@inflexa-ai/harness 0.30.3 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/target-dossier.d.ts +61 -61
- package/dist/execution/run-synthesis.js +7 -2
- package/dist/lib/zod-issues.d.ts +8 -0
- package/dist/lib/zod-issues.js +13 -0
- package/dist/literature/sources/semantic-scholar.d.ts +34 -0
- package/dist/literature/sources/semantic-scholar.js +15 -4
- package/dist/prompts/briefing.d.ts +12 -1
- package/dist/prompts/briefing.js +27 -1
- package/dist/prompts/sandbox-standards.d.ts +1 -1
- package/dist/prompts/sandbox-standards.js +27 -0
- package/dist/sandbox/thread-env.d.ts +18 -12
- package/dist/sandbox/thread-env.js +36 -25
- package/dist/tools/bio/chembl.js +4 -3
- package/dist/tools/bio/drug-gene-interactions.d.ts +2 -14
- package/dist/tools/bio/drug-gene-interactions.js +10 -18
- package/dist/tools/bio/gene-disease-evidence.d.ts +3 -1
- package/dist/tools/bio/gene-disease-evidence.js +12 -9
- package/dist/tools/bio/keys.js +1 -0
- package/dist/tools/bio/lookup-annotation.d.ts +43 -0
- package/dist/tools/bio/lookup-annotation.js +19 -4
- package/dist/tools/bio/pubchem.js +5 -3
- package/dist/tools/bio/search-clinical-trials.js +5 -4
- package/dist/tools/bio/search-geo-datasets.d.ts +39 -9
- package/dist/tools/bio/search-geo-datasets.js +38 -20
- package/dist/tools/lib/api-utils.d.ts +27 -2
- package/dist/tools/lib/api-utils.js +43 -3
- package/dist/tools/lib/bgee-client.d.ts +16 -0
- package/dist/tools/lib/bgee-client.js +16 -5
- package/dist/tools/lib/cbioportal-client.d.ts +20 -0
- package/dist/tools/lib/cbioportal-client.js +16 -8
- package/dist/tools/lib/chembl-client.d.ts +105 -3
- package/dist/tools/lib/chembl-client.js +196 -84
- package/dist/tools/lib/clinical-benchmarks-client.d.ts +5 -0
- package/dist/tools/lib/clinical-benchmarks-client.js +5 -0
- package/dist/tools/lib/clinical-trials-client.d.ts +131 -2
- package/dist/tools/lib/clinical-trials-client.js +32 -6
- package/dist/tools/lib/clinvar-client.d.ts +35 -0
- package/dist/tools/lib/clinvar-client.js +34 -28
- package/dist/tools/lib/ctx-ops.d.ts +106 -35
- package/dist/tools/lib/ctx-ops.js +135 -69
- package/dist/tools/lib/dgidb-client.d.ts +73 -0
- package/dist/tools/lib/dgidb-client.js +25 -13
- package/dist/tools/lib/disgenet-client.d.ts +117 -24
- package/dist/tools/lib/disgenet-client.js +127 -34
- package/dist/tools/lib/disgenet-config.d.ts +1 -1
- package/dist/tools/lib/disgenet-config.js +5 -3
- package/dist/tools/lib/drugbank-client.d.ts +57 -58
- package/dist/tools/lib/drugbank-client.js +69 -64
- package/dist/tools/lib/drugbank-config.d.ts +6 -1
- package/dist/tools/lib/drugbank-config.js +6 -1
- package/dist/tools/lib/ema-client.d.ts +53 -0
- package/dist/tools/lib/ema-client.js +19 -7
- package/dist/tools/lib/ensembl-client.d.ts +4 -0
- package/dist/tools/lib/ensembl-client.js +4 -0
- package/dist/tools/lib/gwas-catalog-client.d.ts +64 -1
- package/dist/tools/lib/gwas-catalog-client.js +21 -6
- package/dist/tools/lib/identifier-resolver.d.ts +17 -1
- package/dist/tools/lib/identifier-resolver.js +13 -4
- package/dist/tools/lib/impc-client.d.ts +4 -0
- package/dist/tools/lib/impc-client.js +4 -0
- package/dist/tools/lib/iuphar-client.d.ts +10 -5
- package/dist/tools/lib/iuphar-client.js +49 -13
- package/dist/tools/lib/monarch-client.d.ts +4 -0
- package/dist/tools/lib/monarch-client.js +4 -0
- package/dist/tools/lib/openfda-client.d.ts +34 -0
- package/dist/tools/lib/openfda-client.js +22 -8
- package/dist/tools/lib/opentargets-client.d.ts +99 -4
- package/dist/tools/lib/opentargets-client.js +97 -37
- package/dist/tools/lib/pathway-client.d.ts +45 -0
- package/dist/tools/lib/pathway-client.js +88 -8
- package/dist/tools/lib/pharmgkb-client.d.ts +35 -1
- package/dist/tools/lib/pharmgkb-client.js +22 -6
- package/dist/tools/lib/pharmgkb-config.d.ts +8 -1
- package/dist/tools/lib/pharmgkb-config.js +8 -1
- package/dist/tools/lib/pubchem-client.d.ts +22 -0
- package/dist/tools/lib/pubchem-client.js +36 -33
- package/dist/tools/lib/pubchem-ops.d.ts +85 -5
- package/dist/tools/lib/pubchem-ops.js +96 -68
- package/dist/tools/lib/pubmed-client.d.ts +4 -0
- package/dist/tools/lib/pubmed-client.js +4 -0
- package/dist/tools/lib/string-client.d.ts +52 -0
- package/dist/tools/lib/string-client.js +12 -7
- package/dist/tools/lib/uniprot-client.d.ts +4 -0
- package/dist/tools/lib/uniprot-client.js +4 -0
- package/dist/tools/research/context7-docs.d.ts +23 -0
- package/dist/tools/research/context7-docs.js +49 -9
- package/dist/tools/research/search-github-repos.d.ts +4 -0
- package/dist/tools/research/search-github-repos.js +4 -0
- package/dist/workflows/execute-target-assessment.js +4 -4
- package/dist/workflows/target-assessment/assemblers/orchestrator.d.ts +2 -1
- package/dist/workflows/target-assessment/assemblers/orchestrator.js +3 -3
- package/dist/workflows/target-assessment/collectors/index.d.ts +8 -2
- package/dist/workflows/target-assessment/collectors/index.js +37 -10
- package/dist/workflows/target-assessment/fanout/index.d.ts +2 -1
- package/dist/workflows/target-assessment/fanout/index.js +2 -2
- package/dist/workflows/target-assessment/lib/safety-corroboration.js +2 -2
- package/dist/workflows/target-assessment/lib/target-identity-filter.d.ts +3 -2
- package/dist/workflows/target-assessment/lib/target-identity-filter.js +16 -5
- package/dist/workflows/target-assessment/phase4-assemble.d.ts +61 -60
- package/dist/workflows/target-assessment/phase4-assemble.js +2 -2
- package/dist/workflows/target-assessment/schemas.d.ts +2 -8
- package/dist/workflows/target-assessment/schemas.js +8 -2
- package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +1 -4
- package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +1 -4
- package/package.json +1 -1
- package/dist/agents/sandbox/__fixtures__/deps.d.ts +0 -23
- package/dist/agents/sandbox/__fixtures__/deps.js +0 -102
- package/dist/citations/__fixtures__/resolver.d.ts +0 -3
- package/dist/citations/__fixtures__/resolver.js +0 -9
- package/dist/loop/__fixtures__/scripted-provider.d.ts +0 -31
- package/dist/loop/__fixtures__/scripted-provider.js +0 -81
- package/dist/providers/__fixtures__/session.d.ts +0 -17
- package/dist/providers/__fixtures__/session.js +0 -20
- package/dist/tools/__fixtures__/tool-context.d.ts +0 -13
- package/dist/tools/__fixtures__/tool-context.js +0 -22
|
@@ -2,24 +2,35 @@
|
|
|
2
2
|
* Pure async client functions for DisGeNET gene-disease associations (GDAs).
|
|
3
3
|
*
|
|
4
4
|
* Requires a DisGeNET API key; `getDisgenetHeaders` throws when it is absent.
|
|
5
|
+
*
|
|
6
|
+
* UNVERIFIED CONTRACT, 2026-08-28. Every data path of the v1 API demands a key,
|
|
7
|
+
* and no key exists, thus no schema here parsed a live GDA answer. The contract
|
|
8
|
+
* comes from two secondary sources: the public Swagger of the provider at
|
|
9
|
+
* `https://api.disgenet.com/v2/api-docs`, which declares
|
|
10
|
+
* `GeneDiseaseAssocSummaryDTO`, `Paging`, and the response envelope, and the
|
|
11
|
+
* provider-authored R client `disgenet2r` 1.2.10, whose request code and column
|
|
12
|
+
* renames encode the same shape. One live unauthenticated 200 on
|
|
13
|
+
* `/public/version` proved the envelope itself.
|
|
14
|
+
*
|
|
15
|
+
* Absence policy: the v1 API omits the key of an absent value. Thus each field
|
|
16
|
+
* carries `.optional()`, and `.nullable()` rides with it because the Swagger
|
|
17
|
+
* marks no field as required.
|
|
5
18
|
*/
|
|
6
19
|
import { z } from "zod";
|
|
20
|
+
import type { Logger } from "../../lib/logger.js";
|
|
7
21
|
declare const GdaSchema: z.ZodPipe<z.ZodObject<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
disease_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
symbolOfGene: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
geneNcbiID: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
|
+
diseaseName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
diseaseUMLSCUI: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
diseaseType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
27
|
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
15
28
|
ei: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
yearInitial: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
30
|
+
yearFinal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
31
|
+
numPMIDs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
20
32
|
}, z.core.$strip>, z.ZodTransform<{
|
|
21
33
|
geneSymbol: string;
|
|
22
|
-
geneName: string;
|
|
23
34
|
geneId: number;
|
|
24
35
|
diseaseName: string;
|
|
25
36
|
diseaseId: string;
|
|
@@ -29,28 +40,110 @@ declare const GdaSchema: z.ZodPipe<z.ZodObject<{
|
|
|
29
40
|
yearInitial: number | null;
|
|
30
41
|
yearFinal: number | null;
|
|
31
42
|
nPmids: number;
|
|
32
|
-
source: string;
|
|
33
43
|
}, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
disease_type?: string | null | undefined;
|
|
44
|
+
symbolOfGene?: string | null | undefined;
|
|
45
|
+
geneNcbiID?: number | null | undefined;
|
|
46
|
+
diseaseName?: string | null | undefined;
|
|
47
|
+
diseaseUMLSCUI?: string | null | undefined;
|
|
48
|
+
diseaseType?: string | null | undefined;
|
|
40
49
|
score?: number | null | undefined;
|
|
41
50
|
ei?: number | null | undefined;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
source?: string | null | undefined;
|
|
51
|
+
yearInitial?: number | null | undefined;
|
|
52
|
+
yearFinal?: number | null | undefined;
|
|
53
|
+
numPMIDs?: number | null | undefined;
|
|
46
54
|
}>>;
|
|
47
55
|
export type Gda = z.infer<typeof GdaSchema>;
|
|
56
|
+
/** The page record of the v1 envelope. Page numbers start at 0. */
|
|
57
|
+
export declare const DisgenetPagingSchema: z.ZodObject<{
|
|
58
|
+
currentPageNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
59
|
+
pageSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
60
|
+
totalElements: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
61
|
+
totalElementsInPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
/**
|
|
64
|
+
* The v1 response envelope. `payload` holds the records, and `paging` holds the
|
|
65
|
+
* count of the whole query. A gated or an empty answer carries a non-OK
|
|
66
|
+
* `status` and an `error` record, and `payload` is then absent.
|
|
67
|
+
*/
|
|
68
|
+
export declare const GdaResponseSchema: z.ZodObject<{
|
|
69
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
payload: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
71
|
+
symbolOfGene: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
geneNcbiID: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
73
|
+
diseaseName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
diseaseUMLSCUI: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
diseaseType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
|
+
ei: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
|
+
yearInitial: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
79
|
+
yearFinal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
80
|
+
numPMIDs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
81
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
82
|
+
geneSymbol: string;
|
|
83
|
+
geneId: number;
|
|
84
|
+
diseaseName: string;
|
|
85
|
+
diseaseId: string;
|
|
86
|
+
diseaseType: string;
|
|
87
|
+
score: number;
|
|
88
|
+
evidenceIndex: number;
|
|
89
|
+
yearInitial: number | null;
|
|
90
|
+
yearFinal: number | null;
|
|
91
|
+
nPmids: number;
|
|
92
|
+
}, {
|
|
93
|
+
symbolOfGene?: string | null | undefined;
|
|
94
|
+
geneNcbiID?: number | null | undefined;
|
|
95
|
+
diseaseName?: string | null | undefined;
|
|
96
|
+
diseaseUMLSCUI?: string | null | undefined;
|
|
97
|
+
diseaseType?: string | null | undefined;
|
|
98
|
+
score?: number | null | undefined;
|
|
99
|
+
ei?: number | null | undefined;
|
|
100
|
+
yearInitial?: number | null | undefined;
|
|
101
|
+
yearFinal?: number | null | undefined;
|
|
102
|
+
numPMIDs?: number | null | undefined;
|
|
103
|
+
}>>>>>;
|
|
104
|
+
paging: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
105
|
+
currentPageNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
106
|
+
pageSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
|
+
totalElements: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
108
|
+
totalElementsInPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
109
|
+
}, z.core.$strip>>>;
|
|
110
|
+
httpStatus: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
111
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
112
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
timestamp: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
+
}, z.core.$strip>>>;
|
|
116
|
+
}, z.core.$strip>;
|
|
48
117
|
export type DisgenetSearchType = "gene" | "disease";
|
|
49
|
-
|
|
118
|
+
/**
|
|
119
|
+
* The source vocabulary of the v1 API. The v7 names `ANIMAL_MODELS` and
|
|
120
|
+
* `BEFREE` are retired: the nearest v1 members are `MODELS` and
|
|
121
|
+
* `TEXTMINING_HUMAN`.
|
|
122
|
+
*/
|
|
123
|
+
export declare const DISGENET_SOURCES: readonly ["ALL", "BIOBANK", "CHEMBL", "CLINICALTRIALS", "CLINGEN", "CLINPGX", "CLINVAR", "CURATED", "FINNGEN", "GENCC", "GWASCAT", "HPO", "INFERRED", "MGD_HUMAN", "MGD_MOUSE", "MODELS", "ORPHANET", "PHEWASCAT", "PSYGENET", "RGD_HUMAN", "RGD_RAT", "TEXTMINING_HUMAN", "TEXTMINING_MODELS", "UKBIOBANK", "UNIPROT"];
|
|
124
|
+
export type DisgenetSource = (typeof DISGENET_SOURCES)[number];
|
|
50
125
|
export interface DisgenetSearchOptions {
|
|
51
126
|
minScore?: number;
|
|
52
127
|
source?: DisgenetSource;
|
|
53
128
|
limit?: number;
|
|
54
129
|
}
|
|
55
|
-
|
|
130
|
+
/** The result of one GDA query: the records of the first page, and the count of the whole query. */
|
|
131
|
+
export interface DisgenetSearchResult {
|
|
132
|
+
records: Gda[];
|
|
133
|
+
totalFound: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gene-disease associations for a gene symbol or for a disease.
|
|
137
|
+
*
|
|
138
|
+
* The v1 route takes query parameters only, and it fixes the page at 100
|
|
139
|
+
* records. Thus `limit` is applied over the first page here, and it is not sent
|
|
140
|
+
* to the provider.
|
|
141
|
+
*
|
|
142
|
+
* A non-OK `status` with an `error` record is an expected gated outcome, not a
|
|
143
|
+
* transport failure: a free academic key serves the curated sources only. Such
|
|
144
|
+
* an answer gives an empty result. The envelope gives no marker that separates
|
|
145
|
+
* the gated answer from a rejected query, thus the cause goes to the injected
|
|
146
|
+
* `Logger` before the result degrades.
|
|
147
|
+
*/
|
|
148
|
+
export declare function searchDisgenet(apiKey: string, query: string, searchType: DisgenetSearchType, options?: DisgenetSearchOptions, logger?: Logger): Promise<DisgenetSearchResult>;
|
|
56
149
|
export {};
|
|
@@ -2,58 +2,151 @@
|
|
|
2
2
|
* Pure async client functions for DisGeNET gene-disease associations (GDAs).
|
|
3
3
|
*
|
|
4
4
|
* Requires a DisGeNET API key; `getDisgenetHeaders` throws when it is absent.
|
|
5
|
+
*
|
|
6
|
+
* UNVERIFIED CONTRACT, 2026-08-28. Every data path of the v1 API demands a key,
|
|
7
|
+
* and no key exists, thus no schema here parsed a live GDA answer. The contract
|
|
8
|
+
* comes from two secondary sources: the public Swagger of the provider at
|
|
9
|
+
* `https://api.disgenet.com/v2/api-docs`, which declares
|
|
10
|
+
* `GeneDiseaseAssocSummaryDTO`, `Paging`, and the response envelope, and the
|
|
11
|
+
* provider-authored R client `disgenet2r` 1.2.10, whose request code and column
|
|
12
|
+
* renames encode the same shape. One live unauthenticated 200 on
|
|
13
|
+
* `/public/version` proved the envelope itself.
|
|
14
|
+
*
|
|
15
|
+
* Absence policy: the v1 API omits the key of an absent value. Thus each field
|
|
16
|
+
* carries `.optional()`, and `.nullable()` rides with it because the Swagger
|
|
17
|
+
* marks no field as required.
|
|
5
18
|
*/
|
|
6
19
|
import { z } from "zod";
|
|
20
|
+
import { createNoopLogger } from "../../lib/console-logger.js";
|
|
7
21
|
import { apiFetchValidated, describeApiError } from "./api-utils.js";
|
|
8
22
|
import { DISGENET_BASE, getDisgenetHeaders } from "./disgenet-config.js";
|
|
9
23
|
// A single schema that both validates and normalizes one DisGeNET GDA record:
|
|
10
|
-
// the `.object(...)` half is the
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
24
|
+
// the `.object(...)` half is the v1 wire shape, and the `.transform(...)` half
|
|
25
|
+
// maps it to the camelCase `Gda` we return. Parsing IS the validation
|
|
26
|
+
// (`apiFetchValidated` runs it over the JSON), and because the transform rides
|
|
27
|
+
// on the schema, `z.infer` below is the OUTPUT type — no separate raw interface
|
|
28
|
+
// and no separate mapper.
|
|
15
29
|
const GdaSchema = z
|
|
16
30
|
.object({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
disease_type: z.string().nullable().optional(),
|
|
31
|
+
symbolOfGene: z.string().nullable().optional(),
|
|
32
|
+
geneNcbiID: z.number().nullable().optional(),
|
|
33
|
+
diseaseName: z.string().nullable().optional(),
|
|
34
|
+
diseaseUMLSCUI: z.string().nullable().optional(),
|
|
35
|
+
diseaseType: z.string().nullable().optional(),
|
|
23
36
|
score: z.number().nullable().optional(),
|
|
24
37
|
ei: z.number().nullable().optional(),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
source: z.string().nullable().optional(),
|
|
38
|
+
yearInitial: z.number().nullable().optional(),
|
|
39
|
+
yearFinal: z.number().nullable().optional(),
|
|
40
|
+
numPMIDs: z.number().nullable().optional(),
|
|
29
41
|
})
|
|
30
42
|
.transform((gda) => ({
|
|
31
|
-
geneSymbol: gda.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
diseaseType: gda.disease_type ?? "",
|
|
43
|
+
geneSymbol: gda.symbolOfGene ?? "",
|
|
44
|
+
geneId: gda.geneNcbiID ?? 0,
|
|
45
|
+
diseaseName: gda.diseaseName ?? "",
|
|
46
|
+
diseaseId: gda.diseaseUMLSCUI ?? "",
|
|
47
|
+
diseaseType: gda.diseaseType ?? "",
|
|
37
48
|
score: gda.score ?? 0,
|
|
38
49
|
evidenceIndex: gda.ei ?? 0,
|
|
39
|
-
yearInitial: gda.
|
|
40
|
-
yearFinal: gda.
|
|
41
|
-
nPmids: gda.
|
|
42
|
-
source: gda.source ?? "",
|
|
50
|
+
yearInitial: gda.yearInitial ?? null,
|
|
51
|
+
yearFinal: gda.yearFinal ?? null,
|
|
52
|
+
nPmids: gda.numPMIDs ?? 0,
|
|
43
53
|
}));
|
|
44
|
-
|
|
45
|
-
export
|
|
54
|
+
/** The page record of the v1 envelope. Page numbers start at 0. */
|
|
55
|
+
export const DisgenetPagingSchema = z.object({
|
|
56
|
+
currentPageNumber: z.number().nullable().optional(),
|
|
57
|
+
pageSize: z.number().nullable().optional(),
|
|
58
|
+
totalElements: z.number().nullable().optional(),
|
|
59
|
+
totalElementsInPage: z.number().nullable().optional(),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* The v1 response envelope. `payload` holds the records, and `paging` holds the
|
|
63
|
+
* count of the whole query. A gated or an empty answer carries a non-OK
|
|
64
|
+
* `status` and an `error` record, and `payload` is then absent.
|
|
65
|
+
*/
|
|
66
|
+
export const GdaResponseSchema = z.object({
|
|
67
|
+
status: z.string().nullable().optional(),
|
|
68
|
+
payload: z.array(GdaSchema).nullable().optional(),
|
|
69
|
+
paging: DisgenetPagingSchema.nullable().optional(),
|
|
70
|
+
httpStatus: z.number().nullable().optional(),
|
|
71
|
+
error: z
|
|
72
|
+
.object({
|
|
73
|
+
message: z.string().nullable().optional(),
|
|
74
|
+
details: z.string().nullable().optional(),
|
|
75
|
+
timestamp: z.string().nullable().optional(),
|
|
76
|
+
})
|
|
77
|
+
.nullable()
|
|
78
|
+
.optional(),
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* The source vocabulary of the v1 API. The v7 names `ANIMAL_MODELS` and
|
|
82
|
+
* `BEFREE` are retired: the nearest v1 members are `MODELS` and
|
|
83
|
+
* `TEXTMINING_HUMAN`.
|
|
84
|
+
*/
|
|
85
|
+
export const DISGENET_SOURCES = [
|
|
86
|
+
"ALL",
|
|
87
|
+
"BIOBANK",
|
|
88
|
+
"CHEMBL",
|
|
89
|
+
"CLINICALTRIALS",
|
|
90
|
+
"CLINGEN",
|
|
91
|
+
"CLINPGX",
|
|
92
|
+
"CLINVAR",
|
|
93
|
+
"CURATED",
|
|
94
|
+
"FINNGEN",
|
|
95
|
+
"GENCC",
|
|
96
|
+
"GWASCAT",
|
|
97
|
+
"HPO",
|
|
98
|
+
"INFERRED",
|
|
99
|
+
"MGD_HUMAN",
|
|
100
|
+
"MGD_MOUSE",
|
|
101
|
+
"MODELS",
|
|
102
|
+
"ORPHANET",
|
|
103
|
+
"PHEWASCAT",
|
|
104
|
+
"PSYGENET",
|
|
105
|
+
"RGD_HUMAN",
|
|
106
|
+
"RGD_RAT",
|
|
107
|
+
"TEXTMINING_HUMAN",
|
|
108
|
+
"TEXTMINING_MODELS",
|
|
109
|
+
"UKBIOBANK",
|
|
110
|
+
"UNIPROT",
|
|
111
|
+
];
|
|
112
|
+
/**
|
|
113
|
+
* Gene-disease associations for a gene symbol or for a disease.
|
|
114
|
+
*
|
|
115
|
+
* The v1 route takes query parameters only, and it fixes the page at 100
|
|
116
|
+
* records. Thus `limit` is applied over the first page here, and it is not sent
|
|
117
|
+
* to the provider.
|
|
118
|
+
*
|
|
119
|
+
* A non-OK `status` with an `error` record is an expected gated outcome, not a
|
|
120
|
+
* transport failure: a free academic key serves the curated sources only. Such
|
|
121
|
+
* an answer gives an empty result. The envelope gives no marker that separates
|
|
122
|
+
* the gated answer from a rejected query, thus the cause goes to the injected
|
|
123
|
+
* `Logger` before the result degrades.
|
|
124
|
+
*/
|
|
125
|
+
export async function searchDisgenet(apiKey, query, searchType, options = {}, logger) {
|
|
46
126
|
const headers = getDisgenetHeaders(apiKey);
|
|
47
127
|
const minScore = options.minScore ?? 0.1;
|
|
48
128
|
const limit = options.limit ?? 25;
|
|
49
129
|
const source = options.source ?? "ALL";
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
130
|
+
const params = new URLSearchParams(searchType === "gene" ? { gene_symbol: query } : { disease: query });
|
|
131
|
+
params.set("min_score", String(minScore));
|
|
132
|
+
params.set("source", source);
|
|
133
|
+
// Page numbers start at 0, thus page 0 is the first page.
|
|
134
|
+
params.set("page_number", "0");
|
|
135
|
+
const res = await apiFetchValidated(`${DISGENET_BASE}/gda/summary?${params}`, GdaResponseSchema, { headers });
|
|
55
136
|
if (res.isErr())
|
|
56
137
|
throw new Error(describeApiError(res.error));
|
|
57
|
-
|
|
58
|
-
|
|
138
|
+
const envelope = res.value;
|
|
139
|
+
if (envelope.status !== "OK" || !envelope.payload) {
|
|
140
|
+
const log = (logger ?? createNoopLogger()).named("disgenet-client").with({ query, searchType });
|
|
141
|
+
log.error("gda query degraded to an empty result", {
|
|
142
|
+
status: envelope.status ?? null,
|
|
143
|
+
httpStatus: envelope.httpStatus ?? null,
|
|
144
|
+
cause: envelope.error?.message ?? null,
|
|
145
|
+
});
|
|
146
|
+
return { records: [], totalFound: 0 };
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
records: envelope.payload.slice(0, limit),
|
|
150
|
+
totalFound: envelope.paging?.totalElements ?? envelope.payload.length,
|
|
151
|
+
};
|
|
59
152
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DISGENET_BASE = "https://
|
|
1
|
+
export declare const DISGENET_BASE = "https://api.disgenet.com/api/v1";
|
|
2
2
|
export declare function getDisgenetHeaders(apiKey: string): Record<string, string>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export const DISGENET_BASE = "https://
|
|
1
|
+
export const DISGENET_BASE = "https://api.disgenet.com/api/v1";
|
|
2
2
|
export function getDisgenetHeaders(apiKey) {
|
|
3
3
|
const key = apiKey;
|
|
4
4
|
if (!key) {
|
|
5
|
-
throw new Error("DISGENET_API_KEY environment variable is not set. " + "Obtain a key from https://
|
|
5
|
+
throw new Error("DISGENET_API_KEY environment variable is not set. " + "Obtain a key from https://disgenet.com/plans");
|
|
6
6
|
}
|
|
7
|
+
// The v1 API reads the raw key out of `Authorization`. A `Bearer ` prefix
|
|
8
|
+
// makes the key unreadable, and every data path then answers 401.
|
|
7
9
|
return {
|
|
8
|
-
Authorization:
|
|
10
|
+
Authorization: key,
|
|
9
11
|
Accept: "application/json",
|
|
10
12
|
};
|
|
11
13
|
}
|
|
@@ -1,83 +1,82 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pure async client functions for DrugBank.
|
|
2
|
+
* Pure async client functions for the DrugBank Discovery API.
|
|
3
|
+
*
|
|
4
|
+
* CONTRACT UNVERIFIED (key-blocked, 2026-08-28). No key exists here, and an
|
|
5
|
+
* unauthenticated probe answers 401 before it routes, thus no live call proves
|
|
6
|
+
* a route or a record. The evidence is secondary: the Wayback captures of
|
|
7
|
+
* `docs.drugbank.com/discovery/v1` and the sample code of the provider. Refer to
|
|
8
|
+
* the truth map, file 07, section 1.
|
|
3
9
|
*
|
|
4
10
|
* Requires a DrugBank API key; `getDrugbankHeaders` throws when it is absent.
|
|
11
|
+
*
|
|
12
|
+
* Absence policy: no evidence establishes the encoding of an absent value,
|
|
13
|
+
* because no key exists for a live call and both fixtures are synthetic. Each
|
|
14
|
+
* maybe-absent field carries `.optional()` today, and no field carries
|
|
15
|
+
* `.nullable()`.
|
|
5
16
|
*/
|
|
6
17
|
import { z } from "zod";
|
|
7
18
|
declare const DrugResultSchema: z.ZodPipe<z.ZodObject<{
|
|
8
|
-
drugbank_id: z.
|
|
19
|
+
drugbank_id: z.ZodString;
|
|
9
20
|
name: z.ZodOptional<z.ZodString>;
|
|
10
21
|
description: z.ZodOptional<z.ZodString>;
|
|
11
22
|
type: z.ZodOptional<z.ZodString>;
|
|
12
23
|
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
-
category: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}, z.core.$strip>>>;
|
|
16
|
-
indication: z.ZodOptional<z.ZodString>;
|
|
17
|
-
pharmacodynamics: z.ZodOptional<z.ZodString>;
|
|
18
|
-
mechanism_of_action: z.ZodOptional<z.ZodString>;
|
|
19
|
-
toxicity: z.ZodOptional<z.ZodString>;
|
|
20
|
-
half_life: z.ZodOptional<z.ZodString>;
|
|
21
|
-
targets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
|
-
name: z.ZodOptional<z.ZodString>;
|
|
23
|
-
gene_name: z.ZodOptional<z.ZodString>;
|
|
24
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
-
known_action: z.ZodOptional<z.ZodString>;
|
|
26
|
-
}, z.core.$strip>>>;
|
|
27
|
-
drug_interactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
28
|
-
drugbank_id: z.ZodOptional<z.ZodString>;
|
|
29
|
-
name: z.ZodOptional<z.ZodString>;
|
|
30
|
-
description: z.ZodOptional<z.ZodString>;
|
|
31
|
-
}, z.core.$strip>>>;
|
|
32
24
|
}, z.core.$strip>, z.ZodTransform<{
|
|
33
25
|
drugbankId: string;
|
|
34
26
|
name: string;
|
|
35
27
|
description: string;
|
|
36
28
|
type: string;
|
|
37
29
|
groups: string[];
|
|
38
|
-
categories: string[];
|
|
39
|
-
indication: string;
|
|
40
|
-
pharmacodynamics: string;
|
|
41
|
-
mechanismOfAction: string;
|
|
42
|
-
toxicity: string;
|
|
43
|
-
halfLife: string;
|
|
44
|
-
targets: {
|
|
45
|
-
name: string;
|
|
46
|
-
geneSymbol: string;
|
|
47
|
-
actions: string[];
|
|
48
|
-
knownAction: string;
|
|
49
|
-
}[];
|
|
50
|
-
interactions: {
|
|
51
|
-
drugbankId: string;
|
|
52
|
-
name: string;
|
|
53
|
-
description: string;
|
|
54
|
-
}[];
|
|
55
30
|
}, {
|
|
56
|
-
drugbank_id
|
|
31
|
+
drugbank_id: string;
|
|
57
32
|
name?: string | undefined;
|
|
58
33
|
description?: string | undefined;
|
|
59
34
|
type?: string | undefined;
|
|
60
35
|
groups?: string[] | undefined;
|
|
61
|
-
categories?: {
|
|
62
|
-
category?: string | undefined;
|
|
63
|
-
}[] | undefined;
|
|
64
|
-
indication?: string | undefined;
|
|
65
|
-
pharmacodynamics?: string | undefined;
|
|
66
|
-
mechanism_of_action?: string | undefined;
|
|
67
|
-
toxicity?: string | undefined;
|
|
68
|
-
half_life?: string | undefined;
|
|
69
|
-
targets?: {
|
|
70
|
-
name?: string | undefined;
|
|
71
|
-
gene_name?: string | undefined;
|
|
72
|
-
actions?: string[] | undefined;
|
|
73
|
-
known_action?: string | undefined;
|
|
74
|
-
}[] | undefined;
|
|
75
|
-
drug_interactions?: {
|
|
76
|
-
drugbank_id?: string | undefined;
|
|
77
|
-
name?: string | undefined;
|
|
78
|
-
description?: string | undefined;
|
|
79
|
-
}[] | undefined;
|
|
80
36
|
}>>;
|
|
81
37
|
export type DrugResult = z.infer<typeof DrugResultSchema>;
|
|
38
|
+
export declare const DrugResponseSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
39
|
+
drugbank_id: z.ZodString;
|
|
40
|
+
name: z.ZodOptional<z.ZodString>;
|
|
41
|
+
description: z.ZodOptional<z.ZodString>;
|
|
42
|
+
type: z.ZodOptional<z.ZodString>;
|
|
43
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
45
|
+
drugbankId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
type: string;
|
|
49
|
+
groups: string[];
|
|
50
|
+
}, {
|
|
51
|
+
drugbank_id: string;
|
|
52
|
+
name?: string | undefined;
|
|
53
|
+
description?: string | undefined;
|
|
54
|
+
type?: string | undefined;
|
|
55
|
+
groups?: string[] | undefined;
|
|
56
|
+
}>>, z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
57
|
+
drugbank_id: z.ZodString;
|
|
58
|
+
name: z.ZodOptional<z.ZodString>;
|
|
59
|
+
description: z.ZodOptional<z.ZodString>;
|
|
60
|
+
type: z.ZodOptional<z.ZodString>;
|
|
61
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
63
|
+
drugbankId: string;
|
|
64
|
+
name: string;
|
|
65
|
+
description: string;
|
|
66
|
+
type: string;
|
|
67
|
+
groups: string[];
|
|
68
|
+
}, {
|
|
69
|
+
drugbank_id: string;
|
|
70
|
+
name?: string | undefined;
|
|
71
|
+
description?: string | undefined;
|
|
72
|
+
type?: string | undefined;
|
|
73
|
+
groups?: string[] | undefined;
|
|
74
|
+
}>>>]>;
|
|
75
|
+
export declare const BondResponseSchema: z.ZodArray<z.ZodObject<{
|
|
76
|
+
drug: z.ZodObject<{
|
|
77
|
+
drugbank_id: z.ZodString;
|
|
78
|
+
name: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
82
81
|
export declare function searchDrugbank(apiKey: string, query: string, searchType: "drug" | "target", limit?: number): Promise<DrugResult[]>;
|
|
83
82
|
export {};
|