@lucern/sdk 0.2.0-alpha.7 → 0.2.0-alpha.9
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/adminClient.d.ts +409 -0
- package/dist/adminClient.js +755 -0
- package/dist/adminClient.js.map +1 -0
- package/dist/answersClient.d.ts +23 -0
- package/dist/answersClient.js +333 -0
- package/dist/answersClient.js.map +1 -0
- package/dist/audiencesClient.d.ts +99 -0
- package/dist/audiencesClient.js +472 -0
- package/dist/audiencesClient.js.map +1 -0
- package/dist/auditClient.d.ts +29 -0
- package/dist/auditClient.js +386 -0
- package/dist/auditClient.js.map +1 -0
- package/dist/beliefsClient.d.ts +162 -0
- package/dist/beliefsClient.js +477 -0
- package/dist/beliefsClient.js.map +1 -0
- package/dist/client.d.ts +2378 -0
- package/dist/client.js +6134 -0
- package/dist/client.js.map +1 -0
- package/dist/contextClient.d.ts +27 -0
- package/dist/contextClient.js +396 -0
- package/dist/contextClient.js.map +1 -0
- package/dist/contextFacade.d.ts +2 -0
- package/dist/contextFacade.js +73 -0
- package/dist/contextFacade.js.map +1 -0
- package/dist/contextPackCompiler.d.ts +102 -0
- package/dist/contextPackCompiler.js +1091 -0
- package/dist/contextPackCompiler.js.map +1 -0
- package/dist/contextPackPolicy.d.ts +84 -0
- package/dist/contextPackPolicy.js +347 -0
- package/dist/contextPackPolicy.js.map +1 -0
- package/dist/contextPackSchema.d.ts +7 -0
- package/{src/contextPackSchema.ts → dist/contextPackSchema.js} +22 -70
- package/dist/contextPackSchema.js.map +1 -0
- package/dist/contextTypes.d.ts +135 -0
- package/dist/contextTypes.js +3 -0
- package/dist/contextTypes.js.map +1 -0
- package/dist/contracts/api-enums.contract.d.ts +81 -0
- package/dist/contracts/api-enums.contract.js +92 -0
- package/dist/contracts/api-enums.contract.js.map +1 -0
- package/dist/contracts/auth-session.contract.d.ts +55 -0
- package/dist/contracts/auth-session.contract.js +48 -0
- package/dist/contracts/auth-session.contract.js.map +1 -0
- package/dist/contracts/context-pack.contract.d.ts +492 -0
- package/dist/contracts/context-pack.contract.js +98 -0
- package/dist/contracts/context-pack.contract.js.map +1 -0
- package/dist/contracts/contextPack.d.ts +1 -0
- package/dist/contracts/contextPack.js +98 -0
- package/dist/contracts/contextPack.js.map +1 -0
- package/dist/contracts/index.d.ts +9 -0
- package/dist/contracts/index.js +4892 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/lens-filter.contract.d.ts +72 -0
- package/dist/contracts/lens-filter.contract.js +71 -0
- package/dist/contracts/lens-filter.contract.js.map +1 -0
- package/dist/contracts/lens-workflow.contract.d.ts +87 -0
- package/dist/contracts/lens-workflow.contract.js +123 -0
- package/dist/contracts/lens-workflow.contract.js.map +1 -0
- package/dist/contracts/lensFilter.d.ts +1 -0
- package/dist/contracts/lensFilter.js +71 -0
- package/dist/contracts/lensFilter.js.map +1 -0
- package/dist/contracts/lensWorkflow.d.ts +2 -0
- package/dist/contracts/lensWorkflow.js +123 -0
- package/dist/contracts/lensWorkflow.js.map +1 -0
- package/dist/contracts/mcp-tools.contract.d.ts +1 -0
- package/dist/contracts/mcp-tools.contract.js +2986 -0
- package/dist/contracts/mcp-tools.contract.js.map +1 -0
- package/dist/contracts/mcpTools.d.ts +1 -0
- package/dist/contracts/mcpTools.js +2986 -0
- package/dist/contracts/mcpTools.js.map +1 -0
- package/dist/contracts/prompt.contract.d.ts +26 -0
- package/dist/contracts/prompt.contract.js +12 -0
- package/dist/contracts/prompt.contract.js.map +1 -0
- package/dist/contracts/prompt.d.ts +1 -0
- package/dist/contracts/prompt.js +12 -0
- package/dist/contracts/prompt.js.map +1 -0
- package/dist/contracts/sdk-tools.contract.d.ts +2 -0
- package/dist/contracts/sdk-tools.contract.js +4134 -0
- package/dist/contracts/sdk-tools.contract.js.map +1 -0
- package/dist/contracts/sdkTools.d.ts +2 -0
- package/dist/contracts/sdkTools.js +4134 -0
- package/dist/contracts/sdkTools.js.map +1 -0
- package/dist/contracts/workflow-runtime.contract.d.ts +163 -0
- package/dist/contracts/workflow-runtime.contract.js +245 -0
- package/dist/contracts/workflow-runtime.contract.js.map +1 -0
- package/dist/contracts/workflowRuntime.d.ts +1 -0
- package/dist/contracts/workflowRuntime.js +245 -0
- package/dist/contracts/workflowRuntime.js.map +1 -0
- package/dist/controlObjectOwnership.d.ts +310 -0
- package/{src/controlObjectOwnership.ts → dist/controlObjectOwnership.js} +53 -124
- package/dist/controlObjectOwnership.js.map +1 -0
- package/dist/coreClient.d.ts +144 -0
- package/dist/coreClient.js +339 -0
- package/dist/coreClient.js.map +1 -0
- package/dist/customTools.d.ts +88 -0
- package/dist/customTools.js +248 -0
- package/dist/customTools.js.map +1 -0
- package/dist/decisionsClient.d.ts +111 -0
- package/dist/decisionsClient.js +522 -0
- package/dist/decisionsClient.js.map +1 -0
- package/dist/domainContext.d.ts +1 -0
- package/dist/domainContext.js +3 -0
- package/dist/domainContext.js.map +1 -0
- package/dist/events.d.ts +178 -0
- package/dist/events.js +249 -0
- package/dist/events.js.map +1 -0
- package/dist/eventsCore.d.ts +49 -0
- package/dist/eventsCore.js +429 -0
- package/dist/eventsCore.js.map +1 -0
- package/dist/facade/context.d.ts +18 -0
- package/dist/facade/context.js +73 -0
- package/dist/facade/context.js.map +1 -0
- package/dist/gatewayFacades.d.ts +591 -0
- package/dist/gatewayFacades.js +1953 -0
- package/dist/gatewayFacades.js.map +1 -0
- package/dist/graphClient.d.ts +271 -0
- package/dist/graphClient.js +698 -0
- package/dist/graphClient.js.map +1 -0
- package/dist/harnessClient.d.ts +314 -0
- package/dist/harnessClient.js +607 -0
- package/dist/harnessClient.js.map +1 -0
- package/dist/identityClient.d.ts +140 -0
- package/dist/identityClient.js +497 -0
- package/dist/identityClient.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +11381 -0
- package/dist/index.js.map +1 -0
- package/dist/learningClient.d.ts +46 -0
- package/dist/learningClient.js +409 -0
- package/dist/learningClient.js.map +1 -0
- package/dist/mcpParityClient.d.ts +74 -0
- package/dist/mcpParityClient.js +516 -0
- package/dist/mcpParityClient.js.map +1 -0
- package/dist/mcpParitySurface.d.ts +12 -0
- package/{src/mcpParitySurface.ts → dist/mcpParitySurface.js} +9 -14
- package/dist/mcpParitySurface.js.map +1 -0
- package/dist/mcpTools-DPZxowDX.d.ts +254 -0
- package/dist/ontologyClient.d.ts +137 -0
- package/dist/ontologyClient.js +513 -0
- package/dist/ontologyClient.js.map +1 -0
- package/dist/packRuntime.d.ts +2 -0
- package/dist/packRuntime.js +3 -0
- package/dist/packRuntime.js.map +1 -0
- package/dist/packsClient.d.ts +131 -0
- package/dist/packsClient.js +525 -0
- package/dist/packsClient.js.map +1 -0
- package/dist/policyClient.d.ts +299 -0
- package/dist/policyClient.js +625 -0
- package/dist/policyClient.js.map +1 -0
- package/dist/realtime/index.d.ts +29 -0
- package/dist/realtime/index.js +23 -0
- package/dist/realtime/index.js.map +1 -0
- package/{src/realtime/refs.ts → dist/realtime/refs.d.ts} +5 -5
- package/dist/realtime/refs.js +9 -0
- package/dist/realtime/refs.js.map +1 -0
- package/dist/reportsClient.d.ts +41 -0
- package/dist/reportsClient.js +418 -0
- package/dist/reportsClient.js.map +1 -0
- package/dist/schemaClient.d.ts +64 -0
- package/dist/schemaClient.js +434 -0
- package/dist/schemaClient.js.map +1 -0
- package/dist/sdkSurface.d.ts +61 -0
- package/dist/sdkSurface.js +112 -0
- package/dist/sdkSurface.js.map +1 -0
- package/dist/sdkTools-CwXJDACb.d.ts +150 -0
- package/dist/topicsClient.d.ts +84 -0
- package/dist/topicsClient.js +492 -0
- package/dist/topicsClient.js.map +1 -0
- package/dist/types.d.ts +696 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/workflowClient.d.ts +316 -0
- package/dist/workflowClient.js +830 -0
- package/dist/workflowClient.js.map +1 -0
- package/package.json +39 -7
- package/.turbo/turbo-build.log +0 -7
- package/.turbo/turbo-typecheck.log +0 -4
- package/examples/README.md +0 -69
- package/examples/contradiction.ts +0 -94
- package/examples/investigation-context.ts +0 -118
- package/examples/questions-and-tasks.ts +0 -55
- package/examples/quickstart.ts +0 -97
- package/examples/shared.ts +0 -318
- package/examples/strict-public-types.ts +0 -143
- package/examples/worktree-lifecycle.ts +0 -79
- package/src/README.md +0 -6
- package/src/adminClient.ts +0 -789
- package/src/answersClient.ts +0 -29
- package/src/audiencesClient.ts +0 -209
- package/src/auditClient.ts +0 -50
- package/src/beliefsClient.ts +0 -319
- package/src/client.ts +0 -2647
- package/src/contextClient.ts +0 -130
- package/src/contextFacade.ts +0 -15
- package/src/contextPackCompiler.ts +0 -828
- package/src/contextTypes.ts +0 -153
- package/src/contracts/api-enums.contract.ts +0 -202
- package/src/contracts/auth-session.contract.ts +0 -109
- package/src/contracts/context-pack.contract.ts +0 -700
- package/src/contracts/contextPack.ts +0 -1
- package/src/contracts/index.ts +0 -10
- package/src/contracts/lens-filter.contract.ts +0 -183
- package/src/contracts/lens-workflow.contract.ts +0 -162
- package/src/contracts/lensFilter.ts +0 -1
- package/src/contracts/lensWorkflow.ts +0 -1
- package/src/contracts/mcp-tools.contract.ts +0 -3636
- package/src/contracts/mcpTools.ts +0 -1
- package/src/contracts/prompt.contract.ts +0 -50
- package/src/contracts/prompt.ts +0 -1
- package/src/contracts/sdk-tools.contract.ts +0 -1457
- package/src/contracts/sdkTools.ts +0 -1
- package/src/contracts/workflow-runtime.contract.ts +0 -440
- package/src/contracts/workflowRuntime.ts +0 -1
- package/src/coreClient.ts +0 -570
- package/src/customTools.ts +0 -398
- package/src/decisionsClient.ts +0 -286
- package/src/domainContext.ts +0 -15
- package/src/events.ts +0 -531
- package/src/eventsCore.ts +0 -168
- package/src/facade/beliefs.ts +0 -83
- package/src/facade/context.ts +0 -110
- package/src/facade/contradictions.ts +0 -29
- package/src/facade/edges.ts +0 -30
- package/src/facade/events.ts +0 -23
- package/src/facade/evidence.ts +0 -41
- package/src/facade/graph.ts +0 -38
- package/src/facade/identity.ts +0 -16
- package/src/facade/ontologies.ts +0 -34
- package/src/facade/questions.ts +0 -59
- package/src/facade/search.ts +0 -16
- package/src/facade/tasks.ts +0 -37
- package/src/facade/topics.ts +0 -42
- package/src/facade/webhooks.ts +0 -58
- package/src/facade/worktrees.ts +0 -51
- package/src/gatewayFacades.ts +0 -1666
- package/src/graphClient.ts +0 -529
- package/src/harnessClient.ts +0 -585
- package/src/identityClient.ts +0 -278
- package/src/index.ts +0 -49
- package/src/learningClient.ts +0 -95
- package/src/mcpParityClient.ts +0 -240
- package/src/ontologyClient.ts +0 -275
- package/src/packRuntime.ts +0 -3
- package/src/packsClient.ts +0 -260
- package/src/policyClient.ts +0 -572
- package/src/promptCatalog.ts +0 -1
- package/src/realtime/index.ts +0 -51
- package/src/reportsClient.ts +0 -99
- package/src/schemaClient.ts +0 -129
- package/src/sdkSurface.ts +0 -190
- package/src/topicsClient.ts +0 -243
- package/src/types.ts +0 -807
- package/src/version.ts +0 -2
- package/src/workflowClient.ts +0 -826
- package/tsconfig.json +0 -9
package/src/graphClient.ts
DELETED
|
@@ -1,529 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createGatewayRequestClient,
|
|
3
|
-
type GatewayClientConfig,
|
|
4
|
-
LucernApiError,
|
|
5
|
-
randomIdempotencyKey,
|
|
6
|
-
toQueryString,
|
|
7
|
-
} from "./coreClient";
|
|
8
|
-
import {
|
|
9
|
-
mapAliasedList,
|
|
10
|
-
mapGatewayData,
|
|
11
|
-
normalizeNodeWriteInput,
|
|
12
|
-
normalizeNodeVerificationStatus,
|
|
13
|
-
normalizeTopicQuery,
|
|
14
|
-
withSdkAliases,
|
|
15
|
-
} from "./sdkSurface";
|
|
16
|
-
import type {
|
|
17
|
-
CreateEdgeResponse,
|
|
18
|
-
CreateNodeResponse,
|
|
19
|
-
DeleteEdgeResponse,
|
|
20
|
-
GraphAnalyticsMetric,
|
|
21
|
-
GraphAnalyticsResponse,
|
|
22
|
-
GraphNeighborhoodResponse,
|
|
23
|
-
GraphPathResponse,
|
|
24
|
-
JsonObject,
|
|
25
|
-
ListResult,
|
|
26
|
-
PlatformGraphEdge,
|
|
27
|
-
PlatformGraphNode,
|
|
28
|
-
QueryEdgesResponse,
|
|
29
|
-
QueryNodesResponse,
|
|
30
|
-
TextAliasInput,
|
|
31
|
-
TopicIdentifierInput,
|
|
32
|
-
UpdateNodeResponse,
|
|
33
|
-
} from "./types";
|
|
34
|
-
|
|
35
|
-
export { LucernApiError };
|
|
36
|
-
export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
|
|
37
|
-
export type {
|
|
38
|
-
CreateEdgeResponse,
|
|
39
|
-
CreateNodeResponse,
|
|
40
|
-
DeleteEdgeResponse,
|
|
41
|
-
GraphAnalyticsMetric,
|
|
42
|
-
GraphAnalyticsResponse,
|
|
43
|
-
GraphNeighborhoodResponse,
|
|
44
|
-
GraphPathResponse,
|
|
45
|
-
ListResult,
|
|
46
|
-
QueryEdgesResponse,
|
|
47
|
-
QueryNodesResponse,
|
|
48
|
-
UpdateNodeResponse,
|
|
49
|
-
} from "./types";
|
|
50
|
-
|
|
51
|
-
/** Configuration for the graph client. */
|
|
52
|
-
export type GraphClientConfig = GatewayClientConfig;
|
|
53
|
-
|
|
54
|
-
/** Filter parameters for listing graph nodes. */
|
|
55
|
-
export type ListNodesInput = {
|
|
56
|
-
nodeId?: string;
|
|
57
|
-
globalId?: string;
|
|
58
|
-
topicId?: string;
|
|
59
|
-
nodeType?: string;
|
|
60
|
-
limit?: number;
|
|
61
|
-
} & TopicIdentifierInput;
|
|
62
|
-
|
|
63
|
-
/** Paginated list response containing graph nodes. */
|
|
64
|
-
export type ListNodesResponse = ListResult<PlatformGraphNode, "nodes">;
|
|
65
|
-
|
|
66
|
-
/** @deprecated Use ListNodesInput. */
|
|
67
|
-
export type QueryNodesInput = ListNodesInput;
|
|
68
|
-
|
|
69
|
-
/** Input for creating a new graph node. */
|
|
70
|
-
export type CreateNodeInput = {
|
|
71
|
-
text?: string;
|
|
72
|
-
/** @deprecated Use text. */
|
|
73
|
-
canonicalText?: string;
|
|
74
|
-
nodeType: string;
|
|
75
|
-
topicId?: string;
|
|
76
|
-
content?: string;
|
|
77
|
-
contentHash?: string;
|
|
78
|
-
globalId?: string;
|
|
79
|
-
sourceType?: string;
|
|
80
|
-
subtype?: string;
|
|
81
|
-
title?: string;
|
|
82
|
-
confidence?: number;
|
|
83
|
-
status?: string;
|
|
84
|
-
tags?: string[];
|
|
85
|
-
metadata?: JsonObject;
|
|
86
|
-
verificationStatus?: string;
|
|
87
|
-
} & TextAliasInput &
|
|
88
|
-
TopicIdentifierInput;
|
|
89
|
-
|
|
90
|
-
/** Input for updating an existing graph node. */
|
|
91
|
-
export type UpdateNodeInput = {
|
|
92
|
-
nodeId: string;
|
|
93
|
-
text?: string;
|
|
94
|
-
canonicalText?: string;
|
|
95
|
-
content?: string;
|
|
96
|
-
contentHash?: string;
|
|
97
|
-
title?: string;
|
|
98
|
-
subtype?: string;
|
|
99
|
-
confidence?: number;
|
|
100
|
-
status?: string;
|
|
101
|
-
tags?: string[];
|
|
102
|
-
metadata?: JsonObject;
|
|
103
|
-
verificationStatus?: string;
|
|
104
|
-
} & TextAliasInput;
|
|
105
|
-
|
|
106
|
-
/** Input for retrieving a single graph node by canonical identifier. */
|
|
107
|
-
export type GetNodeInput = {
|
|
108
|
-
nodeId?: string;
|
|
109
|
-
globalId?: string;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/** Filter parameters for listing graph edges. */
|
|
113
|
-
export type ListEdgesInput = {
|
|
114
|
-
edgeId?: string;
|
|
115
|
-
topicId?: string;
|
|
116
|
-
fromNodeId?: string;
|
|
117
|
-
toNodeId?: string;
|
|
118
|
-
edgeType?: string;
|
|
119
|
-
limit?: number;
|
|
120
|
-
} & TopicIdentifierInput;
|
|
121
|
-
|
|
122
|
-
/** Paginated list response containing graph edges. */
|
|
123
|
-
export type ListEdgesResponse = ListResult<PlatformGraphEdge, "edges">;
|
|
124
|
-
|
|
125
|
-
/** @deprecated Use ListEdgesInput. */
|
|
126
|
-
export type QueryEdgesInput = ListEdgesInput;
|
|
127
|
-
|
|
128
|
-
/** Input for creating a typed edge between two graph nodes. */
|
|
129
|
-
export type CreateEdgeInput = {
|
|
130
|
-
fromNodeId: string;
|
|
131
|
-
toNodeId: string;
|
|
132
|
-
edgeType: string;
|
|
133
|
-
globalId?: string;
|
|
134
|
-
topicId?: string;
|
|
135
|
-
confidence?: number;
|
|
136
|
-
weight?: number;
|
|
137
|
-
context?: string;
|
|
138
|
-
derivationType?: string;
|
|
139
|
-
} & TopicIdentifierInput;
|
|
140
|
-
|
|
141
|
-
/** Filter for selecting edges to delete. */
|
|
142
|
-
export type DeleteEdgeInput = {
|
|
143
|
-
edgeId?: string;
|
|
144
|
-
fromNodeId?: string;
|
|
145
|
-
toNodeId?: string;
|
|
146
|
-
edgeType?: string;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
/** Input for batch-creating multiple graph nodes. */
|
|
150
|
-
export type BatchCreateNodesInput = {
|
|
151
|
-
nodes: Array<CreateNodeInput>;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
/** Input for superseding an existing graph node with a new version. */
|
|
155
|
-
export type SupersedeNodeInput = {
|
|
156
|
-
oldNodeId?: string;
|
|
157
|
-
nodeId?: string;
|
|
158
|
-
newGlobalId?: string;
|
|
159
|
-
newCanonicalText?: string;
|
|
160
|
-
text?: string;
|
|
161
|
-
canonicalText?: string;
|
|
162
|
-
newContentHash?: string;
|
|
163
|
-
reason?: string;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
/** Input for updating a node's verification state. */
|
|
167
|
-
export type VerifyNodeInput = {
|
|
168
|
-
nodeId?: string;
|
|
169
|
-
id?: string;
|
|
170
|
-
verificationStatus: string;
|
|
171
|
-
confidence?: number;
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
/** Input for permanently deleting a node via admin-only API. */
|
|
175
|
-
export type HardDeleteNodeInput = {
|
|
176
|
-
nodeId?: string;
|
|
177
|
-
id?: string;
|
|
178
|
-
reason: string;
|
|
179
|
-
allowBeliefHardDelete?: boolean;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
/** Input for retrieving the local neighborhood around a graph node. */
|
|
183
|
-
export type NeighborhoodInput = {
|
|
184
|
-
globalId?: string;
|
|
185
|
-
globalIds?: string;
|
|
186
|
-
maxDepth?: number;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
/** Input for finding the shortest path between two graph nodes. */
|
|
190
|
-
export type PathInput = {
|
|
191
|
-
fromGlobalId: string;
|
|
192
|
-
toGlobalId: string;
|
|
193
|
-
maxDepth?: number;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
/** Input for retrieving a specific graph analytics metric. */
|
|
197
|
-
export type AnalyticsInput = {
|
|
198
|
-
metric?: GraphAnalyticsMetric;
|
|
199
|
-
limit?: number;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
/** Input for traversing the graph from a starting node. */
|
|
203
|
-
export type TraverseInput = {
|
|
204
|
-
startNode: string;
|
|
205
|
-
direction?: string;
|
|
206
|
-
maxDepth?: number;
|
|
207
|
-
topicId?: string;
|
|
208
|
-
} & TopicIdentifierInput;
|
|
209
|
-
|
|
210
|
-
/** Input for structural analysis of a topic graph. */
|
|
211
|
-
export type AnalyzeInput = {
|
|
212
|
-
topicId?: string;
|
|
213
|
-
metric?: GraphAnalyticsMetric;
|
|
214
|
-
limit?: number;
|
|
215
|
-
} & TopicIdentifierInput;
|
|
216
|
-
|
|
217
|
-
/** Input for detecting confirmation-bias patterns in a topic graph. */
|
|
218
|
-
export type BiasInput = {
|
|
219
|
-
topicId?: string;
|
|
220
|
-
threshold?: number;
|
|
221
|
-
limit?: number;
|
|
222
|
-
} & TopicIdentifierInput;
|
|
223
|
-
|
|
224
|
-
/** Input for finding beliefs without sufficient testing questions. */
|
|
225
|
-
export type GapsInput = {
|
|
226
|
-
topicId?: string;
|
|
227
|
-
minConfidence?: number;
|
|
228
|
-
} & TopicIdentifierInput;
|
|
229
|
-
|
|
230
|
-
/** Input for cross-resource search within a topic scope. */
|
|
231
|
-
export type SearchInput = {
|
|
232
|
-
q?: string;
|
|
233
|
-
query?: string;
|
|
234
|
-
topicId?: string;
|
|
235
|
-
types?: string[];
|
|
236
|
-
status?: string;
|
|
237
|
-
minConfidence?: number;
|
|
238
|
-
limit?: number;
|
|
239
|
-
cursor?: string;
|
|
240
|
-
} & TopicIdentifierInput;
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Create the low-level graph client for nodes, edges, and graph analytics.
|
|
244
|
-
* @param config - Gateway transport configuration.
|
|
245
|
-
* @returns An object with methods for CRUD on nodes/edges plus analytics, traversal, and search.
|
|
246
|
-
*/
|
|
247
|
-
export function createGraphClient(config: GraphClientConfig = {}) {
|
|
248
|
-
const gateway = createGatewayRequestClient(config);
|
|
249
|
-
|
|
250
|
-
return {
|
|
251
|
-
/**
|
|
252
|
-
* List graph nodes matching the provided filters.
|
|
253
|
-
*/
|
|
254
|
-
async listNodes(query: ListNodesInput) {
|
|
255
|
-
return gateway.request<ListNodesResponse>({
|
|
256
|
-
path: `/api/platform/v1/graph/nodes${toQueryString(
|
|
257
|
-
normalizeTopicQuery(query)
|
|
258
|
-
)}`,
|
|
259
|
-
}).then((response) =>
|
|
260
|
-
mapGatewayData(response, (data) => mapAliasedList<PlatformGraphNode, "nodes">(data, "nodes"))
|
|
261
|
-
);
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* @deprecated Use listNodes.
|
|
266
|
-
*/
|
|
267
|
-
async queryNodes(query: QueryNodesInput) {
|
|
268
|
-
return this.listNodes(query);
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Retrieve a single graph node by nodeId or globalId.
|
|
273
|
-
*/
|
|
274
|
-
async getNode(query: GetNodeInput) {
|
|
275
|
-
return gateway.request<PlatformGraphNode>({
|
|
276
|
-
path: `/api/platform/v1/graph/nodes${toQueryString(query)}`,
|
|
277
|
-
}).then((response) =>
|
|
278
|
-
mapGatewayData(response, (data) =>
|
|
279
|
-
withSdkAliases(data as Record<string, unknown>) as PlatformGraphNode
|
|
280
|
-
)
|
|
281
|
-
);
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Create a graph node.
|
|
286
|
-
*/
|
|
287
|
-
async createNode(input: CreateNodeInput, idempotencyKey?: string) {
|
|
288
|
-
return gateway.request<CreateNodeResponse>({
|
|
289
|
-
path: "/api/platform/v1/graph/nodes",
|
|
290
|
-
method: "POST",
|
|
291
|
-
body: normalizeNodeWriteInput(input),
|
|
292
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
293
|
-
}).then((response) =>
|
|
294
|
-
mapGatewayData(response, (data) =>
|
|
295
|
-
withSdkAliases(data as Record<string, unknown>) as CreateNodeResponse
|
|
296
|
-
)
|
|
297
|
-
);
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Update a graph node.
|
|
302
|
-
*/
|
|
303
|
-
async updateNode(input: UpdateNodeInput, idempotencyKey?: string) {
|
|
304
|
-
return gateway.request<UpdateNodeResponse>({
|
|
305
|
-
path: "/api/platform/v1/graph/nodes",
|
|
306
|
-
method: "PUT",
|
|
307
|
-
body: normalizeNodeWriteInput(input as UpdateNodeInput & JsonObject),
|
|
308
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
309
|
-
}).then((response) =>
|
|
310
|
-
mapGatewayData(response, (data) =>
|
|
311
|
-
withSdkAliases(data as Record<string, unknown>) as UpdateNodeResponse
|
|
312
|
-
)
|
|
313
|
-
);
|
|
314
|
-
},
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Batch create graph nodes through the admin route surface.
|
|
318
|
-
*/
|
|
319
|
-
async batchCreateNodes(
|
|
320
|
-
input: BatchCreateNodesInput,
|
|
321
|
-
idempotencyKey?: string
|
|
322
|
-
) {
|
|
323
|
-
return gateway.request<Record<string, unknown>>({
|
|
324
|
-
path: "/api/platform/v1/graph/nodes/batch",
|
|
325
|
-
method: "POST",
|
|
326
|
-
body: {
|
|
327
|
-
nodes: input.nodes.map((node) => normalizeNodeWriteInput(node)),
|
|
328
|
-
} as JsonObject,
|
|
329
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
330
|
-
});
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Supersede an existing graph node with a new canonical version.
|
|
335
|
-
*/
|
|
336
|
-
async supersedeNode(input: SupersedeNodeInput, idempotencyKey?: string) {
|
|
337
|
-
return gateway.request<Record<string, unknown>>({
|
|
338
|
-
path: "/api/platform/v1/graph/nodes/supersede",
|
|
339
|
-
method: "POST",
|
|
340
|
-
body: input as JsonObject,
|
|
341
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
342
|
-
});
|
|
343
|
-
},
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Update a node's verification status.
|
|
347
|
-
*/
|
|
348
|
-
async verifyNode(input: VerifyNodeInput, idempotencyKey?: string) {
|
|
349
|
-
const verificationStatus =
|
|
350
|
-
normalizeNodeVerificationStatus(input.verificationStatus) ??
|
|
351
|
-
input.verificationStatus;
|
|
352
|
-
return gateway.request<Record<string, unknown>>({
|
|
353
|
-
path: "/api/platform/v1/graph/nodes/verify",
|
|
354
|
-
method: "POST",
|
|
355
|
-
body: {
|
|
356
|
-
...input,
|
|
357
|
-
verificationStatus,
|
|
358
|
-
} as JsonObject,
|
|
359
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
360
|
-
});
|
|
361
|
-
},
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Permanently delete a node via the admin-only hard-delete route.
|
|
365
|
-
*/
|
|
366
|
-
async hardDeleteNode(input: HardDeleteNodeInput, idempotencyKey?: string) {
|
|
367
|
-
return gateway.request<Record<string, unknown>>({
|
|
368
|
-
path: "/api/platform/v1/graph/nodes/hard-delete",
|
|
369
|
-
method: "POST",
|
|
370
|
-
body: input as JsonObject,
|
|
371
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
372
|
-
});
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* List graph edges matching the provided filters.
|
|
377
|
-
*/
|
|
378
|
-
async listEdges(query: ListEdgesInput) {
|
|
379
|
-
return gateway.request<ListEdgesResponse>({
|
|
380
|
-
path: `/api/platform/v1/graph/edges${toQueryString(
|
|
381
|
-
normalizeTopicQuery(query)
|
|
382
|
-
)}`,
|
|
383
|
-
}).then((response) =>
|
|
384
|
-
mapGatewayData(response, (data) =>
|
|
385
|
-
mapAliasedList<PlatformGraphEdge, "edges">(data, "edges")
|
|
386
|
-
)
|
|
387
|
-
);
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* @deprecated Use listEdges.
|
|
392
|
-
*/
|
|
393
|
-
async queryEdges(query: QueryEdgesInput) {
|
|
394
|
-
return this.listEdges(query);
|
|
395
|
-
},
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Create a graph edge.
|
|
399
|
-
*/
|
|
400
|
-
async createEdge(input: CreateEdgeInput, idempotencyKey?: string) {
|
|
401
|
-
return gateway.request<CreateEdgeResponse>({
|
|
402
|
-
path: "/api/platform/v1/graph/edges",
|
|
403
|
-
method: "POST",
|
|
404
|
-
body: normalizeTopicQuery(input as CreateEdgeInput & JsonObject),
|
|
405
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
406
|
-
});
|
|
407
|
-
},
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Delete one or more edges matching the provided filter.
|
|
411
|
-
*/
|
|
412
|
-
async deleteEdge(query: DeleteEdgeInput, idempotencyKey?: string) {
|
|
413
|
-
return gateway.request<DeleteEdgeResponse>({
|
|
414
|
-
path: `/api/platform/v1/graph/edges${toQueryString(query)}`,
|
|
415
|
-
method: "DELETE",
|
|
416
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
417
|
-
});
|
|
418
|
-
},
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Retrieve a graph neighborhood around a root node.
|
|
422
|
-
*/
|
|
423
|
-
async neighborhood(query: NeighborhoodInput) {
|
|
424
|
-
return gateway.request<GraphNeighborhoodResponse>({
|
|
425
|
-
path: `/api/platform/v1/graph/neighborhood${toQueryString(query)}`,
|
|
426
|
-
});
|
|
427
|
-
},
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Traverse the graph from a starting node.
|
|
431
|
-
*/
|
|
432
|
-
async traverse(query: TraverseInput) {
|
|
433
|
-
return gateway.request<Record<string, unknown>>({
|
|
434
|
-
path: "/api/platform/v1/graph/traverse",
|
|
435
|
-
method: "POST",
|
|
436
|
-
body: normalizeTopicQuery(query as TraverseInput & JsonObject),
|
|
437
|
-
});
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Analyze graph structure for a topic.
|
|
442
|
-
*/
|
|
443
|
-
async analyze(query: AnalyzeInput = {}) {
|
|
444
|
-
const normalized = normalizeTopicQuery(query as AnalyzeInput & JsonObject);
|
|
445
|
-
return gateway.request<Record<string, unknown>>({
|
|
446
|
-
path: `/api/platform/v1/graph/analyze${toQueryString({
|
|
447
|
-
topicId:
|
|
448
|
-
typeof normalized.topicId === "string" ? normalized.topicId : undefined,
|
|
449
|
-
metric:
|
|
450
|
-
typeof normalized.metric === "string" ? normalized.metric : undefined,
|
|
451
|
-
limit:
|
|
452
|
-
typeof normalized.limit === "number" ? normalized.limit : undefined,
|
|
453
|
-
})}`,
|
|
454
|
-
});
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Detect confirmation-bias patterns for a topic graph.
|
|
459
|
-
*/
|
|
460
|
-
async bias(query: BiasInput = {}) {
|
|
461
|
-
const normalized = normalizeTopicQuery(query as BiasInput & JsonObject);
|
|
462
|
-
return gateway.request<Record<string, unknown>>({
|
|
463
|
-
path: `/api/platform/v1/graph/bias${toQueryString({
|
|
464
|
-
topicId:
|
|
465
|
-
typeof normalized.topicId === "string" ? normalized.topicId : undefined,
|
|
466
|
-
threshold:
|
|
467
|
-
typeof normalized.threshold === "number"
|
|
468
|
-
? normalized.threshold
|
|
469
|
-
: undefined,
|
|
470
|
-
limit:
|
|
471
|
-
typeof normalized.limit === "number" ? normalized.limit : undefined,
|
|
472
|
-
})}`,
|
|
473
|
-
});
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Find graph gaps for beliefs that still need testing.
|
|
478
|
-
*/
|
|
479
|
-
async gaps(query: GapsInput) {
|
|
480
|
-
const normalized = normalizeTopicQuery(query as GapsInput & JsonObject);
|
|
481
|
-
return gateway.request<Record<string, unknown>>({
|
|
482
|
-
path: `/api/platform/v1/graph/gaps${toQueryString({
|
|
483
|
-
topicId:
|
|
484
|
-
typeof normalized.topicId === "string" ? normalized.topicId : undefined,
|
|
485
|
-
minConfidence:
|
|
486
|
-
typeof normalized.minConfidence === "number"
|
|
487
|
-
? normalized.minConfidence
|
|
488
|
-
: undefined,
|
|
489
|
-
})}`,
|
|
490
|
-
});
|
|
491
|
-
},
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Search across graph resources within a topic.
|
|
495
|
-
*/
|
|
496
|
-
async search(query: SearchInput) {
|
|
497
|
-
return gateway.request<Record<string, unknown>>({
|
|
498
|
-
path: "/api/platform/v1/search",
|
|
499
|
-
method: "POST",
|
|
500
|
-
body: normalizeTopicQuery(query as SearchInput & JsonObject),
|
|
501
|
-
});
|
|
502
|
-
},
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Retrieve a graph neighborhood around a root node.
|
|
506
|
-
*/
|
|
507
|
-
async getNeighborhood(query: NeighborhoodInput) {
|
|
508
|
-
return this.neighborhood(query);
|
|
509
|
-
},
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Retrieve the shortest known path between two graph nodes.
|
|
513
|
-
*/
|
|
514
|
-
async getPath(query: PathInput) {
|
|
515
|
-
return gateway.request<GraphPathResponse>({
|
|
516
|
-
path: `/api/platform/v1/graph/path${toQueryString(query)}`,
|
|
517
|
-
});
|
|
518
|
-
},
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Retrieve graph analytics for the requested metric.
|
|
522
|
-
*/
|
|
523
|
-
async getAnalytics(query: AnalyticsInput = {}) {
|
|
524
|
-
return gateway.request<GraphAnalyticsResponse>({
|
|
525
|
-
path: `/api/platform/v1/graph/analytics${toQueryString(query)}`,
|
|
526
|
-
});
|
|
527
|
-
},
|
|
528
|
-
};
|
|
529
|
-
}
|