@rnaga/wp-node 1.1.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/application.d.ts +76 -0
- package/application.d.ts.map +1 -0
- package/application.js +132 -0
- package/common/async-constructor.d.ts +2 -0
- package/common/async-constructor.d.ts.map +1 -0
- package/common/async-constructor.js +7 -0
- package/common/config/define-post-status.config.d.ts +4 -0
- package/common/config/define-post-status.config.d.ts.map +1 -0
- package/common/config/define-post-status.config.js +26 -0
- package/common/config/define-post-type.config.d.ts +4 -0
- package/common/config/define-post-type.config.d.ts.map +1 -0
- package/common/config/define-post-type.config.js +39 -0
- package/common/config/define-taxonomies.config.d.ts +4 -0
- package/common/config/define-taxonomies.config.d.ts.map +1 -0
- package/common/config/define-taxonomies.config.js +26 -0
- package/common/config/define-wp.config..d.ts +12 -0
- package/common/config/define-wp.config..d.ts.map +1 -0
- package/common/config/define-wp.config..js +110 -0
- package/common/config/index.d.ts +5 -0
- package/common/config/index.d.ts.map +1 -0
- package/common/config/index.js +20 -0
- package/common/date.d.ts +19 -0
- package/common/date.d.ts.map +1 -0
- package/common/date.js +116 -0
- package/common/define-hooks.d.ts +4 -0
- package/common/define-hooks.d.ts.map +1 -0
- package/common/define-hooks.js +16 -0
- package/common/diff.d.ts +3 -0
- package/common/diff.d.ts.map +1 -0
- package/common/diff.js +23 -0
- package/common/files.d.ts +14 -0
- package/common/files.d.ts.map +1 -0
- package/common/files.js +160 -0
- package/common/formatting.d.ts +47 -0
- package/common/formatting.d.ts.map +1 -0
- package/common/formatting.js +218 -0
- package/common/hierarchy.d.ts +21 -0
- package/common/hierarchy.d.ts.map +1 -0
- package/common/hierarchy.js +78 -0
- package/common/hooks-command.d.ts +7 -0
- package/common/hooks-command.d.ts.map +1 -0
- package/common/hooks-command.js +21 -0
- package/common/index.d.ts +11 -0
- package/common/index.d.ts.map +1 -0
- package/common/index.js +49 -0
- package/common/password.d.ts +4 -0
- package/common/password.d.ts.map +1 -0
- package/common/password.js +224 -0
- package/common/php-serialize.d.ts +3 -0
- package/common/php-serialize.d.ts.map +1 -0
- package/common/php-serialize.js +17 -0
- package/common/validating.d.ts +10 -0
- package/common/validating.d.ts.map +1 -0
- package/common/validating.js +65 -0
- package/config.d.ts +99 -0
- package/config.d.ts.map +1 -0
- package/config.js +76 -0
- package/constants/async-init.d.ts +2 -0
- package/constants/async-init.d.ts.map +1 -0
- package/constants/async-init.js +4 -0
- package/constants/component.d.ts +3 -0
- package/constants/component.d.ts.map +1 -0
- package/constants/component.js +5 -0
- package/constants/database.d.ts +2 -0
- package/constants/database.d.ts.map +1 -0
- package/constants/database.js +9 -0
- package/constants/default-database-tables.d.ts +7 -0
- package/constants/default-database-tables.d.ts.map +1 -0
- package/constants/default-database-tables.js +26 -0
- package/constants/index.d.ts +9 -0
- package/constants/index.d.ts.map +1 -0
- package/constants/index.js +24 -0
- package/constants/role-capabilities.d.ts +3 -0
- package/constants/role-capabilities.d.ts.map +1 -0
- package/constants/role-capabilities.js +67 -0
- package/constants/role-capability-actions.d.ts +2 -0
- package/constants/role-capability-actions.d.ts.map +1 -0
- package/constants/role-capability-actions.js +90 -0
- package/constants/role-names.d.ts +2 -0
- package/constants/role-names.d.ts.map +1 -0
- package/constants/role-names.js +12 -0
- package/constants/scope.d.ts +6 -0
- package/constants/scope.d.ts.map +1 -0
- package/constants/scope.js +9 -0
- package/core/async-init-reflect.d.ts +5 -0
- package/core/async-init-reflect.d.ts.map +1 -0
- package/core/async-init-reflect.js +18 -0
- package/core/blog.d.ts +20 -0
- package/core/blog.d.ts.map +1 -0
- package/core/blog.js +123 -0
- package/core/capabilities.d.ts +12 -0
- package/core/capabilities.d.ts.map +1 -0
- package/core/capabilities.js +625 -0
- package/core/comment.d.ts +111 -0
- package/core/comment.d.ts.map +1 -0
- package/core/comment.js +173 -0
- package/core/components.d.ts +13 -0
- package/core/components.d.ts.map +1 -0
- package/core/components.js +129 -0
- package/core/context.d.ts +38 -0
- package/core/context.d.ts.map +1 -0
- package/core/context.js +77 -0
- package/core/current.d.ts +33 -0
- package/core/current.d.ts.map +1 -0
- package/core/current.js +229 -0
- package/core/date-time.d.ts +18 -0
- package/core/date-time.d.ts.map +1 -0
- package/core/date-time.js +71 -0
- package/core/hooks/action.d.ts +16 -0
- package/core/hooks/action.d.ts.map +1 -0
- package/core/hooks/action.js +44 -0
- package/core/hooks/actions/init.d.ts +5 -0
- package/core/hooks/actions/init.d.ts.map +1 -0
- package/core/hooks/actions/init.js +28 -0
- package/core/hooks/default-hooks.d.ts +7 -0
- package/core/hooks/default-hooks.d.ts.map +1 -0
- package/core/hooks/default-hooks.js +19 -0
- package/core/hooks/filter.d.ts +12 -0
- package/core/hooks/filter.d.ts.map +1 -0
- package/core/hooks/filter.js +76 -0
- package/core/hooks/filters/capabilities.d.ts +16 -0
- package/core/hooks/filters/capabilities.d.ts.map +1 -0
- package/core/hooks/filters/capabilities.js +395 -0
- package/core/hooks/hooks-command.d.ts +9 -0
- package/core/hooks/hooks-command.d.ts.map +1 -0
- package/core/hooks/hooks-command.js +28 -0
- package/core/hooks/hooks-reflect.d.ts +42 -0
- package/core/hooks/hooks-reflect.d.ts.map +1 -0
- package/core/hooks/hooks-reflect.js +73 -0
- package/core/hooks/hooks.d.ts +61 -0
- package/core/hooks/hooks.d.ts.map +1 -0
- package/core/hooks/hooks.js +82 -0
- package/core/hooks/index.d.ts +4 -0
- package/core/hooks/index.d.ts.map +1 -0
- package/core/hooks/index.js +19 -0
- package/core/installer.d.ts +56 -0
- package/core/installer.d.ts.map +1 -0
- package/core/installer.js +395 -0
- package/core/logger.d.ts +22 -0
- package/core/logger.d.ts.map +1 -0
- package/core/logger.js +65 -0
- package/core/meta.d.ts +20 -0
- package/core/meta.d.ts.map +1 -0
- package/core/meta.js +123 -0
- package/core/options.d.ts +20 -0
- package/core/options.d.ts.map +1 -0
- package/core/options.js +148 -0
- package/core/post.d.ts +39 -0
- package/core/post.d.ts.map +1 -0
- package/core/post.js +164 -0
- package/core/query.d.ts +14 -0
- package/core/query.d.ts.map +1 -0
- package/core/query.js +39 -0
- package/core/role.d.ts +21 -0
- package/core/role.d.ts.map +1 -0
- package/core/role.js +71 -0
- package/core/roles.d.ts +16 -0
- package/core/roles.d.ts.map +1 -0
- package/core/roles.js +84 -0
- package/core/schema.d.ts +13 -0
- package/core/schema.d.ts.map +1 -0
- package/core/schema.js +83 -0
- package/core/site.d.ts +28 -0
- package/core/site.d.ts.map +1 -0
- package/core/site.js +105 -0
- package/core/tables.d.ts +18 -0
- package/core/tables.d.ts.map +1 -0
- package/core/tables.js +64 -0
- package/core/taxonomy.d.ts +23 -0
- package/core/taxonomy.d.ts.map +1 -0
- package/core/taxonomy.js +83 -0
- package/core/term.d.ts +104 -0
- package/core/term.d.ts.map +1 -0
- package/core/term.js +136 -0
- package/core/user.d.ts +32 -0
- package/core/user.d.ts.map +1 -0
- package/core/user.js +273 -0
- package/core/utils/blog.util.d.ts +14 -0
- package/core/utils/blog.util.d.ts.map +1 -0
- package/core/utils/blog.util.js +97 -0
- package/core/utils/comment.util.d.ts +23 -0
- package/core/utils/comment.util.d.ts.map +1 -0
- package/core/utils/comment.util.js +312 -0
- package/core/utils/crud.util.d.ts +40 -0
- package/core/utils/crud.util.d.ts.map +1 -0
- package/core/utils/crud.util.js +97 -0
- package/core/utils/date-time.util.d.ts +9 -0
- package/core/utils/date-time.util.d.ts.map +1 -0
- package/core/utils/date-time.util.js +29 -0
- package/core/utils/link.util.d.ts +23 -0
- package/core/utils/link.util.d.ts.map +1 -0
- package/core/utils/link.util.js +148 -0
- package/core/utils/meta.util.d.ts +13 -0
- package/core/utils/meta.util.d.ts.map +1 -0
- package/core/utils/meta.util.js +73 -0
- package/core/utils/post.util.d.ts +34 -0
- package/core/utils/post.util.d.ts.map +1 -0
- package/core/utils/post.util.js +272 -0
- package/core/utils/query.util.d.ts +36 -0
- package/core/utils/query.util.d.ts.map +1 -0
- package/core/utils/query.util.js +168 -0
- package/core/utils/revision.util.d.ts +67 -0
- package/core/utils/revision.util.d.ts.map +1 -0
- package/core/utils/revision.util.js +105 -0
- package/core/utils/roles.util.d.ts +30 -0
- package/core/utils/roles.util.d.ts.map +1 -0
- package/core/utils/roles.util.js +189 -0
- package/core/utils/signup.util.d.ts +33 -0
- package/core/utils/signup.util.d.ts.map +1 -0
- package/core/utils/signup.util.js +227 -0
- package/core/utils/site.util.d.ts +22 -0
- package/core/utils/site.util.d.ts.map +1 -0
- package/core/utils/site.util.js +122 -0
- package/core/utils/taxonomy.util.d.ts +19 -0
- package/core/utils/taxonomy.util.d.ts.map +1 -0
- package/core/utils/taxonomy.util.js +52 -0
- package/core/utils/term.util.d.ts +13 -0
- package/core/utils/term.util.d.ts.map +1 -0
- package/core/utils/term.util.js +113 -0
- package/core/utils/trx.util.d.ts +24 -0
- package/core/utils/trx.util.d.ts.map +1 -0
- package/core/utils/trx.util.js +86 -0
- package/core/utils/user-self-registration.util.d.ts +46 -0
- package/core/utils/user-self-registration.util.d.ts.map +1 -0
- package/core/utils/user-self-registration.util.js +171 -0
- package/core/utils/user.util.d.ts +153 -0
- package/core/utils/user.util.d.ts.map +1 -0
- package/core/utils/user.util.js +550 -0
- package/core/utils/utils.d.ts +36 -0
- package/core/utils/utils.d.ts.map +1 -0
- package/core/utils/utils.js +85 -0
- package/core/validator.d.ts +11 -0
- package/core/validator.d.ts.map +1 -0
- package/core/validator.js +40 -0
- package/core/vars.d.ts +19 -0
- package/core/vars.d.ts.map +1 -0
- package/core/vars.js +54 -0
- package/crud/blog.crud.d.ts +56 -0
- package/crud/blog.crud.d.ts.map +1 -0
- package/crud/blog.crud.js +301 -0
- package/crud/comment.crud.d.ts +104 -0
- package/crud/comment.crud.d.ts.map +1 -0
- package/crud/comment.crud.js +431 -0
- package/crud/crud.d.ts +63 -0
- package/crud/crud.d.ts.map +1 -0
- package/crud/crud.js +278 -0
- package/crud/error.d.ts +23 -0
- package/crud/error.d.ts.map +1 -0
- package/crud/error.js +51 -0
- package/crud/meta.crud.d.ts +69 -0
- package/crud/meta.crud.d.ts.map +1 -0
- package/crud/meta.crud.js +244 -0
- package/crud/options.crud.d.ts +37 -0
- package/crud/options.crud.d.ts.map +1 -0
- package/crud/options.crud.js +178 -0
- package/crud/post.crud.d.ts +225 -0
- package/crud/post.crud.d.ts.map +1 -0
- package/crud/post.crud.js +589 -0
- package/crud/revision.crud.d.ts +76 -0
- package/crud/revision.crud.d.ts.map +1 -0
- package/crud/revision.crud.js +155 -0
- package/crud/roles.crud.d.ts +50 -0
- package/crud/roles.crud.d.ts.map +1 -0
- package/crud/roles.crud.js +198 -0
- package/crud/settings.crud.d.ts +50 -0
- package/crud/settings.crud.d.ts.map +1 -0
- package/crud/settings.crud.js +153 -0
- package/crud/site.crud.d.ts +62 -0
- package/crud/site.crud.d.ts.map +1 -0
- package/crud/site.crud.js +241 -0
- package/crud/sitemeta.crud.d.ts +55 -0
- package/crud/sitemeta.crud.d.ts.map +1 -0
- package/crud/sitemeta.crud.js +97 -0
- package/crud/term.crud.d.ts +85 -0
- package/crud/term.crud.d.ts.map +1 -0
- package/crud/term.crud.js +285 -0
- package/crud/user-self-registration.crud.d.ts +57 -0
- package/crud/user-self-registration.crud.d.ts.map +1 -0
- package/crud/user-self-registration.crud.js +173 -0
- package/crud/user.crud.d.ts +147 -0
- package/crud/user.crud.d.ts.map +1 -0
- package/crud/user.crud.js +626 -0
- package/database.d.ts +18 -0
- package/database.d.ts.map +1 -0
- package/database.js +80 -0
- package/decorators/async-init.d.ts +2 -0
- package/decorators/async-init.d.ts.map +1 -0
- package/decorators/async-init.js +7 -0
- package/decorators/component.d.ts +12 -0
- package/decorators/component.d.ts.map +1 -0
- package/decorators/component.js +47 -0
- package/decorators/hooks.d.ts +5 -0
- package/decorators/hooks.d.ts.map +1 -0
- package/decorators/hooks.js +30 -0
- package/defaults/extensions.d.ts +4 -0
- package/defaults/extensions.d.ts.map +1 -0
- package/defaults/extensions.js +34 -0
- package/defaults/index.d.ts +11 -0
- package/defaults/index.d.ts.map +1 -0
- package/defaults/index.js +49 -0
- package/defaults/options.d.ts +6 -0
- package/defaults/options.d.ts.map +1 -0
- package/defaults/options.js +267 -0
- package/defaults/post-status.d.ts +10 -0
- package/defaults/post-status.d.ts.map +1 -0
- package/defaults/post-status.js +83 -0
- package/defaults/post-types.d.ts +4 -0
- package/defaults/post-types.d.ts.map +1 -0
- package/defaults/post-types.js +72 -0
- package/defaults/roles.d.ts +31 -0
- package/defaults/roles.d.ts.map +1 -0
- package/defaults/roles.js +213 -0
- package/defaults/seeder.d.ts +34 -0
- package/defaults/seeder.d.ts.map +1 -0
- package/defaults/seeder.js +201 -0
- package/defaults/sitemeta.d.ts +2 -0
- package/defaults/sitemeta.d.ts.map +1 -0
- package/defaults/sitemeta.js +38 -0
- package/defaults/subdirectory-reserved-names.d.ts +2 -0
- package/defaults/subdirectory-reserved-names.d.ts.map +1 -0
- package/defaults/subdirectory-reserved-names.js +16 -0
- package/defaults/taxonomies.d.ts +5 -0
- package/defaults/taxonomies.d.ts.map +1 -0
- package/defaults/taxonomies.js +57 -0
- package/defaults/timezone.d.ts +2 -0
- package/defaults/timezone.d.ts.map +1 -0
- package/defaults/timezone.js +353 -0
- package/package.json +51 -0
- package/query-builder/alias.d.ts +24 -0
- package/query-builder/alias.d.ts.map +1 -0
- package/query-builder/alias.js +64 -0
- package/query-builder/blogs.query.d.ts +22 -0
- package/query-builder/blogs.query.d.ts.map +1 -0
- package/query-builder/blogs.query.js +85 -0
- package/query-builder/comments.query.d.ts +35 -0
- package/query-builder/comments.query.d.ts.map +1 -0
- package/query-builder/comments.query.js +211 -0
- package/query-builder/common.query.d.ts +18 -0
- package/query-builder/common.query.d.ts.map +1 -0
- package/query-builder/common.query.js +58 -0
- package/query-builder/index.d.ts +12 -0
- package/query-builder/index.d.ts.map +1 -0
- package/query-builder/index.js +27 -0
- package/query-builder/meta.query.d.ts +45 -0
- package/query-builder/meta.query.d.ts.map +1 -0
- package/query-builder/meta.query.js +188 -0
- package/query-builder/options.query.d.ts +19 -0
- package/query-builder/options.query.d.ts.map +1 -0
- package/query-builder/options.query.js +57 -0
- package/query-builder/posts.query.d.ts +30 -0
- package/query-builder/posts.query.d.ts.map +1 -0
- package/query-builder/posts.query.js +208 -0
- package/query-builder/query-builder.d.ts +21 -0
- package/query-builder/query-builder.d.ts.map +1 -0
- package/query-builder/query-builder.js +70 -0
- package/query-builder/query-builders.d.ts +18 -0
- package/query-builder/query-builders.d.ts.map +1 -0
- package/query-builder/query-builders.js +64 -0
- package/query-builder/site.query.d.ts +22 -0
- package/query-builder/site.query.d.ts.map +1 -0
- package/query-builder/site.query.js +85 -0
- package/query-builder/terms.query.d.ts +47 -0
- package/query-builder/terms.query.d.ts.map +1 -0
- package/query-builder/terms.query.js +233 -0
- package/query-builder/users.query.d.ts +37 -0
- package/query-builder/users.query.d.ts.map +1 -0
- package/query-builder/users.query.js +188 -0
- package/schema-builder/proxy.d.ts +10 -0
- package/schema-builder/proxy.d.ts.map +1 -0
- package/schema-builder/proxy.js +19 -0
- package/schema-builder/schema-builder.d.ts +21 -0
- package/schema-builder/schema-builder.d.ts.map +1 -0
- package/schema-builder/schema-builder.js +207 -0
- package/schema-builder/schema.d.ts +20 -0
- package/schema-builder/schema.d.ts.map +1 -0
- package/schema-builder/schema.js +527 -0
- package/transactions/blog.trx.d.ts +37 -0
- package/transactions/blog.trx.d.ts.map +1 -0
- package/transactions/blog.trx.js +296 -0
- package/transactions/comment.trx.d.ts +22 -0
- package/transactions/comment.trx.d.ts.map +1 -0
- package/transactions/comment.trx.js +311 -0
- package/transactions/index.d.ts +15 -0
- package/transactions/index.d.ts.map +1 -0
- package/transactions/index.js +30 -0
- package/transactions/link.trx.d.ts +22 -0
- package/transactions/link.trx.d.ts.map +1 -0
- package/transactions/link.trx.js +208 -0
- package/transactions/meta.trx.d.ts +30 -0
- package/transactions/meta.trx.d.ts.map +1 -0
- package/transactions/meta.trx.js +197 -0
- package/transactions/options.trx.d.ts +31 -0
- package/transactions/options.trx.d.ts.map +1 -0
- package/transactions/options.trx.js +192 -0
- package/transactions/post.trx.d.ts +48 -0
- package/transactions/post.trx.d.ts.map +1 -0
- package/transactions/post.trx.js +906 -0
- package/transactions/registration-log.trx.d.ts +14 -0
- package/transactions/registration-log.trx.d.ts.map +1 -0
- package/transactions/registration-log.trx.js +103 -0
- package/transactions/revision.trx.d.ts +32 -0
- package/transactions/revision.trx.d.ts.map +1 -0
- package/transactions/revision.trx.js +278 -0
- package/transactions/roles.trx.d.ts +20 -0
- package/transactions/roles.trx.d.ts.map +1 -0
- package/transactions/roles.trx.js +144 -0
- package/transactions/seeder.trx.d.ts +43 -0
- package/transactions/seeder.trx.d.ts.map +1 -0
- package/transactions/seeder.trx.js +530 -0
- package/transactions/signup.trx.d.ts +53 -0
- package/transactions/signup.trx.d.ts.map +1 -0
- package/transactions/signup.trx.js +305 -0
- package/transactions/site.trx.d.ts +21 -0
- package/transactions/site.trx.d.ts.map +1 -0
- package/transactions/site.trx.js +167 -0
- package/transactions/term.trx.d.ts +51 -0
- package/transactions/term.trx.d.ts.map +1 -0
- package/transactions/term.trx.js +838 -0
- package/transactions/trx.d.ts +9 -0
- package/transactions/trx.d.ts.map +1 -0
- package/transactions/trx.js +20 -0
- package/transactions/user.trx.d.ts +45 -0
- package/transactions/user.trx.d.ts.map +1 -0
- package/transactions/user.trx.js +535 -0
- package/types/capabilities.d.ts +71 -0
- package/types/common.d.ts +16 -0
- package/types/component.d.ts +3 -0
- package/types/config.d.ts +33 -0
- package/types/crud.d.ts +230 -0
- package/types/database.d.ts +50 -0
- package/types/hooks/actions.d.ts +67 -0
- package/types/hooks/command.d.ts +17 -0
- package/types/hooks/filters.d.ts +86 -0
- package/types/hooks/index.d.ts +11 -0
- package/types/index.d.ts +18 -0
- package/types/logging.d.ts +1 -0
- package/types/meta.d.ts +9 -0
- package/types/options.d.ts +3 -0
- package/types/post.d.ts +54 -0
- package/types/query-builder.d.ts +11 -0
- package/types/role.d.ts +34 -0
- package/types/schema.d.ts +11 -0
- package/types/schema.d.ts.map +1 -0
- package/types/schema.js +2 -0
- package/types/taxonomy.d.ts +29 -0
- package/types/timezone.d.ts +3 -0
- package/types/transactions.d.ts +32 -0
- package/types/user.d.ts +12 -0
- package/types/validating.d.ts +9 -0
- package/types/validating.d.ts.map +1 -0
- package/types/validating.js +2 -0
- package/validators/config.d.ts +948 -0
- package/validators/config.d.ts.map +1 -0
- package/validators/config.js +149 -0
- package/validators/crud.d.ts +571 -0
- package/validators/crud.d.ts.map +1 -0
- package/validators/crud.js +281 -0
- package/validators/database.d.ts +958 -0
- package/validators/database.d.ts.map +1 -0
- package/validators/database.js +245 -0
- package/validators/date.d.ts +4 -0
- package/validators/date.d.ts.map +1 -0
- package/validators/date.js +15 -0
- package/validators/helpers.d.ts +16 -0
- package/validators/helpers.d.ts.map +1 -0
- package/validators/helpers.js +86 -0
- package/validators/index.d.ts +10 -0
- package/validators/index.d.ts.map +1 -0
- package/validators/index.js +48 -0
- package/validators/options.d.ts +303 -0
- package/validators/options.d.ts.map +1 -0
- package/validators/options.js +106 -0
- package/validators/post-status.d.ts +42 -0
- package/validators/post-status.d.ts.map +1 -0
- package/validators/post-status.js +18 -0
- package/validators/query.d.ts +534 -0
- package/validators/query.d.ts.map +1 -0
- package/validators/query.js +110 -0
- package/validators/roles.d.ts +22 -0
- package/validators/roles.d.ts.map +1 -0
- package/validators/roles.js +9 -0
- package/validators/sitemeta.d.ts +105 -0
- package/validators/sitemeta.d.ts.map +1 -0
- package/validators/sitemeta.js +39 -0
- package/validators/transactions/blog.d.ts +225 -0
- package/validators/transactions/blog.d.ts.map +1 -0
- package/validators/transactions/blog.js +63 -0
- package/validators/transactions/comment.d.ts +155 -0
- package/validators/transactions/comment.d.ts.map +1 -0
- package/validators/transactions/comment.js +68 -0
- package/validators/transactions/index.d.ts +11 -0
- package/validators/transactions/index.d.ts.map +1 -0
- package/validators/transactions/index.js +26 -0
- package/validators/transactions/link.d.ts +128 -0
- package/validators/transactions/link.d.ts.map +1 -0
- package/validators/transactions/link.js +60 -0
- package/validators/transactions/meta.d.ts +23 -0
- package/validators/transactions/meta.d.ts.map +1 -0
- package/validators/transactions/meta.js +18 -0
- package/validators/transactions/post.d.ts +234 -0
- package/validators/transactions/post.d.ts.map +1 -0
- package/validators/transactions/post.js +100 -0
- package/validators/transactions/roles.d.ts +18 -0
- package/validators/transactions/roles.d.ts.map +1 -0
- package/validators/transactions/roles.js +13 -0
- package/validators/transactions/signup.d.ts +35 -0
- package/validators/transactions/signup.d.ts.map +1 -0
- package/validators/transactions/signup.js +51 -0
- package/validators/transactions/site.d.ts +36 -0
- package/validators/transactions/site.d.ts.map +1 -0
- package/validators/transactions/site.js +49 -0
- package/validators/transactions/term.d.ts +57 -0
- package/validators/transactions/term.d.ts.map +1 -0
- package/validators/transactions/term.js +44 -0
- package/validators/transactions/user.d.ts +182 -0
- package/validators/transactions/user.d.ts.map +1 -0
- package/validators/transactions/user.js +104 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Meta } from "./meta";
|
|
2
|
+
import { QueryUtil } from "./utils/query.util";
|
|
3
|
+
import type * as types from "../types";
|
|
4
|
+
import { Logger } from "./logger";
|
|
5
|
+
export declare class Comment {
|
|
6
|
+
meta: Meta;
|
|
7
|
+
private logger;
|
|
8
|
+
private queryUtil;
|
|
9
|
+
private commentId;
|
|
10
|
+
private _props;
|
|
11
|
+
constructor(meta: Meta, logger: Logger, queryUtil: QueryUtil, commentId: number, _props: types.Tables["comments"]);
|
|
12
|
+
get props(): types.WpComments | undefined;
|
|
13
|
+
withProps(props: Partial<types.Tables["comments"]>): this;
|
|
14
|
+
post(): Promise<{
|
|
15
|
+
ID: number;
|
|
16
|
+
post_author: number;
|
|
17
|
+
post_content: string;
|
|
18
|
+
post_title: string;
|
|
19
|
+
post_excerpt: string;
|
|
20
|
+
post_status: string;
|
|
21
|
+
comment_status: string;
|
|
22
|
+
ping_status: string;
|
|
23
|
+
post_password: string;
|
|
24
|
+
post_name: string;
|
|
25
|
+
to_ping: string;
|
|
26
|
+
pinged: string;
|
|
27
|
+
post_content_filtered: string;
|
|
28
|
+
post_parent: number;
|
|
29
|
+
guid: string;
|
|
30
|
+
menu_order: number;
|
|
31
|
+
post_type: string;
|
|
32
|
+
post_mime_type: string;
|
|
33
|
+
comment_count: number;
|
|
34
|
+
post_date?: string | undefined;
|
|
35
|
+
post_date_gmt?: string | undefined;
|
|
36
|
+
post_modified?: string | undefined;
|
|
37
|
+
post_modified_gmt?: string | undefined;
|
|
38
|
+
} | undefined>;
|
|
39
|
+
user(): Promise<{
|
|
40
|
+
spam: number;
|
|
41
|
+
deleted: number;
|
|
42
|
+
ID: number;
|
|
43
|
+
user_login: string;
|
|
44
|
+
user_email: string;
|
|
45
|
+
user_pass: string;
|
|
46
|
+
user_nicename: string;
|
|
47
|
+
user_activation_key: string;
|
|
48
|
+
user_status: number;
|
|
49
|
+
display_name: string;
|
|
50
|
+
user_url?: string | undefined;
|
|
51
|
+
user_registered?: string | undefined;
|
|
52
|
+
} | undefined>;
|
|
53
|
+
parent(): Promise<{
|
|
54
|
+
comment_ID: number;
|
|
55
|
+
comment_post_ID: number;
|
|
56
|
+
comment_author: string;
|
|
57
|
+
comment_content: string;
|
|
58
|
+
comment_karma: number;
|
|
59
|
+
comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
|
|
60
|
+
comment_agent: string;
|
|
61
|
+
comment_type: string;
|
|
62
|
+
comment_parent: number;
|
|
63
|
+
user_id: number;
|
|
64
|
+
comment_author_email?: string | undefined;
|
|
65
|
+
comment_author_url?: string | undefined;
|
|
66
|
+
comment_author_IP?: string | undefined;
|
|
67
|
+
comment_date?: string | undefined;
|
|
68
|
+
comment_date_gmt?: string | undefined;
|
|
69
|
+
display_name?: string | undefined;
|
|
70
|
+
} | undefined>;
|
|
71
|
+
children(limit?: number): Promise<[{
|
|
72
|
+
comment_ID: number;
|
|
73
|
+
comment_post_ID: number;
|
|
74
|
+
comment_author: string;
|
|
75
|
+
comment_content: string;
|
|
76
|
+
comment_karma: number;
|
|
77
|
+
comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
|
|
78
|
+
comment_agent: string;
|
|
79
|
+
comment_type: string;
|
|
80
|
+
comment_parent: number;
|
|
81
|
+
user_id: number;
|
|
82
|
+
depth: number;
|
|
83
|
+
comment_author_email?: string | undefined;
|
|
84
|
+
comment_author_url?: string | undefined;
|
|
85
|
+
comment_author_IP?: string | undefined;
|
|
86
|
+
comment_date?: string | undefined;
|
|
87
|
+
comment_date_gmt?: string | undefined;
|
|
88
|
+
display_name?: string | undefined;
|
|
89
|
+
}, ...{
|
|
90
|
+
comment_ID: number;
|
|
91
|
+
comment_post_ID: number;
|
|
92
|
+
comment_author: string;
|
|
93
|
+
comment_content: string;
|
|
94
|
+
comment_karma: number;
|
|
95
|
+
comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
|
|
96
|
+
comment_agent: string;
|
|
97
|
+
comment_type: string;
|
|
98
|
+
comment_parent: number;
|
|
99
|
+
user_id: number;
|
|
100
|
+
depth: number;
|
|
101
|
+
comment_author_email?: string | undefined;
|
|
102
|
+
comment_author_url?: string | undefined;
|
|
103
|
+
comment_author_IP?: string | undefined;
|
|
104
|
+
comment_date?: string | undefined;
|
|
105
|
+
comment_date_gmt?: string | undefined;
|
|
106
|
+
display_name?: string | undefined;
|
|
107
|
+
}[]] | undefined>;
|
|
108
|
+
countChildren(): Promise<number | undefined>;
|
|
109
|
+
private init;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=comment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/core/comment.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBACa,OAAO;IAET,IAAI,EAAE,IAAI;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;gBAJP,IAAI,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;IAK1C,IAAI,KAAK,iCAER;IAED,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAK5C,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;IAUJ,IAAI;;;;;;;;;;;;;;IAWJ,MAAM;;;;;;;;;;;;;;;;;;IA0BN,QAAQ,CAAC,KAAK,GAAE,MAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6B3B,aAAa;YA0BL,IAAI;CAenB"}
|
package/core/comment.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.Comment = void 0;
|
|
46
|
+
const zod_1 = require("zod");
|
|
47
|
+
const constants_1 = require("../constants/");
|
|
48
|
+
const async_init_1 = require("../decorators/async-init");
|
|
49
|
+
const component_1 = require("../decorators/component");
|
|
50
|
+
const val = __importStar(require("../validators"));
|
|
51
|
+
const helpers_1 = require("../validators/helpers");
|
|
52
|
+
const meta_1 = require("./meta");
|
|
53
|
+
const query_util_1 = require("./utils/query.util");
|
|
54
|
+
const logger_1 = require("./logger");
|
|
55
|
+
let Comment = class Comment {
|
|
56
|
+
meta;
|
|
57
|
+
logger;
|
|
58
|
+
queryUtil;
|
|
59
|
+
commentId;
|
|
60
|
+
_props;
|
|
61
|
+
constructor(meta, logger, queryUtil, commentId, _props) {
|
|
62
|
+
this.meta = meta;
|
|
63
|
+
this.logger = logger;
|
|
64
|
+
this.queryUtil = queryUtil;
|
|
65
|
+
this.commentId = commentId;
|
|
66
|
+
this._props = _props;
|
|
67
|
+
this.meta.set("comment", commentId);
|
|
68
|
+
}
|
|
69
|
+
get props() {
|
|
70
|
+
return !this._props ? undefined : this._props;
|
|
71
|
+
}
|
|
72
|
+
withProps(props) {
|
|
73
|
+
this._props = { ...this._props, ...props };
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
async post() {
|
|
77
|
+
if (!this.props?.comment_post_ID) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const postId = this.props?.comment_post_ID;
|
|
81
|
+
return await this.queryUtil.posts((query) => {
|
|
82
|
+
query.where("ID", postId).builder.first();
|
|
83
|
+
}, val.database.wpPosts);
|
|
84
|
+
}
|
|
85
|
+
async user() {
|
|
86
|
+
if (!this.props?.user_id) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const userId = this.props.user_id;
|
|
90
|
+
return await this.queryUtil.users((query) => {
|
|
91
|
+
query.where("ID", userId).builder.first();
|
|
92
|
+
}, val.database.wpUsers);
|
|
93
|
+
}
|
|
94
|
+
async parent() {
|
|
95
|
+
if (!this.props?.comment_parent) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const commentParentId = this.props?.comment_parent;
|
|
99
|
+
const results = await this.queryUtil.comments((query) => {
|
|
100
|
+
query
|
|
101
|
+
.where("ID", commentParentId)
|
|
102
|
+
.withUsers([], "left")
|
|
103
|
+
.select(["*", "user_display_name"])
|
|
104
|
+
.builder.first();
|
|
105
|
+
}, val.database.wpComments.merge(zod_1.z.object({
|
|
106
|
+
display_name: val.database.wpUsers.shape.display_name
|
|
107
|
+
.nullable()
|
|
108
|
+
.transform(helpers_1.undefinedIfEmptyString),
|
|
109
|
+
})));
|
|
110
|
+
return results;
|
|
111
|
+
}
|
|
112
|
+
async children(limit = 99) {
|
|
113
|
+
if (!this.props?.comment_ID) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
const commentParentId = this.props?.comment_ID;
|
|
117
|
+
return await this.queryUtil.comments((query) => {
|
|
118
|
+
query
|
|
119
|
+
.withChildren("comment_parent", [commentParentId], limit)
|
|
120
|
+
.withUsers([], "left")
|
|
121
|
+
.select(["*", "parent", "user_display_name"]);
|
|
122
|
+
}, zod_1.z
|
|
123
|
+
.array(val.query.schemaDepth.merge(val.database.wpComments.merge(zod_1.z.object({
|
|
124
|
+
display_name: val.database.wpUsers.shape.display_name
|
|
125
|
+
.nullable()
|
|
126
|
+
.transform(helpers_1.undefinedIfEmptyString),
|
|
127
|
+
}))))
|
|
128
|
+
.nonempty());
|
|
129
|
+
}
|
|
130
|
+
async countChildren() {
|
|
131
|
+
if (!this.props?.comment_ID) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
const commentParentId = this.props?.comment_ID;
|
|
135
|
+
const result = await this.queryUtil.comments((query) => {
|
|
136
|
+
query
|
|
137
|
+
.withChildren("comment_parent", [commentParentId], 0)
|
|
138
|
+
.builder.count(`* as count`);
|
|
139
|
+
}, zod_1.z.array(zod_1.z.object({
|
|
140
|
+
count: zod_1.z.number(),
|
|
141
|
+
depth: zod_1.z.number(),
|
|
142
|
+
})));
|
|
143
|
+
return !result
|
|
144
|
+
? 0
|
|
145
|
+
: result?.reduce((count, comment) => count + comment.count, 0);
|
|
146
|
+
}
|
|
147
|
+
async init() {
|
|
148
|
+
if (!this.commentId) {
|
|
149
|
+
throw new Error("comment Id not defined");
|
|
150
|
+
}
|
|
151
|
+
const comment = await this.queryUtil.comments((query) => {
|
|
152
|
+
query.get(this.commentId);
|
|
153
|
+
}, val.database.wpComments);
|
|
154
|
+
if (!comment) {
|
|
155
|
+
this.logger.info(`Comment not found: ${this.commentId}`);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this._props = comment;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
exports.Comment = Comment;
|
|
162
|
+
__decorate([
|
|
163
|
+
async_init_1.asyncInit,
|
|
164
|
+
__metadata("design:type", Function),
|
|
165
|
+
__metadata("design:paramtypes", []),
|
|
166
|
+
__metadata("design:returntype", Promise)
|
|
167
|
+
], Comment.prototype, "init", null);
|
|
168
|
+
exports.Comment = Comment = __decorate([
|
|
169
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
170
|
+
__metadata("design:paramtypes", [meta_1.Meta,
|
|
171
|
+
logger_1.Logger,
|
|
172
|
+
query_util_1.QueryUtil, Number, Object])
|
|
173
|
+
], Comment);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Constructor } from "../types/common";
|
|
2
|
+
export declare class Components {
|
|
3
|
+
private env;
|
|
4
|
+
private static globalInstanceMap;
|
|
5
|
+
private instanceMap;
|
|
6
|
+
constructor(env?: string);
|
|
7
|
+
register(target: any, instance: any): void;
|
|
8
|
+
asyncGetWithArgs<T>(target: Constructor<T>, ...args: Array<any>): Promise<T>;
|
|
9
|
+
getWithArgs<T>(target: Constructor<T>, ...args: Array<any>): T;
|
|
10
|
+
asyncGet<T>(target: Constructor<T>, constructorArgs?: Array<any>, args?: Record<string, any>): Promise<T>;
|
|
11
|
+
get<T>(target: Constructor<T>, constructorArgs?: Array<any>, args?: Record<string, any>): T;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/core/components.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,qBACa,UAAU;IAIT,OAAO,CAAC,GAAG;IAHvB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAyC;IACzE,OAAO,CAAC,WAAW,CAAoC;gBAEnC,GAAG,GAAE,MAAkB;IAO3C,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAY7B,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAIrE,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAIpD,QAAQ,CAAC,CAAC,EACd,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,eAAe,GAAE,KAAK,CAAC,GAAG,CAAM,EAChC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC7B,OAAO,CAAC,CAAC,CAAC;IAYb,GAAG,CAAC,CAAC,EACH,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,eAAe,GAAE,KAAK,CAAC,GAAG,CAAM,EAChC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC7B,CAAC;CA4FL"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var Components_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Components = void 0;
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
const scope_1 = require("../constants/scope");
|
|
16
|
+
const component_1 = require("../decorators/component");
|
|
17
|
+
const async_init_reflect_1 = require("./async-init-reflect");
|
|
18
|
+
let Components = class Components {
|
|
19
|
+
static { Components_1 = this; }
|
|
20
|
+
env;
|
|
21
|
+
static globalInstanceMap = {};
|
|
22
|
+
instanceMap = new WeakMap();
|
|
23
|
+
constructor(env = "default") {
|
|
24
|
+
this.env = env;
|
|
25
|
+
if (!Components_1.globalInstanceMap[env]) {
|
|
26
|
+
Components_1.globalInstanceMap[env] = new WeakMap();
|
|
27
|
+
}
|
|
28
|
+
this.register(Components_1, this);
|
|
29
|
+
}
|
|
30
|
+
register(target, instance) {
|
|
31
|
+
if (!instance?.__scope) {
|
|
32
|
+
instance.__scope =
|
|
33
|
+
Reflect.getMetadata(constants_1.REFLECT_METADATA_KEY_COMPONENT, target)?.scope ??
|
|
34
|
+
scope_1.Scope.Context;
|
|
35
|
+
}
|
|
36
|
+
instance.__scope === scope_1.Scope.Context
|
|
37
|
+
? this.instanceMap.set(target, instance)
|
|
38
|
+
: Components_1.globalInstanceMap[this.env].set(target, instance);
|
|
39
|
+
}
|
|
40
|
+
async asyncGetWithArgs(target, ...args) {
|
|
41
|
+
return this.asyncGet(target, args);
|
|
42
|
+
}
|
|
43
|
+
getWithArgs(target, ...args) {
|
|
44
|
+
return this.get(target, args);
|
|
45
|
+
}
|
|
46
|
+
async asyncGet(target, constructorArgs = [], args = {}) {
|
|
47
|
+
const instance = this.get(target, constructorArgs, args);
|
|
48
|
+
const asyncInit = async_init_reflect_1.AsyncInitReflect.get(instance, target);
|
|
49
|
+
if (!asyncInit) {
|
|
50
|
+
return new Promise((ok) => ok(instance));
|
|
51
|
+
}
|
|
52
|
+
return asyncInit.then(() => instance);
|
|
53
|
+
}
|
|
54
|
+
get(target, constructorArgs = [], args = {}) {
|
|
55
|
+
if (!target) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
let componentsOptions = Reflect.getMetadata(constants_1.REFLECT_METADATA_KEY_COMPONENT, target) ?? {};
|
|
59
|
+
args = {
|
|
60
|
+
failFast: false,
|
|
61
|
+
forceToInstantiate: false,
|
|
62
|
+
instantiatedByQueryBuilders: false,
|
|
63
|
+
...args,
|
|
64
|
+
depth: args?.depth ?? 0,
|
|
65
|
+
};
|
|
66
|
+
if (!args.refList) {
|
|
67
|
+
args.refList = new WeakMap();
|
|
68
|
+
}
|
|
69
|
+
componentsOptions = {
|
|
70
|
+
scope: scope_1.Scope.Context,
|
|
71
|
+
injectable: false,
|
|
72
|
+
...componentsOptions,
|
|
73
|
+
};
|
|
74
|
+
if (!componentsOptions.injectable) {
|
|
75
|
+
if (!args.failFast) {
|
|
76
|
+
throw new Error(`Target not found`);
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
let instance;
|
|
81
|
+
const instanceMap = (() => {
|
|
82
|
+
if (scope_1.Scope.Transient === componentsOptions.scope) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return scope_1.Scope.Singleton === componentsOptions.scope
|
|
86
|
+
? Components_1.globalInstanceMap[this.env]
|
|
87
|
+
: this.instanceMap;
|
|
88
|
+
})();
|
|
89
|
+
if (instanceMap) {
|
|
90
|
+
instance = instanceMap.get(target);
|
|
91
|
+
if (instance && !args.forceToInstantiate) {
|
|
92
|
+
return instance;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const dependencies = Reflect.getMetadata("design:paramtypes", target) || [];
|
|
96
|
+
const instances = [];
|
|
97
|
+
const argsPassedByDecorator = Reflect.getMetadata(constants_1.REFLECT_METADATA_KEY_COMPONENT_ARGUMENTS, target);
|
|
98
|
+
for (const [index, dep] of dependencies.entries()) {
|
|
99
|
+
const refTarget = args.refList.get(dep);
|
|
100
|
+
if (refTarget) {
|
|
101
|
+
instances.push(refTarget);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
instances.push(this.get(dep, argsPassedByDecorator?.get(index) ?? [], {
|
|
105
|
+
failFast: true,
|
|
106
|
+
depth: args.depth + 1,
|
|
107
|
+
refList: args.refList,
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
instance = new target(...[
|
|
112
|
+
...instances.filter((i) => typeof i !== "undefined"),
|
|
113
|
+
...constructorArgs,
|
|
114
|
+
]);
|
|
115
|
+
if ("queryBuilder" === componentsOptions.componentType) {
|
|
116
|
+
if (args.depth > 0) {
|
|
117
|
+
throw Error("Can't inject query builder in query builder");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
instance.__scope = componentsOptions;
|
|
121
|
+
instanceMap?.set(target, instance);
|
|
122
|
+
return instance;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
exports.Components = Components;
|
|
126
|
+
exports.Components = Components = Components_1 = __decorate([
|
|
127
|
+
(0, component_1.component)(),
|
|
128
|
+
__metadata("design:paramtypes", [String])
|
|
129
|
+
], Components);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Config } from "../config";
|
|
2
|
+
import { Components } from "./components";
|
|
3
|
+
import { Current } from "./current";
|
|
4
|
+
import { Hooks } from "./hooks/hooks";
|
|
5
|
+
import { Options } from "./options";
|
|
6
|
+
import { Roles } from "./roles";
|
|
7
|
+
import { Utils } from "./utils/utils";
|
|
8
|
+
import { Vars } from "./vars";
|
|
9
|
+
import { Logger } from "./logger";
|
|
10
|
+
import type * as types from "../types/";
|
|
11
|
+
export declare class Context {
|
|
12
|
+
#private;
|
|
13
|
+
readonly args: {
|
|
14
|
+
env: string;
|
|
15
|
+
hooks: Hooks;
|
|
16
|
+
};
|
|
17
|
+
readonly config: Config;
|
|
18
|
+
hooks: Hooks;
|
|
19
|
+
current: Current;
|
|
20
|
+
roles: Roles;
|
|
21
|
+
utils: Utils;
|
|
22
|
+
vars: Vars;
|
|
23
|
+
options: Options;
|
|
24
|
+
logger: Logger;
|
|
25
|
+
constructor(config: types.Config, args: {
|
|
26
|
+
env: string;
|
|
27
|
+
hooks: Hooks;
|
|
28
|
+
});
|
|
29
|
+
get components(): Components;
|
|
30
|
+
get env(): string;
|
|
31
|
+
clone(): Promise<Context>;
|
|
32
|
+
static getInstance(config: types.Config, args: {
|
|
33
|
+
env: string;
|
|
34
|
+
hooks: Hooks;
|
|
35
|
+
installing?: boolean;
|
|
36
|
+
}): Promise<Context>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,KAAK,KAAK,KAAK,MAAM,WAAW,CAAC;AAExC,qBAAa,OAAO;;aAcA,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE;IAbrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;gBAKb,MAAM,EAAE,KAAK,CAAC,MAAM,EACJ,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE;IAerD,IAAI,UAAU,eAEb;IAED,IAAI,GAAG,WAEN;IAEK,KAAK;WAOE,WAAW,CACtB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE;CAmC5D"}
|
package/core/context.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Context = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const components_1 = require("./components");
|
|
6
|
+
const current_1 = require("./current");
|
|
7
|
+
const options_1 = require("./options");
|
|
8
|
+
const roles_1 = require("./roles");
|
|
9
|
+
const utils_1 = require("./utils/utils");
|
|
10
|
+
const vars_1 = require("./vars");
|
|
11
|
+
const logger_1 = require("./logger");
|
|
12
|
+
class Context {
|
|
13
|
+
args;
|
|
14
|
+
config;
|
|
15
|
+
hooks;
|
|
16
|
+
current;
|
|
17
|
+
roles;
|
|
18
|
+
utils;
|
|
19
|
+
vars;
|
|
20
|
+
options;
|
|
21
|
+
logger;
|
|
22
|
+
#components;
|
|
23
|
+
constructor(config, args) {
|
|
24
|
+
this.args = args;
|
|
25
|
+
this.#components = new components_1.Components(this.env);
|
|
26
|
+
this.config = this.#components.get(config_1.Config, [config]);
|
|
27
|
+
this.roles = this.#components.get(roles_1.Roles);
|
|
28
|
+
this.current = this.#components.get(current_1.Current);
|
|
29
|
+
this.utils = this.#components.get(utils_1.Utils);
|
|
30
|
+
this.options = this.#components.get(options_1.Options);
|
|
31
|
+
this.vars = this.#components.get(vars_1.Vars);
|
|
32
|
+
this.logger = this.#components.get(logger_1.Logger);
|
|
33
|
+
this.hooks = args.hooks;
|
|
34
|
+
}
|
|
35
|
+
get components() {
|
|
36
|
+
return this.#components;
|
|
37
|
+
}
|
|
38
|
+
get env() {
|
|
39
|
+
return this.args.env ?? "default";
|
|
40
|
+
}
|
|
41
|
+
async clone() {
|
|
42
|
+
return Context.getInstance(this.config.config, {
|
|
43
|
+
env: this.env,
|
|
44
|
+
hooks: this.hooks,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
static async getInstance(config, args) {
|
|
48
|
+
const { env, hooks, installing = false } = args;
|
|
49
|
+
const context = new Context(config, { env, hooks });
|
|
50
|
+
context.vars.CONTEXT = context;
|
|
51
|
+
context.hooks.action.do("core_init", context);
|
|
52
|
+
try {
|
|
53
|
+
if (config.multisite.enabled) {
|
|
54
|
+
await context.current.switchSite(config.multisite.defaultSiteId, config.multisite.defaultBlogId);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
await context.current.setUserRoles();
|
|
58
|
+
}
|
|
59
|
+
// Set current user and role as anonymous
|
|
60
|
+
await context.current.assumeUser();
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
// Roles are defined in DB and an error gets thrown if it doesn't exit.
|
|
64
|
+
// To be certain, set default roles.
|
|
65
|
+
context.current.setDefaultUserRoles();
|
|
66
|
+
// If installoing is enabled, then ignore the error.
|
|
67
|
+
// During installation, it's expected the error is thrown since the database is not yet setup.
|
|
68
|
+
!installing &&
|
|
69
|
+
console.warn(`Failed to initialize the Current component.`, e);
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await context.current.setTimezone();
|
|
73
|
+
}
|
|
74
|
+
return context;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.Context = Context;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Config } from "../config";
|
|
2
|
+
import { Components } from "./components";
|
|
3
|
+
import { Logger } from "./logger";
|
|
4
|
+
import { Post } from "./post";
|
|
5
|
+
import { Role } from "./role";
|
|
6
|
+
import { Site } from "./site";
|
|
7
|
+
import { Tables } from "./tables";
|
|
8
|
+
import { User } from "./user";
|
|
9
|
+
import { Vars } from "./vars";
|
|
10
|
+
export declare class Current {
|
|
11
|
+
#private;
|
|
12
|
+
private config;
|
|
13
|
+
private logger;
|
|
14
|
+
private components;
|
|
15
|
+
private vars;
|
|
16
|
+
constructor(config: Config, logger: Logger, components: Components, vars: Vars);
|
|
17
|
+
get blogId(): number;
|
|
18
|
+
get siteId(): number;
|
|
19
|
+
get post(): Post | undefined;
|
|
20
|
+
get user(): User | undefined;
|
|
21
|
+
get site(): Site | undefined;
|
|
22
|
+
get role(): Role | undefined;
|
|
23
|
+
get tables(): Tables;
|
|
24
|
+
setPost(id: number): Promise<void>;
|
|
25
|
+
assumeUser(userRefOrUser?: number | string | User): Promise<void>;
|
|
26
|
+
setTimezone(): Promise<void>;
|
|
27
|
+
setDefaultUserRoles(): void;
|
|
28
|
+
setUserRoles(): Promise<void>;
|
|
29
|
+
restorePrevious(): Promise<void>;
|
|
30
|
+
switchBlog(blogRef: number | string): Promise<void>;
|
|
31
|
+
switchSite(siteRef: number | string, blogRef?: number | string): Promise<this | undefined>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=current.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current.d.ts","sourceRoot":"","sources":["../../src/core/current.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,qBACa,OAAO;;IAahB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,IAAI;gBAHJ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI;IAOpB,IAAI,MAAM,WAKT;IAED,IAAI,MAAM,WAKT;IAED,IAAI,IAAI,qBAEP;IAED,IAAI,IAAI,qBAEP;IAED,IAAI,IAAI,qBAEP;IAED,IAAI,IAAI,qBAEP;IAED,IAAI,MAAM,WAET;IAEK,OAAO,CAAC,EAAE,EAAE,MAAM;IAIlB,UAAU,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAcjD,WAAW;IAkCjB,mBAAmB;IAIb,YAAY;IAQZ,eAAe;IAUf,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAqBnC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;CAgDrE"}
|