@silexlabs/silex 3.7.0 → 3.9.0-canary.2
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 +115 -78
- package/common/examples/plugin.js +6 -0
- package/common/silex-plugins/config.test.ts +71 -0
- package/common/silex-plugins/config.ts +25 -0
- package/common/silex-plugins/index.ts +2 -0
- package/common/silex-plugins/plugin.test.ts +57 -0
- package/common/silex-plugins/plugin.ts +65 -0
- package/dist/client/css/admin.css +25 -12
- package/dist/client/css/all.min.css +5 -5
- package/dist/client/index.html +2 -2
- package/dist/client/js/main.js +3108 -2940
- package/dist/client/js/main.js.LICENSE.txt +6 -4
- package/dist/client/webfonts/fa-brands-400.woff2 +0 -0
- package/dist/client/webfonts/fa-regular-400.woff2 +0 -0
- package/dist/client/webfonts/fa-solid-900.woff2 +0 -0
- package/dist/client/webfonts/fa-v4compatibility.woff2 +0 -0
- package/dist/server/common/externs.js +2 -0
- package/dist/server/common/silex-plugins/config.js +25 -0
- package/dist/server/common/silex-plugins/index.js +18 -0
- package/dist/server/common/silex-plugins/plugin.js +41 -0
- package/dist/server/server/api/api.js +9 -9
- package/dist/server/server/api/connectorApi.js +35 -35
- package/dist/server/server/api/publicationApi.js +19 -19
- package/dist/server/server/api/websiteApi.js +46 -46
- package/dist/server/server/config.js +19 -19
- package/dist/server/server/connectors/FsHosting.js +6 -6
- package/dist/server/server/connectors/FsStorage.js +35 -35
- package/dist/server/server/connectors/connectors.js +3 -3
- package/dist/server/server/expose.js +18 -8
- package/dist/server/server/express.js +3 -3
- package/dist/server/server/index.js +29 -19
- package/dist/server/server/jobs.js +4 -4
- package/dist/{plugins/server/plugins/server → server/server/plugins}/DownloadConnector.js +23 -28
- package/dist/{plugins/server/plugins/server → server/server/plugins}/FtpConnector.js +42 -117
- package/dist/{plugins/server/plugins/server → server/server/plugins}/GitlabConnector.js +80 -271
- package/dist/{plugins/server/plugins/server → server/server/plugins}/GitlabHostingConnector.js +11 -134
- package/dist/server/server/plugins/PublicationOptimizer.js +2 -0
- package/dist/{plugins/server/plugins/server → server/server/plugins}/SslPlugin.js +3 -32
- package/dist/{plugins/server/plugins/server → server/server/plugins}/StaticPlugin.js +4 -21
- package/dist/server/server/utils/BackwardCompat.js +2 -0
- package/dist/server/server/utils/websiteDataSerialization.js +10 -10
- package/{src/ts/client → editor}/api.ts +2 -2
- package/{src/ts/client → editor}/assetUrl.test.ts +6 -33
- package/{src/ts/client → editor}/assetUrl.ts +2 -2
- package/{src/ts/client → editor}/config.ts +3 -3
- package/{src/css/theme-modern.scss → editor/css/design-system.scss} +29 -14
- package/{src → editor}/css/index.scss +1 -3
- package/{src → editor}/css/project-bar.scss +5 -0
- package/{src/ts/client → editor}/expose.ts +3 -3
- package/{src/ts/client → editor}/grapesjs/LoginDialog.ts +3 -3
- package/{src/ts/client → editor}/grapesjs/PublicationManager.ts +3 -3
- package/{src/ts/client → editor}/grapesjs/PublicationUi.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/cms/index.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/cms/page-settings.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/cms/publication.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/eleventy.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/index.ts +5 -3
- package/{src/ts/client → editor}/grapesjs/internal-links.ts +2 -2
- package/{src/ts/client → editor}/grapesjs/resize-panel.ts +2 -1
- package/{src/ts/client → editor}/grapesjs/settings-sections.ts +1 -1
- package/{src/ts/client → editor}/grapesjs/settings.ts +2 -2
- package/{src/ts/client → editor}/grapesjs/storage.ts +1 -1
- package/editor/grapesjs/website-info.ts +52 -0
- package/{src/ts/client → editor}/index.ts +1 -1
- package/{src/ts/client → editor}/publication-transformers.test.ts +10 -10
- package/{src/ts/client → editor}/publication-transformers.ts +1 -1
- package/{src/ts/client → editor}/publish-fonts.ts +2 -2
- package/grapesjs-plugins/expression-input/.husky/pre-commit +2 -0
- package/grapesjs-plugins/expression-input/.prettierrc.json +7 -0
- package/grapesjs-plugins/expression-input/.vscode/extensions.json +9 -0
- package/grapesjs-plugins/expression-input/CHANGELOG.md +47 -0
- package/grapesjs-plugins/expression-input/LICENSE +661 -0
- package/grapesjs-plugins/expression-input/README.md +59 -0
- package/grapesjs-plugins/expression-input/babel.config.js +3 -0
- package/grapesjs-plugins/expression-input/commitlint.config.js +1 -0
- package/grapesjs-plugins/expression-input/dev/README.md +1 -0
- package/grapesjs-plugins/expression-input/dev/expression-input.html +148 -0
- package/grapesjs-plugins/expression-input/dev/input-chain.html +88 -0
- package/grapesjs-plugins/expression-input/dev/popin-form.html +83 -0
- package/grapesjs-plugins/expression-input/docs/expression-input.md +173 -0
- package/grapesjs-plugins/expression-input/docs/popin-form.md +228 -0
- package/grapesjs-plugins/expression-input/eslint.config.mjs +71 -0
- package/grapesjs-plugins/expression-input/package.json +84 -0
- package/grapesjs-plugins/expression-input/playwright.config.ts +6 -0
- package/grapesjs-plugins/expression-input/rollup.config.js +39 -0
- package/grapesjs-plugins/expression-input/src/expression-input.ts +339 -0
- package/grapesjs-plugins/expression-input/src/index.ts +3 -0
- package/grapesjs-plugins/expression-input/src/input-chain.ts +216 -0
- package/grapesjs-plugins/expression-input/src/popin-form.ts +189 -0
- package/grapesjs-plugins/expression-input/src/popin-overlay.ts +188 -0
- package/grapesjs-plugins/expression-input/src/styles.ts +374 -0
- package/grapesjs-plugins/expression-input/src/test/popin-form_test.ts +47 -0
- package/grapesjs-plugins/expression-input/tsconfig.json +34 -0
- package/grapesjs-plugins/expression-input/web-dev-server.config.js +25 -0
- package/grapesjs-plugins/expression-input/web-test-runner.config.js +124 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/.editorconfig +5 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/.husky/pre-commit +4 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/README.md +158 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/babel.config.js +3 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/eslint.config.mjs +20 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/index.html +353 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/jest.config.cjs +11 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/package-lock.json +12500 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/package.json +75 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/public/simple-selector.html +12 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/StylableElement.ts +15 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/capabilities.ts +49 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/commands.ts +89 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/complex-selector.ts +187 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/compound-selector.ts +241 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/current-selector-display.ts +289 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/inline-select.ts +199 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/resize-input.ts +19 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/components/simple-selector.ts +537 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/i18n/en.ts +75 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/i18n/fr.ts +75 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/index.ts +47 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/ComplexSelector.test.ts +380 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/ComplexSelector.ts +231 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/CompoundSelector.test.ts +232 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/CompoundSelector.ts +128 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/GrapesJsSelectors.test.ts +1077 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/GrapesJsSelectors.ts +653 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/Operator.test.ts +45 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/Operator.ts +129 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/PseudoClass.test.ts +31 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/PseudoClass.ts +159 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/SimpleSelector.test.ts +181 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/model/SimpleSelector.ts +379 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/plugin.ts +225 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/styles.ts +40 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/src/test-data.json +3546 -0
- package/grapesjs-plugins/grapesjs-advanced-selector/tsconfig.json +37 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/.eslintrc.json +31 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/LICENSE +17 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/README.md +129 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/_index.html +37 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/package-lock.json +9023 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/package.json +46 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/src/index.js +97 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/test/index.test.js +198 -0
- package/grapesjs-plugins/grapesjs-ai-capabilities/tsconfig.json +29 -0
- package/grapesjs-plugins/grapesjs-css-variables/.eslintrc.json +31 -0
- package/grapesjs-plugins/grapesjs-css-variables/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-css-variables/README.md +172 -0
- package/grapesjs-plugins/grapesjs-css-variables/TEST_SCENARIOS.md +181 -0
- package/grapesjs-plugins/grapesjs-css-variables/_index.html +93 -0
- package/grapesjs-plugins/grapesjs-css-variables/package-lock.json +9020 -0
- package/grapesjs-plugins/grapesjs-css-variables/package.json +46 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/capabilities.js +133 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/index.js +37 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/locale/en.js +22 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/locale/fr.js +22 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/modal.js +692 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/style-manager.js +461 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/types.js +8 -0
- package/grapesjs-plugins/grapesjs-css-variables/src/variables.js +439 -0
- package/grapesjs-plugins/grapesjs-data-source/.husky/pre-commit +4 -0
- package/grapesjs-plugins/grapesjs-data-source/.nvmrc +1 -0
- package/grapesjs-plugins/grapesjs-data-source/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-data-source/README.md +674 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/directus-schema.json +67137 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/directus-test-schema.json +8393 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/graphql-mocks.js +7 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/simple-schema.json +493 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/squidex-schema.json +6656 -0
- package/grapesjs-plugins/grapesjs-data-source/__mocks__/strapi-schema.json +7986 -0
- package/grapesjs-plugins/grapesjs-data-source/_index.html +110 -0
- package/grapesjs-plugins/grapesjs-data-source/babel.config.js +7 -0
- package/grapesjs-plugins/grapesjs-data-source/eslint.config.mjs +47 -0
- package/grapesjs-plugins/grapesjs-data-source/example.graphql +355 -0
- package/grapesjs-plugins/grapesjs-data-source/example.graphql.json +5666 -0
- package/grapesjs-plugins/grapesjs-data-source/example.page.json +1 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/graphql-response.json +6 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/graphql-types.json +2095 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/preview.html +5 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/base/website.json +79 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/graphql-response.json +1056 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/graphql-types.json +2095 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/preview.html +36 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/countries-lists/website.json +422 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/example.graphql-result.json +18718 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/example.graphql-types.json +1955 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/graphql-modules.json +191 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/modules.html +45 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/graphql-response.json +1056 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/graphql-types.json +2095 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/preview.html +31 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/visibility-truthy/website.json +261 -0
- package/grapesjs-plugins/grapesjs-data-source/integration-tests/website-modules.json +650 -0
- package/grapesjs-plugins/grapesjs-data-source/jest.config.js +21 -0
- package/grapesjs-plugins/grapesjs-data-source/package-lock.json +13182 -0
- package/grapesjs-plugins/grapesjs-data-source/package.json +77 -0
- package/grapesjs-plugins/grapesjs-data-source/src/api.ts +386 -0
- package/grapesjs-plugins/grapesjs-data-source/src/capabilities.ts +80 -0
- package/grapesjs-plugins/grapesjs-data-source/src/commands.ts +269 -0
- package/grapesjs-plugins/grapesjs-data-source/src/datasources/GraphQL.ts +1039 -0
- package/grapesjs-plugins/grapesjs-data-source/src/datasources/graphql-introspection-query.ts +112 -0
- package/grapesjs-plugins/grapesjs-data-source/src/datasources/graphql.test.ts +657 -0
- package/grapesjs-plugins/grapesjs-data-source/src/filters/index.ts +102 -0
- package/grapesjs-plugins/grapesjs-data-source/src/filters/liquid.test.ts +27 -0
- package/grapesjs-plugins/grapesjs-data-source/src/filters/liquid.ts +985 -0
- package/grapesjs-plugins/grapesjs-data-source/src/index.ts +103 -0
- package/grapesjs-plugins/grapesjs-data-source/src/integration.test.ts +504 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/ExpressionTree.ts +251 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/completion.ts +213 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceManager.ts +315 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceRegistry.test.ts +170 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/dataSourceRegistry.ts +117 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/expressionEvaluator.ts +241 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/previewDataLoader.ts +196 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/queryBuilder.ts +118 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/state.test.ts +76 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/state.ts +243 -0
- package/grapesjs-plugins/grapesjs-data-source/src/model/token.ts +336 -0
- package/grapesjs-plugins/grapesjs-data-source/src/storage.test.ts +81 -0
- package/grapesjs-plugins/grapesjs-data-source/src/storage.ts +55 -0
- package/grapesjs-plugins/grapesjs-data-source/src/test-data.ts +154 -0
- package/grapesjs-plugins/grapesjs-data-source/src/types.ts +299 -0
- package/grapesjs-plugins/grapesjs-data-source/src/utils.test.ts +46 -0
- package/grapesjs-plugins/grapesjs-data-source/src/utils.ts +367 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/canvas.ts +718 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/custom-states-editor.ts +371 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/defaultStyles.ts +432 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/index.ts +168 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/properties-editor.ts +249 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/settings.ts +1551 -0
- package/grapesjs-plugins/grapesjs-data-source/src/view/state-editor.ts +528 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.editorconfig +16 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.env.example +7 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.eslintignore +3 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/.eslintrc +27 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/README.md +57 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/admin.js +13 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/api.js +7 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/database.js +92 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/middlewares.js +12 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/config/server.js +10 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/database/migrations/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/favicon.png +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/jsconfig.json +8 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/package.json +31 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/public/robots.txt +3 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/public/uploads/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/admin/app.example.js +39 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/admin/webpack.config.example.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/content-types/post/schema.json +26 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/controllers/post.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/routes/post.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/api/post/services/post.js +9 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/extensions/.gitkeep +0 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/src/index.js +20 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/types/generated/components.d.ts +5 -0
- package/grapesjs-plugins/grapesjs-data-source/strapi/types/generated/contentTypes.d.ts +723 -0
- package/grapesjs-plugins/grapesjs-data-source/tmp/countries-lists.html +1 -0
- package/grapesjs-plugins/grapesjs-data-source/tsconfig.cjs.json +8 -0
- package/grapesjs-plugins/grapesjs-data-source/tsconfig.json +49 -0
- package/grapesjs-plugins/grapesjs-filter-styles/README.md +137 -0
- package/grapesjs-plugins/grapesjs-filter-styles/eslint.config.mjs +35 -0
- package/grapesjs-plugins/grapesjs-filter-styles/package-lock.json +8927 -0
- package/grapesjs-plugins/grapesjs-filter-styles/package.json +40 -0
- package/grapesjs-plugins/grapesjs-filter-styles/src/index.js +283 -0
- package/grapesjs-plugins/grapesjs-filter-styles/tsconfig.json +26 -0
- package/grapesjs-plugins/grapesjs-fonts/.eslintrc.json +31 -0
- package/grapesjs-plugins/grapesjs-fonts/LICENSE +9 -0
- package/grapesjs-plugins/grapesjs-fonts/README.md +231 -0
- package/grapesjs-plugins/grapesjs-fonts/_index.html +95 -0
- package/grapesjs-plugins/grapesjs-fonts/package-lock.json +9024 -0
- package/grapesjs-plugins/grapesjs-fonts/package.json +46 -0
- package/grapesjs-plugins/grapesjs-fonts/src/capabilities.js +61 -0
- package/grapesjs-plugins/grapesjs-fonts/src/commands.js +100 -0
- package/grapesjs-plugins/grapesjs-fonts/src/fonts.js +396 -0
- package/grapesjs-plugins/grapesjs-fonts/src/index.js +34 -0
- package/grapesjs-plugins/grapesjs-fonts/src/locale/en.js +19 -0
- package/grapesjs-plugins/grapesjs-fonts/src/locale/fr.js +21 -0
- package/grapesjs-plugins/grapesjs-fonts/src/locale/ptbr.js +18 -0
- package/grapesjs-plugins/grapesjs-fonts/tsconfig.json +29 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/README.md +116 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/package.json +46 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/src/KeymapsDialog.ts +208 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/src/KeymapsDialogManager.ts +78 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/src/index.ts +70 -0
- package/grapesjs-plugins/grapesjs-keymaps-dialog/tsconfig.json +29 -0
- package/grapesjs-plugins/grapesjs-loading/.eslintrc.json +22 -0
- package/grapesjs-plugins/grapesjs-loading/README.md +140 -0
- package/grapesjs-plugins/grapesjs-loading/_index.html +90 -0
- package/grapesjs-plugins/grapesjs-loading/eslint.config.mjs +20 -0
- package/grapesjs-plugins/grapesjs-loading/grapesjs-loading.gif +0 -0
- package/grapesjs-plugins/grapesjs-loading/package.json +50 -0
- package/grapesjs-plugins/grapesjs-loading/src/index.ts +54 -0
- package/grapesjs-plugins/grapesjs-loading/tsconfig.json +20 -0
- package/grapesjs-plugins/grapesjs-notifications/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-notifications/README.md +295 -0
- package/grapesjs-plugins/grapesjs-notifications/_index.html +95 -0
- package/grapesjs-plugins/grapesjs-notifications/package-lock.json +8187 -0
- package/grapesjs-plugins/grapesjs-notifications/package.json +58 -0
- package/grapesjs-plugins/grapesjs-notifications/src/Notification.ts +117 -0
- package/grapesjs-plugins/grapesjs-notifications/src/NotificationManager.ts +93 -0
- package/grapesjs-plugins/grapesjs-notifications/src/Storage.ts +26 -0
- package/grapesjs-plugins/grapesjs-notifications/src/capabilities.ts +33 -0
- package/grapesjs-plugins/grapesjs-notifications/src/commands.ts +5 -0
- package/grapesjs-plugins/grapesjs-notifications/src/index.ts +126 -0
- package/grapesjs-plugins/grapesjs-notifications/src/locale/en.js +8 -0
- package/grapesjs-plugins/grapesjs-notifications/src/view.ts +127 -0
- package/grapesjs-plugins/grapesjs-notifications/tsconfig.json +30 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/LICENSE +213 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/README.md +119 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/jest.config.js +197 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/package-lock.json +10752 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/package.json +44 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/src/index.js +90 -0
- package/grapesjs-plugins/grapesjs-storage-rate-limit/src/index.test.js +122 -0
- package/grapesjs-plugins/grapesjs-symbols/.eslintrc.cjs +20 -0
- package/grapesjs-plugins/grapesjs-symbols/.husky/pre-commit +5 -0
- package/grapesjs-plugins/grapesjs-symbols/.nvmrc +1 -0
- package/grapesjs-plugins/grapesjs-symbols/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-symbols/README.md +228 -0
- package/grapesjs-plugins/grapesjs-symbols/_index.html +104 -0
- package/grapesjs-plugins/grapesjs-symbols/es5.html +119 -0
- package/grapesjs-plugins/grapesjs-symbols/es6.html +107 -0
- package/grapesjs-plugins/grapesjs-symbols/eslint.config.mjs +72 -0
- package/grapesjs-plugins/grapesjs-symbols/jest.config.js +12 -0
- package/grapesjs-plugins/grapesjs-symbols/package-lock.json +6867 -0
- package/grapesjs-plugins/grapesjs-symbols/package.json +73 -0
- package/grapesjs-plugins/grapesjs-symbols/rollup.config.mjs +26 -0
- package/grapesjs-plugins/grapesjs-symbols/src/SymbolsCommands.test.ts +147 -0
- package/grapesjs-plugins/grapesjs-symbols/src/SymbolsCommands.ts +144 -0
- package/grapesjs-plugins/grapesjs-symbols/src/capabilities.ts +50 -0
- package/grapesjs-plugins/grapesjs-symbols/src/events.ts +8 -0
- package/grapesjs-plugins/grapesjs-symbols/src/id-utils.ts +158 -0
- package/grapesjs-plugins/grapesjs-symbols/src/index.ts +46 -0
- package/grapesjs-plugins/grapesjs-symbols/src/test-utils.ts +51 -0
- package/grapesjs-plugins/grapesjs-symbols/src/utils.test.ts +118 -0
- package/grapesjs-plugins/grapesjs-symbols/src/utils.ts +90 -0
- package/grapesjs-plugins/grapesjs-symbols/src/view/SymbolsView.ts +251 -0
- package/grapesjs-plugins/grapesjs-symbols/src/view/traits.ts +101 -0
- package/grapesjs-plugins/grapesjs-symbols/tsconfig.json +35 -0
- package/grapesjs-plugins/grapesjs-symbols/tsconfig.test.json +12 -0
- package/grapesjs-plugins/grapesjs-version-flow/LICENSE +661 -0
- package/grapesjs-plugins/grapesjs-version-flow/README.md +422 -0
- package/grapesjs-plugins/grapesjs-version-flow/_index.html +494 -0
- package/grapesjs-plugins/grapesjs-version-flow/babel.config.js +9 -0
- package/grapesjs-plugins/grapesjs-version-flow/package-lock.json +11832 -0
- package/grapesjs-plugins/grapesjs-version-flow/package.json +77 -0
- package/grapesjs-plugins/grapesjs-version-flow/prompts/initial.txt +116 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/event-system.js +48 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/index.js +87 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/locale/en.js +26 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/locale/fr.js +26 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/modal-ui.js +562 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/style-manager.js +240 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/upgrade-engine.js +237 -0
- package/grapesjs-plugins/grapesjs-version-flow/src/version-manager.js +117 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/index.test.js +241 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/integration.test.js +227 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/setup.js +67 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/upgrade-engine.test.js +360 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/version-manager.test.js +168 -0
- package/grapesjs-plugins/grapesjs-version-flow/tests/version-storage.test.js +203 -0
- package/grapesjs-plugins/grapesjs-version-flow/tsconfig.json +26 -0
- package/package.json +127 -159
- package/{src/ts/server → server}/api/api.ts +6 -6
- package/{src/ts/server → server}/api/connectorApi.ts +5 -5
- package/{src/ts/server → server}/api/publicationApi.ts +7 -7
- package/{src/ts/server → server}/api/websiteApi.ts +7 -8
- package/{src/ts/server → server}/config.ts +14 -12
- package/{src/ts/server → server}/connectors/FsHosting.ts +4 -4
- package/{src/ts/server → server}/connectors/FsStorage.test.ts +2 -2
- package/{src/ts/server → server}/connectors/FsStorage.ts +8 -8
- package/{src/ts/server → server}/connectors/connectors.ts +3 -3
- package/server/deploy/.nvmrc +1 -0
- package/server/deploy/.silex.js +220 -0
- package/server/deploy/client-config.js +17 -0
- package/server/deploy/client-plugins/.gitkeep +0 -0
- package/server/deploy/client-plugins/onboarding.js +67 -0
- package/server/deploy/example.env +25 -0
- package/server/deploy/onboarding.json +22 -0
- package/server/deploy/picto-silex@3x.png +0 -0
- package/server/deploy/server-plugins/dashboard.js +74 -0
- package/server/deploy/server-plugins/onboarding.js +212 -0
- package/server/deploy/silex-platform.yml +75 -0
- package/{src/ts/server → server}/events.ts +2 -2
- package/{src/ts/server → server}/expose.ts +1 -1
- package/{src/ts/server → server}/express.ts +2 -2
- package/{src/ts/server → server}/index.ts +7 -7
- package/{src/ts/server → server}/jobs.test.ts +1 -1
- package/{src/ts/server → server}/jobs.ts +1 -1
- package/server/plugins/DownloadConnector.publish.test.ts +32 -0
- package/server/plugins/DownloadConnector.test.ts +70 -0
- package/{src/ts/plugins/server → server/plugins}/DownloadConnector.ts +22 -10
- package/{src/ts/plugins/server → server/plugins}/FtpConnector.test.ts +3 -3
- package/{src/ts/plugins/server → server/plugins}/FtpConnector.ts +7 -7
- package/{src/ts/plugins/server → server/plugins}/GitlabConnector.ts +9 -26
- package/{src/ts/plugins/server → server/plugins}/GitlabHostingConnector.ts +5 -5
- package/{src/ts/plugins/server → server/plugins}/SslPlugin.ts +2 -2
- package/{src/ts/plugins/server → server/plugins}/StaticPlugin.ts +2 -2
- package/{src/ts/server → server}/utils/BackwardCompat.ts +1 -1
- package/{src/ts/server → server}/utils/websiteDataSerialization.test.ts +2 -2
- package/{src/ts/server → server}/utils/websiteDataSerialization.ts +3 -3
- package/.silex.js +0 -76
- package/dist/client/client/api.d.ts +0 -101
- package/dist/client/client/assetUrl.d.ts +0 -60
- package/dist/client/client/config.d.ts +0 -110
- package/dist/client/client/events.d.ts +0 -23
- package/dist/client/client/expose.d.ts +0 -10
- package/dist/client/client/grapesjs/LoginDialog.d.ts +0 -15
- package/dist/client/client/grapesjs/PublicationManager.d.ts +0 -117
- package/dist/client/client/grapesjs/PublicationUi.d.ts +0 -59
- package/dist/client/client/grapesjs/blocks.d.ts +0 -1
- package/dist/client/client/grapesjs/body-remap.d.ts +0 -15
- package/dist/client/client/grapesjs/breadcrumbs.d.ts +0 -1
- package/dist/client/client/grapesjs/cms/DataSource.d.ts +0 -43
- package/dist/client/client/grapesjs/cms/blocks.d.ts +0 -2
- package/dist/client/client/grapesjs/cms/buttons.d.ts +0 -2
- package/dist/client/client/grapesjs/cms/collection-pages.d.ts +0 -4
- package/dist/client/client/grapesjs/cms/config.d.ts +0 -9
- package/dist/client/client/grapesjs/cms/filters.d.ts +0 -3
- package/dist/client/client/grapesjs/cms/index.d.ts +0 -43
- package/dist/client/client/grapesjs/cms/liquid.d.ts +0 -73
- package/dist/client/client/grapesjs/cms/page-settings.d.ts +0 -6
- package/dist/client/client/grapesjs/cms/publication.d.ts +0 -60
- package/dist/client/client/grapesjs/cms/site-settings.d.ts +0 -3
- package/dist/client/client/grapesjs/cms/states.d.ts +0 -8
- package/dist/client/client/grapesjs/cms/traits.d.ts +0 -8
- package/dist/client/client/grapesjs/core-commands.d.ts +0 -3
- package/dist/client/client/grapesjs/css-props.d.ts +0 -6
- package/dist/client/client/grapesjs/flex.d.ts +0 -3
- package/dist/client/client/grapesjs/footer.d.ts +0 -2
- package/dist/client/client/grapesjs/img.d.ts +0 -6
- package/dist/client/client/grapesjs/index.d.ts +0 -9
- package/dist/client/client/grapesjs/internal-links.d.ts +0 -1
- package/dist/client/client/grapesjs/keymaps.d.ts +0 -123
- package/dist/client/client/grapesjs/li.d.ts +0 -7
- package/dist/client/client/grapesjs/new-page-dialog.d.ts +0 -2
- package/dist/client/client/grapesjs/openImport.d.ts +0 -9
- package/dist/client/client/grapesjs/page-panel.d.ts +0 -13
- package/dist/client/client/grapesjs/project-bar.d.ts +0 -21
- package/dist/client/client/grapesjs/resize-panel.d.ts +0 -1
- package/dist/client/client/grapesjs/rich-text.d.ts +0 -4
- package/dist/client/client/grapesjs/sectors.d.ts +0 -12
- package/dist/client/client/grapesjs/semantic.d.ts +0 -1
- package/dist/client/client/grapesjs/settings-sections.d.ts +0 -19
- package/dist/client/client/grapesjs/settings.d.ts +0 -16
- package/dist/client/client/grapesjs/storage.d.ts +0 -3
- package/dist/client/client/grapesjs/symbolDialogs.d.ts +0 -4
- package/dist/client/client/grapesjs/upload-progress.d.ts +0 -2
- package/dist/client/client/grapesjs/view-buttons.d.ts +0 -2
- package/dist/client/client/index.d.ts +0 -10
- package/dist/client/client/publication-transformers.d.ts +0 -42
- package/dist/client/client/publish-custom-code-block.d.ts +0 -4
- package/dist/client/client/publish-fonts.d.ts +0 -4
- package/dist/client/client/utils.d.ts +0 -23
- package/dist/client/constants.d.ts +0 -35
- package/dist/client/page.d.ts +0 -2
- package/dist/client/types.d.ts +0 -365
- package/dist/client/webfonts/fa-brands-400.ttf +0 -0
- package/dist/client/webfonts/fa-regular-400.ttf +0 -0
- package/dist/client/webfonts/fa-solid-900.ttf +0 -0
- package/dist/client/webfonts/fa-v4compatibility.ttf +0 -0
- package/dist/plugins/client/client/events.d.ts +0 -23
- package/dist/plugins/client/client/events.js +0 -43
- package/dist/plugins/client/client/events.js.map +0 -1
- package/dist/plugins/client/plugins/client/template.d.ts +0 -2
- package/dist/plugins/client/plugins/client/template.js +0 -234
- package/dist/plugins/client/plugins/client/template.js.map +0 -1
- package/dist/plugins/client/plugins/client/website-info.d.ts +0 -1
- package/dist/plugins/client/plugins/client/website-info.js +0 -72
- package/dist/plugins/client/plugins/client/website-info.js.map +0 -1
- package/dist/plugins/client/types.d.ts +0 -365
- package/dist/plugins/client/types.js +0 -83
- package/dist/plugins/client/types.js.map +0 -1
- package/dist/plugins/server/constants.d.ts +0 -35
- package/dist/plugins/server/constants.js +0 -79
- package/dist/plugins/server/constants.js.map +0 -1
- package/dist/plugins/server/page.d.ts +0 -2
- package/dist/plugins/server/page.js +0 -35
- package/dist/plugins/server/page.js.map +0 -1
- package/dist/plugins/server/plugins/server/Cache.d.ts +0 -2
- package/dist/plugins/server/plugins/server/Cache.js +0 -36
- package/dist/plugins/server/plugins/server/Cache.js.map +0 -1
- package/dist/plugins/server/plugins/server/DownloadConnector.d.ts +0 -29
- package/dist/plugins/server/plugins/server/DownloadConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +0 -86
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +0 -172
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/GitlabHostingConnector.d.ts +0 -23
- package/dist/plugins/server/plugins/server/GitlabHostingConnector.js.map +0 -1
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js +0 -14
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +0 -1
- package/dist/plugins/server/plugins/server/SslPlugin.d.ts +0 -1
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +0 -1
- package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +0 -8
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +0 -1
- package/dist/plugins/server/server/config.d.ts +0 -59
- package/dist/plugins/server/server/config.js +0 -181
- package/dist/plugins/server/server/config.js.map +0 -1
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +0 -14
- package/dist/plugins/server/server/connectors/FsHosting.js +0 -66
- package/dist/plugins/server/server/connectors/FsHosting.js.map +0 -1
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +0 -44
- package/dist/plugins/server/server/connectors/FsStorage.js +0 -303
- package/dist/plugins/server/server/connectors/FsStorage.js.map +0 -1
- package/dist/plugins/server/server/connectors/connectors.d.ts +0 -86
- package/dist/plugins/server/server/connectors/connectors.js +0 -126
- package/dist/plugins/server/server/connectors/connectors.js.map +0 -1
- package/dist/plugins/server/server/events.d.ts +0 -26
- package/dist/plugins/server/server/events.js +0 -31
- package/dist/plugins/server/server/events.js.map +0 -1
- package/dist/plugins/server/server/jobs.d.ts +0 -12
- package/dist/plugins/server/server/jobs.js +0 -79
- package/dist/plugins/server/server/jobs.js.map +0 -1
- package/dist/plugins/server/server/utils/validation.d.ts +0 -7
- package/dist/plugins/server/server/utils/validation.js +0 -37
- package/dist/plugins/server/server/utils/validation.js.map +0 -1
- package/dist/plugins/server/server/utils/websiteDataSerialization.d.ts +0 -24
- package/dist/plugins/server/server/utils/websiteDataSerialization.js +0 -136
- package/dist/plugins/server/server/utils/websiteDataSerialization.js.map +0 -1
- package/dist/plugins/server/types.d.ts +0 -365
- package/dist/plugins/server/types.js +0 -87
- package/dist/plugins/server/types.js.map +0 -1
- package/dist/server/server/cli.js +0 -71
- package/src/css/grapesjs-light.scss +0 -180
- package/src/ts/plugins/client/template.ts +0 -246
- package/src/ts/plugins/client/website-info.ts +0 -84
- package/src/ts/server/cli.ts +0 -67
- /package/{src/ts → common}/constants.ts +0 -0
- /package/{src/ts → common}/externs.ts +0 -0
- /package/{src/ts → common}/page.ts +0 -0
- /package/{src/ts → common}/types.ts +0 -0
- /package/dist/server/{constants.js → common/constants.js} +0 -0
- /package/dist/server/{page.js → common/page.js} +0 -0
- /package/dist/server/{types.js → common/types.js} +0 -0
- /package/dist/server/{plugins/server → server/plugins}/Cache.js +0 -0
- /package/{src → editor}/css/_mixins.scss +0 -0
- /package/{src → editor}/css/_variables.scss +0 -0
- /package/{src → editor}/css/dialog.scss +0 -0
- /package/{src → editor}/css/dialogs.scss +0 -0
- /package/{src → editor}/css/fonts.scss +0 -0
- /package/{src → editor}/css/footer.scss +0 -0
- /package/{src → editor}/css/grapesjs-plugins.scss +0 -0
- /package/{src → editor}/css/grapesjs.scss +0 -0
- /package/{src → editor}/css/loader.scss +0 -0
- /package/{src → editor}/css/page-panel.scss +0 -0
- /package/{src → editor}/css/panels.scss +0 -0
- /package/{src → editor}/css/silex.scss +0 -0
- /package/{src → editor}/css/theme-base.scss +0 -0
- /package/{src → editor}/css/website-info.scss +0 -0
- /package/{src/ts/client → editor}/events.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/blocks.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/body-remap.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/breadcrumbs.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/DataSource.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/blocks.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/buttons.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/collection-pages.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/config.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/filters.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/liquid.mock.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/liquid.test.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/liquid.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/publication.test.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/site-settings.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/states.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/cms/traits.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/core-commands.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/css-props.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/flex.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/footer.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/img.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/internal-links.test.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/keymaps.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/li.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/new-page-dialog.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/openImport.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/page-panel.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/project-bar.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/rich-text.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/sectors.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/semantic.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/static-plugins.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/symbolDialogs.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/upload-progress.ts +0 -0
- /package/{src/ts/client → editor}/grapesjs/view-buttons.ts +0 -0
- /package/{src → editor}/html/debug.pug +0 -0
- /package/{src → editor}/html/index.pug +0 -0
- /package/{src → editor}/html/templates/includes.pug +0 -0
- /package/{src → editor}/html/templates/workspace.pug +0 -0
- /package/{src/ts/client → editor}/publish-custom-code-block.ts +0 -0
- /package/{src/ts/client → editor}/utils.ts +0 -0
- /package/{dist/plugins/server/plugins/server/PublicationOptimizer.d.ts → grapesjs-plugins/expression-input/docs/.nojekyll} +0 -0
- /package/{src/ts/plugins/server → server/plugins}/Cache.ts +0 -0
- /package/{src/ts/plugins/server → server/plugins}/PublicationOptimizer.ts +0 -0
- /package/{src/ts/server → server}/utils/validation.ts +0 -0
|
@@ -1,20 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
3
|
if (k2 === undefined) k2 = k;
|
|
20
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -31,43 +15,34 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
31
15
|
}) : function(o, v) {
|
|
32
16
|
o["default"] = v;
|
|
33
17
|
});
|
|
34
|
-
var __importStar = (this && this.__importStar) || function (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
44
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
36
|
exports.computeGitBlobSha = computeGitBlobSha;
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
37
|
+
const constants_js_1 = require("../../common/constants.js");
|
|
38
|
+
const connectors_js_1 = require("../connectors/connectors.js");
|
|
39
|
+
const types_js_1 = require("../../common/types.js");
|
|
50
40
|
const crypto_1 = __importStar(require("crypto"));
|
|
51
41
|
const path_1 = require("path");
|
|
52
|
-
const
|
|
53
|
-
const websiteDataSerialization_1 = require("../../server/utils/websiteDataSerialization");
|
|
54
|
-
/**
|
|
55
|
-
* Gitlab connector
|
|
56
|
-
* @fileoverview Gitlab connector for Silex, connect to the user's Gitlab account to store websites
|
|
57
|
-
* @see https://docs.gitlab.com/ee/api/oauth2.html
|
|
58
|
-
*/
|
|
42
|
+
const websiteDataSerialization_js_1 = require("../utils/websiteDataSerialization.js");
|
|
59
43
|
const MAX_BATCH_UPLOAD_SIZE = 100;
|
|
60
|
-
const MAX_BODY_SIZE_KB = 8 * 1000 * 1024;
|
|
44
|
+
const MAX_BODY_SIZE_KB = 8 * 1000 * 1024;
|
|
61
45
|
const WEBSITE_DATA_FILE_FORMAT_VERSION = '1.0.0';
|
|
62
|
-
// interface MetaRepoFileContent {
|
|
63
|
-
// websites: {
|
|
64
|
-
// [websiteId: string]: {
|
|
65
|
-
// meta: WebsiteMetaFileContent,
|
|
66
|
-
// createdAt: string,
|
|
67
|
-
// updatedAt: string,
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
// }
|
|
71
46
|
const svg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
72
47
|
<svg
|
|
73
48
|
xmlns:svg="http://www.w3.org/2000/svg"
|
|
@@ -127,26 +102,26 @@ const encodedSvg = encodeURIComponent(svg);
|
|
|
127
102
|
const ICON = '/assets/gitlab.png';
|
|
128
103
|
function computeGitBlobSha(content, binary) {
|
|
129
104
|
const contentBuffer = binary
|
|
130
|
-
? Buffer.from(content, 'base64')
|
|
131
|
-
: Buffer.from(content, 'utf8');
|
|
105
|
+
? Buffer.from(content, 'base64')
|
|
106
|
+
: Buffer.from(content, 'utf8');
|
|
132
107
|
const header = `blob ${contentBuffer.length}\0`;
|
|
133
108
|
const full = Buffer.concat([Buffer.from(header), contentBuffer]);
|
|
134
109
|
return crypto_1.default.createHash('sha1').update(full).digest('hex');
|
|
135
110
|
}
|
|
136
111
|
function sanitizeGitlabPath(name) {
|
|
137
112
|
return name
|
|
138
|
-
.normalize('NFD')
|
|
139
|
-
.replace(/[\u0300-\u036f]/g, '')
|
|
140
|
-
.replace(/[^a-zA-Z0-9._-]/g, '-')
|
|
141
|
-
.replace(/^[-_.]+/, '')
|
|
142
|
-
.replace(/[-_.]+$/, '')
|
|
143
|
-
.replace(/\.git$|\.atom$/i, '')
|
|
113
|
+
.normalize('NFD')
|
|
114
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
115
|
+
.replace(/[^a-zA-Z0-9._-]/g, '-')
|
|
116
|
+
.replace(/^[-_.]+/, '')
|
|
117
|
+
.replace(/[-_.]+$/, '')
|
|
118
|
+
.replace(/\.git$|\.atom$/i, '')
|
|
144
119
|
.toLowerCase();
|
|
145
120
|
}
|
|
146
121
|
class GitlabConnector {
|
|
147
122
|
config;
|
|
148
123
|
connectorId = 'gitlab';
|
|
149
|
-
connectorType =
|
|
124
|
+
connectorType = types_js_1.ConnectorType.STORAGE;
|
|
150
125
|
displayName = 'GitLab';
|
|
151
126
|
icon = ICON;
|
|
152
127
|
disableLogout = false;
|
|
@@ -158,10 +133,8 @@ class GitlabConnector {
|
|
|
158
133
|
this.options = {
|
|
159
134
|
branch: 'main',
|
|
160
135
|
assetsFolder: 'assets',
|
|
161
|
-
//metaRepo: 'silex-meta',
|
|
162
|
-
//metaRepoFile: 'websites.json',
|
|
163
136
|
repoPrefix: 'silex_',
|
|
164
|
-
scope: 'api',
|
|
137
|
+
scope: 'api',
|
|
165
138
|
...opts,
|
|
166
139
|
};
|
|
167
140
|
if (!this.options.clientId)
|
|
@@ -171,10 +144,8 @@ class GitlabConnector {
|
|
|
171
144
|
if (!this.options.domain)
|
|
172
145
|
throw new Error('Missing Gitlab domain');
|
|
173
146
|
if (!this.options.timeOut)
|
|
174
|
-
this.options.timeOut = 15000;
|
|
147
|
+
this.options.timeOut = 15000;
|
|
175
148
|
}
|
|
176
|
-
// **
|
|
177
|
-
// Convenience methods for the Gitlab API
|
|
178
149
|
getAssetPath(path, encode = true) {
|
|
179
150
|
const resolvedPath = (0, path_1.join)(this.options.assetsFolder, path);
|
|
180
151
|
if (encode)
|
|
@@ -186,7 +157,6 @@ class GitlabConnector {
|
|
|
186
157
|
return gitlabDomainRegexp.test(this.options.domain);
|
|
187
158
|
}
|
|
188
159
|
async createFile(session, websiteId, path, content, isBase64 = false) {
|
|
189
|
-
// Remove leading slash
|
|
190
160
|
const safePath = path.replace(/^\//, '');
|
|
191
161
|
const encodePath = decodeURIComponent(path);
|
|
192
162
|
return this.callApi({
|
|
@@ -203,7 +173,6 @@ class GitlabConnector {
|
|
|
203
173
|
});
|
|
204
174
|
}
|
|
205
175
|
async updateFile(session, websiteId, path, content, isBase64 = false) {
|
|
206
|
-
// Remove leading slash
|
|
207
176
|
const safePath = path.replace(/^\//, '');
|
|
208
177
|
const encodePath = decodeURIComponent(path);
|
|
209
178
|
return this.callApi({
|
|
@@ -213,22 +182,17 @@ class GitlabConnector {
|
|
|
213
182
|
requestBody: {
|
|
214
183
|
id: websiteId,
|
|
215
184
|
branch: this.options.branch,
|
|
216
|
-
content: await (0,
|
|
185
|
+
content: await (0, connectors_js_1.contentToString)(content),
|
|
217
186
|
commit_message: `Update website asset ${encodePath} from Silex`,
|
|
218
187
|
encoding: isBase64 ? 'base64' : undefined,
|
|
219
188
|
}
|
|
220
189
|
});
|
|
221
190
|
}
|
|
222
191
|
async readFile(session, websiteId, fileName) {
|
|
223
|
-
// Remove leading slash
|
|
224
192
|
const safePath = fileName.replace(/^\//, '');
|
|
225
193
|
return this.downloadRawFile(session, websiteId, safePath);
|
|
226
194
|
}
|
|
227
|
-
|
|
228
|
-
* Call the Gitlab API with the user's token and handle errors
|
|
229
|
-
*/
|
|
230
|
-
async callApi({ session, path, method = 'GET', requestBody = null, params = {}, responseHeaders = {}, // Will get the response heaaders
|
|
231
|
-
}) {
|
|
195
|
+
async callApi({ session, path, method = 'GET', requestBody = null, params = {}, responseHeaders = {}, }) {
|
|
232
196
|
const token = this.getSessionToken(session).token;
|
|
233
197
|
const tokenParam = token ? `access_token=${token.access_token}&` : '';
|
|
234
198
|
const paramsStr = Object.entries(params).map(([k, v]) => `${k}=${encodeURIComponent(v.toString())}`).join('&');
|
|
@@ -239,7 +203,6 @@ class GitlabConnector {
|
|
|
239
203
|
if (method === 'GET' && requestBody) {
|
|
240
204
|
console.error('[GitlabConnector] Invalid GET request: GET requests should not have a body', { url, method, body: requestBody, params });
|
|
241
205
|
}
|
|
242
|
-
// With or without body
|
|
243
206
|
let response;
|
|
244
207
|
const body = requestBody ? JSON.stringify(requestBody) : undefined;
|
|
245
208
|
try {
|
|
@@ -254,12 +217,10 @@ class GitlabConnector {
|
|
|
254
217
|
});
|
|
255
218
|
}
|
|
256
219
|
response = await this.fetchWithRetry(url, requestBody && method !== 'GET' ? {
|
|
257
|
-
agent: this.getAgent(),
|
|
258
220
|
method,
|
|
259
221
|
headers,
|
|
260
222
|
body,
|
|
261
223
|
} : {
|
|
262
|
-
agent: this.getAgent(),
|
|
263
224
|
method,
|
|
264
225
|
headers,
|
|
265
226
|
});
|
|
@@ -274,11 +235,9 @@ class GitlabConnector {
|
|
|
274
235
|
session,
|
|
275
236
|
stack: e?.stack || new Error().stack,
|
|
276
237
|
});
|
|
277
|
-
throw new
|
|
238
|
+
throw new types_js_1.ApiError(`Could not reach Gitlab API: ${e.message || e}`, 500);
|
|
278
239
|
}
|
|
279
|
-
// Pass the response headers to the caller
|
|
280
240
|
response.headers.forEach((value, name) => responseHeaders[name] = value);
|
|
281
|
-
// Handle the case when the server returns a non-JSON response (e.g. 400 Bad Request)
|
|
282
241
|
const text = await async function () {
|
|
283
242
|
try {
|
|
284
243
|
return await response.text();
|
|
@@ -293,7 +252,7 @@ class GitlabConnector {
|
|
|
293
252
|
params,
|
|
294
253
|
error: e
|
|
295
254
|
});
|
|
296
|
-
throw new
|
|
255
|
+
throw new types_js_1.ApiError(`Gitlab API: Could not read response body (${e.message})`, 500);
|
|
297
256
|
}
|
|
298
257
|
}();
|
|
299
258
|
if (!response.ok) {
|
|
@@ -307,10 +266,9 @@ class GitlabConnector {
|
|
|
307
266
|
responseText: text
|
|
308
267
|
});
|
|
309
268
|
if (text.includes('A file with this name doesn\'t exist')) {
|
|
310
|
-
throw new
|
|
269
|
+
throw new types_js_1.ApiError('Gitlab API: File not found', 404);
|
|
311
270
|
}
|
|
312
271
|
else if (response.status === 401 && this.getSessionToken(session).token?.refresh_token) {
|
|
313
|
-
// Refresh the token
|
|
314
272
|
const token = this.getSessionToken(session).token;
|
|
315
273
|
const body = {
|
|
316
274
|
grant_type: 'refresh_token',
|
|
@@ -318,8 +276,7 @@ class GitlabConnector {
|
|
|
318
276
|
client_id: this.options.clientId,
|
|
319
277
|
client_secret: this.options.clientSecret,
|
|
320
278
|
};
|
|
321
|
-
const response = await (
|
|
322
|
-
agent: this.getAgent(),
|
|
279
|
+
const response = await fetch(this.options.domain + '/oauth/token', {
|
|
323
280
|
method: 'POST',
|
|
324
281
|
headers: {
|
|
325
282
|
'Content-Type': 'application/json',
|
|
@@ -352,7 +309,7 @@ class GitlabConnector {
|
|
|
352
309
|
refresh_token: token?.refresh_token
|
|
353
310
|
});
|
|
354
311
|
this.logout(session);
|
|
355
|
-
throw new
|
|
312
|
+
throw new types_js_1.ApiError(`Gitlab API: Could not refresh token (${message})`, response.status);
|
|
356
313
|
}
|
|
357
314
|
}
|
|
358
315
|
else {
|
|
@@ -367,11 +324,9 @@ class GitlabConnector {
|
|
|
367
324
|
responseText: text,
|
|
368
325
|
message
|
|
369
326
|
});
|
|
370
|
-
throw new
|
|
327
|
+
throw new types_js_1.ApiError(`Gitlab API error: ${message} (${text})`, response.status);
|
|
371
328
|
}
|
|
372
329
|
}
|
|
373
|
-
// Some endpoints (e.g. /jobs/:id/trace) return plain text rather than JSON.
|
|
374
|
-
// Skip JSON.parse when the server says the response isn't JSON.
|
|
375
330
|
const contentType = response.headers.get('content-type') ?? '';
|
|
376
331
|
if (response.ok && !contentType.includes('application/json')) {
|
|
377
332
|
return text;
|
|
@@ -403,16 +358,12 @@ class GitlabConnector {
|
|
|
403
358
|
const token = this.getSessionToken(session).token?.access_token;
|
|
404
359
|
const domain = this.options.domain;
|
|
405
360
|
const branch = this.options.branch;
|
|
406
|
-
// Construct the raw URL
|
|
407
|
-
// GET /projects/:id/repository/files/:file_path/raw
|
|
408
361
|
const rawUrl = `${domain}/api/v4/projects/${projectId}/repository/files/${encodeURIComponent(filePath)}/raw?ref=${branch}&access_token=${token}`;
|
|
409
|
-
const fileRes = await this.fetchWithRetry(rawUrl, {
|
|
410
|
-
agent: this.getAgent(),
|
|
411
|
-
});
|
|
362
|
+
const fileRes = await this.fetchWithRetry(rawUrl, {});
|
|
412
363
|
const contentType = fileRes.headers.get('content-type');
|
|
413
364
|
if (contentType?.includes('text/html')) {
|
|
414
365
|
const html = await fileRes.text();
|
|
415
|
-
throw new
|
|
366
|
+
throw new types_js_1.ApiError('GitLab returned HTML instead of file (unauthorized or not found).', 401);
|
|
416
367
|
}
|
|
417
368
|
if (!fileRes.ok) {
|
|
418
369
|
const errText = await fileRes.text();
|
|
@@ -423,7 +374,7 @@ class GitlabConnector {
|
|
|
423
374
|
url: rawUrl,
|
|
424
375
|
responseText: errText
|
|
425
376
|
});
|
|
426
|
-
throw new
|
|
377
|
+
throw new types_js_1.ApiError(`GitLab raw file not found: filePath="${filePath}" (status ${fileRes.status})`, 404);
|
|
427
378
|
}
|
|
428
379
|
console.error('[GitlabConnector] Failed to fetch raw file from GitLab', {
|
|
429
380
|
filePath,
|
|
@@ -432,15 +383,15 @@ class GitlabConnector {
|
|
|
432
383
|
statusText: fileRes.statusText,
|
|
433
384
|
responseText: errText
|
|
434
385
|
});
|
|
435
|
-
throw new
|
|
386
|
+
throw new types_js_1.ApiError(`Failed to fetch raw file from GitLab: filePath="${filePath}" - ${fileRes.statusText} (${errText})`, fileRes.status);
|
|
436
387
|
}
|
|
437
388
|
try {
|
|
438
|
-
const buffer = await fileRes.
|
|
389
|
+
const buffer = Buffer.from(await fileRes.arrayBuffer());
|
|
439
390
|
return buffer;
|
|
440
391
|
}
|
|
441
392
|
catch (e) {
|
|
442
393
|
console.error('[GitlabConnector] Error reading binary content from GitLab raw file', e);
|
|
443
|
-
throw new
|
|
394
|
+
throw new types_js_1.ApiError('Failed to read binary content from GitLab raw file', 500);
|
|
444
395
|
}
|
|
445
396
|
}
|
|
446
397
|
generateCodeVerifier() {
|
|
@@ -453,55 +404,34 @@ class GitlabConnector {
|
|
|
453
404
|
async generateCodeChallenge(verifier) {
|
|
454
405
|
const hashed = (0, crypto_1.createHash)('sha256').update(verifier).digest();
|
|
455
406
|
let base64Url = hashed.toString('base64');
|
|
456
|
-
// Replace '+' with '-', '/' with '_', and remove '='
|
|
457
407
|
base64Url = base64Url.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
458
408
|
return base64Url;
|
|
459
409
|
}
|
|
460
410
|
getRedirect() {
|
|
461
411
|
const params = `connectorId=${this.connectorId}&type=${this.connectorType}`;
|
|
462
|
-
return `${this.config.url}${
|
|
463
|
-
}
|
|
464
|
-
// Force IPv4 when running locally
|
|
465
|
-
getAgent() {
|
|
466
|
-
if (this.config.url.startsWith('http://localhost')) {
|
|
467
|
-
return new https_1.Agent({
|
|
468
|
-
family: 4,
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
return undefined;
|
|
412
|
+
return `${this.config.url}${constants_js_1.API_PATH}${constants_js_1.API_CONNECTOR_PATH}${constants_js_1.API_CONNECTOR_LOGIN_CALLBACK}?${params}`;
|
|
472
413
|
}
|
|
473
|
-
// GitLab returns transient 5xx (e.g. 500, 503 "Upstream Gitaly has been exhausted")
|
|
474
|
-
// on raw-file fetches even for valid repos. Retry with exponential backoff + jitter.
|
|
475
414
|
async fetchWithRetry(url, init = {}, maxRetries = 3) {
|
|
476
415
|
let response;
|
|
477
416
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
478
|
-
response = await (
|
|
417
|
+
response = await fetch(url, init);
|
|
479
418
|
if (response.status < 500 || attempt === maxRetries)
|
|
480
419
|
return response;
|
|
481
|
-
// Drain the body so the connection can be reused
|
|
482
420
|
try {
|
|
483
421
|
await response.text();
|
|
484
422
|
}
|
|
485
|
-
catch {
|
|
423
|
+
catch { }
|
|
486
424
|
const backoffMs = Math.min(8000, 500 * Math.pow(2, attempt)) + Math.floor(Math.random() * 500);
|
|
487
425
|
console.warn(`[GitlabConnector] GitLab returned ${response.status} on ${url.split('?')[0]}, retrying in ${backoffMs}ms (attempt ${attempt + 1}/${maxRetries})`);
|
|
488
426
|
await new Promise(resolve => setTimeout(resolve, backoffMs));
|
|
489
427
|
}
|
|
490
428
|
return response;
|
|
491
429
|
}
|
|
492
|
-
/**
|
|
493
|
-
* Get the OAuth URL to redirect the user to
|
|
494
|
-
* The URL should look like
|
|
495
|
-
* https://gitlab.example.com/oauth/authorize?client_id=APP_ID&redirect_uri=REDIRECT_URI&response_type=code&state=STATE&scope=REQUESTED_SCOPES&code_challenge=CODE_CHALLENGE&code_challenge_method=S256
|
|
496
|
-
* OAuth2 Step #1 from https://docs.gitlab.com/ee/api/oauth2.html#authorization-code-with-proof-key-for-code-exchange-pkce
|
|
497
|
-
*/
|
|
498
430
|
async getOAuthUrl(session) {
|
|
499
431
|
const redirect_uri = encodeURIComponent(this.getRedirect());
|
|
500
432
|
const state = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
501
433
|
const codeVerifier = this.generateCodeVerifier();
|
|
502
|
-
// Create the code challenge
|
|
503
434
|
const codeChallenge = await this.generateCodeChallenge(codeVerifier);
|
|
504
|
-
// Store the code verifier and code challenge in the session
|
|
505
435
|
this.setSessionToken(session, {
|
|
506
436
|
...this.getSessionToken(session),
|
|
507
437
|
state,
|
|
@@ -520,7 +450,7 @@ class GitlabConnector {
|
|
|
520
450
|
delete session[this.connectorId];
|
|
521
451
|
}
|
|
522
452
|
getOptions(formData) {
|
|
523
|
-
return {};
|
|
453
|
+
return {};
|
|
524
454
|
}
|
|
525
455
|
async getLoginForm(session, redirectTo) {
|
|
526
456
|
return null;
|
|
@@ -531,15 +461,8 @@ class GitlabConnector {
|
|
|
531
461
|
async isLoggedIn(session) {
|
|
532
462
|
return !!this.getSessionToken(session).token;
|
|
533
463
|
}
|
|
534
|
-
/**
|
|
535
|
-
* Get the token from return code
|
|
536
|
-
* Set the token in the session
|
|
537
|
-
* OAuth2 Step #2 from https://docs.gitlab.com/ee/api/oauth2.html#authorization-code-with-proof-key-for-code-exchange-pkce
|
|
538
|
-
*/
|
|
539
464
|
async setToken(session, loginResult) {
|
|
540
465
|
const sessionToken = this.getSessionToken(session);
|
|
541
|
-
// Handle state that may be JSON with redirect info or a plain string
|
|
542
|
-
// Redirect info is when the user is comming from the /fork/ page of the dashboard
|
|
543
466
|
let receivedState = loginResult.state;
|
|
544
467
|
try {
|
|
545
468
|
const parsed = JSON.parse(loginResult.state);
|
|
@@ -548,22 +471,20 @@ class GitlabConnector {
|
|
|
548
471
|
}
|
|
549
472
|
}
|
|
550
473
|
catch {
|
|
551
|
-
// Plain text
|
|
552
474
|
}
|
|
553
475
|
if (!receivedState || receivedState !== sessionToken?.state) {
|
|
554
476
|
this.logout(session);
|
|
555
|
-
throw new
|
|
477
|
+
throw new types_js_1.ApiError('Invalid state', 401);
|
|
556
478
|
}
|
|
557
479
|
if (!sessionToken?.codeVerifier) {
|
|
558
480
|
this.logout(session);
|
|
559
|
-
throw new
|
|
481
|
+
throw new types_js_1.ApiError('Missing code verifier', 401);
|
|
560
482
|
}
|
|
561
483
|
if (!sessionToken?.codeChallenge) {
|
|
562
484
|
this.logout(session);
|
|
563
|
-
throw new
|
|
485
|
+
throw new types_js_1.ApiError('Missing code challenge', 401);
|
|
564
486
|
}
|
|
565
|
-
const response = await (
|
|
566
|
-
agent: this.getAgent(),
|
|
487
|
+
const response = await fetch(this.options.domain + '/oauth/token', {
|
|
567
488
|
method: 'POST',
|
|
568
489
|
headers: {
|
|
569
490
|
'Content-Type': 'application/json',
|
|
@@ -578,17 +499,14 @@ class GitlabConnector {
|
|
|
578
499
|
}),
|
|
579
500
|
});
|
|
580
501
|
const token = await response.json();
|
|
581
|
-
// Store the token in the session
|
|
582
502
|
this.setSessionToken(session, {
|
|
583
503
|
...this.getSessionToken(session),
|
|
584
504
|
token,
|
|
585
505
|
});
|
|
586
|
-
// We need to get the user ID for listWebsites
|
|
587
506
|
const user = await this.callApi({
|
|
588
507
|
session,
|
|
589
508
|
path: 'api/v4/user'
|
|
590
509
|
});
|
|
591
|
-
// Store the user details in the session
|
|
592
510
|
this.setSessionToken(session, {
|
|
593
511
|
...this.getSessionToken(session),
|
|
594
512
|
userId: user.id,
|
|
@@ -607,16 +525,15 @@ class GitlabConnector {
|
|
|
607
525
|
name: user.name,
|
|
608
526
|
email: user.email,
|
|
609
527
|
picture: user.avatar_url,
|
|
610
|
-
storage: await (0,
|
|
528
|
+
storage: await (0, connectors_js_1.toConnectorData)(session, this),
|
|
611
529
|
};
|
|
612
530
|
}
|
|
613
531
|
async listWebsites(session) {
|
|
614
532
|
const userId = this.getSessionToken(session).userId;
|
|
615
533
|
if (!userId) {
|
|
616
534
|
this.logout(session);
|
|
617
|
-
throw new
|
|
535
|
+
throw new types_js_1.ApiError('Missing Gitlab user ID. User not logged in?', 401);
|
|
618
536
|
}
|
|
619
|
-
// Handle multiple pages
|
|
620
537
|
let page = 1;
|
|
621
538
|
let totalPages = 1;
|
|
622
539
|
const projects = [];
|
|
@@ -633,7 +550,6 @@ class GitlabConnector {
|
|
|
633
550
|
});
|
|
634
551
|
projects.push(...pageProjects);
|
|
635
552
|
page++;
|
|
636
|
-
// Get the total number of pages from the response headers
|
|
637
553
|
const total = responseHeaders['x-total-pages'];
|
|
638
554
|
if (total) {
|
|
639
555
|
totalPages = parseInt(total, 10);
|
|
@@ -651,24 +567,15 @@ class GitlabConnector {
|
|
|
651
567
|
connectorUserSettings: {},
|
|
652
568
|
}));
|
|
653
569
|
}
|
|
654
|
-
/**
|
|
655
|
-
* Read the website data
|
|
656
|
-
* The website data file is named `website.json` and the pages are named `page-{id}.json`
|
|
657
|
-
* The pages are stored in the `src` folder by default
|
|
658
|
-
*/
|
|
659
570
|
async readWebsite(session, websiteId) {
|
|
660
|
-
const websiteDataBuf = await this.downloadRawFile(session, websiteId,
|
|
571
|
+
const websiteDataBuf = await this.downloadRawFile(session, websiteId, constants_js_1.WEBSITE_DATA_FILE);
|
|
661
572
|
const websiteDataContent = websiteDataBuf.toString('utf8');
|
|
662
|
-
// Use the common merge function to reconstruct website data
|
|
663
573
|
const pageLoader = async (pagePath) => {
|
|
664
574
|
const pageBuffer = await this.downloadRawFile(session, websiteId, pagePath);
|
|
665
575
|
return pageBuffer.toString('utf8');
|
|
666
576
|
};
|
|
667
|
-
return await (0,
|
|
577
|
+
return await (0, websiteDataSerialization_js_1.merge)(websiteDataContent, pageLoader);
|
|
668
578
|
}
|
|
669
|
-
/**
|
|
670
|
-
* Create a new website, i.e. a new Gitlab repository with an empty website data file
|
|
671
|
-
*/
|
|
672
579
|
async createWebsite(session, websiteMeta) {
|
|
673
580
|
const project = await this.callApi({
|
|
674
581
|
session,
|
|
@@ -678,64 +585,39 @@ class GitlabConnector {
|
|
|
678
585
|
name: this.options.repoPrefix + websiteMeta.name,
|
|
679
586
|
}
|
|
680
587
|
});
|
|
681
|
-
await this.createFile(session, project.id,
|
|
682
|
-
//await this.createFile(session, project.id, WEBSITE_META_DATA_FILE, JSON.stringify(websiteMeta))
|
|
683
|
-
//await this.updateWebsite(session, project.id, {} as WebsiteData)
|
|
684
|
-
//await this.setWebsiteMeta(session, project.id, websiteMeta)
|
|
588
|
+
await this.createFile(session, project.id, constants_js_1.WEBSITE_DATA_FILE, (0, websiteDataSerialization_js_1.stringify)(types_js_1.EMPTY_WEBSITE));
|
|
685
589
|
return project.id;
|
|
686
590
|
}
|
|
687
|
-
/**
|
|
688
|
-
* Update the website data
|
|
689
|
-
* Split the website data into 1 file per page + 1 file for the website data itself
|
|
690
|
-
* Use gitlab batch API to create/update the files
|
|
691
|
-
*/
|
|
692
591
|
async updateWebsite(session, websiteId, websiteData) {
|
|
693
592
|
const batchActions = [];
|
|
694
|
-
// **
|
|
695
|
-
// Handle the legacy sites that have no pagesFolder
|
|
696
|
-
// We want them to use "pages/" by default despite their files being in "src/" for now
|
|
697
593
|
let isLegacySite = !websiteData.pagesFolder;
|
|
698
|
-
// **
|
|
699
|
-
// Backward compatibility case
|
|
700
|
-
// The second time a legacy site is saved, the new `pages/` folder has been created
|
|
701
|
-
// but the front end still doesn't have the `pagesFolder` key
|
|
702
|
-
// This will be the case until the front end reloads
|
|
703
594
|
if (isLegacySite) {
|
|
704
595
|
const rootFiles = await this.ls({
|
|
705
596
|
session,
|
|
706
597
|
websiteId,
|
|
707
|
-
path:
|
|
598
|
+
path: constants_js_1.WEBSITE_PAGES_FOLDER,
|
|
708
599
|
recursive: false,
|
|
709
600
|
});
|
|
710
601
|
if (rootFiles.size) {
|
|
711
|
-
// Here the new `pages/` folder has been created already
|
|
712
602
|
isLegacySite = false;
|
|
713
|
-
websiteData.pagesFolder =
|
|
603
|
+
websiteData.pagesFolder = constants_js_1.WEBSITE_PAGES_FOLDER;
|
|
714
604
|
}
|
|
715
605
|
}
|
|
716
|
-
// **
|
|
717
|
-
// List existing files in the OLD pages folder (to detect files to delete)
|
|
718
606
|
const existingFiles = await this.ls({
|
|
719
607
|
session,
|
|
720
608
|
websiteId,
|
|
721
|
-
path: (0,
|
|
609
|
+
path: (0, websiteDataSerialization_js_1.getPagesFolder)(websiteData),
|
|
722
610
|
recursive: false,
|
|
723
611
|
});
|
|
724
|
-
// **
|
|
725
|
-
// Force pagesFolder to 'pages' for writing if not defined
|
|
726
612
|
if (isLegacySite) {
|
|
727
|
-
websiteData.pagesFolder =
|
|
613
|
+
websiteData.pagesFolder = constants_js_1.WEBSITE_PAGES_FOLDER;
|
|
728
614
|
}
|
|
729
|
-
|
|
730
|
-
// Use the common split function to create files
|
|
731
|
-
const filesToWrite = (0, websiteDataSerialization_1.split)(websiteData);
|
|
732
|
-
// **
|
|
733
|
-
// Process each file to create/update
|
|
615
|
+
const filesToWrite = (0, websiteDataSerialization_js_1.split)(websiteData);
|
|
734
616
|
for (const file of filesToWrite) {
|
|
735
617
|
const filePath = file.path;
|
|
736
618
|
const content = file.content;
|
|
737
619
|
const newSha = computeGitBlobSha(content, false);
|
|
738
|
-
const existingSha = existingFiles.get(filePath) || (filePath ===
|
|
620
|
+
const existingSha = existingFiles.get(filePath) || (filePath === constants_js_1.WEBSITE_DATA_FILE ? 'always-update' : undefined);
|
|
739
621
|
if (existingSha) {
|
|
740
622
|
if (existingSha !== newSha) {
|
|
741
623
|
batchActions.push({
|
|
@@ -743,7 +625,7 @@ class GitlabConnector {
|
|
|
743
625
|
file_path: filePath,
|
|
744
626
|
content,
|
|
745
627
|
});
|
|
746
|
-
}
|
|
628
|
+
}
|
|
747
629
|
}
|
|
748
630
|
else {
|
|
749
631
|
batchActions.push({
|
|
@@ -753,8 +635,6 @@ class GitlabConnector {
|
|
|
753
635
|
});
|
|
754
636
|
}
|
|
755
637
|
}
|
|
756
|
-
// **
|
|
757
|
-
// Delete pages that are not in the new website data
|
|
758
638
|
const pathsToWrite = filesToWrite.map(f => f.path);
|
|
759
639
|
for (const filePath of existingFiles.keys()) {
|
|
760
640
|
if (!pathsToWrite.includes(filePath)) {
|
|
@@ -764,8 +644,6 @@ class GitlabConnector {
|
|
|
764
644
|
});
|
|
765
645
|
}
|
|
766
646
|
}
|
|
767
|
-
// **
|
|
768
|
-
// Perform a batch commit
|
|
769
647
|
return this.callApi({
|
|
770
648
|
session,
|
|
771
649
|
path: `api/v4/projects/${websiteId}/repository/commits`,
|
|
@@ -778,14 +656,12 @@ class GitlabConnector {
|
|
|
778
656
|
});
|
|
779
657
|
}
|
|
780
658
|
async deleteWebsite(session, websiteId) {
|
|
781
|
-
// Delete repo
|
|
782
659
|
await this.callApi({
|
|
783
660
|
session,
|
|
784
661
|
path: `api/v4/projects/${websiteId}`,
|
|
785
662
|
method: 'DELETE',
|
|
786
663
|
});
|
|
787
664
|
}
|
|
788
|
-
// Fork the repo (user's own project)
|
|
789
665
|
async duplicateWebsite(session, websiteId) {
|
|
790
666
|
const meta = await this.getWebsiteMeta(session, websiteId);
|
|
791
667
|
const forkName = `${meta.name} Copy ${new Date().toISOString().slice(0, 10)} ${Math.random().toString(36).substring(2, 4)}`;
|
|
@@ -796,29 +672,18 @@ class GitlabConnector {
|
|
|
796
672
|
method: 'POST',
|
|
797
673
|
requestBody: {
|
|
798
674
|
name: this.options.repoPrefix + forkName,
|
|
799
|
-
/* @ts-ignore */
|
|
800
675
|
path: safePath,
|
|
801
|
-
/* @ts-ignore */
|
|
802
676
|
namespace: meta.namespace?.id || undefined,
|
|
803
677
|
},
|
|
804
678
|
});
|
|
805
679
|
return forkedProject.id;
|
|
806
680
|
}
|
|
807
|
-
/**
|
|
808
|
-
* Fork an external/public GitLab project (from any user/organization)
|
|
809
|
-
* @param session - The user session
|
|
810
|
-
* @param gitlabUrl - The project path in the "username/repo" format
|
|
811
|
-
* @returns The new website ID (project ID)
|
|
812
|
-
*/
|
|
813
681
|
async forkWebsite(session, gitlabUrl) {
|
|
814
|
-
// Only accept "username/repo" pattern (no URLs)
|
|
815
682
|
const projectPath = gitlabUrl.trim();
|
|
816
683
|
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(projectPath)) {
|
|
817
|
-
throw new
|
|
684
|
+
throw new types_js_1.ApiError('Invalid project path. Use the "username/repo" format.', 400);
|
|
818
685
|
}
|
|
819
|
-
// URL-encode the project path for the API
|
|
820
686
|
const encodedPath = encodeURIComponent(projectPath);
|
|
821
|
-
// First, get the source project info to extract its name
|
|
822
687
|
let sourceProject;
|
|
823
688
|
try {
|
|
824
689
|
sourceProject = await this.callApi({
|
|
@@ -829,30 +694,26 @@ class GitlabConnector {
|
|
|
829
694
|
}
|
|
830
695
|
catch (e) {
|
|
831
696
|
if (e.httpStatusCode === 404) {
|
|
832
|
-
throw new
|
|
697
|
+
throw new types_js_1.ApiError(`Project not found: ${projectPath}. Make sure the project exists and is public or you have access to it.`, 404);
|
|
833
698
|
}
|
|
834
699
|
throw e;
|
|
835
700
|
}
|
|
836
|
-
// Generate a unique name for the fork
|
|
837
701
|
const sourceName = sourceProject.name.replace(this.options.repoPrefix, '');
|
|
838
702
|
const forkName = `${sourceName} ${new Date().toISOString().slice(0, 10)} ${Math.random().toString(36).substring(2, 4)}`;
|
|
839
703
|
const safePath = sanitizeGitlabPath(this.options.repoPrefix + forkName);
|
|
840
|
-
// Fork the project to the user's namespace
|
|
841
704
|
const forkedProject = await this.callApi({
|
|
842
705
|
session,
|
|
843
706
|
path: `api/v4/projects/${encodedPath}/fork`,
|
|
844
707
|
method: 'POST',
|
|
845
708
|
requestBody: {
|
|
846
709
|
name: this.options.repoPrefix + forkName,
|
|
847
|
-
/* @ts-ignore */
|
|
848
710
|
path: safePath,
|
|
849
711
|
visibility: 'private',
|
|
850
712
|
},
|
|
851
713
|
});
|
|
852
|
-
// Wait for the fork to complete (GitLab forks asynchronously)
|
|
853
714
|
const forkedProjectId = forkedProject.id.toString();
|
|
854
|
-
const maxAttempts = 30;
|
|
855
|
-
const pollInterval = 2000;
|
|
715
|
+
const maxAttempts = 30;
|
|
716
|
+
const pollInterval = 2000;
|
|
856
717
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
857
718
|
const project = await this.callApi({
|
|
858
719
|
session,
|
|
@@ -863,9 +724,8 @@ class GitlabConnector {
|
|
|
863
724
|
return forkedProjectId;
|
|
864
725
|
}
|
|
865
726
|
if (project.import_status === 'failed') {
|
|
866
|
-
throw new
|
|
727
|
+
throw new types_js_1.ApiError(`Fork failed: ${project.import_error || 'Unknown error'}`, 500);
|
|
867
728
|
}
|
|
868
|
-
// Status is 'scheduled' or 'started', wait and retry
|
|
869
729
|
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
870
730
|
}
|
|
871
731
|
return forkedProjectId;
|
|
@@ -875,24 +735,19 @@ class GitlabConnector {
|
|
|
875
735
|
session,
|
|
876
736
|
path: `api/v4/projects/${websiteId}`
|
|
877
737
|
});
|
|
878
|
-
// Defaults
|
|
879
738
|
let pagesUrl = undefined;
|
|
880
739
|
let pagesVisibility = undefined;
|
|
881
740
|
let lastJob = undefined;
|
|
882
|
-
// Try to get GitLab Pages info
|
|
883
741
|
try {
|
|
884
742
|
const pages = await this.callApi({
|
|
885
743
|
session,
|
|
886
744
|
path: `api/v4/projects/${websiteId}/pages`
|
|
887
745
|
});
|
|
888
746
|
pagesUrl = pages.url;
|
|
889
|
-
// pages.access_control_level may be present; fallback to project.visibility if not
|
|
890
747
|
pagesVisibility = pages.access_control_level || project.visibility;
|
|
891
748
|
}
|
|
892
749
|
catch (e) {
|
|
893
|
-
// If pages are not enabled or call fails, ignore and leave undefined
|
|
894
750
|
}
|
|
895
|
-
// Try to get last relevant job (prefer 'pages' job, otherwise most recent job)
|
|
896
751
|
try {
|
|
897
752
|
const jobs = await this.callApi({
|
|
898
753
|
session,
|
|
@@ -914,9 +769,7 @@ class GitlabConnector {
|
|
|
914
769
|
}
|
|
915
770
|
}
|
|
916
771
|
catch (e) {
|
|
917
|
-
// With no jobs, leave lastJob undefined
|
|
918
772
|
}
|
|
919
|
-
// Fork info - fetch the forked-from project to get license
|
|
920
773
|
let forkedFrom = undefined;
|
|
921
774
|
if (project.forked_from_project) {
|
|
922
775
|
let license = undefined;
|
|
@@ -929,7 +782,6 @@ class GitlabConnector {
|
|
|
929
782
|
license = templateProject.license?.name || templateProject.license?.nickname || templateProject.license?.key;
|
|
930
783
|
}
|
|
931
784
|
catch (e) {
|
|
932
|
-
// Template may be private or inaccessible
|
|
933
785
|
}
|
|
934
786
|
forkedFrom = {
|
|
935
787
|
id: String(project.forked_from_project.id),
|
|
@@ -958,7 +810,6 @@ class GitlabConnector {
|
|
|
958
810
|
return result;
|
|
959
811
|
}
|
|
960
812
|
async setWebsiteMeta(session, websiteId, websiteMeta) {
|
|
961
|
-
// Rename the repo if needed
|
|
962
813
|
const oldMeta = await this.getWebsiteMeta(session, websiteId);
|
|
963
814
|
if (websiteMeta.name !== oldMeta.name) {
|
|
964
815
|
await this.callApi({
|
|
@@ -972,20 +823,18 @@ class GitlabConnector {
|
|
|
972
823
|
}
|
|
973
824
|
}
|
|
974
825
|
async writeAssets(session, websiteId, files, status, removeUnlisted = false) {
|
|
975
|
-
status && await status({ message: `Preparing ${files.length} files`, status:
|
|
976
|
-
// List all the files in assets folder
|
|
826
|
+
status && await status({ message: `Preparing ${files.length} files`, status: types_js_1.JobStatus.IN_PROGRESS });
|
|
977
827
|
const existingFiles = await this.ls({
|
|
978
828
|
session,
|
|
979
829
|
websiteId,
|
|
980
830
|
recursive: true,
|
|
981
831
|
path: this.options.assetsFolder,
|
|
982
832
|
});
|
|
983
|
-
// Create the actions for the batch
|
|
984
833
|
const filesToUpload = [];
|
|
985
834
|
const filesToKeep = new Set(files.map(file => this.getAssetPath(file.path, false)));
|
|
986
835
|
for (const file of files) {
|
|
987
836
|
const filePath = this.getAssetPath(file.path, false);
|
|
988
|
-
const content = (await (0,
|
|
837
|
+
const content = (await (0, connectors_js_1.contentToBuffer)(file.content)).toString('base64');
|
|
989
838
|
const existingSha = existingFiles.get(filePath);
|
|
990
839
|
const newSha = computeGitBlobSha(content, true);
|
|
991
840
|
if (existingSha) {
|
|
@@ -996,7 +845,7 @@ class GitlabConnector {
|
|
|
996
845
|
content,
|
|
997
846
|
encoding: 'base64',
|
|
998
847
|
});
|
|
999
|
-
}
|
|
848
|
+
}
|
|
1000
849
|
}
|
|
1001
850
|
else {
|
|
1002
851
|
filesToUpload.push({
|
|
@@ -1007,7 +856,6 @@ class GitlabConnector {
|
|
|
1007
856
|
});
|
|
1008
857
|
}
|
|
1009
858
|
}
|
|
1010
|
-
// Optionally remove unlisted files
|
|
1011
859
|
if (removeUnlisted) {
|
|
1012
860
|
for (const [existingFilePath] of existingFiles) {
|
|
1013
861
|
if (!filesToKeep.has(existingFilePath)) {
|
|
@@ -1018,25 +866,22 @@ class GitlabConnector {
|
|
|
1018
866
|
}
|
|
1019
867
|
}
|
|
1020
868
|
}
|
|
1021
|
-
// Split the files into chunks to avoid the number of files limit
|
|
1022
869
|
const chunks = [];
|
|
1023
870
|
for (let i = 0; i < filesToUpload.length; i += MAX_BATCH_UPLOAD_SIZE) {
|
|
1024
871
|
chunks.push(filesToUpload.slice(i, i + MAX_BATCH_UPLOAD_SIZE));
|
|
1025
872
|
}
|
|
1026
|
-
// Notify the user if nothing changed
|
|
1027
873
|
if (chunks.length === 0) {
|
|
1028
874
|
console.info('No files to upload');
|
|
1029
|
-
status && await status({ message: 'No files to upload', status:
|
|
875
|
+
status && await status({ message: 'No files to upload', status: types_js_1.JobStatus.SUCCESS });
|
|
1030
876
|
return;
|
|
1031
877
|
}
|
|
1032
|
-
// Upload the files in chunks
|
|
1033
878
|
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
1034
879
|
const chunk = chunks[chunkIndex];
|
|
1035
880
|
if (chunks.length > 1) {
|
|
1036
|
-
status && await status({ message: `Batch ${chunkIndex + 1}/${chunks.length}: Uploading ${chunk.length} files`, status:
|
|
881
|
+
status && await status({ message: `Batch ${chunkIndex + 1}/${chunks.length}: Uploading ${chunk.length} files`, status: types_js_1.JobStatus.IN_PROGRESS });
|
|
1037
882
|
}
|
|
1038
883
|
else {
|
|
1039
|
-
status && await status({ message: `Uploading ${files.length} file(s)`, status:
|
|
884
|
+
status && await status({ message: `Uploading ${files.length} file(s)`, status: types_js_1.JobStatus.IN_PROGRESS });
|
|
1040
885
|
}
|
|
1041
886
|
try {
|
|
1042
887
|
await this.callApi({
|
|
@@ -1052,11 +897,11 @@ class GitlabConnector {
|
|
|
1052
897
|
}
|
|
1053
898
|
catch (e) {
|
|
1054
899
|
console.error(`Batch ${chunkIndex + 1} failed`, e);
|
|
1055
|
-
status && await status({ message: `Error in batch ${chunkIndex + 1}`, status:
|
|
900
|
+
status && await status({ message: `Error in batch ${chunkIndex + 1}`, status: types_js_1.JobStatus.ERROR });
|
|
1056
901
|
throw e;
|
|
1057
902
|
}
|
|
1058
903
|
}
|
|
1059
|
-
status && await status({ message: `All ${files.length} files uploaded`, status:
|
|
904
|
+
status && await status({ message: `All ${files.length} files uploaded`, status: types_js_1.JobStatus.SUCCESS });
|
|
1060
905
|
}
|
|
1061
906
|
async readAsset(session, websiteId, fileName) {
|
|
1062
907
|
const finalPath = this.getAssetPath(fileName, false);
|
|
@@ -1078,35 +923,6 @@ class GitlabConnector {
|
|
|
1078
923
|
}
|
|
1079
924
|
});
|
|
1080
925
|
}
|
|
1081
|
-
/*
|
|
1082
|
-
* Get the meta repo path for the current user
|
|
1083
|
-
* The meta repo contains a JSON file which contains the list of websites
|
|
1084
|
-
*/
|
|
1085
|
-
//private getMetaRepoPath(session: GitlabSession): string {
|
|
1086
|
-
// if(!this.getSessionToken(session).username) throw new ApiError('Missing Gitlab user ID. User not logged in?', 401)
|
|
1087
|
-
// return encodeURIComponent(`${this.getSessionToken(session).username}/${this.options.metaRepo}`)
|
|
1088
|
-
//}
|
|
1089
|
-
///**
|
|
1090
|
-
// * Initialize the storage with a meta repo
|
|
1091
|
-
// */
|
|
1092
|
-
//private async initStorage(session: GitlabSession): Promise<void> {
|
|
1093
|
-
// // Create the meta repo
|
|
1094
|
-
// try {
|
|
1095
|
-
// const project = await this.callApi(session, 'api/v4/projects/', 'POST', {
|
|
1096
|
-
// name: this.options.metaRepo,
|
|
1097
|
-
// }) as any
|
|
1098
|
-
// return this.createFile(session, this.getMetaRepoPath(session), this.options.metaRepoFile, JSON.stringify({
|
|
1099
|
-
// websites: {}
|
|
1100
|
-
// } as MetaRepoFileContent))
|
|
1101
|
-
// } catch (e) {
|
|
1102
|
-
// console.error('Could not init storage', e.statusCode, e.httpStatusCode, e)
|
|
1103
|
-
// throw e
|
|
1104
|
-
// }
|
|
1105
|
-
//}
|
|
1106
|
-
/**
|
|
1107
|
-
* List all the files in a folder
|
|
1108
|
-
* The result is a map of file paths to their SHA
|
|
1109
|
-
*/
|
|
1110
926
|
async ls({ session, websiteId, recursive = false, path, }) {
|
|
1111
927
|
const existingPaths = new Map();
|
|
1112
928
|
let page = 1;
|
|
@@ -1131,25 +947,18 @@ class GitlabConnector {
|
|
|
1131
947
|
});
|
|
1132
948
|
}
|
|
1133
949
|
catch (e) {
|
|
1134
|
-
// Allow 404 errors
|
|
1135
|
-
// This happens when the folder does not exist
|
|
1136
|
-
// In git this just means the files don't exist yet
|
|
1137
950
|
if (e.statusCode !== 404 && e.httpStatusCode !== 404) {
|
|
1138
951
|
throw e;
|
|
1139
952
|
}
|
|
1140
953
|
}
|
|
1141
|
-
// Filter the files
|
|
1142
954
|
tree
|
|
1143
955
|
.filter(item => item.type === 'blob')
|
|
1144
956
|
.forEach(item => existingPaths.set(item.path, item.id));
|
|
1145
|
-
// Check if we need to keep going
|
|
1146
957
|
const maxPages = responseHeaders['x-total-pages'] ? parseInt(responseHeaders['x-total-pages'], 10) : 1;
|
|
1147
958
|
keepGoing = page < maxPages;
|
|
1148
959
|
page++;
|
|
1149
960
|
}
|
|
1150
|
-
// Return the set of existing paths
|
|
1151
961
|
return existingPaths;
|
|
1152
962
|
}
|
|
1153
963
|
}
|
|
1154
964
|
exports.default = GitlabConnector;
|
|
1155
|
-
//# sourceMappingURL=GitlabConnector.js.map
|