@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,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeDefaultRelativeId = void 0;
|
|
4
|
+
function makeDefaultRelativeId({ smallAlphabet = "023456789", bigAlphabet = "023456789abcdefghijkmnopqrstuvwxyz", size = 3, } = {}) {
|
|
5
|
+
const flags = Array(size);
|
|
6
|
+
const maxFlagIndex = size - 1;
|
|
7
|
+
while (true) {
|
|
8
|
+
const remaining = [];
|
|
9
|
+
for (let i = 0; i < size; ++i) {
|
|
10
|
+
if (flags[i] === undefined) {
|
|
11
|
+
remaining.push(i);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (remaining.length === 0)
|
|
15
|
+
break;
|
|
16
|
+
const remainingIndex = randomInt(0, remaining.length);
|
|
17
|
+
const flagIndex = remaining[remainingIndex];
|
|
18
|
+
flags[flagIndex] = "b";
|
|
19
|
+
if (flagIndex > 0)
|
|
20
|
+
flags[flagIndex - 1] = "s";
|
|
21
|
+
if (flagIndex < maxFlagIndex)
|
|
22
|
+
flags[flagIndex + 1] = "s";
|
|
23
|
+
}
|
|
24
|
+
const result = [];
|
|
25
|
+
for (let i = 0; i < size; ++i) {
|
|
26
|
+
result.push(randomCharacterOf(flags[i] === "b" ? bigAlphabet : smallAlphabet));
|
|
27
|
+
}
|
|
28
|
+
return result.join("");
|
|
29
|
+
}
|
|
30
|
+
exports.makeDefaultRelativeId = makeDefaultRelativeId;
|
|
31
|
+
function randomCharacterOf(alphabet) {
|
|
32
|
+
return alphabet[Math.floor(Math.random() * alphabet.length)];
|
|
33
|
+
}
|
|
34
|
+
function randomInt(min, max) {
|
|
35
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=relative-id-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-id-helper.js","sourceRoot":"","sources":["../../src/helpers/relative-id-helper.ts"],"names":[],"mappings":";;;AAMA,SAAgB,qBAAqB,CAAC,EACpC,aAAa,GAAG,WAAW,EAC3B,WAAW,GAAG,oCAAoC,EAClD,IAAI,GAAG,CAAC,GACT,GAAG,EAAE;IACJ,MAAM,KAAK,GAA8B,KAAK,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC;IAE9B,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;YAC9B,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC3B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM;QAClC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,SAAS,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5C,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;QACvB,IAAI,SAAS,GAAG,CAAC;YAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;QAC9C,IAAI,SAAS,GAAG,YAAY;YAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC3D,CAAC;IAED,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AA5BD,sDA4BC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/D,CAAC;AAKD,SAAS,SAAS,CAAC,GAAW,EAAE,GAAW;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AppLog } from "@paroicms/server-lib";
|
|
2
|
+
export interface SimpleTranslator {
|
|
3
|
+
translate: (options: SimpleTranslateOptions) => string;
|
|
4
|
+
}
|
|
5
|
+
export interface SimpleTranslateOptions {
|
|
6
|
+
lang: string;
|
|
7
|
+
key: string;
|
|
8
|
+
args?: (string | number)[];
|
|
9
|
+
}
|
|
10
|
+
export declare function createSimpleTranslator(options: {
|
|
11
|
+
l10nDir: string;
|
|
12
|
+
langs: string[];
|
|
13
|
+
appLog: Pick<AppLog, "warn">;
|
|
14
|
+
}): Promise<SimpleTranslator>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSimpleTranslator = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
7
|
+
async function createSimpleTranslator(options) {
|
|
8
|
+
const labels = await loadLabels(options);
|
|
9
|
+
return {
|
|
10
|
+
translate: (options) => translate(labels, options),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.createSimpleTranslator = createSimpleTranslator;
|
|
14
|
+
function translate(labels, { args = [], key, lang }) {
|
|
15
|
+
let label = labels.get(lang)?.[key] ?? key;
|
|
16
|
+
const variables = findVariablesInString(label, args.length);
|
|
17
|
+
variables.reverse();
|
|
18
|
+
for (const { indexInString, variableName, variableNumber } of variables) {
|
|
19
|
+
const value = args[variableNumber - 1];
|
|
20
|
+
const before = label.substring(0, indexInString);
|
|
21
|
+
const after = label.substring(indexInString + variableName.length);
|
|
22
|
+
label = `${before}${value}${after}`;
|
|
23
|
+
}
|
|
24
|
+
return label;
|
|
25
|
+
}
|
|
26
|
+
function findVariablesInString(str, max) {
|
|
27
|
+
const matches = [];
|
|
28
|
+
const regex = /\$[0-9]+/g;
|
|
29
|
+
let match;
|
|
30
|
+
while (true) {
|
|
31
|
+
match = regex.exec(str);
|
|
32
|
+
if (!match)
|
|
33
|
+
break;
|
|
34
|
+
const [variableName] = match;
|
|
35
|
+
const variableNumber = (0, data_formatters_lib_1.nbVal)(variableName.substring(1), { varName: variableName });
|
|
36
|
+
if (variableNumber <= max) {
|
|
37
|
+
matches.push({
|
|
38
|
+
variableName,
|
|
39
|
+
variableNumber,
|
|
40
|
+
indexInString: match.index,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return matches;
|
|
45
|
+
}
|
|
46
|
+
async function loadLabels({ l10nDir, langs, appLog, }) {
|
|
47
|
+
const labels = new Map();
|
|
48
|
+
for (const lang of langs) {
|
|
49
|
+
let content;
|
|
50
|
+
try {
|
|
51
|
+
content = await (0, promises_1.readFile)((0, node_path_1.join)(l10nDir, `${lang}.json`), "utf-8");
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
labels.set(lang, flattenLocales(JSON.parse(content)));
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
appLog.warn(`invalid locale file '${(0, node_path_1.join)(l10nDir, `${lang}.json`)}'`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return labels;
|
|
64
|
+
}
|
|
65
|
+
function flattenLocales(source, prefix = "") {
|
|
66
|
+
const result = {};
|
|
67
|
+
for (const [key, val] of Object.entries(source)) {
|
|
68
|
+
if (val === null)
|
|
69
|
+
throw new Error(`invalid null value for '${key}'`);
|
|
70
|
+
if (typeof val === "string") {
|
|
71
|
+
result[`${prefix}${key}`] = val;
|
|
72
|
+
}
|
|
73
|
+
else if (typeof val === "object") {
|
|
74
|
+
Object.assign(result, flattenLocales(val, `${prefix}${key}.`));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new Error(`invalid value for '${key}'`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=simple-i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-i18n.js","sourceRoot":"","sources":["../../src/helpers/simple-i18n.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAC5C,yCAAiC;AACjC,oEAAmD;AAa5C,KAAK,UAAU,sBAAsB,CAAC,OAI5C;IACC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO;QACL,SAAS,EAAE,CAAC,OAA+B,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;KAC3E,CAAC;AACJ,CAAC;AATD,wDASC;AAED,SAAS,SAAS,CAChB,MAA4C,EAC5C,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAA0B;IAEhD,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;IAC3C,MAAM,SAAS,GAAG,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5D,SAAS,CAAC,OAAO,EAAE,CAAC;IACpB,KAAK,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,SAAS,EAAE,CAAC;QACxE,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACnE,KAAK,GAAG,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAiBD,SAAS,qBAAqB,CAAC,GAAW,EAAE,GAAW;IACrD,MAAM,OAAO,GAAuB,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,IAAI,KAA6B,CAAC;IAClC,OAAO,IAAI,EAAE,CAAC;QACZ,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK;YAAE,MAAM;QAClB,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;QAC7B,MAAM,cAAc,GAAG,IAAA,2BAAK,EAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QACnF,IAAI,cAAc,IAAI,GAAG,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC;gBACX,YAAY;gBACZ,cAAc;gBACd,aAAa,EAAE,KAAK,CAAC,KAAK;aAC3B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,EACxB,OAAO,EACP,KAAK,EACL,MAAM,GAKP;IACC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC1D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,CAAC;YACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,wBAAwB,IAAA,gBAAI,EAAC,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,MAAc,EAAE,MAAM,GAAG,EAAE;IACjD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,IAAI,GAAG,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,GAAG,CAAC,CAAC;QACrE,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC;QAClC,CAAC;aAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,GAAG,GAAG,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AccountModel } from "../modules/core/account/account.model";
|
|
2
|
+
export declare const devAccountId = "dev:0";
|
|
3
|
+
export declare function isDevAccountId(id: string): boolean;
|
|
4
|
+
export interface ParsedPlatformAdminAccountId {
|
|
5
|
+
index: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function parsePlatformAdminAccountId(id: string): ParsedPlatformAdminAccountId | undefined;
|
|
8
|
+
export declare function getDevAccount(id: string): AccountModel;
|
|
9
|
+
export declare function getPlatformAdminAccount({ index }: ParsedPlatformAdminAccountId): AccountModel;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPlatformAdminAccount = exports.getDevAccount = exports.parsePlatformAdminAccountId = exports.isDevAccountId = exports.devAccountId = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
exports.devAccountId = "dev:0";
|
|
7
|
+
function isDevAccountId(id) {
|
|
8
|
+
return id === exports.devAccountId;
|
|
9
|
+
}
|
|
10
|
+
exports.isDevAccountId = isDevAccountId;
|
|
11
|
+
function parsePlatformAdminAccountId(id) {
|
|
12
|
+
if (!id.startsWith("pladm:"))
|
|
13
|
+
return;
|
|
14
|
+
return { index: Number(id.substring(6)) };
|
|
15
|
+
}
|
|
16
|
+
exports.parsePlatformAdminAccountId = parsePlatformAdminAccountId;
|
|
17
|
+
function getDevAccount(id) {
|
|
18
|
+
const devAccount = context_1.appConf.devAccount;
|
|
19
|
+
if (!devAccount || exports.devAccountId !== id) {
|
|
20
|
+
throw new common_1.NotFoundException();
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
email: devAccount.email,
|
|
24
|
+
id: exports.devAccountId,
|
|
25
|
+
name: devAccount.name,
|
|
26
|
+
special: "dev",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.getDevAccount = getDevAccount;
|
|
30
|
+
function getPlatformAdminAccount({ index }) {
|
|
31
|
+
const account = context_1.appConf.platformAdminAccounts?.[index];
|
|
32
|
+
if (!account) {
|
|
33
|
+
throw new common_1.NotFoundException();
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
id: `pladm:${index}`,
|
|
37
|
+
email: account.email,
|
|
38
|
+
name: account.name,
|
|
39
|
+
special: "platformAdmin",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.getPlatformAdminAccount = getPlatformAdminAccount;
|
|
43
|
+
//# sourceMappingURL=special-account.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"special-account.helpers.js","sourceRoot":"","sources":["../../src/helpers/special-account.helpers.ts"],"names":[],"mappings":";;;AAAA,2CAAmD;AACnD,wCAAqC;AAGxB,QAAA,YAAY,GAAG,OAAO,CAAC;AAEpC,SAAgB,cAAc,CAAC,EAAU;IACvC,OAAO,EAAE,KAAK,oBAAY,CAAC;AAC7B,CAAC;AAFD,wCAEC;AAMD,SAAgB,2BAA2B,CAAC,EAAU;IACpD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO;IACrC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5C,CAAC;AAHD,kEAGC;AAED,SAAgB,aAAa,CAAC,EAAU;IACtC,MAAM,UAAU,GAAG,iBAAO,CAAC,UAAU,CAAC;IACtC,IAAI,CAAC,UAAU,IAAI,oBAAY,KAAK,EAAE,EAAE,CAAC;QACvC,MAAM,IAAI,0BAAiB,EAAE,CAAC;IAChC,CAAC;IAED,OAAO;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,EAAE,EAAE,oBAAY;QAChB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC;AAZD,sCAYC;AAED,SAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAgC;IAC7E,MAAM,OAAO,GAAG,iBAAO,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC,CAAC;IACvD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,0BAAiB,EAAE,CAAC;IAChC,CAAC;IAED,OAAO;QACL,EAAE,EAAE,SAAS,KAAK,EAAE;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,eAAe;KACzB,CAAC;AACJ,CAAC;AAZD,0DAYC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBoUrl = void 0;
|
|
4
|
+
const context_1 = require("../context");
|
|
5
|
+
function getBoUrl(siteConf, path) {
|
|
6
|
+
const { boPublicPort, https } = context_1.appConf.thisServer;
|
|
7
|
+
const { fqdn } = siteConf;
|
|
8
|
+
const protocol = https ? "https" : "http";
|
|
9
|
+
return `${protocol}://${fqdn}${boPublicPort ? `:${boPublicPort}` : ""}${path ?? ""}`;
|
|
10
|
+
}
|
|
11
|
+
exports.getBoUrl = getBoUrl;
|
|
12
|
+
//# sourceMappingURL=url.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.helpers.js","sourceRoot":"","sources":["../../src/helpers/url.helpers.ts"],"names":[],"mappings":";;;AAAA,wCAAqC;AAGrC,SAAgB,QAAQ,CAAC,QAAkB,EAAE,IAAa;IACxD,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,iBAAO,CAAC,UAAU,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,GAAG,QAAQ,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC;AACvF,CAAC;AALD,4BAKC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function toHttpHeaderIfModifiedSince(time: unknown): string;
|
|
2
|
+
export declare function mediaTypeToFileExtension(mediaType: string): string;
|
|
3
|
+
export declare function pascalCaseToDashed(s: string): string;
|
|
4
|
+
export declare function toLeafId(leafOrSectionId: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toLeafId = exports.pascalCaseToDashed = exports.mediaTypeToFileExtension = exports.toHttpHeaderIfModifiedSince = void 0;
|
|
4
|
+
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
5
|
+
const anywhere_lib_1 = require("@paroicms/anywhere-lib");
|
|
6
|
+
function toHttpHeaderIfModifiedSince(time) {
|
|
7
|
+
return (0, data_formatters_lib_1.dateVal)(time).toUTCString();
|
|
8
|
+
}
|
|
9
|
+
exports.toHttpHeaderIfModifiedSince = toHttpHeaderIfModifiedSince;
|
|
10
|
+
function mediaTypeToFileExtension(mediaType) {
|
|
11
|
+
const regexMatchArray = mediaType.match(/\w+\/([-+.\w]+)/);
|
|
12
|
+
if (!regexMatchArray) {
|
|
13
|
+
throw new Error("media extension is incorrect.");
|
|
14
|
+
}
|
|
15
|
+
return regexMatchArray[1];
|
|
16
|
+
}
|
|
17
|
+
exports.mediaTypeToFileExtension = mediaTypeToFileExtension;
|
|
18
|
+
function pascalCaseToDashed(s) {
|
|
19
|
+
return s
|
|
20
|
+
.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)
|
|
21
|
+
.replace(/^-+/, "")
|
|
22
|
+
.replace(/-+$/, "")
|
|
23
|
+
.replace(/--+/g, "-");
|
|
24
|
+
}
|
|
25
|
+
exports.pascalCaseToDashed = pascalCaseToDashed;
|
|
26
|
+
function toLeafId(leafOrSectionId) {
|
|
27
|
+
return leafOrSectionId.indexOf(":") !== -1
|
|
28
|
+
? (0, anywhere_lib_1.parseSectionId)(leafOrSectionId).leafId
|
|
29
|
+
: leafOrSectionId;
|
|
30
|
+
}
|
|
31
|
+
exports.toLeafId = toLeafId;
|
|
32
|
+
//# sourceMappingURL=utils-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-helper.js","sourceRoot":"","sources":["../../src/helpers/utils-helper.ts"],"names":[],"mappings":";;;AAAA,oEAAqD;AACrD,yDAAwD;AAExD,SAAgB,2BAA2B,CAAC,IAAa;IACvD,OAAO,IAAA,6BAAO,EAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AACrC,CAAC;AAFD,kEAEC;AAED,SAAgB,wBAAwB,CAAC,SAAiB;IACxD,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE3D,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AARD,4DAQC;AAED,SAAgB,kBAAkB,CAAC,CAAS;IAC1C,OAAO,CAAC;SACL,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;SAC/C,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAND,gDAMC;AAED,SAAgB,QAAQ,CAAC,eAAuB;IAC9C,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC,CAAC,IAAA,6BAAc,EAAC,eAAe,CAAC,CAAC,MAAM;QACxC,CAAC,CAAC,eAAe,CAAC;AACtB,CAAC;AAJD,4BAIC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.start = void 0;
|
|
7
|
+
const core_1 = require("@nestjs/core");
|
|
8
|
+
const platform_express_1 = require("@nestjs/platform-express");
|
|
9
|
+
const server_image_cache_engine_1 = require("@paroicms/server-image-cache-engine");
|
|
10
|
+
const server_lib_1 = require("@paroicms/server-lib");
|
|
11
|
+
const express_1 = __importDefault(require("express"));
|
|
12
|
+
const context_1 = require("./context");
|
|
13
|
+
const static_middlewares_1 = require("./express/static-middlewares");
|
|
14
|
+
const configuration_helpers_1 = require("./helpers/configuration.helpers");
|
|
15
|
+
const maintenance_task_1 = require("./maintenance/maintenance-task");
|
|
16
|
+
const shutdown_1 = require("./maintenance/shutdown");
|
|
17
|
+
const app_module_1 = require("./modules/app.module");
|
|
18
|
+
const nest_custom_logger_1 = require("./nest-custom-logger");
|
|
19
|
+
const site_conf_1 = require("./site-context/site-conf");
|
|
20
|
+
const site_context_1 = require("./site-context/site-context");
|
|
21
|
+
const site_schema_lib_reader_1 = require("./site-schema/site-schema-lib-reader");
|
|
22
|
+
async function start(options = {}) {
|
|
23
|
+
try {
|
|
24
|
+
await context_1.platformLog.untilReady;
|
|
25
|
+
(0, site_context_1.watchForIdleSiteContexts)();
|
|
26
|
+
(0, server_image_cache_engine_1.setupImageProcessor)({ ...context_1.appConf.imageProcessor, appLog: context_1.platformLog });
|
|
27
|
+
const siteConfs = (0, configuration_helpers_1.isMultiSiteConfiguration)(context_1.appConf)
|
|
28
|
+
? await (0, site_conf_1.loadSitePackConfs)(context_1.appConf.sitePacks, options.sitePackPlaces)
|
|
29
|
+
: await (0, site_conf_1.createSiteConfsFromSingle)(context_1.appConf.singleSite);
|
|
30
|
+
await (0, context_1.initializeContext)(siteConfs);
|
|
31
|
+
(0, context_1.initSiteSchemaLib)(await (0, site_schema_lib_reader_1.readSiteSchemaLibraries)());
|
|
32
|
+
const stopCron = (0, server_lib_1.startCronLike)(maintenance_task_1.maintenanceTask, {
|
|
33
|
+
shouldExecute: (0, server_lib_1.eachDay)({ hours: 2 }),
|
|
34
|
+
appLog: context_1.platformLog,
|
|
35
|
+
});
|
|
36
|
+
const expressApp = (0, express_1.default)();
|
|
37
|
+
const app = await core_1.NestFactory.create(app_module_1.AppModule, new platform_express_1.ExpressAdapter(expressApp), {
|
|
38
|
+
logger: new nest_custom_logger_1.NestCustomLogger(),
|
|
39
|
+
});
|
|
40
|
+
app.enableCors({ credentials: true, origin: "*" });
|
|
41
|
+
app.use(static_middlewares_1.boMiddleware);
|
|
42
|
+
app.use(static_middlewares_1.themeAssetsMiddleware);
|
|
43
|
+
if (context_1.appConf.thisServer.hostName) {
|
|
44
|
+
await app.listen(context_1.appConf.thisServer.port, context_1.appConf.thisServer.hostName);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
await app.listen(context_1.appConf.thisServer.port);
|
|
48
|
+
}
|
|
49
|
+
(0, shutdown_1.handleShutdownEvents)({
|
|
50
|
+
appLog: context_1.platformLog,
|
|
51
|
+
onCloseCb: async () => {
|
|
52
|
+
await Promise.all([stopCron(), (0, maintenance_task_1.unloadAllActiveSites)(), app.close()]);
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
context_1.platformLog.info(`paroi-web-platform is up and running on port '${context_1.appConf.thisServer.port}', it serves:${getListOfSiteUrls()
|
|
56
|
+
.map((url) => `\n- ${url}`)
|
|
57
|
+
.join("")}`);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
context_1.platformLog.error(error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.start = start;
|
|
64
|
+
function getListOfSiteUrls() {
|
|
65
|
+
return Array.from(context_1.siteConfs.values())
|
|
66
|
+
.map((siteConf) => siteConf.siteUrl)
|
|
67
|
+
.sort();
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ParsedSectionId } from "@paroicms/anywhere-lib";
|
|
2
|
+
import { Drop } from "liquidjs";
|
|
3
|
+
import type { SiteContext } from "../site-context/site-context.types";
|
|
4
|
+
import type { RenderingContext } from "./liquidjs-rendering/rendering-context";
|
|
5
|
+
export declare const valuesSymbol: unique symbol;
|
|
6
|
+
export type DropValues<T> = {
|
|
7
|
+
[name in keyof T]: DropOrLiquidValue;
|
|
8
|
+
};
|
|
9
|
+
export type DropOrLiquidValue = DropInst<any> | LiquidValue | (() => Promise<DropOrLiquidValue> | DropOrLiquidValue);
|
|
10
|
+
export type LiquidValue = PrimitiveLiquidValue | object | DropOrLiquidValue[];
|
|
11
|
+
export type PrimitiveLiquidValue = string | number | boolean | undefined;
|
|
12
|
+
export type DropInst<T> = Drop & {
|
|
13
|
+
[valuesSymbol]: DropValues<T>;
|
|
14
|
+
};
|
|
15
|
+
export type CacheKeyOptions = DocumentCacheKeyOptions | SiteCacheKeyOptions;
|
|
16
|
+
export interface DocumentCacheKeyOptions {
|
|
17
|
+
documentId: ParsedSectionId;
|
|
18
|
+
keySuffix?: string;
|
|
19
|
+
keyPrefix?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SiteCacheKeyOptions {
|
|
22
|
+
lang: string;
|
|
23
|
+
keyPrefix?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function createLiquidJsDrop<T>({ renderingContext, cacheKeyOptions, values, }: {
|
|
26
|
+
renderingContext: RenderingContext;
|
|
27
|
+
cacheKeyOptions: CacheKeyOptions;
|
|
28
|
+
values: DropValues<T>;
|
|
29
|
+
}, { siteLog }: Pick<SiteContext, "siteLog">): DropInst<T>;
|
|
30
|
+
export declare function loadOrFromRenderingCache<T>(renderingContext: RenderingContext, cacheKey: string, load: () => T): Promise<T>;
|
|
31
|
+
export declare function makeDropCacheKeyForRendering(propName: string, cacheKeyOptions: CacheKeyOptions): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeDropCacheKeyForRendering = exports.loadOrFromRenderingCache = exports.createLiquidJsDrop = exports.valuesSymbol = void 0;
|
|
4
|
+
const liquidjs_1 = require("liquidjs");
|
|
5
|
+
exports.valuesSymbol = Symbol("values");
|
|
6
|
+
function createLiquidJsDrop({ renderingContext, cacheKeyOptions, values, }, { siteLog }) {
|
|
7
|
+
const drop = Object.create(liquidjs_1.Drop.prototype);
|
|
8
|
+
drop.liquidMethodMissing = async (name) => {
|
|
9
|
+
const val = values[name];
|
|
10
|
+
if (typeof val !== "function")
|
|
11
|
+
return val;
|
|
12
|
+
try {
|
|
13
|
+
return await loadOrFromRenderingCache(renderingContext, makeDropCacheKeyForRendering(name, cacheKeyOptions), val);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
siteLog.error(`Error when generating '${name}':`, error);
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
drop[exports.valuesSymbol] = values;
|
|
21
|
+
return drop;
|
|
22
|
+
}
|
|
23
|
+
exports.createLiquidJsDrop = createLiquidJsDrop;
|
|
24
|
+
async function loadOrFromRenderingCache(renderingContext, cacheKey, load) {
|
|
25
|
+
const cacheVal = renderingContext.getValueFromCache(cacheKey);
|
|
26
|
+
if (cacheVal.found)
|
|
27
|
+
return cacheVal.val;
|
|
28
|
+
const result = await load();
|
|
29
|
+
renderingContext.setValueIntoCache(cacheKey, result);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
exports.loadOrFromRenderingCache = loadOrFromRenderingCache;
|
|
33
|
+
function makeDropCacheKeyForRendering(propName, cacheKeyOptions) {
|
|
34
|
+
if ("documentId" in cacheKeyOptions) {
|
|
35
|
+
const { documentId, keySuffix, keyPrefix } = cacheKeyOptions;
|
|
36
|
+
return `drop:${documentId.lang}:${documentId.leafId}${keyPrefix ? `:${keyPrefix}` : ""}:${propName}${keySuffix ? `:${keySuffix}` : ""}`;
|
|
37
|
+
}
|
|
38
|
+
return makeSiteFieldDropCacheKeyForRendering(propName, cacheKeyOptions);
|
|
39
|
+
}
|
|
40
|
+
exports.makeDropCacheKeyForRendering = makeDropCacheKeyForRendering;
|
|
41
|
+
function makeSiteFieldDropCacheKeyForRendering(fieldName, cacheKeyOptions) {
|
|
42
|
+
const { lang, keyPrefix } = cacheKeyOptions;
|
|
43
|
+
return `drop${keyPrefix ? `:${keyPrefix}` : ""}:${lang}:${fieldName}`;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=liquidjs-drop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidjs-drop.js","sourceRoot":"","sources":["../../src/liquidjs-tools/liquidjs-drop.ts"],"names":[],"mappings":";;;AACA,uCAAgC;AAInB,QAAA,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAgC7C,SAAgB,kBAAkB,CAChC,EACE,gBAAgB,EAChB,eAAe,EACf,MAAM,GAKP,EACD,EAAE,OAAO,EAAgC;IAEzC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,eAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,CAAC,mBAAmB,GAAG,KAAK,EAAE,IAAY,EAAgB,EAAE;QAC9D,MAAM,GAAG,GAAI,MAAc,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,OAAO,GAAG,KAAK,UAAU;YAAE,OAAO,GAAG,CAAC;QAC1C,IAAI,CAAC;YACH,OAAO,MAAM,wBAAwB,CACnC,gBAAgB,EAChB,4BAA4B,CAAC,IAAI,EAAE,eAAe,CAAC,EACnD,GAAG,CACJ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,IAAI,IAAI,EAAE,KAAK,CAAC,CAAC;YACzD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,oBAAY,CAAC,GAAG,MAAM,CAAC;IAC5B,OAAO,IAAI,CAAC;AAed,CAAC;AA3CD,gDA2CC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,gBAAkC,EAClC,QAAgB,EAChB,IAAa;IAEb,MAAM,QAAQ,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC9D,IAAI,QAAQ,CAAC,KAAK;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC;IAExC,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAC5B,gBAAgB,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,4DAWC;AAED,SAAgB,4BAA4B,CAAC,QAAgB,EAAE,eAAgC;IAC7F,IAAI,YAAY,IAAI,eAAe,EAAE,CAAC;QACpC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC;QAC7D,OAAO,QAAQ,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,MAAM,GACjD,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAChC,IAAI,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,qCAAqC,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AAC1E,CAAC;AARD,oEAQC;AAED,SAAS,qCAAqC,CAC5C,SAAiB,EACjB,eAAoC;IAEpC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC;IAC5C,OAAO,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,SAAS,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Context } from "liquidjs";
|
|
2
|
+
import type { SiteContext } from "../site-context/site-context.types";
|
|
3
|
+
export type LiquidFilterHandler = (value: unknown, options: {
|
|
4
|
+
ctx: Context;
|
|
5
|
+
args: any[];
|
|
6
|
+
siteContext: SiteContext;
|
|
7
|
+
}) => string | undefined | Promise<string | undefined>;
|
|
8
|
+
export declare function toLiquidJsFilterHandler(siteContext: SiteContext, handler: LiquidFilterHandler): (this: {
|
|
9
|
+
context: Context;
|
|
10
|
+
}, value: unknown, ...args: unknown[]) => string | Promise<string | undefined> | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toLiquidJsFilterHandler = void 0;
|
|
4
|
+
function toLiquidJsFilterHandler(siteContext, handler) {
|
|
5
|
+
return function (value, ...args) {
|
|
6
|
+
try {
|
|
7
|
+
const result = handler(value, { ctx: this.context, args, siteContext });
|
|
8
|
+
if (result && typeof result !== "string" && "then" in result) {
|
|
9
|
+
return result.then(undefined, (error) => {
|
|
10
|
+
siteContext.siteLog.error("Error in liquid filter:", error);
|
|
11
|
+
throw error;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
siteContext.siteLog.error("Error in liquid filter:", error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.toLiquidJsFilterHandler = toLiquidJsFilterHandler;
|
|
23
|
+
//# sourceMappingURL=liquidjs-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidjs-filter.js","sourceRoot":"","sources":["../../src/liquidjs-tools/liquidjs-filter.ts"],"names":[],"mappings":";;;AAYA,SAAgB,uBAAuB,CAAC,WAAwB,EAAE,OAA4B;IAC5F,OAAO,UAAsC,KAAc,EAAE,GAAG,IAAe;QAC7E,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;YACxE,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;gBAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;oBACtC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;oBAC5D,MAAM,KAAK,CAAC;gBACd,CAAC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YAC5D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAhBD,0DAgBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SiteContext } from "../../site-context/site-context.types";
|
|
2
|
+
import type { RenderingContext } from "./rendering-context";
|
|
3
|
+
export declare function renderLiquidTemplate(siteContext: SiteContext, renderingContext: RenderingContext, { templateNames, payload }: {
|
|
4
|
+
templateNames: string[];
|
|
5
|
+
payload: object;
|
|
6
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderLiquidTemplate = void 0;
|
|
7
|
+
const html_minifier_terser_1 = require("html-minifier-terser");
|
|
8
|
+
const render_1 = __importDefault(require("../render-clone/render"));
|
|
9
|
+
async function renderLiquidTemplate(siteContext, renderingContext, { templateNames, payload }) {
|
|
10
|
+
let html;
|
|
11
|
+
let usedTemplate;
|
|
12
|
+
for (const templateName of templateNames) {
|
|
13
|
+
try {
|
|
14
|
+
html = await siteContext.liquidEngine.renderFile(templateName, {
|
|
15
|
+
...payload,
|
|
16
|
+
[render_1.default.passThroughSymbol]: renderingContext,
|
|
17
|
+
});
|
|
18
|
+
usedTemplate = templateName;
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err.code === "ENOENT")
|
|
22
|
+
continue;
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (!html)
|
|
27
|
+
throw new Error(`missing template '${templateNames[0]}'`);
|
|
28
|
+
try {
|
|
29
|
+
return await (0, html_minifier_terser_1.minify)(html, {
|
|
30
|
+
collapseWhitespace: true,
|
|
31
|
+
removeComments: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
siteContext.siteLog.warn(`[${siteContext.fqdn}] invalid HTML generated by '${usedTemplate}'`);
|
|
36
|
+
}
|
|
37
|
+
return html;
|
|
38
|
+
}
|
|
39
|
+
exports.renderLiquidTemplate = renderLiquidTemplate;
|
|
40
|
+
//# sourceMappingURL=render-liquidjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-liquidjs.js","sourceRoot":"","sources":["../../../src/liquidjs-tools/liquidjs-rendering/render-liquidjs.ts"],"names":[],"mappings":";;;;;;AAAA,+DAA8C;AAE9C,oEAA+C;AAGxC,KAAK,UAAU,oBAAoB,CACxC,WAAwB,EACxB,gBAAkC,EAClC,EAAE,aAAa,EAAE,OAAO,EAAgD;IAExE,IAAI,IAAwB,CAAC;IAC7B,IAAI,YAAgC,CAAC;IACrC,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,YAAY,EAAE;gBAC7D,GAAG,OAAO;gBACV,CAAC,gBAAS,CAAC,iBAAiB,CAAC,EAAE,gBAAgB;aAChD,CAAC,CAAC;YACH,YAAY,GAAG,YAAY,CAAC;QAC9B,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,SAAS;YACpC,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrE,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,6BAAM,EAAC,IAAI,EAAE;YACxB,kBAAkB,EAAE,IAAI;YACxB,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,gCAAgC,YAAY,GAAG,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AA7BD,oDA6BC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Tracker } from "@paroicms/server-lib";
|
|
2
|
+
import type { SiteContext } from "../../site-context/site-context.types";
|
|
3
|
+
export interface RenderingContext {
|
|
4
|
+
renderingId: bigint;
|
|
5
|
+
cacheKey: string;
|
|
6
|
+
tracker: Tracker;
|
|
7
|
+
getDependencyKeys: () => string[];
|
|
8
|
+
addDependencyKey: (...dependencyKeys: string[]) => void;
|
|
9
|
+
getValueFromCache: (key: string) => RenderingCacheResult;
|
|
10
|
+
setValueIntoCache: (key: string, val: any) => void;
|
|
11
|
+
}
|
|
12
|
+
export type RenderingCacheResult = {
|
|
13
|
+
found: false;
|
|
14
|
+
} | {
|
|
15
|
+
found: true;
|
|
16
|
+
val: any;
|
|
17
|
+
};
|
|
18
|
+
export declare function createRenderingContext(siteContext: Pick<SiteContext, "imageCache">, options: {
|
|
19
|
+
cacheKey: string;
|
|
20
|
+
tracker: Tracker;
|
|
21
|
+
dependencyKey?: string;
|
|
22
|
+
}): Promise<RenderingContext>;
|
|
23
|
+
export declare function makeTagCacheKeyForRendering(cacheKey: string, { tagParameters }: {
|
|
24
|
+
tagParameters?: any;
|
|
25
|
+
}): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeTagCacheKeyForRendering = exports.createRenderingContext = void 0;
|
|
4
|
+
let renderingSeq = 0n;
|
|
5
|
+
async function createRenderingContext(siteContext, options) {
|
|
6
|
+
await siteContext.imageCache.resetCacheKey({ cacheKey: options.cacheKey });
|
|
7
|
+
const { cacheKey, tracker } = options;
|
|
8
|
+
const cache = new Map();
|
|
9
|
+
const dependencies = new Set(options.dependencyKey ? [options.dependencyKey] : undefined);
|
|
10
|
+
return {
|
|
11
|
+
renderingId: ++renderingSeq,
|
|
12
|
+
cacheKey,
|
|
13
|
+
tracker,
|
|
14
|
+
getDependencyKeys() {
|
|
15
|
+
return Array.from(dependencies);
|
|
16
|
+
},
|
|
17
|
+
addDependencyKey(...dependencyKeys) {
|
|
18
|
+
for (const key of dependencyKeys)
|
|
19
|
+
dependencies.add(key);
|
|
20
|
+
},
|
|
21
|
+
getValueFromCache(key) {
|
|
22
|
+
const val = cache.get(key);
|
|
23
|
+
return val ?? { found: false };
|
|
24
|
+
},
|
|
25
|
+
setValueIntoCache(key, val) {
|
|
26
|
+
cache.set(key, { found: true, val });
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.createRenderingContext = createRenderingContext;
|
|
31
|
+
function makeTagCacheKeyForRendering(cacheKey, { tagParameters }) {
|
|
32
|
+
return `${cacheKey}:${tagParameters === undefined ? "-" : JSON.stringify(tagParameters)}`;
|
|
33
|
+
}
|
|
34
|
+
exports.makeTagCacheKeyForRendering = makeTagCacheKeyForRendering;
|
|
35
|
+
//# sourceMappingURL=rendering-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rendering-context.js","sourceRoot":"","sources":["../../../src/liquidjs-tools/liquidjs-rendering/rendering-context.ts"],"names":[],"mappings":";;;AAGA,IAAI,YAAY,GAAG,EAAE,CAAC;AAmBf,KAAK,UAAU,sBAAsB,CAC1C,WAA4C,EAC5C,OAIC;IAED,MAAM,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE3E,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAgC,CAAC;IACtD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAClG,OAAO;QACL,WAAW,EAAE,EAAE,YAAY;QAC3B,QAAQ;QACR,OAAO;QACP,iBAAiB;YACf,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAClC,CAAC;QACD,gBAAgB,CAAC,GAAG,cAAc;YAChC,KAAK,MAAM,GAAG,IAAI,cAAc;gBAAE,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1D,CAAC;QACD,iBAAiB,CAAC,GAAG;YACnB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAE3B,OAAO,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACjC,CAAC;QACD,iBAAiB,CAAC,GAAG,EAAE,GAAG;YACxB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC;AAhCD,wDAgCC;AAED,SAAgB,2BAA2B,CACzC,QAAgB,EAChB,EAAE,aAAa,EAA2B;IAE1C,OAAO,GAAG,QAAQ,IAAI,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;AAC5F,CAAC;AALD,kEAKC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Obj } from "@paroicms/anywhere-lib";
|
|
2
|
+
import type { Context } from "liquidjs";
|
|
3
|
+
import type { RenderingContext } from "./liquidjs-rendering/rendering-context";
|
|
4
|
+
export declare function getRenderingContext(ctx: Context): RenderingContext;
|
|
5
|
+
export declare function getLiquidJsPageValues(ctx: Context): Obj | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getLiquidJsPageValues = exports.getRenderingContext = void 0;
|
|
7
|
+
const liquidjs_drop_1 = require("./liquidjs-drop");
|
|
8
|
+
const render_1 = __importDefault(require("./render-clone/render"));
|
|
9
|
+
function getRenderingContext(ctx) {
|
|
10
|
+
const found = ctx.environments?.[render_1.default.passThroughSymbol];
|
|
11
|
+
if (!found)
|
|
12
|
+
throw new Error("missing rendering context");
|
|
13
|
+
return found;
|
|
14
|
+
}
|
|
15
|
+
exports.getRenderingContext = getRenderingContext;
|
|
16
|
+
function getLiquidJsPageValues(ctx) {
|
|
17
|
+
const page = ctx.getSync(["page"]);
|
|
18
|
+
const values = page?.[liquidjs_drop_1.valuesSymbol];
|
|
19
|
+
return typeof values === "object" ? values : undefined;
|
|
20
|
+
}
|
|
21
|
+
exports.getLiquidJsPageValues = getLiquidJsPageValues;
|
|
22
|
+
//# sourceMappingURL=liquidjs-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidjs-utils.js","sourceRoot":"","sources":["../../src/liquidjs-tools/liquidjs-utils.ts"],"names":[],"mappings":";;;;;;AAEA,mDAA+C;AAE/C,mEAA8C;AAE9C,SAAgB,mBAAmB,CAAC,GAAY;IAC9C,MAAM,KAAK,GAAI,GAAG,CAAC,YAAoB,EAAE,CAAC,gBAAS,CAAC,iBAAiB,CAAC,CAAC;IACvE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC;AACf,CAAC;AAJD,kDAIC;AAED,SAAgB,qBAAqB,CAAC,GAAY;IAChD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAQ,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,EAAE,CAAC,4BAAY,CAAC,CAAC;IACpC,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC;AAJD,sDAIC"}
|