@bluecopa/core 0.1.94 → 0.1.95

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.
@@ -0,0 +1,2 @@
1
+ import { VirtualDataset } from '../../../../models/src/lib/gen/Api';
2
+ export declare const getVirtualDatasets: () => Promise<VirtualDataset[]>;
@@ -1,3 +1,4 @@
1
1
  export * from './getData';
2
2
  export * from './getSampleData';
3
3
  export * from './getDatasets';
4
+ export * from './getVirtualDatasets';
@@ -1,22 +1,35 @@
1
1
  export interface ReconV2Workflow {
2
2
  [key: string]: any;
3
3
  }
4
+ export interface ReconV2DatasetRef {
5
+ id: string;
6
+ name: string;
7
+ dateColumn?: string | null;
8
+ }
4
9
  export interface CreateReconV2Request {
5
10
  /** Workflow name — non-alphanumeric characters are replaced with underscores */
6
11
  name: string;
7
12
  /** Recon type, defaults to SMART_RECONCILIATION */
8
13
  type?: string;
14
+ /** Left (primary/source) dataset — provide together with rightDataset to make the workflow immediately runnable */
15
+ leftDataset?: ReconV2DatasetRef;
16
+ /** Right (secondary/target) dataset — provide together with leftDataset */
17
+ rightDataset?: ReconV2DatasetRef;
9
18
  /** Optional initial workflow config (leftDef, rightDef, matchGroups, sources, ...) */
10
19
  config?: Partial<ReconV2Workflow>;
11
20
  }
12
21
  /**
13
22
  * Creates a recon v2 (SMART_RECONCILIATION) workflow along with its backing
14
- * RECON workbook
23
+ * RECON workbook. When leftDataset + rightDataset are provided, the workbook
24
+ * sheets and workflow defs are wired to the datasets so the workflow can be
25
+ * run immediately (smart mode auto-detects match columns).
15
26
  * @param params - The create parameters
16
27
  * @param params.name - Required: Name for the new reconciliation
17
28
  * @param params.type - Optional: Recon type (defaults to SMART_RECONCILIATION)
29
+ * @param params.leftDataset - Optional: Left dataset { id, name, dateColumn? }
30
+ * @param params.rightDataset - Optional: Right dataset { id, name, dateColumn? }
18
31
  * @param params.config - Optional: Initial workflow config to merge in
19
32
  * @returns Promise<ReconV2Workflow> The created workflow
20
33
  * @throws Error if the request fails
21
34
  */
22
- export declare function createReconV2({ name, type, config, }: CreateReconV2Request): Promise<ReconV2Workflow>;
35
+ export declare function createReconV2({ name, type, leftDataset, rightDataset, config, }: CreateReconV2Request): Promise<ReconV2Workflow>;
@@ -0,0 +1,20 @@
1
+ export interface GetReconV2RunsRequest {
2
+ workflowId: string;
3
+ }
4
+ export interface ReconV2Run {
5
+ id?: string;
6
+ workflowId?: string;
7
+ status?: string;
8
+ startedAt?: string;
9
+ finishedAt?: string;
10
+ errorMessages?: string[];
11
+ [key: string]: any;
12
+ }
13
+ /**
14
+ * Gets the run history of a recon v2 workflow
15
+ * @param params - The request parameters
16
+ * @param params.workflowId - Required: The workflow ID
17
+ * @returns Promise<ReconV2Run[]> The runs (newest first)
18
+ * @throws Error if the request fails
19
+ */
20
+ export declare function getReconV2Runs({ workflowId, }: GetReconV2RunsRequest): Promise<ReconV2Run[]>;
@@ -3,6 +3,7 @@ export * from './updateReconV2';
3
3
  export * from './deleteReconV2';
4
4
  export * from './runReconV2';
5
5
  export * from './getAllReconV2Workflows';
6
+ export * from './getReconV2Runs';
6
7
  export * from './getReconV2RunResult';
7
8
  export * from './getReconV2SmartResult';
8
9
  export * from './profileReconV2';
@@ -1,15 +1,26 @@
1
- import { ReconV2Workflow } from './createReconV2';
1
+ import { ReconV2DatasetRef, ReconV2Workflow } from './createReconV2';
2
2
  export interface UpdateReconV2Request {
3
3
  /** Full workflow object including its id */
4
4
  reconWorkflow: ReconV2Workflow;
5
+ /** Optional: rewire the primary (left) sheet to this dataset */
6
+ leftDataset?: ReconV2DatasetRef;
7
+ /** Optional: rewire the secondary (right) sheet to this dataset */
8
+ rightDataset?: ReconV2DatasetRef;
5
9
  }
6
10
  /**
7
11
  * Updates (saves) a recon v2 workflow config.
12
+ * When leftDataset/rightDataset are provided, the backing workbook's
13
+ * primary/secondary sheet is rewired to the dataset and the workflow's
14
+ * leftDef/rightDef ImportDefs are rebuilt server-side. The workflow's
15
+ * `sources` are always kept in sync server-side — callers don't need to
16
+ * (and shouldn't) compute them.
8
17
  * Note: V2 settings stored on the workbook (customFields.reconV2 — currency,
9
18
  * exceptionGroups, policies, prompts) are updated via workbook.saveWorkbook.
10
19
  * @param params - The update parameters
11
20
  * @param params.reconWorkflow - Required: The workflow object with id
21
+ * @param params.leftDataset - Optional: Left dataset { id, name, dateColumn? }
22
+ * @param params.rightDataset - Optional: Right dataset { id, name, dateColumn? }
12
23
  * @returns Promise<ReconV2Workflow> The updated workflow
13
24
  * @throws Error if the request fails
14
25
  */
15
- export declare function updateReconV2({ reconWorkflow, }: UpdateReconV2Request): Promise<ReconV2Workflow>;
26
+ export declare function updateReconV2({ reconWorkflow, leftDataset, rightDataset, }: UpdateReconV2Request): Promise<ReconV2Workflow>;
package/dist/index.d.ts CHANGED
@@ -10,10 +10,11 @@ export type { AuditRecord, CreateAuditLogRequest, } from './api/audit/createAudi
10
10
  export type { TemplatedPipelineWorkflow, GetAllTemplatedPipelinesResponse, } from './api/templatedPipeline/getAllTemplatedPipelines';
11
11
  export type { ReconWorkflow } from './api/recon/getAllReconWorkflows';
12
12
  export type { RunReconRequest, RunReconResponse } from './api/recon/runRecon';
13
- export type { ReconV2Workflow, CreateReconV2Request, } from './api/reconV2/createReconV2';
13
+ export type { ReconV2Workflow, ReconV2DatasetRef, CreateReconV2Request, } from './api/reconV2/createReconV2';
14
14
  export type { UpdateReconV2Request } from './api/reconV2/updateReconV2';
15
15
  export type { DeleteReconV2Request, DeleteReconV2Response, } from './api/reconV2/deleteReconV2';
16
16
  export type { ReconV2MatchConfig, RunReconV2Request, RunReconV2Response, } from './api/reconV2/runReconV2';
17
+ export type { GetReconV2RunsRequest, ReconV2Run, } from './api/reconV2/getReconV2Runs';
17
18
  export type { GetReconV2RunResultRequest, ReconV2RunResult, } from './api/reconV2/getReconV2RunResult';
18
19
  export type { GetReconV2SmartResultRequest, ReconV2SmartResult, } from './api/reconV2/getReconV2SmartResult';
19
20
  export type { ReconV2ProfileRequest, ReconV2ProfileResult, } from './api/reconV2/profileReconV2';
package/dist/index.es.js CHANGED
@@ -10548,7 +10548,7 @@ const getSampleData = async ({
10548
10548
  };
10549
10549
  const getAllDatasets = async () => {
10550
10550
  try {
10551
- const response = await apiClient.post("/datasets/get-datasets");
10551
+ const response = await apiClient.get("/datasets/get-datasets");
10552
10552
  if (!response.data) {
10553
10553
  throw { message: "Failed to fetch datasets", status: 500 };
10554
10554
  }
@@ -10559,11 +10559,25 @@ const getAllDatasets = async () => {
10559
10559
  throw { message, status };
10560
10560
  }
10561
10561
  };
10562
+ const getVirtualDatasets = async () => {
10563
+ try {
10564
+ const response = await apiClient.get("/virtual-datasets/get-virtual-datasets");
10565
+ if (!response.data) {
10566
+ throw { message: "Failed to fetch virtual datasets", status: 500 };
10567
+ }
10568
+ return response.data;
10569
+ } catch (error) {
10570
+ const message = error.response?.data?.message || error.message || "An unexpected error occurred while fetching virtual datasets";
10571
+ const status = error.response?.status || 500;
10572
+ throw { message, status };
10573
+ }
10574
+ };
10562
10575
  const index$h = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10563
10576
  __proto__: null,
10564
10577
  getAllDatasets,
10565
10578
  getData: getData$2,
10566
- getSampleData
10579
+ getSampleData,
10580
+ getVirtualDatasets
10567
10581
  }, Symbol.toStringTag, { value: "Module" }));
10568
10582
  const getPublishedWorkbookById = async ({
10569
10583
  type,
@@ -11297,6 +11311,8 @@ const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
11297
11311
  async function createReconV2({
11298
11312
  name,
11299
11313
  type,
11314
+ leftDataset,
11315
+ rightDataset,
11300
11316
  config
11301
11317
  }) {
11302
11318
  try {
@@ -11306,6 +11322,8 @@ async function createReconV2({
11306
11322
  const response = await apiClient.post("/recon-v2/create", {
11307
11323
  name,
11308
11324
  type,
11325
+ leftDataset,
11326
+ rightDataset,
11309
11327
  config
11310
11328
  });
11311
11329
  if (!response.data) {
@@ -11319,14 +11337,18 @@ async function createReconV2({
11319
11337
  }
11320
11338
  }
11321
11339
  async function updateReconV2({
11322
- reconWorkflow
11340
+ reconWorkflow,
11341
+ leftDataset,
11342
+ rightDataset
11323
11343
  }) {
11324
11344
  try {
11325
11345
  if (!reconWorkflow?.id) {
11326
11346
  throw { message: "reconWorkflow with id is required", status: 400 };
11327
11347
  }
11328
11348
  const response = await apiClient.put("/recon-v2/update", {
11329
- reconWorkflow
11349
+ reconWorkflow,
11350
+ leftDataset,
11351
+ rightDataset
11330
11352
  });
11331
11353
  if (!response.data) {
11332
11354
  throw { message: "Failed to update recon v2 workflow", status: 500 };
@@ -11399,6 +11421,27 @@ async function getAllReconV2Workflows() {
11399
11421
  throw { message, status };
11400
11422
  }
11401
11423
  }
11424
+ async function getReconV2Runs({
11425
+ workflowId
11426
+ }) {
11427
+ try {
11428
+ const id = workflowId?.trim();
11429
+ if (!id) {
11430
+ throw { message: "Workflow ID is required", status: 400 };
11431
+ }
11432
+ const response = await apiClient.get(
11433
+ `/recon-v2/runs/${encodeURIComponent(id)}`
11434
+ );
11435
+ if (!response.data || !response.data.data) {
11436
+ throw { message: "Failed to fetch recon v2 runs", status: 500 };
11437
+ }
11438
+ return response.data.data;
11439
+ } catch (error) {
11440
+ const message = error.response?.data?.message || error.message || "An unexpected error occurred while fetching recon v2 runs";
11441
+ const status = error.response?.status || 500;
11442
+ throw { message, status };
11443
+ }
11444
+ }
11402
11445
  async function getReconV2RunResult({
11403
11446
  runId
11404
11447
  }) {
@@ -11592,6 +11635,7 @@ const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
11592
11635
  getReconV2Explanation,
11593
11636
  getReconV2ProfileResult,
11594
11637
  getReconV2RunResult,
11638
+ getReconV2Runs,
11595
11639
  getReconV2SmartResult,
11596
11640
  runReconV2,
11597
11641
  startReconV2Clean,