svix 2.0.0 → 2.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svix",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Svix webhooks API client and webhook verification library",
5
5
  "author": "svix",
6
6
  "repository": "https://github.com/svix/svix-webhooks",
@@ -1,5 +1,13 @@
1
1
  // this file is @generated
2
2
 
3
+ import {
4
+ type BulkExpungeContentsIn,
5
+ BulkExpungeContentsInSerializer,
6
+ } from "../models/bulkExpungeContentsIn";
7
+ import {
8
+ type BulkExpungeContentsOut,
9
+ BulkExpungeContentsOutSerializer,
10
+ } from "../models/bulkExpungeContentsOut";
3
11
  import {
4
12
  type ExpungeAllContentsOut,
5
13
  ExpungeAllContentsOutSerializer,
@@ -67,6 +75,10 @@ export interface MessageGetOptions {
67
75
  withContent?: boolean;
68
76
  }
69
77
 
78
+ export interface MessageBulkExpungeContentOptions {
79
+ idempotencyKey?: string;
80
+ }
81
+
70
82
  export interface MessageExpungeAllContentsOptions {
71
83
  idempotencyKey?: string;
72
84
  }
@@ -190,7 +202,8 @@ export class Message {
190
202
  * Delete the given message's payload.
191
203
  *
192
204
  * Useful in cases when a message was accidentally sent with sensitive content.
193
- * The message can't be replayed or resent once its payload has been deleted or expired.
205
+ * The message can't be replayed or resent once its payload has been deleted
206
+ * (or has expired).
194
207
  */
195
208
  public async expungeContent(appId: string, msgId: string): Promise<void> {
196
209
  const request = new SvixRequest(
@@ -204,6 +217,33 @@ export class Message {
204
217
  return await request.sendNoResponseBody(this.requestCtx);
205
218
  }
206
219
 
220
+ /**
221
+ * Delete the payloads from the given messages under the current application
222
+ *
223
+ * Useful in cases when a message was accidentally sent with sensitive content.
224
+ * A message can't be replayed or resent once its payload has been deleted
225
+ * (or has expired).
226
+ */
227
+ public async bulkExpungeContent(
228
+ appId: string,
229
+ bulkExpungeContentsIn: BulkExpungeContentsIn = {},
230
+ options?: MessageBulkExpungeContentOptions
231
+ ): Promise<BulkExpungeContentsOut> {
232
+ const request = new SvixRequest(
233
+ HttpMethod.POST,
234
+ "/api/v1/app/{app_id}/msg/bulk-expunge"
235
+ );
236
+
237
+ request.setPathParam("app_id", appId);
238
+ request.setHeaderParam("idempotency-key", options?.idempotencyKey);
239
+ request.setBody(BulkExpungeContentsInSerializer._toJsonObject(bulkExpungeContentsIn));
240
+
241
+ return await request.send(
242
+ this.requestCtx,
243
+ BulkExpungeContentsOutSerializer._fromJsonObject
244
+ );
245
+ }
246
+
207
247
  /**
208
248
  * Delete all message payloads for the application.
209
249
  *
@@ -0,0 +1,20 @@
1
+ // this file is @generated
2
+
3
+ export interface BulkExpungeContentsIn {
4
+ /** Message ID or UID to delete */
5
+ ids?: string[];
6
+ }
7
+
8
+ export const BulkExpungeContentsInSerializer = {
9
+ _fromJsonObject(object: any): BulkExpungeContentsIn {
10
+ return {
11
+ ids: object["ids"],
12
+ };
13
+ },
14
+
15
+ _toJsonObject(self: BulkExpungeContentsIn): any {
16
+ return {
17
+ ids: self.ids,
18
+ };
19
+ },
20
+ };
@@ -0,0 +1,33 @@
1
+ // this file is @generated
2
+ import { type BulkExpungeStatus, BulkExpungeStatusSerializer } from "./bulkExpungeStatus";
3
+
4
+ export interface BulkExpungeContentsOut {
5
+ /** Results of expunging (by ID) */
6
+ results: { [key: string]: BulkExpungeStatus };
7
+ }
8
+
9
+ export const BulkExpungeContentsOutSerializer = {
10
+ _fromJsonObject(object: any): BulkExpungeContentsOut {
11
+ return {
12
+ results: Object.fromEntries(
13
+ Object.entries<BulkExpungeStatus>(object["results"]).map(
14
+ (item: [string, BulkExpungeStatus]) => [
15
+ item[0],
16
+ BulkExpungeStatusSerializer._fromJsonObject(item[1]),
17
+ ]
18
+ )
19
+ ),
20
+ };
21
+ },
22
+
23
+ _toJsonObject(self: BulkExpungeContentsOut): any {
24
+ return {
25
+ results: Object.fromEntries(
26
+ Object.entries(self.results).map((item) => [
27
+ item[0],
28
+ BulkExpungeStatusSerializer._toJsonObject(item[1]),
29
+ ])
30
+ ),
31
+ };
32
+ },
33
+ };
@@ -0,0 +1,16 @@
1
+ // this file is @generated
2
+
3
+ export enum BulkExpungeStatus {
4
+ Expunged = "expunged",
5
+ NotFound = "not-found",
6
+ }
7
+
8
+ export const BulkExpungeStatusSerializer = {
9
+ _fromJsonObject(object: any): BulkExpungeStatus {
10
+ return object;
11
+ },
12
+
13
+ _toJsonObject(self: BulkExpungeStatus): any {
14
+ return self;
15
+ },
16
+ };
@@ -23,6 +23,9 @@ export { BackgroundTaskType } from "./backgroundTaskType";
23
23
  export { type BigQueryConfigIn } from "./bigQueryConfigIn";
24
24
  export { type BigQueryConfigOut } from "./bigQueryConfigOut";
25
25
  export { type BigQueryConfigPatch } from "./bigQueryConfigPatch";
26
+ export { type BulkExpungeContentsIn } from "./bulkExpungeContentsIn";
27
+ export { type BulkExpungeContentsOut } from "./bulkExpungeContentsOut";
28
+ export { BulkExpungeStatus } from "./bulkExpungeStatus";
26
29
  export { type BulkReplayIn } from "./bulkReplayIn";
27
30
  export { type CheckbookConfig } from "./checkbookConfig";
28
31
  export { type CheckbookConfigOut } from "./checkbookConfigOut";
package/src/request.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ApiException, type XOR } from "./util";
2
2
  import type { HttpErrorOut, HTTPValidationError } from "./HttpErrors";
3
3
 
4
- export const LIB_VERSION = "2.0.0";
4
+ export const LIB_VERSION = "2.1.0";
5
5
 
6
6
  function getUserAgent() {
7
7
  var fields = [`svix-libs/${LIB_VERSION}/javascript`];