Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.

Commit 535addf

Browse files
authored
Update schema types (#33)
* update schema types * version bump
1 parent 675208e commit 535addf

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "getindexify",
3-
"version": "0.0.40",
3+
"version": "0.0.41",
44
"description": "This is the TypeScript client for interacting with the Indexify service.",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

src/types.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ export interface IExtractor {
2121
}
2222

2323
export interface ISchema {
24-
columns: Record<string, string | number | boolean>;
25-
content_source: string;
24+
id: string;
25+
extraction_graph_name: string;
2626
namespace: string;
27+
columns: Record<
28+
string,
29+
{
30+
column_type: string;
31+
comment?: string;
32+
}
33+
>;
2734
}
2835
export interface IIndex {
2936
name: string;
@@ -91,11 +98,10 @@ export interface ITaskContentMetadata {
9198
extraction_policy_ids: Record<string, number>;
9299
}
93100

94-
95101
export enum TaskStatus {
96102
Unknown = 0,
97103
Failure = 1,
98-
Success = 2
104+
Success = 2,
99105
}
100106

101107
export interface ITask {

tests/client.test.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,26 @@ test("getStructuredMetadata", async () => {
205205
});
206206

207207
test("getSchemas", async () => {
208-
const client = await IndexifyClient.createClient();
209-
await client.getSchemas();
208+
const nanoid = generateNanoId(8);
209+
const client = await IndexifyClient.createNamespace({
210+
name: `testgetcontent.${nanoid}`,
211+
});
212+
const extractionGraphName = "schematestgraph";
213+
await setupExtractionGraph(
214+
client,
215+
extractionGraphName,
216+
"tensorlake/wikipedia"
217+
);
218+
219+
// upload html
220+
await client.uploadFile(extractionGraphName, `${__dirname}/files/steph_curry.html`);
221+
await new Promise((r) => setTimeout(r, 10000));
222+
223+
224+
const schemas = await client.getSchemas();
225+
expect(schemas.length).toBe(1);
226+
expect(schemas[0].extraction_graph_name).toBe(extractionGraphName)
227+
expect(Object.keys(schemas[0].columns).length).toBe(13)
210228
});
211229

212230
test("downloadContent", async () => {

0 commit comments

Comments
 (0)