@gigapay-dev/contracts 1.8.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/README.md +1 -0
  2. package/build/client.d.ts +934 -0
  3. package/build/client.d.ts.map +1 -0
  4. package/build/client.js +184 -0
  5. package/build/client.js.map +1 -0
  6. package/build/commands/api-response.d.ts +1 -0
  7. package/build/commands/api-response.d.ts.map +1 -0
  8. package/build/commands/api-response.js +1 -0
  9. package/build/commands/api-response.js.map +1 -0
  10. package/build/commands/auth/confirm.d.ts +1 -0
  11. package/build/commands/auth/confirm.d.ts.map +1 -0
  12. package/build/commands/auth/confirm.js +1 -0
  13. package/build/commands/auth/confirm.js.map +1 -0
  14. package/build/commands/auth/endpoints.d.ts +1 -0
  15. package/build/commands/auth/endpoints.d.ts.map +1 -0
  16. package/build/commands/auth/endpoints.js +1 -0
  17. package/build/commands/auth/endpoints.js.map +1 -0
  18. package/build/commands/auth/index.d.ts +2 -0
  19. package/build/commands/auth/index.d.ts.map +1 -0
  20. package/build/commands/auth/index.js +2 -0
  21. package/build/commands/auth/index.js.map +1 -0
  22. package/build/commands/auth/login.d.ts +1 -0
  23. package/build/commands/auth/login.d.ts.map +1 -0
  24. package/build/commands/auth/login.js +1 -0
  25. package/build/commands/auth/login.js.map +1 -0
  26. package/build/commands/auth/profile.d.ts +1 -0
  27. package/build/commands/auth/profile.d.ts.map +1 -0
  28. package/build/commands/auth/profile.js +1 -0
  29. package/build/commands/auth/profile.js.map +1 -0
  30. package/build/commands/auth/register.d.ts +1 -0
  31. package/build/commands/auth/register.d.ts.map +1 -0
  32. package/build/commands/auth/register.js +1 -0
  33. package/build/commands/auth/register.js.map +1 -0
  34. package/build/commands/auth/reset.d.ts +1 -0
  35. package/build/commands/auth/reset.d.ts.map +1 -0
  36. package/build/commands/auth/reset.js +1 -0
  37. package/build/commands/auth/reset.js.map +1 -0
  38. package/build/commands/common.d.ts +65 -0
  39. package/build/commands/common.d.ts.map +1 -0
  40. package/build/commands/common.js +29 -0
  41. package/build/commands/common.js.map +1 -0
  42. package/build/commands/consts.d.ts +1 -0
  43. package/build/commands/consts.d.ts.map +1 -0
  44. package/build/commands/consts.js +1 -0
  45. package/build/commands/consts.js.map +1 -0
  46. package/build/commands/endpoints.d.ts +4643 -0
  47. package/build/commands/endpoints.d.ts.map +1 -0
  48. package/build/commands/endpoints.js +26 -0
  49. package/build/commands/endpoints.js.map +1 -0
  50. package/build/commands/index.d.ts +3 -0
  51. package/build/commands/index.d.ts.map +1 -0
  52. package/build/commands/index.js +3 -0
  53. package/build/commands/index.js.map +1 -0
  54. package/build/commands/orders/create.d.ts +5 -0
  55. package/build/commands/orders/create.d.ts.map +1 -0
  56. package/build/commands/orders/create.js +3 -0
  57. package/build/commands/orders/create.js.map +1 -0
  58. package/build/commands/orders/endpoints.d.ts +40 -24
  59. package/build/commands/orders/endpoints.d.ts.map +1 -0
  60. package/build/commands/orders/endpoints.js +1 -0
  61. package/build/commands/orders/endpoints.js.map +1 -0
  62. package/build/commands/orders/enums.d.ts +1 -0
  63. package/build/commands/orders/enums.d.ts.map +1 -0
  64. package/build/commands/orders/enums.js +1 -0
  65. package/build/commands/orders/enums.js.map +1 -0
  66. package/build/commands/orders/index.d.ts +1 -0
  67. package/build/commands/orders/index.d.ts.map +1 -0
  68. package/build/commands/orders/index.js +1 -0
  69. package/build/commands/orders/index.js.map +1 -0
  70. package/build/commands/orders/query.d.ts +7 -6
  71. package/build/commands/orders/query.d.ts.map +1 -0
  72. package/build/commands/orders/query.js +1 -0
  73. package/build/commands/orders/query.js.map +1 -0
  74. package/build/commands/orders/read.d.ts +8 -3
  75. package/build/commands/orders/read.d.ts.map +1 -0
  76. package/build/commands/orders/read.js +4 -1
  77. package/build/commands/orders/read.js.map +1 -0
  78. package/build/commands/orders/update.d.ts +1 -0
  79. package/build/commands/orders/update.d.ts.map +1 -0
  80. package/build/commands/orders/update.js +1 -0
  81. package/build/commands/orders/update.js.map +1 -0
  82. package/build/commands/pagination.d.ts +8 -7
  83. package/build/commands/pagination.d.ts.map +1 -0
  84. package/build/commands/pagination.js +5 -7
  85. package/build/commands/pagination.js.map +1 -0
  86. package/build/commands/payment-methods/create.d.ts +1 -0
  87. package/build/commands/payment-methods/create.d.ts.map +1 -0
  88. package/build/commands/payment-methods/create.js +1 -0
  89. package/build/commands/payment-methods/create.js.map +1 -0
  90. package/build/commands/payment-methods/endpoints.d.ts +1 -0
  91. package/build/commands/payment-methods/endpoints.d.ts.map +1 -0
  92. package/build/commands/payment-methods/endpoints.js +1 -0
  93. package/build/commands/payment-methods/endpoints.js.map +1 -0
  94. package/build/commands/payment-methods/index.d.ts +1 -0
  95. package/build/commands/payment-methods/index.d.ts.map +1 -0
  96. package/build/commands/payment-methods/index.js +1 -0
  97. package/build/commands/payment-methods/index.js.map +1 -0
  98. package/build/commands/payment-methods/read.d.ts +1 -0
  99. package/build/commands/payment-methods/read.d.ts.map +1 -0
  100. package/build/commands/payment-methods/read.js +1 -0
  101. package/build/commands/payment-methods/read.js.map +1 -0
  102. package/build/commands/payment-methods/update.d.ts +1 -0
  103. package/build/commands/payment-methods/update.d.ts.map +1 -0
  104. package/build/commands/payment-methods/update.js +1 -0
  105. package/build/commands/payment-methods/update.js.map +1 -0
  106. package/build/commands/products/create.d.ts +13 -0
  107. package/build/commands/products/create.d.ts.map +1 -0
  108. package/build/commands/products/create.js +7 -0
  109. package/build/commands/products/create.js.map +1 -0
  110. package/build/commands/products/endpoints.d.ts +101 -2
  111. package/build/commands/products/endpoints.d.ts.map +1 -0
  112. package/build/commands/products/endpoints.js +1 -0
  113. package/build/commands/products/endpoints.js.map +1 -0
  114. package/build/commands/products/enums.d.ts +1 -0
  115. package/build/commands/products/enums.d.ts.map +1 -0
  116. package/build/commands/products/enums.js +1 -0
  117. package/build/commands/products/enums.js.map +1 -0
  118. package/build/commands/products/index.d.ts +1 -0
  119. package/build/commands/products/index.d.ts.map +1 -0
  120. package/build/commands/products/index.js +1 -0
  121. package/build/commands/products/index.js.map +1 -0
  122. package/build/commands/products/query.d.ts +3 -2
  123. package/build/commands/products/query.d.ts.map +1 -0
  124. package/build/commands/products/query.js +1 -0
  125. package/build/commands/products/query.js.map +1 -0
  126. package/build/commands/products/read.d.ts +400 -0
  127. package/build/commands/products/read.d.ts.map +1 -0
  128. package/build/commands/products/read.js +67 -1
  129. package/build/commands/products/read.js.map +1 -0
  130. package/build/commands/products/update.d.ts +7 -0
  131. package/build/commands/products/update.d.ts.map +1 -0
  132. package/build/commands/products/update.js +1 -0
  133. package/build/commands/products/update.js.map +1 -0
  134. package/build/commands/promocode-activations/create.d.ts +1 -0
  135. package/build/commands/promocode-activations/create.d.ts.map +1 -0
  136. package/build/commands/promocode-activations/create.js +1 -0
  137. package/build/commands/promocode-activations/create.js.map +1 -0
  138. package/build/commands/promocode-activations/endpoints.d.ts +158 -0
  139. package/build/commands/promocode-activations/endpoints.d.ts.map +1 -0
  140. package/build/commands/promocode-activations/endpoints.js +39 -0
  141. package/build/commands/promocode-activations/endpoints.js.map +1 -0
  142. package/build/commands/promocode-activations/index.d.ts +2 -0
  143. package/build/commands/promocode-activations/index.d.ts.map +1 -0
  144. package/build/commands/promocode-activations/index.js +2 -0
  145. package/build/commands/promocode-activations/index.js.map +1 -0
  146. package/build/commands/promocode-activations/read.d.ts +1 -0
  147. package/build/commands/promocode-activations/read.d.ts.map +1 -0
  148. package/build/commands/promocode-activations/read.js +1 -0
  149. package/build/commands/promocode-activations/read.js.map +1 -0
  150. package/build/commands/promocode-activations/update.d.ts +1 -0
  151. package/build/commands/promocode-activations/update.d.ts.map +1 -0
  152. package/build/commands/promocode-activations/update.js +1 -0
  153. package/build/commands/promocode-activations/update.js.map +1 -0
  154. package/build/commands/promocodes/create.d.ts +1 -0
  155. package/build/commands/promocodes/create.d.ts.map +1 -0
  156. package/build/commands/promocodes/create.js +1 -0
  157. package/build/commands/promocodes/create.js.map +1 -0
  158. package/build/commands/promocodes/endpoints.d.ts +1 -0
  159. package/build/commands/promocodes/endpoints.d.ts.map +1 -0
  160. package/build/commands/promocodes/endpoints.js +1 -0
  161. package/build/commands/promocodes/endpoints.js.map +1 -0
  162. package/build/commands/promocodes/enums.d.ts +1 -0
  163. package/build/commands/promocodes/enums.d.ts.map +1 -0
  164. package/build/commands/promocodes/enums.js +1 -0
  165. package/build/commands/promocodes/enums.js.map +1 -0
  166. package/build/commands/promocodes/index.d.ts +1 -0
  167. package/build/commands/promocodes/index.d.ts.map +1 -0
  168. package/build/commands/promocodes/index.js +1 -0
  169. package/build/commands/promocodes/index.js.map +1 -0
  170. package/build/commands/promocodes/read.d.ts +1 -0
  171. package/build/commands/promocodes/read.d.ts.map +1 -0
  172. package/build/commands/promocodes/read.js +1 -0
  173. package/build/commands/promocodes/read.js.map +1 -0
  174. package/build/commands/promocodes/update.d.ts +1 -0
  175. package/build/commands/promocodes/update.d.ts.map +1 -0
  176. package/build/commands/promocodes/update.js +1 -0
  177. package/build/commands/promocodes/update.js.map +1 -0
  178. package/build/commands/refresh-sessions/create.d.ts +1 -0
  179. package/build/commands/refresh-sessions/create.d.ts.map +1 -0
  180. package/build/commands/refresh-sessions/create.js +1 -0
  181. package/build/commands/refresh-sessions/create.js.map +1 -0
  182. package/build/commands/refresh-sessions/endpoints.d.ts +216 -0
  183. package/build/commands/refresh-sessions/endpoints.d.ts.map +1 -0
  184. package/build/commands/refresh-sessions/endpoints.js +47 -0
  185. package/build/commands/refresh-sessions/endpoints.js.map +1 -0
  186. package/build/commands/refresh-sessions/enums.d.ts +1 -0
  187. package/build/commands/refresh-sessions/enums.d.ts.map +1 -0
  188. package/build/commands/refresh-sessions/enums.js +1 -0
  189. package/build/commands/refresh-sessions/enums.js.map +1 -0
  190. package/build/commands/refresh-sessions/index.d.ts +2 -0
  191. package/build/commands/refresh-sessions/index.d.ts.map +1 -0
  192. package/build/commands/refresh-sessions/index.js +2 -0
  193. package/build/commands/refresh-sessions/index.js.map +1 -0
  194. package/build/commands/refresh-sessions/read.d.ts +1 -0
  195. package/build/commands/refresh-sessions/read.d.ts.map +1 -0
  196. package/build/commands/refresh-sessions/read.js +1 -0
  197. package/build/commands/refresh-sessions/read.js.map +1 -0
  198. package/build/commands/refresh-sessions/update.d.ts +1 -0
  199. package/build/commands/refresh-sessions/update.d.ts.map +1 -0
  200. package/build/commands/refresh-sessions/update.js +1 -0
  201. package/build/commands/refresh-sessions/update.js.map +1 -0
  202. package/build/commands/settings/endpoints.d.ts +1 -0
  203. package/build/commands/settings/endpoints.d.ts.map +1 -0
  204. package/build/commands/settings/endpoints.js +1 -0
  205. package/build/commands/settings/endpoints.js.map +1 -0
  206. package/build/commands/settings/index.d.ts +1 -0
  207. package/build/commands/settings/index.d.ts.map +1 -0
  208. package/build/commands/settings/index.js +1 -0
  209. package/build/commands/settings/index.js.map +1 -0
  210. package/build/commands/settings/read.d.ts +1 -0
  211. package/build/commands/settings/read.d.ts.map +1 -0
  212. package/build/commands/settings/read.js +1 -0
  213. package/build/commands/settings/read.js.map +1 -0
  214. package/build/commands/settings/update.d.ts +1 -0
  215. package/build/commands/settings/update.d.ts.map +1 -0
  216. package/build/commands/settings/update.js +1 -0
  217. package/build/commands/settings/update.js.map +1 -0
  218. package/build/commands/stats/endpoints.d.ts +1 -0
  219. package/build/commands/stats/endpoints.d.ts.map +1 -0
  220. package/build/commands/stats/endpoints.js +1 -0
  221. package/build/commands/stats/endpoints.js.map +1 -0
  222. package/build/commands/stats/index.d.ts +1 -0
  223. package/build/commands/stats/index.d.ts.map +1 -0
  224. package/build/commands/stats/index.js +1 -0
  225. package/build/commands/stats/index.js.map +1 -0
  226. package/build/commands/stats/query.d.ts +1 -0
  227. package/build/commands/stats/query.d.ts.map +1 -0
  228. package/build/commands/stats/query.js +1 -0
  229. package/build/commands/stats/query.js.map +1 -0
  230. package/build/commands/stats/read.d.ts +1 -0
  231. package/build/commands/stats/read.d.ts.map +1 -0
  232. package/build/commands/stats/read.js +1 -0
  233. package/build/commands/stats/read.js.map +1 -0
  234. package/build/commands/users/create.d.ts +1 -0
  235. package/build/commands/users/create.d.ts.map +1 -0
  236. package/build/commands/users/create.js +1 -0
  237. package/build/commands/users/create.js.map +1 -0
  238. package/build/commands/users/endpoints.d.ts +7 -6
  239. package/build/commands/users/endpoints.d.ts.map +1 -0
  240. package/build/commands/users/endpoints.js +1 -0
  241. package/build/commands/users/endpoints.js.map +1 -0
  242. package/build/commands/users/enums.d.ts +1 -0
  243. package/build/commands/users/enums.d.ts.map +1 -0
  244. package/build/commands/users/enums.js +1 -0
  245. package/build/commands/users/enums.js.map +1 -0
  246. package/build/commands/users/index.d.ts +1 -0
  247. package/build/commands/users/index.d.ts.map +1 -0
  248. package/build/commands/users/index.js +1 -0
  249. package/build/commands/users/index.js.map +1 -0
  250. package/build/commands/users/query.d.ts +7 -6
  251. package/build/commands/users/query.d.ts.map +1 -0
  252. package/build/commands/users/query.js +1 -0
  253. package/build/commands/users/query.js.map +1 -0
  254. package/build/commands/users/read.d.ts +1 -0
  255. package/build/commands/users/read.d.ts.map +1 -0
  256. package/build/commands/users/read.js +1 -0
  257. package/build/commands/users/read.js.map +1 -0
  258. package/build/commands/users/update.d.ts +1 -0
  259. package/build/commands/users/update.d.ts.map +1 -0
  260. package/build/commands/users/update.js +1 -0
  261. package/build/commands/users/update.js.map +1 -0
  262. package/build/index.d.ts +1 -0
  263. package/build/index.d.ts.map +1 -0
  264. package/build/index.js +1 -0
  265. package/build/index.js.map +1 -0
  266. package/build/types.d.ts +1 -0
  267. package/build/types.d.ts.map +1 -0
  268. package/build/types.js +1 -0
  269. package/build/types.js.map +1 -0
  270. package/package.json +48 -17
  271. package/commands/api-response.ts +0 -10
  272. package/commands/auth/confirm.ts +0 -10
  273. package/commands/auth/endpoints.ts +0 -51
  274. package/commands/auth/index.ts +0 -5
  275. package/commands/auth/login.ts +0 -13
  276. package/commands/auth/profile.ts +0 -10
  277. package/commands/auth/register.ts +0 -8
  278. package/commands/auth/reset.ts +0 -9
  279. package/commands/consts.ts +0 -1
  280. package/commands/index.ts +0 -13
  281. package/commands/orders/create.ts +0 -41
  282. package/commands/orders/endpoints.ts +0 -51
  283. package/commands/orders/enums.ts +0 -25
  284. package/commands/orders/index.ts +0 -6
  285. package/commands/orders/query.ts +0 -46
  286. package/commands/orders/read.ts +0 -83
  287. package/commands/orders/update.ts +0 -16
  288. package/commands/pagination.ts +0 -8
  289. package/commands/payment-methods/create.ts +0 -19
  290. package/commands/payment-methods/endpoints.ts +0 -67
  291. package/commands/payment-methods/index.ts +0 -4
  292. package/commands/payment-methods/read.ts +0 -30
  293. package/commands/payment-methods/update.ts +0 -19
  294. package/commands/products/create.ts +0 -134
  295. package/commands/products/endpoints.ts +0 -108
  296. package/commands/products/enums.ts +0 -33
  297. package/commands/products/index.ts +0 -6
  298. package/commands/products/query.ts +0 -52
  299. package/commands/products/read.ts +0 -205
  300. package/commands/products/update.ts +0 -11
  301. package/commands/promocode-activations/create.ts +0 -10
  302. package/commands/promocode-activations/index.ts +0 -3
  303. package/commands/promocode-activations/read.ts +0 -11
  304. package/commands/promocode-activations/update.ts +0 -10
  305. package/commands/promocodes/create.ts +0 -18
  306. package/commands/promocodes/endpoints.ts +0 -62
  307. package/commands/promocodes/enums.ts +0 -9
  308. package/commands/promocodes/index.ts +0 -5
  309. package/commands/promocodes/read.ts +0 -20
  310. package/commands/promocodes/update.ts +0 -16
  311. package/commands/refresh-sessions/create.ts +0 -13
  312. package/commands/refresh-sessions/enums.ts +0 -4
  313. package/commands/refresh-sessions/index.ts +0 -4
  314. package/commands/refresh-sessions/read.ts +0 -14
  315. package/commands/refresh-sessions/update.ts +0 -13
  316. package/commands/settings/endpoints.ts +0 -52
  317. package/commands/settings/index.ts +0 -3
  318. package/commands/settings/read.ts +0 -10
  319. package/commands/settings/update.ts +0 -10
  320. package/commands/stats/endpoints.ts +0 -23
  321. package/commands/stats/index.ts +0 -3
  322. package/commands/stats/query.ts +0 -18
  323. package/commands/stats/read.ts +0 -14
  324. package/commands/users/create.ts +0 -19
  325. package/commands/users/endpoints.ts +0 -47
  326. package/commands/users/enums.ts +0 -10
  327. package/commands/users/index.ts +0 -6
  328. package/commands/users/query.ts +0 -20
  329. package/commands/users/read.ts +0 -25
  330. package/commands/users/update.ts +0 -19
  331. package/index.ts +0 -1
  332. package/tsconfig.json +0 -111
  333. package/types.ts +0 -9
@@ -1,11 +0,0 @@
1
- import { z } from "zod";
2
- import { ProductCreateRequestSchema } from "./create";
3
- import { ProductStatus } from "./enums";
4
-
5
- /** Запрос на обновление продукта (частичное) */
6
- export const ProductUpdateRequestSchema = ProductCreateRequestSchema.partial().extend({
7
- /** Статус продукта */
8
- status: ProductStatus.optional(),
9
- });
10
-
11
- export type ProductUpdateRequest = z.infer<typeof ProductUpdateRequestSchema>;
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const PromoCodeActivationCreateSchema = z.object({
4
- promocodeId: z.coerce.number(),
5
- refferalId: z.coerce.number(),
6
- discountValue: z.coerce.number(),
7
- activatedAt: z.coerce.date(),
8
- });
9
-
10
- export type PromoCodeActivationCreate = z.infer<typeof PromoCodeActivationCreateSchema>;
@@ -1,3 +0,0 @@
1
- export * from "./create"
2
- export * from "./read"
3
- export * from "./update"
@@ -1,11 +0,0 @@
1
- import z from "zod";
2
-
3
- export const PromoCodeActivationReadResponseSchema = z.object({
4
- id: z.coerce.number().positive(),
5
- promocodeId: z.coerce.number().positive(),
6
- refferalId: z.coerce.number().positive(),
7
- discountValue: z.string(),
8
- activatedAt: z.coerce.date(),
9
- });
10
-
11
- export type PromoCodeActivationReadResponse = z.infer<typeof PromoCodeActivationReadResponseSchema>;
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const PromoCodeActivationUpdateSchema = z.object({
4
- promocodeId: z.coerce.number().optional(),
5
- refferalId: z.coerce.number().optional(),
6
- discountValue: z.coerce.number().optional(),
7
- activatedAt: z.coerce.date().nullable().optional(),
8
- });
9
-
10
- export type PromoCodeActivationUpdate = z.infer<typeof PromoCodeActivationUpdateSchema>;
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
- import { PromoCodeStatus, PromoCodeType } from "./enums";
3
-
4
- export const PromoCodeCreateSchema = z.object({
5
- value: z.string(),
6
- discountValue: z.string(),
7
- expiredAt: z.coerce.date().nullable().optional(),
8
- startedAt: z.coerce.date().nullable().optional(),
9
- createdAt: z.coerce.date().nullable().optional(),
10
- deletedAt: z.coerce.date().nullable().optional(),
11
- updatedAt: z.coerce.date().nullable().optional(),
12
- activationLimit: z.coerce.number().positive().nullable().optional(),
13
- activationPerUserLimit: z.coerce.number().positive().nullable().optional(),
14
- type: PromoCodeType,
15
- status: PromoCodeStatus,
16
- });
17
-
18
- export type PromoCodeCreate = z.infer<typeof PromoCodeCreateSchema>;
@@ -1,62 +0,0 @@
1
- import { z } from "zod";
2
- import { EndpointContract } from "../../types";
3
- import {
4
- PromoCodeCreateSchema,
5
- } from "./create";
6
-
7
- import {
8
- PromoCodeReadResponseSchema,
9
- } from "./read";
10
-
11
- import {
12
- PromoCodeUpdateSchema,
13
- } from "./update";
14
-
15
- export const PromoCodeEndpoints = {
16
- create: {
17
- method: "POST",
18
- path: "/promo-codes",
19
- request: PromoCodeCreateSchema,
20
- response: PromoCodeReadResponseSchema,
21
- },
22
- list: {
23
- method: "GET",
24
- path: "/promo-codes",
25
- request: z.object({}),
26
- response: z.array(PromoCodeReadResponseSchema),
27
- },
28
- getById: {
29
- method: "GET",
30
- path: "/promo-codes/:id",
31
- request: z.object({
32
- id: z.coerce.number().positive(),
33
- }),
34
- response: PromoCodeReadResponseSchema,
35
- },
36
- getByValue: {
37
- method: "GET",
38
- path: "/promo-codes/value/:value",
39
- request: z.object({
40
- value: z.string(),
41
- }),
42
- response: PromoCodeReadResponseSchema,
43
- },
44
- update: {
45
- method: "PATCH",
46
- path: "/promo-codes/:id",
47
- request: z.object({
48
- id: z.coerce.number().positive(),
49
- body: PromoCodeUpdateSchema,
50
- }),
51
- response: PromoCodeReadResponseSchema,
52
- },
53
-
54
- } satisfies Record<string, EndpointContract>;
55
-
56
- export type PromoCodeEndpointKey = keyof typeof PromoCodeEndpoints;
57
-
58
- export type GetPromoCodeRequest<K extends PromoCodeEndpointKey> =
59
- z.infer<typeof PromoCodeEndpoints[K]["request"]>;
60
-
61
- export type GetPromoCodeResponse<K extends PromoCodeEndpointKey> =
62
- z.infer<typeof PromoCodeEndpoints[K]["response"]>;
@@ -1,9 +0,0 @@
1
- import z from "zod";
2
-
3
- export const PromoCodeType = z.enum(["USER", "AD", "SYSTEM"]);
4
- export const PromoCodeStatus = z.enum(["ACTIVE", "INACTIVE", "LIMITED", "EXPIRED", "DELETED"]);
5
-
6
- export type PromoCodeType = z.infer<typeof PromoCodeType>;
7
- export type PromoCodeStatus = z.infer<typeof PromoCodeStatus>;
8
-
9
-
@@ -1,5 +0,0 @@
1
- export * from "./create"
2
- export * from "./read"
3
- export * from "./update"
4
- export * from "./enums"
5
- export * from "./endpoints"
@@ -1,20 +0,0 @@
1
- import z from "zod";
2
- import { PromoCodeStatus, PromoCodeType } from "./enums";
3
-
4
- export const PromoCodeReadResponseSchema = z.object({
5
- id: z.coerce.number().positive(),
6
- value: z.string(),
7
- activated: z.coerce.number(),
8
- discountValue: z.string(),
9
- startedAt: z.coerce.date().nullable().optional(),
10
- expiredAt: z.coerce.date().nullable().optional(),
11
- createdAt: z.coerce.date().nullable().optional(),
12
- deletedAt: z.coerce.date().nullable().optional(),
13
- updatedAt: z.coerce.date().nullable().optional(),
14
- activationLimit: z.coerce.number().positive().nullable().optional(),
15
- activationPerUserLimit: z.coerce.number().positive().nullable().optional(),
16
- type: PromoCodeType,
17
- status: PromoCodeStatus,
18
- });
19
-
20
- export type PromoCodeReadResponse = z.infer<typeof PromoCodeReadResponseSchema>;
@@ -1,16 +0,0 @@
1
- import { z } from "zod";
2
- import { PromoCodeStatus, PromoCodeType } from "./enums";
3
-
4
- export const PromoCodeUpdateSchema = z.object({
5
- value: z.string().optional(),
6
- discountValue: z.string().optional(),
7
- startedAt: z.coerce.date().nullable().optional(),
8
- expiredAt: z.coerce.date().nullable().optional(),
9
- activationLimit: z.coerce.number().positive().nullable().optional(),
10
- activationPerUserLimit: z.coerce.number().positive().nullable().optional(),
11
- deletedAt: z.coerce.date().nullable().optional(),
12
- type: PromoCodeType.optional(),
13
- status: PromoCodeStatus.optional(),
14
- })
15
-
16
- export type PromoCodeUpdate = z.infer<typeof PromoCodeUpdateSchema>;
@@ -1,13 +0,0 @@
1
- import { z } from "zod";
2
- import { RefreshSessionStatus } from "./enums";
3
-
4
- export const RefreshSessionCreateSchema = z.object({
5
- userId: z.number(),
6
- refreshToken: z.string(),
7
- expiredAt: z.coerce.date().nullable().optional(),
8
- status: RefreshSessionStatus,
9
- IP: z.string().nullable().optional(),
10
- UA: z.string().nullable().optional(),
11
- });
12
-
13
- export type RefreshSessionCreate = z.infer<typeof RefreshSessionCreateSchema>;
@@ -1,4 +0,0 @@
1
- import z from "zod";
2
-
3
- export const RefreshSessionStatus = z.enum(['ACTIVE', 'EXPIRED', 'BLOCKED', 'TERMINATED']);
4
- export type RefreshSessionStatus = z.infer<typeof RefreshSessionStatus>;
@@ -1,4 +0,0 @@
1
- export * from './create'
2
- export * from './read'
3
- export * from './update'
4
- export * from './enums'
@@ -1,14 +0,0 @@
1
- import z from "zod";
2
- import { RefreshSessionStatus } from "./enums";
3
-
4
- export const RefreshSessionReadResponseSchema = z.object({
5
- id: z.number().positive(),
6
- userId: z.number().positive(),
7
- refreshToken: z.string(),
8
- expiredAt: z.coerce.date().nullable().optional(),
9
- status: RefreshSessionStatus,
10
- createdAt: z.coerce.date().nullable().optional(),
11
- updatedAt: z.coerce.date().nullable().optional(),
12
- });
13
-
14
- export type RefreshSessionReadResponse = z.infer<typeof RefreshSessionReadResponseSchema>;
@@ -1,13 +0,0 @@
1
- import z from "zod";
2
- import { RefreshSessionStatus } from "./enums";
3
-
4
- export const RefreshSessionUpdateSchema = z.object({
5
- userId: z.number().optional(),
6
- refreshToken: z.string().optional(),
7
- expiredAt: z.coerce.date().nullable().optional(),
8
- status: RefreshSessionStatus.optional(),
9
- IP: z.string().nullable().optional(),
10
- UA: z.string().nullable().optional(),
11
- });
12
-
13
- export type RefreshSessionUpdate = z.infer<typeof RefreshSessionUpdateSchema>;
@@ -1,52 +0,0 @@
1
- import { z } from "zod";
2
- import { EndpointContract } from "../../types";
3
- import { SettingsReadResponseSchema } from "./read";
4
- import { SettingsUpdateRequestSchema } from "./update";
5
-
6
- export const SettingsEndpoints = {
7
- getAll: {
8
- method: "GET",
9
- path: "/settings",
10
- request: z.object({}),
11
- response: SettingsReadResponseSchema,
12
- },
13
- getOne: {
14
- method: "GET",
15
- path: "/settings/:key",
16
- request: z.object({
17
- key: z.string(),
18
- }),
19
- response: z.object({
20
- key: z.string(),
21
- value: z.union([z.string(), z.boolean()]),
22
- }),
23
- },
24
- updateAll: {
25
- method: "PUT",
26
- path: "/settings",
27
- request: SettingsUpdateRequestSchema,
28
- response: SettingsReadResponseSchema,
29
- },
30
- updateOne: {
31
- method: "PUT",
32
- path: "/settings/:key",
33
- request: z.object({
34
- key: z.string(),
35
- value: z.union([z.string(), z.boolean()]),
36
- }),
37
- response: z.object({
38
- key: z.string(),
39
- value: z.union([z.string(), z.boolean()]),
40
- }),
41
- },
42
- } satisfies Record<string, EndpointContract>;
43
-
44
- export type SettingsEndpointKey = keyof typeof SettingsEndpoints;
45
-
46
- export type GetSettingsRequest<K extends SettingsEndpointKey> = z.infer<
47
- typeof SettingsEndpoints[K]["request"]
48
- >;
49
-
50
- export type GetSettingsResponse<K extends SettingsEndpointKey> = z.infer<
51
- typeof SettingsEndpoints[K]["response"]
52
- >;
@@ -1,3 +0,0 @@
1
- export * from "./read";
2
- export * from "./update";
3
- export * from "./endpoints";
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const SettingsReadResponseSchema = z.object({
4
- desslyDiscount: z.string(),
5
- serviceEnabled: z.boolean(),
6
- worksEnabled: z.boolean(),
7
- paymentsEnabled: z.boolean(),
8
- });
9
-
10
- export type SettingsReadResponse = z.infer<typeof SettingsReadResponseSchema>;
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const SettingsUpdateRequestSchema = z.object({
4
- desslyDiscount: z.string().optional(),
5
- serviceEnabled: z.boolean().optional(),
6
- worksEnabled: z.boolean().optional(),
7
- paymentsEnabled: z.boolean().optional(),
8
- });
9
-
10
- export type SettingsUpdateRequest = z.infer<typeof SettingsUpdateRequestSchema>;
@@ -1,23 +0,0 @@
1
- import { z } from "zod";
2
- import { EndpointContract } from "../../types";
3
- import { StatsReadResponseSchema } from "./read";
4
- import { StatsReadRequestSchema } from "./query";
5
-
6
-
7
-
8
- export const StatsEndpoints = {
9
- list: {
10
- method: "GET",
11
- path: "/stats",
12
- request: StatsReadRequestSchema,
13
- response: StatsReadResponseSchema,
14
- },
15
- } satisfies Record<string, EndpointContract>;
16
-
17
- export type StatsEndpointKey = keyof typeof StatsEndpoints;
18
-
19
- export type GetStatsRequest<K extends StatsEndpointKey> =
20
- z.infer<typeof StatsEndpoints[K]["request"]>;
21
-
22
- export type GetStatsResponse<K extends StatsEndpointKey> =
23
- z.infer<typeof StatsEndpoints[K]["response"]>;
@@ -1,3 +0,0 @@
1
- export * from "./read";
2
- export * from "./query";
3
- export * from "./endpoints";
@@ -1,18 +0,0 @@
1
- import z from "zod";
2
-
3
- export const StatsReadRequestSchema = z
4
- .object({
5
- period: z.enum(["day", "week", "month", "year", "custom"]).default("day"),
6
- start: z.string().datetime().optional(),
7
- end: z.string().datetime().optional(),
8
- })
9
- .refine(
10
- v => v.period !== "custom" || (v.start && v.end),
11
- { message: "from/to обязательны при period=custom" }
12
- )
13
- .refine(
14
- v => v.period !== "custom" || (new Date(v.start!) < new Date(v.end!)),
15
- { message: "from должен быть раньше to" }
16
- );
17
-
18
- export type StatsReadRequest = z.infer<typeof StatsReadRequestSchema>;
@@ -1,14 +0,0 @@
1
- import z from "zod";
2
-
3
- export const StatsReadResponseSchema = z.object({
4
- usersCount: z.coerce.number().nonnegative(),
5
- ordersCount: z.coerce.number().nonnegative(),
6
- totalAmount: z.coerce.number().nonnegative(),
7
- acquiringCommission: z.coerce.number().nonnegative(),
8
- serviceCommission: z.coerce.number().nonnegative(),
9
- totalAmountWithCommission: z.coerce.number().nonnegative(),
10
- periodStart: z.string().datetime().optional(),
11
- periodEnd: z.string().datetime().optional(),
12
- });
13
-
14
- export type StatsReadResponse = z.infer<typeof StatsReadResponseSchema>;
@@ -1,19 +0,0 @@
1
- import { z } from "zod";
2
- import { UserRoleEnum, UserStatusEnum } from "./enums";
3
-
4
- export const UserCreateSchema = z.object({
5
- username: z.string().nullable().optional(),
6
- picture: z.string().nullable().optional(),
7
- email: z.string(),
8
- password: z.string().nullable().optional(),
9
- steamId: z.string().nullable().optional(),
10
- telegramId: z.string().nullable().optional(),
11
- vkId: z.string().nullable().optional(),
12
- googleId: z.string().nullable().optional(),
13
- isConfirmEmail: z.boolean().optional(),
14
- role: UserRoleEnum,
15
- status: UserStatusEnum,
16
- utmSource: z.string().nullable().optional(),
17
- });
18
-
19
- export type UserCreate = z.infer<typeof UserCreateSchema>;
@@ -1,47 +0,0 @@
1
- import { z } from "zod";
2
- import { EndpointContract } from "../../types";
3
- import { UserCreateSchema } from "./create";
4
- import { UserReadResponseSchema } from "./read";
5
- import { UserUpdateSchema } from "./update";
6
- import { UsersListQuerySchema } from "./query";
7
-
8
- export const UserEndpoints = {
9
- create: {
10
- method: "POST",
11
- path: "/users",
12
- request: UserCreateSchema,
13
- response: UserReadResponseSchema,
14
- },
15
- list: {
16
- method: "GET",
17
- path: "/users",
18
- request: UsersListQuerySchema,
19
- response: z.array(UserReadResponseSchema),
20
- },
21
- getById: {
22
- method: "GET",
23
- path: "/users/:id",
24
- request: z.object({
25
- id: z.coerce.number().positive(),
26
- }),
27
- response: UserReadResponseSchema,
28
- },
29
- update: {
30
- method: "PATCH",
31
- path: "/users/:id",
32
- request: z.object({
33
- id: z.coerce.number().positive(),
34
- body: UserUpdateSchema,
35
- }),
36
- response: UserReadResponseSchema,
37
- },
38
-
39
- } satisfies Record<string, EndpointContract>;
40
-
41
- export type UserEndpointKey = keyof typeof UserEndpoints;
42
-
43
- export type GetUserRequest<K extends UserEndpointKey> =
44
- z.infer<typeof UserEndpoints[K]["request"]>;
45
-
46
- export type GetUserResponse<K extends UserEndpointKey> =
47
- z.infer<typeof UserEndpoints[K]["response"]>;
@@ -1,10 +0,0 @@
1
- import z from "zod";
2
-
3
- export const UserRoleEnum = z.enum(["USER", "ADMIN", "NO_AUTH"]);
4
- export const UserStatusEnum = z.enum(["ACTIVE", "BLOCKED"]);
5
- export const SocialProviderEnum = z.enum(["GOOGLE", "STEAM"]);
6
-
7
- export type UserRoleType = z.infer<typeof UserRoleEnum>;
8
- export type UserStatusType = z.infer<typeof UserStatusEnum>;
9
-
10
-
@@ -1,6 +0,0 @@
1
- export * from "./create"
2
- export * from "./read"
3
- export * from "./update"
4
- export * from "./query"
5
- export * from "./enums"
6
- export * from "./endpoints"
@@ -1,20 +0,0 @@
1
- import z from "zod";
2
- import { PaginationQuery } from "../pagination";
3
- import { UserRoleEnum } from "./enums";
4
-
5
- export const UsersFiltersSchema = z.object({
6
- email: z.string().email().optional(),
7
- id: z.coerce.number().optional(),
8
- role: UserRoleEnum.optional(),
9
- });
10
-
11
- export const UsersSortSchema = z.object({
12
- sortBy: z.string().default("orderAmount"),
13
- sortDir: z.enum(["asc", "desc"]).default("desc"),
14
- });
15
-
16
- export const UsersListQuerySchema = PaginationQuery
17
- .merge(UsersFiltersSchema)
18
- .merge(UsersSortSchema)
19
-
20
- export type UsersListQuery = z.infer<typeof UsersListQuerySchema>;
@@ -1,25 +0,0 @@
1
- import z from "zod";
2
- import { UserRoleEnum, UserStatusEnum } from "./enums";
3
-
4
- export const UserReadResponseSchema = z.object({
5
- id: z.coerce.number().positive(),
6
- username: z.string().nullable(),
7
- picture: z.string().nullable(),
8
- email: z.string().nullable(),
9
- steamId: z.string().nullable(),
10
- telegramId: z.string().nullable(),
11
- password: z.string().nullable(),
12
- vkId: z.string().nullable(),
13
- googleId: z.string().nullable(),
14
- createdAt: z.coerce.date().nullable().optional(),
15
- updatedAt: z.coerce.date().nullable().optional(),
16
- blockedAt: z.coerce.date().nullable().optional(),
17
- ordersCount: z.coerce.number().nonnegative().optional(),
18
- ordersAmount: z.coerce.number().nonnegative().optional(),
19
- isConfirmEmail: z.boolean(),
20
- isOnline: z.boolean(),
21
- role: UserRoleEnum,
22
- status: UserStatusEnum,
23
- });
24
-
25
- export type UserReadResponse = z.infer<typeof UserReadResponseSchema>;
@@ -1,19 +0,0 @@
1
- import { z } from "zod";
2
- import { SocialProviderEnum, UserRoleEnum, UserStatusEnum } from "./enums";
3
-
4
- export const UserUpdateSchema = z.object({
5
- username: z.string().nullable().optional(),
6
- picture: z.string().nullable().optional(),
7
- email: z.string().optional(),
8
- password: z.string().nullable().optional(),
9
- provider: SocialProviderEnum.optional(),
10
- steamId: z.string().optional(),
11
- telegramId: z.string().optional(),
12
- vkId: z.string().optional(),
13
- googleId: z.string().optional(),
14
- isConfirmEmail: z.boolean().optional(),
15
- role: UserRoleEnum.optional(),
16
- status: UserStatusEnum.optional(),
17
- });
18
-
19
- export type UserUpdate = z.infer<typeof UserUpdateSchema>;
package/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./commands"