@gigapay-dev/contracts 3.7.0 → 3.9.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.
@@ -54,10 +54,201 @@ export declare const ImportKeysRequestSchema: z.ZodObject<{
54
54
  keys: z.ZodArray<z.ZodString>;
55
55
  }, z.core.$strip>;
56
56
  export type ImportKeysRequest = z.infer<typeof ImportKeysRequestSchema>;
57
+ /** Частичное обновление карточки: присылаются только изменённые поля. */
58
+ export declare const UpdateProductRequestSchema: z.ZodObject<{
59
+ title: z.ZodOptional<z.ZodString>;
60
+ originalTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ type: z.ZodOptional<z.ZodEnum<{
62
+ GAME_KEY: "GAME_KEY";
63
+ GAME_GIFT: "GAME_GIFT";
64
+ TOPUP: "TOPUP";
65
+ SUBSCRIPTION: "SUBSCRIPTION";
66
+ IN_GAME_ITEM: "IN_GAME_ITEM";
67
+ DLC: "DLC";
68
+ CURRENCY: "CURRENCY";
69
+ VOUCHER: "VOUCHER";
70
+ }>>;
71
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ shortDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ coverImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
74
+ catalogImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
75
+ cardImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
76
+ basePriceUsd: z.ZodOptional<z.ZodString>;
77
+ steamAppId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
78
+ categoryId: z.ZodOptional<z.ZodNumber>;
79
+ }, z.core.$strip>;
80
+ export type UpdateProductRequest = z.infer<typeof UpdateProductRequestSchema>;
81
+ export declare const ProductMediaInputSchema: z.ZodObject<{
82
+ type: z.ZodEnum<{
83
+ IMAGE: "IMAGE";
84
+ VIDEO: "VIDEO";
85
+ }>;
86
+ url: z.ZodURL;
87
+ thumbnailUrl: z.ZodOptional<z.ZodURL>;
88
+ }, z.core.$strip>;
89
+ export type ProductMediaInput = z.infer<typeof ProductMediaInputSchema>;
90
+ /**
91
+ * Галерея заменяется целиком: порядок элементов в массиве и есть порядок
92
+ * в слайдере. Так переупорядочивание — это один запрос без diff-логики.
93
+ */
94
+ export declare const ReplaceProductMediaRequestSchema: z.ZodObject<{
95
+ items: z.ZodArray<z.ZodObject<{
96
+ type: z.ZodEnum<{
97
+ IMAGE: "IMAGE";
98
+ VIDEO: "VIDEO";
99
+ }>;
100
+ url: z.ZodURL;
101
+ thumbnailUrl: z.ZodOptional<z.ZodURL>;
102
+ }, z.core.$strip>>;
103
+ }, z.core.$strip>;
104
+ export type ReplaceProductMediaRequest = z.infer<typeof ReplaceProductMediaRequestSchema>;
57
105
  export declare const SetVariantMarginRequestSchema: z.ZodObject<{
58
106
  marginPct: z.ZodString;
59
107
  }, z.core.$strip>;
60
108
  export type SetVariantMarginRequest = z.infer<typeof SetVariantMarginRequestSchema>;
109
+ /** Массовый импорт каталога Steam Gift из Dessly. */
110
+ export declare const ImportSteamGiftRequestSchema: z.ZodObject<{
111
+ regions: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
+ marginPct: z.ZodOptional<z.ZodString>;
113
+ limit: z.ZodOptional<z.ZodNumber>;
114
+ dryRun: z.ZodOptional<z.ZodBoolean>;
115
+ }, z.core.$strip>;
116
+ export type ImportSteamGiftRequest = z.infer<typeof ImportSteamGiftRequestSchema>;
117
+ export declare const CatalogImportStatsSchema: z.ZodObject<{
118
+ productsCreated: z.ZodNumber;
119
+ productsUpdated: z.ZodNumber;
120
+ variantsCreated: z.ZodNumber;
121
+ variantsUpdated: z.ZodNumber;
122
+ gamesSkipped: z.ZodNumber;
123
+ errors: z.ZodNumber;
124
+ }, z.core.$strip>;
125
+ export type CatalogImportStats = z.infer<typeof CatalogImportStatsSchema>;
126
+ export declare const CatalogImportRunSchema: z.ZodObject<{
127
+ id: z.ZodString;
128
+ source: z.ZodString;
129
+ status: z.ZodEnum<{
130
+ SUCCESS: "SUCCESS";
131
+ FAILED: "FAILED";
132
+ RUNNING: "RUNNING";
133
+ }>;
134
+ triggeredBy: z.ZodString;
135
+ dryRun: z.ZodBoolean;
136
+ totalGames: z.ZodNumber;
137
+ processedGames: z.ZodNumber;
138
+ stats: z.ZodNullable<z.ZodObject<{
139
+ productsCreated: z.ZodNumber;
140
+ productsUpdated: z.ZodNumber;
141
+ variantsCreated: z.ZodNumber;
142
+ variantsUpdated: z.ZodNumber;
143
+ gamesSkipped: z.ZodNumber;
144
+ errors: z.ZodNumber;
145
+ }, z.core.$strip>>;
146
+ errorMessage: z.ZodNullable<z.ZodString>;
147
+ startedAt: z.ZodString;
148
+ finishedAt: z.ZodNullable<z.ZodString>;
149
+ }, z.core.$strip>;
150
+ export type CatalogImportRun = z.infer<typeof CatalogImportRunSchema>;
151
+ export declare const ImportSteamGiftEndpoint: {
152
+ readonly method: "POST";
153
+ readonly path: "/api/admin/products/import/steam-gift";
154
+ readonly request: z.ZodObject<{
155
+ regions: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ marginPct: z.ZodOptional<z.ZodString>;
157
+ limit: z.ZodOptional<z.ZodNumber>;
158
+ dryRun: z.ZodOptional<z.ZodBoolean>;
159
+ }, z.core.$strip>;
160
+ readonly response: z.ZodObject<{
161
+ id: z.ZodString;
162
+ source: z.ZodString;
163
+ status: z.ZodEnum<{
164
+ SUCCESS: "SUCCESS";
165
+ FAILED: "FAILED";
166
+ RUNNING: "RUNNING";
167
+ }>;
168
+ triggeredBy: z.ZodString;
169
+ dryRun: z.ZodBoolean;
170
+ totalGames: z.ZodNumber;
171
+ processedGames: z.ZodNumber;
172
+ stats: z.ZodNullable<z.ZodObject<{
173
+ productsCreated: z.ZodNumber;
174
+ productsUpdated: z.ZodNumber;
175
+ variantsCreated: z.ZodNumber;
176
+ variantsUpdated: z.ZodNumber;
177
+ gamesSkipped: z.ZodNumber;
178
+ errors: z.ZodNumber;
179
+ }, z.core.$strip>>;
180
+ errorMessage: z.ZodNullable<z.ZodString>;
181
+ startedAt: z.ZodString;
182
+ finishedAt: z.ZodNullable<z.ZodString>;
183
+ }, z.core.$strip>;
184
+ readonly requiresAuth: true;
185
+ readonly requiresAdmin: true;
186
+ };
187
+ export declare const GetCatalogImportRunEndpoint: {
188
+ readonly method: "GET";
189
+ readonly path: "/api/admin/products/import/runs/:id";
190
+ readonly params: z.ZodObject<{
191
+ id: z.ZodString;
192
+ }, z.core.$strip>;
193
+ readonly response: z.ZodObject<{
194
+ id: z.ZodString;
195
+ source: z.ZodString;
196
+ status: z.ZodEnum<{
197
+ SUCCESS: "SUCCESS";
198
+ FAILED: "FAILED";
199
+ RUNNING: "RUNNING";
200
+ }>;
201
+ triggeredBy: z.ZodString;
202
+ dryRun: z.ZodBoolean;
203
+ totalGames: z.ZodNumber;
204
+ processedGames: z.ZodNumber;
205
+ stats: z.ZodNullable<z.ZodObject<{
206
+ productsCreated: z.ZodNumber;
207
+ productsUpdated: z.ZodNumber;
208
+ variantsCreated: z.ZodNumber;
209
+ variantsUpdated: z.ZodNumber;
210
+ gamesSkipped: z.ZodNumber;
211
+ errors: z.ZodNumber;
212
+ }, z.core.$strip>>;
213
+ errorMessage: z.ZodNullable<z.ZodString>;
214
+ startedAt: z.ZodString;
215
+ finishedAt: z.ZodNullable<z.ZodString>;
216
+ }, z.core.$strip>;
217
+ readonly requiresAuth: true;
218
+ readonly requiresAdmin: true;
219
+ };
220
+ export declare const ListCatalogImportRunsEndpoint: {
221
+ readonly method: "GET";
222
+ readonly path: "/api/admin/products/import/runs";
223
+ readonly response: z.ZodObject<{
224
+ runs: z.ZodArray<z.ZodObject<{
225
+ id: z.ZodString;
226
+ source: z.ZodString;
227
+ status: z.ZodEnum<{
228
+ SUCCESS: "SUCCESS";
229
+ FAILED: "FAILED";
230
+ RUNNING: "RUNNING";
231
+ }>;
232
+ triggeredBy: z.ZodString;
233
+ dryRun: z.ZodBoolean;
234
+ totalGames: z.ZodNumber;
235
+ processedGames: z.ZodNumber;
236
+ stats: z.ZodNullable<z.ZodObject<{
237
+ productsCreated: z.ZodNumber;
238
+ productsUpdated: z.ZodNumber;
239
+ variantsCreated: z.ZodNumber;
240
+ variantsUpdated: z.ZodNumber;
241
+ gamesSkipped: z.ZodNumber;
242
+ errors: z.ZodNumber;
243
+ }, z.core.$strip>>;
244
+ errorMessage: z.ZodNullable<z.ZodString>;
245
+ startedAt: z.ZodString;
246
+ finishedAt: z.ZodNullable<z.ZodString>;
247
+ }, z.core.$strip>>;
248
+ }, z.core.$strip>;
249
+ readonly requiresAuth: true;
250
+ readonly requiresAdmin: true;
251
+ };
61
252
  export declare const ParseSteamGameModeSchema: z.ZodEnum<{
62
253
  singleplayer: "singleplayer";
63
254
  multiplayer: "multiplayer";
@@ -166,6 +357,14 @@ export declare const ParseSteamResponseSchema: z.ZodObject<{
166
357
  background: z.ZodNullable<z.ZodString>;
167
358
  screenshots: z.ZodArray<z.ZodString>;
168
359
  }, z.core.$strip>;
360
+ gallery: z.ZodArray<z.ZodObject<{
361
+ type: z.ZodEnum<{
362
+ IMAGE: "IMAGE";
363
+ VIDEO: "VIDEO";
364
+ }>;
365
+ url: z.ZodURL;
366
+ thumbnailUrl: z.ZodOptional<z.ZodURL>;
367
+ }, z.core.$strip>>;
169
368
  appId: z.ZodNumber;
170
369
  slug: z.ZodString;
171
370
  title: z.ZodString;
@@ -355,6 +554,14 @@ export declare const ParseSteamEndpoint: {
355
554
  background: z.ZodNullable<z.ZodString>;
356
555
  screenshots: z.ZodArray<z.ZodString>;
357
556
  }, z.core.$strip>;
557
+ gallery: z.ZodArray<z.ZodObject<{
558
+ type: z.ZodEnum<{
559
+ IMAGE: "IMAGE";
560
+ VIDEO: "VIDEO";
561
+ }>;
562
+ url: z.ZodURL;
563
+ thumbnailUrl: z.ZodOptional<z.ZodURL>;
564
+ }, z.core.$strip>>;
358
565
  appId: z.ZodNumber;
359
566
  slug: z.ZodString;
360
567
  title: z.ZodString;
@@ -393,6 +600,71 @@ export declare const ParseSteamEndpoint: {
393
600
  readonly requiresAuth: true;
394
601
  readonly requiresAdmin: true;
395
602
  };
603
+ export declare const UpdateProductEndpoint: {
604
+ readonly method: "PUT";
605
+ readonly path: "/api/admin/products/:id";
606
+ readonly params: z.ZodObject<{
607
+ id: z.ZodCoercedNumber<unknown>;
608
+ }, z.core.$strip>;
609
+ readonly request: z.ZodObject<{
610
+ title: z.ZodOptional<z.ZodString>;
611
+ originalTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
612
+ type: z.ZodOptional<z.ZodEnum<{
613
+ GAME_KEY: "GAME_KEY";
614
+ GAME_GIFT: "GAME_GIFT";
615
+ TOPUP: "TOPUP";
616
+ SUBSCRIPTION: "SUBSCRIPTION";
617
+ IN_GAME_ITEM: "IN_GAME_ITEM";
618
+ DLC: "DLC";
619
+ CURRENCY: "CURRENCY";
620
+ VOUCHER: "VOUCHER";
621
+ }>>;
622
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
623
+ shortDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
624
+ coverImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
625
+ catalogImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
626
+ cardImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
627
+ basePriceUsd: z.ZodOptional<z.ZodString>;
628
+ steamAppId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
629
+ categoryId: z.ZodOptional<z.ZodNumber>;
630
+ }, z.core.$strip>;
631
+ readonly response: z.ZodObject<{
632
+ id: z.ZodNumber;
633
+ }, z.core.$strip>;
634
+ readonly requiresAuth: true;
635
+ readonly requiresAdmin: true;
636
+ };
637
+ export declare const ReplaceProductMediaEndpoint: {
638
+ readonly method: "PUT";
639
+ readonly path: "/api/admin/products/:id/media";
640
+ readonly params: z.ZodObject<{
641
+ id: z.ZodCoercedNumber<unknown>;
642
+ }, z.core.$strip>;
643
+ readonly request: z.ZodObject<{
644
+ items: z.ZodArray<z.ZodObject<{
645
+ type: z.ZodEnum<{
646
+ IMAGE: "IMAGE";
647
+ VIDEO: "VIDEO";
648
+ }>;
649
+ url: z.ZodURL;
650
+ thumbnailUrl: z.ZodOptional<z.ZodURL>;
651
+ }, z.core.$strip>>;
652
+ }, z.core.$strip>;
653
+ readonly response: z.ZodObject<{
654
+ media: z.ZodArray<z.ZodObject<{
655
+ id: z.ZodNumber;
656
+ type: z.ZodEnum<{
657
+ IMAGE: "IMAGE";
658
+ VIDEO: "VIDEO";
659
+ }>;
660
+ url: z.ZodString;
661
+ thumbnailUrl: z.ZodNullable<z.ZodString>;
662
+ sortOrder: z.ZodNumber;
663
+ }, z.core.$strip>>;
664
+ }, z.core.$strip>;
665
+ readonly requiresAuth: true;
666
+ readonly requiresAdmin: true;
667
+ };
396
668
  export declare const SetVariantMarginEndpoint: {
397
669
  readonly method: "PATCH";
398
670
  readonly path: "/api/admin/products/variants/:id/margin";
@@ -443,6 +715,71 @@ export declare const ProductCommands: {
443
715
  readonly requiresAuth: true;
444
716
  readonly requiresAdmin: true;
445
717
  };
718
+ readonly update: {
719
+ readonly method: "PUT";
720
+ readonly path: "/api/admin/products/:id";
721
+ readonly params: z.ZodObject<{
722
+ id: z.ZodCoercedNumber<unknown>;
723
+ }, z.core.$strip>;
724
+ readonly request: z.ZodObject<{
725
+ title: z.ZodOptional<z.ZodString>;
726
+ originalTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
727
+ type: z.ZodOptional<z.ZodEnum<{
728
+ GAME_KEY: "GAME_KEY";
729
+ GAME_GIFT: "GAME_GIFT";
730
+ TOPUP: "TOPUP";
731
+ SUBSCRIPTION: "SUBSCRIPTION";
732
+ IN_GAME_ITEM: "IN_GAME_ITEM";
733
+ DLC: "DLC";
734
+ CURRENCY: "CURRENCY";
735
+ VOUCHER: "VOUCHER";
736
+ }>>;
737
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
738
+ shortDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
739
+ coverImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
740
+ catalogImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
741
+ cardImageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
742
+ basePriceUsd: z.ZodOptional<z.ZodString>;
743
+ steamAppId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
744
+ categoryId: z.ZodOptional<z.ZodNumber>;
745
+ }, z.core.$strip>;
746
+ readonly response: z.ZodObject<{
747
+ id: z.ZodNumber;
748
+ }, z.core.$strip>;
749
+ readonly requiresAuth: true;
750
+ readonly requiresAdmin: true;
751
+ };
752
+ readonly replaceMedia: {
753
+ readonly method: "PUT";
754
+ readonly path: "/api/admin/products/:id/media";
755
+ readonly params: z.ZodObject<{
756
+ id: z.ZodCoercedNumber<unknown>;
757
+ }, z.core.$strip>;
758
+ readonly request: z.ZodObject<{
759
+ items: z.ZodArray<z.ZodObject<{
760
+ type: z.ZodEnum<{
761
+ IMAGE: "IMAGE";
762
+ VIDEO: "VIDEO";
763
+ }>;
764
+ url: z.ZodURL;
765
+ thumbnailUrl: z.ZodOptional<z.ZodURL>;
766
+ }, z.core.$strip>>;
767
+ }, z.core.$strip>;
768
+ readonly response: z.ZodObject<{
769
+ media: z.ZodArray<z.ZodObject<{
770
+ id: z.ZodNumber;
771
+ type: z.ZodEnum<{
772
+ IMAGE: "IMAGE";
773
+ VIDEO: "VIDEO";
774
+ }>;
775
+ url: z.ZodString;
776
+ thumbnailUrl: z.ZodNullable<z.ZodString>;
777
+ sortOrder: z.ZodNumber;
778
+ }, z.core.$strip>>;
779
+ }, z.core.$strip>;
780
+ readonly requiresAuth: true;
781
+ readonly requiresAdmin: true;
782
+ };
446
783
  readonly archive: {
447
784
  readonly method: "POST";
448
785
  readonly path: "/api/admin/products/:id/archive";
@@ -581,6 +918,14 @@ export declare const ProductCommands: {
581
918
  background: z.ZodNullable<z.ZodString>;
582
919
  screenshots: z.ZodArray<z.ZodString>;
583
920
  }, z.core.$strip>;
921
+ gallery: z.ZodArray<z.ZodObject<{
922
+ type: z.ZodEnum<{
923
+ IMAGE: "IMAGE";
924
+ VIDEO: "VIDEO";
925
+ }>;
926
+ url: z.ZodURL;
927
+ thumbnailUrl: z.ZodOptional<z.ZodURL>;
928
+ }, z.core.$strip>>;
584
929
  appId: z.ZodNumber;
585
930
  slug: z.ZodString;
586
931
  title: z.ZodString;
@@ -619,5 +964,106 @@ export declare const ProductCommands: {
619
964
  readonly requiresAuth: true;
620
965
  readonly requiresAdmin: true;
621
966
  };
967
+ readonly importSteamGift: {
968
+ readonly method: "POST";
969
+ readonly path: "/api/admin/products/import/steam-gift";
970
+ readonly request: z.ZodObject<{
971
+ regions: z.ZodOptional<z.ZodArray<z.ZodString>>;
972
+ marginPct: z.ZodOptional<z.ZodString>;
973
+ limit: z.ZodOptional<z.ZodNumber>;
974
+ dryRun: z.ZodOptional<z.ZodBoolean>;
975
+ }, z.core.$strip>;
976
+ readonly response: z.ZodObject<{
977
+ id: z.ZodString;
978
+ source: z.ZodString;
979
+ status: z.ZodEnum<{
980
+ SUCCESS: "SUCCESS";
981
+ FAILED: "FAILED";
982
+ RUNNING: "RUNNING";
983
+ }>;
984
+ triggeredBy: z.ZodString;
985
+ dryRun: z.ZodBoolean;
986
+ totalGames: z.ZodNumber;
987
+ processedGames: z.ZodNumber;
988
+ stats: z.ZodNullable<z.ZodObject<{
989
+ productsCreated: z.ZodNumber;
990
+ productsUpdated: z.ZodNumber;
991
+ variantsCreated: z.ZodNumber;
992
+ variantsUpdated: z.ZodNumber;
993
+ gamesSkipped: z.ZodNumber;
994
+ errors: z.ZodNumber;
995
+ }, z.core.$strip>>;
996
+ errorMessage: z.ZodNullable<z.ZodString>;
997
+ startedAt: z.ZodString;
998
+ finishedAt: z.ZodNullable<z.ZodString>;
999
+ }, z.core.$strip>;
1000
+ readonly requiresAuth: true;
1001
+ readonly requiresAdmin: true;
1002
+ };
1003
+ readonly getImportRun: {
1004
+ readonly method: "GET";
1005
+ readonly path: "/api/admin/products/import/runs/:id";
1006
+ readonly params: z.ZodObject<{
1007
+ id: z.ZodString;
1008
+ }, z.core.$strip>;
1009
+ readonly response: z.ZodObject<{
1010
+ id: z.ZodString;
1011
+ source: z.ZodString;
1012
+ status: z.ZodEnum<{
1013
+ SUCCESS: "SUCCESS";
1014
+ FAILED: "FAILED";
1015
+ RUNNING: "RUNNING";
1016
+ }>;
1017
+ triggeredBy: z.ZodString;
1018
+ dryRun: z.ZodBoolean;
1019
+ totalGames: z.ZodNumber;
1020
+ processedGames: z.ZodNumber;
1021
+ stats: z.ZodNullable<z.ZodObject<{
1022
+ productsCreated: z.ZodNumber;
1023
+ productsUpdated: z.ZodNumber;
1024
+ variantsCreated: z.ZodNumber;
1025
+ variantsUpdated: z.ZodNumber;
1026
+ gamesSkipped: z.ZodNumber;
1027
+ errors: z.ZodNumber;
1028
+ }, z.core.$strip>>;
1029
+ errorMessage: z.ZodNullable<z.ZodString>;
1030
+ startedAt: z.ZodString;
1031
+ finishedAt: z.ZodNullable<z.ZodString>;
1032
+ }, z.core.$strip>;
1033
+ readonly requiresAuth: true;
1034
+ readonly requiresAdmin: true;
1035
+ };
1036
+ readonly listImportRuns: {
1037
+ readonly method: "GET";
1038
+ readonly path: "/api/admin/products/import/runs";
1039
+ readonly response: z.ZodObject<{
1040
+ runs: z.ZodArray<z.ZodObject<{
1041
+ id: z.ZodString;
1042
+ source: z.ZodString;
1043
+ status: z.ZodEnum<{
1044
+ SUCCESS: "SUCCESS";
1045
+ FAILED: "FAILED";
1046
+ RUNNING: "RUNNING";
1047
+ }>;
1048
+ triggeredBy: z.ZodString;
1049
+ dryRun: z.ZodBoolean;
1050
+ totalGames: z.ZodNumber;
1051
+ processedGames: z.ZodNumber;
1052
+ stats: z.ZodNullable<z.ZodObject<{
1053
+ productsCreated: z.ZodNumber;
1054
+ productsUpdated: z.ZodNumber;
1055
+ variantsCreated: z.ZodNumber;
1056
+ variantsUpdated: z.ZodNumber;
1057
+ gamesSkipped: z.ZodNumber;
1058
+ errors: z.ZodNumber;
1059
+ }, z.core.$strip>>;
1060
+ errorMessage: z.ZodNullable<z.ZodString>;
1061
+ startedAt: z.ZodString;
1062
+ finishedAt: z.ZodNullable<z.ZodString>;
1063
+ }, z.core.$strip>>;
1064
+ }, z.core.$strip>;
1065
+ readonly requiresAuth: true;
1066
+ readonly requiresAdmin: true;
1067
+ };
622
1068
  };
623
1069
  //# sourceMappingURL=commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/domains/products/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;iBAcrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;iBAerC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,6BAA6B;;iBAIxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,wBAAwB;;;;EAAmD,CAAC;AACzF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,uBAAuB;;;;;;;;;iBAWlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAalB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductCommands = exports.SetVariantMarginEndpoint = exports.ParseSteamEndpoint = exports.ImportKeysEndpoint = exports.CreateVariantEndpoint = exports.PublishProductEndpoint = exports.ArchiveProductEndpoint = exports.CreateProductEndpoint = exports.ParseSteamResponseSchema = exports.SteamImageSetSchema = exports.SteamImageVariantSchema = exports.ParseSteamEditionSchema = exports.ParseSteamGameModeSchema = exports.SetVariantMarginRequestSchema = exports.ImportKeysRequestSchema = exports.CreateVariantRequestSchema = exports.CreateProductRequestSchema = void 0;
3
+ exports.ProductCommands = exports.SetVariantMarginEndpoint = exports.ReplaceProductMediaEndpoint = exports.UpdateProductEndpoint = exports.ParseSteamEndpoint = exports.ImportKeysEndpoint = exports.CreateVariantEndpoint = exports.PublishProductEndpoint = exports.ArchiveProductEndpoint = exports.CreateProductEndpoint = exports.ParseSteamResponseSchema = exports.SteamImageSetSchema = exports.SteamImageVariantSchema = exports.ParseSteamEditionSchema = exports.ParseSteamGameModeSchema = exports.ListCatalogImportRunsEndpoint = exports.GetCatalogImportRunEndpoint = exports.ImportSteamGiftEndpoint = exports.CatalogImportRunSchema = exports.CatalogImportStatsSchema = exports.ImportSteamGiftRequestSchema = exports.SetVariantMarginRequestSchema = exports.ReplaceProductMediaRequestSchema = exports.ProductMediaInputSchema = exports.UpdateProductRequestSchema = exports.ImportKeysRequestSchema = exports.CreateVariantRequestSchema = exports.CreateProductRequestSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const common_1 = require("../../shared/common");
6
6
  const money_1 = require("../../shared/money");
@@ -39,11 +39,98 @@ exports.CreateVariantRequestSchema = zod_1.z.object({
39
39
  exports.ImportKeysRequestSchema = zod_1.z.object({
40
40
  keys: zod_1.z.array(zod_1.z.string().min(1)).min(1).max(10_000),
41
41
  });
42
+ /** Частичное обновление карточки: присылаются только изменённые поля. */
43
+ exports.UpdateProductRequestSchema = zod_1.z
44
+ .object({
45
+ title: zod_1.z.string().min(1).max(256),
46
+ originalTitle: zod_1.z.string().max(256).nullable(),
47
+ type: dtos_1.ProductTypeSchema,
48
+ description: zod_1.z.string().max(65_536).nullable(),
49
+ shortDescription: zod_1.z.string().max(2048).nullable(),
50
+ coverImageUrl: zod_1.z.url().nullable(),
51
+ catalogImageUrl: zod_1.z.url().nullable(),
52
+ cardImageUrl: zod_1.z.url().nullable(),
53
+ basePriceUsd: money_1.MoneyAmountSchema,
54
+ steamAppId: zod_1.z.number().int().positive().nullable(),
55
+ /** Смена категории переносит товар в другой раздел каталога. */
56
+ categoryId: zod_1.z.number().int().positive(),
57
+ })
58
+ .partial();
59
+ exports.ProductMediaInputSchema = zod_1.z.object({
60
+ type: dtos_1.ProductMediaTypeSchema,
61
+ url: zod_1.z.url(),
62
+ thumbnailUrl: zod_1.z.url().optional(),
63
+ });
64
+ /**
65
+ * Галерея заменяется целиком: порядок элементов в массиве и есть порядок
66
+ * в слайдере. Так переупорядочивание — это один запрос без diff-логики.
67
+ */
68
+ exports.ReplaceProductMediaRequestSchema = zod_1.z.object({
69
+ items: zod_1.z.array(exports.ProductMediaInputSchema).max(60),
70
+ });
42
71
  exports.SetVariantMarginRequestSchema = zod_1.z.object({
43
72
  marginPct: zod_1.z
44
73
  .string()
45
74
  .regex(/^\d+(\.\d+)?$/, "expected decimal string without sign, e.g. '10' or '12.5'"),
46
75
  });
76
+ /** Массовый импорт каталога Steam Gift из Dessly. */
77
+ exports.ImportSteamGiftRequestSchema = zod_1.z.object({
78
+ /** Регионы изданий, которые заводим как варианты. По умолчанию — ходовые дешёвые. */
79
+ regions: zod_1.z.array(zod_1.z.string().min(2).max(8)).min(1).max(50).optional(),
80
+ /** Маржа для НОВЫХ вариантов; у существующих не трогается. */
81
+ marginPct: zod_1.z
82
+ .string()
83
+ .regex(/^\d+(\.\d+)?$/, "expected decimal string without sign")
84
+ .optional(),
85
+ /** Ограничить число игр — удобно для пробного прогона. */
86
+ limit: zod_1.z.number().int().positive().max(5_000).optional(),
87
+ /** Ничего не писать в БД, только посчитать что будет создано. */
88
+ dryRun: zod_1.z.boolean().optional(),
89
+ });
90
+ exports.CatalogImportStatsSchema = zod_1.z.object({
91
+ productsCreated: zod_1.z.number().int().nonnegative(),
92
+ productsUpdated: zod_1.z.number().int().nonnegative(),
93
+ variantsCreated: zod_1.z.number().int().nonnegative(),
94
+ variantsUpdated: zod_1.z.number().int().nonnegative(),
95
+ gamesSkipped: zod_1.z.number().int().nonnegative(),
96
+ errors: zod_1.z.number().int().nonnegative(),
97
+ });
98
+ exports.CatalogImportRunSchema = zod_1.z.object({
99
+ id: zod_1.z.string(),
100
+ source: zod_1.z.string(),
101
+ status: zod_1.z.enum(["RUNNING", "SUCCESS", "FAILED"]),
102
+ triggeredBy: zod_1.z.string(),
103
+ dryRun: zod_1.z.boolean(),
104
+ totalGames: zod_1.z.number().int().nonnegative(),
105
+ processedGames: zod_1.z.number().int().nonnegative(),
106
+ stats: exports.CatalogImportStatsSchema.nullable(),
107
+ errorMessage: zod_1.z.string().nullable(),
108
+ startedAt: zod_1.z.string(),
109
+ finishedAt: zod_1.z.string().nullable(),
110
+ });
111
+ exports.ImportSteamGiftEndpoint = {
112
+ method: "POST",
113
+ path: "/api/admin/products/import/steam-gift",
114
+ request: exports.ImportSteamGiftRequestSchema,
115
+ response: exports.CatalogImportRunSchema,
116
+ requiresAuth: true,
117
+ requiresAdmin: true,
118
+ };
119
+ exports.GetCatalogImportRunEndpoint = {
120
+ method: "GET",
121
+ path: "/api/admin/products/import/runs/:id",
122
+ params: zod_1.z.object({ id: zod_1.z.string() }),
123
+ response: exports.CatalogImportRunSchema,
124
+ requiresAuth: true,
125
+ requiresAdmin: true,
126
+ };
127
+ exports.ListCatalogImportRunsEndpoint = {
128
+ method: "GET",
129
+ path: "/api/admin/products/import/runs",
130
+ response: zod_1.z.object({ runs: zod_1.z.array(exports.CatalogImportRunSchema) }),
131
+ requiresAuth: true,
132
+ requiresAdmin: true,
133
+ };
47
134
  exports.ParseSteamGameModeSchema = zod_1.z.enum(["singleplayer", "multiplayer", "co-op"]);
48
135
  exports.ParseSteamEditionSchema = zod_1.z.object({
49
136
  edition: zod_1.z.string(),
@@ -81,6 +168,12 @@ exports.SteamImageSetSchema = zod_1.z.object({
81
168
  });
82
169
  exports.ParseSteamResponseSchema = zod_1.z.object({
83
170
  images: exports.SteamImageSetSchema,
171
+ /**
172
+ * Готовая галерея для слайдера: трейлеры идут первыми, затем скриншоты.
173
+ * Формат совпадает с телом `PUT /api/admin/products/:id/media` — можно
174
+ * отправить как есть либо предварительно переставить.
175
+ */
176
+ gallery: zod_1.z.array(exports.ProductMediaInputSchema),
84
177
  appId: zod_1.z.number().int().positive(),
85
178
  slug: zod_1.z.string(),
86
179
  title: zod_1.z.string(),
@@ -149,6 +242,24 @@ exports.ParseSteamEndpoint = {
149
242
  requiresAuth: true,
150
243
  requiresAdmin: true,
151
244
  };
245
+ exports.UpdateProductEndpoint = {
246
+ method: "PUT",
247
+ path: "/api/admin/products/:id",
248
+ params: common_1.IdParamSchema,
249
+ request: exports.UpdateProductRequestSchema,
250
+ response: zod_1.z.object({ id: zod_1.z.number().int().positive() }),
251
+ requiresAuth: true,
252
+ requiresAdmin: true,
253
+ };
254
+ exports.ReplaceProductMediaEndpoint = {
255
+ method: "PUT",
256
+ path: "/api/admin/products/:id/media",
257
+ params: common_1.IdParamSchema,
258
+ request: exports.ReplaceProductMediaRequestSchema,
259
+ response: zod_1.z.object({ media: zod_1.z.array(dtos_1.ProductMediaSchema) }),
260
+ requiresAuth: true,
261
+ requiresAdmin: true,
262
+ };
152
263
  exports.SetVariantMarginEndpoint = {
153
264
  method: "PATCH",
154
265
  path: "/api/admin/products/variants/:id/margin",
@@ -160,11 +271,16 @@ exports.SetVariantMarginEndpoint = {
160
271
  };
161
272
  exports.ProductCommands = {
162
273
  create: exports.CreateProductEndpoint,
274
+ update: exports.UpdateProductEndpoint,
275
+ replaceMedia: exports.ReplaceProductMediaEndpoint,
163
276
  archive: exports.ArchiveProductEndpoint,
164
277
  publish: exports.PublishProductEndpoint,
165
278
  createVariant: exports.CreateVariantEndpoint,
166
279
  importKeys: exports.ImportKeysEndpoint,
167
280
  setVariantMargin: exports.SetVariantMarginEndpoint,
168
281
  parseSteam: exports.ParseSteamEndpoint,
282
+ importSteamGift: exports.ImportSteamGiftEndpoint,
283
+ getImportRun: exports.GetCatalogImportRunEndpoint,
284
+ listImportRuns: exports.ListCatalogImportRunsEndpoint,
169
285
  };
170
286
  //# sourceMappingURL=commands.js.map