@paroicms/server 0.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/ddl/main.ddl.sql +84 -0
- package/dist/backup/site/archiver.helper.d.ts +12 -0
- package/dist/backup/site/archiver.helper.js +46 -0
- package/dist/backup/site/archiver.helper.js.map +1 -0
- package/dist/backup/site/backup.d.ts +5 -0
- package/dist/backup/site/backup.js +118 -0
- package/dist/backup/site/backup.js.map +1 -0
- 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/excerpt.helpers.spec.d.ts +1 -0
- package/dist/helpers/excerpt.helpers.spec.js +133 -0
- package/dist/helpers/excerpt.helpers.spec.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/search-text-helper.d.ts +7 -0
- package/dist/helpers/search-text-helper.js +27 -0
- package/dist/helpers/search-text-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 +67 -0
- package/dist/index.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.controller.d.ts +5 -0
- package/dist/modules/core/account-auth/account-auth.controller.js +46 -0
- package/dist/modules/core/account-auth/account-auth.controller.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 +49 -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 +164 -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 +61 -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 +54 -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/document/search-document-item.resolver.d.ts +7 -0
- package/dist/modules/core/document/search-document-item.resolver.js +58 -0
- package/dist/modules/core/document/search-document-item.resolver.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 +143 -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 +54 -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.model.d.ts +6 -0
- package/dist/modules/core/part/part.model.js +44 -0
- package/dist/modules/core/part/part.model.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-fields/site-fields.model.d.ts +4 -0
- package/dist/modules/core/site-fields/site-fields.model.js +30 -0
- package/dist/modules/core/site-fields/site-fields.model.js.map +1 -0
- package/dist/modules/core/site-fields/site-fields.module.d.ts +2 -0
- package/dist/modules/core/site-fields/site-fields.module.js +20 -0
- package/dist/modules/core/site-fields/site-fields.module.js.map +1 -0
- package/dist/modules/core/site-fields/site-fields.queries.d.ts +9 -0
- package/dist/modules/core/site-fields/site-fields.queries.js +123 -0
- package/dist/modules/core/site-fields/site-fields.queries.js.map +1 -0
- package/dist/modules/core/site-fields/site-fields.resolver.d.ts +5 -0
- package/dist/modules/core/site-fields/site-fields.resolver.js +56 -0
- package/dist/modules/core/site-fields/site-fields.resolver.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/term-flag/term-flag.service.d.ts +9 -0
- package/dist/modules/core/term-flag/term-flag.service.js +50 -0
- package/dist/modules/core/term-flag/term-flag.service.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 +59 -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 +198 -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/google-auth.controller.d.ts +10 -0
- package/dist/modules/public-site/google-auth.controller.js +127 -0
- package/dist/modules/public-site/google-auth.controller.js.map +1 -0
- package/dist/modules/public-site/helpers/format-date.helper.d.ts +3 -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/format-date.helper.spec.d.ts +1 -0
- package/dist/modules/public-site/helpers/format-date.helper.spec.js +37 -0
- package/dist/modules/public-site/helpers/format-date.helper.spec.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/helpers/public-field-values.d.ts +10 -0
- package/dist/modules/public-site/helpers/public-field-values.js +76 -0
- package/dist/modules/public-site/helpers/public-field-values.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/format-date.d.ts +2 -0
- package/dist/modules/public-site/liquidjs-filters/format-date.js +14 -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 +2 -0
- package/dist/modules/public-site/liquidjs-filters/format-number.js +18 -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 +2 -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 +2 -0
- package/dist/modules/public-site/liquidjs-filters/inject-facebook-chat.js +38 -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 +3 -0
- package/dist/modules/public-site/liquidjs-filters/inject-menu-items-data.js +21 -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 +2 -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 +3 -0
- package/dist/modules/public-site/liquidjs-filters/obfuscate.js +15 -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 +4 -0
- package/dist/modules/public-site/liquidjs-filters/open-graph-filter.js +39 -0
- package/dist/modules/public-site/liquidjs-filters/open-graph-filter.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.1.d.ts +3 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.1.js +12 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.1.js.map +1 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.d.ts +3 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.js +12 -0
- package/dist/modules/public-site/liquidjs-filters/translate-filter.js.map +1 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/collection.d.ts +1 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/collection.js +18 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/collection.js.map +1 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/forloop-drop.d.ts +15 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/forloop-drop.js +40 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/forloop-drop.js.map +1 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/render.d.ts +13 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/render.js +108 -0
- package/dist/modules/public-site/liquidjs-rendering/render-clone/render.js.map +1 -0
- package/dist/modules/public-site/liquidjs-rendering/render-liquidjs.d.ts +6 -0
- package/dist/modules/public-site/liquidjs-rendering/render-liquidjs.js +40 -0
- package/dist/modules/public-site/liquidjs-rendering/render-liquidjs.js.map +1 -0
- package/dist/modules/public-site/liquidjs-rendering/rendering-context.d.ts +27 -0
- package/dist/modules/public-site/liquidjs-rendering/rendering-context.js +46 -0
- package/dist/modules/public-site/liquidjs-rendering/rendering-context.js.map +1 -0
- package/dist/modules/public-site/liquidjs-tags/get-breadcrumb-liquidjs-tag.d.ts +13 -0
- package/dist/modules/public-site/liquidjs-tags/get-breadcrumb-liquidjs-tag.js +49 -0
- package/dist/modules/public-site/liquidjs-tags/get-breadcrumb-liquidjs-tag.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 +68 -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 +94 -0
- package/dist/modules/public-site/liquidjs-tags/get-pages-tag.js.map +1 -0
- package/dist/modules/public-site/liquidjs-tags/get-siblings-liquidjs-tag.d.ts +13 -0
- package/dist/modules/public-site/liquidjs-tags/get-siblings-liquidjs-tag.js +61 -0
- package/dist/modules/public-site/liquidjs-tags/get-siblings-liquidjs-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 +53 -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 +144 -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 +46 -0
- package/dist/modules/security/complexity-plugin.js.map +1 -0
- package/dist/modules/security/gqlThrottlerGuard.d.ts +8 -0
- package/dist/modules/security/gqlThrottlerGuard.js +24 -0
- package/dist/modules/security/gqlThrottlerGuard.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/create-page-payload-drop.d.ts +10 -0
- package/dist/public-payload/create-page-payload-drop.js +143 -0
- package/dist/public-payload/create-page-payload-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/liquidjs-drop.d.ts +31 -0
- package/dist/public-payload/liquidjs-drop.js +45 -0
- package/dist/public-payload/liquidjs-drop.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 +11 -0
- package/dist/site-backup/backup-tasks.js +98 -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 +34 -0
- package/dist/site-backup/backup.js.map +1 -0
- package/dist/site-backup/default-data/default-config.d.ts +1 -0
- package/dist/site-backup/default-data/default-config.js +50 -0
- package/dist/site-backup/default-data/default-config.js.map +1 -0
- package/dist/site-backup/default-data/default-readme.d.ts +1 -0
- package/dist/site-backup/default-data/default-readme.js +8 -0
- package/dist/site-backup/default-data/default-readme.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 +37 -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 +4 -0
- package/dist/site-context/db-init/init-routing-points.js +147 -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 +11 -0
- package/dist/site-context/site-context.js +234 -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 +382 -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/locales/en.json +18 -0
- package/locales/fr.json +18 -0
- package/package.json +99 -0
- package/schema.gql +293 -0
- package/site-schema-lib/common-schema.json +36 -0
- package/site-schema-lib/common-schema.l10n.en.json +10 -0
- package/site-schema-lib/common-schema.l10n.fr.json +10 -0
- package/site-schema-lib/fields.site-schema.json +79 -0
- package/site-schema-lib/fields.site-schema.l10n.en.json +26 -0
- package/site-schema-lib/fields.site-schema.l10n.fr.json +26 -0
- package/site-schema-lib/gallery-page.site-schema.json +19 -0
- package/site-schema-lib/gallery-page.site-schema.l10n.en.json +11 -0
- package/site-schema-lib/gallery-page.site-schema.l10n.fr.json +11 -0
- package/site-schema-lib/lowcost.site-schema.json +84 -0
- package/site-schema-lib/lowcost.site-schema.l10n.en.json +30 -0
- package/site-schema-lib/lowcost.site-schema.l10n.fr.json +30 -0
- package/site-schema-lib/media-policies.site-schema.json +26 -0
- package/site-schema-lib/portfolio.site-schema.json +28 -0
- package/site-schema-lib/portfolio.site-schema.l10n.en.json +16 -0
- package/site-schema-lib/portfolio.site-schema.l10n.fr.json +16 -0
- package/site-schema-lib/post.site-schema.json +48 -0
- package/site-schema-lib/post.site-schema.l10n.en.json +28 -0
- package/site-schema-lib/post.site-schema.l10n.fr.json +27 -0
- package/site-schema-lib/simple-pages.site-schema.json +19 -0
- package/site-schema-lib/simple-pages.site-schema.l10n.en.json +11 -0
- package/site-schema-lib/simple-pages.site-schema.l10n.fr.json +11 -0
- package/site-schema-lib/special-page.site-schema.json +42 -0
- package/site-schema-lib/special-page.site-schema.l10n.en.json +16 -0
- package/site-schema-lib/special-page.site-schema.l10n.fr.json +16 -0
- package/site-schema-lib/tour.site-schema.json +70 -0
- package/site-schema-lib/tour.site-schema.l10n.en.json +37 -0
- package/site-schema-lib/tour.site-schema.l10n.fr.json +37 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.countPartsOf = exports.loadPartsOf = void 0;
|
|
4
|
+
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
5
|
+
const anywhere_lib_1 = require("@paroicms/anywhere-lib");
|
|
6
|
+
const ddl_migration_1 = require("../site-context/db-init/ddl-migration");
|
|
7
|
+
async function loadPartsOf(siteContext, tracker, parentId, listType) {
|
|
8
|
+
const { listName } = listType;
|
|
9
|
+
const rows = await siteContext.mainCn
|
|
10
|
+
.createQueryBuilder()
|
|
11
|
+
.select("l.id", "leafId")
|
|
12
|
+
.addSelect("l.leafType", "leafType")
|
|
13
|
+
.addSelect("i.itemNum", "itemNum")
|
|
14
|
+
.addSelect("s.leafId", "tLeafId")
|
|
15
|
+
.from("PaLeaf", "l")
|
|
16
|
+
.innerJoin("PaLeafItem", "i", "i.leafId = l.id")
|
|
17
|
+
.leftJoin("PaSection", "s", "s.leafId = l.id and s.lang = :lang", {
|
|
18
|
+
lang: parentId.lang,
|
|
19
|
+
})
|
|
20
|
+
.where("l.parentId = :leafId", { leafId: parentId.leafId })
|
|
21
|
+
.andWhere("i.listName = :listName", { listName })
|
|
22
|
+
.orderBy("i.itemNum", "ASC")
|
|
23
|
+
.getRawMany();
|
|
24
|
+
tracker.trackAccess(ddl_migration_1.dbSchemaName, "PaSection", "read");
|
|
25
|
+
const oneLangItems = rows.map((row) => {
|
|
26
|
+
const inRightLang = (0, data_formatters_lib_1.strValOrUndef)(row.tLeafId) !== undefined;
|
|
27
|
+
return inRightLang
|
|
28
|
+
? {
|
|
29
|
+
leafId: (0, data_formatters_lib_1.strVal)(row.leafId),
|
|
30
|
+
leafType: (0, data_formatters_lib_1.strVal)(row.leafType),
|
|
31
|
+
itemNum: (0, data_formatters_lib_1.nbVal)(row.itemNum),
|
|
32
|
+
listName,
|
|
33
|
+
inRightLang,
|
|
34
|
+
lang: parentId.lang,
|
|
35
|
+
title: (0, data_formatters_lib_1.strValOrUndef)(row.title),
|
|
36
|
+
}
|
|
37
|
+
: {
|
|
38
|
+
leafId: (0, data_formatters_lib_1.strVal)(row.leafId),
|
|
39
|
+
leafType: (0, data_formatters_lib_1.strVal)(row.leafType),
|
|
40
|
+
itemNum: (0, data_formatters_lib_1.nbVal)(row.itemNum),
|
|
41
|
+
listName,
|
|
42
|
+
inRightLang,
|
|
43
|
+
lang: undefined,
|
|
44
|
+
title: (0, data_formatters_lib_1.strValOrUndef)(row.title),
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const completed = await completeMissingTranslations(siteContext, tracker, oneLangItems);
|
|
48
|
+
const result = [];
|
|
49
|
+
for (const item of completed) {
|
|
50
|
+
if (!item.lang) {
|
|
51
|
+
siteContext.siteLog.warn("should have lang here", item);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
result.push({
|
|
55
|
+
leafType: item.leafType,
|
|
56
|
+
num: item.itemNum,
|
|
57
|
+
inRightLang: item.inRightLang,
|
|
58
|
+
lang: item.lang,
|
|
59
|
+
langLabel: siteContext.siteSchema.langLabels[item.lang],
|
|
60
|
+
leafId: item.leafId,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
exports.loadPartsOf = loadPartsOf;
|
|
66
|
+
async function completeMissingTranslations(siteContext, tracker, list) {
|
|
67
|
+
const missingLeafIds = list.filter((item) => !item.inRightLang).map((item) => item.leafId);
|
|
68
|
+
let otherLangItems;
|
|
69
|
+
if (missingLeafIds.length > 0) {
|
|
70
|
+
const rows = await siteContext.mainCn
|
|
71
|
+
.createQueryBuilder()
|
|
72
|
+
.addSelect("s.leafId", "leafId")
|
|
73
|
+
.addSelect("s.lang", "lang")
|
|
74
|
+
.addSelect("l.leafType", "leafType")
|
|
75
|
+
.from("PaSection", "s")
|
|
76
|
+
.innerJoin("PaLeaf", "l", "l.id = s.leafId")
|
|
77
|
+
.where("s.leafId in (:...leafIds)", { leafIds: missingLeafIds })
|
|
78
|
+
.getRawMany();
|
|
79
|
+
tracker.trackAccess(ddl_migration_1.dbSchemaName, "PaSection", "read");
|
|
80
|
+
const formatted = rows.map((row) => {
|
|
81
|
+
return {
|
|
82
|
+
leafType: (0, data_formatters_lib_1.strVal)(row.leafType),
|
|
83
|
+
leafId: (0, data_formatters_lib_1.strVal)(row.leafId),
|
|
84
|
+
lang: (0, data_formatters_lib_1.strVal)(row.lang),
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
otherLangItems = new Map(formatted.map((item) => [(0, anywhere_lib_1.encodeSectionId)(item), item]));
|
|
88
|
+
}
|
|
89
|
+
return list.map((item) => {
|
|
90
|
+
if (item.inRightLang)
|
|
91
|
+
return item;
|
|
92
|
+
for (const lang of siteContext.siteSchema.langs) {
|
|
93
|
+
const found = otherLangItems?.get((0, anywhere_lib_1.encodeSectionId)({ leafId: item.leafId, lang }));
|
|
94
|
+
if (found) {
|
|
95
|
+
return {
|
|
96
|
+
leafType: item.leafType,
|
|
97
|
+
leafId: item.leafId,
|
|
98
|
+
lang,
|
|
99
|
+
itemNum: item.itemNum,
|
|
100
|
+
listName: item.listName,
|
|
101
|
+
inRightLang: false,
|
|
102
|
+
title: found.title,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
throw new Error(`missing part for item '${item.leafId}'`);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async function countPartsOf(siteContext, tracker, parentId, listType) {
|
|
110
|
+
const { listName } = listType;
|
|
111
|
+
const row = await siteContext.mainCn
|
|
112
|
+
.createQueryBuilder()
|
|
113
|
+
.select("count(1)", "cnt")
|
|
114
|
+
.from("PaLeaf", "l")
|
|
115
|
+
.innerJoin("PaLeafItem", "i", "i.leafId = l.id")
|
|
116
|
+
.where("l.parentId = :leafId", { leafId: parentId.leafId })
|
|
117
|
+
.andWhere("i.listName = :listName", { listName })
|
|
118
|
+
.getRawOne();
|
|
119
|
+
tracker.trackAccess(ddl_migration_1.dbSchemaName, "PaLeafItem", "read");
|
|
120
|
+
return (0, data_formatters_lib_1.nbValOrUndef)(row?.cnt) ?? 0;
|
|
121
|
+
}
|
|
122
|
+
exports.countPartsOf = countPartsOf;
|
|
123
|
+
//# sourceMappingURL=parts.queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parts.queries.js","sourceRoot":"","sources":["../../src/public-payload/parts.queries.ts"],"names":[],"mappings":";;;AAAA,oEAAwF;AACxF,yDAA+F;AAE/F,yEAAqE;AA4B9D,KAAK,UAAU,WAAW,CAC/B,WAAwB,EACxB,OAAgB,EAChB,QAAyB,EACzB,QAA0C;IAE1C,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC;IAE9B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,MAAM;SAClC,kBAAkB,EAAE;SACpB,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;SACxB,SAAS,CAAC,YAAY,EAAE,UAAU,CAAC;SACnC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC;SACjC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC;SAChC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;SACnB,SAAS,CAAC,YAAY,EAAE,GAAG,EAAE,iBAAiB,CAAC;SAE/C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE,oCAAoC,EAAE;QAChE,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAC;SACD,KAAK,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;SAC1D,QAAQ,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,CAAC;SAChD,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC;SAC3B,UAAU,EAAO,CAAC;IACrB,OAAO,CAAC,WAAW,CAAC,4BAAY,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAEvD,MAAM,YAAY,GAAmB,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACpD,MAAM,WAAW,GAAG,IAAA,mCAAa,EAAC,GAAG,CA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AAK,CAAC;SACzB,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;SACnB,SAAS,CAAC,YAAY,EAAE,GAAG,EAAE,iBAAiB,CAAC;SAC/C,KAAK,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;SAC1D,QAAQ,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,CAAC;SAChD,SAAS,EAAO,CAAC;IACpB,OAAO,CAAC,WAAW,CAAC,4BAAY,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IAExD,OAAO,IAAA,kCAAY,EAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAlBD,oCAkBC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { FieldValues } from "../modules/core/fields/load-fields.queries";
|
|
2
|
+
export type PublicPayload = DetachedPublicPayload | RegularPublicPayload;
|
|
3
|
+
export interface DetachedPublicPayload {
|
|
4
|
+
site: SitePayload;
|
|
5
|
+
page: DetachedPagePayload;
|
|
6
|
+
}
|
|
7
|
+
export interface RegularPublicPayload {
|
|
8
|
+
site: SitePayload;
|
|
9
|
+
page: PagePayload;
|
|
10
|
+
}
|
|
11
|
+
export interface BaseSitePayload {
|
|
12
|
+
fqdn: string;
|
|
13
|
+
siteAppAssets: {
|
|
14
|
+
jsUrl: string;
|
|
15
|
+
cssUrl: string;
|
|
16
|
+
};
|
|
17
|
+
assetsUrl: string;
|
|
18
|
+
fields: {
|
|
19
|
+
[fieldName: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
recaptchaKey: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SitePayload extends BaseSitePayload {
|
|
24
|
+
kind: "site";
|
|
25
|
+
lang: string;
|
|
26
|
+
langLabel: string;
|
|
27
|
+
home: HomeRoutingPointSectionIds;
|
|
28
|
+
}
|
|
29
|
+
export interface HomeRoutingPointSectionIds extends RoutingPointSectionIds {
|
|
30
|
+
url: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RoutingPointSectionIds {
|
|
33
|
+
id: string;
|
|
34
|
+
[leafType: string]: RoutingPointSectionIds | string;
|
|
35
|
+
}
|
|
36
|
+
export interface DetachedPagePayload {
|
|
37
|
+
kind: "detached";
|
|
38
|
+
leafType?: string;
|
|
39
|
+
lang?: string;
|
|
40
|
+
langLabel?: string;
|
|
41
|
+
translations: PageTranslation[];
|
|
42
|
+
id?: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface PageValues {
|
|
46
|
+
leafType: string;
|
|
47
|
+
leafId: string;
|
|
48
|
+
lang: string;
|
|
49
|
+
relativeId: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
slug?: string;
|
|
52
|
+
publishDate: string;
|
|
53
|
+
metaDescription?: string;
|
|
54
|
+
metaKeywords?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface PagePayload extends PageValues {
|
|
57
|
+
kind: "page";
|
|
58
|
+
id: string;
|
|
59
|
+
langLabel: string;
|
|
60
|
+
url: string;
|
|
61
|
+
excerpt?: string;
|
|
62
|
+
parts: {
|
|
63
|
+
[listName: string]: PagePart[];
|
|
64
|
+
};
|
|
65
|
+
partCount: {
|
|
66
|
+
[listName: string]: number;
|
|
67
|
+
};
|
|
68
|
+
defaultImageUid?: string;
|
|
69
|
+
featuredImageUid?: string;
|
|
70
|
+
fields: FieldValues;
|
|
71
|
+
translations: PageTranslation[];
|
|
72
|
+
flaggedWith: {
|
|
73
|
+
[leafType: string]: Term[];
|
|
74
|
+
};
|
|
75
|
+
flaggedWithOne: {
|
|
76
|
+
[leafType: string]: Term | undefined;
|
|
77
|
+
};
|
|
78
|
+
og: OgValues;
|
|
79
|
+
breadcrumb: BreadcrumbItem[];
|
|
80
|
+
siblings: SiblingDocuments;
|
|
81
|
+
leafTypeLabel: string;
|
|
82
|
+
}
|
|
83
|
+
export interface PageTranslation {
|
|
84
|
+
lang: string;
|
|
85
|
+
langLabel: string;
|
|
86
|
+
isCurrent: boolean;
|
|
87
|
+
url: string;
|
|
88
|
+
page?: PagePayload;
|
|
89
|
+
}
|
|
90
|
+
export interface TermValues extends PageValues {
|
|
91
|
+
inRightLang: boolean;
|
|
92
|
+
isLead: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface Term extends TermValues, Omit<PagePayload, "kind"> {
|
|
95
|
+
kind: "term";
|
|
96
|
+
}
|
|
97
|
+
export interface PagePartValues {
|
|
98
|
+
leafType: string;
|
|
99
|
+
num: number;
|
|
100
|
+
inRightLang: boolean;
|
|
101
|
+
lang: string;
|
|
102
|
+
langLabel: string;
|
|
103
|
+
leafId: string;
|
|
104
|
+
}
|
|
105
|
+
export interface PagePart extends PagePartValues {
|
|
106
|
+
kind: "part";
|
|
107
|
+
id: string;
|
|
108
|
+
defaultImageUid?: string;
|
|
109
|
+
featuredImageUid?: string;
|
|
110
|
+
fields: FieldValues;
|
|
111
|
+
leafTypeLabel: string;
|
|
112
|
+
}
|
|
113
|
+
export interface OgValues {
|
|
114
|
+
url: string;
|
|
115
|
+
type?: string;
|
|
116
|
+
imageUid?: string;
|
|
117
|
+
title?: string;
|
|
118
|
+
siteName?: string;
|
|
119
|
+
description?: string;
|
|
120
|
+
locale?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface BreadcrumbItem {
|
|
123
|
+
id: string;
|
|
124
|
+
title?: string;
|
|
125
|
+
url: string;
|
|
126
|
+
}
|
|
127
|
+
export interface SiblingDocuments {
|
|
128
|
+
previous?: PagePayload;
|
|
129
|
+
next?: PagePayload;
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-payload.types.js","sourceRoot":"","sources":["../../src/public-payload/public-payload.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RenderingContext } from "../modules/public-site/liquidjs-rendering/rendering-context";
|
|
2
|
+
import { SiteContext } from "../site-context/site-context.types";
|
|
3
|
+
import type * as publicPayload from "./public-payload.types";
|
|
4
|
+
export declare function makeSitePayload(siteContext: SiteContext, renderingContext: RenderingContext, lang: string): publicPayload.SitePayload;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeSitePayload = void 0;
|
|
4
|
+
const data_format_1 = require("../common/data-format");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
const make_url_1 = require("../modules/public-site/public-route/make-url");
|
|
7
|
+
const field_values_1 = require("./field-values");
|
|
8
|
+
function makeSitePayload(siteContext, renderingContext, lang) {
|
|
9
|
+
const siteAppBaseUrl = (0, data_format_1.getSiteAppBaseUrl)();
|
|
10
|
+
const homeIds = toPublicRoutingPointSectionIds(siteContext.siteIds.homeIds, lang);
|
|
11
|
+
return {
|
|
12
|
+
kind: "site",
|
|
13
|
+
fqdn: siteContext.fqdn,
|
|
14
|
+
siteAppAssets: {
|
|
15
|
+
cssUrl: `${siteAppBaseUrl}/index.css`,
|
|
16
|
+
jsUrl: `${siteAppBaseUrl}/index.js`,
|
|
17
|
+
},
|
|
18
|
+
assetsUrl: (0, data_format_1.getAssetsBaseUrl)(siteContext),
|
|
19
|
+
fields: (0, field_values_1.getPublicSiteFieldValues)(siteContext, renderingContext, lang),
|
|
20
|
+
recaptchaKey: context_1.appConf.googleRecaptcha.siteKey,
|
|
21
|
+
home: {
|
|
22
|
+
url: (0, make_url_1.getHomeUrl)(siteContext, lang),
|
|
23
|
+
...homeIds,
|
|
24
|
+
},
|
|
25
|
+
lang: lang,
|
|
26
|
+
langLabel: siteContext.siteSchema.langLabels[lang],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.makeSitePayload = makeSitePayload;
|
|
30
|
+
function toPublicRoutingPointSectionIds(ids, lang) {
|
|
31
|
+
const sectionId = ids.sectionIds[lang];
|
|
32
|
+
if (sectionId === undefined) {
|
|
33
|
+
throw new Error(`missing section for '${ids.leafType}', lang '${lang}'`);
|
|
34
|
+
}
|
|
35
|
+
const parentIds = {
|
|
36
|
+
id: sectionId,
|
|
37
|
+
};
|
|
38
|
+
for (const [childLeafType, childIds] of Object.entries(ids.children ?? {})) {
|
|
39
|
+
parentIds[childLeafType] = toPublicRoutingPointSectionIds(childIds, lang);
|
|
40
|
+
}
|
|
41
|
+
return parentIds;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=site-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-payload.js","sourceRoot":"","sources":["../../src/public-payload/site-payload.ts"],"names":[],"mappings":";;;AAAA,uDAA4E;AAC5E,wCAAqC;AAErC,2EAA0E;AAE1E,iDAA0D;AAG1D,SAAgB,eAAe,CAC7B,WAAwB,EACxB,gBAAkC,EAClC,IAAY;IAEZ,MAAM,cAAc,GAAG,IAAA,+BAAiB,GAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,8BAA8B,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClF,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,aAAa,EAAE;YACb,MAAM,EAAE,GAAG,cAAc,YAAY;YACrC,KAAK,EAAE,GAAG,cAAc,WAAW;SACpC;QACD,SAAS,EAAE,IAAA,8BAAgB,EAAC,WAAW,CAAC;QACxC,MAAM,EAAE,IAAA,uCAAwB,EAAC,WAAW,EAAE,gBAAgB,EAAE,IAAI,CAAC;QACrE,YAAY,EAAE,iBAAO,CAAC,eAAe,CAAC,OAAO;QAC7C,IAAI,EAAE;YACJ,GAAG,EAAE,IAAA,qBAAU,EAAC,WAAW,EAAE,IAAI,CAAC;YAClC,GAAG,OAAO;SACX;QACD,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC;KACnD,CAAC;AACJ,CAAC;AAxBD,0CAwBC;AAED,SAAS,8BAA8B,CACrC,GAAoB,EACpB,IAAY;IAEZ,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,CAAC,QAAQ,YAAY,IAAI,GAAG,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,SAAS,GAAyC;QACtD,EAAE,EAAE,SAAS;KACd,CAAC;IACF,KAAK,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;QAC3E,SAAS,CAAC,aAAa,CAAC,GAAG,8BAA8B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Obj, ParsedSectionId } from "@paroicms/anywhere-lib";
|
|
2
|
+
import { Tracker } from "@paroicms/server-lib";
|
|
3
|
+
import { SiteContext } from "../site-context/site-context.types";
|
|
4
|
+
import type * as publicPayload from "./public-payload.types";
|
|
5
|
+
export declare function loadFlaggedWithTerms(siteContext: SiteContext, tracker: Tracker, { documentId, taxonomyLeafType }: {
|
|
6
|
+
documentId: ParsedSectionId;
|
|
7
|
+
taxonomyLeafType: string;
|
|
8
|
+
}): Promise<publicPayload.TermValues[] | undefined>;
|
|
9
|
+
export declare function formatTermValues(row: Obj, { lang, leafId, leafType }?: {
|
|
10
|
+
lang?: string;
|
|
11
|
+
leafId?: string;
|
|
12
|
+
leafType?: string;
|
|
13
|
+
}): publicPayload.TermValues;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatTermValues = exports.loadFlaggedWithTerms = void 0;
|
|
4
|
+
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
5
|
+
const ddl_migration_1 = require("../site-context/db-init/ddl-migration");
|
|
6
|
+
const page_values_queries_1 = require("./page-values.queries");
|
|
7
|
+
async function loadFlaggedWithTerms(siteContext, tracker, { documentId, taxonomyLeafType }) {
|
|
8
|
+
const query = siteContext.mainCn.createQueryBuilder();
|
|
9
|
+
(0, page_values_queries_1.querySelectPageValues)(query);
|
|
10
|
+
query
|
|
11
|
+
.addSelect("f.lead", "lead")
|
|
12
|
+
.addSelect("d.leafId", "dLeafId")
|
|
13
|
+
.from("PaLeaf", "l")
|
|
14
|
+
.innerJoin("PaTermFlag", "f", "f.termId = l.id")
|
|
15
|
+
.innerJoin("PaLeaf", "l2", "l2.id = l.parentId")
|
|
16
|
+
.innerJoin("PaSection", "s", "s.leafId = l.id and s.lang = :lang and s.ready = 1", {
|
|
17
|
+
lang: documentId.lang,
|
|
18
|
+
})
|
|
19
|
+
.innerJoin("PaDocument", "d", "d.leafId = s.leafId and d.lang = :lang", {
|
|
20
|
+
lang: documentId.lang,
|
|
21
|
+
})
|
|
22
|
+
.where("f.flaggedId = :leafId", { leafId: documentId.leafId })
|
|
23
|
+
.andWhere("l.publishDate <= current_timestamp")
|
|
24
|
+
.andWhere("l2.leafType = :taxonomyLeafType", { taxonomyLeafType })
|
|
25
|
+
.orderBy("d.title", "ASC");
|
|
26
|
+
const rows = await query.getRawMany();
|
|
27
|
+
tracker.trackAccess(ddl_migration_1.dbSchemaName, "PaTermFlag", "read");
|
|
28
|
+
return rows.map((row) => {
|
|
29
|
+
return {
|
|
30
|
+
...(0, page_values_queries_1.formatPageValues)(row, { lang: documentId.lang }),
|
|
31
|
+
isLead: (0, data_formatters_lib_1.boolVal)(row.lead),
|
|
32
|
+
inRightLang: (0, data_formatters_lib_1.strValOrUndef)(row.dLeafId) !== undefined,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.loadFlaggedWithTerms = loadFlaggedWithTerms;
|
|
37
|
+
function formatTermValues(row, { lang, leafId, leafType } = {}) {
|
|
38
|
+
return {
|
|
39
|
+
...(0, page_values_queries_1.formatPageValues)(row, { lang, leafId, leafType }),
|
|
40
|
+
inRightLang: (0, data_formatters_lib_1.boolVal)(row.inRightLang),
|
|
41
|
+
isLead: (0, data_formatters_lib_1.boolVal)(row.inRightLang),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
exports.formatTermValues = formatTermValues;
|
|
45
|
+
//# sourceMappingURL=taxonomies.queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taxonomies.queries.js","sourceRoot":"","sources":["../../src/public-payload/taxonomies.queries.ts"],"names":[],"mappings":";;;AAAA,oEAAoE;AAGpE,yEAAqE;AAErE,+DAAgF;AAGzE,KAAK,UAAU,oBAAoB,CACxC,WAAwB,EACxB,OAAgB,EAChB,EAAE,UAAU,EAAE,gBAAgB,EAA6D;IAE3F,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;IACtD,IAAA,2CAAqB,EAAC,KAAK,CAAC,CAAC;IAC7B,KAAK;SACF,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;SAC3B,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC;SAChC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;SACnB,SAAS,CAAC,YAAY,EAAE,GAAG,EAAE,iBAAiB,CAAC;SAC/C,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,oBAAoB,CAAC;SAC/C,SAAS,CAAC,WAAW,EAAE,GAAG,EAAE,oDAAoD,EAAE;QACjF,IAAI,EAAE,UAAU,CAAC,IAAI;KACtB,CAAC;SACD,SAAS,CAAC,YAAY,EAAE,GAAG,EAAE,wCAAwC,EAAE;QACtE,IAAI,EAAE,UAAU,CAAC,IAAI;KACtB,CAAC;SACD,KAAK,CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;SAC7D,QAAQ,CAAC,oCAAoC,CAAC;SAC9C,QAAQ,CAAC,iCAAiC,EAAE,EAAE,gBAAgB,EAAE,CAAC;SACjE,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAE7B,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,UAAU,EAAO,CAAC;IAC3C,OAAO,CAAC,WAAW,CAAC,4BAAY,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IAExD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACtB,OAAO;YACL,GAAG,IAAA,sCAAgB,EAAC,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;YACnD,MAAM,EAAE,IAAA,6BAAO,EAAC,GAAG,CAAC,IAAI,CAAC;YACzB,WAAW,EAAE,IAAA,mCAAa,EAAC,GAAG,CAAC,OAAO,CAAC,KAAK,SAAS;SACtD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAlCD,oDAkCC;AAED,SAAgB,gBAAgB,CAC9B,GAAQ,EACR,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,KAA4D,EAAE;IAEtF,OAAO;QACL,GAAG,IAAA,sCAAgB,EAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QACpD,WAAW,EAAE,IAAA,6BAAO,EAAC,GAAG,CAAC,WAAW,CAAC;QACrC,MAAM,EAAE,IAAA,6BAAO,EAAC,GAAG,CAAC,WAAW,CAAC;KACjC,CAAC;AACJ,CAAC;AATD,4CASC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ParsedSectionId } from "@paroicms/anywhere-lib";
|
|
2
|
+
import { RenderingContext } from "../modules/public-site/liquidjs-rendering/rendering-context";
|
|
3
|
+
import { SiteContext } from "../site-context/site-context.types";
|
|
4
|
+
import { DropInst } from "./liquidjs-drop";
|
|
5
|
+
import { PageTranslation } from "./public-payload.types";
|
|
6
|
+
export declare function makeBasicTranslationsPayload(siteContext: Pick<SiteContext, "siteSchema" | "multilingual">): PageTranslation[];
|
|
7
|
+
export declare function loadTranslationsAsDrops(siteContext: SiteContext, renderingContext: RenderingContext, documentId: ParsedSectionId): Promise<DropInst<PageTranslation>[]>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadTranslationsAsDrops = exports.makeBasicTranslationsPayload = void 0;
|
|
4
|
+
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
5
|
+
const text_cache_1 = require("../common/text-cache");
|
|
6
|
+
const make_url_1 = require("../modules/public-site/public-route/make-url");
|
|
7
|
+
const ddl_migration_1 = require("../site-context/db-init/ddl-migration");
|
|
8
|
+
const create_page_drop_1 = require("./create-page-drop");
|
|
9
|
+
const liquidjs_drop_1 = require("./liquidjs-drop");
|
|
10
|
+
const page_values_queries_1 = require("./page-values.queries");
|
|
11
|
+
function makeBasicTranslationsPayload(siteContext) {
|
|
12
|
+
return siteContext.siteSchema.langs.map((lang) => ({
|
|
13
|
+
lang: lang,
|
|
14
|
+
langLabel: siteContext.siteSchema.langLabels[lang],
|
|
15
|
+
isCurrent: false,
|
|
16
|
+
url: (0, make_url_1.getHomeUrl)(siteContext, lang),
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
exports.makeBasicTranslationsPayload = makeBasicTranslationsPayload;
|
|
20
|
+
async function loadTranslationsAsDrops(siteContext, renderingContext, documentId) {
|
|
21
|
+
const { leafId } = documentId;
|
|
22
|
+
const existingLangs = await getExistingLangsOf(siteContext, renderingContext.tracker, leafId);
|
|
23
|
+
const translations = [];
|
|
24
|
+
for (const lang of siteContext.siteSchema.langs) {
|
|
25
|
+
const exists = existingLangs.has(lang);
|
|
26
|
+
const url = exists
|
|
27
|
+
? await (0, make_url_1.getUrlOfDocument)(siteContext, renderingContext.tracker, { leafId, lang })
|
|
28
|
+
: (0, make_url_1.getHomeUrl)(siteContext, lang);
|
|
29
|
+
const itemId = { leafId, lang };
|
|
30
|
+
translations.push((0, liquidjs_drop_1.createLiquidJsDrop)({
|
|
31
|
+
renderingContext,
|
|
32
|
+
cacheKeyOptions: { documentId: itemId },
|
|
33
|
+
values: {
|
|
34
|
+
lang,
|
|
35
|
+
langLabel: siteContext.siteSchema.langLabels[lang],
|
|
36
|
+
isCurrent: lang === documentId.lang,
|
|
37
|
+
url,
|
|
38
|
+
page: exists
|
|
39
|
+
? async () => (0, create_page_drop_1.createPagePayloadDrop)(siteContext, renderingContext, await (0, page_values_queries_1.getPageItem)(siteContext, renderingContext.tracker, itemId))
|
|
40
|
+
: undefined,
|
|
41
|
+
},
|
|
42
|
+
}, siteContext));
|
|
43
|
+
if (lang !== documentId.lang) {
|
|
44
|
+
renderingContext.addDependencyKey((0, text_cache_1.makeCacheDependencyKey)({ documentId: itemId }));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
renderingContext.addDependencyKey((0, text_cache_1.makeCacheDependencyKey)({ leafId }));
|
|
48
|
+
return translations;
|
|
49
|
+
}
|
|
50
|
+
exports.loadTranslationsAsDrops = loadTranslationsAsDrops;
|
|
51
|
+
async function getExistingLangsOf(siteContext, tracker, leafId) {
|
|
52
|
+
const documents = await siteContext.mainCn
|
|
53
|
+
.createQueryBuilder()
|
|
54
|
+
.select("s.lang", "lang")
|
|
55
|
+
.from("PaSection", "s")
|
|
56
|
+
.where("s.leafId = :leafId", { leafId })
|
|
57
|
+
.andWhere("s.ready = 1")
|
|
58
|
+
.getRawMany();
|
|
59
|
+
tracker.trackAccess(ddl_migration_1.dbSchemaName, "PaSection", "read");
|
|
60
|
+
return new Set(documents.map((item) => (0, data_formatters_lib_1.strVal)(item.lang)));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=translations.queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transl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AO,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,4BAAM,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.types.js","sourceRoot":"","sources":["../src/public.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Obj } from "@paroicms/anywhere-lib";
|
|
2
|
+
export interface AppLog {
|
|
3
|
+
error(...messages: any[]): void;
|
|
4
|
+
warn(...messages: any[]): void;
|
|
5
|
+
info(...messages: any[]): void;
|
|
6
|
+
debug(...messages: any[]): void;
|
|
7
|
+
trace(...messages: any[]): void;
|
|
8
|
+
stats(...messages: any[]): void;
|
|
9
|
+
}
|
|
10
|
+
export interface PlatformLog extends AppLog {
|
|
11
|
+
createChildLog(properties: Obj): AppLog;
|
|
12
|
+
on(level: AppLogLevel, listener: (ev: AppLogEvent) => void): void;
|
|
13
|
+
untilReady: Promise<void>;
|
|
14
|
+
flushSync(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface AppLogEvent {
|
|
17
|
+
level: AppLogLevel;
|
|
18
|
+
textMessage: string;
|
|
19
|
+
originalMessages: any[];
|
|
20
|
+
}
|
|
21
|
+
export type AppLogLevel = Exclude<keyof AppLog, "flushSync" | "untilReady" | "on">;
|
|
22
|
+
export interface AppLogOptions {
|
|
23
|
+
level: "silent" | AppLogLevel;
|
|
24
|
+
file?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function createPlatformLog({ file, level }: AppLogOptions): PlatformLog;
|
|
@@ -0,0 +1,138 @@
|
|
|
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.createPlatformLog = void 0;
|
|
7
|
+
const async_lib_1 = require("@paroi/async-lib");
|
|
8
|
+
const events_1 = require("events");
|
|
9
|
+
const pino_1 = __importDefault(require("pino"));
|
|
10
|
+
const levels = ["error", "warn", "info", "stats", "debug", "trace"];
|
|
11
|
+
const levelIndexes = new Map(levels.map((l, index) => [l, index]));
|
|
12
|
+
function createPlatformLog({ file, level }) {
|
|
13
|
+
const destination = pino_1.default.destination({
|
|
14
|
+
dest: file,
|
|
15
|
+
sync: false,
|
|
16
|
+
});
|
|
17
|
+
const emitter = new events_1.EventEmitter();
|
|
18
|
+
let ready = false;
|
|
19
|
+
const { promise: untilReady, resolve, reject } = (0, async_lib_1.promiseToHandle)();
|
|
20
|
+
destination.on("error", reject);
|
|
21
|
+
destination.on("ready", () => {
|
|
22
|
+
ready = true;
|
|
23
|
+
destination.off("error", reject);
|
|
24
|
+
destination.on("error", (error) => console.error("[Error in Pino]", error));
|
|
25
|
+
resolve();
|
|
26
|
+
});
|
|
27
|
+
let waitingMessages;
|
|
28
|
+
function makeLogFn(level) {
|
|
29
|
+
return (...messages) => {
|
|
30
|
+
const textMessage = messagesToString(messages);
|
|
31
|
+
if (ready)
|
|
32
|
+
logger[level](textMessage);
|
|
33
|
+
else {
|
|
34
|
+
if (!waitingMessages) {
|
|
35
|
+
waitingMessages = [];
|
|
36
|
+
console.warn("There is something to log before the logger is ready");
|
|
37
|
+
void untilReady.then(() => {
|
|
38
|
+
if (waitingMessages) {
|
|
39
|
+
if (file) {
|
|
40
|
+
waitingMessages.forEach((wMessages) => logger[level](messagesToString(wMessages)));
|
|
41
|
+
}
|
|
42
|
+
waitingMessages = undefined;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (level in console)
|
|
47
|
+
console[level](...messages);
|
|
48
|
+
else
|
|
49
|
+
console.log(...messages);
|
|
50
|
+
messages.unshift("[DELAYED]");
|
|
51
|
+
waitingMessages.push(messages);
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
emitAppLogEvent({
|
|
55
|
+
level,
|
|
56
|
+
textMessage,
|
|
57
|
+
originalMessages: messages,
|
|
58
|
+
}, emitter);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (ready)
|
|
62
|
+
logger.error(messagesToString(["Error in app log listener:", error]));
|
|
63
|
+
else
|
|
64
|
+
console.error("Error in app log listener:", error);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const logger = (0, pino_1.default)({
|
|
69
|
+
level,
|
|
70
|
+
customLevels: {
|
|
71
|
+
stats: 25,
|
|
72
|
+
},
|
|
73
|
+
}, destination);
|
|
74
|
+
console.log(`Application log with level '${level}' is in: ${file ?? "stdout"}.`);
|
|
75
|
+
function createChildLog(properties) {
|
|
76
|
+
return logger.child(properties);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
error: makeLogFn("error"),
|
|
80
|
+
warn: makeLogFn("warn"),
|
|
81
|
+
info: makeLogFn("info"),
|
|
82
|
+
debug: makeLogFn("debug"),
|
|
83
|
+
trace: makeLogFn("trace"),
|
|
84
|
+
stats: makeLogFn("stats"),
|
|
85
|
+
on: (level, listener) => emitter.on(`on-${level}`, listener),
|
|
86
|
+
untilReady,
|
|
87
|
+
flushSync() {
|
|
88
|
+
if (ready)
|
|
89
|
+
destination.flushSync();
|
|
90
|
+
else
|
|
91
|
+
console.warn("Flush is called before the logger is ready.");
|
|
92
|
+
},
|
|
93
|
+
createChildLog,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
exports.createPlatformLog = createPlatformLog;
|
|
97
|
+
function messagesToString(messages) {
|
|
98
|
+
return messages.map((msg) => messageToString(msg)).join(" ");
|
|
99
|
+
}
|
|
100
|
+
function messageToString(msg, parents = []) {
|
|
101
|
+
if (parents.includes(msg))
|
|
102
|
+
return "[recursive-ref]";
|
|
103
|
+
if (parents.length > 5)
|
|
104
|
+
return "[too-deep]";
|
|
105
|
+
switch (typeof msg) {
|
|
106
|
+
case "string":
|
|
107
|
+
return msg;
|
|
108
|
+
case "number":
|
|
109
|
+
case "bigint":
|
|
110
|
+
case "boolean":
|
|
111
|
+
case "undefined":
|
|
112
|
+
case "symbol":
|
|
113
|
+
return String(msg);
|
|
114
|
+
case "function":
|
|
115
|
+
return `[function ${msg.name}]`;
|
|
116
|
+
case "object":
|
|
117
|
+
if (msg === null)
|
|
118
|
+
return "null";
|
|
119
|
+
if (Array.isArray(msg))
|
|
120
|
+
return `[${msg.map((child) => messageToString(child, [...parents, msg])).join(",")}]`;
|
|
121
|
+
if (msg instanceof Error)
|
|
122
|
+
return msg.stack ?? `Error: ${msg.message ?? "-no-message-"}`;
|
|
123
|
+
return `{${Object.entries(msg)
|
|
124
|
+
.map(([key, child]) => `${key}: ${messageToString(child, [...parents, msg])}`)
|
|
125
|
+
.join(",")}}`;
|
|
126
|
+
default:
|
|
127
|
+
return `Unexpected message type: ${typeof msg}`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function emitAppLogEvent(ev, emitter) {
|
|
131
|
+
let index = levelIndexes.get(ev.level);
|
|
132
|
+
if (index === undefined)
|
|
133
|
+
throw new Error(`Invalid level '${ev.level}'`);
|
|
134
|
+
do {
|
|
135
|
+
emitter.emit(`on-${levels[index]}`, ev);
|
|
136
|
+
} while (++index < levels.length);
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=pino-app-log.js.map
|