@getzep/zep-cloud 3.0.4 → 3.1.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/cjs/Client.js +2 -2
- package/dist/cjs/api/errors/index.d.ts +1 -1
- package/dist/cjs/api/errors/index.js +1 -1
- package/dist/cjs/api/resources/graph/client/Client.d.ts +21 -19
- package/dist/cjs/api/resources/graph/client/Client.js +81 -62
- package/dist/cjs/api/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
- package/dist/cjs/api/resources/graph/client/requests/GraphListEntityTypesRequest.d.ts +17 -0
- package/dist/cjs/api/resources/graph/client/requests/GraphListEntityTypesRequest.js +5 -0
- package/dist/cjs/api/resources/graph/client/requests/index.d.ts +2 -1
- package/dist/cjs/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
- package/dist/cjs/serialization/resources/graph/client/requests/EntityTypeRequest.js +2 -0
- package/dist/cjs/serialization/resources/graph/client/requests/index.d.ts +1 -1
- package/dist/cjs/serialization/resources/graph/client/requests/index.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrapper/graph.d.ts +14 -7
- package/dist/cjs/wrapper/graph.js +12 -8
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/errors/index.d.mts +1 -1
- package/dist/esm/api/errors/index.mjs +1 -1
- package/dist/esm/api/resources/graph/client/Client.d.mts +21 -19
- package/dist/esm/api/resources/graph/client/Client.mjs +81 -62
- package/dist/esm/api/resources/graph/client/requests/EntityTypeRequest.d.mts +2 -0
- package/dist/esm/api/resources/graph/client/requests/GraphListEntityTypesRequest.d.mts +17 -0
- package/dist/esm/api/resources/graph/client/requests/GraphListEntityTypesRequest.mjs +4 -0
- package/dist/esm/api/resources/graph/client/requests/index.d.mts +2 -1
- package/dist/esm/serialization/resources/graph/client/requests/EntityTypeRequest.d.mts +2 -0
- package/dist/esm/serialization/resources/graph/client/requests/EntityTypeRequest.mjs +2 -0
- package/dist/esm/serialization/resources/graph/client/requests/index.d.mts +1 -1
- package/dist/esm/serialization/resources/graph/client/requests/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/wrapper/graph.d.mts +14 -7
- package/dist/esm/wrapper/graph.mjs +12 -8
- package/package.json +1 -1
- package/reference.md +26 -18
|
@@ -14,10 +14,11 @@ const Client_js_1 = require("../api/resources/graph/client/Client.js");
|
|
|
14
14
|
const ontology_js_1 = require("./ontology.js");
|
|
15
15
|
class Graph extends Client_js_1.Graph {
|
|
16
16
|
/**
|
|
17
|
-
* Sets the entity and edge types for
|
|
17
|
+
* Sets the entity and edge types for the specified targets, replacing any existing ones in those targets. If no targets are specified, it sets the ontology for the entire project.
|
|
18
18
|
*
|
|
19
19
|
* @param {Record<string, EntityType>} entityTypes
|
|
20
20
|
* @param {Record<string, EdgeType>} edgeTypes
|
|
21
|
+
* @param {OntologyTargets} [ontologyTargets] - The targets for which to set the ontology. Can include userIds or graphIds. If none specified, sets for the entire project.
|
|
21
22
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
22
23
|
*
|
|
23
24
|
* @throws {@link Zep.BadRequestError}
|
|
@@ -49,9 +50,9 @@ class Graph extends Client_js_1.Graph {
|
|
|
49
50
|
* TravelDestination: travelDestinationSchema,
|
|
50
51
|
* }, {
|
|
51
52
|
* IS_TRAVELING_TO: isTravelingTo,
|
|
52
|
-
* });
|
|
53
|
+
* }, {userIds: ['user_1234']});
|
|
53
54
|
*/
|
|
54
|
-
setEntityTypes(entityTypes, edgeTypes, requestOptions) {
|
|
55
|
+
setEntityTypes(entityTypes, edgeTypes, ontologyTargets, requestOptions) {
|
|
55
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
57
|
const validatedEntityTypes = Object.keys(entityTypes).map((key) => {
|
|
57
58
|
const schema = entityTypes[key];
|
|
@@ -64,14 +65,17 @@ class Graph extends Client_js_1.Graph {
|
|
|
64
65
|
return this.setEntityTypesInternal({
|
|
65
66
|
entityTypes: validatedEntityTypes,
|
|
66
67
|
edgeTypes: validatedEdgeTypes,
|
|
68
|
+
userIds: ontologyTargets === null || ontologyTargets === void 0 ? void 0 : ontologyTargets.userIds,
|
|
69
|
+
graphIds: ontologyTargets === null || ontologyTargets === void 0 ? void 0 : ontologyTargets.graphIds,
|
|
67
70
|
}, requestOptions);
|
|
68
71
|
});
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
71
|
-
* Sets the entity and edge types for
|
|
74
|
+
* Sets the entity and edge types for the specified targets, replacing any existing ones in those targets. If no targets are specified, it sets the ontology for the entire project.
|
|
72
75
|
*
|
|
73
76
|
* @param {Record<string, EntityType>} entityTypes
|
|
74
77
|
* @param {Record<string, EdgeType>} edgeTypes
|
|
78
|
+
* @param {OntologyTargets} [ontologyTargets] - The targets for which to set the ontology. Can include userIds or graphIds. If none specified, sets for the entire project.
|
|
75
79
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
76
80
|
*
|
|
77
81
|
* @throws {@link Zep.BadRequestError}
|
|
@@ -99,15 +103,15 @@ class Graph extends Client_js_1.Graph {
|
|
|
99
103
|
* ]
|
|
100
104
|
* }
|
|
101
105
|
*
|
|
102
|
-
* await client.graph.
|
|
106
|
+
* await client.graph.setEntityTypes({
|
|
103
107
|
* TravelDestination: travelDestinationSchema,
|
|
104
108
|
* }, {
|
|
105
109
|
* IS_TRAVELING_TO: isTravelingTo,
|
|
106
|
-
* });
|
|
110
|
+
* }, {userIds: ['user_1234']});
|
|
107
111
|
*/
|
|
108
|
-
setOntology(entityTypes, edgeTypes, requestOptions) {
|
|
112
|
+
setOntology(entityTypes, edgeTypes, ontologyTargets, requestOptions) {
|
|
109
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
return this.setEntityTypes(entityTypes, edgeTypes, requestOptions);
|
|
114
|
+
return this.setEntityTypes(entityTypes, edgeTypes, ontologyTargets, requestOptions);
|
|
111
115
|
});
|
|
112
116
|
}
|
|
113
117
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -11,8 +11,8 @@ export class ZepClient {
|
|
|
11
11
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
12
12
|
"X-Fern-Language": "JavaScript",
|
|
13
13
|
"X-Fern-SDK-Name": "zep-cloud",
|
|
14
|
-
"X-Fern-SDK-Version": "3.0
|
|
15
|
-
"User-Agent": "zep-cloud/3.0
|
|
14
|
+
"X-Fern-SDK-Version": "3.1.0",
|
|
15
|
+
"User-Agent": "zep-cloud/3.1.0",
|
|
16
16
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
17
17
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
18
18
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -38,20 +38,22 @@ export declare class Graph {
|
|
|
38
38
|
get episode(): Episode;
|
|
39
39
|
get node(): Node;
|
|
40
40
|
/**
|
|
41
|
-
* Returns all entity types for a project.
|
|
41
|
+
* Returns all entity types for a project, user, or graph.
|
|
42
42
|
*
|
|
43
|
+
* @param {Zep.GraphListEntityTypesRequest} request
|
|
43
44
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
45
|
*
|
|
46
|
+
* @throws {@link Zep.BadRequestError}
|
|
45
47
|
* @throws {@link Zep.NotFoundError}
|
|
46
48
|
* @throws {@link Zep.InternalServerError}
|
|
47
49
|
*
|
|
48
50
|
* @example
|
|
49
51
|
* await client.graph.listEntityTypes()
|
|
50
52
|
*/
|
|
51
|
-
listEntityTypes(requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.EntityTypeResponse>;
|
|
53
|
+
listEntityTypes(request?: Zep.GraphListEntityTypesRequest, requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.EntityTypeResponse>;
|
|
52
54
|
private __listEntityTypes;
|
|
53
55
|
/**
|
|
54
|
-
* Sets the entity types for
|
|
56
|
+
* Sets the entity types for multiple users and graphs, replacing any existing ones.
|
|
55
57
|
*
|
|
56
58
|
* @param {Zep.EntityTypeRequest} request
|
|
57
59
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -132,22 +134,6 @@ export declare class Graph {
|
|
|
132
134
|
*/
|
|
133
135
|
clone(request?: Zep.CloneGraphRequest, requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.CloneGraphResponse>;
|
|
134
136
|
private __clone;
|
|
135
|
-
/**
|
|
136
|
-
* Perform a graph search query.
|
|
137
|
-
*
|
|
138
|
-
* @param {Zep.GraphSearchQuery} request
|
|
139
|
-
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
140
|
-
*
|
|
141
|
-
* @throws {@link Zep.BadRequestError}
|
|
142
|
-
* @throws {@link Zep.InternalServerError}
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* await client.graph.search({
|
|
146
|
-
* query: "query"
|
|
147
|
-
* })
|
|
148
|
-
*/
|
|
149
|
-
search(request: Zep.GraphSearchQuery, requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.GraphSearchResults>;
|
|
150
|
-
private __search;
|
|
151
137
|
/**
|
|
152
138
|
* Creates a new graph.
|
|
153
139
|
*
|
|
@@ -178,6 +164,22 @@ export declare class Graph {
|
|
|
178
164
|
*/
|
|
179
165
|
listAll(request?: Zep.GraphListAllRequest, requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.GraphListResponse>;
|
|
180
166
|
private __listAll;
|
|
167
|
+
/**
|
|
168
|
+
* Perform a graph search query.
|
|
169
|
+
*
|
|
170
|
+
* @param {Zep.GraphSearchQuery} request
|
|
171
|
+
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
172
|
+
*
|
|
173
|
+
* @throws {@link Zep.BadRequestError}
|
|
174
|
+
* @throws {@link Zep.InternalServerError}
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* await client.graph.search({
|
|
178
|
+
* query: "query"
|
|
179
|
+
* })
|
|
180
|
+
*/
|
|
181
|
+
search(request: Zep.GraphSearchQuery, requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.GraphSearchResults>;
|
|
182
|
+
private __search;
|
|
181
183
|
/**
|
|
182
184
|
* Returns a graph.
|
|
183
185
|
*
|
|
@@ -36,26 +36,37 @@ export class Graph {
|
|
|
36
36
|
return ((_a = this._node) !== null && _a !== void 0 ? _a : (this._node = new Node(this._options)));
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Returns all entity types for a project.
|
|
39
|
+
* Returns all entity types for a project, user, or graph.
|
|
40
40
|
*
|
|
41
|
+
* @param {Zep.GraphListEntityTypesRequest} request
|
|
41
42
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
42
43
|
*
|
|
44
|
+
* @throws {@link Zep.BadRequestError}
|
|
43
45
|
* @throws {@link Zep.NotFoundError}
|
|
44
46
|
* @throws {@link Zep.InternalServerError}
|
|
45
47
|
*
|
|
46
48
|
* @example
|
|
47
49
|
* await client.graph.listEntityTypes()
|
|
48
50
|
*/
|
|
49
|
-
listEntityTypes(requestOptions) {
|
|
50
|
-
return core.HttpResponsePromise.fromPromise(this.__listEntityTypes(requestOptions));
|
|
51
|
+
listEntityTypes(request = {}, requestOptions) {
|
|
52
|
+
return core.HttpResponsePromise.fromPromise(this.__listEntityTypes(request, requestOptions));
|
|
51
53
|
}
|
|
52
|
-
__listEntityTypes(
|
|
53
|
-
return __awaiter(this,
|
|
54
|
+
__listEntityTypes() {
|
|
55
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
54
56
|
var _a, _b, _c, _d;
|
|
57
|
+
const { userId, graphId } = request;
|
|
58
|
+
const _queryParams = {};
|
|
59
|
+
if (userId != null) {
|
|
60
|
+
_queryParams["user_id"] = userId;
|
|
61
|
+
}
|
|
62
|
+
if (graphId != null) {
|
|
63
|
+
_queryParams["graph_id"] = graphId;
|
|
64
|
+
}
|
|
55
65
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
56
66
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, "entity-types"),
|
|
57
67
|
method: "GET",
|
|
58
68
|
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
69
|
+
queryParameters: _queryParams,
|
|
59
70
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
60
71
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
61
72
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -74,6 +85,14 @@ export class Graph {
|
|
|
74
85
|
}
|
|
75
86
|
if (_response.error.reason === "status-code") {
|
|
76
87
|
switch (_response.error.statusCode) {
|
|
88
|
+
case 400:
|
|
89
|
+
throw new Zep.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
90
|
+
unrecognizedObjectKeys: "passthrough",
|
|
91
|
+
allowUnrecognizedUnionMembers: true,
|
|
92
|
+
allowUnrecognizedEnumValues: true,
|
|
93
|
+
skipValidation: true,
|
|
94
|
+
breadcrumbsPrefix: ["response"],
|
|
95
|
+
}), _response.rawResponse);
|
|
77
96
|
case 404:
|
|
78
97
|
throw new Zep.NotFoundError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
79
98
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -116,7 +135,7 @@ export class Graph {
|
|
|
116
135
|
});
|
|
117
136
|
}
|
|
118
137
|
/**
|
|
119
|
-
* Sets the entity types for
|
|
138
|
+
* Sets the entity types for multiple users and graphs, replacing any existing ones.
|
|
120
139
|
*
|
|
121
140
|
* @param {Zep.EntityTypeRequest} request
|
|
122
141
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -563,32 +582,32 @@ export class Graph {
|
|
|
563
582
|
});
|
|
564
583
|
}
|
|
565
584
|
/**
|
|
566
|
-
*
|
|
585
|
+
* Creates a new graph.
|
|
567
586
|
*
|
|
568
|
-
* @param {Zep.
|
|
587
|
+
* @param {Zep.CreateGraphRequest} request
|
|
569
588
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
570
589
|
*
|
|
571
590
|
* @throws {@link Zep.BadRequestError}
|
|
572
591
|
* @throws {@link Zep.InternalServerError}
|
|
573
592
|
*
|
|
574
593
|
* @example
|
|
575
|
-
* await client.graph.
|
|
576
|
-
*
|
|
594
|
+
* await client.graph.create({
|
|
595
|
+
* graphId: "graph_id"
|
|
577
596
|
* })
|
|
578
597
|
*/
|
|
579
|
-
|
|
580
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
598
|
+
create(request, requestOptions) {
|
|
599
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
581
600
|
}
|
|
582
|
-
|
|
601
|
+
__create(request, requestOptions) {
|
|
583
602
|
return __awaiter(this, void 0, void 0, function* () {
|
|
584
603
|
var _a, _b, _c, _d;
|
|
585
604
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
586
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, "graph/
|
|
605
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, "graph/create"),
|
|
587
606
|
method: "POST",
|
|
588
607
|
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
589
608
|
contentType: "application/json",
|
|
590
609
|
requestType: "json",
|
|
591
|
-
body: serializers.
|
|
610
|
+
body: serializers.CreateGraphRequest.jsonOrThrow(request, {
|
|
592
611
|
unrecognizedObjectKeys: "strip",
|
|
593
612
|
omitUndefined: true,
|
|
594
613
|
}),
|
|
@@ -598,7 +617,7 @@ export class Graph {
|
|
|
598
617
|
});
|
|
599
618
|
if (_response.ok) {
|
|
600
619
|
return {
|
|
601
|
-
data: serializers.
|
|
620
|
+
data: serializers.Graph.parseOrThrow(_response.body, {
|
|
602
621
|
unrecognizedObjectKeys: "passthrough",
|
|
603
622
|
allowUnrecognizedUnionMembers: true,
|
|
604
623
|
allowUnrecognizedEnumValues: true,
|
|
@@ -642,7 +661,7 @@ export class Graph {
|
|
|
642
661
|
rawResponse: _response.rawResponse,
|
|
643
662
|
});
|
|
644
663
|
case "timeout":
|
|
645
|
-
throw new errors.ZepTimeoutError("Timeout exceeded when calling POST /graph/
|
|
664
|
+
throw new errors.ZepTimeoutError("Timeout exceeded when calling POST /graph/create.");
|
|
646
665
|
case "unknown":
|
|
647
666
|
throw new errors.ZepError({
|
|
648
667
|
message: _response.error.errorMessage,
|
|
@@ -652,42 +671,43 @@ export class Graph {
|
|
|
652
671
|
});
|
|
653
672
|
}
|
|
654
673
|
/**
|
|
655
|
-
*
|
|
674
|
+
* Returns all graphs.
|
|
656
675
|
*
|
|
657
|
-
* @param {Zep.
|
|
676
|
+
* @param {Zep.GraphListAllRequest} request
|
|
658
677
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
659
678
|
*
|
|
660
679
|
* @throws {@link Zep.BadRequestError}
|
|
661
680
|
* @throws {@link Zep.InternalServerError}
|
|
662
681
|
*
|
|
663
682
|
* @example
|
|
664
|
-
* await client.graph.
|
|
665
|
-
* graphId: "graph_id"
|
|
666
|
-
* })
|
|
683
|
+
* await client.graph.listAll()
|
|
667
684
|
*/
|
|
668
|
-
|
|
669
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
685
|
+
listAll(request = {}, requestOptions) {
|
|
686
|
+
return core.HttpResponsePromise.fromPromise(this.__listAll(request, requestOptions));
|
|
670
687
|
}
|
|
671
|
-
|
|
672
|
-
return __awaiter(this,
|
|
688
|
+
__listAll() {
|
|
689
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
673
690
|
var _a, _b, _c, _d;
|
|
691
|
+
const { pageNumber, pageSize } = request;
|
|
692
|
+
const _queryParams = {};
|
|
693
|
+
if (pageNumber != null) {
|
|
694
|
+
_queryParams["pageNumber"] = pageNumber.toString();
|
|
695
|
+
}
|
|
696
|
+
if (pageSize != null) {
|
|
697
|
+
_queryParams["pageSize"] = pageSize.toString();
|
|
698
|
+
}
|
|
674
699
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
675
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, "
|
|
676
|
-
method: "
|
|
700
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, "graph/list-all"),
|
|
701
|
+
method: "GET",
|
|
677
702
|
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
678
|
-
|
|
679
|
-
requestType: "json",
|
|
680
|
-
body: serializers.CreateGraphRequest.jsonOrThrow(request, {
|
|
681
|
-
unrecognizedObjectKeys: "strip",
|
|
682
|
-
omitUndefined: true,
|
|
683
|
-
}),
|
|
703
|
+
queryParameters: _queryParams,
|
|
684
704
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
685
705
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
686
706
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
687
707
|
});
|
|
688
708
|
if (_response.ok) {
|
|
689
709
|
return {
|
|
690
|
-
data: serializers.
|
|
710
|
+
data: serializers.GraphListResponse.parseOrThrow(_response.body, {
|
|
691
711
|
unrecognizedObjectKeys: "passthrough",
|
|
692
712
|
allowUnrecognizedUnionMembers: true,
|
|
693
713
|
allowUnrecognizedEnumValues: true,
|
|
@@ -731,7 +751,7 @@ export class Graph {
|
|
|
731
751
|
rawResponse: _response.rawResponse,
|
|
732
752
|
});
|
|
733
753
|
case "timeout":
|
|
734
|
-
throw new errors.ZepTimeoutError("Timeout exceeded when calling
|
|
754
|
+
throw new errors.ZepTimeoutError("Timeout exceeded when calling GET /graph/list-all.");
|
|
735
755
|
case "unknown":
|
|
736
756
|
throw new errors.ZepError({
|
|
737
757
|
message: _response.error.errorMessage,
|
|
@@ -741,43 +761,42 @@ export class Graph {
|
|
|
741
761
|
});
|
|
742
762
|
}
|
|
743
763
|
/**
|
|
744
|
-
*
|
|
764
|
+
* Perform a graph search query.
|
|
745
765
|
*
|
|
746
|
-
* @param {Zep.
|
|
766
|
+
* @param {Zep.GraphSearchQuery} request
|
|
747
767
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
748
768
|
*
|
|
749
769
|
* @throws {@link Zep.BadRequestError}
|
|
750
770
|
* @throws {@link Zep.InternalServerError}
|
|
751
771
|
*
|
|
752
772
|
* @example
|
|
753
|
-
* await client.graph.
|
|
773
|
+
* await client.graph.search({
|
|
774
|
+
* query: "query"
|
|
775
|
+
* })
|
|
754
776
|
*/
|
|
755
|
-
|
|
756
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
777
|
+
search(request, requestOptions) {
|
|
778
|
+
return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
|
|
757
779
|
}
|
|
758
|
-
|
|
759
|
-
return __awaiter(this,
|
|
780
|
+
__search(request, requestOptions) {
|
|
781
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
760
782
|
var _a, _b, _c, _d;
|
|
761
|
-
const { pageNumber, pageSize } = request;
|
|
762
|
-
const _queryParams = {};
|
|
763
|
-
if (pageNumber != null) {
|
|
764
|
-
_queryParams["pageNumber"] = pageNumber.toString();
|
|
765
|
-
}
|
|
766
|
-
if (pageSize != null) {
|
|
767
|
-
_queryParams["pageSize"] = pageSize.toString();
|
|
768
|
-
}
|
|
769
783
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
770
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, "
|
|
771
|
-
method: "
|
|
784
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, "graph/search"),
|
|
785
|
+
method: "POST",
|
|
772
786
|
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
773
|
-
|
|
787
|
+
contentType: "application/json",
|
|
788
|
+
requestType: "json",
|
|
789
|
+
body: serializers.GraphSearchQuery.jsonOrThrow(request, {
|
|
790
|
+
unrecognizedObjectKeys: "strip",
|
|
791
|
+
omitUndefined: true,
|
|
792
|
+
}),
|
|
774
793
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
775
794
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
776
795
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
777
796
|
});
|
|
778
797
|
if (_response.ok) {
|
|
779
798
|
return {
|
|
780
|
-
data: serializers.
|
|
799
|
+
data: serializers.GraphSearchResults.parseOrThrow(_response.body, {
|
|
781
800
|
unrecognizedObjectKeys: "passthrough",
|
|
782
801
|
allowUnrecognizedUnionMembers: true,
|
|
783
802
|
allowUnrecognizedEnumValues: true,
|
|
@@ -821,7 +840,7 @@ export class Graph {
|
|
|
821
840
|
rawResponse: _response.rawResponse,
|
|
822
841
|
});
|
|
823
842
|
case "timeout":
|
|
824
|
-
throw new errors.ZepTimeoutError("Timeout exceeded when calling
|
|
843
|
+
throw new errors.ZepTimeoutError("Timeout exceeded when calling POST /graph/search.");
|
|
825
844
|
case "unknown":
|
|
826
845
|
throw new errors.ZepError({
|
|
827
846
|
message: _response.error.errorMessage,
|
|
@@ -849,7 +868,7 @@ export class Graph {
|
|
|
849
868
|
return __awaiter(this, void 0, void 0, function* () {
|
|
850
869
|
var _a, _b, _c, _d;
|
|
851
870
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
852
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, `
|
|
871
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, `graph/${encodeURIComponent(graphId)}`),
|
|
853
872
|
method: "GET",
|
|
854
873
|
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
855
874
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -902,7 +921,7 @@ export class Graph {
|
|
|
902
921
|
rawResponse: _response.rawResponse,
|
|
903
922
|
});
|
|
904
923
|
case "timeout":
|
|
905
|
-
throw new errors.ZepTimeoutError("Timeout exceeded when calling GET /
|
|
924
|
+
throw new errors.ZepTimeoutError("Timeout exceeded when calling GET /graph/{graphId}.");
|
|
906
925
|
case "unknown":
|
|
907
926
|
throw new errors.ZepError({
|
|
908
927
|
message: _response.error.errorMessage,
|
|
@@ -931,7 +950,7 @@ export class Graph {
|
|
|
931
950
|
return __awaiter(this, void 0, void 0, function* () {
|
|
932
951
|
var _a, _b, _c, _d;
|
|
933
952
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
934
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, `
|
|
953
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, `graph/${encodeURIComponent(graphId)}`),
|
|
935
954
|
method: "DELETE",
|
|
936
955
|
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
937
956
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -992,7 +1011,7 @@ export class Graph {
|
|
|
992
1011
|
rawResponse: _response.rawResponse,
|
|
993
1012
|
});
|
|
994
1013
|
case "timeout":
|
|
995
|
-
throw new errors.ZepTimeoutError("Timeout exceeded when calling DELETE /
|
|
1014
|
+
throw new errors.ZepTimeoutError("Timeout exceeded when calling DELETE /graph/{graphId}.");
|
|
996
1015
|
case "unknown":
|
|
997
1016
|
throw new errors.ZepError({
|
|
998
1017
|
message: _response.error.errorMessage,
|
|
@@ -1022,7 +1041,7 @@ export class Graph {
|
|
|
1022
1041
|
return __awaiter(this, arguments, void 0, function* (graphId, request = {}, requestOptions) {
|
|
1023
1042
|
var _a, _b, _c, _d;
|
|
1024
1043
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
1025
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, `
|
|
1044
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ZepEnvironment.Default, `graph/${encodeURIComponent(graphId)}`),
|
|
1026
1045
|
method: "PATCH",
|
|
1027
1046
|
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
1028
1047
|
contentType: "application/json",
|
|
@@ -1089,7 +1108,7 @@ export class Graph {
|
|
|
1089
1108
|
rawResponse: _response.rawResponse,
|
|
1090
1109
|
});
|
|
1091
1110
|
case "timeout":
|
|
1092
|
-
throw new errors.ZepTimeoutError("Timeout exceeded when calling PATCH /
|
|
1111
|
+
throw new errors.ZepTimeoutError("Timeout exceeded when calling PATCH /graph/{graphId}.");
|
|
1093
1112
|
case "unknown":
|
|
1094
1113
|
throw new errors.ZepError({
|
|
1095
1114
|
message: _response.error.errorMessage,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {}
|
|
7
|
+
*/
|
|
8
|
+
export interface GraphListEntityTypesRequest {
|
|
9
|
+
/**
|
|
10
|
+
* User ID to get user-specific entity types
|
|
11
|
+
*/
|
|
12
|
+
userId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Graph ID to get graph-specific entity types
|
|
15
|
+
*/
|
|
16
|
+
graphId?: string;
|
|
17
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
export { type GraphListEntityTypesRequest } from "./GraphListEntityTypesRequest.mjs";
|
|
1
2
|
export { type EntityTypeRequest } from "./EntityTypeRequest.mjs";
|
|
2
3
|
export { type AddDataRequest } from "./AddDataRequest.mjs";
|
|
3
4
|
export { type AddDataBatchRequest } from "./AddDataBatchRequest.mjs";
|
|
4
5
|
export { type AddTripleRequest } from "./AddTripleRequest.mjs";
|
|
5
6
|
export { type CloneGraphRequest } from "./CloneGraphRequest.mjs";
|
|
6
|
-
export { type GraphSearchQuery } from "./GraphSearchQuery.mjs";
|
|
7
7
|
export { type CreateGraphRequest } from "./CreateGraphRequest.mjs";
|
|
8
8
|
export { type GraphListAllRequest } from "./GraphListAllRequest.mjs";
|
|
9
|
+
export { type GraphSearchQuery } from "./GraphSearchQuery.mjs";
|
|
9
10
|
export { type UpdateGraphRequest } from "./UpdateGraphRequest.mjs";
|
|
@@ -7,4 +7,6 @@ import { EntityType } from "../../../../types/EntityType.mjs";
|
|
|
7
7
|
export const EntityTypeRequest = core.serialization.object({
|
|
8
8
|
edgeTypes: core.serialization.property("edge_types", core.serialization.list(EdgeType).optional()),
|
|
9
9
|
entityTypes: core.serialization.property("entity_types", core.serialization.list(EntityType).optional()),
|
|
10
|
+
graphIds: core.serialization.property("graph_ids", core.serialization.list(core.serialization.string()).optional()),
|
|
11
|
+
userIds: core.serialization.property("user_ids", core.serialization.list(core.serialization.string()).optional()),
|
|
10
12
|
});
|
|
@@ -3,6 +3,6 @@ export { AddDataRequest } from "./AddDataRequest.mjs";
|
|
|
3
3
|
export { AddDataBatchRequest } from "./AddDataBatchRequest.mjs";
|
|
4
4
|
export { AddTripleRequest } from "./AddTripleRequest.mjs";
|
|
5
5
|
export { CloneGraphRequest } from "./CloneGraphRequest.mjs";
|
|
6
|
-
export { GraphSearchQuery } from "./GraphSearchQuery.mjs";
|
|
7
6
|
export { CreateGraphRequest } from "./CreateGraphRequest.mjs";
|
|
7
|
+
export { GraphSearchQuery } from "./GraphSearchQuery.mjs";
|
|
8
8
|
export { UpdateGraphRequest } from "./UpdateGraphRequest.mjs";
|
|
@@ -3,6 +3,6 @@ export { AddDataRequest } from "./AddDataRequest.mjs";
|
|
|
3
3
|
export { AddDataBatchRequest } from "./AddDataBatchRequest.mjs";
|
|
4
4
|
export { AddTripleRequest } from "./AddTripleRequest.mjs";
|
|
5
5
|
export { CloneGraphRequest } from "./CloneGraphRequest.mjs";
|
|
6
|
-
export { GraphSearchQuery } from "./GraphSearchQuery.mjs";
|
|
7
6
|
export { CreateGraphRequest } from "./CreateGraphRequest.mjs";
|
|
7
|
+
export { GraphSearchQuery } from "./GraphSearchQuery.mjs";
|
|
8
8
|
export { UpdateGraphRequest } from "./UpdateGraphRequest.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.0
|
|
1
|
+
export declare const SDK_VERSION = "3.1.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "3.0
|
|
1
|
+
export const SDK_VERSION = "3.1.0";
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Graph as BaseGraph } from "../api/resources/graph/client/Client.mjs";
|
|
2
2
|
import { Zep } from "../index.mjs";
|
|
3
3
|
import { EdgeType, EntityType } from "./ontology.mjs";
|
|
4
|
+
interface OntologyTargets {
|
|
5
|
+
userIds?: string[];
|
|
6
|
+
graphIds?: string[];
|
|
7
|
+
}
|
|
4
8
|
export declare class Graph extends BaseGraph {
|
|
5
9
|
/**
|
|
6
|
-
* Sets the entity and edge types for
|
|
10
|
+
* Sets the entity and edge types for the specified targets, replacing any existing ones in those targets. If no targets are specified, it sets the ontology for the entire project.
|
|
7
11
|
*
|
|
8
12
|
* @param {Record<string, EntityType>} entityTypes
|
|
9
13
|
* @param {Record<string, EdgeType>} edgeTypes
|
|
14
|
+
* @param {OntologyTargets} [ontologyTargets] - The targets for which to set the ontology. Can include userIds or graphIds. If none specified, sets for the entire project.
|
|
10
15
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
11
16
|
*
|
|
12
17
|
* @throws {@link Zep.BadRequestError}
|
|
@@ -38,14 +43,15 @@ export declare class Graph extends BaseGraph {
|
|
|
38
43
|
* TravelDestination: travelDestinationSchema,
|
|
39
44
|
* }, {
|
|
40
45
|
* IS_TRAVELING_TO: isTravelingTo,
|
|
41
|
-
* });
|
|
46
|
+
* }, {userIds: ['user_1234']});
|
|
42
47
|
*/
|
|
43
|
-
setEntityTypes(entityTypes: Record<string, EntityType>, edgeTypes: Record<string, EdgeType>, requestOptions?: BaseGraph.RequestOptions): Promise<Zep.SuccessResponse>;
|
|
48
|
+
setEntityTypes(entityTypes: Record<string, EntityType>, edgeTypes: Record<string, EdgeType>, ontologyTargets?: OntologyTargets, requestOptions?: BaseGraph.RequestOptions): Promise<Zep.SuccessResponse>;
|
|
44
49
|
/**
|
|
45
|
-
* Sets the entity and edge types for
|
|
50
|
+
* Sets the entity and edge types for the specified targets, replacing any existing ones in those targets. If no targets are specified, it sets the ontology for the entire project.
|
|
46
51
|
*
|
|
47
52
|
* @param {Record<string, EntityType>} entityTypes
|
|
48
53
|
* @param {Record<string, EdgeType>} edgeTypes
|
|
54
|
+
* @param {OntologyTargets} [ontologyTargets] - The targets for which to set the ontology. Can include userIds or graphIds. If none specified, sets for the entire project.
|
|
49
55
|
* @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
|
|
50
56
|
*
|
|
51
57
|
* @throws {@link Zep.BadRequestError}
|
|
@@ -73,11 +79,12 @@ export declare class Graph extends BaseGraph {
|
|
|
73
79
|
* ]
|
|
74
80
|
* }
|
|
75
81
|
*
|
|
76
|
-
* await client.graph.
|
|
82
|
+
* await client.graph.setEntityTypes({
|
|
77
83
|
* TravelDestination: travelDestinationSchema,
|
|
78
84
|
* }, {
|
|
79
85
|
* IS_TRAVELING_TO: isTravelingTo,
|
|
80
|
-
* });
|
|
86
|
+
* }, {userIds: ['user_1234']});
|
|
81
87
|
*/
|
|
82
|
-
setOntology(entityTypes: Record<string, EntityType>, edgeTypes: Record<string, EdgeType>, requestOptions?: BaseGraph.RequestOptions): Promise<Zep.SuccessResponse>;
|
|
88
|
+
setOntology(entityTypes: Record<string, EntityType>, edgeTypes: Record<string, EdgeType>, ontologyTargets?: OntologyTargets, requestOptions?: BaseGraph.RequestOptions): Promise<Zep.SuccessResponse>;
|
|
83
89
|
}
|
|
90
|
+
export {};
|