@flexbe/sdk 0.2.32 → 0.2.33
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/README.md +6 -4
- package/dist/browser/client/api-client.js +19 -9
- package/dist/browser/client/client.js +1 -1
- package/dist/browser/client/meta-api.js +3 -3
- package/dist/browser/client/pages.js +43 -9
- package/dist/browser/client/token-manager.js +33 -24
- package/dist/cjs/client/api-client.js +8 -8
- package/dist/cjs/client/client.js +1 -1
- package/dist/cjs/client/meta-api.js +3 -3
- package/dist/cjs/client/pages.js +44 -13
- package/dist/cjs/client/token-manager.js +33 -24
- package/dist/esm/client/api-client.js +9 -9
- package/dist/esm/client/client.js +1 -1
- package/dist/esm/client/meta-api.js +3 -3
- package/dist/esm/client/pages.js +44 -13
- package/dist/esm/client/token-manager.js +33 -24
- package/dist/types/client/api-client.d.ts +1 -1
- package/dist/types/client/client.d.ts +2 -2
- package/dist/types/client/meta-api.d.ts +2 -2
- package/dist/types/client/pages.d.ts +30 -7
- package/dist/types/client/site-api.d.ts +1 -1
- package/dist/types/client/stat.d.ts +2 -2
- package/dist/types/client/token-manager.d.ts +1 -0
- package/dist/types/types/pages.d.ts +14 -2
- package/package.json +61 -64
- package/dist/browser/client/auth.js +0 -74
- package/dist/cjs/client/auth.js +0 -63
- package/dist/client/flexbe-client.d.ts +0 -13
- package/dist/client/flexbe-client.js +0 -62
- package/dist/esm/client/auth.js +0 -59
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -18
- package/dist/src/client/flexbe-client.d.ts +0 -20
- package/dist/src/client/flexbe-client.js +0 -86
- package/dist/src/client/pages-client.d.ts +0 -14
- package/dist/src/client/pages-client.js +0 -23
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.js +0 -20
- package/dist/src/types/index.d.ts +0 -23
- package/dist/src/types/index.js +0 -2
- package/dist/src/types/pages.d.ts +0 -41
- package/dist/src/types/pages.js +0 -19
- package/dist/test/client/flexbe-client.test.d.ts +0 -1
- package/dist/test/client/flexbe-client.test.js +0 -38
- package/dist/test/client/pages-client.test.d.ts +0 -1
- package/dist/test/client/pages-client.test.js +0 -82
- package/dist/types/client/auth.d.ts +0 -11
- package/dist/types/index.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BadRequestException, FlexbeAuthType, ForbiddenException, NotFoundException, ServerException, TimeoutException, UnauthorizedException } from '../types';
|
|
2
2
|
import { TokenManager } from './token-manager';
|
|
3
3
|
export class ApiClient {
|
|
4
4
|
constructor(config) {
|
|
@@ -19,7 +19,7 @@ export class ApiClient {
|
|
|
19
19
|
if (!token) {
|
|
20
20
|
throw new Error('No valid bearer token available');
|
|
21
21
|
}
|
|
22
|
-
headers
|
|
22
|
+
headers.Authorization = `Bearer ${token}`;
|
|
23
23
|
}
|
|
24
24
|
return headers;
|
|
25
25
|
}
|
|
@@ -54,7 +54,7 @@ export class ApiClient {
|
|
|
54
54
|
const defaultError = {
|
|
55
55
|
message: response.statusText,
|
|
56
56
|
error: response.statusText,
|
|
57
|
-
statusCode: response.status
|
|
57
|
+
statusCode: response.status,
|
|
58
58
|
};
|
|
59
59
|
const errorData = await response.json().catch(() => defaultError);
|
|
60
60
|
switch (errorData.statusCode) {
|
|
@@ -76,7 +76,7 @@ export class ApiClient {
|
|
|
76
76
|
message: errorData.message,
|
|
77
77
|
error: errorData.error,
|
|
78
78
|
statusCode: errorData.statusCode,
|
|
79
|
-
errors: errorData.errors
|
|
79
|
+
errors: errorData.errors,
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -105,19 +105,19 @@ export class ApiClient {
|
|
|
105
105
|
throw error;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
get(url, config) {
|
|
108
|
+
async get(url, config) {
|
|
109
109
|
return this.request({ ...config, url, method: 'GET' });
|
|
110
110
|
}
|
|
111
|
-
post(url, data, config) {
|
|
111
|
+
async post(url, data, config) {
|
|
112
112
|
return this.request({ ...config, url, method: 'POST', body: JSON.stringify(data) });
|
|
113
113
|
}
|
|
114
|
-
put(url, data, config) {
|
|
114
|
+
async put(url, data, config) {
|
|
115
115
|
return this.request({ ...config, url, method: 'PUT', body: JSON.stringify(data) });
|
|
116
116
|
}
|
|
117
|
-
patch(url, data, config) {
|
|
117
|
+
async patch(url, data, config) {
|
|
118
118
|
return this.request({ ...config, url, method: 'PATCH', body: JSON.stringify(data) });
|
|
119
119
|
}
|
|
120
|
-
delete(url, config) {
|
|
120
|
+
async delete(url, config) {
|
|
121
121
|
return this.request({ ...config, url, method: 'DELETE' });
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlexbeAuthType } from '../types';
|
|
2
2
|
import { ApiClient } from './api-client';
|
|
3
|
-
import { SiteApi } from './site-api';
|
|
4
3
|
import { MetaApi } from './meta-api';
|
|
4
|
+
import { SiteApi } from './site-api';
|
|
5
5
|
import { TokenManager } from './token-manager';
|
|
6
6
|
export class FlexbeClient {
|
|
7
7
|
constructor(config) {
|
|
@@ -8,7 +8,7 @@ export class MetaApi {
|
|
|
8
8
|
*/
|
|
9
9
|
async getSiteLanguages() {
|
|
10
10
|
const response = await this.api.get('/meta/site-languages', {
|
|
11
|
-
headers: {
|
|
11
|
+
headers: { Authorization: '' },
|
|
12
12
|
});
|
|
13
13
|
return response.data;
|
|
14
14
|
}
|
|
@@ -18,7 +18,7 @@ export class MetaApi {
|
|
|
18
18
|
*/
|
|
19
19
|
async getUserLanguages() {
|
|
20
20
|
const response = await this.api.get('/meta/user-languages', {
|
|
21
|
-
headers: {
|
|
21
|
+
headers: { Authorization: '' },
|
|
22
22
|
});
|
|
23
23
|
return response.data;
|
|
24
24
|
}
|
|
@@ -28,7 +28,7 @@ export class MetaApi {
|
|
|
28
28
|
*/
|
|
29
29
|
async getSiteCurrencies() {
|
|
30
30
|
const response = await this.api.get('/meta/site-currencies', {
|
|
31
|
-
headers: {
|
|
31
|
+
headers: { Authorization: '' },
|
|
32
32
|
});
|
|
33
33
|
return response.data;
|
|
34
34
|
}
|
package/dist/esm/client/pages.js
CHANGED
|
@@ -20,11 +20,13 @@ export class Pages {
|
|
|
20
20
|
* @throws {TimeoutException} When the request times out
|
|
21
21
|
*/
|
|
22
22
|
async getPages(params) {
|
|
23
|
-
const processedParams = params
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const processedParams = params
|
|
24
|
+
? {
|
|
25
|
+
...params,
|
|
26
|
+
type: Array.isArray(params.type) ? params.type.join(',') : params.type,
|
|
27
|
+
status: Array.isArray(params.status) ? params.status.join(',') : params.status,
|
|
28
|
+
}
|
|
29
|
+
: undefined;
|
|
28
30
|
const response = await this.api.get(`/sites/${this.siteId}/pages`, { params: processedParams });
|
|
29
31
|
return response.data;
|
|
30
32
|
}
|
|
@@ -123,6 +125,7 @@ export class Pages {
|
|
|
123
125
|
* @param pageId - ID of the page to update
|
|
124
126
|
* @param data - Update parameters including:
|
|
125
127
|
* - status: New status for the page
|
|
128
|
+
* - versionId: ID of the version to set as current
|
|
126
129
|
* - name: New name for the page (max 150 characters)
|
|
127
130
|
* - uri: New URI for the page (max 255 characters, automatically normalized with leading and trailing slashes)
|
|
128
131
|
* - language: New language for the page
|
|
@@ -136,10 +139,9 @@ export class Pages {
|
|
|
136
139
|
* - ogTitle: Open Graph title for social sharing (max 200 characters)
|
|
137
140
|
* - ogDescription: Open Graph description for social sharing (max 1000 characters)
|
|
138
141
|
* - noindex: Whether to prevent search engine indexing
|
|
139
|
-
* - grid: Grid configuration for the page
|
|
140
142
|
* @throws {UnauthorizedException} When the API key is invalid or expired
|
|
141
|
-
* @throws {NotFoundException} When the page is not found
|
|
142
|
-
* @throws {ForbiddenException} When the page does not belong to the site
|
|
143
|
+
* @throws {NotFoundException} When the page or version is not found
|
|
144
|
+
* @throws {ForbiddenException} When the page does not belong to the site or version belongs to a different page
|
|
143
145
|
* @throws {BadRequestException} When the update parameters are invalid
|
|
144
146
|
* @throws {ServerException} When the server encounters an error
|
|
145
147
|
* @throws {TimeoutException} When the request times out
|
|
@@ -205,7 +207,7 @@ export class Pages {
|
|
|
205
207
|
*/
|
|
206
208
|
async bulkDeletePages(ids) {
|
|
207
209
|
const response = await this.api.delete(`/sites/${this.siteId}/pages`, {
|
|
208
|
-
body: JSON.stringify({ ids })
|
|
210
|
+
body: JSON.stringify({ ids }),
|
|
209
211
|
});
|
|
210
212
|
return response.data;
|
|
211
213
|
}
|
|
@@ -239,6 +241,35 @@ export class Pages {
|
|
|
239
241
|
const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
|
|
240
242
|
return response.data;
|
|
241
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Get list of page history items
|
|
246
|
+
* @param pageId - ID of the page to get history for
|
|
247
|
+
* @returns List of page history items
|
|
248
|
+
* @throws {UnauthorizedException} When the API key is invalid or expired
|
|
249
|
+
* @throws {NotFoundException} When the page is not found
|
|
250
|
+
* @throws {ForbiddenException} When the page does not belong to the site
|
|
251
|
+
* @throws {ServerException} When the server encounters an error
|
|
252
|
+
* @throws {TimeoutException} When the request times out
|
|
253
|
+
*/
|
|
254
|
+
async getPageHistory(pageId) {
|
|
255
|
+
const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/history`);
|
|
256
|
+
return response.data;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Get a specific page history item
|
|
260
|
+
* @param pageId - ID of the page
|
|
261
|
+
* @param versionId - ID of the history item to get
|
|
262
|
+
* @returns The requested page history item with data
|
|
263
|
+
* @throws {UnauthorizedException} When the API key is invalid or expired
|
|
264
|
+
* @throws {NotFoundException} When the page or history item is not found
|
|
265
|
+
* @throws {ForbiddenException} When the page does not belong to the site
|
|
266
|
+
* @throws {ServerException} When the server encounters an error
|
|
267
|
+
* @throws {TimeoutException} When the request times out
|
|
268
|
+
*/
|
|
269
|
+
async getPageHistoryItem(pageId, versionId) {
|
|
270
|
+
const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/history/${versionId}`);
|
|
271
|
+
return response.data;
|
|
272
|
+
}
|
|
242
273
|
/**
|
|
243
274
|
* Get list of page versions
|
|
244
275
|
* @param pageId - ID of the page to get versions for
|
|
@@ -249,8 +280,8 @@ export class Pages {
|
|
|
249
280
|
* @throws {ServerException} When the server encounters an error
|
|
250
281
|
* @throws {TimeoutException} When the request times out
|
|
251
282
|
*/
|
|
252
|
-
async
|
|
253
|
-
const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/
|
|
283
|
+
async getPageVersions(pageId) {
|
|
284
|
+
const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
|
|
254
285
|
return response.data;
|
|
255
286
|
}
|
|
256
287
|
/**
|
|
@@ -264,8 +295,8 @@ export class Pages {
|
|
|
264
295
|
* @throws {ServerException} When the server encounters an error
|
|
265
296
|
* @throws {TimeoutException} When the request times out
|
|
266
297
|
*/
|
|
267
|
-
async
|
|
268
|
-
const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/
|
|
298
|
+
async getPageVersion(pageId, versionId) {
|
|
299
|
+
const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
|
|
269
300
|
return response.data;
|
|
270
301
|
}
|
|
271
302
|
}
|
|
@@ -4,6 +4,7 @@ const TOKEN_REFRESH_THRESHOLD = 5 * 60 * 1000; // update token 5 minutes before
|
|
|
4
4
|
export class TokenManager {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.tokenPromise = null;
|
|
7
|
+
this.isRevoking = false;
|
|
7
8
|
}
|
|
8
9
|
static getInstance() {
|
|
9
10
|
if (!TokenManager.instance) {
|
|
@@ -18,6 +19,9 @@ export class TokenManager {
|
|
|
18
19
|
return TokenManager.instance;
|
|
19
20
|
}
|
|
20
21
|
async getToken() {
|
|
22
|
+
if (this.isRevoking) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
21
25
|
const token = this.getStoredToken();
|
|
22
26
|
if (token && token.expiresAt > Date.now()) {
|
|
23
27
|
// TODO check if token expire less that 1 minute
|
|
@@ -32,10 +36,14 @@ export class TokenManager {
|
|
|
32
36
|
return retrievedToken?.accessToken ?? null;
|
|
33
37
|
}
|
|
34
38
|
async revokeToken() {
|
|
39
|
+
this.isRevoking = true;
|
|
35
40
|
const token = this.getStoredToken();
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
if (!token) {
|
|
42
|
+
this.isRevoking = false;
|
|
38
43
|
return;
|
|
44
|
+
}
|
|
45
|
+
// Optimistic token cleanup
|
|
46
|
+
this.clearToken();
|
|
39
47
|
try {
|
|
40
48
|
const controller = new AbortController();
|
|
41
49
|
const timeoutId = setTimeout(() => controller.abort(), 30000);
|
|
@@ -43,7 +51,7 @@ export class TokenManager {
|
|
|
43
51
|
method: 'POST',
|
|
44
52
|
headers: {
|
|
45
53
|
'Content-Type': 'application/json',
|
|
46
|
-
|
|
54
|
+
Authorization: `Bearer ${token.accessToken}`,
|
|
47
55
|
},
|
|
48
56
|
body: JSON.stringify({ token: token.accessToken }),
|
|
49
57
|
credentials: 'include',
|
|
@@ -54,10 +62,16 @@ export class TokenManager {
|
|
|
54
62
|
catch (error) {
|
|
55
63
|
console.error('Failed to revoke token:', error);
|
|
56
64
|
}
|
|
65
|
+
finally {
|
|
66
|
+
// Finally cleanup the token
|
|
67
|
+
this.clearToken();
|
|
68
|
+
this.isRevoking = false;
|
|
69
|
+
}
|
|
57
70
|
}
|
|
58
71
|
getStoredToken() {
|
|
59
|
-
if (typeof window === 'undefined')
|
|
72
|
+
if (typeof window === 'undefined') {
|
|
60
73
|
return null;
|
|
74
|
+
}
|
|
61
75
|
const storedToken = localStorage.getItem(TOKEN_STORAGE_KEY);
|
|
62
76
|
if (!storedToken) {
|
|
63
77
|
return null;
|
|
@@ -87,28 +101,23 @@ export class TokenManager {
|
|
|
87
101
|
async doRetrieveToken() {
|
|
88
102
|
const controller = new AbortController();
|
|
89
103
|
const timeoutId = setTimeout(() => controller.abort(), 30000);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
throw new UnauthorizedException(errorData.message || response.statusText);
|
|
103
|
-
}
|
|
104
|
-
throw new Error(errorData.message || response.statusText);
|
|
104
|
+
const response = await fetch('/oauth/token', {
|
|
105
|
+
method: 'POST',
|
|
106
|
+
headers: { 'Content-Type': 'application/json' },
|
|
107
|
+
body: JSON.stringify({ grant_type: 'client_credentials' }),
|
|
108
|
+
credentials: 'include',
|
|
109
|
+
signal: controller.signal,
|
|
110
|
+
});
|
|
111
|
+
clearTimeout(timeoutId);
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
const errorData = await response.json().catch(() => ({ message: response.statusText }));
|
|
114
|
+
if (response.status === 401) {
|
|
115
|
+
throw new UnauthorizedException(errorData.message || response.statusText);
|
|
105
116
|
}
|
|
106
|
-
|
|
107
|
-
this.setToken(data);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
throw error;
|
|
117
|
+
throw new Error(errorData.message || response.statusText);
|
|
111
118
|
}
|
|
119
|
+
const data = await response.json();
|
|
120
|
+
this.setToken(data);
|
|
112
121
|
}
|
|
113
122
|
setToken(tokenResponse) {
|
|
114
123
|
const expiresAt = this.getExpirationFromToken(tokenResponse.accessToken);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FlexbeConfig } from '../types';
|
|
2
|
-
import { SiteApi } from './site-api';
|
|
3
1
|
import { MetaApi } from './meta-api';
|
|
2
|
+
import { SiteApi } from './site-api';
|
|
3
|
+
import type { FlexbeConfig } from '../types';
|
|
4
4
|
export declare class FlexbeClient {
|
|
5
5
|
private readonly config;
|
|
6
6
|
private readonly api;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiClient } from './api-client';
|
|
2
|
-
import { SiteCurrency, SiteLanguage, UserLanguage } from '../types/meta';
|
|
1
|
+
import type { ApiClient } from './api-client';
|
|
2
|
+
import type { SiteCurrency, SiteLanguage, UserLanguage } from '../types/meta';
|
|
3
3
|
export declare class MetaApi {
|
|
4
4
|
private readonly api;
|
|
5
5
|
constructor(api: ApiClient);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ApiClient } from './api-client';
|
|
2
|
+
import type { BulkDeleteResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkUpdatePageItem, BulkUpdateResponse, CreateFolderParams, GetPagesParams, Page, PageContent, PageFolder, PageFolderListResponse, PageHistoryItemData, PageHistoryListResponse, PageListResponse, PageVersionDataResponse, PageVersionListResponse, UpdateFolderParams, UpdatePageContentParams, UpdatePageParams } from '../types/pages';
|
|
3
3
|
export declare class Pages {
|
|
4
4
|
private readonly api;
|
|
5
5
|
private readonly siteId;
|
|
@@ -97,6 +97,7 @@ export declare class Pages {
|
|
|
97
97
|
* @param pageId - ID of the page to update
|
|
98
98
|
* @param data - Update parameters including:
|
|
99
99
|
* - status: New status for the page
|
|
100
|
+
* - versionId: ID of the version to set as current
|
|
100
101
|
* - name: New name for the page (max 150 characters)
|
|
101
102
|
* - uri: New URI for the page (max 255 characters, automatically normalized with leading and trailing slashes)
|
|
102
103
|
* - language: New language for the page
|
|
@@ -110,10 +111,9 @@ export declare class Pages {
|
|
|
110
111
|
* - ogTitle: Open Graph title for social sharing (max 200 characters)
|
|
111
112
|
* - ogDescription: Open Graph description for social sharing (max 1000 characters)
|
|
112
113
|
* - noindex: Whether to prevent search engine indexing
|
|
113
|
-
* - grid: Grid configuration for the page
|
|
114
114
|
* @throws {UnauthorizedException} When the API key is invalid or expired
|
|
115
|
-
* @throws {NotFoundException} When the page is not found
|
|
116
|
-
* @throws {ForbiddenException} When the page does not belong to the site
|
|
115
|
+
* @throws {NotFoundException} When the page or version is not found
|
|
116
|
+
* @throws {ForbiddenException} When the page does not belong to the site or version belongs to a different page
|
|
117
117
|
* @throws {BadRequestException} When the update parameters are invalid
|
|
118
118
|
* @throws {ServerException} When the server encounters an error
|
|
119
119
|
* @throws {TimeoutException} When the request times out
|
|
@@ -193,6 +193,29 @@ export declare class Pages {
|
|
|
193
193
|
* @throws {TimeoutException} When the request times out
|
|
194
194
|
*/
|
|
195
195
|
updatePageContent(pageId: number, content: Partial<UpdatePageContentParams>): Promise<PageContent>;
|
|
196
|
+
/**
|
|
197
|
+
* Get list of page history items
|
|
198
|
+
* @param pageId - ID of the page to get history for
|
|
199
|
+
* @returns List of page history items
|
|
200
|
+
* @throws {UnauthorizedException} When the API key is invalid or expired
|
|
201
|
+
* @throws {NotFoundException} When the page is not found
|
|
202
|
+
* @throws {ForbiddenException} When the page does not belong to the site
|
|
203
|
+
* @throws {ServerException} When the server encounters an error
|
|
204
|
+
* @throws {TimeoutException} When the request times out
|
|
205
|
+
*/
|
|
206
|
+
getPageHistory(pageId: number): Promise<PageHistoryListResponse>;
|
|
207
|
+
/**
|
|
208
|
+
* Get a specific page history item
|
|
209
|
+
* @param pageId - ID of the page
|
|
210
|
+
* @param versionId - ID of the history item to get
|
|
211
|
+
* @returns The requested page history item with data
|
|
212
|
+
* @throws {UnauthorizedException} When the API key is invalid or expired
|
|
213
|
+
* @throws {NotFoundException} When the page or history item is not found
|
|
214
|
+
* @throws {ForbiddenException} When the page does not belong to the site
|
|
215
|
+
* @throws {ServerException} When the server encounters an error
|
|
216
|
+
* @throws {TimeoutException} When the request times out
|
|
217
|
+
*/
|
|
218
|
+
getPageHistoryItem(pageId: number, versionId: number): Promise<PageHistoryItemData>;
|
|
196
219
|
/**
|
|
197
220
|
* Get list of page versions
|
|
198
221
|
* @param pageId - ID of the page to get versions for
|
|
@@ -203,7 +226,7 @@ export declare class Pages {
|
|
|
203
226
|
* @throws {ServerException} When the server encounters an error
|
|
204
227
|
* @throws {TimeoutException} When the request times out
|
|
205
228
|
*/
|
|
206
|
-
|
|
229
|
+
getPageVersions(pageId: number): Promise<PageVersionListResponse>;
|
|
207
230
|
/**
|
|
208
231
|
* Get a specific page version
|
|
209
232
|
* @param pageId - ID of the page
|
|
@@ -215,5 +238,5 @@ export declare class Pages {
|
|
|
215
238
|
* @throws {ServerException} When the server encounters an error
|
|
216
239
|
* @throws {TimeoutException} When the request times out
|
|
217
240
|
*/
|
|
218
|
-
|
|
241
|
+
getPageVersion(pageId: number, versionId: number): Promise<PageVersionDataResponse>;
|
|
219
242
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FlexbeBulkError, Pagination } from './index';
|
|
1
|
+
import type { FlexbeBulkError, Pagination } from './index';
|
|
2
2
|
export interface GridConfig {
|
|
3
3
|
color?: string;
|
|
4
4
|
desktop?: {
|
|
@@ -45,6 +45,7 @@ export declare enum PageStatus {
|
|
|
45
45
|
}
|
|
46
46
|
export interface Page {
|
|
47
47
|
id: number;
|
|
48
|
+
versionId: number | null;
|
|
48
49
|
type: PageType;
|
|
49
50
|
status: PageStatus;
|
|
50
51
|
name: string;
|
|
@@ -89,6 +90,7 @@ export interface CreateFolderParams {
|
|
|
89
90
|
}
|
|
90
91
|
export interface UpdatePageParams {
|
|
91
92
|
status?: PageStatus;
|
|
93
|
+
versionId?: number;
|
|
92
94
|
name?: string;
|
|
93
95
|
uri?: string;
|
|
94
96
|
language?: string;
|
|
@@ -292,10 +294,20 @@ export interface PageHistoryItem {
|
|
|
292
294
|
createdAt: string;
|
|
293
295
|
selected?: boolean;
|
|
294
296
|
}
|
|
295
|
-
export interface
|
|
297
|
+
export interface PageHistoryListResponse {
|
|
296
298
|
list: PageHistoryItem[];
|
|
297
299
|
}
|
|
298
300
|
export interface PageHistoryItemData extends PageHistoryItem {
|
|
299
301
|
data: Record<string, unknown>;
|
|
300
302
|
}
|
|
303
|
+
export interface PageVersionItem {
|
|
304
|
+
id: number;
|
|
305
|
+
createdAt: string;
|
|
306
|
+
}
|
|
307
|
+
export interface PageVersionListResponse {
|
|
308
|
+
list: PageVersionItem[];
|
|
309
|
+
}
|
|
310
|
+
export interface PageVersionDataResponse {
|
|
311
|
+
data: PageContent;
|
|
312
|
+
}
|
|
301
313
|
export {};
|
package/package.json
CHANGED
|
@@ -1,67 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "npm run build:esm && npm run build:cjs && npm run build:browser",
|
|
18
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
19
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
20
|
-
"build:browser": "tsc -p tsconfig.browser.json",
|
|
21
|
-
"dev": "tsc -p tsconfig.esm.json --watch",
|
|
22
|
-
"test": "dotenv -e test/.env.test jest",
|
|
23
|
-
"lint": "eslint src --ext .ts",
|
|
24
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
25
|
-
"prepare": "npm run build",
|
|
26
|
-
"prepublishOnly": "npm test && npm run lint"
|
|
27
|
-
},
|
|
28
|
-
"keywords": [
|
|
29
|
-
"flexbe",
|
|
30
|
-
"sdk",
|
|
31
|
-
"typescript",
|
|
32
|
-
"api-client"
|
|
33
|
-
],
|
|
34
|
-
"author": "Flexbe",
|
|
35
|
-
"license": "MIT",
|
|
36
|
-
"repository": {
|
|
37
|
-
"type": "git",
|
|
38
|
-
"url": "git+https://github.com/flexbe/sdk-ts.git"
|
|
39
|
-
},
|
|
40
|
-
"bugs": {
|
|
41
|
-
"url": "https://github.com/flexbe/sdk-ts/issues"
|
|
42
|
-
},
|
|
43
|
-
"homepage": "https://github.com/flexbe/sdk-ts#readme",
|
|
44
|
-
"dependencies": {},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@types/jest": "^29.5.12",
|
|
47
|
-
"@types/node": "^20.11.19",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
49
|
-
"@typescript-eslint/parser": "^7.0.1",
|
|
50
|
-
"dotenv-cli": "^7.4.1",
|
|
51
|
-
"eslint": "^8.56.0",
|
|
52
|
-
"jest": "^29.7.0",
|
|
53
|
-
"prettier": "^3.2.5",
|
|
54
|
-
"ts-jest": "^29.1.2",
|
|
55
|
-
"typescript": "~5.5.0"
|
|
56
|
-
},
|
|
57
|
-
"files": [
|
|
58
|
-
"dist",
|
|
59
|
-
"README.md"
|
|
60
|
-
],
|
|
61
|
-
"engines": {
|
|
62
|
-
"node": ">=16.0.0"
|
|
63
|
-
},
|
|
64
|
-
"publishConfig": {
|
|
65
|
-
"access": "public"
|
|
2
|
+
"name": "@flexbe/sdk",
|
|
3
|
+
"version": "0.2.33",
|
|
4
|
+
"description": "TypeScript SDK for Flexbe API",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"browser": "dist/browser/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"require": "./dist/cjs/index.js",
|
|
13
|
+
"types": "./dist/types/index.d.ts"
|
|
66
14
|
}
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "npm run build:esm && npm run build:cjs && npm run build:browser",
|
|
18
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
19
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
20
|
+
"build:browser": "tsc -p tsconfig.browser.json",
|
|
21
|
+
"dev": "tsc -p tsconfig.esm.json --watch",
|
|
22
|
+
"test": "dotenv -e test/.env.test jest",
|
|
23
|
+
"lint": "eslint src --ext .ts",
|
|
24
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
25
|
+
"prepare": "npm run build",
|
|
26
|
+
"prepublishOnly_": "npm test && npm run lint"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"flexbe",
|
|
30
|
+
"sdk",
|
|
31
|
+
"typescript",
|
|
32
|
+
"api-client"
|
|
33
|
+
],
|
|
34
|
+
"author": "Flexbe",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/flexbe/sdk-ts.git"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/flexbe/sdk-ts/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/flexbe/sdk-ts#readme",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@flexbe/eslint-config": "^1.0.7",
|
|
46
|
+
"@types/jest": "^29.5.12",
|
|
47
|
+
"@types/node": "^20.11.19",
|
|
48
|
+
"dotenv-cli": "^7.4.1",
|
|
49
|
+
"eslint": "^9.26.0",
|
|
50
|
+
"jest": "^29.7.0",
|
|
51
|
+
"ts-jest": "^29.1.2",
|
|
52
|
+
"typescript": "~5.5.0"
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"dist",
|
|
56
|
+
"README.md"
|
|
57
|
+
],
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=16.0.0"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
}
|
|
67
64
|
}
|