@or-sdk/graph 1.3.2 → 1.4.0
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/CHANGELOG.md +9 -0
- package/README.md +266 -86
- package/dist/cjs/Graphs.js +17 -0
- package/dist/cjs/Graphs.js.map +1 -1
- package/dist/esm/Graphs.js +10 -0
- package/dist/esm/Graphs.js.map +1 -1
- package/dist/types/Graphs.d.ts +1 -0
- package/dist/types/Graphs.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Graphs.ts +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.4.0](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/graph@1.3.2...@or-sdk/graph@1.4.0) (2023-06-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **graphs:** support conversion text to cypher ([fedcf4d](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/fedcf4d989dddba54a942fc15d3ea256fda2cc54))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [1.3.2](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/graph@1.3.1...@or-sdk/graph@1.3.2) (2023-06-01)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @or-sdk/graph
|
package/README.md
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
# Graphs SDK
|
|
2
2
|
|
|
3
|
-
The `@or-sdk/
|
|
3
|
+
The `@or-sdk/graphs` package provides a client for working with the Graphs system in OneReach.ai. With this client, you can perform operations such as creating graphs, executing queries, managing graph properties, and working with saved queries.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Concepts
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Graph
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A graph is a data structure that consists of nodes and relationships between those nodes. In the Graphs system, a graph can represent various types of entities and their relationships, allowing you to organize and structure data in a way that represents real-world scenarios.
|
|
10
|
+
|
|
11
|
+
### Node
|
|
12
|
+
|
|
13
|
+
A node is an individual entity within a graph that represents a single data item. Nodes can have properties that store information about the entity as key-value pairs. They can also have one or more labels, which help to classify nodes into groups or categories.
|
|
14
|
+
|
|
15
|
+
### Relationship
|
|
16
|
+
|
|
17
|
+
A relationship is a connection between two nodes in a graph. It represents how the entities are related or connected. Relationships can have properties that store information about the connection as key-value pairs. They also have a relationship type, which helps to classify the relationship based on its purpose or meaning.
|
|
18
|
+
|
|
19
|
+
### Query
|
|
20
|
+
|
|
21
|
+
A query is a statement that is used to interact with the Graphs system, including creating, updating, or retrieving data from a graph. The query language used in the OneReach.ai Graphs system is based on [Cypher](https://neo4j.com/developer/cypher/), which is a powerful and expressive declarative graph query language.
|
|
10
22
|
|
|
11
23
|
## Installation
|
|
12
24
|
|
|
13
25
|
To install the package, run the following command:
|
|
14
26
|
|
|
15
27
|
```
|
|
16
|
-
$ npm install @or-sdk/
|
|
28
|
+
$ npm install @or-sdk/graphs
|
|
17
29
|
```
|
|
18
30
|
|
|
19
31
|
## Usage
|
|
@@ -21,184 +33,352 @@ $ npm install @or-sdk/graph
|
|
|
21
33
|
To use the `Graphs` client, you need to create an instance of the class with the appropriate configuration options. You can either provide the direct API URL or the service discovery URL. Here is an example:
|
|
22
34
|
|
|
23
35
|
```typescript
|
|
24
|
-
import { Graphs } from '@or-sdk/
|
|
36
|
+
import { Graphs } from '@or-sdk/graphs';
|
|
25
37
|
|
|
26
38
|
// with direct api url
|
|
27
|
-
const
|
|
39
|
+
const graphs = new Graphs({
|
|
28
40
|
token: 'my-account-token-string',
|
|
29
|
-
graphUrl: 'http://example.
|
|
41
|
+
graphUrl: 'http://example.graphs/endpoint'
|
|
30
42
|
});
|
|
31
43
|
|
|
32
44
|
// with service discovery(slower)
|
|
33
|
-
const
|
|
45
|
+
const graphs = new Graphs({
|
|
34
46
|
token: 'my-account-token-string',
|
|
35
|
-
discoveryUrl: 'http://example.
|
|
47
|
+
discoveryUrl: 'http://example.graphs/endpoint'
|
|
36
48
|
});
|
|
37
49
|
```
|
|
38
50
|
|
|
39
|
-
Once you have an instance of the `Graphs`
|
|
40
|
-
client, you can use its methods to interact with the OneReach.ai Graphs application. The available methods are:
|
|
41
|
-
|
|
51
|
+
Once you have an instance of the `Graphs` client, you can use its methods to interact with the OneReach.ai Graphs system. The available methods are:
|
|
42
52
|
|
|
43
53
|
### `query`
|
|
44
|
-
|
|
54
|
+
|
|
55
|
+
Execute a query in a graph to retrieve, create, or manipulate data stored in the graph.
|
|
45
56
|
|
|
46
57
|
#### Params
|
|
47
|
-
- `
|
|
48
|
-
- `[0].query: graph` - Graph name to execute the query in
|
|
49
|
-
- `[0].params?: Object` - Optional substitution params.
|
|
58
|
+
- `query`: `ExecuteQueryArgs` - The query object containing the graph name, the query string, and optional query parameters
|
|
50
59
|
|
|
51
60
|
#### Example
|
|
52
|
-
```typescript
|
|
53
|
-
type Place = Node<{ name: string; description: string; lat: number; lng: number }>
|
|
54
61
|
|
|
55
|
-
|
|
62
|
+
In this example, the `query` method executes a Cypher query to match nodes with the label "Place" where the `name` property equals "CoffeePlace", and returns the matching nodes.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const results = await graphs.query<{ p: Place }>({
|
|
56
66
|
graph: 'places',
|
|
57
67
|
query: 'MATCH (p: Place) WHERE p.name = $name RETURN p',
|
|
58
|
-
params: { name: 'CoffeePlace' }
|
|
68
|
+
params: { name: 'CoffeePlace' },
|
|
59
69
|
});
|
|
60
70
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
// Example response
|
|
72
|
+
[
|
|
73
|
+
{
|
|
74
|
+
p: {
|
|
75
|
+
id: 1,
|
|
76
|
+
labels: ['Place'],
|
|
77
|
+
properties: {
|
|
78
|
+
name: 'CoffeePlace',
|
|
79
|
+
description: 'A cozy place for coffee lovers',
|
|
80
|
+
lat: 40.7128,
|
|
81
|
+
lng: -74.0060,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
]
|
|
64
86
|
```
|
|
65
87
|
|
|
66
|
-
### `
|
|
67
|
-
|
|
88
|
+
### `createGraph`
|
|
89
|
+
|
|
90
|
+
Create a new graph with a specified name and optional description and imageUrl.
|
|
68
91
|
|
|
69
92
|
#### Params
|
|
70
|
-
- `
|
|
93
|
+
- `graph`: `Graph` - The graph object containing the name, and optional description and imageUrl
|
|
71
94
|
|
|
72
95
|
#### Example
|
|
96
|
+
|
|
97
|
+
In this example, the `createGraph` method creates a new graph with the name "places", description "A graph of places and their relationships", and an imageUrl for the graph's icon.
|
|
98
|
+
|
|
73
99
|
```typescript
|
|
74
|
-
const
|
|
100
|
+
const result = await graphs.createGraph({
|
|
101
|
+
name: 'places',
|
|
102
|
+
description: 'A graph of places and their relationships',
|
|
103
|
+
imageUrl: 'http://example.com/graph-icon.png',
|
|
104
|
+
});
|
|
75
105
|
|
|
76
|
-
|
|
77
|
-
|
|
106
|
+
// Example response
|
|
107
|
+
{
|
|
108
|
+
ok: 1,
|
|
109
|
+
}
|
|
78
110
|
```
|
|
79
111
|
|
|
80
|
-
### `
|
|
81
|
-
|
|
112
|
+
### `listGraphs`
|
|
113
|
+
|
|
114
|
+
Retrieve a list of graphs from the Graphs system, optionally filtering by a graph name.
|
|
82
115
|
|
|
83
116
|
#### Params
|
|
84
|
-
- `
|
|
117
|
+
- `name`: `string` (optional) - The name of the graph to search for.
|
|
118
|
+
|
|
119
|
+
#### Returns
|
|
120
|
+
- `Promise<List<Graph>>`: A promise containing a list of graph objects.
|
|
85
121
|
|
|
86
122
|
#### Example
|
|
87
|
-
```typescript
|
|
88
|
-
const result = await graph.getGraphInfo('graph-name');
|
|
89
123
|
|
|
90
|
-
|
|
91
|
-
|
|
124
|
+
In this example, the `listGraphs` method fetches a list of graphs from the Graphs system.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const graphsList = await graphs.listGraphs();
|
|
128
|
+
|
|
129
|
+
console.log(graphsList.items);
|
|
130
|
+
// Example output
|
|
131
|
+
// [
|
|
132
|
+
// {
|
|
133
|
+
// name: 'places',
|
|
134
|
+
// description: 'A graph of places and their relationships',
|
|
135
|
+
// imageUrl: 'http://example.com/graph-icon.png',
|
|
136
|
+
// },
|
|
137
|
+
// {
|
|
138
|
+
// name: 'people',
|
|
139
|
+
// description: 'A graph of people and their relationships',
|
|
140
|
+
// imageUrl: 'http://example.com/people-graph-icon.png',
|
|
141
|
+
// },
|
|
142
|
+
// ]
|
|
143
|
+
|
|
144
|
+
// If you want to search for a specific graph by name
|
|
145
|
+
const specificGraphsList = await graphs.listGraphs('places');
|
|
146
|
+
|
|
147
|
+
console.log(specificGraphsList.items);
|
|
148
|
+
// Example output
|
|
149
|
+
// [
|
|
150
|
+
// {
|
|
151
|
+
// name: 'places',
|
|
152
|
+
// description: 'A graph of places and their relationships',
|
|
153
|
+
// imageUrl: 'http://example.com/graph-icon.png',
|
|
154
|
+
// },
|
|
155
|
+
// ]
|
|
92
156
|
```
|
|
93
157
|
|
|
94
|
-
|
|
95
|
-
|
|
158
|
+
The `listGraphs` method helps you fetch information about the available graphs or a specific graph by name so you can manage them or execute queries on them using other methods available in the SDK.
|
|
159
|
+
|
|
160
|
+
### `getGraphInfo`
|
|
161
|
+
|
|
162
|
+
Retrieve detailed information about a graph, including its labels and relationship types, by specifying its name.
|
|
96
163
|
|
|
97
164
|
#### Params
|
|
98
|
-
- `
|
|
165
|
+
- `name`: `string` - The name of the graph for which you want to obtain information.
|
|
166
|
+
|
|
167
|
+
#### Returns
|
|
168
|
+
- `Promise<GraphInfo>`: A promise containing information about the requested graph.
|
|
99
169
|
|
|
100
170
|
#### Example
|
|
101
|
-
```typescript
|
|
102
|
-
const result = await graph.createGraph({
|
|
103
|
-
name: 'graph-name',
|
|
104
|
-
description: 'First steps in graphs',
|
|
105
|
-
});
|
|
106
171
|
|
|
107
|
-
|
|
108
|
-
|
|
172
|
+
In this example, the `getGraphInfo` method fetches information about the "places" graph.
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
const graphInfo = await graphs.getGraphInfo("places");
|
|
176
|
+
|
|
177
|
+
console.log(graphInfo);
|
|
178
|
+
// Example output
|
|
179
|
+
// {
|
|
180
|
+
// name: 'places',
|
|
181
|
+
// description: 'A graph of places and their relationships',
|
|
182
|
+
// imageUrl: 'http://example.com/graph-icon.png',
|
|
183
|
+
// labels: ['Place', 'City', 'Country'],
|
|
184
|
+
// relationshipTypes: ['LOCATED_IN', 'CONNECTED_TO']
|
|
185
|
+
// }
|
|
109
186
|
```
|
|
110
187
|
|
|
188
|
+
The `getGraphInfo` method allows you to retrieve detailed information about a specific graph, such as its labels and relationship types, so you can understand the structure of the graph and use this information when working with queries or managing the graph.
|
|
189
|
+
|
|
111
190
|
### `updateGraph`
|
|
112
|
-
|
|
191
|
+
|
|
192
|
+
Update the properties of an existing graph in the Graphs system, such as the description or imageUrl.
|
|
113
193
|
|
|
114
194
|
#### Params
|
|
115
|
-
- `
|
|
195
|
+
- `graph`: `Graph` - The graph object containing the name of the graph to update, and any properties (description or imageUrl) that you want to update.
|
|
196
|
+
|
|
197
|
+
#### Returns
|
|
198
|
+
- `Promise<WriteResponse>`: A promise containing an object with a property 'ok' indicating the success of the update operation.
|
|
116
199
|
|
|
117
200
|
#### Example
|
|
201
|
+
|
|
202
|
+
In this example, the `updateGraph` method updates the description and imageUrl properties of an existing graph named "places".
|
|
203
|
+
|
|
118
204
|
```typescript
|
|
119
|
-
const
|
|
120
|
-
name: '
|
|
121
|
-
description: '
|
|
205
|
+
const updateResult = await graphs.updateGraph({
|
|
206
|
+
name: 'places',
|
|
207
|
+
description: 'An updated description for the places graph',
|
|
208
|
+
imageUrl: 'http://example.com/updated-graph-icon.png',
|
|
122
209
|
});
|
|
123
210
|
|
|
124
|
-
console.log(
|
|
125
|
-
//
|
|
211
|
+
console.log(updateResult);
|
|
212
|
+
// Example output
|
|
213
|
+
// { ok: 1 }
|
|
126
214
|
```
|
|
127
215
|
|
|
216
|
+
The `updateGraph` method helps you modify the properties of an existing graph in the Graphs system. Keep in mind that you need to provide the `name` property of the graph you want to update, along with any of the properties you want to modify (description or imageUrl).
|
|
217
|
+
|
|
128
218
|
### `deleteGraph`
|
|
129
|
-
|
|
219
|
+
|
|
220
|
+
Delete a graph by its name from the Graphs system.
|
|
130
221
|
|
|
131
222
|
#### Params
|
|
132
|
-
- `
|
|
223
|
+
- `name`: `string` - The name of the graph to delete.
|
|
224
|
+
|
|
225
|
+
#### Returns
|
|
226
|
+
- `Promise<WriteResponse>`: A promise containing a write response object indicating the success status of the operation.
|
|
133
227
|
|
|
134
228
|
#### Example
|
|
229
|
+
|
|
230
|
+
In this example, the `deleteGraph` method deletes a graph with the name "places" from the Graphs system.
|
|
231
|
+
|
|
135
232
|
```typescript
|
|
136
|
-
const result = await
|
|
233
|
+
const result = await graphs.deleteGraph('places');
|
|
137
234
|
|
|
138
235
|
console.log(result);
|
|
139
|
-
//
|
|
236
|
+
// Example output
|
|
237
|
+
// {
|
|
238
|
+
// ok: 1,
|
|
239
|
+
// }
|
|
140
240
|
```
|
|
141
241
|
|
|
242
|
+
Using the `deleteGraph` method, you can remove a graph from the Graphs system if you no longer need it or if you want to clean up resources. Keep in mind that deleting a graph permanently removes its data and cannot be undone. Ensure you have proper backups or data exports before performing this operation.
|
|
243
|
+
|
|
142
244
|
### `saveQuery`
|
|
143
|
-
|
|
245
|
+
|
|
246
|
+
Save a query to the Graphs system for future reuse. This allows you to store frequently used queries for easy access and execution.
|
|
144
247
|
|
|
145
248
|
#### Params
|
|
146
|
-
- `
|
|
147
|
-
- `
|
|
249
|
+
- `graph`: `string` - The name of the graph that the query belongs to.
|
|
250
|
+
- `query`: `Query` - The query object containing the name, query string, and optional description and parameters.
|
|
251
|
+
|
|
252
|
+
#### Returns
|
|
253
|
+
- `Promise<WriteResponse>`: A promise containing a write response object indicating the success of the operation.
|
|
148
254
|
|
|
149
255
|
#### Example
|
|
256
|
+
|
|
257
|
+
In this example, the `saveQuery` method saves a query to the Graphs system for the "places" graph. The query finds places with the label "Place" that have a `name` property equal to a given value.
|
|
258
|
+
|
|
150
259
|
```typescript
|
|
151
|
-
const
|
|
152
|
-
name: '
|
|
260
|
+
const query: Query = {
|
|
261
|
+
name: 'findPlaceByName',
|
|
153
262
|
query: 'MATCH (p: Place) WHERE p.name = $name RETURN p',
|
|
154
|
-
|
|
263
|
+
description: 'Find a place by its name',
|
|
264
|
+
params: { name: 'string' },
|
|
265
|
+
};
|
|
155
266
|
|
|
156
|
-
|
|
157
|
-
|
|
267
|
+
const result = await graphs.saveQuery('places', query);
|
|
268
|
+
|
|
269
|
+
// Example response
|
|
270
|
+
// {
|
|
271
|
+
// ok: 1,
|
|
272
|
+
// }
|
|
158
273
|
```
|
|
159
274
|
|
|
275
|
+
The `saveQuery` method makes it easy to store frequently used queries to the Graphs system, allowing you to execute them later without defining the query each time. You can also manage the saved queries using other methods available in the SDK, such as `listQueries`, `getQuery`, and `deleteQuery`.
|
|
276
|
+
|
|
160
277
|
### `listQueries`
|
|
161
|
-
|
|
278
|
+
|
|
279
|
+
Retrieve a list of saved queries for a specific graph, optionally filtering by a query name.
|
|
162
280
|
|
|
163
281
|
#### Params
|
|
164
|
-
- `
|
|
165
|
-
- `
|
|
282
|
+
- `graph`: `string` - The name of the graph for which to list saved queries.
|
|
283
|
+
- `name`: `string` (optional) - The name of the query to search for.
|
|
284
|
+
|
|
285
|
+
#### Returns
|
|
286
|
+
- `Promise<List<Query>>`: A promise containing a list of saved query objects.
|
|
166
287
|
|
|
167
288
|
#### Example
|
|
168
|
-
```typescript
|
|
169
|
-
const queries = await graph.listQueries('graph-name');
|
|
170
289
|
|
|
171
|
-
|
|
172
|
-
|
|
290
|
+
In this example, the `listQueries` method fetches a list of saved queries for a graph named "places".
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
const queriesList = await graphs.listQueries('places');
|
|
294
|
+
|
|
295
|
+
console.log(queriesList.items);
|
|
296
|
+
// Example output
|
|
297
|
+
// [
|
|
298
|
+
// {
|
|
299
|
+
// name: 'find_place_by_name',
|
|
300
|
+
// query: 'MATCH (p:Place) WHERE p.name = $name RETURN p',
|
|
301
|
+
// description: 'Find a place by its name',
|
|
302
|
+
// params: { name: 'string' },
|
|
303
|
+
// },
|
|
304
|
+
// {
|
|
305
|
+
// name: 'find_nearby_places',
|
|
306
|
+
// query: 'MATCH (p:Place) WHERE p.lat between $latMin and $latMax AND p.lng between $lngMin and $lngMax RETURN p',
|
|
307
|
+
// description: 'Find nearby places based on latitude and longitude ranges',
|
|
308
|
+
// params: { latMin: 'number', latMax: 'number', lngMin: 'number', lngMax: 'number' },
|
|
309
|
+
// },
|
|
310
|
+
// ]
|
|
311
|
+
|
|
312
|
+
// If you want to search for a specific saved query by name
|
|
313
|
+
const specificQueriesList = await graphs.listQueries('places', 'find_place_by_name');
|
|
314
|
+
|
|
315
|
+
console.log(specificQueriesList.items);
|
|
316
|
+
// Example output
|
|
317
|
+
// [
|
|
318
|
+
// {
|
|
319
|
+
// name: 'find_place_by_name',
|
|
320
|
+
// query: 'MATCH (p:Place) WHERE p.name = $name RETURN p',
|
|
321
|
+
// description: 'Find a place by its name',
|
|
322
|
+
// params: { name: 'string' },
|
|
323
|
+
// },
|
|
324
|
+
// ]
|
|
173
325
|
```
|
|
174
326
|
|
|
327
|
+
The `listQueries` method allows you to fetch information about saved queries for a specific graph so you can execute them or manage them using other methods available in the SDK.
|
|
328
|
+
|
|
175
329
|
### `getQuery`
|
|
176
|
-
|
|
330
|
+
|
|
331
|
+
Retrieve a single saved query by its name from a specified graph.
|
|
177
332
|
|
|
178
333
|
#### Params
|
|
179
|
-
- `
|
|
180
|
-
- `
|
|
334
|
+
- `graph`: `string` - The name of the graph to which the saved query belongs.
|
|
335
|
+
- `name`: `string` - The name of the saved query to fetch.
|
|
336
|
+
|
|
337
|
+
#### Returns
|
|
338
|
+
- `Promise<Query>`: A promise containing a query object with details of the saved query.
|
|
181
339
|
|
|
182
340
|
#### Example
|
|
183
|
-
```typescript
|
|
184
|
-
const result = await graph.getQuery('graph-name', 'query-name');
|
|
185
341
|
|
|
186
|
-
|
|
187
|
-
|
|
342
|
+
In this example, the `getQuery` method retrieves a saved query named "find_places" from the "places" graph.
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
const query = await graphs.getQuery('places', 'find_places');
|
|
346
|
+
|
|
347
|
+
console.log(query);
|
|
348
|
+
// Example output
|
|
349
|
+
// {
|
|
350
|
+
// name: 'find_places',
|
|
351
|
+
// query: 'MATCH (p: Place) WHERE p.name = $name RETURN p',
|
|
352
|
+
// description: 'Find places by name',
|
|
353
|
+
// params: { name: 'string' },
|
|
354
|
+
// }
|
|
188
355
|
```
|
|
189
356
|
|
|
357
|
+
The `getQuery` method helps you fetch the details of a specific saved query from a graph so that you can review its functionality, update its properties, or delete it if necessary using other SDK methods.
|
|
358
|
+
|
|
190
359
|
### `deleteQuery`
|
|
191
|
-
|
|
360
|
+
|
|
361
|
+
Delete a saved query from a graph in the Graphs system.
|
|
192
362
|
|
|
193
363
|
#### Params
|
|
194
|
-
- `
|
|
195
|
-
- `
|
|
364
|
+
- `graph`: `string` - The name of the graph the saved query belongs to.
|
|
365
|
+
- `name`: `string` - The name of the saved query to delete.
|
|
366
|
+
|
|
367
|
+
#### Returns
|
|
368
|
+
- `Promise<WriteResponse>`: A promise containing the write response indicating the success or failure of the deletion.
|
|
196
369
|
|
|
197
370
|
#### Example
|
|
371
|
+
|
|
372
|
+
In this example, the `deleteQuery` method deletes a saved query named "findPopularPlaces" from the "places" graph.
|
|
373
|
+
|
|
198
374
|
```typescript
|
|
199
|
-
const result = await
|
|
375
|
+
const result = await graphs.deleteQuery('places', 'findPopularPlaces');
|
|
200
376
|
|
|
201
377
|
console.log(result);
|
|
202
|
-
//
|
|
378
|
+
// Example output
|
|
379
|
+
// {
|
|
380
|
+
// ok: 1,
|
|
381
|
+
// }
|
|
203
382
|
```
|
|
204
383
|
|
|
384
|
+
Use the `deleteQuery` method to maintain and manage your saved queries in a graph by deleting the ones that are no longer needed or relevant. This helps with keeping your Graphs system organized and efficient.
|
package/dist/cjs/Graphs.js
CHANGED
|
@@ -202,6 +202,23 @@ var Graphs = (function (_super) {
|
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
};
|
|
205
|
+
Graphs.prototype.textToCypher = function (graph, text) {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
207
|
+
var query;
|
|
208
|
+
return __generator(this, function (_a) {
|
|
209
|
+
switch (_a.label) {
|
|
210
|
+
case 0: return [4, this.callApiV2({
|
|
211
|
+
data: { text: text },
|
|
212
|
+
method: 'POST',
|
|
213
|
+
route: "graphs/".concat(graph, "/text-to-cypher"),
|
|
214
|
+
})];
|
|
215
|
+
case 1:
|
|
216
|
+
query = (_a.sent()).query;
|
|
217
|
+
return [2, query];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
};
|
|
205
222
|
return Graphs;
|
|
206
223
|
}(base_1.Base));
|
|
207
224
|
exports.Graphs = Graphs;
|
package/dist/cjs/Graphs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graphs.js","sourceRoot":"","sources":["../../src/Graphs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AAapD,yCAA0C;AAE1C;IAA4B,0BAAI;IAC9B,gBAAY,MAAmB;QACrB,IAAA,KAAK,GAAwC,MAAM,MAA9C,EAAE,YAAY,GAA0B,MAAM,aAAhC,EAAE,SAAS,GAAe,MAAM,UAArB,EAAE,QAAQ,GAAK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,CAAC,CAAC,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC,CAAC,EAAE;yBAC7B,CAAC,EAAA;;wBAJI,OAAO,GAAG,SAId;wBAEF,WAAO,IAAA,eAAQ,EAAQ,OAAO,CAAC,EAAC;;;;KACjC;IAUY,yBAAQ,GAArB,UAAsB,KAAa,EAAE,IAAY;;;gBAC/C,WAAO,IAAI,CAAC,SAAS,CAAQ;wBAC3B,MAAM,EAAE,KAAK;wBACb,KAAK,EAAE,iBAAU,KAAK,sBAAY,IAAI,CAAE;qBACzC,CAAC,EAAC;;;KACJ;IAUY,4BAAW,GAAxB,UAAyB,KAAa,EAAE,IAAY;;;gBAClD,WAAO,IAAI,CAAC,SAAS,CAAgB;wBACnC,MAAM,EAAE,QAAQ;wBAChB,KAAK,EAAE,iBAAU,KAAK,sBAAY,IAAI,CAAE;qBACzC,CAAC,EAAC;;;KACJ;IAcY,6BAAY,GAAzB,UAA0B,KAAa,EAAE,IAAY;;;;;4BACjC,WAAM,IAAI,CAAC,SAAS,CAAqB;4BACzD,IAAI,EAAE,EAAE,IAAI,MAAA,EAAE;4BACd,MAAM,EAAE,MAAM;4BACd,KAAK,EAAE,iBAAU,KAAK,oBAAiB;yBACxC,CAAC,EAAA;;wBAJM,KAAK,GAAK,CAAA,SAIhB,CAAA,MAJW;wBAMb,WAAO,KAAK,EAAC;;;;KACd;IACH,aAAC;AAAD,CAAC,AA7MD,CAA4B,WAAI,GA6M/B;AA7MY,wBAAM"}
|
package/dist/esm/Graphs.js
CHANGED
|
@@ -124,5 +124,15 @@ export class Graphs extends Base {
|
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
+
textToCypher(graph, text) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
const { query } = yield this.callApiV2({
|
|
130
|
+
data: { text },
|
|
131
|
+
method: 'POST',
|
|
132
|
+
route: `graphs/${graph}/text-to-cypher`,
|
|
133
|
+
});
|
|
134
|
+
return query;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
127
137
|
}
|
|
128
138
|
//# sourceMappingURL=Graphs.js.map
|
package/dist/esm/Graphs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graphs.js","sourceRoot":"","sources":["../../src/Graphs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAapD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,MAAO,SAAQ,IAAI;IAC9B,YAAY,MAAmB;QAC7B,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAE5D,KAAK,CAAC;YACJ,KAAK;YACL,YAAY;YACZ,UAAU,EAAE,WAAW;YACvB,SAAS;YACT,UAAU,EAAE,QAAQ;SACrB,CAAC,CAAC;IACL,CAAC;IAmBY,KAAK,CAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAoB;;YAC9D,OAAO,IAAI,CAAC,SAAS,CAAW;gBAC9B,IAAI,EAAE;oBACJ,KAAK;oBACL,MAAM;iBACP;gBACD,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,UAAU,KAAK,QAAQ;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IASY,UAAU,CAAC,IAAa;;YACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAAqB;gBACpD,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;aAC7B,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAQ,IAAI,CAAC,CAAC;QAC/B,CAAC;KAAA;IASY,YAAY,CAAC,IAAY;;YACpC,OAAO,IAAI,CAAC,SAAS,CAAY;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,WAAW,CAAC,KAAa,EAAE,IAAa;;YACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAsB;gBACxD,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,UAAU,KAAK,UAAU;gBAChC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;aAC7B,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAQ,OAAO,CAAC,CAAC;QAClC,CAAC;KAAA;IAUY,QAAQ,CAAC,KAAa,EAAE,IAAY;;YAC/C,OAAO,IAAI,CAAC,SAAS,CAAQ;gBAC3B,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,UAAU,KAAK,YAAY,IAAI,EAAE;aACzC,CAAC,CAAC;QACL,CAAC;KAAA;IAUY,WAAW,CAAC,KAAa,EAAE,IAAY;;YAClD,OAAO,IAAI,CAAC,SAAS,CAAgB;gBACnC,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,UAAU,KAAK,YAAY,IAAI,EAAE;aACzC,CAAC,CAAC;QACL,CAAC;KAAA;IAcY,YAAY,CAAC,KAAa,EAAE,IAAY;;YACnD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS,CAAqB;gBACzD,IAAI,EAAE,EAAE,IAAI,EAAE;gBACd,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,UAAU,KAAK,iBAAiB;aACxC,CAAC,CAAC;YAEH,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;CACF"}
|
package/dist/types/Graphs.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export declare class Graphs extends Base {
|
|
|
12
12
|
listQueries(graph: string, name?: string): Promise<List<Query>>;
|
|
13
13
|
getQuery(graph: string, name: string): Promise<Query>;
|
|
14
14
|
deleteQuery(graph: string, name: string): Promise<WriteResponse>;
|
|
15
|
+
textToCypher(graph: string, text: string): Promise<string>;
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=Graphs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graphs.d.ts","sourceRoot":"","sources":["../../src/Graphs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAY,MAAM,cAAc,CAAC;AAEpD,OAAO,EACL,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,KAAK,EAEN,MAAM,SAAS,CAAC;AAIjB,qBAAa,MAAO,SAAQ,IAAI;gBAClB,MAAM,EAAE,WAAW;IA6BlB,KAAK,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,gBAAgB;IAkBnD,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAiB/C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAgB9C,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;IAiBjD,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;IAiBjD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAajD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK;IAgBlD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAkBxC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAepC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Graphs.d.ts","sourceRoot":"","sources":["../../src/Graphs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,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
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "252e3551ff821d5c9b833ce0b2b694091cc97faa"
|
|
32
32
|
}
|
package/src/Graphs.ts
CHANGED
|
@@ -196,4 +196,26 @@ export class Graphs extends Base {
|
|
|
196
196
|
route: `graphs/${graph}/queries/${name}`,
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Converts user provided message to executable cypher query.
|
|
202
|
+
* @param {string} graph Graph name
|
|
203
|
+
* @param {string} text Text to generate a Cypher query from
|
|
204
|
+
* @returns {Promise<string>} Promise that resolves to the generated Cypher query
|
|
205
|
+
*
|
|
206
|
+
* ```typescript
|
|
207
|
+
* const generatedCypher = await graph.textToCypher('my-graph', 'List all airports in London');
|
|
208
|
+
* console.log(generatedCypher);
|
|
209
|
+
* // MATCH (n:Airport) WHERE n.city = 'London' RETURN n
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
public async textToCypher(graph: string, text: string): Promise<string> {
|
|
213
|
+
const { query } = await this.callApiV2<{ query: string; }>({
|
|
214
|
+
data: { text },
|
|
215
|
+
method: 'POST',
|
|
216
|
+
route: `graphs/${graph}/text-to-cypher`,
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
return query;
|
|
220
|
+
}
|
|
199
221
|
}
|