@juhuu/sdk-ts 1.2.286 → 1.2.288

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/index.d.mts CHANGED
@@ -6207,15 +6207,20 @@ declare namespace JUHUU {
6207
6207
  }
6208
6208
  namespace Kit {
6209
6209
  type KitType = "controlKitV1" | "tapkeyV1" | "emzV1";
6210
+ type KitStatus = "setupComplete" | "waitingForSetup";
6210
6211
  type BaseKit = {
6211
6212
  id: string;
6212
6213
  readonly object: "kit";
6213
6214
  name: string;
6214
6215
  propertyId: string | null;
6216
+ status: KitStatus;
6215
6217
  };
6216
6218
  type ControlKitV1 = BaseKit & {
6217
6219
  type: "controlKitV1";
6218
6220
  simIdArray: string[];
6221
+ mqttTopicId: string;
6222
+ signalStrengthPercentage: number;
6223
+ teltonikaSerialNumber: string;
6219
6224
  };
6220
6225
  type TapkeyV1 = BaseKit & {
6221
6226
  type: "tapkeyV1";
@@ -6237,23 +6242,31 @@ declare namespace JUHUU {
6237
6242
  type Params = {
6238
6243
  name?: string;
6239
6244
  propertyId: string;
6240
- template: {
6241
- type: "controlKitV1";
6242
- simIdArray: string[];
6243
- } | {
6244
- type: "tapkeyV1";
6245
- physicalLockId: string;
6246
- boundLockId: string;
6247
- ownerAccountId: string;
6248
- ipId: string;
6249
- } | {
6250
- type: "emzV1";
6251
- contractId: string;
6252
- targetHardwareId: string;
6253
- userId: string;
6254
- username: string;
6255
- password: string;
6256
- };
6245
+ type: "controlKitV1";
6246
+ status: KitStatus;
6247
+ simIdArray: string[];
6248
+ mqttTopicId: string;
6249
+ signalStrengthPercentage: number;
6250
+ teltonikaSerialNumber: string;
6251
+ } | {
6252
+ name?: string;
6253
+ propertyId: string;
6254
+ type: "tapkeyV1";
6255
+ status: KitStatus;
6256
+ physicalLockId: string;
6257
+ boundLockId: string;
6258
+ ownerAccountId: string;
6259
+ ipId: string;
6260
+ } | {
6261
+ name?: string;
6262
+ propertyId: string;
6263
+ type: "emzV1";
6264
+ status: KitStatus;
6265
+ contractId: string;
6266
+ targetHardwareId: string;
6267
+ userId: string;
6268
+ username: string;
6269
+ password: string;
6257
6270
  };
6258
6271
  type Options = JUHUU.RequestOptions;
6259
6272
  type Response = {
@@ -6550,13 +6563,15 @@ declare namespace JUHUU {
6550
6563
  type Params = {};
6551
6564
  type Options = JUHUU.RequestOptions;
6552
6565
  type Response = {
6553
- subscribe: (locationIdArray?: string[], parameterIdArray?: string[]) => void;
6566
+ subscribe: (locationIdArray?: string[], parameterIdArray?: string[], sessionIdArray?: string[]) => void;
6554
6567
  unsubscribeFromLocations: (locationIdArray: string[]) => void;
6555
6568
  unsubscribeFromParameters: (parameterIdArray: string[]) => void;
6556
- unsubscribe: (locationIdArray?: string[], parameterIdArray?: string[]) => void;
6569
+ unsubscribeFromSessions: (sessionIdArray: string[]) => void;
6570
+ unsubscribe: (locationIdArray?: string[], parameterIdArray?: string[], sessionIdArray?: string[]) => void;
6557
6571
  ping: (data?: any) => void;
6558
6572
  onLocationUpdate: (callback: (message: JUHUU.Websocket.LocationUpdate) => void) => void;
6559
6573
  onParameterUpdate: (callback: (message: JUHUU.Websocket.ParameterUpdate) => void) => void;
6574
+ onSessionUpdate: (callback: (message: JUHUU.Websocket.SessionUpdate) => void) => void;
6560
6575
  onPong: (callback: (message: any) => void) => void;
6561
6576
  close: () => void;
6562
6577
  };
@@ -6574,11 +6589,18 @@ declare namespace JUHUU {
6574
6589
  changedFields: string[];
6575
6590
  initiatedAt?: Date;
6576
6591
  };
6592
+ type SessionUpdate = {
6593
+ sessionId: string;
6594
+ before: JUHUU.Session.Object;
6595
+ after: JUHUU.Session.Object;
6596
+ changedFields: string[];
6597
+ };
6577
6598
  type SubscriptionSuccess = {
6578
6599
  locationIdArray: string[];
6579
6600
  parameterIdArray: string[];
6601
+ sessionIdArray: string[];
6580
6602
  subscriptionResultArray: Array<{
6581
- type: "location" | "parameter";
6603
+ type: "location" | "parameter" | "session";
6582
6604
  id: string;
6583
6605
  roomName: string;
6584
6606
  success: boolean;
@@ -6588,8 +6610,9 @@ declare namespace JUHUU {
6588
6610
  type UnsubscriptionSuccess = {
6589
6611
  locationIdArray: string[];
6590
6612
  parameterIdArray: string[];
6613
+ sessionIdArray: string[];
6591
6614
  unsubscriptionResultArray: Array<{
6592
- type: "location" | "parameter";
6615
+ type: "location" | "parameter" | "session";
6593
6616
  id: string;
6594
6617
  roomName: string;
6595
6618
  success: boolean;
package/dist/index.d.ts CHANGED
@@ -6207,15 +6207,20 @@ declare namespace JUHUU {
6207
6207
  }
6208
6208
  namespace Kit {
6209
6209
  type KitType = "controlKitV1" | "tapkeyV1" | "emzV1";
6210
+ type KitStatus = "setupComplete" | "waitingForSetup";
6210
6211
  type BaseKit = {
6211
6212
  id: string;
6212
6213
  readonly object: "kit";
6213
6214
  name: string;
6214
6215
  propertyId: string | null;
6216
+ status: KitStatus;
6215
6217
  };
6216
6218
  type ControlKitV1 = BaseKit & {
6217
6219
  type: "controlKitV1";
6218
6220
  simIdArray: string[];
6221
+ mqttTopicId: string;
6222
+ signalStrengthPercentage: number;
6223
+ teltonikaSerialNumber: string;
6219
6224
  };
6220
6225
  type TapkeyV1 = BaseKit & {
6221
6226
  type: "tapkeyV1";
@@ -6237,23 +6242,31 @@ declare namespace JUHUU {
6237
6242
  type Params = {
6238
6243
  name?: string;
6239
6244
  propertyId: string;
6240
- template: {
6241
- type: "controlKitV1";
6242
- simIdArray: string[];
6243
- } | {
6244
- type: "tapkeyV1";
6245
- physicalLockId: string;
6246
- boundLockId: string;
6247
- ownerAccountId: string;
6248
- ipId: string;
6249
- } | {
6250
- type: "emzV1";
6251
- contractId: string;
6252
- targetHardwareId: string;
6253
- userId: string;
6254
- username: string;
6255
- password: string;
6256
- };
6245
+ type: "controlKitV1";
6246
+ status: KitStatus;
6247
+ simIdArray: string[];
6248
+ mqttTopicId: string;
6249
+ signalStrengthPercentage: number;
6250
+ teltonikaSerialNumber: string;
6251
+ } | {
6252
+ name?: string;
6253
+ propertyId: string;
6254
+ type: "tapkeyV1";
6255
+ status: KitStatus;
6256
+ physicalLockId: string;
6257
+ boundLockId: string;
6258
+ ownerAccountId: string;
6259
+ ipId: string;
6260
+ } | {
6261
+ name?: string;
6262
+ propertyId: string;
6263
+ type: "emzV1";
6264
+ status: KitStatus;
6265
+ contractId: string;
6266
+ targetHardwareId: string;
6267
+ userId: string;
6268
+ username: string;
6269
+ password: string;
6257
6270
  };
6258
6271
  type Options = JUHUU.RequestOptions;
6259
6272
  type Response = {
@@ -6550,13 +6563,15 @@ declare namespace JUHUU {
6550
6563
  type Params = {};
6551
6564
  type Options = JUHUU.RequestOptions;
6552
6565
  type Response = {
6553
- subscribe: (locationIdArray?: string[], parameterIdArray?: string[]) => void;
6566
+ subscribe: (locationIdArray?: string[], parameterIdArray?: string[], sessionIdArray?: string[]) => void;
6554
6567
  unsubscribeFromLocations: (locationIdArray: string[]) => void;
6555
6568
  unsubscribeFromParameters: (parameterIdArray: string[]) => void;
6556
- unsubscribe: (locationIdArray?: string[], parameterIdArray?: string[]) => void;
6569
+ unsubscribeFromSessions: (sessionIdArray: string[]) => void;
6570
+ unsubscribe: (locationIdArray?: string[], parameterIdArray?: string[], sessionIdArray?: string[]) => void;
6557
6571
  ping: (data?: any) => void;
6558
6572
  onLocationUpdate: (callback: (message: JUHUU.Websocket.LocationUpdate) => void) => void;
6559
6573
  onParameterUpdate: (callback: (message: JUHUU.Websocket.ParameterUpdate) => void) => void;
6574
+ onSessionUpdate: (callback: (message: JUHUU.Websocket.SessionUpdate) => void) => void;
6560
6575
  onPong: (callback: (message: any) => void) => void;
6561
6576
  close: () => void;
6562
6577
  };
@@ -6574,11 +6589,18 @@ declare namespace JUHUU {
6574
6589
  changedFields: string[];
6575
6590
  initiatedAt?: Date;
6576
6591
  };
6592
+ type SessionUpdate = {
6593
+ sessionId: string;
6594
+ before: JUHUU.Session.Object;
6595
+ after: JUHUU.Session.Object;
6596
+ changedFields: string[];
6597
+ };
6577
6598
  type SubscriptionSuccess = {
6578
6599
  locationIdArray: string[];
6579
6600
  parameterIdArray: string[];
6601
+ sessionIdArray: string[];
6580
6602
  subscriptionResultArray: Array<{
6581
- type: "location" | "parameter";
6603
+ type: "location" | "parameter" | "session";
6582
6604
  id: string;
6583
6605
  roomName: string;
6584
6606
  success: boolean;
@@ -6588,8 +6610,9 @@ declare namespace JUHUU {
6588
6610
  type UnsubscriptionSuccess = {
6589
6611
  locationIdArray: string[];
6590
6612
  parameterIdArray: string[];
6613
+ sessionIdArray: string[];
6591
6614
  unsubscriptionResultArray: Array<{
6592
- type: "location" | "parameter";
6615
+ type: "location" | "parameter" | "session";
6593
6616
  id: string;
6594
6617
  roomName: string;
6595
6618
  success: boolean;
package/dist/index.js CHANGED
@@ -2041,11 +2041,20 @@ var WebsocketsService = class extends Service {
2041
2041
  }
2042
2042
  );
2043
2043
  };
2044
+ const onSessionUpdate = (callback) => {
2045
+ socket.on(
2046
+ "session_update",
2047
+ (message) => {
2048
+ callback(message);
2049
+ }
2050
+ );
2051
+ };
2044
2052
  return {
2045
- subscribe: (locationIdArray, parameterIdArray) => {
2053
+ subscribe: (locationIdArray, parameterIdArray, sessionIdArray) => {
2046
2054
  socket.emit("subscribe", {
2047
2055
  locationIdArray: locationIdArray || [],
2048
- parameterIdArray: parameterIdArray || []
2056
+ parameterIdArray: parameterIdArray || [],
2057
+ sessionIdArray: sessionIdArray || []
2049
2058
  });
2050
2059
  },
2051
2060
  unsubscribeFromLocations: (locationIdArray) => {
@@ -2054,10 +2063,14 @@ var WebsocketsService = class extends Service {
2054
2063
  unsubscribeFromParameters: (parameterIdArray) => {
2055
2064
  socket.emit("unsubscribe", { parameterIdArray });
2056
2065
  },
2057
- unsubscribe: (locationIdArray, parameterIdArray) => {
2066
+ unsubscribeFromSessions: (sessionIdArray) => {
2067
+ socket.emit("unsubscribe", { sessionIdArray });
2068
+ },
2069
+ unsubscribe: (locationIdArray, parameterIdArray, sessionIdArray) => {
2058
2070
  socket.emit("unsubscribe", {
2059
2071
  locationIdArray: locationIdArray || [],
2060
- parameterIdArray: parameterIdArray || []
2072
+ parameterIdArray: parameterIdArray || [],
2073
+ sessionIdArray: sessionIdArray || []
2061
2074
  });
2062
2075
  },
2063
2076
  ping: (data) => {
@@ -2065,6 +2078,7 @@ var WebsocketsService = class extends Service {
2065
2078
  },
2066
2079
  onLocationUpdate,
2067
2080
  onParameterUpdate,
2081
+ onSessionUpdate,
2068
2082
  onPong: (callback) => {
2069
2083
  socket.on("pong", callback);
2070
2084
  },
@@ -5036,15 +5050,34 @@ var KitsService = class extends Service {
5036
5050
  super(config);
5037
5051
  }
5038
5052
  async create(params, options) {
5053
+ const body = {
5054
+ name: params.name,
5055
+ propertyId: params.propertyId,
5056
+ type: params.type,
5057
+ status: params.status
5058
+ };
5059
+ if (params.type === "controlKitV1") {
5060
+ body.simIdArray = params.simIdArray;
5061
+ body.mqttTopicId = params.mqttTopicId;
5062
+ body.signalStrengthPercentage = params.signalStrengthPercentage;
5063
+ body.teltonikaSerialNumber = params.teltonikaSerialNumber;
5064
+ } else if (params.type === "tapkeyV1") {
5065
+ body.physicalLockId = params.physicalLockId;
5066
+ body.boundLockId = params.boundLockId;
5067
+ body.ownerAccountId = params.ownerAccountId;
5068
+ body.ipId = params.ipId;
5069
+ } else if (params.type === "emzV1") {
5070
+ body.contractId = params.contractId;
5071
+ body.targetHardwareId = params.targetHardwareId;
5072
+ body.userId = params.userId;
5073
+ body.username = params.username;
5074
+ body.password = params.password;
5075
+ }
5039
5076
  return await super.sendRequest(
5040
5077
  {
5041
5078
  method: "POST",
5042
5079
  url: "kits",
5043
- body: {
5044
- name: params.name,
5045
- propertyId: params.propertyId,
5046
- template: params.template
5047
- },
5080
+ body,
5048
5081
  authenticationNotOptional: true
5049
5082
  },
5050
5083
  options
package/dist/index.mjs CHANGED
@@ -1997,11 +1997,20 @@ var WebsocketsService = class extends Service {
1997
1997
  }
1998
1998
  );
1999
1999
  };
2000
+ const onSessionUpdate = (callback) => {
2001
+ socket.on(
2002
+ "session_update",
2003
+ (message) => {
2004
+ callback(message);
2005
+ }
2006
+ );
2007
+ };
2000
2008
  return {
2001
- subscribe: (locationIdArray, parameterIdArray) => {
2009
+ subscribe: (locationIdArray, parameterIdArray, sessionIdArray) => {
2002
2010
  socket.emit("subscribe", {
2003
2011
  locationIdArray: locationIdArray || [],
2004
- parameterIdArray: parameterIdArray || []
2012
+ parameterIdArray: parameterIdArray || [],
2013
+ sessionIdArray: sessionIdArray || []
2005
2014
  });
2006
2015
  },
2007
2016
  unsubscribeFromLocations: (locationIdArray) => {
@@ -2010,10 +2019,14 @@ var WebsocketsService = class extends Service {
2010
2019
  unsubscribeFromParameters: (parameterIdArray) => {
2011
2020
  socket.emit("unsubscribe", { parameterIdArray });
2012
2021
  },
2013
- unsubscribe: (locationIdArray, parameterIdArray) => {
2022
+ unsubscribeFromSessions: (sessionIdArray) => {
2023
+ socket.emit("unsubscribe", { sessionIdArray });
2024
+ },
2025
+ unsubscribe: (locationIdArray, parameterIdArray, sessionIdArray) => {
2014
2026
  socket.emit("unsubscribe", {
2015
2027
  locationIdArray: locationIdArray || [],
2016
- parameterIdArray: parameterIdArray || []
2028
+ parameterIdArray: parameterIdArray || [],
2029
+ sessionIdArray: sessionIdArray || []
2017
2030
  });
2018
2031
  },
2019
2032
  ping: (data) => {
@@ -2021,6 +2034,7 @@ var WebsocketsService = class extends Service {
2021
2034
  },
2022
2035
  onLocationUpdate,
2023
2036
  onParameterUpdate,
2037
+ onSessionUpdate,
2024
2038
  onPong: (callback) => {
2025
2039
  socket.on("pong", callback);
2026
2040
  },
@@ -4992,15 +5006,34 @@ var KitsService = class extends Service {
4992
5006
  super(config);
4993
5007
  }
4994
5008
  async create(params, options) {
5009
+ const body = {
5010
+ name: params.name,
5011
+ propertyId: params.propertyId,
5012
+ type: params.type,
5013
+ status: params.status
5014
+ };
5015
+ if (params.type === "controlKitV1") {
5016
+ body.simIdArray = params.simIdArray;
5017
+ body.mqttTopicId = params.mqttTopicId;
5018
+ body.signalStrengthPercentage = params.signalStrengthPercentage;
5019
+ body.teltonikaSerialNumber = params.teltonikaSerialNumber;
5020
+ } else if (params.type === "tapkeyV1") {
5021
+ body.physicalLockId = params.physicalLockId;
5022
+ body.boundLockId = params.boundLockId;
5023
+ body.ownerAccountId = params.ownerAccountId;
5024
+ body.ipId = params.ipId;
5025
+ } else if (params.type === "emzV1") {
5026
+ body.contractId = params.contractId;
5027
+ body.targetHardwareId = params.targetHardwareId;
5028
+ body.userId = params.userId;
5029
+ body.username = params.username;
5030
+ body.password = params.password;
5031
+ }
4995
5032
  return await super.sendRequest(
4996
5033
  {
4997
5034
  method: "POST",
4998
5035
  url: "kits",
4999
- body: {
5000
- name: params.name,
5001
- propertyId: params.propertyId,
5002
- template: params.template
5003
- },
5036
+ body,
5004
5037
  authenticationNotOptional: true
5005
5038
  },
5006
5039
  options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juhuu/sdk-ts",
3
- "version": "1.2.286",
3
+ "version": "1.2.288",
4
4
  "description": "Typescript wrapper for JUHUU services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",