@cobre-npm/library-portal-core 0.42.0 → 0.43.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.
package/README.md CHANGED
@@ -46,6 +46,7 @@ import { getCountries } from "@cobre-npm/library-portal-core/countries"
46
46
  | `@cobre-npm/library-portal-core/canonicalTransactions` | Canonical transaction/money-movement detail interfaces |
47
47
  | `@cobre-npm/library-portal-core/search` | Search / aggregation interfaces |
48
48
  | `@cobre-npm/library-portal-core/trustedSessions` | Trusted session (OTP elevation window) interfaces + constants |
49
+ | `@cobre-npm/library-portal-core/exports` | Export request/response entity + the engine's format/operator allow-lists |
49
50
  | `@cobre-npm/library-portal-core/lang` | Supported locales (`Locale`, defaults) |
50
51
  | `@cobre-npm/library-portal-core` (root) | ⚠️ **Legacy / deprecated** — see [below](#legacy-code--and-its-deprecation) |
51
52
 
@@ -448,6 +449,41 @@ import type {
448
449
  doc comment for one case that's a superset of two non-overlapping shapes rather than a clean merge,
449
450
  and revisit it once the real payload is confirmed.
450
451
 
452
+ ### `exports`
453
+
454
+ Interfaces only (pure types) — the export engine's (`util-platform-exports`) request/response contract,
455
+ verified against its real DTO and entity, not against what any consumer had guessed:
456
+
457
+ ```ts
458
+ import {
459
+ type ExportRequest, type ExportQueryConfig, type ExportQueryFilter, type ExportQuerySort,
460
+ type ExportResponse, type ExportStatus, type ExportCreator, type ExportStatusState,
461
+ EXPORT_FORMATS, type ExportFormat,
462
+ EXPORT_QUERY_OPERATORS, type ExportQueryOperator,
463
+ } from "@cobre-npm/library-portal-core/exports"
464
+ ```
465
+
466
+ - `ExportResponse` is the **same entity** whether it just came back from `POST /v1/exports` (creating it)
467
+ or from a later `GET` (reading it) — the engine stores one record per export and updates
468
+ `status`/`updated_at`/`export_path` in place as it processes. Both the exports list/status view in
469
+ `portal` and any widget that creates exports read/write this one shape; keeping two hand-typed copies
470
+ is what let each one drift from the real contract in its own way (see the two fixes below).
471
+ - `EXPORT_QUERY_OPERATORS` is the engine's **real** allow-list (`eq`, `gt`, `lt`, `lte`, `gte`) — narrower
472
+ than what a layout's catalog is allowed to declare (`between`, `in`, `like`, `neq` are valid catalog
473
+ entries the engine still rejects at request time). A consumer validating a filter before sending it
474
+ needs the intersection of both, not just the catalog's.
475
+ - `ExportQuerySort` uses `field`; `ExportQueryFilter` uses `column` — not a typo, the engine's own DTOs
476
+ name the two differently.
477
+ - `column_aggregations` is a required `boolean` (apply aggregations or don't), not a per-column map — the
478
+ catalog's `aggregation: "sum"` markers describe what *can* be aggregated, not the request shape.
479
+ - `language` is deliberately typed `string`, not `Locale`: the engine validates it against
480
+ `/^[a-z]{2}(-[A-Z]{2})?$/` (a BCP-47-shaped language tag), and `Locale`'s `"es-mex"` value doesn't match
481
+ that pattern — the two look interchangeable because they happen to cover the same two languages today,
482
+ but `Locale` names a translation-file convention (`locales/es-mex.json`), not this engine's contract.
483
+ - **Deliberately excludes the export catalog** (`GET .../catalog/{layout}`, i.e. which columns/operators a
484
+ given layout allows) — that stays with whichever widget owns fetching it, not here; it isn't a shape
485
+ two independent consumers need to agree on today.
486
+
451
487
  ---
452
488
 
453
489
  ## i18n / languages
@@ -0,0 +1,21 @@
1
+ export * from "./interfaces/common.interface";
2
+ export * from "./interfaces/request.interface";
3
+ export * from "./interfaces/response.interface";
4
+ export declare const EXPORT_FORMATS: {
5
+ readonly CSV: "csv";
6
+ readonly JSON: "json";
7
+ };
8
+ export type ExportFormat = typeof EXPORT_FORMATS[keyof typeof EXPORT_FORMATS];
9
+ /**
10
+ * The export engine's real allow-list (verified against util-platform-exports'
11
+ * QueryOperator enum). A layout's catalog can declare more operators than this
12
+ * ("between", "in", "like", "neq") — those are rejected by the engine at request time.
13
+ */
14
+ export declare const EXPORT_QUERY_OPERATORS: {
15
+ readonly EQ: "eq";
16
+ readonly GT: "gt";
17
+ readonly LT: "lt";
18
+ readonly LTE: "lte";
19
+ readonly GTE: "gte";
20
+ };
21
+ export type ExportQueryOperator = typeof EXPORT_QUERY_OPERATORS[keyof typeof EXPORT_QUERY_OPERATORS];
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.EXPORT_QUERY_OPERATORS = exports.EXPORT_FORMATS = void 0;
18
+ __exportStar(require("./interfaces/common.interface"), exports);
19
+ __exportStar(require("./interfaces/request.interface"), exports);
20
+ __exportStar(require("./interfaces/response.interface"), exports);
21
+ exports.EXPORT_FORMATS = {
22
+ CSV: "csv",
23
+ JSON: "json"
24
+ };
25
+ /**
26
+ * The export engine's real allow-list (verified against util-platform-exports'
27
+ * QueryOperator enum). A layout's catalog can declare more operators than this
28
+ * ("between", "in", "like", "neq") — those are rejected by the engine at request time.
29
+ */
30
+ exports.EXPORT_QUERY_OPERATORS = {
31
+ EQ: "eq",
32
+ GT: "gt",
33
+ LT: "lt",
34
+ LTE: "lte",
35
+ GTE: "gte"
36
+ };
@@ -0,0 +1,11 @@
1
+ import type { ExportQueryOperator } from "../index";
2
+ export interface ExportQueryFilter {
3
+ column: string;
4
+ type: string;
5
+ operator: ExportQueryOperator;
6
+ value: string;
7
+ }
8
+ export interface ExportQuerySort {
9
+ field: string;
10
+ order: "asc" | "desc";
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import type { ExportFormat } from "../index";
2
+ import type { ExportQueryFilter, ExportQuerySort } from "./common.interface";
3
+ export interface ExportQueryConfig {
4
+ format: ExportFormat;
5
+ language: string;
6
+ timezone: string;
7
+ start_date: string;
8
+ end_date: string;
9
+ columns: string[];
10
+ column_aggregations: boolean;
11
+ query_filters?: ExportQueryFilter[];
12
+ query_sorting?: ExportQuerySort[];
13
+ }
14
+ export interface ExportRequest {
15
+ layout: string;
16
+ query_config: ExportQueryConfig;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,32 @@
1
+ import type { ExportQueryConfig } from "./request.interface";
2
+ /** Verified against util-platform-exports' ExportStatusState enum. */
3
+ export type ExportStatusState = "initiated" | "processing" | "created" | "failed";
4
+ export interface ExportCreator {
5
+ user_id: string;
6
+ email: string;
7
+ role_id: string;
8
+ sensitive_data: boolean;
9
+ }
10
+ export interface ExportStatus {
11
+ state: ExportStatusState;
12
+ code: string;
13
+ description: string;
14
+ }
15
+ /**
16
+ * The export entity — same shape whether it just came back from POST /v1/exports
17
+ * (creating it) or from a later GET (reading it): the engine stores one record per
18
+ * export and updates status/updated_at/export_path in place as it processes.
19
+ * Verified against util-platform-exports' ExportData entity.
20
+ */
21
+ export interface ExportResponse {
22
+ id: string;
23
+ client_id: string;
24
+ creator: ExportCreator;
25
+ status: ExportStatus;
26
+ layout: string;
27
+ query_config: ExportQueryConfig;
28
+ created_at: string;
29
+ updated_at: string;
30
+ ttl?: number;
31
+ export_path?: string;
32
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ export * from "./interfaces/common.interface";
2
+ export * from "./interfaces/request.interface";
3
+ export * from "./interfaces/response.interface";
4
+ export const EXPORT_FORMATS = {
5
+ CSV: "csv",
6
+ JSON: "json"
7
+ };
8
+ /**
9
+ * The export engine's real allow-list (verified against util-platform-exports'
10
+ * QueryOperator enum). A layout's catalog can declare more operators than this
11
+ * ("between", "in", "like", "neq") — those are rejected by the engine at request time.
12
+ */
13
+ export const EXPORT_QUERY_OPERATORS = {
14
+ EQ: "eq",
15
+ GT: "gt",
16
+ LT: "lt",
17
+ LTE: "lte",
18
+ GTE: "gte"
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/library-portal-core",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "Shared configurations and resources for Portal MFEs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -70,6 +70,11 @@
70
70
  "types": "./dist/cjs/lang/index.d.ts",
71
71
  "import": "./dist/esm/lang/index.js",
72
72
  "require": "./dist/cjs/lang/index.js"
73
+ },
74
+ "./exports": {
75
+ "types": "./dist/cjs/exports/index.d.ts",
76
+ "import": "./dist/esm/exports/index.js",
77
+ "require": "./dist/cjs/exports/index.js"
73
78
  }
74
79
  },
75
80
  "files": [