@gigapay-dev/contracts 1.1.0 → 1.1.2

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.
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.AuthEndpoints = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
4
8
  const login_1 = require("./login");
5
9
  const register_1 = require("./register");
6
10
  const confirm_1 = require("./confirm");
11
+ const reset_1 = require("./reset");
7
12
  exports.AuthEndpoints = {
8
13
  login: {
9
14
  method: "POST",
@@ -17,6 +22,18 @@ exports.AuthEndpoints = {
17
22
  request: register_1.UserRegisterRequestSchema,
18
23
  response: login_1.UserLoginResponseSchema,
19
24
  },
25
+ refresh: {
26
+ method: "GET",
27
+ path: "/auth/refresh",
28
+ request: zod_1.default.void(),
29
+ response: login_1.UserLoginResponseSchema,
30
+ },
31
+ reset: {
32
+ method: "POST",
33
+ path: "/auth/reset",
34
+ request: reset_1.UserResetRequestSchema,
35
+ response: zod_1.default.void(),
36
+ },
20
37
  confirm: {
21
38
  method: "GET",
22
39
  path: "/auth/confirm-code/:code",
@@ -8,10 +8,12 @@ const zod_1 = __importDefault(require("zod"));
8
8
  exports.OrderCreateRequestSchema = zod_1.default.object({
9
9
  email: zod_1.default.string().email(),
10
10
  steamUsername: zod_1.default.string(),
11
- amount: zod_1.default.number().positive(),
12
- userId: zod_1.default.number().positive().optional(),
13
- paymentMethodId: zod_1.default.number().positive().optional(),
14
- promocodeId: zod_1.default.number().positive().optional(),
11
+ amount: zod_1.default.coerce.number().positive(),
12
+ userId: zod_1.default.coerce.number().positive().optional(),
13
+ paymentMethodId: zod_1.default.coerce.number().positive().optional(),
14
+ token: zod_1.default.string().nullable().optional(),
15
+ network: zod_1.default.string().nullable().optional(),
16
+ promocodeId: zod_1.default.coerce.number().positive().optional(),
15
17
  });
16
18
  exports.OrderCreateResponseSchema = zod_1.default.object({
17
19
  redirectUrl: zod_1.default.string(),
@@ -30,10 +30,8 @@ exports.OrderEndpoints = {
30
30
  },
31
31
  getUserOrders: {
32
32
  method: "GET",
33
- path: "/orders/user/:userId",
34
- request: zod_1.default.object({
35
- userId: zod_1.default.coerce.number().positive(),
36
- }),
33
+ path: "/orders/user",
34
+ request: zod_1.default.object({}),
37
35
  response: zod_1.default.array(read_1.OrderReadResponseSchema),
38
36
  },
39
37
  getUserOrderById: {
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrderReadResponseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.OrderReadResponseSchema = zod_1.z.object({
6
- id: zod_1.z.number().positive(),
7
- userId: zod_1.z.number().positive().optional(),
8
- promocodeId: zod_1.z.number().positive().optional(),
6
+ id: zod_1.z.coerce.number().positive(),
7
+ userId: zod_1.z.coerce.number().positive().optional(),
8
+ promocodeId: zod_1.z.coerce.number().positive().optional(),
9
9
  status: zod_1.z.string(),
10
10
  steamUsername: zod_1.z.string(),
11
- paymentId: zod_1.z.number().positive(),
12
- paymentMethodId: zod_1.z.number().positive().optional(),
13
- amount: zod_1.z.number().positive(),
11
+ paymentId: zod_1.z.coerce.number().positive(),
12
+ paymentMethodId: zod_1.z.coerce.number().positive().optional(),
13
+ amount: zod_1.z.coerce.number().positive(),
14
14
  createdAt: zod_1.z.coerce.date().default(() => new Date()),
15
15
  updatedAt: zod_1.z.coerce.date().default(() => new Date()),
16
16
  });
@@ -4,9 +4,9 @@ exports.OrderUpdateRequestSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.OrderUpdateRequestSchema = zod_1.z.object({
6
6
  email: zod_1.z.string().email().optional(),
7
- amount: zod_1.z.number().positive().optional(),
7
+ amount: zod_1.z.coerce.number().positive().optional(),
8
8
  steamUsername: zod_1.z.string().optional(),
9
- userId: zod_1.z.number().positive().optional(),
10
- paymentMethodId: zod_1.z.number().positive().optional(),
11
- promocodeId: zod_1.z.number().positive().optional(),
9
+ userId: zod_1.z.coerce.number().positive().optional(),
10
+ paymentMethodId: zod_1.z.coerce.number().positive().optional(),
11
+ promocodeId: zod_1.z.coerce.number().positive().optional(),
12
12
  });
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PromoCodeActivationReadResponseSchema = void 0;
7
7
  const zod_1 = __importDefault(require("zod"));
8
8
  exports.PromoCodeActivationReadResponseSchema = zod_1.default.object({
9
- id: zod_1.default.number().positive(),
10
- promocodeId: zod_1.default.number().positive(),
11
- refferalId: zod_1.default.number().positive(),
9
+ id: zod_1.default.coerce.number().positive(),
10
+ promocodeId: zod_1.default.coerce.number().positive(),
11
+ refferalId: zod_1.default.coerce.number().positive(),
12
12
  discountValue: zod_1.default.string(),
13
13
  activatedAt: zod_1.default.coerce.date(),
14
14
  });
@@ -3,6 +3,7 @@ import { UserLoginRequestSchema, UserLoginResponseSchema } from "./login";
3
3
  import { UserRegisterRequestSchema } from "./register";
4
4
  import { EndpointContract } from "../../types";
5
5
  import { ConfirmCodeRequestSchema } from "./confirm";
6
+ import { UserResetRequestSchema } from "./reset";
6
7
 
7
8
  export const AuthEndpoints = {
8
9
  login: {
@@ -17,6 +18,18 @@ export const AuthEndpoints = {
17
18
  request: UserRegisterRequestSchema,
18
19
  response: UserLoginResponseSchema,
19
20
  },
21
+ refresh: {
22
+ method: "GET",
23
+ path: "/auth/refresh",
24
+ request: z.void(),
25
+ response: UserLoginResponseSchema,
26
+ },
27
+ reset: {
28
+ method: "POST",
29
+ path: "/auth/reset",
30
+ request: UserResetRequestSchema,
31
+ response: z.void(),
32
+ },
20
33
  confirm: {
21
34
  method: "GET",
22
35
  path: "/auth/confirm-code/:code",
@@ -3,10 +3,12 @@ import z from "zod";
3
3
  export const OrderCreateRequestSchema = z.object({
4
4
  email: z.string().email(),
5
5
  steamUsername: z.string(),
6
- amount: z.number().positive(),
7
- userId: z.number().positive().optional(),
8
- paymentMethodId: z.number().positive().optional(),
9
- promocodeId: z.number().positive().optional(),
6
+ amount: z.coerce.number().positive(),
7
+ userId: z.coerce.number().positive().optional(),
8
+ paymentMethodId: z.coerce.number().positive().optional(),
9
+ token: z.string().nullable().optional(),
10
+ network: z.string().nullable().optional(),
11
+ promocodeId: z.coerce.number().positive().optional(),
10
12
  });
11
13
 
12
14
  export const OrderCreateResponseSchema = z.object({
@@ -30,10 +30,8 @@ export const OrderEndpoints = {
30
30
  },
31
31
  getUserOrders: {
32
32
  method: "GET",
33
- path: "/orders/user/:userId",
34
- request: z.object({
35
- userId: z.coerce.number().positive(),
36
- }),
33
+ path: "/orders/user",
34
+ request: z.object({}),
37
35
  response: z.array(OrderReadResponseSchema),
38
36
  },
39
37
  getUserOrderById: {
@@ -1,14 +1,14 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  export const OrderReadResponseSchema = z.object({
4
- id: z.number().positive(),
5
- userId: z.number().positive().optional(),
6
- promocodeId: z.number().positive().optional(),
4
+ id: z.coerce.number().positive(),
5
+ userId: z.coerce.number().positive().optional(),
6
+ promocodeId: z.coerce.number().positive().optional(),
7
7
  status: z.string(),
8
8
  steamUsername: z.string(),
9
- paymentId: z.number().positive(),
10
- paymentMethodId: z.number().positive().optional(),
11
- amount: z.number().positive(),
9
+ paymentId: z.coerce.number().positive(),
10
+ paymentMethodId: z.coerce.number().positive().optional(),
11
+ amount: z.coerce.number().positive(),
12
12
  createdAt: z.coerce.date().default(() => new Date()),
13
13
  updatedAt: z.coerce.date().default(() => new Date()),
14
14
  });
@@ -2,11 +2,11 @@ import { z } from "zod";
2
2
 
3
3
  export const OrderUpdateRequestSchema = z.object({
4
4
  email: z.string().email().optional(),
5
- amount: z.number().positive().optional(),
5
+ amount: z.coerce.number().positive().optional(),
6
6
  steamUsername: z.string().optional(),
7
- userId: z.number().positive().optional(),
8
- paymentMethodId: z.number().positive().optional(),
9
- promocodeId: z.number().positive().optional(),
7
+ userId: z.coerce.number().positive().optional(),
8
+ paymentMethodId: z.coerce.number().positive().optional(),
9
+ promocodeId: z.coerce.number().positive().optional(),
10
10
  })
11
11
 
12
12
  export type OrderUpdateRequest = z.infer<typeof OrderUpdateRequestSchema>
@@ -1,9 +1,9 @@
1
1
  import z from "zod";
2
2
 
3
3
  export const PromoCodeActivationReadResponseSchema = z.object({
4
- id: z.number().positive(),
5
- promocodeId: z.number().positive(),
6
- refferalId: z.number().positive(),
4
+ id: z.coerce.number().positive(),
5
+ promocodeId: z.coerce.number().positive(),
6
+ refferalId: z.coerce.number().positive(),
7
7
  discountValue: z.string(),
8
8
  activatedAt: z.coerce.date(),
9
9
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gigapay-dev/contracts",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": "./build/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",