Skip to content

Commit 3090768

Browse files
committed
Fix merge conflicts
1 parent 3005d03 commit 3090768

File tree

3 files changed

+3
-107
lines changed

3 files changed

+3
-107
lines changed

src/batch.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import {
33
BatchObject,
44
BatchesQuery,
55
BatchesResults,
6-
<<<<<<< HEAD
76
BatchesResultsObject,
8-
=======
9-
>>>>>>> 87ac02b (Add getBatch)
107
} from "./types";
118
import { HttpRequests, toQueryParams } from "./http-requests";
129

@@ -54,31 +51,18 @@ class BatchClient {
5451
* @returns Promise containing all tasks
5552
*/
5653
async getBatches(parameters: BatchesQuery = {}): Promise<BatchesResults> {
57-
<<<<<<< HEAD
5854
const url = `batches`;
5955

60-
const tasks = await this.httpRequest.get<Promise<BatchesResultsObject>>(
56+
const batches = await this.httpRequest.get<Promise<BatchesResultsObject>>(
6157
url,
6258
toQueryParams<BatchesQuery>(parameters),
63-
=======
64-
const url = `tasks`;
65-
66-
const tasks = await this.httpRequest.get<Promise<TasksResultsObject>>(
67-
url,
68-
toQueryParams<TasksQuery>(parameters),
69-
>>>>>>> 87ac02b (Add getBatch)
7059
);
7160

7261
return {
73-
...tasks,
74-
results: tasks.results.map((task) => new Batch(task)),
62+
...batches,
63+
results: batches.results.map((batch) => new Batch(batch)),
7564
};
7665
}
77-
<<<<<<< HEAD
78-
=======
79-
80-
81-
>>>>>>> 87ac02b (Add getBatch)
8266
}
8367

8468
export { BatchClient, Batch };

src/types/types.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ export type WaitOptions = {
666666
** BATCHES
667667
*/
668668

669-
<<<<<<< HEAD
670669
/**
671670
* Represents a batch operation object containing information about tasks
672671
* processing
@@ -716,37 +715,11 @@ export type BatchObject = {
716715
/** Timestamp when the batch finished processing (rfc3339 format) */
717716
finishedAt: string;
718717
/** Duration of batch processing */
719-
=======
720-
export type BatchObject = {
721-
uid: number;
722-
// TODO
723-
details: null;
724-
progress: null;
725-
stats: {
726-
totalNbTasks: number;
727-
status: {
728-
succeeded: number;
729-
failed: number;
730-
canceled: number;
731-
processing: number;
732-
enqueued: number;
733-
};
734-
// TODO
735-
types: null;
736-
indexUids: string[];
737-
};
738-
startedAt: string;
739-
finishedAt: string;
740-
// TODO
741-
>>>>>>> 87ac02b (Add getBatch)
742718
duration: string;
743719
};
744720

745721
export type BatchesQuery = {
746-
<<<<<<< HEAD
747722
/** The batch should contain the specified task UIDs */
748-
=======
749-
>>>>>>> 87ac02b (Add getBatch)
750723
uids?: number[];
751724
batchUids?: number[];
752725
types?: TaskTypes[];
@@ -761,11 +734,7 @@ export type BatchesQuery = {
761734
afterFinishedAt?: Date;
762735
limit?: number;
763736
from?: number;
764-
<<<<<<< HEAD
765737
};
766-
=======
767-
}
768-
>>>>>>> 87ac02b (Add getBatch)
769738

770739
export type BatchesResults = CursorResults<Batch>;
771740
export type BatchesResultsObject = CursorResults<BatchObject>;

tests/batch.test.ts

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
import { afterAll, beforeEach, describe, expect, test } from "vitest";
2-
<<<<<<< HEAD
3-
import {
4-
config,
5-
getClient,
6-
clearAllIndexes,
7-
} from "./utils/meilisearch-test-utils";
8-
import { sleep } from "../src/utils";
9-
=======
102
import { config, getClient, clearAllIndexes } from "./utils/meilisearch-test-utils";
11-
>>>>>>> 87ac02b (Add getBatch)
123

134
const index = {
145
uid: "batch-test",
@@ -18,49 +9,6 @@ afterAll(() => {
189
return clearAllIndexes(config);
1910
});
2011

21-
<<<<<<< HEAD
22-
describe.each([{ permission: "Master" }, { permission: "Admin" }])(
23-
"Tests on batches",
24-
({ permission }) => {
25-
beforeEach(async () => {
26-
const client = await getClient("Master");
27-
const { taskUid } = await client.createIndex(
28-
`${permission}-${index.uid}`,
29-
);
30-
await client.waitForTask(taskUid);
31-
});
32-
33-
test(`${permission} key: Get all batches`, async () => {
34-
const client = await getClient(permission);
35-
const { taskUid } = await client.createIndex(
36-
`${permission}-${index.uid}-second-index`,
37-
);
38-
await client.waitForTask(taskUid);
39-
const batches = await client.getBatches({ limit: 2 });
40-
41-
expect(batches.results).toBeInstanceOf(Array);
42-
expect(batches.results.length).toEqual(2);
43-
expect(batches.total).toBeGreaterThan(0);
44-
expect(batches.results[0]).toHaveProperty("uid");
45-
expect(batches.results[0]).toHaveProperty("details");
46-
expect(batches.results[0]).toHaveProperty("stats");
47-
expect(batches.results[0]).toHaveProperty("duration");
48-
expect(batches.results[0]).toHaveProperty("startedAt");
49-
expect(batches.results[0]).toHaveProperty("finishedAt");
50-
});
51-
52-
test(`${permission} key: Get one batch`, async () => {
53-
const client = await getClient(permission);
54-
55-
const batches = await client.getBatches({
56-
limit: 1,
57-
});
58-
console.log("batches", batches.results[0].uid, "exists");
59-
60-
const batch = await client.getBatch(batches.results[0].uid);
61-
expect(batch.uid).toEqual(batches.results[0].uid);
62-
expect(batch.details).toBeInstanceOf(Object);
63-
=======
6412
describe.each([
6513
{ permission: "Master" },
6614
{ permission: "Admin" }
@@ -78,7 +26,6 @@ describe.each([
7826
expect(batch.uid).toEqual(1);
7927
expect(batch.details).toHaveProperty("receivedDocuments");
8028
expect(batch.details).toHaveProperty("indexedDocuments");
81-
>>>>>>> 87ac02b (Add getBatch)
8229
expect(batch.stats).toHaveProperty("totalNbTasks");
8330
expect(batch.stats).toHaveProperty("status");
8431
expect(batch.stats).toHaveProperty("types");
@@ -89,7 +36,3 @@ describe.each([
8936
});
9037
},
9138
);
92-
<<<<<<< HEAD
93-
=======
94-
95-
>>>>>>> 87ac02b (Add getBatch)

0 commit comments

Comments
 (0)