@silexlabs/silex 3.1.0 → 3.2.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/grapesjs-filter-styles/dist/index.d.ts +4 -0
- package/dist/client/grapesjs-fonts/dist/index.d.ts +4 -0
- package/dist/client/grapesjs-fonts/src/commands.d.ts +3 -0
- package/dist/client/grapesjs-fonts/src/fonts.d.ts +4 -0
- package/dist/client/grapesjs-storage-rate-limit/dist/index.d.ts +4 -0
- package/dist/client/grapesjs-ui-suggest-classes/dist/index.d.ts +4 -0
- package/dist/client/js/main.js +1 -1
- package/dist/client/silex-lib/src/ts/client/api.d.ts +90 -0
- package/dist/client/silex-lib/src/ts/client/assetUrl.d.ts +46 -0
- package/dist/client/silex-lib/src/ts/client/config.d.ts +102 -0
- package/dist/client/silex-lib/src/ts/client/events.d.ts +23 -0
- package/dist/client/silex-lib/src/ts/client/expose.d.ts +8 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/PublicationManager.d.ts +74 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/PublicationUi.d.ts +59 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/blocks.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/breadcrumbs.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/css-props.d.ts +6 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/footer.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/img.d.ts +6 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/index.d.ts +9 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/internal-links.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/keymaps.d.ts +123 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/new-page-dialog.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/openImport.d.ts +9 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/page-panel.d.ts +9 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/project-bar.d.ts +21 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/resize-panel.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/rich-text.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/semantic.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/settings-sections.d.ts +16 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/settings.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/storage.d.ts +3 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/symbolDialogs.d.ts +3 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/upload-progress.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/view-buttons.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/index.d.ts +10 -0
- package/dist/client/silex-lib/src/ts/client/publication-transformers.d.ts +42 -0
- package/dist/client/silex-lib/src/ts/client/publish-custom-code-block.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/publish-fonts.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/utils.d.ts +22 -0
- package/dist/client/silex-lib/src/ts/constants.d.ts +33 -0
- package/dist/client/silex-lib/src/ts/page.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/types.d.ts +341 -0
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const cmdOpenSettings = "open-settings";
|
|
2
|
+
export declare const settingsDialog: (editor: any, opts: any) => void;
|
|
3
|
+
export declare function addSection(section: any, siteOrPage: 'site' | 'page', position: 'first' | 'last' | number): void;
|
|
4
|
+
export declare function removeSection(id: any, siteOrPage: 'site' | 'page'): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (editor: any): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientConfig } from './config';
|
|
2
|
+
export * from './expose';
|
|
3
|
+
/**
|
|
4
|
+
* Expose the config object
|
|
5
|
+
*/
|
|
6
|
+
export declare let config: ClientConfig;
|
|
7
|
+
/**
|
|
8
|
+
* Start Silex, called from host HTML page with window.silex.start()
|
|
9
|
+
*/
|
|
10
|
+
export declare function start(options?: {}): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component, CssRule, StyleProps, Editor } from 'grapesjs';
|
|
2
|
+
import { ClientSideFile, ClientSideFileType, Initiator, PublicationData } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for publication transformers
|
|
5
|
+
* They are added to the config object with config.addPublicationTransformer()
|
|
6
|
+
*/
|
|
7
|
+
export interface PublicationTransformer {
|
|
8
|
+
renderComponent?(component: Component, toHtml: () => string): string | undefined;
|
|
9
|
+
renderCssRule?(rule: CssRule, initialRule: () => StyleProps): StyleProps | undefined;
|
|
10
|
+
transformFile?(file: ClientSideFile): ClientSideFile;
|
|
11
|
+
transformPermalink?(link: string, type: ClientSideFileType, initiator: Initiator): string;
|
|
12
|
+
transformPath?(path: string, type: ClientSideFileType): string;
|
|
13
|
+
}
|
|
14
|
+
export declare const publicationTransformerDefault: PublicationTransformer;
|
|
15
|
+
export declare function validatePublicationTransformer(transformer: PublicationTransformer): void;
|
|
16
|
+
/**
|
|
17
|
+
* Alter the components rendering
|
|
18
|
+
* Exported for unit tests
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderComponents(editor: Editor): void;
|
|
21
|
+
/**
|
|
22
|
+
* Alter the styles rendering
|
|
23
|
+
* Exported for unit tests
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderCssRules(editor: Editor): void;
|
|
26
|
+
/**
|
|
27
|
+
* Transform background image url according to the transformed path of assets
|
|
28
|
+
*/
|
|
29
|
+
export declare function transformBgImage(editor: Editor, style: StyleProps): StyleProps;
|
|
30
|
+
/**
|
|
31
|
+
* Transform files
|
|
32
|
+
* Exported for unit tests
|
|
33
|
+
*/
|
|
34
|
+
export declare function transformFiles(editor: Editor, data: PublicationData): void;
|
|
35
|
+
/**
|
|
36
|
+
* Transform files paths
|
|
37
|
+
* Exported for unit tests
|
|
38
|
+
*/
|
|
39
|
+
export declare function transformPermalink(editor: Editor, path: string, type: ClientSideFileType, initiator: Initiator): string;
|
|
40
|
+
export declare function transformPath(editor: Editor, path: string, type: ClientSideFileType): string;
|
|
41
|
+
export declare function resetRenderComponents(editor: Editor): void;
|
|
42
|
+
export declare function resetRenderCssRules(editor: Editor): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Editor } from 'grapesjs';
|
|
2
|
+
export declare function onAll(editor: Editor, cbk: (c: Component) => void): void;
|
|
3
|
+
/**
|
|
4
|
+
* SHA256 hash a string
|
|
5
|
+
*/
|
|
6
|
+
export declare function hashString(str: string): Promise<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Select the <body> element in the editor.
|
|
9
|
+
* @param editor The GrapesJS editor.
|
|
10
|
+
*/
|
|
11
|
+
export declare function selectBody(editor: Editor): void;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if an element is a text or input field.
|
|
14
|
+
* @param element The element to check.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isTextOrInputField(element: HTMLElement): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Makes every word in a string start with an uppercase letter.
|
|
19
|
+
* @param str The string to title-case.
|
|
20
|
+
* @param sep The separator between words.
|
|
21
|
+
*/
|
|
22
|
+
export declare function titleCase(str: string, sep?: string): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview define constants for Silex client and server
|
|
3
|
+
*/
|
|
4
|
+
export declare const WEBSITE_DATA_FILE = "website.json";
|
|
5
|
+
export declare const WEBSITE_META_DATA_FILE = "meta.json";
|
|
6
|
+
export declare const WEBSITE_PAGES_FOLDER = "src";
|
|
7
|
+
export declare const DEFAULT_WEBSITE_ID = "default";
|
|
8
|
+
export declare const DEFAULT_LANGUAGE = "en";
|
|
9
|
+
export declare const CLIENT_CONFIG_FILE_NAME = "silex.js";
|
|
10
|
+
export declare const API_PATH = "/api";
|
|
11
|
+
export declare const API_CONNECTOR_PATH = "/connector";
|
|
12
|
+
export declare const API_CONNECTOR_USER = "/user";
|
|
13
|
+
export declare const API_CONNECTOR_LIST = "/";
|
|
14
|
+
export declare const API_CONNECTOR_LOGOUT = "/logout";
|
|
15
|
+
export declare const API_CONNECTOR_LOGIN = "/login";
|
|
16
|
+
export declare const API_CONNECTOR_SETTINGS = "/settings";
|
|
17
|
+
export declare const API_CONNECTOR_LOGIN_CALLBACK = "/login/callback";
|
|
18
|
+
export declare const API_PUBLICATION_PATH = "/publication";
|
|
19
|
+
export declare const API_PUBLICATION_PUBLISH = "/";
|
|
20
|
+
export declare const API_PUBLICATION_STATUS = "/publication/status";
|
|
21
|
+
export declare const API_WEBSITE_PATH = "/website";
|
|
22
|
+
export declare const API_WEBSITE_READ = "/";
|
|
23
|
+
export declare const API_WEBSITE_WRITE = "/";
|
|
24
|
+
export declare const API_WEBSITE_CREATE = "/";
|
|
25
|
+
export declare const API_WEBSITE_DELETE = "/";
|
|
26
|
+
export declare const API_WEBSITE_DUPLICATE = "/duplicate";
|
|
27
|
+
export declare const API_WEBSITE_LIST = "/";
|
|
28
|
+
export declare const API_WEBSITE_ASSET_READ = "/assets";
|
|
29
|
+
export declare const API_WEBSITE_ASSETS_WRITE = "/assets";
|
|
30
|
+
export declare const API_WEBSITE_META_READ = "/meta";
|
|
31
|
+
export declare const API_WEBSITE_META_WRITE = "/meta";
|
|
32
|
+
export declare let SILEX_VERSION: any;
|
|
33
|
+
export declare const DEV_MESSAGE: string;
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview define types for Silex client and server
|
|
3
|
+
*/
|
|
4
|
+
export interface PublicationSettings {
|
|
5
|
+
connector?: ConnectorData;
|
|
6
|
+
options?: ConnectorOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface WebsiteFile {
|
|
9
|
+
html: string;
|
|
10
|
+
css: string;
|
|
11
|
+
htmlPath: string;
|
|
12
|
+
cssPath: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class ApiError extends Error {
|
|
15
|
+
readonly httpStatusCode: number;
|
|
16
|
+
constructor(message: string, httpStatusCode: number);
|
|
17
|
+
}
|
|
18
|
+
export type ApiResponseError = {
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
export type ApiPublicationPublishBody = WebsiteData;
|
|
22
|
+
export type ApiPublicationPublishQuery = {
|
|
23
|
+
websiteId: WebsiteId;
|
|
24
|
+
hostingId: ConnectorId;
|
|
25
|
+
storageId: ConnectorId;
|
|
26
|
+
options: ConnectorOptions;
|
|
27
|
+
};
|
|
28
|
+
export type ApiPublicationPublishResponse = {
|
|
29
|
+
url: string;
|
|
30
|
+
job: PublicationJobData;
|
|
31
|
+
};
|
|
32
|
+
export type ApiPublicationStatusQuery = {
|
|
33
|
+
jobId: JobId;
|
|
34
|
+
};
|
|
35
|
+
export type ApiPublicationStatusResponse = PublicationJobData;
|
|
36
|
+
export type ApiWebsiteReadQuery = {
|
|
37
|
+
websiteId: WebsiteId;
|
|
38
|
+
connectorId?: ConnectorId;
|
|
39
|
+
};
|
|
40
|
+
export type ApiWebsiteReadResponse = WebsiteData;
|
|
41
|
+
export type ApiWebsiteListQuery = {
|
|
42
|
+
connectorId?: ConnectorId;
|
|
43
|
+
};
|
|
44
|
+
export type ApiWebsiteListResponse = WebsiteMeta[];
|
|
45
|
+
export type ApiWebsiteWriteQuery = {
|
|
46
|
+
websiteId: WebsiteId;
|
|
47
|
+
connectorId?: ConnectorId;
|
|
48
|
+
};
|
|
49
|
+
export type ApiWebsiteWriteBody = WebsiteData;
|
|
50
|
+
export type ApiWebsiteWriteResponse = {
|
|
51
|
+
message: string;
|
|
52
|
+
};
|
|
53
|
+
export type ApiWebsiteCreateQuery = {
|
|
54
|
+
connectorId?: ConnectorId;
|
|
55
|
+
};
|
|
56
|
+
export type ApiWebsiteCreateBody = WebsiteMetaFileContent;
|
|
57
|
+
export type ApiWebsiteCreateResponse = {
|
|
58
|
+
message: string;
|
|
59
|
+
};
|
|
60
|
+
export type ApiWebsiteDeleteQuery = {
|
|
61
|
+
websiteId: WebsiteId;
|
|
62
|
+
connectorId?: ConnectorId;
|
|
63
|
+
};
|
|
64
|
+
export type ApiWebsiteDuplicateQuery = {
|
|
65
|
+
websiteId: WebsiteId;
|
|
66
|
+
connectorId?: ConnectorId;
|
|
67
|
+
};
|
|
68
|
+
export type ApiWebsiteMetaReadQuery = {
|
|
69
|
+
websiteId: WebsiteId;
|
|
70
|
+
connectorId?: ConnectorId;
|
|
71
|
+
};
|
|
72
|
+
export type ApiWebsiteMetaReadResponse = WebsiteMeta;
|
|
73
|
+
export type ApiWebsiteMetaWriteQuery = {
|
|
74
|
+
websiteId: WebsiteId;
|
|
75
|
+
connectorId?: ConnectorId;
|
|
76
|
+
};
|
|
77
|
+
export type ApiWebsiteMetaWriteBody = WebsiteMetaFileContent;
|
|
78
|
+
export type ApiWebsiteMetaWriteResponse = {
|
|
79
|
+
message: string;
|
|
80
|
+
};
|
|
81
|
+
export type ApiWebsiteAssetsReadQuery = {
|
|
82
|
+
websiteId: WebsiteId;
|
|
83
|
+
connectorId?: ConnectorId;
|
|
84
|
+
};
|
|
85
|
+
export type ApiWebsiteAssetsReadParams = {
|
|
86
|
+
path: string;
|
|
87
|
+
};
|
|
88
|
+
export type ApiWebsiteAssetsReadResponse = string;
|
|
89
|
+
export type ApiWebsiteAssetsWriteQuery = {
|
|
90
|
+
websiteId: WebsiteId;
|
|
91
|
+
connectorId?: ConnectorId;
|
|
92
|
+
};
|
|
93
|
+
export type ApiWebsiteAssetsWriteBody = ClientSideFile[];
|
|
94
|
+
export type ApiWebsiteAssetsWriteResponse = {
|
|
95
|
+
data: string[];
|
|
96
|
+
};
|
|
97
|
+
export type ApiConnectorListQuery = {
|
|
98
|
+
type: ConnectorType;
|
|
99
|
+
};
|
|
100
|
+
export type ApiConnectorListResponse = ConnectorData[];
|
|
101
|
+
export type ApiConnectorLoginQuery = {
|
|
102
|
+
connectorId: ConnectorId;
|
|
103
|
+
type: ConnectorType;
|
|
104
|
+
};
|
|
105
|
+
export type ApiConnectorLoggedInPostMessage = {
|
|
106
|
+
type: string;
|
|
107
|
+
error: boolean;
|
|
108
|
+
message: string;
|
|
109
|
+
connectorId: ConnectorId;
|
|
110
|
+
options: ConnectorOptions;
|
|
111
|
+
};
|
|
112
|
+
export type ApiConnectorLoginCbkQuery = {
|
|
113
|
+
connectorId?: ConnectorId;
|
|
114
|
+
type: ConnectorType;
|
|
115
|
+
error?: string;
|
|
116
|
+
};
|
|
117
|
+
export type ApiConnectorLoginCbkBody = object;
|
|
118
|
+
export type ApiConnectorSettingsQuery = {
|
|
119
|
+
connectorId?: ConnectorId;
|
|
120
|
+
type: ConnectorType;
|
|
121
|
+
};
|
|
122
|
+
export type ApiConnectorSettingsResponse = string;
|
|
123
|
+
export type ApiConnectorSettingsPostQuery = {
|
|
124
|
+
connectorId?: ConnectorId;
|
|
125
|
+
type: ConnectorType;
|
|
126
|
+
};
|
|
127
|
+
export type ApiConnectorSettingsPostBody = ConnectorUserSettings;
|
|
128
|
+
export type ApiConnectorSettingsPostResponse = {
|
|
129
|
+
message: string;
|
|
130
|
+
};
|
|
131
|
+
export type ApiConnectorLogoutQuery = {
|
|
132
|
+
connectorId?: ConnectorId;
|
|
133
|
+
type: ConnectorType;
|
|
134
|
+
};
|
|
135
|
+
export type ApiConnectorUserQuery = {
|
|
136
|
+
connectorId?: ConnectorId;
|
|
137
|
+
type: ConnectorType;
|
|
138
|
+
};
|
|
139
|
+
export type ApiConnectorUserResponse = ConnectorUser;
|
|
140
|
+
export declare const defaultWebsiteData: WebsiteData;
|
|
141
|
+
export interface Component {
|
|
142
|
+
type: string;
|
|
143
|
+
content?: string;
|
|
144
|
+
attributes: {
|
|
145
|
+
[key: string]: string;
|
|
146
|
+
};
|
|
147
|
+
components: Component[];
|
|
148
|
+
}
|
|
149
|
+
export interface Page {
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
slug: string;
|
|
153
|
+
settings: WebsiteSettings;
|
|
154
|
+
frames: {
|
|
155
|
+
component: Component;
|
|
156
|
+
}[];
|
|
157
|
+
}
|
|
158
|
+
export interface WebsiteData {
|
|
159
|
+
pages: Page[];
|
|
160
|
+
assets: Asset[];
|
|
161
|
+
styles: Style[];
|
|
162
|
+
settings: WebsiteSettings;
|
|
163
|
+
fonts: Font[];
|
|
164
|
+
symbols: symbol[];
|
|
165
|
+
publication: PublicationSettings;
|
|
166
|
+
}
|
|
167
|
+
export interface PublicationData extends WebsiteData {
|
|
168
|
+
files?: ClientSideFile[];
|
|
169
|
+
}
|
|
170
|
+
export interface WebsiteSettings {
|
|
171
|
+
description?: string;
|
|
172
|
+
title?: string;
|
|
173
|
+
lang?: string;
|
|
174
|
+
head?: string;
|
|
175
|
+
favicon?: string;
|
|
176
|
+
'og:title'?: string;
|
|
177
|
+
'og:description'?: string;
|
|
178
|
+
'og:image'?: string;
|
|
179
|
+
}
|
|
180
|
+
export interface Font {
|
|
181
|
+
name: string;
|
|
182
|
+
value: string;
|
|
183
|
+
variants: string[];
|
|
184
|
+
}
|
|
185
|
+
export declare enum Unit {
|
|
186
|
+
PX = "px"
|
|
187
|
+
}
|
|
188
|
+
export interface Asset {
|
|
189
|
+
type: string;
|
|
190
|
+
src: string;
|
|
191
|
+
unitDim: Unit;
|
|
192
|
+
height: number;
|
|
193
|
+
width: number;
|
|
194
|
+
name: string;
|
|
195
|
+
path?: string;
|
|
196
|
+
}
|
|
197
|
+
export interface Style {
|
|
198
|
+
selectors: Selector[];
|
|
199
|
+
style: {
|
|
200
|
+
[key: string]: string;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
export type Selector = string | {
|
|
204
|
+
name: string;
|
|
205
|
+
type: number;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Type for a connector id
|
|
209
|
+
*/
|
|
210
|
+
export type ConnectorId = string;
|
|
211
|
+
export type ConnectorOptions = {
|
|
212
|
+
websiteUrl?: string;
|
|
213
|
+
[key: string]: any;
|
|
214
|
+
};
|
|
215
|
+
export declare enum ClientSideFileType {
|
|
216
|
+
HTML = "html",
|
|
217
|
+
ASSET = "asset",
|
|
218
|
+
CSS = "css",
|
|
219
|
+
OTHER = "other"
|
|
220
|
+
}
|
|
221
|
+
export declare enum Initiator {
|
|
222
|
+
HTML = "html",
|
|
223
|
+
CSS = "css"
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Type for a client side file when the content is not available, used to handle file names and paths and urls
|
|
227
|
+
*/
|
|
228
|
+
export interface ClientSideFileWithPermalink {
|
|
229
|
+
path: string;
|
|
230
|
+
permalink?: string;
|
|
231
|
+
type: ClientSideFileType;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Type for a client side file when the content is available as a string
|
|
235
|
+
*/
|
|
236
|
+
export interface ClientSideFileWithContent extends ClientSideFileWithPermalink {
|
|
237
|
+
content: string;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Type for a client side file when the content is in the connector
|
|
241
|
+
*/
|
|
242
|
+
export interface ClientSideFileWithSrc extends ClientSideFileWithPermalink {
|
|
243
|
+
src: string;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Type for a client side file
|
|
247
|
+
* @see connector/File
|
|
248
|
+
*/
|
|
249
|
+
export type ClientSideFile = ClientSideFileWithContent | ClientSideFileWithSrc;
|
|
250
|
+
/**
|
|
251
|
+
* Type for file listing
|
|
252
|
+
*/
|
|
253
|
+
export interface FileMeta {
|
|
254
|
+
name: string;
|
|
255
|
+
isDir: boolean;
|
|
256
|
+
size: number;
|
|
257
|
+
createdAt: Date;
|
|
258
|
+
updatedAt: Date;
|
|
259
|
+
metadata?: object;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Enum to express if the connector is a storage or a hosting
|
|
263
|
+
*/
|
|
264
|
+
export declare enum ConnectorType {
|
|
265
|
+
STORAGE = "STORAGE",
|
|
266
|
+
HOSTING = "HOSTING"
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Type for a website id
|
|
270
|
+
*/
|
|
271
|
+
export type WebsiteId = string;
|
|
272
|
+
/**
|
|
273
|
+
* Back end data shared with the front end
|
|
274
|
+
*/
|
|
275
|
+
export interface ConnectorData {
|
|
276
|
+
connectorId: ConnectorId;
|
|
277
|
+
type: ConnectorType;
|
|
278
|
+
displayName: string;
|
|
279
|
+
icon: string;
|
|
280
|
+
disableLogout: boolean;
|
|
281
|
+
isLoggedIn: boolean;
|
|
282
|
+
oauthUrl: string | null;
|
|
283
|
+
color: string;
|
|
284
|
+
background: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* User settings for a connector and for a given website
|
|
288
|
+
*/
|
|
289
|
+
export type ConnectorUserSettings = {
|
|
290
|
+
[websiteId: string]: object;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Back end data shared with the front end
|
|
294
|
+
*/
|
|
295
|
+
export interface ConnectorUser {
|
|
296
|
+
name: string;
|
|
297
|
+
email?: string;
|
|
298
|
+
picture?: string;
|
|
299
|
+
storage: ConnectorData;
|
|
300
|
+
}
|
|
301
|
+
export interface WebsiteMetaFileContent {
|
|
302
|
+
name: string;
|
|
303
|
+
imageUrl?: string;
|
|
304
|
+
connectorUserSettings: ConnectorUserSettings;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Back end data sent to the front end
|
|
308
|
+
* Meta data can be the root path of the websites, or the bucket name, etc.
|
|
309
|
+
*/
|
|
310
|
+
export interface WebsiteMeta extends WebsiteMetaFileContent {
|
|
311
|
+
websiteId: WebsiteId;
|
|
312
|
+
createdAt?: Date;
|
|
313
|
+
updatedAt?: Date;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Enum to express if the job is in progress or finished or errored
|
|
317
|
+
*/
|
|
318
|
+
export declare enum JobStatus {
|
|
319
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
320
|
+
SUCCESS = "SUCCESS",
|
|
321
|
+
ERROR = "ERROR"
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Id used to track the progress of a publication
|
|
325
|
+
*/
|
|
326
|
+
export type JobId = string;
|
|
327
|
+
/**
|
|
328
|
+
* Data structure which is sent to the client to display the progress of a job
|
|
329
|
+
*/
|
|
330
|
+
export interface JobData {
|
|
331
|
+
jobId: JobId;
|
|
332
|
+
status: JobStatus;
|
|
333
|
+
message: string;
|
|
334
|
+
_timeout?: ReturnType<typeof setTimeout>;
|
|
335
|
+
}
|
|
336
|
+
export interface PublicationJobData extends JobData {
|
|
337
|
+
logs: string[][];
|
|
338
|
+
errors: string[][];
|
|
339
|
+
startTime?: number;
|
|
340
|
+
endTime?: number;
|
|
341
|
+
}
|