@paroicms/server 0.151.0 → 0.151.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/dist/cli.d.ts +2 -0
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -0
- package/dist/common/child-ordering-query.d.ts +13 -0
- package/dist/common/child-ordering-query.js +107 -0
- package/dist/common/child-ordering-query.js.map +1 -0
- package/dist/common/data-format.d.ts +19 -0
- package/dist/common/data-format.js +86 -0
- package/dist/common/data-format.js.map +1 -0
- package/dist/common/mail/html-helpers.d.ts +7 -0
- package/dist/common/mail/html-helpers.js +46 -0
- package/dist/common/mail/html-helpers.js.map +1 -0
- package/dist/common/mail/sendMail.helpers.d.ts +14 -0
- package/dist/common/mail/sendMail.helpers.js +51 -0
- package/dist/common/mail/sendMail.helpers.js.map +1 -0
- package/dist/common/media-handles.helpers.d.ts +19 -0
- package/dist/common/media-handles.helpers.js +52 -0
- package/dist/common/media-handles.helpers.js.map +1 -0
- package/dist/common/serve-html-or.d.ts +16 -0
- package/dist/common/serve-html-or.js +72 -0
- package/dist/common/serve-html-or.js.map +1 -0
- package/dist/common/text-cache.d.ts +57 -0
- package/dist/common/text-cache.js +87 -0
- package/dist/common/text-cache.js.map +1 -0
- package/dist/common/tracker-report.d.ts +2 -0
- package/dist/common/tracker-report.js +27 -0
- package/dist/common/tracker-report.js.map +1 -0
- package/dist/context.d.ts +29 -0
- package/dist/context.js +60 -0
- package/dist/context.js.map +1 -0
- package/dist/express/http-helpers.d.ts +16 -0
- package/dist/express/http-helpers.js +44 -0
- package/dist/express/http-helpers.js.map +1 -0
- package/dist/express/static-middlewares.d.ts +3 -0
- package/dist/express/static-middlewares.js +114 -0
- package/dist/express/static-middlewares.js.map +1 -0
- package/dist/helpers/configuration.helpers.d.ts +2 -0
- package/dist/helpers/configuration.helpers.js +8 -0
- package/dist/helpers/configuration.helpers.js.map +1 -0
- package/dist/helpers/excerpt.helpers.d.ts +2 -0
- package/dist/helpers/excerpt.helpers.js +31 -0
- package/dist/helpers/excerpt.helpers.js.map +1 -0
- package/dist/helpers/jwt-secret.helpers.d.ts +2 -0
- package/dist/helpers/jwt-secret.helpers.js +30 -0
- package/dist/helpers/jwt-secret.helpers.js.map +1 -0
- package/dist/helpers/label-translator.helper.d.ts +9 -0
- package/dist/helpers/label-translator.helper.js +14 -0
- package/dist/helpers/label-translator.helper.js.map +1 -0
- package/dist/helpers/passwordEncrypt-helper.d.ts +2 -0
- package/dist/helpers/passwordEncrypt-helper.js +37 -0
- package/dist/helpers/passwordEncrypt-helper.js.map +1 -0
- package/dist/helpers/relative-id-helper.d.ts +10 -0
- package/dist/helpers/relative-id-helper.js +37 -0
- package/dist/helpers/relative-id-helper.js.map +1 -0
- package/dist/helpers/simple-i18n.d.ts +14 -0
- package/dist/helpers/simple-i18n.js +82 -0
- package/dist/helpers/simple-i18n.js.map +1 -0
- package/dist/helpers/special-account.helpers.d.ts +9 -0
- package/dist/helpers/special-account.helpers.js +43 -0
- package/dist/helpers/special-account.helpers.js.map +1 -0
- package/dist/helpers/url.helpers.d.ts +2 -0
- package/dist/helpers/url.helpers.js +12 -0
- package/dist/helpers/url.helpers.js.map +1 -0
- package/dist/helpers/utils-helper.d.ts +4 -0
- package/dist/helpers/utils-helper.js +32 -0
- package/dist/helpers/utils-helper.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/liquidjs-tools/liquidjs-drop.d.ts +31 -0
- package/dist/liquidjs-tools/liquidjs-drop.js +45 -0
- package/dist/liquidjs-tools/liquidjs-drop.js.map +1 -0
- package/dist/liquidjs-tools/liquidjs-filter.d.ts +10 -0
- package/dist/liquidjs-tools/liquidjs-filter.js +23 -0
- package/dist/liquidjs-tools/liquidjs-filter.js.map +1 -0
- package/dist/liquidjs-tools/liquidjs-rendering/render-liquidjs.d.ts +6 -0
- package/dist/liquidjs-tools/liquidjs-rendering/render-liquidjs.js +40 -0
- package/dist/liquidjs-tools/liquidjs-rendering/render-liquidjs.js.map +1 -0
- package/dist/liquidjs-tools/liquidjs-rendering/rendering-context.d.ts +25 -0
- package/dist/liquidjs-tools/liquidjs-rendering/rendering-context.js +35 -0
- package/dist/liquidjs-tools/liquidjs-rendering/rendering-context.js.map +1 -0
- package/dist/liquidjs-tools/liquidjs-utils.d.ts +5 -0
- package/dist/liquidjs-tools/liquidjs-utils.js +22 -0
- package/dist/liquidjs-tools/liquidjs-utils.js.map +1 -0
- package/dist/liquidjs-tools/render-clone/collection.d.ts +1 -0
- package/dist/liquidjs-tools/render-clone/collection.js +18 -0
- package/dist/liquidjs-tools/render-clone/collection.js.map +1 -0
- package/dist/liquidjs-tools/render-clone/forloop-drop.d.ts +15 -0
- package/dist/liquidjs-tools/render-clone/forloop-drop.js +40 -0
- package/dist/liquidjs-tools/render-clone/forloop-drop.js.map +1 -0
- package/dist/liquidjs-tools/render-clone/render.d.ts +13 -0
- package/dist/liquidjs-tools/render-clone/render.js +108 -0
- package/dist/liquidjs-tools/render-clone/render.js.map +1 -0
- package/dist/maintenance/maintenance-task.d.ts +4 -0
- package/dist/maintenance/maintenance-task.js +27 -0
- package/dist/maintenance/maintenance-task.js.map +1 -0
- package/dist/maintenance/shutdown.d.ts +7 -0
- package/dist/maintenance/shutdown.js +51 -0
- package/dist/maintenance/shutdown.js.map +1 -0
- package/dist/modules/app.controller.d.ts +5 -0
- package/dist/modules/app.controller.js +89 -0
- package/dist/modules/app.controller.js.map +1 -0
- package/dist/modules/app.module.d.ts +2 -0
- package/dist/modules/app.module.js +48 -0
- package/dist/modules/app.module.js.map +1 -0
- package/dist/modules/core/account/account.model.d.ts +18 -0
- package/dist/modules/core/account/account.model.js +59 -0
- package/dist/modules/core/account/account.model.js.map +1 -0
- package/dist/modules/core/account/account.module.d.ts +2 -0
- package/dist/modules/core/account/account.module.js +20 -0
- package/dist/modules/core/account/account.module.js.map +1 -0
- package/dist/modules/core/account/account.queries.d.ts +18 -0
- package/dist/modules/core/account/account.queries.js +150 -0
- package/dist/modules/core/account/account.queries.js.map +1 -0
- package/dist/modules/core/account/account.resolver.d.ts +11 -0
- package/dist/modules/core/account/account.resolver.js +107 -0
- package/dist/modules/core/account/account.resolver.js.map +1 -0
- package/dist/modules/core/account/account.schema.d.ts +24 -0
- package/dist/modules/core/account/account.schema.js +114 -0
- package/dist/modules/core/account/account.schema.js.map +1 -0
- package/dist/modules/core/account-auth/account-auth.module.d.ts +2 -0
- package/dist/modules/core/account-auth/account-auth.module.js +24 -0
- package/dist/modules/core/account-auth/account-auth.module.js.map +1 -0
- package/dist/modules/core/account-auth/account-auth.service.d.ts +5 -0
- package/dist/modules/core/account-auth/account-auth.service.js +41 -0
- package/dist/modules/core/account-auth/account-auth.service.js.map +1 -0
- package/dist/modules/core/account-auth/account-auth.strategy.d.ts +10 -0
- package/dist/modules/core/account-auth/account-auth.strategy.js +48 -0
- package/dist/modules/core/account-auth/account-auth.strategy.js.map +1 -0
- package/dist/modules/core/auth/auth.module.d.ts +2 -0
- package/dist/modules/core/auth/auth.module.js +35 -0
- package/dist/modules/core/auth/auth.module.js.map +1 -0
- package/dist/modules/core/auth/auth.service.d.ts +11 -0
- package/dist/modules/core/auth/auth.service.js +163 -0
- package/dist/modules/core/auth/auth.service.js.map +1 -0
- package/dist/modules/core/auth/auth.types.d.ts +27 -0
- package/dist/modules/core/auth/auth.types.js +3 -0
- package/dist/modules/core/auth/auth.types.js.map +1 -0
- package/dist/modules/core/auth/jwt.auth.guard.d.ts +6 -0
- package/dist/modules/core/auth/jwt.auth.guard.js +23 -0
- package/dist/modules/core/auth/jwt.auth.guard.js.map +1 -0
- package/dist/modules/core/auth/jwt.strategy.d.ts +10 -0
- package/dist/modules/core/auth/jwt.strategy.js +35 -0
- package/dist/modules/core/auth/jwt.strategy.js.map +1 -0
- package/dist/modules/core/backup/backup.controller.d.ts +7 -0
- package/dist/modules/core/backup/backup.controller.js +60 -0
- package/dist/modules/core/backup/backup.controller.js.map +1 -0
- package/dist/modules/core/backup/backup.module.d.ts +2 -0
- package/dist/modules/core/backup/backup.module.js +22 -0
- package/dist/modules/core/backup/backup.module.js.map +1 -0
- package/dist/modules/core/backup/backup.resolver.d.ts +8 -0
- package/dist/modules/core/backup/backup.resolver.js +53 -0
- package/dist/modules/core/backup/backup.resolver.js.map +1 -0
- package/dist/modules/core/backup/backup.shema.d.ts +4 -0
- package/dist/modules/core/backup/backup.shema.js +30 -0
- package/dist/modules/core/backup/backup.shema.js.map +1 -0
- package/dist/modules/core/core.module.d.ts +2 -0
- package/dist/modules/core/core.module.js +50 -0
- package/dist/modules/core/core.module.js.map +1 -0
- package/dist/modules/core/document/document.helper.d.ts +2 -0
- package/dist/modules/core/document/document.helper.js +10 -0
- package/dist/modules/core/document/document.helper.js.map +1 -0
- package/dist/modules/core/document/document.model.d.ts +9 -0
- package/dist/modules/core/document/document.model.js +59 -0
- package/dist/modules/core/document/document.model.js.map +1 -0
- package/dist/modules/core/document/document.module.d.ts +2 -0
- package/dist/modules/core/document/document.module.js +25 -0
- package/dist/modules/core/document/document.module.js.map +1 -0
- package/dist/modules/core/document/document.resolver.d.ts +12 -0
- package/dist/modules/core/document/document.resolver.extend.d.ts +10 -0
- package/dist/modules/core/document/document.resolver.extend.js +69 -0
- package/dist/modules/core/document/document.resolver.extend.js.map +1 -0
- package/dist/modules/core/document/document.resolver.js +154 -0
- package/dist/modules/core/document/document.resolver.js.map +1 -0
- package/dist/modules/core/document/document.schema.d.ts +39 -0
- package/dist/modules/core/document/document.schema.js +181 -0
- package/dist/modules/core/document/document.schema.js.map +1 -0
- package/dist/modules/core/document/load-documents.queries.d.ts +17 -0
- package/dist/modules/core/document/load-documents.queries.js +119 -0
- package/dist/modules/core/document/load-documents.queries.js.map +1 -0
- package/dist/modules/core/document/save-documents.queries.d.ts +18 -0
- package/dist/modules/core/document/save-documents.queries.js +199 -0
- package/dist/modules/core/document/save-documents.queries.js.map +1 -0
- package/dist/modules/core/fields/_fields.helpers.d.ts +2 -0
- package/dist/modules/core/fields/_fields.helpers.js +12 -0
- package/dist/modules/core/fields/_fields.helpers.js.map +1 -0
- package/dist/modules/core/fields/fields.model.d.ts +17 -0
- package/dist/modules/core/fields/fields.model.js +99 -0
- package/dist/modules/core/fields/fields.model.js.map +1 -0
- package/dist/modules/core/fields/fields.module.d.ts +2 -0
- package/dist/modules/core/fields/fields.module.js +20 -0
- package/dist/modules/core/fields/fields.module.js.map +1 -0
- package/dist/modules/core/fields/fields.resolver.d.ts +14 -0
- package/dist/modules/core/fields/fields.resolver.js +165 -0
- package/dist/modules/core/fields/fields.resolver.js.map +1 -0
- package/dist/modules/core/fields/load-fields.queries.d.ts +20 -0
- package/dist/modules/core/fields/load-fields.queries.js +233 -0
- package/dist/modules/core/fields/load-fields.queries.js.map +1 -0
- package/dist/modules/core/fields/quill-delta.d.ts +1 -0
- package/dist/modules/core/fields/quill-delta.js +40 -0
- package/dist/modules/core/fields/quill-delta.js.map +1 -0
- package/dist/modules/core/fields/save-fields.queries.d.ts +9 -0
- package/dist/modules/core/fields/save-fields.queries.js +135 -0
- package/dist/modules/core/fields/save-fields.queries.js.map +1 -0
- package/dist/modules/core/leaf/leaf.model.d.ts +9 -0
- package/dist/modules/core/leaf/leaf.model.js +61 -0
- package/dist/modules/core/leaf/leaf.model.js.map +1 -0
- package/dist/modules/core/leaf/leaf.module.d.ts +2 -0
- package/dist/modules/core/leaf/leaf.module.js +21 -0
- package/dist/modules/core/leaf/leaf.module.js.map +1 -0
- package/dist/modules/core/leaf/leaf.queries.d.ts +21 -0
- package/dist/modules/core/leaf/leaf.queries.js +159 -0
- package/dist/modules/core/leaf/leaf.queries.js.map +1 -0
- package/dist/modules/core/leaf/leaf.resolver.d.ts +9 -0
- package/dist/modules/core/leaf/leaf.resolver.extend.d.ts +6 -0
- package/dist/modules/core/leaf/leaf.resolver.extend.js +42 -0
- package/dist/modules/core/leaf/leaf.resolver.extend.js.map +1 -0
- package/dist/modules/core/leaf/leaf.resolver.js +84 -0
- package/dist/modules/core/leaf/leaf.resolver.js.map +1 -0
- package/dist/modules/core/leaf/leaf.schema.d.ts +7 -0
- package/dist/modules/core/leaf/leaf.schema.js +45 -0
- package/dist/modules/core/leaf/leaf.schema.js.map +1 -0
- package/dist/modules/core/leaf-item/leaf-item.model.d.ts +6 -0
- package/dist/modules/core/leaf-item/leaf-item.model.js +44 -0
- package/dist/modules/core/leaf-item/leaf-item.model.js.map +1 -0
- package/dist/modules/core/leaf-item/leaf-item.queries.d.ts +9 -0
- package/dist/modules/core/leaf-item/leaf-item.queries.js +120 -0
- package/dist/modules/core/leaf-item/leaf-item.queries.js.map +1 -0
- package/dist/modules/core/login/login.controller.d.ts +8 -0
- package/dist/modules/core/login/login.controller.js +53 -0
- package/dist/modules/core/login/login.controller.js.map +1 -0
- package/dist/modules/core/login/login.module.d.ts +2 -0
- package/dist/modules/core/login/login.module.js +22 -0
- package/dist/modules/core/login/login.module.js.map +1 -0
- package/dist/modules/core/media/media-upload.controller.d.ts +21 -0
- package/dist/modules/core/media/media-upload.controller.js +160 -0
- package/dist/modules/core/media/media-upload.controller.js.map +1 -0
- package/dist/modules/core/media/media.d.ts +22 -0
- package/dist/modules/core/media/media.js +53 -0
- package/dist/modules/core/media/media.js.map +1 -0
- package/dist/modules/core/media/media.module.d.ts +2 -0
- package/dist/modules/core/media/media.module.js +22 -0
- package/dist/modules/core/media/media.module.js.map +1 -0
- package/dist/modules/core/media/media.resolver.d.ts +14 -0
- package/dist/modules/core/media/media.resolver.js +199 -0
- package/dist/modules/core/media/media.resolver.js.map +1 -0
- package/dist/modules/core/media/media.schema.d.ts +30 -0
- package/dist/modules/core/media/media.schema.js +144 -0
- package/dist/modules/core/media/media.schema.js.map +1 -0
- package/dist/modules/core/part/part.module.d.ts +2 -0
- package/dist/modules/core/part/part.module.js +21 -0
- package/dist/modules/core/part/part.module.js.map +1 -0
- package/dist/modules/core/part/part.queries.d.ts +22 -0
- package/dist/modules/core/part/part.queries.js +167 -0
- package/dist/modules/core/part/part.queries.js.map +1 -0
- package/dist/modules/core/part/part.resolver.d.ts +14 -0
- package/dist/modules/core/part/part.resolver.extend.d.ts +5 -0
- package/dist/modules/core/part/part.resolver.extend.js +49 -0
- package/dist/modules/core/part/part.resolver.extend.js.map +1 -0
- package/dist/modules/core/part/part.resolver.js +135 -0
- package/dist/modules/core/part/part.resolver.js.map +1 -0
- package/dist/modules/core/part/part.schema.d.ts +12 -0
- package/dist/modules/core/part/part.schema.js +66 -0
- package/dist/modules/core/part/part.schema.js.map +1 -0
- package/dist/modules/core/section/section-wrap.resolver.d.ts +11 -0
- package/dist/modules/core/section/section-wrap.resolver.js +168 -0
- package/dist/modules/core/section/section-wrap.resolver.js.map +1 -0
- package/dist/modules/core/section/section.model.d.ts +6 -0
- package/dist/modules/core/section/section.model.js +44 -0
- package/dist/modules/core/section/section.model.js.map +1 -0
- package/dist/modules/core/section/section.module.d.ts +2 -0
- package/dist/modules/core/section/section.module.js +21 -0
- package/dist/modules/core/section/section.module.js.map +1 -0
- package/dist/modules/core/section/section.queries.d.ts +51 -0
- package/dist/modules/core/section/section.queries.js +228 -0
- package/dist/modules/core/section/section.queries.js.map +1 -0
- package/dist/modules/core/section/section.resolver.d.ts +7 -0
- package/dist/modules/core/section/section.resolver.js +78 -0
- package/dist/modules/core/section/section.resolver.js.map +1 -0
- package/dist/modules/core/section/section.schema.d.ts +27 -0
- package/dist/modules/core/section/section.schema.js +129 -0
- package/dist/modules/core/section/section.schema.js.map +1 -0
- package/dist/modules/core/site-info/site-info.module.d.ts +2 -0
- package/dist/modules/core/site-info/site-info.module.js +20 -0
- package/dist/modules/core/site-info/site-info.module.js.map +1 -0
- package/dist/modules/core/site-info/site-info.resolver.d.ts +5 -0
- package/dist/modules/core/site-info/site-info.resolver.js +44 -0
- package/dist/modules/core/site-info/site-info.resolver.js.map +1 -0
- package/dist/modules/core/site-info/site-info.schema.d.ts +6 -0
- package/dist/modules/core/site-info/site-info.schema.js +36 -0
- package/dist/modules/core/site-info/site-info.schema.js.map +1 -0
- package/dist/modules/core/site-schema/site-schema.module.d.ts +2 -0
- package/dist/modules/core/site-schema/site-schema.module.js +20 -0
- package/dist/modules/core/site-schema/site-schema.module.js.map +1 -0
- package/dist/modules/core/site-schema/site-schema.resolver.d.ts +4 -0
- package/dist/modules/core/site-schema/site-schema.resolver.js +35 -0
- package/dist/modules/core/site-schema/site-schema.resolver.js.map +1 -0
- package/dist/modules/core/term-flag/term-flag.model.d.ts +6 -0
- package/dist/modules/core/term-flag/term-flag.model.js +45 -0
- package/dist/modules/core/term-flag/term-flag.model.js.map +1 -0
- package/dist/modules/core/term-flag/term-flag.module.d.ts +2 -0
- package/dist/modules/core/term-flag/term-flag.module.js +20 -0
- package/dist/modules/core/term-flag/term-flag.module.js.map +1 -0
- package/dist/modules/core/term-flag/term-flag.queries.d.ts +7 -0
- package/dist/modules/core/term-flag/term-flag.queries.js +44 -0
- package/dist/modules/core/term-flag/term-flag.queries.js.map +1 -0
- package/dist/modules/core/term-flag/term-flag.resolver.d.ts +5 -0
- package/dist/modules/core/term-flag/term-flag.resolver.js +47 -0
- package/dist/modules/core/term-flag/term-flag.resolver.js.map +1 -0
- package/dist/modules/core/term-flag/term-flag.schema.d.ts +9 -0
- package/dist/modules/core/term-flag/term-flag.schema.js +51 -0
- package/dist/modules/core/term-flag/term-flag.schema.js.map +1 -0
- package/dist/modules/core/unprotected/unprotected.module.d.ts +2 -0
- package/dist/modules/core/unprotected/unprotected.module.js +20 -0
- package/dist/modules/core/unprotected/unprotected.module.js.map +1 -0
- package/dist/modules/core/unprotected/unprotected.resolver.d.ts +8 -0
- package/dist/modules/core/unprotected/unprotected.resolver.js +106 -0
- package/dist/modules/core/unprotected/unprotected.resolver.js.map +1 -0
- package/dist/modules/core/unprotected/unprotected.schema.d.ts +19 -0
- package/dist/modules/core/unprotected/unprotected.schema.js +93 -0
- package/dist/modules/core/unprotected/unprotected.schema.js.map +1 -0
- package/dist/modules/graphql.types.d.ts +6 -0
- package/dist/modules/graphql.types.js +3 -0
- package/dist/modules/graphql.types.js.map +1 -0
- package/dist/modules/private-api.module.d.ts +2 -0
- package/dist/modules/private-api.module.js +50 -0
- package/dist/modules/private-api.module.js.map +1 -0
- package/dist/modules/public-api/class-validator-options.d.ts +7 -0
- package/dist/modules/public-api/class-validator-options.js +11 -0
- package/dist/modules/public-api/class-validator-options.js.map +1 -0
- package/dist/modules/public-api/mail/contact-form-mail.d.ts +8 -0
- package/dist/modules/public-api/mail/contact-form-mail.js +96 -0
- package/dist/modules/public-api/mail/contact-form-mail.js.map +1 -0
- package/dist/modules/public-api/mail/mail.dto.d.ts +8 -0
- package/dist/modules/public-api/mail/mail.dto.js +56 -0
- package/dist/modules/public-api/mail/mail.dto.js.map +1 -0
- package/dist/modules/public-api/partials/partials-params.dto.d.ts +6 -0
- package/dist/modules/public-api/partials/partials-params.dto.js +45 -0
- package/dist/modules/public-api/partials/partials-params.dto.js.map +1 -0
- package/dist/modules/public-api/password-reset/password-reset.controller.d.ts +11 -0
- package/dist/modules/public-api/password-reset/password-reset.controller.js +57 -0
- package/dist/modules/public-api/password-reset/password-reset.controller.js.map +1 -0
- package/dist/modules/public-api/password-reset/password-reset.dto.d.ts +9 -0
- package/dist/modules/public-api/password-reset/password-reset.dto.js +55 -0
- package/dist/modules/public-api/password-reset/password-reset.dto.js.map +1 -0
- package/dist/modules/public-api/password-reset/password-reset.module.d.ts +2 -0
- package/dist/modules/public-api/password-reset/password-reset.module.js +22 -0
- package/dist/modules/public-api/password-reset/password-reset.module.js.map +1 -0
- package/dist/modules/public-api/password-reset/password-reset.service.d.ts +14 -0
- package/dist/modules/public-api/password-reset/password-reset.service.js +56 -0
- package/dist/modules/public-api/password-reset/password-reset.service.js.map +1 -0
- package/dist/modules/public-api/public-api-controller.d.ts +32 -0
- package/dist/modules/public-api/public-api-controller.js +195 -0
- package/dist/modules/public-api/public-api-controller.js.map +1 -0
- package/dist/modules/public-api/public-api.module.d.ts +2 -0
- package/dist/modules/public-api/public-api.module.js +22 -0
- package/dist/modules/public-api/public-api.module.js.map +1 -0
- package/dist/modules/public-api/search-text/search-text.dto.d.ts +7 -0
- package/dist/modules/public-api/search-text/search-text.dto.js +50 -0
- package/dist/modules/public-api/search-text/search-text.dto.js.map +1 -0
- package/dist/modules/public-api/search-text/search-text.queries.d.ts +14 -0
- package/dist/modules/public-api/search-text/search-text.queries.js +58 -0
- package/dist/modules/public-api/search-text/search-text.queries.js.map +1 -0
- package/dist/modules/public-site/app-exception-filter.d.ts +4 -0
- package/dist/modules/public-site/app-exception-filter.js +41 -0
- package/dist/modules/public-site/app-exception-filter.js.map +1 -0
- package/dist/modules/public-site/helpers/format-date.helper.d.ts +4 -0
- package/dist/modules/public-site/helpers/format-date.helper.js +35 -0
- package/dist/modules/public-site/helpers/format-date.helper.js.map +1 -0
- package/dist/modules/public-site/helpers/medias.helpers.d.ts +3 -0
- package/dist/modules/public-site/helpers/medias.helpers.js +16 -0
- package/dist/modules/public-site/helpers/medias.helpers.js.map +1 -0
- package/dist/modules/public-site/helpers/obfuscate.helper.d.ts +2 -0
- package/dist/modules/public-site/helpers/obfuscate.helper.js +27 -0
- package/dist/modules/public-site/helpers/obfuscate.helper.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/format-date.d.ts +7 -0
- package/dist/modules/public-site/liquidjs-filters/format-date.js +15 -0
- package/dist/modules/public-site/liquidjs-filters/format-date.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/format-number.d.ts +6 -0
- package/dist/modules/public-site/liquidjs-filters/format-number.js +17 -0
- package/dist/modules/public-site/liquidjs-filters/format-number.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/info-filter.d.ts +1 -0
- package/dist/modules/public-site/liquidjs-filters/info-filter.js +144 -0
- package/dist/modules/public-site/liquidjs-filters/info-filter.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/inject-facebook-chat.d.ts +1 -0
- package/dist/modules/public-site/liquidjs-filters/inject-facebook-chat.js +40 -0
- package/dist/modules/public-site/liquidjs-filters/inject-facebook-chat.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/inject-menu-items-data.d.ts +6 -0
- package/dist/modules/public-site/liquidjs-filters/inject-menu-items-data.js +25 -0
- package/dist/modules/public-site/liquidjs-filters/inject-menu-items-data.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/make-excerpt.d.ts +3 -0
- package/dist/modules/public-site/liquidjs-filters/make-excerpt.js +10 -0
- package/dist/modules/public-site/liquidjs-filters/make-excerpt.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/obfuscate.d.ts +2 -0
- package/dist/modules/public-site/liquidjs-filters/obfuscate.js +18 -0
- package/dist/modules/public-site/liquidjs-filters/obfuscate.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/open-graph-filter.d.ts +6 -0
- package/dist/modules/public-site/liquidjs-filters/open-graph-filter.js +41 -0
- package/dist/modules/public-site/liquidjs-filters/open-graph-filter.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.d.ts +7 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.js +23 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.js.map +1 -0
- package/dist/modules/public-site/liquidjs-tags/get-page-tag.d.ts +13 -0
- package/dist/modules/public-site/liquidjs-tags/get-page-tag.js +69 -0
- package/dist/modules/public-site/liquidjs-tags/get-page-tag.js.map +1 -0
- package/dist/modules/public-site/liquidjs-tags/get-pages-tag.d.ts +13 -0
- package/dist/modules/public-site/liquidjs-tags/get-pages-tag.js +95 -0
- package/dist/modules/public-site/liquidjs-tags/get-pages-tag.js.map +1 -0
- package/dist/modules/public-site/liquidjs-tags/use-image-tag.d.ts +13 -0
- package/dist/modules/public-site/liquidjs-tags/use-image-tag.js +54 -0
- package/dist/modules/public-site/liquidjs-tags/use-image-tag.js.map +1 -0
- package/dist/modules/public-site/media-serve/_media-serve-helpers.d.ts +11 -0
- package/dist/modules/public-site/media-serve/_media-serve-helpers.js +26 -0
- package/dist/modules/public-site/media-serve/_media-serve-helpers.js.map +1 -0
- package/dist/modules/public-site/media-serve/media-serve.controller.d.ts +4 -0
- package/dist/modules/public-site/media-serve/media-serve.controller.js +140 -0
- package/dist/modules/public-site/media-serve/media-serve.controller.js.map +1 -0
- package/dist/modules/public-site/media-serve/media-serve.module.d.ts +2 -0
- package/dist/modules/public-site/media-serve/media-serve.module.js +20 -0
- package/dist/modules/public-site/media-serve/media-serve.module.js.map +1 -0
- package/dist/modules/public-site/oauth2-client.controller.d.ts +10 -0
- package/dist/modules/public-site/oauth2-client.controller.js +143 -0
- package/dist/modules/public-site/oauth2-client.controller.js.map +1 -0
- package/dist/modules/public-site/public-route/make-url.d.ts +11 -0
- package/dist/modules/public-site/public-route/make-url.js +150 -0
- package/dist/modules/public-site/public-route/make-url.js.map +1 -0
- package/dist/modules/public-site/public-route/public-route-parser.d.ts +16 -0
- package/dist/modules/public-site/public-route/public-route-parser.js +154 -0
- package/dist/modules/public-site/public-route/public-route-parser.js.map +1 -0
- package/dist/modules/public-site/public-route/raw-document-payload.d.ts +8 -0
- package/dist/modules/public-site/public-route/raw-document-payload.js +86 -0
- package/dist/modules/public-site/public-route/raw-document-payload.js.map +1 -0
- package/dist/modules/public-site/public-site.controller.d.ts +7 -0
- package/dist/modules/public-site/public-site.controller.js +58 -0
- package/dist/modules/public-site/public-site.controller.js.map +1 -0
- package/dist/modules/public-site/public-site.middleware.d.ts +5 -0
- package/dist/modules/public-site/public-site.middleware.js +67 -0
- package/dist/modules/public-site/public-site.middleware.js.map +1 -0
- package/dist/modules/public-site/public-site.module.d.ts +4 -0
- package/dist/modules/public-site/public-site.module.js +27 -0
- package/dist/modules/public-site/public-site.module.js.map +1 -0
- package/dist/modules/public-site/serve-document/serve-document.d.ts +20 -0
- package/dist/modules/public-site/serve-document/serve-document.js +60 -0
- package/dist/modules/public-site/serve-document/serve-document.js.map +1 -0
- package/dist/modules/security/app-throttler-guard.d.ts +8 -0
- package/dist/modules/security/app-throttler-guard.js +18 -0
- package/dist/modules/security/app-throttler-guard.js.map +1 -0
- package/dist/modules/security/complexity-plugin.d.ts +8 -0
- package/dist/modules/security/complexity-plugin.js +45 -0
- package/dist/modules/security/complexity-plugin.js.map +1 -0
- package/dist/nest-custom-logger.d.ts +8 -0
- package/dist/nest-custom-logger.js +23 -0
- package/dist/nest-custom-logger.js.map +1 -0
- package/dist/public-payload/breadcrumb.queries.d.ts +5 -0
- package/dist/public-payload/breadcrumb.queries.js +26 -0
- package/dist/public-payload/breadcrumb.queries.js.map +1 -0
- package/dist/public-payload/create-page-drop.d.ts +11 -0
- package/dist/public-payload/create-page-drop.js +160 -0
- package/dist/public-payload/create-page-drop.js.map +1 -0
- package/dist/public-payload/create-page-part-drop.d.ts +7 -0
- package/dist/public-payload/create-page-part-drop.js +39 -0
- package/dist/public-payload/create-page-part-drop.js.map +1 -0
- package/dist/public-payload/excerpt.queries.d.ts +10 -0
- package/dist/public-payload/excerpt.queries.js +38 -0
- package/dist/public-payload/excerpt.queries.js.map +1 -0
- package/dist/public-payload/field-values.d.ts +9 -0
- package/dist/public-payload/field-values.js +99 -0
- package/dist/public-payload/field-values.js.map +1 -0
- package/dist/public-payload/get-siblings.queries.d.ts +5 -0
- package/dist/public-payload/get-siblings.queries.js +117 -0
- package/dist/public-payload/get-siblings.queries.js.map +1 -0
- package/dist/public-payload/load-default-image.d.ts +8 -0
- package/dist/public-payload/load-default-image.js +52 -0
- package/dist/public-payload/load-default-image.js.map +1 -0
- package/dist/public-payload/make-basic-payload.d.ts +6 -0
- package/dist/public-payload/make-basic-payload.js +19 -0
- package/dist/public-payload/make-basic-payload.js.map +1 -0
- package/dist/public-payload/make-image-available.d.ts +26 -0
- package/dist/public-payload/make-image-available.js +38 -0
- package/dist/public-payload/make-image-available.js.map +1 -0
- package/dist/public-payload/page-values.queries.d.ts +27 -0
- package/dist/public-payload/page-values.queries.js +110 -0
- package/dist/public-payload/page-values.queries.js.map +1 -0
- package/dist/public-payload/parts.queries.d.ts +6 -0
- package/dist/public-payload/parts.queries.js +123 -0
- package/dist/public-payload/parts.queries.js.map +1 -0
- package/dist/public-payload/public-payload.types.d.ts +130 -0
- package/dist/public-payload/public-payload.types.js +3 -0
- package/dist/public-payload/public-payload.types.js.map +1 -0
- package/dist/public-payload/site-payload.d.ts +4 -0
- package/dist/public-payload/site-payload.js +43 -0
- package/dist/public-payload/site-payload.js.map +1 -0
- package/dist/public-payload/taxonomies.queries.d.ts +13 -0
- package/dist/public-payload/taxonomies.queries.js +45 -0
- package/dist/public-payload/taxonomies.queries.js.map +1 -0
- package/dist/public-payload/translations.queries.d.ts +7 -0
- package/dist/public-payload/translations.queries.js +62 -0
- package/dist/public-payload/translations.queries.js.map +1 -0
- package/dist/public.types.d.ts +5 -0
- package/dist/public.types.js +3 -0
- package/dist/public.types.js.map +1 -0
- package/dist/share/pino-app-log.d.ts +26 -0
- package/dist/share/pino-app-log.js +138 -0
- package/dist/share/pino-app-log.js.map +1 -0
- package/dist/share/read-configuration.d.ts +7 -0
- package/dist/share/read-configuration.js +31 -0
- package/dist/share/read-configuration.js.map +1 -0
- package/dist/site-backup/archiver.helper.d.ts +12 -0
- package/dist/site-backup/archiver.helper.js +43 -0
- package/dist/site-backup/archiver.helper.js.map +1 -0
- package/dist/site-backup/backup-tasks.d.ts +10 -0
- package/dist/site-backup/backup-tasks.js +50 -0
- package/dist/site-backup/backup-tasks.js.map +1 -0
- package/dist/site-backup/backup.d.ts +11 -0
- package/dist/site-backup/backup.helper.d.ts +3 -0
- package/dist/site-backup/backup.helper.js +13 -0
- package/dist/site-backup/backup.helper.js.map +1 -0
- package/dist/site-backup/backup.js +35 -0
- package/dist/site-backup/backup.js.map +1 -0
- package/dist/site-context/create-site-context.d.ts +3 -0
- package/dist/site-context/create-site-context.js +183 -0
- package/dist/site-context/create-site-context.js.map +1 -0
- package/dist/site-context/db-init/db-init.d.ts +11 -0
- package/dist/site-context/db-init/db-init.js +38 -0
- package/dist/site-context/db-init/db-init.js.map +1 -0
- package/dist/site-context/db-init/ddl-migration.d.ts +13 -0
- package/dist/site-context/db-init/ddl-migration.js +26 -0
- package/dist/site-context/db-init/ddl-migration.js.map +1 -0
- package/dist/site-context/db-init/init-routing-points.d.ts +5 -0
- package/dist/site-context/db-init/init-routing-points.js +149 -0
- package/dist/site-context/db-init/init-routing-points.js.map +1 -0
- package/dist/site-context/site-conf.d.ts +17 -0
- package/dist/site-context/site-conf.js +103 -0
- package/dist/site-context/site-conf.js.map +1 -0
- package/dist/site-context/site-context.d.ts +12 -0
- package/dist/site-context/site-context.js +87 -0
- package/dist/site-context/site-context.js.map +1 -0
- package/dist/site-context/site-context.types.d.ts +46 -0
- package/dist/site-context/site-context.types.js +3 -0
- package/dist/site-context/site-context.types.js.map +1 -0
- package/dist/site-context/theme-conf-reader.d.ts +4 -0
- package/dist/site-context/theme-conf-reader.js +33 -0
- package/dist/site-context/theme-conf-reader.js.map +1 -0
- package/dist/site-context/theme-conf-types.d.ts +4 -0
- package/dist/site-context/theme-conf-types.js +3 -0
- package/dist/site-context/theme-conf-types.js.map +1 -0
- package/dist/site-schema/common-schema-reader.d.ts +6 -0
- package/dist/site-schema/common-schema-reader.js +29 -0
- package/dist/site-schema/common-schema-reader.js.map +1 -0
- package/dist/site-schema/merged-schema-lib.d.ts +30 -0
- package/dist/site-schema/merged-schema-lib.js +118 -0
- package/dist/site-schema/merged-schema-lib.js.map +1 -0
- package/dist/site-schema/read-locales.d.ts +24 -0
- package/dist/site-schema/read-locales.js +171 -0
- package/dist/site-schema/read-locales.js.map +1 -0
- package/dist/site-schema/site-schema-factory.d.ts +2 -0
- package/dist/site-schema/site-schema-factory.js +385 -0
- package/dist/site-schema/site-schema-factory.js.map +1 -0
- package/dist/site-schema/site-schema-helpers.d.ts +5 -0
- package/dist/site-schema/site-schema-helpers.js +27 -0
- package/dist/site-schema/site-schema-helpers.js.map +1 -0
- package/dist/site-schema/site-schema-lib-reader.d.ts +14 -0
- package/dist/site-schema/site-schema-lib-reader.js +48 -0
- package/dist/site-schema/site-schema-lib-reader.js.map +1 -0
- package/dist/start.d.ts +1 -0
- package/dist/start.js +5 -0
- package/dist/start.js.map +1 -0
- package/dist/types.to.json +1 -0
- package/package.json +9 -8
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findParentParsedRouteWithData = exports.parsePublicRoute = void 0;
|
|
4
|
+
function parsePublicRoute(siteContext, path) {
|
|
5
|
+
const { siteSchema, multilingual } = siteContext;
|
|
6
|
+
const tokens = path
|
|
7
|
+
.split("/")
|
|
8
|
+
.slice(1)
|
|
9
|
+
.filter((token) => token.length > 0);
|
|
10
|
+
const lang = multilingual ? tokens[0] : siteSchema.defaultLang;
|
|
11
|
+
const parts = multilingual ? tokens.slice(1) : tokens;
|
|
12
|
+
if (!lang || !siteSchema.langs.includes(lang))
|
|
13
|
+
return;
|
|
14
|
+
const urlCacheKey = [];
|
|
15
|
+
if (multilingual)
|
|
16
|
+
urlCacheKey.push(lang);
|
|
17
|
+
let prev = siteSchema.documentTypes.home;
|
|
18
|
+
const routingPoints = [prev];
|
|
19
|
+
let depth = 0;
|
|
20
|
+
let i = 0;
|
|
21
|
+
for (; i < parts.length; ++i) {
|
|
22
|
+
const urlPath = parts[i];
|
|
23
|
+
const routingPoint = findRoutingPointByUrlPath({ siteSchema, parent: prev, urlPath, lang });
|
|
24
|
+
if (!routingPoint)
|
|
25
|
+
break;
|
|
26
|
+
routingPoints.push(routingPoint);
|
|
27
|
+
urlCacheKey.push(urlPath);
|
|
28
|
+
++depth;
|
|
29
|
+
prev = routingPoint;
|
|
30
|
+
}
|
|
31
|
+
const classicRelativeIds = [];
|
|
32
|
+
while (i < parts.length) {
|
|
33
|
+
const found = findClassicRelativeIdByUrlPath({
|
|
34
|
+
siteSchema,
|
|
35
|
+
parent: prev,
|
|
36
|
+
parts,
|
|
37
|
+
partsIndex: i,
|
|
38
|
+
});
|
|
39
|
+
if (!found)
|
|
40
|
+
return;
|
|
41
|
+
classicRelativeIds.push(found.classicRelativeId);
|
|
42
|
+
urlCacheKey.push(`${found.classicRelativeId.documentType.leafType}:${found.classicRelativeId.relativeId}`);
|
|
43
|
+
++depth;
|
|
44
|
+
prev = found.classicRelativeId.documentType;
|
|
45
|
+
i += found.skipUrlParts;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
lang,
|
|
49
|
+
routingPoints,
|
|
50
|
+
classicRelativeIds,
|
|
51
|
+
documentType: prev,
|
|
52
|
+
depth,
|
|
53
|
+
urlCacheKey: urlCacheKey.join("/"),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
exports.parsePublicRoute = parsePublicRoute;
|
|
57
|
+
function findRoutingPointByUrlPath({ siteSchema, parent, urlPath, lang, }) {
|
|
58
|
+
for (const leafType of parent.children ?? []) {
|
|
59
|
+
const documentType = siteSchema.documentTypes[leafType];
|
|
60
|
+
if (!documentType)
|
|
61
|
+
throw new Error(`document-type '${leafType}' should be in the schema`);
|
|
62
|
+
if (documentType.kind !== "routingPoint" || !documentType.urlPaths)
|
|
63
|
+
continue;
|
|
64
|
+
if (urlPath === documentType.urlPaths[lang])
|
|
65
|
+
return documentType;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function findClassicRelativeIdByUrlPath({ siteSchema, parent, parts, partsIndex, }) {
|
|
69
|
+
for (const leafType of parent.children ?? []) {
|
|
70
|
+
const documentType = siteSchema.documentTypes[leafType];
|
|
71
|
+
if (!documentType)
|
|
72
|
+
throw new Error(`document-type '${leafType}' should be in the schema`);
|
|
73
|
+
if (documentType.kind !== "classic")
|
|
74
|
+
continue;
|
|
75
|
+
if (documentType.route === ":relativeId-:slug") {
|
|
76
|
+
const urlPath = parts[partsIndex];
|
|
77
|
+
const relativeId = parseClassicRelativeIdSlug(urlPath);
|
|
78
|
+
return {
|
|
79
|
+
classicRelativeId: { relativeId, documentType },
|
|
80
|
+
skipUrlParts: 1,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (documentType.route === ":yyyy/:mm/:dd/:relativeId-:slug") {
|
|
84
|
+
if (parts.length < partsIndex + 3 ||
|
|
85
|
+
!isYear(parts[partsIndex]) ||
|
|
86
|
+
!isMonth(parts[partsIndex + 1]) ||
|
|
87
|
+
!isDay(parts[partsIndex + 2])) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const urlPath = parts[partsIndex + 3];
|
|
91
|
+
const relativeId = parseClassicRelativeIdSlug(urlPath);
|
|
92
|
+
return {
|
|
93
|
+
classicRelativeId: { relativeId, documentType },
|
|
94
|
+
skipUrlParts: 4,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function parseClassicRelativeIdSlug(urlPath) {
|
|
100
|
+
const index = urlPath.indexOf("-");
|
|
101
|
+
return index === -1 ? urlPath : urlPath.substring(0, index);
|
|
102
|
+
}
|
|
103
|
+
function isYear(s) {
|
|
104
|
+
return /[0-9]{4}/.test(s);
|
|
105
|
+
}
|
|
106
|
+
function isMonth(s) {
|
|
107
|
+
if (!/[0-9]{2}/.test(s))
|
|
108
|
+
return false;
|
|
109
|
+
const val = Number(s);
|
|
110
|
+
return val >= 1 && val <= 12;
|
|
111
|
+
}
|
|
112
|
+
function isDay(s) {
|
|
113
|
+
if (!/[0-9]{2}/.test(s))
|
|
114
|
+
return false;
|
|
115
|
+
const val = Number(s);
|
|
116
|
+
return val >= 1 && val <= 31;
|
|
117
|
+
}
|
|
118
|
+
function findParentParsedRouteWithData(parsedRoute) {
|
|
119
|
+
let curRoute = parsedRoute;
|
|
120
|
+
while (true) {
|
|
121
|
+
curRoute = findParentParsedRoute(curRoute);
|
|
122
|
+
if (!curRoute)
|
|
123
|
+
break;
|
|
124
|
+
if (curRoute.documentType.withData)
|
|
125
|
+
return curRoute;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.findParentParsedRouteWithData = findParentParsedRouteWithData;
|
|
129
|
+
function findParentParsedRoute(parsedRoute) {
|
|
130
|
+
const routingPoints = [...parsedRoute.routingPoints];
|
|
131
|
+
const classicRelativeIds = [...parsedRoute.classicRelativeIds];
|
|
132
|
+
const urlCacheKey = parsedRoute.urlCacheKey.split("/");
|
|
133
|
+
if (classicRelativeIds.length > 0) {
|
|
134
|
+
classicRelativeIds.pop();
|
|
135
|
+
urlCacheKey.pop();
|
|
136
|
+
}
|
|
137
|
+
else if (routingPoints.length > 0) {
|
|
138
|
+
routingPoints.pop();
|
|
139
|
+
urlCacheKey.pop();
|
|
140
|
+
}
|
|
141
|
+
if (classicRelativeIds.length === 0 && routingPoints.length === 0)
|
|
142
|
+
return;
|
|
143
|
+
const lastClassic = classicRelativeIds.length > 0 ? classicRelativeIds[classicRelativeIds.length - 1] : undefined;
|
|
144
|
+
const documentType = lastClassic?.documentType ?? routingPoints[routingPoints.length - 1];
|
|
145
|
+
return {
|
|
146
|
+
lang: parsedRoute.lang,
|
|
147
|
+
routingPoints,
|
|
148
|
+
classicRelativeIds,
|
|
149
|
+
documentType,
|
|
150
|
+
depth: parsedRoute.depth - 1,
|
|
151
|
+
urlCacheKey: urlCacheKey.join("/"),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=public-route-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-route-parser.js","sourceRoot":"","sources":["../../../../src/modules/public-site/public-route/public-route-parser.ts"],"names":[],"mappings":";;;AAsBA,SAAgB,gBAAgB,CAC9B,WAA6D,EAC7D,IAAY;IAEZ,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,WAAW,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI;SAChB,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,CAAC,CAAC;SACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,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,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvD,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,kBAAkB,CAAC,GAAG,EAAE,CAAC;QACzB,WAAW,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;SAAM,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,aAAa,CAAC,GAAG,EAAE,CAAC;QACpB,WAAW,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAE1E,MAAM,WAAW,GACf,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChG,MAAM,YAAY,GAAG,WAAW,EAAE,YAAY,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE1F,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,aAAa;QACb,kBAAkB;QAClB,YAAY;QACZ,KAAK,EAAE,WAAW,CAAC,KAAK,GAAG,CAAC;QAC5B,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PageValues } from "../../../public-payload/public-payload.types";
|
|
2
|
+
import type { SiteContext } from "../../../site-context/site-context.types";
|
|
3
|
+
import type { ParsedPublicRoute } from "./public-route-parser";
|
|
4
|
+
export interface RawPagePayload {
|
|
5
|
+
leafIdPath: string[];
|
|
6
|
+
pageValues: PageValues;
|
|
7
|
+
}
|
|
8
|
+
export declare function fetchRawPagePayload(siteContext: SiteContext, parsedRoute: ParsedPublicRoute): Promise<RawPagePayload | undefined>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchRawPagePayload = void 0;
|
|
4
|
+
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
5
|
+
const page_values_queries_1 = require("../../../public-payload/page-values.queries");
|
|
6
|
+
async function fetchRawPagePayload(siteContext, parsedRoute) {
|
|
7
|
+
const query = buildRawPagePayloadQuery(siteContext, parsedRoute);
|
|
8
|
+
const [row] = await query.getRawMany();
|
|
9
|
+
if (!row)
|
|
10
|
+
return;
|
|
11
|
+
return formatRawPagePayload(row, {
|
|
12
|
+
depth: parsedRoute.depth,
|
|
13
|
+
lang: parsedRoute.lang,
|
|
14
|
+
leafType: parsedRoute.documentType.leafType,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.fetchRawPagePayload = fetchRawPagePayload;
|
|
18
|
+
function buildRawPagePayloadQuery(siteContext, parsedRoute) {
|
|
19
|
+
const query = siteContext.mainCn.createQueryBuilder();
|
|
20
|
+
query
|
|
21
|
+
.select("cast(l0.id as varchar)", "_id0")
|
|
22
|
+
.from("PaLeaf", "l0")
|
|
23
|
+
.innerJoin("PaSection", "s0", "l0.id = s0.leafId and s0.lang = :lang", {
|
|
24
|
+
lang: parsedRoute.lang,
|
|
25
|
+
})
|
|
26
|
+
.where("l0.depth = 0")
|
|
27
|
+
.andWhere("l0.leafType = 'home'")
|
|
28
|
+
.andWhere("l0.publishDate <= current_timestamp")
|
|
29
|
+
.andWhere("s0.ready = 1");
|
|
30
|
+
let prev = 0;
|
|
31
|
+
for (const routingPoint of parsedRoute.routingPoints.slice(1)) {
|
|
32
|
+
const cur = prev + 1;
|
|
33
|
+
query
|
|
34
|
+
.addSelect(`cast(l${cur}.id as varchar)`, `_id${cur}`)
|
|
35
|
+
.innerJoin("PaLeaf", `l${cur}`, `l${prev}.id = l${cur}.parentId and l${cur}.leafType = :leafType${cur}`, {
|
|
36
|
+
[`leafType${cur}`]: routingPoint.leafType,
|
|
37
|
+
})
|
|
38
|
+
.innerJoin("PaSection", `s${cur}`, `l${cur}.id = s${cur}.leafId and s${cur}.lang = :lang`, {
|
|
39
|
+
lang: parsedRoute.lang,
|
|
40
|
+
})
|
|
41
|
+
.andWhere(`l${cur}.publishDate <= current_timestamp`)
|
|
42
|
+
.andWhere(`s${cur}.ready = 1`);
|
|
43
|
+
prev = cur;
|
|
44
|
+
}
|
|
45
|
+
for (const { documentType, relativeId } of parsedRoute.classicRelativeIds) {
|
|
46
|
+
const cur = prev + 1;
|
|
47
|
+
query
|
|
48
|
+
.addSelect(`cast(l${cur}.id as varchar)`, `_id${cur}`)
|
|
49
|
+
.innerJoin("PaLeaf", `l${cur}`, `l${prev}.id = l${cur}.parentId and l${cur}.relativeId = :relativeId${cur}`, {
|
|
50
|
+
[`relativeId${cur}`]: relativeId,
|
|
51
|
+
})
|
|
52
|
+
.innerJoin("PaSection", `s${cur}`, `l${cur}.id = s${cur}.leafId and s${cur}.lang = :lang`, {
|
|
53
|
+
lang: parsedRoute.lang,
|
|
54
|
+
})
|
|
55
|
+
.andWhere(`l${cur}.leafType = :leafType${cur}`, {
|
|
56
|
+
[`leafType${cur}`]: documentType.leafType,
|
|
57
|
+
})
|
|
58
|
+
.andWhere(`l${cur}.publishDate <= current_timestamp`)
|
|
59
|
+
.andWhere(`s${cur}.ready = 1`);
|
|
60
|
+
prev = cur;
|
|
61
|
+
}
|
|
62
|
+
query
|
|
63
|
+
.addSelect(`l${prev}.relativeId`, "relativeId")
|
|
64
|
+
.addSelect(`l${prev}.publishDate`, "publishDate");
|
|
65
|
+
if (parsedRoute.documentType.withData) {
|
|
66
|
+
query
|
|
67
|
+
.addSelect("d.title", "title")
|
|
68
|
+
.addSelect("d.slug", "slug")
|
|
69
|
+
.addSelect("d.metaDescription", "metaDescription")
|
|
70
|
+
.addSelect("d.metaKeywords", "metaKeywords")
|
|
71
|
+
.innerJoin("PaDocument", "d", `l${prev}.id = d.leafId and s${prev}.lang = d.lang`);
|
|
72
|
+
}
|
|
73
|
+
return query;
|
|
74
|
+
}
|
|
75
|
+
function formatRawPagePayload(row, { depth, lang, leafType }) {
|
|
76
|
+
const leafIdPath = [];
|
|
77
|
+
for (let i = 0; i <= depth; ++i) {
|
|
78
|
+
leafIdPath.push((0, data_formatters_lib_1.strVal)(row[`_id${i}`], { varName: `_id${i}` }));
|
|
79
|
+
}
|
|
80
|
+
const leafId = leafIdPath[depth];
|
|
81
|
+
return {
|
|
82
|
+
leafIdPath,
|
|
83
|
+
pageValues: (0, page_values_queries_1.formatPageValues)(row, { lang, leafId, leafType }),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=raw-document-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw-document-payload.js","sourceRoot":"","sources":["../../../../src/modules/public-site/public-route/raw-document-payload.ts"],"names":[],"mappings":";;;AAAA,oEAAoD;AAEpD,qFAA+E;AAUxE,KAAK,UAAU,mBAAmB,CACvC,WAAwB,EACxB,WAA8B;IAE9B,MAAM,KAAK,GAAG,wBAAwB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACjE,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC,UAAU,EAAO,CAAC;IAC5C,IAAI,CAAC,GAAG;QAAE,OAAO;IAEjB,OAAO,oBAAoB,CAAC,GAAG,EAAE;QAC/B,KAAK,EAAE,WAAW,CAAC,KAAK;QACxB,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC,QAAQ;KAC5C,CAAC,CAAC;AACL,CAAC;AAbD,kDAaC;AAED,SAAS,wBAAwB,CAAC,WAAwB,EAAE,WAA8B;IACxF,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;IACtD,KAAK;SACF,MAAM,CAAC,wBAAwB,EAAE,MAAM,CAAC;SACxC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CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;QAChC,UAAU,CAAC,IAAI,CAAC,IAAA,4BAAM,EAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IACD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAEjC,OAAO;QACL,UAAU;QACV,UAAU,EAAE,IAAA,sCAAgB,EAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Tracker } from "@paroicms/server-lib";
|
|
2
|
+
import type { Request, Response } from "express";
|
|
3
|
+
import type { SiteContext } from "../../site-context/site-context.types";
|
|
4
|
+
export declare class PublicSiteController {
|
|
5
|
+
index(req: Request, res: Response): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare function serveHomePage(siteContext: SiteContext, req: Request, res: Response, tracker: Tracker): Promise<void>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.serveHomePage = exports.PublicSiteController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const server_lib_1 = require("@paroicms/server-lib");
|
|
18
|
+
const serve_html_or_1 = require("../../common/serve-html-or");
|
|
19
|
+
const text_cache_1 = require("../../common/text-cache");
|
|
20
|
+
const tracker_report_1 = require("../../common/tracker-report");
|
|
21
|
+
const render_liquidjs_1 = require("../../liquidjs-tools/liquidjs-rendering/render-liquidjs");
|
|
22
|
+
const rendering_context_1 = require("../../liquidjs-tools/liquidjs-rendering/rendering-context");
|
|
23
|
+
const make_basic_payload_1 = require("../../public-payload/make-basic-payload");
|
|
24
|
+
const site_context_1 = require("../../site-context/site-context");
|
|
25
|
+
let PublicSiteController = class PublicSiteController {
|
|
26
|
+
async index(req, res) {
|
|
27
|
+
const siteContext = await (0, site_context_1.getSiteContext)(req.hostname);
|
|
28
|
+
const tracker = (0, server_lib_1.createTracker)();
|
|
29
|
+
await serveHomePage(siteContext, req, res, tracker);
|
|
30
|
+
siteContext.siteLog.stats((0, tracker_report_1.trackerReportToMessage)(tracker.toReport(), `serve ${req.url}`));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.PublicSiteController = PublicSiteController;
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, common_1.Get)(),
|
|
36
|
+
__param(0, (0, common_1.Req)()),
|
|
37
|
+
__param(1, (0, common_1.Res)()),
|
|
38
|
+
__metadata("design:type", Function),
|
|
39
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
40
|
+
__metadata("design:returntype", Promise)
|
|
41
|
+
], PublicSiteController.prototype, "index", null);
|
|
42
|
+
exports.PublicSiteController = PublicSiteController = __decorate([
|
|
43
|
+
(0, common_1.Controller)()
|
|
44
|
+
], PublicSiteController);
|
|
45
|
+
async function serveHomePage(siteContext, req, res, tracker) {
|
|
46
|
+
const cacheKey = (0, text_cache_1.makeCacheKey)({ kind: "html", url: req.url });
|
|
47
|
+
const serveOr = (0, serve_html_or_1.serveHtmlFromCacheOr)(siteContext, tracker, { cacheKey, req, res });
|
|
48
|
+
if (await serveOr.serveFromCache())
|
|
49
|
+
return;
|
|
50
|
+
const renderingContext = await (0, rendering_context_1.createRenderingContext)(siteContext, { cacheKey, tracker });
|
|
51
|
+
const html = await (0, render_liquidjs_1.renderLiquidTemplate)(siteContext, renderingContext, {
|
|
52
|
+
templateNames: ["index"],
|
|
53
|
+
payload: (0, make_basic_payload_1.makePublicBasicPayload)(siteContext, renderingContext),
|
|
54
|
+
});
|
|
55
|
+
await serveOr.putInCacheAndServe(html, renderingContext.getDependencyKeys());
|
|
56
|
+
}
|
|
57
|
+
exports.serveHomePage = serveHomePage;
|
|
58
|
+
//# sourceMappingURL=public-site.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-site.controller.js","sourceRoot":"","sources":["../../../src/modules/public-site/public-site.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2D;AAC3D,qDAAmE;AAEnE,8DAAkE;AAClE,wDAAuD;AACvD,gEAAqE;AACrE,6FAA+F;AAC/F,iGAAmG;AACnG,gFAAiF;AACjF,kEAAiE;AAI1D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAEzB,AAAN,KAAK,CAAC,KAAK,CAAQ,GAAY,EAAS,GAAa;QACnD,MAAM,WAAW,GAAG,MAAM,IAAA,6BAAc,EAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEvD,MAAM,OAAO,GAAG,IAAA,0BAAa,GAAE,CAAC;QAChC,MAAM,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACpD,WAAW,CA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, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PublicSiteMiddleware = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const server_lib_1 = require("@paroicms/server-lib");
|
|
12
|
+
const serve_html_or_1 = require("../../common/serve-html-or");
|
|
13
|
+
const text_cache_1 = require("../../common/text-cache");
|
|
14
|
+
const tracker_report_1 = require("../../common/tracker-report");
|
|
15
|
+
const http_helpers_1 = require("../../express/http-helpers");
|
|
16
|
+
const site_context_1 = require("../../site-context/site-context");
|
|
17
|
+
const public_route_parser_1 = require("./public-route/public-route-parser");
|
|
18
|
+
const serve_document_1 = require("./serve-document/serve-document");
|
|
19
|
+
let PublicSiteMiddleware = class PublicSiteMiddleware {
|
|
20
|
+
async use(req, res, next) {
|
|
21
|
+
if (req.url.startsWith("/auth")) {
|
|
22
|
+
next();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const siteContext = await (0, site_context_1.getSiteContext)(req.hostname);
|
|
26
|
+
const parsedRoute = (0, public_route_parser_1.parsePublicRoute)(siteContext, req.url);
|
|
27
|
+
if (!parsedRoute) {
|
|
28
|
+
next();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const tracker = (0, server_lib_1.createTracker)();
|
|
32
|
+
await serveDocument(siteContext, req, res, parsedRoute, tracker);
|
|
33
|
+
siteContext.siteLog.stats((0, tracker_report_1.trackerReportToMessage)(tracker.toReport(), `serve ${req.url}`));
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.PublicSiteMiddleware = PublicSiteMiddleware;
|
|
37
|
+
exports.PublicSiteMiddleware = PublicSiteMiddleware = __decorate([
|
|
38
|
+
(0, common_1.Injectable)()
|
|
39
|
+
], PublicSiteMiddleware);
|
|
40
|
+
async function serveDocument(siteContext, req, res, parsedRoute, tracker) {
|
|
41
|
+
const cacheKey = (0, text_cache_1.makeCacheKey)({ kind: "html", url: req.url });
|
|
42
|
+
const serveOr = (0, serve_html_or_1.serveHtmlFromCacheOr)(siteContext, tracker, { cacheKey, req, res });
|
|
43
|
+
if (await serveOr.serveFromCache())
|
|
44
|
+
return;
|
|
45
|
+
const redirectCacheKey = (0, text_cache_1.makeCacheKey)({ kind: "redirect", urlKey: parsedRoute.urlCacheKey });
|
|
46
|
+
const cacheRedirect = await siteContext.textCache.getCacheValue(redirectCacheKey, tracker);
|
|
47
|
+
if (cacheRedirect && cacheRedirect.value !== req.url) {
|
|
48
|
+
(0, http_helpers_1.serve301Redirect)(res, cacheRedirect.value);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const generated = await (0, serve_document_1.generateDocumentHtml)(siteContext, { req, parsedRoute, cacheKey }, tracker);
|
|
52
|
+
if (generated.status === 301) {
|
|
53
|
+
await siteContext.textCache.setCacheValue({
|
|
54
|
+
cacheKey: redirectCacheKey,
|
|
55
|
+
dependencyKeys: generated.dependencyKeys,
|
|
56
|
+
value: generated.url,
|
|
57
|
+
}, tracker);
|
|
58
|
+
(0, http_helpers_1.serve301Redirect)(res, generated.url);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (generated.status === 404) {
|
|
62
|
+
await (0, serve_html_or_1.render404Html)(siteContext, res, { lang: parsedRoute.lang });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
await serveOr.putInCacheAndServe(generated.html, generated.dependencyKeys);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=public-site.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-site.middleware.js","sourceRoot":"","sources":["../../../src/modules/public-site/public-site.middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAiE;AACjE,qDAAmE;AAEnE,8DAAiF;AACjF,wDAAuD;AACvD,gEAAqE;AACrE,6DAA8D;AAC9D,kEAAiE;AAEjE,4EAA8F;AAC9F,oEAAuE;AAGhE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,KAAK,CAAC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB;QACvD,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,IAAI,EAAE,CAAC;YACP,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,IAAA,6BAAc,EAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,IAAA,sCAAgB,EAAC,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,EAAE,CAAC;YACP,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,IAAA,0BAAa,GAAE,CAAC;QAChC,MAAM,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACjE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,uCAAsB,EAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC;CACF,CAAA;AAlBY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;GACA,oBAAoB,CAkBhC;AAED,KAAK,UAAU,aAAa,CAC1B,WAAwB,EACxB,GAAY,EACZ,GAAa,EACb,WAA8B,EAC9B,OAAgB;IAEhB,MA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EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,OAAO;IACT,CAAC;IAED,MAAM,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PublicSiteModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const media_serve_module_1 = require("./media-serve/media-serve.module");
|
|
12
|
+
const oauth2_client_controller_1 = require("./oauth2-client.controller");
|
|
13
|
+
const public_site_controller_1 = require("./public-site.controller");
|
|
14
|
+
const public_site_middleware_1 = require("./public-site.middleware");
|
|
15
|
+
let PublicSiteModule = class PublicSiteModule {
|
|
16
|
+
configure(consumer) {
|
|
17
|
+
consumer.apply(public_site_middleware_1.PublicSiteMiddleware).forRoutes({ path: "*", method: common_1.RequestMethod.GET });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.PublicSiteModule = PublicSiteModule;
|
|
21
|
+
exports.PublicSiteModule = PublicSiteModule = __decorate([
|
|
22
|
+
(0, common_1.Module)({
|
|
23
|
+
imports: [media_serve_module_1.MediaServeModule],
|
|
24
|
+
controllers: [public_site_controller_1.PublicSiteController, oauth2_client_controller_1.OAuth2ClientController],
|
|
25
|
+
})
|
|
26
|
+
], PublicSiteModule);
|
|
27
|
+
//# sourceMappingURL=public-site.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-site.module.js","sourceRoot":"","sources":["../../../src/modules/public-site/public-site.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAiG;AACjG,yEAAoE;AACpE,yEAAoE;AACpE,qEAAgE;AAChE,qEAAgE;AAMzD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,SAAS,CAAC,QAA4B;QACpC,QAAQ,CAAC,KAAK,CAAC,6CAAoB,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,sBAAa,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF,CAAA;AAJY,4CAAgB;2BAAhB,gBAAgB;IAJ5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qCAAgB,CAAC;QAC3B,WAAW,EAAE,CAAC,6CAAoB,EAAE,iDAAsB,CAAC;KAC5D,CAAC;GACW,gBAAgB,CAI5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Tracker } from "@paroicms/server-lib";
|
|
2
|
+
import type { Request } from "express";
|
|
3
|
+
import type { SiteContext } from "../../../site-context/site-context.types";
|
|
4
|
+
import { type ParsedPublicRoute } from "../public-route/public-route-parser";
|
|
5
|
+
export type GeneratedDocumentHtml = {
|
|
6
|
+
status: 200;
|
|
7
|
+
html: string;
|
|
8
|
+
dependencyKeys: string[];
|
|
9
|
+
} | {
|
|
10
|
+
status: 404;
|
|
11
|
+
} | {
|
|
12
|
+
status: 301;
|
|
13
|
+
url: string;
|
|
14
|
+
dependencyKeys: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function generateDocumentHtml(siteContext: SiteContext, options: {
|
|
17
|
+
req: Request;
|
|
18
|
+
parsedRoute: ParsedPublicRoute;
|
|
19
|
+
cacheKey: string;
|
|
20
|
+
}, tracker: Tracker): Promise<GeneratedDocumentHtml>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateDocumentHtml = void 0;
|
|
4
|
+
const text_cache_1 = require("../../../common/text-cache");
|
|
5
|
+
const render_liquidjs_1 = require("../../../liquidjs-tools/liquidjs-rendering/render-liquidjs");
|
|
6
|
+
const rendering_context_1 = require("../../../liquidjs-tools/liquidjs-rendering/rendering-context");
|
|
7
|
+
const create_page_drop_1 = require("../../../public-payload/create-page-drop");
|
|
8
|
+
const site_payload_1 = require("../../../public-payload/site-payload");
|
|
9
|
+
const make_url_1 = require("../public-route/make-url");
|
|
10
|
+
const public_route_parser_1 = require("../public-route/public-route-parser");
|
|
11
|
+
const raw_document_payload_1 = require("../public-route/raw-document-payload");
|
|
12
|
+
async function generateDocumentHtml(siteContext, options, tracker) {
|
|
13
|
+
const { req, parsedRoute, cacheKey } = options;
|
|
14
|
+
if (!parsedRoute.documentType.withData) {
|
|
15
|
+
const parentRoute = (0, public_route_parser_1.findParentParsedRouteWithData)(parsedRoute);
|
|
16
|
+
const rawPayload = parentRoute
|
|
17
|
+
? await (0, raw_document_payload_1.fetchRawPagePayload)(siteContext, parentRoute)
|
|
18
|
+
: undefined;
|
|
19
|
+
if (rawPayload && parentRoute) {
|
|
20
|
+
const { url, dependencyKeys } = await (0, make_url_1.getUrlOfDocument)(siteContext, tracker, {
|
|
21
|
+
lang: parentRoute.lang,
|
|
22
|
+
leafId: rawPayload.pageValues.leafId,
|
|
23
|
+
}, { returnUrlDependencyKeys: true });
|
|
24
|
+
return { status: 301, url, dependencyKeys };
|
|
25
|
+
}
|
|
26
|
+
return { status: 404 };
|
|
27
|
+
}
|
|
28
|
+
const rawPayload = await (0, raw_document_payload_1.fetchRawPagePayload)(siteContext, parsedRoute);
|
|
29
|
+
if (!rawPayload)
|
|
30
|
+
return { status: 404 };
|
|
31
|
+
const { url: docUrl, dependencyKeys: urlDependencyKeys } = await (0, make_url_1.getUrlOfDocument)(siteContext, tracker, {
|
|
32
|
+
lang: parsedRoute.lang,
|
|
33
|
+
leafId: rawPayload.pageValues.leafId,
|
|
34
|
+
}, { returnUrlDependencyKeys: true });
|
|
35
|
+
if (docUrl !== req.url) {
|
|
36
|
+
return { status: 301, url: docUrl, dependencyKeys: urlDependencyKeys };
|
|
37
|
+
}
|
|
38
|
+
const renderingContext = await (0, rendering_context_1.createRenderingContext)(siteContext, {
|
|
39
|
+
cacheKey,
|
|
40
|
+
tracker,
|
|
41
|
+
dependencyKey: (0, text_cache_1.makeCacheDependencyKey)({ documentId: rawPayload.pageValues }),
|
|
42
|
+
});
|
|
43
|
+
const html = await (0, render_liquidjs_1.renderLiquidTemplate)(siteContext, renderingContext, {
|
|
44
|
+
templateNames: parsedRoute.documentType.templateNames,
|
|
45
|
+
payload: makeRegularPublicPayload(siteContext, renderingContext, rawPayload, docUrl),
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
status: 200,
|
|
49
|
+
html,
|
|
50
|
+
dependencyKeys: renderingContext.getDependencyKeys(),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.generateDocumentHtml = generateDocumentHtml;
|
|
54
|
+
function makeRegularPublicPayload(siteContext, renderingContext, rawPayload, url) {
|
|
55
|
+
return {
|
|
56
|
+
site: (0, site_payload_1.makeSitePayload)(siteContext, renderingContext, rawPayload.pageValues.lang),
|
|
57
|
+
page: (0, create_page_drop_1.createPagePayloadDrop)(siteContext, renderingContext, rawPayload.pageValues, { url }),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=serve-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-document.js","sourceRoot":"","sources":["../../../../src/modules/public-site/serve-document/serve-document.ts"],"names":[],"mappings":";;;AAEA,2DA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value: true });
|
|
3
|
+
exports.AppThrottlerGuard = void 0;
|
|
4
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
5
|
+
const throttler_1 = require("@nestjs/throttler");
|
|
6
|
+
class AppThrottlerGuard extends throttler_1.ThrottlerGuard {
|
|
7
|
+
getRequestResponse(context) {
|
|
8
|
+
const reqType = context.getType();
|
|
9
|
+
if (reqType === "graphql") {
|
|
10
|
+
const gqlCtx = graphql_1.GqlExecutionContext.create(context);
|
|
11
|
+
const ctx = gqlCtx.getContext();
|
|
12
|
+
return { req: ctx.req, res: ctx.req.res };
|
|
13
|
+
}
|
|
14
|
+
return super.getRequestResponse(context);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.AppThrottlerGuard = AppThrottlerGuard;
|
|
18
|
+
//# sourceMappingURL=app-throttler-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-throttler-guard.js","sourceRoot":"","sources":["../../../src/modules/security/app-throttler-guard.ts"],"names":[],"mappings":";;;AACA,6CAAsD;AACtD,iDAAmD;AAEnD,MAAa,iBAAkB,SAAQ,0BAAc;IACnD,kBAAkB,CAAC,OAAyB;QAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,EAA2B,CAAC;QAC3D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,6BAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YAChC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QAC5C,CAAC;QACD,OAAO,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF;AAVD,8CAUC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ApolloServerPlugin, GraphQLRequestListener } from "@apollo/server";
|
|
2
|
+
import type { GraphQLSchemaHost } from "@nestjs/graphql";
|
|
3
|
+
import type { GraphqlContext } from "../graphql.types";
|
|
4
|
+
export declare class ComplexityPlugin implements ApolloServerPlugin {
|
|
5
|
+
private gqlSchemaHost;
|
|
6
|
+
constructor(gqlSchemaHost: GraphQLSchemaHost);
|
|
7
|
+
requestDidStart(): Promise<GraphQLRequestListener<GraphqlContext>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ComplexityPlugin = void 0;
|
|
13
|
+
const apollo_1 = require("@nestjs/apollo");
|
|
14
|
+
const graphql_1 = require("graphql");
|
|
15
|
+
const graphql_query_complexity_1 = require("graphql-query-complexity");
|
|
16
|
+
let ComplexityPlugin = class ComplexityPlugin {
|
|
17
|
+
gqlSchemaHost;
|
|
18
|
+
constructor(gqlSchemaHost) {
|
|
19
|
+
this.gqlSchemaHost = gqlSchemaHost;
|
|
20
|
+
}
|
|
21
|
+
async requestDidStart() {
|
|
22
|
+
const maxComplexity = 100;
|
|
23
|
+
const { schema } = this.gqlSchemaHost;
|
|
24
|
+
return {
|
|
25
|
+
async didResolveOperation({ request, document }) {
|
|
26
|
+
const complexity = (0, graphql_query_complexity_1.getComplexity)({
|
|
27
|
+
schema,
|
|
28
|
+
operationName: request.operationName,
|
|
29
|
+
query: document,
|
|
30
|
+
variables: request.variables,
|
|
31
|
+
estimators: [(0, graphql_query_complexity_1.fieldExtensionsEstimator)(), (0, graphql_query_complexity_1.simpleEstimator)({ defaultComplexity: 2 })],
|
|
32
|
+
});
|
|
33
|
+
if (complexity > maxComplexity) {
|
|
34
|
+
throw new graphql_1.GraphQLError(`Query is too complex: ${complexity}. Maximum allowed complexity: ${maxComplexity}`);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.ComplexityPlugin = ComplexityPlugin;
|
|
41
|
+
exports.ComplexityPlugin = ComplexityPlugin = __decorate([
|
|
42
|
+
(0, apollo_1.Plugin)(),
|
|
43
|
+
__metadata("design:paramtypes", [Function])
|
|
44
|
+
], ComplexityPlugin);
|
|
45
|
+
//# sourceMappingURL=complexity-plugin.js.map
|