@strapi/types 5.0.0-beta.0 → 5.0.0-beta.2

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 (397) hide show
  1. package/dist/core/api.d.ts +3 -0
  2. package/dist/core/api.d.ts.map +1 -0
  3. package/dist/{types/core → core}/commands/index.d.ts +1 -1
  4. package/dist/core/commands/index.d.ts.map +1 -0
  5. package/dist/core/config/admin.d.ts.map +1 -0
  6. package/dist/core/config/api.d.ts.map +1 -0
  7. package/dist/{types/core → core}/config/database.d.ts +2 -2
  8. package/dist/core/config/database.d.ts.map +1 -0
  9. package/dist/core/config/index.d.ts.map +1 -0
  10. package/dist/{types/core → core}/config/middlewares.d.ts +1 -1
  11. package/dist/core/config/middlewares.d.ts.map +1 -0
  12. package/dist/core/config/plugin.d.ts.map +1 -0
  13. package/dist/{types/core → core}/config/server.d.ts +0 -4
  14. package/dist/core/config/server.d.ts.map +1 -0
  15. package/dist/core/config/shared.d.ts.map +1 -0
  16. package/dist/core/container.d.ts.map +1 -0
  17. package/dist/{types/core/common → core}/controller.d.ts +1 -1
  18. package/dist/core/controller.d.ts.map +1 -0
  19. package/dist/{types → core}/core-api/controller.d.ts +16 -14
  20. package/dist/core/core-api/controller.d.ts.map +1 -0
  21. package/dist/core/core-api/index.d.ts.map +1 -0
  22. package/dist/{types → core}/core-api/router.d.ts +7 -6
  23. package/dist/core/core-api/router.d.ts.map +1 -0
  24. package/dist/{types → core}/core-api/service.d.ts +7 -6
  25. package/dist/core/core-api/service.d.ts.map +1 -0
  26. package/dist/core/index.d.ts +14 -0
  27. package/dist/core/index.d.ts.map +1 -0
  28. package/dist/{types/core/common → core}/middleware.d.ts +3 -2
  29. package/dist/core/middleware.d.ts.map +1 -0
  30. package/dist/core/module.d.ts +26 -0
  31. package/dist/core/module.d.ts.map +1 -0
  32. package/dist/core/plugin.d.ts +6 -0
  33. package/dist/core/plugin.d.ts.map +1 -0
  34. package/dist/core/policy.d.ts +15 -0
  35. package/dist/core/policy.d.ts.map +1 -0
  36. package/dist/core/router.d.ts.map +1 -0
  37. package/dist/core/service.d.ts.map +1 -0
  38. package/dist/core/strapi.d.ts +157 -0
  39. package/dist/core/strapi.d.ts.map +1 -0
  40. package/dist/data/component.d.ts +12 -0
  41. package/dist/data/component.d.ts.map +1 -0
  42. package/dist/data/constants.d.ts +2 -0
  43. package/dist/data/constants.d.ts.map +1 -0
  44. package/dist/data/content-type.d.ts +17 -0
  45. package/dist/data/content-type.d.ts.map +1 -0
  46. package/dist/data/entity.d.ts +9 -0
  47. package/dist/data/entity.d.ts.map +1 -0
  48. package/dist/data/index.d.ts +5 -0
  49. package/dist/data/index.d.ts.map +1 -0
  50. package/dist/index.d.ts +11 -150
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/internal/index.d.ts +13 -0
  53. package/dist/internal/index.d.ts.map +1 -0
  54. package/dist/{types/core → internal}/namespace.d.ts +6 -6
  55. package/dist/internal/namespace.d.ts.map +1 -0
  56. package/dist/internal/registry.d.ts +8 -0
  57. package/dist/internal/registry.d.ts.map +1 -0
  58. package/dist/{types/core → internal}/uid.d.ts +20 -13
  59. package/dist/internal/uid.d.ts.map +1 -0
  60. package/dist/modules/auth.d.ts +4 -4
  61. package/dist/modules/auth.d.ts.map +1 -1
  62. package/dist/modules/content-api.d.ts +5 -3
  63. package/dist/modules/content-api.d.ts.map +1 -1
  64. package/dist/modules/core-store.d.ts +3 -3
  65. package/dist/modules/core-store.d.ts.map +1 -1
  66. package/dist/modules/cron.d.ts +1 -1
  67. package/dist/modules/cron.d.ts.map +1 -1
  68. package/dist/modules/documents/document-engine.d.ts +2 -0
  69. package/dist/modules/documents/document-engine.d.ts.map +1 -0
  70. package/dist/modules/documents/draft-and-publish.d.ts +7 -7
  71. package/dist/modules/documents/draft-and-publish.d.ts.map +1 -1
  72. package/dist/modules/documents/index.d.ts +9 -4
  73. package/dist/modules/documents/index.d.ts.map +1 -1
  74. package/dist/modules/documents/middleware.d.ts +3 -3
  75. package/dist/modules/documents/middleware.d.ts.map +1 -1
  76. package/dist/modules/documents/params/attributes.d.ts +33 -30
  77. package/dist/modules/documents/params/attributes.d.ts.map +1 -1
  78. package/dist/modules/documents/params/data.d.ts +2 -2
  79. package/dist/modules/documents/params/data.d.ts.map +1 -1
  80. package/dist/modules/documents/params/document-engine.d.ts +14 -14
  81. package/dist/modules/documents/params/document-engine.d.ts.map +1 -1
  82. package/dist/modules/documents/params/fields.d.ts +7 -5
  83. package/dist/modules/documents/params/fields.d.ts.map +1 -1
  84. package/dist/modules/documents/params/filters/index.d.ts +11 -9
  85. package/dist/modules/documents/params/filters/index.d.ts.map +1 -1
  86. package/dist/modules/documents/params/index.d.ts +5 -4
  87. package/dist/modules/documents/params/index.d.ts.map +1 -1
  88. package/dist/modules/documents/params/pagination.d.ts +2 -2
  89. package/dist/modules/documents/params/pagination.d.ts.map +1 -1
  90. package/dist/modules/documents/params/populate.d.ts +19 -17
  91. package/dist/modules/documents/params/populate.d.ts.map +1 -1
  92. package/dist/modules/documents/params/sort.d.ts +10 -8
  93. package/dist/modules/documents/params/sort.d.ts.map +1 -1
  94. package/dist/modules/documents/plugin.d.ts +8 -5
  95. package/dist/modules/documents/plugin.d.ts.map +1 -1
  96. package/dist/modules/documents/result/document-engine.d.ts +30 -0
  97. package/dist/modules/documents/result/document-engine.d.ts.map +1 -0
  98. package/dist/modules/documents/result/index.d.ts +38 -35
  99. package/dist/modules/documents/result/index.d.ts.map +1 -1
  100. package/dist/modules/documents/service-instance.d.ts +25 -6
  101. package/dist/modules/documents/service-instance.d.ts.map +1 -1
  102. package/dist/modules/entity-service/index.d.ts +22 -22
  103. package/dist/modules/entity-service/index.d.ts.map +1 -1
  104. package/dist/modules/entity-service/params/attributes/id.d.ts +2 -2
  105. package/dist/modules/entity-service/params/attributes/id.d.ts.map +1 -1
  106. package/dist/modules/entity-service/params/attributes/index.d.ts +21 -19
  107. package/dist/modules/entity-service/params/attributes/index.d.ts.map +1 -1
  108. package/dist/modules/entity-service/params/attributes/literals.d.ts +1 -1
  109. package/dist/modules/entity-service/params/attributes/literals.d.ts.map +1 -1
  110. package/dist/modules/entity-service/params/attributes/relation.d.ts +6 -4
  111. package/dist/modules/entity-service/params/attributes/relation.d.ts.map +1 -1
  112. package/dist/modules/entity-service/params/attributes/utils.d.ts +8 -6
  113. package/dist/modules/entity-service/params/attributes/utils.d.ts.map +1 -1
  114. package/dist/modules/entity-service/params/data.d.ts +2 -2
  115. package/dist/modules/entity-service/params/data.d.ts.map +1 -1
  116. package/dist/modules/entity-service/params/fields.d.ts +7 -5
  117. package/dist/modules/entity-service/params/fields.d.ts.map +1 -1
  118. package/dist/modules/entity-service/params/filters/index.d.ts +17 -15
  119. package/dist/modules/entity-service/params/filters/index.d.ts.map +1 -1
  120. package/dist/modules/entity-service/params/index.d.ts +4 -3
  121. package/dist/modules/entity-service/params/index.d.ts.map +1 -1
  122. package/dist/modules/entity-service/params/pagination.d.ts +1 -2
  123. package/dist/modules/entity-service/params/pagination.d.ts.map +1 -1
  124. package/dist/modules/entity-service/params/populate.d.ts +20 -18
  125. package/dist/modules/entity-service/params/populate.d.ts.map +1 -1
  126. package/dist/modules/entity-service/params/sort.d.ts +11 -9
  127. package/dist/modules/entity-service/params/sort.d.ts.map +1 -1
  128. package/dist/modules/entity-service/plugin.d.ts +8 -5
  129. package/dist/modules/entity-service/plugin.d.ts.map +1 -1
  130. package/dist/modules/entity-service/result.d.ts +34 -45
  131. package/dist/modules/entity-service/result.d.ts.map +1 -1
  132. package/dist/modules/entity-validator.d.ts +5 -4
  133. package/dist/modules/entity-validator.d.ts.map +1 -1
  134. package/dist/modules/index.d.ts +20 -0
  135. package/dist/modules/index.d.ts.map +1 -0
  136. package/dist/modules/permissions.d.ts +14 -0
  137. package/dist/modules/permissions.d.ts.map +1 -0
  138. package/dist/modules/sanitizers.d.ts +4 -5
  139. package/dist/modules/sanitizers.d.ts.map +1 -1
  140. package/dist/modules/server.d.ts +3 -3
  141. package/dist/modules/server.d.ts.map +1 -1
  142. package/dist/modules/validators.d.ts +4 -5
  143. package/dist/modules/validators.d.ts.map +1 -1
  144. package/dist/plugin/config/index.d.ts.map +1 -0
  145. package/dist/plugin/config/strapi-admin/index.d.ts.map +1 -0
  146. package/dist/plugin/config/strapi-server/config.d.ts.map +1 -0
  147. package/dist/{types/core/plugins → plugin}/config/strapi-server/content-types.d.ts +2 -2
  148. package/dist/plugin/config/strapi-server/content-types.d.ts.map +1 -0
  149. package/dist/plugin/config/strapi-server/controllers.d.ts +8 -0
  150. package/dist/plugin/config/strapi-server/controllers.d.ts.map +1 -0
  151. package/dist/plugin/config/strapi-server/index.d.ts.map +1 -0
  152. package/dist/{types/core/plugins → plugin}/config/strapi-server/lifecycle.d.ts +1 -1
  153. package/dist/plugin/config/strapi-server/lifecycle.d.ts.map +1 -0
  154. package/dist/plugin/config/strapi-server/routes.d.ts +11 -0
  155. package/dist/plugin/config/strapi-server/routes.d.ts.map +1 -0
  156. package/dist/plugin/index.d.ts +37 -0
  157. package/dist/plugin/index.d.ts.map +1 -0
  158. package/dist/public/index.d.ts +6 -0
  159. package/dist/public/index.d.ts.map +1 -0
  160. package/dist/public/registries.d.ts +34 -0
  161. package/dist/public/registries.d.ts.map +1 -0
  162. package/dist/public/shared.d.ts +8 -0
  163. package/dist/public/shared.d.ts.map +1 -0
  164. package/dist/{types/core/attributes → schema/attribute}/base.d.ts +4 -30
  165. package/dist/schema/attribute/base.d.ts.map +1 -0
  166. package/dist/schema/attribute/common.d.ts +4 -0
  167. package/dist/schema/attribute/common.d.ts.map +1 -0
  168. package/dist/schema/attribute/constants.d.ts +12 -0
  169. package/dist/schema/attribute/constants.d.ts.map +1 -0
  170. package/dist/schema/attribute/definitions/biginteger.d.ts +16 -0
  171. package/dist/schema/attribute/definitions/biginteger.d.ts.map +1 -0
  172. package/dist/{types/core/attributes → schema/attribute/definitions}/blocks.d.ts +17 -13
  173. package/dist/schema/attribute/definitions/blocks.d.ts.map +1 -0
  174. package/dist/schema/attribute/definitions/boolean.d.ts +16 -0
  175. package/dist/schema/attribute/definitions/boolean.d.ts.map +1 -0
  176. package/dist/schema/attribute/definitions/component.d.ts +22 -0
  177. package/dist/schema/attribute/definitions/component.d.ts.map +1 -0
  178. package/dist/schema/attribute/definitions/date-time.d.ts +15 -0
  179. package/dist/schema/attribute/definitions/date-time.d.ts.map +1 -0
  180. package/dist/schema/attribute/definitions/date.d.ts +15 -0
  181. package/dist/schema/attribute/definitions/date.d.ts.map +1 -0
  182. package/dist/schema/attribute/definitions/decimal.d.ts +16 -0
  183. package/dist/schema/attribute/definitions/decimal.d.ts.map +1 -0
  184. package/dist/schema/attribute/definitions/dynamic-zone.d.ts +22 -0
  185. package/dist/schema/attribute/definitions/dynamic-zone.d.ts.map +1 -0
  186. package/dist/schema/attribute/definitions/email.d.ts +16 -0
  187. package/dist/schema/attribute/definitions/email.d.ts.map +1 -0
  188. package/dist/schema/attribute/definitions/enumeration.d.ts +19 -0
  189. package/dist/schema/attribute/definitions/enumeration.d.ts.map +1 -0
  190. package/dist/schema/attribute/definitions/float.d.ts +16 -0
  191. package/dist/schema/attribute/definitions/float.d.ts.map +1 -0
  192. package/dist/schema/attribute/definitions/index.d.ts +23 -0
  193. package/dist/schema/attribute/definitions/index.d.ts.map +1 -0
  194. package/dist/schema/attribute/definitions/integer.d.ts +16 -0
  195. package/dist/schema/attribute/definitions/integer.d.ts.map +1 -0
  196. package/dist/schema/attribute/definitions/json.d.ts +14 -0
  197. package/dist/schema/attribute/definitions/json.d.ts.map +1 -0
  198. package/dist/schema/attribute/definitions/media.d.ts +21 -0
  199. package/dist/schema/attribute/definitions/media.d.ts.map +1 -0
  200. package/dist/schema/attribute/definitions/password.d.ts +15 -0
  201. package/dist/schema/attribute/definitions/password.d.ts.map +1 -0
  202. package/dist/schema/attribute/definitions/relation.d.ts +165 -0
  203. package/dist/schema/attribute/definitions/relation.d.ts.map +1 -0
  204. package/dist/schema/attribute/definitions/richtext.d.ts +15 -0
  205. package/dist/schema/attribute/definitions/richtext.d.ts.map +1 -0
  206. package/dist/schema/attribute/definitions/string.d.ts +22 -0
  207. package/dist/schema/attribute/definitions/string.d.ts.map +1 -0
  208. package/dist/schema/attribute/definitions/text.d.ts +20 -0
  209. package/dist/schema/attribute/definitions/text.d.ts.map +1 -0
  210. package/dist/schema/attribute/definitions/time.d.ts +15 -0
  211. package/dist/schema/attribute/definitions/time.d.ts.map +1 -0
  212. package/dist/schema/attribute/definitions/timestamp.d.ts +15 -0
  213. package/dist/schema/attribute/definitions/timestamp.d.ts.map +1 -0
  214. package/dist/{types/core/attributes → schema/attribute/definitions}/uid.d.ts +13 -2
  215. package/dist/schema/attribute/definitions/uid.d.ts.map +1 -0
  216. package/dist/schema/attribute/index.d.ts +7 -0
  217. package/dist/schema/attribute/index.d.ts.map +1 -0
  218. package/dist/schema/attribute/options.d.ts +81 -0
  219. package/dist/schema/attribute/options.d.ts.map +1 -0
  220. package/dist/schema/attribute/utils.d.ts +60 -0
  221. package/dist/schema/attribute/utils.d.ts.map +1 -0
  222. package/dist/schema/index.d.ts +71 -0
  223. package/dist/schema/index.d.ts.map +1 -0
  224. package/dist/struct/index.d.ts +3 -0
  225. package/dist/struct/index.d.ts.map +1 -0
  226. package/dist/struct/schema-definition.d.ts +10 -0
  227. package/dist/struct/schema-definition.d.ts.map +1 -0
  228. package/dist/{types/core/schemas/index.d.ts → struct/schema.d.ts} +46 -36
  229. package/dist/struct/schema.d.ts.map +1 -0
  230. package/dist/uid/index.d.ts +43 -0
  231. package/dist/uid/index.d.ts.map +1 -0
  232. package/dist/utils/array.d.ts +80 -0
  233. package/dist/utils/array.d.ts.map +1 -0
  234. package/dist/utils/constants.d.ts +67 -0
  235. package/dist/utils/constants.d.ts.map +1 -0
  236. package/dist/utils/expression.d.ts +490 -0
  237. package/dist/utils/expression.d.ts.map +1 -0
  238. package/dist/utils/function.d.ts +21 -0
  239. package/dist/utils/function.d.ts.map +1 -0
  240. package/dist/utils/guard.d.ts +90 -0
  241. package/dist/utils/guard.d.ts.map +1 -0
  242. package/dist/utils/index.d.ts +180 -0
  243. package/dist/utils/index.d.ts.map +1 -0
  244. package/dist/utils/json.d.ts +119 -0
  245. package/dist/utils/json.d.ts.map +1 -0
  246. package/dist/utils/object.d.ts +180 -0
  247. package/dist/utils/object.d.ts.map +1 -0
  248. package/dist/utils/string.d.ts +154 -0
  249. package/dist/utils/string.d.ts.map +1 -0
  250. package/dist/utils/tuple.d.ts +19 -0
  251. package/dist/utils/tuple.d.ts.map +1 -0
  252. package/package.json +15 -13
  253. package/dist/container.d.ts.map +0 -1
  254. package/dist/modules/documents/result/document-enigne.d.ts +0 -30
  255. package/dist/modules/documents/result/document-enigne.d.ts.map +0 -1
  256. package/dist/types/core/attributes/base.d.ts.map +0 -1
  257. package/dist/types/core/attributes/biginteger.d.ts +0 -5
  258. package/dist/types/core/attributes/biginteger.d.ts.map +0 -1
  259. package/dist/types/core/attributes/blocks.d.ts.map +0 -1
  260. package/dist/types/core/attributes/boolean.d.ts +0 -7
  261. package/dist/types/core/attributes/boolean.d.ts.map +0 -1
  262. package/dist/types/core/attributes/common.d.ts +0 -59
  263. package/dist/types/core/attributes/common.d.ts.map +0 -1
  264. package/dist/types/core/attributes/component.d.ts +0 -20
  265. package/dist/types/core/attributes/component.d.ts.map +0 -1
  266. package/dist/types/core/attributes/date-time.d.ts +0 -5
  267. package/dist/types/core/attributes/date-time.d.ts.map +0 -1
  268. package/dist/types/core/attributes/date.d.ts +0 -5
  269. package/dist/types/core/attributes/date.d.ts.map +0 -1
  270. package/dist/types/core/attributes/decimal.d.ts +0 -5
  271. package/dist/types/core/attributes/decimal.d.ts.map +0 -1
  272. package/dist/types/core/attributes/dynamic-zone.d.ts +0 -13
  273. package/dist/types/core/attributes/dynamic-zone.d.ts.map +0 -1
  274. package/dist/types/core/attributes/email.d.ts +0 -5
  275. package/dist/types/core/attributes/email.d.ts.map +0 -1
  276. package/dist/types/core/attributes/enumeration.d.ts +0 -10
  277. package/dist/types/core/attributes/enumeration.d.ts.map +0 -1
  278. package/dist/types/core/attributes/float.d.ts +0 -5
  279. package/dist/types/core/attributes/float.d.ts.map +0 -1
  280. package/dist/types/core/attributes/index.d.ts +0 -26
  281. package/dist/types/core/attributes/index.d.ts.map +0 -1
  282. package/dist/types/core/attributes/integer.d.ts +0 -5
  283. package/dist/types/core/attributes/integer.d.ts.map +0 -1
  284. package/dist/types/core/attributes/json.d.ts +0 -6
  285. package/dist/types/core/attributes/json.d.ts.map +0 -1
  286. package/dist/types/core/attributes/media.d.ts +0 -13
  287. package/dist/types/core/attributes/media.d.ts.map +0 -1
  288. package/dist/types/core/attributes/password.d.ts +0 -5
  289. package/dist/types/core/attributes/password.d.ts.map +0 -1
  290. package/dist/types/core/attributes/relation.d.ts +0 -85
  291. package/dist/types/core/attributes/relation.d.ts.map +0 -1
  292. package/dist/types/core/attributes/richtext.d.ts +0 -5
  293. package/dist/types/core/attributes/richtext.d.ts.map +0 -1
  294. package/dist/types/core/attributes/string.d.ts +0 -10
  295. package/dist/types/core/attributes/string.d.ts.map +0 -1
  296. package/dist/types/core/attributes/text.d.ts +0 -8
  297. package/dist/types/core/attributes/text.d.ts.map +0 -1
  298. package/dist/types/core/attributes/time.d.ts +0 -5
  299. package/dist/types/core/attributes/time.d.ts.map +0 -1
  300. package/dist/types/core/attributes/timestamp.d.ts +0 -5
  301. package/dist/types/core/attributes/timestamp.d.ts.map +0 -1
  302. package/dist/types/core/attributes/uid.d.ts.map +0 -1
  303. package/dist/types/core/attributes/utils.d.ts +0 -28
  304. package/dist/types/core/attributes/utils.d.ts.map +0 -1
  305. package/dist/types/core/commands/index.d.ts.map +0 -1
  306. package/dist/types/core/common/api.d.ts +0 -4
  307. package/dist/types/core/common/api.d.ts.map +0 -1
  308. package/dist/types/core/common/controller.d.ts.map +0 -1
  309. package/dist/types/core/common/index.d.ts +0 -15
  310. package/dist/types/core/common/index.d.ts.map +0 -1
  311. package/dist/types/core/common/middleware.d.ts.map +0 -1
  312. package/dist/types/core/common/module.d.ts +0 -25
  313. package/dist/types/core/common/module.d.ts.map +0 -1
  314. package/dist/types/core/common/plugin.d.ts +0 -6
  315. package/dist/types/core/common/plugin.d.ts.map +0 -1
  316. package/dist/types/core/common/policy.d.ts +0 -10
  317. package/dist/types/core/common/policy.d.ts.map +0 -1
  318. package/dist/types/core/common/router.d.ts.map +0 -1
  319. package/dist/types/core/common/schema.d.ts +0 -3
  320. package/dist/types/core/common/schema.d.ts.map +0 -1
  321. package/dist/types/core/common/service.d.ts.map +0 -1
  322. package/dist/types/core/common/uid.d.ts +0 -16
  323. package/dist/types/core/common/uid.d.ts.map +0 -1
  324. package/dist/types/core/config/admin.d.ts.map +0 -1
  325. package/dist/types/core/config/api.d.ts.map +0 -1
  326. package/dist/types/core/config/database.d.ts.map +0 -1
  327. package/dist/types/core/config/index.d.ts.map +0 -1
  328. package/dist/types/core/config/middlewares.d.ts.map +0 -1
  329. package/dist/types/core/config/plugin.d.ts.map +0 -1
  330. package/dist/types/core/config/server.d.ts.map +0 -1
  331. package/dist/types/core/config/shared.d.ts.map +0 -1
  332. package/dist/types/core/entity/index.d.ts +0 -2
  333. package/dist/types/core/entity/index.d.ts.map +0 -1
  334. package/dist/types/core/index.d.ts +0 -11
  335. package/dist/types/core/index.d.ts.map +0 -1
  336. package/dist/types/core/namespace.d.ts.map +0 -1
  337. package/dist/types/core/permissions/index.d.ts +0 -5
  338. package/dist/types/core/permissions/index.d.ts.map +0 -1
  339. package/dist/types/core/plugins/config/index.d.ts.map +0 -1
  340. package/dist/types/core/plugins/config/strapi-admin/index.d.ts.map +0 -1
  341. package/dist/types/core/plugins/config/strapi-server/config.d.ts.map +0 -1
  342. package/dist/types/core/plugins/config/strapi-server/content-types.d.ts.map +0 -1
  343. package/dist/types/core/plugins/config/strapi-server/controllers.d.ts +0 -8
  344. package/dist/types/core/plugins/config/strapi-server/controllers.d.ts.map +0 -1
  345. package/dist/types/core/plugins/config/strapi-server/index.d.ts.map +0 -1
  346. package/dist/types/core/plugins/config/strapi-server/lifecycle.d.ts.map +0 -1
  347. package/dist/types/core/plugins/config/strapi-server/routes.d.ts +0 -11
  348. package/dist/types/core/plugins/config/strapi-server/routes.d.ts.map +0 -1
  349. package/dist/types/core/plugins/index.d.ts +0 -33
  350. package/dist/types/core/plugins/index.d.ts.map +0 -1
  351. package/dist/types/core/registry.d.ts +0 -58
  352. package/dist/types/core/registry.d.ts.map +0 -1
  353. package/dist/types/core/schemas/index.d.ts.map +0 -1
  354. package/dist/types/core/strapi/index.d.ts +0 -26
  355. package/dist/types/core/strapi/index.d.ts.map +0 -1
  356. package/dist/types/core/uid.d.ts.map +0 -1
  357. package/dist/types/core-api/controller.d.ts.map +0 -1
  358. package/dist/types/core-api/index.d.ts.map +0 -1
  359. package/dist/types/core-api/router.d.ts.map +0 -1
  360. package/dist/types/core-api/service.d.ts.map +0 -1
  361. package/dist/types/index.d.ts +0 -5
  362. package/dist/types/index.d.ts.map +0 -1
  363. package/dist/types/shared/index.d.ts +0 -5
  364. package/dist/types/shared/index.d.ts.map +0 -1
  365. package/dist/types/shared/registries.d.ts +0 -38
  366. package/dist/types/shared/registries.d.ts.map +0 -1
  367. package/dist/types/utils/array.d.ts +0 -16
  368. package/dist/types/utils/array.d.ts.map +0 -1
  369. package/dist/types/utils/expression.d.ts +0 -44
  370. package/dist/types/utils/expression.d.ts.map +0 -1
  371. package/dist/types/utils/function.d.ts +0 -3
  372. package/dist/types/utils/function.d.ts.map +0 -1
  373. package/dist/types/utils/guard.d.ts +0 -20
  374. package/dist/types/utils/guard.d.ts.map +0 -1
  375. package/dist/types/utils/index.d.ts +0 -27
  376. package/dist/types/utils/index.d.ts.map +0 -1
  377. package/dist/types/utils/json.d.ts +0 -7
  378. package/dist/types/utils/json.d.ts.map +0 -1
  379. package/dist/types/utils/object.d.ts +0 -69
  380. package/dist/types/utils/object.d.ts.map +0 -1
  381. package/dist/types/utils/string.d.ts +0 -40
  382. package/dist/types/utils/string.d.ts.map +0 -1
  383. package/dist/types/utils/tuple.d.ts +0 -9
  384. package/dist/types/utils/tuple.d.ts.map +0 -1
  385. /package/dist/{types/core → core}/config/admin.d.ts +0 -0
  386. /package/dist/{types/core → core}/config/api.d.ts +0 -0
  387. /package/dist/{types/core → core}/config/index.d.ts +0 -0
  388. /package/dist/{types/core → core}/config/plugin.d.ts +0 -0
  389. /package/dist/{types/core → core}/config/shared.d.ts +0 -0
  390. /package/dist/{container.d.ts → core/container.d.ts} +0 -0
  391. /package/dist/{types → core}/core-api/index.d.ts +0 -0
  392. /package/dist/{types/core/common → core}/router.d.ts +0 -0
  393. /package/dist/{types/core/common → core}/service.d.ts +0 -0
  394. /package/dist/{types/core/plugins → plugin}/config/index.d.ts +0 -0
  395. /package/dist/{types/core/plugins → plugin}/config/strapi-admin/index.d.ts +0 -0
  396. /package/dist/{types/core/plugins → plugin}/config/strapi-server/config.d.ts +0 -0
  397. /package/dist/{types/core/plugins → plugin}/config/strapi-server/index.d.ts +0 -0
@@ -0,0 +1,180 @@
1
+ export * as Constants from './constants';
2
+ export * as Array from './array';
3
+ export * as Guard from './guard';
4
+ export * as Object from './object';
5
+ export * as String from './string';
6
+ export * as Function from './function';
7
+ export * as Tuple from './tuple';
8
+ export * from './expression';
9
+ export * from './json';
10
+ /**
11
+ * `Get<TValue, TKey>` obtains the type of a specific property (key-value pair) within an object or type.
12
+ *
13
+ * @template TValue The initial object type from which a property's type should be extracted.
14
+ * @template TKey A specific key, existing within `TValue`.
15
+ *
16
+ * @example
17
+ * // Utilizing Get to extract types from an object
18
+ * type ExampleObject = { foo: 'bar', 'bar': 'foo' };
19
+ *
20
+ * // Extract `foo`'s type from the object. This infers and outputs the type 'bar'.
21
+ * type FooType = Get<ExampleObject, 'foo'>;
22
+ * let fooVar: FooType = 'bar'; // This is valid
23
+ *
24
+ * // Similar extraction for `bar`
25
+ * type BarType = Get<ExampleObject, 'bar'>;
26
+ * let barVar: BarType = 'foo'; // This is valid
27
+ */
28
+ export type Get<TValue, TKey extends keyof TValue> = TValue[TKey];
29
+ /**
30
+ * `Flatten intersection types.
31
+ *
32
+ * It acts upon each constituent type within the provided intersection, and extracts its properties
33
+ * to form a new, unified object type where properties do not retain their original type-specific
34
+ * distinctions.
35
+ *
36
+ * It’s useful when there's a need to treat an intersection type as a single unified object type,
37
+ * while ensuring that the properties of each component type in the intersection are accounted for.
38
+ *
39
+ * @template T The type parameter indicating the intersection type that is to be simplified. This must extend `unknown`.
40
+ *
41
+ * @example
42
+ * Consider the following example with two distinct types `A` and `B`:
43
+ * ```typescript
44
+ * type A = { a: number };
45
+ * type B = { b: string };
46
+ * ```
47
+ * If we were to create an intersection of these two types as `C`:
48
+ * ```typescript
49
+ * type C = A & B;
50
+ * ```
51
+ * The usual operations on `C` would account for the distinct types `A` and `B`. However, when we want to treat it as a single unified object type, we can apply `Simplify` in the following way:
52
+ * ```typescript
53
+ * type D = Simplify<C>;
54
+ * ```
55
+ * Now, `D` is a single object type with properties from both `A` and `B`, and we can operate on it as:
56
+ * ```typescript
57
+ * let obj: D = { a: 5, b: 'hello' };
58
+ * ```
59
+ *
60
+ * @remark
61
+ * While this type is beneficial in certain contexts where treating intersection types as single unified objects is desirable (e.g. when exposing
62
+ * complex types to end-users), it's important to remember that it strips the original type information from the properties.
63
+ *
64
+ * Thus, it may not be suitable in situations where retaining the distinction between types present in the intersection is important.
65
+ */
66
+ export type Simplify<T> = {
67
+ [TKey in keyof T]: T[TKey];
68
+ };
69
+ /**
70
+ * Utility type that creates a new type by excluding properties from the left type ({@link TLeft}) that exist in the right type ({@link TRight}).
71
+ *
72
+ * @template TLeft
73
+ * @template TRight
74
+ *
75
+ * @example
76
+ * type User = {
77
+ * id: number,
78
+ * name: string,
79
+ * email: string,
80
+ * };
81
+ *
82
+ * type Credentials = {
83
+ * email: string,
84
+ * password: string,
85
+ * };
86
+ *
87
+ * type UserWithoutCredentials = Without<User, Credentials>;
88
+ *
89
+ * const user: UserWithoutCredentials = {
90
+ * id: 1,
91
+ * name: 'Alice'
92
+ * // no email property because it's excluded by the Without type
93
+ * };
94
+ */
95
+ export type Without<TLeft, TRight> = {
96
+ [key in Exclude<keyof TLeft, keyof TRight>]?: never;
97
+ };
98
+ /**
99
+ * Creates a type that is mutually exclusive between two given types.
100
+ *
101
+ * @template TLeft - The first type.
102
+ * @template TRight - The second type.
103
+ *
104
+ * @remarks
105
+ * This type is used to create a type that can be either TLeft or TRight, but not both at the same time.
106
+ *
107
+ * @example
108
+ * // Example 1: XOR type with two object types
109
+ * type A = { a: number };
110
+ * type B = { b: string };
111
+ *
112
+ * const value1: XOR<A, B> = { a: 1 }; // Valid, TLeft type A is assigned
113
+ * const value2: XOR<A, B> = { b: "hello" }; // Valid, TRight type B is assigned
114
+ * const value3: XOR<A, B> = { a: 1, b: "hello" }; // Invalid, both types A and B cannot be assigned at the same time
115
+ *
116
+ * // Example 2: XOR type with object type and string type
117
+ * type C = XOR<A, string>;
118
+ *
119
+ * const value4: C = { a: 1 }; // Valid, object type A is assigned
120
+ * const value5: C = "hello"; // Valid, string type is assigned
121
+ * const value6: C = { a: 1, b: "hello" }; // Invalid, both object type A and string type cannot be assigned at the same time
122
+ */
123
+ export type XOR<TLeft, TRight> = TLeft | TRight extends object ? (Without<TLeft, TRight> & TRight) | (Without<TRight, TLeft> & TLeft) : TLeft | TRight;
124
+ /**
125
+ * The `Cast` type is designed for casting a value of type {@link TValue} into type {@link TType}, thus making sure {@link TValue} extends {@link TType}.
126
+ *
127
+ * If the casting is impossible ({@link TValue} does not extend {@link TType}), it returns `never`.
128
+ *
129
+ * @template TValue - The type to cast.
130
+ * @template TType - The target type.
131
+ *
132
+ * @example
133
+ * // In this example, the String 'Hello' is attempted to be cast to a number,
134
+ * // which is not possible. Thus, the result would be 'never'.
135
+ * type ImpossibleCasting = Cast<'Hello', number>; // this will be 'never'
136
+ *
137
+ * @example
138
+ * // In this example, the String 'Hello' is attempted to be cast to a String,
139
+ * // which is possible. Thus, the result would be 'Hello'.
140
+ * type PossibleCasting = Cast<'Hello', string>; // this will be 'Hello'
141
+ *
142
+ */
143
+ export type Cast<TValue, TType> = TValue extends TType ? TValue : never;
144
+ /**
145
+ * The `PartialWithThis<T>` type extends the functionality of two types: {@link Partial} and {@link ThisType}.
146
+ *
147
+ * It creates a type that represents an object with a subset of properties from the provided
148
+ * type {@link T} merged with a pseudo `this` context for methods, based on the same type parameter.
149
+ *
150
+ * - {@link Partial} makes all properties of the given type optional.
151
+ * - {@link ThisType} defines what `this` refers to within a method of the final object.
152
+ *
153
+ * @template T The type to create a subset from and to use for the pseudo 'this' context.
154
+ *
155
+ * It can be any TypeScript type such as interface, class, primitive, or even another
156
+ * generic type.
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * interface MyObject {
161
+ * property1: string;
162
+ * property2: number;
163
+ * method(): void;
164
+ * }
165
+ *
166
+ * let foo: PartialWithThis<MyObject> = {
167
+ * property1: 'Hello',
168
+ * method() {
169
+ * // Here, `this` refers to `MyObject`
170
+ * console.log(this.property1);
171
+ * },
172
+ * // `property2` is optional
173
+ * };
174
+ * ```
175
+ *
176
+ * @remark
177
+ * This type can be useful when working with partial data and object methods that contain a pseudo `this` context.
178
+ */
179
+ export type PartialWithThis<T> = Partial<T> & ThisType<T>;
180
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KAAG,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;CAAE,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,EAAE,MAAM,IAAI;KAAG,GAAG,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK;CAAE,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,GAAG,MAAM,SAAS,MAAM,GAC1D,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,GACpE,KAAK,GAAG,MAAM,CAAC;AAEnB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,MAAM,SAAS,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * The `JSONValue` type embodies all potential JSON data forms ({@link JSONPrimitive}, {@link JSONObject}, and {@link JSONArray}).
3
+ *
4
+ * @note `JSONValue` does not introduce any new type parameters; it merely aggregates {@link JSONPrimitive}, {@link JSONObject}, and {@link JSONArray}.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * function processJSON(jsonData: JSONValue): void {
9
+ * if (Array.isArray(jsonData)) {
10
+ * console.log('This is a JSONArray: ', JSON.stringify(jsonData, null, 2));
11
+ * } else if (typeof jsonData === 'object') {
12
+ * console.log('This is a JSONObject: ', JSON.stringify(jsonData, null, 2));
13
+ * } else {
14
+ * console.log('This is a JSONPrimitive: ', jsonData);
15
+ * }
16
+ * }
17
+ *
18
+ * processJSON(['hello', { anotherKey: 'anotherValue' }]);
19
+ * // This is a JSONArray: ["hello", { "anotherKey": "anotherValue" }]
20
+ *
21
+ * processJSON({ key: 'value' });
22
+ * // This is a JSONObject: { "key": "value" }
23
+ *
24
+ * processJSON(10);
25
+ * // This is a JSONPrimitive: 10
26
+ * ```
27
+ *
28
+ * @see {@link JSONPrimitive} - The simplest form of `JSONValue`, corresponds to basic JSON data types.
29
+ * @see {@link JSONObject} - A potential `JSONValue`, encapsulates JSON object structures.
30
+ * @see {@link JSONArray} - A potential `JSONValue`, encapsulates JSON arrays.
31
+ */
32
+ export type JSONValue = JSONPrimitive | JSONObject | JSONArray;
33
+ /**
34
+ * The `JSONPrimitive` type models the fundamental data types (`string`, `number`, `boolean`, `null`) of JSON in TypeScript.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * declare function set(key: string, value: JSONPrimitive): void;
39
+ *
40
+ * set('string', 'foo'); // This is valid
41
+ * set('number', 42); // This is valid
42
+ * set('boolean', true); // This is valid
43
+ * set('null', null); // This is valid
44
+ * set('array', []); // Error
45
+ * set('undefined', undefined); // Error
46
+ * ```
47
+ *
48
+ * @see {@link JSONValue} - The potential forms of JSON data, including `JSONPrimitive`.
49
+ * @see {@link JSONObject} - Incorporated in {@link JSONValue}, represents JSON objects.
50
+ * @see {@link JSONArray} - Incorporated in {@link JSONValue}, represents JSON arrays.
51
+ *
52
+ * @remarks
53
+ * `JSONPrimitive` provides a foundation for describing JSON data.
54
+ * Combined with {@link JSONObject} and {@link JSONArray}, they encompass all possible JSON data types.
55
+ */
56
+ export type JSONPrimitive = string | number | boolean | null;
57
+ /**
58
+ * The `JSONArray` type models a standard JSON array in TypeScript, which allows manipulation of arrays of {@link JSONValue} elements.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Create a JSONArray consisting of different JSONValues
63
+ * let jsonArray: JSONArray = ['hello', 10, true, null, {key: 'value'}, ['nested array']];
64
+ *
65
+ * function prettyPrint(jsonArray: JSONArray): void {
66
+ * jsonArray.forEach(item => {
67
+ * if(typeof item === 'object' && item !== null) {
68
+ * // If it's a JSONObject or another JSONArray, stringify it
69
+ * console.log(JSON.stringify(item, null, 2));
70
+ * } else {
71
+ * // If it's a JSONPrimitive, print it directly
72
+ * console.log(item);
73
+ * }
74
+ * });
75
+ * }
76
+ *
77
+ * prettyPrint(jsonArray); // Will print all items in a friendly format to the console
78
+ * ```
79
+ *
80
+ * This type is part of a series of types used for modeling all possible JSON values in TypeScript.
81
+ * @see {@link JSONValue} - The supertype of all elements that a `JSONArray` can contain.
82
+ * @see {@link JSONPrimitive} - The simplest kind of `JSONValue` that a `JSONArray` can contain.
83
+ * @see {@link JSONObject} - A possible `JSONValue` that a `JSONArray` can contain.
84
+ *
85
+ * @remarks
86
+ * The `JSONArray` is a versatile type that can contain various kinds of JSON data, even nested arrays or objects.
87
+ */
88
+ export type JSONArray = Array<JSONValue>;
89
+ /**
90
+ * The `JSONObject` interface formally defines a JavaScript object with string keys and values of type {@link JSONValue}.
91
+ *
92
+ * It models standard JSON objects as TypeScript types, facilitating their manipulation.
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * function addToJSONObject(key: string, value: JSONValue, jsonObject: JSONObject): JSONObject {
97
+ * // Copy the existing JSONObject
98
+ * let updatedObject: JSONObject = { ...jsonObject };
99
+ *
100
+ * // Add the new key-value pair
101
+ * updatedObject[key] = value;
102
+ *
103
+ * // Return the updated JSONObject
104
+ * return updatedObject;
105
+ * }
106
+ * ```
107
+ *
108
+ * @see {@link JSONValue} - The permitted types for values within the `JSONObject` (primitives, objects, or arrays).
109
+ * @see {@link JSONPrimitive} - The basis for JSON data, used in {@link JSONValue}.
110
+ * @see {@link JSONArray} - Arrays used in {@link JSONValue}.
111
+ *
112
+ * @remarks
113
+ * The keys of the `JSONObject` are always of type string, as per the standard JSON specification.
114
+ * Values may take any valid {@link JSONValue}, allowing nested data structures.
115
+ */
116
+ export interface JSONObject {
117
+ [key: string]: JSONValue;
118
+ }
119
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/utils/json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Extracts object's (`TValue`) keys where the key's value type extends the given `TTest` type.
3
+ *
4
+ * @template TValue - The original object type.
5
+ * @template TTest - The test type. Keys of TValue having values that extend this type are extracted.
6
+ * @template TExtract - An optional constraint for the keys of TValue.
7
+ *
8
+ * @example
9
+ *
10
+ * // Here TValue is `{ foo: 'bar', bar: 'foo', foobar: 2 }` and TTest is `string`.
11
+ * // So it extracts keys `foo` and `bar`, because their values are string type.
12
+ * type keys = KeysBy<{ foo: 'bar', bar: 'foo', foobar: 2 }, string> // 'foo' | 'bar'
13
+ *
14
+ * @example
15
+ *
16
+ * // Here TValue is `{ foo: { x: 'foo' }, bar: { x: 'bar' }, other: { x: '42' } }` and TTest is `{ x: 'foo' | 'bar' }`.
17
+ * // So it extracts keys `foo` and `bar`, because their values are extending `{ x: 'foo' | 'bar' }`.
18
+ * type Base = { x: 'foo' | 'bar' };
19
+ * type Obj = { foo: { x: 'foo' }, bar: { x: 'bar' }, other: { x: '42' } };
20
+ * type X = KeysBy<Obj, Base> // 'foo' | 'bar'
21
+ *
22
+ * @see {@link KeysExcept}
23
+ * @see {@link PickBy}
24
+ */
25
+ export type KeysBy<TValue, TTest, TExtract extends keyof any = keyof any> = {
26
+ [key in keyof TValue & TExtract]: TValue[key] extends TTest ? key : never;
27
+ }[keyof TValue & TExtract];
28
+ /**
29
+ * Extracts the keys of a given object ({@link TValue}). It includes only those keys which do not map to a value of type {@link TTest}`.
30
+ *
31
+ * @template TValue - The object whose keys are to be examined and selectively retrieved
32
+ * @template TTest - The type of value to be used as an exclusion criterion for selecting keys from `TValue`
33
+ * @template TExtract - An optional union of keys to constrain the keys that are being examined. If not provided, it defaults to examining all keys in `TValue`.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * // In this example, KeysExcept is used to fetch keys from the object which do not have string type values
38
+ * type ExampleType = { foo: 'bar', bar: 'foo', foobar: 2 }
39
+ * type ResultType = KeysExcept<ExampleType, string>
40
+ * // The resulting type is "foobar"
41
+ * ```
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * // In this example, we use a base type to define allowed value types and only fetch those keys from the object that have values not extending the base type
46
+ * type Base = { x: 'foo' | 'bar' };
47
+ * type Obj = { foo: { x: 'foo' }, bar: { x: 'bar' }, other: { x: '42' } };
48
+ * type X = KeysBy<Obj, Base>
49
+ * // The resulting type is "other"
50
+ * ```
51
+ */
52
+ export type KeysExcept<TValue, TTest, TExtract extends keyof any = keyof any> = {
53
+ [key in keyof TValue & TExtract]: TValue[key] extends TTest ? never : key;
54
+ }[keyof TValue & TExtract];
55
+ /**
56
+ * Select properties from an object ({@link TValue}), only if their types extend a specific test type ({@link TTest}).
57
+ *
58
+ * @template TValue - The object type from which properties are selected.
59
+ * @template TTest - The test type. Properties of TValue extending this type are selected.
60
+ *
61
+ * @example
62
+ *
63
+ * // If we have this:
64
+ * type FruitAttributes = { color: string, taste: string, weight: number, isOrganic: boolean };
65
+ *
66
+ * // And we use `PickBy` like so:
67
+ * type StringAttributes = PickBy<FruitAttributes, string>;
68
+ *
69
+ * // Then, `StringAttributes` will equal: `{ color: string, taste: string }`
70
+ */
71
+ export type PickBy<TValue, TTest> = Pick<TValue, KeysBy<TValue, TTest>>;
72
+ /**
73
+ * Creates a new type from a given type ({@link TValue}), and select specific
74
+ * keys ({@link TKeys}) to be optionally present in the new type.
75
+ *
76
+ * @template TValue The original type of object.
77
+ * @template TKeys A union of selected {@link TValue} object keys that should be partial/optional in the new type.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * type Person = {
82
+ * name: string;
83
+ * age: number;
84
+ * };
85
+ *
86
+ * type PartialAgePerson = PartialBy<Person, 'age'>;
87
+ *
88
+ * // the type PartialAgePerson is now equivalent to:
89
+ * // {
90
+ * // name: string;
91
+ * // age?: number;
92
+ * // }
93
+ * ```
94
+ */
95
+ export type PartialBy<TValue, TKeys extends keyof TValue> = Omit<TValue, TKeys> & Partial<Pick<TValue, TKeys>>;
96
+ /**
97
+ * Extracts all unique values from a given object as a union type.
98
+ *
99
+ * @template TObject - An object from which values are to be extracted. It must extend the `object` type.
100
+ *
101
+ * @remark
102
+ * It works with non-primitive values as well. Hence, if a value is an object, it is included as is. Primitive types are included directly.
103
+ *
104
+ * @example
105
+ * With a simple object:
106
+ * ```TypeScript
107
+ * type SimpleExample = Values<{
108
+ * a: 'one',
109
+ * b: 'two',
110
+ * c: 3
111
+ * }>;
112
+ * // Result: 'one' | 'two' | 3
113
+ * ```
114
+ *
115
+ * @example
116
+ * With complex (non-primitive) values in an object:
117
+ * ```TypeScript
118
+ * type ComplexExample = Values<{
119
+ * a: { x: 10 },
120
+ * b: { y: 'twenty' },
121
+ * c: { z: true }
122
+ * }>;
123
+ * // Result: { x: 10 } | { y: 'twenty' } | { z: true }
124
+ * ```
125
+ */
126
+ export type Values<TObject extends object> = TObject[keyof TObject];
127
+ /**
128
+ * Provides a way to set deeply-nested properties within `TObject` to optional.
129
+ *
130
+ * @template TObject Type of the object that will become deeply partial.
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * interface Person {
135
+ * name: string;
136
+ * age: number;
137
+ * address: {
138
+ * city: string;
139
+ * street: string;
140
+ * postalCode: number;
141
+ * };
142
+ * }
143
+ *
144
+ * const partialPerson: DeepPartial<Person> = {}; // This is now valid
145
+ *
146
+ * // You can assign partially filled objects
147
+ * const anotherPerson: DeepPartial<Person> = {
148
+ * name: 'John',
149
+ * address: {
150
+ * city: 'San Francisco',
151
+ * // street and postal code are optional
152
+ * }
153
+ * }
154
+ * ```
155
+ */
156
+ export type DeepPartial<TObject> = TObject extends object ? {
157
+ [TKey in keyof TObject]?: DeepPartial<TObject[TKey]>;
158
+ } : TObject;
159
+ /**
160
+ * Creates a new type by replacing properties of {@link TObject} with properties from {@link TNew}.
161
+ *
162
+ * This is particularly useful to fine-tune the shape of an object type by altering some of its properties while keeping the rest intact.
163
+ *
164
+ * @template TObject - A type that extends `object`. This should be the original type that you intend to transform.
165
+ * @template TNew - A partial type of {@link TObject} where keys are replaced with new types.
166
+ *
167
+ * @example
168
+ *
169
+ * ```typescript
170
+ * type Original = { foo: number, bar: number}; // Declare original type
171
+ * type Transformation = { foo: string }; // Declare keys to replace from original type
172
+ *
173
+ * type Result = Replace<Original, Transformation>;
174
+ * // The transformed type now becomes { foo: string, bar: number }
175
+ * ```
176
+ */
177
+ export type Replace<TObject extends object, TNew extends Partial<{
178
+ [key in keyof TObject]: unknown;
179
+ }>> = Omit<TObject, keyof TNew> & TNew;
180
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,SAAS,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI;KACzE,GAAG,IAAI,MAAM,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,KAAK;CAC1E,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,SAAS,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI;KAC7E,GAAG,IAAI,MAAM,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,GAAG;CAC1E,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC;AAE3B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,SAAS,CAAC,MAAM,EAAE,KAAK,SAAS,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,GAC7E,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,MAAM,CAAC,OAAO,SAAS,MAAM,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,IAAI,OAAO,SAAS,MAAM,GACrD;KACG,IAAI,IAAI,MAAM,OAAO,CAAC,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD,GACD,OAAO,CAAC;AAEZ;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,OAAO,CACjB,OAAO,SAAS,MAAM,EACtB,IAAI,SAAS,OAAO,CAAC;KAAG,GAAG,IAAI,MAAM,OAAO,GAAG,OAAO;CAAE,CAAC,IACvD,IAAI,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC"}
@@ -0,0 +1,154 @@
1
+ import type { Extends } from './expression';
2
+ /**
3
+ * Alias for any literal type (useful for template string parameters)
4
+ *
5
+ * @see {@link Split}
6
+ * @see {@link Suffix}
7
+ * @see {@link Prefix}
8
+ * @see {@link StartsWith}
9
+ * @see {@link EndsWith}
10
+ */
11
+ export type Literal = string | number | bigint | boolean;
12
+ /**
13
+ * Ensures that a string is not empty.
14
+ *
15
+ * @template T - The type that extends a string.
16
+ *
17
+ * @example
18
+ * // T is assigned a string type
19
+ * type A = NonEmpty<string>;
20
+ * // A can be any string except the empty string
21
+ * let a: A = "hello"; // Valid
22
+ * a = ""; // Error: Type '""' is not assignable to type 'NonEmpty<string>'
23
+ *
24
+ * @example
25
+ * // T is assigned a string literal type
26
+ * type B = NonEmpty<"hello">;
27
+ * // B can only be "hello"
28
+ * let b: B = "hello"; // Valid
29
+ * b = ""; // Error: Type '""' is not assignable to type 'NonEmpty<"hello">'
30
+ */
31
+ export type NonEmpty<T extends string> = T extends '' ? never : T;
32
+ /**
33
+ * Splits a given string ({@link TValue}) around occurrences of a given separator ({@link TSeparator}).
34
+ *
35
+ * The resulting type is an array where each item is a part of the original string that falls between two instances of the separator.
36
+ *
37
+ * If the string does not contain the separator, the array will contain just the original string.
38
+ *
39
+ * If the string is empty, the result is an empty array.
40
+ *
41
+ * @template TValue - The string to split. Must extend `string`.
42
+ * @template TSeparator - The character(s) used to determine in which locations the string should be split. Must be a `string`.
43
+ *
44
+ * @example
45
+ *
46
+ * ```typescript
47
+ * type Example = Split<'a.b.c.d', '.'>; // Output will be: ['a', 'b', 'c', 'd']
48
+ * ```
49
+ * In the above example, the string 'a.b.c.d' is split around occurrences of the '.' separator.
50
+ *
51
+ * @example
52
+ *
53
+ * ```typescript
54
+ * type ExampleUnion = Split<'a.b-c', '.' | '-'>; // Output will be: ['a', 'b-c'] | ['a.b', 'c']
55
+ * ```
56
+ * The split operation will distribute the union members and create two possible return type for the union
57
+ */
58
+ export type Split<TValue extends string, TSeparator extends string> = {
59
+ [TSep in TSeparator]: TValue extends `${infer TLeft}${TSep}${infer TRight}` ? [TLeft, ...Split<TRight, TSep>] : TValue extends '' ? [] : [TValue];
60
+ }[TSeparator];
61
+ /**
62
+ * The `Suffix` type appends a literal suffix ({@link TSuffix}) to the end of a provided string ({@link TValue}).
63
+ *
64
+ * @template TValue - The string to add the suffix to.
65
+ * @template TSuffix - It extends the {@link Literal} type, and represents the suffix to append.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * // A type that appends '.com' to a string
70
+ * type DomainName = Suffix<string, '.com'>;
71
+ * const myComDomain: DomainName = 'example.com'; // This is valid
72
+ * const myNetDomain: DomainName = 'example.net'; // This is not valid
73
+ *
74
+ * // A variant using `number` as literal
75
+ * type SuffixedNumber = Suffix<string, 1>;
76
+ * const mySuffixedNumber: SuffixedNumber = 'example1'; // Also valid
77
+ * ```
78
+ */
79
+ export type Suffix<TValue extends string, TSuffix extends Literal> = `${TValue}${TSuffix}`;
80
+ /**
81
+ * Prepend a literal prefix ({@link TPrefix}) to the start of a provided string ({@link TValue}).
82
+ *
83
+ * @template TValue - The string to add the prefix to.
84
+ * @template TPrefix - It extends the {@link Literal} type, and represents the prefix to prepend.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * // A type that prepends 'Hello ' to a string
89
+ * type Greeting = Suffix<string, 'Hello '>;
90
+ * const greeting: Greeting = 'Hello Bob'; // This is valid
91
+ * const farewell: Greeting = 'Bye Bob'; // This is not valid
92
+ * ```
93
+ */
94
+ export type Prefix<TValue extends string, TPrefix extends Literal> = `${TPrefix}${TValue}`;
95
+ /**
96
+ * Creates an indexed object where every key is a string and every value is `T`
97
+ *
98
+ * @template T - Value type of the dictionary
99
+ *
100
+ * @example
101
+ * // Dictionary where each key is a string and is bound to a number type value.
102
+ * const numDict: Dict<number> = {
103
+ * 'a': 1,
104
+ * 'b': 2,
105
+ * 'c': 3
106
+ * };
107
+ */
108
+ export type Dict<T> = {
109
+ [key: string]: T;
110
+ };
111
+ /**
112
+ * Determines if a string, represented by {@link TValue}, ends with a specific literal ({@link TSuffix}).
113
+ *
114
+ * @template TValue - The string to check.
115
+ * @template TSuffix - A literal which may or may not be at the end of {@link TValue}.
116
+ *
117
+ * @remark
118
+ * To remember easily: `String.prototype.endsWith` method but at type level.
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * type Result = EndsWith<"HelloWorld", "World">;
123
+ * // Output: Constants.True
124
+ * ```
125
+ *
126
+ * ```typescript
127
+ * type Result = EndsWith<"HelloWorld", "Hello">;
128
+ * // Output: Constants.False
129
+ * ```
130
+ */
131
+ export type EndsWith<TValue extends string, TSuffix extends Literal> = Extends<TValue, `${string}${TSuffix}`>;
132
+ /**
133
+ * Determines if a string, represented by {@link TValue}, starts with a specific literal ({@link TPrefix}).
134
+ *
135
+ * @template TValue - The string to check.
136
+ * @template TPrefix - A literal which may or may not be at the start of {@link TValue}.
137
+ *
138
+ * @remark
139
+ * To remember easily: `String.prototype.startsWith` method but at type level.
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * type IsHelloWorld = StartsWith<"Hello World", "Hello">;
144
+ * // Output: Constants.True
145
+ * ```
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * type NotHelloWorld = StartsWith<"World Hello", "Hello">;
150
+ * // Output: Constants.False
151
+ * ```
152
+ */
153
+ export type StartsWith<TValue extends string, TPrefix extends Literal> = Extends<TValue, `${TPrefix}${string}`>;
154
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,KAAK,CAAC,MAAM,SAAS,MAAM,EAAE,UAAU,SAAS,MAAM,IAAI;KACnE,IAAI,IAAI,UAAU,GAAG,MAAM,SAAS,GAAG,MAAM,KAAK,GAAG,IAAI,GAAG,MAAM,MAAM,EAAE,GACvE,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,GAC/B,MAAM,SAAS,EAAE,GACf,EAAE,GACF,CAAC,MAAM,CAAC;CACf,CAAC,UAAU,CAAC,CAAC;AAEd;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,GAAG,MAAM,GAAG,OAAO,EAAE,CAAC;AAE3F;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC;AAE3F;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAA;CAAE,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,QAAQ,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,OAAO,CAC5E,MAAM,EACN,GAAG,MAAM,GAAG,OAAO,EAAE,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,OAAO,CAC9E,MAAM,EACN,GAAG,OAAO,GAAG,MAAM,EAAE,CACtB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Literal } from './string';
2
+ /**
3
+ * Transforms a tuple ({@link TCollection}) into a concatenated string, interlaced with a designated separator character ({@link TSeparator}).
4
+ *
5
+ * @template TCollection - Represents the array of elements to be joined.
6
+ * @template TSeparator - Represents the separator character used to join the elements of {@link TCollection}.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * type R1 = Join<["John", "Doe", "Smith"], ",">; // type R1 = "John,Doe,Smith"
11
+ * type R2 = Join<[1, 2, 3, 4], "-">; // type R2 = "1-2-3-4"
12
+ * type R3 = Join<["Foo", "Bar", "Baz"], "," | "-">; // type R3 = "Foo,Bar,Baz" | "Foo-Bar-Baz"
13
+ * ```
14
+ */
15
+ export type Join<TCollection extends unknown[], TSeparator extends Literal> = TCollection extends [
16
+ infer THead extends Literal,
17
+ ...infer TTail
18
+ ] ? TTail['length'] extends 0 ? THead : `${THead}${TSeparator}${Join<TTail, TSeparator>}` : never;
19
+ //# sourceMappingURL=tuple.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../src/utils/tuple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,IAAI,CAAC,WAAW,SAAS,OAAO,EAAE,EAAE,UAAU,SAAS,OAAO,IAAI,WAAW,SAAS;IAChG,MAAM,KAAK,SAAS,OAAO;IAC3B,GAAG,MAAM,KAAK;CACf,GACG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,GACvB,KAAK,GACL,GAAG,KAAK,GAAG,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,GACnD,KAAK,CAAC"}