@rnaga/wp-node 1.2.8 → 1.2.10

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.
@@ -10,14 +10,20 @@ declare const allowedOptions: {
10
10
  reading: readonly ["posts_per_page", "posts_per_rss", "rss_use_excerpt", "show_on_front", "page_on_front", "page_for_posts", "blog_public"];
11
11
  writing: readonly ["default_category", "default_email_category", "default_link_category", "default_post_format"];
12
12
  };
13
- type AllowedOptions = typeof allowedOptions;
13
+ type AllowedOptions = {
14
+ general: readonly ((typeof allowedOptions.general)[number] | "users_can_register" | "default_role")[];
15
+ discussion: readonly (typeof allowedOptions.discussion)[number][];
16
+ media: readonly (typeof allowedOptions.media)[number][];
17
+ reading: readonly (typeof allowedOptions.reading)[number][];
18
+ writing: readonly (typeof allowedOptions.writing)[number][];
19
+ };
14
20
  type AllowedOptionKeys = AllowedOptions[keyof AllowedOptions][number][];
15
21
  export declare class OptionsCrud extends Crud {
16
22
  private config;
17
23
  constructor(components: Components, config: Config);
18
24
  private checkPermission;
19
25
  getAll(options?: Parameters<OptionsCrud["get"]>[1]): Promise<{
20
- data: Record<"blogname" | "blogdescription" | "admin_email" | "start_of_week" | "require_name_email" | "comments_notify" | "posts_per_rss" | "rss_use_excerpt" | "default_category" | "default_comment_status" | "default_ping_status" | "default_pingback_flag" | "posts_per_page" | "date_format" | "time_format" | "comment_moderation" | "moderation_notify" | "moderation_keys" | "comment_max_links" | "gmt_offset" | "default_email_category" | "comment_registration" | "blog_public" | "default_link_category" | "show_on_front" | "show_avatars" | "avatar_rating" | "thumbnail_size_w" | "thumbnail_size_h" | "thumbnail_crop" | "medium_size_w" | "medium_size_h" | "avatar_default" | "large_size_w" | "large_size_h" | "image_default_link_type" | "image_default_size" | "image_default_align" | "close_comments_for_old_posts" | "close_comments_days_old" | "thread_comments" | "thread_comments_depth" | "page_comments" | "comments_per_page" | "default_comments_page" | "comment_order" | "timezone_string" | "page_for_posts" | "page_on_front" | "default_post_format" | "show_comments_cookies_opt_in" | "disallowed_keys" | "comment_previously_approved", any>;
26
+ data: Record<"blogname" | "blogdescription" | "users_can_register" | "admin_email" | "start_of_week" | "require_name_email" | "comments_notify" | "posts_per_rss" | "rss_use_excerpt" | "default_category" | "default_comment_status" | "default_ping_status" | "default_pingback_flag" | "posts_per_page" | "date_format" | "time_format" | "comment_moderation" | "moderation_notify" | "moderation_keys" | "comment_max_links" | "gmt_offset" | "default_email_category" | "comment_registration" | "default_role" | "blog_public" | "default_link_category" | "show_on_front" | "show_avatars" | "avatar_rating" | "thumbnail_size_w" | "thumbnail_size_h" | "thumbnail_crop" | "medium_size_w" | "medium_size_h" | "avatar_default" | "large_size_w" | "large_size_h" | "image_default_link_type" | "image_default_size" | "image_default_align" | "close_comments_for_old_posts" | "close_comments_days_old" | "thread_comments" | "thread_comments_depth" | "page_comments" | "comments_per_page" | "default_comments_page" | "comment_order" | "timezone_string" | "page_for_posts" | "page_on_front" | "default_post_format" | "show_comments_cookies_opt_in" | "disallowed_keys" | "comment_previously_approved", any>;
21
27
  info: undefined;
22
28
  }>;
23
29
  get<T extends keyof AllowedOptions, K extends T extends keyof AllowedOptions ? AllowedOptions[T] : AllowedOptionKeys>(key?: T, options?: Partial<{
@@ -1 +1 @@
1
- {"version":3,"file":"options.crud.d.ts","sourceRoot":"","sources":["../../src/crud/options.crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAM9B,QAAA,MAAM,cAAc;;;;;;CAgEnB,CAAC;AAEF,KAAK,cAAc,GAAG,OAAO,cAAc,CAAC;AAC5C,KAAK,iBAAiB,GAAG,cAAc,CAAC,M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EAAE,SAAS,CAAC,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAClE,KAAK,EAAE,SAAS,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACxD,OAAO,EAAE,SAAS,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5D,OAAO,EAAE,SAAS,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;CAC7D,CAAC;AAEF,KAAK,iBAAiB,GAAG,cAAc,CAAC,MAAM,cAAc,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;AAExE,qBACa,WAAY,SAAQ,IAAI;IACC,OAAO,CAAC,MAAM;gBAAtC,UAAU,EAAE,UAAU,EAAU,MAAM,EAAE,MAAM;YAI5C,eAAe;IAYvB,MAAM,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;;;;IAIlD,GAAG,CACP,CAAC,SAAS,MAAM,cAAc,EAC9B,CAAC,SAAS,CAAC,SAAS,MAAM,cAAc,GACpC,cAAc,CAAC,CAAC,CAAC,GACjB,iBAAiB,EACrB,GAAG,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;;;;IAuC1C,MAAM,CACV,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,EAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;;;;CAkBxC"}
@@ -52,7 +52,6 @@ const component_1 = require("../decorators/component");
52
52
  const val = __importStar(require("../validators"));
53
53
  const crud_1 = require("./crud");
54
54
  const error_1 = require("./error");
55
- //import type * as types from "../types";
56
55
  // src/wp-admin/options.php
57
56
  const allowedOptions = {
58
57
  general: [
@@ -144,9 +143,20 @@ let OptionsCrud = class OptionsCrud extends crud_1.Crud {
144
143
  if (blogId && this.config.isMultiSite()) {
145
144
  await context.current.switchBlog(blogId);
146
145
  }
146
+ const redefinedAllowedOptions = this.config.isMultiSite()
147
+ ? allowedOptions
148
+ : // For single site, we add user_registration and default_role to the general options
149
+ {
150
+ ...allowedOptions,
151
+ general: [
152
+ ...allowedOptions.general,
153
+ "users_can_register",
154
+ "default_role",
155
+ ],
156
+ };
147
157
  const optionNames = key
148
- ? allowedOptions[key]
149
- : Object.values(allowedOptions).flat(); //this.config.config.options.defaults;
158
+ ? redefinedAllowedOptions[key]
159
+ : Object.values(redefinedAllowedOptions).flat();
150
160
  const data = ((await context.utils.query.options((query) => {
151
161
  query.whereIn(optionNames);
152
162
  }, zod_1.z.array(val.query.optionsResult))) ?? [])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnaga/wp-node",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && tsc --project tsconfig.build.json && npm run copyfiles && cp package.json ./dist/",
@@ -19,6 +19,7 @@
19
19
  "mariadb"
20
20
  ],
21
21
  "author": "Ryohei Nagatsuka",
22
+ "license": "MIT",
22
23
  "devDependencies": {
23
24
  "@types/node": "^22",
24
25
  "copyfiles": "^2.4.1",