@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 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/core/validator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAEvC,qBACa,SAAS;;IAGpB,SAAS,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAC5C,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAChC,KAAK,EAAE,CAAC;IAKV,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EACxC,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAChC,KAAK,EAAE,CAAC;IAKV,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,MAAM,EACpC,IAAI,EAAE,CAAC,EACP,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,GACtC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAIvC,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,MAAM,EACvC,IAAI,EAAE,CAAC,EACP,CAAC,EAAE,GAAG,GACL,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAIvC,QAAQ,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,MAAM,EACxC,IAAI,EAAE,CAAC,EACP,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,GACtC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS;IAInD,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,MAAM,EAC3C,IAAI,EAAE,CAAC,EACP,CAAC,EAAE,GAAG,GACL,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS;CAGpD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.Validator = void 0;
|
|
13
|
+
const common_1 = require("../common");
|
|
14
|
+
const component_1 = require("../decorators/component");
|
|
15
|
+
let Validator = class Validator {
|
|
16
|
+
constructor() { }
|
|
17
|
+
fieldSafe(table, field, value) {
|
|
18
|
+
return common_1.validating.fieldSafe(table, field, value);
|
|
19
|
+
}
|
|
20
|
+
field(table, field, value) {
|
|
21
|
+
return common_1.validating.field(table, field, value);
|
|
22
|
+
}
|
|
23
|
+
exec(func, v) {
|
|
24
|
+
return common_1.validating.exec(func, v);
|
|
25
|
+
}
|
|
26
|
+
execAny(func, v) {
|
|
27
|
+
return common_1.validating.execAny(func, v);
|
|
28
|
+
}
|
|
29
|
+
execSafe(func, v) {
|
|
30
|
+
return common_1.validating.execSafe(func, v);
|
|
31
|
+
}
|
|
32
|
+
execSafeAny(func, v) {
|
|
33
|
+
return common_1.validating.execSafeAny(func, v);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.Validator = Validator;
|
|
37
|
+
exports.Validator = Validator = __decorate([
|
|
38
|
+
(0, component_1.component)(),
|
|
39
|
+
__metadata("design:paramtypes", [])
|
|
40
|
+
], Validator);
|
package/core/vars.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from "./context";
|
|
2
|
+
import type * as types from "../types";
|
|
3
|
+
export declare class Vars {
|
|
4
|
+
static globalMap: Map<any, any>;
|
|
5
|
+
map: Map<any, any>;
|
|
6
|
+
get TABLES_MS_CURRENT_INDEX(): number;
|
|
7
|
+
set TABLES_MS_CURRENT_INDEX(index: number);
|
|
8
|
+
get DOING_AUTOSAVE(): boolean;
|
|
9
|
+
set DOING_AUTOSAVE(save: boolean);
|
|
10
|
+
get CONTEXT(): Context;
|
|
11
|
+
set CONTEXT(context: Context);
|
|
12
|
+
get USER_ROLES(): types.Roles;
|
|
13
|
+
set USER_ROLES(roles: types.Roles);
|
|
14
|
+
set TZ_IDENTIFIER(tz: string);
|
|
15
|
+
get TZ_IDENTIFIER(): string;
|
|
16
|
+
set TIME_OFFSET_MINUTES(offset: number);
|
|
17
|
+
get TIME_OFFSET_MINUTES(): number;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vars.d.ts","sourceRoot":"","sources":["../../src/core/vars.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAEvC,qBACa,IAAI;IACf,MAAM,CAAC,SAAS,gBAAa;IAC7B,GAAG,gBAAa;IAEhB,IAAI,uBAAuB,IAIQ,MAAM,CAFxC;IAED,IAAI,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAExC;IAED,IAAI,cAAc,IAIO,OAAO,CAF/B;IAED,IAAI,cAAc,CAAC,IAAI,EAAE,OAAO,EAE/B;IAED,IAAI,OAAO,IAIU,OAAO,CAF3B;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,EAE3B;IAED,IAAI,UAAU,IAIQ,KAAK,CAAC,KAAK,CAFhC;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAEhC;IAED,IAAI,aAAa,CAAC,EAAE,EAAE,MAAM,EAE3B;IAED,IAAI,aAAa,IAJK,MAAM,CAM3B;IAED,IAAI,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAErC;IAED,IAAI,mBAAmB,IAJS,MAAM,CAMrC;CACF"}
|
package/core/vars.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Vars = void 0;
|
|
10
|
+
const component_1 = require("../decorators/component");
|
|
11
|
+
let Vars = class Vars {
|
|
12
|
+
static globalMap = new Map();
|
|
13
|
+
map = new Map();
|
|
14
|
+
get TABLES_MS_CURRENT_INDEX() {
|
|
15
|
+
return this.map.get("TABLES_MS_CURRENT_INDEX") ?? 0;
|
|
16
|
+
}
|
|
17
|
+
set TABLES_MS_CURRENT_INDEX(index) {
|
|
18
|
+
this.map.set("TABLES_MS_CURRENT_INDEX", index);
|
|
19
|
+
}
|
|
20
|
+
get DOING_AUTOSAVE() {
|
|
21
|
+
return this.map.get("DOING_AUTOSAVE") ?? false;
|
|
22
|
+
}
|
|
23
|
+
set DOING_AUTOSAVE(save) {
|
|
24
|
+
this.map.set("DOING_AUTOSAVE", save);
|
|
25
|
+
}
|
|
26
|
+
get CONTEXT() {
|
|
27
|
+
return this.map.get("CONTEXT");
|
|
28
|
+
}
|
|
29
|
+
set CONTEXT(context) {
|
|
30
|
+
this.map.set("CONTEXT", context);
|
|
31
|
+
}
|
|
32
|
+
get USER_ROLES() {
|
|
33
|
+
return this.map.get("USER_ROLES");
|
|
34
|
+
}
|
|
35
|
+
set USER_ROLES(roles) {
|
|
36
|
+
this.map.set("USER_ROLES", roles);
|
|
37
|
+
}
|
|
38
|
+
set TZ_IDENTIFIER(tz) {
|
|
39
|
+
this.map.set("TZ_IDENTIFIER", tz);
|
|
40
|
+
}
|
|
41
|
+
get TZ_IDENTIFIER() {
|
|
42
|
+
return this.map.get("TZ_IDENTIFIER") ?? "Etc/GMT";
|
|
43
|
+
}
|
|
44
|
+
set TIME_OFFSET_MINUTES(offset) {
|
|
45
|
+
this.map.set("TIME_OFFSET_MINUTES", offset);
|
|
46
|
+
}
|
|
47
|
+
get TIME_OFFSET_MINUTES() {
|
|
48
|
+
return this.map.get("TIME_OFFSET_MINUTES") ?? 0;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.Vars = Vars;
|
|
52
|
+
exports.Vars = Vars = __decorate([
|
|
53
|
+
(0, component_1.component)()
|
|
54
|
+
], Vars);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Config } from "../config";
|
|
3
|
+
import { Components } from "../core/components";
|
|
4
|
+
import { BlogUtil } from "../core/utils/blog.util";
|
|
5
|
+
import * as val from "../validators";
|
|
6
|
+
import { Crud } from "./crud";
|
|
7
|
+
import type * as types from "../types";
|
|
8
|
+
import { SiteUtil } from "../core/utils/site.util";
|
|
9
|
+
import { SettingsCrud } from "./settings.crud";
|
|
10
|
+
type BlogUpdate = z.infer<typeof val.crud.blogUpdate>;
|
|
11
|
+
type BlogInsert = z.infer<typeof val.crud.blogInsert>;
|
|
12
|
+
type DataType = BlogUpdate & {
|
|
13
|
+
is_main_blog: boolean;
|
|
14
|
+
blogname: string;
|
|
15
|
+
url: string;
|
|
16
|
+
settings: Awaited<ReturnType<InstanceType<typeof SettingsCrud>["get"]>>["data"];
|
|
17
|
+
};
|
|
18
|
+
type BlogSettings = z.infer<typeof val.crud.settings>;
|
|
19
|
+
export declare class BlogCrud extends Crud {
|
|
20
|
+
private config;
|
|
21
|
+
private blogUtil;
|
|
22
|
+
private siteUtil;
|
|
23
|
+
constructor(components: Components, config: Config, blogUtil: BlogUtil, siteUtil: SiteUtil);
|
|
24
|
+
private checkPermission;
|
|
25
|
+
get(blogId: number): Promise<{
|
|
26
|
+
data: DataType;
|
|
27
|
+
info: undefined;
|
|
28
|
+
}>;
|
|
29
|
+
update(blogId: number, data: Partial<BlogUpdate>, options?: {
|
|
30
|
+
settings: BlogSettings;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
data: boolean;
|
|
33
|
+
info: undefined;
|
|
34
|
+
}>;
|
|
35
|
+
create(input: BlogInsert): Promise<{
|
|
36
|
+
data: number;
|
|
37
|
+
info: undefined;
|
|
38
|
+
}>;
|
|
39
|
+
delete(blogId: number): Promise<{
|
|
40
|
+
data: types.WpBlogs | undefined;
|
|
41
|
+
info: undefined;
|
|
42
|
+
}>;
|
|
43
|
+
list(args?: Partial<z.infer<typeof val.crud.blogListParams>>): Promise<{
|
|
44
|
+
data: DataType[];
|
|
45
|
+
info: {
|
|
46
|
+
pagination: {
|
|
47
|
+
page: number;
|
|
48
|
+
limit: number;
|
|
49
|
+
totalPage: number;
|
|
50
|
+
count: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=blog.crud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog.crud.d.ts","sourceRoot":"","sources":["../../src/crud/blog.crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAMnD,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtD,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtD,KAAK,QAAQ,GAAG,UAAU,GAAG;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CACf,UAAU,CAAC,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CACrD,CAAC,MAAM,CAAC,CAAC;CACX,CAAC;AACF,KAAK,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAEtD,qBACa,QAAS,SAAQ,IAAI;IAG9B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,QAAQ;gBAHhB,UAAU,EAAE,UAAU,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ;YAKd,eAAe;IAevB,GAAG,CAAC,MAAM,EAAE,MAAM;;;;IAyBlB,MAAM,CACV,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,EACzB,OAAO,CAAC,EAAE;QACR,QAAQ,EAAE,YAAY,CAAC;KACxB;;;;IAoCG,MAAM,CAAC,KAAK,EAAE,UAAU;;;;IA8ExB,MAAM,CAAC,MAAM,EAAE,MAAM;;;;IA4BrB,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;;;;;;;;;;;CA+HnE"}
|
|
@@ -0,0 +1,301 @@
|
|
|
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.BlogCrud = void 0;
|
|
46
|
+
const config_1 = require("../config");
|
|
47
|
+
const components_1 = require("../core/components");
|
|
48
|
+
const current_1 = require("../core/current");
|
|
49
|
+
const blog_util_1 = require("../core/utils/blog.util");
|
|
50
|
+
const query_util_1 = require("../core/utils/query.util");
|
|
51
|
+
const user_util_1 = require("../core/utils/user.util");
|
|
52
|
+
const component_1 = require("../decorators/component");
|
|
53
|
+
const transactions_1 = require("../transactions");
|
|
54
|
+
const val = __importStar(require("../validators"));
|
|
55
|
+
const crud_1 = require("./crud");
|
|
56
|
+
const error_1 = require("./error");
|
|
57
|
+
const site_util_1 = require("../core/utils/site.util");
|
|
58
|
+
const settings_crud_1 = require("./settings.crud");
|
|
59
|
+
const signup_util_1 = require("../core/utils/signup.util");
|
|
60
|
+
let BlogCrud = class BlogCrud extends crud_1.Crud {
|
|
61
|
+
config;
|
|
62
|
+
blogUtil;
|
|
63
|
+
siteUtil;
|
|
64
|
+
constructor(components, config, blogUtil, siteUtil) {
|
|
65
|
+
super(components);
|
|
66
|
+
this.config = config;
|
|
67
|
+
this.blogUtil = blogUtil;
|
|
68
|
+
this.siteUtil = siteUtil;
|
|
69
|
+
}
|
|
70
|
+
async checkPermission(args) {
|
|
71
|
+
const { user: currentUser } = await this.getUser();
|
|
72
|
+
const current = this.components.get(current_1.Current);
|
|
73
|
+
const { user = currentUser, blogId = current.blogId } = args ?? {};
|
|
74
|
+
if (!this.config.isMultiSite() ||
|
|
75
|
+
!(await user.can("manage_sites", [blogId])) ||
|
|
76
|
+
!(await user.can("delete_sites", [blogId])) ||
|
|
77
|
+
!(await user.can("create_sites", [blogId]))) {
|
|
78
|
+
throw new error_1.CrudError(error_1.StatusMessage.UNAUTHORIZED, "Not permitted");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async get(blogId) {
|
|
82
|
+
await this.checkPermission({ blogId });
|
|
83
|
+
const blog = await this.blogUtil.get(blogId);
|
|
84
|
+
if (!blog.props) {
|
|
85
|
+
throw new error_1.CrudError(error_1.StatusMessage.NOT_FOUND, "Blog not found");
|
|
86
|
+
}
|
|
87
|
+
const isMainBlog = (await this.blogUtil.getMainBlogId()) == blog.props.blog_id;
|
|
88
|
+
const settingsCrud = this.components.get(settings_crud_1.SettingsCrud);
|
|
89
|
+
return this.returnValue({
|
|
90
|
+
...blog.props,
|
|
91
|
+
is_main_blog: isMainBlog,
|
|
92
|
+
blogname: await blog.name(),
|
|
93
|
+
url: await blog.siteurl(),
|
|
94
|
+
blog_meta: await blog.meta.props(),
|
|
95
|
+
settings: (await settingsCrud.get({ blogId })).data,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// src/wp-admin/network/site-info.php
|
|
99
|
+
async update(blogId, data, options) {
|
|
100
|
+
const { settings } = options ?? {};
|
|
101
|
+
await this.checkPermission({ blogId });
|
|
102
|
+
const blogUtil = this.components.get(blog_util_1.BlogUtil);
|
|
103
|
+
const currentBlog = (await this.get(blogId)).data;
|
|
104
|
+
const mainBlogId = await blogUtil.getMainBlogId();
|
|
105
|
+
// On the network's main site, don't allow the domain or path to change.
|
|
106
|
+
if (mainBlogId == blogId) {
|
|
107
|
+
data.domain = currentBlog.domain;
|
|
108
|
+
data.path = currentBlog.path;
|
|
109
|
+
}
|
|
110
|
+
data.blog_id = blogId;
|
|
111
|
+
const blogTrx = this.components.get(transactions_1.BlogTrx);
|
|
112
|
+
const result = await blogTrx.upsert(data);
|
|
113
|
+
// Update wp_options
|
|
114
|
+
let settingsResult = true;
|
|
115
|
+
if (settings) {
|
|
116
|
+
const settingsCrud = this.components.get(settings_crud_1.SettingsCrud);
|
|
117
|
+
settingsResult = (await settingsCrud.update(settings, {
|
|
118
|
+
blogId,
|
|
119
|
+
})).data;
|
|
120
|
+
}
|
|
121
|
+
return this.returnValue(!!result && settingsResult);
|
|
122
|
+
}
|
|
123
|
+
// src/wp-admin/network/site-new.php
|
|
124
|
+
async create(input) {
|
|
125
|
+
await this.checkPermission();
|
|
126
|
+
const data = val.crud.blogInsert.parse(input);
|
|
127
|
+
const { user } = await this.getUser();
|
|
128
|
+
if (data.user_id) {
|
|
129
|
+
const userUtil = this.components.get(user_util_1.UserUtil);
|
|
130
|
+
const user = await userUtil.get(data.user_id);
|
|
131
|
+
await this.checkPermission({ user });
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
data.user_id = user.props?.ID;
|
|
135
|
+
}
|
|
136
|
+
if (!data.user_id) {
|
|
137
|
+
throw new error_1.CrudError(error_1.StatusMessage.BAD_REQUEST, "User not specified");
|
|
138
|
+
}
|
|
139
|
+
const signupUtil = this.components.get(signup_util_1.SignupUtil);
|
|
140
|
+
const [isTrue, validationError] = await signupUtil.validateBlog(data.domain, data.title, user);
|
|
141
|
+
if (!isTrue) {
|
|
142
|
+
throw new error_1.CrudError(error_1.StatusMessage.BAD_REQUEST, validationError ?? "Invalid input");
|
|
143
|
+
}
|
|
144
|
+
const userId = data.user_id;
|
|
145
|
+
// If not a subdomain installation, make sure the domain isn't a reserved word.
|
|
146
|
+
const reservedNames = await this.siteUtil.getReservedNames();
|
|
147
|
+
if (!this.config.isSubdomainInstall() &&
|
|
148
|
+
reservedNames.includes(data.domain)) {
|
|
149
|
+
throw new error_1.CrudError(error_1.StatusMessage.BAD_REQUEST, `The following words are reserved for use by WordPress functions and cannot be used as site names: ${data.domain}`);
|
|
150
|
+
}
|
|
151
|
+
const current = this.components.get(current_1.Current);
|
|
152
|
+
if (!current.site?.props.site.domain ||
|
|
153
|
+
!current.site?.props.site.path ||
|
|
154
|
+
!current.site?.props.site.id) {
|
|
155
|
+
throw new error_1.CrudError(error_1.StatusMessage.BAD_REQUEST, "Invalid site");
|
|
156
|
+
}
|
|
157
|
+
const siteDomain = current.site?.props.site.domain;
|
|
158
|
+
const sitePath = current.site?.props.site.path;
|
|
159
|
+
const siteId = current.site.props.site.id;
|
|
160
|
+
if (this.config.isSubdomainInstall()) {
|
|
161
|
+
data.domain = `${data.domain}.${siteDomain.replace(/^www\./, "")}`;
|
|
162
|
+
data.path = sitePath;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
data.path = `${sitePath}${data.domain}/`;
|
|
166
|
+
data.domain = siteDomain;
|
|
167
|
+
}
|
|
168
|
+
const blogTrx = this.components.get(transactions_1.BlogTrx);
|
|
169
|
+
return this.returnValue(await blogTrx.upsert({
|
|
170
|
+
...data,
|
|
171
|
+
site_id: siteId,
|
|
172
|
+
user_id: userId,
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
async delete(blogId) {
|
|
176
|
+
await this.checkPermission({ blogId });
|
|
177
|
+
const { user } = await this.getUser();
|
|
178
|
+
const blog = (await this.get(blogId)).data;
|
|
179
|
+
if (!(await user.can("delete_site", blog.blog_id))) {
|
|
180
|
+
throw new error_1.CrudError(error_1.StatusMessage.UNAUTHORIZED, "Sorry, you are not allowed to delete the site");
|
|
181
|
+
}
|
|
182
|
+
const blogUtil = this.components.get(blog_util_1.BlogUtil);
|
|
183
|
+
const mainBlogId = await blogUtil.getMainBlogId();
|
|
184
|
+
if (mainBlogId == blogId) {
|
|
185
|
+
throw new error_1.CrudError(error_1.StatusMessage.BAD_REQUEST, "Can't delete the main blog");
|
|
186
|
+
}
|
|
187
|
+
const blogTrx = this.components.get(transactions_1.BlogTrx);
|
|
188
|
+
const result = await blogTrx.remove(blogId);
|
|
189
|
+
return this.returnValue(result.props);
|
|
190
|
+
}
|
|
191
|
+
async list(args) {
|
|
192
|
+
if (args?.site || args?.site_id) {
|
|
193
|
+
const siteIds = [
|
|
194
|
+
...(args.site ?? []),
|
|
195
|
+
...(args?.site_id ? [args?.site_id] : []),
|
|
196
|
+
];
|
|
197
|
+
const { user: currentUser } = await this.getUser();
|
|
198
|
+
if (!(await currentUser.can("manage_network", siteIds))) {
|
|
199
|
+
throw new error_1.CrudError(error_1.StatusMessage.UNAUTHORIZED, "Not permitted");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
await this.checkPermission();
|
|
204
|
+
}
|
|
205
|
+
const queryUtil = this.components.get(query_util_1.QueryUtil);
|
|
206
|
+
const blogUtil = this.components.get(blog_util_1.BlogUtil);
|
|
207
|
+
const parsedArgs = val.crud.blogListParams.parse(args ?? {});
|
|
208
|
+
const buildQuery = (query) => {
|
|
209
|
+
const { column } = query.alias;
|
|
210
|
+
const offset = parsedArgs.offset ?? (parsedArgs.page - 1) * parsedArgs.per_page;
|
|
211
|
+
const limit = parsedArgs.per_page;
|
|
212
|
+
query.builder
|
|
213
|
+
.offset(offset)
|
|
214
|
+
.limit(limit)
|
|
215
|
+
.groupBy(column("blogs", "blog_id"));
|
|
216
|
+
if (parsedArgs.orderby) {
|
|
217
|
+
if (parsedArgs.orderby == "url") {
|
|
218
|
+
query.builder.orderBy([
|
|
219
|
+
{ column: column("blogs", "domain") },
|
|
220
|
+
{ column: column("blogs", "path"), order: parsedArgs.order },
|
|
221
|
+
]);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
query.builder.orderBy(column("blogs", parsedArgs.orderby), parsedArgs.order);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (Array.isArray(parsedArgs.include)) {
|
|
228
|
+
query.whereIn("blog_id", parsedArgs.include);
|
|
229
|
+
}
|
|
230
|
+
if (Array.isArray(parsedArgs.exclude)) {
|
|
231
|
+
query.andWhereNot((query) => query.whereIn("blog_id", parsedArgs.exclude));
|
|
232
|
+
}
|
|
233
|
+
if (parsedArgs.search) {
|
|
234
|
+
query.andWhere((query) => {
|
|
235
|
+
const searchColumns = ["domain", "path"];
|
|
236
|
+
for (const searchColumn of searchColumns) {
|
|
237
|
+
parsedArgs.search &&
|
|
238
|
+
query.or.whereLike(searchColumn, parsedArgs.search);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
for (const key of Object.keys(parsedArgs)) {
|
|
243
|
+
const value = parsedArgs[key];
|
|
244
|
+
if (!value)
|
|
245
|
+
continue;
|
|
246
|
+
switch (key) {
|
|
247
|
+
case "public":
|
|
248
|
+
case "archived":
|
|
249
|
+
case "mature":
|
|
250
|
+
case "spam":
|
|
251
|
+
case "deleted":
|
|
252
|
+
case "lang_id":
|
|
253
|
+
query.where(key, value);
|
|
254
|
+
break;
|
|
255
|
+
case "site_id":
|
|
256
|
+
query.where("site_id", value);
|
|
257
|
+
break;
|
|
258
|
+
case "site":
|
|
259
|
+
query.whereIn("site_id", value);
|
|
260
|
+
break;
|
|
261
|
+
case "site_exclude":
|
|
262
|
+
query.andWhereNot((query) => query.whereIn("site_id", value));
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
const blogs = (await queryUtil.blogs((query) => {
|
|
268
|
+
buildQuery(query);
|
|
269
|
+
})) ?? [];
|
|
270
|
+
const counts = await queryUtil.blogs((query) => {
|
|
271
|
+
buildQuery(query);
|
|
272
|
+
query.count("blogs", "blog_id");
|
|
273
|
+
}, val.query.resultCount);
|
|
274
|
+
const data = [];
|
|
275
|
+
for (const blog of blogUtil.toBlogs(blogs)) {
|
|
276
|
+
const props = blog.props;
|
|
277
|
+
data.push({
|
|
278
|
+
...props,
|
|
279
|
+
blog_meta: await blog.meta.props(),
|
|
280
|
+
blogname: await blog.name(),
|
|
281
|
+
url: await blog.siteurl(),
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
const pagination = this.pagination({
|
|
285
|
+
page: parsedArgs.page,
|
|
286
|
+
limit: parsedArgs.per_page,
|
|
287
|
+
count: counts?.count ?? 0,
|
|
288
|
+
});
|
|
289
|
+
return this.returnValue(data, {
|
|
290
|
+
pagination,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
exports.BlogCrud = BlogCrud;
|
|
295
|
+
exports.BlogCrud = BlogCrud = __decorate([
|
|
296
|
+
(0, component_1.component)(),
|
|
297
|
+
__metadata("design:paramtypes", [components_1.Components,
|
|
298
|
+
config_1.Config,
|
|
299
|
+
blog_util_1.BlogUtil,
|
|
300
|
+
site_util_1.SiteUtil])
|
|
301
|
+
], BlogCrud);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Comment } from "../core/comment";
|
|
3
|
+
import { Components } from "../core/components";
|
|
4
|
+
import { CommentUtil } from "../core/utils/comment.util";
|
|
5
|
+
import { PostUtil } from "../core/utils/post.util";
|
|
6
|
+
import * as val from "../validators";
|
|
7
|
+
import { Crud } from "./crud";
|
|
8
|
+
type DataUpsert = z.infer<typeof val.trx.commentUpsert>;
|
|
9
|
+
type DataBaseType = {
|
|
10
|
+
comment_parent: number;
|
|
11
|
+
post_comment_count: number;
|
|
12
|
+
post_title: string;
|
|
13
|
+
post_type: string;
|
|
14
|
+
post_guid: string;
|
|
15
|
+
post_author: number;
|
|
16
|
+
post_status: string;
|
|
17
|
+
user_display_name?: string;
|
|
18
|
+
parent_comment_author?: string;
|
|
19
|
+
parent_user_display_name?: string;
|
|
20
|
+
parent_user_id: number;
|
|
21
|
+
children?: Awaited<ReturnType<InstanceType<typeof Comment>["children"]>>;
|
|
22
|
+
count_children: number;
|
|
23
|
+
};
|
|
24
|
+
type DataType<T extends "view" | "edit" | "embed"> = T extends "edit" ? DataBaseType & Comment["props"] & {
|
|
25
|
+
metas: Record<string, any>;
|
|
26
|
+
} : DataBaseType & {
|
|
27
|
+
comment_ID: number;
|
|
28
|
+
comment_post_ID: number;
|
|
29
|
+
comment_author: string;
|
|
30
|
+
comment_date: string;
|
|
31
|
+
comment_date_gmt: string;
|
|
32
|
+
comment_content: string;
|
|
33
|
+
comment_approved: string;
|
|
34
|
+
comment_type: string;
|
|
35
|
+
user_id: number;
|
|
36
|
+
};
|
|
37
|
+
export declare class CommentCrud extends Crud {
|
|
38
|
+
private commentUtil;
|
|
39
|
+
private postUtil;
|
|
40
|
+
constructor(components: Components, commentUtil: CommentUtil, postUtil: PostUtil);
|
|
41
|
+
private canReadPostComment;
|
|
42
|
+
private canRead;
|
|
43
|
+
private canEdit;
|
|
44
|
+
private formReturnData;
|
|
45
|
+
getAsUpsert(commentId: number): Promise<{
|
|
46
|
+
data: {
|
|
47
|
+
comment_post_ID: number;
|
|
48
|
+
comment_author: string;
|
|
49
|
+
comment_content: string;
|
|
50
|
+
comment_karma: number;
|
|
51
|
+
comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
|
|
52
|
+
comment_agent: string;
|
|
53
|
+
comment_type: string;
|
|
54
|
+
comment_parent: number;
|
|
55
|
+
user_id: number;
|
|
56
|
+
comment_meta: Record<string, any>;
|
|
57
|
+
comment_ID?: number | undefined;
|
|
58
|
+
comment_author_email?: string | undefined;
|
|
59
|
+
comment_author_url?: string | undefined;
|
|
60
|
+
comment_author_IP?: string | undefined;
|
|
61
|
+
comment_date?: string | undefined;
|
|
62
|
+
comment_date_gmt?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
info: undefined;
|
|
65
|
+
}>;
|
|
66
|
+
get<T extends "view" | "edit" | "embed">(commentId: number, options?: Partial<{
|
|
67
|
+
context: T;
|
|
68
|
+
password: string;
|
|
69
|
+
}>): Promise<{
|
|
70
|
+
data: DataType<T>;
|
|
71
|
+
info: undefined;
|
|
72
|
+
}>;
|
|
73
|
+
create(data: Partial<DataUpsert>, options?: Partial<{
|
|
74
|
+
remoteIp: string;
|
|
75
|
+
}>): Promise<{
|
|
76
|
+
data: number;
|
|
77
|
+
info: undefined;
|
|
78
|
+
}>;
|
|
79
|
+
update(commentId: number, data: Partial<DataUpsert>): Promise<{
|
|
80
|
+
data: number;
|
|
81
|
+
info: undefined;
|
|
82
|
+
}>;
|
|
83
|
+
delete(commentId: number, force?: boolean): Promise<{
|
|
84
|
+
data: boolean;
|
|
85
|
+
info: undefined;
|
|
86
|
+
}>;
|
|
87
|
+
list<T extends "view" | "edit" | "embed">(args?: Partial<z.infer<typeof val.crud.commentListParams>>, options?: {
|
|
88
|
+
context?: T;
|
|
89
|
+
password?: string;
|
|
90
|
+
limitChildren?: number;
|
|
91
|
+
}): Promise<{
|
|
92
|
+
data: DataType<T>[];
|
|
93
|
+
info: {
|
|
94
|
+
pagination: {
|
|
95
|
+
page: number;
|
|
96
|
+
limit: number;
|
|
97
|
+
totalPage: number;
|
|
98
|
+
count: number;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}>;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=comment.crud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.crud.d.ts","sourceRoot":"","sources":["../../src/crud/comment.crud.ts"],"names":[],"mappings":"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"}
|