@gigapay-dev/contracts 1.3.6 → 1.3.7
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.
- package/build/commands/index.js +2 -0
- package/build/commands/stats/endpoints.js +13 -0
- package/build/commands/stats/index.js +18 -0
- package/build/commands/stats/read.js +12 -0
- package/build/commands/status/endpoints.js +33 -0
- package/build/commands/status/index.js +18 -0
- package/build/commands/status/read.js +12 -0
- package/commands/index.ts +3 -1
- package/commands/stats/endpoints.ts +20 -0
- package/commands/stats/index.ts +2 -0
- package/commands/stats/read.ts +9 -0
- package/commands/status/endpoints.ts +40 -0
- package/commands/status/index.ts +2 -0
- package/commands/status/read.ts +9 -0
- package/package.json +1 -1
package/build/commands/index.js
CHANGED
|
@@ -23,3 +23,5 @@ __exportStar(require("./consts"), exports);
|
|
|
23
23
|
__exportStar(require("./pagination"), exports);
|
|
24
24
|
__exportStar(require("./payment-methods"), exports);
|
|
25
25
|
__exportStar(require("./users"), exports);
|
|
26
|
+
__exportStar(require("./stats"), exports);
|
|
27
|
+
__exportStar(require("./status"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatsEndpoints = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const read_1 = require("./read");
|
|
6
|
+
exports.StatsEndpoints = {
|
|
7
|
+
list: {
|
|
8
|
+
method: "GET",
|
|
9
|
+
path: "/stats",
|
|
10
|
+
request: zod_1.z.object({}),
|
|
11
|
+
response: read_1.StatsReadResponseSchema,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./read"), exports);
|
|
18
|
+
__exportStar(require("./endpoints"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StatsReadResponseSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.StatsReadResponseSchema = zod_1.default.object({
|
|
9
|
+
usersCount: zod_1.default.coerce.number().positive(),
|
|
10
|
+
ordersCount: zod_1.default.coerce.number().positive(),
|
|
11
|
+
ordersAmount: zod_1.default.coerce.number().positive(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusEndpoints = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const read_1 = require("./read");
|
|
6
|
+
exports.StatusEndpoints = {
|
|
7
|
+
list: {
|
|
8
|
+
method: "GET",
|
|
9
|
+
path: "/status",
|
|
10
|
+
request: zod_1.z.object({}),
|
|
11
|
+
response: read_1.StatusReadResponseSchema,
|
|
12
|
+
},
|
|
13
|
+
get: {
|
|
14
|
+
method: "GET",
|
|
15
|
+
path: "/status/:key",
|
|
16
|
+
request: zod_1.z.object({
|
|
17
|
+
key: zod_1.z.string(),
|
|
18
|
+
}),
|
|
19
|
+
response: zod_1.z.object({
|
|
20
|
+
key: zod_1.z.string(),
|
|
21
|
+
value: zod_1.z.boolean(),
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
set: {
|
|
25
|
+
method: "POST",
|
|
26
|
+
path: "/status/:key",
|
|
27
|
+
request: zod_1.z.object({
|
|
28
|
+
key: zod_1.z.string(),
|
|
29
|
+
value: zod_1.z.boolean(),
|
|
30
|
+
}),
|
|
31
|
+
response: read_1.StatusReadResponseSchema,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./read"), exports);
|
|
18
|
+
__exportStar(require("./endpoints"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StatusReadResponseSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.StatusReadResponseSchema = zod_1.default.object({
|
|
9
|
+
service: zod_1.default.boolean(),
|
|
10
|
+
works: zod_1.default.boolean(),
|
|
11
|
+
payments: zod_1.default.boolean(),
|
|
12
|
+
});
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EndpointContract } from "../../types";
|
|
3
|
+
import { StatsReadResponseSchema } from "./read";
|
|
4
|
+
|
|
5
|
+
export const StatsEndpoints = {
|
|
6
|
+
list: {
|
|
7
|
+
method: "GET",
|
|
8
|
+
path: "/stats",
|
|
9
|
+
request: z.object({}),
|
|
10
|
+
response: StatsReadResponseSchema,
|
|
11
|
+
},
|
|
12
|
+
} satisfies Record<string, EndpointContract>;
|
|
13
|
+
|
|
14
|
+
export type StatsEndpointKey = keyof typeof StatsEndpoints;
|
|
15
|
+
|
|
16
|
+
export type GetStatsRequest<K extends StatsEndpointKey> =
|
|
17
|
+
z.infer<typeof StatsEndpoints[K]["request"]>;
|
|
18
|
+
|
|
19
|
+
export type GetStatsResponse<K extends StatsEndpointKey> =
|
|
20
|
+
z.infer<typeof StatsEndpoints[K]["response"]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const StatsReadResponseSchema = z.object({
|
|
4
|
+
usersCount: z.coerce.number().positive(),
|
|
5
|
+
ordersCount: z.coerce.number().positive(),
|
|
6
|
+
ordersAmount: z.coerce.number().positive(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type StatsReadResponse = z.infer<typeof StatsReadResponseSchema>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EndpointContract } from "../../types";
|
|
3
|
+
import { StatusReadResponseSchema } from "./read";
|
|
4
|
+
|
|
5
|
+
export const StatusEndpoints = {
|
|
6
|
+
list: {
|
|
7
|
+
method: "GET",
|
|
8
|
+
path: "/status",
|
|
9
|
+
request: z.object({}),
|
|
10
|
+
response: StatusReadResponseSchema,
|
|
11
|
+
},
|
|
12
|
+
get: {
|
|
13
|
+
method: "GET",
|
|
14
|
+
path: "/status/:key",
|
|
15
|
+
request: z.object({
|
|
16
|
+
key: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
response: z.object({
|
|
19
|
+
key: z.string(),
|
|
20
|
+
value: z.boolean(),
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
set: {
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: "/status/:key",
|
|
26
|
+
request: z.object({
|
|
27
|
+
key: z.string(),
|
|
28
|
+
value: z.boolean(),
|
|
29
|
+
}),
|
|
30
|
+
response: StatusReadResponseSchema,
|
|
31
|
+
},
|
|
32
|
+
} satisfies Record<string, EndpointContract>;
|
|
33
|
+
|
|
34
|
+
export type StatusEndpointKey = keyof typeof StatusEndpoints;
|
|
35
|
+
|
|
36
|
+
export type GetStatusRequest<K extends StatusEndpointKey> =
|
|
37
|
+
z.infer<typeof StatusEndpoints[K]["request"]>;
|
|
38
|
+
|
|
39
|
+
export type GetStatusResponse<K extends StatusEndpointKey> =
|
|
40
|
+
z.infer<typeof StatusEndpoints[K]["response"]>;
|