@rnaga/wp-node 1.1.4 → 1.2.3

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.
Files changed (80) hide show
  1. package/README.md +20 -0
  2. package/config.d.ts +32 -32
  3. package/core/comment.d.ts +18 -36
  4. package/core/comment.d.ts.map +1 -1
  5. package/core/post.d.ts +4 -4
  6. package/core/term.d.ts +11 -49
  7. package/core/term.d.ts.map +1 -1
  8. package/core/utils/comment.util.d.ts +1 -1
  9. package/core/utils/post.util.d.ts +3 -3
  10. package/core/utils/revision.util.d.ts +6 -30
  11. package/core/utils/revision.util.d.ts.map +1 -1
  12. package/core/vars.d.ts +1 -1
  13. package/core/vars.d.ts.map +1 -1
  14. package/crud/comment.crud.d.ts +6 -6
  15. package/crud/meta.crud.d.ts +6 -6
  16. package/crud/meta.crud.d.ts.map +1 -1
  17. package/crud/meta.crud.js +3 -1
  18. package/crud/post.crud.d.ts +30 -30
  19. package/crud/revision.crud.d.ts +6 -30
  20. package/crud/revision.crud.d.ts.map +1 -1
  21. package/crud/settings.crud.d.ts +9 -9
  22. package/crud/site.crud.d.ts +1 -1
  23. package/crud/sitemeta.crud.d.ts +25 -25
  24. package/crud/user.crud.d.ts +12 -12
  25. package/package.json +7 -8
  26. package/types/validating.d.ts +10 -9
  27. package/validators/config.d.ts +186 -836
  28. package/validators/config.d.ts.map +1 -1
  29. package/validators/config.js +1 -1
  30. package/validators/crud.d.ts +221 -502
  31. package/validators/crud.d.ts.map +1 -1
  32. package/validators/crud.js +2 -2
  33. package/validators/database.d.ts +96 -692
  34. package/validators/database.d.ts.map +1 -1
  35. package/validators/database.js +6 -6
  36. package/validators/date.d.ts +2 -2
  37. package/validators/date.d.ts.map +1 -1
  38. package/validators/helpers.d.ts +36 -19
  39. package/validators/helpers.d.ts.map +1 -1
  40. package/validators/helpers.js +1 -43
  41. package/validators/options.d.ts +10 -210
  42. package/validators/options.d.ts.map +1 -1
  43. package/validators/options.js +4 -4
  44. package/validators/post-status.d.ts +1 -27
  45. package/validators/post-status.d.ts.map +1 -1
  46. package/validators/query.d.ts +54 -387
  47. package/validators/query.d.ts.map +1 -1
  48. package/validators/roles.d.ts +4 -16
  49. package/validators/roles.d.ts.map +1 -1
  50. package/validators/roles.js +1 -1
  51. package/validators/sitemeta.d.ts +11 -76
  52. package/validators/sitemeta.d.ts.map +1 -1
  53. package/validators/sitemeta.js +3 -3
  54. package/validators/transactions/blog.d.ts +31 -179
  55. package/validators/transactions/blog.d.ts.map +1 -1
  56. package/validators/transactions/blog.js +5 -2
  57. package/validators/transactions/comment.d.ts +51 -126
  58. package/validators/transactions/comment.d.ts.map +1 -1
  59. package/validators/transactions/comment.js +1 -1
  60. package/validators/transactions/link.d.ts +13 -96
  61. package/validators/transactions/link.d.ts.map +1 -1
  62. package/validators/transactions/meta.d.ts +5 -17
  63. package/validators/transactions/meta.d.ts.map +1 -1
  64. package/validators/transactions/post.d.ts +33 -181
  65. package/validators/transactions/post.d.ts.map +1 -1
  66. package/validators/transactions/post.js +2 -2
  67. package/validators/transactions/roles.d.ts +4 -14
  68. package/validators/transactions/roles.d.ts.map +1 -1
  69. package/validators/transactions/signup.d.ts +5 -28
  70. package/validators/transactions/signup.d.ts.map +1 -1
  71. package/validators/transactions/site.d.ts +6 -29
  72. package/validators/transactions/site.d.ts.map +1 -1
  73. package/validators/transactions/site.js +1 -1
  74. package/validators/transactions/term.d.ts +12 -50
  75. package/validators/transactions/term.d.ts.map +1 -1
  76. package/validators/transactions/user.d.ts +84 -158
  77. package/validators/transactions/user.d.ts.map +1 -1
  78. package/validators/transactions/user.js +1 -1
  79. package/types/validating.d.ts.map +0 -1
  80. package/types/validating.js +0 -2
@@ -10,18 +10,18 @@ export declare class PostCrud extends Crud {
10
10
  private formReturnData;
11
11
  getAsUpsert(postId: number, defaultValue?: Partial<PostUpsert>): Promise<{
12
12
  data: {
13
- file: string;
14
13
  post_author: number;
14
+ post_date: string | undefined;
15
+ post_date_gmt: string | undefined;
15
16
  post_content: string;
16
17
  post_title: string;
17
18
  post_excerpt: string;
18
- post_status: string;
19
- comment_status: "closed" | "open";
20
- ping_status: "closed" | "open";
21
19
  post_password: string;
22
20
  post_name: string;
23
21
  to_ping: string;
24
22
  pinged: string;
23
+ post_modified: string | undefined;
24
+ post_modified_gmt: string | undefined;
25
25
  post_content_filtered: string;
26
26
  post_parent: number;
27
27
  guid: string;
@@ -30,16 +30,16 @@ export declare class PostCrud extends Crud {
30
30
  post_mime_type: string;
31
31
  comment_count: number;
32
32
  import_id: number;
33
- tags_input: string[] | number[] | (string | number)[];
33
+ post_status: string;
34
+ comment_status: "open" | "closed";
35
+ ping_status: "open" | "closed";
36
+ tags_input: string[] | (string | number)[] | number[];
37
+ file: string;
34
38
  context: string;
35
39
  ID?: number | undefined;
36
- post_date?: string | undefined;
37
- post_date_gmt?: string | undefined;
38
- post_modified?: string | undefined;
39
- post_modified_gmt?: string | undefined;
40
40
  post_categeory?: number[] | undefined;
41
- tax_input?: Record<string, string[] | number[] | (string | number)[]> | undefined;
42
- meta_input?: Record<string, string | number | (string | number)[] | Record<string, any>> | undefined;
41
+ tax_input?: Record<string, string[] | (string | number)[] | number[]> | undefined;
42
+ meta_input?: Record<string, string | number | Record<string, any> | (string | number)[]> | undefined;
43
43
  };
44
44
  info: undefined;
45
45
  }>;
@@ -68,6 +68,8 @@ export declare class PostCrud extends Crud {
68
68
  }[];
69
69
  ID: number;
70
70
  post_author: number;
71
+ post_date: string | undefined;
72
+ post_date_gmt: string | undefined;
71
73
  post_content: string;
72
74
  post_title: string;
73
75
  post_excerpt: string;
@@ -78,6 +80,8 @@ export declare class PostCrud extends Crud {
78
80
  post_name: string;
79
81
  to_ping: string;
80
82
  pinged: string;
83
+ post_modified: string | undefined;
84
+ post_modified_gmt: string | undefined;
81
85
  post_content_filtered: string;
82
86
  post_parent: number;
83
87
  guid: string;
@@ -85,10 +89,6 @@ export declare class PostCrud extends Crud {
85
89
  post_type: string;
86
90
  post_mime_type: string;
87
91
  comment_count: number;
88
- post_date?: string | undefined;
89
- post_date_gmt?: string | undefined;
90
- post_modified?: string | undefined;
91
- post_modified_gmt?: string | undefined;
92
92
  };
93
93
  info: {
94
94
  protected: boolean;
@@ -122,18 +122,18 @@ export declare class PostCrud extends Crud {
122
122
  }>;
123
123
  getAutosave(parentId: number): Promise<{
124
124
  data: {
125
- file: string;
126
125
  post_author: number;
126
+ post_date: string | undefined;
127
+ post_date_gmt: string | undefined;
127
128
  post_content: string;
128
129
  post_title: string;
129
130
  post_excerpt: string;
130
- post_status: string;
131
- comment_status: "closed" | "open";
132
- ping_status: "closed" | "open";
133
131
  post_password: string;
134
132
  post_name: string;
135
133
  to_ping: string;
136
134
  pinged: string;
135
+ post_modified: string | undefined;
136
+ post_modified_gmt: string | undefined;
137
137
  post_content_filtered: string;
138
138
  post_parent: number;
139
139
  guid: string;
@@ -142,16 +142,16 @@ export declare class PostCrud extends Crud {
142
142
  post_mime_type: string;
143
143
  comment_count: number;
144
144
  import_id: number;
145
- tags_input: string[] | number[] | (string | number)[];
145
+ post_status: string;
146
+ comment_status: "open" | "closed";
147
+ ping_status: "open" | "closed";
148
+ tags_input: string[] | (string | number)[] | number[];
149
+ file: string;
146
150
  context: string;
147
151
  ID?: number | undefined;
148
- post_date?: string | undefined;
149
- post_date_gmt?: string | undefined;
150
- post_modified?: string | undefined;
151
- post_modified_gmt?: string | undefined;
152
152
  post_categeory?: number[] | undefined;
153
- tax_input?: Record<string, string[] | number[] | (string | number)[]> | undefined;
154
- meta_input?: Record<string, string | number | (string | number)[] | Record<string, any>> | undefined;
153
+ tax_input?: Record<string, string[] | (string | number)[] | number[]> | undefined;
154
+ meta_input?: Record<string, string | number | Record<string, any> | (string | number)[]> | undefined;
155
155
  };
156
156
  info: undefined;
157
157
  }>;
@@ -185,6 +185,8 @@ export declare class PostCrud extends Crud {
185
185
  }[];
186
186
  ID: number;
187
187
  post_author: number;
188
+ post_date: string | undefined;
189
+ post_date_gmt: string | undefined;
188
190
  post_content: string;
189
191
  post_title: string;
190
192
  post_excerpt: string;
@@ -195,6 +197,8 @@ export declare class PostCrud extends Crud {
195
197
  post_name: string;
196
198
  to_ping: string;
197
199
  pinged: string;
200
+ post_modified: string | undefined;
201
+ post_modified_gmt: string | undefined;
198
202
  post_content_filtered: string;
199
203
  post_parent: number;
200
204
  guid: string;
@@ -202,10 +206,6 @@ export declare class PostCrud extends Crud {
202
206
  post_type: string;
203
207
  post_mime_type: string;
204
208
  comment_count: number;
205
- post_date?: string | undefined;
206
- post_date_gmt?: string | undefined;
207
- post_modified?: string | undefined;
208
- post_modified_gmt?: string | undefined;
209
209
  }[];
210
210
  info: {
211
211
  pagination: {
@@ -14,9 +14,11 @@ export declare class RevisionCrud extends Crud {
14
14
  info: undefined;
15
15
  }>;
16
16
  list(parentId: number, args: Partial<z.infer<typeof val.crud.revisionListParams>>): Promise<{
17
- data: [] | [{
17
+ data: {
18
18
  ID: number;
19
19
  post_author: number;
20
+ post_date: string | undefined;
21
+ post_date_gmt: string | undefined;
20
22
  post_content: string;
21
23
  post_title: string;
22
24
  post_excerpt: string;
@@ -27,6 +29,8 @@ export declare class RevisionCrud extends Crud {
27
29
  post_name: string;
28
30
  to_ping: string;
29
31
  pinged: string;
32
+ post_modified: string | undefined;
33
+ post_modified_gmt: string | undefined;
30
34
  post_content_filtered: string;
31
35
  post_parent: number;
32
36
  guid: string;
@@ -34,35 +38,7 @@ export declare class RevisionCrud extends Crud {
34
38
  post_type: string;
35
39
  post_mime_type: string;
36
40
  comment_count: number;
37
- post_date?: string | undefined;
38
- post_date_gmt?: string | undefined;
39
- post_modified?: string | undefined;
40
- post_modified_gmt?: string | undefined;
41
- }, ...{
42
- ID: number;
43
- post_author: number;
44
- post_content: string;
45
- post_title: string;
46
- post_excerpt: string;
47
- post_status: string;
48
- comment_status: string;
49
- ping_status: string;
50
- post_password: string;
51
- post_name: string;
52
- to_ping: string;
53
- pinged: string;
54
- post_content_filtered: string;
55
- post_parent: number;
56
- guid: string;
57
- menu_order: number;
58
- post_type: string;
59
- post_mime_type: string;
60
- comment_count: number;
61
- post_date?: string | undefined;
62
- post_date_gmt?: string | undefined;
63
- post_modified?: string | undefined;
64
- post_modified_gmt?: string | undefined;
65
- }[]];
41
+ }[];
66
42
  info: {
67
43
  pagination: {
68
44
  page: number;
@@ -1 +1 @@
1
- {"version":3,"file":"revision.crud.d.ts","sourceRoot":"","sources":["../../src/crud/revision.crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,qBACa,YAAa,SAAQ,IAAI;gBACxB,UAAU,EAAE,UAAU;YAIpB,eAAe;IAoBvB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;;IAgBhC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;;IAqCpC,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE7D"}
1
+ {"version":3,"file":"revision.crud.d.ts","sourceRoot":"","sources":["../../src/crud/revision.crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,qBACa,YAAa,SAAQ,IAAI;gBACxB,UAAU,EAAE,UAAU;YAIpB,eAAe;IAoBvB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;;IAgBhC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;;IAqCpC,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE7D"}
@@ -15,25 +15,25 @@ export declare class SettingsCrud extends Crud {
15
15
  blogId: number;
16
16
  }): Promise<{
17
17
  data: {
18
- url?: string | undefined;
19
18
  title?: string | undefined;
19
+ description?: string | undefined;
20
+ url?: string | undefined;
20
21
  home?: string | undefined;
21
22
  email?: string | undefined;
22
- description?: string | undefined;
23
+ timezone?: string | undefined;
24
+ date_format?: string | undefined;
25
+ time_format?: string | undefined;
23
26
  start_of_week?: number | undefined;
24
27
  use_smilies?: number | undefined;
25
28
  default_category?: number | undefined;
26
- default_comment_status?: "closed" | "open" | undefined;
27
- default_ping_status?: "closed" | "open" | undefined;
29
+ default_post_format?: number | undefined;
28
30
  posts_per_page?: number | undefined;
29
- date_format?: string | undefined;
30
- time_format?: string | undefined;
31
31
  show_on_front?: string | undefined;
32
- page_for_posts?: number | undefined;
33
32
  page_on_front?: number | undefined;
34
- default_post_format?: number | undefined;
33
+ page_for_posts?: number | undefined;
34
+ default_ping_status?: "open" | "closed" | undefined;
35
+ default_comment_status?: "open" | "closed" | undefined;
35
36
  site_icon?: number | undefined;
36
- timezone?: string | undefined;
37
37
  } & {
38
38
  time_offset_minutes: number;
39
39
  };
@@ -18,8 +18,8 @@ export declare class SiteCrud extends Crud {
18
18
  data: {
19
19
  site_meta: Record<string, any>;
20
20
  id: number;
21
- path: string;
22
21
  domain: string;
22
+ path: string;
23
23
  };
24
24
  info: undefined;
25
25
  }>;
@@ -10,39 +10,39 @@ export declare class SitemetaCrud extends Crud {
10
10
  private checkPermission;
11
11
  get(siteId: number): Promise<{
12
12
  data: Partial<{
13
- WPLANG: string;
14
- siteurl: string;
13
+ site_name: string;
15
14
  admin_email: string;
16
- add_new_users: number;
17
- active_sitewide_plugins: any[];
18
15
  admin_user_id: number;
19
- allowedthemes: Record<string, true>;
20
- banned_email_domains: string[];
16
+ registration: string;
17
+ upload_filetypes: string;
21
18
  blog_upload_space: number;
22
19
  fileupload_maxk: number;
23
- first_comment: string;
24
- first_comment_author: string;
25
- first_comment_email: string;
26
- first_comment_url: string;
27
- first_page: string;
28
- first_post: string;
29
- illegal_names: string[];
30
- initial_db_version: number;
31
- limited_email_domains: string[];
32
- menu_items: string[];
33
- ms_files_rewriting: number;
34
- new_admin_email: string;
35
- registration: string;
36
- registrationnotification: "no" | "yes";
37
20
  site_admins: string[];
38
- site_name: string;
39
- subdomain_install: string;
40
- upload_filetypes: string;
21
+ allowedthemes: Record<string, true>;
22
+ illegal_names: string[];
23
+ wpmu_upgrade_site: number;
24
+ welcome_email: string;
25
+ first_post: string;
26
+ siteurl: string;
27
+ add_new_users: number;
41
28
  upload_space_check_disabled: number;
29
+ subdomain_install: string;
30
+ ms_files_rewriting: number;
42
31
  user_count: number;
43
- welcome_email: string;
32
+ initial_db_version: number;
33
+ active_sitewide_plugins: any[];
34
+ WPLANG: string;
35
+ registrationnotification: "no" | "yes";
36
+ menu_items: string[];
37
+ first_page: string;
38
+ first_comment: string;
39
+ first_comment_url: string;
40
+ first_comment_author: string;
44
41
  welcome_user_email: string;
45
- wpmu_upgrade_site: number;
42
+ limited_email_domains: string[];
43
+ banned_email_domains: string[];
44
+ new_admin_email: string;
45
+ first_comment_email: string;
46
46
  }>;
47
47
  info: undefined;
48
48
  }>;
@@ -41,30 +41,30 @@ export declare class UserCrud extends Crud {
41
41
  constructor(components: Components, config: Config);
42
42
  getAsUpsert(userId: number): Promise<{
43
43
  data: {
44
- description: string;
45
- spam: number;
46
- deleted: number;
47
- user_login: string;
48
- user_email: string;
49
44
  user_pass: string;
50
45
  user_nicename: string;
46
+ user_email: string;
51
47
  user_activation_key: string;
52
48
  user_status: number;
53
49
  display_name: string;
50
+ spam: number;
51
+ deleted: number;
52
+ user_login: string;
53
+ user_registered: string | undefined;
54
54
  meta_input: Record<string, any>;
55
55
  nickname: string;
56
56
  first_name: string;
57
57
  last_name: string;
58
- rich_editing: number | "false" | "true";
59
- syntax_highlighting: number | "false" | "true";
60
- comment_shortcuts: number | "false" | "true";
58
+ description: string;
59
+ rich_editing: number | "true" | "false";
60
+ syntax_highlighting: number | "true" | "false";
61
+ comment_shortcuts: number | "true" | "false";
61
62
  admin_color: string;
62
63
  use_ssl: string;
63
- show_admin_bar_front: number | "false" | "true";
64
- role?: string[] | "editor" | "author" | "superadmin" | "administrator" | "contributor" | "subscriber" | "anonymous" | ("editor" | "author" | "superadmin" | "administrator" | "contributor" | "subscriber" | "anonymous")[] | undefined;
65
- ID?: number | undefined;
64
+ show_admin_bar_front: number | "true" | "false";
66
65
  user_url?: string | undefined;
67
- user_registered?: string | undefined;
66
+ ID?: number | undefined;
67
+ role?: string[] | "editor" | "author" | "superadmin" | "administrator" | "contributor" | "subscriber" | "anonymous" | ("editor" | "author" | "superadmin" | "administrator" | "contributor" | "subscriber" | "anonymous")[] | undefined;
68
68
  locale?: string | undefined;
69
69
  };
70
70
  info: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnaga/wp-node",
3
- "version": "1.1.4",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && tsc --project tsconfig.build.json && npm run copyfiles && cp package.json ./dist/",
@@ -20,22 +20,21 @@
20
20
  ],
21
21
  "author": "Ryohei Nagatsuka",
22
22
  "devDependencies": {
23
- "@types/bcryptjs": "^2.4.6",
24
- "@types/node": "^20.14.10",
23
+ "@types/node": "^22",
25
24
  "copyfiles": "^2.4.1",
26
25
  "ts-node": "^10.9.1",
27
- "typescript": "^5.5.3",
26
+ "typescript": "^5.8.3",
28
27
  "wordpress-hash-node": "^1.0.0"
29
28
  },
30
29
  "dependencies": {
31
- "bcryptjs": "^2.4.3",
30
+ "bcryptjs": "^3.0.0",
32
31
  "deep-object-diff": "^1.1.9",
33
32
  "knex": "^3.1.0",
34
- "moment-timezone": "^0.5.45",
35
- "mysql2": "^3.6.1",
33
+ "moment-timezone": "^0.6.0",
34
+ "mysql2": "^3.14.0",
36
35
  "php-serialize": "^5",
37
36
  "reflect-metadata": "^0.1.13",
38
- "zod": "^3.22.4"
37
+ "zod": "^4.0.5"
39
38
  },
40
39
  "repository": {
41
40
  "type": "git",
@@ -1,14 +1,15 @@
1
1
  import * as val from "../validators";
2
2
  import { z } from "zod";
3
+
3
4
  export type Parser = {
4
- parse: (v: any, ...args: any) => any;
5
- safeParse: (v: any, ...args: any) => any;
5
+ parse: (v: any, ...args: any) => any;
6
+ safeParse: (v: any, ...args: any) => any;
6
7
  };
7
- export type ParserReturnType<T> = T extends Parser ? ReturnType<T["parse"]> : any;
8
+
9
+ export type ParserReturnType<T> = T extends Parser
10
+ ? ReturnType<T["parse"]>
11
+ : any;
12
+
8
13
  export type Tables = keyof typeof val.database.wpTables;
9
- export type Field<T extends Tables> = keyof (typeof val.database.wpTables)[T]["shape"];
10
- export type PickZodObjectKey<T extends z.ZodType<any, any, any>, K extends keyof z.infer<T>> = {
11
- [P in K]: z.infer<T>[P];
12
- };
13
- export type PickZodObjectKeyInArray<T extends z.ZodType<any, any, any>, K extends keyof z.infer<T>[number]> = PickZodObjectKey<T, K>[];
14
- //# sourceMappingURL=validating.d.ts.map
14
+ export type Field<T extends Tables> =
15
+ keyof (typeof val.database.wpTables)[T]["shape"];