@prezly/sdk 11.9.0 → 11.10.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,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_USER_AGENT = void 0;
7
- const VERSION = "11.8.1-0";
7
+ const VERSION = "11.9.1";
8
8
  const URL = 'https://github.com/prezly/javascript-sdk';
9
9
  const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
10
10
  exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
@@ -1,3 +1,3 @@
1
- const VERSION = "11.8.1-0";
1
+ const VERSION = "11.9.1";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -1,4 +1,4 @@
1
- import type { CultureRef, NewsroomCompanyInformation, NewsroomLanguageSettings } from '../../types';
1
+ import type { CultureRef, NewsroomLanguageSettings } from '../../types';
2
2
  export interface ListOptions {
3
3
  sortOrder?: string;
4
4
  }
@@ -9,7 +9,29 @@ export interface ListResponse {
9
9
  export interface SettingsUpdateRequest {
10
10
  is_default?: true;
11
11
  code?: CultureRef['code'];
12
- company_information?: Partial<NewsroomCompanyInformation>;
12
+ company_information?: {
13
+ name?: string;
14
+ about?: string;
15
+ about_plaintext?: string;
16
+ email?: string | null;
17
+ website?: string | null;
18
+ phone?: string | null;
19
+ address?: string | null;
20
+ twitter?: string | null;
21
+ facebook?: string | null;
22
+ linkedin?: string | null;
23
+ pinterest?: string | null;
24
+ youtube?: string | null;
25
+ instagram?: string | null;
26
+ tiktok?: string | null;
27
+ email_disclaimer?: string;
28
+ cookie_statement?: string;
29
+ subscribe_disclaimer?: string;
30
+ seo_settings?: {
31
+ meta_title?: string | null;
32
+ meta_description?: string | null;
33
+ };
34
+ };
13
35
  }
14
36
  export interface UnsafeUpdateErrorResponse {
15
37
  status: 'error';
@@ -64,6 +64,7 @@ export interface UpdateRequest {
64
64
  * Uploadcare Image JSON
65
65
  */
66
66
  icon?: string;
67
+ google_search_console_key?: string | null;
67
68
  google_analytics_id?: string | null;
68
69
  segment_analytics_id?: string | null;
69
70
  /**
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Client = void 0;
7
7
  var _index = require("../../http/index.cjs");
8
- var _ApiError = require("../../http/ApiError.cjs");
9
8
  var _routing = require("../../routing.cjs");
10
9
  class Client {
11
10
  constructor(apiClient) {
@@ -153,7 +152,7 @@ class Client {
153
152
  story
154
153
  };
155
154
  } catch (error) {
156
- if (error instanceof _ApiError.ApiError && error.status === _index.HttpCodes.CONFLICT) {
155
+ if (error instanceof _index.ApiError && error.status === _index.HttpCodes.CONFLICT) {
157
156
  return error.payload;
158
157
  }
159
158
  throw error;
@@ -5,52 +5,57 @@ import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsa
5
5
  * `uuid` is the preferred way of targeting a Story. Numeric `id` is considered deprecated.
6
6
  */
7
7
  declare type StoryId = Story['uuid'] | Story['id'];
8
+ /**
9
+ * Utility type to forbid arbitrary ad-hoc extensions of generic parameters.
10
+ * @see https://stackoverflow.com/a/69666350
11
+ */
12
+ declare type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
8
13
  export declare class Client {
9
14
  private readonly apiClient;
10
15
  constructor(apiClient: DeferredJobsApiClient);
11
- list<Include extends readonly (keyof Story.ExtraFields)[], Options extends ListOptions<Include>, StoryRecord extends Story = Options['include'] extends Include ? Story & Pick<Story.ExtraFields, Options['include'][number]> : Story>(options?: Options): Promise<ListResponse<StoryRecord>>;
12
- search<Include extends readonly (keyof Story.ExtraFields)[], Options extends SearchOptions<Include>, StoryRecord extends Story = Options['include'] extends Include ? Story & Pick<Story.ExtraFields, Options['include'][number]> : Story>(options?: Options): Promise<ListResponse<StoryRecord>>;
16
+ list<Include extends readonly (keyof Story.ExtraFields)[], Options extends ListOptions<Include>, StoryRecord extends Story = Options['include'] extends Include ? Story & Pick<Story.ExtraFields, Options['include'][number]> : Story>(options?: Exactly<ListOptions<Include>, Options>): Promise<ListResponse<StoryRecord>>;
17
+ search<Include extends readonly (keyof Story.ExtraFields)[], Options extends SearchOptions<Include>, StoryRecord extends Story = Options['include'] extends Include ? Story & Pick<Story.ExtraFields, Options['include'][number]> : Story>(options?: Exactly<SearchOptions<Include>, Options>): Promise<ListResponse<StoryRecord>>;
13
18
  /**
14
19
  * Get story by UUID.
15
20
  */
16
- get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: Story['uuid'], options?: Options): Promise<StoryRecord>;
21
+ get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: Story['uuid'], options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
17
22
  /**
18
23
  * Get multiple stories by UUIDs.
19
24
  */
20
- get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['uuid'][], options?: Options): Promise<StoryRecord[]>;
25
+ get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['uuid'][], options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord[]>;
21
26
  /**
22
27
  * Get story by deprecated numeric ID, or UUID.
23
28
  * @deprecated Please use UUID instead.
24
29
  */
25
- get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: Story['id'] | Story['uuid'], options?: Options): Promise<StoryRecord>;
30
+ get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: Story['id'] | Story['uuid'], options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
26
31
  /**
27
32
  * Get multiple stories by numeric IDs.
28
33
  * @deprecated Please use UUID instead.
29
34
  */
30
- get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['id'][], options?: Options): Promise<StoryRecord[]>;
31
- create<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(payload: CreateRequest, options?: Options): Promise<StoryRecord>;
32
- duplicate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Options): Promise<StoryRecord>;
33
- translate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: TranslateRequest, options?: Options): Promise<StoryRecord>;
34
- move<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include> & {
35
+ get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['id'][], options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord[]>;
36
+ create<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(payload: CreateRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
37
+ duplicate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
38
+ translate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: TranslateRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
39
+ move<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: MoveRequest, options?: Exactly<IncludeOptions<Include>, Options> & {
35
40
  force?: true;
36
- }, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: MoveRequest, options?: Options): Promise<ChangeNewsroomSuccessResponse<StoryRecord> | ChangeNewsroomUnsafeResponse>;
37
- update<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: UpdateRequest, options?: Options): Promise<StoryRecord>;
41
+ }): Promise<ChangeNewsroomSuccessResponse<StoryRecord> | ChangeNewsroomUnsafeResponse>;
42
+ update<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: UpdateRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
38
43
  /**
39
44
  * This operation is only allowed for V3 stories
40
45
  */
41
- autosave<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: AutosaveRequest, options?: Options): Promise<StoryRecord>;
46
+ autosave<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: AutosaveRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
42
47
  /**
43
48
  * This operation is only allowed for V3 stories
44
49
  */
45
- revert<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: RevertRequest, options?: Options): Promise<StoryRecord>;
46
- publish<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: PublishRequest, options?: Options): Promise<StoryRecord>;
47
- unpublish<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: UnpublishRequest, options?: Options): Promise<StoryRecord>;
48
- schedule<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: ScheduleRequest, options?: Options): Promise<StoryRecord>;
49
- unschedule<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: UnscheduleRequest, options?: Options): Promise<StoryRecord>;
50
- pin<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Options & {
50
+ revert<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: RevertRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
51
+ publish<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: PublishRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
52
+ unpublish<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: UnpublishRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
53
+ schedule<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: ScheduleRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
54
+ unschedule<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: UnscheduleRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
55
+ pin<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Exactly<IncludeOptions<Include>, Options> & {
51
56
  force?: boolean;
52
57
  }): Promise<StoryRecord>;
53
- unpin<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Options): Promise<StoryRecord>;
58
+ unpin<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
54
59
  delete(id: StoryId): Promise<void>;
55
60
  }
56
61
  export {};
@@ -1,5 +1,4 @@
1
- import { HttpCodes } from "../../http/index.js";
2
- import { ApiError } from "../../http/ApiError.js";
1
+ import { ApiError, HttpCodes } from "../../http/index.js";
3
2
  import { routing } from "../../routing.js";
4
3
  export class Client {
5
4
  constructor(apiClient) {
@@ -90,6 +90,7 @@ export interface Newsroom extends NewsroomRef {
90
90
  };
91
91
  ga_tracking_id: string | null;
92
92
  segment_analytics_id: string | null;
93
+ google_search_console_key: string | null;
93
94
  is_subscription_form_enabled: boolean;
94
95
  is_white_labeled: boolean;
95
96
  is_plausible_enabled: boolean;
@@ -1,3 +1,4 @@
1
+ import type { SEOSettings } from './SEOSettings';
1
2
  export interface NewsroomCompanyInformation {
2
3
  name: string;
3
4
  about: string;
@@ -13,16 +14,8 @@ export interface NewsroomCompanyInformation {
13
14
  youtube: string | null;
14
15
  instagram: string | null;
15
16
  tiktok: string | null;
16
- /**
17
- * Only admins are allowed to update this field.
18
- */
19
17
  email_disclaimer: string;
20
- /**
21
- * Only admins are allowed to update this field.
22
- */
23
18
  cookie_statement: string;
24
- /**
25
- * Only admins are allowed to update this field.
26
- */
27
19
  subscribe_disclaimer: string;
20
+ seo_settings: SEOSettings;
28
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "11.9.0",
3
+ "version": "11.10.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",