@gigapay-dev/contracts 1.8.1 → 1.8.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.
@@ -26,3 +26,4 @@ __exportStar(require("./api-response"), exports);
26
26
  __exportStar(require("./users"), exports);
27
27
  __exportStar(require("./stats"), exports);
28
28
  __exportStar(require("./status"), exports);
29
+ __exportStar(require("./settings"), exports);
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsEndpoints = void 0;
4
+ const zod_1 = require("zod");
5
+ const read_1 = require("./read");
6
+ const update_1 = require("./update");
7
+ exports.SettingsEndpoints = {
8
+ getAll: {
9
+ method: "GET",
10
+ path: "/settings",
11
+ request: zod_1.z.object({}),
12
+ response: read_1.SettingsReadResponseSchema,
13
+ },
14
+ getOne: {
15
+ method: "GET",
16
+ path: "/settings/:key",
17
+ request: zod_1.z.object({
18
+ key: zod_1.z.string(),
19
+ }),
20
+ response: zod_1.z.object({
21
+ key: zod_1.z.string(),
22
+ value: zod_1.z.union([zod_1.z.string(), zod_1.z.boolean()]),
23
+ }),
24
+ },
25
+ updateAll: {
26
+ method: "PUT",
27
+ path: "/settings",
28
+ request: update_1.SettingsUpdateRequestSchema,
29
+ response: read_1.SettingsReadResponseSchema,
30
+ },
31
+ updateOne: {
32
+ method: "PUT",
33
+ path: "/settings/:key",
34
+ request: zod_1.z.object({
35
+ key: zod_1.z.string(),
36
+ value: zod_1.z.union([zod_1.z.string(), zod_1.z.boolean()]),
37
+ }),
38
+ response: zod_1.z.object({
39
+ key: zod_1.z.string(),
40
+ value: zod_1.z.union([zod_1.z.string(), zod_1.z.boolean()]),
41
+ }),
42
+ },
43
+ };
@@ -0,0 +1,19 @@
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("./update"), exports);
19
+ __exportStar(require("./endpoints"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsReadResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.SettingsReadResponseSchema = zod_1.z.object({
6
+ desslyDiscount: zod_1.z.string(),
7
+ serviceEnabled: zod_1.z.boolean(),
8
+ worksEnabled: zod_1.z.boolean(),
9
+ paymentsEnabled: zod_1.z.boolean(),
10
+ });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsUpdateRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.SettingsUpdateRequestSchema = zod_1.z.object({
6
+ desslyDiscount: zod_1.z.string().optional(),
7
+ serviceEnabled: zod_1.z.boolean().optional(),
8
+ worksEnabled: zod_1.z.boolean().optional(),
9
+ paymentsEnabled: zod_1.z.boolean().optional(),
10
+ });
package/commands/index.ts CHANGED
@@ -9,4 +9,5 @@ export * from './payment-methods';
9
9
  export * from './api-response';
10
10
  export * from './users';
11
11
  export * from './stats';
12
- export * from './status';
12
+ export * from './status';
13
+ export * from './settings';
@@ -0,0 +1,52 @@
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
+ >;
@@ -0,0 +1,3 @@
1
+ export * from "./read";
2
+ export * from "./update";
3
+ export * from "./endpoints";
@@ -0,0 +1,10 @@
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>;
@@ -0,0 +1,10 @@
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>;
@@ -34,7 +34,7 @@ export const StatusEndpoints = {
34
34
  export type StatusEndpointKey = keyof typeof StatusEndpoints;
35
35
 
36
36
  export type GetStatusRequest<K extends StatusEndpointKey> =
37
- z.infer<typeof StatusEndpoints[K]["request"]>;
37
+ z.infer<typeof StatusEndpoints[K]["request"]>;
38
38
 
39
39
  export type GetStatusResponse<K extends StatusEndpointKey> =
40
- z.infer<typeof StatusEndpoints[K]["response"]>;
40
+ z.infer<typeof StatusEndpoints[K]["response"]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gigapay-dev/contracts",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "main": "./build/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",