@papr/memory 1.5.1 → 1.7.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 (71) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +13 -25
  3. package/client.d.mts +2 -5
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -5
  6. package/client.d.ts.map +1 -1
  7. package/client.js +0 -3
  8. package/client.js.map +1 -1
  9. package/client.mjs +0 -3
  10. package/client.mjs.map +1 -1
  11. package/internal/shim-types.d.mts +11 -22
  12. package/internal/shim-types.d.mts.map +1 -0
  13. package/internal/shim-types.d.ts +11 -22
  14. package/internal/shim-types.d.ts.map +1 -0
  15. package/internal/shim-types.js +4 -0
  16. package/internal/shim-types.js.map +1 -0
  17. package/internal/shim-types.mjs +3 -0
  18. package/internal/shim-types.mjs.map +1 -0
  19. package/internal/shims.d.mts +2 -2
  20. package/internal/shims.d.mts.map +1 -1
  21. package/internal/shims.d.ts +2 -2
  22. package/internal/shims.d.ts.map +1 -1
  23. package/internal/uploads.js.map +1 -1
  24. package/internal/uploads.mjs.map +1 -1
  25. package/package.json +1 -4
  26. package/resources/index.d.mts +1 -2
  27. package/resources/index.d.mts.map +1 -1
  28. package/resources/index.d.ts +1 -2
  29. package/resources/index.d.ts.map +1 -1
  30. package/resources/index.js +1 -3
  31. package/resources/index.js.map +1 -1
  32. package/resources/index.mjs +0 -1
  33. package/resources/index.mjs.map +1 -1
  34. package/resources/memory.d.mts +106 -19
  35. package/resources/memory.d.mts.map +1 -1
  36. package/resources/memory.d.ts +106 -19
  37. package/resources/memory.d.ts.map +1 -1
  38. package/resources/memory.js +9 -1
  39. package/resources/memory.js.map +1 -1
  40. package/resources/memory.mjs +9 -1
  41. package/resources/memory.mjs.map +1 -1
  42. package/resources/user.d.mts +49 -6
  43. package/resources/user.d.mts.map +1 -1
  44. package/resources/user.d.ts +49 -6
  45. package/resources/user.d.ts.map +1 -1
  46. package/resources/user.js +16 -2
  47. package/resources/user.js.map +1 -1
  48. package/resources/user.mjs +16 -2
  49. package/resources/user.mjs.map +1 -1
  50. package/src/client.ts +4 -10
  51. package/src/internal/shim-types.ts +26 -0
  52. package/src/internal/shims.ts +2 -2
  53. package/src/internal/uploads.ts +1 -1
  54. package/src/resources/index.ts +2 -6
  55. package/src/resources/memory.ts +153 -21
  56. package/src/resources/user.ts +66 -5
  57. package/src/version.ts +1 -1
  58. package/version.d.mts +1 -1
  59. package/version.d.ts +1 -1
  60. package/version.js +1 -1
  61. package/version.mjs +1 -1
  62. package/resources/document.d.mts +0 -103
  63. package/resources/document.d.mts.map +0 -1
  64. package/resources/document.d.ts +0 -103
  65. package/resources/document.d.ts.map +0 -1
  66. package/resources/document.js +0 -33
  67. package/resources/document.js.map +0 -1
  68. package/resources/document.mjs +0 -29
  69. package/resources/document.mjs.map +0 -1
  70. package/src/internal/shim-types.d.ts +0 -28
  71. package/src/resources/document.ts +0 -140
@@ -1,103 +0,0 @@
1
- import { APIResource } from "../core/resource.js";
2
- import { APIPromise } from "../core/api-promise.js";
3
- import { RequestOptions } from "../internal/request-options.js";
4
- export declare class Document extends APIResource {
5
- /**
6
- * Upload a document (PDF/HTML/TXT) to be processed and added to memory.
7
- *
8
- * **Authentication Required**:
9
- * One of the following authentication methods must be used:
10
- * - Bearer token in `Authorization` header
11
- * - API Key in `X-API-Key` header
12
- * - Session token in `X-Session-Token` header
13
- *
14
- * **Required Headers**:
15
- * - Content-Type: multipart/form-data
16
- * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
17
- *
18
- * **Form Data**:
19
- * - file: The document file to upload (PDF/HTML/TXT)
20
- * - metadata: (optional) JSON string containing additional metadata
21
- */
22
- upload(params?: DocumentUploadParams | null | undefined, options?: RequestOptions): APIPromise<DocumentUploadResponse>;
23
- }
24
- /**
25
- * Response model for a single memory item in add_memory response
26
- */
27
- export interface AddMemoryItem {
28
- createdAt: string;
29
- memoryId: string;
30
- objectId: string;
31
- memoryChunkIds?: Array<string>;
32
- }
33
- export interface DocumentUploadResponse {
34
- /**
35
- * Status and progress of the document upload
36
- */
37
- document_status: DocumentUploadResponse.DocumentStatus;
38
- /**
39
- * HTTP status code
40
- */
41
- code?: number;
42
- /**
43
- * Additional error details or context
44
- */
45
- details?: unknown;
46
- /**
47
- * Error message if failed
48
- */
49
- error?: string | null;
50
- /**
51
- * For backward compatibility
52
- */
53
- memories?: Array<AddMemoryItem> | null;
54
- /**
55
- * List of memory items created from the document
56
- */
57
- memory_items?: Array<AddMemoryItem>;
58
- /**
59
- * Human-readable status message
60
- */
61
- message?: string | null;
62
- /**
63
- * 'success', 'processing', 'error', etc.
64
- */
65
- status?: string;
66
- }
67
- export declare namespace DocumentUploadResponse {
68
- /**
69
- * Status and progress of the document upload
70
- */
71
- interface DocumentStatus {
72
- /**
73
- * 0.0 to 1.0 for percentage
74
- */
75
- progress: number;
76
- current_filename?: string | null;
77
- current_page?: number | null;
78
- /**
79
- * Error message if failed
80
- */
81
- error?: string | null;
82
- /**
83
- * Processing status type
84
- */
85
- status_type?: 'processing' | 'completed' | 'failed' | 'not_found' | 'queued' | 'cancelled' | null;
86
- total_pages?: number | null;
87
- upload_id?: string | null;
88
- }
89
- }
90
- export interface DocumentUploadParams {
91
- /**
92
- * Optional Post objectId for updating status
93
- */
94
- post_objectId?: string | null;
95
- /**
96
- * If True, skips adding background tasks for processing
97
- */
98
- skip_background_processing?: boolean;
99
- }
100
- export declare namespace Document {
101
- export { type AddMemoryItem as AddMemoryItem, type DocumentUploadResponse as DocumentUploadResponse, type DocumentUploadParams as DocumentUploadParams, };
102
- }
103
- //# sourceMappingURL=document.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/resources/document.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;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ElG,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B;CACF;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Document = void 0;
5
- const resource_1 = require("../core/resource.js");
6
- class Document extends resource_1.APIResource {
7
- /**
8
- * Upload a document (PDF/HTML/TXT) to be processed and added to memory.
9
- *
10
- * **Authentication Required**:
11
- * One of the following authentication methods must be used:
12
- * - Bearer token in `Authorization` header
13
- * - API Key in `X-API-Key` header
14
- * - Session token in `X-Session-Token` header
15
- *
16
- * **Required Headers**:
17
- * - Content-Type: multipart/form-data
18
- * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
19
- *
20
- * **Form Data**:
21
- * - file: The document file to upload (PDF/HTML/TXT)
22
- * - metadata: (optional) JSON string containing additional metadata
23
- */
24
- upload(params = {}, options) {
25
- const { post_objectId, skip_background_processing } = params ?? {};
26
- return this._client.post('/v1/document', {
27
- query: { post_objectId, skip_background_processing },
28
- ...options,
29
- });
30
- }
31
- }
32
- exports.Document = Document;
33
- //# sourceMappingURL=document.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"document.js","sourceRoot":"","sources":["../src/resources/document.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CACJ,SAAkD,EAAE,EACpD,OAAwB;QAExB,MAAM,EAAE,aAAa,EAAE,0BAA0B,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,KAAK,EAAE,EAAE,aAAa,EAAE,0BAA0B,EAAE;YACpD,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AA5BD,4BA4BC"}
@@ -1,29 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../core/resource.mjs";
3
- export class Document extends APIResource {
4
- /**
5
- * Upload a document (PDF/HTML/TXT) to be processed and added to memory.
6
- *
7
- * **Authentication Required**:
8
- * One of the following authentication methods must be used:
9
- * - Bearer token in `Authorization` header
10
- * - API Key in `X-API-Key` header
11
- * - Session token in `X-Session-Token` header
12
- *
13
- * **Required Headers**:
14
- * - Content-Type: multipart/form-data
15
- * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
16
- *
17
- * **Form Data**:
18
- * - file: The document file to upload (PDF/HTML/TXT)
19
- * - metadata: (optional) JSON string containing additional metadata
20
- */
21
- upload(params = {}, options) {
22
- const { post_objectId, skip_background_processing } = params ?? {};
23
- return this._client.post('/v1/document', {
24
- query: { post_objectId, skip_background_processing },
25
- ...options,
26
- });
27
- }
28
- }
29
- //# sourceMappingURL=document.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"document.mjs","sourceRoot":"","sources":["../src/resources/document.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CACJ,SAAkD,EAAE,EACpD,OAAwB;QAExB,MAAM,EAAE,aAAa,EAAE,0BAA0B,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,KAAK,EAAE,EAAE,aAAa,EAAE,0BAA0B,EAAE;YACpD,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,28 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- /**
4
- * Shims for types that we can't always rely on being available globally.
5
- *
6
- * Note: these only exist at the type-level, there is no corresponding runtime
7
- * version for any of these symbols.
8
- */
9
-
10
- /**
11
- * In order to properly access the global `NodeJS` type, if it's available, we
12
- * need to make use of declaration shadowing. Without this, any checks for the
13
- * presence of `NodeJS.ReadableStream` will fail.
14
- */
15
- declare namespace NodeJS {
16
- interface ReadableStream {}
17
- }
18
-
19
- type HasProperties<T> = keyof T extends never ? false : true;
20
-
21
- // @ts-ignore
22
- type _ReadableStream<R = any> =
23
- // @ts-ignore
24
- HasProperties<NodeJS.ReadableStream> extends true ? NodeJS.ReadableStream<R> : ReadableStream<R>;
25
-
26
- // @ts-ignore
27
- declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
28
- export { _ReadableStream as ReadableStream };
@@ -1,140 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../core/resource';
4
- import { APIPromise } from '../core/api-promise';
5
- import { RequestOptions } from '../internal/request-options';
6
-
7
- export class Document extends APIResource {
8
- /**
9
- * Upload a document (PDF/HTML/TXT) to be processed and added to memory.
10
- *
11
- * **Authentication Required**:
12
- * One of the following authentication methods must be used:
13
- * - Bearer token in `Authorization` header
14
- * - API Key in `X-API-Key` header
15
- * - Session token in `X-Session-Token` header
16
- *
17
- * **Required Headers**:
18
- * - Content-Type: multipart/form-data
19
- * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
20
- *
21
- * **Form Data**:
22
- * - file: The document file to upload (PDF/HTML/TXT)
23
- * - metadata: (optional) JSON string containing additional metadata
24
- */
25
- upload(
26
- params: DocumentUploadParams | null | undefined = {},
27
- options?: RequestOptions,
28
- ): APIPromise<DocumentUploadResponse> {
29
- const { post_objectId, skip_background_processing } = params ?? {};
30
- return this._client.post('/v1/document', {
31
- query: { post_objectId, skip_background_processing },
32
- ...options,
33
- });
34
- }
35
- }
36
-
37
- /**
38
- * Response model for a single memory item in add_memory response
39
- */
40
- export interface AddMemoryItem {
41
- createdAt: string;
42
-
43
- memoryId: string;
44
-
45
- objectId: string;
46
-
47
- memoryChunkIds?: Array<string>;
48
- }
49
-
50
- export interface DocumentUploadResponse {
51
- /**
52
- * Status and progress of the document upload
53
- */
54
- document_status: DocumentUploadResponse.DocumentStatus;
55
-
56
- /**
57
- * HTTP status code
58
- */
59
- code?: number;
60
-
61
- /**
62
- * Additional error details or context
63
- */
64
- details?: unknown;
65
-
66
- /**
67
- * Error message if failed
68
- */
69
- error?: string | null;
70
-
71
- /**
72
- * For backward compatibility
73
- */
74
- memories?: Array<AddMemoryItem> | null;
75
-
76
- /**
77
- * List of memory items created from the document
78
- */
79
- memory_items?: Array<AddMemoryItem>;
80
-
81
- /**
82
- * Human-readable status message
83
- */
84
- message?: string | null;
85
-
86
- /**
87
- * 'success', 'processing', 'error', etc.
88
- */
89
- status?: string;
90
- }
91
-
92
- export namespace DocumentUploadResponse {
93
- /**
94
- * Status and progress of the document upload
95
- */
96
- export interface DocumentStatus {
97
- /**
98
- * 0.0 to 1.0 for percentage
99
- */
100
- progress: number;
101
-
102
- current_filename?: string | null;
103
-
104
- current_page?: number | null;
105
-
106
- /**
107
- * Error message if failed
108
- */
109
- error?: string | null;
110
-
111
- /**
112
- * Processing status type
113
- */
114
- status_type?: 'processing' | 'completed' | 'failed' | 'not_found' | 'queued' | 'cancelled' | null;
115
-
116
- total_pages?: number | null;
117
-
118
- upload_id?: string | null;
119
- }
120
- }
121
-
122
- export interface DocumentUploadParams {
123
- /**
124
- * Optional Post objectId for updating status
125
- */
126
- post_objectId?: string | null;
127
-
128
- /**
129
- * If True, skips adding background tasks for processing
130
- */
131
- skip_background_processing?: boolean;
132
- }
133
-
134
- export declare namespace Document {
135
- export {
136
- type AddMemoryItem as AddMemoryItem,
137
- type DocumentUploadResponse as DocumentUploadResponse,
138
- type DocumentUploadParams as DocumentUploadParams,
139
- };
140
- }