@prezly/sdk 25.1.0 → 25.3.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.
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_USER_AGENT = void 0;
7
- const VERSION = "25.0.0";
7
+ const VERSION = "25.2.0";
8
8
  const URL = 'https://github.com/prezly/javascript-sdk';
9
9
  const DEFAULT_USER_AGENT = exports.DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -1,3 +1,3 @@
1
- const VERSION = "25.0.0";
1
+ const VERSION = "25.2.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -53,6 +53,18 @@ function createClient(api) {
53
53
  async function doDelete(id) {
54
54
  return api.delete(`${_routing.routing.campaignsUrl}/${id}`);
55
55
  }
56
+ function bulkDelete(payload) {
57
+ const {
58
+ search,
59
+ query
60
+ } = payload;
61
+ return api.delete(_routing.routing.campaignsUrl, {
62
+ payload: {
63
+ search,
64
+ query
65
+ }
66
+ });
67
+ }
56
68
  async function test(id, emails) {
57
69
  return api.post(`${_routing.routing.campaignsUrl}/${id}/test`, {
58
70
  payload: {
@@ -100,6 +112,7 @@ function createClient(api) {
100
112
  unschedule,
101
113
  create,
102
114
  update,
103
- delete: doDelete
115
+ delete: doDelete,
116
+ bulkDelete
104
117
  };
105
118
  }
@@ -1,6 +1,6 @@
1
1
  import type { ProgressPromise } from '@prezly/progress-promise';
2
2
  import type { DeferredJobsApiClient } from '../../api';
3
- import type { Campaign } from '../../types';
3
+ import type { BulkDeletePayload, Campaign } from '../../types';
4
4
  import type { CreateRequest, RecipientsOperationResponse, CampaignResponse, UpdateRequest, ListResponse, SearchOptions } from './types';
5
5
  export type Client = ReturnType<typeof createClient>;
6
6
  export declare function createClient(api: DeferredJobsApiClient): {
@@ -17,4 +17,7 @@ export declare function createClient(api: DeferredJobsApiClient): {
17
17
  }>;
18
18
  update: (id: Campaign["id"], payload: UpdateRequest) => Promise<CampaignResponse>;
19
19
  delete: (id: Campaign["id"]) => Promise<void>;
20
+ bulkDelete: (payload: BulkDeletePayload) => ProgressPromise<{
21
+ records_deleted_number: number;
22
+ }>;
20
23
  };
@@ -47,6 +47,18 @@ export function createClient(api) {
47
47
  async function doDelete(id) {
48
48
  return api.delete(`${routing.campaignsUrl}/${id}`);
49
49
  }
50
+ function bulkDelete(payload) {
51
+ const {
52
+ search,
53
+ query
54
+ } = payload;
55
+ return api.delete(routing.campaignsUrl, {
56
+ payload: {
57
+ search,
58
+ query
59
+ }
60
+ });
61
+ }
50
62
  async function test(id, emails) {
51
63
  return api.post(`${routing.campaignsUrl}/${id}/test`, {
52
64
  payload: {
@@ -94,6 +106,7 @@ export function createClient(api) {
94
106
  unschedule,
95
107
  create,
96
108
  update,
97
- delete: doDelete
109
+ delete: doDelete,
110
+ bulkDelete
98
111
  };
99
112
  }
@@ -408,12 +408,14 @@ function createClient(api) {
408
408
  const url = `${_routing.routing.storiesUrl}/${id}`;
409
409
  await api.delete(url);
410
410
  }
411
- async function bulkDelete(selector) {
411
+ function bulkDelete(payload) {
412
412
  const {
413
+ search,
413
414
  query
414
- } = selector;
415
+ } = payload;
415
416
  return api.delete(_routing.routing.storiesUrl, {
416
417
  payload: {
418
+ search,
417
419
  query
418
420
  }
419
421
  });
@@ -1,6 +1,6 @@
1
1
  import type { ProgressPromise } from '@prezly/progress-promise';
2
2
  import type { DeferredJobsApiClient } from '../../api';
3
- import type { ExtendedStory, Query, Story, StoriesBulkSelector } from '../../types';
3
+ import type { BulkDeletePayload, ExtendedStory, Query, Story } from '../../types';
4
4
  import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsafeResponse, CreateRequest, IncludeOptions, ListOptions, ListResponse, MoveRequest, PreviewResponse, PreviewOptions, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, TranslateRequest, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types';
5
5
  /**
6
6
  * `uuid` is the preferred way of targeting a Story. Numeric `id` is considered deprecated.
@@ -120,7 +120,7 @@ export declare function createClient(api: DeferredJobsApiClient): {
120
120
  formats?: Formats;
121
121
  }>) => Promise<ExtendedStory & InferExtraFields<Options>>;
122
122
  delete: (id: StoryId) => Promise<void>;
123
- bulkDelete: (selector: StoriesBulkSelector) => ProgressPromise<{
123
+ bulkDelete: (payload: BulkDeletePayload) => ProgressPromise<{
124
124
  records_deleted_number: number;
125
125
  }>;
126
126
  preview: (id: StoryId, options?: PreviewOptions) => Promise<PreviewResponse>;
@@ -400,12 +400,14 @@ export function createClient(api) {
400
400
  const url = `${routing.storiesUrl}/${id}`;
401
401
  await api.delete(url);
402
402
  }
403
- async function bulkDelete(selector) {
403
+ function bulkDelete(payload) {
404
404
  const {
405
+ search,
405
406
  query
406
- } = selector;
407
+ } = payload;
407
408
  return api.delete(routing.storiesUrl, {
408
409
  payload: {
410
+ search,
409
411
  query
410
412
  }
411
413
  });
@@ -0,0 +1,5 @@
1
+ import type { Query } from './common';
2
+ export interface BulkDeletePayload {
3
+ search?: string;
4
+ query?: Query;
5
+ }
@@ -1,6 +1,6 @@
1
+ import type { Iso8601DateTime } from './common';
1
2
  import type { ContactTagGroupRef } from './ContactTagGroup';
2
3
  import type { UserRef } from './User';
3
- type Iso8601DateTime = string;
4
4
  export interface ContactTagRef {
5
5
  id: number;
6
6
  name: string;
@@ -21,4 +21,3 @@ export interface ContactTag {
21
21
  export declare namespace ContactTag {
22
22
  type Identifier = ContactTag['id'] | ContactTag['name'];
23
23
  }
24
- export {};
@@ -1,5 +1,5 @@
1
+ import type { Iso8601DateTime } from './common';
1
2
  import type { UserRef } from './User';
2
- type Iso8601DateTime = string;
3
3
  export interface ContactsExport {
4
4
  uuid: string;
5
5
  status: ContactsExport.Status;
@@ -15,4 +15,3 @@ export declare namespace ContactsExport {
15
15
  FAILED = "failed"
16
16
  }
17
17
  }
18
- export {};
@@ -1,8 +1,8 @@
1
+ import type { Iso8601DateTime } from './common';
1
2
  import type { CoverageEntry } from './CoverageEntry';
2
3
  import type { CoverageIntegrationRun } from './CoverageIntegrationRun';
3
4
  import type { NewsroomRef } from './Newsroom';
4
5
  import type { UserRef } from './User';
5
- type Iso8601DateTime = string;
6
6
  export interface CoverageIntegration {
7
7
  id: number;
8
8
  name: string;
@@ -34,4 +34,3 @@ export declare namespace CoverageIntegration {
34
34
  DELETED = "deleted"
35
35
  }
36
36
  }
37
- export {};
@@ -1,5 +1,5 @@
1
+ import type { Iso8601DateTime } from './common';
1
2
  import type { CoverageIntegrationRef } from './CoverageIntegration';
2
- type Iso8601DateTime = string;
3
3
  export interface CoverageIntegrationRun {
4
4
  id: number;
5
5
  uuid: string;
@@ -20,4 +20,3 @@ export declare namespace CoverageIntegrationRun {
20
20
  RUNNING = "running"
21
21
  }
22
22
  }
23
- export {};
@@ -1,4 +1,5 @@
1
1
  import type { UploadedImage } from '@prezly/uploads';
2
+ import type { Iso8601DateTime } from './common';
2
3
  import type { CultureRef } from './Culture';
3
4
  import type { NewroomThemeRef, NewsroomThemePreset } from './NewsroomTheme';
4
5
  export interface NewsroomRef {
@@ -12,6 +13,7 @@ export interface NewsroomRef {
12
13
  thumbnail_url: string;
13
14
  name: string;
14
15
  subdomain: string;
16
+ domain: string;
15
17
  status: Newsroom.Status;
16
18
  /**
17
19
  * @deprecated Please use `status` instead
@@ -69,9 +71,9 @@ export interface NewsroomRef {
69
71
  };
70
72
  active_theme?: NewroomThemeRef | null;
71
73
  is_auto_created: boolean;
74
+ created_at: Iso8601DateTime;
72
75
  }
73
76
  export interface Newsroom extends NewsroomRef {
74
- domain: string;
75
77
  is_hub: boolean;
76
78
  cultures: CultureRef[];
77
79
  campaigns_number: number;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ export type Iso8601DateTime = string;
@@ -0,0 +1 @@
1
+ export {};
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _Iso8601DateTime = require("./Iso8601DateTime.cjs");
7
+ Object.keys(_Iso8601DateTime).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Iso8601DateTime[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Iso8601DateTime[key];
14
+ }
15
+ });
16
+ });
6
17
  var _Notification = require("./Notification.cjs");
7
18
  Object.keys(_Notification).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -1,3 +1,4 @@
1
+ export * from './Iso8601DateTime';
1
2
  export * from './Notification';
2
3
  export * from './OEmbedInfo';
3
4
  export * from './Pagination';
@@ -1,3 +1,4 @@
1
+ export * from "./Iso8601DateTime.js";
1
2
  export * from "./Notification.js";
2
3
  export * from "./OEmbedInfo.js";
3
4
  export * from "./Pagination.js";
@@ -432,14 +432,14 @@ Object.keys(_SortOrder).forEach(function (key) {
432
432
  }
433
433
  });
434
434
  });
435
- var _StoriesBulkSelector = require("./StoriesBulkSelector.cjs");
436
- Object.keys(_StoriesBulkSelector).forEach(function (key) {
435
+ var _BulkDeletePayload = require("./BulkDeletePayload.cjs");
436
+ Object.keys(_BulkDeletePayload).forEach(function (key) {
437
437
  if (key === "default" || key === "__esModule") return;
438
- if (key in exports && exports[key] === _StoriesBulkSelector[key]) return;
438
+ if (key in exports && exports[key] === _BulkDeletePayload[key]) return;
439
439
  Object.defineProperty(exports, key, {
440
440
  enumerable: true,
441
441
  get: function () {
442
- return _StoriesBulkSelector[key];
442
+ return _BulkDeletePayload[key];
443
443
  }
444
444
  });
445
445
  });
@@ -37,7 +37,7 @@ export * from './SenderAddress';
37
37
  export * from './SenderDomain';
38
38
  export * from './Snippet';
39
39
  export * from './SortOrder';
40
- export * from './StoriesBulkSelector';
40
+ export * from './BulkDeletePayload';
41
41
  export * from './Story';
42
42
  export * from './User';
43
43
  export * from './UserAccount';
@@ -38,7 +38,7 @@ export * from "./SenderAddress.js";
38
38
  export * from "./SenderDomain.js";
39
39
  export * from "./Snippet.js";
40
40
  export * from "./SortOrder.js";
41
- export * from "./StoriesBulkSelector.js";
41
+ export * from "./BulkDeletePayload.js";
42
42
  export * from "./Story.js";
43
43
  export * from "./User.js";
44
44
  export * from "./UserAccount.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "25.1.0",
3
+ "version": "25.3.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -1,4 +0,0 @@
1
- import type { Query } from './common';
2
- export interface StoriesBulkSelector {
3
- query: Query;
4
- }