@getzep/zep-cloud 3.10.0 → 3.12.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 (124) hide show
  1. package/dist/cjs/Client.d.ts +3 -0
  2. package/dist/cjs/Client.js +15 -10
  3. package/dist/cjs/api/errors/index.d.ts +1 -1
  4. package/dist/cjs/api/errors/index.js +1 -1
  5. package/dist/cjs/api/resources/context/client/Client.d.ts +112 -0
  6. package/dist/cjs/api/resources/context/client/Client.js +516 -0
  7. package/dist/cjs/api/resources/context/client/index.d.ts +2 -0
  8. package/dist/cjs/api/resources/context/client/index.js +17 -0
  9. package/dist/cjs/api/resources/context/client/requests/CreateContextTemplateRequest.d.ts +16 -0
  10. package/dist/cjs/api/resources/context/client/requests/CreateContextTemplateRequest.js +5 -0
  11. package/dist/cjs/api/resources/context/client/requests/UpdateContextTemplateRequest.d.ts +13 -0
  12. package/dist/cjs/api/resources/context/client/requests/UpdateContextTemplateRequest.js +5 -0
  13. package/dist/cjs/api/resources/context/client/requests/index.d.ts +2 -0
  14. package/dist/cjs/api/resources/context/client/requests/index.js +2 -0
  15. package/dist/cjs/api/resources/context/index.d.ts +1 -0
  16. package/dist/cjs/api/resources/context/index.js +17 -0
  17. package/dist/cjs/api/resources/graph/client/Client.d.ts +8 -2
  18. package/dist/cjs/api/resources/graph/client/Client.js +8 -2
  19. package/dist/cjs/api/resources/graph/client/requests/GraphListAllRequest.d.ts +4 -1
  20. package/dist/cjs/api/resources/graph/client/requests/GraphListEntityTypesRequest.d.ts +4 -1
  21. package/dist/cjs/api/resources/graph/resources/episode/client/Client.d.ts +6 -2
  22. package/dist/cjs/api/resources/graph/resources/episode/client/Client.js +6 -2
  23. package/dist/cjs/api/resources/graph/resources/episode/client/requests/EpisodeGetByGraphIdRequest.d.ts +3 -1
  24. package/dist/cjs/api/resources/graph/resources/episode/client/requests/EpisodeGetByUserIdRequest.d.ts +3 -1
  25. package/dist/cjs/api/resources/index.d.ts +2 -0
  26. package/dist/cjs/api/resources/index.js +3 -1
  27. package/dist/cjs/api/resources/thread/client/Client.d.ts +16 -3
  28. package/dist/cjs/api/resources/thread/client/Client.js +20 -4
  29. package/dist/cjs/api/resources/thread/client/requests/ThreadGetRequest.d.ts +5 -1
  30. package/dist/cjs/api/resources/thread/client/requests/ThreadGetUserContextRequest.d.ts +10 -2
  31. package/dist/cjs/api/resources/thread/client/requests/ThreadListAllRequest.d.ts +6 -1
  32. package/dist/cjs/api/resources/user/client/Client.d.ts +7 -2
  33. package/dist/cjs/api/resources/user/client/Client.js +7 -2
  34. package/dist/cjs/api/resources/user/client/requests/UserListOrderedRequest.d.ts +4 -1
  35. package/dist/cjs/api/resources/user/client/requests/UserListUserSummaryInstructionsRequest.d.ts +3 -1
  36. package/dist/cjs/api/types/ContextTemplateResponse.d.ts +11 -0
  37. package/dist/cjs/api/types/ContextTemplateResponse.js +5 -0
  38. package/dist/cjs/api/types/ListContextTemplatesResponse.d.ts +7 -0
  39. package/dist/cjs/api/types/ListContextTemplatesResponse.js +5 -0
  40. package/dist/cjs/api/types/index.d.ts +2 -0
  41. package/dist/cjs/api/types/index.js +2 -0
  42. package/dist/cjs/serialization/resources/context/client/index.d.ts +1 -0
  43. package/dist/cjs/serialization/resources/context/client/index.js +17 -0
  44. package/dist/cjs/serialization/resources/context/client/requests/CreateContextTemplateRequest.d.ts +13 -0
  45. package/dist/cjs/serialization/resources/context/client/requests/CreateContextTemplateRequest.js +44 -0
  46. package/dist/cjs/serialization/resources/context/client/requests/UpdateContextTemplateRequest.d.ts +12 -0
  47. package/dist/cjs/serialization/resources/context/client/requests/UpdateContextTemplateRequest.js +43 -0
  48. package/dist/cjs/serialization/resources/context/client/requests/index.d.ts +2 -0
  49. package/dist/cjs/serialization/resources/context/client/requests/index.js +7 -0
  50. package/dist/cjs/serialization/resources/context/index.d.ts +1 -0
  51. package/dist/cjs/serialization/resources/context/index.js +17 -0
  52. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  53. package/dist/cjs/serialization/resources/index.js +3 -1
  54. package/dist/cjs/serialization/types/ContextTemplateResponse.d.ts +14 -0
  55. package/dist/cjs/serialization/types/ContextTemplateResponse.js +45 -0
  56. package/dist/cjs/serialization/types/ListContextTemplatesResponse.d.ts +13 -0
  57. package/dist/cjs/serialization/types/ListContextTemplatesResponse.js +44 -0
  58. package/dist/cjs/serialization/types/index.d.ts +2 -0
  59. package/dist/cjs/serialization/types/index.js +2 -0
  60. package/dist/cjs/version.d.ts +1 -1
  61. package/dist/cjs/version.js +1 -1
  62. package/dist/esm/Client.d.mts +3 -0
  63. package/dist/esm/Client.mjs +7 -2
  64. package/dist/esm/api/errors/index.d.mts +1 -1
  65. package/dist/esm/api/errors/index.mjs +1 -1
  66. package/dist/esm/api/resources/context/client/Client.d.mts +112 -0
  67. package/dist/esm/api/resources/context/client/Client.mjs +479 -0
  68. package/dist/esm/api/resources/context/client/index.d.mts +2 -0
  69. package/dist/esm/api/resources/context/client/index.mjs +1 -0
  70. package/dist/esm/api/resources/context/client/requests/CreateContextTemplateRequest.d.mts +16 -0
  71. package/dist/esm/api/resources/context/client/requests/CreateContextTemplateRequest.mjs +4 -0
  72. package/dist/esm/api/resources/context/client/requests/UpdateContextTemplateRequest.d.mts +13 -0
  73. package/dist/esm/api/resources/context/client/requests/UpdateContextTemplateRequest.mjs +4 -0
  74. package/dist/esm/api/resources/context/client/requests/index.d.mts +2 -0
  75. package/dist/esm/api/resources/context/client/requests/index.mjs +1 -0
  76. package/dist/esm/api/resources/context/index.d.mts +1 -0
  77. package/dist/esm/api/resources/context/index.mjs +1 -0
  78. package/dist/esm/api/resources/graph/client/Client.d.mts +8 -2
  79. package/dist/esm/api/resources/graph/client/Client.mjs +8 -2
  80. package/dist/esm/api/resources/graph/client/requests/GraphListAllRequest.d.mts +4 -1
  81. package/dist/esm/api/resources/graph/client/requests/GraphListEntityTypesRequest.d.mts +4 -1
  82. package/dist/esm/api/resources/graph/resources/episode/client/Client.d.mts +6 -2
  83. package/dist/esm/api/resources/graph/resources/episode/client/Client.mjs +6 -2
  84. package/dist/esm/api/resources/graph/resources/episode/client/requests/EpisodeGetByGraphIdRequest.d.mts +3 -1
  85. package/dist/esm/api/resources/graph/resources/episode/client/requests/EpisodeGetByUserIdRequest.d.mts +3 -1
  86. package/dist/esm/api/resources/index.d.mts +2 -0
  87. package/dist/esm/api/resources/index.mjs +2 -0
  88. package/dist/esm/api/resources/thread/client/Client.d.mts +16 -3
  89. package/dist/esm/api/resources/thread/client/Client.mjs +20 -4
  90. package/dist/esm/api/resources/thread/client/requests/ThreadGetRequest.d.mts +5 -1
  91. package/dist/esm/api/resources/thread/client/requests/ThreadGetUserContextRequest.d.mts +10 -2
  92. package/dist/esm/api/resources/thread/client/requests/ThreadListAllRequest.d.mts +6 -1
  93. package/dist/esm/api/resources/user/client/Client.d.mts +7 -2
  94. package/dist/esm/api/resources/user/client/Client.mjs +7 -2
  95. package/dist/esm/api/resources/user/client/requests/UserListOrderedRequest.d.mts +4 -1
  96. package/dist/esm/api/resources/user/client/requests/UserListUserSummaryInstructionsRequest.d.mts +3 -1
  97. package/dist/esm/api/types/ContextTemplateResponse.d.mts +11 -0
  98. package/dist/esm/api/types/ContextTemplateResponse.mjs +4 -0
  99. package/dist/esm/api/types/ListContextTemplatesResponse.d.mts +7 -0
  100. package/dist/esm/api/types/ListContextTemplatesResponse.mjs +4 -0
  101. package/dist/esm/api/types/index.d.mts +2 -0
  102. package/dist/esm/api/types/index.mjs +2 -0
  103. package/dist/esm/serialization/resources/context/client/index.d.mts +1 -0
  104. package/dist/esm/serialization/resources/context/client/index.mjs +1 -0
  105. package/dist/esm/serialization/resources/context/client/requests/CreateContextTemplateRequest.d.mts +13 -0
  106. package/dist/esm/serialization/resources/context/client/requests/CreateContextTemplateRequest.mjs +8 -0
  107. package/dist/esm/serialization/resources/context/client/requests/UpdateContextTemplateRequest.d.mts +12 -0
  108. package/dist/esm/serialization/resources/context/client/requests/UpdateContextTemplateRequest.mjs +7 -0
  109. package/dist/esm/serialization/resources/context/client/requests/index.d.mts +2 -0
  110. package/dist/esm/serialization/resources/context/client/requests/index.mjs +2 -0
  111. package/dist/esm/serialization/resources/context/index.d.mts +1 -0
  112. package/dist/esm/serialization/resources/context/index.mjs +1 -0
  113. package/dist/esm/serialization/resources/index.d.mts +2 -0
  114. package/dist/esm/serialization/resources/index.mjs +2 -0
  115. package/dist/esm/serialization/types/ContextTemplateResponse.d.mts +14 -0
  116. package/dist/esm/serialization/types/ContextTemplateResponse.mjs +9 -0
  117. package/dist/esm/serialization/types/ListContextTemplatesResponse.d.mts +13 -0
  118. package/dist/esm/serialization/types/ListContextTemplatesResponse.mjs +8 -0
  119. package/dist/esm/serialization/types/index.d.mts +2 -0
  120. package/dist/esm/serialization/types/index.mjs +2 -0
  121. package/dist/esm/version.d.mts +1 -1
  122. package/dist/esm/version.mjs +1 -1
  123. package/package.json +1 -1
  124. package/reference.md +359 -9
@@ -0,0 +1,479 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ import * as environments from "../../../../environments.mjs";
14
+ import * as core from "../../../../core/index.mjs";
15
+ import * as Zep from "../../../index.mjs";
16
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
17
+ import * as serializers from "../../../../serialization/index.mjs";
18
+ import * as errors from "../../../../errors/index.mjs";
19
+ export class Context {
20
+ constructor(_options = {}) {
21
+ this._options = _options;
22
+ }
23
+ /**
24
+ * Lists all context templates.
25
+ *
26
+ * @param {Context.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link Zep.BadRequestError}
29
+ * @throws {@link Zep.InternalServerError}
30
+ *
31
+ * @example
32
+ * await client.context.listContextTemplates()
33
+ */
34
+ listContextTemplates(requestOptions) {
35
+ return core.HttpResponsePromise.fromPromise(this.__listContextTemplates(requestOptions));
36
+ }
37
+ __listContextTemplates(requestOptions) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ var _a, _b, _c, _d;
40
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
41
+ 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, "context-templates"),
42
+ method: "GET",
43
+ 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),
44
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
45
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
46
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
47
+ });
48
+ if (_response.ok) {
49
+ return {
50
+ data: serializers.ListContextTemplatesResponse.parseOrThrow(_response.body, {
51
+ unrecognizedObjectKeys: "passthrough",
52
+ allowUnrecognizedUnionMembers: true,
53
+ allowUnrecognizedEnumValues: true,
54
+ skipValidation: true,
55
+ breadcrumbsPrefix: ["response"],
56
+ }),
57
+ rawResponse: _response.rawResponse,
58
+ };
59
+ }
60
+ if (_response.error.reason === "status-code") {
61
+ switch (_response.error.statusCode) {
62
+ case 400:
63
+ throw new Zep.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
64
+ unrecognizedObjectKeys: "passthrough",
65
+ allowUnrecognizedUnionMembers: true,
66
+ allowUnrecognizedEnumValues: true,
67
+ skipValidation: true,
68
+ breadcrumbsPrefix: ["response"],
69
+ }), _response.rawResponse);
70
+ case 500:
71
+ throw new Zep.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
72
+ unrecognizedObjectKeys: "passthrough",
73
+ allowUnrecognizedUnionMembers: true,
74
+ allowUnrecognizedEnumValues: true,
75
+ skipValidation: true,
76
+ breadcrumbsPrefix: ["response"],
77
+ }), _response.rawResponse);
78
+ default:
79
+ throw new errors.ZepError({
80
+ statusCode: _response.error.statusCode,
81
+ body: _response.error.body,
82
+ rawResponse: _response.rawResponse,
83
+ });
84
+ }
85
+ }
86
+ switch (_response.error.reason) {
87
+ case "non-json":
88
+ throw new errors.ZepError({
89
+ statusCode: _response.error.statusCode,
90
+ body: _response.error.rawBody,
91
+ rawResponse: _response.rawResponse,
92
+ });
93
+ case "timeout":
94
+ throw new errors.ZepTimeoutError("Timeout exceeded when calling GET /context-templates.");
95
+ case "unknown":
96
+ throw new errors.ZepError({
97
+ message: _response.error.errorMessage,
98
+ rawResponse: _response.rawResponse,
99
+ });
100
+ }
101
+ });
102
+ }
103
+ /**
104
+ * Creates a new context template.
105
+ *
106
+ * @param {Zep.CreateContextTemplateRequest} request
107
+ * @param {Context.RequestOptions} requestOptions - Request-specific configuration.
108
+ *
109
+ * @throws {@link Zep.BadRequestError}
110
+ * @throws {@link Zep.InternalServerError}
111
+ *
112
+ * @example
113
+ * await client.context.createContextTemplate({
114
+ * template: "template",
115
+ * templateId: "template_id"
116
+ * })
117
+ */
118
+ createContextTemplate(request, requestOptions) {
119
+ return core.HttpResponsePromise.fromPromise(this.__createContextTemplate(request, requestOptions));
120
+ }
121
+ __createContextTemplate(request, requestOptions) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ var _a, _b, _c, _d;
124
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
125
+ 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, "context-templates"),
126
+ method: "POST",
127
+ 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),
128
+ contentType: "application/json",
129
+ requestType: "json",
130
+ body: serializers.CreateContextTemplateRequest.jsonOrThrow(request, {
131
+ unrecognizedObjectKeys: "strip",
132
+ omitUndefined: true,
133
+ }),
134
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
135
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
136
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
137
+ });
138
+ if (_response.ok) {
139
+ return {
140
+ data: serializers.ContextTemplateResponse.parseOrThrow(_response.body, {
141
+ unrecognizedObjectKeys: "passthrough",
142
+ allowUnrecognizedUnionMembers: true,
143
+ allowUnrecognizedEnumValues: true,
144
+ skipValidation: true,
145
+ breadcrumbsPrefix: ["response"],
146
+ }),
147
+ rawResponse: _response.rawResponse,
148
+ };
149
+ }
150
+ if (_response.error.reason === "status-code") {
151
+ switch (_response.error.statusCode) {
152
+ case 400:
153
+ throw new Zep.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
154
+ unrecognizedObjectKeys: "passthrough",
155
+ allowUnrecognizedUnionMembers: true,
156
+ allowUnrecognizedEnumValues: true,
157
+ skipValidation: true,
158
+ breadcrumbsPrefix: ["response"],
159
+ }), _response.rawResponse);
160
+ case 500:
161
+ throw new Zep.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
162
+ unrecognizedObjectKeys: "passthrough",
163
+ allowUnrecognizedUnionMembers: true,
164
+ allowUnrecognizedEnumValues: true,
165
+ skipValidation: true,
166
+ breadcrumbsPrefix: ["response"],
167
+ }), _response.rawResponse);
168
+ default:
169
+ throw new errors.ZepError({
170
+ statusCode: _response.error.statusCode,
171
+ body: _response.error.body,
172
+ rawResponse: _response.rawResponse,
173
+ });
174
+ }
175
+ }
176
+ switch (_response.error.reason) {
177
+ case "non-json":
178
+ throw new errors.ZepError({
179
+ statusCode: _response.error.statusCode,
180
+ body: _response.error.rawBody,
181
+ rawResponse: _response.rawResponse,
182
+ });
183
+ case "timeout":
184
+ throw new errors.ZepTimeoutError("Timeout exceeded when calling POST /context-templates.");
185
+ case "unknown":
186
+ throw new errors.ZepError({
187
+ message: _response.error.errorMessage,
188
+ rawResponse: _response.rawResponse,
189
+ });
190
+ }
191
+ });
192
+ }
193
+ /**
194
+ * Retrieves a context template by template_id.
195
+ *
196
+ * @param {string} templateId - Template ID
197
+ * @param {Context.RequestOptions} requestOptions - Request-specific configuration.
198
+ *
199
+ * @throws {@link Zep.BadRequestError}
200
+ * @throws {@link Zep.NotFoundError}
201
+ * @throws {@link Zep.InternalServerError}
202
+ *
203
+ * @example
204
+ * await client.context.getContextTemplate("template_id")
205
+ */
206
+ getContextTemplate(templateId, requestOptions) {
207
+ return core.HttpResponsePromise.fromPromise(this.__getContextTemplate(templateId, requestOptions));
208
+ }
209
+ __getContextTemplate(templateId, requestOptions) {
210
+ return __awaiter(this, void 0, void 0, function* () {
211
+ var _a, _b, _c, _d;
212
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
213
+ 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, `context-templates/${encodeURIComponent(templateId)}`),
214
+ method: "GET",
215
+ 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),
216
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
217
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
218
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
219
+ });
220
+ if (_response.ok) {
221
+ return {
222
+ data: serializers.ContextTemplateResponse.parseOrThrow(_response.body, {
223
+ unrecognizedObjectKeys: "passthrough",
224
+ allowUnrecognizedUnionMembers: true,
225
+ allowUnrecognizedEnumValues: true,
226
+ skipValidation: true,
227
+ breadcrumbsPrefix: ["response"],
228
+ }),
229
+ rawResponse: _response.rawResponse,
230
+ };
231
+ }
232
+ if (_response.error.reason === "status-code") {
233
+ switch (_response.error.statusCode) {
234
+ case 400:
235
+ throw new Zep.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
236
+ unrecognizedObjectKeys: "passthrough",
237
+ allowUnrecognizedUnionMembers: true,
238
+ allowUnrecognizedEnumValues: true,
239
+ skipValidation: true,
240
+ breadcrumbsPrefix: ["response"],
241
+ }), _response.rawResponse);
242
+ case 404:
243
+ throw new Zep.NotFoundError(serializers.ApiError.parseOrThrow(_response.error.body, {
244
+ unrecognizedObjectKeys: "passthrough",
245
+ allowUnrecognizedUnionMembers: true,
246
+ allowUnrecognizedEnumValues: true,
247
+ skipValidation: true,
248
+ breadcrumbsPrefix: ["response"],
249
+ }), _response.rawResponse);
250
+ case 500:
251
+ throw new Zep.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
252
+ unrecognizedObjectKeys: "passthrough",
253
+ allowUnrecognizedUnionMembers: true,
254
+ allowUnrecognizedEnumValues: true,
255
+ skipValidation: true,
256
+ breadcrumbsPrefix: ["response"],
257
+ }), _response.rawResponse);
258
+ default:
259
+ throw new errors.ZepError({
260
+ statusCode: _response.error.statusCode,
261
+ body: _response.error.body,
262
+ rawResponse: _response.rawResponse,
263
+ });
264
+ }
265
+ }
266
+ switch (_response.error.reason) {
267
+ case "non-json":
268
+ throw new errors.ZepError({
269
+ statusCode: _response.error.statusCode,
270
+ body: _response.error.rawBody,
271
+ rawResponse: _response.rawResponse,
272
+ });
273
+ case "timeout":
274
+ throw new errors.ZepTimeoutError("Timeout exceeded when calling GET /context-templates/{template_id}.");
275
+ case "unknown":
276
+ throw new errors.ZepError({
277
+ message: _response.error.errorMessage,
278
+ rawResponse: _response.rawResponse,
279
+ });
280
+ }
281
+ });
282
+ }
283
+ /**
284
+ * Updates an existing context template by template_id.
285
+ *
286
+ * @param {string} templateId - Template ID
287
+ * @param {Zep.UpdateContextTemplateRequest} request
288
+ * @param {Context.RequestOptions} requestOptions - Request-specific configuration.
289
+ *
290
+ * @throws {@link Zep.BadRequestError}
291
+ * @throws {@link Zep.NotFoundError}
292
+ * @throws {@link Zep.InternalServerError}
293
+ *
294
+ * @example
295
+ * await client.context.updateContextTemplate("template_id", {
296
+ * template: "template"
297
+ * })
298
+ */
299
+ updateContextTemplate(templateId, request, requestOptions) {
300
+ return core.HttpResponsePromise.fromPromise(this.__updateContextTemplate(templateId, request, requestOptions));
301
+ }
302
+ __updateContextTemplate(templateId, request, requestOptions) {
303
+ return __awaiter(this, void 0, void 0, function* () {
304
+ var _a, _b, _c, _d;
305
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
306
+ 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, `context-templates/${encodeURIComponent(templateId)}`),
307
+ method: "PUT",
308
+ 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),
309
+ contentType: "application/json",
310
+ requestType: "json",
311
+ body: serializers.UpdateContextTemplateRequest.jsonOrThrow(request, {
312
+ unrecognizedObjectKeys: "strip",
313
+ omitUndefined: true,
314
+ }),
315
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
316
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
317
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
318
+ });
319
+ if (_response.ok) {
320
+ return {
321
+ data: serializers.ContextTemplateResponse.parseOrThrow(_response.body, {
322
+ unrecognizedObjectKeys: "passthrough",
323
+ allowUnrecognizedUnionMembers: true,
324
+ allowUnrecognizedEnumValues: true,
325
+ skipValidation: true,
326
+ breadcrumbsPrefix: ["response"],
327
+ }),
328
+ rawResponse: _response.rawResponse,
329
+ };
330
+ }
331
+ if (_response.error.reason === "status-code") {
332
+ switch (_response.error.statusCode) {
333
+ case 400:
334
+ throw new Zep.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
335
+ unrecognizedObjectKeys: "passthrough",
336
+ allowUnrecognizedUnionMembers: true,
337
+ allowUnrecognizedEnumValues: true,
338
+ skipValidation: true,
339
+ breadcrumbsPrefix: ["response"],
340
+ }), _response.rawResponse);
341
+ case 404:
342
+ throw new Zep.NotFoundError(serializers.ApiError.parseOrThrow(_response.error.body, {
343
+ unrecognizedObjectKeys: "passthrough",
344
+ allowUnrecognizedUnionMembers: true,
345
+ allowUnrecognizedEnumValues: true,
346
+ skipValidation: true,
347
+ breadcrumbsPrefix: ["response"],
348
+ }), _response.rawResponse);
349
+ case 500:
350
+ throw new Zep.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
351
+ unrecognizedObjectKeys: "passthrough",
352
+ allowUnrecognizedUnionMembers: true,
353
+ allowUnrecognizedEnumValues: true,
354
+ skipValidation: true,
355
+ breadcrumbsPrefix: ["response"],
356
+ }), _response.rawResponse);
357
+ default:
358
+ throw new errors.ZepError({
359
+ statusCode: _response.error.statusCode,
360
+ body: _response.error.body,
361
+ rawResponse: _response.rawResponse,
362
+ });
363
+ }
364
+ }
365
+ switch (_response.error.reason) {
366
+ case "non-json":
367
+ throw new errors.ZepError({
368
+ statusCode: _response.error.statusCode,
369
+ body: _response.error.rawBody,
370
+ rawResponse: _response.rawResponse,
371
+ });
372
+ case "timeout":
373
+ throw new errors.ZepTimeoutError("Timeout exceeded when calling PUT /context-templates/{template_id}.");
374
+ case "unknown":
375
+ throw new errors.ZepError({
376
+ message: _response.error.errorMessage,
377
+ rawResponse: _response.rawResponse,
378
+ });
379
+ }
380
+ });
381
+ }
382
+ /**
383
+ * Deletes a context template by template_id.
384
+ *
385
+ * @param {string} templateId - Template ID
386
+ * @param {Context.RequestOptions} requestOptions - Request-specific configuration.
387
+ *
388
+ * @throws {@link Zep.BadRequestError}
389
+ * @throws {@link Zep.NotFoundError}
390
+ * @throws {@link Zep.InternalServerError}
391
+ *
392
+ * @example
393
+ * await client.context.deleteContextTemplate("template_id")
394
+ */
395
+ deleteContextTemplate(templateId, requestOptions) {
396
+ return core.HttpResponsePromise.fromPromise(this.__deleteContextTemplate(templateId, requestOptions));
397
+ }
398
+ __deleteContextTemplate(templateId, requestOptions) {
399
+ return __awaiter(this, void 0, void 0, function* () {
400
+ var _a, _b, _c, _d;
401
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
402
+ 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, `context-templates/${encodeURIComponent(templateId)}`),
403
+ method: "DELETE",
404
+ 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),
405
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
406
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
407
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
408
+ });
409
+ if (_response.ok) {
410
+ return {
411
+ data: serializers.SuccessResponse.parseOrThrow(_response.body, {
412
+ unrecognizedObjectKeys: "passthrough",
413
+ allowUnrecognizedUnionMembers: true,
414
+ allowUnrecognizedEnumValues: true,
415
+ skipValidation: true,
416
+ breadcrumbsPrefix: ["response"],
417
+ }),
418
+ rawResponse: _response.rawResponse,
419
+ };
420
+ }
421
+ if (_response.error.reason === "status-code") {
422
+ switch (_response.error.statusCode) {
423
+ case 400:
424
+ throw new Zep.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
425
+ unrecognizedObjectKeys: "passthrough",
426
+ allowUnrecognizedUnionMembers: true,
427
+ allowUnrecognizedEnumValues: true,
428
+ skipValidation: true,
429
+ breadcrumbsPrefix: ["response"],
430
+ }), _response.rawResponse);
431
+ case 404:
432
+ throw new Zep.NotFoundError(serializers.ApiError.parseOrThrow(_response.error.body, {
433
+ unrecognizedObjectKeys: "passthrough",
434
+ allowUnrecognizedUnionMembers: true,
435
+ allowUnrecognizedEnumValues: true,
436
+ skipValidation: true,
437
+ breadcrumbsPrefix: ["response"],
438
+ }), _response.rawResponse);
439
+ case 500:
440
+ throw new Zep.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
441
+ unrecognizedObjectKeys: "passthrough",
442
+ allowUnrecognizedUnionMembers: true,
443
+ allowUnrecognizedEnumValues: true,
444
+ skipValidation: true,
445
+ breadcrumbsPrefix: ["response"],
446
+ }), _response.rawResponse);
447
+ default:
448
+ throw new errors.ZepError({
449
+ statusCode: _response.error.statusCode,
450
+ body: _response.error.body,
451
+ rawResponse: _response.rawResponse,
452
+ });
453
+ }
454
+ }
455
+ switch (_response.error.reason) {
456
+ case "non-json":
457
+ throw new errors.ZepError({
458
+ statusCode: _response.error.statusCode,
459
+ body: _response.error.rawBody,
460
+ rawResponse: _response.rawResponse,
461
+ });
462
+ case "timeout":
463
+ throw new errors.ZepTimeoutError("Timeout exceeded when calling DELETE /context-templates/{template_id}.");
464
+ case "unknown":
465
+ throw new errors.ZepError({
466
+ message: _response.error.errorMessage,
467
+ rawResponse: _response.rawResponse,
468
+ });
469
+ }
470
+ });
471
+ }
472
+ _getCustomAuthorizationHeaders() {
473
+ return __awaiter(this, void 0, void 0, function* () {
474
+ var _a;
475
+ const apiKeyValue = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["ZEP_API_KEY"];
476
+ return { Authorization: `Api-Key ${apiKeyValue}` };
477
+ });
478
+ }
479
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * template: "template",
8
+ * templateId: "template_id"
9
+ * }
10
+ */
11
+ export interface CreateContextTemplateRequest {
12
+ /** The template content (max 1200 characters). */
13
+ template: string;
14
+ /** Unique identifier for the template (max 100 characters). */
15
+ templateId: string;
16
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * template: "template"
8
+ * }
9
+ */
10
+ export interface UpdateContextTemplateRequest {
11
+ /** The template content (max 1200 characters). */
12
+ template: string;
13
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,2 @@
1
+ export { type CreateContextTemplateRequest } from "./CreateContextTemplateRequest.mjs";
2
+ export { type UpdateContextTemplateRequest } from "./UpdateContextTemplateRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -48,7 +48,10 @@ export declare class Graph {
48
48
  * @throws {@link Zep.InternalServerError}
49
49
  *
50
50
  * @example
51
- * await client.graph.listEntityTypes()
51
+ * await client.graph.listEntityTypes({
52
+ * userId: "user_id",
53
+ * graphId: "graph_id"
54
+ * })
52
55
  */
53
56
  listEntityTypes(request?: Zep.GraphListEntityTypesRequest, requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.EntityTypeResponse>;
54
57
  private __listEntityTypes;
@@ -160,7 +163,10 @@ export declare class Graph {
160
163
  * @throws {@link Zep.InternalServerError}
161
164
  *
162
165
  * @example
163
- * await client.graph.listAll()
166
+ * await client.graph.listAll({
167
+ * pageNumber: 1,
168
+ * pageSize: 1
169
+ * })
164
170
  */
165
171
  listAll(request?: Zep.GraphListAllRequest, requestOptions?: Graph.RequestOptions): core.HttpResponsePromise<Zep.GraphListResponse>;
166
172
  private __listAll;
@@ -46,7 +46,10 @@ export class Graph {
46
46
  * @throws {@link Zep.InternalServerError}
47
47
  *
48
48
  * @example
49
- * await client.graph.listEntityTypes()
49
+ * await client.graph.listEntityTypes({
50
+ * userId: "user_id",
51
+ * graphId: "graph_id"
52
+ * })
50
53
  */
51
54
  listEntityTypes(request = {}, requestOptions) {
52
55
  return core.HttpResponsePromise.fromPromise(this.__listEntityTypes(request, requestOptions));
@@ -680,7 +683,10 @@ export class Graph {
680
683
  * @throws {@link Zep.InternalServerError}
681
684
  *
682
685
  * @example
683
- * await client.graph.listAll()
686
+ * await client.graph.listAll({
687
+ * pageNumber: 1,
688
+ * pageSize: 1
689
+ * })
684
690
  */
685
691
  listAll(request = {}, requestOptions) {
686
692
  return core.HttpResponsePromise.fromPromise(this.__listAll(request, requestOptions));
@@ -3,7 +3,10 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {}
6
+ * {
7
+ * pageNumber: 1,
8
+ * pageSize: 1
9
+ * }
7
10
  */
8
11
  export interface GraphListAllRequest {
9
12
  /**
@@ -3,7 +3,10 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {}
6
+ * {
7
+ * userId: "user_id",
8
+ * graphId: "graph_id"
9
+ * }
7
10
  */
8
11
  export interface GraphListEntityTypesRequest {
9
12
  /**
@@ -39,7 +39,9 @@ export declare class Episode {
39
39
  * @throws {@link Zep.InternalServerError}
40
40
  *
41
41
  * @example
42
- * await client.graph.episode.getByGraphId("graph_id")
42
+ * await client.graph.episode.getByGraphId("graph_id", {
43
+ * lastn: 1
44
+ * })
43
45
  */
44
46
  getByGraphId(graphId: string, request?: Zep.graph.EpisodeGetByGraphIdRequest, requestOptions?: Episode.RequestOptions): core.HttpResponsePromise<Zep.EpisodeResponse>;
45
47
  private __getByGraphId;
@@ -54,7 +56,9 @@ export declare class Episode {
54
56
  * @throws {@link Zep.InternalServerError}
55
57
  *
56
58
  * @example
57
- * await client.graph.episode.getByUserId("user_id")
59
+ * await client.graph.episode.getByUserId("user_id", {
60
+ * lastn: 1
61
+ * })
58
62
  */
59
63
  getByUserId(userId: string, request?: Zep.graph.EpisodeGetByUserIdRequest, requestOptions?: Episode.RequestOptions): core.HttpResponsePromise<Zep.EpisodeResponse>;
60
64
  private __getByUserId;
@@ -31,7 +31,9 @@ export class Episode {
31
31
  * @throws {@link Zep.InternalServerError}
32
32
  *
33
33
  * @example
34
- * await client.graph.episode.getByGraphId("graph_id")
34
+ * await client.graph.episode.getByGraphId("graph_id", {
35
+ * lastn: 1
36
+ * })
35
37
  */
36
38
  getByGraphId(graphId, request = {}, requestOptions) {
37
39
  return core.HttpResponsePromise.fromPromise(this.__getByGraphId(graphId, request, requestOptions));
@@ -119,7 +121,9 @@ export class Episode {
119
121
  * @throws {@link Zep.InternalServerError}
120
122
  *
121
123
  * @example
122
- * await client.graph.episode.getByUserId("user_id")
124
+ * await client.graph.episode.getByUserId("user_id", {
125
+ * lastn: 1
126
+ * })
123
127
  */
124
128
  getByUserId(userId, request = {}, requestOptions) {
125
129
  return core.HttpResponsePromise.fromPromise(this.__getByUserId(userId, request, requestOptions));