@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":"meta.d.ts","sourceRoot":"","sources":["../../src/core/meta.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAEvC,qBACa,IAAI;IAEb,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,MAAM;gBAHN,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKrC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,MAAM;IAMtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI7B,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM;YAOhB,IAAI;YAQJ,OAAO;YAQP,IAAI;YAQJ,IAAI;YAQJ,IAAI;YAQJ,IAAI;IAQZ,KAAK;CAaZ"}
|
package/core/meta.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
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.Meta = void 0;
|
|
46
|
+
const zod_1 = require("zod");
|
|
47
|
+
const formatting_1 = require("../common/formatting");
|
|
48
|
+
const constants_1 = require("../constants");
|
|
49
|
+
const component_1 = require("../decorators/component");
|
|
50
|
+
const val = __importStar(require("../validators"));
|
|
51
|
+
const query_util_1 = require("./utils/query.util");
|
|
52
|
+
let Meta = class Meta {
|
|
53
|
+
queryUtil;
|
|
54
|
+
table;
|
|
55
|
+
id;
|
|
56
|
+
_props;
|
|
57
|
+
constructor(queryUtil, table, id, _props) {
|
|
58
|
+
this.queryUtil = queryUtil;
|
|
59
|
+
this.table = table;
|
|
60
|
+
this.id = id;
|
|
61
|
+
this._props = _props;
|
|
62
|
+
this._props = {};
|
|
63
|
+
}
|
|
64
|
+
set(table, id) {
|
|
65
|
+
this.table = table;
|
|
66
|
+
this.id = id;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
setProps(props) {
|
|
70
|
+
this._props = props;
|
|
71
|
+
}
|
|
72
|
+
async get(key) {
|
|
73
|
+
if (!this._props[key]) {
|
|
74
|
+
this._props = await this.props();
|
|
75
|
+
}
|
|
76
|
+
return this._props[key];
|
|
77
|
+
}
|
|
78
|
+
async post() {
|
|
79
|
+
return ((await this.queryUtil.posts((query) => {
|
|
80
|
+
query.withMeta("inner").where("ID", this.id);
|
|
81
|
+
}, zod_1.z.array(val.database.wpPostMeta))) ?? []);
|
|
82
|
+
}
|
|
83
|
+
async comment() {
|
|
84
|
+
return ((await this.queryUtil.comments((query) => {
|
|
85
|
+
query.withMeta("inner").where("ID", this.id);
|
|
86
|
+
}, zod_1.z.array(val.database.wpCommentMeta))) ?? []);
|
|
87
|
+
}
|
|
88
|
+
async site() {
|
|
89
|
+
return ((await this.queryUtil.sites((query) => {
|
|
90
|
+
query.withMeta("inner").where("id", this.id);
|
|
91
|
+
}, zod_1.z.array(val.database.wpSiteMeta))) ?? []);
|
|
92
|
+
}
|
|
93
|
+
async blog() {
|
|
94
|
+
return ((await this.queryUtil.blogs((query) => {
|
|
95
|
+
query.withMeta("inner").where("blog_id", this.id);
|
|
96
|
+
}, zod_1.z.array(val.database.wpBlogMeta))) ?? []);
|
|
97
|
+
}
|
|
98
|
+
async term() {
|
|
99
|
+
return ((await this.queryUtil.terms((query) => {
|
|
100
|
+
query.withMeta("inner").where("term_id", this.id);
|
|
101
|
+
}, zod_1.z.array(val.database.wpTermMeta))) ?? []);
|
|
102
|
+
}
|
|
103
|
+
async user() {
|
|
104
|
+
return ((await this.queryUtil.users((query) => {
|
|
105
|
+
query.withMeta("inner").where("ID", this.id);
|
|
106
|
+
}, zod_1.z.array(val.database.wpUserMeta))) ?? []);
|
|
107
|
+
}
|
|
108
|
+
async props() {
|
|
109
|
+
const result = await this[this.table]();
|
|
110
|
+
result.forEach((meta) => {
|
|
111
|
+
if (typeof meta.meta_key !== "string" || 0 >= meta.meta_key.length) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this._props[meta.meta_key] = formatting_1.formatting.primitive(meta.meta_value);
|
|
115
|
+
});
|
|
116
|
+
return this._props;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
exports.Meta = Meta;
|
|
120
|
+
exports.Meta = Meta = __decorate([
|
|
121
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
122
|
+
__metadata("design:paramtypes", [query_util_1.QueryUtil, String, Number, Object])
|
|
123
|
+
], Meta);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Config } from "../config";
|
|
2
|
+
import { Components } from "./components";
|
|
3
|
+
import { Logger } from "./logger";
|
|
4
|
+
export declare class Options {
|
|
5
|
+
private components;
|
|
6
|
+
private logger;
|
|
7
|
+
private config;
|
|
8
|
+
constructor(components: Components, logger: Logger, config: Config);
|
|
9
|
+
private get tables();
|
|
10
|
+
usingBlog(id: number): this;
|
|
11
|
+
resetBlog(): this;
|
|
12
|
+
private getMultiple;
|
|
13
|
+
get<T = string, Name extends string | string[] = string>(name: Name, args?: {
|
|
14
|
+
withPrefix?: boolean;
|
|
15
|
+
siteId?: number | undefined;
|
|
16
|
+
blogId?: number | undefined;
|
|
17
|
+
default?: T;
|
|
18
|
+
}): Promise<Name extends string ? T | undefined : Map<string, any>>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/core/options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,qBACa,OAAO;IAEhB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;gBAFN,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM;IAGxB,OAAO,KAAK,MAAM,GAEjB;IAED,SAAS,CAAC,EAAE,EAAE,MAAM;IAKpB,SAAS;YAKK,WAAW;IA0CnB,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAC3D,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,OAAO,CAAC,EAAE,CAAC,CAAC;KACb,GACA,OAAO,CAAC,IAAI,SAAS,MAAM,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAkCnE"}
|
package/core/options.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
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.Options = void 0;
|
|
46
|
+
const zod_1 = require("zod");
|
|
47
|
+
const common_1 = require("../common");
|
|
48
|
+
const config_1 = require("../config");
|
|
49
|
+
const constants_1 = require("../constants");
|
|
50
|
+
const component_1 = require("../decorators/component");
|
|
51
|
+
const val = __importStar(require("../validators"));
|
|
52
|
+
const components_1 = require("./components");
|
|
53
|
+
const current_1 = require("./current");
|
|
54
|
+
const logger_1 = require("./logger");
|
|
55
|
+
const meta_util_1 = require("./utils/meta.util");
|
|
56
|
+
const query_util_1 = require("./utils/query.util");
|
|
57
|
+
let Options = class Options {
|
|
58
|
+
components;
|
|
59
|
+
logger;
|
|
60
|
+
config;
|
|
61
|
+
constructor(components, logger, config) {
|
|
62
|
+
this.components = components;
|
|
63
|
+
this.logger = logger;
|
|
64
|
+
this.config = config;
|
|
65
|
+
}
|
|
66
|
+
get tables() {
|
|
67
|
+
return this.components.get(current_1.Current).tables;
|
|
68
|
+
}
|
|
69
|
+
usingBlog(id) {
|
|
70
|
+
if (this.config.isMultiSite())
|
|
71
|
+
this.tables.index = id;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
resetBlog() {
|
|
75
|
+
this.usingBlog(-99);
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
async getMultiple(names, args) {
|
|
79
|
+
const queryUtil = this.components
|
|
80
|
+
.get(query_util_1.QueryUtil)
|
|
81
|
+
.usingBlog(this.tables.index);
|
|
82
|
+
const result = new Map();
|
|
83
|
+
try {
|
|
84
|
+
if (typeof args?.siteId === "number") {
|
|
85
|
+
const metaUtil = this.components.get(meta_util_1.MetaUtil);
|
|
86
|
+
for (const name of names) {
|
|
87
|
+
const value = await metaUtil.getValue("site", args.siteId, name);
|
|
88
|
+
result.set(name, common_1.formatting.primitive(value));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const options = (await queryUtil
|
|
93
|
+
.usingBlog(args?.blogId ?? this.tables.index)
|
|
94
|
+
.options((query) => {
|
|
95
|
+
query.whereIn(names);
|
|
96
|
+
}, zod_1.z.array(val.database.wpOptions))) ?? [];
|
|
97
|
+
for (const option of options) {
|
|
98
|
+
result.set(option.option_name, common_1.formatting.primitive(option.option_value));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
this.logger.info(`Option not found: ${names}`);
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
async get(name, args) {
|
|
108
|
+
const queryUtil = this.components
|
|
109
|
+
.get(query_util_1.QueryUtil)
|
|
110
|
+
.usingBlog(this.tables.index);
|
|
111
|
+
let value;
|
|
112
|
+
try {
|
|
113
|
+
if (Array.isArray(name)) {
|
|
114
|
+
return (await this.getMultiple(name, args));
|
|
115
|
+
}
|
|
116
|
+
else if (typeof name === "string") {
|
|
117
|
+
if (typeof args?.siteId === "number") {
|
|
118
|
+
// get_network_option( null, $option, $default_value )
|
|
119
|
+
// get_site_option( $option, $default_value = false, $deprecated = true )
|
|
120
|
+
const metaUtil = this.components.get(meta_util_1.MetaUtil);
|
|
121
|
+
value = await metaUtil.getValue("site", args.siteId, name);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
const option = await queryUtil
|
|
125
|
+
.usingBlog(args?.blogId ?? this.tables.index)
|
|
126
|
+
.options((query) => {
|
|
127
|
+
query.get(args?.withPrefix ? this.tables.get(name) : name);
|
|
128
|
+
});
|
|
129
|
+
value = common_1.formatting.primitive(option?.option_value);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
this.logger.info(`Option not found: ${name}`);
|
|
135
|
+
}
|
|
136
|
+
if (!value && args?.default) {
|
|
137
|
+
value = args.default;
|
|
138
|
+
}
|
|
139
|
+
return value ?? undefined;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
exports.Options = Options;
|
|
143
|
+
exports.Options = Options = __decorate([
|
|
144
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
145
|
+
__metadata("design:paramtypes", [components_1.Components,
|
|
146
|
+
logger_1.Logger,
|
|
147
|
+
config_1.Config])
|
|
148
|
+
], Options);
|
package/core/post.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Logger } from "./logger";
|
|
2
|
+
import { Meta } from "./meta";
|
|
3
|
+
import { QueryUtil } from "./utils/query.util";
|
|
4
|
+
import type * as types from "../types";
|
|
5
|
+
type Props = types.Tables["posts"];
|
|
6
|
+
export declare class Post {
|
|
7
|
+
meta: Meta;
|
|
8
|
+
private logger;
|
|
9
|
+
private queryUtil;
|
|
10
|
+
private postId;
|
|
11
|
+
private _props;
|
|
12
|
+
private _terms;
|
|
13
|
+
private _parents;
|
|
14
|
+
private _children;
|
|
15
|
+
filter: "raw" | "edit" | "db" | "display" | "sample";
|
|
16
|
+
constructor(meta: Meta, logger: Logger, queryUtil: QueryUtil, postId: number, _props: Props, _terms: Map<string, types.WpTerms[]>, _parents?: types.Tables["posts"][], _children?: types.Tables["posts"][]);
|
|
17
|
+
get props(): types.WpPosts | undefined;
|
|
18
|
+
withProps(props: Partial<Props>): this;
|
|
19
|
+
children(): Promise<types.WpPosts[]>;
|
|
20
|
+
parents(): Promise<types.WpPosts[]>;
|
|
21
|
+
terms(taxonomy: types.TaxonomyName): Promise<types.WpTerms[] | undefined>;
|
|
22
|
+
author(): Promise<{
|
|
23
|
+
spam: number;
|
|
24
|
+
deleted: number;
|
|
25
|
+
ID: number;
|
|
26
|
+
user_login: string;
|
|
27
|
+
user_email: string;
|
|
28
|
+
user_pass: string;
|
|
29
|
+
user_nicename: string;
|
|
30
|
+
user_activation_key: string;
|
|
31
|
+
user_status: number;
|
|
32
|
+
display_name: string;
|
|
33
|
+
user_url?: string | undefined;
|
|
34
|
+
user_registered?: string | undefined;
|
|
35
|
+
} | undefined>;
|
|
36
|
+
private init;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=post.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/core/post.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AACvC,KAAK,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnC,qBACa,IAAI;IAKN,IAAI,EAAE,IAAI;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;IATnB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAS;gBAEpD,IAAI,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EACpC,QAAQ,GAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAO,EACtC,SAAS,GAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAO;IAMjD,IAAI,KAAK,8BAER;IAED,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC;IAKzB,QAAQ;IAiBR,OAAO;IAgBP,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,YAAY;IAuBlC,MAAM;;;;;;;;;;;;;;YAOE,IAAI;CAiBnB"}
|
package/core/post.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
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.Post = void 0;
|
|
46
|
+
const zod_1 = require("zod");
|
|
47
|
+
const constants_1 = require("../constants/");
|
|
48
|
+
const async_init_1 = require("../decorators/async-init");
|
|
49
|
+
const component_1 = require("../decorators/component");
|
|
50
|
+
const val = __importStar(require("../validators"));
|
|
51
|
+
const logger_1 = require("./logger");
|
|
52
|
+
const meta_1 = require("./meta");
|
|
53
|
+
const query_util_1 = require("./utils/query.util");
|
|
54
|
+
let Post = class Post {
|
|
55
|
+
meta;
|
|
56
|
+
logger;
|
|
57
|
+
queryUtil;
|
|
58
|
+
postId;
|
|
59
|
+
_props;
|
|
60
|
+
_terms;
|
|
61
|
+
_parents;
|
|
62
|
+
_children;
|
|
63
|
+
// Optional. Type of filter to apply. Accepts 'raw', 'edit', 'db',
|
|
64
|
+
// or 'display'. Default 'raw'.
|
|
65
|
+
filter = "raw";
|
|
66
|
+
constructor(meta, logger, queryUtil, postId, _props, _terms, _parents = [], _children = []) {
|
|
67
|
+
this.meta = meta;
|
|
68
|
+
this.logger = logger;
|
|
69
|
+
this.queryUtil = queryUtil;
|
|
70
|
+
this.postId = postId;
|
|
71
|
+
this._props = _props;
|
|
72
|
+
this._terms = _terms;
|
|
73
|
+
this._parents = _parents;
|
|
74
|
+
this._children = _children;
|
|
75
|
+
this.meta.set("post", postId);
|
|
76
|
+
this._terms = new Map();
|
|
77
|
+
}
|
|
78
|
+
get props() {
|
|
79
|
+
return !this._props ? undefined : this._props;
|
|
80
|
+
}
|
|
81
|
+
withProps(props) {
|
|
82
|
+
this._props = { ...this._props, ...props };
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
async children() {
|
|
86
|
+
if (!this._props?.ID || this._children.length > 0) {
|
|
87
|
+
return this._children;
|
|
88
|
+
}
|
|
89
|
+
const postId = this.props?.ID;
|
|
90
|
+
this._children =
|
|
91
|
+
(await this.queryUtil.posts((query) => {
|
|
92
|
+
query.withChildren(postId).builder.clear("select").select("*");
|
|
93
|
+
}, zod_1.z.array(val.database.wpPosts))) ?? [];
|
|
94
|
+
//this._children = this._children.filter((post) => post.ID != this._props.ID);
|
|
95
|
+
return this._children;
|
|
96
|
+
}
|
|
97
|
+
// get_post_ancestors
|
|
98
|
+
async parents() {
|
|
99
|
+
if (!this._props?.ID || this._parents.length > 0) {
|
|
100
|
+
return this._parents;
|
|
101
|
+
}
|
|
102
|
+
const postId = this.props?.ID;
|
|
103
|
+
this._parents =
|
|
104
|
+
(await this.queryUtil.posts((query) => {
|
|
105
|
+
query.withParents(postId).builder.clear("select").select("*");
|
|
106
|
+
}, zod_1.z.array(val.database.wpPosts))) ?? [];
|
|
107
|
+
//this._parents = this._parents.filter((post) => post.ID != this.props?.ID);
|
|
108
|
+
return this._parents;
|
|
109
|
+
}
|
|
110
|
+
async terms(taxonomy) {
|
|
111
|
+
if (!this._props?.ID)
|
|
112
|
+
return [];
|
|
113
|
+
if (this._terms.get(taxonomy)) {
|
|
114
|
+
return this._terms.get(taxonomy) ?? [];
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
const terms = await this.queryUtil.terms((query) => {
|
|
118
|
+
const { column } = query.alias;
|
|
119
|
+
query
|
|
120
|
+
.withObjectIds([this._props.ID])
|
|
121
|
+
.where("taxonomy", taxonomy)
|
|
122
|
+
.builder.orderBy(column("terms", "term_id"), "asc");
|
|
123
|
+
}, zod_1.z.array(val.database.wpTerms));
|
|
124
|
+
terms && this._terms.set(taxonomy, terms);
|
|
125
|
+
return terms;
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
this.logger.info(`Terms not found: ${taxonomy}`);
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async author() {
|
|
133
|
+
return await this.queryUtil.users((query) => {
|
|
134
|
+
query.where("ID", this._props.post_author).builder.first();
|
|
135
|
+
}, val.database.wpUsers);
|
|
136
|
+
}
|
|
137
|
+
async init() {
|
|
138
|
+
if (0 >= this.postId) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this.meta.set("post", this.postId);
|
|
142
|
+
const post = await this.queryUtil.posts((query) => {
|
|
143
|
+
query.get(this.postId);
|
|
144
|
+
}, val.database.wpPosts);
|
|
145
|
+
if (!post) {
|
|
146
|
+
this.logger.info(`Post not found: ${this.postId}`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this._props = post;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
exports.Post = Post;
|
|
153
|
+
__decorate([
|
|
154
|
+
async_init_1.asyncInit,
|
|
155
|
+
__metadata("design:type", Function),
|
|
156
|
+
__metadata("design:paramtypes", []),
|
|
157
|
+
__metadata("design:returntype", Promise)
|
|
158
|
+
], Post.prototype, "init", null);
|
|
159
|
+
exports.Post = Post = __decorate([
|
|
160
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
161
|
+
__metadata("design:paramtypes", [meta_1.Meta,
|
|
162
|
+
logger_1.Logger,
|
|
163
|
+
query_util_1.QueryUtil, Number, Object, Map, Array, Array])
|
|
164
|
+
], Post);
|
package/core/query.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { QueryBuilders } from "../query-builder";
|
|
2
|
+
import { Validator } from "./validator";
|
|
3
|
+
import type * as types from "../types";
|
|
4
|
+
type builderFunction = (query: types.QueryBuilder, builders: QueryBuilders) => void;
|
|
5
|
+
export declare class Query {
|
|
6
|
+
#private;
|
|
7
|
+
private builders;
|
|
8
|
+
private validator;
|
|
9
|
+
constructor(builders: QueryBuilders, validator: Validator);
|
|
10
|
+
build(fn: builderFunction): this;
|
|
11
|
+
execute<T extends types.validating.Parser>(validating?: T): Promise<types.validating.ParserReturnType<T>>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/core/query.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAEvC,KAAK,eAAe,GAAG,CACrB,KAAK,EAAE,KAAK,CAAC,YAAY,EACzB,QAAQ,EAAE,aAAa,KACpB,IAAI,CAAC;AAEV,qBACa,KAAK;;IAEJ,OAAO,CAAC,QAAQ;IAAiB,OAAO,CAAC,SAAS;gBAA1C,QAAQ,EAAE,aAAa,EAAU,SAAS,EAAE,SAAS;IAIzE,KAAK,CAAC,EAAE,EAAE,eAAe;IAKnB,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;CAMhE"}
|
package/core/query.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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.Query = void 0;
|
|
13
|
+
const constants_1 = require("../constants");
|
|
14
|
+
const component_1 = require("../decorators/component");
|
|
15
|
+
const query_builder_1 = require("../query-builder");
|
|
16
|
+
const validator_1 = require("./validator");
|
|
17
|
+
let Query = class Query {
|
|
18
|
+
builders;
|
|
19
|
+
validator;
|
|
20
|
+
#query;
|
|
21
|
+
constructor(builders, validator) {
|
|
22
|
+
this.builders = builders;
|
|
23
|
+
this.validator = validator;
|
|
24
|
+
this.#query = this.builders.queryBuilder;
|
|
25
|
+
}
|
|
26
|
+
build(fn) {
|
|
27
|
+
fn(this.#query, this.builders);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
async execute(validating) {
|
|
31
|
+
const result = await this.#query;
|
|
32
|
+
return (!validating ? result : this.validator.execSafe(validating, result));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.Query = Query;
|
|
36
|
+
exports.Query = Query = __decorate([
|
|
37
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
38
|
+
__metadata("design:paramtypes", [query_builder_1.QueryBuilders, validator_1.Validator])
|
|
39
|
+
], Query);
|
package/core/role.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Components } from "./components";
|
|
2
|
+
import { User } from "./user";
|
|
3
|
+
import type * as types from "../types";
|
|
4
|
+
import { Config } from "../config";
|
|
5
|
+
export declare class Role {
|
|
6
|
+
private components;
|
|
7
|
+
private config;
|
|
8
|
+
readonly primaryName: types.RoleNames;
|
|
9
|
+
names: Set<string>;
|
|
10
|
+
capabilities: Set<string>;
|
|
11
|
+
constructor(components: Components, config: Config, primaryName?: types.RoleNames, capabilities?: string[]);
|
|
12
|
+
addNames(names: string[]): void;
|
|
13
|
+
isSuperAdmin(): boolean;
|
|
14
|
+
isAdmin(): boolean;
|
|
15
|
+
is<T>(roleName: T): boolean;
|
|
16
|
+
add(capabilities: string[]): void;
|
|
17
|
+
has<T>(cap: T): boolean;
|
|
18
|
+
can<T extends types.RoleCapabilityActions>(action: T, user: number | User, ...args: any): Promise<boolean>;
|
|
19
|
+
can(action: string, user: number | User, ...args: any): Promise<boolean>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=role.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/core/role.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,qBACa,IAAI;IAKb,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;aACE,WAAW,EAAE,KAAK,CAAC,SAAS;IANvC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IAC/B,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;gBAGnC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACN,WAAW,GAAE,KAAK,CAAC,SAAuB,EAC1D,YAAY,GAAE,MAAM,EAAO;IAS7B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE;IAKxB,YAAY;IAOZ,OAAO;IAIP,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,OAAO;IAK3B,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE;IAI1B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO;IAKjB,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,qBAAqB,EAC7C,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,GAAG,IAAI,EAAE,GAAG,GACX,OAAO,CAAC,OAAO,CAAC;IACb,GAAG,CACP,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,GAAG,IAAI,EAAE,GAAG,GACX,OAAO,CAAC,OAAO,CAAC;CAgBpB"}
|
package/core/role.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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.Role = void 0;
|
|
13
|
+
const constants_1 = require("../constants");
|
|
14
|
+
const component_1 = require("../decorators/component");
|
|
15
|
+
const capabilities_1 = require("./capabilities");
|
|
16
|
+
const components_1 = require("./components");
|
|
17
|
+
const config_1 = require("../config");
|
|
18
|
+
let Role = class Role {
|
|
19
|
+
components;
|
|
20
|
+
config;
|
|
21
|
+
primaryName;
|
|
22
|
+
names = new Set();
|
|
23
|
+
capabilities = new Set();
|
|
24
|
+
constructor(components, config, primaryName = "anonymous", capabilities = []) {
|
|
25
|
+
this.components = components;
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.primaryName = primaryName;
|
|
28
|
+
this.primaryName = this.primaryName.toLowerCase();
|
|
29
|
+
this.addNames([this.primaryName]);
|
|
30
|
+
if (Array.isArray(capabilities)) {
|
|
31
|
+
this.add(capabilities);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
addNames(names) {
|
|
35
|
+
names.map((name) => this.names.add(name.toLowerCase()));
|
|
36
|
+
}
|
|
37
|
+
// is_super_admin
|
|
38
|
+
isSuperAdmin() {
|
|
39
|
+
return ((this.config.isMultiSite() && this.is("superadmin")) ||
|
|
40
|
+
(!this.config.isMultiSite() && this.has("delete_users")));
|
|
41
|
+
}
|
|
42
|
+
isAdmin() {
|
|
43
|
+
return this.is("administrator") || this.isSuperAdmin();
|
|
44
|
+
}
|
|
45
|
+
is(roleName) {
|
|
46
|
+
return this.names.has(roleName);
|
|
47
|
+
}
|
|
48
|
+
add(capabilities) {
|
|
49
|
+
capabilities.map((capability) => this.capabilities.add(capability));
|
|
50
|
+
}
|
|
51
|
+
has(cap) {
|
|
52
|
+
return this.capabilities.has(cap);
|
|
53
|
+
}
|
|
54
|
+
async can(action, user, ...args) {
|
|
55
|
+
if (typeof action === "undefined") {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const capabilities = this.components.get(capabilities_1.Capabilities);
|
|
59
|
+
const results = await capabilities.check(action, user, ...args);
|
|
60
|
+
if (results.includes(constants_1.DO_NOT_ALLOW)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return results.length == results.filter((cap) => this.has(cap)).length;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.Role = Role;
|
|
67
|
+
exports.Role = Role = __decorate([
|
|
68
|
+
(0, component_1.component)({ scope: constants_1.Scope.Transient }),
|
|
69
|
+
__metadata("design:paramtypes", [components_1.Components,
|
|
70
|
+
config_1.Config, Object, Array])
|
|
71
|
+
], Role);
|