@silexlabs/silex 3.0.0-alpha.100
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/.env.default +19 -0
- package/.silex.js +37 -0
- package/LICENSE +661 -0
- package/README.md +96 -0
- package/dist/client/client/api.d.ts +85 -0
- package/dist/client/client/assetUrl.d.ts +51 -0
- package/dist/client/client/config.d.ts +58 -0
- package/dist/client/client/events.d.ts +14 -0
- package/dist/client/client/expose.d.ts +8 -0
- package/dist/client/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/client/client/grapesjs/PublicationManager.d.ts +72 -0
- package/dist/client/client/grapesjs/PublicationUi.d.ts +62 -0
- package/dist/client/client/grapesjs/blocks.d.ts +1 -0
- package/dist/client/client/grapesjs/breadcrumbs.d.ts +1 -0
- package/dist/client/client/grapesjs/footer.d.ts +2 -0
- package/dist/client/client/grapesjs/index.d.ts +5 -0
- package/dist/client/client/grapesjs/internal-links.d.ts +1 -0
- package/dist/client/client/grapesjs/new-page-dialog.d.ts +2 -0
- package/dist/client/client/grapesjs/openImport.d.ts +9 -0
- package/dist/client/client/grapesjs/page-panel.d.ts +3 -0
- package/dist/client/client/grapesjs/project-bar.d.ts +1 -0
- package/dist/client/client/grapesjs/rich-text.d.ts +1 -0
- package/dist/client/client/grapesjs/semantic.d.ts +1 -0
- package/dist/client/client/grapesjs/settings.d.ts +2 -0
- package/dist/client/client/grapesjs/storage.d.ts +1 -0
- package/dist/client/client/grapesjs/symbolDialogs.d.ts +3 -0
- package/dist/client/client/index.d.ts +5 -0
- package/dist/client/client/publication-transformers.d.ts +41 -0
- package/dist/client/client/utils.d.ts +2 -0
- package/dist/client/constants.d.ts +29 -0
- package/dist/client/css/admin.css +4491 -0
- package/dist/client/index.html +9 -0
- package/dist/client/js/main.js +321 -0
- package/dist/client/js/main.js.LICENSE.txt +24 -0
- package/dist/client/page.d.ts +2 -0
- package/dist/client/types.d.ts +334 -0
- package/dist/plugins/client/client/api.d.ts +85 -0
- package/dist/plugins/client/client/api.js +114 -0
- package/dist/plugins/client/client/api.js.map +1 -0
- package/dist/plugins/client/client/assetUrl.d.ts +51 -0
- package/dist/plugins/client/client/assetUrl.js +224 -0
- package/dist/plugins/client/client/assetUrl.js.map +1 -0
- package/dist/plugins/client/client/config.d.ts +58 -0
- package/dist/plugins/client/client/config.js +90 -0
- package/dist/plugins/client/client/config.js.map +1 -0
- package/dist/plugins/client/client/events.d.ts +14 -0
- package/dist/plugins/client/client/events.js +34 -0
- package/dist/plugins/client/client/events.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.js +195 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.d.ts +72 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.js +356 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.d.ts +62 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.js +336 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/blocks.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/blocks.js +37 -0
- package/dist/plugins/client/client/grapesjs/blocks.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/breadcrumbs.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/breadcrumbs.js +75 -0
- package/dist/plugins/client/client/grapesjs/breadcrumbs.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/footer.d.ts +2 -0
- package/dist/plugins/client/client/grapesjs/footer.js +28 -0
- package/dist/plugins/client/client/grapesjs/footer.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/index.d.ts +5 -0
- package/dist/plugins/client/client/grapesjs/index.js +313 -0
- package/dist/plugins/client/client/grapesjs/index.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/internal-links.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/internal-links.js +219 -0
- package/dist/plugins/client/client/grapesjs/internal-links.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/new-page-dialog.d.ts +2 -0
- package/dist/plugins/client/client/grapesjs/new-page-dialog.js +83 -0
- package/dist/plugins/client/client/grapesjs/new-page-dialog.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/openImport.d.ts +9 -0
- package/dist/plugins/client/client/grapesjs/openImport.js +74 -0
- package/dist/plugins/client/client/grapesjs/openImport.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/page-panel.d.ts +3 -0
- package/dist/plugins/client/client/grapesjs/page-panel.js +113 -0
- package/dist/plugins/client/client/grapesjs/page-panel.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/project-bar.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/project-bar.js +104 -0
- package/dist/plugins/client/client/grapesjs/project-bar.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/rich-text.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/rich-text.js +31 -0
- package/dist/plugins/client/client/grapesjs/rich-text.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/semantic.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/semantic.js +110 -0
- package/dist/plugins/client/client/grapesjs/semantic.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/settings.d.ts +2 -0
- package/dist/plugins/client/client/grapesjs/settings.js +198 -0
- package/dist/plugins/client/client/grapesjs/settings.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/storage.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/storage.js +126 -0
- package/dist/plugins/client/client/grapesjs/storage.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/symbolDialogs.d.ts +3 -0
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js +36 -0
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js.map +1 -0
- package/dist/plugins/client/client/publication-transformers.d.ts +41 -0
- package/dist/plugins/client/client/publication-transformers.js +238 -0
- package/dist/plugins/client/client/publication-transformers.js.map +1 -0
- package/dist/plugins/client/client/utils.d.ts +2 -0
- package/dist/plugins/client/client/utils.js +25 -0
- package/dist/plugins/client/client/utils.js.map +1 -0
- package/dist/plugins/client/constants.d.ts +29 -0
- package/dist/plugins/client/constants.js +46 -0
- package/dist/plugins/client/constants.js.map +1 -0
- package/dist/plugins/client/page.d.ts +2 -0
- package/dist/plugins/client/page.js +31 -0
- package/dist/plugins/client/page.js.map +1 -0
- package/dist/plugins/client/plugins/client/11ty.d.ts +17 -0
- package/dist/plugins/client/plugins/client/11ty.js +86 -0
- package/dist/plugins/client/plugins/client/11ty.js.map +1 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.d.ts +2 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.js +170 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.js.map +1 -0
- package/dist/plugins/client/plugins/client/template.d.ts +2 -0
- package/dist/plugins/client/plugins/client/template.js +183 -0
- package/dist/plugins/client/plugins/client/template.js.map +1 -0
- package/dist/plugins/client/plugins/client/website-info.d.ts +1 -0
- package/dist/plugins/client/plugins/client/website-info.js +72 -0
- package/dist/plugins/client/plugins/client/website-info.js.map +1 -0
- package/dist/plugins/client/types.d.ts +334 -0
- package/dist/plugins/client/types.js +74 -0
- package/dist/plugins/client/types.js.map +1 -0
- package/dist/plugins/server/constants.d.ts +29 -0
- package/dist/plugins/server/constants.js +49 -0
- package/dist/plugins/server/constants.js.map +1 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.js +40 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/Cache.d.ts +2 -0
- package/dist/plugins/server/plugins/server/Cache.js +32 -0
- package/dist/plugins/server/plugins/server/Cache.js.map +1 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.d.ts +29 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.js +129 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +86 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js +526 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +87 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js +564 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.d.ts +0 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js +14 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js +86 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js +78 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +1 -0
- package/dist/plugins/server/server/config.d.ts +59 -0
- package/dist/plugins/server/server/config.js +181 -0
- package/dist/plugins/server/server/config.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +13 -0
- package/dist/plugins/server/server/connectors/FsHosting.js +54 -0
- package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +43 -0
- package/dist/plugins/server/server/connectors/FsStorage.js +257 -0
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -0
- package/dist/plugins/server/server/connectors/connectors.d.ts +87 -0
- package/dist/plugins/server/server/connectors/connectors.js +127 -0
- package/dist/plugins/server/server/connectors/connectors.js.map +1 -0
- package/dist/plugins/server/server/events.d.ts +26 -0
- package/dist/plugins/server/server/events.js +31 -0
- package/dist/plugins/server/server/events.js.map +1 -0
- package/dist/plugins/server/server/jobs.d.ts +12 -0
- package/dist/plugins/server/server/jobs.js +77 -0
- package/dist/plugins/server/server/jobs.js.map +1 -0
- package/dist/plugins/server/server/utils/validation.d.ts +7 -0
- package/dist/plugins/server/server/utils/validation.js +38 -0
- package/dist/plugins/server/server/utils/validation.js.map +1 -0
- package/dist/plugins/server/types.d.ts +334 -0
- package/dist/plugins/server/types.js +78 -0
- package/dist/plugins/server/types.js.map +1 -0
- package/dist/server/constants.js +29 -0
- package/dist/server/plugins/server/Cache.js +15 -0
- package/dist/server/server/api/api.js +20 -0
- package/dist/server/server/api/connectorApi.js +216 -0
- package/dist/server/server/api/publicationApi.js +108 -0
- package/dist/server/server/api/websiteApi.js +296 -0
- package/dist/server/server/cli.js +68 -0
- package/dist/server/server/config.js +120 -0
- package/dist/server/server/connectors/FsHosting.js +35 -0
- package/dist/server/server/connectors/FsStorage.js +225 -0
- package/dist/server/server/connectors/connectors.js +89 -0
- package/dist/server/server/events.js +14 -0
- package/dist/server/server/expose.js +27 -0
- package/dist/server/server/express.js +47 -0
- package/dist/server/server/index.js +90 -0
- package/dist/server/server/jobs.js +48 -0
- package/dist/server/server/utils/validation.js +15 -0
- package/dist/server/types.js +34 -0
- package/package.json +209 -0
- package/public/assets/container.png +0 -0
- package/public/assets/favicon.png +0 -0
- package/public/assets/logo-silex-small.png +0 -0
- package/public/robots.txt +2 -0
- package/public/silex.js +24 -0
- package/src/css/_mixins.scss +8 -0
- package/src/css/_variables.scss +33 -0
- package/src/css/dialog.scss +41 -0
- package/src/css/footer.scss +12 -0
- package/src/css/grapesjs-light.scss +180 -0
- package/src/css/grapesjs.scss +152 -0
- package/src/css/index.scss +32 -0
- package/src/css/light.scss +7 -0
- package/src/css/loader.scss +12 -0
- package/src/css/page-panel.scss +65 -0
- package/src/css/project-bar.scss +102 -0
- package/src/css/silex.scss +189 -0
- package/src/css/website-info.scss +14 -0
- package/src/html/debug.pug +8 -0
- package/src/html/index.pug +39 -0
- package/src/html/templates/includes.pug +1 -0
- package/src/html/templates/workspace.pug +2 -0
- package/src/ts/client/api.ts +144 -0
- package/src/ts/client/assetUrl.test.ts +125 -0
- package/src/ts/client/assetUrl.ts +235 -0
- package/src/ts/client/config.ts +105 -0
- package/src/ts/client/events.ts +34 -0
- package/src/ts/client/expose.ts +30 -0
- package/src/ts/client/grapesjs/LoginDialog.ts +204 -0
- package/src/ts/client/grapesjs/PublicationManager.ts +370 -0
- package/src/ts/client/grapesjs/PublicationUi.ts +342 -0
- package/src/ts/client/grapesjs/blocks.ts +37 -0
- package/src/ts/client/grapesjs/breadcrumbs.ts +79 -0
- package/src/ts/client/grapesjs/eleventy.ts +47 -0
- package/src/ts/client/grapesjs/footer.ts +27 -0
- package/src/ts/client/grapesjs/index.ts +335 -0
- package/src/ts/client/grapesjs/internal-links.test.ts +105 -0
- package/src/ts/client/grapesjs/internal-links.ts +225 -0
- package/src/ts/client/grapesjs/new-page-dialog.ts +90 -0
- package/src/ts/client/grapesjs/openImport.ts +81 -0
- package/src/ts/client/grapesjs/page-panel.ts +118 -0
- package/src/ts/client/grapesjs/project-bar.ts +107 -0
- package/src/ts/client/grapesjs/rich-text.ts +33 -0
- package/src/ts/client/grapesjs/semantic.ts +114 -0
- package/src/ts/client/grapesjs/settings.ts +208 -0
- package/src/ts/client/grapesjs/storage.ts +121 -0
- package/src/ts/client/grapesjs/symbolDialogs.ts +38 -0
- package/src/ts/client/index.ts +98 -0
- package/src/ts/client/publication-transformers.test.ts +199 -0
- package/src/ts/client/publication-transformers.ts +263 -0
- package/src/ts/client/utils.ts +28 -0
- package/src/ts/constants.ts +52 -0
- package/src/ts/externs.ts +18 -0
- package/src/ts/page.ts +31 -0
- package/src/ts/plugins/client/11ty.ts +104 -0
- package/src/ts/plugins/client/publicationRenderer.ts +174 -0
- package/src/ts/plugins/client/template.ts +192 -0
- package/src/ts/plugins/client/website-info.ts +84 -0
- package/src/ts/plugins/server/AuthPlugin.ts +38 -0
- package/src/ts/plugins/server/Cache.ts +28 -0
- package/src/ts/plugins/server/DownloadConnector.ts +148 -0
- package/src/ts/plugins/server/FtpConnector.test.ts +82 -0
- package/src/ts/plugins/server/FtpConnector.ts +609 -0
- package/src/ts/plugins/server/GitlabConnector.ts +644 -0
- package/src/ts/plugins/server/PublicationOptimizer.ts +14 -0
- package/src/ts/plugins/server/SslPlugin.ts +84 -0
- package/src/ts/plugins/server/StaticPlugin.ts +79 -0
- package/src/ts/server/api/api.ts +19 -0
- package/src/ts/server/api/connectorApi.ts +345 -0
- package/src/ts/server/api/publicationApi.ts +159 -0
- package/src/ts/server/api/websiteApi.ts +432 -0
- package/src/ts/server/cli.ts +65 -0
- package/src/ts/server/config.ts +189 -0
- package/src/ts/server/connectors/FsHosting.ts +60 -0
- package/src/ts/server/connectors/FsStorage.test.ts +51 -0
- package/src/ts/server/connectors/FsStorage.ts +261 -0
- package/src/ts/server/connectors/connectors.ts +203 -0
- package/src/ts/server/events.ts +37 -0
- package/src/ts/server/expose.ts +19 -0
- package/src/ts/server/express.ts +70 -0
- package/src/ts/server/index.ts +100 -0
- package/src/ts/server/jobs.test.ts +75 -0
- package/src/ts/server/jobs.ts +87 -0
- package/src/ts/server/utils/BackwardCompat.ts +552 -0
- package/src/ts/server/utils/validation.ts +34 -0
- package/src/ts/types.ts +339 -0
package/src/ts/types.ts
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Silex website builder, free/libre no-code tool for makers.
|
|
3
|
+
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU Affero General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @fileoverview define types for Silex client and server
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// Publication API
|
|
23
|
+
export interface PublicationSettings {
|
|
24
|
+
connector?: ConnectorData, // Set by the postMessage from the login callback page
|
|
25
|
+
options?: ConnectorOptions, // Options for the publication connector saved with the site
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface WebsiteFile {
|
|
29
|
+
html: string,
|
|
30
|
+
css: string,
|
|
31
|
+
htmlPath: string,
|
|
32
|
+
cssPath: string,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class ApiError extends Error {
|
|
36
|
+
constructor(message: string, public readonly httpStatusCode: number) {
|
|
37
|
+
super(message)
|
|
38
|
+
console.info('API error', httpStatusCode, message)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// **
|
|
43
|
+
// HTTP API types
|
|
44
|
+
export type ApiResponseError = { message: string }
|
|
45
|
+
export type ApiPublicationPublishBody = WebsiteData // this contains the connectorId
|
|
46
|
+
export type ApiPublicationPublishQuery = { websiteId: WebsiteId, hostingId: ConnectorId, storageId: ConnectorId, options: ConnectorOptions}
|
|
47
|
+
export type ApiPublicationPublishResponse = { url: string, job: PublicationJobData }
|
|
48
|
+
export type ApiPublicationStatusQuery = { jobId: JobId }
|
|
49
|
+
export type ApiPublicationStatusResponse = PublicationJobData
|
|
50
|
+
export type ApiWebsiteReadQuery = { websiteId: WebsiteId, connectorId?: ConnectorId }
|
|
51
|
+
export type ApiWebsiteReadResponse = WebsiteData
|
|
52
|
+
export type ApiWebsiteListQuery = { connectorId?: ConnectorId }
|
|
53
|
+
export type ApiWebsiteListResponse = WebsiteMeta[]
|
|
54
|
+
export type ApiWebsiteWriteQuery = { websiteId: WebsiteId, connectorId?: ConnectorId }
|
|
55
|
+
export type ApiWebsiteWriteBody = WebsiteData
|
|
56
|
+
export type ApiWebsiteWriteResponse = { message: string }
|
|
57
|
+
export type ApiWebsiteCreateQuery = { connectorId?: ConnectorId }
|
|
58
|
+
export type ApiWebsiteCreateBody = WebsiteMetaFileContent
|
|
59
|
+
export type ApiWebsiteCreateResponse = { message: string }
|
|
60
|
+
export type ApiWebsiteDeleteQuery = { websiteId: WebsiteId, connectorId?: ConnectorId }
|
|
61
|
+
export type ApiWebsiteMetaReadQuery = { websiteId: WebsiteId, connectorId?: ConnectorId }
|
|
62
|
+
export type ApiWebsiteMetaReadResponse = WebsiteMeta
|
|
63
|
+
export type ApiWebsiteMetaWriteQuery = { websiteId: WebsiteId, connectorId?: ConnectorId }
|
|
64
|
+
export type ApiWebsiteMetaWriteBody = WebsiteMetaFileContent
|
|
65
|
+
export type ApiWebsiteMetaWriteResponse = { message: string }
|
|
66
|
+
export type ApiWebsiteAssetsReadQuery = { websiteId: WebsiteId, connectorId?: ConnectorId }
|
|
67
|
+
export type ApiWebsiteAssetsReadParams = { path: string }
|
|
68
|
+
export type ApiWebsiteAssetsReadResponse = string
|
|
69
|
+
export type ApiWebsiteAssetsWriteQuery = { websiteId: WebsiteId, connectorId?: ConnectorId }
|
|
70
|
+
export type ApiWebsiteAssetsWriteBody = ClientSideFile[]
|
|
71
|
+
export type ApiWebsiteAssetsWriteResponse = { data: string[] }
|
|
72
|
+
export type ApiConnectorListQuery = { type: ConnectorType }
|
|
73
|
+
export type ApiConnectorListResponse = ConnectorData[]
|
|
74
|
+
export type ApiConnectorLoginQuery = { connectorId: ConnectorId, type: ConnectorType }
|
|
75
|
+
export type ApiConnectorLoggedInPostMessage = { type: string, error: boolean, message: string, connectorId: ConnectorId, options: ConnectorOptions }
|
|
76
|
+
export type ApiConnectorLoginCbkQuery = { connectorId?: ConnectorId, type: ConnectorType, error?: string } // May have any other query params from oauth
|
|
77
|
+
export type ApiConnectorLoginCbkBody = object // Body from basic auth, POST only, contains options and token
|
|
78
|
+
export type ApiConnectorSettingsQuery = { connectorId?: ConnectorId, type: ConnectorType }
|
|
79
|
+
export type ApiConnectorSettingsResponse = string // HTML
|
|
80
|
+
export type ApiConnectorSettingsPostQuery = { connectorId?: ConnectorId, type: ConnectorType }
|
|
81
|
+
export type ApiConnectorSettingsPostBody = ConnectorUserSettings
|
|
82
|
+
export type ApiConnectorSettingsPostResponse = { message: string }
|
|
83
|
+
export type ApiConnectorLogoutQuery = { connectorId?: ConnectorId, type: ConnectorType }
|
|
84
|
+
export type ApiConnectorUserQuery = { connectorId?: ConnectorId, type: ConnectorType }
|
|
85
|
+
export type ApiConnectorUserResponse = ConnectorUser
|
|
86
|
+
|
|
87
|
+
// **
|
|
88
|
+
// Website API
|
|
89
|
+
export const defaultWebsiteData: WebsiteData = {
|
|
90
|
+
//pages: [],
|
|
91
|
+
//assets: [],
|
|
92
|
+
//styles: [],
|
|
93
|
+
//settings: {},
|
|
94
|
+
//fonts: [],
|
|
95
|
+
//symbols: [],
|
|
96
|
+
//publication: {},
|
|
97
|
+
} as WebsiteData
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
// **
|
|
101
|
+
// Grapesjs types
|
|
102
|
+
// From grapesjs, not imported because it breaks the build on the server side
|
|
103
|
+
export interface Component {
|
|
104
|
+
type: string,
|
|
105
|
+
content?: string,
|
|
106
|
+
attributes: { [key: string]: string },
|
|
107
|
+
components: Component[],
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface Page {
|
|
111
|
+
id: string,
|
|
112
|
+
name: string,
|
|
113
|
+
slug: string,
|
|
114
|
+
settings: WebsiteSettings, // TODO: why is this here? It is used in the publication manager
|
|
115
|
+
frames: {
|
|
116
|
+
component: Component,
|
|
117
|
+
}[]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface WebsiteData {
|
|
121
|
+
pages: Page[],
|
|
122
|
+
assets: Asset[],
|
|
123
|
+
styles: Style[],
|
|
124
|
+
//name: string,
|
|
125
|
+
settings: WebsiteSettings,
|
|
126
|
+
fonts: Font[],
|
|
127
|
+
symbols: symbol[],
|
|
128
|
+
publication: PublicationSettings,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface PublicationData extends WebsiteData {
|
|
132
|
+
files?: ClientSideFile[], // Added by the client for publish
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface WebsiteSettings {
|
|
136
|
+
description?: string,
|
|
137
|
+
title?: string,
|
|
138
|
+
lang?: string,
|
|
139
|
+
head?: string,
|
|
140
|
+
favicon?: string,
|
|
141
|
+
'og:title'?: string,
|
|
142
|
+
'og:description'?: string,
|
|
143
|
+
'og:image'?: string,
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface Font {
|
|
147
|
+
name: string,
|
|
148
|
+
value: string,
|
|
149
|
+
variants: string[],
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
//export interface Frame {
|
|
153
|
+
// component: { type: string, stylable: string[] },
|
|
154
|
+
// components: Component[],
|
|
155
|
+
//}
|
|
156
|
+
//
|
|
157
|
+
//export interface Component {
|
|
158
|
+
// type: string,
|
|
159
|
+
// content?: string,
|
|
160
|
+
// attributes: { [key: string]: string },
|
|
161
|
+
// conponents: Component[],
|
|
162
|
+
//}
|
|
163
|
+
|
|
164
|
+
export enum Unit {
|
|
165
|
+
PX = 'px',
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface Asset {
|
|
169
|
+
type: string,
|
|
170
|
+
src: string,
|
|
171
|
+
unitDim: Unit,
|
|
172
|
+
height: number,
|
|
173
|
+
width: number,
|
|
174
|
+
name: string,
|
|
175
|
+
path?: string, // Set by the publication renderer, this is the path in the hosting storage after publication
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface Style {
|
|
179
|
+
selectors: Selector[],
|
|
180
|
+
style: { [key: string]: string },
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export type Selector = string | {
|
|
184
|
+
name: string,
|
|
185
|
+
type: number,
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// **
|
|
189
|
+
// Connector API
|
|
190
|
+
/**
|
|
191
|
+
* Type for a connector id
|
|
192
|
+
*/
|
|
193
|
+
export type ConnectorId = string
|
|
194
|
+
|
|
195
|
+
export type ConnectorOptions = {
|
|
196
|
+
websiteUrl?: string, // For publication UI
|
|
197
|
+
[key: string]: any,
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export enum ClientSideFileType {
|
|
201
|
+
HTML = 'html',
|
|
202
|
+
ASSET = 'asset',
|
|
203
|
+
CSS = 'css',
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Type for a client side file when the content is not available, used to handle file names and paths and urls
|
|
208
|
+
*/
|
|
209
|
+
export interface ClientSideFileWithPermalink {
|
|
210
|
+
path: string, // Path in the connector
|
|
211
|
+
permalink: string, // Used to link to the file
|
|
212
|
+
type: ClientSideFileType,
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Type for a client side file when the content is available as a string
|
|
217
|
+
*/
|
|
218
|
+
export interface ClientSideFileWithContent {
|
|
219
|
+
path: string,
|
|
220
|
+
content: string, // Not buffer because it's sent from the client in JSON
|
|
221
|
+
type: ClientSideFileType
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Type for a client side file when the content is in the connector
|
|
226
|
+
*/
|
|
227
|
+
export interface ClientSideFileWithSrc {
|
|
228
|
+
path: string,
|
|
229
|
+
src: string, // Where to download the file, a path for the storage connector
|
|
230
|
+
type: ClientSideFileType
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Type for a client side file
|
|
235
|
+
* @see connector/File
|
|
236
|
+
*/
|
|
237
|
+
export type ClientSideFile = ClientSideFileWithContent | ClientSideFileWithSrc
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Type for file listing
|
|
241
|
+
*/
|
|
242
|
+
export interface FileMeta {
|
|
243
|
+
name: string
|
|
244
|
+
isDir: boolean
|
|
245
|
+
size: number
|
|
246
|
+
createdAt: Date
|
|
247
|
+
updatedAt: Date
|
|
248
|
+
metadata?: object
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Enum to express if the connector is a storage or a hosting
|
|
253
|
+
*/
|
|
254
|
+
export enum ConnectorType {
|
|
255
|
+
STORAGE = 'STORAGE',
|
|
256
|
+
HOSTING = 'HOSTING',
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Type for a website id
|
|
261
|
+
*/
|
|
262
|
+
export type WebsiteId = string
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Back end data shared with the front end
|
|
266
|
+
*/
|
|
267
|
+
export interface ConnectorData {
|
|
268
|
+
connectorId: ConnectorId
|
|
269
|
+
type: ConnectorType
|
|
270
|
+
displayName: string
|
|
271
|
+
icon: string
|
|
272
|
+
disableLogout: boolean
|
|
273
|
+
isLoggedIn: boolean
|
|
274
|
+
oauthUrl: string | null
|
|
275
|
+
color: string
|
|
276
|
+
background: string
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* User settings for a connector and for a given website
|
|
281
|
+
*/
|
|
282
|
+
export type ConnectorUserSettings = {
|
|
283
|
+
[websiteId: string]: object
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Back end data shared with the front end
|
|
288
|
+
*/
|
|
289
|
+
export interface ConnectorUser {
|
|
290
|
+
name: string
|
|
291
|
+
email?: string
|
|
292
|
+
picture?: string
|
|
293
|
+
storage: ConnectorData
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface WebsiteMetaFileContent {
|
|
297
|
+
name: string
|
|
298
|
+
imageUrl?: string
|
|
299
|
+
connectorUserSettings: ConnectorUserSettings
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Back end data sent to the front end
|
|
304
|
+
* Meta data can be the root path of the websites, or the bucket name, etc.
|
|
305
|
+
*/
|
|
306
|
+
export interface WebsiteMeta extends WebsiteMetaFileContent {
|
|
307
|
+
websiteId: WebsiteId
|
|
308
|
+
createdAt: Date
|
|
309
|
+
updatedAt: Date
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Enum to express if the job is in progress or finished or errored
|
|
314
|
+
*/
|
|
315
|
+
export enum JobStatus {
|
|
316
|
+
IN_PROGRESS = 'IN_PROGRESS',
|
|
317
|
+
SUCCESS = 'SUCCESS',
|
|
318
|
+
ERROR = 'ERROR',
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Id used to track the progress of a publication
|
|
323
|
+
*/
|
|
324
|
+
export type JobId = string
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Data structure which is sent to the client to display the progress of a job
|
|
328
|
+
*/
|
|
329
|
+
export interface JobData {
|
|
330
|
+
jobId: JobId // The job id
|
|
331
|
+
status: JobStatus // status code
|
|
332
|
+
message: string // status to display
|
|
333
|
+
_timeout?: ReturnType<typeof setTimeout> // Internal use
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface PublicationJobData extends JobData {
|
|
337
|
+
logs: string[][]
|
|
338
|
+
errors: string[][]
|
|
339
|
+
}
|