@kohost/api-client 1.0.0-beta.3 → 1.0.0-beta.5
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/dist/cjs/Client.js +5089 -0
- package/dist/cjs/Commands.js +568 -0
- package/dist/cjs/Errors.js +174 -0
- package/dist/cjs/Events.js +375 -0
- package/dist/cjs/Models.js +3584 -0
- package/dist/cjs/defs.js +175 -0
- package/dist/cjs/index.cjs.js +17 -0
- package/dist/cjs/utils.js +246 -0
- package/dist/esm/Client.js +7428 -0
- package/dist/esm/Client.js.map +7 -0
- package/dist/esm/Commands.js +574 -0
- package/dist/esm/Commands.js.map +7 -0
- package/dist/esm/Errors.js +180 -0
- package/dist/esm/Errors.js.map +7 -0
- package/dist/esm/Events.js +381 -0
- package/dist/esm/Events.js.map +7 -0
- package/dist/esm/Models.js +13220 -0
- package/dist/esm/Models.js.map +7 -0
- package/dist/esm/defs.js +2514 -0
- package/dist/esm/defs.js.map +7 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/utils.js +7281 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/useCases/AddDefaultScenesToRooms.js +32 -0
- package/dist/useCases/AddScenesToRoom.js +32 -0
- package/dist/useCases/AdminCreateProperty.js +32 -0
- package/dist/useCases/AdminDescribeProperty.js +32 -0
- package/dist/useCases/AdminListCustomers.js +32 -0
- package/dist/useCases/AdminListProperties.js +32 -0
- package/dist/useCases/AdminUpdateProperty.js +32 -0
- package/dist/useCases/BatchNotifyPreArrival.js +32 -0
- package/dist/useCases/CheckInReservation.js +32 -0
- package/dist/useCases/CheckVerificationCode.js +32 -0
- package/dist/useCases/CreateAlarm.js +32 -0
- package/dist/useCases/CreateCamera.js +32 -0
- package/dist/useCases/CreateCourtesy.js +32 -0
- package/dist/useCases/CreateDefaultScenes.js +32 -0
- package/dist/useCases/CreateDimmer.js +32 -0
- package/dist/useCases/CreateDiscoveredDevice.js +32 -0
- package/dist/useCases/CreateDiscoveredDeviceAssociation.js +32 -0
- package/dist/useCases/CreateIntegration.js +32 -0
- package/dist/useCases/CreateIntegrationDeviceMapEntry.js +32 -0
- package/dist/useCases/CreateLock.js +32 -0
- package/dist/useCases/CreateReservation.js +32 -0
- package/dist/useCases/CreateRoom.js +32 -0
- package/dist/useCases/CreateRoomInSpace.js +32 -0
- package/dist/useCases/CreateSource.js +32 -0
- package/dist/useCases/CreateSpace.js +32 -0
- package/dist/useCases/CreateSwitch.js +32 -0
- package/dist/useCases/CreateThermostat.js +32 -0
- package/dist/useCases/CreateTicket.js +32 -0
- package/dist/useCases/CreateTicketMessage.js +32 -0
- package/dist/useCases/CreateUser.js +32 -0
- package/dist/useCases/CreateWindowCovering.js +32 -0
- package/dist/useCases/DeleteAlarm.js +32 -0
- package/dist/useCases/DeleteCamera.js +32 -0
- package/dist/useCases/DeleteCourtesy.js +32 -0
- package/dist/useCases/DeleteDimmer.js +32 -0
- package/dist/useCases/DeleteDiscoveredDevice.js +32 -0
- package/dist/useCases/DeleteIntegration.js +32 -0
- package/dist/useCases/DeleteLock.js +32 -0
- package/dist/useCases/DeleteReservation.js +32 -0
- package/dist/useCases/DeleteRoom.js +32 -0
- package/dist/useCases/DeleteSource.js +32 -0
- package/dist/useCases/DeleteSpace.js +32 -0
- package/dist/useCases/DeleteSwitch.js +32 -0
- package/dist/useCases/DeleteThermostat.js +32 -0
- package/dist/useCases/DeleteTicket.js +32 -0
- package/dist/useCases/DeleteUser.js +32 -0
- package/dist/useCases/DeleteWindowCovering.js +32 -0
- package/dist/useCases/DescribeAlarm.js +32 -0
- package/dist/useCases/DescribeCamera.js +32 -0
- package/dist/useCases/DescribeCourtesy.js +32 -0
- package/dist/useCases/DescribeDimmer.js +32 -0
- package/dist/useCases/DescribeDiscoveredDevice.js +32 -0
- package/dist/useCases/DescribeIntegration.js +32 -0
- package/dist/useCases/DescribeLock.js +32 -0
- package/dist/useCases/DescribeMyProperty.js +32 -0
- package/dist/useCases/DescribeReservation.js +32 -0
- package/dist/useCases/DescribeReservationCheckinStatus.js +32 -0
- package/dist/useCases/DescribeRoom.js +32 -0
- package/dist/useCases/DescribeSelf.js +32 -0
- package/dist/useCases/DescribeSource.js +32 -0
- package/dist/useCases/DescribeSpace.js +32 -0
- package/dist/useCases/DescribeSwitch.js +32 -0
- package/dist/useCases/DescribeThermostat.js +32 -0
- package/dist/useCases/DescribeTicket.js +32 -0
- package/dist/useCases/DescribeUser.js +32 -0
- package/dist/useCases/DescribeWindowCovering.js +32 -0
- package/dist/useCases/DiscoverReservations.js +32 -0
- package/dist/useCases/EmailUserAccountSetup.js +32 -0
- package/dist/useCases/ListAlarms.js +32 -0
- package/dist/useCases/ListCameras.js +32 -0
- package/dist/useCases/ListCourtesy.js +32 -0
- package/dist/useCases/ListDimmers.js +32 -0
- package/dist/useCases/ListDiscoveredDevices.js +32 -0
- package/dist/useCases/ListIntegrations.js +32 -0
- package/dist/useCases/ListLocks.js +32 -0
- package/dist/useCases/ListMyReservations.js +32 -0
- package/dist/useCases/ListMySpaces.js +32 -0
- package/dist/useCases/ListReservations.js +32 -0
- package/dist/useCases/ListRooms.js +32 -0
- package/dist/useCases/ListRoomsInSpace.js +32 -0
- package/dist/useCases/ListSources.js +32 -0
- package/dist/useCases/ListSpaces.js +32 -0
- package/dist/useCases/ListSwitches.js +32 -0
- package/dist/useCases/ListThermostats.js +32 -0
- package/dist/useCases/ListTickets.js +32 -0
- package/dist/useCases/ListUserReservations.js +32 -0
- package/dist/useCases/ListUsers.js +32 -0
- package/dist/useCases/ListWindowCoverings.js +32 -0
- package/dist/useCases/LoginGateway.js +32 -0
- package/dist/useCases/LoginUser.js +32 -0
- package/dist/useCases/MatchUserIdentification.js +32 -0
- package/dist/useCases/OCRDocument.js +32 -0
- package/dist/useCases/RefreshToken.js +32 -0
- package/dist/useCases/RequestLoginLink.js +32 -0
- package/dist/useCases/SendPreArrivalEmail.js +32 -0
- package/dist/useCases/SendPreArrivalSMS.js +32 -0
- package/dist/useCases/SendVerificationCode.js +32 -0
- package/dist/useCases/SetCamera.js +32 -0
- package/dist/useCases/SetCourtesy.js +32 -0
- package/dist/useCases/SetLock.js +32 -0
- package/dist/useCases/SetSource.js +32 -0
- package/dist/useCases/SetSwitch.js +32 -0
- package/dist/useCases/SetThermostat.js +32 -0
- package/dist/useCases/SetWindowCovering.js +32 -0
- package/dist/useCases/UpdateAlarm.js +32 -0
- package/dist/useCases/UpdateCamera.js +32 -0
- package/dist/useCases/UpdateCourtesy.js +32 -0
- package/dist/useCases/UpdateDimmer.js +32 -0
- package/dist/useCases/UpdateDiscoveredDevice.js +32 -0
- package/dist/useCases/UpdateIntegration.js +32 -0
- package/dist/useCases/UpdateLock.js +32 -0
- package/dist/useCases/UpdateMessageReadStatus.js +32 -0
- package/dist/useCases/UpdateReservation.js +32 -0
- package/dist/useCases/UpdateRoom.js +32 -0
- package/dist/useCases/UpdateSelf.js +32 -0
- package/dist/useCases/UpdateSource.js +32 -0
- package/dist/useCases/UpdateSpace.js +32 -0
- package/dist/useCases/UpdateSwitch.js +32 -0
- package/dist/useCases/UpdateThermostat.js +32 -0
- package/dist/useCases/UpdateTicket.js +32 -0
- package/dist/useCases/UpdateTicketStatus.js +32 -0
- package/dist/useCases/UpdateUser.js +32 -0
- package/dist/useCases/UpdateWindowCovering.js +32 -0
- package/dist/useCases/UpsertDiscoveredDevice.js +32 -0
- package/package.json +26 -7
- package/.eslintrc.js +0 -10
- package/bitbucket-pipelines.yml +0 -71
- package/commands/CheckInReservationCommand.js +0 -23
- package/commands/Command.js +0 -38
- package/commands/DiscoverReservationsCommand.js +0 -24
- package/commands/DiscoverRoomsCommand.js +0 -21
- package/commands/DiscoverUsersCommand.js +0 -21
- package/commands/OCRDocumentCommand.js +0 -20
- package/commands/SendEmailCommand.js +0 -24
- package/commands/SendSMSCommand.js +0 -21
- package/commands/SetAlarmCommand.js +0 -21
- package/commands/SetCourtesyCommand.js +0 -21
- package/commands/SetDimmerCommand.js +0 -21
- package/commands/SetLockCommand.js +0 -21
- package/commands/SetSceneControllerCommand.js +0 -21
- package/commands/SetSwitchCommand.js +0 -21
- package/commands/SetThermostatCommand.js +0 -21
- package/commands/SetWindowCoveringCommand.js +0 -21
- package/commands/index.js +0 -31
- package/defs/deviceTypes.js +0 -15
- package/defs/formalDeviceTypes.js +0 -6
- package/defs/http.js +0 -7
- package/defs/index.js +0 -11
- package/errors/AppError.js +0 -8
- package/errors/AuthenticationError.js +0 -9
- package/errors/AuthorizationError.js +0 -9
- package/errors/DeviceCommError.js +0 -9
- package/errors/LoginError.js +0 -9
- package/errors/NotFoundError.js +0 -9
- package/errors/RequestError.js +0 -9
- package/errors/SystemCommError.js +0 -9
- package/errors/TokenExpiredError.js +0 -9
- package/errors/UnprocessableRequestError.js +0 -9
- package/errors/ValidationError.js +0 -9
- package/errors/index.js +0 -15
- package/events/EmailSentEvent.js +0 -17
- package/events/Event.js +0 -52
- package/events/SMSSentEvent.js +0 -17
- package/events/ShortLinkCreatedEvent.js +0 -17
- package/events/SystemCameraUpdatedEvent.js +0 -17
- package/events/SystemCourtesyUpdatedEvent.js +0 -17
- package/events/SystemDimmerUpdatedEvent.js +0 -17
- package/events/SystemLockUpdatedEvent.js +0 -17
- package/events/SystemReservationUpdatedEvent.js +0 -17
- package/events/SystemSceneControllerUpdatedEvent.js +0 -17
- package/events/SystemSourceUpdatedEvent.js +0 -17
- package/events/SystemSpaceUpdatedEvent.js +0 -17
- package/events/SystemSwitchUpdatedEvent.js +0 -17
- package/events/SystemThermostatUpdatedEvent.js +0 -17
- package/events/SystemUserUpdatedEvent.js +0 -17
- package/events/SystemWindowCoveringUpdatedEvent.js +0 -17
- package/events/index.js +0 -35
- package/http/handleResponseError.js +0 -33
- package/http/handleResponseSuccess.js +0 -15
- package/http/index.js +0 -169
- package/index.js +0 -23
- package/models/acl.js +0 -29
- package/models/admin/customer.js +0 -28
- package/models/admin/property.js +0 -28
- package/models/alarm.js +0 -29
- package/models/application.js +0 -28
- package/models/camera.js +0 -29
- package/models/courtesy.js +0 -33
- package/models/credential.js +0 -29
- package/models/dimmer.js +0 -49
- package/models/discoveredDevice.js +0 -30
- package/models/gateway.js +0 -29
- package/models/identification.js +0 -32
- package/models/index.js +0 -56
- package/models/integration.js +0 -76
- package/models/kohost.js +0 -96
- package/models/lock.js +0 -33
- package/models/mediaSource.js +0 -29
- package/models/motionSensor.js +0 -29
- package/models/product.js +0 -30
- package/models/reservation.js +0 -83
- package/models/room.js +0 -174
- package/models/scene.js +0 -28
- package/models/shortLink.js +0 -29
- package/models/space.js +0 -99
- package/models/switch.js +0 -33
- package/models/thermostat.js +0 -80
- package/models/ticket.js +0 -91
- package/models/user.js +0 -56
- package/models/windowCovering.js +0 -49
- package/prepare.js +0 -4
- package/schemas/acl.json +0 -111
- package/schemas/admin/customer.json +0 -32
- package/schemas/admin/property.json +0 -180
- package/schemas/alarm.json +0 -93
- package/schemas/application.json +0 -24
- package/schemas/camera.json +0 -41
- package/schemas/courtesy.json +0 -37
- package/schemas/credential.json +0 -28
- package/schemas/definitions/common.json +0 -74
- package/schemas/definitions/device.json +0 -76
- package/schemas/dimmer.json +0 -34
- package/schemas/discoveredDevice.json +0 -43
- package/schemas/gateway.json +0 -30
- package/schemas/identification.json +0 -49
- package/schemas/integration.json +0 -94
- package/schemas/lock.json +0 -36
- package/schemas/mediaSource.json +0 -151
- package/schemas/motionSensor.json +0 -26
- package/schemas/payment.json +0 -40
- package/schemas/product.json +0 -36
- package/schemas/reservation.json +0 -71
- package/schemas/room.json +0 -131
- package/schemas/scene.json +0 -118
- package/schemas/shortLink.json +0 -30
- package/schemas/space.json +0 -111
- package/schemas/switch.json +0 -33
- package/schemas/thermostat.json +0 -139
- package/schemas/ticket.json +0 -82
- package/schemas/user.json +0 -176
- package/schemas/windowCovering.json +0 -34
- package/tests/unit/models/space.test.js +0 -31
- package/tests/unit/models/thermostat.test.js +0 -146
- package/tests/unit/models/user.test.js +0 -28
- package/useCases/http.json +0 -1161
- package/utils/getDeviceTypes.js +0 -7
- package/utils/getFormalDeviceType.js +0 -5
- package/utils/schema.js +0 -28
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = function UpdateTicketStatus(requestData, options = {}) {
|
|
2
|
+
if (!requestData)
|
|
3
|
+
requestData = {};
|
|
4
|
+
const pathParams = [":id"];
|
|
5
|
+
const { data, query, headers } = requestData;
|
|
6
|
+
let url = "/tickets/:id/status";
|
|
7
|
+
if (pathParams && data) {
|
|
8
|
+
for (const param of pathParams) {
|
|
9
|
+
const paramName = param.replace(":", "");
|
|
10
|
+
url = url.replace(param, data[paramName]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
14
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
15
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
16
|
+
return Promise.reject(
|
|
17
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
const config = {
|
|
21
|
+
method: "put",
|
|
22
|
+
url,
|
|
23
|
+
...options
|
|
24
|
+
};
|
|
25
|
+
if (data)
|
|
26
|
+
config.data = data;
|
|
27
|
+
if (query)
|
|
28
|
+
config.params = query;
|
|
29
|
+
if (headers)
|
|
30
|
+
config.headers = headers;
|
|
31
|
+
return this._http.request(config);
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = function UpdateUser(requestData, options = {}) {
|
|
2
|
+
if (!requestData)
|
|
3
|
+
requestData = {};
|
|
4
|
+
const pathParams = [":id"];
|
|
5
|
+
const { data, query, headers } = requestData;
|
|
6
|
+
let url = "/users/:id";
|
|
7
|
+
if (pathParams && data) {
|
|
8
|
+
for (const param of pathParams) {
|
|
9
|
+
const paramName = param.replace(":", "");
|
|
10
|
+
url = url.replace(param, data[paramName]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
14
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
15
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
16
|
+
return Promise.reject(
|
|
17
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
const config = {
|
|
21
|
+
method: "put",
|
|
22
|
+
url,
|
|
23
|
+
...options
|
|
24
|
+
};
|
|
25
|
+
if (data)
|
|
26
|
+
config.data = data;
|
|
27
|
+
if (query)
|
|
28
|
+
config.params = query;
|
|
29
|
+
if (headers)
|
|
30
|
+
config.headers = headers;
|
|
31
|
+
return this._http.request(config);
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = function UpdateWindowCovering(requestData, options = {}) {
|
|
2
|
+
if (!requestData)
|
|
3
|
+
requestData = {};
|
|
4
|
+
const pathParams = [":roomId", ":id"];
|
|
5
|
+
const { data, query, headers } = requestData;
|
|
6
|
+
let url = "/rooms/:roomId/windowCoverings/:id";
|
|
7
|
+
if (pathParams && data) {
|
|
8
|
+
for (const param of pathParams) {
|
|
9
|
+
const paramName = param.replace(":", "");
|
|
10
|
+
url = url.replace(param, data[paramName]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
14
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
15
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
16
|
+
return Promise.reject(
|
|
17
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
const config = {
|
|
21
|
+
method: "put",
|
|
22
|
+
url,
|
|
23
|
+
...options
|
|
24
|
+
};
|
|
25
|
+
if (data)
|
|
26
|
+
config.data = data;
|
|
27
|
+
if (query)
|
|
28
|
+
config.params = query;
|
|
29
|
+
if (headers)
|
|
30
|
+
config.headers = headers;
|
|
31
|
+
return this._http.request(config);
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = function UpsertDiscoveredDevice(requestData, options = {}) {
|
|
2
|
+
if (!requestData)
|
|
3
|
+
requestData = {};
|
|
4
|
+
const pathParams = null;
|
|
5
|
+
const { data, query, headers } = requestData;
|
|
6
|
+
let url = "/discoveredDevices/upsert";
|
|
7
|
+
if (pathParams && data) {
|
|
8
|
+
for (const param of pathParams) {
|
|
9
|
+
const paramName = param.replace(":", "");
|
|
10
|
+
url = url.replace(param, data[paramName]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
14
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
15
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
16
|
+
return Promise.reject(
|
|
17
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
const config = {
|
|
21
|
+
method: "post",
|
|
22
|
+
url,
|
|
23
|
+
...options
|
|
24
|
+
};
|
|
25
|
+
if (data)
|
|
26
|
+
config.data = data;
|
|
27
|
+
if (query)
|
|
28
|
+
config.params = query;
|
|
29
|
+
if (headers)
|
|
30
|
+
config.headers = headers;
|
|
31
|
+
return this._http.request(config);
|
|
32
|
+
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kohost/api-client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "API client for Kohost
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
|
+
"description": "API client, models, schemas, commands, and events for Kohost applications",
|
|
5
|
+
"author": "Ian Rogers",
|
|
6
|
+
"main": "dist/cjs/index.cjs.js",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/esm/index.js",
|
|
11
|
+
"require": "./dist/cjs/index.cjs.js"
|
|
12
|
+
},
|
|
13
|
+
"./*": {
|
|
14
|
+
"import": "./dist/esm/*.js",
|
|
15
|
+
"require": "./dist/cjs/*.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
7
18
|
"scripts": {
|
|
8
19
|
"test": "jest",
|
|
9
20
|
"test:watch": "jest --watchAll",
|
|
10
21
|
"lint": "eslint ./",
|
|
11
22
|
"lint:fix": "eslint --fix ./",
|
|
12
|
-
"prepare": "node prepare.js"
|
|
23
|
+
"prepare": "node prepare.js",
|
|
24
|
+
"build": "node scripts/build.js",
|
|
25
|
+
"clean": "rm -rf ./dist"
|
|
13
26
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
16
30
|
"devDependencies": {
|
|
17
31
|
"@kohost/eslint-config": "^1.0.0",
|
|
32
|
+
"esbuild": "^0.17.2",
|
|
18
33
|
"eslint": "^8.6.0",
|
|
19
34
|
"eslint-plugin-jest": "^27.1.3",
|
|
20
35
|
"husky": "^8.0.1",
|
|
@@ -26,11 +41,15 @@
|
|
|
26
41
|
"ajv": "^8.11.0",
|
|
27
42
|
"ajv-formats": "^2.1.1",
|
|
28
43
|
"axios": "^1.0.0",
|
|
44
|
+
"events": "^3.3.0",
|
|
29
45
|
"lodash.clonedeep": "^4.5.0",
|
|
30
46
|
"lodash.findlast": "^4.6.0",
|
|
31
47
|
"lodash.sortby": "^4.7.0",
|
|
32
48
|
"nanoid": "^3.3.4"
|
|
33
49
|
},
|
|
50
|
+
"browser": {
|
|
51
|
+
"events": "events"
|
|
52
|
+
},
|
|
34
53
|
"lint-staged": {
|
|
35
54
|
"*.js": "eslint --cache --fix",
|
|
36
55
|
"*.{js,css,md,json}": "prettier --write"
|
package/.eslintrc.js
DELETED
package/bitbucket-pipelines.yml
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
image: node:16.17.1
|
|
2
|
-
|
|
3
|
-
definitions:
|
|
4
|
-
install-aws-cli: &install-aws-cli |
|
|
5
|
-
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
6
|
-
unzip awscliv2.zip
|
|
7
|
-
./aws/install
|
|
8
|
-
|
|
9
|
-
pipelines:
|
|
10
|
-
custom:
|
|
11
|
-
publish-use-cases:
|
|
12
|
-
- variables:
|
|
13
|
-
- name: USE_CASE_HASH
|
|
14
|
-
- step:
|
|
15
|
-
image: atlassian/default-image:3
|
|
16
|
-
name: Fetch use cases
|
|
17
|
-
script:
|
|
18
|
-
- *install-aws-cli
|
|
19
|
-
## fetch use cases from s3
|
|
20
|
-
- aws s3 cp s3://cloud-v3-data/useCases/useCases-${USE_CASE_HASH}.json ./useCases/http.json
|
|
21
|
-
## commit the result
|
|
22
|
-
- git commit -am "Update use cases"
|
|
23
|
-
- git push
|
|
24
|
-
|
|
25
|
-
pull-requests:
|
|
26
|
-
"**":
|
|
27
|
-
- step:
|
|
28
|
-
name: Install dependencies and build
|
|
29
|
-
caches:
|
|
30
|
-
- node
|
|
31
|
-
script:
|
|
32
|
-
- npm ci
|
|
33
|
-
- npm rum lint
|
|
34
|
-
branches:
|
|
35
|
-
master:
|
|
36
|
-
- step:
|
|
37
|
-
name: Build and publish to NPM
|
|
38
|
-
caches:
|
|
39
|
-
- node
|
|
40
|
-
script:
|
|
41
|
-
- npm ci
|
|
42
|
-
- pipe: atlassian/npm-publish:0.3.2
|
|
43
|
-
variables:
|
|
44
|
-
NPM_TOKEN: $NPM_TOKEN
|
|
45
|
-
dev:
|
|
46
|
-
- step:
|
|
47
|
-
name: Build and publish to NPM
|
|
48
|
-
caches:
|
|
49
|
-
- node
|
|
50
|
-
script:
|
|
51
|
-
- npm ci
|
|
52
|
-
- npm version prerelease --preid=beta -m "Upgrade to %s [skip ci]"
|
|
53
|
-
- git push && git push --tags
|
|
54
|
-
- pipe: atlassian/npm-publish:0.3.2
|
|
55
|
-
variables:
|
|
56
|
-
NPM_TOKEN: $NPM_TOKEN
|
|
57
|
-
EXTRA_ARGS: --tag next
|
|
58
|
-
|
|
59
|
-
v1:
|
|
60
|
-
- step:
|
|
61
|
-
name: Build and publish to NPM
|
|
62
|
-
caches:
|
|
63
|
-
- node
|
|
64
|
-
script:
|
|
65
|
-
- npm ci
|
|
66
|
-
- npm version prerelease --preid=beta -m "Upgrade to %s [skip ci]"
|
|
67
|
-
- git push && git push --tags
|
|
68
|
-
- pipe: atlassian/npm-publish:0.3.2
|
|
69
|
-
variables:
|
|
70
|
-
NPM_TOKEN: $NPM_TOKEN
|
|
71
|
-
EXTRA_ARGS: --tag next-v1
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
const RequestError = require("../errors/RequestError");
|
|
3
|
-
|
|
4
|
-
class CheckInReservationCommand extends Command {
|
|
5
|
-
constructor({ id }) {
|
|
6
|
-
if (!id) throw new RequestError("document type is required");
|
|
7
|
-
super({ id });
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
get name() {
|
|
11
|
-
return "CheckInReservation";
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
get routingKey() {
|
|
15
|
-
return `reservation.${this.data.id}.checkin`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get replyTo() {
|
|
19
|
-
return "system.response.reservations";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = CheckInReservationCommand;
|
package/commands/Command.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
class Command {
|
|
2
|
-
constructor(data) {
|
|
3
|
-
this.data = {};
|
|
4
|
-
if (!data) throw new Error("Command data is required");
|
|
5
|
-
if (typeof data !== "object")
|
|
6
|
-
throw new Error("Command data must be an object");
|
|
7
|
-
|
|
8
|
-
for (const key in data) {
|
|
9
|
-
this.data[key] = data[key];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
get name() {
|
|
14
|
-
throw new Error("Command name is required");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get type() {
|
|
18
|
-
return "Command";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
get routingKey() {
|
|
22
|
-
return "";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get exchange() {
|
|
26
|
-
return "Commands";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get replyTo() {
|
|
30
|
-
return "amq.rabbitmq.reply-to";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
build() {
|
|
34
|
-
return { data: { ...this.data } };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = Command;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const { RequestError } = require("../errors");
|
|
2
|
-
const Command = require("./Command");
|
|
3
|
-
|
|
4
|
-
class DiscoverReservationsCommand extends Command {
|
|
5
|
-
constructor(options) {
|
|
6
|
-
if (!options) throw new RequestError("options are required");
|
|
7
|
-
const { id, startDate, endDate, status } = options;
|
|
8
|
-
super({ id, startDate, endDate, status });
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
get name() {
|
|
12
|
-
return "DiscoverReservations";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get routingKey() {
|
|
16
|
-
return "reservation.discover";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get replyTo() {
|
|
20
|
-
return "system.response.reservations";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = DiscoverReservationsCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class DiscoverRoomsCommand extends Command {
|
|
4
|
-
constructor({ id }) {
|
|
5
|
-
super({ id });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "DiscoverRooms";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `rooms.${this.data.id}.get`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.users";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = DiscoverRoomsCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class DiscoverUsersCommand extends Command {
|
|
4
|
-
constructor({ id }) {
|
|
5
|
-
super({ id });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "DiscoverUsers";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `users.${this.data.id}.get`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.users";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = DiscoverUsersCommand;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
const RequestError = require("../errors/RequestError");
|
|
3
|
-
|
|
4
|
-
class OCRDocumentCommand extends Command {
|
|
5
|
-
constructor({ type, image }) {
|
|
6
|
-
if (!type) throw new RequestError("document type is required");
|
|
7
|
-
if (!image) throw new RequestError("document image is required");
|
|
8
|
-
super({ type, image });
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
get name() {
|
|
12
|
-
return "OCRDocument";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get routingKey() {
|
|
16
|
-
return `document.${this.data.type}.ocr`;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = OCRDocumentCommand;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
const RequestError = require("../errors/RequestError");
|
|
3
|
-
|
|
4
|
-
class SendEmailCommand extends Command {
|
|
5
|
-
constructor({ text, html, to, from, subject, eventData }) {
|
|
6
|
-
if (!to) throw new RequestError("email to is required");
|
|
7
|
-
if (!from) throw new RequestError("email from is required");
|
|
8
|
-
if (!subject) throw new RequestError("email subject is required");
|
|
9
|
-
if (!text && !html)
|
|
10
|
-
throw new RequestError("email text or html is required");
|
|
11
|
-
|
|
12
|
-
super({ text, html, to, from, subject, eventData });
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get name() {
|
|
16
|
-
return "SendEmail";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get routingKey() {
|
|
20
|
-
return "comm.email.send";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = SendEmailCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
const RequestError = require("../errors/RequestError");
|
|
3
|
-
|
|
4
|
-
class SendSMSCommand extends Command {
|
|
5
|
-
constructor({ body, to, from, metaData }) {
|
|
6
|
-
if (!body) throw new RequestError("sms body is required");
|
|
7
|
-
if (!to) throw new RequestError("sms to is required");
|
|
8
|
-
if (!from) throw new RequestError("sms from is required");
|
|
9
|
-
super({ body, to, from, metaData });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get name() {
|
|
13
|
-
return "SendSMS";
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get routingKey() {
|
|
17
|
-
return "comm.sms.send";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SendSMSCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetAlarmCommand extends Command {
|
|
4
|
-
constructor({ id, zones, areas }) {
|
|
5
|
-
super({ id, zones, areas });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetAlarm";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `alarm.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetAlarmCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetCourtesyCommand extends Command {
|
|
4
|
-
constructor({ id, state }) {
|
|
5
|
-
super({ id, state });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetCourtesy";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `courtesy.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetCourtesyCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetDimmerCommand extends Command {
|
|
4
|
-
constructor({ id, level }) {
|
|
5
|
-
super({ id, level });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetDimmer";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `dimmer.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetDimmerCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetLockCommand extends Command {
|
|
4
|
-
constructor({ id, state }) {
|
|
5
|
-
super({ id, state });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetLock";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `lock.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetLockCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetSceneControllerCommand extends Command {
|
|
4
|
-
constructor({ id, scene }) {
|
|
5
|
-
super({ id, scene });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetSceneController";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `sceneController.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetSceneControllerCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetSwitchCommand extends Command {
|
|
4
|
-
constructor({ id, state }) {
|
|
5
|
-
super({ id, state });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetSwitch";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `switch.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetSwitchCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetThermostatCommand extends Command {
|
|
4
|
-
constructor({ id, setpoints, hvacMode, fanMode }) {
|
|
5
|
-
super({ id, setpoints, hvacMode, fanMode });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetThermostat";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `thermostat.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetThermostatCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const Command = require("./Command");
|
|
2
|
-
|
|
3
|
-
class SetWindowCoveringCommand extends Command {
|
|
4
|
-
constructor({ id, position }) {
|
|
5
|
-
super({ id, position });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get name() {
|
|
9
|
-
return "SetWindowCovering";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get routingKey() {
|
|
13
|
-
return `windowCovering.${this.data.id}.set`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get replyTo() {
|
|
17
|
-
return "system.response.devices";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = SetWindowCoveringCommand;
|
package/commands/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const SetAlarmCommand = require("./SetAlarmCommand");
|
|
2
|
-
const SetDimmerCommand = require("./SetDimmerCommand");
|
|
3
|
-
const SetSwitchCommand = require("./SetSwitchCommand");
|
|
4
|
-
const SetThermostatCommand = require("./SetThermostatCommand");
|
|
5
|
-
const SetLockCommand = require("./SetLockCommand");
|
|
6
|
-
const SetSceneControllerCommand = require("./SetSceneControllerCommand");
|
|
7
|
-
const SetWindowCoveringCommand = require("./SetWindowCoveringCommand");
|
|
8
|
-
const SetCourtesyCommand = require("./SetCourtesyCommand");
|
|
9
|
-
const DiscoverUsersCommand = require("./DiscoverUsersCommand");
|
|
10
|
-
const OCRDocumentCommand = require("./OCRDocumentCommand");
|
|
11
|
-
const CheckInReservationCommand = require("./CheckInReservationCommand");
|
|
12
|
-
const SendSMSCommand = require("./SendSMSCommand");
|
|
13
|
-
const DiscoverReservationsCommand = require("./DiscoverReservationsCommand");
|
|
14
|
-
const DiscoverRoomsCommand = require("./DiscoverRoomsCommand");
|
|
15
|
-
|
|
16
|
-
module.exports = {
|
|
17
|
-
SetAlarmCommand,
|
|
18
|
-
SetDimmerCommand,
|
|
19
|
-
SetSwitchCommand,
|
|
20
|
-
SetThermostatCommand,
|
|
21
|
-
SetLockCommand,
|
|
22
|
-
SetSceneControllerCommand,
|
|
23
|
-
SetWindowCoveringCommand,
|
|
24
|
-
SetCourtesyCommand,
|
|
25
|
-
OCRDocumentCommand,
|
|
26
|
-
DiscoverUsersCommand,
|
|
27
|
-
CheckInReservationCommand,
|
|
28
|
-
SendSMSCommand,
|
|
29
|
-
DiscoverReservationsCommand,
|
|
30
|
-
DiscoverRoomsCommand,
|
|
31
|
-
};
|