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

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 +156 -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 +2 -2
  73. package/dist/modules/documents/index.d.ts.map +1 -1
  74. package/dist/modules/documents/middleware.d.ts +2 -2
  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 +6 -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 +14 -12
  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,490 @@
1
+ import type { Array, Constants } from '.';
2
+ /**
3
+ * The `IsNever` type checks if a given type {@link TValue} strictly equals to `never`.
4
+ *
5
+ * @template TValue - The type variable to be checked against `never`.
6
+ *
7
+ * @example
8
+ * type A = IsNever<number>; // This will resolve to 'false' because number is not `never`
9
+ * type B = IsNever<Cast<'foo', number>>; // This will resolve to 'true' because Cast<'foo', number> strictly equals to never.
10
+ *
11
+ * @see {@link StrictEqual} - The Type used internally to make the comparison.
12
+ * @remark
13
+ * Please make sure to understand the difference between `never` and other types in TypeScript before using `IsNever` for any conditional checks
14
+ */
15
+ export type IsNever<TValue> = StrictEqual<TValue, never>;
16
+ /**
17
+ * The `IsNotNever` type checks if a given type {@link TValue} does not strictly equals to `never`.
18
+ *
19
+ * It is useful in conditional types to verify if the variable of type {@link TValue} is something other than `never`.
20
+ * It complements the {@link IsNever} type by negating the result using the {@link Not} utility type.
21
+ *
22
+ * @template TValue - The type variable to be checked for inequality against `never`.
23
+ *
24
+ * @example
25
+ * type IsNotNeverNumber = IsNotNever<number>; // Evaluates to 'true' because number is not 'never'.
26
+ * type IsNotNeverNever = IsNotNever<never>; // Evaluates to 'false' because `never` equals to 'never'.
27
+ *
28
+ * @see {@link IsNever} - The type used internally to check if {@link TValue} is `never`.
29
+ */
30
+ export type IsNotNever<TValue> = Not<IsNever<TValue>>;
31
+ /**
32
+ * The `IsTrue` type evaluates if the given {@link TValue} strictly equals {@link Constants.True}.
33
+ *
34
+ * @template TValue - The type to evaluate.
35
+ *
36
+ * @example
37
+ * type A = IsTrue<true>; // This will resolve to Constants.True
38
+ * type B = IsTrue<false>; // This will resolve to Constants.False
39
+ */
40
+ export type IsTrue<TValue> = [TValue] extends [Constants.True] ? Constants.True : Constants.False;
41
+ /**
42
+ * The `IsNotTrue` type evaluates if the given {@link TValue} is not strictly equal to {@link Constants.True}.
43
+ *
44
+ * It basically negates the output of {@link IsTrue}.
45
+ *
46
+ * @template TValue - The type to evaluate.
47
+ *
48
+ * @example
49
+ * type A = IsNotTrue<true>; // This will resolve to Constants.False
50
+ * type B = IsNotTrue<false>; // This will resolve to Constants.True
51
+ *
52
+ */
53
+ export type IsNotTrue<TValue> = Not<IsTrue<TValue>>;
54
+ /**
55
+ * The `IsFalse` type evaluates if the given {@link TValue} strictly equals {@link Constants.False}.
56
+ *
57
+ * @template TValue - The type to evaluate.
58
+ *
59
+ * @example
60
+ * type A = IsFalse<true>; // This will resolve to Constants.False
61
+ * type B = IsFalse<false>; // This will resolve to Constants.True
62
+ */
63
+ export type IsFalse<TValue> = [TValue] extends [Constants.False] ? Constants.True : Constants.False;
64
+ /**
65
+ * The `IsNotFalse` type evaluates if the value provided does not strictly equal {@link Constants.False}.
66
+ *
67
+ * It basically negates the output of {@link IsFalse}.
68
+ *
69
+ * @template TValue - The type to be evaluated.
70
+ *
71
+ * @example
72
+ * type A = IsNotFalse<false>; // This will resolve to Constants.False
73
+ * type B = IsNotFalse<true>; // This will resolve to Constants.True
74
+ */
75
+ export type IsNotFalse<TValue> = Not<IsFalse<TValue>>;
76
+ /**
77
+ * The `StrictEqual` type evaluates if two types, {@link TValue} and {@link TMatch}, are strictly the same.
78
+ *
79
+ * In other words, it checks if {@link TValue} extends {@link TMatch} and if {@link TMatch} extends {@link TValue} at the same time,
80
+ * hence ensuring complete type match.
81
+ *
82
+ * @template TValue - The first type to be compared.
83
+ * @template TMatch - The second type to be compared.
84
+ *
85
+ * @returns Either {@link Constants.True} or {@link Constants.False}.
86
+ *
87
+ * @example
88
+ * // With a regular extends
89
+ * type A = "string" extends string ? true : false; // Result: true
90
+ *
91
+ * // With `StrictEqual`
92
+ * type B = StrictEqual<"string", string>; // Result: false
93
+ */
94
+ export type StrictEqual<TValue, TMatch> = And<Extends<TValue, TMatch>, Extends<TMatch, TValue>>;
95
+ /**
96
+ * The `NotStrictEqual` type is a utility type that checks if two types, {@link TValue} and {@link TMatch}, are different using strict equality comparison.
97
+ *
98
+ *
99
+ * @template TValue - The first type to be compared.
100
+ * @template TMatch - The second type to be compared against the first one.
101
+ *
102
+ * @returns Either {@link Constants.True} or {@link Constants.False}
103
+ *
104
+ * @see {@link StrictEqual}
105
+ *
106
+ * @example
107
+ * // Comparing basic types
108
+ * type BasicTypeCheck = NotStrictEqual<number, string>; // Result: Constants.True (because `number` and `string` types are not the same)
109
+ *
110
+ * // Comparing complex types
111
+ * type MyType = { a: number, b: string };
112
+ * type OtherType = { a: number, c: boolean };
113
+ * type ComplexTypeCheck = NotStrictEqual<MyType, OtherType>; // Result: Constants.True (because `MyType` and `OtherType` do not have the same structure)
114
+ *
115
+ */
116
+ export type NotStrictEqual<TValue, TMatch> = Not<StrictEqual<TValue, TMatch>>;
117
+ /**
118
+ * The `Extends` type evaluates if a type, identified by {@link TLeft}, extends another one, identified by {@link TRight}.
119
+ *
120
+ * @template TLeft - The type to be tested if it extends {@link TRight}.
121
+ * @template TRight - The base type used for comparison.
122
+ *
123
+ * @note To understand more about conditional types and the `extends` keyword in TypeScript see {@link https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types}
124
+ *
125
+ * @remark
126
+ * The check `[TLeft] extends [TRight]` is wrapped in a tuple because TypeScript's `extends` behaves differently with unions in the context of distributivity.
127
+ *
128
+ * Wrapping in a tuple deactivates this distributive behavior and makes the check behave as expected in all cases.
129
+ *
130
+ * @example
131
+ * The type `"hello"` is a subtype of `string` so it extends `string`
132
+ * ```typescript
133
+ * type isString = Extends<"hello", string>;
134
+ * // output: Constants.True
135
+ *```
136
+ *
137
+ * The type `string` does not extend `"hello"`.
138
+ * ```typescript
139
+ * type notSpecificString = Extends<string, "hello">;
140
+ * // output: Constants.False
141
+ * ```
142
+ */
143
+ export type Extends<TLeft, TRight> = [TLeft] extends [TRight] ? Constants.True : Constants.False;
144
+ /**
145
+ * The `DoesNotExtends` type checks if {@link TLeft} does not extend {@link TRight}.
146
+ *
147
+ * @template TLeft - The type to be tested if it does not extend {@link TRight}.
148
+ * @template TRight - The base type used for comparing if it is not extended by {@link TLeft}.
149
+ *
150
+ * @see {@link Extends}
151
+ */
152
+ export type DoesNotExtends<TLeft, TRight> = Not<Extends<TLeft, TRight>>;
153
+ /**
154
+ * The `Not` type defines a type-level boolean negation operation.
155
+ *
156
+ * More concretely, if {@link TExpression} strictly equates to {@link Constants.True} then the result of `Not<TExpression>` would be {@link Constants.False}, and vice versa.
157
+ *
158
+ * @template TExpression - The type level boolean expression to be negated. It should extend {@link Constants.BooleanValue}.
159
+ *
160
+ * @see {@link Constants.BooleanValue}
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * // Using expression that equates to `true`
165
+ * type A = Not<Constants.True>; // Results in Constants.False
166
+ *
167
+ * // Using `true` wrapped inside another type
168
+ * type B = Not<IsTrue<true>>; // Results in Constants.False
169
+ *
170
+ * // Using expression that equates to `false`
171
+ * type C = Not<Constants.False>; // Results in Constants.True
172
+ *
173
+ * // Using `false` wrapped inside another type
174
+ * type D = Not<IsFalse<false>>; // Results in Constants.True
175
+ * ```
176
+ */
177
+ export type Not<TExpression extends Constants.BooleanValue> = If<TExpression, Constants.False, Constants.True>;
178
+ /**
179
+ * The `If` type is a conditional type that accepts a type level boolean expression (`true` or `false` represented as {@link Constants.BooleanValue}),
180
+ * and two result types, one if the expression is {@link Constants.True} and the other if it's {@link Constants.False}.
181
+ *
182
+ * It's an implementation of the traditional 'if/then/else' logic, but at the type level.
183
+ *
184
+ * @template TExpression - The type level boolean expression to evaluate. It should extend {@link Constants.BooleanValue}.
185
+ * @template TOnTrue - The type returned if {@link TExpression} resolves to {@link Constants.True}.
186
+ * @template TOnFalse - The type returned if {@link TExpression} resolves to {@link Constants.False}. It defaults to `never`.
187
+ *
188
+ * @example
189
+ * Here's an example using `If` with {@link TExpression} that's resolved to {@link Constants.False}.
190
+ *
191
+ * As a result, the type applied will be 'FalseCase'.
192
+ * ```typescript
193
+ * type FalseCase = 'This is False';
194
+ * type TrueCase = 'This is True';
195
+ *
196
+ * type Result = If<Constants.False, TrueCase, FalseCase>; // Result: 'This is False'
197
+ * ```
198
+ *
199
+ * Conversely, if we replace {@link TExpression} with {@link Constants.True}, the applicable type will be 'TrueCase'.
200
+ * ```typescript
201
+ * type ExampleTrue = If<Constants.True, TrueCase, FalseCase>; // Result: 'This is True case'
202
+ * ```
203
+ *
204
+ * If the third type argument is omitted, and the expression is false, the `If` type will resolve to `never`.
205
+ * ```typescript
206
+ * type ExampleNever = If<Constants.False, TrueCase>; // Result: never
207
+ * ```
208
+ */
209
+ export type If<TExpression extends Constants.BooleanValue, TOnTrue, TOnFalse = never> = [
210
+ TExpression
211
+ ] extends [Constants.True] ? TOnTrue : TOnFalse;
212
+ /**
213
+ * The `MatchFirst` type is a type-level logic that matches the first truthy `Test` in a given array of {@link Test} types
214
+ * and resolves to corresponding type value ('TValue') of that {@link Test}.
215
+ *
216
+ * If no truthy {@link Test} is found, it resolves to a default type {@link TDefault}.
217
+ *
218
+ * @note This type is particularly useful for checking multiple conditions and matching the type to
219
+ * whichever condition proves true first, similar to a switch-case or a series of if-else statements in traditional programming.
220
+ *
221
+ * @template TTests - An array of {@link Test} types that the type checker will iterate over to find the first truthy test.
222
+ * @template TDefault - The default value that will be used if none of the {@link Test} types in {@link TTests} prove true. Defaults to `never`.
223
+ *
224
+ * @see {@link Test}
225
+ * @see {@link MatchAllIntersect}
226
+ *
227
+ * @example
228
+ * Here's an example showing how `MatchFirst` can be used with series of {@link Test} types.
229
+ *
230
+ * We have declared a Test array containing two Test types.
231
+ * - The first Test type checks if 'T' is a string.
232
+ *
233
+ * If true, it will return 'string type', else it moves to the next Test type.
234
+ * - The next Test type checks if 'T' is a number.
235
+ *
236
+ * If true, it will return 'number type'.
237
+ * - The third argument is the default type which would be returned if all the conditions fail. In our case its 'unknown type'.
238
+ *
239
+ * ```typescript
240
+ * type T = string; // you can replace 'T' with 'number' or 'boolean' to test.
241
+ *
242
+ * type IsString = Test<Extends<T, string>, 'string type'>;
243
+ * type IsNumber = Test<Extends<T, number>, 'number type'>;
244
+ * type Tests = [IsString, IsNumber];
245
+ *
246
+ * type Result = MatchFirst<Tests, 'unknown type'>; // Result would be 'string type' as 'T' is string.
247
+ * ```
248
+ *
249
+ */
250
+ export type MatchFirst<TTests extends Test[], TDefault = never> = TTests extends [
251
+ infer THead extends Test,
252
+ ...infer TTail extends Test[]
253
+ ] ? THead extends Test<infer TExpression, infer TValue> ? If<TExpression, TValue, If<Array.IsNotEmpty<TTail>, MatchFirst<TTail, TDefault>, TDefault>> : never : never;
254
+ /**
255
+ * The `MatchAllIntersect` type enables the creation of an intersection type from a sequence of conditional types.
256
+ *
257
+ * It is useful in scenarios where the properties of an object are to be picked conditionally, based on evaluated boolean expressions.
258
+ *
259
+ * @template TTests - A tuple type where each member extends {@link Test}.
260
+ *
261
+ * It's this sequence of tests that determine the properties to be picked.
262
+ *
263
+ * @template TDefault - This type is used whenever a member of `TTests` doesn't match the expected type or when the
264
+ * tuple is empty, meaning that no conditions were provided.
265
+ *
266
+ * This defaults to `unknown`.
267
+ *
268
+ * @see {@link Test}
269
+ * @see {@link MatchFirst}
270
+ *
271
+ * @example
272
+ * ```typescript
273
+ * type Test1 = Test<Constants.True, { sort?: string }>;
274
+ * type Test2 = Test<Constants.False, { fields?: number[] }>;
275
+ * type Test3 = Test<Constants.True, { populate?: string[] }>;
276
+ *
277
+ * type Result = MatchAllIntersect<[Test1, Test2, Test3]>;
278
+ * // The Result will be { sort?: string } & { populate?: string[] }
279
+ * ```
280
+ *
281
+ * In the example above, only Test1 and Test3 resolves to true case and thus the result excludes the type `{ fields?: number[] }`.
282
+ *
283
+ * There is also a default case `{}` that would be returned if *all* the tests in `TTests` were false.
284
+ *
285
+ * This can be customized by using the second type parameter {@link TDefault}.
286
+ * ```typescript
287
+ * type Test3 = Test<Constants.False, { sort?: string }>;
288
+ * type Test4 = Test<Constants.False, { fields?: number[] }>;
289
+ *
290
+ * type ResultDefault = MatchAllIntersect<[Test3, Test4], {}>; // The Result will be {}
291
+ * ```
292
+ */
293
+ export type MatchAllIntersect<TTests extends Test[], TDefault = unknown> = TTests extends [
294
+ infer THead extends Test,
295
+ ...infer TTail extends Test[]
296
+ ] ? THead extends Test<infer TExpression, infer TValue> ? // Actual test case evaluation
297
+ If<TExpression, TValue, TDefault> & If<Array.IsNotEmpty<TTail>, MatchAllIntersect<TTail, TDefault>, TDefault> : TDefault : TDefault;
298
+ /**
299
+ * The `Test` type pairs a boolean expression and a corresponding value.
300
+ *
301
+ * The elements of the type pair are:
302
+ * 1. A boolean value ({@link TExpression}), which acts as the conditional expression.
303
+ * 2. A corresponding value ({@link TValue}), which is usually returned/read when the conditional expression is `true`.
304
+ *
305
+ * @template TExpression - A boolean value that will be used as the conditional expression. It extends from {@link Constants.BooleanValue}.
306
+ * @template TValue - The corresponding value that will be returned when the `TExpression` is `true`.
307
+ *
308
+ * @see {@link Constants.BooleanValue}
309
+ * @see {@link MatchFirst}
310
+ * @see {@link MatchAllIntersect}
311
+ *
312
+ * @example
313
+ * Suppose we're writing a type level function that behaves differently based on whether the generic type parameter extends a string or a number.
314
+ *
315
+ * We can represent these two conditions using the `Test` type, like this:
316
+ *
317
+ * ```typescript
318
+ * type T = number; // replace this with different types to see the outcome
319
+ *
320
+ * // Defining two Test conditions
321
+ * type IsString = Test<Extends<T, string>, 'Input is a string'>;
322
+ * type IsNumber = Test<Extends<T, number>, 'Input is a number'>;
323
+ *
324
+ * type DetectedType = MatchFirst<[IsString, IsNumber], 'unknown type'>; // The Result will be 'Input is a number'
325
+ * ```
326
+ */
327
+ export type Test<TExpression extends Constants.BooleanValue = Constants.BooleanValue, TValue = unknown> = [TExpression, TValue];
328
+ /**
329
+ * The `Some` type is used for performing a boolean OR operation at the type level over all elements of {@link TExpressions}.
330
+ *
331
+ * The OR operation is applied between every two adjacent types in the array from left to right until a resulting type is derived.
332
+ *
333
+ * It's conceptually similar to the `Array.prototype.some()` method, but at the type level rather than the value level.
334
+ *
335
+ * If the array is empty, it returns {@link Constants.False}.
336
+ *
337
+ * @template TExpressions - An array of types extending {@link Constants.BooleanValue}. Use this to specify the types to apply the OR operation on.
338
+ *
339
+ * @see {@link Every}
340
+ * @see {@link Constants.BooleanValue}
341
+ *
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * type Example1 = Some<[Constants.False, Constants.False, Constants.False]>; // Result: Constants.False
346
+ * type Example2 = Some<[Constants.False, Constants.True, Constants.False]>; // Result: Constants.True
347
+ * type Example3 = Some<[Constants.True, Constants.True, Constants.True]>; // Result: Constants.True
348
+ * type Example4 = Some<[Constants.False]>; // Result: Constants.False
349
+ * type Example5 = Some<[Constants.True]>; // Result: Constants.True
350
+ * type Example6 = Some<[]>; // Result: Constants.False
351
+ * ```
352
+ */
353
+ export type Some<TExpressions extends Constants.BooleanValue[]> = TExpressions extends [
354
+ infer THead extends Constants.BooleanValue,
355
+ ...infer TTail extends Constants.BooleanValue[]
356
+ ] ? If<Array.IsNotEmpty<TTail>, Or<THead, Some<TTail>>, Or<THead, false>> : never;
357
+ /**
358
+ * The `Every` type is used to perform a logical AND operation on a sequence of type-level boolean values represented as {@link Constants.BooleanValue}.
359
+ *
360
+ * The AND operation is applied between every two adjacent types in the array from left to right until a resulting type is derived.
361
+ *
362
+ * It's conceptually similar to the `Array.prototype.every()` method, but at the type level rather than the value level.
363
+ *
364
+ * If the array is empty, it returns {@link Constants.True}.
365
+ *
366
+ * @template TExpressions - An array of types extending {@link Constants.BooleanValue}. Use this to specify the types to apply the AND operation on.
367
+ *
368
+ * @example
369
+ * ```typescript
370
+ * type Example1 = Every<[Constants.False, Constants.False, Constants.False]>; // Result: Constants.False
371
+ * type Example2 = Every<[Constants.False, Constants.True, Constants.False]>; // Result: Constants.False
372
+ * type Example3 = Every<[Constants.True, Constants.True, Constants.True]>; // Result: Constants.True
373
+ * type Example4 = Every<[Constants.False]>; // Result: Constants.False
374
+ * type Example5 = Every<[Constants.True]>; // Result: Constants.True
375
+ * type Example6 = Every<[]>; // Result: Constants.True
376
+ * ```
377
+ *
378
+ * @see {@link Some}
379
+ * @see {@link Constants.BooleanValue}
380
+ */
381
+ export type Every<TExpressions extends Constants.BooleanValue[]> = TExpressions extends [
382
+ infer THead extends Constants.BooleanValue,
383
+ ...infer TTail extends Constants.BooleanValue[]
384
+ ] ? If<Array.IsNotEmpty<TTail>, And<THead, Every<TTail>>, And<THead, Constants.True>> : never;
385
+ /**
386
+ * The `And` type is a type-level logical conjugation (AND) operator.
387
+ *
388
+ * It calculates boolean AND operation of {@link IsTrue} derived from the input types {@link TLeft} and {@link TRight}.
389
+ *
390
+ * @template TLeft - The left hand operand of the AND operation. It should extend {@link Constants.BooleanValue}.
391
+ * @template TRight - The right hand operand of the AND operation. It should extend {@link Constants.BooleanValue}.
392
+ *
393
+ * @see {@link IsTrue}
394
+ *
395
+ * @example
396
+ * ```typescript
397
+ * // Constants.True AND Constants.True
398
+ * type Example1 = And<Constants.True, Constants.True>; // Result: Constants.True
399
+ *
400
+ * // Constants.False AND Constants.True
401
+ * type Example2 = And<Constants.False, Constants.True>; // Result: Constants.False
402
+ *
403
+ * // Constants.False AND Constants.False
404
+ * type Example3 = And<Constants.False, Constants.False>; // Result: Constants.False
405
+ * ```
406
+ */
407
+ export type And<TLeft extends Constants.BooleanValue, TRight extends Constants.BooleanValue> = IsTrue<IsTrue<TLeft> | IsTrue<TRight>>;
408
+ /**
409
+ * The `Or` type is a type-level logical conjugation (OR) operator.
410
+ *
411
+ * It calculates boolean OR operation of {@link IsTrue} derived from the input types {@link TLeft} and {@link TRight}.
412
+ *
413
+ * @template TLeft - The left hand operand of the OR operation. It should extend {@link Constants.BooleanValue}.
414
+ * @template TRight - The right hand operand of the OR operation. It should extend {@link Constants.BooleanValue}.
415
+ *
416
+ * @see {@link IsTrue}
417
+ *
418
+ * @example
419
+ * ```typescript
420
+ * // Constants.True OR Constants.True
421
+ * type Example1 = Or<Constants.True, Constants.True>; // Result: Constants.True
422
+ *
423
+ * // Constants.False OR Constants.True
424
+ * type Example2 = Or<Constants.False, Constants.True>; // Result: Constants.True
425
+ *
426
+ * // Constants.False OR Constants.False
427
+ * type Example3 = Or<Constants.False, Constants.False>; // Result: Constants.False
428
+ * ```
429
+ */
430
+ export type Or<TLeft extends Constants.BooleanValue, TRight extends Constants.BooleanValue> = Not<IsFalse<IsTrue<TLeft> | IsTrue<TRight>>>;
431
+ /**
432
+ * The `Intersect` type constructs a new type by intersecting a list of types.
433
+ *
434
+ * @template TValues - The tuple of types to be intersected extending from `unknown[]`.
435
+ *
436
+ * @remark This type can easily be replaced by a regular intersection in most scenario.
437
+ *
438
+ * The main use-case would be when dealing with a list of types of unknown length.
439
+ *
440
+ * In the codebase, it's used mainly for aesthetics reasons (formatting of type params vs intersection members).
441
+ *
442
+ * @example
443
+ * ```typescript
444
+ * // Defining Attribute Options
445
+ * interface ConfigurableOption {
446
+ * configurable?: boolean;
447
+ * }
448
+ *
449
+ * interface RequiredOption {
450
+ * required?: boolean;
451
+ * }
452
+ *
453
+ * // Intersecting Attribute Options
454
+ * type AttributeOptions = Intersect<
455
+ * [ ConfigurableOption, RequiredOption ]
456
+ * >
457
+ *
458
+ * // Now `AttributeOptions` contains properties from both `ConfigurableOption` and `RequiredOption`.
459
+ * ```
460
+ *
461
+ * @example
462
+ * ```typescript
463
+ * // Using `Intersect` to define a complete Attribute type
464
+ * interface BasicAttribute {
465
+ * name: string;
466
+ * type: string;
467
+ * }
468
+ *
469
+ * interface AttributeProperties {
470
+ * minLength?: number;
471
+ * maxLength?: number;
472
+ * }
473
+ *
474
+ * type Attribute = Intersect<[
475
+ * BasicAttribute,
476
+ * AttributeProperties,
477
+ * AttributeOptions
478
+ * ]>
479
+ *
480
+ * // Now, `Attribute` type contains
481
+ * // - name and type fields from `BasicAttribute`
482
+ * // - minLength and maxLength fields from AttributeProperties
483
+ * // - configurable and required fields from `AttributeOptions`
484
+ * ```
485
+ */
486
+ export type Intersect<TValues extends unknown[]> = TValues extends [
487
+ infer THead,
488
+ ...infer TTail extends unknown[]
489
+ ] ? THead & If<Array.IsNotEmpty<TTail>, Intersect<TTail>, unknown> : never;
490
+ //# sourceMappingURL=expression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../src/utils/expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,OAAO,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,KAA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AAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,EAAE,CAAC,KAAK,SAAS,SAAS,CAAC,YAAY,EAAE,MAAM,SAAS,SAAS,CAAC,YAAY,IAAI,GAAG,CAC/F,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,MAAM,SAAS,CAAC,OAAO,SAAS,OAAO,EAAE,IAAI,OAAO,SAAS;IACjE,MAAM,KAAK;IACX,GAAG,MAAM,KAAK,SAAS,OAAO,EAAE;CACjC,GACG,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAC9D,KAAK,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Defines a function parameter in a way that accommodates any number and type of arguments.
3
+ *
4
+ * The flexibility the type provides makes it a suitable choice for representing generic function in TypeScript whose behaviors heavily rely on the runtime inputs.
5
+ *
6
+ * This type is primarily used when the function parameter types and return type can't be accurately defined.
7
+ *
8
+ * @remark
9
+ * It's important to understand that while the {@link Any} type provides flexibility,
10
+ * it inherently sacrifices the benefits of type-safety.
11
+ *
12
+ * Therefore, it's suggested to use it sparingly and only in situations where it's unavoidable.
13
+ */
14
+ export type Any = (...args: any[]) => any;
15
+ /**
16
+ * Async version of {@link Any}
17
+ *
18
+ * @see Any
19
+ */
20
+ export type AnyPromise = (...args: any[]) => Promise<any>;
21
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/utils/function.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,90 @@
1
+ import type { Array, If, StrictEqual } from '.';
2
+ /**
3
+ * Conditionally assigns a fallback type {@link TFallback} to a type {@link TValue}, if {@link TValue} resolves to `never`.
4
+ *
5
+ * Otherwise, it assigns the type of {@link TValue}.
6
+ *
7
+ * @template TValue - The original type which could be any type or `never`.
8
+ * @template TFallback - The fallback type that will be assigned to {@link TValue} if {@link TValue} is `never`. It defaults to `unknown`.
9
+ *
10
+ * @remark
11
+ * This type becomes useful when working with conditional types where there are possibilities of ending up with `never` type.
12
+ *
13
+ * It provides a way to ensure that, in such situations, the type defaults to a more meaningful type rather than `never`.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * type User = { name: 'John' }
18
+ *
19
+ * type X = Guard.Never<User>; // X: User
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * type NoType = never;
25
+ *
26
+ * type X = Guard.Never<NoType>; // X: unknown
27
+ * type Y = Guard.Never<NoType, string>; // Y: string
28
+ * ```
29
+ */
30
+ export type Never<TValue, TFallback = unknown> = OfTypes<[never], TValue, TFallback>;
31
+ /**
32
+ * Conditionally assigns a fallback type {@link TFallback} to a type {@link TValue}, if {@link TValue} resolves to `{}`.
33
+ *
34
+ * Otherwise, it assigns the type of {@link TValue}.
35
+ *
36
+ * @template TValue - The original type which could be any type or `{}`.
37
+ * @template TFallback - The fallback type that will be assigned to {@link TValue} if {@link TValue} is `{}`. It defaults to `unknown`.
38
+ *
39
+ * @remark
40
+ * This type becomes useful when working with conditional types where there are possibilities of ending up with `{}` type.
41
+ *
42
+ * It provides a way to ensure that, in such situations, the type defaults to a more meaningful type rather than `{}`.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * type User = { name: 'John' }
47
+ *
48
+ * type X = Guard.EmptyObject<User>; // X: User
49
+ * ```
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * type MyObj = {};
54
+ *
55
+ * type X = Guard.EmptyObject<MyObj>; // X: unknown
56
+ * type Y = Guard.EmptyObject<MyObj, string>; // Y: string
57
+ * ```
58
+ */
59
+ export type EmptyObject<TValue, TFallback = unknown> = OfTypes<[{}], TValue, TFallback>;
60
+ /**
61
+ * Conditionally assigning a fallback type (@link TFallback) if the value type ({@link TValue}) matches any of the types in {@link TTypes}.
62
+ *
63
+ * It basically enables conditional type assignments based on type matching.
64
+ *
65
+ * The value is checked against the list of types iteratively. If it matches any type from the list, the fallback type is assigned.
66
+ *
67
+ * If it doesn't match, the value's original type is maintained.
68
+ *
69
+ * If no fallback is provided, unknown type is used by default.
70
+ *
71
+ * @template TTypes - A tuple of types to match the value against. It must extend Array<unknown>
72
+ * @template TValue - The value whose type is checked against TTypes.
73
+ * @template TFallback - The type to be assigned if TValue matches any member of TTypes. It defaults to unknown.
74
+ *
75
+ * @example
76
+ * Here, the `TValue` is `string` which exists in the `TTypes` list. Thus, the `TFallback` which is `null` is returned.
77
+ * ```typescript
78
+ * type Result = OfTypes<[string, number], string, null>; // Result: null
79
+ * ```
80
+ *
81
+ * Here, the `TValue` is `boolean` which does not exist in the `TTypes` list. Thus, the `TValue` is returned as no match was found.
82
+ * ```typescript
83
+ * type Result = OfTypes<[string, number], boolean, number>; // Result: boolean
84
+ * ```
85
+ */
86
+ export type OfTypes<TTypes extends unknown[], TValue, TFallback = unknown> = TTypes extends [
87
+ infer THead extends unknown,
88
+ ...infer TTail extends unknown[]
89
+ ] ? If<StrictEqual<TValue, THead>, TFallback, If<Array.IsNotEmpty<TTail>, OfTypes<TTail, TValue, TFallback>, TValue>> : never;
90
+ //# sourceMappingURL=guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/utils/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,MAAM,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,OAAO,CAAC,MAAM,SAAS,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,IAAI,MAAM,SAAS;IAC1F,MAAM,KAAK,SAAS,OAAO;IAC3B,GAAG,MAAM,KAAK,SAAS,OAAO,EAAE;CACjC,GACG,EAAE,CACA,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EAC1B,SAAS,EACT,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,CACvE,GACD,KAAK,CAAC"}