@prezly/sdk 11.2.1 → 11.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.
@@ -1,3 +1,3 @@
1
- const VERSION = "11.2.0";
1
+ const VERSION = "11.2.2";
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 { Category, CategoryRef, CultureRef, ExtendedStory, Newsroom, NewsroomContactRef, Pagination, Query, Story, Warning as BaseWarning } from '../../types';
1
+ import type { Category, CategoryRef, CultureRef, ExtendedStory, Newsroom, NewsroomContactRef, Pagination, Query, Story } from '../../types';
2
2
  /**
3
3
  * Uploadcare image JSON string.
4
4
  */
@@ -12,6 +12,12 @@ declare type Html = string;
12
12
  * String containing Prezly Content Format JSON structure.
13
13
  */
14
14
  declare type PrezlyContentFormat = string;
15
+ interface BaseWarning {
16
+ text: string;
17
+ scope: string;
18
+ field: string;
19
+ value: unknown;
20
+ }
15
21
  interface ChangingNewsroomUnsafeOperationWarning extends BaseWarning {
16
22
  scope: 'room_id';
17
23
  field: 'room_id';
@@ -1,3 +1,4 @@
1
+ export { ApiError } from './ApiError';
1
2
  export { Http } from './Http';
2
3
  export { isDeferredJobResponse } from './lib';
3
4
  export { type ApiResponse, type HeadersMap, type Params, type ParamsWithPayload, HttpCodes, Method, } from './types';
@@ -1,3 +1,4 @@
1
+ export { ApiError } from "./ApiError.js";
1
2
  export { Http } from "./Http.js";
2
3
  export { isDeferredJobResponse } from "./lib.js";
3
4
  export { HttpCodes, Method } from "./types.js";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from '@prezly/uploads';
2
2
  export { type Client as PrezlyClient, createClient as createPrezlyClient } from './Client';
3
- export type { HeadersMap } from './http';
3
+ export { type HeadersMap, ApiError } from './http';
4
4
  export * from './endpoints';
5
5
  export * from './types';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from '@prezly/uploads';
2
2
  export { createClient as createPrezlyClient } from "./Client.js";
3
+ export { ApiError } from "./http/index.js";
3
4
  export * from "./endpoints/index.js";
4
5
  export * from "./types/index.js";
@@ -223,6 +223,14 @@ export declare namespace Story {
223
223
  function isScheduledEmbargo(story: Pick<Story, 'lifecycle_status'>): boolean;
224
224
  function isPublished(status: LifecycleStatus): boolean;
225
225
  function isPublished(story: Pick<Story, 'lifecycle_status'>): boolean;
226
+ function isLegacyHtmlFormat(format: FormatVersion): format is FormatVersion.HTML;
227
+ function isLegacyHtmlFormat<T extends Pick<Story, 'format_version'>>(story: T): story is T & {
228
+ format_version: FormatVersion.HTML;
229
+ };
230
+ function isSlateFormat(format: FormatVersion): format is FormatVersion.SLATEJS;
231
+ function isSlateFormat<T extends Pick<Story, 'format_version'>>(story: Pick<Story, 'format_version'>): story is T & {
232
+ format_version: FormatVersion.SLATEJS;
233
+ };
226
234
  }
227
235
  export interface ExtendedStory extends Story, Pick<Story.ExtraFields, 'thumbnail_image' | 'header_image' | 'preview_image' | 'social_image' | 'social_text' | 'tag_names' | 'content' | 'attached_gallery_content' | 'referenced_entities'> {
228
236
  }
@@ -65,4 +65,18 @@ export let Story;
65
65
  return arg === LifecycleStatus.PUBLISHED;
66
66
  }
67
67
  _Story.isPublished = isPublished;
68
+ function isLegacyHtmlFormat(arg) {
69
+ if (typeof arg === 'object') {
70
+ return isLegacyHtmlFormat(arg.format_version);
71
+ }
72
+ return arg === FormatVersion.HTML;
73
+ }
74
+ _Story.isLegacyHtmlFormat = isLegacyHtmlFormat;
75
+ function isSlateFormat(arg) {
76
+ if (typeof arg === 'object') {
77
+ return isSlateFormat(arg.format_version);
78
+ }
79
+ return arg === FormatVersion.SLATEJS;
80
+ }
81
+ _Story.isSlateFormat = isSlateFormat;
68
82
  })(Story || (Story = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "11.2.1",
3
+ "version": "11.3.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",