@cobre-npm/library-portal-core 0.27.0 → 0.29.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 (30) hide show
  1. package/README.md +76 -7
  2. package/dist/currencies/catalog.d.ts +6 -1
  3. package/dist/currencies/catalog.d.ts.map +1 -1
  4. package/dist/currencies/catalog.js +2 -2
  5. package/dist/currencies/catalog.js.map +1 -1
  6. package/dist/currencies/index.d.ts +1 -1
  7. package/dist/currencies/index.d.ts.map +1 -1
  8. package/dist/currencies/utils/currency.utils.d.ts +14 -1
  9. package/dist/currencies/utils/currency.utils.d.ts.map +1 -1
  10. package/dist/currencies/utils/currency.utils.js +14 -1
  11. package/dist/currencies/utils/currency.utils.js.map +1 -1
  12. package/dist/transactions/index.d.ts +2 -0
  13. package/dist/transactions/index.d.ts.map +1 -1
  14. package/dist/transactions/index.js +1 -0
  15. package/dist/transactions/index.js.map +1 -1
  16. package/dist/transactions/types/catalog.d.ts +137 -0
  17. package/dist/transactions/types/catalog.d.ts.map +1 -0
  18. package/dist/transactions/types/catalog.js +50 -0
  19. package/dist/transactions/types/catalog.js.map +1 -0
  20. package/dist/transactions/types/locales/en.json +48 -0
  21. package/dist/transactions/types/locales/es-mex.json +48 -0
  22. package/dist/transactions/types/utils/transaction-type.utils.d.ts +18 -0
  23. package/dist/transactions/types/utils/transaction-type.utils.d.ts.map +1 -0
  24. package/dist/transactions/types/utils/transaction-type.utils.js +31 -0
  25. package/dist/transactions/types/utils/transaction-type.utils.js.map +1 -0
  26. package/dist/utils/catalog-query.utils.d.ts +24 -0
  27. package/dist/utils/catalog-query.utils.d.ts.map +1 -0
  28. package/dist/utils/catalog-query.utils.js +26 -0
  29. package/dist/utils/catalog-query.utils.js.map +1 -0
  30. package/package.json +1 -1
package/README.md CHANGED
@@ -41,7 +41,7 @@ import { getCountries } from "@cobre-npm/library-portal-core/countries"
41
41
  | `@cobre-npm/library-portal-core/movements` | Movement types and statuses |
42
42
  | `@cobre-npm/library-portal-core/documentTypes` | Document types (definition + per-country applicability) |
43
43
  | `@cobre-npm/library-portal-core/currencies` | Currencies |
44
- | `@cobre-npm/library-portal-core/transactions` | Transaction interfaces |
44
+ | `@cobre-npm/library-portal-core/transactions` | Transaction types + interfaces |
45
45
  | `@cobre-npm/library-portal-core/canonicalTransactions` | Canonical transaction/money-movement detail interfaces |
46
46
  | `@cobre-npm/library-portal-core/search` | Search / aggregation interfaces |
47
47
  | `@cobre-npm/library-portal-core/trustedSessions` | Trusted session (OTP elevation window) interfaces |
@@ -117,11 +117,22 @@ Every use case comes out of this, without the consumer having to walk internal s
117
117
  > since each record already carries its metadata (`geo`, `type`, etc.), filtering is a trivial `.filter()` on the
118
118
  > consumer side.
119
119
 
120
+ **That is changing, one domain at a time.** Catalogs are growing records that only make sense in one flow
121
+ (`cny`/`eur`, counterparty settlement only) — something the consumer cannot tell from the record alone, so
122
+ "filter it yourself" quietly leaks them into every picker. Domains are gaining a **`queryX()`** that
123
+ returns the list already narrowed, with a safe default.
124
+
125
+ `currencies` is the first: see [`currencies`](#currencies) for the query rules, which every later `queryX()`
126
+ will follow. `transactions/types` is the second, and the first **i18n** one: `lang` travels **inside** the
127
+ query object (required there, no default) rather than as a positional argument — see
128
+ [`transactions`](#transactions) for what that changes. Until a domain has one, `.filter()` is still the
129
+ way — and it stays fine for one-off predicates even where `queryX()` exists.
130
+
120
131
  ### Two classes of domain
121
132
 
122
133
  | Class | When | Signature | Examples |
123
134
  |---|---|---|---|
124
- | **With i18n** | the label depends on the language | `getX(lang)` | accountTypes, counterpartyTypes, movementTypes, countries, countriesISO, documentTypes |
135
+ | **With i18n** | the label depends on the language | `getX(lang)` | accountTypes, counterpartyTypes, movementTypes, transactionTypes, countries, countriesISO, documentTypes |
125
136
  | **Without i18n** | the label is fixed (or there is none) | `getX()` | currencies (inline label), accountProviders, movementStatus |
126
137
 
127
138
  `currencies`/`providers`/`status` **don't take `lang`** because there's no translation — the signature is honest.
@@ -239,21 +250,79 @@ code repeats per country. No single shape covers both cases well.
239
250
  ### `currencies`
240
251
 
241
252
  ```ts
242
- import { getCurrencies, type Currency, type CurrencyType, type CurrencyRecord }
243
- from "@cobre-npm/library-portal-core/currencies"
253
+ import { getCurrencies, queryCurrencies, type Currency, type CurrencyType, type CurrencyRecord,
254
+ type CurrencyScope, type CurrencyQuery } from "@cobre-npm/library-portal-core/currencies"
244
255
 
245
256
  getCurrencies().cop // { code:"cop", label:"COP", isoCode:"COP", geo:"col", flagAsset:"col", minAmount:1, type:"fiat" }
246
- Object.values(getCurrencies()).filter(c => c.type === "fiat") // the consumer filters
257
+ queryCurrencies({ type: "fiat" }) // [ cop, mxn, usd ] → the list a picker needs
247
258
  ```
248
259
 
249
260
  No `lang`: the `label` is fixed (a display code, the same in any language).
250
261
 
251
- ### `transactions` / `search` / `trustedSessions`
262
+ **Which one to use.** `getCurrencies()` is the catalog keyed by code — use it to look a single currency
263
+ up (`getCurrencies()[code]`) or when you genuinely want all of them. `queryCurrencies()` returns a
264
+ **list**, narrowed by the query, and is what a dropdown, table filter or picker should call.
265
+
266
+ #### Query rules
267
+
268
+ ```ts
269
+ queryCurrencies() // cop, mxn, usd, usd_stable, usdt, usdc, copco
270
+ queryCurrencies({ type: "fiat" }) // cop, mxn, usd
271
+ queryCurrencies({ type: ["fiat", "stable"] }) // cop, mxn, usd, usd_stable, copco
272
+ queryCurrencies({ type: "fiat", geo: ["col", "mex"] }) // cop, mxn
273
+ queryCurrencies({ isoCode: "USD" }) // usd, usd_stable, usdt, usdc
274
+ queryCurrencies({ scope: "counterparties" }) // cny, eur
275
+ ```
276
+
277
+ 1. **Any field of the record is queryable**, by equality. **AND across fields, OR within a field**, so
278
+ `{ type: ["fiat","stable"], geo: "col" }` reads as *(fiat or stable) and geo col*. There are no
279
+ operators — for a range or a substring, `.filter()` the result.
280
+ 2. **A key that is present always filters.** What does not filter is the *absence* of the key, so
281
+ `queryCurrencies({})` returns everything while `queryCurrencies({ code: undefined })` returns nothing.
282
+ An optional UI filter therefore has to be spread in conditionally:
283
+
284
+ ```ts
285
+ queryCurrencies({ type: "fiat", ...(country.value ? { geo: country.value } : {}) })
286
+ ```
287
+
288
+ This fails loudly — an empty dropdown — instead of silently returning more rows than intended.
289
+ 3. **`scope` is the one field with a default of its own.** Leave the key out and you get only the
290
+ general-purpose currencies; ask for a scope and you get exactly the ones restricted to it. That is
291
+ what keeps a new picker from inheriting `cny`/`eur`, which exist solely for counterparty settlement.
292
+
293
+ Watch out for two consequences of rule 3:
294
+
295
+ - `queryCurrencies()` and `queryCurrencies({ scope: "counterparties" })` are **disjoint**. For every
296
+ currency a counterparty flow accepts, use `Object.values(getCurrencies())`.
297
+ - `queryCurrencies({ code: "eur" })` returns `[]`, because the scope default drops `eur` before `code`
298
+ is considered. Looking a currency up by code is `getCurrencies().eur`.
299
+
300
+ And two on rule 1: `{ minAmount: 1 }` is equality, not `>=`, which is rarely what you want; and
301
+ `flagAsset`/`label` are presentation details that make poor business criteria.
302
+
303
+ ### `transactions`
304
+
305
+ ```ts
306
+ import {
307
+ getTransactionTypes, queryTransactionTypes, type TransactionType, type TransactionTypeQuery,
308
+ type Transaction, type EnrichedTransaction, /* ...interfaces */
309
+ } from "@cobre-npm/library-portal-core/transactions"
310
+
311
+ getTransactionTypes("en").spei_debit.label // "Debit via SPEI"
312
+ queryTransactionTypes({ lang: "en", code: "spei_debit" }) // [ { code: "spei_debit", label: "Debit via SPEI" } ]
313
+ ```
314
+
315
+ - **types** (i18n): `getTransactionTypes(lang)`; each record carries `code` and `label`.
316
+ - **types query** (i18n `queryX()`): `queryTransactionTypes({ lang, ...filters })` — `lang` is **required inside
317
+ the query object**, not a separate argument, so the result is already localized. There is no default field
318
+ (unlike `currencies`' `scope`): every transaction type comes back when only `lang` is given.
319
+ - **interfaces**: `Transaction`, `EnrichedTransaction`, `TransactionMetadata`, `CreditDebitType`.
320
+
321
+ ### `search` / `trustedSessions`
252
322
 
253
323
  Interfaces only (pure types):
254
324
 
255
325
  ```ts
256
- import type { Transaction, EnrichedTransaction } from "@cobre-npm/library-portal-core/transactions"
257
326
  import type { SearchRequest, SearchResponse, SearchFilter } from "@cobre-npm/library-portal-core/search"
258
327
  import type { TrustedSessionStatus } from "@cobre-npm/library-portal-core/trustedSessions"
259
328
  ```
@@ -1,3 +1,4 @@
1
+ export type CurrencyScope = "counterparties";
1
2
  export declare const CURRENCIES: {
2
3
  readonly cop: {
3
4
  readonly code: "cop";
@@ -70,6 +71,7 @@ export declare const CURRENCIES: {
70
71
  readonly flagAsset: "chn";
71
72
  readonly minAmount: 100;
72
73
  readonly type: "fiat";
74
+ readonly scope: "counterparties";
73
75
  };
74
76
  readonly eur: {
75
77
  readonly code: "eur";
@@ -79,9 +81,12 @@ export declare const CURRENCIES: {
79
81
  readonly flagAsset: "eur";
80
82
  readonly minAmount: 100;
81
83
  readonly type: "fiat";
84
+ readonly scope: "counterparties";
82
85
  };
83
86
  };
84
87
  export type Currency = keyof typeof CURRENCIES;
85
88
  export type CurrencyType = (typeof CURRENCIES)[Currency]["type"];
86
- export type CurrencyRecord = (typeof CURRENCIES)[Currency];
89
+ export type CurrencyRecord = (typeof CURRENCIES)[Currency] & {
90
+ readonly scope?: CurrencyScope;
91
+ };
87
92
  //# sourceMappingURL=catalog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/currencies/catalog.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBrB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAA;AAC9C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAA"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/currencies/catalog.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAA;AAE5C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBrB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAA;AAC9C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAMhE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,CAAA"}
@@ -9,7 +9,7 @@ exports.CURRENCIES = {
9
9
  usdt: { code: "usdt", label: "USD (USDT)", isoCode: "USD", geo: "usa", flagAsset: "usdt", minAmount: 1, type: "stablecoin" },
10
10
  usdc: { code: "usdc", label: "USD (USDC)", isoCode: "USD", geo: "usa", flagAsset: "usdc", minAmount: 1, type: "stablecoin" },
11
11
  copco: { code: "copco", label: "COPco", isoCode: "COP", geo: "col", flagAsset: "cop_stable", minAmount: 1, type: "stable" },
12
- cny: { code: "cny", label: "CNY", isoCode: "CNY", geo: "chn", flagAsset: "chn", minAmount: 100, type: "fiat" },
13
- eur: { code: "eur", label: "EUR", isoCode: "EUR", geo: "eur", flagAsset: "eur", minAmount: 100, type: "fiat" },
12
+ cny: { code: "cny", label: "CNY", isoCode: "CNY", geo: "chn", flagAsset: "chn", minAmount: 100, type: "fiat", scope: "counterparties" },
13
+ eur: { code: "eur", label: "EUR", isoCode: "EUR", geo: "eur", flagAsset: "eur", minAmount: 100, type: "fiat", scope: "counterparties" },
14
14
  };
15
15
  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,KAAK,EAAK,SAAS,EAAE,KAAK,EAAS,SAAS,EAAE,GAAG,EAAG,IAAI,EAAE,MAAM,EAAQ,KAAK,EAAE,gBAAgB,EAAE;CAU7K,CAAA"}
@@ -1,3 +1,3 @@
1
- export type { Currency, CurrencyType, CurrencyRecord } from "./catalog";
1
+ export type { Currency, CurrencyType, CurrencyRecord, CurrencyScope } from "./catalog";
2
2
  export * from "./utils/currency.utils";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/currencies/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEvE,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/currencies/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEtF,cAAc,wBAAwB,CAAA"}
@@ -1,3 +1,16 @@
1
- import type { Currency, CurrencyRecord } from "../catalog";
1
+ import type { Currency, CurrencyRecord, CurrencyScope } from "../catalog";
2
+ import type { CatalogQuery } from "../../utils/catalog-query.utils";
2
3
  export declare const getCurrencies: () => Record<Currency, CurrencyRecord>;
4
+ /** Every field of the record is queryable. `scope` is listed apart because it is the one with a default. */
5
+ export type CurrencyQuery = CatalogQuery<Omit<CurrencyRecord, "scope">> & {
6
+ scope?: CurrencyScope | readonly CurrencyScope[];
7
+ };
8
+ /**
9
+ * The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules.
10
+ *
11
+ * `scope` is the one field with a default: leave the key out and only general-purpose currencies come
12
+ * back, so a picker never inherits the counterparty-only ones by accident. That is also why
13
+ * `{ code: "eur" }` returns nothing — looking a currency up by code is `getCurrencies()[code]`.
14
+ */
15
+ export declare const queryCurrencies: (query?: CurrencyQuery) => CurrencyRecord[];
3
16
  //# sourceMappingURL=currency.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"currency.utils.d.ts","sourceRoot":"","sources":["../../../src/currencies/utils/currency.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAI1D,eAAO,MAAM,aAAa,QAAO,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAe,CAAA"}
1
+ {"version":3,"file":"currency.utils.d.ts","sourceRoot":"","sources":["../../../src/currencies/utils/currency.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAInE,eAAO,MAAM,aAAa,QAAO,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAe,CAAA;AAE/E,4GAA4G;AAC5G,MAAM,MAAM,aAAa,GACrB,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,GAC3C;IAAE,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,aAAa,EAAE,CAAA;CAAE,CAAA;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,QAAO,aAAkB,KAAG,cAAc,EAIzE,CAAA"}
@@ -1,9 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCurrencies = void 0;
3
+ exports.queryCurrencies = exports.getCurrencies = void 0;
4
4
  const catalog_1 = require("../catalog");
5
+ const catalog_query_utils_1 = require("../../utils/catalog-query.utils");
5
6
  // The currency catalog indexed by code. Label is already inline, so no lang is needed.
6
7
  // Access by code directly, or Object.values for a list.
7
8
  const getCurrencies = () => catalog_1.CURRENCIES;
8
9
  exports.getCurrencies = getCurrencies;
10
+ /**
11
+ * The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules.
12
+ *
13
+ * `scope` is the one field with a default: leave the key out and only general-purpose currencies come
14
+ * back, so a picker never inherits the counterparty-only ones by accident. That is also why
15
+ * `{ code: "eur" }` returns nothing — looking a currency up by code is `getCurrencies()[code]`.
16
+ */
17
+ const queryCurrencies = (query = {}) => {
18
+ const withScopeDefault = "scope" in query ? query : { ...query, scope: undefined };
19
+ return Object.values(catalog_1.CURRENCIES).filter(currency => (0, catalog_query_utils_1.matchesQuery)(currency, withScopeDefault));
20
+ };
21
+ exports.queryCurrencies = queryCurrencies;
9
22
  //# sourceMappingURL=currency.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"currency.utils.js","sourceRoot":"","sources":["../../../src/currencies/utils/currency.utils.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AAGvC,uFAAuF;AACvF,wDAAwD;AACjD,MAAM,aAAa,GAAG,GAAqC,EAAE,CAAC,oBAAU,CAAA;AAAlE,QAAA,aAAa,iBAAqD"}
1
+ {"version":3,"file":"currency.utils.js","sourceRoot":"","sources":["../../../src/currencies/utils/currency.utils.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AAEvC,yEAA8D;AAG9D,uFAAuF;AACvF,wDAAwD;AACjD,MAAM,aAAa,GAAG,GAAqC,EAAE,CAAC,oBAAU,CAAA;AAAlE,QAAA,aAAa,iBAAqD;AAO/E;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAAC,QAAuB,EAAE,EAAoB,EAAE;IAC7E,MAAM,gBAAgB,GAAG,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IAElF,OAAO,MAAM,CAAC,MAAM,CAAC,oBAAU,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAA,kCAAY,EAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAA;AAC/F,CAAC,CAAA;AAJY,QAAA,eAAe,mBAI3B"}
@@ -1,2 +1,4 @@
1
+ export type { TransactionType } from "./types/catalog";
2
+ export * from "./types/utils/transaction-type.utils";
1
3
  export * from "./interfaces/response.interface";
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,cAAc,sCAAsC,CAAA;AAEpD,cAAc,iCAAiC,CAAA"}
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/utils/transaction-type.utils"), exports);
17
18
  __exportStar(require("./interfaces/response.interface"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAA+C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,uEAAoD;AAEpD,kEAA+C"}
@@ -0,0 +1,137 @@
1
+ export declare const TRANSACTION_TYPES: {
2
+ readonly spei_debit: {
3
+ readonly code: "spei_debit";
4
+ };
5
+ readonly spei_credit: {
6
+ readonly code: "spei_credit";
7
+ };
8
+ readonly spei_return: {
9
+ readonly code: "spei_return";
10
+ };
11
+ readonly spei_rejected: {
12
+ readonly code: "spei_rejected";
13
+ };
14
+ readonly internal_spei_debit: {
15
+ readonly code: "internal_spei_debit";
16
+ };
17
+ readonly internal_spei_credit: {
18
+ readonly code: "internal_spei_credit";
19
+ };
20
+ readonly adjustment_credit: {
21
+ readonly code: "adjustment_credit";
22
+ };
23
+ readonly adjustment_debit: {
24
+ readonly code: "adjustment_debit";
25
+ };
26
+ readonly mex_debit: {
27
+ readonly code: "mex_debit";
28
+ };
29
+ readonly mex_credit: {
30
+ readonly code: "mex_credit";
31
+ };
32
+ readonly col_debit: {
33
+ readonly code: "col_debit";
34
+ };
35
+ readonly col_credit: {
36
+ readonly code: "col_credit";
37
+ };
38
+ readonly misc_debit: {
39
+ readonly code: "misc_debit";
40
+ };
41
+ readonly misc_credit: {
42
+ readonly code: "misc_credit";
43
+ };
44
+ readonly internal_credit: {
45
+ readonly code: "internal_credit";
46
+ };
47
+ readonly internal_debit: {
48
+ readonly code: "internal_debit";
49
+ };
50
+ readonly r2p_credit: {
51
+ readonly code: "r2p_credit";
52
+ };
53
+ readonly cbmm_debit: {
54
+ readonly code: "cbmm_debit";
55
+ };
56
+ readonly cbmm_credit: {
57
+ readonly code: "cbmm_credit";
58
+ };
59
+ readonly dd_credit: {
60
+ readonly code: "dd_credit";
61
+ };
62
+ readonly col_cb_credit: {
63
+ readonly code: "col_cb_credit";
64
+ };
65
+ readonly col_cb_debit: {
66
+ readonly code: "col_cb_debit";
67
+ };
68
+ readonly breb_credit: {
69
+ readonly code: "breb_credit";
70
+ };
71
+ readonly breb_debit: {
72
+ readonly code: "breb_debit";
73
+ };
74
+ readonly r2p_breb_credit: {
75
+ readonly code: "r2p_breb_credit";
76
+ };
77
+ readonly breb_rejected: {
78
+ readonly code: "breb_rejected";
79
+ };
80
+ readonly col_top_up_credit: {
81
+ readonly code: "col_top_up_credit";
82
+ };
83
+ readonly global_debit: {
84
+ readonly code: "global_debit";
85
+ };
86
+ readonly global_credit: {
87
+ readonly code: "global_credit";
88
+ };
89
+ readonly r2p_spei_credit: {
90
+ readonly code: "r2p_spei_credit";
91
+ };
92
+ readonly transfer_credit: {
93
+ readonly code: "transfer_credit";
94
+ };
95
+ readonly fedwire_debit: {
96
+ readonly code: "fedwire_debit";
97
+ };
98
+ readonly fedwire_credit: {
99
+ readonly code: "fedwire_credit";
100
+ };
101
+ readonly reward_credit: {
102
+ readonly code: "reward_credit";
103
+ };
104
+ readonly global_pay_to_usa_debit: {
105
+ readonly code: "global_pay_to_usa_debit";
106
+ };
107
+ readonly global_pay_to_usa_credit: {
108
+ readonly code: "global_pay_to_usa_credit";
109
+ };
110
+ readonly usa_pay_to_global_debit: {
111
+ readonly code: "usa_pay_to_global_debit";
112
+ };
113
+ readonly usa_pay_to_global_credit: {
114
+ readonly code: "usa_pay_to_global_credit";
115
+ };
116
+ readonly onramp_credit: {
117
+ readonly code: "onramp_credit";
118
+ };
119
+ readonly offramp_debit: {
120
+ readonly code: "offramp_debit";
121
+ };
122
+ readonly stable_payout_debit: {
123
+ readonly code: "stable_payout_debit";
124
+ };
125
+ readonly stable_payout_credit: {
126
+ readonly code: "stable_payout_credit";
127
+ };
128
+ readonly global_pay_to_generic_debit: {
129
+ readonly code: "global_pay_to_generic_debit";
130
+ };
131
+ readonly global_pay_to_generic_credit: {
132
+ readonly code: "global_pay_to_generic_credit";
133
+ };
134
+ };
135
+ export type TransactionType = keyof typeof TRANSACTION_TYPES;
136
+ export type TransactionTypeRecord = (typeof TRANSACTION_TYPES)[TransactionType];
137
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/transactions/types/catalog.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CpB,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAC5D,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,eAAe,CAAC,CAAA"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRANSACTION_TYPES = void 0;
4
+ exports.TRANSACTION_TYPES = {
5
+ spei_debit: { code: "spei_debit" },
6
+ spei_credit: { code: "spei_credit" },
7
+ spei_return: { code: "spei_return" },
8
+ spei_rejected: { code: "spei_rejected" },
9
+ internal_spei_debit: { code: "internal_spei_debit" },
10
+ internal_spei_credit: { code: "internal_spei_credit" },
11
+ adjustment_credit: { code: "adjustment_credit" },
12
+ adjustment_debit: { code: "adjustment_debit" },
13
+ mex_debit: { code: "mex_debit" },
14
+ mex_credit: { code: "mex_credit" },
15
+ col_debit: { code: "col_debit" },
16
+ col_credit: { code: "col_credit" },
17
+ misc_debit: { code: "misc_debit" },
18
+ misc_credit: { code: "misc_credit" },
19
+ internal_credit: { code: "internal_credit" },
20
+ internal_debit: { code: "internal_debit" },
21
+ r2p_credit: { code: "r2p_credit" },
22
+ cbmm_debit: { code: "cbmm_debit" },
23
+ cbmm_credit: { code: "cbmm_credit" },
24
+ dd_credit: { code: "dd_credit" },
25
+ col_cb_credit: { code: "col_cb_credit" },
26
+ col_cb_debit: { code: "col_cb_debit" },
27
+ breb_credit: { code: "breb_credit" },
28
+ breb_debit: { code: "breb_debit" },
29
+ r2p_breb_credit: { code: "r2p_breb_credit" },
30
+ breb_rejected: { code: "breb_rejected" },
31
+ col_top_up_credit: { code: "col_top_up_credit" },
32
+ global_debit: { code: "global_debit" },
33
+ global_credit: { code: "global_credit" },
34
+ r2p_spei_credit: { code: "r2p_spei_credit" },
35
+ transfer_credit: { code: "transfer_credit" },
36
+ fedwire_debit: { code: "fedwire_debit" },
37
+ fedwire_credit: { code: "fedwire_credit" },
38
+ reward_credit: { code: "reward_credit" },
39
+ global_pay_to_usa_debit: { code: "global_pay_to_usa_debit" },
40
+ global_pay_to_usa_credit: { code: "global_pay_to_usa_credit" },
41
+ usa_pay_to_global_debit: { code: "usa_pay_to_global_debit" },
42
+ usa_pay_to_global_credit: { code: "usa_pay_to_global_credit" },
43
+ onramp_credit: { code: "onramp_credit" },
44
+ offramp_debit: { code: "offramp_debit" },
45
+ stable_payout_debit: { code: "stable_payout_debit" },
46
+ stable_payout_credit: { code: "stable_payout_credit" },
47
+ global_pay_to_generic_debit: { code: "global_pay_to_generic_debit" },
48
+ global_pay_to_generic_credit: { code: "global_pay_to_generic_credit" },
49
+ };
50
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/transactions/types/catalog.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC/B,UAAU,EAAoB,EAAE,IAAI,EAAE,YAAY,EAAE;IACpD,WAAW,EAAmB,EAAE,IAAI,EAAE,aAAa,EAAE;IACrD,WAAW,EAAmB,EAAE,IAAI,EAAE,aAAa,EAAE;IACrD,aAAa,EAAiB,EAAE,IAAI,EAAE,eAAe,EAAE;IACvD,mBAAmB,EAAW,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC7D,oBAAoB,EAAU,EAAE,IAAI,EAAE,sBAAsB,EAAE;IAC9D,iBAAiB,EAAa,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC3D,gBAAgB,EAAc,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC1D,SAAS,EAAqB,EAAE,IAAI,EAAE,WAAW,EAAE;IACnD,UAAU,EAAoB,EAAE,IAAI,EAAE,YAAY,EAAE;IACpD,SAAS,EAAqB,EAAE,IAAI,EAAE,WAAW,EAAE;IACnD,UAAU,EAAoB,EAAE,IAAI,EAAE,YAAY,EAAE;IACpD,UAAU,EAAoB,EAAE,IAAI,EAAE,YAAY,EAAE;IACpD,WAAW,EAAmB,EAAE,IAAI,EAAE,aAAa,EAAE;IACrD,eAAe,EAAe,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACzD,cAAc,EAAg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eAAe,EAAE;IACvD,mBAAmB,EAAW,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC7D,oBAAoB,EAAU,EAAE,IAAI,EAAE,sBAAsB,EAAE;IAC9D,2BAA2B,EAAG,EAAE,IAAI,EAAE,6BAA6B,EAAE;IACrE,4BAA4B,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE;CAC9D,CAAA"}
@@ -0,0 +1,48 @@
1
+ {
2
+ "transactionTypes": {
3
+ "spei_debit": "Debit via SPEI",
4
+ "spei_credit": "Credit via SPEI",
5
+ "spei_return": "Refund via SPEI",
6
+ "spei_rejected": "SPEI Rejected",
7
+ "internal_spei_debit": "Internal debit through SPEI",
8
+ "internal_spei_credit": "Internal credit through SPEI",
9
+ "adjustment_credit": "Credit adjustment",
10
+ "adjustment_debit": "Debit adjustment",
11
+ "mex_debit": "Debit in Mexico",
12
+ "mex_credit": "Credit in Mexico",
13
+ "col_debit": "Debit in Colombia",
14
+ "col_credit": "Credit in Colombia",
15
+ "misc_debit": "Debit",
16
+ "misc_credit": "Credit",
17
+ "internal_credit": "Internal credit",
18
+ "internal_debit": "Internal debit",
19
+ "r2p_credit": "R2P Credit",
20
+ "cbmm_debit": "Debit Cross Border",
21
+ "cbmm_credit": "Credit Cross Border",
22
+ "dd_credit": "Direct Debit Credit",
23
+ "col_cb_credit": "Cobre Balance Credit in Colombia",
24
+ "col_cb_debit": "Cobre Balance Debit in Colombia",
25
+ "breb_credit": "Credit by Bre-B",
26
+ "breb_debit": "Debit by Bre-B",
27
+ "r2p_breb_credit": "R2P Credit by Bre-B",
28
+ "breb_rejected": "Bre-B Rejected",
29
+ "col_top_up_credit": "Cobre Balance Credit in Colombia",
30
+ "global_debit": "Global Debit",
31
+ "global_credit": "Global Credit",
32
+ "r2p_spei_credit": "R2P Credit SPEI",
33
+ "transfer_credit": "Transfer Credit",
34
+ "fedwire_debit": "Fedwire Debit",
35
+ "fedwire_credit": "Fedwire Credit",
36
+ "reward_credit": "Rewards credit",
37
+ "global_pay_to_usa_debit": "Global account debit",
38
+ "global_pay_to_usa_credit": "FBO account credit",
39
+ "usa_pay_to_global_debit": "FBO account debit",
40
+ "usa_pay_to_global_credit": "Global account credit",
41
+ "onramp_credit": "Onramp Credit",
42
+ "offramp_debit": "Offramp Debit",
43
+ "stable_payout_debit": "Stable Payout",
44
+ "stable_payout_credit": "Stable Payout Credit",
45
+ "global_pay_to_generic_debit": "Generic Payment Debit",
46
+ "global_pay_to_generic_credit": "Generic Payment Credit"
47
+ }
48
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "transactionTypes": {
3
+ "spei_debit": "Débito a través de SPEI",
4
+ "spei_credit": "Crédito a través de SPEI",
5
+ "spei_return": "Reembolso a través de SPEI",
6
+ "spei_rejected": "Retorno de SPEI",
7
+ "internal_spei_debit": "Débito interno a través de SPEI",
8
+ "internal_spei_credit": "Crédito interno a través de SPEI",
9
+ "adjustment_credit": "Ajuste de crédito",
10
+ "adjustment_debit": "Ajuste de débito",
11
+ "mex_debit": "Débito en México",
12
+ "mex_credit": "Crédito en México",
13
+ "col_debit": "Débito en Colombia",
14
+ "col_credit": "Crédito en Colombia",
15
+ "misc_debit": "Débito",
16
+ "misc_credit": "Crédito",
17
+ "internal_credit": "Crédito Interno",
18
+ "internal_debit": "Débito Interno",
19
+ "r2p_credit": "Crédito por recaudo",
20
+ "cbmm_debit": "Débito Internacional",
21
+ "cbmm_credit": "Crédito Internacional",
22
+ "dd_credit": "Crédito Débito a cuenta",
23
+ "col_cb_credit": "Crédito Cobre Balance",
24
+ "col_cb_debit": "Débito Cobre Balance",
25
+ "breb_credit": "Crédito a través de Bre-B",
26
+ "breb_debit": "Débito a través de Bre-B",
27
+ "r2p_breb_credit": "Crédito por recaudo Bre-B",
28
+ "breb_rejected": "Retorno de Bre-B",
29
+ "col_top_up_credit": "Recarga Cobre Balance",
30
+ "global_debit": "Débito Global",
31
+ "global_credit": "Crédito Global",
32
+ "r2p_spei_credit": "Crédito por recaudo SPEI",
33
+ "transfer_credit": "Crédito de transferencia",
34
+ "fedwire_debit": "Débito Fedwire",
35
+ "fedwire_credit": "Crédito Fedwire",
36
+ "reward_credit": "Crédito por recompensa",
37
+ "global_pay_to_usa_debit": "Débito cuenta global",
38
+ "global_pay_to_usa_credit": "Crédito cuenta FBO",
39
+ "usa_pay_to_global_debit": "Débito cuenta FBO",
40
+ "usa_pay_to_global_credit": "Crédito cuenta global",
41
+ "onramp_credit": "Crédito onramp",
42
+ "offramp_debit": "Débito offramp",
43
+ "stable_payout_debit": "Stable Payout",
44
+ "stable_payout_credit": "Crédito Stable Payout",
45
+ "global_pay_to_generic_debit": "Débito pago genérico",
46
+ "global_pay_to_generic_credit": "Retorno pago genérico"
47
+ }
48
+ }
@@ -0,0 +1,18 @@
1
+ import type { TransactionType, TransactionTypeRecord } from "../catalog";
2
+ import type { Locale } from "../../../lang";
3
+ import type { CatalogQuery } from "../../../utils/catalog-query.utils";
4
+ export type TransactionTypeOption = TransactionTypeRecord & {
5
+ label: string;
6
+ };
7
+ /**
8
+ * The catalog indexed by code (same shape as TRANSACTION_TYPES), each record enriched
9
+ * with its label for the given language. Access by code directly, or Object.values for a list.
10
+ */
11
+ export declare const getTransactionTypes: (lang: Locale) => Record<TransactionType, TransactionTypeOption>;
12
+ /** i18n domain: `lang` is required, inside the query object — see matchesQuery for the matching rules. */
13
+ export type TransactionTypeQuery = CatalogQuery<TransactionTypeRecord> & {
14
+ lang: Locale;
15
+ };
16
+ /** The catalog as a list narrowed by the query, each record enriched with its label for `query.lang`. */
17
+ export declare const queryTransactionTypes: (query: TransactionTypeQuery) => TransactionTypeOption[];
18
+ //# sourceMappingURL=transaction-type.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-type.utils.d.ts","sourceRoot":"","sources":["../../../../src/transactions/types/utils/transaction-type.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAGxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAItE,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAS/F,CAAA;AAED,0GAA0G;AAC1G,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,qBAAqB,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzF,yGAAyG;AACzG,eAAO,MAAM,qBAAqB,GAAI,OAAO,oBAAoB,KAAG,qBAAqB,EAIxF,CAAA"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.queryTransactionTypes = exports.getTransactionTypes = void 0;
7
+ const catalog_1 = require("../catalog");
8
+ const en_json_1 = __importDefault(require("../locales/en.json"));
9
+ const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
+ const catalog_query_utils_1 = require("../../../utils/catalog-query.utils");
11
+ const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
12
+ /**
13
+ * The catalog indexed by code (same shape as TRANSACTION_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 getTransactionTypes = (lang) => {
17
+ const locale = locales[lang];
18
+ const result = {};
19
+ for (const record of Object.values(catalog_1.TRANSACTION_TYPES)) {
20
+ result[record.code] = { ...record, label: locale.transactionTypes[record.code] };
21
+ }
22
+ return result;
23
+ };
24
+ exports.getTransactionTypes = getTransactionTypes;
25
+ /** The catalog as a list narrowed by the query, each record enriched with its label for `query.lang`. */
26
+ const queryTransactionTypes = (query) => {
27
+ const { lang, ...filters } = query;
28
+ return Object.values((0, exports.getTransactionTypes)(lang)).filter(option => (0, catalog_query_utils_1.matchesQuery)(option, filters));
29
+ };
30
+ exports.queryTransactionTypes = queryTransactionTypes;
31
+ //# sourceMappingURL=transaction-type.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-type.utils.js","sourceRoot":"","sources":["../../../../src/transactions/types/utils/transaction-type.utils.ts"],"names":[],"mappings":";;;;;;AAAA,wCAA8C;AAE9C,iEAAyC;AACzC,yEAAgD;AAEhD,4EAAiE;AAGjE,MAAM,OAAO,GAAuC,EAAE,EAAE,EAAE,iBAAQ,EAAE,QAAQ,EAAE,qBAAW,EAAE,CAAA;AAI3F;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAkD,EAAE;IAClG,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,MAAM,GAAG,EAAoD,CAAA;IAEnE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,2BAAiB,CAAC,EAAE,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAA;IAClF,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AATY,QAAA,mBAAmB,uBAS/B;AAKD,yGAAyG;AAClG,MAAM,qBAAqB,GAAG,CAAC,KAA2B,EAA2B,EAAE;IAC5F,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAA;IAElC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAA,kCAAY,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AACjG,CAAC,CAAA;AAJY,QAAA,qBAAqB,yBAIjC"}
@@ -0,0 +1,24 @@
1
+ type ReservedKey = "lang";
2
+ /**
3
+ * The query shape for a catalog record: every field optional, each accepting one value or a list of them.
4
+ * A field typed as an array in the record accepts its item type, so `{ geo: "col" }` works whether `geo`
5
+ * is a `Country` or a `Country[]`.
6
+ */
7
+ export type CatalogQuery<TRecord> = {
8
+ [K in Exclude<keyof TRecord, ReservedKey>]?: TRecord[K] extends readonly (infer TItem)[] ? TItem | readonly TItem[] : TRecord[K] | readonly TRecord[K][];
9
+ };
10
+ /**
11
+ * A single value or a list of them, normalized to a list. `undefined` becomes `[undefined]`, which is what
12
+ * makes a present-but-empty key filter instead of being ignored.
13
+ */
14
+ export declare const asList: <T>(value: T | readonly T[]) => readonly T[];
15
+ /**
16
+ * Whether a record satisfies a query: AND across fields, OR within a field, equality only — no operators.
17
+ *
18
+ * A key that is present always filters; what does not filter is the absence of the key. So `{}` matches
19
+ * everything while `{ code: undefined }` matches nothing, and an optional UI filter has to be spread in
20
+ * conditionally rather than passed as `undefined`.
21
+ */
22
+ export declare const matchesQuery: (record: object, query: object) => boolean;
23
+ export {};
24
+ //# sourceMappingURL=catalog-query.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-query.utils.d.ts","sourceRoot":"","sources":["../../src/utils/catalog-query.utils.ts"],"names":[],"mappings":"AAUA,KAAK,WAAW,GAAG,MAAM,CAAA;AAEzB;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,OAAO,IAAI;KACjC,CAAC,IAAI,OAAO,CAAC,MAAM,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACzC,OAAO,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,GACvC,KAAK,GAAG,SAAS,KAAK,EAAE,GACxB,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE;CACzC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,EAAE,KAAG,SAAS,CAAC,EACjB,CAAA;AAM7C;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,OAEe,CAAA"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*
3
+ Domain-agnostic matcher shared by every queryX() in the library. It lives here, and not inside a domain,
4
+ because more catalogs are getting a query API shortly and writing the same matcher four times guarantees
5
+ the semantics drift apart.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.matchesQuery = exports.asList = void 0;
9
+ /**
10
+ * A single value or a list of them, normalized to a list. `undefined` becomes `[undefined]`, which is what
11
+ * makes a present-but-empty key filter instead of being ignored.
12
+ */
13
+ const asList = (value) => Array.isArray(value) ? value : [value];
14
+ exports.asList = asList;
15
+ /* A scalar field matches by equality; an array field matches when it contains any of the wanted values. */
16
+ const matchesField = (actual, wanted) => Array.isArray(actual) ? actual.some(item => wanted.includes(item)) : wanted.includes(actual);
17
+ /**
18
+ * Whether a record satisfies a query: AND across fields, OR within a field, equality only — no operators.
19
+ *
20
+ * A key that is present always filters; what does not filter is the absence of the key. So `{}` matches
21
+ * everything while `{ code: undefined }` matches nothing, and an optional UI filter has to be spread in
22
+ * conditionally rather than passed as `undefined`.
23
+ */
24
+ const matchesQuery = (record, query) => Object.entries(query).every(([field, value]) => matchesField(record[field], (0, exports.asList)(value)));
25
+ exports.matchesQuery = matchesQuery;
26
+ //# sourceMappingURL=catalog-query.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-query.utils.js","sourceRoot":"","sources":["../../src/utils/catalog-query.utils.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;AAoBF;;;GAGG;AACI,MAAM,MAAM,GAAG,CAAI,KAAuB,EAAgB,EAAE,CACjE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAU,CAAC,CAAA;AADhC,QAAA,MAAM,UAC0B;AAE7C,2GAA2G;AAC3G,MAAM,YAAY,GAAG,CAAC,MAAe,EAAE,MAA0B,EAAW,EAAE,CAC5E,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAE9F;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,KAAa,EAAW,EAAE,CACrE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAC7C,YAAY,CAAE,MAAkC,CAAC,KAAK,CAAC,EAAE,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAF/D,QAAA,YAAY,gBAEmD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/library-portal-core",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "description": "Shared configurations and resources for Portal MFEs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",