@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
package/core/term.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
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.Term = void 0;
|
|
46
|
+
const constants_1 = require("../constants");
|
|
47
|
+
const async_init_1 = require("../decorators/async-init");
|
|
48
|
+
const component_1 = require("../decorators/component");
|
|
49
|
+
const val = __importStar(require("../validators"));
|
|
50
|
+
const components_1 = require("./components");
|
|
51
|
+
const taxonomy_1 = require("./taxonomy");
|
|
52
|
+
const query_util_1 = require("./utils/query.util");
|
|
53
|
+
const meta_1 = require("./meta");
|
|
54
|
+
const logger_1 = require("./logger");
|
|
55
|
+
const schemaProps = val.database.wpTerms.merge(val.database.wpTermTaxonomy.merge(val.database.wpTermRelationships));
|
|
56
|
+
let Term = class Term {
|
|
57
|
+
meta;
|
|
58
|
+
logger;
|
|
59
|
+
components;
|
|
60
|
+
queryUtil;
|
|
61
|
+
termId;
|
|
62
|
+
_taxonomyName;
|
|
63
|
+
_props;
|
|
64
|
+
#taxonomy;
|
|
65
|
+
constructor(meta, logger, components, queryUtil, termId, _taxonomyName, _props) {
|
|
66
|
+
this.meta = meta;
|
|
67
|
+
this.logger = logger;
|
|
68
|
+
this.components = components;
|
|
69
|
+
this.queryUtil = queryUtil;
|
|
70
|
+
this.termId = termId;
|
|
71
|
+
this._taxonomyName = _taxonomyName;
|
|
72
|
+
this._props = _props;
|
|
73
|
+
this.meta.set("term", termId);
|
|
74
|
+
}
|
|
75
|
+
get taxonomyName() {
|
|
76
|
+
return !this._taxonomyName ? undefined : this._taxonomyName;
|
|
77
|
+
}
|
|
78
|
+
get taxonomy() {
|
|
79
|
+
return this.#taxonomy;
|
|
80
|
+
}
|
|
81
|
+
get props() {
|
|
82
|
+
return !this._props ? undefined : this._props;
|
|
83
|
+
}
|
|
84
|
+
async children() {
|
|
85
|
+
return await this.queryUtil.terms((query) => {
|
|
86
|
+
query.withChildren("parent", [this.termId]);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
setTaxonomy(taxonomy) {
|
|
90
|
+
this.#taxonomy = taxonomy;
|
|
91
|
+
this._taxonomyName = this.#taxonomy.name;
|
|
92
|
+
}
|
|
93
|
+
withProps(props) {
|
|
94
|
+
this._props = { ...this._props, ...props };
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
async init() {
|
|
98
|
+
if (!this._props) {
|
|
99
|
+
const term = await this.queryUtil.terms((query) => {
|
|
100
|
+
query.get(this.termId);
|
|
101
|
+
}, val.database.wpTerms.merge(val.database.wpTermTaxonomy)); //.merge(val.database.wpTermRelationships));
|
|
102
|
+
if (!term) {
|
|
103
|
+
this.logger.info(`Term not found: ${this.termId}`);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this._props = schemaProps.parse(term);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
if (!this._taxonomyName) {
|
|
111
|
+
this._taxonomyName =
|
|
112
|
+
this._props?.taxonomy ?? undefined;
|
|
113
|
+
}
|
|
114
|
+
this.#taxonomy = await this.components.asyncGet(taxonomy_1.Taxonomy, [
|
|
115
|
+
this._taxonomyName,
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
this.logger.info(`Taxonomy not found: ${this.termId}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
exports.Term = Term;
|
|
124
|
+
__decorate([
|
|
125
|
+
async_init_1.asyncInit,
|
|
126
|
+
__metadata("design:type", Function),
|
|
127
|
+
__metadata("design:paramtypes", []),
|
|
128
|
+
__metadata("design:returntype", Promise)
|
|
129
|
+
], Term.prototype, "init", null);
|
|
130
|
+
exports.Term = Term = __decorate([
|
|
131
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
132
|
+
__metadata("design:paramtypes", [meta_1.Meta,
|
|
133
|
+
logger_1.Logger,
|
|
134
|
+
components_1.Components,
|
|
135
|
+
query_util_1.QueryUtil, Number, Object, Object])
|
|
136
|
+
], Term);
|
package/core/user.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Config } from "../config";
|
|
2
|
+
import { Components } from "./components";
|
|
3
|
+
import { Logger } from "./logger";
|
|
4
|
+
import { Meta } from "./meta";
|
|
5
|
+
import { Role } from "./role";
|
|
6
|
+
import { QueryUtil } from "./utils/query.util";
|
|
7
|
+
import type * as types from "../types";
|
|
8
|
+
export declare class User {
|
|
9
|
+
meta: Meta;
|
|
10
|
+
private logger;
|
|
11
|
+
private queryUtil;
|
|
12
|
+
private components;
|
|
13
|
+
private config;
|
|
14
|
+
private userRef;
|
|
15
|
+
private _props;
|
|
16
|
+
private _roles;
|
|
17
|
+
private _role;
|
|
18
|
+
constructor(meta: Meta, logger: Logger, queryUtil: QueryUtil, components: Components, config: Config, userRef: string | number, _props: types.Tables["users"], _roles: string[]);
|
|
19
|
+
hasCapabilities(capabilities: string[], options?: {
|
|
20
|
+
blogIds: number[];
|
|
21
|
+
}): Promise<boolean>;
|
|
22
|
+
role(): Promise<Role>;
|
|
23
|
+
roles(): Promise<string[]>;
|
|
24
|
+
get props(): types.WpUsers | undefined;
|
|
25
|
+
private setDefaultProps;
|
|
26
|
+
private setAnonymous;
|
|
27
|
+
can<T extends types.RoleCapabilityActions>(action: T, ...args: types.TMapMetaCapArgs<T>): Promise<boolean>;
|
|
28
|
+
can<T extends string>(action?: T, ...args: types.TMapMetaCapArgs<T>): Promise<boolean>;
|
|
29
|
+
bulkCan<T extends types.RoleCapabilityActions>(actionOrArrArgs: T | [T, ...types.TMapMetaCapArgs<T>][], arrArgs?: types.TMapMetaCapArgs<T>[]): Promise<[T, types.TMapMetaCapArgs<T>, boolean][]>;
|
|
30
|
+
private init;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/core/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AACvC,qBACa,IAAI;IAGN,IAAI,EAAE,IAAI;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IAThB,OAAO,CAAC,KAAK,CAAO;gBAEX,IAAI,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAC7B,MAAM,EAAE,MAAM,EAAE;IAKpB,eAAe,CACnB,YAAY,EAAE,MAAM,EAAE,EACtB,OAAO,CAAC,EAAE;QACR,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB;IAMG,IAAI;IAKJ,KAAK;IAgEX,IAAI,KAAK,8BAER;IAED,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,YAAY;IAId,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,qBAAqB,EAC7C,MAAM,EAAE,CAAC,EACT,GAAG,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,GAChC,OAAO,CAAC,OAAO,CAAC;IACb,GAAG,CAAC,CAAC,SAAS,MAAM,EACxB,MAAM,CAAC,EAAE,CAAC,EACV,GAAG,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,GAChC,OAAO,CAAC,OAAO,CAAC;IA+Bb,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,qBAAqB,EACjD,eAAe,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,EACvD,OAAO,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,GACnC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;YAwDtC,IAAI;CAyCnB"}
|
package/core/user.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
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.User = void 0;
|
|
46
|
+
const config_1 = require("../config");
|
|
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 components_1 = require("./components");
|
|
52
|
+
const current_1 = require("./current");
|
|
53
|
+
const logger_1 = require("./logger");
|
|
54
|
+
const meta_1 = require("./meta");
|
|
55
|
+
const options_1 = require("./options");
|
|
56
|
+
const role_1 = require("./role");
|
|
57
|
+
const roles_1 = require("./roles");
|
|
58
|
+
const query_util_1 = require("./utils/query.util");
|
|
59
|
+
const user_util_1 = require("./utils/user.util");
|
|
60
|
+
let User = class User {
|
|
61
|
+
meta;
|
|
62
|
+
logger;
|
|
63
|
+
queryUtil;
|
|
64
|
+
components;
|
|
65
|
+
config;
|
|
66
|
+
userRef;
|
|
67
|
+
_props;
|
|
68
|
+
_roles;
|
|
69
|
+
_role;
|
|
70
|
+
constructor(meta, logger, queryUtil, components, config, userRef, _props, _roles) {
|
|
71
|
+
this.meta = meta;
|
|
72
|
+
this.logger = logger;
|
|
73
|
+
this.queryUtil = queryUtil;
|
|
74
|
+
this.components = components;
|
|
75
|
+
this.config = config;
|
|
76
|
+
this.userRef = userRef;
|
|
77
|
+
this._props = _props;
|
|
78
|
+
this._roles = _roles;
|
|
79
|
+
this._role = this.components.get(role_1.Role);
|
|
80
|
+
}
|
|
81
|
+
async hasCapabilities(capabilities, options) {
|
|
82
|
+
const userUtil = this.components.get(user_util_1.UserUtil);
|
|
83
|
+
return userUtil.hasCapabilities(this, capabilities, options);
|
|
84
|
+
}
|
|
85
|
+
async role() {
|
|
86
|
+
await this.roles();
|
|
87
|
+
return this._role;
|
|
88
|
+
}
|
|
89
|
+
async roles() {
|
|
90
|
+
if (!this._roles) {
|
|
91
|
+
this.setAnonymous();
|
|
92
|
+
}
|
|
93
|
+
const user = this._props;
|
|
94
|
+
const current = this.components.get(current_1.Current);
|
|
95
|
+
const roles = [];
|
|
96
|
+
this.meta.set("user", this._props.ID);
|
|
97
|
+
// Grab and set a role from database
|
|
98
|
+
const rolesMeta = (await this.meta.get(`${current.tables.prefix}capabilities`)) ?? {};
|
|
99
|
+
for (const [key] of Object.entries(rolesMeta)) {
|
|
100
|
+
roles.push(key);
|
|
101
|
+
}
|
|
102
|
+
// Get the first role in array
|
|
103
|
+
let primaryRoleName = roles[0];
|
|
104
|
+
// Check super admin
|
|
105
|
+
// get_super_admins
|
|
106
|
+
// get_site_option( 'site_admins', array( 'admin' ) )
|
|
107
|
+
const options = this.components.get(options_1.Options);
|
|
108
|
+
if (this.config.isMultiSite()) {
|
|
109
|
+
const superAdmins = await options.get("site_admins", {
|
|
110
|
+
siteId: current.site?.props.site?.id,
|
|
111
|
+
//serialized: true,
|
|
112
|
+
});
|
|
113
|
+
if (Array.isArray(superAdmins) && superAdmins.includes(user.user_login)) {
|
|
114
|
+
roles.push("superadmin");
|
|
115
|
+
primaryRoleName = "superadmin";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const roleJson = this.components.get(roles_1.Roles).get(primaryRoleName);
|
|
119
|
+
const role = this.components.get(role_1.Role, [
|
|
120
|
+
roleJson?.name,
|
|
121
|
+
roleJson?.capabilities,
|
|
122
|
+
]);
|
|
123
|
+
// If user has more than one role, add its names and capabilities to a role
|
|
124
|
+
if (roles.length > 1) {
|
|
125
|
+
role.addNames(roles);
|
|
126
|
+
for (const roleName of roles.slice(1)) {
|
|
127
|
+
const roleJson = this.components.get(roles_1.Roles).get(roleName);
|
|
128
|
+
Array.isArray(roleJson?.capabilities) &&
|
|
129
|
+
role.add(roleJson.capabilities);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
this._roles = roles;
|
|
133
|
+
this._role = role;
|
|
134
|
+
return this._roles;
|
|
135
|
+
}
|
|
136
|
+
get props() {
|
|
137
|
+
return !this._props || 0 >= this._props.ID ? undefined : this._props;
|
|
138
|
+
}
|
|
139
|
+
setDefaultProps(id = -1) {
|
|
140
|
+
this._props = {
|
|
141
|
+
...this._props,
|
|
142
|
+
ID: id,
|
|
143
|
+
};
|
|
144
|
+
this._roles = [];
|
|
145
|
+
}
|
|
146
|
+
setAnonymous() {
|
|
147
|
+
this.setDefaultProps(-1);
|
|
148
|
+
}
|
|
149
|
+
async can(action, ...args) {
|
|
150
|
+
const role = await this.role();
|
|
151
|
+
return await role.can(action, this, ...args);
|
|
152
|
+
}
|
|
153
|
+
// async bulkCan<T extends types.RoleCapabilityActions>(
|
|
154
|
+
// actionOrArrArgs: [T, ...types.TMapMetaCapArgs<T>[]][],
|
|
155
|
+
// arrArgs?: never
|
|
156
|
+
// ): Promise<[T, types.TMapMetaCapArgs<T>, boolean][]>;
|
|
157
|
+
// async bulkCan<T extends types.RoleCapabilityActions>(
|
|
158
|
+
// actionOrArrArgs: T,
|
|
159
|
+
// arrArgs: types.TMapMetaCapArgs<T>[]
|
|
160
|
+
// ): Promise<[T, types.TMapMetaCapArgs<T>, boolean][]>;
|
|
161
|
+
// async bulkCan(actionOrArrArgs: any, arrArgs?: any[]) {
|
|
162
|
+
// let bulkArgs: any[] = [];
|
|
163
|
+
// if (Array.isArray(actionOrArrArgs)) {
|
|
164
|
+
// bulkArgs = actionOrArrArgs;
|
|
165
|
+
// } else {
|
|
166
|
+
// arrArgs?.map((args) => bulkArgs.push([actionOrArrArgs, ...args]));
|
|
167
|
+
// }
|
|
168
|
+
// const results = [];
|
|
169
|
+
// for (const [action, ...args] of bulkArgs) {
|
|
170
|
+
// const result = await this.can(action, ...(args as any));
|
|
171
|
+
// results.push([action, args, result]);
|
|
172
|
+
// }
|
|
173
|
+
// return results;
|
|
174
|
+
// }
|
|
175
|
+
async bulkCan(actionOrArrArgs, arrArgs) {
|
|
176
|
+
let bulkArgs = [];
|
|
177
|
+
// Check if the first argument is an array and handle it accordingly
|
|
178
|
+
if (Array.isArray(actionOrArrArgs)) {
|
|
179
|
+
if (actionOrArrArgs.length > 0 && Array.isArray(actionOrArrArgs[0])) {
|
|
180
|
+
// Handle the case when the first argument is an array of arrays
|
|
181
|
+
bulkArgs = actionOrArrArgs;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// Handle the case when the first argument is just an array (of arguments for a single action)
|
|
185
|
+
bulkArgs.push(actionOrArrArgs);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// Handle the case when the first argument is a single action and the second is an array of arguments
|
|
190
|
+
arrArgs?.forEach((args) => bulkArgs.push([actionOrArrArgs, ...args]));
|
|
191
|
+
}
|
|
192
|
+
const results = [];
|
|
193
|
+
for (const [action, ...args] of bulkArgs) {
|
|
194
|
+
const result = await this.can(action, ...args);
|
|
195
|
+
results.push([action, args, result]);
|
|
196
|
+
}
|
|
197
|
+
return results;
|
|
198
|
+
}
|
|
199
|
+
// async bulkCan<T extends types.RoleCapabilityActions>(
|
|
200
|
+
// actionOrArrArgs: T | [T, ...types.TMapMetaCapArgs<T>[]][],
|
|
201
|
+
// arrArgs?: types.TMapMetaCapArgs<T>[]
|
|
202
|
+
// ): Promise<[T, types.TMapMetaCapArgs<T>[], boolean][]> {
|
|
203
|
+
// let bulkArgs: [T, ...types.TMapMetaCapArgs<T>[]][] = [];
|
|
204
|
+
// if (
|
|
205
|
+
// Array.isArray(actionOrArrArgs) &&
|
|
206
|
+
// actionOrArrArgs.every((item: any) => Array.isArray(item))
|
|
207
|
+
// ) {
|
|
208
|
+
// // When actionOrArrArgs is an array of arrays, cast it directly.
|
|
209
|
+
// bulkArgs = actionOrArrArgs as [T, ...types.TMapMetaCapArgs<T>[]][];
|
|
210
|
+
// } else if (!Array.isArray(actionOrArrArgs) && arrArgs) {
|
|
211
|
+
// // When actionOrArrArgs is a single action and arrArgs are provided.
|
|
212
|
+
// bulkArgs = arrArgs.map((args: any) => [actionOrArrArgs, ...args]);
|
|
213
|
+
// }
|
|
214
|
+
// const results: [T, types.TMapMetaCapArgs<T>[], boolean][] = [];
|
|
215
|
+
// for (const [action, ...args] of bulkArgs) {
|
|
216
|
+
// const result = await this.can(
|
|
217
|
+
// action,
|
|
218
|
+
// ...(args as types.TMapMetaCapArgs<T>)
|
|
219
|
+
// );
|
|
220
|
+
// results.push([action, args, result]);
|
|
221
|
+
// }
|
|
222
|
+
// return results;
|
|
223
|
+
// }
|
|
224
|
+
async init() {
|
|
225
|
+
this.setDefaultProps(this._props?.ID);
|
|
226
|
+
let user = this._props;
|
|
227
|
+
if (typeof this._props?.ID === "undefined" || 0 >= this._props?.ID) {
|
|
228
|
+
if (!this.userRef)
|
|
229
|
+
return;
|
|
230
|
+
const result = await this.queryUtil.users((query) => {
|
|
231
|
+
query.get(this.userRef);
|
|
232
|
+
}, val.database.wpUsers);
|
|
233
|
+
if (!result) {
|
|
234
|
+
this.logger.info(`User not found: ${this.userRef}`);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
// Set props
|
|
238
|
+
this._props = result;
|
|
239
|
+
user = result;
|
|
240
|
+
}
|
|
241
|
+
else if (
|
|
242
|
+
// Sync userRef
|
|
243
|
+
(typeof this.userRef == "number" && user.ID !== this.userRef) ||
|
|
244
|
+
(typeof this.userRef == "string" &&
|
|
245
|
+
user.user_nicename !== this.userRef &&
|
|
246
|
+
user.display_name !== this.userRef &&
|
|
247
|
+
user.user_email !== this.userRef)) {
|
|
248
|
+
this.userRef = user.ID;
|
|
249
|
+
}
|
|
250
|
+
this.meta.set("user", this._props.ID);
|
|
251
|
+
// Set props with valid role and roles
|
|
252
|
+
this._props = {
|
|
253
|
+
...this._props,
|
|
254
|
+
...user,
|
|
255
|
+
};
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
exports.User = User;
|
|
260
|
+
__decorate([
|
|
261
|
+
async_init_1.asyncInit,
|
|
262
|
+
__metadata("design:type", Function),
|
|
263
|
+
__metadata("design:paramtypes", []),
|
|
264
|
+
__metadata("design:returntype", Promise)
|
|
265
|
+
], User.prototype, "init", null);
|
|
266
|
+
exports.User = User = __decorate([
|
|
267
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
268
|
+
__metadata("design:paramtypes", [meta_1.Meta,
|
|
269
|
+
logger_1.Logger,
|
|
270
|
+
query_util_1.QueryUtil,
|
|
271
|
+
components_1.Components,
|
|
272
|
+
config_1.Config, Object, Object, Array])
|
|
273
|
+
], User);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Config } from "../../config";
|
|
2
|
+
import { Blog } from "../blog";
|
|
3
|
+
import { Components } from "../components";
|
|
4
|
+
import type * as types from "../../types";
|
|
5
|
+
export declare class BlogUtil {
|
|
6
|
+
private components;
|
|
7
|
+
private config;
|
|
8
|
+
constructor(components: Components, config: Config);
|
|
9
|
+
get(blogRef: string | number): Promise<Blog>;
|
|
10
|
+
toBlog(blog: types.Tables["blogs"]): Blog;
|
|
11
|
+
toBlogs(blogs: types.Tables["blogs"][]): Blog[];
|
|
12
|
+
getMainBlogId(): Promise<number>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=blog.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/blog.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,qBACa,QAAQ;IACP,OAAO,CAAC,UAAU;IAAc,OAAO,CAAC,MAAM;gBAAtC,UAAU,EAAE,UAAU,EAAU,MAAM,EAAE,MAAM;IAE5D,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIlC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;IAIlC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;IAQhC,aAAa;CAwBpB"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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.BlogUtil = void 0;
|
|
46
|
+
const config_1 = require("../../config");
|
|
47
|
+
const component_1 = require("../../decorators/component");
|
|
48
|
+
const val = __importStar(require("../../validators"));
|
|
49
|
+
const blog_1 = require("../blog");
|
|
50
|
+
const components_1 = require("../components");
|
|
51
|
+
const current_1 = require("../current");
|
|
52
|
+
const query_util_1 = require("./query.util");
|
|
53
|
+
let BlogUtil = class BlogUtil {
|
|
54
|
+
components;
|
|
55
|
+
config;
|
|
56
|
+
constructor(components, config) {
|
|
57
|
+
this.components = components;
|
|
58
|
+
this.config = config;
|
|
59
|
+
}
|
|
60
|
+
async get(blogRef) {
|
|
61
|
+
return await this.components.asyncGet(blog_1.Blog, [blogRef]);
|
|
62
|
+
}
|
|
63
|
+
toBlog(blog) {
|
|
64
|
+
return this.components.get(blog_1.Blog, [blog.blog_id, blog]);
|
|
65
|
+
}
|
|
66
|
+
toBlogs(blogs) {
|
|
67
|
+
return blogs.map((blog) => {
|
|
68
|
+
const toBlog = this.toBlog(blog);
|
|
69
|
+
toBlog.meta.set("blog", blog.blog_id);
|
|
70
|
+
return toBlog;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async getMainBlogId() {
|
|
74
|
+
const current = this.components.get(current_1.Current);
|
|
75
|
+
if (!this.config.isMultiSite()) {
|
|
76
|
+
return 1;
|
|
77
|
+
}
|
|
78
|
+
const siteId = current.site?.props.site.id;
|
|
79
|
+
if (!siteId) {
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
const queryUtil = this.components.get(query_util_1.QueryUtil);
|
|
83
|
+
const siteMeta = await queryUtil.sites((query) => {
|
|
84
|
+
query
|
|
85
|
+
.withMeta()
|
|
86
|
+
.where("site_id", siteId)
|
|
87
|
+
.where("meta_key", "main_site")
|
|
88
|
+
.builder.first();
|
|
89
|
+
}, val.database.wpSiteMeta);
|
|
90
|
+
return parseInt(siteMeta?.meta_value ?? "1");
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
exports.BlogUtil = BlogUtil;
|
|
94
|
+
exports.BlogUtil = BlogUtil = __decorate([
|
|
95
|
+
(0, component_1.component)(),
|
|
96
|
+
__metadata("design:paramtypes", [components_1.Components, config_1.Config])
|
|
97
|
+
], BlogUtil);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Config } from "../../config";
|
|
3
|
+
import * as val from "../../validators";
|
|
4
|
+
import { Comment } from "../comment";
|
|
5
|
+
import { Components } from "../components";
|
|
6
|
+
import { Post } from "../post";
|
|
7
|
+
import type * as types from "../../types";
|
|
8
|
+
export declare class CommentUtil {
|
|
9
|
+
private components;
|
|
10
|
+
private config;
|
|
11
|
+
constructor(components: Components, config: Config);
|
|
12
|
+
get(id: number): Promise<Comment>;
|
|
13
|
+
toComment(comment: types.Tables["comments"]): Comment;
|
|
14
|
+
toComments(comments: types.Tables["comments"][]): Comment[];
|
|
15
|
+
getDefaultStatus(postType?: types.PostType, commentType?: string): Promise<"open" | "closed">;
|
|
16
|
+
getDefaultStatus(postType?: string, commentType?: string): Promise<"open" | "closed">;
|
|
17
|
+
getStatusAsString(commentId: number): Promise<"" | "trash" | "spam" | "approved" | "unapproved">;
|
|
18
|
+
isOpen(post: Post): boolean | undefined;
|
|
19
|
+
containsNGWord(args: Partial<types.Tables["comments"]>): Promise<boolean>;
|
|
20
|
+
isValid(args: Partial<types.Tables["comments"]>): Promise<boolean>;
|
|
21
|
+
getStatus(comment: Partial<types.Tables["comments"]>): Promise<z.infer<typeof val.database.wpComments.shape.comment_approved>>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=comment.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/comment.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,qBACa,WAAW;IACV,OAAO,CAAC,UAAU;IAAc,OAAO,CAAC,MAAM;gBAAtC,UAAU,EAAE,UAAU,EAAU,MAAM,EAAE,MAAM;IAE5D,GAAG,CAAC,EAAE,EAAE,MAAM;IAIpB,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;IAI3C,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;IAIzC,gBAAgB,CACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,EACzB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;IACvB,gBAAgB,CACpB,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;IAwCvB,iBAAiB,CAAC,SAAS,EAAE,MAAM;IA6BzC,MAAM,CAAC,IAAI,EAAE,IAAI;IAKX,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAiDtD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAiH/C,SAAS,CACb,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GACzC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;CAuE3E"}
|