@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.
Files changed (517) hide show
  1. package/application.d.ts +76 -0
  2. package/application.d.ts.map +1 -0
  3. package/application.js +132 -0
  4. package/common/async-constructor.d.ts +2 -0
  5. package/common/async-constructor.d.ts.map +1 -0
  6. package/common/async-constructor.js +7 -0
  7. package/common/config/define-post-status.config.d.ts +4 -0
  8. package/common/config/define-post-status.config.d.ts.map +1 -0
  9. package/common/config/define-post-status.config.js +26 -0
  10. package/common/config/define-post-type.config.d.ts +4 -0
  11. package/common/config/define-post-type.config.d.ts.map +1 -0
  12. package/common/config/define-post-type.config.js +39 -0
  13. package/common/config/define-taxonomies.config.d.ts +4 -0
  14. package/common/config/define-taxonomies.config.d.ts.map +1 -0
  15. package/common/config/define-taxonomies.config.js +26 -0
  16. package/common/config/define-wp.config..d.ts +12 -0
  17. package/common/config/define-wp.config..d.ts.map +1 -0
  18. package/common/config/define-wp.config..js +110 -0
  19. package/common/config/index.d.ts +5 -0
  20. package/common/config/index.d.ts.map +1 -0
  21. package/common/config/index.js +20 -0
  22. package/common/date.d.ts +19 -0
  23. package/common/date.d.ts.map +1 -0
  24. package/common/date.js +116 -0
  25. package/common/define-hooks.d.ts +4 -0
  26. package/common/define-hooks.d.ts.map +1 -0
  27. package/common/define-hooks.js +16 -0
  28. package/common/diff.d.ts +3 -0
  29. package/common/diff.d.ts.map +1 -0
  30. package/common/diff.js +23 -0
  31. package/common/files.d.ts +14 -0
  32. package/common/files.d.ts.map +1 -0
  33. package/common/files.js +160 -0
  34. package/common/formatting.d.ts +47 -0
  35. package/common/formatting.d.ts.map +1 -0
  36. package/common/formatting.js +218 -0
  37. package/common/hierarchy.d.ts +21 -0
  38. package/common/hierarchy.d.ts.map +1 -0
  39. package/common/hierarchy.js +78 -0
  40. package/common/hooks-command.d.ts +7 -0
  41. package/common/hooks-command.d.ts.map +1 -0
  42. package/common/hooks-command.js +21 -0
  43. package/common/index.d.ts +11 -0
  44. package/common/index.d.ts.map +1 -0
  45. package/common/index.js +49 -0
  46. package/common/password.d.ts +4 -0
  47. package/common/password.d.ts.map +1 -0
  48. package/common/password.js +224 -0
  49. package/common/php-serialize.d.ts +3 -0
  50. package/common/php-serialize.d.ts.map +1 -0
  51. package/common/php-serialize.js +17 -0
  52. package/common/validating.d.ts +10 -0
  53. package/common/validating.d.ts.map +1 -0
  54. package/common/validating.js +65 -0
  55. package/config.d.ts +99 -0
  56. package/config.d.ts.map +1 -0
  57. package/config.js +76 -0
  58. package/constants/async-init.d.ts +2 -0
  59. package/constants/async-init.d.ts.map +1 -0
  60. package/constants/async-init.js +4 -0
  61. package/constants/component.d.ts +3 -0
  62. package/constants/component.d.ts.map +1 -0
  63. package/constants/component.js +5 -0
  64. package/constants/database.d.ts +2 -0
  65. package/constants/database.d.ts.map +1 -0
  66. package/constants/database.js +9 -0
  67. package/constants/default-database-tables.d.ts +7 -0
  68. package/constants/default-database-tables.d.ts.map +1 -0
  69. package/constants/default-database-tables.js +26 -0
  70. package/constants/index.d.ts +9 -0
  71. package/constants/index.d.ts.map +1 -0
  72. package/constants/index.js +24 -0
  73. package/constants/role-capabilities.d.ts +3 -0
  74. package/constants/role-capabilities.d.ts.map +1 -0
  75. package/constants/role-capabilities.js +67 -0
  76. package/constants/role-capability-actions.d.ts +2 -0
  77. package/constants/role-capability-actions.d.ts.map +1 -0
  78. package/constants/role-capability-actions.js +90 -0
  79. package/constants/role-names.d.ts +2 -0
  80. package/constants/role-names.d.ts.map +1 -0
  81. package/constants/role-names.js +12 -0
  82. package/constants/scope.d.ts +6 -0
  83. package/constants/scope.d.ts.map +1 -0
  84. package/constants/scope.js +9 -0
  85. package/core/async-init-reflect.d.ts +5 -0
  86. package/core/async-init-reflect.d.ts.map +1 -0
  87. package/core/async-init-reflect.js +18 -0
  88. package/core/blog.d.ts +20 -0
  89. package/core/blog.d.ts.map +1 -0
  90. package/core/blog.js +123 -0
  91. package/core/capabilities.d.ts +12 -0
  92. package/core/capabilities.d.ts.map +1 -0
  93. package/core/capabilities.js +625 -0
  94. package/core/comment.d.ts +111 -0
  95. package/core/comment.d.ts.map +1 -0
  96. package/core/comment.js +173 -0
  97. package/core/components.d.ts +13 -0
  98. package/core/components.d.ts.map +1 -0
  99. package/core/components.js +129 -0
  100. package/core/context.d.ts +38 -0
  101. package/core/context.d.ts.map +1 -0
  102. package/core/context.js +77 -0
  103. package/core/current.d.ts +33 -0
  104. package/core/current.d.ts.map +1 -0
  105. package/core/current.js +229 -0
  106. package/core/date-time.d.ts +18 -0
  107. package/core/date-time.d.ts.map +1 -0
  108. package/core/date-time.js +71 -0
  109. package/core/hooks/action.d.ts +16 -0
  110. package/core/hooks/action.d.ts.map +1 -0
  111. package/core/hooks/action.js +44 -0
  112. package/core/hooks/actions/init.d.ts +5 -0
  113. package/core/hooks/actions/init.d.ts.map +1 -0
  114. package/core/hooks/actions/init.js +28 -0
  115. package/core/hooks/default-hooks.d.ts +7 -0
  116. package/core/hooks/default-hooks.d.ts.map +1 -0
  117. package/core/hooks/default-hooks.js +19 -0
  118. package/core/hooks/filter.d.ts +12 -0
  119. package/core/hooks/filter.d.ts.map +1 -0
  120. package/core/hooks/filter.js +76 -0
  121. package/core/hooks/filters/capabilities.d.ts +16 -0
  122. package/core/hooks/filters/capabilities.d.ts.map +1 -0
  123. package/core/hooks/filters/capabilities.js +395 -0
  124. package/core/hooks/hooks-command.d.ts +9 -0
  125. package/core/hooks/hooks-command.d.ts.map +1 -0
  126. package/core/hooks/hooks-command.js +28 -0
  127. package/core/hooks/hooks-reflect.d.ts +42 -0
  128. package/core/hooks/hooks-reflect.d.ts.map +1 -0
  129. package/core/hooks/hooks-reflect.js +73 -0
  130. package/core/hooks/hooks.d.ts +61 -0
  131. package/core/hooks/hooks.d.ts.map +1 -0
  132. package/core/hooks/hooks.js +82 -0
  133. package/core/hooks/index.d.ts +4 -0
  134. package/core/hooks/index.d.ts.map +1 -0
  135. package/core/hooks/index.js +19 -0
  136. package/core/installer.d.ts +56 -0
  137. package/core/installer.d.ts.map +1 -0
  138. package/core/installer.js +395 -0
  139. package/core/logger.d.ts +22 -0
  140. package/core/logger.d.ts.map +1 -0
  141. package/core/logger.js +65 -0
  142. package/core/meta.d.ts +20 -0
  143. package/core/meta.d.ts.map +1 -0
  144. package/core/meta.js +123 -0
  145. package/core/options.d.ts +20 -0
  146. package/core/options.d.ts.map +1 -0
  147. package/core/options.js +148 -0
  148. package/core/post.d.ts +39 -0
  149. package/core/post.d.ts.map +1 -0
  150. package/core/post.js +164 -0
  151. package/core/query.d.ts +14 -0
  152. package/core/query.d.ts.map +1 -0
  153. package/core/query.js +39 -0
  154. package/core/role.d.ts +21 -0
  155. package/core/role.d.ts.map +1 -0
  156. package/core/role.js +71 -0
  157. package/core/roles.d.ts +16 -0
  158. package/core/roles.d.ts.map +1 -0
  159. package/core/roles.js +84 -0
  160. package/core/schema.d.ts +13 -0
  161. package/core/schema.d.ts.map +1 -0
  162. package/core/schema.js +83 -0
  163. package/core/site.d.ts +28 -0
  164. package/core/site.d.ts.map +1 -0
  165. package/core/site.js +105 -0
  166. package/core/tables.d.ts +18 -0
  167. package/core/tables.d.ts.map +1 -0
  168. package/core/tables.js +64 -0
  169. package/core/taxonomy.d.ts +23 -0
  170. package/core/taxonomy.d.ts.map +1 -0
  171. package/core/taxonomy.js +83 -0
  172. package/core/term.d.ts +104 -0
  173. package/core/term.d.ts.map +1 -0
  174. package/core/term.js +136 -0
  175. package/core/user.d.ts +32 -0
  176. package/core/user.d.ts.map +1 -0
  177. package/core/user.js +273 -0
  178. package/core/utils/blog.util.d.ts +14 -0
  179. package/core/utils/blog.util.d.ts.map +1 -0
  180. package/core/utils/blog.util.js +97 -0
  181. package/core/utils/comment.util.d.ts +23 -0
  182. package/core/utils/comment.util.d.ts.map +1 -0
  183. package/core/utils/comment.util.js +312 -0
  184. package/core/utils/crud.util.d.ts +40 -0
  185. package/core/utils/crud.util.d.ts.map +1 -0
  186. package/core/utils/crud.util.js +97 -0
  187. package/core/utils/date-time.util.d.ts +9 -0
  188. package/core/utils/date-time.util.d.ts.map +1 -0
  189. package/core/utils/date-time.util.js +29 -0
  190. package/core/utils/link.util.d.ts +23 -0
  191. package/core/utils/link.util.d.ts.map +1 -0
  192. package/core/utils/link.util.js +148 -0
  193. package/core/utils/meta.util.d.ts +13 -0
  194. package/core/utils/meta.util.d.ts.map +1 -0
  195. package/core/utils/meta.util.js +73 -0
  196. package/core/utils/post.util.d.ts +34 -0
  197. package/core/utils/post.util.d.ts.map +1 -0
  198. package/core/utils/post.util.js +272 -0
  199. package/core/utils/query.util.d.ts +36 -0
  200. package/core/utils/query.util.d.ts.map +1 -0
  201. package/core/utils/query.util.js +168 -0
  202. package/core/utils/revision.util.d.ts +67 -0
  203. package/core/utils/revision.util.d.ts.map +1 -0
  204. package/core/utils/revision.util.js +105 -0
  205. package/core/utils/roles.util.d.ts +30 -0
  206. package/core/utils/roles.util.d.ts.map +1 -0
  207. package/core/utils/roles.util.js +189 -0
  208. package/core/utils/signup.util.d.ts +33 -0
  209. package/core/utils/signup.util.d.ts.map +1 -0
  210. package/core/utils/signup.util.js +227 -0
  211. package/core/utils/site.util.d.ts +22 -0
  212. package/core/utils/site.util.d.ts.map +1 -0
  213. package/core/utils/site.util.js +122 -0
  214. package/core/utils/taxonomy.util.d.ts +19 -0
  215. package/core/utils/taxonomy.util.d.ts.map +1 -0
  216. package/core/utils/taxonomy.util.js +52 -0
  217. package/core/utils/term.util.d.ts +13 -0
  218. package/core/utils/term.util.d.ts.map +1 -0
  219. package/core/utils/term.util.js +113 -0
  220. package/core/utils/trx.util.d.ts +24 -0
  221. package/core/utils/trx.util.d.ts.map +1 -0
  222. package/core/utils/trx.util.js +86 -0
  223. package/core/utils/user-self-registration.util.d.ts +46 -0
  224. package/core/utils/user-self-registration.util.d.ts.map +1 -0
  225. package/core/utils/user-self-registration.util.js +171 -0
  226. package/core/utils/user.util.d.ts +153 -0
  227. package/core/utils/user.util.d.ts.map +1 -0
  228. package/core/utils/user.util.js +550 -0
  229. package/core/utils/utils.d.ts +36 -0
  230. package/core/utils/utils.d.ts.map +1 -0
  231. package/core/utils/utils.js +85 -0
  232. package/core/validator.d.ts +11 -0
  233. package/core/validator.d.ts.map +1 -0
  234. package/core/validator.js +40 -0
  235. package/core/vars.d.ts +19 -0
  236. package/core/vars.d.ts.map +1 -0
  237. package/core/vars.js +54 -0
  238. package/crud/blog.crud.d.ts +56 -0
  239. package/crud/blog.crud.d.ts.map +1 -0
  240. package/crud/blog.crud.js +301 -0
  241. package/crud/comment.crud.d.ts +104 -0
  242. package/crud/comment.crud.d.ts.map +1 -0
  243. package/crud/comment.crud.js +431 -0
  244. package/crud/crud.d.ts +63 -0
  245. package/crud/crud.d.ts.map +1 -0
  246. package/crud/crud.js +278 -0
  247. package/crud/error.d.ts +23 -0
  248. package/crud/error.d.ts.map +1 -0
  249. package/crud/error.js +51 -0
  250. package/crud/meta.crud.d.ts +69 -0
  251. package/crud/meta.crud.d.ts.map +1 -0
  252. package/crud/meta.crud.js +244 -0
  253. package/crud/options.crud.d.ts +37 -0
  254. package/crud/options.crud.d.ts.map +1 -0
  255. package/crud/options.crud.js +178 -0
  256. package/crud/post.crud.d.ts +225 -0
  257. package/crud/post.crud.d.ts.map +1 -0
  258. package/crud/post.crud.js +589 -0
  259. package/crud/revision.crud.d.ts +76 -0
  260. package/crud/revision.crud.d.ts.map +1 -0
  261. package/crud/revision.crud.js +155 -0
  262. package/crud/roles.crud.d.ts +50 -0
  263. package/crud/roles.crud.d.ts.map +1 -0
  264. package/crud/roles.crud.js +198 -0
  265. package/crud/settings.crud.d.ts +50 -0
  266. package/crud/settings.crud.d.ts.map +1 -0
  267. package/crud/settings.crud.js +153 -0
  268. package/crud/site.crud.d.ts +62 -0
  269. package/crud/site.crud.d.ts.map +1 -0
  270. package/crud/site.crud.js +241 -0
  271. package/crud/sitemeta.crud.d.ts +55 -0
  272. package/crud/sitemeta.crud.d.ts.map +1 -0
  273. package/crud/sitemeta.crud.js +97 -0
  274. package/crud/term.crud.d.ts +85 -0
  275. package/crud/term.crud.d.ts.map +1 -0
  276. package/crud/term.crud.js +285 -0
  277. package/crud/user-self-registration.crud.d.ts +57 -0
  278. package/crud/user-self-registration.crud.d.ts.map +1 -0
  279. package/crud/user-self-registration.crud.js +173 -0
  280. package/crud/user.crud.d.ts +147 -0
  281. package/crud/user.crud.d.ts.map +1 -0
  282. package/crud/user.crud.js +626 -0
  283. package/database.d.ts +18 -0
  284. package/database.d.ts.map +1 -0
  285. package/database.js +80 -0
  286. package/decorators/async-init.d.ts +2 -0
  287. package/decorators/async-init.d.ts.map +1 -0
  288. package/decorators/async-init.js +7 -0
  289. package/decorators/component.d.ts +12 -0
  290. package/decorators/component.d.ts.map +1 -0
  291. package/decorators/component.js +47 -0
  292. package/decorators/hooks.d.ts +5 -0
  293. package/decorators/hooks.d.ts.map +1 -0
  294. package/decorators/hooks.js +30 -0
  295. package/defaults/extensions.d.ts +4 -0
  296. package/defaults/extensions.d.ts.map +1 -0
  297. package/defaults/extensions.js +34 -0
  298. package/defaults/index.d.ts +11 -0
  299. package/defaults/index.d.ts.map +1 -0
  300. package/defaults/index.js +49 -0
  301. package/defaults/options.d.ts +6 -0
  302. package/defaults/options.d.ts.map +1 -0
  303. package/defaults/options.js +267 -0
  304. package/defaults/post-status.d.ts +10 -0
  305. package/defaults/post-status.d.ts.map +1 -0
  306. package/defaults/post-status.js +83 -0
  307. package/defaults/post-types.d.ts +4 -0
  308. package/defaults/post-types.d.ts.map +1 -0
  309. package/defaults/post-types.js +72 -0
  310. package/defaults/roles.d.ts +31 -0
  311. package/defaults/roles.d.ts.map +1 -0
  312. package/defaults/roles.js +213 -0
  313. package/defaults/seeder.d.ts +34 -0
  314. package/defaults/seeder.d.ts.map +1 -0
  315. package/defaults/seeder.js +201 -0
  316. package/defaults/sitemeta.d.ts +2 -0
  317. package/defaults/sitemeta.d.ts.map +1 -0
  318. package/defaults/sitemeta.js +38 -0
  319. package/defaults/subdirectory-reserved-names.d.ts +2 -0
  320. package/defaults/subdirectory-reserved-names.d.ts.map +1 -0
  321. package/defaults/subdirectory-reserved-names.js +16 -0
  322. package/defaults/taxonomies.d.ts +5 -0
  323. package/defaults/taxonomies.d.ts.map +1 -0
  324. package/defaults/taxonomies.js +57 -0
  325. package/defaults/timezone.d.ts +2 -0
  326. package/defaults/timezone.d.ts.map +1 -0
  327. package/defaults/timezone.js +353 -0
  328. package/package.json +51 -0
  329. package/query-builder/alias.d.ts +24 -0
  330. package/query-builder/alias.d.ts.map +1 -0
  331. package/query-builder/alias.js +64 -0
  332. package/query-builder/blogs.query.d.ts +22 -0
  333. package/query-builder/blogs.query.d.ts.map +1 -0
  334. package/query-builder/blogs.query.js +85 -0
  335. package/query-builder/comments.query.d.ts +35 -0
  336. package/query-builder/comments.query.d.ts.map +1 -0
  337. package/query-builder/comments.query.js +211 -0
  338. package/query-builder/common.query.d.ts +18 -0
  339. package/query-builder/common.query.d.ts.map +1 -0
  340. package/query-builder/common.query.js +58 -0
  341. package/query-builder/index.d.ts +12 -0
  342. package/query-builder/index.d.ts.map +1 -0
  343. package/query-builder/index.js +27 -0
  344. package/query-builder/meta.query.d.ts +45 -0
  345. package/query-builder/meta.query.d.ts.map +1 -0
  346. package/query-builder/meta.query.js +188 -0
  347. package/query-builder/options.query.d.ts +19 -0
  348. package/query-builder/options.query.d.ts.map +1 -0
  349. package/query-builder/options.query.js +57 -0
  350. package/query-builder/posts.query.d.ts +30 -0
  351. package/query-builder/posts.query.d.ts.map +1 -0
  352. package/query-builder/posts.query.js +208 -0
  353. package/query-builder/query-builder.d.ts +21 -0
  354. package/query-builder/query-builder.d.ts.map +1 -0
  355. package/query-builder/query-builder.js +70 -0
  356. package/query-builder/query-builders.d.ts +18 -0
  357. package/query-builder/query-builders.d.ts.map +1 -0
  358. package/query-builder/query-builders.js +64 -0
  359. package/query-builder/site.query.d.ts +22 -0
  360. package/query-builder/site.query.d.ts.map +1 -0
  361. package/query-builder/site.query.js +85 -0
  362. package/query-builder/terms.query.d.ts +47 -0
  363. package/query-builder/terms.query.d.ts.map +1 -0
  364. package/query-builder/terms.query.js +233 -0
  365. package/query-builder/users.query.d.ts +37 -0
  366. package/query-builder/users.query.d.ts.map +1 -0
  367. package/query-builder/users.query.js +188 -0
  368. package/schema-builder/proxy.d.ts +10 -0
  369. package/schema-builder/proxy.d.ts.map +1 -0
  370. package/schema-builder/proxy.js +19 -0
  371. package/schema-builder/schema-builder.d.ts +21 -0
  372. package/schema-builder/schema-builder.d.ts.map +1 -0
  373. package/schema-builder/schema-builder.js +207 -0
  374. package/schema-builder/schema.d.ts +20 -0
  375. package/schema-builder/schema.d.ts.map +1 -0
  376. package/schema-builder/schema.js +527 -0
  377. package/transactions/blog.trx.d.ts +37 -0
  378. package/transactions/blog.trx.d.ts.map +1 -0
  379. package/transactions/blog.trx.js +296 -0
  380. package/transactions/comment.trx.d.ts +22 -0
  381. package/transactions/comment.trx.d.ts.map +1 -0
  382. package/transactions/comment.trx.js +311 -0
  383. package/transactions/index.d.ts +15 -0
  384. package/transactions/index.d.ts.map +1 -0
  385. package/transactions/index.js +30 -0
  386. package/transactions/link.trx.d.ts +22 -0
  387. package/transactions/link.trx.d.ts.map +1 -0
  388. package/transactions/link.trx.js +208 -0
  389. package/transactions/meta.trx.d.ts +30 -0
  390. package/transactions/meta.trx.d.ts.map +1 -0
  391. package/transactions/meta.trx.js +197 -0
  392. package/transactions/options.trx.d.ts +31 -0
  393. package/transactions/options.trx.d.ts.map +1 -0
  394. package/transactions/options.trx.js +192 -0
  395. package/transactions/post.trx.d.ts +48 -0
  396. package/transactions/post.trx.d.ts.map +1 -0
  397. package/transactions/post.trx.js +906 -0
  398. package/transactions/registration-log.trx.d.ts +14 -0
  399. package/transactions/registration-log.trx.d.ts.map +1 -0
  400. package/transactions/registration-log.trx.js +103 -0
  401. package/transactions/revision.trx.d.ts +32 -0
  402. package/transactions/revision.trx.d.ts.map +1 -0
  403. package/transactions/revision.trx.js +278 -0
  404. package/transactions/roles.trx.d.ts +20 -0
  405. package/transactions/roles.trx.d.ts.map +1 -0
  406. package/transactions/roles.trx.js +144 -0
  407. package/transactions/seeder.trx.d.ts +43 -0
  408. package/transactions/seeder.trx.d.ts.map +1 -0
  409. package/transactions/seeder.trx.js +530 -0
  410. package/transactions/signup.trx.d.ts +53 -0
  411. package/transactions/signup.trx.d.ts.map +1 -0
  412. package/transactions/signup.trx.js +305 -0
  413. package/transactions/site.trx.d.ts +21 -0
  414. package/transactions/site.trx.d.ts.map +1 -0
  415. package/transactions/site.trx.js +167 -0
  416. package/transactions/term.trx.d.ts +51 -0
  417. package/transactions/term.trx.d.ts.map +1 -0
  418. package/transactions/term.trx.js +838 -0
  419. package/transactions/trx.d.ts +9 -0
  420. package/transactions/trx.d.ts.map +1 -0
  421. package/transactions/trx.js +20 -0
  422. package/transactions/user.trx.d.ts +45 -0
  423. package/transactions/user.trx.d.ts.map +1 -0
  424. package/transactions/user.trx.js +535 -0
  425. package/types/capabilities.d.ts +71 -0
  426. package/types/common.d.ts +16 -0
  427. package/types/component.d.ts +3 -0
  428. package/types/config.d.ts +33 -0
  429. package/types/crud.d.ts +230 -0
  430. package/types/database.d.ts +50 -0
  431. package/types/hooks/actions.d.ts +67 -0
  432. package/types/hooks/command.d.ts +17 -0
  433. package/types/hooks/filters.d.ts +86 -0
  434. package/types/hooks/index.d.ts +11 -0
  435. package/types/index.d.ts +18 -0
  436. package/types/logging.d.ts +1 -0
  437. package/types/meta.d.ts +9 -0
  438. package/types/options.d.ts +3 -0
  439. package/types/post.d.ts +54 -0
  440. package/types/query-builder.d.ts +11 -0
  441. package/types/role.d.ts +34 -0
  442. package/types/schema.d.ts +11 -0
  443. package/types/schema.d.ts.map +1 -0
  444. package/types/schema.js +2 -0
  445. package/types/taxonomy.d.ts +29 -0
  446. package/types/timezone.d.ts +3 -0
  447. package/types/transactions.d.ts +32 -0
  448. package/types/user.d.ts +12 -0
  449. package/types/validating.d.ts +9 -0
  450. package/types/validating.d.ts.map +1 -0
  451. package/types/validating.js +2 -0
  452. package/validators/config.d.ts +948 -0
  453. package/validators/config.d.ts.map +1 -0
  454. package/validators/config.js +149 -0
  455. package/validators/crud.d.ts +571 -0
  456. package/validators/crud.d.ts.map +1 -0
  457. package/validators/crud.js +281 -0
  458. package/validators/database.d.ts +958 -0
  459. package/validators/database.d.ts.map +1 -0
  460. package/validators/database.js +245 -0
  461. package/validators/date.d.ts +4 -0
  462. package/validators/date.d.ts.map +1 -0
  463. package/validators/date.js +15 -0
  464. package/validators/helpers.d.ts +16 -0
  465. package/validators/helpers.d.ts.map +1 -0
  466. package/validators/helpers.js +86 -0
  467. package/validators/index.d.ts +10 -0
  468. package/validators/index.d.ts.map +1 -0
  469. package/validators/index.js +48 -0
  470. package/validators/options.d.ts +303 -0
  471. package/validators/options.d.ts.map +1 -0
  472. package/validators/options.js +106 -0
  473. package/validators/post-status.d.ts +42 -0
  474. package/validators/post-status.d.ts.map +1 -0
  475. package/validators/post-status.js +18 -0
  476. package/validators/query.d.ts +534 -0
  477. package/validators/query.d.ts.map +1 -0
  478. package/validators/query.js +110 -0
  479. package/validators/roles.d.ts +22 -0
  480. package/validators/roles.d.ts.map +1 -0
  481. package/validators/roles.js +9 -0
  482. package/validators/sitemeta.d.ts +105 -0
  483. package/validators/sitemeta.d.ts.map +1 -0
  484. package/validators/sitemeta.js +39 -0
  485. package/validators/transactions/blog.d.ts +225 -0
  486. package/validators/transactions/blog.d.ts.map +1 -0
  487. package/validators/transactions/blog.js +63 -0
  488. package/validators/transactions/comment.d.ts +155 -0
  489. package/validators/transactions/comment.d.ts.map +1 -0
  490. package/validators/transactions/comment.js +68 -0
  491. package/validators/transactions/index.d.ts +11 -0
  492. package/validators/transactions/index.d.ts.map +1 -0
  493. package/validators/transactions/index.js +26 -0
  494. package/validators/transactions/link.d.ts +128 -0
  495. package/validators/transactions/link.d.ts.map +1 -0
  496. package/validators/transactions/link.js +60 -0
  497. package/validators/transactions/meta.d.ts +23 -0
  498. package/validators/transactions/meta.d.ts.map +1 -0
  499. package/validators/transactions/meta.js +18 -0
  500. package/validators/transactions/post.d.ts +234 -0
  501. package/validators/transactions/post.d.ts.map +1 -0
  502. package/validators/transactions/post.js +100 -0
  503. package/validators/transactions/roles.d.ts +18 -0
  504. package/validators/transactions/roles.d.ts.map +1 -0
  505. package/validators/transactions/roles.js +13 -0
  506. package/validators/transactions/signup.d.ts +35 -0
  507. package/validators/transactions/signup.d.ts.map +1 -0
  508. package/validators/transactions/signup.js +51 -0
  509. package/validators/transactions/site.d.ts +36 -0
  510. package/validators/transactions/site.d.ts.map +1 -0
  511. package/validators/transactions/site.js +49 -0
  512. package/validators/transactions/term.d.ts +57 -0
  513. package/validators/transactions/term.d.ts.map +1 -0
  514. package/validators/transactions/term.js +44 -0
  515. package/validators/transactions/user.d.ts +182 -0
  516. package/validators/transactions/user.d.ts.map +1 -0
  517. package/validators/transactions/user.js +104 -0
@@ -0,0 +1,312 @@
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.CommentUtil = void 0;
46
+ const common_1 = require("../../common");
47
+ const config_1 = require("../../config");
48
+ const component_1 = require("../../decorators/component");
49
+ const val = __importStar(require("../../validators"));
50
+ const comment_1 = require("../comment");
51
+ const components_1 = require("../components");
52
+ const options_1 = require("../options");
53
+ const post_util_1 = require("./post.util");
54
+ const query_util_1 = require("./query.util");
55
+ const user_util_1 = require("./user.util");
56
+ let CommentUtil = class CommentUtil {
57
+ components;
58
+ config;
59
+ constructor(components, config) {
60
+ this.components = components;
61
+ this.config = config;
62
+ }
63
+ async get(id) {
64
+ return await this.components.asyncGet(comment_1.Comment, [id]);
65
+ }
66
+ toComment(comment) {
67
+ return this.components.get(comment_1.Comment, [comment.comment_ID, comment]);
68
+ }
69
+ toComments(comments) {
70
+ return comments.map((comment) => this.toComment(comment));
71
+ }
72
+ async getDefaultStatus(postType, commentType) {
73
+ postType = postType ?? "post";
74
+ commentType = commentType ?? "comment";
75
+ const options = this.components.get(options_1.Options);
76
+ const postTypeObjects = this.components
77
+ .get(post_util_1.PostUtil)
78
+ .getTypeObject(postType);
79
+ let supports, option, status;
80
+ switch (commentType) {
81
+ case "pingback":
82
+ case "trackback":
83
+ supports = "trackbacks";
84
+ option = "ping";
85
+ break;
86
+ default:
87
+ supports = "comments";
88
+ option = "comment";
89
+ break;
90
+ }
91
+ // Set the status.
92
+ if ("page" === postType) {
93
+ status = "closed";
94
+ }
95
+ else if (postTypeObjects && postTypeObjects.supports.includes(supports)) {
96
+ const defaultStatus = await options.get(`default_${option}_status`);
97
+ status =
98
+ defaultStatus === "open" || defaultStatus === "closed"
99
+ ? defaultStatus
100
+ : "closed";
101
+ }
102
+ else {
103
+ status = "closed";
104
+ }
105
+ return status;
106
+ }
107
+ // wp_get_comment_status
108
+ async getStatusAsString(commentId) {
109
+ const comment = await this.get(commentId);
110
+ if (!comment.props) {
111
+ return "";
112
+ }
113
+ const approved = comment.props.comment_approved;
114
+ if (!approved) {
115
+ return "";
116
+ }
117
+ if ("1" === approved) {
118
+ return "approved";
119
+ }
120
+ if ("0" === approved) {
121
+ return "unapproved";
122
+ }
123
+ if ("spam" == approved || "trash" == approved) {
124
+ return approved;
125
+ }
126
+ return "";
127
+ }
128
+ // comments_open
129
+ isOpen(post) {
130
+ return post.props && "open" == post.props.comment_status;
131
+ }
132
+ // wp_check_comment_disallowed_list
133
+ async containsNGWord(args) {
134
+ const { comment_author: author = "", comment_author_email: email = "", comment_author_url: url = "", comment_content: content = "", comment_author_IP: authorIp = "", comment_agent: userAgent = "", } = args;
135
+ const options = this.components.get(options_1.Options);
136
+ const moderationKeys = await options.get("disallowed_keys");
137
+ if (!moderationKeys || 0 >= moderationKeys.length) {
138
+ return false;
139
+ }
140
+ // Ensure HTML tags are not being used to bypass the list of disallowed characters and words.
141
+ const commentWithoutHtml = common_1.formatting.stripTags(content);
142
+ const escapeRegExp = (key) => {
143
+ // Escape special characters for use in a regular expression
144
+ return key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
145
+ };
146
+ for (const key of moderationKeys.split("\n").map((key) => key.trim())) {
147
+ // Skip empty lines.
148
+ if (0 >= key.length) {
149
+ continue;
150
+ }
151
+ // Do some escaping magic so that '#' chars in the spam words don't break things
152
+ const pattern = new RegExp(escapeRegExp(key), "iu");
153
+ if (pattern.test(author) ||
154
+ pattern.test(email) ||
155
+ pattern.test(url) ||
156
+ pattern.test(content) ||
157
+ pattern.test(commentWithoutHtml) ||
158
+ pattern.test(authorIp) ||
159
+ pattern.test(userAgent)) {
160
+ return true;
161
+ }
162
+ }
163
+ return false;
164
+ }
165
+ // check_comment
166
+ async isValid(args) {
167
+ const { comment_author: author = "", comment_author_email: email = "", comment_author_url: url = "", comment_content: content = "", comment_author_IP: authorIp = "", comment_agent: userAgent = "", comment_type: commentType = "comment", } = args;
168
+ const options = this.components.get(options_1.Options);
169
+ // If manual moderation is enabled, skip all checks and return false.
170
+ if (1 === (await options.get("comment_moderation"))) {
171
+ return false;
172
+ }
173
+ // Check for the number of external links if a max allowed number is set.
174
+ const maxLinks = await options.get("comment_max_links");
175
+ if (maxLinks) {
176
+ const regex = /<a [^>]*href/gi;
177
+ const numLinks = content.match(regex);
178
+ if (numLinks && numLinks.length >= maxLinks) {
179
+ return false;
180
+ }
181
+ }
182
+ const moderationKeys = (await options.get("moderation_keys"))?.trim();
183
+ // If moderation 'keys' (keywords) are set, process them.
184
+ if (moderationKeys) {
185
+ const escapeRegExp = (key) => {
186
+ // Escape special characters for use in a regular expression
187
+ return key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
188
+ };
189
+ for (const key of moderationKeys.split("\n").map((key) => key.trim())) {
190
+ // Skip empty lines.
191
+ if (0 >= key.length) {
192
+ continue;
193
+ }
194
+ // - Escape the word to be used in the regex
195
+ // - Create the regex pattern
196
+ const pattern = new RegExp(escapeRegExp(key), "iu");
197
+ for (const field of [
198
+ author,
199
+ email,
200
+ url,
201
+ content,
202
+ authorIp,
203
+ userAgent,
204
+ ]) {
205
+ if (pattern.test(field)) {
206
+ return false;
207
+ }
208
+ }
209
+ }
210
+ /*
211
+ * Check if the option to approve comments by previously-approved authors is enabled.
212
+ *
213
+ * If it is enabled, check whether the comment author has a previously-approved comment,
214
+ * as well as whether there are any moderation keywords (if set) present in the author
215
+ * email address. If both checks pass, return true. Otherwise, return false.
216
+ */
217
+ if (1 === (await options.get("comment_previously_approved"))) {
218
+ if (commentType === "trackback" ||
219
+ commentType === "pingback" ||
220
+ 0 >= author.length ||
221
+ 0 >= email.length) {
222
+ return false;
223
+ }
224
+ const queryUtil = this.components.get(query_util_1.QueryUtil);
225
+ const user = await queryUtil.users((query) => {
226
+ query.where("user_email", common_1.formatting.unslash(email)).builder.first();
227
+ }, val.database.wpUsers);
228
+ let okToComment = false;
229
+ if (user && user.ID) {
230
+ okToComment = (await queryUtil.comments((query) => {
231
+ query.where("user_id", user.ID).where("approved", "1");
232
+ }))
233
+ ? true
234
+ : false;
235
+ }
236
+ else {
237
+ okToComment = (await queryUtil.comments((query) => {
238
+ query
239
+ .where("author", author)
240
+ .where("author_email", email)
241
+ .where("approved", "1");
242
+ }))
243
+ ? true
244
+ : false;
245
+ }
246
+ return (okToComment && (!moderationKeys || !email.includes(moderationKeys)));
247
+ }
248
+ }
249
+ return true;
250
+ }
251
+ // wp_allow_comment
252
+ async getStatus(comment) {
253
+ const parsed = val.database.wpComments.safeParse({
254
+ comment_ID: 0,
255
+ ...comment,
256
+ });
257
+ if (!parsed.success) {
258
+ return "0";
259
+ }
260
+ const data = parsed.data;
261
+ /*
262
+ * Simple duplicate check.
263
+ * expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
264
+ */
265
+ const queryUtil = this.components.get(query_util_1.QueryUtil);
266
+ const duplicate = await queryUtil.comments((query) => {
267
+ query
268
+ .where("post_ID", common_1.formatting.unslash(data.comment_post_ID))
269
+ .where("parent", common_1.formatting.unslash(data.comment_parent));
270
+ if (data.comment_author) {
271
+ query.where("author", common_1.formatting.unslash(data.comment_author));
272
+ }
273
+ if (data.comment_author_email) {
274
+ query.where("author_email", common_1.formatting.unslash(data.comment_author_email));
275
+ }
276
+ query.builder.first();
277
+ }, val.database.wpComments);
278
+ if (duplicate) {
279
+ throw new Error("comment_duplicate");
280
+ }
281
+ let user = undefined;
282
+ let post = undefined;
283
+ if (data.user_id && data.comment_post_ID) {
284
+ const userUtil = this.components.get(user_util_1.UserUtil);
285
+ user = await userUtil.get(data.user_id);
286
+ post = await queryUtil.posts((query) => {
287
+ query.where("ID", data.comment_post_ID).builder.first();
288
+ }, val.database.wpPosts);
289
+ }
290
+ if (user &&
291
+ user.props &&
292
+ (data.user_id == post?.post_author ||
293
+ (await user.can("moderate_comments")))) {
294
+ return "1";
295
+ }
296
+ let approved = "0";
297
+ if (await this.isValid(comment)) {
298
+ approved = "1";
299
+ }
300
+ if (await this.containsNGWord(comment)) {
301
+ approved = this.config.config.constants.EMPTY_TRASH_DAYS
302
+ ? "trash"
303
+ : "spam";
304
+ }
305
+ return approved;
306
+ }
307
+ };
308
+ exports.CommentUtil = CommentUtil;
309
+ exports.CommentUtil = CommentUtil = __decorate([
310
+ (0, component_1.component)(),
311
+ __metadata("design:paramtypes", [components_1.Components, config_1.Config])
312
+ ], CommentUtil);
@@ -0,0 +1,40 @@
1
+ import { BlogCrud } from "../../crud/blog.crud";
2
+ import { CommentCrud } from "../../crud/comment.crud";
3
+ import { CrudError, StatusMessage } from "../../crud/error";
4
+ import { MetaCrud } from "../../crud/meta.crud";
5
+ import { OptionsCrud } from "../../crud/options.crud";
6
+ import { PostCrud } from "../../crud/post.crud";
7
+ import { RevisionCrud } from "../../crud/revision.crud";
8
+ import { RolesCrud } from "../../crud/roles.crud";
9
+ import { SettingsCrud } from "../../crud/settings.crud";
10
+ import { SiteCrud } from "../../crud/site.crud";
11
+ import { SitemetaCrud } from "../../crud/sitemeta.crud";
12
+ import { TermCrud } from "../../crud/term.crud";
13
+ import { UserSelfRegistrationCrud } from "../../crud/user-self-registration.crud";
14
+ import { UserCrud } from "../../crud/user.crud";
15
+ import { Components } from "../components";
16
+ export declare class CrudUtil {
17
+ private components;
18
+ constructor(components: Components);
19
+ parseError<T extends Error & CrudError>(e: T): {
20
+ status: {
21
+ code: import("../../crud/error").StatusCode;
22
+ message: StatusMessage;
23
+ };
24
+ message: string;
25
+ };
26
+ get blog(): BlogCrud;
27
+ get comment(): CommentCrud;
28
+ get meta(): MetaCrud;
29
+ get options(): OptionsCrud;
30
+ get post(): PostCrud;
31
+ get revision(): RevisionCrud;
32
+ get roles(): RolesCrud;
33
+ get settings(): SettingsCrud;
34
+ get site(): SiteCrud;
35
+ get sitemeta(): SitemetaCrud;
36
+ get term(): TermCrud;
37
+ get user(): UserCrud;
38
+ get userSelfRegistration(): UserSelfRegistrationCrud;
39
+ }
40
+ //# sourceMappingURL=crud.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crud.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/crud.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAoB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qBACa,QAAQ;IACP,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C,UAAU,CAAC,CAAC,SAAS,KAAK,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC;;;;;;;IAqB5C,IAAI,IAAI,aAEP;IAED,IAAI,OAAO,gBAEV;IAED,IAAI,IAAI,aAEP;IAED,IAAI,OAAO,gBAEV;IAED,IAAI,IAAI,aAEP;IAED,IAAI,QAAQ,iBAEX;IAED,IAAI,KAAK,cAER;IAED,IAAI,QAAQ,iBAEX;IAED,IAAI,IAAI,aAEP;IAED,IAAI,QAAQ,iBAEX;IAED,IAAI,IAAI,aAEP;IAED,IAAI,IAAI,aAEP;IAED,IAAI,oBAAoB,6BAEvB;CACF"}
@@ -0,0 +1,97 @@
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.CrudUtil = void 0;
13
+ const blog_crud_1 = require("../../crud/blog.crud");
14
+ const comment_crud_1 = require("../../crud/comment.crud");
15
+ const error_1 = require("../../crud/error");
16
+ const meta_crud_1 = require("../../crud/meta.crud");
17
+ const options_crud_1 = require("../../crud/options.crud");
18
+ const post_crud_1 = require("../../crud/post.crud");
19
+ const revision_crud_1 = require("../../crud/revision.crud");
20
+ const roles_crud_1 = require("../../crud/roles.crud");
21
+ const settings_crud_1 = require("../../crud/settings.crud");
22
+ const site_crud_1 = require("../../crud/site.crud");
23
+ const sitemeta_crud_1 = require("../../crud/sitemeta.crud");
24
+ const term_crud_1 = require("../../crud/term.crud");
25
+ const user_self_registration_crud_1 = require("../../crud/user-self-registration.crud");
26
+ const user_crud_1 = require("../../crud/user.crud");
27
+ const component_1 = require("../../decorators/component");
28
+ const components_1 = require("../components");
29
+ let CrudUtil = class CrudUtil {
30
+ components;
31
+ constructor(components) {
32
+ this.components = components;
33
+ }
34
+ parseError(e) {
35
+ if (e?.statusCode) {
36
+ return {
37
+ status: {
38
+ code: e.statusCode,
39
+ message: error_1.StatusCodeMapper.getMessage(e.statusCode),
40
+ },
41
+ message: e.message,
42
+ };
43
+ }
44
+ const statusMessage = error_1.StatusMessage.INTERNAL_SERVER_ERROR;
45
+ return {
46
+ status: {
47
+ code: error_1.StatusCodeMapper.getCode(statusMessage),
48
+ message: statusMessage,
49
+ },
50
+ message: e.message,
51
+ };
52
+ }
53
+ get blog() {
54
+ return this.components.get(blog_crud_1.BlogCrud);
55
+ }
56
+ get comment() {
57
+ return this.components.get(comment_crud_1.CommentCrud);
58
+ }
59
+ get meta() {
60
+ return this.components.get(meta_crud_1.MetaCrud);
61
+ }
62
+ get options() {
63
+ return this.components.get(options_crud_1.OptionsCrud);
64
+ }
65
+ get post() {
66
+ return this.components.get(post_crud_1.PostCrud);
67
+ }
68
+ get revision() {
69
+ return this.components.get(revision_crud_1.RevisionCrud);
70
+ }
71
+ get roles() {
72
+ return this.components.get(roles_crud_1.RolesCrud);
73
+ }
74
+ get settings() {
75
+ return this.components.get(settings_crud_1.SettingsCrud);
76
+ }
77
+ get site() {
78
+ return this.components.get(site_crud_1.SiteCrud);
79
+ }
80
+ get sitemeta() {
81
+ return this.components.get(sitemeta_crud_1.SitemetaCrud);
82
+ }
83
+ get term() {
84
+ return this.components.get(term_crud_1.TermCrud);
85
+ }
86
+ get user() {
87
+ return this.components.get(user_crud_1.UserCrud);
88
+ }
89
+ get userSelfRegistration() {
90
+ return this.components.get(user_self_registration_crud_1.UserSelfRegistrationCrud);
91
+ }
92
+ };
93
+ exports.CrudUtil = CrudUtil;
94
+ exports.CrudUtil = CrudUtil = __decorate([
95
+ (0, component_1.component)(),
96
+ __metadata("design:paramtypes", [components_1.Components])
97
+ ], CrudUtil);
@@ -0,0 +1,9 @@
1
+ import { Components } from "../components";
2
+ import { DateTime } from "../date-time";
3
+ import type { MomentInput } from "moment";
4
+ export declare class DateTimeUtil {
5
+ private components;
6
+ constructor(components: Components);
7
+ get(date?: MomentInput): DateTime;
8
+ }
9
+ //# sourceMappingURL=date-time.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-time.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/date-time.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C,qBACa,YAAY;IACX,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW;CAGvB"}
@@ -0,0 +1,29 @@
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.DateTimeUtil = void 0;
13
+ const component_1 = require("../../decorators/component");
14
+ const components_1 = require("../components");
15
+ const date_time_1 = require("../date-time");
16
+ let DateTimeUtil = class DateTimeUtil {
17
+ components;
18
+ constructor(components) {
19
+ this.components = components;
20
+ }
21
+ get(date) {
22
+ return this.components.get(date_time_1.DateTime, [date]);
23
+ }
24
+ };
25
+ exports.DateTimeUtil = DateTimeUtil;
26
+ exports.DateTimeUtil = DateTimeUtil = __decorate([
27
+ (0, component_1.component)(),
28
+ __metadata("design:paramtypes", [components_1.Components])
29
+ ], DateTimeUtil);
@@ -0,0 +1,23 @@
1
+ import { Config } from "../../config";
2
+ import { Components } from "../components";
3
+ import { Post } from "../post";
4
+ import { Vars } from "../vars";
5
+ import { PostUtil } from "./post.util";
6
+ export declare class LinkUtil {
7
+ private components;
8
+ private postUtil;
9
+ private vars;
10
+ private config;
11
+ constructor(components: Components, postUtil: PostUtil, vars: Vars, config: Config);
12
+ getPermalink(post: Post): Promise<string>;
13
+ getAttachmentLink(post?: Post): Promise<string>;
14
+ getPageLink(post?: Post, leavename?: boolean, sample?: boolean): Promise<string>;
15
+ private forcePlainPostPermalink;
16
+ getHomeUrl(args?: {
17
+ blogId?: number;
18
+ path?: string;
19
+ scheme?: "http" | "https" | "relative" | "rest";
20
+ }): Promise<string>;
21
+ setUrlScheme(url: string, scheme?: string | null): string;
22
+ }
23
+ //# sourceMappingURL=link.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.util.d.ts","sourceRoot":"","sources":["../../../src/core/utils/link.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBACa,QAAQ;IAEjB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,MAAM;gBAHN,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM;IAIlB,YAAY,CAAC,IAAI,EAAE,IAAI;IAmBvB,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI;IAO7B,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,UAAQ,EAAE,MAAM,UAAQ;IAiBhE,OAAO,CAAC,uBAAuB;IAgCzB,UAAU,CAAC,IAAI,CAAC,EAAE;QACtB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;KACjD;IAgCD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM;CA2BhE"}
@@ -0,0 +1,148 @@
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.LinkUtil = void 0;
13
+ const config_1 = require("../../config");
14
+ const component_1 = require("../../decorators/component");
15
+ const components_1 = require("../components");
16
+ const current_1 = require("../current");
17
+ const options_1 = require("../options");
18
+ const vars_1 = require("../vars");
19
+ const post_util_1 = require("./post.util");
20
+ let LinkUtil = class LinkUtil {
21
+ components;
22
+ postUtil;
23
+ vars;
24
+ config;
25
+ constructor(components, postUtil, vars, config) {
26
+ this.components = components;
27
+ this.postUtil = postUtil;
28
+ this.vars = vars;
29
+ this.config = config;
30
+ }
31
+ // get_permalink
32
+ async getPermalink(post) {
33
+ if (!post.props?.ID) {
34
+ return this.getHomeUrl();
35
+ }
36
+ if ("page" === post.props.post_type) {
37
+ return await this.getPageLink(post);
38
+ }
39
+ if ("attachment" === post.props.post_type) {
40
+ return await this.getAttachmentLink(post);
41
+ }
42
+ return this.getHomeUrl({
43
+ path: `?p=${post.props.ID}`,
44
+ });
45
+ }
46
+ // get_attachment_link
47
+ async getAttachmentLink(post) {
48
+ return !post
49
+ ? await this.getHomeUrl()
50
+ : await this.getHomeUrl({ path: `/?attachment_id=${post.props?.ID}` });
51
+ }
52
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
53
+ async getPageLink(post, leavename = false, sample = false) {
54
+ if (!post || !post.props?.ID) {
55
+ return await this.getHomeUrl();
56
+ }
57
+ const options = this.components.get(options_1.Options);
58
+ if ("page" === (await options.get("show_on_from")) &&
59
+ (await options.get("page_on_from")) === post.props.ID) {
60
+ return await this.getHomeUrl();
61
+ }
62
+ return await this.getHomeUrl({ path: `?page_id=${post.props.ID}` });
63
+ }
64
+ forcePlainPostPermalink(post) {
65
+ const postUtil = this.components.get(post_util_1.PostUtil);
66
+ const current = this.components.get(current_1.Current);
67
+ const sample = post.filter == "sample";
68
+ if (!post.props?.ID && post.props && 0 >= post.props.ID) {
69
+ return true;
70
+ }
71
+ const statusObject = postUtil.getStatusObject(post.props?.post_status);
72
+ const typeObject = postUtil.getTypeObject(post.props?.post_type);
73
+ if (!statusObject || !typeObject) {
74
+ return true;
75
+ }
76
+ if (
77
+ // Publicly viewable links never have plain permalinks.
78
+ postUtil.isStatusViewable(statusObject) ||
79
+ // Private posts don't have plain permalinks if the user can read them.
80
+ (true == statusObject.private &&
81
+ post.props?.ID &&
82
+ current.user?.can("read_post", post.props.ID)) ||
83
+ // Protected posts don't have plain links if getting a sample URL.
84
+ (true == statusObject.protected && sample)) {
85
+ return false;
86
+ }
87
+ return true;
88
+ }
89
+ async getHomeUrl(args) {
90
+ let { scheme = undefined } = args ?? {};
91
+ const { blogId = undefined, path = "" } = args ?? {};
92
+ const options = this.components.get(options_1.Options);
93
+ if (blogId && this.config.isMultiSite()) {
94
+ options.usingBlog(blogId);
95
+ }
96
+ let url = (await options.get("home")) ?? "";
97
+ options.resetBlog();
98
+ if (!["http", "https", "relative"].includes(scheme ?? "")) {
99
+ scheme = this.config.isSsl() ? "https" : "http";
100
+ }
101
+ else {
102
+ try {
103
+ const protocol = new URL(url).protocol.replace(/:$/, "");
104
+ scheme = ["http", "https", "relative", "rest"].includes(protocol)
105
+ ? protocol
106
+ : (scheme = this.config.isSsl() ? "https" : "http");
107
+ }
108
+ catch (e) {
109
+ scheme = this.config.isSsl() ? "https" : "http";
110
+ }
111
+ }
112
+ url = this.setUrlScheme(url, scheme);
113
+ if (typeof path === "string") {
114
+ url = `${url}/${path.replace(/^\//, "")}`;
115
+ }
116
+ return url;
117
+ }
118
+ setUrlScheme(url, scheme = null) {
119
+ if (!scheme ||
120
+ ["admin", "login", "login_post", "rpc"].includes(scheme) ||
121
+ !["http", "https", "relative"].includes(scheme)) {
122
+ scheme = this.config.isSsl() ? "https" : "http";
123
+ }
124
+ url = url.trim();
125
+ if (url.startsWith("//")) {
126
+ url = "https:" + url;
127
+ }
128
+ if (scheme === "relative") {
129
+ url = url.replace(/^\w+:\/\//, ""); // Remove the scheme
130
+ if (url !== "" && url[0] === "/") {
131
+ // eslint-disable-next-line no-control-regex
132
+ url = "/" + url.replace(/^[/ \t\n\r\0\x0B]+/, "");
133
+ }
134
+ }
135
+ else {
136
+ url = url.replace(/^\w+:\/\//, scheme + "://");
137
+ }
138
+ return url;
139
+ }
140
+ };
141
+ exports.LinkUtil = LinkUtil;
142
+ exports.LinkUtil = LinkUtil = __decorate([
143
+ (0, component_1.component)(),
144
+ __metadata("design:paramtypes", [components_1.Components,
145
+ post_util_1.PostUtil,
146
+ vars_1.Vars,
147
+ config_1.Config])
148
+ ], LinkUtil);