cheshirecat-typescript-client 1.1.3 → 1.1.5

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.
@@ -1,38 +1,95 @@
1
+ /**
2
+ * @file RabbitHoleEndpoint.ts
3
+ *
4
+ * Isomorphic implementation of the RabbitHoleEndpoint that works in both
5
+ * Node.js (server) and browser (client) environments. This class handles
6
+ * file uploads to the RabbitHole API with environment-specific file handling.
7
+ */
1
8
  import { AbstractEndpoint } from "./abstract";
9
+ import { FileSource } from "../utils/file-reader";
2
10
  import { AllowedMimeTypesOutput } from "../models/api/rabbitholes";
3
11
  export declare class RabbitHoleEndpoint extends AbstractEndpoint {
4
12
  protected prefix: string;
13
+ private throwError;
14
+ private appendFileToForm;
15
+ private appendQueryDataToForm;
16
+ private submitForm;
5
17
  /**
6
- * This method posts a file to the RabbitHole API. The file is uploaded to the RabbitHole server and ingested into
7
- * the RAG system. The file is then processed by the RAG system and the results are stored in the RAG database.
8
- * The process is asynchronous and the results are returned in a batch.
9
- * The CheshireCat processes the injection in background and the client will be informed at the end of the process.
18
+ * Posts a file to the RabbitHole API for ingestion into the RAG system.
10
19
  *
11
- * @param filePath The path to the file to be uploaded.
12
- * @param fileName The name of the file to be uploaded. If not provided, the name of the file will be used.
13
- * @param chunkSize The size of the chunks to be used for the upload. If not provided, the default chunk size will be used.
14
- * @param chunkOverlap The size of the overlap between chunks. If not provided, the default overlap size will be used.
15
- * @param agentId The ID of the agent to be used for the upload. If not provided, the default agent will be used.
16
- * @param metadata Additional metadata to be associated with the file.
20
+ * This method works in both Node.js and browser environments:
21
+ * - In Node.js: Pass a file path string as `fileSource`
22
+ * - In browser: Pass a File object as `fileSource`
17
23
  *
18
- * @returns The response from the RabbitHole API.
24
+ * The file is uploaded to the RabbitHole server and processed asynchronously.
25
+ * The CheshireCat processes the injection in background, and the client will be informed when processing completes.
26
+ *
27
+ * @param fileSource The source of the file to upload:
28
+ * - In Node.js: A string path to the file
29
+ * - In browser: A File object
30
+ * @param fileName Optional custom name for the file. If not provided:
31
+ * - In Node.js: The basename of the file path is used
32
+ * - In browser: The name property of the File object is used
33
+ * @param chunkSize Optional size of chunks for RAG processing
34
+ * @param chunkOverlap Optional overlap between chunks
35
+ * @param agentId Optional ID of the agent to associate with this upload
36
+ * @param metadata Optional additional metadata to associate with the file
37
+ *
38
+ * @returns Promise resolving to the API response data
39
+ *
40
+ * @example Browser usage:
41
+ * ```typescript
42
+ * // In a Vue.js or React component
43
+ * const fileInput = document.getElementById('fileInput');
44
+ * const file = fileInput.files[0];
45
+ * const response = await rabbitHoleEndpoint.postFile(file);
46
+ * ```
47
+ *
48
+ * @example Node.js usage:
49
+ * ```typescript
50
+ * // In a Node.js application
51
+ * const response = await rabbitHoleEndpoint.postFile('/path/to/document.pdf');
52
+ * ```
19
53
  */
20
- postFile(filePath: string, fileName?: string | null, chunkSize?: number | null, chunkOverlap?: number | null, agentId?: string | null, metadata?: Record<string, any> | null): Promise<any>;
54
+ postFile(fileSource: FileSource, fileName?: string | null, chunkSize?: number | null, chunkOverlap?: number | null, agentId?: string | null, metadata?: Record<string, any> | null): Promise<any>;
21
55
  /**
22
56
  * This method posts a number of files to the RabbitHole API. The files are uploaded to the RabbitHole server and
23
- * ingested into the RAG system. The files are then processed by the RAG system and the results are stored in the
24
- * RAG database. The files are processed in a batch. The process is asynchronous.
25
- * The CheshireCat processes the injection in background and the client will be informed at the end of the process.
57
+ * ingested into the RAG system.
26
58
  *
27
- * @param filePaths The paths to the files to be uploaded.
28
- * @param chunkSize The size of the chunks to be used for the upload. If not provided, the default chunk size will be used.
29
- * @param chunkOverlap The size of the overlap between chunks. If not provided, the default overlap size will be used.
30
- * @param agentId The ID of the agent to be used for the upload. If not provided, the default agent will be used.
31
- * @param metadata Additional metadata to be associated with the files.
59
+ * This method works in both Node.js and browser environments:
60
+ * - In Node.js: Pass an array of file path strings as `fileSource`
61
+ * - In browser: Pass an array of File objects as `fileSource`
32
62
  *
33
- * @returns The response from the RabbitHole API.
63
+ * The files are then processed by the RAG system, and the results are stored in the RAG database. The files are
64
+ * processed in a batch. The process is asynchronous.
65
+ * The CheshireCat processes the injection in the background, and the client will be informed at the end of the
66
+ * process.
67
+ *
68
+ * @param fileSources The sources of the file to upload:
69
+ * - In Node.js: An array of strings path to the file
70
+ * - In browser: An array of File objects
71
+ * @param chunkSize Optional size of chunks for RAG processing
72
+ * @param chunkOverlap Optional overlap between chunks
73
+ * @param agentId Optional ID of the agent to associate with this upload
74
+ * @param metadata Optional additional metadata to associate with the file
75
+ *
76
+ * @returns Promise resolving to the API response data
77
+ *
78
+ * @example Browser usage:
79
+ * ```typescript
80
+ * // In a Vue.js or React component
81
+ * const fileInputs = document.getElementById('fileInput');
82
+ * const files = fileInputs.files;
83
+ * const response = await rabbitHoleEndpoint.postFiles(files);
84
+ * ```
85
+ *
86
+ * @example Node.js usage:
87
+ * ```typescript
88
+ * // In a Node.js application
89
+ * const response = await rabbitHoleEndpoint.postFiles(['/path/to/first/document.pdf', '/path/to/second/document.pdf']);
90
+ * ```
34
91
  */
35
- postFiles(filePaths: string[], chunkSize?: number | null, chunkOverlap?: number | null, agentId?: string | null, metadata?: Record<string, any> | null): Promise<any>;
92
+ postFiles(fileSources: FileSource[], chunkSize?: number | null, chunkOverlap?: number | null, agentId?: string | null, metadata?: Record<string, any> | null): Promise<any>;
36
93
  /**
37
94
  * This method posts a web URL to the RabbitHole API. The web URL is ingested into the RAG system. The web URL is
38
95
  * processed by the RAG system by Web scraping and the results are stored in the RAG database. The process is
@@ -52,15 +109,32 @@ export declare class RabbitHoleEndpoint extends AbstractEndpoint {
52
109
  * This method posts a memory point, either for the agent identified by the agentId parameter (for multi-agent
53
110
  * installations) or for the default agent (for single-agent installations). The memory point is ingested into the
54
111
  * RAG system. The process is asynchronous. The provided file must be in JSON format.
55
- * The CheshireCat processes the injection in background and the client will be informed at the end of the process.
112
+ * The CheshireCat processes the injection in the background, and the client will be informed at the end of the
113
+ * process.
56
114
  *
57
- * @param filePath The path to the file to be uploaded.
115
+ * @param fileSource The source of the file to upload:
116
+ * - In Node.js: A string path to the file
117
+ * - In browser: A File object
58
118
  * @param fileName The name of the file to be uploaded. If not provided, the name of the file will be used.
59
119
  * @param agentId The ID of the agent to be used for the upload. If not provided, the default agent will be used.
60
120
  *
61
121
  * @returns The response from the RabbitHole API.
122
+ *
123
+ * @example Browser usage:
124
+ * ```typescript
125
+ * // In a Vue.js or React component
126
+ * const fileInput = document.getElementById('fileInput');
127
+ * const file = fileInput.files[0];
128
+ * const response = await rabbitHoleEndpoint.postMemory(file);
129
+ * ```
130
+ *
131
+ * @example Node.js usage:
132
+ * ```typescript
133
+ * // In a Node.js application
134
+ * const response = await rabbitHoleEndpoint.postMemory('/path/to/document.json');
135
+ * ```
62
136
  */
63
- postMemory(filePath: string, fileName?: string | null, agentId?: string | null): Promise<any>;
137
+ postMemory(fileSource: FileSource, fileName?: string | null, agentId?: string | null): Promise<any>;
64
138
  /**
65
139
  * This method retrieves the allowed MIME types for the RabbitHole API. The allowed MIME types are the MIME types
66
140
  * that are allowed to be uploaded to the RabbitHole API. The allowed MIME types are returned in a list.
@@ -1,72 +1,45 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
38
5
  Object.defineProperty(exports, "__esModule", { value: true });
39
6
  exports.RabbitHoleEndpoint = void 0;
40
- const fs_1 = require("fs");
41
- const path = __importStar(require("path"));
42
- const form_data_1 = __importDefault(require("form-data"));
43
- const mime = __importStar(require("mime-types"));
7
+ /**
8
+ * @file RabbitHoleEndpoint.ts
9
+ *
10
+ * Isomorphic implementation of the RabbitHoleEndpoint that works in both
11
+ * Node.js (server) and browser (client) environments. This class handles
12
+ * file uploads to the RabbitHole API with environment-specific file handling.
13
+ */
44
14
  const abstract_1 = require("./abstract");
15
+ const form_data_1 = __importDefault(require("form-data"));
16
+ const environment_1 = require("../utils/environment");
17
+ const file_reader_1 = require("../utils/file-reader");
45
18
  class RabbitHoleEndpoint extends abstract_1.AbstractEndpoint {
46
19
  prefix = "/rabbithole";
47
- /**
48
- * This method posts a file to the RabbitHole API. The file is uploaded to the RabbitHole server and ingested into
49
- * the RAG system. The file is then processed by the RAG system and the results are stored in the RAG database.
50
- * The process is asynchronous and the results are returned in a batch.
51
- * The CheshireCat processes the injection in background and the client will be informed at the end of the process.
52
- *
53
- * @param filePath The path to the file to be uploaded.
54
- * @param fileName The name of the file to be uploaded. If not provided, the name of the file will be used.
55
- * @param chunkSize The size of the chunks to be used for the upload. If not provided, the default chunk size will be used.
56
- * @param chunkOverlap The size of the overlap between chunks. If not provided, the default overlap size will be used.
57
- * @param agentId The ID of the agent to be used for the upload. If not provided, the default agent will be used.
58
- * @param metadata Additional metadata to be associated with the file.
59
- *
60
- * @returns The response from the RabbitHole API.
61
- */
62
- async postFile(filePath, fileName, chunkSize, chunkOverlap, agentId, metadata) {
63
- const form = new form_data_1.default();
64
- const finalFileName = fileName || path.basename(filePath);
65
- const fileBuffer = (0, fs_1.readFileSync)(filePath);
66
- form.append("file", fileBuffer, {
20
+ throwError(fileSource, error) {
21
+ // Provide more helpful error messages based on environment
22
+ if (!(0, environment_1.isNodeEnvironment)() && typeof fileSource === "string") {
23
+ throw new Error("In browser environments, fileSource must be a File object, not a file path string.");
24
+ }
25
+ else if ((0, environment_1.isNodeEnvironment)() && typeof fileSource !== 'string') {
26
+ throw new Error("In Node.js environments, fileSource must be a file path string.");
27
+ }
28
+ // Re-throw the original error
29
+ throw error;
30
+ }
31
+ async appendFileToForm(form, fileSource, formKey, fileName) {
32
+ // Read file content in an environment-appropriate way
33
+ const fileBuffer = await (0, file_reader_1.readFile)(fileSource);
34
+ // Get appropriate filename
35
+ const finalFileName = fileName || await (0, file_reader_1.getFileName)(fileSource);
36
+ const fileMimeType = await (0, file_reader_1.getFileMimeType)(fileSource, finalFileName);
37
+ form.append(formKey, fileBuffer, {
67
38
  filename: finalFileName,
68
- contentType: mime.contentType(finalFileName) || "application/octet-stream"
39
+ contentType: fileMimeType
69
40
  });
41
+ }
42
+ appendQueryDataToForm(form, chunkSize, chunkOverlap, metadata) {
70
43
  if (chunkSize) {
71
44
  form.append("chunk_size", chunkSize.toString());
72
45
  }
@@ -76,49 +49,115 @@ class RabbitHoleEndpoint extends abstract_1.AbstractEndpoint {
76
49
  if (metadata) {
77
50
  form.append("metadata", JSON.stringify(metadata));
78
51
  }
79
- const response = await this.getHttpClient(agentId).post(this.prefix, form, {
52
+ }
53
+ async submitForm(form, url, agentId) {
54
+ const response = await this.getHttpClient(agentId).post(url, form, {
80
55
  headers: {
81
56
  ...form.getHeaders(),
82
- 'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
83
- },
57
+ "Content-Type": `multipart/form-data; boundary=${form.getBoundary()}`
58
+ }
84
59
  });
85
60
  return response.data;
86
61
  }
87
62
  /**
88
- * This method posts a number of files to the RabbitHole API. The files are uploaded to the RabbitHole server and
89
- * ingested into the RAG system. The files are then processed by the RAG system and the results are stored in the
90
- * RAG database. The files are processed in a batch. The process is asynchronous.
91
- * The CheshireCat processes the injection in background and the client will be informed at the end of the process.
63
+ * Posts a file to the RabbitHole API for ingestion into the RAG system.
92
64
  *
93
- * @param filePaths The paths to the files to be uploaded.
94
- * @param chunkSize The size of the chunks to be used for the upload. If not provided, the default chunk size will be used.
95
- * @param chunkOverlap The size of the overlap between chunks. If not provided, the default overlap size will be used.
96
- * @param agentId The ID of the agent to be used for the upload. If not provided, the default agent will be used.
97
- * @param metadata Additional metadata to be associated with the files.
65
+ * This method works in both Node.js and browser environments:
66
+ * - In Node.js: Pass a file path string as `fileSource`
67
+ * - In browser: Pass a File object as `fileSource`
98
68
  *
99
- * @returns The response from the RabbitHole API.
69
+ * The file is uploaded to the RabbitHole server and processed asynchronously.
70
+ * The CheshireCat processes the injection in background, and the client will be informed when processing completes.
71
+ *
72
+ * @param fileSource The source of the file to upload:
73
+ * - In Node.js: A string path to the file
74
+ * - In browser: A File object
75
+ * @param fileName Optional custom name for the file. If not provided:
76
+ * - In Node.js: The basename of the file path is used
77
+ * - In browser: The name property of the File object is used
78
+ * @param chunkSize Optional size of chunks for RAG processing
79
+ * @param chunkOverlap Optional overlap between chunks
80
+ * @param agentId Optional ID of the agent to associate with this upload
81
+ * @param metadata Optional additional metadata to associate with the file
82
+ *
83
+ * @returns Promise resolving to the API response data
84
+ *
85
+ * @example Browser usage:
86
+ * ```typescript
87
+ * // In a Vue.js or React component
88
+ * const fileInput = document.getElementById('fileInput');
89
+ * const file = fileInput.files[0];
90
+ * const response = await rabbitHoleEndpoint.postFile(file);
91
+ * ```
92
+ *
93
+ * @example Node.js usage:
94
+ * ```typescript
95
+ * // In a Node.js application
96
+ * const response = await rabbitHoleEndpoint.postFile('/path/to/document.pdf');
97
+ * ```
100
98
  */
101
- async postFiles(filePaths, chunkSize, chunkOverlap, agentId, metadata) {
99
+ async postFile(fileSource, fileName, chunkSize, chunkOverlap, agentId, metadata) {
102
100
  const form = new form_data_1.default();
103
- filePaths.forEach((filePath) => {
104
- const fileName = path.basename(filePath);
105
- const fileBuffer = (0, fs_1.readFileSync)(filePath);
106
- form.append("files", fileBuffer, {
107
- filename: fileName,
108
- contentType: mime.contentType(fileName) || "application/octet-stream"
109
- });
110
- });
111
- if (chunkSize) {
112
- form.append("chunk_size", chunkSize.toString());
101
+ try {
102
+ await this.appendFileToForm(form, fileSource, "file", fileName);
103
+ this.appendQueryDataToForm(form, chunkSize, chunkOverlap, metadata);
104
+ // Send the request
105
+ return await this.submitForm(form, this.prefix, agentId);
113
106
  }
114
- if (chunkOverlap) {
115
- form.append("chunk_overlap", chunkOverlap.toString());
107
+ catch (error) {
108
+ this.throwError(fileSource, error);
116
109
  }
117
- if (metadata) {
118
- form.append("metadata", JSON.stringify(metadata));
110
+ }
111
+ /**
112
+ * This method posts a number of files to the RabbitHole API. The files are uploaded to the RabbitHole server and
113
+ * ingested into the RAG system.
114
+ *
115
+ * This method works in both Node.js and browser environments:
116
+ * - In Node.js: Pass an array of file path strings as `fileSource`
117
+ * - In browser: Pass an array of File objects as `fileSource`
118
+ *
119
+ * The files are then processed by the RAG system, and the results are stored in the RAG database. The files are
120
+ * processed in a batch. The process is asynchronous.
121
+ * The CheshireCat processes the injection in the background, and the client will be informed at the end of the
122
+ * process.
123
+ *
124
+ * @param fileSources The sources of the file to upload:
125
+ * - In Node.js: An array of strings path to the file
126
+ * - In browser: An array of File objects
127
+ * @param chunkSize Optional size of chunks for RAG processing
128
+ * @param chunkOverlap Optional overlap between chunks
129
+ * @param agentId Optional ID of the agent to associate with this upload
130
+ * @param metadata Optional additional metadata to associate with the file
131
+ *
132
+ * @returns Promise resolving to the API response data
133
+ *
134
+ * @example Browser usage:
135
+ * ```typescript
136
+ * // In a Vue.js or React component
137
+ * const fileInputs = document.getElementById('fileInput');
138
+ * const files = fileInputs.files;
139
+ * const response = await rabbitHoleEndpoint.postFiles(files);
140
+ * ```
141
+ *
142
+ * @example Node.js usage:
143
+ * ```typescript
144
+ * // In a Node.js application
145
+ * const response = await rabbitHoleEndpoint.postFiles(['/path/to/first/document.pdf', '/path/to/second/document.pdf']);
146
+ * ```
147
+ */
148
+ async postFiles(fileSources, chunkSize, chunkOverlap, agentId, metadata) {
149
+ const form = new form_data_1.default();
150
+ try {
151
+ await Promise.all(fileSources.map(async (fileSource) => {
152
+ await this.appendFileToForm(form, fileSource, "files");
153
+ }));
154
+ // Append additional query parameters
155
+ this.appendQueryDataToForm(form, chunkSize, chunkOverlap, metadata);
156
+ return await this.submitForm(form, this.formatUrl("/batch"), agentId);
157
+ }
158
+ catch (error) {
159
+ this.throwError(fileSources[0], error);
119
160
  }
120
- const response = await this.getHttpClient(agentId).post(this.formatUrl("/batch"), form);
121
- return response.data;
122
161
  }
123
162
  /**
124
163
  * This method posts a web URL to the RabbitHole API. The web URL is ingested into the RAG system. The web URL is
@@ -152,29 +191,40 @@ class RabbitHoleEndpoint extends abstract_1.AbstractEndpoint {
152
191
  * This method posts a memory point, either for the agent identified by the agentId parameter (for multi-agent
153
192
  * installations) or for the default agent (for single-agent installations). The memory point is ingested into the
154
193
  * RAG system. The process is asynchronous. The provided file must be in JSON format.
155
- * The CheshireCat processes the injection in background and the client will be informed at the end of the process.
194
+ * The CheshireCat processes the injection in the background, and the client will be informed at the end of the
195
+ * process.
156
196
  *
157
- * @param filePath The path to the file to be uploaded.
197
+ * @param fileSource The source of the file to upload:
198
+ * - In Node.js: A string path to the file
199
+ * - In browser: A File object
158
200
  * @param fileName The name of the file to be uploaded. If not provided, the name of the file will be used.
159
201
  * @param agentId The ID of the agent to be used for the upload. If not provided, the default agent will be used.
160
202
  *
161
203
  * @returns The response from the RabbitHole API.
204
+ *
205
+ * @example Browser usage:
206
+ * ```typescript
207
+ * // In a Vue.js or React component
208
+ * const fileInput = document.getElementById('fileInput');
209
+ * const file = fileInput.files[0];
210
+ * const response = await rabbitHoleEndpoint.postMemory(file);
211
+ * ```
212
+ *
213
+ * @example Node.js usage:
214
+ * ```typescript
215
+ * // In a Node.js application
216
+ * const response = await rabbitHoleEndpoint.postMemory('/path/to/document.json');
217
+ * ```
162
218
  */
163
- async postMemory(filePath, fileName, agentId) {
219
+ async postMemory(fileSource, fileName, agentId) {
164
220
  const form = new form_data_1.default();
165
- const finalFileName = fileName || path.basename(filePath);
166
- const fileBuffer = (0, fs_1.readFileSync)(filePath);
167
- form.append("file", fileBuffer, {
168
- filename: finalFileName,
169
- contentType: mime.contentType(finalFileName) || "application/octet-stream"
170
- });
171
- const response = await this.getHttpClient(agentId).post(this.formatUrl("/memory"), form, {
172
- headers: {
173
- ...form.getHeaders(),
174
- 'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
175
- },
176
- });
177
- return response.data;
221
+ try {
222
+ await this.appendFileToForm(form, fileSource, "file", fileName);
223
+ return this.submitForm(form, this.formatUrl("/memory"), agentId);
224
+ }
225
+ catch (error) {
226
+ this.throwError(fileSource, error);
227
+ }
178
228
  }
179
229
  /**
180
230
  * This method retrieves the allowed MIME types for the RabbitHole API. The allowed MIME types are the MIME types
@@ -1 +1 @@
1
- {"version":3,"file":"rabbitHole.js","sourceRoot":"","sources":["../../src/endpoints/rabbitHole.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAgC;AAChC,2CAA6B;AAC7B,0DAAiC;AACjC,iDAAmC;AACnC,yCAA4C;AAG5C,MAAa,kBAAmB,SAAQ,2BAAgB;IAC1C,MAAM,GAAG,aAAa,CAAC;IAEjC;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,QAAQ,CACV,QAAgB,EAChB,QAAwB,EACxB,SAAyB,EACzB,YAA4B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C,CAAC;QACD,IAAI,YAAY,EAAE,CAAC;YACf,OAAO,CAAC,eAAe,CAAC,GAAG,YAAY,CAAC;QAC5C,CAAC;QACD,IAAI,QAAQ,EAAE,CAAC;YACX,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QACnC,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACzF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,UAAU,CACZ,UAAsB,EACtB,QAAwB,EACxB,OAAuB;QAEvB,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YAEhE,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;QACtC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,mBAAmB,CAAC,OAAuB;QAC7C,OAAO,IAAI,CAAC,GAAG,CAAyB,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3F,CAAC;CACJ;AA/QD,gDA+QC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file environment.ts
3
+ *
4
+ * Utility functions for detecting the current JavaScript environment.
5
+ */
6
+ /**
7
+ * Determines if the code is running in a Node.js environment.
8
+ */
9
+ export declare function isNodeEnvironment(): boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * @file environment.ts
4
+ *
5
+ * Utility functions for detecting the current JavaScript environment.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.isNodeEnvironment = isNodeEnvironment;
9
+ /**
10
+ * Determines if the code is running in a Node.js environment.
11
+ */
12
+ function isNodeEnvironment() {
13
+ return typeof process !== "undefined" &&
14
+ process.versions != null &&
15
+ process.versions.node != null;
16
+ }
17
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/utils/environment.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAKH,8CAIC;AAPD;;GAEG;AACH,SAAgB,iBAAiB;IAC7B,OAAO,OAAO,OAAO,KAAK,WAAW;QACjC,OAAO,CAAC,QAAQ,IAAI,IAAI;QACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC;AACtC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @file file-reader.ts
3
+ *
4
+ * Isomorphic (Node.js and browser) utilities for file operations.
5
+ */
6
+ /**
7
+ * Type representing the source of a file, which differs by environment:
8
+ * - In Node.js: A string path to the file
9
+ * - In browser: A File object
10
+ */
11
+ export type FileSource = string | File | Blob;
12
+ /**
13
+ * Reads file content in an environment-appropriate way.
14
+ *
15
+ * @param fileSource The source of the file:
16
+ * - In Node.js: A string path to the file
17
+ * - In browser: A File or Blob object
18
+ * @returns Promise resolving to the file buffer/blob
19
+ * @throws Error if file reading fails or if using an inappropriate
20
+ * file source type for the current environment
21
+ */
22
+ export declare function readFile(fileSource: FileSource): Promise<Buffer | Blob>;
23
+ /**
24
+ * Gets the appropriate filename from the file source based on the environment.
25
+ *
26
+ * @param fileSource The source of the file
27
+ * @returns Promise resolving to the filename
28
+ */
29
+ export declare function getFileName(fileSource: FileSource): Promise<string>;
30
+ export declare function getFileMimeType(fileSource: FileSource, fileName: string): Promise<string>;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ /**
3
+ * @file file-reader.ts
4
+ *
5
+ * Isomorphic (Node.js and browser) utilities for file operations.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.readFile = readFile;
42
+ exports.getFileName = getFileName;
43
+ exports.getFileMimeType = getFileMimeType;
44
+ const environment_1 = require("./environment");
45
+ /**
46
+ * Reads file content in an environment-appropriate way.
47
+ *
48
+ * @param fileSource The source of the file:
49
+ * - In Node.js: A string path to the file
50
+ * - In browser: A File or Blob object
51
+ * @returns Promise resolving to the file buffer/blob
52
+ * @throws Error if file reading fails or if using an inappropriate
53
+ * file source type for the current environment
54
+ */
55
+ async function readFile(fileSource) {
56
+ // Node.js environment
57
+ if ((0, environment_1.isNodeEnvironment)()) {
58
+ if (typeof fileSource !== "string") {
59
+ throw new Error("In Node.js environment, fileSource must be a file path string");
60
+ }
61
+ try {
62
+ // Dynamic import to avoid bundling issues in browser
63
+ const fs = await Promise.resolve().then(() => __importStar(require("fs")));
64
+ return fs.readFileSync(fileSource);
65
+ }
66
+ catch (error) {
67
+ throw new Error(`Failed to read file at path ${fileSource}: ${error.message}`);
68
+ }
69
+ }
70
+ // Browser environment
71
+ if (typeof fileSource === "string") {
72
+ throw new Error("In browser environment, fileSource must be a File or Blob object, not a path string");
73
+ }
74
+ // File or Blob are already the data we need
75
+ return fileSource;
76
+ }
77
+ /**
78
+ * Gets the appropriate filename from the file source based on the environment.
79
+ *
80
+ * @param fileSource The source of the file
81
+ * @returns Promise resolving to the filename
82
+ */
83
+ async function getFileName(fileSource) {
84
+ // In Node.js, extract the basename from the path
85
+ if ((0, environment_1.isNodeEnvironment)()) {
86
+ if (typeof fileSource !== "string") {
87
+ throw new Error("Expected file path string in Node.js environment");
88
+ }
89
+ const path = await Promise.resolve().then(() => __importStar(require("path")));
90
+ return path.basename(fileSource);
91
+ }
92
+ // In browser, use the name property of the File object
93
+ if (fileSource instanceof File) {
94
+ return fileSource.name;
95
+ }
96
+ if (fileSource instanceof Blob) {
97
+ // For generic blobs, generate a name
98
+ return `blob-${Date.now()}.bin`;
99
+ }
100
+ throw new Error("Expected File or Blob in browser environment");
101
+ }
102
+ async function getFileMimeType(fileSource, fileName) {
103
+ // In Node.js, use the mime module to get the MIME type
104
+ if ((0, environment_1.isNodeEnvironment)()) {
105
+ if (typeof fileSource !== "string") {
106
+ throw new Error("Expected file path string in Node.js environment");
107
+ }
108
+ const { contentType } = await Promise.resolve().then(() => __importStar(require("mime-types")));
109
+ return contentType(fileName) || "application/octet-stream";
110
+ }
111
+ // In browser, use the type property of the File object
112
+ if (fileSource instanceof File || fileSource instanceof Blob) {
113
+ return fileSource.type || "application/octet-stream";
114
+ }
115
+ throw new Error("Expected File or Blob in browser environment");
116
+ }
117
+ //# sourceMappingURL=file-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-reader.js","sourceRoot":"","sources":["../../src/utils/file-reader.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBH,4BAuBC;AAQD,kCAoBC;AAED,0CAgBC;AAxFD,+CAAkD;AASlD;;;;;;;;;GASG;AACI,KAAK,UAAU,QAAQ,CAAC,UAAsB;IACjD,sBAAsB;IACtB,IAAI,IAAA,+BAAiB,GAAE,EAAE,CAAC;QACtB,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACrF,CAAC;QAED,IAAI,CAAC;YACD,qDAAqD;YACrD,MAAM,EAAE,GAAG,wDAAa,IAAI,GAAC,CAAC;YAC9B,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,+BAA+B,UAAU,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnF,CAAC;IACL,CAAC;IAED,sBAAsB;IACtB,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC;IAC3G,CAAC;IAED,4CAA4C;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAC,UAAsB;IACpD,iDAAiD;IACjD,IAAI,IAAA,+BAAiB,GAAE,EAAE,CAAC;QACtB,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;Q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