@prezly/sdk 11.10.0 → 11.12.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/Client.cjs +1 -0
- package/dist/Client.d.ts +2 -1
- package/dist/Client.js +2 -1
- package/dist/api/constants.cjs +1 -1
- package/dist/api/constants.js +1 -1
- package/dist/endpoints/CampaignRecipients/Client.cjs +2 -2
- package/dist/endpoints/CampaignRecipients/Client.js +3 -3
- package/dist/endpoints/CampaignRecipients/types.d.ts +2 -2
- package/dist/endpoints/Campaigns/Client.cjs +2 -2
- package/dist/endpoints/Campaigns/Client.js +3 -3
- package/dist/endpoints/Campaigns/types.d.ts +2 -2
- package/dist/endpoints/ContactsExports/Client.cjs +3 -2
- package/dist/endpoints/ContactsExports/Client.js +3 -2
- package/dist/endpoints/ContactsExports/types.d.ts +2 -2
- package/dist/endpoints/Coverage/Client.cjs +2 -2
- package/dist/endpoints/Coverage/Client.js +3 -3
- package/dist/endpoints/Coverage/types.d.ts +2 -2
- package/dist/endpoints/NewsroomCategories/Client.cjs +2 -1
- package/dist/endpoints/NewsroomCategories/Client.js +2 -1
- package/dist/endpoints/NewsroomCategories/types.d.ts +2 -1
- package/dist/endpoints/NewsroomGalleries/Client.cjs +2 -2
- package/dist/endpoints/NewsroomGalleries/Client.js +3 -3
- package/dist/endpoints/NewsroomGalleries/types.d.ts +2 -2
- package/dist/endpoints/NewsroomHub/Client.cjs +29 -0
- package/dist/endpoints/NewsroomHub/Client.d.ts +11 -0
- package/dist/endpoints/NewsroomHub/Client.js +22 -0
- package/dist/endpoints/NewsroomHub/index.cjs +25 -0
- package/dist/endpoints/NewsroomHub/index.d.ts +2 -0
- package/dist/endpoints/NewsroomHub/index.js +2 -0
- package/dist/endpoints/NewsroomHub/types.cjs +1 -0
- package/dist/endpoints/NewsroomHub/types.d.ts +12 -0
- package/dist/endpoints/NewsroomHub/types.js +1 -0
- package/dist/endpoints/NewsroomLanguages/Client.cjs +2 -1
- package/dist/endpoints/NewsroomLanguages/Client.js +2 -1
- package/dist/endpoints/NewsroomLanguages/types.d.ts +2 -2
- package/dist/endpoints/Newsrooms/Client.cjs +2 -2
- package/dist/endpoints/Newsrooms/Client.js +3 -3
- package/dist/endpoints/Newsrooms/types.d.ts +2 -2
- package/dist/endpoints/Stories/Client.cjs +3 -2
- package/dist/endpoints/Stories/Client.js +3 -2
- package/dist/endpoints/Stories/types.d.ts +2 -2
- package/dist/endpoints/index.cjs +3 -1
- package/dist/endpoints/index.d.ts +1 -0
- package/dist/endpoints/index.js +1 -0
- package/dist/routing.cjs +1 -0
- package/dist/routing.d.ts +1 -0
- package/dist/routing.js +1 -0
- package/dist/types/SortOrder.cjs +131 -0
- package/dist/types/SortOrder.d.ts +22 -0
- package/dist/types/SortOrder.js +124 -0
- package/dist/types/index.cjs +10 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +1 -1
package/dist/Client.cjs
CHANGED
|
@@ -35,6 +35,7 @@ function createClient({
|
|
|
35
35
|
newsroomPrivacyRequests: new _index2.NewsroomPrivacyRequests.Client(apiClient),
|
|
36
36
|
newsroomDomains: new _index2.NewsroomDomains.Client(apiClient),
|
|
37
37
|
newsroomGalleries: new _index2.NewsroomGalleries.Client(apiClient),
|
|
38
|
+
newsroomHub: new _index2.NewsroomHub.Client(apiClient),
|
|
38
39
|
senderAddresses: new _index2.SenderAddresses.Client(apiClient),
|
|
39
40
|
signup: new _index2.Signup.Client(apiClient),
|
|
40
41
|
stories: new _index2.Stories.Client(apiClient),
|
package/dist/Client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
|
|
1
|
+
import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
|
|
2
2
|
import type { HeadersMap } from './http';
|
|
3
3
|
export interface ClientOptions {
|
|
4
4
|
accessToken: string;
|
|
@@ -23,6 +23,7 @@ export interface Client {
|
|
|
23
23
|
newsroomPrivacyRequests: NewsroomPrivacyRequests.Client;
|
|
24
24
|
newsroomDomains: NewsroomDomains.Client;
|
|
25
25
|
newsroomGalleries: NewsroomGalleries.Client;
|
|
26
|
+
newsroomHub: NewsroomHub.Client;
|
|
26
27
|
senderAddresses: SenderAddresses.Client;
|
|
27
28
|
signup: Signup.Client;
|
|
28
29
|
stories: Stories.Client;
|
package/dist/Client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiClient, DeferredJobsApiClient } from "./api/index.js";
|
|
2
|
-
import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
|
|
2
|
+
import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
|
|
3
3
|
const DEFAULT_BASE_URL = 'https://api.prezly.com';
|
|
4
4
|
export function createClient({
|
|
5
5
|
accessToken,
|
|
@@ -29,6 +29,7 @@ export function createClient({
|
|
|
29
29
|
newsroomPrivacyRequests: new NewsroomPrivacyRequests.Client(apiClient),
|
|
30
30
|
newsroomDomains: new NewsroomDomains.Client(apiClient),
|
|
31
31
|
newsroomGalleries: new NewsroomGalleries.Client(apiClient),
|
|
32
|
+
newsroomHub: new NewsroomHub.Client(apiClient),
|
|
32
33
|
senderAddresses: new SenderAddresses.Client(apiClient),
|
|
33
34
|
signup: new Signup.Client(apiClient),
|
|
34
35
|
stories: new Stories.Client(apiClient),
|
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.11.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
|
@@ -21,7 +21,7 @@ class Client {
|
|
|
21
21
|
query: {
|
|
22
22
|
limit,
|
|
23
23
|
offset,
|
|
24
|
-
sort: sortOrder
|
|
24
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -37,7 +37,7 @@ class Client {
|
|
|
37
37
|
return this.apiClient.get(url, {
|
|
38
38
|
query: {
|
|
39
39
|
query: _index.Query.stringify(query),
|
|
40
|
-
sort: sortOrder,
|
|
40
|
+
sort: _index.SortOrder.stringify(sortOrder),
|
|
41
41
|
limit,
|
|
42
42
|
offset
|
|
43
43
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
-
import { Query } from "../../types/index.js";
|
|
2
|
+
import { Query, SortOrder } from "../../types/index.js";
|
|
3
3
|
export class Client {
|
|
4
4
|
constructor(apiClient) {
|
|
5
5
|
this.apiClient = apiClient;
|
|
@@ -15,7 +15,7 @@ export class Client {
|
|
|
15
15
|
query: {
|
|
16
16
|
limit,
|
|
17
17
|
offset,
|
|
18
|
-
sort: sortOrder
|
|
18
|
+
sort: SortOrder.stringify(sortOrder)
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -31,7 +31,7 @@ export class Client {
|
|
|
31
31
|
return this.apiClient.get(url, {
|
|
32
32
|
query: {
|
|
33
33
|
query: Query.stringify(query),
|
|
34
|
-
sort: sortOrder,
|
|
34
|
+
sort: SortOrder.stringify(sortOrder),
|
|
35
35
|
limit,
|
|
36
36
|
offset
|
|
37
37
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { EmailRecipient, Pagination, Query } from '../../types';
|
|
1
|
+
import type { EmailRecipient, Pagination, Query, SortOrder } from '../../types';
|
|
2
2
|
export interface ListOptions {
|
|
3
3
|
limit?: number;
|
|
4
4
|
offset?: number;
|
|
5
|
-
sortOrder?: string;
|
|
5
|
+
sortOrder?: SortOrder | string;
|
|
6
6
|
}
|
|
7
7
|
export interface SearchOptions extends ListOptions {
|
|
8
8
|
query?: Query;
|
|
@@ -23,7 +23,7 @@ class Client {
|
|
|
23
23
|
limit,
|
|
24
24
|
offset,
|
|
25
25
|
query: _index.Query.stringify(query),
|
|
26
|
-
sort: sortOrder
|
|
26
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -39,7 +39,7 @@ class Client {
|
|
|
39
39
|
limit,
|
|
40
40
|
offset,
|
|
41
41
|
query,
|
|
42
|
-
sort: sortOrder
|
|
42
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
-
import { Query } from "../../types/index.js";
|
|
2
|
+
import { Query, SortOrder } from "../../types/index.js";
|
|
3
3
|
import { toIso8601 } from "../../utils.js";
|
|
4
4
|
export class Client {
|
|
5
5
|
constructor(apiClient) {
|
|
@@ -17,7 +17,7 @@ export class Client {
|
|
|
17
17
|
limit,
|
|
18
18
|
offset,
|
|
19
19
|
query: Query.stringify(query),
|
|
20
|
-
sort: sortOrder
|
|
20
|
+
sort: SortOrder.stringify(sortOrder)
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -33,7 +33,7 @@ export class Client {
|
|
|
33
33
|
limit,
|
|
34
34
|
offset,
|
|
35
35
|
query,
|
|
36
|
-
sort: sortOrder
|
|
36
|
+
sort: SortOrder.stringify(sortOrder)
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Campaign, Pagination, Query, SenderAddress, Story, Warning } from '../../types';
|
|
1
|
+
import type { Campaign, Pagination, Query, SenderAddress, SortOrder, Story, Warning } from '../../types';
|
|
2
2
|
export interface CreateRequest {
|
|
3
3
|
subject?: Campaign['subject'];
|
|
4
4
|
sender?: SenderAddress['id'];
|
|
@@ -31,7 +31,7 @@ export interface CampaignResponse {
|
|
|
31
31
|
export interface ListOptions {
|
|
32
32
|
limit?: number;
|
|
33
33
|
offset?: number;
|
|
34
|
-
sortOrder?: string;
|
|
34
|
+
sortOrder?: SortOrder | string;
|
|
35
35
|
}
|
|
36
36
|
export interface SearchOptions extends ListOptions {
|
|
37
37
|
query?: Query;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Client = void 0;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
|
+
var _index = require("../../types/index.cjs");
|
|
8
9
|
class Client {
|
|
9
10
|
constructor(apiClient) {
|
|
10
11
|
this.apiClient = apiClient;
|
|
@@ -23,7 +24,7 @@ class Client {
|
|
|
23
24
|
query: {
|
|
24
25
|
limit,
|
|
25
26
|
offset,
|
|
26
|
-
sort: sortOrder
|
|
27
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -44,7 +45,7 @@ class Client {
|
|
|
44
45
|
limit,
|
|
45
46
|
offset,
|
|
46
47
|
query,
|
|
47
|
-
sort: sortOrder
|
|
48
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
+
import { SortOrder } from "../../types/index.js";
|
|
2
3
|
export class Client {
|
|
3
4
|
constructor(apiClient) {
|
|
4
5
|
this.apiClient = apiClient;
|
|
@@ -17,7 +18,7 @@ export class Client {
|
|
|
17
18
|
query: {
|
|
18
19
|
limit,
|
|
19
20
|
offset,
|
|
20
|
-
sort: sortOrder
|
|
21
|
+
sort: SortOrder.stringify(sortOrder)
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
}
|
|
@@ -38,7 +39,7 @@ export class Client {
|
|
|
38
39
|
limit,
|
|
39
40
|
offset,
|
|
40
41
|
query,
|
|
41
|
-
sort: sortOrder
|
|
42
|
+
sort: SortOrder.stringify(sortOrder)
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
45
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ContactsExport, ContactsScope, Pagination, Query } from '../../types';
|
|
1
|
+
import type { ContactsExport, ContactsScope, Pagination, Query, SortOrder } from '../../types';
|
|
2
2
|
export interface ListOptions {
|
|
3
3
|
limit?: number;
|
|
4
4
|
offset?: number;
|
|
5
|
-
sortOrder?: string;
|
|
5
|
+
sortOrder?: SortOrder | string;
|
|
6
6
|
}
|
|
7
7
|
export interface SearchOptions extends ListOptions {
|
|
8
8
|
query?: Query;
|
|
@@ -24,7 +24,7 @@ class Client {
|
|
|
24
24
|
include_deleted: includeDeleted ? 'on' : undefined,
|
|
25
25
|
limit,
|
|
26
26
|
offset,
|
|
27
|
-
sort: sortOrder
|
|
27
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -45,7 +45,7 @@ class Client {
|
|
|
45
45
|
query: _index.Query.stringify(query),
|
|
46
46
|
limit,
|
|
47
47
|
offset,
|
|
48
|
-
sort: sortOrder
|
|
48
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
-
import { Query } from "../../types/index.js";
|
|
2
|
+
import { Query, SortOrder } from "../../types/index.js";
|
|
3
3
|
export class Client {
|
|
4
4
|
constructor(apiClient) {
|
|
5
5
|
this.apiClient = apiClient;
|
|
@@ -18,7 +18,7 @@ export class Client {
|
|
|
18
18
|
include_deleted: includeDeleted ? 'on' : undefined,
|
|
19
19
|
limit,
|
|
20
20
|
offset,
|
|
21
|
-
sort: sortOrder
|
|
21
|
+
sort: SortOrder.stringify(sortOrder)
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -39,7 +39,7 @@ export class Client {
|
|
|
39
39
|
query: Query.stringify(query),
|
|
40
40
|
limit,
|
|
41
41
|
offset,
|
|
42
|
-
sort: sortOrder
|
|
42
|
+
sort: SortOrder.stringify(sortOrder)
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CultureRef, CountryRef, Contact, CoverageEntry, NewsroomRef, OEmbedInfo, Pagination, Story, Query } from '../../types';
|
|
1
|
+
import type { CultureRef, CountryRef, Contact, CoverageEntry, NewsroomRef, OEmbedInfo, Pagination, Story, Query, SortOrder } from '../../types';
|
|
2
2
|
export declare type Scope = {
|
|
3
3
|
story: Story['id'];
|
|
4
4
|
} | null;
|
|
@@ -53,7 +53,7 @@ export interface ListOptions {
|
|
|
53
53
|
includeDeleted?: boolean;
|
|
54
54
|
limit?: number;
|
|
55
55
|
offset?: number;
|
|
56
|
-
sortOrder?: string;
|
|
56
|
+
sortOrder?: SortOrder | string;
|
|
57
57
|
}
|
|
58
58
|
export interface SearchOptions extends ListOptions {
|
|
59
59
|
query?: Query;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Client = void 0;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
|
+
var _index = require("../../types/index.cjs");
|
|
8
9
|
class Client {
|
|
9
10
|
constructor(apiClient) {
|
|
10
11
|
this.apiClient = apiClient;
|
|
@@ -17,7 +18,7 @@ class Client {
|
|
|
17
18
|
categories
|
|
18
19
|
} = await this.apiClient.get(url, {
|
|
19
20
|
query: {
|
|
20
|
-
sort: sortOrder
|
|
21
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
return categories;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
+
import { SortOrder } from "../../types/index.js";
|
|
2
3
|
export class Client {
|
|
3
4
|
constructor(apiClient) {
|
|
4
5
|
this.apiClient = apiClient;
|
|
@@ -11,7 +12,7 @@ export class Client {
|
|
|
11
12
|
categories
|
|
12
13
|
} = await this.apiClient.get(url, {
|
|
13
14
|
query: {
|
|
14
|
-
sort: sortOrder
|
|
15
|
+
sort: SortOrder.stringify(sortOrder)
|
|
15
16
|
}
|
|
16
17
|
});
|
|
17
18
|
return categories;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SortOrder } from '../../types';
|
|
1
2
|
export interface ListOptions {
|
|
2
3
|
/**
|
|
3
4
|
* Supported sort columns:
|
|
@@ -6,7 +7,7 @@ export interface ListOptions {
|
|
|
6
7
|
* - `display_description`
|
|
7
8
|
* - `stories_number`
|
|
8
9
|
*/
|
|
9
|
-
sortOrder?: string;
|
|
10
|
+
sortOrder?: SortOrder | string;
|
|
10
11
|
}
|
|
11
12
|
export interface CreateRequest {
|
|
12
13
|
i18n: {
|
|
@@ -24,7 +24,7 @@ class Client {
|
|
|
24
24
|
const url = _routing.routing.newsroomGalleriesUrl.replace(':newsroom_id', String(newsroomId));
|
|
25
25
|
return this.apiClient.get(url, {
|
|
26
26
|
query: {
|
|
27
|
-
sort: sortOrder,
|
|
27
|
+
sort: _index.SortOrder.stringify(sortOrder),
|
|
28
28
|
limit: limit,
|
|
29
29
|
offset: offset
|
|
30
30
|
}
|
|
@@ -44,7 +44,7 @@ class Client {
|
|
|
44
44
|
query: {
|
|
45
45
|
scope: _index.Query.stringify(scope),
|
|
46
46
|
query: _index.Query.stringify(query),
|
|
47
|
-
sort: sortOrder,
|
|
47
|
+
sort: _index.SortOrder.stringify(sortOrder),
|
|
48
48
|
limit: limit,
|
|
49
49
|
offset: offset
|
|
50
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
-
import { Query } from "../../types/index.js";
|
|
2
|
+
import { Query, SortOrder } from "../../types/index.js";
|
|
3
3
|
export class Client {
|
|
4
4
|
constructor(apiClient) {
|
|
5
5
|
this.apiClient = apiClient;
|
|
@@ -18,7 +18,7 @@ export class Client {
|
|
|
18
18
|
const url = routing.newsroomGalleriesUrl.replace(':newsroom_id', String(newsroomId));
|
|
19
19
|
return this.apiClient.get(url, {
|
|
20
20
|
query: {
|
|
21
|
-
sort: sortOrder,
|
|
21
|
+
sort: SortOrder.stringify(sortOrder),
|
|
22
22
|
limit: limit,
|
|
23
23
|
offset: offset
|
|
24
24
|
}
|
|
@@ -38,7 +38,7 @@ export class Client {
|
|
|
38
38
|
query: {
|
|
39
39
|
scope: Query.stringify(scope),
|
|
40
40
|
query: Query.stringify(query),
|
|
41
|
-
sort: sortOrder,
|
|
41
|
+
sort: SortOrder.stringify(sortOrder),
|
|
42
42
|
limit: limit,
|
|
43
43
|
offset: offset
|
|
44
44
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { NewsroomGallery, Pagination, Query } from '../../types';
|
|
1
|
+
import type { NewsroomGallery, Pagination, Query, SortOrder } from '../../types';
|
|
2
2
|
export interface ListOptions {
|
|
3
3
|
limit?: number;
|
|
4
4
|
offset?: number;
|
|
5
|
-
sortOrder?: string;
|
|
5
|
+
sortOrder?: SortOrder | string;
|
|
6
6
|
}
|
|
7
7
|
export interface SearchOptions extends ListOptions {
|
|
8
8
|
scope?: Query;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
var _routing = require("../../routing.cjs");
|
|
8
|
+
class Client {
|
|
9
|
+
constructor(apiClient) {
|
|
10
|
+
this.apiClient = apiClient;
|
|
11
|
+
}
|
|
12
|
+
async list(newsroomId) {
|
|
13
|
+
const url = _routing.routing.newsroomHubUrl.replace(':newsroom_id', String(newsroomId));
|
|
14
|
+
const {
|
|
15
|
+
members
|
|
16
|
+
} = await this.apiClient.get(url);
|
|
17
|
+
return members;
|
|
18
|
+
}
|
|
19
|
+
async link(newsroomId, payload) {
|
|
20
|
+
const url = _routing.routing.newsroomHubUrl.replace(':newsroom_id', String(newsroomId));
|
|
21
|
+
const {
|
|
22
|
+
members
|
|
23
|
+
} = await this.apiClient.post(url, {
|
|
24
|
+
payload
|
|
25
|
+
});
|
|
26
|
+
return members;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Client = Client;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DeferredJobsApiClient } from '../../api';
|
|
2
|
+
import type { NewsroomRef } from '../../types';
|
|
3
|
+
import type { LinkRequest } from './types';
|
|
4
|
+
declare type NewsroomId = NewsroomRef['uuid'] | NewsroomRef['id'];
|
|
5
|
+
export declare class Client {
|
|
6
|
+
private readonly apiClient;
|
|
7
|
+
constructor(apiClient: DeferredJobsApiClient);
|
|
8
|
+
list(newsroomId: NewsroomId): Promise<NewsroomRef[]>;
|
|
9
|
+
link(newsroomId: NewsroomId, payload: LinkRequest): Promise<NewsroomRef[]>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { routing } from "../../routing.js";
|
|
2
|
+
export class Client {
|
|
3
|
+
constructor(apiClient) {
|
|
4
|
+
this.apiClient = apiClient;
|
|
5
|
+
}
|
|
6
|
+
async list(newsroomId) {
|
|
7
|
+
const url = routing.newsroomHubUrl.replace(':newsroom_id', String(newsroomId));
|
|
8
|
+
const {
|
|
9
|
+
members
|
|
10
|
+
} = await this.apiClient.get(url);
|
|
11
|
+
return members;
|
|
12
|
+
}
|
|
13
|
+
async link(newsroomId, payload) {
|
|
14
|
+
const url = routing.newsroomHubUrl.replace(':newsroom_id', String(newsroomId));
|
|
15
|
+
const {
|
|
16
|
+
members
|
|
17
|
+
} = await this.apiClient.post(url, {
|
|
18
|
+
payload
|
|
19
|
+
});
|
|
20
|
+
return members;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Client = require("./Client.cjs");
|
|
7
|
+
Object.keys(_Client).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
Object.defineProperty(exports, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _Client[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _types[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NewsroomRef } from '../../types';
|
|
2
|
+
declare type NewsroomId = NewsroomRef['uuid'] | NewsroomRef['id'];
|
|
3
|
+
export interface ListResponse {
|
|
4
|
+
members: NewsroomRef[];
|
|
5
|
+
}
|
|
6
|
+
export interface LinkRequest {
|
|
7
|
+
members: NewsroomId[];
|
|
8
|
+
}
|
|
9
|
+
export interface LinkResponse {
|
|
10
|
+
members: NewsroomRef[];
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Client = void 0;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
|
+
var _index = require("../../types/index.cjs");
|
|
8
9
|
var _lib = require("./lib.cjs");
|
|
9
10
|
class Client {
|
|
10
11
|
constructor(apiClient) {
|
|
@@ -16,7 +17,7 @@ class Client {
|
|
|
16
17
|
const url = _routing.routing.newsroomLanguagesUrl.replace(':newsroom_id', String(newsroomId));
|
|
17
18
|
return this.apiClient.get(url, {
|
|
18
19
|
query: {
|
|
19
|
-
sort: sortOrder
|
|
20
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
+
import { SortOrder } from "../../types/index.js";
|
|
2
3
|
import { isUnsafeNewsroomUpdateErrorResponse } from "./lib.js";
|
|
3
4
|
export class Client {
|
|
4
5
|
constructor(apiClient) {
|
|
@@ -10,7 +11,7 @@ export class Client {
|
|
|
10
11
|
const url = routing.newsroomLanguagesUrl.replace(':newsroom_id', String(newsroomId));
|
|
11
12
|
return this.apiClient.get(url, {
|
|
12
13
|
query: {
|
|
13
|
-
sort: sortOrder
|
|
14
|
+
sort: SortOrder.stringify(sortOrder)
|
|
14
15
|
}
|
|
15
16
|
});
|
|
16
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CultureRef, NewsroomLanguageSettings } from '../../types';
|
|
1
|
+
import type { CultureRef, NewsroomLanguageSettings, SortOrder } from '../../types';
|
|
2
2
|
export interface ListOptions {
|
|
3
|
-
sortOrder?: string;
|
|
3
|
+
sortOrder?: SortOrder | string;
|
|
4
4
|
}
|
|
5
5
|
export interface ListResponse {
|
|
6
6
|
languages: NewsroomLanguageSettings[];
|
|
@@ -21,7 +21,7 @@ class Client {
|
|
|
21
21
|
limit,
|
|
22
22
|
offset,
|
|
23
23
|
search,
|
|
24
|
-
sort: sortOrder
|
|
24
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -40,7 +40,7 @@ class Client {
|
|
|
40
40
|
limit,
|
|
41
41
|
offset,
|
|
42
42
|
search,
|
|
43
|
-
sort: sortOrder
|
|
43
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
-
import { Query } from "../../types/index.js";
|
|
2
|
+
import { Query, SortOrder } from "../../types/index.js";
|
|
3
3
|
export class Client {
|
|
4
4
|
constructor(apiClient) {
|
|
5
5
|
this.apiClient = apiClient;
|
|
@@ -15,7 +15,7 @@ export class Client {
|
|
|
15
15
|
limit,
|
|
16
16
|
offset,
|
|
17
17
|
search,
|
|
18
|
-
sort: sortOrder
|
|
18
|
+
sort: SortOrder.stringify(sortOrder)
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -34,7 +34,7 @@ export class Client {
|
|
|
34
34
|
limit,
|
|
35
35
|
offset,
|
|
36
36
|
search,
|
|
37
|
-
sort: sortOrder
|
|
37
|
+
sort: SortOrder.stringify(sortOrder)
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CultureRef, Newsroom, Pagination, Query } from '../../types';
|
|
1
|
+
import type { CultureRef, Newsroom, Pagination, Query, SortOrder } from '../../types';
|
|
2
2
|
export interface ListOptions {
|
|
3
3
|
limit?: number;
|
|
4
4
|
offset?: number;
|
|
@@ -6,7 +6,7 @@ export interface ListOptions {
|
|
|
6
6
|
* Text search keyword.
|
|
7
7
|
*/
|
|
8
8
|
search?: string;
|
|
9
|
-
sortOrder?: string;
|
|
9
|
+
sortOrder?: SortOrder | string;
|
|
10
10
|
}
|
|
11
11
|
export interface SearchOptions extends ListOptions {
|
|
12
12
|
/**
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Client = void 0;
|
|
7
7
|
var _index = require("../../http/index.cjs");
|
|
8
8
|
var _routing = require("../../routing.cjs");
|
|
9
|
+
var _index2 = require("../../types/index.cjs");
|
|
9
10
|
class Client {
|
|
10
11
|
constructor(apiClient) {
|
|
11
12
|
this.apiClient = apiClient;
|
|
@@ -21,7 +22,7 @@ class Client {
|
|
|
21
22
|
query: {
|
|
22
23
|
limit,
|
|
23
24
|
offset,
|
|
24
|
-
sort: sortOrder,
|
|
25
|
+
sort: _index2.SortOrder.stringify(sortOrder),
|
|
25
26
|
include: include ? include.join(',') : undefined
|
|
26
27
|
}
|
|
27
28
|
});
|
|
@@ -39,7 +40,7 @@ class Client {
|
|
|
39
40
|
query,
|
|
40
41
|
limit,
|
|
41
42
|
offset,
|
|
42
|
-
sort: sortOrder,
|
|
43
|
+
sort: _index2.SortOrder.stringify(sortOrder),
|
|
43
44
|
include: include ? include.join(',') : undefined
|
|
44
45
|
}
|
|
45
46
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiError, HttpCodes } from "../../http/index.js";
|
|
2
2
|
import { routing } from "../../routing.js";
|
|
3
|
+
import { SortOrder } from "../../types/index.js";
|
|
3
4
|
export class Client {
|
|
4
5
|
constructor(apiClient) {
|
|
5
6
|
this.apiClient = apiClient;
|
|
@@ -15,7 +16,7 @@ export class Client {
|
|
|
15
16
|
query: {
|
|
16
17
|
limit,
|
|
17
18
|
offset,
|
|
18
|
-
sort: sortOrder,
|
|
19
|
+
sort: SortOrder.stringify(sortOrder),
|
|
19
20
|
include: include ? include.join(',') : undefined
|
|
20
21
|
}
|
|
21
22
|
});
|
|
@@ -33,7 +34,7 @@ export class Client {
|
|
|
33
34
|
query,
|
|
34
35
|
limit,
|
|
35
36
|
offset,
|
|
36
|
-
sort: sortOrder,
|
|
37
|
+
sort: SortOrder.stringify(sortOrder),
|
|
37
38
|
include: include ? include.join(',') : undefined
|
|
38
39
|
}
|
|
39
40
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Category, CategoryRef, CultureRef, ExtendedStory, Newsroom, NewsroomContactRef, Pagination, Query, Story } from '../../types';
|
|
1
|
+
import type { Category, CategoryRef, CultureRef, ExtendedStory, Newsroom, NewsroomContactRef, Pagination, Query, SortOrder, Story } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Uploadcare image JSON string.
|
|
4
4
|
*/
|
|
@@ -50,7 +50,7 @@ export interface IncludeOptions<Include extends readonly (keyof Story.ExtraField
|
|
|
50
50
|
export interface ListOptions<Include extends readonly (keyof Story.ExtraFields)[]> {
|
|
51
51
|
limit?: number;
|
|
52
52
|
offset?: number;
|
|
53
|
-
sortOrder?: string;
|
|
53
|
+
sortOrder?: SortOrder | string;
|
|
54
54
|
include?: Include;
|
|
55
55
|
}
|
|
56
56
|
export interface SearchOptions<Include extends readonly (keyof Story.ExtraFields)[]> extends ListOptions<Include> {
|
package/dist/endpoints/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.NotificationSubscriptions = exports.Subscriptions = exports.Stories = exports.Snippets = exports.Signup = exports.SenderAddresses = exports.NewsroomWebhooks = exports.NewsroomThemes = exports.NewsroomSubscriptions = exports.Newsrooms = exports.NewsroomPrivacyRequests = exports.NewsroomLanguages = exports.NewsroomGalleries = exports.NewsroomDomains = exports.NewsroomContacts = exports.NewsroomCategories = exports.Licenses = exports.Jobs = exports.Coverage = exports.ContactsExports = exports.Campaigns = exports.CampaignRecipients = exports.Billing = exports.Accounts = void 0;
|
|
6
|
+
exports.NotificationSubscriptions = exports.Subscriptions = exports.Stories = exports.Snippets = exports.Signup = exports.SenderAddresses = exports.NewsroomWebhooks = exports.NewsroomThemes = exports.NewsroomSubscriptions = exports.Newsrooms = exports.NewsroomPrivacyRequests = exports.NewsroomLanguages = exports.NewsroomHub = exports.NewsroomGalleries = exports.NewsroomDomains = exports.NewsroomContacts = exports.NewsroomCategories = exports.Licenses = exports.Jobs = exports.Coverage = exports.ContactsExports = exports.Campaigns = exports.CampaignRecipients = exports.Billing = exports.Accounts = void 0;
|
|
7
7
|
var _Accounts = _interopRequireWildcard(require("./Accounts/index.cjs"));
|
|
8
8
|
exports.Accounts = _Accounts;
|
|
9
9
|
var _Billing = _interopRequireWildcard(require("./Billing/index.cjs"));
|
|
@@ -28,6 +28,8 @@ var _NewsroomDomains = _interopRequireWildcard(require("./NewsroomDomains/index.
|
|
|
28
28
|
exports.NewsroomDomains = _NewsroomDomains;
|
|
29
29
|
var _NewsroomGalleries = _interopRequireWildcard(require("./NewsroomGalleries/index.cjs"));
|
|
30
30
|
exports.NewsroomGalleries = _NewsroomGalleries;
|
|
31
|
+
var _NewsroomHub = _interopRequireWildcard(require("./NewsroomHub/index.cjs"));
|
|
32
|
+
exports.NewsroomHub = _NewsroomHub;
|
|
31
33
|
var _NewsroomLanguages = _interopRequireWildcard(require("./NewsroomLanguages/index.cjs"));
|
|
32
34
|
exports.NewsroomLanguages = _NewsroomLanguages;
|
|
33
35
|
var _NewsroomPrivacyRequests = _interopRequireWildcard(require("./NewsroomPrivacyRequests/index.cjs"));
|
|
@@ -10,6 +10,7 @@ export * as NewsroomCategories from './NewsroomCategories';
|
|
|
10
10
|
export * as NewsroomContacts from './NewsroomContacts';
|
|
11
11
|
export * as NewsroomDomains from './NewsroomDomains';
|
|
12
12
|
export * as NewsroomGalleries from './NewsroomGalleries';
|
|
13
|
+
export * as NewsroomHub from './NewsroomHub';
|
|
13
14
|
export * as NewsroomLanguages from './NewsroomLanguages';
|
|
14
15
|
export * as NewsroomPrivacyRequests from './NewsroomPrivacyRequests';
|
|
15
16
|
export * as Newsrooms from './Newsrooms';
|
package/dist/endpoints/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * as NewsroomCategories from "./NewsroomCategories/index.js";
|
|
|
10
10
|
export * as NewsroomContacts from "./NewsroomContacts/index.js";
|
|
11
11
|
export * as NewsroomDomains from "./NewsroomDomains/index.js";
|
|
12
12
|
export * as NewsroomGalleries from "./NewsroomGalleries/index.js";
|
|
13
|
+
export * as NewsroomHub from "./NewsroomHub/index.js";
|
|
13
14
|
export * as NewsroomLanguages from "./NewsroomLanguages/index.js";
|
|
14
15
|
export * as NewsroomPrivacyRequests from "./NewsroomPrivacyRequests/index.js";
|
|
15
16
|
export * as Newsrooms from "./Newsrooms/index.js";
|
package/dist/routing.cjs
CHANGED
|
@@ -27,6 +27,7 @@ const routing = {
|
|
|
27
27
|
newsroomPrivacyRequestsUrl: '/v2/newsrooms/:newsroom_id/privacy-requests',
|
|
28
28
|
newsroomDomainsUrl: '/v2/newsrooms/:newsroom_id/domains',
|
|
29
29
|
newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
|
|
30
|
+
newsroomHubUrl: '/v2/newsrooms/:newsroom_id/hub',
|
|
30
31
|
notificationSubscriptionsUrl: '/v2/notification-subscriptions',
|
|
31
32
|
senderAddressesUrl: '/v2/sender-addresses',
|
|
32
33
|
signup: '/v2/signup',
|
package/dist/routing.d.ts
CHANGED
package/dist/routing.js
CHANGED
|
@@ -21,6 +21,7 @@ export const routing = {
|
|
|
21
21
|
newsroomPrivacyRequestsUrl: '/v2/newsrooms/:newsroom_id/privacy-requests',
|
|
22
22
|
newsroomDomainsUrl: '/v2/newsrooms/:newsroom_id/domains',
|
|
23
23
|
newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
|
|
24
|
+
newsroomHubUrl: '/v2/newsrooms/:newsroom_id/hub',
|
|
24
25
|
notificationSubscriptionsUrl: '/v2/notification-subscriptions',
|
|
25
26
|
senderAddressesUrl: '/v2/sender-addresses',
|
|
26
27
|
signup: '/v2/signup',
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SortOrder = void 0;
|
|
7
|
+
let SortOrder;
|
|
8
|
+
exports.SortOrder = SortOrder;
|
|
9
|
+
(function (_SortOrder) {
|
|
10
|
+
let Direction;
|
|
11
|
+
(function (Direction) {
|
|
12
|
+
Direction["ASC"] = "asc";
|
|
13
|
+
Direction["DESC"] = "desc";
|
|
14
|
+
})(Direction || (Direction = {}));
|
|
15
|
+
_SortOrder.Direction = Direction;
|
|
16
|
+
function empty() {
|
|
17
|
+
return {
|
|
18
|
+
columns: []
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
_SortOrder.empty = empty;
|
|
22
|
+
function isEmpty(sortOrder) {
|
|
23
|
+
if (typeof sortOrder === 'undefined') {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return toObject(sortOrder).columns.length === 0;
|
|
27
|
+
}
|
|
28
|
+
_SortOrder.isEmpty = isEmpty;
|
|
29
|
+
function asc(column) {
|
|
30
|
+
validateColumnName(column);
|
|
31
|
+
return {
|
|
32
|
+
columns: [{
|
|
33
|
+
name: column,
|
|
34
|
+
direction: Direction.ASC
|
|
35
|
+
}]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
_SortOrder.asc = asc;
|
|
39
|
+
function desc(column) {
|
|
40
|
+
validateColumnName(column);
|
|
41
|
+
return {
|
|
42
|
+
columns: [{
|
|
43
|
+
name: column,
|
|
44
|
+
direction: Direction.DESC
|
|
45
|
+
}]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
_SortOrder.desc = desc;
|
|
49
|
+
function parse(sortOrder) {
|
|
50
|
+
if (typeof sortOrder === 'undefined') {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const columns = sortOrder.split(',').map(parseColumn);
|
|
54
|
+
return {
|
|
55
|
+
columns
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
_SortOrder.parse = parse;
|
|
59
|
+
function stringify(sortOrder) {
|
|
60
|
+
if (typeof sortOrder === 'undefined') {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (typeof sortOrder === 'string') {
|
|
64
|
+
return sortOrder;
|
|
65
|
+
}
|
|
66
|
+
if (isEmpty(sortOrder)) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return toString(sortOrder);
|
|
70
|
+
}
|
|
71
|
+
_SortOrder.stringify = stringify;
|
|
72
|
+
function combine(sortOrder, another) {
|
|
73
|
+
if (typeof sortOrder === 'string' && typeof another === 'string') {
|
|
74
|
+
const combined = stringify(combine(toObject(sortOrder), toObject(another)));
|
|
75
|
+
if (typeof combined === 'undefined') {
|
|
76
|
+
throw new Error('stringify() cannot return undefined. This should never happen.');
|
|
77
|
+
}
|
|
78
|
+
return combined;
|
|
79
|
+
}
|
|
80
|
+
if (typeof sortOrder === 'object' && typeof another === 'object') {
|
|
81
|
+
return {
|
|
82
|
+
columns: [...sortOrder.columns, ...toObject(another).columns]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
throw new Error('Both arguments of combine() should be of the same type.');
|
|
86
|
+
}
|
|
87
|
+
_SortOrder.combine = combine;
|
|
88
|
+
})(SortOrder || (exports.SortOrder = SortOrder = {}));
|
|
89
|
+
function toObject(sortOrder) {
|
|
90
|
+
return typeof sortOrder === 'string' ? SortOrder.parse(sortOrder) : sortOrder;
|
|
91
|
+
}
|
|
92
|
+
function parseColumn(column) {
|
|
93
|
+
if (column.startsWith('+')) {
|
|
94
|
+
const [, name] = column.split('+');
|
|
95
|
+
validateColumnName(name);
|
|
96
|
+
return {
|
|
97
|
+
name,
|
|
98
|
+
direction: SortOrder.Direction.ASC
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (column.startsWith('-')) {
|
|
102
|
+
const [, name] = column.split('-');
|
|
103
|
+
validateColumnName(name);
|
|
104
|
+
return {
|
|
105
|
+
name,
|
|
106
|
+
direction: SortOrder.Direction.DESC
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
validateColumnName(column);
|
|
110
|
+
return {
|
|
111
|
+
name: column,
|
|
112
|
+
direction: SortOrder.Direction.ASC
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function toString(arg) {
|
|
116
|
+
if (arg === SortOrder.Direction.ASC) {
|
|
117
|
+
return '+';
|
|
118
|
+
}
|
|
119
|
+
if (arg === SortOrder.Direction.DESC) {
|
|
120
|
+
return '-';
|
|
121
|
+
}
|
|
122
|
+
if ('columns' in arg) {
|
|
123
|
+
return arg.columns.map(toString).join(',');
|
|
124
|
+
}
|
|
125
|
+
return `${toString(arg.direction)}${arg.name}`;
|
|
126
|
+
}
|
|
127
|
+
function validateColumnName(name) {
|
|
128
|
+
if (name.length === 0) {
|
|
129
|
+
throw new Error(`Invalid sort column name: '${name}'.`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SortOrder {
|
|
2
|
+
columns: SortOrder.Column[];
|
|
3
|
+
}
|
|
4
|
+
export declare namespace SortOrder {
|
|
5
|
+
enum Direction {
|
|
6
|
+
ASC = "asc",
|
|
7
|
+
DESC = "desc"
|
|
8
|
+
}
|
|
9
|
+
interface Column {
|
|
10
|
+
name: string;
|
|
11
|
+
direction: Direction;
|
|
12
|
+
}
|
|
13
|
+
function empty(): SortOrder;
|
|
14
|
+
function isEmpty(sortOrder: SortOrder | string | undefined): boolean;
|
|
15
|
+
function asc(column: string): SortOrder;
|
|
16
|
+
function desc(column: string): SortOrder;
|
|
17
|
+
function parse(sortOrder: string): SortOrder;
|
|
18
|
+
function parse(sortOrder: string | undefined): SortOrder | undefined;
|
|
19
|
+
function stringify(sortOrder: SortOrder | string | undefined): string | undefined;
|
|
20
|
+
function combine(sortOrder: string, append: string): string;
|
|
21
|
+
function combine(sortOrder: SortOrder, append: SortOrder): SortOrder;
|
|
22
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export let SortOrder;
|
|
2
|
+
(function (_SortOrder) {
|
|
3
|
+
let Direction;
|
|
4
|
+
(function (Direction) {
|
|
5
|
+
Direction["ASC"] = "asc";
|
|
6
|
+
Direction["DESC"] = "desc";
|
|
7
|
+
})(Direction || (Direction = {}));
|
|
8
|
+
_SortOrder.Direction = Direction;
|
|
9
|
+
function empty() {
|
|
10
|
+
return {
|
|
11
|
+
columns: []
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
_SortOrder.empty = empty;
|
|
15
|
+
function isEmpty(sortOrder) {
|
|
16
|
+
if (typeof sortOrder === 'undefined') {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return toObject(sortOrder).columns.length === 0;
|
|
20
|
+
}
|
|
21
|
+
_SortOrder.isEmpty = isEmpty;
|
|
22
|
+
function asc(column) {
|
|
23
|
+
validateColumnName(column);
|
|
24
|
+
return {
|
|
25
|
+
columns: [{
|
|
26
|
+
name: column,
|
|
27
|
+
direction: Direction.ASC
|
|
28
|
+
}]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
_SortOrder.asc = asc;
|
|
32
|
+
function desc(column) {
|
|
33
|
+
validateColumnName(column);
|
|
34
|
+
return {
|
|
35
|
+
columns: [{
|
|
36
|
+
name: column,
|
|
37
|
+
direction: Direction.DESC
|
|
38
|
+
}]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
_SortOrder.desc = desc;
|
|
42
|
+
function parse(sortOrder) {
|
|
43
|
+
if (typeof sortOrder === 'undefined') {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const columns = sortOrder.split(',').map(parseColumn);
|
|
47
|
+
return {
|
|
48
|
+
columns
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
_SortOrder.parse = parse;
|
|
52
|
+
function stringify(sortOrder) {
|
|
53
|
+
if (typeof sortOrder === 'undefined') {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (typeof sortOrder === 'string') {
|
|
57
|
+
return sortOrder;
|
|
58
|
+
}
|
|
59
|
+
if (isEmpty(sortOrder)) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
return toString(sortOrder);
|
|
63
|
+
}
|
|
64
|
+
_SortOrder.stringify = stringify;
|
|
65
|
+
function combine(sortOrder, another) {
|
|
66
|
+
if (typeof sortOrder === 'string' && typeof another === 'string') {
|
|
67
|
+
const combined = stringify(combine(toObject(sortOrder), toObject(another)));
|
|
68
|
+
if (typeof combined === 'undefined') {
|
|
69
|
+
throw new Error('stringify() cannot return undefined. This should never happen.');
|
|
70
|
+
}
|
|
71
|
+
return combined;
|
|
72
|
+
}
|
|
73
|
+
if (typeof sortOrder === 'object' && typeof another === 'object') {
|
|
74
|
+
return {
|
|
75
|
+
columns: [...sortOrder.columns, ...toObject(another).columns]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
throw new Error('Both arguments of combine() should be of the same type.');
|
|
79
|
+
}
|
|
80
|
+
_SortOrder.combine = combine;
|
|
81
|
+
})(SortOrder || (SortOrder = {}));
|
|
82
|
+
function toObject(sortOrder) {
|
|
83
|
+
return typeof sortOrder === 'string' ? SortOrder.parse(sortOrder) : sortOrder;
|
|
84
|
+
}
|
|
85
|
+
function parseColumn(column) {
|
|
86
|
+
if (column.startsWith('+')) {
|
|
87
|
+
const [, name] = column.split('+');
|
|
88
|
+
validateColumnName(name);
|
|
89
|
+
return {
|
|
90
|
+
name,
|
|
91
|
+
direction: SortOrder.Direction.ASC
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (column.startsWith('-')) {
|
|
95
|
+
const [, name] = column.split('-');
|
|
96
|
+
validateColumnName(name);
|
|
97
|
+
return {
|
|
98
|
+
name,
|
|
99
|
+
direction: SortOrder.Direction.DESC
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
validateColumnName(column);
|
|
103
|
+
return {
|
|
104
|
+
name: column,
|
|
105
|
+
direction: SortOrder.Direction.ASC
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function toString(arg) {
|
|
109
|
+
if (arg === SortOrder.Direction.ASC) {
|
|
110
|
+
return '+';
|
|
111
|
+
}
|
|
112
|
+
if (arg === SortOrder.Direction.DESC) {
|
|
113
|
+
return '-';
|
|
114
|
+
}
|
|
115
|
+
if ('columns' in arg) {
|
|
116
|
+
return arg.columns.map(toString).join(',');
|
|
117
|
+
}
|
|
118
|
+
return `${toString(arg.direction)}${arg.name}`;
|
|
119
|
+
}
|
|
120
|
+
function validateColumnName(name) {
|
|
121
|
+
if (name.length === 0) {
|
|
122
|
+
throw new Error(`Invalid sort column name: '${name}'.`);
|
|
123
|
+
}
|
|
124
|
+
}
|
package/dist/types/index.cjs
CHANGED
|
@@ -283,6 +283,16 @@ Object.keys(_Snippet).forEach(function (key) {
|
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
285
|
});
|
|
286
|
+
var _SortOrder = require("./SortOrder.cjs");
|
|
287
|
+
Object.keys(_SortOrder).forEach(function (key) {
|
|
288
|
+
if (key === "default" || key === "__esModule") return;
|
|
289
|
+
Object.defineProperty(exports, key, {
|
|
290
|
+
enumerable: true,
|
|
291
|
+
get: function () {
|
|
292
|
+
return _SortOrder[key];
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
});
|
|
286
296
|
var _Story = require("./Story.cjs");
|
|
287
297
|
Object.keys(_Story).forEach(function (key) {
|
|
288
298
|
if (key === "default" || key === "__esModule") return;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export * from "./PrivacyRequest.js";
|
|
|
27
27
|
export * from "./SenderAddress.js";
|
|
28
28
|
export * from "./SenderDomain.js";
|
|
29
29
|
export * from "./Snippet.js";
|
|
30
|
+
export * from "./SortOrder.js";
|
|
30
31
|
export * from "./Story.js";
|
|
31
32
|
export * from "./User.js";
|
|
32
33
|
export * from "./UserAccount.js";
|