@rnaga/wp-node 1.1.4 → 1.2.4

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 (82) hide show
  1. package/README.md +20 -0
  2. package/common/password.d.ts.map +1 -1
  3. package/common/password.js +78 -8
  4. package/config.d.ts +32 -32
  5. package/core/comment.d.ts +18 -36
  6. package/core/comment.d.ts.map +1 -1
  7. package/core/post.d.ts +4 -4
  8. package/core/term.d.ts +11 -49
  9. package/core/term.d.ts.map +1 -1
  10. package/core/utils/comment.util.d.ts +1 -1
  11. package/core/utils/post.util.d.ts +3 -3
  12. package/core/utils/revision.util.d.ts +6 -30
  13. package/core/utils/revision.util.d.ts.map +1 -1
  14. package/core/vars.d.ts +1 -1
  15. package/core/vars.d.ts.map +1 -1
  16. package/crud/comment.crud.d.ts +6 -6
  17. package/crud/meta.crud.d.ts +6 -6
  18. package/crud/meta.crud.d.ts.map +1 -1
  19. package/crud/meta.crud.js +3 -1
  20. package/crud/post.crud.d.ts +30 -30
  21. package/crud/revision.crud.d.ts +6 -30
  22. package/crud/revision.crud.d.ts.map +1 -1
  23. package/crud/settings.crud.d.ts +9 -9
  24. package/crud/site.crud.d.ts +1 -1
  25. package/crud/sitemeta.crud.d.ts +25 -25
  26. package/crud/user.crud.d.ts +12 -12
  27. package/package.json +8 -8
  28. package/types/validating.d.ts +10 -9
  29. package/validators/config.d.ts +186 -836
  30. package/validators/config.d.ts.map +1 -1
  31. package/validators/config.js +1 -1
  32. package/validators/crud.d.ts +221 -502
  33. package/validators/crud.d.ts.map +1 -1
  34. package/validators/crud.js +2 -2
  35. package/validators/database.d.ts +96 -692
  36. package/validators/database.d.ts.map +1 -1
  37. package/validators/database.js +6 -6
  38. package/validators/date.d.ts +2 -2
  39. package/validators/date.d.ts.map +1 -1
  40. package/validators/helpers.d.ts +36 -19
  41. package/validators/helpers.d.ts.map +1 -1
  42. package/validators/helpers.js +1 -43
  43. package/validators/options.d.ts +10 -210
  44. package/validators/options.d.ts.map +1 -1
  45. package/validators/options.js +4 -4
  46. package/validators/post-status.d.ts +1 -27
  47. package/validators/post-status.d.ts.map +1 -1
  48. package/validators/query.d.ts +54 -387
  49. package/validators/query.d.ts.map +1 -1
  50. package/validators/roles.d.ts +4 -16
  51. package/validators/roles.d.ts.map +1 -1
  52. package/validators/roles.js +1 -1
  53. package/validators/sitemeta.d.ts +11 -76
  54. package/validators/sitemeta.d.ts.map +1 -1
  55. package/validators/sitemeta.js +3 -3
  56. package/validators/transactions/blog.d.ts +31 -179
  57. package/validators/transactions/blog.d.ts.map +1 -1
  58. package/validators/transactions/blog.js +5 -2
  59. package/validators/transactions/comment.d.ts +51 -126
  60. package/validators/transactions/comment.d.ts.map +1 -1
  61. package/validators/transactions/comment.js +1 -1
  62. package/validators/transactions/link.d.ts +13 -96
  63. package/validators/transactions/link.d.ts.map +1 -1
  64. package/validators/transactions/meta.d.ts +5 -17
  65. package/validators/transactions/meta.d.ts.map +1 -1
  66. package/validators/transactions/post.d.ts +33 -181
  67. package/validators/transactions/post.d.ts.map +1 -1
  68. package/validators/transactions/post.js +2 -2
  69. package/validators/transactions/roles.d.ts +4 -14
  70. package/validators/transactions/roles.d.ts.map +1 -1
  71. package/validators/transactions/signup.d.ts +5 -28
  72. package/validators/transactions/signup.d.ts.map +1 -1
  73. package/validators/transactions/site.d.ts +6 -29
  74. package/validators/transactions/site.d.ts.map +1 -1
  75. package/validators/transactions/site.js +1 -1
  76. package/validators/transactions/term.d.ts +12 -50
  77. package/validators/transactions/term.d.ts.map +1 -1
  78. package/validators/transactions/user.d.ts +84 -158
  79. package/validators/transactions/user.d.ts.map +1 -1
  80. package/validators/transactions/user.js +1 -1
  81. package/types/validating.d.ts.map +0 -1
  82. package/types/validating.js +0 -2
package/README.md CHANGED
@@ -17,6 +17,26 @@ Key benefits include:
17
17
  - CLI tools to seed databases and run custom commands
18
18
  - Clean architecture with Dependency Injection and decorators
19
19
 
20
+ ## Quick Start Example
21
+
22
+ Here's an example of how to initialize WP-Node app and access WordPress post:
23
+
24
+ ```typescript
25
+ import Application from "@rnaga/wp-node/application";
26
+
27
+ (async () => {
28
+ // Initialize WP-Node application
29
+ const wp = await Application.getContext();
30
+
31
+ // Fetch a post with ID 1
32
+ const post = await wp.utils.query.posts((query) => {
33
+ query.where("ID", 1);
34
+ });
35
+
36
+ process.exit(0);
37
+ })();
38
+ ```
39
+
20
40
  ## Features
21
41
 
22
42
  - **TypeScript-first**: Fully typed interfaces and schema validation using [Zod](https://zod.dev/)
@@ -1 +1 @@
1
- {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/common/password.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GAAI,WAAW,MAAM,WAG7C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,EAAE,YAAY,MAAM,YAGlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,SAAQ,MAAW,EACnB,eAAc,OAAc,EAC5B,oBAAmB,OAAe,KACjC,MAmBF,CAAC"}
1
+ {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/common/password.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,WAAW,MAAM,WAG7C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,EAAE,YAAY,MAAM,YAGlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,SAAQ,MAAW,EACnB,eAAc,OAAc,EAC5B,oBAAmB,OAAe,KACjC,MAmBF,CAAC"}
@@ -32,9 +32,13 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.generatePassword = exports.checkPassword = exports.hashPassword = void 0;
37
40
  const crypto = __importStar(require("crypto"));
41
+ const bcryptjs_1 = __importDefault(require("bcryptjs"));
38
42
  const hashPassword = (plainText) => {
39
43
  const passwordHash = new PasswordHash(8, true);
40
44
  return passwordHash.hashPassword(plainText);
@@ -207,18 +211,84 @@ class PasswordHash {
207
211
  }
208
212
  return "*";
209
213
  }
214
+ // https://github.com/WordPress/wordpress-develop/blob/063a74f93f0a89d1d92fac1f25c49a379ab3476b/src/wp-includes/pluggable.php#L2740
210
215
  checkPassword(password, storedHash) {
216
+ // Passwords longer than 4096 characters are not supported
211
217
  if (password.length > 4096) {
212
218
  return false;
213
219
  }
214
- let hash = this.cryptPrivate(password, storedHash);
215
- if (hash[0] === "*") {
216
- hash = crypto
217
- .createHash("md5")
218
- .update(password, "binary")
219
- .digest("binary");
220
- hash = this.cryptPrivate(password, storedHash);
220
+ // Check the hash using md5 regardless of the current hashing mechanism (legacy support)
221
+ if (storedHash.length <= 32) {
222
+ const md5Hash = crypto.createHash("md5").update(password).digest("hex");
223
+ return this.hashEquals(storedHash, md5Hash);
224
+ }
225
+ // Check the password using the current WordPress prefixed hash ($wp$ prefix)
226
+ if (storedHash.startsWith("$wp$")) {
227
+ try {
228
+ // WordPress 6.8+ uses SHA384 HMAC preprocessing before bcrypt
229
+ const passwordToVerify = crypto
230
+ .createHmac("sha384", "wp-sha384")
231
+ .update(password)
232
+ .digest("base64");
233
+ const bcryptHash = storedHash.substring(3); // Remove "$wp" prefix
234
+ return this.verifyPassword(passwordToVerify, bcryptHash);
235
+ }
236
+ catch (err) {
237
+ console.error("Error verifying WordPress prefixed hash:", err);
238
+ return false;
239
+ }
240
+ }
241
+ // Check the password using phpass ($P$ prefix)
242
+ if (storedHash.startsWith("$P$")) {
243
+ let hash = this.cryptPrivate(password, storedHash);
244
+ if (hash[0] === "*") {
245
+ hash = crypto
246
+ .createHash("md5")
247
+ .update(password, "binary")
248
+ .digest("binary");
249
+ hash = this.cryptPrivate(password, storedHash);
250
+ }
251
+ return hash === storedHash;
252
+ }
253
+ // Check the password using compat support for any non-prefixed hash (bcrypt, Argon2, etc.)
254
+ try {
255
+ return this.verifyPassword(password, storedHash);
256
+ }
257
+ catch (err) {
258
+ console.error("Error verifying non-prefixed hash:", err);
259
+ return false;
260
+ }
261
+ }
262
+ /**
263
+ * Secure hash comparison to prevent timing attacks
264
+ */
265
+ hashEquals(hash1, hash2) {
266
+ if (hash1.length !== hash2.length) {
267
+ return false;
268
+ }
269
+ let result = 0;
270
+ for (let i = 0; i < hash1.length; i++) {
271
+ result |= hash1.charCodeAt(i) ^ hash2.charCodeAt(i);
272
+ }
273
+ return result === 0;
274
+ }
275
+ /**
276
+ * Verify password using modern hashing algorithms (bcrypt, Argon2, etc.)
277
+ */
278
+ verifyPassword(password, hash) {
279
+ try {
280
+ // Try bcrypt first (most common)
281
+ if (hash.match(/^\$2[axyb]\$/)) {
282
+ return bcryptjs_1.default.compareSync(password, hash);
283
+ }
284
+ // For other algorithms, we would need additional libraries
285
+ // For now, we'll just try bcrypt and return false for unsupported formats
286
+ console.warn(`Unsupported hash format: ${hash.substring(0, 10)}...`);
287
+ return false;
288
+ }
289
+ catch (err) {
290
+ console.error("Error in password verification:", err);
291
+ return false;
221
292
  }
222
- return hash === storedHash;
223
293
  }
224
294
  }
package/config.d.ts CHANGED
@@ -6,33 +6,6 @@ export declare class Config {
6
6
  isSsl(): boolean;
7
7
  isSubdomainInstall(): boolean;
8
8
  get config(): {
9
- options: {
10
- protected: string[];
11
- defaults: string[];
12
- };
13
- posts: {
14
- types: Record<string, {
15
- public: boolean;
16
- supports: string[];
17
- _builtin: boolean;
18
- capabilityType: string | [string, string];
19
- mapMetaCap: boolean;
20
- deleteWithUser: boolean;
21
- publiclyQueryable: boolean;
22
- hierarchical?: boolean | undefined;
23
- capabilities?: Record<string, string> | undefined;
24
- }>;
25
- typeNames: string[] | "attachment" | "page" | "post" | "revision";
26
- statusNames: string[] | "inherit" | "private" | "pending" | "publish" | "future" | "draft" | "trash" | "auto-draft" | "request-pending" | "request-confirmed" | "request-failed" | "request-completed";
27
- statuses: Record<string, {
28
- label: string;
29
- internal?: boolean | undefined;
30
- private?: boolean | undefined;
31
- public?: boolean | undefined;
32
- _builtin?: boolean | undefined;
33
- protected?: boolean | undefined;
34
- }>;
35
- };
36
9
  constants: {
37
10
  ALLOW_UNFILTERED_UPLOADS: boolean;
38
11
  DISALLOW_UNFILTERED_HTML: boolean;
@@ -46,15 +19,19 @@ export declare class Config {
46
19
  EMPTY_TRASH_DAYS: number;
47
20
  MEDIA_TRASH: boolean;
48
21
  WP_POST_REVISIONS: number;
49
- WP_LOG_LEVEL: "error" | "debug" | "info" | "warn";
22
+ WP_LOG_LEVEL: "debug" | "info" | "warn" | "error";
50
23
  };
51
24
  extensions: {
25
+ misc: string[];
52
26
  audio: string[];
53
27
  video: string[];
54
- misc: string[];
55
28
  };
56
29
  timezoneOffset: string;
57
30
  staticAssetsPath: string;
31
+ options: {
32
+ protected: string[];
33
+ defaults: string[];
34
+ };
58
35
  multisite: {
59
36
  enabled: boolean;
60
37
  defaultBlogId: number;
@@ -75,18 +52,41 @@ export declare class Config {
75
52
  charset: string;
76
53
  host?: string | undefined;
77
54
  user?: string | undefined;
78
- database?: string | undefined;
79
55
  password?: string | undefined;
56
+ database?: string | undefined;
80
57
  };
81
58
  };
59
+ posts: {
60
+ typeNames: string[] | "post" | "page" | "attachment" | "revision";
61
+ types: Record<string, {
62
+ capabilityType: string | [string, string];
63
+ supports: string[];
64
+ mapMetaCap: boolean;
65
+ deleteWithUser: boolean;
66
+ publiclyQueryable: boolean;
67
+ public: boolean;
68
+ _builtin: boolean;
69
+ capabilities?: Record<string, string> | undefined;
70
+ hierarchical?: boolean | undefined;
71
+ }>;
72
+ statusNames: string[] | "publish" | "future" | "draft" | "pending" | "private" | "trash" | "inherit" | "auto-draft" | "request-pending" | "request-confirmed" | "request-failed" | "request-completed";
73
+ statuses: Record<string, {
74
+ label: string;
75
+ public?: boolean | undefined;
76
+ protected?: boolean | undefined;
77
+ private?: boolean | undefined;
78
+ internal?: boolean | undefined;
79
+ _builtin?: boolean | undefined;
80
+ }>;
81
+ };
82
82
  taxonomy: {
83
83
  names: string[] | "category" | "post_tag" | "post_format" | "link_category";
84
84
  settings: Record<string, {
85
- objectType: string;
86
85
  hierarchical: boolean;
86
+ objectType: string;
87
87
  _builtin: boolean;
88
88
  showUi: boolean;
89
- capabilities?: Partial<Record<"manage_terms" | "edit_terms" | "delete_terms" | "assign_terms", string>> | undefined;
89
+ capabilities?: Record<"manage_terms" | "edit_terms" | "delete_terms" | "assign_terms", string> | undefined;
90
90
  }>;
91
91
  };
92
92
  roles: Record<string, {
package/core/comment.d.ts CHANGED
@@ -14,6 +14,8 @@ export declare class Comment {
14
14
  post(): Promise<{
15
15
  ID: number;
16
16
  post_author: number;
17
+ post_date: string | undefined;
18
+ post_date_gmt: string | undefined;
17
19
  post_content: string;
18
20
  post_title: string;
19
21
  post_excerpt: string;
@@ -24,6 +26,8 @@ export declare class Comment {
24
26
  post_name: string;
25
27
  to_ping: string;
26
28
  pinged: string;
29
+ post_modified: string | undefined;
30
+ post_modified_gmt: string | undefined;
27
31
  post_content_filtered: string;
28
32
  post_parent: number;
29
33
  guid: string;
@@ -31,80 +35,58 @@ export declare class Comment {
31
35
  post_type: string;
32
36
  post_mime_type: string;
33
37
  comment_count: number;
34
- post_date?: string | undefined;
35
- post_date_gmt?: string | undefined;
36
- post_modified?: string | undefined;
37
- post_modified_gmt?: string | undefined;
38
38
  } | undefined>;
39
39
  user(): Promise<{
40
- spam: number;
41
- deleted: number;
42
40
  ID: number;
43
41
  user_login: string;
44
- user_email: string;
45
42
  user_pass: string;
46
43
  user_nicename: string;
44
+ user_email: string;
45
+ user_registered: string | undefined;
47
46
  user_activation_key: string;
48
47
  user_status: number;
49
48
  display_name: string;
49
+ spam: number;
50
+ deleted: number;
50
51
  user_url?: string | undefined;
51
- user_registered?: string | undefined;
52
52
  } | undefined>;
53
53
  parent(): Promise<{
54
54
  comment_ID: number;
55
55
  comment_post_ID: number;
56
56
  comment_author: string;
57
+ comment_date: string | undefined;
58
+ comment_date_gmt: string | undefined;
57
59
  comment_content: string;
58
60
  comment_karma: number;
59
- comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
61
+ comment_approved: number | "trash" | "0" | "1" | "spam" | "post-trashed" | "approve" | "hold";
60
62
  comment_agent: string;
61
63
  comment_type: string;
62
64
  comment_parent: number;
63
65
  user_id: number;
66
+ display_name: string | undefined;
64
67
  comment_author_email?: string | undefined;
65
68
  comment_author_url?: string | undefined;
66
69
  comment_author_IP?: string | undefined;
67
- comment_date?: string | undefined;
68
- comment_date_gmt?: string | undefined;
69
- display_name?: string | undefined;
70
70
  } | undefined>;
71
- children(limit?: number): Promise<[{
72
- comment_ID: number;
73
- comment_post_ID: number;
74
- comment_author: string;
75
- comment_content: string;
76
- comment_karma: number;
77
- comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
78
- comment_agent: string;
79
- comment_type: string;
80
- comment_parent: number;
81
- user_id: number;
71
+ children(limit?: number): Promise<{
82
72
  depth: number;
83
- comment_author_email?: string | undefined;
84
- comment_author_url?: string | undefined;
85
- comment_author_IP?: string | undefined;
86
- comment_date?: string | undefined;
87
- comment_date_gmt?: string | undefined;
88
- display_name?: string | undefined;
89
- }, ...{
90
73
  comment_ID: number;
91
74
  comment_post_ID: number;
92
75
  comment_author: string;
76
+ comment_date: string | undefined;
77
+ comment_date_gmt: string | undefined;
93
78
  comment_content: string;
94
79
  comment_karma: number;
95
- comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
80
+ comment_approved: number | "trash" | "0" | "1" | "spam" | "post-trashed" | "approve" | "hold";
96
81
  comment_agent: string;
97
82
  comment_type: string;
98
83
  comment_parent: number;
99
84
  user_id: number;
100
- depth: number;
85
+ display_name: string | undefined;
101
86
  comment_author_email?: string | undefined;
102
87
  comment_author_url?: string | undefined;
103
88
  comment_author_IP?: string | undefined;
104
- comment_date?: string | undefined;
105
- comment_date_gmt?: string | undefined;
106
- display_name?: string | undefined;
107
- }[]] | undefined>;
89
+ }[] | undefined>;
108
90
  countChildren(): Promise<number | undefined>;
109
91
  private init;
110
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/core/comment.ts"],"names":[],"mappings":"AAOA,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,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBACa,OAAO;IAET,IAAI,EAAE,IAAI;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;gBAJP,IAAI,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;IAK1C,IAAI,KAAK,iCAER;IAED,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAK5C,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;IAUJ,IAAI;;;;;;;;;;;;;;IAWJ,MAAM;;;;;;;;;;;;;;;;;;IA0BN,QAAQ,CAAC,KAAK,GAAE,MAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6B3B,aAAa;YA0BL,IAAI;CAenB"}
1
+ {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/core/comment.ts"],"names":[],"mappings":"AAOA,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,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBACa,OAAO;IAET,IAAI,EAAE,IAAI;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;gBAJP,IAAI,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;IAK1C,IAAI,KAAK,iCAER;IAED,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAK5C,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;IAUJ,IAAI;;;;;;;;;;;;;;IAWJ,MAAM;;;;;;;;;;;;;;;;;;IA0BN,QAAQ,CAAC,KAAK,GAAE,MAAW;;;;;;;;;;;;;;;;;;;IA6B3B,aAAa;YA0BL,IAAI;CAenB"}
package/core/post.d.ts CHANGED
@@ -20,18 +20,18 @@ export declare class Post {
20
20
  parents(): Promise<types.WpPosts[]>;
21
21
  terms(taxonomy: types.TaxonomyName): Promise<types.WpTerms[] | undefined>;
22
22
  author(): Promise<{
23
- spam: number;
24
- deleted: number;
25
23
  ID: number;
26
24
  user_login: string;
27
- user_email: string;
28
25
  user_pass: string;
29
26
  user_nicename: string;
27
+ user_email: string;
28
+ user_registered: string | undefined;
30
29
  user_activation_key: string;
31
30
  user_status: number;
32
31
  display_name: string;
32
+ spam: number;
33
+ deleted: number;
33
34
  user_url?: string | undefined;
34
- user_registered?: string | undefined;
35
35
  } | undefined>;
36
36
  private init;
37
37
  }
package/core/term.d.ts CHANGED
@@ -7,9 +7,8 @@ import { Meta } from "./meta";
7
7
  import { Logger } from "./logger";
8
8
  declare const schemaProps: z.ZodObject<{
9
9
  name: z.ZodString;
10
- slug: z.ZodEffects<z.ZodString, string, string>;
10
+ slug: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
11
11
  term_group: z.ZodDefault<z.ZodNumber>;
12
- } & {
13
12
  term_id: z.ZodDefault<z.ZodNumber>;
14
13
  taxonomy: z.ZodDefault<z.ZodString>;
15
14
  description: z.ZodDefault<z.ZodString>;
@@ -18,31 +17,7 @@ declare const schemaProps: z.ZodObject<{
18
17
  object_id: z.ZodDefault<z.ZodNumber>;
19
18
  term_taxonomy_id: z.ZodDefault<z.ZodNumber>;
20
19
  term_order: z.ZodDefault<z.ZodNumber>;
21
- }, "strip", z.ZodTypeAny, {
22
- name: string;
23
- description: string;
24
- parent: number;
25
- taxonomy: string;
26
- count: number;
27
- term_id: number;
28
- object_id: number;
29
- term_taxonomy_id: number;
30
- term_order: number;
31
- slug: string;
32
- term_group: number;
33
- }, {
34
- name: string;
35
- slug: string;
36
- description?: string | undefined;
37
- parent?: number | undefined;
38
- taxonomy?: string | undefined;
39
- count?: number | undefined;
40
- term_id?: number | undefined;
41
- object_id?: number | undefined;
42
- term_taxonomy_id?: number | undefined;
43
- term_order?: number | undefined;
44
- term_group?: number | undefined;
45
- }>;
20
+ }, z.core.$strip>;
46
21
  type Props = z.infer<typeof schemaProps>;
47
22
  export declare class Term {
48
23
  #private;
@@ -58,44 +33,31 @@ export declare class Term {
58
33
  get taxonomy(): Taxonomy | undefined;
59
34
  get props(): {
60
35
  name: string;
61
- description: string;
62
- parent: number;
63
- taxonomy: string;
64
- count: number;
65
- term_id: number;
66
- object_id: number;
67
- term_taxonomy_id: number;
68
- term_order: number;
69
36
  slug: string;
70
37
  term_group: number;
71
- } | undefined;
72
- children(): Promise<[{
73
- name: string;
38
+ term_id: number;
39
+ taxonomy: string;
74
40
  description: string;
75
41
  parent: number;
76
- taxonomy: string;
77
42
  count: number;
78
- term_id: number;
79
43
  object_id: number;
80
44
  term_taxonomy_id: number;
81
45
  term_order: number;
82
- slug: string;
83
- term_group: number;
46
+ } | undefined;
47
+ children(): Promise<{
84
48
  depth: number;
85
- }, ...{
86
49
  name: string;
50
+ slug: string;
51
+ term_group: number;
52
+ term_id: number;
53
+ taxonomy: string;
87
54
  description: string;
88
55
  parent: number;
89
- taxonomy: string;
90
56
  count: number;
91
- term_id: number;
92
57
  object_id: number;
93
58
  term_taxonomy_id: number;
94
59
  term_order: number;
95
- slug: string;
96
- term_group: number;
97
- depth: number;
98
- }[]] | undefined>;
60
+ }[] | undefined>;
99
61
  setTaxonomy(taxonomy: Taxonomy): void;
100
62
  withProps(props: Partial<Props>): this;
101
63
  private init;
@@ -1 +1 @@
1
- {"version":3,"file":"term.d.ts","sourceRoot":"","sources":["../../src/core/term.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEhB,CAAC;AAGF,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,qBACa,IAAI;;IAIN,IAAI,EAAE,IAAI;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IAErB,OAAO,CAAC,MAAM;gBAPP,IAAI,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,aAAa,EA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,IAAI,YAAY,mCAEf;IAED,IAAI,QAAQ,yBAEX;IAED,IAAI,KAAK;;;;;;;;;;;;kBAER;IAEK,QAAQ;;;;;;;;;;;;;;IAMd,WAAW,CAAC,QAAQ,EAAE,QAAQ;IAK9B,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC;YAMjB,IAAI;CAyBnB"}
@@ -14,7 +14,7 @@ export declare class CommentUtil {
14
14
  toComments(comments: types.Tables["comments"][]): Comment[];
15
15
  getDefaultStatus(postType?: types.PostType, commentType?: string): Promise<"open" | "closed">;
16
16
  getDefaultStatus(postType?: string, commentType?: string): Promise<"open" | "closed">;
17
- getStatusAsString(commentId: number): Promise<"" | "trash" | "spam" | "approved" | "unapproved">;
17
+ getStatusAsString(commentId: number): Promise<"trash" | "" | "spam" | "approved" | "unapproved">;
18
18
  isOpen(post: Post): boolean | undefined;
19
19
  containsNGWord(args: Partial<types.Tables["comments"]>): Promise<boolean>;
20
20
  isValid(args: Partial<types.Tables["comments"]>): Promise<boolean>;
@@ -17,11 +17,11 @@ export declare class PostUtil {
17
17
  isStatusViewable(statusObjectOrString: string | ReturnType<PostUtil["getStatusObject"]>): boolean;
18
18
  getStatusObject(status: typeof defaults.postStatuses | string | undefined): {
19
19
  label: string;
20
- internal?: boolean | undefined;
21
- private?: boolean | undefined;
22
20
  public?: boolean | undefined;
23
- _builtin?: boolean | undefined;
24
21
  protected?: boolean | undefined;
22
+ private?: boolean | undefined;
23
+ internal?: boolean | undefined;
24
+ _builtin?: boolean | undefined;
25
25
  } | undefined;
26
26
  getStatus(post?: Post, parent?: Post): Promise<string | undefined>;
27
27
  getAttachedFile(postId: number, unfiltered?: boolean): Promise<string | undefined>;
@@ -12,9 +12,11 @@ export declare class RevisionUtil {
12
12
  static revisionFields: Record<RevisionColumns, string>;
13
13
  constructor(components: Components, config: Config, postUtil: PostUtil);
14
14
  getAutosave(postId: number, userId?: number): Promise<Post | undefined>;
15
- getList(postOrId: Post | number, fn?: (query: PostsQuery) => void): Promise<never[] | [{
15
+ getList(postOrId: Post | number, fn?: (query: PostsQuery) => void): Promise<{
16
16
  ID: number;
17
17
  post_author: number;
18
+ post_date: string | undefined;
19
+ post_date_gmt: string | undefined;
18
20
  post_content: string;
19
21
  post_title: string;
20
22
  post_excerpt: string;
@@ -25,6 +27,8 @@ export declare class RevisionUtil {
25
27
  post_name: string;
26
28
  to_ping: string;
27
29
  pinged: string;
30
+ post_modified: string | undefined;
31
+ post_modified_gmt: string | undefined;
28
32
  post_content_filtered: string;
29
33
  post_parent: number;
30
34
  guid: string;
@@ -32,35 +36,7 @@ export declare class RevisionUtil {
32
36
  post_type: string;
33
37
  post_mime_type: string;
34
38
  comment_count: number;
35
- post_date?: string | undefined;
36
- post_date_gmt?: string | undefined;
37
- post_modified?: string | undefined;
38
- post_modified_gmt?: string | undefined;
39
- }, ...{
40
- ID: number;
41
- post_author: number;
42
- post_content: string;
43
- post_title: string;
44
- post_excerpt: string;
45
- post_status: string;
46
- comment_status: string;
47
- ping_status: string;
48
- post_password: string;
49
- post_name: string;
50
- to_ping: string;
51
- pinged: string;
52
- post_content_filtered: string;
53
- post_parent: number;
54
- guid: string;
55
- menu_order: number;
56
- post_type: string;
57
- post_mime_type: string;
58
- comment_count: number;
59
- post_date?: string | undefined;
60
- post_date_gmt?: string | undefined;
61
- post_modified?: string | undefined;
62
- post_modified_gmt?: string | undefined;
63
- }[]]>;
39
+ }[]>;
64
40
  convertToData(post: types.Tables["posts"], autosave?: boolean): Record<string, any>;
65
41
  }
66
42
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"revision.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/revision.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM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KAAK,eAAe,GAAG,OAAO,CAC5B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,UAAU,EACnD,YAAY,GAAG,cAAc,GAAG,cAAc,CAC/C,CAAC;AAEF,qBACa,YAAY;IAQrB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ;IARlB,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAI3C;gBAED,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ;IAItB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU;IAwB9C,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;IAkCvE,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,UAAQ;CAsB5D"}
package/core/vars.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Context } from "./context";
2
2
  import type * as types from "../types";
3
3
  export declare class Vars {
4
4
  static globalMap: Map<any, any>;
5
- map: Map<any, any>;
5
+ map: Map<string, any>;
6
6
  get TABLES_MS_CURRENT_INDEX(): number;
7
7
  set TABLES_MS_CURRENT_INDEX(index: number);
8
8
  get DOING_AUTOSAVE(): boolean;
@@ -1 +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,C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M,EAAE,MAAM,EAErC;IAED,IAAI,mBAAmB,IAJS,MAAM,CAMrC;CACF"}
@@ -44,22 +44,22 @@ export declare class CommentCrud extends Crud {
44
44
  private formReturnData;
45
45
  getAsUpsert(commentId: number): Promise<{
46
46
  data: {
47
+ comment_date: string | undefined;
48
+ comment_date_gmt: string | undefined;
47
49
  comment_post_ID: number;
48
- comment_author: string;
49
- comment_content: string;
50
50
  comment_karma: number;
51
- comment_approved: number | "0" | "1" | "trash" | "spam" | "post-trashed" | "approve" | "hold";
52
51
  comment_agent: string;
53
52
  comment_type: string;
54
53
  comment_parent: number;
55
54
  user_id: number;
55
+ comment_author: string;
56
+ comment_approved: number | "trash" | "0" | "1" | "spam" | "post-trashed" | "approve" | "hold";
57
+ comment_content: string;
56
58
  comment_meta: Record<string, any>;
57
- comment_ID?: number | undefined;
58
59
  comment_author_email?: string | undefined;
59
60
  comment_author_url?: string | undefined;
60
61
  comment_author_IP?: string | undefined;
61
- comment_date?: string | undefined;
62
- comment_date_gmt?: string | undefined;
62
+ comment_ID?: number | undefined;
63
63
  };
64
64
  info: undefined;
65
65
  }>;
@@ -39,28 +39,28 @@ export declare class MetaCrud extends Crud {
39
39
  } | {
40
40
  meta_value: string | number | bigint | boolean | symbol | object | Function | null | undefined;
41
41
  meta_id: number;
42
- meta_key: string | null;
43
42
  comment_id: number;
43
+ meta_key: string | null;
44
44
  } | {
45
45
  meta_value: string | number | bigint | boolean | symbol | object | Function | null | undefined;
46
46
  meta_id: number;
47
- meta_key: string | null;
48
47
  post_id: number;
48
+ meta_key: string | null;
49
49
  } | {
50
50
  meta_value: string | number | bigint | boolean | symbol | object | Function | null | undefined;
51
51
  meta_id: number;
52
- meta_key: string | null;
53
52
  site_id: number;
53
+ meta_key: string | null;
54
54
  } | {
55
55
  meta_value: string | number | bigint | boolean | symbol | object | Function | null | undefined;
56
56
  meta_id: number;
57
- meta_key: string | null;
58
57
  term_id: number;
58
+ meta_key: string | null;
59
59
  } | {
60
60
  meta_value: string | number | bigint | boolean | symbol | object | Function | null | undefined;
61
- meta_key: string | null;
62
- user_id: number;
63
61
  umeta_id: number;
62
+ user_id: number;
63
+ meta_key: string | null;
64
64
  })[];
65
65
  info: undefined;
66
66
  }>;