@papr/memory 1.9.0 → 1.13.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 (83) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +11 -9
  3. package/client.d.mts +23 -11
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +23 -11
  6. package/client.d.ts.map +1 -1
  7. package/client.js +41 -21
  8. package/client.js.map +1 -1
  9. package/client.mjs +41 -21
  10. package/client.mjs.map +1 -1
  11. package/internal/request-options.d.mts +42 -0
  12. package/internal/request-options.d.mts.map +1 -1
  13. package/internal/request-options.d.ts +42 -0
  14. package/internal/request-options.d.ts.map +1 -1
  15. package/internal/request-options.js.map +1 -1
  16. package/internal/request-options.mjs.map +1 -1
  17. package/internal/uploads.js +1 -1
  18. package/internal/uploads.js.map +1 -1
  19. package/internal/uploads.mjs +1 -1
  20. package/internal/uploads.mjs.map +1 -1
  21. package/internal/utils/log.d.mts.map +1 -1
  22. package/internal/utils/log.d.ts.map +1 -1
  23. package/internal/utils/log.js +4 -3
  24. package/internal/utils/log.js.map +1 -1
  25. package/internal/utils/log.mjs +4 -3
  26. package/internal/utils/log.mjs.map +1 -1
  27. package/internal/utils/path.d.mts.map +1 -1
  28. package/internal/utils/path.d.ts.map +1 -1
  29. package/internal/utils/path.js +26 -5
  30. package/internal/utils/path.js.map +1 -1
  31. package/internal/utils/path.mjs +26 -5
  32. package/internal/utils/path.mjs.map +1 -1
  33. package/package.json +1 -1
  34. package/resources/feedback.d.mts +333 -0
  35. package/resources/feedback.d.mts.map +1 -0
  36. package/resources/feedback.d.ts +333 -0
  37. package/resources/feedback.d.ts.map +1 -0
  38. package/resources/feedback.js +108 -0
  39. package/resources/feedback.js.map +1 -0
  40. package/resources/feedback.mjs +104 -0
  41. package/resources/feedback.mjs.map +1 -0
  42. package/resources/index.d.mts +2 -1
  43. package/resources/index.d.mts.map +1 -1
  44. package/resources/index.d.ts +2 -1
  45. package/resources/index.d.ts.map +1 -1
  46. package/resources/index.js +3 -1
  47. package/resources/index.js.map +1 -1
  48. package/resources/index.mjs +1 -0
  49. package/resources/index.mjs.map +1 -1
  50. package/resources/memory.d.mts +48 -11
  51. package/resources/memory.d.mts.map +1 -1
  52. package/resources/memory.d.ts +48 -11
  53. package/resources/memory.d.ts.map +1 -1
  54. package/resources/memory.js +11 -0
  55. package/resources/memory.js.map +1 -1
  56. package/resources/memory.mjs +11 -0
  57. package/resources/memory.mjs.map +1 -1
  58. package/resources/user.d.mts +24 -88
  59. package/resources/user.d.mts.map +1 -1
  60. package/resources/user.d.ts +24 -88
  61. package/resources/user.d.ts.map +1 -1
  62. package/resources/user.js +17 -56
  63. package/resources/user.js.map +1 -1
  64. package/resources/user.mjs +17 -56
  65. package/resources/user.mjs.map +1 -1
  66. package/src/client.ts +74 -28
  67. package/src/internal/request-options.ts +53 -0
  68. package/src/internal/uploads.ts +1 -1
  69. package/src/internal/utils/log.ts +3 -2
  70. package/src/internal/utils/path.ts +32 -7
  71. package/src/resources/feedback.ts +424 -0
  72. package/src/resources/index.ts +9 -1
  73. package/src/resources/memory.ts +44 -11
  74. package/src/resources/user.ts +29 -130
  75. package/src/version.ts +1 -1
  76. package/version.d.mts +1 -1
  77. package/version.d.mts.map +1 -1
  78. package/version.d.ts +1 -1
  79. package/version.d.ts.map +1 -1
  80. package/version.js +1 -1
  81. package/version.js.map +1 -1
  82. package/version.mjs +1 -1
  83. package/version.mjs.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.13.0 (2025-07-15)
4
+
5
+ Full Changelog: [v1.12.0...v1.13.0](https://github.com/Papr-ai/papr-TypescriptSDK/compare/v1.12.0...v1.13.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([9fb2050](https://github.com/Papr-ai/papr-TypescriptSDK/commit/9fb2050fcb0813bb09e24cd3a08db1f4c291cfd7))
10
+ * **api:** update via SDK Studio ([6ef1cc7](https://github.com/Papr-ai/papr-TypescriptSDK/commit/6ef1cc7b67d4b0a909cf0d6bc6c0da0d98a933dd))
11
+
12
+ ## 1.12.0 (2025-07-15)
13
+
14
+ Full Changelog: [v1.11.0...v1.12.0](https://github.com/Papr-ai/papr-TypescriptSDK/compare/v1.11.0...v1.12.0)
15
+
16
+ ### Features
17
+
18
+ * **api:** update via SDK Studio ([aa2bbe6](https://github.com/Papr-ai/papr-TypescriptSDK/commit/aa2bbe631ab316662dbb555c55133c43211247b3))
19
+
20
+ ## 1.11.0 (2025-07-15)
21
+
22
+ Full Changelog: [v1.10.0...v1.11.0](https://github.com/Papr-ai/papr-TypescriptSDK/compare/v1.10.0...v1.11.0)
23
+
24
+ ### Features
25
+
26
+ * **api:** update via SDK Studio ([ce9b467](https://github.com/Papr-ai/papr-TypescriptSDK/commit/ce9b467670371865feb807fa6e5d02f356e76cda))
27
+
28
+
29
+ ### Chores
30
+
31
+ * make some internal functions async ([ca4351a](https://github.com/Papr-ai/papr-TypescriptSDK/commit/ca4351ab115afec8e9bdd6c72506182546ff050a))
32
+
33
+ ## 1.10.0 (2025-07-07)
34
+
35
+ Full Changelog: [v1.9.0...v1.10.0](https://github.com/Papr-ai/papr-TypescriptSDK/compare/v1.9.0...v1.10.0)
36
+
37
+ ### Features
38
+
39
+ * **api:** update via SDK Studio ([43fbd9e](https://github.com/Papr-ai/papr-TypescriptSDK/commit/43fbd9e46b591ccd61e705fcb5f1689a0ae458b2))
40
+ * **api:** update via SDK Studio ([04c5d58](https://github.com/Papr-ai/papr-TypescriptSDK/commit/04c5d582028a0615c15db371b9894a87422fcf9b))
41
+
42
+
43
+ ### Chores
44
+
45
+ * add docs to RequestOptions type ([969ee17](https://github.com/Papr-ai/papr-TypescriptSDK/commit/969ee177bd1860fdd3b9d25e177349a7b5b5229f))
46
+ * **client:** improve path param validation ([0bad0e2](https://github.com/Papr-ai/papr-TypescriptSDK/commit/0bad0e28cbb072c44ff84bf88eb2893eaf33c393))
47
+
3
48
  ## 1.9.0 (2025-06-30)
4
49
 
5
50
  Full Changelog: [v1.8.3...v1.9.0](https://github.com/Papr-ai/papr-TypescriptSDK/compare/v1.8.3...v1.9.0)
package/README.md CHANGED
@@ -23,10 +23,10 @@ The full API of this library can be found in [api.md](api.md).
23
23
  import Papr from '@papr/memory';
24
24
 
25
25
  const client = new Papr({
26
- apiKey: process.env['PAPR_MEMORY_API_KEY'], // This is the default and can be omitted
26
+ xAPIKey: process.env['PAPR_MEMORY_API_KEY'], // This is the default and can be omitted
27
27
  });
28
28
 
29
- const userResponse = await client.user.create({ external_id: 'user123', 'X-API-Key': 'X-API-Key' });
29
+ const userResponse = await client.user.create({ external_id: 'demo_user_123', email: 'user@example.com' });
30
30
 
31
31
  console.log(userResponse.external_id);
32
32
  ```
@@ -40,10 +40,10 @@ This library includes TypeScript definitions for all request params and response
40
40
  import Papr from '@papr/memory';
41
41
 
42
42
  const client = new Papr({
43
- apiKey: process.env['PAPR_MEMORY_API_KEY'], // This is the default and can be omitted
43
+ xAPIKey: process.env['PAPR_MEMORY_API_KEY'], // This is the default and can be omitted
44
44
  });
45
45
 
46
- const params: Papr.UserCreateParams = { external_id: 'user123', 'X-API-Key': 'X-API-Key' };
46
+ const params: Papr.UserCreateParams = { external_id: 'demo_user_123', email: 'user@example.com' };
47
47
  const userResponse: Papr.UserResponse = await client.user.create(params);
48
48
  ```
49
49
 
@@ -58,7 +58,7 @@ a subclass of `APIError` will be thrown:
58
58
  <!-- prettier-ignore -->
59
59
  ```ts
60
60
  const userResponse = await client.user
61
- .create({ external_id: 'user123', 'X-API-Key': 'X-API-Key' })
61
+ .create({ external_id: 'demo_user_123', email: 'user@example.com' })
62
62
  .catch(async (err) => {
63
63
  if (err instanceof Papr.APIError) {
64
64
  console.log(err.status); // 400
@@ -99,7 +99,7 @@ const client = new Papr({
99
99
  });
100
100
 
101
101
  // Or, configure per-request:
102
- await client.user.create({ external_id: 'user123', 'X-API-Key': 'X-API-Key' }, {
102
+ await client.user.create({ external_id: 'demo_user_123', email: 'user@example.com' }, {
103
103
  maxRetries: 5,
104
104
  });
105
105
  ```
@@ -116,7 +116,7 @@ const client = new Papr({
116
116
  });
117
117
 
118
118
  // Override per-request:
119
- await client.user.create({ external_id: 'user123', 'X-API-Key': 'X-API-Key' }, {
119
+ await client.user.create({ external_id: 'demo_user_123', email: 'user@example.com' }, {
120
120
  timeout: 5 * 1000,
121
121
  });
122
122
  ```
@@ -139,12 +139,14 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
139
139
  ```ts
140
140
  const client = new Papr();
141
141
 
142
- const response = await client.user.create({ external_id: 'user123', 'X-API-Key': 'X-API-Key' }).asResponse();
142
+ const response = await client.user
143
+ .create({ external_id: 'demo_user_123', email: 'user@example.com' })
144
+ .asResponse();
143
145
  console.log(response.headers.get('X-My-Header'));
144
146
  console.log(response.statusText); // access the underlying Response object
145
147
 
146
148
  const { data: userResponse, response: raw } = await client.user
147
- .create({ external_id: 'user123', 'X-API-Key': 'X-API-Key' })
149
+ .create({ external_id: 'demo_user_123', email: 'user@example.com' })
148
150
  .withResponse();
149
151
  console.log(raw.headers.get('X-My-Header'));
150
152
  console.log(userResponse.external_id);
package/client.d.mts CHANGED
@@ -6,8 +6,9 @@ import * as Errors from "./core/error.mjs";
6
6
  import * as Uploads from "./core/uploads.mjs";
7
7
  import * as API from "./resources/index.mjs";
8
8
  import { APIPromise } from "./core/api-promise.mjs";
9
+ import { BatchRequest, BatchResponse, Feedback, FeedbackRequest, FeedbackResponse, FeedbackSubmitBatchParams, FeedbackSubmitParams } from "./resources/feedback.mjs";
9
10
  import { AddMemory, AddMemoryResponse, ContextItem, Memory, MemoryAddBatchParams, MemoryAddBatchResponse, MemoryAddParams, MemoryDeleteParams, MemoryDeleteResponse, MemoryMetadata, MemorySearchParams, MemoryType, MemoryUpdateParams, MemoryUpdateResponse, RelationshipItem, SearchResponse } from "./resources/memory.mjs";
10
- import { User, UserCreateBatchParams, UserCreateBatchResponse, UserCreateParams, UserDeleteParams, UserDeleteResponse, UserGetParams, UserListParams, UserListResponse, UserResponse, UserType, UserUpdateParams } from "./resources/user.mjs";
11
+ import { User, UserCreateBatchParams, UserCreateBatchResponse, UserCreateParams, UserDeleteParams, UserDeleteResponse, UserListParams, UserListResponse, UserResponse, UserType, UserUpdateParams } from "./resources/user.mjs";
11
12
  import { type Fetch } from "./internal/builtin-types.mjs";
12
13
  import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
13
14
  import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs";
@@ -16,7 +17,11 @@ export interface ClientOptions {
16
17
  /**
17
18
  * Defaults to process.env['PAPR_MEMORY_API_KEY'].
18
19
  */
19
- apiKey?: string | undefined;
20
+ xAPIKey?: string | undefined;
21
+ /**
22
+ * Defaults to process.env['PAPR_MEMORY_Session_Token'].
23
+ */
24
+ xSessionToken?: string | null | undefined;
20
25
  /**
21
26
  * Defaults to process.env['PAPR_MEMORY_BEARER_TOKEN'].
22
27
  */
@@ -33,6 +38,8 @@ export interface ClientOptions {
33
38
  *
34
39
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
35
40
  * much longer than this timeout before the promise succeeds or fails.
41
+ *
42
+ * @unit milliseconds
36
43
  */
37
44
  timeout?: number | undefined;
38
45
  /**
@@ -85,7 +92,8 @@ export interface ClientOptions {
85
92
  */
86
93
  export declare class Papr {
87
94
  #private;
88
- apiKey: string;
95
+ xAPIKey: string;
96
+ xSessionToken: string | null;
89
97
  bearerToken: string | null;
90
98
  baseURL: string;
91
99
  maxRetries: number;
@@ -99,7 +107,8 @@ export declare class Papr {
99
107
  /**
100
108
  * API Client for interfacing with the Papr API.
101
109
  *
102
- * @param {string | undefined} [opts.apiKey=process.env['PAPR_MEMORY_API_KEY'] ?? undefined]
110
+ * @param {string | undefined} [opts.xAPIKey=process.env['PAPR_MEMORY_API_KEY'] ?? undefined]
111
+ * @param {string | null | undefined} [opts.xSessionToken=process.env['PAPR_MEMORY_Session_Token'] ?? null]
103
112
  * @param {string | null | undefined} [opts.bearerToken=process.env['PAPR_MEMORY_BEARER_TOKEN'] ?? null]
104
113
  * @param {string} [opts.baseURL=process.env['PAPR_BASE_URL'] ?? https://memory.papr.ai] - Override the default base URL for the API.
105
114
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
@@ -109,16 +118,17 @@ export declare class Papr {
109
118
  * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
110
119
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
111
120
  */
112
- constructor({ baseURL, apiKey, bearerToken, ...opts }?: ClientOptions);
121
+ constructor({ baseURL, xAPIKey, xSessionToken, bearerToken, ...opts }?: ClientOptions);
113
122
  /**
114
123
  * Create a new client instance re-using the same options given to the current client with optional overriding.
115
124
  */
116
125
  withOptions(options: Partial<ClientOptions>): this;
117
126
  protected defaultQuery(): Record<string, string | undefined> | undefined;
118
127
  protected validateHeaders({ values, nulls }: NullableHeaders): void;
119
- protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined;
120
- protected apiKeyHeaderAuth(opts: FinalRequestOptions): NullableHeaders | undefined;
121
- protected bearerAuth(opts: FinalRequestOptions): NullableHeaders | undefined;
128
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
129
+ protected bearerAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
130
+ protected xSessionTokenAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
131
+ protected xAPIKeyAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
122
132
  /**
123
133
  * Basic re-implementation of `qs.stringify` for primitive types.
124
134
  */
@@ -155,11 +165,11 @@ export declare class Papr {
155
165
  private calculateDefaultRetryTimeoutMillis;
156
166
  buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
157
167
  retryCount?: number;
158
- }): {
168
+ }): Promise<{
159
169
  req: FinalizedRequestInit;
160
170
  url: string;
161
171
  timeout: number;
162
- };
172
+ }>;
163
173
  private buildHeaders;
164
174
  private buildBody;
165
175
  static Papr: typeof Papr;
@@ -180,10 +190,12 @@ export declare class Papr {
180
190
  static toFile: typeof Uploads.toFile;
181
191
  user: API.User;
182
192
  memory: API.Memory;
193
+ feedback: API.Feedback;
183
194
  }
184
195
  export declare namespace Papr {
185
196
  export type RequestOptions = Opts.RequestOptions;
186
- export { User as User, type UserResponse as UserResponse, type UserType as UserType, type UserListResponse as UserListResponse, type UserDeleteResponse as UserDeleteResponse, type UserCreateBatchResponse as UserCreateBatchResponse, type UserCreateParams as UserCreateParams, type UserUpdateParams as UserUpdateParams, type UserListParams as UserListParams, type UserDeleteParams as UserDeleteParams, type UserCreateBatchParams as UserCreateBatchParams, type UserGetParams as UserGetParams, };
197
+ export { User as User, type UserResponse as UserResponse, type UserType as UserType, type UserListResponse as UserListResponse, type UserDeleteResponse as UserDeleteResponse, type UserCreateBatchResponse as UserCreateBatchResponse, type UserCreateParams as UserCreateParams, type UserUpdateParams as UserUpdateParams, type UserListParams as UserListParams, type UserDeleteParams as UserDeleteParams, type UserCreateBatchParams as UserCreateBatchParams, };
187
198
  export { Memory as Memory, type AddMemory as AddMemory, type AddMemoryResponse as AddMemoryResponse, type ContextItem as ContextItem, type MemoryMetadata as MemoryMetadata, type MemoryType as MemoryType, type RelationshipItem as RelationshipItem, type SearchResponse as SearchResponse, type MemoryUpdateResponse as MemoryUpdateResponse, type MemoryDeleteResponse as MemoryDeleteResponse, type MemoryAddBatchResponse as MemoryAddBatchResponse, type MemoryUpdateParams as MemoryUpdateParams, type MemoryDeleteParams as MemoryDeleteParams, type MemoryAddParams as MemoryAddParams, type MemoryAddBatchParams as MemoryAddBatchParams, type MemorySearchParams as MemorySearchParams, };
199
+ export { Feedback as Feedback, type BatchRequest as BatchRequest, type BatchResponse as BatchResponse, type FeedbackRequest as FeedbackRequest, type FeedbackResponse as FeedbackResponse, type FeedbackSubmitParams as FeedbackSubmitParams, type FeedbackSubmitBatchParams as FeedbackSubmitBatchParams, };
188
200
  }
189
201
  //# sourceMappingURL=client.d.mts.map
package/client.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;YAIvE,EAAE,MAAM,EAAE,QAAQ,EAAE;OAKzB,KAAK,IAAI;OAET,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,UAAU,EAAE;OACd,EACL,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACf;OACM,EACL,IAAI,EACJ,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EACjB;OACM,EAAE,KAAK,KAAK,EAAE;OACd,EAAE,WAAW,EAAE,eAAe,EAAgB;OAC9C,EAAE,mBAAmB,EAAE,cAAc,EAAE;OAEvC,EACL,KAAK,QAAQ,EACb,KAAK,MAAM,EAIZ;AAGD,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAEpC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAA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ACjD,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
package/client.d.ts CHANGED
@@ -6,8 +6,9 @@ import * as Errors from "./core/error.js";
6
6
  import * as Uploads from "./core/uploads.js";
7
7
  import * as API from "./resources/index.js";
8
8
  import { APIPromise } from "./core/api-promise.js";
9
+ import { BatchRequest, BatchResponse, Feedback, FeedbackRequest, FeedbackResponse, FeedbackSubmitBatchParams, FeedbackSubmitParams } from "./resources/feedback.js";
9
10
  import { AddMemory, AddMemoryResponse, ContextItem, Memory, MemoryAddBatchParams, MemoryAddBatchResponse, MemoryAddParams, MemoryDeleteParams, MemoryDeleteResponse, MemoryMetadata, MemorySearchParams, MemoryType, MemoryUpdateParams, MemoryUpdateResponse, RelationshipItem, SearchResponse } from "./resources/memory.js";
10
- import { User, UserCreateBatchParams, UserCreateBatchResponse, UserCreateParams, UserDeleteParams, UserDeleteResponse, UserGetParams, UserListParams, UserListResponse, UserResponse, UserType, UserUpdateParams } from "./resources/user.js";
11
+ import { User, UserCreateBatchParams, UserCreateBatchResponse, UserCreateParams, UserDeleteParams, UserDeleteResponse, UserListParams, UserListResponse, UserResponse, UserType, UserUpdateParams } from "./resources/user.js";
11
12
  import { type Fetch } from "./internal/builtin-types.js";
12
13
  import { HeadersLike, NullableHeaders } from "./internal/headers.js";
13
14
  import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js";
@@ -16,7 +17,11 @@ export interface ClientOptions {
16
17
  /**
17
18
  * Defaults to process.env['PAPR_MEMORY_API_KEY'].
18
19
  */
19
- apiKey?: string | undefined;
20
+ xAPIKey?: string | undefined;
21
+ /**
22
+ * Defaults to process.env['PAPR_MEMORY_Session_Token'].
23
+ */
24
+ xSessionToken?: string | null | undefined;
20
25
  /**
21
26
  * Defaults to process.env['PAPR_MEMORY_BEARER_TOKEN'].
22
27
  */
@@ -33,6 +38,8 @@ export interface ClientOptions {
33
38
  *
34
39
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
35
40
  * much longer than this timeout before the promise succeeds or fails.
41
+ *
42
+ * @unit milliseconds
36
43
  */
37
44
  timeout?: number | undefined;
38
45
  /**
@@ -85,7 +92,8 @@ export interface ClientOptions {
85
92
  */
86
93
  export declare class Papr {
87
94
  #private;
88
- apiKey: string;
95
+ xAPIKey: string;
96
+ xSessionToken: string | null;
89
97
  bearerToken: string | null;
90
98
  baseURL: string;
91
99
  maxRetries: number;
@@ -99,7 +107,8 @@ export declare class Papr {
99
107
  /**
100
108
  * API Client for interfacing with the Papr API.
101
109
  *
102
- * @param {string | undefined} [opts.apiKey=process.env['PAPR_MEMORY_API_KEY'] ?? undefined]
110
+ * @param {string | undefined} [opts.xAPIKey=process.env['PAPR_MEMORY_API_KEY'] ?? undefined]
111
+ * @param {string | null | undefined} [opts.xSessionToken=process.env['PAPR_MEMORY_Session_Token'] ?? null]
103
112
  * @param {string | null | undefined} [opts.bearerToken=process.env['PAPR_MEMORY_BEARER_TOKEN'] ?? null]
104
113
  * @param {string} [opts.baseURL=process.env['PAPR_BASE_URL'] ?? https://memory.papr.ai] - Override the default base URL for the API.
105
114
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
@@ -109,16 +118,17 @@ export declare class Papr {
109
118
  * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
110
119
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
111
120
  */
112
- constructor({ baseURL, apiKey, bearerToken, ...opts }?: ClientOptions);
121
+ constructor({ baseURL, xAPIKey, xSessionToken, bearerToken, ...opts }?: ClientOptions);
113
122
  /**
114
123
  * Create a new client instance re-using the same options given to the current client with optional overriding.
115
124
  */
116
125
  withOptions(options: Partial<ClientOptions>): this;
117
126
  protected defaultQuery(): Record<string, string | undefined> | undefined;
118
127
  protected validateHeaders({ values, nulls }: NullableHeaders): void;
119
- protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined;
120
- protected apiKeyHeaderAuth(opts: FinalRequestOptions): NullableHeaders | undefined;
121
- protected bearerAuth(opts: FinalRequestOptions): NullableHeaders | undefined;
128
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
129
+ protected bearerAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
130
+ protected xSessionTokenAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
131
+ protected xAPIKeyAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
122
132
  /**
123
133
  * Basic re-implementation of `qs.stringify` for primitive types.
124
134
  */
@@ -155,11 +165,11 @@ export declare class Papr {
155
165
  private calculateDefaultRetryTimeoutMillis;
156
166
  buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
157
167
  retryCount?: number;
158
- }): {
168
+ }): Promise<{
159
169
  req: FinalizedRequestInit;
160
170
  url: string;
161
171
  timeout: number;
162
- };
172
+ }>;
163
173
  private buildHeaders;
164
174
  private buildBody;
165
175
  static Papr: typeof Papr;
@@ -180,10 +190,12 @@ export declare class Papr {
180
190
  static toFile: typeof Uploads.toFile;
181
191
  user: API.User;
182
192
  memory: API.Memory;
193
+ feedback: API.Feedback;
183
194
  }
184
195
  export declare namespace Papr {
185
196
  export type RequestOptions = Opts.RequestOptions;
186
- export { User as User, type UserResponse as UserResponse, type UserType as UserType, type UserListResponse as UserListResponse, type UserDeleteResponse as UserDeleteResponse, type UserCreateBatchResponse as UserCreateBatchResponse, type UserCreateParams as UserCreateParams, type UserUpdateParams as UserUpdateParams, type UserListParams as UserListParams, type UserDeleteParams as UserDeleteParams, type UserCreateBatchParams as UserCreateBatchParams, type UserGetParams as UserGetParams, };
197
+ export { User as User, type UserResponse as UserResponse, type UserType as UserType, type UserListResponse as UserListResponse, type UserDeleteResponse as UserDeleteResponse, type UserCreateBatchResponse as UserCreateBatchResponse, type UserCreateParams as UserCreateParams, type UserUpdateParams as UserUpdateParams, type UserListParams as UserListParams, type UserDeleteParams as UserDeleteParams, type UserCreateBatchParams as UserCreateBatchParams, };
187
198
  export { Memory as Memory, type AddMemory as AddMemory, type AddMemoryResponse as AddMemoryResponse, type ContextItem as ContextItem, type MemoryMetadata as MemoryMetadata, type MemoryType as MemoryType, type RelationshipItem as RelationshipItem, type SearchResponse as SearchResponse, type MemoryUpdateResponse as MemoryUpdateResponse, type MemoryDeleteResponse as MemoryDeleteResponse, type MemoryAddBatchResponse as MemoryAddBatchResponse, type MemoryUpdateParams as MemoryUpdateParams, type MemoryDeleteParams as MemoryDeleteParams, type MemoryAddParams as MemoryAddParams, type MemoryAddBatchParams as MemoryAddBatchParams, type MemorySearchParams as MemorySearchParams, };
199
+ export { Feedback as Feedback, type BatchRequest as BatchRequest, type BatchResponse as BatchResponse, type FeedbackRequest as FeedbackRequest, type FeedbackResponse as FeedbackResponse, type FeedbackSubmitParams as FeedbackSubmitParams, type FeedbackSubmitBatchParams as FeedbackSubmitBatchParams, };
188
200
  }
189
201
  //# sourceMappingURL=client.d.ts.map
package/client.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;YAIvE,EAAE,MAAM,EAAE,QAAQ,EAAE;OAKzB,KAAK,IAAI;OAET,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,UAAU,EAAE;OACd,EACL,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACf;OACM,EACL,IAAI,EACJ,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACl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AK,cAAc,IAAI,cAAc,EACrC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;IAEF,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
package/client.js CHANGED
@@ -16,6 +16,7 @@ const Errors = tslib_1.__importStar(require("./core/error.js"));
16
16
  const Uploads = tslib_1.__importStar(require("./core/uploads.js"));
17
17
  const API = tslib_1.__importStar(require("./resources/index.js"));
18
18
  const api_promise_1 = require("./core/api-promise.js");
19
+ const feedback_1 = require("./resources/feedback.js");
19
20
  const memory_1 = require("./resources/memory.js");
20
21
  const user_1 = require("./resources/user.js");
21
22
  const headers_1 = require("./internal/headers.js");
@@ -29,7 +30,8 @@ class Papr {
29
30
  /**
30
31
  * API Client for interfacing with the Papr API.
31
32
  *
32
- * @param {string | undefined} [opts.apiKey=process.env['PAPR_MEMORY_API_KEY'] ?? undefined]
33
+ * @param {string | undefined} [opts.xAPIKey=process.env['PAPR_MEMORY_API_KEY'] ?? undefined]
34
+ * @param {string | null | undefined} [opts.xSessionToken=process.env['PAPR_MEMORY_Session_Token'] ?? null]
33
35
  * @param {string | null | undefined} [opts.bearerToken=process.env['PAPR_MEMORY_BEARER_TOKEN'] ?? null]
34
36
  * @param {string} [opts.baseURL=process.env['PAPR_BASE_URL'] ?? https://memory.papr.ai] - Override the default base URL for the API.
35
37
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
@@ -39,16 +41,18 @@ class Papr {
39
41
  * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
40
42
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
41
43
  */
42
- constructor({ baseURL = (0, env_1.readEnv)('PAPR_BASE_URL'), apiKey = (0, env_1.readEnv)('PAPR_MEMORY_API_KEY'), bearerToken = (0, env_1.readEnv)('PAPR_MEMORY_BEARER_TOKEN') ?? null, ...opts } = {}) {
44
+ constructor({ baseURL = (0, env_1.readEnv)('PAPR_BASE_URL'), xAPIKey = (0, env_1.readEnv)('PAPR_MEMORY_API_KEY'), xSessionToken = (0, env_1.readEnv)('PAPR_MEMORY_Session_Token') ?? null, bearerToken = (0, env_1.readEnv)('PAPR_MEMORY_BEARER_TOKEN') ?? null, ...opts } = {}) {
43
45
  _Papr_instances.add(this);
44
46
  _Papr_encoder.set(this, void 0);
45
47
  this.user = new API.User(this);
46
48
  this.memory = new API.Memory(this);
47
- if (apiKey === undefined) {
48
- throw new Errors.PaprError("The PAPR_MEMORY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Papr client with an apiKey option, like new Papr({ apiKey: 'My API Key' }).");
49
+ this.feedback = new API.Feedback(this);
50
+ if (xAPIKey === undefined) {
51
+ throw new Errors.PaprError("The PAPR_MEMORY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Papr client with an xAPIKey option, like new Papr({ xAPIKey: 'My X API Key' }).");
49
52
  }
50
53
  const options = {
51
- apiKey,
54
+ xAPIKey,
55
+ xSessionToken,
52
56
  bearerToken,
53
57
  ...opts,
54
58
  baseURL: baseURL || `https://memory.papr.ai`,
@@ -68,14 +72,15 @@ class Papr {
68
72
  this.fetch = options.fetch ?? Shims.getDefaultFetch();
69
73
  tslib_1.__classPrivateFieldSet(this, _Papr_encoder, Opts.FallbackEncoder, "f");
70
74
  this._options = options;
71
- this.apiKey = apiKey;
75
+ this.xAPIKey = xAPIKey;
76
+ this.xSessionToken = xSessionToken;
72
77
  this.bearerToken = bearerToken;
73
78
  }
74
79
  /**
75
80
  * Create a new client instance re-using the same options given to the current client with optional overriding.
76
81
  */
77
82
  withOptions(options) {
78
- return new this.constructor({
83
+ const client = new this.constructor({
79
84
  ...this._options,
80
85
  baseURL: this.baseURL,
81
86
  maxRetries: this.maxRetries,
@@ -84,10 +89,12 @@ class Papr {
84
89
  logLevel: this.logLevel,
85
90
  fetch: this.fetch,
86
91
  fetchOptions: this.fetchOptions,
87
- apiKey: this.apiKey,
92
+ xAPIKey: this.xAPIKey,
93
+ xSessionToken: this.xSessionToken,
88
94
  bearerToken: this.bearerToken,
89
95
  ...options,
90
96
  });
97
+ return client;
91
98
  }
92
99
  defaultQuery() {
93
100
  return this._options.defaultQuery;
@@ -95,18 +102,28 @@ class Papr {
95
102
  validateHeaders({ values, nulls }) {
96
103
  return;
97
104
  }
98
- authHeaders(opts) {
99
- return (0, headers_1.buildHeaders)([this.apiKeyHeaderAuth(opts), this.bearerAuth(opts)]);
100
- }
101
- apiKeyHeaderAuth(opts) {
102
- return (0, headers_1.buildHeaders)([{ 'X-Session-Token': this.apiKey }]);
105
+ async authHeaders(opts) {
106
+ return (0, headers_1.buildHeaders)([
107
+ await this.bearerAuth(opts),
108
+ await this.xSessionTokenAuth(opts),
109
+ await this.xAPIKeyAuth(opts),
110
+ ]);
103
111
  }
104
- bearerAuth(opts) {
112
+ async bearerAuth(opts) {
105
113
  if (this.bearerToken == null) {
106
114
  return undefined;
107
115
  }
108
116
  return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${this.bearerToken}` }]);
109
117
  }
118
+ async xSessionTokenAuth(opts) {
119
+ if (this.xSessionToken == null) {
120
+ return undefined;
121
+ }
122
+ return (0, headers_1.buildHeaders)([{ 'X-Session-Token': this.xSessionToken }]);
123
+ }
124
+ async xAPIKeyAuth(opts) {
125
+ return (0, headers_1.buildHeaders)([{ 'X-API-Key': this.xAPIKey }]);
126
+ }
110
127
  /**
111
128
  * Basic re-implementation of `qs.stringify` for primitive types.
112
129
  */
@@ -188,7 +205,9 @@ class Papr {
188
205
  retriesRemaining = maxRetries;
189
206
  }
190
207
  await this.prepareOptions(options);
191
- const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
208
+ const { req, url, timeout } = await this.buildRequest(options, {
209
+ retryCount: maxRetries - retriesRemaining,
210
+ });
192
211
  await this.prepareRequest(req, { url, options });
193
212
  /** Not an API request ID, just for correlating local log entries. */
194
213
  const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
@@ -242,7 +261,7 @@ class Papr {
242
261
  }
243
262
  const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
244
263
  if (!response.ok) {
245
- const shouldRetry = this.shouldRetry(response);
264
+ const shouldRetry = await this.shouldRetry(response);
246
265
  if (retriesRemaining && shouldRetry) {
247
266
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
248
267
  // We don't need the body of this response.
@@ -309,7 +328,7 @@ class Papr {
309
328
  clearTimeout(timeout);
310
329
  }
311
330
  }
312
- shouldRetry(response) {
331
+ async shouldRetry(response) {
313
332
  // Note this is not a standard header.
314
333
  const shouldRetryHeader = response.headers.get('x-should-retry');
315
334
  // If the server explicitly says whether or not to retry, obey.
@@ -371,7 +390,7 @@ class Papr {
371
390
  const jitter = 1 - Math.random() * 0.25;
372
391
  return sleepSeconds * jitter * 1000;
373
392
  }
374
- buildRequest(inputOptions, { retryCount = 0 } = {}) {
393
+ async buildRequest(inputOptions, { retryCount = 0 } = {}) {
375
394
  const options = { ...inputOptions };
376
395
  const { method, path, query, defaultBaseURL } = options;
377
396
  const url = this.buildURL(path, query, defaultBaseURL);
@@ -379,7 +398,7 @@ class Papr {
379
398
  (0, values_1.validatePositiveInteger)('timeout', options.timeout);
380
399
  options.timeout = options.timeout ?? this.timeout;
381
400
  const { bodyHeaders, body } = this.buildBody({ options });
382
- const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
401
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
383
402
  const req = {
384
403
  method,
385
404
  headers: reqHeaders,
@@ -392,7 +411,7 @@ class Papr {
392
411
  };
393
412
  return { req, url, timeout: options.timeout };
394
413
  }
395
- buildHeaders({ options, method, bodyHeaders, retryCount, }) {
414
+ async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
396
415
  let idempotencyHeaders = {};
397
416
  if (this.idempotencyHeader && method !== 'get') {
398
417
  if (!options.idempotencyKey)
@@ -408,7 +427,7 @@ class Papr {
408
427
  ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
409
428
  ...(0, detect_platform_1.getPlatformHeaders)(),
410
429
  },
411
- this.authHeaders(options),
430
+ await this.authHeaders(options),
412
431
  this._options.defaultHeaders,
413
432
  bodyHeaders,
414
433
  options.headers,
@@ -471,4 +490,5 @@ Papr.UnprocessableEntityError = Errors.UnprocessableEntityError;
471
490
  Papr.toFile = Uploads.toFile;
472
491
  Papr.User = user_1.User;
473
492
  Papr.Memory = memory_1.Memory;
493
+ Papr.Feedback = feedback_1.Feedback;
474
494
  //# sourceMappingURL=client.js.map