@akbarsafari00/bonyan-types 5.52.1-fa.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/LICENSE +37 -0
  2. package/README.md +9 -0
  3. package/dist/core/api.d.ts +3 -0
  4. package/dist/core/api.d.ts.map +1 -0
  5. package/dist/core/commands/index.d.ts +6 -0
  6. package/dist/core/commands/index.d.ts.map +1 -0
  7. package/dist/core/config/admin.d.ts +156 -0
  8. package/dist/core/config/admin.d.ts.map +1 -0
  9. package/dist/core/config/api.d.ts +38 -0
  10. package/dist/core/config/api.d.ts.map +1 -0
  11. package/dist/core/config/database.d.ts +78 -0
  12. package/dist/core/config/database.d.ts.map +1 -0
  13. package/dist/core/config/features.d.ts +14 -0
  14. package/dist/core/config/features.d.ts.map +1 -0
  15. package/dist/core/config/index.d.ts +11 -0
  16. package/dist/core/config/index.d.ts.map +1 -0
  17. package/dist/core/config/middlewares.d.ts +3 -0
  18. package/dist/core/config/middlewares.d.ts.map +1 -0
  19. package/dist/core/config/openapi.d.ts +35 -0
  20. package/dist/core/config/openapi.d.ts.map +1 -0
  21. package/dist/core/config/plugin.d.ts +8 -0
  22. package/dist/core/config/plugin.d.ts.map +1 -0
  23. package/dist/core/config/server.d.ts +102 -0
  24. package/dist/core/config/server.d.ts.map +1 -0
  25. package/dist/core/config/shared.d.ts +8 -0
  26. package/dist/core/config/shared.d.ts.map +1 -0
  27. package/dist/core/config/typescript.d.ts +10 -0
  28. package/dist/core/config/typescript.d.ts.map +1 -0
  29. package/dist/core/container.d.ts +5 -0
  30. package/dist/core/container.d.ts.map +1 -0
  31. package/dist/core/controller.d.ts +7 -0
  32. package/dist/core/controller.d.ts.map +1 -0
  33. package/dist/core/core-api/controller.d.ts +47 -0
  34. package/dist/core/core-api/controller.d.ts.map +1 -0
  35. package/dist/core/core-api/index.d.ts +4 -0
  36. package/dist/core/core-api/index.d.ts.map +1 -0
  37. package/dist/core/core-api/router.d.ts +64 -0
  38. package/dist/core/core-api/router.d.ts.map +1 -0
  39. package/dist/core/core-api/service.d.ts +69 -0
  40. package/dist/core/core-api/service.d.ts.map +1 -0
  41. package/dist/core/index.d.ts +15 -0
  42. package/dist/core/index.d.ts.map +1 -0
  43. package/dist/core/middleware.d.ts +15 -0
  44. package/dist/core/middleware.d.ts.map +1 -0
  45. package/dist/core/module.d.ts +26 -0
  46. package/dist/core/module.d.ts.map +1 -0
  47. package/dist/core/plugin.d.ts +6 -0
  48. package/dist/core/plugin.d.ts.map +1 -0
  49. package/dist/core/policy.d.ts +15 -0
  50. package/dist/core/policy.d.ts.map +1 -0
  51. package/dist/core/route.d.ts +54 -0
  52. package/dist/core/route.d.ts.map +1 -0
  53. package/dist/core/router.d.ts +15 -0
  54. package/dist/core/router.d.ts.map +1 -0
  55. package/dist/core/service.d.ts +4 -0
  56. package/dist/core/service.d.ts.map +1 -0
  57. package/dist/core/strapi.d.ts +162 -0
  58. package/dist/core/strapi.d.ts.map +1 -0
  59. package/dist/data/component.d.ts +21 -0
  60. package/dist/data/component.d.ts.map +1 -0
  61. package/dist/data/constants.d.ts +5 -0
  62. package/dist/data/constants.d.ts.map +1 -0
  63. package/dist/data/content-type.d.ts +26 -0
  64. package/dist/data/content-type.d.ts.map +1 -0
  65. package/dist/data/entity.d.ts +15 -0
  66. package/dist/data/entity.d.ts.map +1 -0
  67. package/dist/data/index.d.ts +5 -0
  68. package/dist/data/index.d.ts.map +1 -0
  69. package/dist/index.d.ts +20 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +3 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/index.mjs +2 -0
  74. package/dist/index.mjs.map +1 -0
  75. package/dist/internal/index.d.ts +13 -0
  76. package/dist/internal/index.d.ts.map +1 -0
  77. package/dist/internal/namespace.d.ts +78 -0
  78. package/dist/internal/namespace.d.ts.map +1 -0
  79. package/dist/internal/registry.d.ts +8 -0
  80. package/dist/internal/registry.d.ts.map +1 -0
  81. package/dist/internal/uid.d.ts +116 -0
  82. package/dist/internal/uid.d.ts.map +1 -0
  83. package/dist/modules/ai.d.ts +34 -0
  84. package/dist/modules/ai.d.ts.map +1 -0
  85. package/dist/modules/audit-logs.d.ts +6 -0
  86. package/dist/modules/audit-logs.d.ts.map +1 -0
  87. package/dist/modules/auth.d.ts +25 -0
  88. package/dist/modules/auth.d.ts.map +1 -0
  89. package/dist/modules/content-api.d.ts +92 -0
  90. package/dist/modules/content-api.d.ts.map +1 -0
  91. package/dist/modules/core-store.d.ts +28 -0
  92. package/dist/modules/core-store.d.ts.map +1 -0
  93. package/dist/modules/cron.d.ts +27 -0
  94. package/dist/modules/cron.d.ts.map +1 -0
  95. package/dist/modules/custom-fields.d.ts +25 -0
  96. package/dist/modules/custom-fields.d.ts.map +1 -0
  97. package/dist/modules/documents/component-extension.d.ts +73 -0
  98. package/dist/modules/documents/component-extension.d.ts.map +1 -0
  99. package/dist/modules/documents/draft-and-publish.d.ts +12 -0
  100. package/dist/modules/documents/draft-and-publish.d.ts.map +1 -0
  101. package/dist/modules/documents/index.d.ts +27 -0
  102. package/dist/modules/documents/index.d.ts.map +1 -0
  103. package/dist/modules/documents/middleware.d.ts +14 -0
  104. package/dist/modules/documents/middleware.d.ts.map +1 -0
  105. package/dist/modules/documents/params/attributes/id.d.ts +4 -0
  106. package/dist/modules/documents/params/attributes/id.d.ts.map +1 -0
  107. package/dist/modules/documents/params/attributes/index.d.ts +79 -0
  108. package/dist/modules/documents/params/attributes/index.d.ts.map +1 -0
  109. package/dist/modules/documents/params/attributes/relations.d.ts +40 -0
  110. package/dist/modules/documents/params/attributes/relations.d.ts.map +1 -0
  111. package/dist/modules/documents/params/data.d.ts +67 -0
  112. package/dist/modules/documents/params/data.d.ts.map +1 -0
  113. package/dist/modules/documents/params/document-engine.d.ts +34 -0
  114. package/dist/modules/documents/params/document-engine.d.ts.map +1 -0
  115. package/dist/modules/documents/params/fields.d.ts +61 -0
  116. package/dist/modules/documents/params/fields.d.ts.map +1 -0
  117. package/dist/modules/documents/params/filters/index.d.ts +61 -0
  118. package/dist/modules/documents/params/filters/index.d.ts.map +1 -0
  119. package/dist/modules/documents/params/filters/operators.d.ts +9 -0
  120. package/dist/modules/documents/params/filters/operators.d.ts.map +1 -0
  121. package/dist/modules/documents/params/index.d.ts +162 -0
  122. package/dist/modules/documents/params/index.d.ts.map +1 -0
  123. package/dist/modules/documents/params/locale.d.ts +4 -0
  124. package/dist/modules/documents/params/locale.d.ts.map +1 -0
  125. package/dist/modules/documents/params/pagination.d.ts +11 -0
  126. package/dist/modules/documents/params/pagination.d.ts.map +1 -0
  127. package/dist/modules/documents/params/populate.d.ts +86 -0
  128. package/dist/modules/documents/params/populate.d.ts.map +1 -0
  129. package/dist/modules/documents/params/search.d.ts +2 -0
  130. package/dist/modules/documents/params/search.d.ts.map +1 -0
  131. package/dist/modules/documents/params/sort.d.ts +87 -0
  132. package/dist/modules/documents/params/sort.d.ts.map +1 -0
  133. package/dist/modules/documents/params/status.d.ts +12 -0
  134. package/dist/modules/documents/params/status.d.ts.map +1 -0
  135. package/dist/modules/documents/plugin.d.ts +11 -0
  136. package/dist/modules/documents/plugin.d.ts.map +1 -0
  137. package/dist/modules/documents/result/document-engine.d.ts +34 -0
  138. package/dist/modules/documents/result/document-engine.d.ts.map +1 -0
  139. package/dist/modules/documents/result/index.d.ts +93 -0
  140. package/dist/modules/documents/result/index.d.ts.map +1 -0
  141. package/dist/modules/documents/service-instance.d.ts +96 -0
  142. package/dist/modules/documents/service-instance.d.ts.map +1 -0
  143. package/dist/modules/entity-service/index.d.ts +87 -0
  144. package/dist/modules/entity-service/index.d.ts.map +1 -0
  145. package/dist/modules/entity-service/params/attributes/id.d.ts +3 -0
  146. package/dist/modules/entity-service/params/attributes/id.d.ts.map +1 -0
  147. package/dist/modules/entity-service/params/attributes/index.d.ts +71 -0
  148. package/dist/modules/entity-service/params/attributes/index.d.ts.map +1 -0
  149. package/dist/modules/entity-service/params/attributes/literals.d.ts +8 -0
  150. package/dist/modules/entity-service/params/attributes/literals.d.ts.map +1 -0
  151. package/dist/modules/entity-service/params/attributes/relation.d.ts +40 -0
  152. package/dist/modules/entity-service/params/attributes/relation.d.ts.map +1 -0
  153. package/dist/modules/entity-service/params/attributes/utils.d.ts +9 -0
  154. package/dist/modules/entity-service/params/attributes/utils.d.ts.map +1 -0
  155. package/dist/modules/entity-service/params/data.d.ts +52 -0
  156. package/dist/modules/entity-service/params/data.d.ts.map +1 -0
  157. package/dist/modules/entity-service/params/fields.d.ts +61 -0
  158. package/dist/modules/entity-service/params/fields.d.ts.map +1 -0
  159. package/dist/modules/entity-service/params/filters/index.d.ts +96 -0
  160. package/dist/modules/entity-service/params/filters/index.d.ts.map +1 -0
  161. package/dist/modules/entity-service/params/filters/operators.d.ts +9 -0
  162. package/dist/modules/entity-service/params/filters/operators.d.ts.map +1 -0
  163. package/dist/modules/entity-service/params/index.d.ts +123 -0
  164. package/dist/modules/entity-service/params/index.d.ts.map +1 -0
  165. package/dist/modules/entity-service/params/pagination.d.ts +10 -0
  166. package/dist/modules/entity-service/params/pagination.d.ts.map +1 -0
  167. package/dist/modules/entity-service/params/populate.d.ts +69 -0
  168. package/dist/modules/entity-service/params/populate.d.ts.map +1 -0
  169. package/dist/modules/entity-service/params/search.d.ts +2 -0
  170. package/dist/modules/entity-service/params/search.d.ts.map +1 -0
  171. package/dist/modules/entity-service/params/sort.d.ts +95 -0
  172. package/dist/modules/entity-service/params/sort.d.ts.map +1 -0
  173. package/dist/modules/entity-service/plugin.d.ts +11 -0
  174. package/dist/modules/entity-service/plugin.d.ts.map +1 -0
  175. package/dist/modules/entity-service/result.d.ts +78 -0
  176. package/dist/modules/entity-service/result.d.ts.map +1 -0
  177. package/dist/modules/entity-validator.d.ts +21 -0
  178. package/dist/modules/entity-validator.d.ts.map +1 -0
  179. package/dist/modules/event-hub.d.ts +16 -0
  180. package/dist/modules/event-hub.d.ts.map +1 -0
  181. package/dist/modules/features.d.ts +12 -0
  182. package/dist/modules/features.d.ts.map +1 -0
  183. package/dist/modules/fetch.d.ts +11 -0
  184. package/dist/modules/fetch.d.ts.map +1 -0
  185. package/dist/modules/index.d.ts +24 -0
  186. package/dist/modules/index.d.ts.map +1 -0
  187. package/dist/modules/mcp.d.ts +216 -0
  188. package/dist/modules/mcp.d.ts.map +1 -0
  189. package/dist/modules/metrics.d.ts +8 -0
  190. package/dist/modules/metrics.d.ts.map +1 -0
  191. package/dist/modules/permissions.d.ts +14 -0
  192. package/dist/modules/permissions.d.ts.map +1 -0
  193. package/dist/modules/request-context.d.ts +6 -0
  194. package/dist/modules/request-context.d.ts.map +1 -0
  195. package/dist/modules/sanitizers.d.ts +8 -0
  196. package/dist/modules/sanitizers.d.ts.map +1 -0
  197. package/dist/modules/server.d.ts +29 -0
  198. package/dist/modules/server.d.ts.map +1 -0
  199. package/dist/modules/session-manager.d.ts +70 -0
  200. package/dist/modules/session-manager.d.ts.map +1 -0
  201. package/dist/modules/validators.d.ts +8 -0
  202. package/dist/modules/validators.d.ts.map +1 -0
  203. package/dist/modules/webhook-runner.d.ts +19 -0
  204. package/dist/modules/webhook-runner.d.ts.map +1 -0
  205. package/dist/modules/webhook-store.d.ts +21 -0
  206. package/dist/modules/webhook-store.d.ts.map +1 -0
  207. package/dist/plugin/config/index.d.ts +3 -0
  208. package/dist/plugin/config/index.d.ts.map +1 -0
  209. package/dist/plugin/config/strapi-admin/index.d.ts +8 -0
  210. package/dist/plugin/config/strapi-admin/index.d.ts.map +1 -0
  211. package/dist/plugin/config/strapi-server/config.d.ts +8 -0
  212. package/dist/plugin/config/strapi-server/config.d.ts.map +1 -0
  213. package/dist/plugin/config/strapi-server/content-types.d.ts +11 -0
  214. package/dist/plugin/config/strapi-server/content-types.d.ts.map +1 -0
  215. package/dist/plugin/config/strapi-server/controllers.d.ts +8 -0
  216. package/dist/plugin/config/strapi-server/controllers.d.ts.map +1 -0
  217. package/dist/plugin/config/strapi-server/index.d.ts +21 -0
  218. package/dist/plugin/config/strapi-server/index.d.ts.map +1 -0
  219. package/dist/plugin/config/strapi-server/lifecycle.d.ts +8 -0
  220. package/dist/plugin/config/strapi-server/lifecycle.d.ts.map +1 -0
  221. package/dist/plugin/config/strapi-server/routes.d.ts +11 -0
  222. package/dist/plugin/config/strapi-server/routes.d.ts.map +1 -0
  223. package/dist/plugin/index.d.ts +40 -0
  224. package/dist/plugin/index.d.ts.map +1 -0
  225. package/dist/public/index.d.ts +6 -0
  226. package/dist/public/index.d.ts.map +1 -0
  227. package/dist/public/registries.d.ts +68 -0
  228. package/dist/public/registries.d.ts.map +1 -0
  229. package/dist/public/shared.d.ts +61 -0
  230. package/dist/public/shared.d.ts.map +1 -0
  231. package/dist/schema/attribute/base.d.ts +92 -0
  232. package/dist/schema/attribute/base.d.ts.map +1 -0
  233. package/dist/schema/attribute/common.d.ts +29 -0
  234. package/dist/schema/attribute/common.d.ts.map +1 -0
  235. package/dist/schema/attribute/constants.d.ts +12 -0
  236. package/dist/schema/attribute/constants.d.ts.map +1 -0
  237. package/dist/schema/attribute/definitions/biginteger.d.ts +19 -0
  238. package/dist/schema/attribute/definitions/biginteger.d.ts.map +1 -0
  239. package/dist/schema/attribute/definitions/blocks.d.ts +80 -0
  240. package/dist/schema/attribute/definitions/blocks.d.ts.map +1 -0
  241. package/dist/schema/attribute/definitions/boolean.d.ts +19 -0
  242. package/dist/schema/attribute/definitions/boolean.d.ts.map +1 -0
  243. package/dist/schema/attribute/definitions/component.d.ts +25 -0
  244. package/dist/schema/attribute/definitions/component.d.ts.map +1 -0
  245. package/dist/schema/attribute/definitions/date-time.d.ts +18 -0
  246. package/dist/schema/attribute/definitions/date-time.d.ts.map +1 -0
  247. package/dist/schema/attribute/definitions/date.d.ts +18 -0
  248. package/dist/schema/attribute/definitions/date.d.ts.map +1 -0
  249. package/dist/schema/attribute/definitions/decimal.d.ts +19 -0
  250. package/dist/schema/attribute/definitions/decimal.d.ts.map +1 -0
  251. package/dist/schema/attribute/definitions/dynamic-zone.d.ts +25 -0
  252. package/dist/schema/attribute/definitions/dynamic-zone.d.ts.map +1 -0
  253. package/dist/schema/attribute/definitions/email.d.ts +19 -0
  254. package/dist/schema/attribute/definitions/email.d.ts.map +1 -0
  255. package/dist/schema/attribute/definitions/enumeration.d.ts +22 -0
  256. package/dist/schema/attribute/definitions/enumeration.d.ts.map +1 -0
  257. package/dist/schema/attribute/definitions/float.d.ts +19 -0
  258. package/dist/schema/attribute/definitions/float.d.ts.map +1 -0
  259. package/dist/schema/attribute/definitions/index.d.ts +23 -0
  260. package/dist/schema/attribute/definitions/index.d.ts.map +1 -0
  261. package/dist/schema/attribute/definitions/integer.d.ts +19 -0
  262. package/dist/schema/attribute/definitions/integer.d.ts.map +1 -0
  263. package/dist/schema/attribute/definitions/json.d.ts +17 -0
  264. package/dist/schema/attribute/definitions/json.d.ts.map +1 -0
  265. package/dist/schema/attribute/definitions/media.d.ts +24 -0
  266. package/dist/schema/attribute/definitions/media.d.ts.map +1 -0
  267. package/dist/schema/attribute/definitions/password.d.ts +18 -0
  268. package/dist/schema/attribute/definitions/password.d.ts.map +1 -0
  269. package/dist/schema/attribute/definitions/relation.d.ts +167 -0
  270. package/dist/schema/attribute/definitions/relation.d.ts.map +1 -0
  271. package/dist/schema/attribute/definitions/richtext.d.ts +18 -0
  272. package/dist/schema/attribute/definitions/richtext.d.ts.map +1 -0
  273. package/dist/schema/attribute/definitions/string.d.ts +28 -0
  274. package/dist/schema/attribute/definitions/string.d.ts.map +1 -0
  275. package/dist/schema/attribute/definitions/text.d.ts +23 -0
  276. package/dist/schema/attribute/definitions/text.d.ts.map +1 -0
  277. package/dist/schema/attribute/definitions/time.d.ts +18 -0
  278. package/dist/schema/attribute/definitions/time.d.ts.map +1 -0
  279. package/dist/schema/attribute/definitions/timestamp.d.ts +18 -0
  280. package/dist/schema/attribute/definitions/timestamp.d.ts.map +1 -0
  281. package/dist/schema/attribute/definitions/uid.d.ts +31 -0
  282. package/dist/schema/attribute/definitions/uid.d.ts.map +1 -0
  283. package/dist/schema/attribute/index.d.ts +7 -0
  284. package/dist/schema/attribute/index.d.ts.map +1 -0
  285. package/dist/schema/attribute/options.d.ts +221 -0
  286. package/dist/schema/attribute/options.d.ts.map +1 -0
  287. package/dist/schema/attribute/utils.d.ts +101 -0
  288. package/dist/schema/attribute/utils.d.ts.map +1 -0
  289. package/dist/schema/index.d.ts +144 -0
  290. package/dist/schema/index.d.ts.map +1 -0
  291. package/dist/struct/index.d.ts +3 -0
  292. package/dist/struct/index.d.ts.map +1 -0
  293. package/dist/struct/schema-definition.d.ts +10 -0
  294. package/dist/struct/schema-definition.d.ts.map +1 -0
  295. package/dist/struct/schema.d.ts +286 -0
  296. package/dist/struct/schema.d.ts.map +1 -0
  297. package/dist/uid/index.d.ts +168 -0
  298. package/dist/uid/index.d.ts.map +1 -0
  299. package/dist/utils/array.d.ts +80 -0
  300. package/dist/utils/array.d.ts.map +1 -0
  301. package/dist/utils/constants.d.ts +67 -0
  302. package/dist/utils/constants.d.ts.map +1 -0
  303. package/dist/utils/expression.d.ts +490 -0
  304. package/dist/utils/expression.d.ts.map +1 -0
  305. package/dist/utils/function.d.ts +21 -0
  306. package/dist/utils/function.d.ts.map +1 -0
  307. package/dist/utils/guard.d.ts +90 -0
  308. package/dist/utils/guard.d.ts.map +1 -0
  309. package/dist/utils/index.d.ts +236 -0
  310. package/dist/utils/index.d.ts.map +1 -0
  311. package/dist/utils/json.d.ts +119 -0
  312. package/dist/utils/json.d.ts.map +1 -0
  313. package/dist/utils/object.d.ts +180 -0
  314. package/dist/utils/object.d.ts.map +1 -0
  315. package/dist/utils/string.d.ts +190 -0
  316. package/dist/utils/string.d.ts.map +1 -0
  317. package/dist/utils/tuple.d.ts +19 -0
  318. package/dist/utils/tuple.d.ts.map +1 -0
  319. package/package.json +68 -0
@@ -0,0 +1,190 @@
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
+ /**
155
+ * Combines a union of literal types with a more general type while preserving autocompletion.
156
+ *
157
+ * When using string literal unions, it maintains IDE suggestions for the literal values while
158
+ * still allowing any value of the base type.
159
+ *
160
+ * @template T - The literal type to suggest in autocompletion (for example, specific strings)
161
+ * @template U - The base type that T extends from (defaults to string)
162
+ *
163
+ * @example
164
+ * // Define a type for specific HTTP methods while allowing custom one's
165
+ * type HttpMethod = LiteralUnion<'GET' | 'POST' | 'PUT' | 'DELETE'>;
166
+ *
167
+ * // These will show up in autocompletion
168
+ * const method1: HttpMethod = 'GET'; // ✓ Valid
169
+ * const method2: HttpMethod = 'POST'; // ✓ Valid
170
+ *
171
+ * // This is also valid since any string is allowed
172
+ * const method3: HttpMethod = 'PATCH'; // ✓ Valid
173
+ *
174
+ * @example
175
+ * // Can be used with number literals too
176
+ * type CommonPorts = LiteralUnion<80 | 443 | 3000, number>;
177
+ *
178
+ * // Suggested in autocompletion
179
+ * const port1: CommonPorts = 80; // ✓ Valid
180
+ * const port2: CommonPorts = 443; // ✓ Valid
181
+ *
182
+ * // Any number is still accepted
183
+ * const port3: CommonPorts = 8080; // ✓ Valid
184
+ *
185
+ * @remark
186
+ * This type is particularly useful for API parameters where specific values should be suggested,
187
+ * but custom values shouldn't be restricted.
188
+ */
189
+ export type LiteralUnion<T extends U, U = string> = T | (U & NonNullable<unknown>);
190
+ //# 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;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,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"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@akbarsafari00/bonyan-types",
3
+ "version": "5.52.1-fa.4",
4
+ "description": "Shared typescript types for Bonyan internal use",
5
+ "keywords": [
6
+ "strapi"
7
+ ],
8
+ "homepage": "https://www.npmjs.com/package/@akbarsafari00/bonyan-types",
9
+ "license": "SEE LICENSE IN LICENSE",
10
+ "author": "akbarsafari00",
11
+ "main": "./dist/index.js",
12
+ "source": "./src/index.ts",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "source": "./src/index.ts",
18
+ "import": "./dist/index.mjs",
19
+ "require": "./dist/index.js",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./package.json": "./package.json",
23
+ "./*": "./*"
24
+ },
25
+ "files": [
26
+ "dist/"
27
+ ],
28
+ "scripts": {
29
+ "build": "run -T npm-run-all clean --parallel build:code build:types",
30
+ "build:code": "run -T rollup -c",
31
+ "build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
32
+ "clean": "run -T rimraf ./dist",
33
+ "doc:ts": "typedoc",
34
+ "doc:ts:watch": "typedoc --watch",
35
+ "lint": "run -T eslint . --max-warnings=0",
36
+ "test:ts": "run -T tsc -p tsconfig.json",
37
+ "watch": "run -T tsc -p tsconfig.build.json -w"
38
+ },
39
+ "dependencies": {
40
+ "@casl/ability": "6.7.5",
41
+ "@koa/cors": "5.0.0",
42
+ "@koa/router": "12.0.2",
43
+ "@modelcontextprotocol/sdk": "1.30.0",
44
+ "@strapi/database": "npm:@akbarsafari00/bonyan-database@5.52.1-fa.4",
45
+ "@strapi/logger": "5.52.1",
46
+ "@strapi/permissions": "5.52.1",
47
+ "@strapi/utils": "5.52.1",
48
+ "commander": "8.3.0",
49
+ "json-logic-js": "2.0.5",
50
+ "koa": "2.16.4",
51
+ "koa-body": "6.0.1",
52
+ "node-schedule": "2.1.1",
53
+ "typedoc": "0.28.19",
54
+ "typedoc-github-wiki-theme": "2.1.0",
55
+ "typedoc-plugin-markdown": "4.11.0",
56
+ "zod": "3.25.76"
57
+ },
58
+ "engines": {
59
+ "node": ">=20.0.0 <=26.x.x",
60
+ "npm": ">=6.0.0"
61
+ },
62
+ "private": false,
63
+ "optionalDependencies": {},
64
+ "publishConfig": {
65
+ "access": "public",
66
+ "registry": "https://registry.npmjs.org/"
67
+ }
68
+ }