@or-sdk/graph 1.10.0 → 1.10.1-beta.4012.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/dist/types/Graphs.d.ts +130 -0
- package/dist/types/Graphs.d.ts.map +1 -1
- package/dist/types/types.d.ts +12 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -4
package/dist/types/Graphs.d.ts
CHANGED
|
@@ -2,18 +2,148 @@ import { Base, List } from '@or-sdk/base';
|
|
|
2
2
|
import { WriteResponse, Graph, ExecuteQueryArgs, GraphInfo, GraphConfig, Query, ExecuteTransactionArgs, CreateNodeArgs, Node, NodeProperties } from './types';
|
|
3
3
|
export declare class Graphs extends Base {
|
|
4
4
|
constructor(params: GraphConfig);
|
|
5
|
+
/**
|
|
6
|
+
* Execute query in graph
|
|
7
|
+
* @param {ExecuteQueryArgs} query Query to run
|
|
8
|
+
* ```typescript
|
|
9
|
+
* type Place = Node<{ name: string; description: string; lat: number; lng: number }>
|
|
10
|
+
*
|
|
11
|
+
* const res = await graph.query<{ p: Place }>({
|
|
12
|
+
* graph: 'places',
|
|
13
|
+
* query: 'MATCH (p: Place) WHERE p.name = $name RETURN p',
|
|
14
|
+
* params: { name: 'CoffeePlace' }
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* console.log(res[0].n.name)
|
|
18
|
+
* // CoffeePlace
|
|
19
|
+
* ```
|
|
20
|
+
* @returns Query results as array
|
|
21
|
+
*/
|
|
5
22
|
query<T>({ query, params, graph, readonly }: ExecuteQueryArgs): Promise<T[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Execute bulk of queries in transaction in graph
|
|
25
|
+
* @param {string} graph Graph name to execute transaction in
|
|
26
|
+
* @param {ExecuteTransactionArgs[]} queries Set of queries to run in transaction
|
|
27
|
+
* ```typescript
|
|
28
|
+
*
|
|
29
|
+
* const res = await graph.transaction('places', [
|
|
30
|
+
* {
|
|
31
|
+
* query: 'CREATE (p: Place { name: 'place1' })',
|
|
32
|
+
* },
|
|
33
|
+
* {
|
|
34
|
+
* query: 'CREATE (p: Place { name: $name })',
|
|
35
|
+
* params: { name: 'place2' }
|
|
36
|
+
* }
|
|
37
|
+
* ]);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
6
40
|
transaction(graph: string, queries: ExecuteTransactionArgs[]): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* List graphs
|
|
43
|
+
* @param {string} [name] Graph name to search for.
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const graphs = await graph.listGraphs();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
7
48
|
listGraphs(name?: string): Promise<List<Graph>>;
|
|
49
|
+
/**
|
|
50
|
+
* Get graph info
|
|
51
|
+
* @param {string} [name] Graph name
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const result = await graph.getGraphInfo('graph-name');
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
8
56
|
getGraphInfo(name: string): Promise<GraphInfo>;
|
|
57
|
+
/**
|
|
58
|
+
* Create graph
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const result = await graph.createGraph({
|
|
61
|
+
* name: 'graph-name',
|
|
62
|
+
* description: 'First steps in graphs',
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
9
66
|
createGraph(graph: Graph): Promise<WriteResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Update graph
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const result = await graph.updateGraph({
|
|
71
|
+
* name: 'graph-name',
|
|
72
|
+
* description: 'First steps in graphs'
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
10
76
|
updateGraph(graph: Graph): Promise<WriteResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Delete graph
|
|
79
|
+
* @param {string} name Graph name to delete
|
|
80
|
+
* ```typescript
|
|
81
|
+
* await graph.deleteGraph('graph-name');
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
11
84
|
deleteGraph(name: string): Promise<WriteResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* Save Query for future resuse
|
|
87
|
+
* @param graph
|
|
88
|
+
* @param param1
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
12
91
|
saveQuery(graph: string, { name, ...query }: Query): Promise<WriteResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* List queries
|
|
94
|
+
* @param {string} graph Graph name to list queries for.
|
|
95
|
+
* @param {string} [name] Query name to search for.
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const queries = await graph.listQueries();
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
13
100
|
listQueries(graph: string, name?: string): Promise<List<Query>>;
|
|
101
|
+
/**
|
|
102
|
+
* Get single saved query
|
|
103
|
+
* @param {string} graph Graph name queries belong to
|
|
104
|
+
* @param {string} name Query name.
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const queries = await graph.listQueries();
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
14
109
|
getQuery(graph: string, name: string): Promise<Query>;
|
|
110
|
+
/**
|
|
111
|
+
* Delete saved query
|
|
112
|
+
* @param {string} graph Graph name query belongs to
|
|
113
|
+
* @param {string} name Query name to delete
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const result = await graph.deleteQuery('db-name');
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
15
118
|
deleteQuery(graph: string, name: string): Promise<WriteResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Converts user provided message to executable cypher query.
|
|
121
|
+
* @param {string} graph Graph name
|
|
122
|
+
* @param {string} text Text to generate a Cypher query from
|
|
123
|
+
* @returns {Promise<string>} Promise that resolves to the generated Cypher query
|
|
124
|
+
*
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const generatedCypher = await graph.textToCypher('my-graph', 'List all airports in London');
|
|
127
|
+
* console.log(generatedCypher);
|
|
128
|
+
* // MATCH (n:Airport) WHERE n.city = 'London' RETURN n
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
16
131
|
textToCypher(graph: string, text: string): Promise<string>;
|
|
132
|
+
/**
|
|
133
|
+
* Creates node in graph database
|
|
134
|
+
* @param {string[]} labels Node labels
|
|
135
|
+
* @param {object} properties Object with node properties, only string, number, boolean
|
|
136
|
+
* @param {string} databaseName Graph name
|
|
137
|
+
* @returns {Promise<Node>} Promise that returns created node
|
|
138
|
+
*
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const node = await graph.createNode({
|
|
141
|
+
* labels: ['Label1', 'Label2'],
|
|
142
|
+
* properties: { name: 'Node' },
|
|
143
|
+
* databaseName: 'my-graph'
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
17
147
|
createNode({ labels, properties, databaseName }: CreateNodeArgs): Promise<Node<NodeProperties>>;
|
|
18
148
|
}
|
|
19
149
|
//# 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;AAGpD,OAAO,EACL,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,KAAK,EAEL,sBAAsB,EACtB,cAAc,EACd,IAAI,EACJ,cAAc,EACf,MAAM,SAAS,CAAC;AAGjB,qBAAa,MAAO,SAAQ,IAAI;gBAClB,MAAM,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"Graphs.d.ts","sourceRoot":"","sources":["../../src/Graphs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAY,MAAM,cAAc,CAAC;AAGpD,OAAO,EACL,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,KAAK,EAEL,sBAAsB,EACtB,cAAc,EACd,IAAI,EACJ,cAAc,EACf,MAAM,SAAS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C,MAAM,CAAC;IAWvE;;;;;;;;;;;;;;OAcG;IACU,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;CAc7G"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { Token } from '@or-sdk/base';
|
|
2
2
|
export type GraphConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* token
|
|
5
|
+
*/
|
|
3
6
|
token: Token;
|
|
7
|
+
/**
|
|
8
|
+
* Url of OneReach service discovery api
|
|
9
|
+
*/
|
|
4
10
|
discoveryUrl?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Account ID for cross-account requests (super admin only)
|
|
13
|
+
*/
|
|
5
14
|
accountId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Url of OneReach graph api
|
|
17
|
+
*/
|
|
6
18
|
graphUrl?: string;
|
|
7
19
|
};
|
|
8
20
|
export type QueryParams = Record<string, null | number | string | boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IAEb;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MA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AE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,KAAK,EAAE,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@or-sdk/graph",
|
|
3
|
-
"version": "1.10.0",
|
|
3
|
+
"version": "1.10.1-beta.4012.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dev": "pnpm build:watch:esm"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@or-sdk/base": "^0.
|
|
21
|
+
"@or-sdk/base": "^0.44.0-beta.4012.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"concurrently": "9.0.1",
|
|
@@ -26,6 +26,5 @@
|
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
|
-
}
|
|
30
|
-
"gitHead": "ce62679c119c54ef41fd0d8f7084c563c3b21b24"
|
|
29
|
+
}
|
|
31
30
|
}
|