-
Notifications
You must be signed in to change notification settings - Fork 100
Add export method feature #2036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
663f1f2
e82ddc0
b9d1a47
f0b5896
3191780
99fd3ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import type { Filter } from "./types.js"; | ||
|
|
||
| /** | ||
| * {@link https://www.meilisearch.com/docs/reference/api/export#indexes} | ||
| * | ||
| * @see `meilisearch::routes::export::ExportIndexSettings` | ||
| */ | ||
| export type ExportIndexSettings = { | ||
| filter?: Filter; | ||
| overrideSettings?: boolean; | ||
| }; | ||
|
|
||
| /** {@link https://www.meilisearch.com/docs/reference/api/export#indexes} */ | ||
| export type ExportIndexSettingsRecord = Record<string, ExportIndexSettings>; | ||
|
|
||
| /** | ||
| * {@link https://www.meilisearch.com/docs/reference/api/export#body} | ||
| * | ||
| * @see `meilisearch::routes::export::Export` | ||
| */ | ||
| export type ExportOptions = { | ||
| /** {@link https://www.meilisearch.com/docs/reference/api/export#url} */ | ||
| url: string; | ||
| /** {@link https://www.meilisearch.com/docs/reference/api/export#apikey} */ | ||
| apiKey?: string; | ||
| /** {@link https://www.meilisearch.com/docs/reference/api/export#payloadsize} */ | ||
| payloadSize?: string; | ||
| /** {@link https://www.meilisearch.com/docs/reference/api/export#indexes} */ | ||
| indexes?: ExportIndexSettingsRecord; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { randomUUID } from "node:crypto"; | ||
| import { afterAll, beforeAll, test } from "vitest"; | ||
| import { assert, getClient } from "./utils/meilisearch-test-utils.js"; | ||
|
|
||
| const INDEX_UID = randomUUID(); | ||
| const ms = await getClient("Master"); | ||
|
|
||
| beforeAll(async () => { | ||
| const task = await ms.createIndex(INDEX_UID).waitTask(); | ||
| assert.isTaskSuccessful(task); | ||
|
|
||
| const task2 = await ms | ||
| .index(INDEX_UID) | ||
| .addDocuments([{ id: 0, beep: "boop" }]) | ||
| .waitTask(); | ||
| assert.isTaskSuccessful(task2); | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| const task = await ms.deleteIndex(INDEX_UID).waitTask(); | ||
| assert.isTaskSuccessful(task); | ||
| }); | ||
|
|
||
| test(`${ms.export.name} method`, async () => { | ||
| const task = await ms | ||
| .export({ | ||
| url: "http://127.0.0.1:7702", | ||
|
||
| apiKey: "masterKey", | ||
| payloadSize: "50MiB", | ||
| indexes: { | ||
| [INDEX_UID]: { filter: "beep = boop", overrideSettings: true }, | ||
| }, | ||
| }) | ||
| .waitTask({ timeout: 60_000 }); | ||
|
|
||
| assert.isTaskSuccessful(task); | ||
| assert.strictEqual(task.type, "export"); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.