@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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throw an error if a parameter is missing
|
|
3
|
+
* @param value the value to check
|
|
4
|
+
* @param name the name of the parameter
|
|
5
|
+
* @throws Error if the parameter is missing
|
|
6
|
+
*/
|
|
7
|
+
export declare function requiredParam<T>(value: T | undefined, name: string, defaultValue?: T): NonNullable<T>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Silex website builder, free/libre no-code tool for makers.
|
|
4
|
+
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.requiredParam = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* Throw an error if a parameter is missing
|
|
22
|
+
* @param value the value to check
|
|
23
|
+
* @param name the name of the parameter
|
|
24
|
+
* @throws Error if the parameter is missing
|
|
25
|
+
*/
|
|
26
|
+
function requiredParam(value, name, defaultValue) {
|
|
27
|
+
if (value === undefined) {
|
|
28
|
+
if (defaultValue !== undefined) {
|
|
29
|
+
return defaultValue;
|
|
30
|
+
}
|
|
31
|
+
const error = new Error(`Missing required parameter ${name}`);
|
|
32
|
+
console.error(`Missing required parameter ${name}`, error);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
exports.requiredParam = requiredParam;
|
|
38
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../src/ts/server/utils/validation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH;;;;;GAKG;AACH,SAAgB,aAAa,CAAI,KAAoB,EAAE,IAAY,EAAE,YAAgB;IACnF,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,OAAO,YAA8B,CAAA;SACtC;QACD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAA;QAC7D,OAAO,CAAC,KAAK,CAAC,8BAA8B,IAAI,EAAE,EAAE,KAAK,CAAC,CAAA;QAC1D,MAAM,KAAK,CAAA;KACZ;IACD,OAAO,KAAuB,CAAA;AAChC,CAAC;AAVD,sCAUC"}
|
|
@@ -0,0 +1,334 @@
|
|
|
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 ApiWebsiteMetaReadQuery = {
|
|
65
|
+
websiteId: WebsiteId;
|
|
66
|
+
connectorId?: ConnectorId;
|
|
67
|
+
};
|
|
68
|
+
export type ApiWebsiteMetaReadResponse = WebsiteMeta;
|
|
69
|
+
export type ApiWebsiteMetaWriteQuery = {
|
|
70
|
+
websiteId: WebsiteId;
|
|
71
|
+
connectorId?: ConnectorId;
|
|
72
|
+
};
|
|
73
|
+
export type ApiWebsiteMetaWriteBody = WebsiteMetaFileContent;
|
|
74
|
+
export type ApiWebsiteMetaWriteResponse = {
|
|
75
|
+
message: string;
|
|
76
|
+
};
|
|
77
|
+
export type ApiWebsiteAssetsReadQuery = {
|
|
78
|
+
websiteId: WebsiteId;
|
|
79
|
+
connectorId?: ConnectorId;
|
|
80
|
+
};
|
|
81
|
+
export type ApiWebsiteAssetsReadParams = {
|
|
82
|
+
path: string;
|
|
83
|
+
};
|
|
84
|
+
export type ApiWebsiteAssetsReadResponse = string;
|
|
85
|
+
export type ApiWebsiteAssetsWriteQuery = {
|
|
86
|
+
websiteId: WebsiteId;
|
|
87
|
+
connectorId?: ConnectorId;
|
|
88
|
+
};
|
|
89
|
+
export type ApiWebsiteAssetsWriteBody = ClientSideFile[];
|
|
90
|
+
export type ApiWebsiteAssetsWriteResponse = {
|
|
91
|
+
data: string[];
|
|
92
|
+
};
|
|
93
|
+
export type ApiConnectorListQuery = {
|
|
94
|
+
type: ConnectorType;
|
|
95
|
+
};
|
|
96
|
+
export type ApiConnectorListResponse = ConnectorData[];
|
|
97
|
+
export type ApiConnectorLoginQuery = {
|
|
98
|
+
connectorId: ConnectorId;
|
|
99
|
+
type: ConnectorType;
|
|
100
|
+
};
|
|
101
|
+
export type ApiConnectorLoggedInPostMessage = {
|
|
102
|
+
type: string;
|
|
103
|
+
error: boolean;
|
|
104
|
+
message: string;
|
|
105
|
+
connectorId: ConnectorId;
|
|
106
|
+
options: ConnectorOptions;
|
|
107
|
+
};
|
|
108
|
+
export type ApiConnectorLoginCbkQuery = {
|
|
109
|
+
connectorId?: ConnectorId;
|
|
110
|
+
type: ConnectorType;
|
|
111
|
+
error?: string;
|
|
112
|
+
};
|
|
113
|
+
export type ApiConnectorLoginCbkBody = object;
|
|
114
|
+
export type ApiConnectorSettingsQuery = {
|
|
115
|
+
connectorId?: ConnectorId;
|
|
116
|
+
type: ConnectorType;
|
|
117
|
+
};
|
|
118
|
+
export type ApiConnectorSettingsResponse = string;
|
|
119
|
+
export type ApiConnectorSettingsPostQuery = {
|
|
120
|
+
connectorId?: ConnectorId;
|
|
121
|
+
type: ConnectorType;
|
|
122
|
+
};
|
|
123
|
+
export type ApiConnectorSettingsPostBody = ConnectorUserSettings;
|
|
124
|
+
export type ApiConnectorSettingsPostResponse = {
|
|
125
|
+
message: string;
|
|
126
|
+
};
|
|
127
|
+
export type ApiConnectorLogoutQuery = {
|
|
128
|
+
connectorId?: ConnectorId;
|
|
129
|
+
type: ConnectorType;
|
|
130
|
+
};
|
|
131
|
+
export type ApiConnectorUserQuery = {
|
|
132
|
+
connectorId?: ConnectorId;
|
|
133
|
+
type: ConnectorType;
|
|
134
|
+
};
|
|
135
|
+
export type ApiConnectorUserResponse = ConnectorUser;
|
|
136
|
+
export declare const defaultWebsiteData: WebsiteData;
|
|
137
|
+
export interface Component {
|
|
138
|
+
type: string;
|
|
139
|
+
content?: string;
|
|
140
|
+
attributes: {
|
|
141
|
+
[key: string]: string;
|
|
142
|
+
};
|
|
143
|
+
components: Component[];
|
|
144
|
+
}
|
|
145
|
+
export interface Page {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
slug: string;
|
|
149
|
+
settings: WebsiteSettings;
|
|
150
|
+
frames: {
|
|
151
|
+
component: Component;
|
|
152
|
+
}[];
|
|
153
|
+
}
|
|
154
|
+
export interface WebsiteData {
|
|
155
|
+
pages: Page[];
|
|
156
|
+
assets: Asset[];
|
|
157
|
+
styles: Style[];
|
|
158
|
+
settings: WebsiteSettings;
|
|
159
|
+
fonts: Font[];
|
|
160
|
+
symbols: symbol[];
|
|
161
|
+
publication: PublicationSettings;
|
|
162
|
+
}
|
|
163
|
+
export interface PublicationData extends WebsiteData {
|
|
164
|
+
files?: ClientSideFile[];
|
|
165
|
+
}
|
|
166
|
+
export interface WebsiteSettings {
|
|
167
|
+
description?: string;
|
|
168
|
+
title?: string;
|
|
169
|
+
lang?: string;
|
|
170
|
+
head?: string;
|
|
171
|
+
favicon?: string;
|
|
172
|
+
'og:title'?: string;
|
|
173
|
+
'og:description'?: string;
|
|
174
|
+
'og:image'?: string;
|
|
175
|
+
}
|
|
176
|
+
export interface Font {
|
|
177
|
+
name: string;
|
|
178
|
+
value: string;
|
|
179
|
+
variants: string[];
|
|
180
|
+
}
|
|
181
|
+
export declare enum Unit {
|
|
182
|
+
PX = "px"
|
|
183
|
+
}
|
|
184
|
+
export interface Asset {
|
|
185
|
+
type: string;
|
|
186
|
+
src: string;
|
|
187
|
+
unitDim: Unit;
|
|
188
|
+
height: number;
|
|
189
|
+
width: number;
|
|
190
|
+
name: string;
|
|
191
|
+
path?: string;
|
|
192
|
+
}
|
|
193
|
+
export interface Style {
|
|
194
|
+
selectors: Selector[];
|
|
195
|
+
style: {
|
|
196
|
+
[key: string]: string;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
export type Selector = string | {
|
|
200
|
+
name: string;
|
|
201
|
+
type: number;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Type for a connector id
|
|
205
|
+
*/
|
|
206
|
+
export type ConnectorId = string;
|
|
207
|
+
export type ConnectorOptions = {
|
|
208
|
+
websiteUrl?: string;
|
|
209
|
+
[key: string]: any;
|
|
210
|
+
};
|
|
211
|
+
export declare enum ClientSideFileType {
|
|
212
|
+
HTML = "html",
|
|
213
|
+
ASSET = "asset",
|
|
214
|
+
CSS = "css"
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Type for a client side file when the content is not available, used to handle file names and paths and urls
|
|
218
|
+
*/
|
|
219
|
+
export interface ClientSideFileWithPermalink {
|
|
220
|
+
path: string;
|
|
221
|
+
permalink: string;
|
|
222
|
+
type: ClientSideFileType;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Type for a client side file when the content is available as a string
|
|
226
|
+
*/
|
|
227
|
+
export interface ClientSideFileWithContent {
|
|
228
|
+
path: string;
|
|
229
|
+
content: string;
|
|
230
|
+
type: ClientSideFileType;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Type for a client side file when the content is in the connector
|
|
234
|
+
*/
|
|
235
|
+
export interface ClientSideFileWithSrc {
|
|
236
|
+
path: string;
|
|
237
|
+
src: string;
|
|
238
|
+
type: ClientSideFileType;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Type for a client side file
|
|
242
|
+
* @see connector/File
|
|
243
|
+
*/
|
|
244
|
+
export type ClientSideFile = ClientSideFileWithContent | ClientSideFileWithSrc;
|
|
245
|
+
/**
|
|
246
|
+
* Type for file listing
|
|
247
|
+
*/
|
|
248
|
+
export interface FileMeta {
|
|
249
|
+
name: string;
|
|
250
|
+
isDir: boolean;
|
|
251
|
+
size: number;
|
|
252
|
+
createdAt: Date;
|
|
253
|
+
updatedAt: Date;
|
|
254
|
+
metadata?: object;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Enum to express if the connector is a storage or a hosting
|
|
258
|
+
*/
|
|
259
|
+
export declare enum ConnectorType {
|
|
260
|
+
STORAGE = "STORAGE",
|
|
261
|
+
HOSTING = "HOSTING"
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Type for a website id
|
|
265
|
+
*/
|
|
266
|
+
export type WebsiteId = string;
|
|
267
|
+
/**
|
|
268
|
+
* Back end data shared with the front end
|
|
269
|
+
*/
|
|
270
|
+
export interface ConnectorData {
|
|
271
|
+
connectorId: ConnectorId;
|
|
272
|
+
type: ConnectorType;
|
|
273
|
+
displayName: string;
|
|
274
|
+
icon: string;
|
|
275
|
+
disableLogout: boolean;
|
|
276
|
+
isLoggedIn: boolean;
|
|
277
|
+
oauthUrl: string | null;
|
|
278
|
+
color: string;
|
|
279
|
+
background: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* User settings for a connector and for a given website
|
|
283
|
+
*/
|
|
284
|
+
export type ConnectorUserSettings = {
|
|
285
|
+
[websiteId: string]: object;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Back end data shared with the front end
|
|
289
|
+
*/
|
|
290
|
+
export interface ConnectorUser {
|
|
291
|
+
name: string;
|
|
292
|
+
email?: string;
|
|
293
|
+
picture?: string;
|
|
294
|
+
storage: ConnectorData;
|
|
295
|
+
}
|
|
296
|
+
export interface WebsiteMetaFileContent {
|
|
297
|
+
name: string;
|
|
298
|
+
imageUrl?: string;
|
|
299
|
+
connectorUserSettings: ConnectorUserSettings;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Back end data sent to the front end
|
|
303
|
+
* Meta data can be the root path of the websites, or the bucket name, etc.
|
|
304
|
+
*/
|
|
305
|
+
export interface WebsiteMeta extends WebsiteMetaFileContent {
|
|
306
|
+
websiteId: WebsiteId;
|
|
307
|
+
createdAt: Date;
|
|
308
|
+
updatedAt: Date;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Enum to express if the job is in progress or finished or errored
|
|
312
|
+
*/
|
|
313
|
+
export declare enum JobStatus {
|
|
314
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
315
|
+
SUCCESS = "SUCCESS",
|
|
316
|
+
ERROR = "ERROR"
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Id used to track the progress of a publication
|
|
320
|
+
*/
|
|
321
|
+
export type JobId = string;
|
|
322
|
+
/**
|
|
323
|
+
* Data structure which is sent to the client to display the progress of a job
|
|
324
|
+
*/
|
|
325
|
+
export interface JobData {
|
|
326
|
+
jobId: JobId;
|
|
327
|
+
status: JobStatus;
|
|
328
|
+
message: string;
|
|
329
|
+
_timeout?: ReturnType<typeof setTimeout>;
|
|
330
|
+
}
|
|
331
|
+
export interface PublicationJobData extends JobData {
|
|
332
|
+
logs: string[][];
|
|
333
|
+
errors: string[][];
|
|
334
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Silex website builder, free/libre no-code tool for makers.
|
|
4
|
+
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.JobStatus = exports.ConnectorType = exports.ClientSideFileType = exports.Unit = exports.defaultWebsiteData = exports.ApiError = void 0;
|
|
20
|
+
class ApiError extends Error {
|
|
21
|
+
httpStatusCode;
|
|
22
|
+
constructor(message, httpStatusCode) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.httpStatusCode = httpStatusCode;
|
|
25
|
+
console.info('API error', httpStatusCode, message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.ApiError = ApiError;
|
|
29
|
+
// **
|
|
30
|
+
// Website API
|
|
31
|
+
exports.defaultWebsiteData = {
|
|
32
|
+
//pages: [],
|
|
33
|
+
//assets: [],
|
|
34
|
+
//styles: [],
|
|
35
|
+
//settings: {},
|
|
36
|
+
//fonts: [],
|
|
37
|
+
//symbols: [],
|
|
38
|
+
//publication: {},
|
|
39
|
+
};
|
|
40
|
+
//export interface Frame {
|
|
41
|
+
// component: { type: string, stylable: string[] },
|
|
42
|
+
// components: Component[],
|
|
43
|
+
//}
|
|
44
|
+
//
|
|
45
|
+
//export interface Component {
|
|
46
|
+
// type: string,
|
|
47
|
+
// content?: string,
|
|
48
|
+
// attributes: { [key: string]: string },
|
|
49
|
+
// conponents: Component[],
|
|
50
|
+
//}
|
|
51
|
+
var Unit;
|
|
52
|
+
(function (Unit) {
|
|
53
|
+
Unit["PX"] = "px";
|
|
54
|
+
})(Unit || (exports.Unit = Unit = {}));
|
|
55
|
+
var ClientSideFileType;
|
|
56
|
+
(function (ClientSideFileType) {
|
|
57
|
+
ClientSideFileType["HTML"] = "html";
|
|
58
|
+
ClientSideFileType["ASSET"] = "asset";
|
|
59
|
+
ClientSideFileType["CSS"] = "css";
|
|
60
|
+
})(ClientSideFileType || (exports.ClientSideFileType = ClientSideFileType = {}));
|
|
61
|
+
/**
|
|
62
|
+
* Enum to express if the connector is a storage or a hosting
|
|
63
|
+
*/
|
|
64
|
+
var ConnectorType;
|
|
65
|
+
(function (ConnectorType) {
|
|
66
|
+
ConnectorType["STORAGE"] = "STORAGE";
|
|
67
|
+
ConnectorType["HOSTING"] = "HOSTING";
|
|
68
|
+
})(ConnectorType || (exports.ConnectorType = ConnectorType = {}));
|
|
69
|
+
/**
|
|
70
|
+
* Enum to express if the job is in progress or finished or errored
|
|
71
|
+
*/
|
|
72
|
+
var JobStatus;
|
|
73
|
+
(function (JobStatus) {
|
|
74
|
+
JobStatus["IN_PROGRESS"] = "IN_PROGRESS";
|
|
75
|
+
JobStatus["SUCCESS"] = "SUCCESS";
|
|
76
|
+
JobStatus["ERROR"] = "ERROR";
|
|
77
|
+
})(JobStatus || (exports.JobStatus = JobStatus = {}));
|
|
78
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ts/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAmBH,MAAa,QAAS,SAAQ,KAAK;IACY;IAA7C,YAAY,OAAe,EAAkB,cAAsB;QACjE,KAAK,CAAC,OAAO,CAAC,CAAA;QAD6B,mBAAc,GAAd,cAAc,CAAQ;QAEjE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;IACpD,CAAC;CACF;AALD,4BAKC;AA+CD,KAAK;AACL,cAAc;AACD,QAAA,kBAAkB,GAAgB;AAC7C,YAAY;AACZ,aAAa;AACb,aAAa;AACb,eAAe;AACf,YAAY;AACZ,cAAc;AACd,kBAAkB;CACJ,CAAA;AAuDhB,0BAA0B;AAC1B,oDAAoD;AACpD,4BAA4B;AAC5B,GAAG;AACH,EAAE;AACF,8BAA8B;AAC9B,iBAAiB;AACjB,qBAAqB;AACrB,0CAA0C;AAC1C,4BAA4B;AAC5B,GAAG;AAEH,IAAY,IAEX;AAFD,WAAY,IAAI;IACd,iBAAS,CAAA;AACX,CAAC,EAFW,IAAI,oBAAJ,IAAI,QAEf;AAkCD,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,qCAAe,CAAA;IACf,iCAAW,CAAA;AACb,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AA+CD;;GAEG;AACH,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;AACrB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAuDD;;GAEG;AACH,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gCAAmB,CAAA;IACnB,4BAAe,CAAA;AACjB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_WEBSITE_META_WRITE = exports.API_WEBSITE_META_READ = exports.API_WEBSITE_ASSETS_WRITE = exports.API_WEBSITE_ASSET_READ = exports.API_WEBSITE_LIST = exports.API_WEBSITE_DELETE = exports.API_WEBSITE_CREATE = exports.API_WEBSITE_WRITE = exports.API_WEBSITE_READ = exports.API_WEBSITE_PATH = exports.API_PUBLICATION_STATUS = exports.API_PUBLICATION_PUBLISH = exports.API_PUBLICATION_PATH = exports.API_CONNECTOR_LOGIN_CALLBACK = exports.API_CONNECTOR_SETTINGS = exports.API_CONNECTOR_LOGIN = exports.API_CONNECTOR_LOGOUT = exports.API_CONNECTOR_LIST = exports.API_CONNECTOR_USER = exports.API_CONNECTOR_PATH = exports.API_PATH = exports.CLIENT_CONFIG_FILE_NAME = exports.DEFAULT_LANGUAGE = exports.DEFAULT_WEBSITE_ID = exports.WEBSITE_META_DATA_FILE = exports.WEBSITE_DATA_FILE = void 0;
|
|
4
|
+
exports.WEBSITE_DATA_FILE = 'website.json';
|
|
5
|
+
exports.WEBSITE_META_DATA_FILE = 'meta.json';
|
|
6
|
+
exports.DEFAULT_WEBSITE_ID = 'default';
|
|
7
|
+
exports.DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
exports.CLIENT_CONFIG_FILE_NAME = 'silex.js';
|
|
9
|
+
exports.API_PATH = '/api';
|
|
10
|
+
exports.API_CONNECTOR_PATH = '/connector';
|
|
11
|
+
exports.API_CONNECTOR_USER = '/user';
|
|
12
|
+
exports.API_CONNECTOR_LIST = '/';
|
|
13
|
+
exports.API_CONNECTOR_LOGOUT = '/logout';
|
|
14
|
+
exports.API_CONNECTOR_LOGIN = '/login';
|
|
15
|
+
exports.API_CONNECTOR_SETTINGS = '/settings';
|
|
16
|
+
exports.API_CONNECTOR_LOGIN_CALLBACK = '/login/callback';
|
|
17
|
+
exports.API_PUBLICATION_PATH = '/publication';
|
|
18
|
+
exports.API_PUBLICATION_PUBLISH = '/';
|
|
19
|
+
exports.API_PUBLICATION_STATUS = '/publication/status';
|
|
20
|
+
exports.API_WEBSITE_PATH = '/website';
|
|
21
|
+
exports.API_WEBSITE_READ = '/';
|
|
22
|
+
exports.API_WEBSITE_WRITE = '/';
|
|
23
|
+
exports.API_WEBSITE_CREATE = '/';
|
|
24
|
+
exports.API_WEBSITE_DELETE = '/';
|
|
25
|
+
exports.API_WEBSITE_LIST = '/';
|
|
26
|
+
exports.API_WEBSITE_ASSET_READ = '/assets';
|
|
27
|
+
exports.API_WEBSITE_ASSETS_WRITE = '/assets';
|
|
28
|
+
exports.API_WEBSITE_META_READ = '/meta';
|
|
29
|
+
exports.API_WEBSITE_META_WRITE = '/meta';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withCache = exports.noCache = void 0;
|
|
4
|
+
function noCache(req, res, next) {
|
|
5
|
+
res.header('Cache-Control', 'private,no-cache,no-store,must-revalidate,proxy-revalidate');
|
|
6
|
+
res.header('Expires', '-1');
|
|
7
|
+
res.header('Pragma', 'no-cache');
|
|
8
|
+
next();
|
|
9
|
+
}
|
|
10
|
+
exports.noCache = noCache;
|
|
11
|
+
function withCache(req, res, next) {
|
|
12
|
+
res.header('Cache-Control', 'public,max-age=86400,immutable');
|
|
13
|
+
next();
|
|
14
|
+
}
|
|
15
|
+
exports.withCache = withCache;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const express_1 = require("express");
|
|
7
|
+
const Cache_1 = require("../../plugins/server/Cache");
|
|
8
|
+
const connectorApi_1 = __importDefault(require("./connectorApi"));
|
|
9
|
+
const websiteApi_1 = __importDefault(require("./websiteApi"));
|
|
10
|
+
const publicationApi_1 = __importDefault(require("./publicationApi"));
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
12
|
+
function default_1(config) {
|
|
13
|
+
const router = (0, express_1.Router)();
|
|
14
|
+
router.use(Cache_1.noCache);
|
|
15
|
+
router.use(constants_1.API_CONNECTOR_PATH, (0, connectorApi_1.default)(config));
|
|
16
|
+
router.use(constants_1.API_WEBSITE_PATH, (0, websiteApi_1.default)(config));
|
|
17
|
+
router.use(constants_1.API_PUBLICATION_PATH, (0, publicationApi_1.default)(config));
|
|
18
|
+
return router;
|
|
19
|
+
}
|
|
20
|
+
exports.default = default_1;
|