@prezly/sdk 12.5.0 → 13.0.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/dist/api/constants.cjs +1 -1
- package/dist/api/constants.js +1 -1
- package/dist/endpoints/Stories/Client.cjs +7 -2
- package/dist/endpoints/Stories/Client.d.ts +1 -1
- package/dist/endpoints/Stories/Client.js +7 -2
- package/dist/endpoints/Stories/types.d.ts +1 -1
- package/dist/types/Newsroom.cjs +21 -0
- package/dist/types/Newsroom.d.ts +6 -0
- package/dist/types/Newsroom.js +21 -0
- package/dist/types/Story.cjs +39 -19
- package/dist/types/Story.d.ts +57 -49
- package/dist/types/Story.js +39 -19
- package/package.json +1 -1
package/dist/api/constants.cjs
CHANGED
|
@@ -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 = "12.
|
|
7
|
+
const VERSION = "12.6.0";
|
|
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;
|
package/dist/api/constants.js
CHANGED
|
@@ -121,7 +121,10 @@ class Client {
|
|
|
121
121
|
});
|
|
122
122
|
return story;
|
|
123
123
|
}
|
|
124
|
-
async translate(id, payload, options) {
|
|
124
|
+
async translate(id, payload = {}, options) {
|
|
125
|
+
const {
|
|
126
|
+
culture
|
|
127
|
+
} = payload ?? {};
|
|
125
128
|
const include = options?.include;
|
|
126
129
|
const url = `${_routing.routing.storiesUrl}/${id}/translate`;
|
|
127
130
|
const {
|
|
@@ -130,7 +133,9 @@ class Client {
|
|
|
130
133
|
query: {
|
|
131
134
|
include: include
|
|
132
135
|
},
|
|
133
|
-
payload
|
|
136
|
+
payload: {
|
|
137
|
+
culture
|
|
138
|
+
}
|
|
134
139
|
});
|
|
135
140
|
return story;
|
|
136
141
|
}
|
|
@@ -35,7 +35,7 @@ export declare class Client {
|
|
|
35
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
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
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
|
|
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
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> & {
|
|
40
40
|
force?: true;
|
|
41
41
|
}): Promise<ChangeNewsroomSuccessResponse<StoryRecord> | ChangeNewsroomUnsafeResponse>;
|
|
@@ -115,7 +115,10 @@ export class Client {
|
|
|
115
115
|
});
|
|
116
116
|
return story;
|
|
117
117
|
}
|
|
118
|
-
async translate(id, payload, options) {
|
|
118
|
+
async translate(id, payload = {}, options) {
|
|
119
|
+
const {
|
|
120
|
+
culture
|
|
121
|
+
} = payload ?? {};
|
|
119
122
|
const include = options?.include;
|
|
120
123
|
const url = `${routing.storiesUrl}/${id}/translate`;
|
|
121
124
|
const {
|
|
@@ -124,7 +127,9 @@ export class Client {
|
|
|
124
127
|
query: {
|
|
125
128
|
include: include
|
|
126
129
|
},
|
|
127
|
-
payload
|
|
130
|
+
payload: {
|
|
131
|
+
culture
|
|
132
|
+
}
|
|
128
133
|
});
|
|
129
134
|
return story;
|
|
130
135
|
}
|
|
@@ -171,7 +171,7 @@ export interface ScheduleRequest {
|
|
|
171
171
|
}
|
|
172
172
|
export declare type UnscheduleRequest = UnpublishRequest;
|
|
173
173
|
export interface TranslateRequest {
|
|
174
|
-
culture
|
|
174
|
+
culture?: CultureRef['code'];
|
|
175
175
|
}
|
|
176
176
|
export interface MoveRequest {
|
|
177
177
|
newsroom: Newsroom['uuid'] | Newsroom['id'];
|
package/dist/types/Newsroom.cjs
CHANGED
|
@@ -27,4 +27,25 @@ exports.Newsroom = Newsroom;
|
|
|
27
27
|
TrackingPolicy["CONSENT_TO_IDENTIFY"] = "consent-to-identify";
|
|
28
28
|
})(TrackingPolicy || (TrackingPolicy = {}));
|
|
29
29
|
_Newsroom.TrackingPolicy = TrackingPolicy;
|
|
30
|
+
function isActive(arg) {
|
|
31
|
+
if (typeof arg === 'string') {
|
|
32
|
+
return arg === Status.ACTIVE;
|
|
33
|
+
}
|
|
34
|
+
return isActive(arg.status);
|
|
35
|
+
}
|
|
36
|
+
_Newsroom.isActive = isActive;
|
|
37
|
+
function isInactive(arg) {
|
|
38
|
+
if (typeof arg === 'string') {
|
|
39
|
+
return arg === Status.INACTIVE;
|
|
40
|
+
}
|
|
41
|
+
return isInactive(arg.status);
|
|
42
|
+
}
|
|
43
|
+
_Newsroom.isInactive = isInactive;
|
|
44
|
+
function isArchived(arg) {
|
|
45
|
+
if (typeof arg === 'string') {
|
|
46
|
+
return arg === Status.ARCHIVED;
|
|
47
|
+
}
|
|
48
|
+
return isArchived(arg.status);
|
|
49
|
+
}
|
|
50
|
+
_Newsroom.isArchived = isArchived;
|
|
30
51
|
})(Newsroom || (exports.Newsroom = Newsroom = {}));
|
package/dist/types/Newsroom.d.ts
CHANGED
|
@@ -133,4 +133,10 @@ export declare namespace Newsroom {
|
|
|
133
133
|
DISABLED = "disabled",
|
|
134
134
|
CONSENT_TO_IDENTIFY = "consent-to-identify"
|
|
135
135
|
}
|
|
136
|
+
function isActive(newsroom: Newsroom['status']): boolean;
|
|
137
|
+
function isActive(newsroom: Pick<Newsroom, 'status'>): boolean;
|
|
138
|
+
function isInactive(newsroom: Newsroom['status']): boolean;
|
|
139
|
+
function isInactive(newsroom: Pick<Newsroom, 'status'>): boolean;
|
|
140
|
+
function isArchived(newsroom: Newsroom['status']): boolean;
|
|
141
|
+
function isArchived(newsroom: Pick<Newsroom, 'status'>): boolean;
|
|
136
142
|
}
|
package/dist/types/Newsroom.js
CHANGED
|
@@ -20,4 +20,25 @@ export let Newsroom;
|
|
|
20
20
|
TrackingPolicy["CONSENT_TO_IDENTIFY"] = "consent-to-identify";
|
|
21
21
|
})(TrackingPolicy || (TrackingPolicy = {}));
|
|
22
22
|
_Newsroom.TrackingPolicy = TrackingPolicy;
|
|
23
|
+
function isActive(arg) {
|
|
24
|
+
if (typeof arg === 'string') {
|
|
25
|
+
return arg === Status.ACTIVE;
|
|
26
|
+
}
|
|
27
|
+
return isActive(arg.status);
|
|
28
|
+
}
|
|
29
|
+
_Newsroom.isActive = isActive;
|
|
30
|
+
function isInactive(arg) {
|
|
31
|
+
if (typeof arg === 'string') {
|
|
32
|
+
return arg === Status.INACTIVE;
|
|
33
|
+
}
|
|
34
|
+
return isInactive(arg.status);
|
|
35
|
+
}
|
|
36
|
+
_Newsroom.isInactive = isInactive;
|
|
37
|
+
function isArchived(arg) {
|
|
38
|
+
if (typeof arg === 'string') {
|
|
39
|
+
return arg === Status.ARCHIVED;
|
|
40
|
+
}
|
|
41
|
+
return isArchived(arg.status);
|
|
42
|
+
}
|
|
43
|
+
_Newsroom.isArchived = isArchived;
|
|
23
44
|
})(Newsroom || (Newsroom = {}));
|
package/dist/types/Story.cjs
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Story = void 0;
|
|
7
|
+
var _Newsroom = require("./Newsroom.cjs");
|
|
7
8
|
let Story;
|
|
8
9
|
exports.Story = Story;
|
|
9
10
|
(function (_Story) {
|
|
@@ -13,15 +14,22 @@ exports.Story = Story;
|
|
|
13
14
|
FormatVersion[FormatVersion["SLATEJS"] = 3] = "SLATEJS";
|
|
14
15
|
})(FormatVersion || (FormatVersion = {}));
|
|
15
16
|
_Story.FormatVersion = FormatVersion;
|
|
16
|
-
let
|
|
17
|
-
(function (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})(
|
|
24
|
-
_Story.
|
|
17
|
+
let Status;
|
|
18
|
+
(function (Status) {
|
|
19
|
+
Status["UNINITIALIZED"] = "uninitialized";
|
|
20
|
+
Status["DRAFT"] = "draft";
|
|
21
|
+
Status["SCHEDULED"] = "scheduled";
|
|
22
|
+
Status["EMBARGO"] = "embargo";
|
|
23
|
+
Status["PUBLISHED"] = "published";
|
|
24
|
+
})(Status || (Status = {}));
|
|
25
|
+
_Story.Status = Status;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Please use `Status` instead.
|
|
28
|
+
* @see Status
|
|
29
|
+
*/var LifecycleStatus = Status; /**
|
|
30
|
+
* @deprecated Please use `Status` instead.
|
|
31
|
+
* @see Status
|
|
32
|
+
*/
|
|
25
33
|
let PublicationStatus;
|
|
26
34
|
(function (PublicationStatus) {
|
|
27
35
|
PublicationStatus["NEW"] = "new";
|
|
@@ -37,39 +45,51 @@ exports.Story = Story;
|
|
|
37
45
|
Visibility["CONFIDENTIAL"] = "confidential";
|
|
38
46
|
})(Visibility || (Visibility = {}));
|
|
39
47
|
_Story.Visibility = Visibility;
|
|
48
|
+
function isActiveNewsroom(story) {
|
|
49
|
+
return _Newsroom.Newsroom.isActive(story.newsroom);
|
|
50
|
+
}
|
|
51
|
+
_Story.isActiveNewsroom = isActiveNewsroom;
|
|
52
|
+
function isInactiveNewsroom(story) {
|
|
53
|
+
return _Newsroom.Newsroom.isInactive(story.newsroom);
|
|
54
|
+
}
|
|
55
|
+
_Story.isInactiveNewsroom = isInactiveNewsroom;
|
|
56
|
+
function isArchivedNewsroom(story) {
|
|
57
|
+
return _Newsroom.Newsroom.isArchived(story.newsroom);
|
|
58
|
+
}
|
|
59
|
+
_Story.isArchivedNewsroom = isArchivedNewsroom;
|
|
40
60
|
function isUninitialized(arg) {
|
|
41
61
|
if (typeof arg === 'object') {
|
|
42
|
-
return isUninitialized(arg.
|
|
62
|
+
return isUninitialized(arg.status);
|
|
43
63
|
}
|
|
44
|
-
return arg ===
|
|
64
|
+
return arg === Status.UNINITIALIZED;
|
|
45
65
|
}
|
|
46
66
|
_Story.isUninitialized = isUninitialized;
|
|
47
67
|
function isDraft(arg) {
|
|
48
68
|
if (typeof arg === 'object') {
|
|
49
|
-
return isDraft(arg.
|
|
69
|
+
return isDraft(arg.status);
|
|
50
70
|
}
|
|
51
|
-
return arg ===
|
|
71
|
+
return arg === Status.DRAFT;
|
|
52
72
|
}
|
|
53
73
|
_Story.isDraft = isDraft;
|
|
54
74
|
function isScheduled(arg) {
|
|
55
75
|
if (typeof arg === 'object') {
|
|
56
|
-
return isScheduled(arg.
|
|
76
|
+
return isScheduled(arg.status);
|
|
57
77
|
}
|
|
58
|
-
return arg ===
|
|
78
|
+
return arg === Status.SCHEDULED;
|
|
59
79
|
}
|
|
60
80
|
_Story.isScheduled = isScheduled;
|
|
61
81
|
function isScheduledEmbargo(arg) {
|
|
62
82
|
if (typeof arg === 'object') {
|
|
63
|
-
return isScheduledEmbargo(arg.
|
|
83
|
+
return isScheduledEmbargo(arg.status);
|
|
64
84
|
}
|
|
65
|
-
return arg ===
|
|
85
|
+
return arg === Status.EMBARGO;
|
|
66
86
|
}
|
|
67
87
|
_Story.isScheduledEmbargo = isScheduledEmbargo;
|
|
68
88
|
function isPublished(arg) {
|
|
69
89
|
if (typeof arg === 'object') {
|
|
70
|
-
return isPublished(arg.
|
|
90
|
+
return isPublished(arg.status);
|
|
71
91
|
}
|
|
72
|
-
return arg ===
|
|
92
|
+
return arg === Status.PUBLISHED;
|
|
73
93
|
}
|
|
74
94
|
_Story.isPublished = isPublished;
|
|
75
95
|
function isLegacyHtmlFormat(arg) {
|
package/dist/types/Story.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Category } from './Category';
|
|
2
2
|
import type { OEmbedInfo } from './common';
|
|
3
3
|
import type { CultureRef } from './Culture';
|
|
4
|
-
import type
|
|
4
|
+
import { type NewsroomRef } from './Newsroom';
|
|
5
5
|
import type { SEOSettings } from './SEOSettings';
|
|
6
6
|
import type { UserRef } from './User';
|
|
7
7
|
export interface StoryRef {
|
|
@@ -13,13 +13,19 @@ export interface StoryRef {
|
|
|
13
13
|
id: number;
|
|
14
14
|
title: string;
|
|
15
15
|
slug: string;
|
|
16
|
+
status: Story.Status;
|
|
16
17
|
/**
|
|
17
|
-
* @deprecated Please use `
|
|
18
|
-
* @see
|
|
19
|
-
* @see Story.
|
|
18
|
+
* @deprecated Please use `status` instead.
|
|
19
|
+
* @see status
|
|
20
|
+
* @see Story.Status
|
|
20
21
|
*/
|
|
21
|
-
publication_status: Story.PublicationStatus;
|
|
22
22
|
lifecycle_status: Story.LifecycleStatus;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Please use `status` instead.
|
|
25
|
+
* @see status
|
|
26
|
+
* @see Story.Status
|
|
27
|
+
*/
|
|
28
|
+
publication_status: Story.PublicationStatus;
|
|
23
29
|
visibility: Story.Visibility;
|
|
24
30
|
thumbnail_url: string;
|
|
25
31
|
created_at: string;
|
|
@@ -52,19 +58,9 @@ export interface Story {
|
|
|
52
58
|
culture: CultureRef;
|
|
53
59
|
author: UserRef | null;
|
|
54
60
|
links: {
|
|
55
|
-
analytics: string;
|
|
56
|
-
api: string;
|
|
57
|
-
create_campaign: string;
|
|
58
|
-
duplicate: string | null;
|
|
59
|
-
edit: string | null;
|
|
60
|
-
newsroom_preview: string;
|
|
61
|
-
newsroom_view: string | null;
|
|
62
|
-
preview: string;
|
|
63
|
-
publication_api: string;
|
|
64
|
-
reports_api: string;
|
|
65
|
-
sharing: string;
|
|
66
61
|
short: string | null;
|
|
67
|
-
|
|
62
|
+
newsroom_view: string | null;
|
|
63
|
+
newsroom_preview: string;
|
|
68
64
|
};
|
|
69
65
|
newsroom: NewsroomRef;
|
|
70
66
|
categories: Category[];
|
|
@@ -78,7 +74,11 @@ export interface Story {
|
|
|
78
74
|
updated_at: string;
|
|
79
75
|
published_at: string | null;
|
|
80
76
|
scheduled_at: string | null;
|
|
81
|
-
|
|
77
|
+
status: Story.Status;
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated Please use `status` instead.
|
|
80
|
+
*/
|
|
81
|
+
lifecycle_status: Story.Status;
|
|
82
82
|
/**
|
|
83
83
|
* @deprecated Please use `newsroom.status` instead.
|
|
84
84
|
* @see newsroom
|
|
@@ -86,27 +86,27 @@ export interface Story {
|
|
|
86
86
|
*/
|
|
87
87
|
is_archived: boolean;
|
|
88
88
|
/**
|
|
89
|
-
* @deprecated Please use `
|
|
90
|
-
* @see
|
|
91
|
-
* @see Story.
|
|
89
|
+
* @deprecated Please use `status` instead.
|
|
90
|
+
* @see status
|
|
91
|
+
* @see Story.Status
|
|
92
92
|
*/
|
|
93
93
|
is_finalized: boolean;
|
|
94
94
|
/**
|
|
95
|
-
* @deprecated Please use `
|
|
96
|
-
* @see
|
|
97
|
-
* @see Story.
|
|
95
|
+
* @deprecated Please use `status` instead.
|
|
96
|
+
* @see status
|
|
97
|
+
* @see Story.Status
|
|
98
98
|
*/
|
|
99
99
|
is_published: boolean;
|
|
100
100
|
/**
|
|
101
|
-
* @deprecated Please use `
|
|
102
|
-
* @see
|
|
103
|
-
* @see Story.
|
|
101
|
+
* @deprecated Please use `status` instead.
|
|
102
|
+
* @see status
|
|
103
|
+
* @see Story.Status
|
|
104
104
|
*/
|
|
105
105
|
is_draft: boolean;
|
|
106
106
|
/**
|
|
107
|
-
* @deprecated Please use `
|
|
108
|
-
* @see
|
|
109
|
-
* @see Story.
|
|
107
|
+
* @deprecated Please use `status` instead.
|
|
108
|
+
* @see status
|
|
109
|
+
* @see Story.Status
|
|
110
110
|
*/
|
|
111
111
|
is_embargo: boolean;
|
|
112
112
|
/**
|
|
@@ -116,18 +116,18 @@ export interface Story {
|
|
|
116
116
|
*/
|
|
117
117
|
is_private: boolean;
|
|
118
118
|
/**
|
|
119
|
-
* @deprecated Please use `
|
|
120
|
-
* @see
|
|
121
|
-
* @see Story.
|
|
119
|
+
* @deprecated Please use `status` instead.
|
|
120
|
+
* @see status
|
|
121
|
+
* @see Story.Status
|
|
122
122
|
*/
|
|
123
123
|
is_scheduled: boolean;
|
|
124
124
|
is_sharable: boolean;
|
|
125
125
|
is_analytics_available: boolean;
|
|
126
126
|
is_shared_to_prpro: boolean;
|
|
127
127
|
/**
|
|
128
|
-
* @deprecated Please use `
|
|
129
|
-
* @see
|
|
130
|
-
* @see Story.
|
|
128
|
+
* @deprecated Please use `status` instead.
|
|
129
|
+
* @see status
|
|
130
|
+
* @see Story.Status
|
|
131
131
|
*/
|
|
132
132
|
publication_status: Story.PublicationStatus;
|
|
133
133
|
visibility: Story.Visibility;
|
|
@@ -140,7 +140,7 @@ export declare namespace Story {
|
|
|
140
140
|
HTML = 1,
|
|
141
141
|
SLATEJS = 3
|
|
142
142
|
}
|
|
143
|
-
enum
|
|
143
|
+
enum Status {
|
|
144
144
|
UNINITIALIZED = "uninitialized",
|
|
145
145
|
DRAFT = "draft",
|
|
146
146
|
SCHEDULED = "scheduled",
|
|
@@ -148,8 +148,13 @@ export declare namespace Story {
|
|
|
148
148
|
PUBLISHED = "published"
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
|
-
* Please use `
|
|
152
|
-
* @see
|
|
151
|
+
* @deprecated Please use `Status` instead.
|
|
152
|
+
* @see Status
|
|
153
|
+
*/
|
|
154
|
+
export import LifecycleStatus = Status;
|
|
155
|
+
/**
|
|
156
|
+
* @deprecated Please use `Status` instead.
|
|
157
|
+
* @see Status
|
|
153
158
|
*/
|
|
154
159
|
enum PublicationStatus {
|
|
155
160
|
NEW = "new",
|
|
@@ -237,16 +242,19 @@ export declare namespace Story {
|
|
|
237
242
|
*/
|
|
238
243
|
'pitches.count': number;
|
|
239
244
|
}
|
|
240
|
-
function
|
|
241
|
-
function
|
|
242
|
-
function
|
|
243
|
-
function
|
|
244
|
-
function
|
|
245
|
-
function
|
|
246
|
-
function
|
|
247
|
-
function
|
|
248
|
-
function
|
|
249
|
-
function
|
|
245
|
+
function isActiveNewsroom(story: Pick<Story, 'newsroom'>): boolean;
|
|
246
|
+
function isInactiveNewsroom(story: Pick<Story, 'newsroom'>): boolean;
|
|
247
|
+
function isArchivedNewsroom(story: Pick<Story, 'newsroom'>): boolean;
|
|
248
|
+
function isUninitialized(status: Status): boolean;
|
|
249
|
+
function isUninitialized(story: Pick<Story, 'status'>): boolean;
|
|
250
|
+
function isDraft(status: Status): boolean;
|
|
251
|
+
function isDraft(story: Pick<Story, 'status'>): boolean;
|
|
252
|
+
function isScheduled(status: Status): boolean;
|
|
253
|
+
function isScheduled(story: Pick<Story, 'status'>): boolean;
|
|
254
|
+
function isScheduledEmbargo(status: Status): boolean;
|
|
255
|
+
function isScheduledEmbargo(story: Pick<Story, 'status'>): boolean;
|
|
256
|
+
function isPublished(status: Status): boolean;
|
|
257
|
+
function isPublished(story: Pick<Story, 'status'>): boolean;
|
|
250
258
|
function isLegacyHtmlFormat(format: FormatVersion): format is FormatVersion.HTML;
|
|
251
259
|
function isLegacyHtmlFormat<T extends Pick<Story, 'format_version'>>(story: T): story is T & {
|
|
252
260
|
format_version: FormatVersion.HTML;
|
package/dist/types/Story.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Newsroom } from "./Newsroom.js";
|
|
1
2
|
export let Story;
|
|
2
3
|
(function (_Story) {
|
|
3
4
|
let FormatVersion;
|
|
@@ -6,15 +7,22 @@ export let Story;
|
|
|
6
7
|
FormatVersion[FormatVersion["SLATEJS"] = 3] = "SLATEJS";
|
|
7
8
|
})(FormatVersion || (FormatVersion = {}));
|
|
8
9
|
_Story.FormatVersion = FormatVersion;
|
|
9
|
-
let
|
|
10
|
-
(function (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})(
|
|
17
|
-
_Story.
|
|
10
|
+
let Status;
|
|
11
|
+
(function (Status) {
|
|
12
|
+
Status["UNINITIALIZED"] = "uninitialized";
|
|
13
|
+
Status["DRAFT"] = "draft";
|
|
14
|
+
Status["SCHEDULED"] = "scheduled";
|
|
15
|
+
Status["EMBARGO"] = "embargo";
|
|
16
|
+
Status["PUBLISHED"] = "published";
|
|
17
|
+
})(Status || (Status = {}));
|
|
18
|
+
_Story.Status = Status;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Please use `Status` instead.
|
|
21
|
+
* @see Status
|
|
22
|
+
*/var LifecycleStatus = Status; /**
|
|
23
|
+
* @deprecated Please use `Status` instead.
|
|
24
|
+
* @see Status
|
|
25
|
+
*/
|
|
18
26
|
let PublicationStatus;
|
|
19
27
|
(function (PublicationStatus) {
|
|
20
28
|
PublicationStatus["NEW"] = "new";
|
|
@@ -30,39 +38,51 @@ export let Story;
|
|
|
30
38
|
Visibility["CONFIDENTIAL"] = "confidential";
|
|
31
39
|
})(Visibility || (Visibility = {}));
|
|
32
40
|
_Story.Visibility = Visibility;
|
|
41
|
+
function isActiveNewsroom(story) {
|
|
42
|
+
return Newsroom.isActive(story.newsroom);
|
|
43
|
+
}
|
|
44
|
+
_Story.isActiveNewsroom = isActiveNewsroom;
|
|
45
|
+
function isInactiveNewsroom(story) {
|
|
46
|
+
return Newsroom.isInactive(story.newsroom);
|
|
47
|
+
}
|
|
48
|
+
_Story.isInactiveNewsroom = isInactiveNewsroom;
|
|
49
|
+
function isArchivedNewsroom(story) {
|
|
50
|
+
return Newsroom.isArchived(story.newsroom);
|
|
51
|
+
}
|
|
52
|
+
_Story.isArchivedNewsroom = isArchivedNewsroom;
|
|
33
53
|
function isUninitialized(arg) {
|
|
34
54
|
if (typeof arg === 'object') {
|
|
35
|
-
return isUninitialized(arg.
|
|
55
|
+
return isUninitialized(arg.status);
|
|
36
56
|
}
|
|
37
|
-
return arg ===
|
|
57
|
+
return arg === Status.UNINITIALIZED;
|
|
38
58
|
}
|
|
39
59
|
_Story.isUninitialized = isUninitialized;
|
|
40
60
|
function isDraft(arg) {
|
|
41
61
|
if (typeof arg === 'object') {
|
|
42
|
-
return isDraft(arg.
|
|
62
|
+
return isDraft(arg.status);
|
|
43
63
|
}
|
|
44
|
-
return arg ===
|
|
64
|
+
return arg === Status.DRAFT;
|
|
45
65
|
}
|
|
46
66
|
_Story.isDraft = isDraft;
|
|
47
67
|
function isScheduled(arg) {
|
|
48
68
|
if (typeof arg === 'object') {
|
|
49
|
-
return isScheduled(arg.
|
|
69
|
+
return isScheduled(arg.status);
|
|
50
70
|
}
|
|
51
|
-
return arg ===
|
|
71
|
+
return arg === Status.SCHEDULED;
|
|
52
72
|
}
|
|
53
73
|
_Story.isScheduled = isScheduled;
|
|
54
74
|
function isScheduledEmbargo(arg) {
|
|
55
75
|
if (typeof arg === 'object') {
|
|
56
|
-
return isScheduledEmbargo(arg.
|
|
76
|
+
return isScheduledEmbargo(arg.status);
|
|
57
77
|
}
|
|
58
|
-
return arg ===
|
|
78
|
+
return arg === Status.EMBARGO;
|
|
59
79
|
}
|
|
60
80
|
_Story.isScheduledEmbargo = isScheduledEmbargo;
|
|
61
81
|
function isPublished(arg) {
|
|
62
82
|
if (typeof arg === 'object') {
|
|
63
|
-
return isPublished(arg.
|
|
83
|
+
return isPublished(arg.status);
|
|
64
84
|
}
|
|
65
|
-
return arg ===
|
|
85
|
+
return arg === Status.PUBLISHED;
|
|
66
86
|
}
|
|
67
87
|
_Story.isPublished = isPublished;
|
|
68
88
|
function isLegacyHtmlFormat(arg) {
|