@prezly/sdk 11.9.0 → 11.9.1
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
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 = "11.
|
|
7
|
+
const VERSION = "11.9.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
|
@@ -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
|
|
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
|
-
}
|
|
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 {};
|