@purpleschool/multisite 0.0.7 → 0.0.9

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 (84) hide show
  1. package/api/controller/http/product.ts +1 -0
  2. package/api/controller/http/subscription.ts +3 -0
  3. package/api/controller/http/unregistered-user.ts +4 -0
  4. package/api/controller/http/user.ts +1 -0
  5. package/api/routes.ts +7 -0
  6. package/build/api/controller/http/product.d.ts +1 -0
  7. package/build/api/controller/http/product.d.ts.map +1 -1
  8. package/build/api/controller/http/product.js +1 -0
  9. package/build/api/controller/http/subscription.d.ts +3 -0
  10. package/build/api/controller/http/subscription.d.ts.map +1 -1
  11. package/build/api/controller/http/subscription.js +3 -0
  12. package/build/api/controller/http/unregistered-user.d.ts +3 -0
  13. package/build/api/controller/http/unregistered-user.d.ts.map +1 -1
  14. package/build/api/controller/http/unregistered-user.js +4 -1
  15. package/build/api/controller/http/user.d.ts +1 -0
  16. package/build/api/controller/http/user.d.ts.map +1 -1
  17. package/build/api/controller/http/user.js +1 -0
  18. package/build/api/routes.d.ts +6 -0
  19. package/build/api/routes.d.ts.map +1 -1
  20. package/build/api/routes.js +6 -0
  21. package/build/commands/payment/cloud-payments.command.d.ts +10 -10
  22. package/build/commands/payment/cloud-payments.command.js +4 -4
  23. package/build/commands/subscription/cancel-subscription.command.d.ts +22 -0
  24. package/build/commands/subscription/cancel-subscription.command.d.ts.map +1 -0
  25. package/build/commands/subscription/cancel-subscription.command.js +14 -0
  26. package/build/commands/subscription/index.d.ts +1 -0
  27. package/build/commands/subscription/index.d.ts.map +1 -1
  28. package/build/commands/subscription/index.js +1 -0
  29. package/build/constants/cloud-payments/index.d.ts +2 -0
  30. package/build/constants/cloud-payments/index.d.ts.map +1 -0
  31. package/build/constants/cloud-payments/index.js +4 -0
  32. package/build/constants/errors/errors.d.ts +5 -0
  33. package/build/constants/errors/errors.d.ts.map +1 -1
  34. package/build/constants/errors/errors.js +5 -0
  35. package/build/constants/index.d.ts +1 -0
  36. package/build/constants/index.d.ts.map +1 -1
  37. package/build/constants/index.js +1 -0
  38. package/build/constants/user-to-subscription/enums/user-to-subscription-status.enum.d.ts +2 -1
  39. package/build/constants/user-to-subscription/enums/user-to-subscription-status.enum.d.ts.map +1 -1
  40. package/build/constants/user-to-subscription/enums/user-to-subscription-status.enum.js +1 -0
  41. package/build/queries/image-editor/find-image-editor-jobs.command.d.ts +3 -0
  42. package/build/queries/image-editor/find-image-editor-jobs.command.d.ts.map +1 -1
  43. package/build/queries/image-editor/find-image-editor-jobs.command.js +1 -0
  44. package/build/queries/image-generation/find-image-generation-jobs.command.d.ts +3 -0
  45. package/build/queries/image-generation/find-image-generation-jobs.command.d.ts.map +1 -1
  46. package/build/queries/image-generation/find-image-generation-jobs.command.js +1 -0
  47. package/build/queries/index.d.ts +1 -0
  48. package/build/queries/index.d.ts.map +1 -1
  49. package/build/queries/index.js +1 -0
  50. package/build/queries/subscription/get-subscriptions-summary.command.d.ts +308 -0
  51. package/build/queries/subscription/get-subscriptions-summary.command.d.ts.map +1 -0
  52. package/build/queries/subscription/get-subscriptions-summary.command.js +36 -0
  53. package/build/queries/subscription/index.d.ts +1 -0
  54. package/build/queries/subscription/index.d.ts.map +1 -1
  55. package/build/queries/subscription/index.js +1 -0
  56. package/build/queries/unregistered-user/get-unregistered-user-balance.command.d.ts +37 -0
  57. package/build/queries/unregistered-user/get-unregistered-user-balance.command.d.ts.map +1 -0
  58. package/build/queries/unregistered-user/get-unregistered-user-balance.command.js +15 -0
  59. package/build/queries/unregistered-user/index.d.ts +2 -0
  60. package/build/queries/unregistered-user/index.d.ts.map +1 -0
  61. package/build/queries/unregistered-user/index.js +17 -0
  62. package/build/queries/user/get-user-balance.command.d.ts +37 -0
  63. package/build/queries/user/get-user-balance.command.d.ts.map +1 -0
  64. package/build/queries/user/get-user-balance.command.js +15 -0
  65. package/build/queries/user/index.d.ts +1 -0
  66. package/build/queries/user/index.d.ts.map +1 -1
  67. package/build/queries/user/index.js +1 -0
  68. package/commands/payment/cloud-payments.command.ts +4 -4
  69. package/commands/subscription/cancel-subscription.command.ts +16 -0
  70. package/commands/subscription/index.ts +1 -0
  71. package/constants/cloud-payments/index.ts +1 -0
  72. package/constants/errors/errors.ts +5 -0
  73. package/constants/index.ts +1 -0
  74. package/constants/user-to-subscription/enums/user-to-subscription-status.enum.ts +1 -0
  75. package/package.json +1 -1
  76. package/queries/image-editor/find-image-editor-jobs.command.ts +1 -0
  77. package/queries/image-generation/find-image-generation-jobs.command.ts +1 -0
  78. package/queries/index.ts +1 -0
  79. package/queries/subscription/get-subscriptions-summary.command.ts +38 -0
  80. package/queries/subscription/index.ts +1 -0
  81. package/queries/unregistered-user/get-unregistered-user-balance.command.ts +14 -0
  82. package/queries/unregistered-user/index.ts +1 -0
  83. package/queries/user/get-user-balance.command.ts +14 -0
  84. package/queries/user/index.ts +1 -0
@@ -0,0 +1,308 @@
1
+ import { z } from 'zod';
2
+ import { USER_TO_SUBSCRIPTION_STATUS, USER_TO_PRODUCT_STATUS } from '../../constants';
3
+ export declare namespace GetSubscriptionsSummaryCommand {
4
+ const ResponseSchema: z.ZodObject<{
5
+ subscriptions: z.ZodArray<z.ZodObject<{
6
+ uuid: z.ZodString;
7
+ initTokenBalance: z.ZodNumber;
8
+ tokenBalance: z.ZodNumber;
9
+ carriedOverTokenBalance: z.ZodNumber;
10
+ status: z.ZodNativeEnum<typeof USER_TO_SUBSCRIPTION_STATUS>;
11
+ active: z.ZodBoolean;
12
+ createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
13
+ subscription: z.ZodObject<{
14
+ uuid: z.ZodString;
15
+ siteId: z.ZodString;
16
+ name: z.ZodString;
17
+ description: z.ZodString;
18
+ price: z.ZodNumber;
19
+ interval: z.ZodString;
20
+ period: z.ZodNumber;
21
+ tokens: z.ZodNumber;
22
+ discount: z.ZodNumber;
23
+ features: z.ZodArray<z.ZodObject<{
24
+ type: z.ZodString;
25
+ name: z.ZodString;
26
+ }, "strip", z.ZodTypeAny, {
27
+ type: string;
28
+ name: string;
29
+ }, {
30
+ type: string;
31
+ name: string;
32
+ }>, "many">;
33
+ carryoverPercent: z.ZodNumber;
34
+ }, "strip", z.ZodTypeAny, {
35
+ price: number;
36
+ uuid: string;
37
+ siteId: string;
38
+ name: string;
39
+ description: string;
40
+ tokens: number;
41
+ features: {
42
+ type: string;
43
+ name: string;
44
+ }[];
45
+ interval: string;
46
+ period: number;
47
+ discount: number;
48
+ carryoverPercent: number;
49
+ }, {
50
+ price: number;
51
+ uuid: string;
52
+ siteId: string;
53
+ name: string;
54
+ description: string;
55
+ tokens: number;
56
+ features: {
57
+ type: string;
58
+ name: string;
59
+ }[];
60
+ interval: string;
61
+ period: number;
62
+ discount: number;
63
+ carryoverPercent: number;
64
+ }>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ active: boolean;
67
+ uuid: string;
68
+ status: USER_TO_SUBSCRIPTION_STATUS;
69
+ createdAt: string | Date;
70
+ tokenBalance: number;
71
+ initTokenBalance: number;
72
+ carriedOverTokenBalance: number;
73
+ subscription: {
74
+ price: number;
75
+ uuid: string;
76
+ siteId: string;
77
+ name: string;
78
+ description: string;
79
+ tokens: number;
80
+ features: {
81
+ type: string;
82
+ name: string;
83
+ }[];
84
+ interval: string;
85
+ period: number;
86
+ discount: number;
87
+ carryoverPercent: number;
88
+ };
89
+ }, {
90
+ active: boolean;
91
+ uuid: string;
92
+ status: USER_TO_SUBSCRIPTION_STATUS;
93
+ createdAt: string | Date;
94
+ tokenBalance: number;
95
+ initTokenBalance: number;
96
+ carriedOverTokenBalance: number;
97
+ subscription: {
98
+ price: number;
99
+ uuid: string;
100
+ siteId: string;
101
+ name: string;
102
+ description: string;
103
+ tokens: number;
104
+ features: {
105
+ type: string;
106
+ name: string;
107
+ }[];
108
+ interval: string;
109
+ period: number;
110
+ discount: number;
111
+ carryoverPercent: number;
112
+ };
113
+ }>, "many">;
114
+ products: z.ZodArray<z.ZodObject<{
115
+ uuid: z.ZodString;
116
+ initTokenBalance: z.ZodNumber;
117
+ tokenBalance: z.ZodNumber;
118
+ status: z.ZodNativeEnum<typeof USER_TO_PRODUCT_STATUS>;
119
+ createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
120
+ product: z.ZodObject<{
121
+ uuid: z.ZodString;
122
+ siteId: z.ZodString;
123
+ name: z.ZodString;
124
+ description: z.ZodString;
125
+ tokens: z.ZodNumber;
126
+ price: z.ZodNumber;
127
+ features: z.ZodArray<z.ZodObject<{
128
+ type: z.ZodString;
129
+ name: z.ZodString;
130
+ }, "strip", z.ZodTypeAny, {
131
+ type: string;
132
+ name: string;
133
+ }, {
134
+ type: string;
135
+ name: string;
136
+ }>, "many">;
137
+ }, "strip", z.ZodTypeAny, {
138
+ price: number;
139
+ uuid: string;
140
+ siteId: string;
141
+ name: string;
142
+ description: string;
143
+ tokens: number;
144
+ features: {
145
+ type: string;
146
+ name: string;
147
+ }[];
148
+ }, {
149
+ price: number;
150
+ uuid: string;
151
+ siteId: string;
152
+ name: string;
153
+ description: string;
154
+ tokens: number;
155
+ features: {
156
+ type: string;
157
+ name: string;
158
+ }[];
159
+ }>;
160
+ }, "strip", z.ZodTypeAny, {
161
+ uuid: string;
162
+ status: USER_TO_PRODUCT_STATUS;
163
+ createdAt: string | Date;
164
+ tokenBalance: number;
165
+ initTokenBalance: number;
166
+ product: {
167
+ price: number;
168
+ uuid: string;
169
+ siteId: string;
170
+ name: string;
171
+ description: string;
172
+ tokens: number;
173
+ features: {
174
+ type: string;
175
+ name: string;
176
+ }[];
177
+ };
178
+ }, {
179
+ uuid: string;
180
+ status: USER_TO_PRODUCT_STATUS;
181
+ createdAt: string | Date;
182
+ tokenBalance: number;
183
+ initTokenBalance: number;
184
+ product: {
185
+ price: number;
186
+ uuid: string;
187
+ siteId: string;
188
+ name: string;
189
+ description: string;
190
+ tokens: number;
191
+ features: {
192
+ type: string;
193
+ name: string;
194
+ }[];
195
+ };
196
+ }>, "many">;
197
+ features: z.ZodArray<z.ZodObject<{
198
+ type: z.ZodString;
199
+ name: z.ZodString;
200
+ }, "strip", z.ZodTypeAny, {
201
+ type: string;
202
+ name: string;
203
+ }, {
204
+ type: string;
205
+ name: string;
206
+ }>, "many">;
207
+ }, "strip", z.ZodTypeAny, {
208
+ features: {
209
+ type: string;
210
+ name: string;
211
+ }[];
212
+ subscriptions: {
213
+ active: boolean;
214
+ uuid: string;
215
+ status: USER_TO_SUBSCRIPTION_STATUS;
216
+ createdAt: string | Date;
217
+ tokenBalance: number;
218
+ initTokenBalance: number;
219
+ carriedOverTokenBalance: number;
220
+ subscription: {
221
+ price: number;
222
+ uuid: string;
223
+ siteId: string;
224
+ name: string;
225
+ description: string;
226
+ tokens: number;
227
+ features: {
228
+ type: string;
229
+ name: string;
230
+ }[];
231
+ interval: string;
232
+ period: number;
233
+ discount: number;
234
+ carryoverPercent: number;
235
+ };
236
+ }[];
237
+ products: {
238
+ uuid: string;
239
+ status: USER_TO_PRODUCT_STATUS;
240
+ createdAt: string | Date;
241
+ tokenBalance: number;
242
+ initTokenBalance: number;
243
+ product: {
244
+ price: number;
245
+ uuid: string;
246
+ siteId: string;
247
+ name: string;
248
+ description: string;
249
+ tokens: number;
250
+ features: {
251
+ type: string;
252
+ name: string;
253
+ }[];
254
+ };
255
+ }[];
256
+ }, {
257
+ features: {
258
+ type: string;
259
+ name: string;
260
+ }[];
261
+ subscriptions: {
262
+ active: boolean;
263
+ uuid: string;
264
+ status: USER_TO_SUBSCRIPTION_STATUS;
265
+ createdAt: string | Date;
266
+ tokenBalance: number;
267
+ initTokenBalance: number;
268
+ carriedOverTokenBalance: number;
269
+ subscription: {
270
+ price: number;
271
+ uuid: string;
272
+ siteId: string;
273
+ name: string;
274
+ description: string;
275
+ tokens: number;
276
+ features: {
277
+ type: string;
278
+ name: string;
279
+ }[];
280
+ interval: string;
281
+ period: number;
282
+ discount: number;
283
+ carryoverPercent: number;
284
+ };
285
+ }[];
286
+ products: {
287
+ uuid: string;
288
+ status: USER_TO_PRODUCT_STATUS;
289
+ createdAt: string | Date;
290
+ tokenBalance: number;
291
+ initTokenBalance: number;
292
+ product: {
293
+ price: number;
294
+ uuid: string;
295
+ siteId: string;
296
+ name: string;
297
+ description: string;
298
+ tokens: number;
299
+ features: {
300
+ type: string;
301
+ name: string;
302
+ }[];
303
+ };
304
+ }[];
305
+ }>;
306
+ type Response = z.infer<typeof ResponseSchema>;
307
+ }
308
+ //# sourceMappingURL=get-subscriptions-summary.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-subscriptions-summary.command.d.ts","sourceRoot":"","sources":["../../../queries/subscription/get-subscriptions-summary.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AA2BtF,yBAAiB,8BAA8B,CAAC;IACrC,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetSubscriptionsSummaryCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ const constants_1 = require("../../constants");
7
+ const FeatureSchema = zod_1.z.object({
8
+ type: zod_1.z.string(),
9
+ name: zod_1.z.string(),
10
+ });
11
+ const UserToSubscriptionSummarySchema = zod_1.z.object({
12
+ uuid: zod_1.z.string().uuid(),
13
+ initTokenBalance: zod_1.z.number().int(),
14
+ tokenBalance: zod_1.z.number().int(),
15
+ carriedOverTokenBalance: zod_1.z.number().int(),
16
+ status: zod_1.z.nativeEnum(constants_1.USER_TO_SUBSCRIPTION_STATUS),
17
+ active: zod_1.z.boolean(),
18
+ createdAt: zod_1.z.date().or(zod_1.z.string().datetime()),
19
+ subscription: models_1.SubscriptionSchema,
20
+ });
21
+ const UserToProductSummarySchema = zod_1.z.object({
22
+ uuid: zod_1.z.string().uuid(),
23
+ initTokenBalance: zod_1.z.number().int(),
24
+ tokenBalance: zod_1.z.number().int(),
25
+ status: zod_1.z.nativeEnum(constants_1.USER_TO_PRODUCT_STATUS),
26
+ createdAt: zod_1.z.date().or(zod_1.z.string().datetime()),
27
+ product: models_1.ProductSchema,
28
+ });
29
+ var GetSubscriptionsSummaryCommand;
30
+ (function (GetSubscriptionsSummaryCommand) {
31
+ GetSubscriptionsSummaryCommand.ResponseSchema = zod_1.z.object({
32
+ subscriptions: zod_1.z.array(UserToSubscriptionSummarySchema),
33
+ products: zod_1.z.array(UserToProductSummarySchema),
34
+ features: zod_1.z.array(FeatureSchema),
35
+ });
36
+ })(GetSubscriptionsSummaryCommand || (exports.GetSubscriptionsSummaryCommand = GetSubscriptionsSummaryCommand = {}));
@@ -1,2 +1,3 @@
1
1
  export * from './find-subscriptions.command';
2
+ export * from './get-subscriptions-summary.command';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/subscription/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/subscription/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC"}
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./find-subscriptions.command"), exports);
18
+ __exportStar(require("./get-subscriptions-summary.command"), exports);
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ export declare namespace GetUnregisteredUserBalanceCommand {
3
+ const ResponseSchema: z.ZodObject<{
4
+ data: z.ZodObject<{
5
+ subscriptionTokens: z.ZodNumber;
6
+ productTokens: z.ZodNumber;
7
+ bonusTokens: z.ZodNumber;
8
+ totalTokens: z.ZodNumber;
9
+ }, "strip", z.ZodTypeAny, {
10
+ subscriptionTokens: number;
11
+ productTokens: number;
12
+ bonusTokens: number;
13
+ totalTokens: number;
14
+ }, {
15
+ subscriptionTokens: number;
16
+ productTokens: number;
17
+ bonusTokens: number;
18
+ totalTokens: number;
19
+ }>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ data: {
22
+ subscriptionTokens: number;
23
+ productTokens: number;
24
+ bonusTokens: number;
25
+ totalTokens: number;
26
+ };
27
+ }, {
28
+ data: {
29
+ subscriptionTokens: number;
30
+ productTokens: number;
31
+ bonusTokens: number;
32
+ totalTokens: number;
33
+ };
34
+ }>;
35
+ type Response = z.infer<typeof ResponseSchema>;
36
+ }
37
+ //# sourceMappingURL=get-unregistered-user-balance.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-unregistered-user-balance.command.d.ts","sourceRoot":"","sources":["../../../queries/unregistered-user/get-unregistered-user-balance.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAiB,iCAAiC,CAAC;IACxC,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAOzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetUnregisteredUserBalanceCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var GetUnregisteredUserBalanceCommand;
6
+ (function (GetUnregisteredUserBalanceCommand) {
7
+ GetUnregisteredUserBalanceCommand.ResponseSchema = zod_1.z.object({
8
+ data: zod_1.z.object({
9
+ subscriptionTokens: zod_1.z.number().int().min(0),
10
+ productTokens: zod_1.z.number().int().min(0),
11
+ bonusTokens: zod_1.z.number().int().min(0),
12
+ totalTokens: zod_1.z.number().int().min(0),
13
+ }),
14
+ });
15
+ })(GetUnregisteredUserBalanceCommand || (exports.GetUnregisteredUserBalanceCommand = GetUnregisteredUserBalanceCommand = {}));
@@ -0,0 +1,2 @@
1
+ export * from './get-unregistered-user-balance.command';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/unregistered-user/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-unregistered-user-balance.command"), exports);
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ export declare namespace GetUserBalanceCommand {
3
+ const ResponseSchema: z.ZodObject<{
4
+ data: z.ZodObject<{
5
+ subscriptionTokens: z.ZodNumber;
6
+ productTokens: z.ZodNumber;
7
+ bonusTokens: z.ZodNumber;
8
+ totalTokens: z.ZodNumber;
9
+ }, "strip", z.ZodTypeAny, {
10
+ subscriptionTokens: number;
11
+ productTokens: number;
12
+ bonusTokens: number;
13
+ totalTokens: number;
14
+ }, {
15
+ subscriptionTokens: number;
16
+ productTokens: number;
17
+ bonusTokens: number;
18
+ totalTokens: number;
19
+ }>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ data: {
22
+ subscriptionTokens: number;
23
+ productTokens: number;
24
+ bonusTokens: number;
25
+ totalTokens: number;
26
+ };
27
+ }, {
28
+ data: {
29
+ subscriptionTokens: number;
30
+ productTokens: number;
31
+ bonusTokens: number;
32
+ totalTokens: number;
33
+ };
34
+ }>;
35
+ type Response = z.infer<typeof ResponseSchema>;
36
+ }
37
+ //# sourceMappingURL=get-user-balance.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-user-balance.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-user-balance.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAiB,qBAAqB,CAAC;IAC5B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAOzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetUserBalanceCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var GetUserBalanceCommand;
6
+ (function (GetUserBalanceCommand) {
7
+ GetUserBalanceCommand.ResponseSchema = zod_1.z.object({
8
+ data: zod_1.z.object({
9
+ subscriptionTokens: zod_1.z.number().int().min(0),
10
+ productTokens: zod_1.z.number().int().min(0),
11
+ bonusTokens: zod_1.z.number().int().min(0),
12
+ totalTokens: zod_1.z.number().int().min(0),
13
+ }),
14
+ });
15
+ })(GetUserBalanceCommand || (exports.GetUserBalanceCommand = GetUserBalanceCommand = {}));
@@ -1,4 +1,5 @@
1
1
  export * from './get-user.command';
2
+ export * from './get-user-balance.command';
2
3
  export * from './get-my-products.command';
3
4
  export * from './get-my-subscriptions.command';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC"}
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./get-user.command"), exports);
18
+ __exportStar(require("./get-user-balance.command"), exports);
18
19
  __exportStar(require("./get-my-products.command"), exports);
19
20
  __exportStar(require("./get-my-subscriptions.command"), exports);
@@ -22,15 +22,15 @@ export namespace CloudPaymentsCheckCommand {
22
22
 
23
23
  export namespace CloudPaymentsPayCommand {
24
24
  export const RequestSchema = z.object({
25
- transactionId: z.number().optional(),
26
- amount: z.number(),
25
+ transactionId: z.union([z.string(), z.number()]).optional(),
26
+ amount: z.union([z.string(), z.number()]),
27
27
  currency: z.string().optional().default('RUB'),
28
28
  paymentAmount: z.union([z.string(), z.number()]).optional(),
29
29
  paymentCurrency: z.string().optional(),
30
30
  invoiceId: z.string().optional(),
31
31
  accountId: z.string(),
32
32
  subscriptionId: z.string().optional(),
33
- data: JsonValueSchema.optional(),
33
+ data: z.union([JsonValueSchema, z.string()]).optional(),
34
34
  });
35
35
  export type Request = z.infer<typeof RequestSchema>;
36
36
 
@@ -43,7 +43,7 @@ export namespace CloudPaymentsRecurrentCommand {
43
43
  id: z.string(),
44
44
  accountId: z.string(),
45
45
  status: z.string(),
46
- failedTransactionsNumber: z.number().optional(),
46
+ failedTransactionsNumber: z.union([z.string(), z.number()]).optional(),
47
47
  lastTransactionDate: z.string().optional(),
48
48
  });
49
49
  export type Request = z.infer<typeof RequestSchema>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CancelSubscriptionCommand {
4
+ export const RequestParamSchema = z.object({
5
+ uuidSiteUserToSubscription: z.string().uuid(),
6
+ });
7
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
8
+
9
+ export const RequestSchema = z.object({
10
+ text: z.string().min(1).max(500),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = z.void();
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -1 +1,2 @@
1
1
  export * from './buy-subscription.command';
2
+ export * from './cancel-subscription.command';
@@ -0,0 +1 @@
1
+ export const CLOUD_PAYMENTS_CANCEL = 'https://api.cloudpayments.ru/subscriptions/cancel';
@@ -201,6 +201,11 @@ export const ERRORS = {
201
201
  code: 'SUBSCRIPTION_005',
202
202
  httpCode: 409,
203
203
  },
204
+ SUBSCRIPTION_CANCEL_ERROR: {
205
+ message: 'Ошибка при отмене подписки',
206
+ code: 'SUBSCRIPTION_006',
207
+ httpCode: 500,
208
+ },
204
209
 
205
210
  // ORDER
206
211
  ORDER_NOT_FOUND: {
@@ -1,5 +1,6 @@
1
1
  export * from './errors';
2
2
  export * from './common';
3
+ export * from './cloud-payments';
3
4
  export * from './user';
4
5
  export * from './payment';
5
6
  export * from './transaction';
@@ -1,3 +1,4 @@
1
1
  export enum USER_TO_SUBSCRIPTION_STATUS {
2
2
  ACTIVE = 'active',
3
+ INACTIVE = 'inactive',
3
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/multisite",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Multisite API contracts (DTO schemas, routes, constants)",
5
5
  "type": "commonjs",
6
6
  "main": "build/index.js",
@@ -5,6 +5,7 @@ export namespace FindImageEditorJobsCommand {
5
5
  export const RequestQuerySchema = z.object({
6
6
  limit: z.coerce.number().int().min(1).max(100).default(20),
7
7
  offset: z.coerce.number().int().min(0).default(0),
8
+ title: z.string().trim().min(1).max(200).optional(),
8
9
  });
9
10
  export type RequestQuery = z.infer<typeof RequestQuerySchema>;
10
11
 
@@ -5,6 +5,7 @@ export namespace FindImageGenerationJobsCommand {
5
5
  export const RequestQuerySchema = z.object({
6
6
  limit: z.coerce.number().int().min(1).max(100).default(20),
7
7
  offset: z.coerce.number().int().min(0).default(0),
8
+ title: z.string().trim().min(1).max(200).optional(),
8
9
  });
9
10
  export type RequestQuery = z.infer<typeof RequestQuerySchema>;
10
11
 
package/queries/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './subscription';
3
3
  export * from './payment';
4
4
  export * from './file';
5
5
  export * from './user';
6
+ export * from './unregistered-user';
6
7
  export * from './image-generation';
7
8
  export * from './image-editor';
8
9
  export * from './page';