@opensecret/react 1.5.1 → 1.5.3

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/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2024 OpenSecret
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ declare namespace api {
43
43
  fetchUser,
44
44
  fetchPut,
45
45
  fetchDelete,
46
+ fetchDeleteAllKV,
46
47
  fetchGet,
47
48
  fetchList,
48
49
  fetchLogout,
@@ -86,6 +87,7 @@ declare namespace api {
86
87
  updateConversation,
87
88
  deleteConversation,
88
89
  deleteConversations,
90
+ batchDeleteConversations,
89
91
  addConversationItems,
90
92
  listConversationItems,
91
93
  listConversations,
@@ -137,6 +139,9 @@ declare namespace api {
137
139
  ConversationsListResponse,
138
140
  ConversationDeleteResponse,
139
141
  ConversationsDeleteResponse,
142
+ BatchDeleteConversationsRequest,
143
+ BatchDeleteItemResult,
144
+ BatchDeleteConversationsResponse,
140
145
  ResponsesCancelResponse,
141
146
  ResponsesDeleteResponse,
142
147
  ResponsesCreateRequest,
@@ -279,6 +284,51 @@ declare function authenticate(attestationDocumentBase64: string, trustedRootCert
279
284
 
280
285
  declare const AWS_ROOT_CERT_DER: Uint8Array;
281
286
 
287
+ /**
288
+ * Batch deletes multiple conversations by their IDs
289
+ * @param ids - Array of conversation UUIDs to delete
290
+ * @returns A promise resolving to per-item deletion results
291
+ * @throws {Error} If:
292
+ * - The user is not authenticated
293
+ * - The request fails
294
+ *
295
+ * @description
296
+ * This function deletes multiple conversations in a single request.
297
+ * Returns per-item results so callers can handle partial failures.
298
+ *
299
+ * @example
300
+ * ```typescript
301
+ * const result = await batchDeleteConversations([
302
+ * "550e8400-e29b-41d4-a716-446655440000",
303
+ * "550e8400-e29b-41d4-a716-446655440001"
304
+ * ]);
305
+ * for (const item of result.data) {
306
+ * if (item.deleted) {
307
+ * console.log(`Conversation ${item.id} deleted`);
308
+ * } else {
309
+ * console.log(`Failed to delete ${item.id}: ${item.error}`);
310
+ * }
311
+ * }
312
+ * ```
313
+ */
314
+ declare function batchDeleteConversations(ids: string[]): Promise<BatchDeleteConversationsResponse>;
315
+
316
+ export declare type BatchDeleteConversationsRequest = {
317
+ ids: string[];
318
+ };
319
+
320
+ export declare type BatchDeleteConversationsResponse = {
321
+ object: "list";
322
+ data: BatchDeleteItemResult[];
323
+ };
324
+
325
+ export declare type BatchDeleteItemResult = {
326
+ id: string;
327
+ object: "conversation.deleted";
328
+ deleted: boolean;
329
+ error?: "not_found" | "delete_failed";
330
+ };
331
+
282
332
  /**
283
333
  * Cancels an in-progress response
284
334
  * @param responseId - The UUID of the response to cancel
@@ -821,6 +871,8 @@ declare function fetchAttestationDocument(nonce: string, explicitApiUrl?: string
821
871
 
822
872
  declare function fetchDelete(key: string): Promise<void>;
823
873
 
874
+ declare function fetchDeleteAllKV(): Promise<void>;
875
+
824
876
  declare function fetchGet(key: string): Promise<string | undefined>;
825
877
 
826
878
  declare function fetchGuestLogin(id: string, password: string, client_id: string): Promise<LoginResponse>;
@@ -1521,6 +1573,12 @@ export declare type OpenSecretContextType = {
1521
1573
  * - Propagates any server-side errors directly
1522
1574
  */
1523
1575
  del: typeof api.fetchDelete;
1576
+ /**
1577
+ * Deletes all key-value pairs from the user's storage
1578
+ * @returns A promise resolving when the deletion is complete
1579
+ * @throws {Error} If the deletion fails
1580
+ */
1581
+ delAll: typeof api.fetchDeleteAllKV;
1524
1582
  verifyEmail: typeof api.verifyEmail;
1525
1583
  requestNewVerificationCode: typeof api.requestNewVerificationCode;
1526
1584
  requestNewVerificationEmail: typeof api.requestNewVerificationCode;
@@ -2045,6 +2103,12 @@ export declare type OpenSecretContextType = {
2045
2103
  * @returns A promise resolving to deletion confirmation
2046
2104
  */
2047
2105
  deleteConversations: typeof api.deleteConversations;
2106
+ /**
2107
+ * Batch deletes multiple conversations by their IDs
2108
+ * @param ids - Array of conversation UUIDs to delete
2109
+ * @returns A promise resolving to per-item deletion results
2110
+ */
2111
+ batchDeleteConversations: typeof api.batchDeleteConversations;
2048
2112
  /**
2049
2113
  * Creates a new instruction
2050
2114
  * @param request - The instruction creation parameters