Skip to content

Commit

Permalink
Update schema types (#33)
Browse files Browse the repository at this point in the history
* update schema types

* version bump
  • Loading branch information
lucasjacks0n authored May 13, 2024
1 parent 675208e commit 535addf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "getindexify",
"version": "0.0.40",
"version": "0.0.41",
"description": "This is the TypeScript client for interacting with the Indexify service.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
14 changes: 10 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ export interface IExtractor {
}

export interface ISchema {
columns: Record<string, string | number | boolean>;
content_source: string;
id: string;
extraction_graph_name: string;
namespace: string;
columns: Record<
string,
{
column_type: string;
comment?: string;
}
>;
}
export interface IIndex {
name: string;
Expand Down Expand Up @@ -91,11 +98,10 @@ export interface ITaskContentMetadata {
extraction_policy_ids: Record<string, number>;
}


export enum TaskStatus {
Unknown = 0,
Failure = 1,
Success = 2
Success = 2,
}

export interface ITask {
Expand Down
22 changes: 20 additions & 2 deletions tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,26 @@ test("getStructuredMetadata", async () => {
});

test("getSchemas", async () => {
const client = await IndexifyClient.createClient();
await client.getSchemas();
const nanoid = generateNanoId(8);
const client = await IndexifyClient.createNamespace({
name: `testgetcontent.${nanoid}`,
});
const extractionGraphName = "schematestgraph";
await setupExtractionGraph(
client,
extractionGraphName,
"tensorlake/wikipedia"
);

// upload html
await client.uploadFile(extractionGraphName, `${__dirname}/files/steph_curry.html`);
await new Promise((r) => setTimeout(r, 10000));


const schemas = await client.getSchemas();
expect(schemas.length).toBe(1);
expect(schemas[0].extraction_graph_name).toBe(extractionGraphName)
expect(Object.keys(schemas[0].columns).length).toBe(13)
});

test("downloadContent", async () => {
Expand Down

0 comments on commit 535addf

Please sign in to comment.