@diia-inhouse/utils 4.1.0 → 5.3.0

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 (44) hide show
  1. package/LICENCE.md +59 -59
  2. package/dist/address.js +41 -0
  3. package/dist/address.js.map +1 -0
  4. package/dist/applicationUtils.js +319 -23
  5. package/dist/applicationUtils.js.map +1 -1
  6. package/dist/dictionaries/phoneCodes.js +2443 -0
  7. package/dist/dictionaries/phoneCodes.js.map +1 -0
  8. package/dist/guards.js +25 -0
  9. package/dist/guards.js.map +1 -1
  10. package/dist/index.js +41 -15
  11. package/dist/index.js.map +1 -1
  12. package/dist/interfaces/applicationUtils.js +3 -0
  13. package/dist/interfaces/applicationUtils.js.map +1 -0
  14. package/dist/interfaces/error.js +3 -0
  15. package/dist/interfaces/error.js.map +1 -0
  16. package/dist/interfaces/slack.js +3 -0
  17. package/dist/interfaces/slack.js.map +1 -0
  18. package/dist/phoneticChecker/index.js +6 -4
  19. package/dist/phoneticChecker/index.js.map +1 -1
  20. package/dist/phoneticChecker/metaphone.js +0 -1
  21. package/dist/phoneticChecker/metaphone.js.map +1 -1
  22. package/dist/publicService.js +118 -12
  23. package/dist/publicService.js.map +1 -1
  24. package/dist/random.js +1 -0
  25. package/dist/random.js.map +1 -1
  26. package/dist/session.js.map +1 -1
  27. package/dist/slackFormatting.js +24 -0
  28. package/dist/slackFormatting.js.map +1 -0
  29. package/dist/typeUtils.js +1 -0
  30. package/dist/typeUtils.js.map +1 -1
  31. package/dist/types/address.d.ts +4 -0
  32. package/dist/types/applicationUtils.d.ts +122 -5
  33. package/dist/types/dictionaries/phoneCodes.d.ts +2 -0
  34. package/dist/types/guards.d.ts +4 -1
  35. package/dist/types/index.d.ts +59 -1
  36. package/dist/types/interfaces/applicationUtils.d.ts +1 -0
  37. package/dist/types/interfaces/error.d.ts +7 -0
  38. package/dist/types/interfaces/publicService.d.ts +8 -0
  39. package/dist/types/interfaces/slack.d.ts +3 -0
  40. package/dist/types/phoneticChecker/index.d.ts +3 -2
  41. package/dist/types/publicService.d.ts +51 -3
  42. package/dist/types/random.d.ts +2 -0
  43. package/dist/types/slackFormatting.d.ts +7 -0
  44. package/package.json +34 -51
@@ -6,20 +6,33 @@ export declare class ApplicationUtils {
6
6
  private static camelCaseToDocumentTypeExceptions;
7
7
  private static defaultItnDate;
8
8
  private static defaultFormat;
9
- private static readonly nameDelimiters;
10
9
  private static readonly cyrillicToLatin;
10
+ private static readonly nameComponentsToLowerCase;
11
11
  static documentTypeToCamelCase(documentType: string): string;
12
12
  static camelCaseToDocumentType(camelCaseDocumentType: string): string;
13
13
  static isItnChecksumValid(itn: string): boolean;
14
14
  static getBirthDayFromItn(itn: string): string;
15
15
  static getGenderFromItn(itn: string): Gender;
16
16
  static isItnFormatValid(itn: string): boolean;
17
- static capitalizeName(name: string): string;
17
+ static capitalizeName(name: string | undefined | null): string;
18
18
  static capitalizeFirstLetter(str: string): string;
19
19
  static lowerFirstLetter(str: string): string;
20
20
  static mapCyrillic(value: string): string;
21
21
  static mapLatin(value: string): string;
22
+ /**
23
+ * Validates the Ukrainian IBAN number by format and checksum.
24
+ */
22
25
  static isIbanNumberValid(iban: string): boolean;
26
+ /**
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
+ */
35
+ static extractBankCodeFromIban(iban: string): string;
23
36
  static getStreetName(street: string, streetType: string): string;
24
37
  static toHashedFilesWithSignatures(hashedFiles: HashedFile[], signedItems: SignedItem[]): [HashedFileWithSignature[], string[]];
25
38
  static handleError<T = never>(err: unknown, cb: (err: ApiError) => T): T;
@@ -30,13 +43,19 @@ export declare class ApplicationUtils {
30
43
  * Get age from birth date. Powered by {@link https://moment.github.io/luxon/#/ luxon}
31
44
  *
32
45
  * @param birthDay Input birth date.
33
- * @param format `birthDay` format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Default - 'dd.MM.yyyy'
34
- * @param unitOfTime Unit of time to return. Default - 'years'
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
35
50
  *
36
51
  * @returns Age in years if other `unitOfTime` is not specified
37
52
  * @throws If input date is invalid
38
53
  */
39
- static getAge(birthDay: string, format?: string, unitOfTime?: ToRelativeUnit): number;
54
+ static getAge(birthDay: string, params?: {
55
+ format?: string;
56
+ unitOfTime?: ToRelativeUnit;
57
+ relativeTo?: string;
58
+ }): number;
40
59
  static getFullName(lastName: string, firstName: string, middleName?: string, separator?: string): string;
41
60
  static getShortName(lastName: string, firstName: string, middleName?: string): string;
42
61
  static getUserFullName(user: UserTokenData): string;
@@ -90,6 +109,104 @@ export declare class ApplicationUtils {
90
109
  static isAppVersionMatch(appVersion: string, platformType: PlatformType, appVersions: AppVersions): boolean;
91
110
  static getFileName(name: string, id: string, requestDateTime?: string, postFix?: string): string;
92
111
  static sanitizeString(input: string): string;
112
+ /**
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
+ */
131
+ static pluralizeString(value: number, one: string, few: string, many: string, other?: string, locale?: string): string;
132
+ /**
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
+ */
143
+ static getServiceName(): string;
144
+ /**
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
+ */
153
+ static getServiceVersion(): string;
154
+ /**
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
+ */
164
+ static formatMask(rawData: string, mask: string): string;
165
+ /**
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
+ */
175
+ static memoize<T extends (...args: Parameters<T>) => ReturnType<T>>(fn: T, ttl?: number): T;
176
+ /**
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
+ */
190
+ static encodeValuesWithIterator(data: object | string): object | string;
191
+ /**
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
+ */
205
+ static decodeValuesWithIterator(data: object | string): object | string;
206
+ static removeUnderscoreFields<T>(value: T): T;
93
207
  private static mod97;
94
208
  private static toApiError;
209
+ private static getPackageJson;
210
+ private static processObject;
211
+ private static processValues;
95
212
  }
@@ -0,0 +1,2 @@
1
+ import { InputPhoneCodeItem } from '@diia-inhouse/design-system';
2
+ export declare const phoneCodes: InputPhoneCodeItem[];
@@ -1,9 +1,12 @@
1
1
  import { ApiError } from '@diia-inhouse/errors';
2
- import { AcquirerSession, ActionSession, OnBeforeApplicationShutdown, OnDestroy, OnHealthCheck, OnInit, OnRegistrationsFinished, ServiceEntranceSession, UserSession } from '@diia-inhouse/types';
2
+ import { AcquirerSession, ActionSession, AppUser, EResidentSession, EResidentTokenData, OnBeforeApplicationShutdown, OnDestroy, OnHealthCheck, OnInit, OnRegistrationsFinished, ServiceEntranceSession, UserSession, UserTokenData } from '@diia-inhouse/types';
3
3
  export declare const Guards: {
4
4
  isError(value: unknown): value is Error;
5
5
  apiError(err: Error): err is ApiError;
6
6
  isUserSession(session: ActionSession | undefined): session is UserSession;
7
+ isUser(user: AppUser | undefined): user is UserTokenData;
8
+ isEResidentSession(session: ActionSession | undefined): session is EResidentSession;
9
+ isEResident(user: AppUser | undefined): user is EResidentTokenData;
7
10
  isAcquirerSession(session: ActionSession | undefined): session is AcquirerSession;
8
11
  isServiceEntranceSession(session: ActionSession | undefined): session is ServiceEntranceSession;
9
12
  hasOnInitHook(instance: unknown): instance is OnInit;
@@ -1,9 +1,16 @@
1
+ import { AddressUtils } from './address';
1
2
  import { ApplicationUtils } from './applicationUtils';
3
+ import { NetworkUtils } from './network';
4
+ import { PaymentUtils } from './payment';
5
+ import { SlackFormattingUtils } from './slackFormatting';
2
6
  declare const asserts: import("./interfaces/asserts").AssertsContainer;
3
7
  declare const guards: {
4
8
  isError(value: unknown): value is Error;
5
9
  apiError(err: Error): err is import("@diia-inhouse/errors").ApiError;
6
10
  isUserSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").UserSession;
11
+ isUser(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").UserTokenData;
12
+ isEResidentSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").EResidentSession;
13
+ isEResident(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").EResidentTokenData;
7
14
  isAcquirerSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").AcquirerSession;
8
15
  isServiceEntranceSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").ServiceEntranceSession;
9
16
  hasOnInitHook(instance: unknown): instance is import("@diia-inhouse/types").OnInit;
@@ -21,8 +28,59 @@ export { asserts, guards, utils, pdfUtils };
21
28
  export { TypeUtils } from './typeUtils';
22
29
  export { PaymentUtils } from './payment';
23
30
  export { PublicServiceUtils } from './publicService';
24
- export { phoneticChecker } from './phoneticChecker/index';
31
+ export { phoneticChecker } from './phoneticChecker';
25
32
  export { NetworkUtils } from './network';
26
33
  export { IntegrationUtils } from './integration';
27
34
  export { RandomUtils } from './random';
35
+ export { AddressUtils } from './address';
28
36
  export * from './session';
37
+ export * from './slackFormatting';
38
+ export declare class Utils {
39
+ address: typeof AddressUtils;
40
+ application: typeof ApplicationUtils;
41
+ network: typeof NetworkUtils;
42
+ payment: typeof PaymentUtils;
43
+ slackFormatting: typeof SlackFormattingUtils;
44
+ asserts: import("./interfaces/asserts").AssertsContainer;
45
+ guards: {
46
+ isError(value: unknown): value is Error;
47
+ apiError(err: Error): err is import("@diia-inhouse/errors").ApiError;
48
+ isUserSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").UserSession;
49
+ isUser(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").UserTokenData;
50
+ isEResidentSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").EResidentSession;
51
+ isEResident(user: import("@diia-inhouse/types").AppUser | undefined): user is import("@diia-inhouse/types").EResidentTokenData;
52
+ isAcquirerSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").AcquirerSession;
53
+ isServiceEntranceSession(session: import("@diia-inhouse/types").ActionSession | undefined): session is import("@diia-inhouse/types").ServiceEntranceSession;
54
+ hasOnInitHook(instance: unknown): instance is import("@diia-inhouse/types").OnInit;
55
+ hasOnHealthCheckHook(instance: unknown): instance is import("@diia-inhouse/types").OnHealthCheck;
56
+ hasOnDestroyHook(instance: unknown): instance is import("@diia-inhouse/types").OnDestroy;
57
+ hasOnRegistrationsFinishedHook(instance: unknown): instance is import("@diia-inhouse/types").OnRegistrationsFinished;
58
+ hasOnBeforeApplicationShutdownHook(instance: unknown): instance is import("@diia-inhouse/types").OnBeforeApplicationShutdown;
59
+ isSettledError(value: PromiseSettledResult<unknown>): value is PromiseRejectedResult;
60
+ };
61
+ integration: {
62
+ getRetryDelay(retry: number, timeLeft: number, initDelay: number, maxDelay: number, multiplier: number): number;
63
+ };
64
+ pdf: {
65
+ getPdfFileName(name: string, id: string, requestDateTime?: string): string;
66
+ };
67
+ publicService: {
68
+ getContacts(user: import("@diia-inhouse/types").UserTokenData): import("@diia-inhouse/design-system").ContactsResponse;
69
+ getContactsText(user: import("@diia-inhouse/types").UserTokenData): string;
70
+ getContactsComponent(user: import("@diia-inhouse/types").UserTokenData, inputCode?: string): import("@diia-inhouse/design-system").DSBodyItem;
71
+ getInputPhoneCodeOrg(params: import("./interfaces/publicService").InputPhoneCodeOrgParams): import("@diia-inhouse/design-system").InputPhoneCodeOrg;
72
+ getInputPhoneCodeItems(filter?: string[]): import("@diia-inhouse/design-system").InputPhoneCodeItem[];
73
+ getEmailInputTextMlc(emailValue: string, inputCode?: string): import("@diia-inhouse/design-system").InputTextMlc;
74
+ getContactsComponentTextLabel(user: import("@diia-inhouse/types").UserTokenData, phoneNumber: string): import("@diia-inhouse/design-system").TextLabelMlc | undefined;
75
+ extractPhoneNumber(phoneNumber: string, phoneCodeValue: string): string | never;
76
+ };
77
+ random: {
78
+ generateUUID: typeof import("node:crypto").randomUUID;
79
+ getRandomIntsString(length?: number): string;
80
+ };
81
+ type: {
82
+ isObject(value: any): boolean;
83
+ isArray(value: any): boolean;
84
+ isBuffer(value: any): boolean;
85
+ };
86
+ }
@@ -0,0 +1 @@
1
+ export type ProcessObjectCallback = (value: string) => string;
@@ -0,0 +1,7 @@
1
+ import { ErrorData, ErrorType } from '@diia-inhouse/errors';
2
+ export type OriginError = Error & {
3
+ code?: number;
4
+ data?: ErrorData;
5
+ type?: ErrorType;
6
+ keyValue?: unknown;
7
+ };
@@ -5,3 +5,11 @@ export declare enum AuthProviderName {
5
5
  BankId = "bankid",
6
6
  Nfc = "nfc"
7
7
  }
8
+ export interface InputPhoneCodeOrgParams {
9
+ inputCode?: string;
10
+ phoneValue?: string;
11
+ codeValueId?: string;
12
+ codeIds?: string[];
13
+ hint?: string;
14
+ codeValueIsEditable?: boolean;
15
+ }
@@ -0,0 +1,3 @@
1
+ export interface GetListValueOptions {
2
+ isError?: boolean;
3
+ }
@@ -1,6 +1,7 @@
1
1
  declare class PhoneticChecker {
2
- getEqualityCoefficient(etalonValue: string, slaveValue: string): number;
3
- private getLevenshteinDistance;
2
+ private equalityCoefficientThreshold;
3
+ arePhoneticallySimilar(etalonValue: string, slaveValue: string, threshold?: number): boolean;
4
+ private getEqualityCoefficient;
4
5
  }
5
6
  export declare const phoneticChecker: PhoneticChecker;
6
7
  export {};
@@ -1,7 +1,55 @@
1
- import { ContactsResponse, NavigationPanel, PlatformAppVersion, PublicServiceContextMenu, PublicServiceSettings, UserTokenData } from '@diia-inhouse/types';
1
+ import { ContactsResponse, DSBodyItem, InputPhoneCodeItem, InputPhoneCodeOrg, InputTextMlc, TextLabelMlc } from '@diia-inhouse/design-system';
2
+ import { UserTokenData } from '@diia-inhouse/types';
3
+ import { InputPhoneCodeOrgParams } from './interfaces/publicService';
2
4
  export declare const PublicServiceUtils: {
3
5
  getContacts(user: UserTokenData): ContactsResponse;
4
6
  getContactsText(user: UserTokenData): string;
5
- extractContextMenu(settings: PublicServiceSettings, appVersion: PlatformAppVersion | undefined): PublicServiceContextMenu[] | undefined;
6
- extractNavigationPanel(settings: PublicServiceSettings, appVersion: PlatformAppVersion | undefined, header?: string): NavigationPanel | undefined;
7
+ getContactsComponent(user: UserTokenData, inputCode?: string): DSBodyItem;
8
+ /**
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
+ */
22
+ getInputPhoneCodeOrg(params: InputPhoneCodeOrgParams): InputPhoneCodeOrg;
23
+ /**
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
+ */
35
+ getInputPhoneCodeItems(filter?: string[]): InputPhoneCodeItem[];
36
+ getEmailInputTextMlc(emailValue: string, inputCode?: string): InputTextMlc;
37
+ getContactsComponentTextLabel(user: UserTokenData, phoneNumber: string): TextLabelMlc | undefined;
38
+ /**
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
+ */
54
+ extractPhoneNumber(phoneNumber: string, phoneCodeValue: string): string | never;
7
55
  };
@@ -1,3 +1,5 @@
1
+ import { randomUUID } from 'node:crypto';
1
2
  export declare const RandomUtils: {
3
+ generateUUID: typeof randomUUID;
2
4
  getRandomIntsString(length?: number): string;
3
5
  };
@@ -0,0 +1,7 @@
1
+ import type { RichTextElement, RichTextEmoji } from '@slack/types';
2
+ import { GetListValueOptions } from './interfaces/slack';
3
+ export declare class SlackFormattingUtils {
4
+ readonly greenCircleEmoji: RichTextEmoji;
5
+ readonly redCircleEmoji: RichTextEmoji;
6
+ getValue(name: string, value: string | number | undefined, { isError }?: GetListValueOptions): RichTextElement[];
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diia-inhouse/utils",
3
- "version": "4.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "Generic utils",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -11,30 +11,32 @@
11
11
  "dist"
12
12
  ],
13
13
  "engines": {
14
- "node": ">=20"
14
+ "node": ">=22"
15
15
  },
16
16
  "scripts": {
17
17
  "prebuild": "rimraf dist",
18
18
  "build": "tsc",
19
19
  "semantic-release": "semantic-release",
20
- "start": "npm run build && node dist/index.js",
21
- "lint": "eslint --ext .ts . && prettier --check .",
22
- "lint-fix": "eslint '*/**/*.{js,ts}' --fix && prettier --write .",
20
+ "lint": "eslint . && prettier --check .",
21
+ "lint-fix": "eslint --fix . && prettier --write .",
23
22
  "lint:lockfile": "lockfile-lint --path package-lock.json --allowed-hosts registry.npmjs.org --validate-https",
24
23
  "prepare": "npm run build",
25
- "test": "jest",
26
- "test:unit": "npm run test --selectProjects unit --",
27
- "test:coverage": "npm run test --selectProjects unit --coverage",
24
+ "test": "tsc --project tests/tsconfig.json --noEmit && vitest run",
25
+ "test:watch": "vitest watch",
28
26
  "find-circulars": "madge --circular --extensions ts ./"
29
27
  },
30
28
  "dependencies": {
31
- "@types/luxon": "3.4.2",
32
- "bson": "6.2.0",
29
+ "@diia-inhouse/design-system": "3.0.2",
30
+ "@types/luxon": "3.7.1",
31
+ "bson": "7.2.0",
33
32
  "compare-versions": "6.1.1",
33
+ "design-system": "2.5.0",
34
34
  "fast-levenshtein": "3.0.0",
35
- "lodash": "4.17.21",
36
- "luxon": "3.5.0",
37
- "moment": "2.30.1"
35
+ "lodash": "4.17.23",
36
+ "luxon": "3.7.2",
37
+ "map-age-cleaner": "0.2.0",
38
+ "moment": "2.30.1",
39
+ "type-fest": "4.41.0"
38
40
  },
39
41
  "peerDependencies": {
40
42
  "@diia-inhouse/errors": ">=1.4.1",
@@ -42,52 +44,33 @@
42
44
  "@diia-inhouse/validators": ">=1.5.0"
43
45
  },
44
46
  "devDependencies": {
45
- "@diia-inhouse/configs": "2.2.0",
46
- "@diia-inhouse/errors": "1.10.0",
47
- "@diia-inhouse/eslint-config": "5.1.0",
48
- "@diia-inhouse/test": "6.4.0",
49
- "@diia-inhouse/types": "6.50.0",
50
- "@diia-inhouse/validators": "1.17.0",
47
+ "@diia-inhouse/configs": "6.1.1",
48
+ "@diia-inhouse/errors": "1.17.0",
49
+ "@diia-inhouse/eslint-config": "8.2.4",
50
+ "@diia-inhouse/test": "7.2.0",
51
+ "@diia-inhouse/types": "11.3.0",
52
+ "@diia-inhouse/validators": "1.28.0",
53
+ "@slack/types": "2.20.0",
51
54
  "@types/fast-levenshtein": "0.0.4",
52
- "@types/lodash": "4.17.7",
53
- "@types/node": "22.1.0",
54
- "@typescript-eslint/typescript-estree": "7.0.1",
55
- "lockfile-lint": "4.14.0",
55
+ "@types/lodash": "4.17.24",
56
+ "@types/node": "25.3.3",
57
+ "@vitest/coverage-v8": "4.0.18",
58
+ "@vitest/ui": "4.0.18",
59
+ "eslint": "9.39.3",
60
+ "lockfile-lint": "4.14.1",
56
61
  "madge": "8.0.0",
57
- "protobufjs": "7.2.6",
58
- "rimraf": "6.0.1"
62
+ "protobufjs": "7.5.4",
63
+ "rimraf": "6.1.3",
64
+ "typescript": "5.9.3",
65
+ "vite-tsconfig-paths": "6.1.1",
66
+ "vitest": "4.0.18"
59
67
  },
60
68
  "release": {
61
- "extends": "@diia-inhouse/configs/dist/semantic-release/package",
62
- "branches": [
63
- "main"
64
- ]
69
+ "extends": "@diia-inhouse/configs/dist/semantic-release/package"
65
70
  },
66
71
  "commitlint": {
67
72
  "extends": "@diia-inhouse/configs/dist/commitlint"
68
73
  },
69
- "eslintConfig": {
70
- "extends": "@diia-inhouse/eslint-config",
71
- "rules": {
72
- "@typescript-eslint/no-explicit-any": "warn"
73
- },
74
- "overrides": [
75
- {
76
- "files": [
77
- "*.ts"
78
- ],
79
- "parserOptions": {
80
- "project": [
81
- "./tsconfig.json",
82
- "./tests/tsconfig.json"
83
- ]
84
- }
85
- }
86
- ]
87
- },
88
- "jest": {
89
- "preset": "@diia-inhouse/configs/dist/jest"
90
- },
91
74
  "prettier": "@diia-inhouse/eslint-config/prettier",
92
75
  "madge": {
93
76
  "tsConfig": "./tsconfig.json"