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

Fix initialize client #31

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.38",
"version": "0.0.39",
"description": "This is the TypeScript client for interacting with the Indexify service.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
27 changes: 7 additions & 20 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,13 @@ class IndexifyClient {
return new IndexifyClient(
serviceUrl,
namespace,
response.data.namespace.extraction_graphs.map(
(item: {
id: string;
name: string;
extractor: string;
filters_eq: string;
input_params: Record<string, string | number>;
content_source: string;
}) => {
// abstraction for filters_eq
return {
id: item.id,
name: item.name,
extractor: item.extractor,
labels_eq: item.filters_eq,
input_params: item.input_params,
content_source: item.content_source,
};
}
) as IExtractionGraph[],
response.data.namespace.extraction_graphs.map((graph: { extraction_policies: any[]; }) => ({
...graph,
extraction_policies: graph.extraction_policies.map((policy: { filters_eq: any; }) => ({
...policy,
labels_eq: policy.filters_eq, // Transform filters_eq to labels_eq
}))
})),
IndexifyClient.getHttpsAgent({ mtlsConfig })
);
}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface IExtractionPolicy {
labels_eq?: string;
input_params?: Record<string, string | number>;
content_source?: string;
graph_name: string;
}

export interface ITaskContentMetadata {
Expand Down
1 change: 1 addition & 0 deletions tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async function setupExtractionGraph(
const extractionPolicy: IExtractionPolicy = {
extractor,
name: `extractor.${nanoid}`,
graph_name: extractionGraphName
};
const resp = await client.createExtractionGraph(
extractionGraphName,
Expand Down