@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,13 @@
|
|
|
1
|
+
import { Components } from "../components";
|
|
2
|
+
import { Meta } from "../meta";
|
|
3
|
+
import type * as types from "../../types";
|
|
4
|
+
export declare class MetaUtil {
|
|
5
|
+
private components;
|
|
6
|
+
constructor(components: Components);
|
|
7
|
+
get(table: types.MetaTable, id: number): Meta;
|
|
8
|
+
getValue<T = string>(table: types.MetaTable, id: number, key: string): Promise<T | undefined>;
|
|
9
|
+
isProtected(metaKey: string, metaType?: types.MetaTable): boolean;
|
|
10
|
+
getObjectSubtype(type: string, id: number): Promise<string>;
|
|
11
|
+
getObjectSubtype(type: "post" | "comment" | "term" | "user", id: number): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=meta.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/meta.util.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,qBACa,QAAQ;IACP,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,MAAM;IAIhC,QAAQ,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAM1E,WAAW,CACT,OAAO,EAAE,MAAM,EAEf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS;IAWtB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3D,gBAAgB,CACpB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,EAC1C,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC;CA+BnB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-case-declarations */
|
|
3
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
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;
|
|
7
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8
|
+
};
|
|
9
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.MetaUtil = void 0;
|
|
14
|
+
const component_1 = require("../../decorators/component");
|
|
15
|
+
const components_1 = require("../components");
|
|
16
|
+
const meta_1 = require("../meta");
|
|
17
|
+
const comment_util_1 = require("./comment.util");
|
|
18
|
+
const post_util_1 = require("./post.util");
|
|
19
|
+
const term_util_1 = require("./term.util");
|
|
20
|
+
const user_util_1 = require("./user.util");
|
|
21
|
+
let MetaUtil = class MetaUtil {
|
|
22
|
+
components;
|
|
23
|
+
constructor(components) {
|
|
24
|
+
this.components = components;
|
|
25
|
+
}
|
|
26
|
+
get(table, id) {
|
|
27
|
+
return this.components.get(meta_1.Meta, [table, id]);
|
|
28
|
+
}
|
|
29
|
+
async getValue(table, id, key) {
|
|
30
|
+
return await this.get(table, id).get(key);
|
|
31
|
+
}
|
|
32
|
+
// https://github.com/WordPress/WordPress/blob/master/wp-includes/meta.php
|
|
33
|
+
// is_protected_meta
|
|
34
|
+
isProtected(metaKey,
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
|
+
metaType) {
|
|
37
|
+
const sanitizedKey = metaKey.replace(/[^\x20-\x7E\p{L}]/gu, "");
|
|
38
|
+
const protectedKey = sanitizedKey.length > 0 && sanitizedKey[0] === "_";
|
|
39
|
+
// @todo: add hook
|
|
40
|
+
return protectedKey;
|
|
41
|
+
}
|
|
42
|
+
async getObjectSubtype(type, id) {
|
|
43
|
+
let subType = undefined;
|
|
44
|
+
switch (type) {
|
|
45
|
+
case "post":
|
|
46
|
+
const postUtil = this.components.get(post_util_1.PostUtil);
|
|
47
|
+
const post = await postUtil.get(id);
|
|
48
|
+
subType = post.props?.post_type;
|
|
49
|
+
break;
|
|
50
|
+
case "term":
|
|
51
|
+
const termUtil = this.components.get(term_util_1.TermUtil);
|
|
52
|
+
const term = await termUtil.get(id);
|
|
53
|
+
subType = term.props?.taxonomy;
|
|
54
|
+
break;
|
|
55
|
+
case "comment":
|
|
56
|
+
const commentUtil = this.components.get(comment_util_1.CommentUtil);
|
|
57
|
+
const comment = await commentUtil.get(id);
|
|
58
|
+
subType = comment.props?.comment_ID ? "comment" : undefined;
|
|
59
|
+
break;
|
|
60
|
+
case "user":
|
|
61
|
+
const userUtil = this.components.get(user_util_1.UserUtil);
|
|
62
|
+
const user = await userUtil.get(id);
|
|
63
|
+
subType = user.props?.ID ? "user" : undefined;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return subType;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.MetaUtil = MetaUtil;
|
|
70
|
+
exports.MetaUtil = MetaUtil = __decorate([
|
|
71
|
+
(0, component_1.component)(),
|
|
72
|
+
__metadata("design:paramtypes", [components_1.Components])
|
|
73
|
+
], MetaUtil);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Config } from "../../config";
|
|
2
|
+
import * as defaults from "../../defaults";
|
|
3
|
+
import { Components } from "../components";
|
|
4
|
+
import { Post } from "../post";
|
|
5
|
+
import type * as types from "../../types";
|
|
6
|
+
export declare class PostUtil {
|
|
7
|
+
private config;
|
|
8
|
+
private components;
|
|
9
|
+
constructor(config: Config, components: Components);
|
|
10
|
+
toPost(post: types.Tables["posts"]): Post;
|
|
11
|
+
toPosts(posts: types.Tables["posts"][]): Post[];
|
|
12
|
+
get(id: number): Promise<Post>;
|
|
13
|
+
getBySlug(slug: string): Promise<Post | undefined>;
|
|
14
|
+
isPubliclyViewable(postIdOrPost: number | Post): Promise<boolean>;
|
|
15
|
+
getViewableTypes(): types.PostType[];
|
|
16
|
+
isTypeViewable(typeObjectOrString: string | ReturnType<PostUtil["getTypeObject"]>): boolean;
|
|
17
|
+
isStatusViewable(statusObjectOrString: string | ReturnType<PostUtil["getStatusObject"]>): boolean;
|
|
18
|
+
getStatusObject(status: typeof defaults.postStatuses | string | undefined): {
|
|
19
|
+
label: string;
|
|
20
|
+
internal?: boolean | undefined;
|
|
21
|
+
private?: boolean | undefined;
|
|
22
|
+
public?: boolean | undefined;
|
|
23
|
+
_builtin?: boolean | undefined;
|
|
24
|
+
protected?: boolean | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
getStatus(post?: Post, parent?: Post): Promise<string | undefined>;
|
|
27
|
+
getAttachedFile(postId: number, unfiltered?: boolean): Promise<string | undefined>;
|
|
28
|
+
getAttachmentMetadata<T = Record<string, any>>(postId: number): Promise<NonNullable<Awaited<T>> | undefined>;
|
|
29
|
+
getTypeObject<T>(name: T | (typeof defaults.postTypes)[number]): types.Config["posts"]["types"][string] | undefined;
|
|
30
|
+
private getCapabilities;
|
|
31
|
+
getUniqueSlug(slug: string, post: number | Post, maxSuffix?: number): Promise<string>;
|
|
32
|
+
private truncateSlug;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=post.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/post.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,qBACa,QAAQ;IACP,OAAO,CAAC,MAAM;IAAU,OAAO,CAAC,UAAU;gBAAlC,MAAM,EAAE,MAAM,EAAU,UAAU,EAAE,UAAU;IAElE,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;IAIlC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;IAIhC,GAAG,CAAC,EAAE,EAAE,MAAM;IAId,SAAS,CAAC,IAAI,EAAE,MAAM;IAWtB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAgBpD,gBAAgB,IAGT,KAAK,CAAC,QAAQ,EAAE;IAIvB,cAAc,CACZ,kBAAkB,EAAE,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAkBpE,gBAAgB,CACd,oBAAoB,EAAE,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,GACrE,OAAO;IAmBV,eAAe,CAAC,MAAM,EAAE,OAAO,QAAQ,CAAC,YAAY,GAAG,MAAM,GAAG,SAAS;;;;;;;;IAQnE,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAuDlE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,UAAQ;IAqBlD,qBAAqB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM;IAiBnE,aAAa,CAAC,CAAC,EACb,IAAI,EAAE,CAAC,GAAG,CAAC,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAC5C,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS;IAcrD,OAAO,CAAC,eAAe;IAkDjB,aAAa,CACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,SAAS,GAAE,MAAW,GACrB,OAAO,CAAC,MAAM,CAAC;IAuDlB,OAAO,CAAC,YAAY;CAYrB"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PostUtil = void 0;
|
|
13
|
+
const config_1 = require("../../config");
|
|
14
|
+
const component_1 = require("../../decorators/component");
|
|
15
|
+
const components_1 = require("../components");
|
|
16
|
+
const current_1 = require("../current");
|
|
17
|
+
const post_1 = require("../post");
|
|
18
|
+
const query_util_1 = require("./query.util");
|
|
19
|
+
let PostUtil = class PostUtil {
|
|
20
|
+
config;
|
|
21
|
+
components;
|
|
22
|
+
constructor(config, components) {
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.components = components;
|
|
25
|
+
}
|
|
26
|
+
toPost(post) {
|
|
27
|
+
return this.components.get(post_1.Post, [post.ID, post]);
|
|
28
|
+
}
|
|
29
|
+
toPosts(posts) {
|
|
30
|
+
return posts.map((post) => this.toPost(post));
|
|
31
|
+
}
|
|
32
|
+
async get(id) {
|
|
33
|
+
return await this.components.asyncGet(post_1.Post, [id]);
|
|
34
|
+
}
|
|
35
|
+
async getBySlug(slug) {
|
|
36
|
+
const queryUtil = this.components.get(query_util_1.QueryUtil);
|
|
37
|
+
const posts = await queryUtil.posts((query) => query.where("post_name", slug).builder.limit(1));
|
|
38
|
+
const postId = posts?.[0]?.ID;
|
|
39
|
+
return postId ? await this.get(postId) : undefined;
|
|
40
|
+
}
|
|
41
|
+
// is_post_publicly_viewable
|
|
42
|
+
async isPubliclyViewable(postIdOrPost) {
|
|
43
|
+
const post = typeof postIdOrPost == "number"
|
|
44
|
+
? await this.get(postIdOrPost)
|
|
45
|
+
: postIdOrPost;
|
|
46
|
+
if (!post.props?.ID || 0 >= post.props.ID) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return (this.isTypeViewable(post.props.post_type) &&
|
|
50
|
+
this.isStatusViewable(post.props.post_status));
|
|
51
|
+
}
|
|
52
|
+
getViewableTypes() {
|
|
53
|
+
return Object.keys(this.config.config.posts.types).filter((type) => this.isTypeViewable(type));
|
|
54
|
+
}
|
|
55
|
+
// is_post_type_viewable
|
|
56
|
+
isTypeViewable(typeObjectOrString) {
|
|
57
|
+
const typeObject = typeof typeObjectOrString === "string"
|
|
58
|
+
? this.getTypeObject(typeObjectOrString)
|
|
59
|
+
: typeObjectOrString;
|
|
60
|
+
if (!typeObject) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return (typeObject.publiclyQueryable || (typeObject._builtin && typeObject.public));
|
|
64
|
+
}
|
|
65
|
+
// https://github.com/WordPress/WordPress/blob/master/wp-includes/post.php
|
|
66
|
+
// is_post_status_viewable
|
|
67
|
+
isStatusViewable(statusObjectOrString) {
|
|
68
|
+
const statusObject = typeof statusObjectOrString === "string"
|
|
69
|
+
? this.getStatusObject(statusObjectOrString)
|
|
70
|
+
: statusObjectOrString;
|
|
71
|
+
if (!statusObject ||
|
|
72
|
+
true == statusObject.internal ||
|
|
73
|
+
true == statusObject.protected) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true == statusObject._builtin && true == statusObject.public;
|
|
77
|
+
}
|
|
78
|
+
// https://github.com/WordPress/WordPress/blob/master/wp-includes/post.php
|
|
79
|
+
// get_post_status_object
|
|
80
|
+
getStatusObject(status) {
|
|
81
|
+
return !status || !this.config.config.posts.statuses[status]
|
|
82
|
+
? undefined
|
|
83
|
+
: this.config.config.posts.statuses[status];
|
|
84
|
+
}
|
|
85
|
+
// https://github.com/WordPress/WordPress/blob/master/wp-includes/post.php
|
|
86
|
+
// get_post_status
|
|
87
|
+
async getStatus(post, parent) {
|
|
88
|
+
if (!post?.props) {
|
|
89
|
+
const current = this.components.get(current_1.Current);
|
|
90
|
+
if (!current.post) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
post = current.post;
|
|
94
|
+
}
|
|
95
|
+
const postParent = parent ??
|
|
96
|
+
(await this.components.asyncGet(post_1.Post, [post.props?.post_parent]));
|
|
97
|
+
let postStatus = post.props?.post_status;
|
|
98
|
+
if ("attachment" === post.props?.post_type && "inherit" === postStatus) {
|
|
99
|
+
if (0 === post.props.post_parent ||
|
|
100
|
+
!postParent.props ||
|
|
101
|
+
post.props.ID === post.props.post_parent) {
|
|
102
|
+
// Unattached attachments with inherit status are assumed to be published.
|
|
103
|
+
postStatus = "publish";
|
|
104
|
+
}
|
|
105
|
+
else if ("trash" === (await this.getStatus(postParent))) {
|
|
106
|
+
// Get parent status prior to trashing.
|
|
107
|
+
postStatus = await postParent.meta.get("_wp_trash_meta_status");
|
|
108
|
+
if (!postStatus) {
|
|
109
|
+
// Assume publish as above.
|
|
110
|
+
postStatus = "publish";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
postStatus = await this.getStatus(postParent);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if ("attachment" === post.props?.post_type &&
|
|
118
|
+
!["private", "trash", "auto-draft"].includes(post.props?.post_status ?? "")) {
|
|
119
|
+
/*
|
|
120
|
+
* Ensure uninherited attachments have a permitted status either 'private', 'trash', 'auto-draft'.
|
|
121
|
+
* This is to match the logic in wp_insert_post().
|
|
122
|
+
*
|
|
123
|
+
* Note: 'inherit' is excluded from this check as it is resolved to the parent post's
|
|
124
|
+
* status in the logic block above.
|
|
125
|
+
*/
|
|
126
|
+
postStatus = "publish";
|
|
127
|
+
}
|
|
128
|
+
return postStatus;
|
|
129
|
+
}
|
|
130
|
+
// get_attached_file
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
+
async getAttachedFile(postId, unfiltered = false) {
|
|
133
|
+
const post = await this.get(postId);
|
|
134
|
+
if (!post.props) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
let file = await post.meta.get("_wp_attached_file");
|
|
138
|
+
if (!file) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
// If the file is relative, prepend upload dir.
|
|
142
|
+
if (file && !file.startsWith("/") && !/^.:\\/.test(file)) {
|
|
143
|
+
file = `${this.config.config.staticAssetsPath}/${file}`;
|
|
144
|
+
}
|
|
145
|
+
return file;
|
|
146
|
+
}
|
|
147
|
+
// wp_get_attachment_metadata
|
|
148
|
+
async getAttachmentMetadata(postId) {
|
|
149
|
+
const post = await this.get(postId);
|
|
150
|
+
if (!post.props) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
const meta = await post.meta.get("_wp_attachment_metadata");
|
|
154
|
+
if (!meta) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
return meta;
|
|
158
|
+
}
|
|
159
|
+
getTypeObject(name) {
|
|
160
|
+
const type = this.config.config.posts.types[name];
|
|
161
|
+
if (!type) {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
type.capabilities = {
|
|
165
|
+
...(type.capabilities ?? {}),
|
|
166
|
+
...this.getCapabilities(type),
|
|
167
|
+
};
|
|
168
|
+
return type;
|
|
169
|
+
}
|
|
170
|
+
// get_post_type_capabilities
|
|
171
|
+
getCapabilities(args) {
|
|
172
|
+
const capabilityType = !Array.isArray(args?.capabilityType)
|
|
173
|
+
? [args.capabilityType, args.capabilityType + "s"]
|
|
174
|
+
: args.capabilityType;
|
|
175
|
+
// Singular base for meta capabilities, plural base for primitive capabilities.
|
|
176
|
+
const [singular_base, plural_base] = capabilityType;
|
|
177
|
+
let defaultCapabilities = {
|
|
178
|
+
// Meta capabilities.
|
|
179
|
+
edit_post: "edit_" + singular_base,
|
|
180
|
+
read_post: "read_" + singular_base,
|
|
181
|
+
delete_post: "delete_" + singular_base,
|
|
182
|
+
// Primitive capabilities used outside of map_meta_cap():
|
|
183
|
+
edit_posts: "edit_" + plural_base,
|
|
184
|
+
edit_others_posts: "edit_others_" + plural_base,
|
|
185
|
+
delete_posts: "delete_" + plural_base,
|
|
186
|
+
publish_posts: "publish_" + plural_base,
|
|
187
|
+
read_private_posts: "read_private_" + plural_base,
|
|
188
|
+
};
|
|
189
|
+
// Primitive capabilities used within map_meta_cap():
|
|
190
|
+
if (args.mapMetaCap) {
|
|
191
|
+
defaultCapabilities = {
|
|
192
|
+
...defaultCapabilities,
|
|
193
|
+
...{
|
|
194
|
+
read: "read",
|
|
195
|
+
delete_private_posts: "delete_private_" + plural_base,
|
|
196
|
+
delete_published_posts: "delete_published_" + plural_base,
|
|
197
|
+
delete_others_posts: "delete_others_" + plural_base,
|
|
198
|
+
edit_private_posts: "edit_private_" + plural_base,
|
|
199
|
+
edit_published_posts: "edit_published_" + plural_base,
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const capabilities = {
|
|
204
|
+
...defaultCapabilities,
|
|
205
|
+
...(args.capabilities ?? {}),
|
|
206
|
+
};
|
|
207
|
+
// Post creation capability simply maps to edit_posts by default:
|
|
208
|
+
if (!capabilities || !capabilities["create_posts"]) {
|
|
209
|
+
capabilities["create_posts"] = capabilities["edit_posts"];
|
|
210
|
+
}
|
|
211
|
+
return capabilities;
|
|
212
|
+
}
|
|
213
|
+
// wp_unique_post_slug
|
|
214
|
+
async getUniqueSlug(slug, post, maxSuffix = 10) {
|
|
215
|
+
const queryUtil = this.components.get(query_util_1.QueryUtil);
|
|
216
|
+
if (typeof post === "number") {
|
|
217
|
+
post = await this.get(post);
|
|
218
|
+
}
|
|
219
|
+
slug = slug?.trim();
|
|
220
|
+
const postId = post.props?.ID ?? 0;
|
|
221
|
+
const postParent = post.props?.post_parent ?? 0;
|
|
222
|
+
const postType = post.props?.post_type ?? "";
|
|
223
|
+
const postStatus = post.props?.post_status ?? "";
|
|
224
|
+
const postTypeObject = this.getTypeObject(postType);
|
|
225
|
+
if (["draft", "pending", "auto-draft"].includes(postStatus) ||
|
|
226
|
+
("inherit" === postStatus && "revision" === postType) ||
|
|
227
|
+
"user_request" === postType ||
|
|
228
|
+
("nav_menu_item" == postType && postTypeObject?.hierarchical)) {
|
|
229
|
+
return slug ?? post.props?.post_name;
|
|
230
|
+
}
|
|
231
|
+
slug = this.truncateSlug(slug);
|
|
232
|
+
if (!slug || 0 >= slug.length) {
|
|
233
|
+
return slug;
|
|
234
|
+
}
|
|
235
|
+
for (let suffix = 0; suffix < maxSuffix; suffix++) {
|
|
236
|
+
const newSlug = 0 >= suffix ? slug : `${slug}-${suffix + 1}`;
|
|
237
|
+
const posts = await queryUtil.posts((query) => {
|
|
238
|
+
query
|
|
239
|
+
.where("post_name", newSlug)
|
|
240
|
+
.builder.not.__ref(query)
|
|
241
|
+
.where("ID", postId);
|
|
242
|
+
if (postTypeObject?.hierarchical) {
|
|
243
|
+
query
|
|
244
|
+
.whereIn("post_type", ["attachment", postType])
|
|
245
|
+
.where("post_parent", postParent);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
if (!posts) {
|
|
249
|
+
return newSlug;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return `${slug}-${Math.floor(Math.random() * (maxSuffix + 999990010 - maxSuffix + 1) + maxSuffix + 1)}`;
|
|
253
|
+
}
|
|
254
|
+
// _truncate_post_slug
|
|
255
|
+
truncateSlug(slug, length = 200) {
|
|
256
|
+
if (slug.length > length) {
|
|
257
|
+
const decodedSlug = decodeURIComponent(slug);
|
|
258
|
+
if (decodedSlug === slug) {
|
|
259
|
+
slug = slug.substring(0, length);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
slug = encodeURIComponent(decodedSlug).slice(0, length);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return slug.replace(/-+$/, ""); // Remove trailing hyphens
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
exports.PostUtil = PostUtil;
|
|
269
|
+
exports.PostUtil = PostUtil = __decorate([
|
|
270
|
+
(0, component_1.component)(),
|
|
271
|
+
__metadata("design:paramtypes", [config_1.Config, components_1.Components])
|
|
272
|
+
], PostUtil);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as types from "../../types";
|
|
2
|
+
import * as val from "../../validators";
|
|
3
|
+
import { PostsQuery, QueryBuilders, TermsQuery, CommentsQuery, UsersQuery, MetaQuery, BlogsQuery, SiteQuery, OptionsQuery, CommonQuery } from "../../query-builder";
|
|
4
|
+
import { Components } from "../components";
|
|
5
|
+
import { Config } from "../../config";
|
|
6
|
+
export declare class QueryUtil {
|
|
7
|
+
#private;
|
|
8
|
+
private components;
|
|
9
|
+
private config;
|
|
10
|
+
constructor(components: Components, config: Config);
|
|
11
|
+
usingBlog(id: number): this;
|
|
12
|
+
resetBlog(): this;
|
|
13
|
+
private base;
|
|
14
|
+
custom<C, T extends types.validating.Parser>(clazz: types.Constructor<C>, formatter: T, func: (query: C, builders: QueryBuilders) => void): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
15
|
+
terms<T extends types.validating.Parser = typeof val.query.termsResult>(func: (query: TermsQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
16
|
+
posts<T extends types.validating.Parser = typeof val.query.postsResult>(func: (query: PostsQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
17
|
+
comments<T extends types.validating.Parser = typeof val.query.commentsResult>(func: (query: CommentsQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
18
|
+
users<T extends types.validating.Parser = typeof val.query.usersResult>(func: (query: UsersQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
19
|
+
blogs<T extends types.validating.Parser = typeof val.query.blogsResult>(func: (query: BlogsQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
20
|
+
sites<T extends types.validating.Parser = typeof val.query.sitesResult>(func: (query: SiteQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
21
|
+
options<T extends types.validating.Parser = typeof val.query.optionsResult>(func: (query: OptionsQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
22
|
+
meta<Table extends types.MetaTable, T extends types.validating.Parser = {
|
|
23
|
+
post: typeof val.query.metaPostResult;
|
|
24
|
+
comment: typeof val.query.metaCommentResult;
|
|
25
|
+
blog: typeof val.query.metaBlogResult;
|
|
26
|
+
term: typeof val.query.metaTermResult;
|
|
27
|
+
user: typeof val.query.metaUserResult;
|
|
28
|
+
site: typeof val.query.metaSiteResult;
|
|
29
|
+
}[Table]>(type: Table, fn: (query: MetaQuery, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
30
|
+
common<Table extends "signups" | "links" | "registration_log", T extends types.validating.Parser = {
|
|
31
|
+
signups: typeof val.query.signupsResult;
|
|
32
|
+
links: typeof val.query.linksResult;
|
|
33
|
+
registration_log: typeof val.query.registrationLogResult;
|
|
34
|
+
}[Table], Query = CommonQuery<Table>>(table: Table, fn: (query: Query, builders: QueryBuilders) => void, formatter?: T): Promise<types.validating.ParserReturnType<T> | undefined>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=query.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/query.util.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,168 @@
|
|
|
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.QueryUtil = void 0;
|
|
46
|
+
const component_1 = require("../../decorators/component");
|
|
47
|
+
const query_1 = require("../query");
|
|
48
|
+
const val = __importStar(require("../../validators"));
|
|
49
|
+
const query_builder_1 = require("../../query-builder");
|
|
50
|
+
const constants_1 = require("../../constants");
|
|
51
|
+
const components_1 = require("../components");
|
|
52
|
+
const config_1 = require("../../config");
|
|
53
|
+
const current_1 = require("../current");
|
|
54
|
+
let QueryUtil = class QueryUtil {
|
|
55
|
+
components;
|
|
56
|
+
config;
|
|
57
|
+
constructor(components, config) {
|
|
58
|
+
this.components = components;
|
|
59
|
+
this.config = config;
|
|
60
|
+
}
|
|
61
|
+
#blogId = -99;
|
|
62
|
+
usingBlog(id) {
|
|
63
|
+
if (this.config.isMultiSite())
|
|
64
|
+
this.#blogId = id;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
resetBlog() {
|
|
68
|
+
this.usingBlog(-99);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
async base(fn, formatter, clazz) {
|
|
72
|
+
return await this.components
|
|
73
|
+
.get(query_1.Query)
|
|
74
|
+
.build((query, builders) => {
|
|
75
|
+
const qb = builders?.get(clazz, query);
|
|
76
|
+
if (this.config.isMultiSite()) {
|
|
77
|
+
builders.tables.index =
|
|
78
|
+
this.#blogId > 0
|
|
79
|
+
? this.#blogId
|
|
80
|
+
: this.components.get(current_1.Current).tables.index;
|
|
81
|
+
}
|
|
82
|
+
qb.from;
|
|
83
|
+
fn(qb, builders);
|
|
84
|
+
})
|
|
85
|
+
.execute(formatter);
|
|
86
|
+
}
|
|
87
|
+
async custom(clazz, formatter, func) {
|
|
88
|
+
return (await this.base(func, formatter, clazz));
|
|
89
|
+
}
|
|
90
|
+
async terms(func, formatter) {
|
|
91
|
+
return (await this.base(func, formatter ?? val.query.termsResult, query_builder_1.TermsQuery));
|
|
92
|
+
}
|
|
93
|
+
async posts(func, formatter) {
|
|
94
|
+
return (await this.base(func, formatter ?? val.query.postsResult, query_builder_1.PostsQuery));
|
|
95
|
+
}
|
|
96
|
+
async comments(func, formatter) {
|
|
97
|
+
return (await this.base(func, formatter ?? val.query.commentsResult, query_builder_1.CommentsQuery));
|
|
98
|
+
}
|
|
99
|
+
async users(func, formatter) {
|
|
100
|
+
return (await this.base(func, formatter ?? val.query.usersResult, query_builder_1.UsersQuery));
|
|
101
|
+
}
|
|
102
|
+
async blogs(func, formatter) {
|
|
103
|
+
return (await this.base(func, formatter ?? val.query.blogsResult, query_builder_1.BlogsQuery));
|
|
104
|
+
}
|
|
105
|
+
async sites(func, formatter) {
|
|
106
|
+
return (await this.base(func, formatter ?? val.query.sitesResult, query_builder_1.SiteQuery));
|
|
107
|
+
}
|
|
108
|
+
async options(func, formatter) {
|
|
109
|
+
return (await this.base(func, formatter ?? val.query.optionsResult, query_builder_1.OptionsQuery));
|
|
110
|
+
}
|
|
111
|
+
async meta(type, fn, formatter) {
|
|
112
|
+
if (!formatter) {
|
|
113
|
+
switch (type) {
|
|
114
|
+
case "post":
|
|
115
|
+
formatter = val.query.metaPostResult;
|
|
116
|
+
break;
|
|
117
|
+
case "comment":
|
|
118
|
+
formatter = val.query.metaCommentResult;
|
|
119
|
+
break;
|
|
120
|
+
case "blog":
|
|
121
|
+
formatter = val.query.metaBlogResult;
|
|
122
|
+
break;
|
|
123
|
+
case "term":
|
|
124
|
+
formatter = val.query.metaTermResult;
|
|
125
|
+
break;
|
|
126
|
+
case "user":
|
|
127
|
+
formatter = val.query.metaUserResult;
|
|
128
|
+
break;
|
|
129
|
+
case "site":
|
|
130
|
+
formatter = val.query.metaSiteResult;
|
|
131
|
+
break;
|
|
132
|
+
default:
|
|
133
|
+
formatter = val.query.metaResult;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const wrappedFunc = (query, builders) => {
|
|
138
|
+
query.setPrimaryTable(type).from;
|
|
139
|
+
fn(query, builders);
|
|
140
|
+
};
|
|
141
|
+
return (await this.base(wrappedFunc, formatter, query_builder_1.MetaQuery));
|
|
142
|
+
}
|
|
143
|
+
async common(table, fn, formatter) {
|
|
144
|
+
if (!formatter) {
|
|
145
|
+
switch (table) {
|
|
146
|
+
case "signups":
|
|
147
|
+
formatter = val.query.signupsResult;
|
|
148
|
+
break;
|
|
149
|
+
case "links":
|
|
150
|
+
formatter = val.query.linksResult;
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
formatter = val.query.registrationLogResult;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const wrappedFunc = (query, builders) => {
|
|
158
|
+
query.withTable(table).from;
|
|
159
|
+
fn(query, builders);
|
|
160
|
+
};
|
|
161
|
+
return (await this.base(wrappedFunc, formatter, (query_builder_1.CommonQuery)));
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
exports.QueryUtil = QueryUtil;
|
|
165
|
+
exports.QueryUtil = QueryUtil = __decorate([
|
|
166
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
167
|
+
__metadata("design:paramtypes", [components_1.Components, config_1.Config])
|
|
168
|
+
], QueryUtil);
|