@jakobgoerke/ac-infinity-client 0.1.0 → 0.1.1
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/src/AcInfinityClient.d.ts +34 -0
- package/build/src/AcInfinityClient.d.ts.map +1 -0
- package/build/src/AcInfinityClient.js +74 -0
- package/build/src/errors/index.d.ts +5 -0
- package/build/src/errors/index.d.ts.map +1 -0
- package/build/src/errors/index.js +12 -0
- package/build/src/index.d.ts +2 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +17 -0
- package/build/src/types/Controller.d.ts +177 -0
- package/build/src/types/Controller.d.ts.map +1 -0
- package/build/src/types/Controller.js +35 -0
- package/build/src/types/Device.d.ts +24 -0
- package/build/src/types/Device.d.ts.map +1 -0
- package/build/src/types/Device.js +26 -0
- package/build/src/types/User.d.ts +16 -0
- package/build/src/types/User.d.ts.map +1 -0
- package/build/src/types/User.js +9 -0
- package/build/src/types/index.d.ts +4 -0
- package/build/src/types/index.d.ts.map +1 -0
- package/build/src/types/index.js +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Controller, User, DeviceModeSettings, DeviceSettings } from './types';
|
|
2
|
+
export declare enum Url {
|
|
3
|
+
AUTH = "/user/appUserLogin",
|
|
4
|
+
CONTROLLERS = "/user/devInfoListAll",
|
|
5
|
+
DEVICE_SETTINGS = "/dev/getDevSetting",
|
|
6
|
+
DEVICE_MODE_SETTINGS = "/dev/getdevModeSettingList"
|
|
7
|
+
}
|
|
8
|
+
export interface Response<T> {
|
|
9
|
+
code: number;
|
|
10
|
+
data: T;
|
|
11
|
+
}
|
|
12
|
+
export interface AuthParams {
|
|
13
|
+
email: string;
|
|
14
|
+
password: string;
|
|
15
|
+
}
|
|
16
|
+
interface GetDeviceParams {
|
|
17
|
+
deviceId: string;
|
|
18
|
+
port: number;
|
|
19
|
+
}
|
|
20
|
+
declare class AcInfinityClient {
|
|
21
|
+
constructor(args: AuthParams);
|
|
22
|
+
private api;
|
|
23
|
+
private token;
|
|
24
|
+
private email;
|
|
25
|
+
private password;
|
|
26
|
+
authenticate(): Promise<User>;
|
|
27
|
+
getControllers(): Promise<Controller[]>;
|
|
28
|
+
getDeviceSettings({ deviceId, port }: GetDeviceParams): Promise<DeviceSettings>;
|
|
29
|
+
getDeviceModeSettings({ deviceId, port }: GetDeviceParams): Promise<DeviceModeSettings>;
|
|
30
|
+
static build(args: AuthParams): Promise<AcInfinityClient>;
|
|
31
|
+
}
|
|
32
|
+
export { AcInfinityClient };
|
|
33
|
+
export type { Controller, User, DeviceModeSettings, DeviceSettings };
|
|
34
|
+
//# sourceMappingURL=AcInfinityClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcInfinityClient.d.ts","sourceRoot":"","sources":["../../src/AcInfinityClient.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EAEV,IAAI,EAGJ,kBAAkB,EAClB,cAAc,EAEf,MAAM,SAAS,CAAC;AAGjB,oBAAY,GAAG;IACb,IAAI,uBAAuB;IAC3B,WAAW,yBAAyB;IACpC,eAAe,uBAAuB;IACtC,oBAAoB,+BAA+B;CACpD;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACT;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,cAAM,gBAAgB;gBACR,IAAI,EAAE,UAAU;IAiB5B,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAS;IAEZ,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB7B,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAQvC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAS/E,qBAAqB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;WASvF,KAAK,CAAC,IAAI,EAAE,UAAU;CAKpC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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.AcInfinityClient = exports.Url = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
const errors_1 = require("./errors");
|
|
10
|
+
var Url;
|
|
11
|
+
(function (Url) {
|
|
12
|
+
Url["AUTH"] = "/user/appUserLogin";
|
|
13
|
+
Url["CONTROLLERS"] = "/user/devInfoListAll";
|
|
14
|
+
Url["DEVICE_SETTINGS"] = "/dev/getDevSetting";
|
|
15
|
+
Url["DEVICE_MODE_SETTINGS"] = "/dev/getdevModeSettingList";
|
|
16
|
+
})(Url || (exports.Url = Url = {}));
|
|
17
|
+
class AcInfinityClient {
|
|
18
|
+
constructor(args) {
|
|
19
|
+
const { email, password } = args;
|
|
20
|
+
this.email = email;
|
|
21
|
+
this.password = password;
|
|
22
|
+
this.token = '';
|
|
23
|
+
this.api = axios_1.default.create({
|
|
24
|
+
timeout: 5000,
|
|
25
|
+
baseURL: 'http://www.acinfinityserver.com/api',
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
api;
|
|
32
|
+
token;
|
|
33
|
+
email;
|
|
34
|
+
password;
|
|
35
|
+
async authenticate() {
|
|
36
|
+
const response = await this.api.post(Url.AUTH, {
|
|
37
|
+
appEmail: this.email,
|
|
38
|
+
appPasswordl: this.password,
|
|
39
|
+
});
|
|
40
|
+
if (response.data.code !== 200) {
|
|
41
|
+
throw new errors_1.AuthenticationError();
|
|
42
|
+
}
|
|
43
|
+
const user = types_1.UserSchema.parse(response.data.data);
|
|
44
|
+
this.token = user.appId;
|
|
45
|
+
this.api.defaults.headers.common['token'] = user.appId;
|
|
46
|
+
return user;
|
|
47
|
+
}
|
|
48
|
+
async getControllers() {
|
|
49
|
+
const response = await this.api.post(Url.CONTROLLERS, {
|
|
50
|
+
userId: this.token,
|
|
51
|
+
});
|
|
52
|
+
return response.data.data.map((device) => types_1.ControllerSchema.parse(device));
|
|
53
|
+
}
|
|
54
|
+
async getDeviceSettings({ deviceId, port }) {
|
|
55
|
+
const response = await this.api.post(Url.DEVICE_SETTINGS, {
|
|
56
|
+
devId: deviceId,
|
|
57
|
+
port,
|
|
58
|
+
});
|
|
59
|
+
return types_1.DeviceSettingsSchema.parse(response.data.data);
|
|
60
|
+
}
|
|
61
|
+
async getDeviceModeSettings({ deviceId, port }) {
|
|
62
|
+
const response = await this.api.post(Url.DEVICE_MODE_SETTINGS, {
|
|
63
|
+
devId: deviceId,
|
|
64
|
+
port,
|
|
65
|
+
});
|
|
66
|
+
return types_1.DeviceModeSettingsSchema.parse(response.data.data);
|
|
67
|
+
}
|
|
68
|
+
static async build(args) {
|
|
69
|
+
const instance = new AcInfinityClient(args);
|
|
70
|
+
await instance.authenticate();
|
|
71
|
+
return instance;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.AcInfinityClient = AcInfinityClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAM,mBAAoB,SAAQ,KAAK;gBACzB,OAAO,CAAC,EAAE,MAAM;CAQ7B;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthenticationError = void 0;
|
|
4
|
+
class AuthenticationError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = this.constructor.name;
|
|
8
|
+
Error.captureStackTrace(this, this.constructor);
|
|
9
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.AuthenticationError = AuthenticationError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,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("./AcInfinityClient"), exports);
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DeviceMode, DeviceType } from './Device';
|
|
3
|
+
declare enum ControllerDeviceType {
|
|
4
|
+
UIS_CONTROLLER_69_PRO = 11,
|
|
5
|
+
UIS_CONTROLLER_69_PRO_PLUS = 10
|
|
6
|
+
}
|
|
7
|
+
export declare const ControllerPortSchema: z.ZodObject<{
|
|
8
|
+
loadType: z.ZodNativeEnum<typeof DeviceType>;
|
|
9
|
+
curMode: z.ZodNativeEnum<typeof DeviceMode>;
|
|
10
|
+
port: z.ZodNumber;
|
|
11
|
+
speak: z.ZodNumber;
|
|
12
|
+
portName: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
loadType: DeviceType;
|
|
15
|
+
curMode: DeviceMode;
|
|
16
|
+
port: number;
|
|
17
|
+
speak: number;
|
|
18
|
+
portName: string;
|
|
19
|
+
}, {
|
|
20
|
+
loadType: DeviceType;
|
|
21
|
+
curMode: DeviceMode;
|
|
22
|
+
port: number;
|
|
23
|
+
speak: number;
|
|
24
|
+
portName: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type ControllerPort = z.infer<typeof ControllerPortSchema>;
|
|
27
|
+
export declare const ControllerDeviceInfoSchema: z.ZodObject<{
|
|
28
|
+
temperature: z.ZodNumber;
|
|
29
|
+
humidity: z.ZodNumber;
|
|
30
|
+
ports: z.ZodArray<z.ZodObject<{
|
|
31
|
+
loadType: z.ZodNativeEnum<typeof DeviceType>;
|
|
32
|
+
curMode: z.ZodNativeEnum<typeof DeviceMode>;
|
|
33
|
+
port: z.ZodNumber;
|
|
34
|
+
speak: z.ZodNumber;
|
|
35
|
+
portName: z.ZodString;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
loadType: DeviceType;
|
|
38
|
+
curMode: DeviceMode;
|
|
39
|
+
port: number;
|
|
40
|
+
speak: number;
|
|
41
|
+
portName: string;
|
|
42
|
+
}, {
|
|
43
|
+
loadType: DeviceType;
|
|
44
|
+
curMode: DeviceMode;
|
|
45
|
+
port: number;
|
|
46
|
+
speak: number;
|
|
47
|
+
portName: string;
|
|
48
|
+
}>, "many">;
|
|
49
|
+
vpdnums: z.ZodNumber;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
temperature: number;
|
|
52
|
+
humidity: number;
|
|
53
|
+
ports: {
|
|
54
|
+
loadType: DeviceType;
|
|
55
|
+
curMode: DeviceMode;
|
|
56
|
+
port: number;
|
|
57
|
+
speak: number;
|
|
58
|
+
portName: string;
|
|
59
|
+
}[];
|
|
60
|
+
vpdnums: number;
|
|
61
|
+
}, {
|
|
62
|
+
temperature: number;
|
|
63
|
+
humidity: number;
|
|
64
|
+
ports: {
|
|
65
|
+
loadType: DeviceType;
|
|
66
|
+
curMode: DeviceMode;
|
|
67
|
+
port: number;
|
|
68
|
+
speak: number;
|
|
69
|
+
portName: string;
|
|
70
|
+
}[];
|
|
71
|
+
vpdnums: number;
|
|
72
|
+
}>;
|
|
73
|
+
export type ControllerDeviceInfo = z.infer<typeof ControllerDeviceInfoSchema>;
|
|
74
|
+
export declare const ControllerSchema: z.ZodObject<{
|
|
75
|
+
devId: z.ZodString;
|
|
76
|
+
devCode: z.ZodString;
|
|
77
|
+
devName: z.ZodString;
|
|
78
|
+
devType: z.ZodNativeEnum<typeof ControllerDeviceType>;
|
|
79
|
+
devPortCount: z.ZodNumber;
|
|
80
|
+
devVersion: z.ZodNumber;
|
|
81
|
+
online: z.ZodBoolean;
|
|
82
|
+
firmwareVersion: z.ZodString;
|
|
83
|
+
hardwareVersion: z.ZodString;
|
|
84
|
+
deviceInfo: z.ZodObject<{
|
|
85
|
+
temperature: z.ZodNumber;
|
|
86
|
+
humidity: z.ZodNumber;
|
|
87
|
+
ports: z.ZodArray<z.ZodObject<{
|
|
88
|
+
loadType: z.ZodNativeEnum<typeof DeviceType>;
|
|
89
|
+
curMode: z.ZodNativeEnum<typeof DeviceMode>;
|
|
90
|
+
port: z.ZodNumber;
|
|
91
|
+
speak: z.ZodNumber;
|
|
92
|
+
portName: z.ZodString;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
loadType: DeviceType;
|
|
95
|
+
curMode: DeviceMode;
|
|
96
|
+
port: number;
|
|
97
|
+
speak: number;
|
|
98
|
+
portName: string;
|
|
99
|
+
}, {
|
|
100
|
+
loadType: DeviceType;
|
|
101
|
+
curMode: DeviceMode;
|
|
102
|
+
port: number;
|
|
103
|
+
speak: number;
|
|
104
|
+
portName: string;
|
|
105
|
+
}>, "many">;
|
|
106
|
+
vpdnums: z.ZodNumber;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
temperature: number;
|
|
109
|
+
humidity: number;
|
|
110
|
+
ports: {
|
|
111
|
+
loadType: DeviceType;
|
|
112
|
+
curMode: DeviceMode;
|
|
113
|
+
port: number;
|
|
114
|
+
speak: number;
|
|
115
|
+
portName: string;
|
|
116
|
+
}[];
|
|
117
|
+
vpdnums: number;
|
|
118
|
+
}, {
|
|
119
|
+
temperature: number;
|
|
120
|
+
humidity: number;
|
|
121
|
+
ports: {
|
|
122
|
+
loadType: DeviceType;
|
|
123
|
+
curMode: DeviceMode;
|
|
124
|
+
port: number;
|
|
125
|
+
speak: number;
|
|
126
|
+
portName: string;
|
|
127
|
+
}[];
|
|
128
|
+
vpdnums: number;
|
|
129
|
+
}>;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
devId: string;
|
|
132
|
+
devCode: string;
|
|
133
|
+
devName: string;
|
|
134
|
+
devType: ControllerDeviceType;
|
|
135
|
+
devPortCount: number;
|
|
136
|
+
devVersion: number;
|
|
137
|
+
online: boolean;
|
|
138
|
+
firmwareVersion: string;
|
|
139
|
+
hardwareVersion: string;
|
|
140
|
+
deviceInfo: {
|
|
141
|
+
temperature: number;
|
|
142
|
+
humidity: number;
|
|
143
|
+
ports: {
|
|
144
|
+
loadType: DeviceType;
|
|
145
|
+
curMode: DeviceMode;
|
|
146
|
+
port: number;
|
|
147
|
+
speak: number;
|
|
148
|
+
portName: string;
|
|
149
|
+
}[];
|
|
150
|
+
vpdnums: number;
|
|
151
|
+
};
|
|
152
|
+
}, {
|
|
153
|
+
devId: string;
|
|
154
|
+
devCode: string;
|
|
155
|
+
devName: string;
|
|
156
|
+
devType: ControllerDeviceType;
|
|
157
|
+
devPortCount: number;
|
|
158
|
+
devVersion: number;
|
|
159
|
+
online: boolean;
|
|
160
|
+
firmwareVersion: string;
|
|
161
|
+
hardwareVersion: string;
|
|
162
|
+
deviceInfo: {
|
|
163
|
+
temperature: number;
|
|
164
|
+
humidity: number;
|
|
165
|
+
ports: {
|
|
166
|
+
loadType: DeviceType;
|
|
167
|
+
curMode: DeviceMode;
|
|
168
|
+
port: number;
|
|
169
|
+
speak: number;
|
|
170
|
+
portName: string;
|
|
171
|
+
}[];
|
|
172
|
+
vpdnums: number;
|
|
173
|
+
};
|
|
174
|
+
}>;
|
|
175
|
+
export type Controller = z.infer<typeof ControllerSchema>;
|
|
176
|
+
export {};
|
|
177
|
+
//# sourceMappingURL=Controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../../src/types/Controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD,aAAK,oBAAoB;IACvB,qBAAqB,KAAK;IAC1B,0BAA0B,KAAK;CAChC;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAM/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControllerSchema = exports.ControllerDeviceInfoSchema = exports.ControllerPortSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const Device_1 = require("./Device");
|
|
6
|
+
var ControllerDeviceType;
|
|
7
|
+
(function (ControllerDeviceType) {
|
|
8
|
+
ControllerDeviceType[ControllerDeviceType["UIS_CONTROLLER_69_PRO"] = 11] = "UIS_CONTROLLER_69_PRO";
|
|
9
|
+
ControllerDeviceType[ControllerDeviceType["UIS_CONTROLLER_69_PRO_PLUS"] = 10] = "UIS_CONTROLLER_69_PRO_PLUS";
|
|
10
|
+
})(ControllerDeviceType || (ControllerDeviceType = {}));
|
|
11
|
+
exports.ControllerPortSchema = zod_1.z.object({
|
|
12
|
+
loadType: zod_1.z.nativeEnum(Device_1.DeviceType),
|
|
13
|
+
curMode: zod_1.z.nativeEnum(Device_1.DeviceMode),
|
|
14
|
+
port: zod_1.z.number().positive(),
|
|
15
|
+
speak: zod_1.z.number(),
|
|
16
|
+
portName: zod_1.z.string(),
|
|
17
|
+
});
|
|
18
|
+
exports.ControllerDeviceInfoSchema = zod_1.z.object({
|
|
19
|
+
temperature: zod_1.z.number(),
|
|
20
|
+
humidity: zod_1.z.number(),
|
|
21
|
+
ports: zod_1.z.array(exports.ControllerPortSchema),
|
|
22
|
+
vpdnums: zod_1.z.number(),
|
|
23
|
+
});
|
|
24
|
+
exports.ControllerSchema = zod_1.z.object({
|
|
25
|
+
devId: zod_1.z.string(),
|
|
26
|
+
devCode: zod_1.z.string(),
|
|
27
|
+
devName: zod_1.z.string(),
|
|
28
|
+
devType: zod_1.z.nativeEnum(ControllerDeviceType),
|
|
29
|
+
devPortCount: zod_1.z.number().positive(),
|
|
30
|
+
devVersion: zod_1.z.number(),
|
|
31
|
+
online: zod_1.z.coerce.boolean(),
|
|
32
|
+
firmwareVersion: zod_1.z.string(),
|
|
33
|
+
hardwareVersion: zod_1.z.string(),
|
|
34
|
+
deviceInfo: exports.ControllerDeviceInfoSchema,
|
|
35
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare enum DeviceType {
|
|
3
|
+
'GROW_LIGHT' = 1,
|
|
4
|
+
'HUMIDIFIER' = 2,
|
|
5
|
+
'DEHUMIDIFIER' = 3,
|
|
6
|
+
'HEATER' = 4,
|
|
7
|
+
'AIR_CONDITION' = 5,
|
|
8
|
+
'FAN' = 6
|
|
9
|
+
}
|
|
10
|
+
export declare enum DeviceMode {
|
|
11
|
+
'OFF' = 1,
|
|
12
|
+
'ON' = 2,
|
|
13
|
+
'AUTO' = 3,
|
|
14
|
+
'TIMER_TO_ON' = 4,
|
|
15
|
+
'TIMER_TO_OFF' = 5,
|
|
16
|
+
'CYCLE' = 6,
|
|
17
|
+
'SCHEDULE' = 7,
|
|
18
|
+
'VPD' = 8
|
|
19
|
+
}
|
|
20
|
+
export declare const DeviceSettingsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
21
|
+
export type DeviceSettings = z.infer<typeof DeviceSettingsSchema>;
|
|
22
|
+
export declare const DeviceModeSettingsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
23
|
+
export type DeviceModeSettings = z.infer<typeof DeviceModeSettingsSchema>;
|
|
24
|
+
//# sourceMappingURL=Device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../../src/types/Device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oBAAY,UAAU;IACpB,YAAY,IAAI;IAChB,YAAY,IAAI;IAChB,cAAc,IAAI;IAClB,QAAQ,IAAI;IACZ,eAAe,IAAI;IACnB,KAAK,IAAI;CACV;AAED,oBAAY,UAAU;IACpB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,MAAM,IAAI;IACV,aAAa,IAAI;IACjB,cAAc,IAAI;IAClB,OAAO,IAAI;IACX,UAAU,IAAI;IACd,KAAK,IAAI;CACV;AAED,eAAO,MAAM,oBAAoB,gDAAe,CAAC;AACjD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,wBAAwB,gDAAe,CAAC;AACrD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceModeSettingsSchema = exports.DeviceSettingsSchema = exports.DeviceMode = exports.DeviceType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var DeviceType;
|
|
6
|
+
(function (DeviceType) {
|
|
7
|
+
DeviceType[DeviceType["GROW_LIGHT"] = 1] = "GROW_LIGHT";
|
|
8
|
+
DeviceType[DeviceType["HUMIDIFIER"] = 2] = "HUMIDIFIER";
|
|
9
|
+
DeviceType[DeviceType["DEHUMIDIFIER"] = 3] = "DEHUMIDIFIER";
|
|
10
|
+
DeviceType[DeviceType["HEATER"] = 4] = "HEATER";
|
|
11
|
+
DeviceType[DeviceType["AIR_CONDITION"] = 5] = "AIR_CONDITION";
|
|
12
|
+
DeviceType[DeviceType["FAN"] = 6] = "FAN";
|
|
13
|
+
})(DeviceType || (exports.DeviceType = DeviceType = {}));
|
|
14
|
+
var DeviceMode;
|
|
15
|
+
(function (DeviceMode) {
|
|
16
|
+
DeviceMode[DeviceMode["OFF"] = 1] = "OFF";
|
|
17
|
+
DeviceMode[DeviceMode["ON"] = 2] = "ON";
|
|
18
|
+
DeviceMode[DeviceMode["AUTO"] = 3] = "AUTO";
|
|
19
|
+
DeviceMode[DeviceMode["TIMER_TO_ON"] = 4] = "TIMER_TO_ON";
|
|
20
|
+
DeviceMode[DeviceMode["TIMER_TO_OFF"] = 5] = "TIMER_TO_OFF";
|
|
21
|
+
DeviceMode[DeviceMode["CYCLE"] = 6] = "CYCLE";
|
|
22
|
+
DeviceMode[DeviceMode["SCHEDULE"] = 7] = "SCHEDULE";
|
|
23
|
+
DeviceMode[DeviceMode["VPD"] = 8] = "VPD";
|
|
24
|
+
})(DeviceMode || (exports.DeviceMode = DeviceMode = {}));
|
|
25
|
+
exports.DeviceSettingsSchema = zod_1.z.object({});
|
|
26
|
+
exports.DeviceModeSettingsSchema = zod_1.z.object({});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const UserSchema: z.ZodObject<{
|
|
3
|
+
appId: z.ZodString;
|
|
4
|
+
nickName: z.ZodString;
|
|
5
|
+
appEmail: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
appId: string;
|
|
8
|
+
nickName: string;
|
|
9
|
+
appEmail: string;
|
|
10
|
+
}, {
|
|
11
|
+
appId: string;
|
|
12
|
+
nickName: string;
|
|
13
|
+
appEmail: string;
|
|
14
|
+
}>;
|
|
15
|
+
export type User = z.infer<typeof UserSchema>;
|
|
16
|
+
//# sourceMappingURL=User.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../src/types/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;;;;EAIrB,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserSchema = zod_1.z.object({
|
|
6
|
+
appId: zod_1.z.string(),
|
|
7
|
+
nickName: zod_1.z.string(),
|
|
8
|
+
appEmail: zod_1.z.string().email(),
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -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("./Controller"), exports);
|
|
18
|
+
__exportStar(require("./Device"), exports);
|
|
19
|
+
__exportStar(require("./User"), exports);
|