@cobre-npm/library-portal-core 0.67.0 → 0.68.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 (56) hide show
  1. package/README.md +21 -2
  2. package/dist/cjs/accounts/status/utils/account-status.utils.d.ts +4 -1
  3. package/dist/cjs/accounts/status/utils/account-status.utils.js +6 -7
  4. package/dist/cjs/accounts/types/utils/account-type.utils.d.ts +4 -1
  5. package/dist/cjs/accounts/types/utils/account-type.utils.js +6 -11
  6. package/dist/cjs/blockchains/utils/blockchain.utils.d.ts +4 -1
  7. package/dist/cjs/blockchains/utils/blockchain.utils.js +6 -7
  8. package/dist/cjs/canonicalTransactions/nature/utils/nature.utils.d.ts +4 -1
  9. package/dist/cjs/canonicalTransactions/nature/utils/nature.utils.js +4 -6
  10. package/dist/cjs/canonicalTransactions/productType/utils/product-type.utils.d.ts +4 -1
  11. package/dist/cjs/canonicalTransactions/productType/utils/product-type.utils.js +4 -6
  12. package/dist/cjs/counterparties/types/utils/counterparty-type.utils.d.ts +4 -1
  13. package/dist/cjs/counterparties/types/utils/counterparty-type.utils.js +6 -7
  14. package/dist/cjs/countries/base/utils/country.utils.d.ts +4 -1
  15. package/dist/cjs/countries/base/utils/country.utils.js +6 -7
  16. package/dist/cjs/countries/iso/utils/country-iso.utils.d.ts +4 -1
  17. package/dist/cjs/countries/iso/utils/country-iso.utils.js +6 -7
  18. package/dist/cjs/documentTypes/utils/document-type.utils.d.ts +4 -1
  19. package/dist/cjs/documentTypes/utils/document-type.utils.js +7 -11
  20. package/dist/cjs/filterClassification/categoryFamilies/utils/filter-classification-category-family.utils.d.ts +4 -1
  21. package/dist/cjs/filterClassification/categoryFamilies/utils/filter-classification-category-family.utils.js +4 -6
  22. package/dist/cjs/filterClassification/sections/utils/filter-classification-section.utils.d.ts +4 -1
  23. package/dist/cjs/filterClassification/sections/utils/filter-classification-section.utils.js +4 -7
  24. package/dist/cjs/financialInstitutions/utils/financial-institution.utils.d.ts +6 -3
  25. package/dist/cjs/financialInstitutions/utils/financial-institution.utils.js +11 -7
  26. package/dist/cjs/lang/index.d.ts +8 -0
  27. package/dist/cjs/lang/index.js +11 -1
  28. package/dist/cjs/movements/status/utils/movement-status.utils.d.ts +4 -1
  29. package/dist/cjs/movements/status/utils/movement-status.utils.js +5 -6
  30. package/dist/cjs/movements/types/utils/movement-type.utils.d.ts +4 -1
  31. package/dist/cjs/movements/types/utils/movement-type.utils.js +5 -6
  32. package/dist/cjs/subclients/status/utils/subclient-status.utils.d.ts +4 -1
  33. package/dist/cjs/subclients/status/utils/subclient-status.utils.js +4 -6
  34. package/dist/cjs/transactions/types/utils/transaction-type.utils.d.ts +4 -1
  35. package/dist/cjs/transactions/types/utils/transaction-type.utils.js +5 -10
  36. package/dist/cjs/utils/catalog-label.utils.d.ts +8 -0
  37. package/dist/cjs/utils/catalog-label.utils.js +2 -0
  38. package/dist/esm/accounts/status/utils/account-status.utils.js +3 -4
  39. package/dist/esm/accounts/types/utils/account-type.utils.js +3 -8
  40. package/dist/esm/blockchains/utils/blockchain.utils.js +3 -4
  41. package/dist/esm/canonicalTransactions/nature/utils/nature.utils.js +3 -4
  42. package/dist/esm/canonicalTransactions/productType/utils/product-type.utils.js +3 -4
  43. package/dist/esm/counterparties/types/utils/counterparty-type.utils.js +3 -4
  44. package/dist/esm/countries/base/utils/country.utils.js +3 -4
  45. package/dist/esm/countries/iso/utils/country-iso.utils.js +3 -4
  46. package/dist/esm/documentTypes/utils/document-type.utils.js +4 -8
  47. package/dist/esm/filterClassification/categoryFamilies/utils/filter-classification-category-family.utils.js +3 -4
  48. package/dist/esm/filterClassification/sections/utils/filter-classification-section.utils.js +3 -5
  49. package/dist/esm/financialInstitutions/utils/financial-institution.utils.js +9 -5
  50. package/dist/esm/lang/index.js +9 -0
  51. package/dist/esm/movements/status/utils/movement-status.utils.js +3 -4
  52. package/dist/esm/movements/types/utils/movement-type.utils.js +3 -4
  53. package/dist/esm/subclients/status/utils/subclient-status.utils.js +3 -4
  54. package/dist/esm/transactions/types/utils/transaction-type.utils.js +3 -8
  55. package/dist/esm/utils/catalog-label.utils.js +1 -0
  56. package/package.json +1 -1
package/README.md CHANGED
@@ -55,7 +55,7 @@ import { getCountries } from "@cobre-npm/library-portal-core/countries"
55
55
  | `@cobre-npm/library-portal-core/trustedSessions` | Trusted session (OTP elevation window) interfaces + constants |
56
56
  | `@cobre-npm/library-portal-core/exports` | Export request/response entity + the engine's format/operator allow-lists |
57
57
  | `@cobre-npm/library-portal-core/financialInstitutions` | Financial institutions (banks) by country, with labels |
58
- | `@cobre-npm/library-portal-core/lang` | Supported locales (`Locale`, defaults) |
58
+ | `@cobre-npm/library-portal-core/lang` | Supported locales (`Locale`, defaults) and `toSupportedLocale` |
59
59
  | `@cobre-npm/library-portal-core` (root) | ⚠️ **Legacy / deprecated** — see [below](#legacy-code--and-its-deprecation) |
60
60
 
61
61
  ---
@@ -125,6 +125,7 @@ Every use case comes out of this, without the consumer having to walk internal s
125
125
 
126
126
  | I need… | How |
127
127
  |---|---|
128
+ | A code or its metadata, no text (compare, filter, send to an API) | `getX()[code].code` — no language |
128
129
  | The label of a code | `getX(lang)[code].label` |
129
130
  | The full list (dropdown, table) | `Object.values(getX(lang))` |
130
131
  | Filter by some property | `Object.values(getX(lang)).filter(x => …)` |
@@ -155,12 +156,30 @@ one-off predicates even where `queryX()` exists.
155
156
 
156
157
  `currencies`/`providers` **don't take `lang`** because there's no translation — the signature is honest.
157
158
 
159
+ **An i18n getter can also be called without `lang`**, and then it returns the same records **with no `label`**:
160
+
161
+ ```ts
162
+ getAccountStatuses().connected.code // "connected" → codes and metadata, no language needed
163
+ getAccountStatuses().connected.label // ✗ compile error: without a language there is no text
164
+ getAccountStatuses("en").connected.label // "Connected"
165
+ ```
166
+
167
+ Use it where only codes are read — module-level constants, filters sent to an API — instead of passing a
168
+ placeholder language. Without a language there is no label, so text in the wrong language cannot leak out.
169
+ `ReturnType<typeof getX>` still resolves to the labeled shape (the overload with `lang` is declared last).
170
+
171
+ The active language rarely arrives as a library literal (`en-US` from the browser, a user preference saved
172
+ unvalidated). Narrow it once with `toSupportedLocale(value)` from `/lang` — an exact `Locale` passes through,
173
+ anything else falls back to `es-mex` — before handing it to any `getX(lang)` / `queryX({ lang })`.
174
+
158
175
  ### Type convention
159
176
 
160
177
  - **`XOption`** = the catalog record **+ `label`** (what `getX(lang)` returns in i18n domains). This is the type
161
178
  consumers use to type results.
162
179
  - **`XRecord`** = the raw record. In non-i18n domains (currencies/providers) it is the result type
163
180
  (the label is already inline); in i18n domains it is **internal** (only input to `XOption`) and is not exported.
181
+ `getX()` without `lang` in an i18n domain is typed `WithoutLabel<XOption>` (a distributive `Omit`, so fields only
182
+ some records carry, like `filterDisplay`, survive), and `XRecord` stays internal.
164
183
  - **`X`** (e.g. `AccountType`, `Currency`) = the union of codes. Always public (for typing variables/params).
165
184
 
166
185
  ---
@@ -561,7 +580,7 @@ options.filter(isGroupOption) // only the group opt
561
580
  - **Family** (`FilterClassificationCategoryFamily`): the chips of the grouped type filter, in chip order: `payments`, `collections`,
562
581
  `international`, `conversions`, `top_up`, `between_accounts` and `unclassified`. Each family lists the
563
582
  `categories` it groups, and a category belongs to exactly one family (`adjustment` and `reward` fold into
564
- `between_accounts`). `getFilterClassificationCategoryFamilies(lang)` returns each family with its label and categories; `lang` is required.
583
+ `between_accounts`). `getFilterClassificationCategoryFamilies(lang)` returns each family with its label and categories; without `lang`, the same families with no label.
565
584
  - **Category** (`FilterClassificationCategory`): derived from the families' lists: `payments`, `collections`, `conversions`,
566
585
  `international`, `between_accounts`, `top_up`, `adjustment`, `reward`, `unclassified`. The family is never stored
567
586
  per record: group types by family with `getFilterClassificationCategoryFamilies(lang)[family].categories.includes(type.category)`.
@@ -1,10 +1,13 @@
1
1
  import type { AccountStatus, AccountStatusRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
3
  import type { CatalogQuery } from "../../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
4
5
  export type AccountStatusOption = AccountStatusRecord & {
5
6
  label: string;
6
7
  };
7
- export declare const getAccountStatuses: (lang: Locale) => Record<AccountStatus, AccountStatusOption>;
8
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
9
+ export declare function getAccountStatuses(): Record<AccountStatus, WithoutLabel<AccountStatusOption>>;
10
+ export declare function getAccountStatuses(lang: Locale): Record<AccountStatus, AccountStatusOption>;
8
11
  /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
9
12
  export type AccountStatusQuery = CatalogQuery<AccountStatusRecord> & {
10
13
  lang: Locale;
@@ -3,25 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.queryAccountStatuses = exports.getAccountStatuses = void 0;
6
+ exports.queryAccountStatuses = void 0;
7
+ exports.getAccountStatuses = getAccountStatuses;
7
8
  const catalog_1 = require("../catalog");
8
9
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
10
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
11
  const catalog_query_utils_1 = require("../../../utils/catalog-query.utils");
11
12
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
- const getAccountStatuses = (lang) => {
13
- const locale = locales[lang];
13
+ function getAccountStatuses(...args) {
14
14
  const result = {};
15
15
  for (const record of Object.values(catalog_1.ACCOUNT_STATUSES)) {
16
- result[record.code] = { ...record, label: locale.accountStatuses[record.code] };
16
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].accountStatuses[record.code] };
17
17
  }
18
18
  return result;
19
- };
20
- exports.getAccountStatuses = getAccountStatuses;
19
+ }
21
20
  /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
22
21
  const queryAccountStatuses = (query) => {
23
22
  const { lang, ...criteria } = query;
24
- const statuses = (0, exports.getAccountStatuses)(lang);
23
+ const statuses = getAccountStatuses(lang);
25
24
  return Object.values(statuses).filter(status => (0, catalog_query_utils_1.matchesQuery)(status, criteria));
26
25
  };
27
26
  exports.queryAccountStatuses = queryAccountStatuses;
@@ -1,14 +1,17 @@
1
1
  import type { AccountType, AccountTypeRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
3
  import type { CatalogQuery } from "../../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
4
5
  export type AccountTypeOption = AccountTypeRecord & {
5
6
  label: string;
6
7
  };
8
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
9
+ export declare function getAccountTypes(): Record<AccountType, WithoutLabel<AccountTypeOption>>;
7
10
  /**
8
11
  * The catalog indexed by code (same shape as ACCOUNT_TYPES), each record enriched
9
12
  * with its label for the given language. Access by code directly, or Object.values for a list.
10
13
  */
11
- export declare const getAccountTypes: (lang: Locale) => Record<AccountType, AccountTypeOption>;
14
+ export declare function getAccountTypes(lang: Locale): Record<AccountType, AccountTypeOption>;
12
15
  /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
13
16
  export type AccountTypeQuery = CatalogQuery<AccountTypeRecord> & {
14
17
  lang: Locale;
@@ -3,29 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.queryAccountTypes = exports.getAccountTypes = void 0;
6
+ exports.queryAccountTypes = void 0;
7
+ exports.getAccountTypes = getAccountTypes;
7
8
  const catalog_1 = require("../catalog");
8
9
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
10
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
11
  const catalog_query_utils_1 = require("../../../utils/catalog-query.utils");
11
12
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
- /**
13
- * The catalog indexed by code (same shape as ACCOUNT_TYPES), each record enriched
14
- * with its label for the given language. Access by code directly, or Object.values for a list.
15
- */
16
- const getAccountTypes = (lang) => {
17
- const locale = locales[lang];
13
+ function getAccountTypes(...args) {
18
14
  const result = {};
19
15
  for (const record of Object.values(catalog_1.ACCOUNT_TYPES)) {
20
- result[record.code] = { ...record, label: locale.accountTypes[record.code] };
16
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].accountTypes[record.code] };
21
17
  }
22
18
  return result;
23
- };
24
- exports.getAccountTypes = getAccountTypes;
19
+ }
25
20
  /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
26
21
  const queryAccountTypes = (query) => {
27
22
  const { lang, ...criteria } = query;
28
- const types = (0, exports.getAccountTypes)(lang);
23
+ const types = getAccountTypes(lang);
29
24
  return Object.values(types).filter(type => (0, catalog_query_utils_1.matchesQuery)(type, criteria));
30
25
  };
31
26
  exports.queryAccountTypes = queryAccountTypes;
@@ -1,10 +1,13 @@
1
1
  import type { Blockchain, BlockchainRecord } from "../catalog";
2
2
  import type { Locale } from "../../lang";
3
3
  import type { CatalogQuery } from "../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../utils/catalog-label.utils";
4
5
  export type BlockchainOption = BlockchainRecord & {
5
6
  label: string;
6
7
  };
7
- export declare const getBlockchains: (lang: Locale) => Record<Blockchain, BlockchainOption>;
8
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
9
+ export declare function getBlockchains(): Record<Blockchain, WithoutLabel<BlockchainOption>>;
10
+ export declare function getBlockchains(lang: Locale): Record<Blockchain, BlockchainOption>;
8
11
  /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
9
12
  export type BlockchainQuery = CatalogQuery<BlockchainRecord> & {
10
13
  lang: Locale;
@@ -3,25 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.queryBlockchains = exports.getBlockchains = void 0;
6
+ exports.queryBlockchains = void 0;
7
+ exports.getBlockchains = getBlockchains;
7
8
  const catalog_1 = require("../catalog");
8
9
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
10
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
11
  const catalog_query_utils_1 = require("../../utils/catalog-query.utils");
11
12
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
- const getBlockchains = (lang) => {
13
- const locale = locales[lang];
13
+ function getBlockchains(...args) {
14
14
  const result = {};
15
15
  for (const record of Object.values(catalog_1.BLOCKCHAINS)) {
16
- result[record.code] = { ...record, label: locale.blockchains[record.code] };
16
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].blockchains[record.code] };
17
17
  }
18
18
  return result;
19
- };
20
- exports.getBlockchains = getBlockchains;
19
+ }
21
20
  /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
22
21
  const queryBlockchains = (query) => {
23
22
  const { lang, ...criteria } = query;
24
- const blockchains = (0, exports.getBlockchains)(lang);
23
+ const blockchains = getBlockchains(lang);
25
24
  return Object.values(blockchains).filter(blockchain => (0, catalog_query_utils_1.matchesQuery)(blockchain, criteria));
26
25
  };
27
26
  exports.queryBlockchains = queryBlockchains;
@@ -1,6 +1,9 @@
1
1
  import type { Nature, NatureRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
3
4
  export type NatureOption = NatureRecord & {
4
5
  label: string;
5
6
  };
6
- export declare const getNatures: (lang: Locale) => Record<Nature, NatureOption>;
7
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
8
+ export declare function getNatures(): Record<Nature, WithoutLabel<NatureOption>>;
9
+ export declare function getNatures(lang: Locale): Record<Nature, NatureOption>;
@@ -3,17 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getNatures = void 0;
6
+ exports.getNatures = getNatures;
7
7
  const catalog_1 = require("../catalog");
8
8
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
9
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
10
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
11
- const getNatures = (lang) => {
12
- const locale = locales[lang];
11
+ function getNatures(...args) {
13
12
  const result = {};
14
13
  for (const record of Object.values(catalog_1.NATURES)) {
15
- result[record.code] = { ...record, label: locale.natures[record.code] };
14
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].natures[record.code] };
16
15
  }
17
16
  return result;
18
- };
19
- exports.getNatures = getNatures;
17
+ }
@@ -1,6 +1,9 @@
1
1
  import type { ProductType, ProductTypeRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
3
4
  export type ProductTypeOption = ProductTypeRecord & {
4
5
  label: string;
5
6
  };
6
- export declare const getProductTypes: (lang: Locale) => Record<ProductType, ProductTypeOption>;
7
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
8
+ export declare function getProductTypes(): Record<ProductType, WithoutLabel<ProductTypeOption>>;
9
+ export declare function getProductTypes(lang: Locale): Record<ProductType, ProductTypeOption>;
@@ -3,17 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getProductTypes = void 0;
6
+ exports.getProductTypes = getProductTypes;
7
7
  const catalog_1 = require("../catalog");
8
8
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
9
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
10
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
11
- const getProductTypes = (lang) => {
12
- const locale = locales[lang];
11
+ function getProductTypes(...args) {
13
12
  const result = {};
14
13
  for (const record of Object.values(catalog_1.PRODUCT_TYPES)) {
15
- result[record.code] = { ...record, label: locale.productTypes[record.code] };
14
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].productTypes[record.code] };
16
15
  }
17
16
  return result;
18
- };
19
- exports.getProductTypes = getProductTypes;
17
+ }
@@ -1,10 +1,13 @@
1
1
  import type { CounterpartyType, CounterpartyTypeRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
3
  import type { CatalogQuery } from "../../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
4
5
  export type CounterpartyTypeOption = CounterpartyTypeRecord & {
5
6
  label: string;
6
7
  };
7
- export declare const getCounterpartyTypes: (lang: Locale) => Record<CounterpartyType, CounterpartyTypeOption>;
8
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
9
+ export declare function getCounterpartyTypes(): Record<CounterpartyType, WithoutLabel<CounterpartyTypeOption>>;
10
+ export declare function getCounterpartyTypes(lang: Locale): Record<CounterpartyType, CounterpartyTypeOption>;
8
11
  /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
9
12
  export type CounterpartyTypeQuery = CatalogQuery<CounterpartyTypeRecord> & {
10
13
  lang: Locale;
@@ -3,25 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.queryCounterpartyTypes = exports.getCounterpartyTypes = void 0;
6
+ exports.queryCounterpartyTypes = void 0;
7
+ exports.getCounterpartyTypes = getCounterpartyTypes;
7
8
  const catalog_1 = require("../catalog");
8
9
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
10
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
11
  const catalog_query_utils_1 = require("../../../utils/catalog-query.utils");
11
12
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
- const getCounterpartyTypes = (lang) => {
13
- const locale = locales[lang];
13
+ function getCounterpartyTypes(...args) {
14
14
  const result = {};
15
15
  for (const record of Object.values(catalog_1.COUNTERPARTY_TYPES)) {
16
- result[record.code] = { ...record, label: locale.counterpartyTypes[record.code] };
16
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].counterpartyTypes[record.code] };
17
17
  }
18
18
  return result;
19
- };
20
- exports.getCounterpartyTypes = getCounterpartyTypes;
19
+ }
21
20
  /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
22
21
  const queryCounterpartyTypes = (query) => {
23
22
  const { lang, ...criteria } = query;
24
- const types = (0, exports.getCounterpartyTypes)(lang);
23
+ const types = getCounterpartyTypes(lang);
25
24
  return Object.values(types).filter(type => (0, catalog_query_utils_1.matchesQuery)(type, criteria));
26
25
  };
27
26
  exports.queryCounterpartyTypes = queryCounterpartyTypes;
@@ -1,10 +1,13 @@
1
1
  import type { Country, CountryRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
3
  import type { CatalogQuery } from "../../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
4
5
  export type CountryOption = CountryRecord & {
5
6
  label: string;
6
7
  };
7
- export declare const getCountries: (lang: Locale) => Record<Country, CountryOption>;
8
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
9
+ export declare function getCountries(): Record<Country, WithoutLabel<CountryOption>>;
10
+ export declare function getCountries(lang: Locale): Record<Country, CountryOption>;
8
11
  /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
9
12
  export type CountryQuery = CatalogQuery<CountryRecord> & {
10
13
  lang: Locale;
@@ -3,25 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.queryCountries = exports.getCountries = void 0;
6
+ exports.queryCountries = void 0;
7
+ exports.getCountries = getCountries;
7
8
  const catalog_1 = require("../catalog");
8
9
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
10
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
11
  const catalog_query_utils_1 = require("../../../utils/catalog-query.utils");
11
12
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
- const getCountries = (lang) => {
13
- const locale = locales[lang];
13
+ function getCountries(...args) {
14
14
  const result = {};
15
15
  for (const record of Object.values(catalog_1.COUNTRIES)) {
16
- result[record.code] = { ...record, label: locale.countries[record.code] };
16
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].countries[record.code] };
17
17
  }
18
18
  return result;
19
- };
20
- exports.getCountries = getCountries;
19
+ }
21
20
  /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
22
21
  const queryCountries = (query) => {
23
22
  const { lang, ...criteria } = query;
24
- const countries = (0, exports.getCountries)(lang);
23
+ const countries = getCountries(lang);
25
24
  return Object.values(countries).filter(country => (0, catalog_query_utils_1.matchesQuery)(country, criteria));
26
25
  };
27
26
  exports.queryCountries = queryCountries;
@@ -1,6 +1,7 @@
1
1
  import type { CountryISO, CountryISORecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
3
  import type { CatalogQuery } from "../../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
4
5
  export declare const hasCountryISOFlag: (code: CountryISO) => boolean;
5
6
  export type CountryISOOption = CountryISORecord & {
6
7
  label: string;
@@ -12,7 +13,9 @@ export interface IndicativeWithCode {
12
13
  country: string;
13
14
  isoCode: string | undefined;
14
15
  }
15
- export declare const getCountriesISO: (lang: Locale) => Record<CountryISO, CountryISOOption>;
16
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
17
+ export declare function getCountriesISO(): Record<CountryISO, WithoutLabel<CountryISOOption>>;
18
+ export declare function getCountriesISO(lang: Locale): Record<CountryISO, CountryISOOption>;
16
19
  /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
17
20
  export type CountryISOQuery = CatalogQuery<CountryISORecord> & {
18
21
  lang: Locale;
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getIndicativesWithCodes = exports.queryCountriesISO = exports.getCountriesISO = exports.hasCountryISOFlag = void 0;
6
+ exports.getIndicativesWithCodes = exports.queryCountriesISO = exports.hasCountryISOFlag = void 0;
7
+ exports.getCountriesISO = getCountriesISO;
7
8
  const catalog_1 = require("../catalog");
8
9
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
10
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
@@ -12,19 +13,17 @@ const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
13
  const AVAILABLE_FLAG_CODES = new Set(["col", "mex", "usa"]);
13
14
  const hasCountryISOFlag = (code) => AVAILABLE_FLAG_CODES.has(code);
14
15
  exports.hasCountryISOFlag = hasCountryISOFlag;
15
- const getCountriesISO = (lang) => {
16
- const locale = locales[lang];
16
+ function getCountriesISO(...args) {
17
17
  const result = {};
18
18
  for (const record of Object.values(catalog_1.COUNTRIES_ISO)) {
19
- result[record.code] = { ...record, label: locale.countriesISO[record.code] };
19
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].countriesISO[record.code] };
20
20
  }
21
21
  return result;
22
- };
23
- exports.getCountriesISO = getCountriesISO;
22
+ }
24
23
  /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
25
24
  const queryCountriesISO = (query) => {
26
25
  const { lang, ...criteria } = query;
27
- const countries = (0, exports.getCountriesISO)(lang);
26
+ const countries = getCountriesISO(lang);
28
27
  return Object.values(countries).filter(country => (0, catalog_query_utils_1.matchesQuery)(country, criteria));
29
28
  };
30
29
  exports.queryCountriesISO = queryCountriesISO;
@@ -1,6 +1,7 @@
1
1
  import type { DocumentType, DocumentTypeGeo, DocumentTypeRecord, DocumentTypeUsage } from "../catalog";
2
2
  import type { Locale } from "../../lang";
3
3
  import type { CatalogQuery } from "../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../utils/catalog-label.utils";
4
5
  type DocumentTypeValidation = Omit<DocumentTypeRecord, "geo">;
5
6
  export type DocumentTypeOption = DocumentTypeValidation & {
6
7
  label: string;
@@ -12,11 +13,13 @@ type DocumentTypeGeoRecord = DocumentTypeValidation & {
12
13
  export type DocumentTypeGeoOption = DocumentTypeGeoRecord & {
13
14
  label: string;
14
15
  };
16
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
17
+ export declare function getDocumentTypes(): Record<DocumentType, WithoutLabel<DocumentTypeOption>>;
15
18
  /**
16
19
  * Documents indexed by code (definition + label). For the unique list (Object.values),
17
20
  * validation ([code].minLength / maxLength / type) and label ([code].label).
18
21
  */
19
- export declare const getDocumentTypes: (lang: Locale) => Record<DocumentType, DocumentTypeOption>;
22
+ export declare function getDocumentTypes(lang: Locale): Record<DocumentType, DocumentTypeOption>;
20
23
  /** i18n domain: `lang` is required, inside the query object — see matchesQuery for the matching rules. */
21
24
  export type DocumentTypeQuery = CatalogQuery<DocumentTypeGeoRecord> & {
22
25
  lang: Locale;
@@ -3,25 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getDocumentTypesByGeo = exports.queryDocumentTypes = exports.getDocumentTypes = void 0;
6
+ exports.getDocumentTypesByGeo = exports.queryDocumentTypes = void 0;
7
+ exports.getDocumentTypes = getDocumentTypes;
7
8
  const catalog_1 = require("../catalog");
8
9
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
10
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
11
  const catalog_query_utils_1 = require("../../utils/catalog-query.utils");
11
12
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
- /**
13
- * Documents indexed by code (definition + label). For the unique list (Object.values),
14
- * validation ([code].minLength / maxLength / type) and label ([code].label).
15
- */
16
- const getDocumentTypes = (lang) => {
17
- const locale = locales[lang];
13
+ function getDocumentTypes(...args) {
18
14
  const result = {};
19
15
  for (const { code, minLength, maxLength, type } of Object.values(catalog_1.DOCUMENT_TYPES)) {
20
- result[code] = { code, minLength, maxLength, type, label: locale.documentTypes[code] };
16
+ const validation = { code, minLength, maxLength, type };
17
+ result[code] = args.length === 0 ? validation : { ...validation, label: locales[args[0]].documentTypes[code] };
21
18
  }
22
19
  return result;
23
- };
24
- exports.getDocumentTypes = getDocumentTypes;
20
+ }
25
21
  /** DOCUMENT_TYPES flattened by geo, one row per (code, geo) pair — no label, so it is what gets filtered. */
26
22
  const flattenByGeo = () => Object.values(catalog_1.DOCUMENT_TYPES).flatMap(({ geo, ...record }) => {
27
23
  const entries = Object.entries(geo);
@@ -30,7 +26,7 @@ const flattenByGeo = () => Object.values(catalog_1.DOCUMENT_TYPES).flatMap(({ ge
30
26
  /** The catalog flattened by geo, narrowed by the query, each record enriched with its label for `query.lang`. */
31
27
  const queryDocumentTypes = (query) => {
32
28
  const { lang, ...filters } = query;
33
- const docs = (0, exports.getDocumentTypes)(lang);
29
+ const docs = getDocumentTypes(lang);
34
30
  return flattenByGeo()
35
31
  .filter(record => (0, catalog_query_utils_1.matchesQuery)(record, filters))
36
32
  .map(record => ({ ...record, label: docs[record.code].label }));
@@ -1,8 +1,11 @@
1
1
  import type { FilterClassificationCategory, FilterClassificationCategoryFamily } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
3
4
  export type FilterClassificationCategoryFamilyOption = {
4
5
  code: FilterClassificationCategoryFamily;
5
6
  categories: readonly FilterClassificationCategory[];
6
7
  label: string;
7
8
  };
8
- export declare const getFilterClassificationCategoryFamilies: (lang: Locale) => Record<FilterClassificationCategoryFamily, FilterClassificationCategoryFamilyOption>;
9
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
10
+ export declare function getFilterClassificationCategoryFamilies(): Record<FilterClassificationCategoryFamily, WithoutLabel<FilterClassificationCategoryFamilyOption>>;
11
+ export declare function getFilterClassificationCategoryFamilies(lang: Locale): Record<FilterClassificationCategoryFamily, FilterClassificationCategoryFamilyOption>;
@@ -3,17 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getFilterClassificationCategoryFamilies = void 0;
6
+ exports.getFilterClassificationCategoryFamilies = getFilterClassificationCategoryFamilies;
7
7
  const catalog_1 = require("../catalog");
8
8
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
9
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
10
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
11
- const getFilterClassificationCategoryFamilies = (lang) => {
12
- const locale = locales[lang];
11
+ function getFilterClassificationCategoryFamilies(...args) {
13
12
  const result = {};
14
13
  for (const record of Object.values(catalog_1.FILTER_CLASSIFICATION_CATEGORY_FAMILIES)) {
15
- result[record.code] = { ...record, label: locale.categoryFamilies[record.code] };
14
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].categoryFamilies[record.code] };
16
15
  }
17
16
  return result;
18
- };
19
- exports.getFilterClassificationCategoryFamilies = getFilterClassificationCategoryFamilies;
17
+ }
@@ -1,7 +1,10 @@
1
1
  import type { FilterClassificationSection, FilterClassificationSectionRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
+ import type { WithoutLabel } from "../../../utils/catalog-label.utils";
3
4
  export type FilterClassificationSectionOption = FilterClassificationSectionRecord & {
4
5
  label: string;
5
6
  };
7
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
8
+ export declare function getFilterClassificationSections(): Record<FilterClassificationSection, WithoutLabel<FilterClassificationSectionOption>>;
6
9
  /** The section headings indexed by code, each with its label. A section is a heading: never selectable, never sent to an API. */
7
- export declare const getFilterClassificationSections: (lang: Locale) => Record<FilterClassificationSection, FilterClassificationSectionOption>;
10
+ export declare function getFilterClassificationSections(lang: Locale): Record<FilterClassificationSection, FilterClassificationSectionOption>;
@@ -3,18 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getFilterClassificationSections = void 0;
6
+ exports.getFilterClassificationSections = getFilterClassificationSections;
7
7
  const catalog_1 = require("../catalog");
8
8
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
9
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
10
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
11
- /** The section headings indexed by code, each with its label. A section is a heading: never selectable, never sent to an API. */
12
- const getFilterClassificationSections = (lang) => {
13
- const locale = locales[lang];
11
+ function getFilterClassificationSections(...args) {
14
12
  const result = {};
15
13
  for (const record of Object.values(catalog_1.FILTER_CLASSIFICATION_SECTIONS)) {
16
- result[record.code] = { ...record, label: locale.sections[record.code] };
14
+ result[record.code] = args.length === 0 ? { ...record } : { ...record, label: locales[args[0]].sections[record.code] };
17
15
  }
18
16
  return result;
19
- };
20
- exports.getFilterClassificationSections = getFilterClassificationSections;
17
+ }
@@ -1,6 +1,7 @@
1
1
  import type { FinancialInstitution, FinancialInstitutionRecord } from "../catalog";
2
2
  import type { Locale } from "../../lang";
3
3
  import type { CatalogQuery } from "../../utils/catalog-query.utils";
4
+ import type { WithoutLabel } from "../../utils/catalog-label.utils";
4
5
  export type FinancialInstitutionOption = FinancialInstitutionRecord & {
5
6
  label: string;
6
7
  };
@@ -8,14 +9,16 @@ export type FinancialInstitutionOption = FinancialInstitutionRecord & {
8
9
  * The catalog by code. Indexed by a plain string (e.g. a code from an API payload) instead of a known code,
9
10
  * the lookup is `FinancialInstitutionOption | undefined`, so an unknown code needs no cast to be handled.
10
11
  */
11
- export interface FinancialInstitutionCatalog extends Record<FinancialInstitution, FinancialInstitutionOption> {
12
- [code: string]: FinancialInstitutionOption | undefined;
12
+ export interface FinancialInstitutionCatalog<T = FinancialInstitutionOption> extends Record<FinancialInstitution, T> {
13
+ [code: string]: T | undefined;
13
14
  }
15
+ /** Without `lang`: the records with no `label`, to read codes and metadata where no language applies. */
16
+ export declare function getFinancialInstitutions(): FinancialInstitutionCatalog<WithoutLabel<FinancialInstitutionOption>>;
14
17
  /**
15
18
  * The catalog indexed by code (same shape as FINANCIAL_INSTITUTIONS), each record enriched
16
19
  * with its label for the given language. Access by code directly; for a list use `queryFinancialInstitutions`.
17
20
  */
18
- export declare const getFinancialInstitutions: (lang: Locale) => FinancialInstitutionCatalog;
21
+ export declare function getFinancialInstitutions(lang: Locale): FinancialInstitutionCatalog;
19
22
  /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
20
23
  export type FinancialInstitutionQuery = CatalogQuery<FinancialInstitutionRecord> & {
21
24
  lang: Locale;