@getzep/zep-cloud 3.0.5 → 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.
Files changed (32) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/errors/index.d.ts +1 -1
  3. package/dist/cjs/api/errors/index.js +1 -1
  4. package/dist/cjs/api/resources/graph/client/Client.d.ts +5 -3
  5. package/dist/cjs/api/resources/graph/client/Client.js +25 -6
  6. package/dist/cjs/api/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
  7. package/dist/cjs/api/resources/graph/client/requests/GraphListEntityTypesRequest.d.ts +17 -0
  8. package/dist/cjs/api/resources/graph/client/requests/GraphListEntityTypesRequest.js +5 -0
  9. package/dist/cjs/api/resources/graph/client/requests/index.d.ts +1 -0
  10. package/dist/cjs/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
  11. package/dist/cjs/serialization/resources/graph/client/requests/EntityTypeRequest.js +2 -0
  12. package/dist/cjs/version.d.ts +1 -1
  13. package/dist/cjs/version.js +1 -1
  14. package/dist/cjs/wrapper/graph.d.ts +14 -7
  15. package/dist/cjs/wrapper/graph.js +12 -8
  16. package/dist/esm/Client.mjs +2 -2
  17. package/dist/esm/api/errors/index.d.mts +1 -1
  18. package/dist/esm/api/errors/index.mjs +1 -1
  19. package/dist/esm/api/resources/graph/client/Client.d.mts +5 -3
  20. package/dist/esm/api/resources/graph/client/Client.mjs +25 -6
  21. package/dist/esm/api/resources/graph/client/requests/EntityTypeRequest.d.mts +2 -0
  22. package/dist/esm/api/resources/graph/client/requests/GraphListEntityTypesRequest.d.mts +17 -0
  23. package/dist/esm/api/resources/graph/client/requests/GraphListEntityTypesRequest.mjs +4 -0
  24. package/dist/esm/api/resources/graph/client/requests/index.d.mts +1 -0
  25. package/dist/esm/serialization/resources/graph/client/requests/EntityTypeRequest.d.mts +2 -0
  26. package/dist/esm/serialization/resources/graph/client/requests/EntityTypeRequest.mjs +2 -0
  27. package/dist/esm/version.d.mts +1 -1
  28. package/dist/esm/version.mjs +1 -1
  29. package/dist/esm/wrapper/graph.d.mts +14 -7
  30. package/dist/esm/wrapper/graph.mjs +12 -8
  31. package/package.json +1 -1
  32. package/reference.md +11 -3
@@ -47,8 +47,8 @@ class ZepClient {
47
47
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
48
48
  "X-Fern-Language": "JavaScript",
49
49
  "X-Fern-SDK-Name": "zep-cloud",
50
- "X-Fern-SDK-Version": "3.0.5",
51
- "User-Agent": "zep-cloud/3.0.5",
50
+ "X-Fern-SDK-Version": "3.1.0",
51
+ "User-Agent": "zep-cloud/3.1.0",
52
52
  "X-Fern-Runtime": core.RUNTIME.type,
53
53
  "X-Fern-Runtime-Version": core.RUNTIME.version,
54
54
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -1,3 +1,3 @@
1
+ export * from "./BadRequestError.js";
1
2
  export * from "./NotFoundError.js";
2
3
  export * from "./InternalServerError.js";
3
- export * from "./BadRequestError.js";
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BadRequestError.js"), exports);
17
18
  __exportStar(require("./NotFoundError.js"), exports);
18
19
  __exportStar(require("./InternalServerError.js"), exports);
19
- __exportStar(require("./BadRequestError.js"), exports);
@@ -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 a project, replacing any existing ones.
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.
@@ -72,26 +72,37 @@ class Graph {
72
72
  return ((_a = this._node) !== null && _a !== void 0 ? _a : (this._node = new Client_js_3.Node(this._options)));
73
73
  }
74
74
  /**
75
- * Returns all entity types for a project.
75
+ * Returns all entity types for a project, user, or graph.
76
76
  *
77
+ * @param {Zep.GraphListEntityTypesRequest} request
77
78
  * @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
78
79
  *
80
+ * @throws {@link Zep.BadRequestError}
79
81
  * @throws {@link Zep.NotFoundError}
80
82
  * @throws {@link Zep.InternalServerError}
81
83
  *
82
84
  * @example
83
85
  * await client.graph.listEntityTypes()
84
86
  */
85
- listEntityTypes(requestOptions) {
86
- return core.HttpResponsePromise.fromPromise(this.__listEntityTypes(requestOptions));
87
+ listEntityTypes(request = {}, requestOptions) {
88
+ return core.HttpResponsePromise.fromPromise(this.__listEntityTypes(request, requestOptions));
87
89
  }
88
- __listEntityTypes(requestOptions) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
+ __listEntityTypes() {
91
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
90
92
  var _a, _b, _c, _d;
93
+ const { userId, graphId } = request;
94
+ const _queryParams = {};
95
+ if (userId != null) {
96
+ _queryParams["user_id"] = userId;
97
+ }
98
+ if (graphId != null) {
99
+ _queryParams["graph_id"] = graphId;
100
+ }
91
101
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
92
102
  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"),
93
103
  method: "GET",
94
104
  headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
105
+ queryParameters: _queryParams,
95
106
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
96
107
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
97
108
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -110,6 +121,14 @@ class Graph {
110
121
  }
111
122
  if (_response.error.reason === "status-code") {
112
123
  switch (_response.error.statusCode) {
124
+ case 400:
125
+ throw new Zep.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
126
+ unrecognizedObjectKeys: "passthrough",
127
+ allowUnrecognizedUnionMembers: true,
128
+ allowUnrecognizedEnumValues: true,
129
+ skipValidation: true,
130
+ breadcrumbsPrefix: ["response"],
131
+ }), _response.rawResponse);
113
132
  case 404:
114
133
  throw new Zep.NotFoundError(serializers.ApiError.parseOrThrow(_response.error.body, {
115
134
  unrecognizedObjectKeys: "passthrough",
@@ -152,7 +171,7 @@ class Graph {
152
171
  });
153
172
  }
154
173
  /**
155
- * Sets the entity types for a project, replacing any existing ones.
174
+ * Sets the entity types for multiple users and graphs, replacing any existing ones.
156
175
  *
157
176
  * @param {Zep.EntityTypeRequest} request
158
177
  * @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
@@ -9,4 +9,6 @@ import * as Zep from "../../../../index.js";
9
9
  export interface EntityTypeRequest {
10
10
  edgeTypes?: Zep.EdgeType[];
11
11
  entityTypes?: Zep.EntityType[];
12
+ graphIds?: string[];
13
+ userIds?: string[];
12
14
  }
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ export { type GraphListEntityTypesRequest } from "./GraphListEntityTypesRequest.js";
1
2
  export { type EntityTypeRequest } from "./EntityTypeRequest.js";
2
3
  export { type AddDataRequest } from "./AddDataRequest.js";
3
4
  export { type AddDataBatchRequest } from "./AddDataBatchRequest.js";
@@ -11,5 +11,7 @@ export declare namespace EntityTypeRequest {
11
11
  interface Raw {
12
12
  edge_types?: EdgeType.Raw[] | null;
13
13
  entity_types?: EntityType.Raw[] | null;
14
+ graph_ids?: string[] | null;
15
+ user_ids?: string[] | null;
14
16
  }
15
17
  }
@@ -43,4 +43,6 @@ const EntityType_js_1 = require("../../../../types/EntityType.js");
43
43
  exports.EntityTypeRequest = core.serialization.object({
44
44
  edgeTypes: core.serialization.property("edge_types", core.serialization.list(EdgeType_js_1.EdgeType).optional()),
45
45
  entityTypes: core.serialization.property("entity_types", core.serialization.list(EntityType_js_1.EntityType).optional()),
46
+ graphIds: core.serialization.property("graph_ids", core.serialization.list(core.serialization.string()).optional()),
47
+ userIds: core.serialization.property("user_ids", core.serialization.list(core.serialization.string()).optional()),
46
48
  });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.0.5";
1
+ export declare const SDK_VERSION = "3.1.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "3.0.5";
4
+ exports.SDK_VERSION = "3.1.0";
@@ -1,12 +1,17 @@
1
1
  import { Graph as BaseGraph } from "../api/resources/graph/client/Client.js";
2
2
  import { Zep } from "../index.js";
3
3
  import { EdgeType, EntityType } from "./ontology.js";
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 a project, replacing any existing ones.
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 a project, replacing any existing ones.
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.setOntology({
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 {};
@@ -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 a project, replacing any existing ones.
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 a project, replacing any existing ones.
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.setOntology({
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
  }
@@ -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.5",
15
- "User-Agent": "zep-cloud/3.0.5",
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) });
@@ -1,3 +1,3 @@
1
+ export * from "./BadRequestError.mjs";
1
2
  export * from "./NotFoundError.mjs";
2
3
  export * from "./InternalServerError.mjs";
3
- export * from "./BadRequestError.mjs";
@@ -1,3 +1,3 @@
1
+ export * from "./BadRequestError.mjs";
1
2
  export * from "./NotFoundError.mjs";
2
3
  export * from "./InternalServerError.mjs";
3
- export * from "./BadRequestError.mjs";
@@ -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 a project, replacing any existing ones.
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.
@@ -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(requestOptions) {
53
- return __awaiter(this, void 0, void 0, function* () {
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 a project, replacing any existing ones.
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.
@@ -9,4 +9,6 @@ import * as Zep from "../../../../index.mjs";
9
9
  export interface EntityTypeRequest {
10
10
  edgeTypes?: Zep.EdgeType[];
11
11
  entityTypes?: Zep.EntityType[];
12
+ graphIds?: string[];
13
+ userIds?: string[];
12
14
  }
@@ -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
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -1,3 +1,4 @@
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";
@@ -11,5 +11,7 @@ export declare namespace EntityTypeRequest {
11
11
  interface Raw {
12
12
  edge_types?: EdgeType.Raw[] | null;
13
13
  entity_types?: EntityType.Raw[] | null;
14
+ graph_ids?: string[] | null;
15
+ user_ids?: string[] | null;
14
16
  }
15
17
  }
@@ -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
  });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.0.5";
1
+ export declare const SDK_VERSION = "3.1.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "3.0.5";
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 a project, replacing any existing ones.
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 a project, replacing any existing ones.
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.setOntology({
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 {};
@@ -11,10 +11,11 @@ import { Graph as BaseGraph } from "../api/resources/graph/client/Client.mjs";
11
11
  import { entityModelToAPISchema, edgeModelToAPISchema } from "./ontology.mjs";
12
12
  export class Graph extends BaseGraph {
13
13
  /**
14
- * Sets the entity and edge types for a project, replacing any existing ones.
14
+ * 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.
15
15
  *
16
16
  * @param {Record<string, EntityType>} entityTypes
17
17
  * @param {Record<string, EdgeType>} edgeTypes
18
+ * @param {OntologyTargets} [ontologyTargets] - The targets for which to set the ontology. Can include userIds or graphIds. If none specified, sets for the entire project.
18
19
  * @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
19
20
  *
20
21
  * @throws {@link Zep.BadRequestError}
@@ -46,9 +47,9 @@ export class Graph extends BaseGraph {
46
47
  * TravelDestination: travelDestinationSchema,
47
48
  * }, {
48
49
  * IS_TRAVELING_TO: isTravelingTo,
49
- * });
50
+ * }, {userIds: ['user_1234']});
50
51
  */
51
- setEntityTypes(entityTypes, edgeTypes, requestOptions) {
52
+ setEntityTypes(entityTypes, edgeTypes, ontologyTargets, requestOptions) {
52
53
  return __awaiter(this, void 0, void 0, function* () {
53
54
  const validatedEntityTypes = Object.keys(entityTypes).map((key) => {
54
55
  const schema = entityTypes[key];
@@ -61,14 +62,17 @@ export class Graph extends BaseGraph {
61
62
  return this.setEntityTypesInternal({
62
63
  entityTypes: validatedEntityTypes,
63
64
  edgeTypes: validatedEdgeTypes,
65
+ userIds: ontologyTargets === null || ontologyTargets === void 0 ? void 0 : ontologyTargets.userIds,
66
+ graphIds: ontologyTargets === null || ontologyTargets === void 0 ? void 0 : ontologyTargets.graphIds,
64
67
  }, requestOptions);
65
68
  });
66
69
  }
67
70
  /**
68
- * Sets the entity and edge types for a project, replacing any existing ones.
71
+ * 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.
69
72
  *
70
73
  * @param {Record<string, EntityType>} entityTypes
71
74
  * @param {Record<string, EdgeType>} edgeTypes
75
+ * @param {OntologyTargets} [ontologyTargets] - The targets for which to set the ontology. Can include userIds or graphIds. If none specified, sets for the entire project.
72
76
  * @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
73
77
  *
74
78
  * @throws {@link Zep.BadRequestError}
@@ -96,15 +100,15 @@ export class Graph extends BaseGraph {
96
100
  * ]
97
101
  * }
98
102
  *
99
- * await client.graph.setOntology({
103
+ * await client.graph.setEntityTypes({
100
104
  * TravelDestination: travelDestinationSchema,
101
105
  * }, {
102
106
  * IS_TRAVELING_TO: isTravelingTo,
103
- * });
107
+ * }, {userIds: ['user_1234']});
104
108
  */
105
- setOntology(entityTypes, edgeTypes, requestOptions) {
109
+ setOntology(entityTypes, edgeTypes, ontologyTargets, requestOptions) {
106
110
  return __awaiter(this, void 0, void 0, function* () {
107
- return this.setEntityTypes(entityTypes, edgeTypes, requestOptions);
111
+ return this.setEntityTypes(entityTypes, edgeTypes, ontologyTargets, requestOptions);
108
112
  });
109
113
  }
110
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getzep/zep-cloud",
3
- "version": "3.0.5",
3
+ "version": "3.1.0",
4
4
  "private": false,
5
5
  "repository": "https://github.com/getzep/zep-js",
6
6
  "description": "Zep: Fast, scalable building blocks for production LLM apps",
package/reference.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Graph
4
4
 
5
- <details><summary><code>client.graph.<a href="/src/api/resources/graph/client/Client.ts">listEntityTypes</a>() -> Zep.EntityTypeResponse</code></summary>
5
+ <details><summary><code>client.graph.<a href="/src/api/resources/graph/client/Client.ts">listEntityTypes</a>({ ...params }) -> Zep.EntityTypeResponse</code></summary>
6
6
  <dl>
7
7
  <dd>
8
8
 
@@ -14,7 +14,7 @@
14
14
  <dl>
15
15
  <dd>
16
16
 
17
- Returns all entity types for a project.
17
+ Returns all entity types for a project, user, or graph.
18
18
 
19
19
  </dd>
20
20
  </dl>
@@ -46,6 +46,14 @@ await client.graph.listEntityTypes();
46
46
  <dl>
47
47
  <dd>
48
48
 
49
+ **request:** `Zep.GraphListEntityTypesRequest`
50
+
51
+ </dd>
52
+ </dl>
53
+
54
+ <dl>
55
+ <dd>
56
+
49
57
  **requestOptions:** `Graph.RequestOptions`
50
58
 
51
59
  </dd>
@@ -69,7 +77,7 @@ await client.graph.listEntityTypes();
69
77
  <dl>
70
78
  <dd>
71
79
 
72
- Sets the entity types for a project, replacing any existing ones.
80
+ Sets the entity types for multiple users and graphs, replacing any existing ones.
73
81
 
74
82
  </dd>
75
83
  </dl>