@opensecret/react 1.3.5 → 1.3.7
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.
- package/dist/index.d.ts +71 -1
- package/dist/opensecret-react.es.js +1072 -1055
- package/dist/opensecret-react.umd.js +18 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare namespace api {
|
|
|
47
47
|
requestAccountDeletion,
|
|
48
48
|
confirmAccountDeletion,
|
|
49
49
|
fetchModels,
|
|
50
|
+
uploadDocument,
|
|
50
51
|
LoginResponse,
|
|
51
52
|
UserResponse,
|
|
52
53
|
KVListItem,
|
|
@@ -64,7 +65,9 @@ declare namespace api {
|
|
|
64
65
|
ThirdPartyTokenResponse,
|
|
65
66
|
EncryptDataRequest,
|
|
66
67
|
EncryptDataResponse,
|
|
67
|
-
DecryptDataRequest
|
|
68
|
+
DecryptDataRequest,
|
|
69
|
+
DocumentUploadRequest,
|
|
70
|
+
DocumentResponse
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
|
|
@@ -311,6 +314,17 @@ declare type DeveloperResponse = PlatformUser & {
|
|
|
311
314
|
|
|
312
315
|
export declare type DeveloperRole = "owner" | "admin" | "developer" | "viewer";
|
|
313
316
|
|
|
317
|
+
export declare type DocumentResponse = {
|
|
318
|
+
text: string;
|
|
319
|
+
filename: string;
|
|
320
|
+
size: number;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
declare type DocumentUploadRequest = {
|
|
324
|
+
filename: string;
|
|
325
|
+
content_base64: string;
|
|
326
|
+
};
|
|
327
|
+
|
|
314
328
|
declare type EmailSettings = {
|
|
315
329
|
provider: string;
|
|
316
330
|
send_from: string;
|
|
@@ -1101,6 +1115,33 @@ export declare type OpenSecretContextType = {
|
|
|
1101
1115
|
* - Requires an active authentication session
|
|
1102
1116
|
*/
|
|
1103
1117
|
fetchModels: () => Promise<Model[]>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Uploads a document for text extraction and processing
|
|
1120
|
+
* @param file - The file to upload (File or Blob object)
|
|
1121
|
+
* @returns A promise resolving to the extracted document text and metadata
|
|
1122
|
+
* @throws {Error} If:
|
|
1123
|
+
* - The file exceeds 10MB size limit
|
|
1124
|
+
* - The user is not authenticated (or is a guest user)
|
|
1125
|
+
* - Usage limits are exceeded (403)
|
|
1126
|
+
* - Processing fails (500)
|
|
1127
|
+
*
|
|
1128
|
+
* @description
|
|
1129
|
+
* This function uploads a document to the Tinfoil processing service which:
|
|
1130
|
+
* 1. Extracts text from various document formats (PDF, DOCX, TXT, etc.)
|
|
1131
|
+
* 2. Returns the extracted text ready for use in chat prompts
|
|
1132
|
+
* 3. Maintains end-to-end encryption using session keys
|
|
1133
|
+
*
|
|
1134
|
+
* Common supported formats include PDF, DOCX, XLSX, PPTX, TXT, RTF, and more.
|
|
1135
|
+
* Guest users will receive a 401 Unauthorized error.
|
|
1136
|
+
*
|
|
1137
|
+
* Example usage:
|
|
1138
|
+
* ```typescript
|
|
1139
|
+
* const file = new File(["content"], "document.pdf", { type: "application/pdf" });
|
|
1140
|
+
* const result = await context.uploadDocument(file);
|
|
1141
|
+
* console.log(result.text); // Extracted text from the document
|
|
1142
|
+
* ```
|
|
1143
|
+
*/
|
|
1144
|
+
uploadDocument: (file: File | Blob) => Promise<DocumentResponse>;
|
|
1104
1145
|
};
|
|
1105
1146
|
|
|
1106
1147
|
/**
|
|
@@ -1857,6 +1898,35 @@ declare function updateProject(orgId: string, projectId: string, updates: {
|
|
|
1857
1898
|
status?: string;
|
|
1858
1899
|
}): Promise<Project>;
|
|
1859
1900
|
|
|
1901
|
+
/**
|
|
1902
|
+
* Uploads a document for text extraction and processing
|
|
1903
|
+
* @param file - The file to upload (File or Blob object)
|
|
1904
|
+
* @returns A promise resolving to the extracted document text and metadata
|
|
1905
|
+
* @throws {Error} If:
|
|
1906
|
+
* - The file exceeds 10MB size limit
|
|
1907
|
+
* - The user is not authenticated
|
|
1908
|
+
* - The user is a guest (401)
|
|
1909
|
+
* - Usage limits are exceeded (403)
|
|
1910
|
+
* - Processing fails (500)
|
|
1911
|
+
*
|
|
1912
|
+
* @description
|
|
1913
|
+
* This function uploads a document to the Tinfoil processing service which:
|
|
1914
|
+
* 1. Extracts text from various document formats (PDF, DOCX, TXT, etc.)
|
|
1915
|
+
* 2. Returns the extracted text ready for use in chat prompts
|
|
1916
|
+
* 3. Maintains end-to-end encryption using session keys
|
|
1917
|
+
*
|
|
1918
|
+
* The file is converted to base64 before upload due to encryption requirements.
|
|
1919
|
+
* Common supported formats include PDF, DOCX, XLSX, PPTX, TXT, RTF, and more.
|
|
1920
|
+
*
|
|
1921
|
+
* Example usage:
|
|
1922
|
+
* ```typescript
|
|
1923
|
+
* const file = new File(["content"], "document.pdf", { type: "application/pdf" });
|
|
1924
|
+
* const result = await uploadDocument(file);
|
|
1925
|
+
* console.log(result.text); // Extracted text from the document
|
|
1926
|
+
* ```
|
|
1927
|
+
*/
|
|
1928
|
+
declare function uploadDocument(file: File | Blob): Promise<DocumentResponse>;
|
|
1929
|
+
|
|
1860
1930
|
export declare function useOpenSecret(): OpenSecretContextType;
|
|
1861
1931
|
|
|
1862
1932
|
export declare function useOpenSecretDeveloper(): OpenSecretDeveloperContextType;
|