@kohost/api-client 7.8.1 → 7.9.0

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.
Files changed (288) hide show
  1. package/dist/httpClient.js +2 -3
  2. package/dist/httpClient.js.map +1 -1
  3. package/dist/lib/deliveryStatus.d.ts +3 -0
  4. package/dist/lib/deliveryStatus.js +31 -0
  5. package/dist/lib/deliveryStatus.js.map +1 -0
  6. package/dist/lib/emergencyContacts.d.ts +14 -0
  7. package/dist/lib/emergencyContacts.js +1 -0
  8. package/dist/lib/index.d.ts +6 -1
  9. package/dist/lib/index.js +15 -2
  10. package/dist/lib/index.js.map +1 -1
  11. package/dist/lib/messageErrorCodes.d.ts +4 -0
  12. package/dist/lib/messageErrorCodes.js +24 -0
  13. package/dist/lib/messageErrorCodes.js.map +1 -0
  14. package/dist/lib/money.d.ts +7 -1
  15. package/dist/lib/money.js +11 -2
  16. package/dist/lib/money.js.map +1 -1
  17. package/dist/lib/sisDrivers.d.ts +3 -0
  18. package/dist/lib/sisDrivers.js +9 -0
  19. package/dist/lib/sisDrivers.js.map +1 -0
  20. package/dist/lib/sosAudiences.d.ts +2 -0
  21. package/dist/lib/sosAudiences.js +6 -0
  22. package/dist/lib/sosAudiences.js.map +1 -0
  23. package/dist/models/announcement.js +4 -2
  24. package/dist/models/announcement.js.map +1 -1
  25. package/dist/models/category.js +2 -0
  26. package/dist/models/category.js.map +1 -1
  27. package/dist/models/emailMessage.js +1 -0
  28. package/dist/models/emailMessage.js.map +1 -1
  29. package/dist/models/index.d.ts +2 -0
  30. package/dist/models/index.js +5 -1
  31. package/dist/models/index.js.map +1 -1
  32. package/dist/models/resource.d.ts +17 -0
  33. package/dist/models/resource.js +31 -0
  34. package/dist/models/resource.js.map +1 -0
  35. package/dist/models/smsMessage.js +1 -0
  36. package/dist/models/smsMessage.js.map +1 -1
  37. package/dist/models/sosEvent.d.ts +17 -0
  38. package/dist/models/sosEvent.js +29 -0
  39. package/dist/models/sosEvent.js.map +1 -0
  40. package/dist/models/systemUser.js +2 -0
  41. package/dist/models/systemUser.js.map +1 -1
  42. package/dist/schemas/announcement.d.ts +47 -3
  43. package/dist/schemas/announcement.js +50 -4
  44. package/dist/schemas/announcement.js.map +1 -1
  45. package/dist/schemas/category.d.ts +11 -1
  46. package/dist/schemas/category.js +12 -1
  47. package/dist/schemas/category.js.map +1 -1
  48. package/dist/schemas/definitions.d.ts +160 -0
  49. package/dist/schemas/definitions.js +104 -1
  50. package/dist/schemas/definitions.js.map +1 -1
  51. package/dist/schemas/emailMessage.d.ts +4 -0
  52. package/dist/schemas/emailMessage.js +4 -0
  53. package/dist/schemas/emailMessage.js.map +1 -1
  54. package/dist/schemas/index.d.ts +2 -0
  55. package/dist/schemas/index.js +3 -1
  56. package/dist/schemas/organization.d.ts +19 -0
  57. package/dist/schemas/organization.js +13 -0
  58. package/dist/schemas/organization.js.map +1 -1
  59. package/dist/schemas/property.d.ts +14 -0
  60. package/dist/schemas/property.js +12 -0
  61. package/dist/schemas/property.js.map +1 -1
  62. package/dist/schemas/resource.d.ts +137 -0
  63. package/dist/schemas/resource.js +112 -0
  64. package/dist/schemas/resource.js.map +1 -0
  65. package/dist/schemas/smsMessage.d.ts +4 -0
  66. package/dist/schemas/smsMessage.js +4 -0
  67. package/dist/schemas/smsMessage.js.map +1 -1
  68. package/dist/schemas/sosEvent.d.ts +318 -0
  69. package/dist/schemas/sosEvent.js +267 -0
  70. package/dist/schemas/sosEvent.js.map +1 -0
  71. package/dist/schemas/systemUser.d.ts +8 -0
  72. package/dist/schemas/systemUser.js +9 -1
  73. package/dist/schemas/systemUser.js.map +1 -1
  74. package/dist/schemas/ticket.d.ts +1 -1
  75. package/dist/schemas/ticket.js +1 -0
  76. package/dist/schemas/ticket.js.map +1 -1
  77. package/dist/useCases/autoAssociateDiscoveredDevices.d.ts +3 -3
  78. package/dist/useCases/autoAssociateDiscoveredDevices.js.map +1 -1
  79. package/dist/useCases/bulkUpdateIssue.d.ts +3 -3
  80. package/dist/useCases/bulkUpdateIssue.js.map +1 -1
  81. package/dist/useCases/copyIssueRouting.d.ts +3 -3
  82. package/dist/useCases/copyIssueRouting.js.map +1 -1
  83. package/dist/useCases/createAutomation.d.ts +3 -3
  84. package/dist/useCases/createAutomation.js.map +1 -1
  85. package/dist/useCases/createBill.d.ts +3 -3
  86. package/dist/useCases/createBill.js.map +1 -1
  87. package/dist/useCases/createBillingCategory.d.ts +3 -3
  88. package/dist/useCases/createBillingCategory.js.map +1 -1
  89. package/dist/useCases/createCategory.d.ts +3 -3
  90. package/dist/useCases/createCategory.js.map +1 -1
  91. package/dist/useCases/createDefaultAutomations.d.ts +3 -3
  92. package/dist/useCases/createDefaultAutomations.js.map +1 -1
  93. package/dist/useCases/createDepartment.d.ts +3 -3
  94. package/dist/useCases/createDepartment.js.map +1 -1
  95. package/dist/useCases/createDiscoveredDevice.d.ts +3 -3
  96. package/dist/useCases/createDiscoveredDevice.js.map +1 -1
  97. package/dist/useCases/createDiscoveredDeviceAssociationMap.d.ts +3 -3
  98. package/dist/useCases/createDiscoveredDeviceAssociationMap.js.map +1 -1
  99. package/dist/useCases/createIssue.d.ts +3 -3
  100. package/dist/useCases/createIssue.js.map +1 -1
  101. package/dist/useCases/createOrganization.d.ts +3 -3
  102. package/dist/useCases/createOrganization.js.map +1 -1
  103. package/dist/useCases/createPolicy.d.ts +3 -3
  104. package/dist/useCases/createPolicy.js.map +1 -1
  105. package/dist/useCases/createProperty.d.ts +3 -3
  106. package/dist/useCases/createProperty.js.map +1 -1
  107. package/dist/useCases/createPwaHandoffToken.d.ts +3 -3
  108. package/dist/useCases/createPwaHandoffToken.js.map +1 -1
  109. package/dist/useCases/createResource.d.ts +27 -0
  110. package/dist/useCases/createResource.js +47 -0
  111. package/dist/useCases/createResource.js.map +1 -0
  112. package/dist/useCases/createServer.d.ts +3 -3
  113. package/dist/useCases/createServer.js.map +1 -1
  114. package/dist/useCases/createSpace.d.ts +3 -3
  115. package/dist/useCases/createSpace.js.map +1 -1
  116. package/dist/useCases/createSystem.d.ts +3 -3
  117. package/dist/useCases/createSystem.js.map +1 -1
  118. package/dist/useCases/createTicket.d.ts +3 -3
  119. package/dist/useCases/createTicket.js.map +1 -1
  120. package/dist/useCases/createTimeSheet.d.ts +3 -3
  121. package/dist/useCases/createTimeSheet.js.map +1 -1
  122. package/dist/useCases/createUser.d.ts +3 -3
  123. package/dist/useCases/createUser.js.map +1 -1
  124. package/dist/useCases/createVendor.d.ts +3 -3
  125. package/dist/useCases/createVendor.js.map +1 -1
  126. package/dist/useCases/deleteResource.d.ts +36 -0
  127. package/dist/useCases/deleteResource.js +47 -0
  128. package/dist/useCases/deleteResource.js.map +1 -0
  129. package/dist/useCases/describeConciergeFacilitiesViewer.d.ts +3 -3
  130. package/dist/useCases/describeConciergeFacilitiesViewer.js.map +1 -1
  131. package/dist/useCases/describeConciergeStatsFilters.d.ts +3 -3
  132. package/dist/useCases/describeConciergeStatsFilters.js.map +1 -1
  133. package/dist/useCases/describeConciergeStatsHeatmap.d.ts +3 -3
  134. package/dist/useCases/describeConciergeStatsHeatmap.js.map +1 -1
  135. package/dist/useCases/describeConciergeStatsSummary.d.ts +3 -3
  136. package/dist/useCases/describeConciergeStatsSummary.js.map +1 -1
  137. package/dist/useCases/describeConciergeStatsTickets.d.ts +3 -3
  138. package/dist/useCases/describeConciergeStatsTickets.js.map +1 -1
  139. package/dist/useCases/describeConciergeWorkspaceFilters.d.ts +3 -3
  140. package/dist/useCases/describeConciergeWorkspaceFilters.js.map +1 -1
  141. package/dist/useCases/describeMyAuth.d.ts +3 -3
  142. package/dist/useCases/describeMyAuth.js.map +1 -1
  143. package/dist/useCases/describeMyOrganization.d.ts +3 -3
  144. package/dist/useCases/describeMyOrganization.js.map +1 -1
  145. package/dist/useCases/describeMyPasskeyRegistrations.d.ts +3 -3
  146. package/dist/useCases/describeMyPasskeyRegistrations.js.map +1 -1
  147. package/dist/useCases/describeOrgNotificationDefaults.d.ts +3 -3
  148. package/dist/useCases/describeOrgNotificationDefaults.js.map +1 -1
  149. package/dist/useCases/describePushVapidPublicKey.d.ts +3 -3
  150. package/dist/useCases/describePushVapidPublicKey.js.map +1 -1
  151. package/dist/useCases/describeResource.d.ts +36 -0
  152. package/dist/useCases/describeResource.js +47 -0
  153. package/dist/useCases/describeResource.js.map +1 -0
  154. package/dist/useCases/describeSOS.d.ts +3 -3
  155. package/dist/useCases/describeSOS.js.map +1 -1
  156. package/dist/useCases/describeSOSEvent.d.ts +36 -0
  157. package/dist/useCases/describeSOSEvent.js +47 -0
  158. package/dist/useCases/describeSOSEvent.js.map +1 -0
  159. package/dist/useCases/describeSelf.d.ts +3 -3
  160. package/dist/useCases/describeSelf.js.map +1 -1
  161. package/dist/useCases/describeSelfAccess.d.ts +3 -3
  162. package/dist/useCases/describeSelfAccess.js.map +1 -1
  163. package/dist/useCases/describeStaffFunctions.d.ts +3 -3
  164. package/dist/useCases/describeStaffFunctions.js.map +1 -1
  165. package/dist/useCases/describeTicketFilters.d.ts +3 -3
  166. package/dist/useCases/describeTicketFilters.js.map +1 -1
  167. package/dist/useCases/describeTicketStats.d.ts +3 -3
  168. package/dist/useCases/describeTicketStats.js.map +1 -1
  169. package/dist/useCases/describeTicketStatsFilters.d.ts +3 -3
  170. package/dist/useCases/describeTicketStatsFilters.js.map +1 -1
  171. package/dist/useCases/describeTicketStatsHeatmap.d.ts +3 -3
  172. package/dist/useCases/describeTicketStatsHeatmap.js.map +1 -1
  173. package/dist/useCases/describeTicketStatsSummary.d.ts +3 -3
  174. package/dist/useCases/describeTicketStatsSummary.js.map +1 -1
  175. package/dist/useCases/describeTicketStatsTickets.d.ts +3 -3
  176. package/dist/useCases/describeTicketStatsTickets.js.map +1 -1
  177. package/dist/useCases/describeTimeSheetStats.d.ts +3 -3
  178. package/dist/useCases/describeTimeSheetStats.js.map +1 -1
  179. package/dist/useCases/fetchEmergencyContacts.d.ts +27 -0
  180. package/dist/useCases/fetchEmergencyContacts.js +47 -0
  181. package/dist/useCases/fetchEmergencyContacts.js.map +1 -0
  182. package/dist/useCases/index.d.ts +11 -0
  183. package/dist/useCases/index.js +23 -1
  184. package/dist/useCases/index.js.map +1 -1
  185. package/dist/useCases/listAutomations.d.ts +3 -3
  186. package/dist/useCases/listAutomations.js.map +1 -1
  187. package/dist/useCases/listBillingCategories.d.ts +3 -3
  188. package/dist/useCases/listBillingCategories.js.map +1 -1
  189. package/dist/useCases/listBills.d.ts +3 -3
  190. package/dist/useCases/listBills.js.map +1 -1
  191. package/dist/useCases/listCategories.d.ts +3 -3
  192. package/dist/useCases/listCategories.js.map +1 -1
  193. package/dist/useCases/listConciergeUninvoicedCosts.d.ts +3 -3
  194. package/dist/useCases/listConciergeUninvoicedCosts.js.map +1 -1
  195. package/dist/useCases/listConciergeWorkspaceBills.d.ts +3 -3
  196. package/dist/useCases/listConciergeWorkspaceBills.js.map +1 -1
  197. package/dist/useCases/listConciergeWorkspaceTickets.d.ts +3 -3
  198. package/dist/useCases/listConciergeWorkspaceTickets.js.map +1 -1
  199. package/dist/useCases/listDepartments.d.ts +3 -3
  200. package/dist/useCases/listDepartments.js.map +1 -1
  201. package/dist/useCases/listDiscoveredDevices.d.ts +3 -3
  202. package/dist/useCases/listDiscoveredDevices.js.map +1 -1
  203. package/dist/useCases/listFacilitiesStaffIds.d.ts +3 -3
  204. package/dist/useCases/listFacilitiesStaffIds.js.map +1 -1
  205. package/dist/useCases/listIntegrations.d.ts +3 -3
  206. package/dist/useCases/listIntegrations.js.map +1 -1
  207. package/dist/useCases/listIssues.d.ts +3 -3
  208. package/dist/useCases/listIssues.js.map +1 -1
  209. package/dist/useCases/listKohostStaff.d.ts +3 -3
  210. package/dist/useCases/listKohostStaff.js.map +1 -1
  211. package/dist/useCases/listMyOrganizations.d.ts +3 -3
  212. package/dist/useCases/listMyOrganizations.js.map +1 -1
  213. package/dist/useCases/listMyProperties.d.ts +3 -3
  214. package/dist/useCases/listMyProperties.js.map +1 -1
  215. package/dist/useCases/listMyPushSubscriptions.d.ts +3 -3
  216. package/dist/useCases/listMyPushSubscriptions.js.map +1 -1
  217. package/dist/useCases/listMyTimeSheets.d.ts +3 -3
  218. package/dist/useCases/listMyTimeSheets.js.map +1 -1
  219. package/dist/useCases/listOrganizationBills.d.ts +3 -3
  220. package/dist/useCases/listOrganizationBills.js.map +1 -1
  221. package/dist/useCases/listOrganizations.d.ts +3 -3
  222. package/dist/useCases/listOrganizations.js.map +1 -1
  223. package/dist/useCases/listPolicies.d.ts +3 -3
  224. package/dist/useCases/listPolicies.js.map +1 -1
  225. package/dist/useCases/listProperties.d.ts +3 -3
  226. package/dist/useCases/listProperties.js.map +1 -1
  227. package/dist/useCases/listResources.d.ts +27 -0
  228. package/dist/useCases/listResources.js +47 -0
  229. package/dist/useCases/listResources.js.map +1 -0
  230. package/dist/useCases/listSOSEvents.d.ts +27 -0
  231. package/dist/useCases/listSOSEvents.js +47 -0
  232. package/dist/useCases/listSOSEvents.js.map +1 -0
  233. package/dist/useCases/listServers.d.ts +3 -3
  234. package/dist/useCases/listServers.js.map +1 -1
  235. package/dist/useCases/listSessions.d.ts +3 -3
  236. package/dist/useCases/listSessions.js.map +1 -1
  237. package/dist/useCases/listSpaces.d.ts +3 -3
  238. package/dist/useCases/listSpaces.js.map +1 -1
  239. package/dist/useCases/listSystems.d.ts +3 -3
  240. package/dist/useCases/listSystems.js.map +1 -1
  241. package/dist/useCases/listTicketLocations.d.ts +3 -3
  242. package/dist/useCases/listTicketLocations.js.map +1 -1
  243. package/dist/useCases/listTickets.d.ts +3 -3
  244. package/dist/useCases/listTickets.js.map +1 -1
  245. package/dist/useCases/listTimeSheets.d.ts +3 -3
  246. package/dist/useCases/listTimeSheets.js.map +1 -1
  247. package/dist/useCases/listUsers.d.ts +3 -3
  248. package/dist/useCases/listUsers.js.map +1 -1
  249. package/dist/useCases/listVendors.d.ts +3 -3
  250. package/dist/useCases/listVendors.js.map +1 -1
  251. package/dist/useCases/mergeIssue.d.ts +3 -3
  252. package/dist/useCases/mergeIssue.js.map +1 -1
  253. package/dist/useCases/replaceDevice.d.ts +39 -0
  254. package/dist/useCases/replaceDevice.js +47 -0
  255. package/dist/useCases/replaceDevice.js.map +1 -0
  256. package/dist/useCases/selectOrganization.d.ts +3 -3
  257. package/dist/useCases/selectOrganization.js.map +1 -1
  258. package/dist/useCases/sendAnnouncement.d.ts +27 -0
  259. package/dist/useCases/sendAnnouncement.js +47 -0
  260. package/dist/useCases/sendAnnouncement.js.map +1 -0
  261. package/dist/useCases/sendNotification.d.ts +3 -3
  262. package/dist/useCases/sendNotification.js.map +1 -1
  263. package/dist/useCases/sendSOSUpdate.d.ts +27 -0
  264. package/dist/useCases/sendSOSUpdate.js +47 -0
  265. package/dist/useCases/sendSOSUpdate.js.map +1 -0
  266. package/dist/useCases/setDevices.d.ts +3 -3
  267. package/dist/useCases/setDevices.js.map +1 -1
  268. package/dist/useCases/startSOS.d.ts +3 -3
  269. package/dist/useCases/startSOS.js.map +1 -1
  270. package/dist/useCases/stopSOS.d.ts +3 -3
  271. package/dist/useCases/stopSOS.js.map +1 -1
  272. package/dist/useCases/subscribePushDevice.d.ts +3 -3
  273. package/dist/useCases/subscribePushDevice.js.map +1 -1
  274. package/dist/useCases/updateOrgNotificationDefaults.d.ts +3 -3
  275. package/dist/useCases/updateOrgNotificationDefaults.js.map +1 -1
  276. package/dist/useCases/updateResource.d.ts +36 -0
  277. package/dist/useCases/updateResource.js +47 -0
  278. package/dist/useCases/updateResource.js.map +1 -0
  279. package/dist/useCases/updateSelf.d.ts +3 -3
  280. package/dist/useCases/updateSelf.js.map +1 -1
  281. package/dist/useCases/upsertDiscoveredDevice.d.ts +3 -3
  282. package/dist/useCases/upsertDiscoveredDevice.js.map +1 -1
  283. package/dist/useCases/validateAuth.d.ts +3 -3
  284. package/dist/useCases/validateAuth.js.map +1 -1
  285. package/dist/validate.d.ts +34 -0
  286. package/dist/validate.js +7 -1
  287. package/dist/validate.js.map +1 -1
  288. package/package.json +1 -1
@@ -152,9 +152,8 @@ var KohostHTTPClient = class KohostHTTPClient {
152
152
  else url.searchParams.append(key, value);
153
153
  });
154
154
  const headers = new Headers(this.headers);
155
- if (config.headers) Object.entries(config.headers).forEach(([key, value]) => {
156
- if (value === null || value === void 0 || value === "") headers.delete(key);
157
- else headers.set(key, value);
155
+ if (config.headers) Object.keys(config.headers).forEach((key) => {
156
+ headers.set(key, config.headers[key]);
158
157
  });
159
158
  const body = config.data !== null && [
160
159
  "POST",
@@ -1 +1 @@
1
- {"version":3,"file":"httpClient.js","names":["#onSuccess","#onError","#onPhoneVerificationRequired","#onLoginRequired"],"sources":["../.generated/httpClient.js"],"sourcesContent":["export class KohostHTTPClient {\n #onSuccess;\n #onError;\n\n /** \n @param {Object} options - The options to create the client\n @param {String} options.organizationId - The organization ID\n @param {String} options.propertyId - The property ID\n @param {String | URL} options.url - The base URL for the API endpint\n @param {String} options.apiKey - The API key to use for requests\n @param {Headers} options.headers - Additional headers to send with each request\n @param {Function} options.onSuccess - A callback to handle successful responses\n @param {Function} options.onError - A callback to handle errors\n */\n constructor(\n options = {\n url: \"\",\n propertyId: \"\",\n organizationId: \"\",\n apiKey: \"\",\n headers: new Headers({}),\n onSuccess: (response) => response,\n onError: (error) => error,\n },\n ) {\n if (!options.url) throw new Error(\"options.url is required\");\n this.options = options;\n\n this.baseUrl = new URL(options.url);\n this.headers = new Headers({\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...options.headers,\n });\n\n if (options.apiKey) {\n this.headers.set(KohostHTTPClient.defs.apiKeyHeader, options.apiKey);\n }\n\n if (options.propertyId) {\n this.propertyId = options.propertyId;\n }\n\n if (options.organizationId) {\n this.organizationId = options.organizationId;\n }\n\n this.#onSuccess = options.onSuccess\n ? options.onSuccess\n : (response) => response;\n\n this.#onError = options.onError ? options.onError : (error) => error;\n\n this.callbacks = {};\n }\n\n /**\n *\n * @param {\"LoginRequired\" | \"PhoneVerificationRequired\"} event\n * @param {Function} callback\n */\n on(event, callback) {\n if (typeof callback !== \"function\") {\n throw new Error(\"Callback must be a function\");\n }\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n this.callbacks[event].push(callback);\n }\n\n emit(event, ...args) {\n if (this.callbacks[event]) {\n this.callbacks[event].forEach((callback) => callback(...args));\n }\n }\n\n /**\n * @param {string} orgId\n * @returns {void}\n * @memberof KohostApiClient\n * @example\n * client.organizationId = \"1234\";\n */\n set organizationId(orgId) {\n const key = KohostHTTPClient.defs.organizationHeader;\n this.headers.set(key, orgId);\n }\n\n get organizationId() {\n const key = KohostHTTPClient.defs.organizationHeader;\n return this.headers.get(key);\n }\n\n /**\n * @param {string} propertyId\n * @returns {void}\n * @memberof KohostApiClient\n * @example\n * client.propertyId = \"1234\";\n */\n\n set propertyId(propertyId) {\n const key = KohostHTTPClient.defs.propertyHeader;\n this.headers.set(key, propertyId);\n }\n\n get propertyId() {\n const key = KohostHTTPClient.defs.propertyHeader;\n return this.headers.get(key);\n }\n\n static get defs() {\n return {\n apiKeyHeader: \"X-Api-Key\",\n propertyHeader: \"X-Property-Id\",\n organizationHeader: \"X-Organization-Id\",\n };\n }\n\n /**\n * @typedef {keyof typeof import('./useCases')} CommandName\n * @typedef {import('./useCases')[CommandName]} Command\n *\n * @param {Command} command\n */\n async send(command) {\n const commandConfig = command.config;\n const request = this.createRequest(commandConfig);\n\n const response = await fetch(request);\n\n const isJsonResponse =\n response.headers.get(\"Content-Type\")?.includes(\"application/json\") ||\n false;\n\n const responseData = isJsonResponse ? await response.json() : response.body;\n\n if (!response.ok) {\n let error = responseData?.error || new Error(response.statusText);\n\n const status = response.status;\n const errorMessage = responseData?.error?.message;\n\n const expectedError = status >= 400 && status < 500;\n\n if (expectedError && errorMessage === \"Phone Verification is required\") {\n this.#onPhoneVerificationRequired();\n return Promise.reject(error);\n }\n\n if (expectedError && errorMessage === \"Login Required\") {\n this.#onLoginRequired();\n return Promise.reject(error);\n }\n\n if (\n expectedError &&\n errorMessage === \"No auth header or cookie provided\"\n ) {\n this.#onLoginRequired();\n return Promise.reject(error);\n }\n\n error = this.#onError(error);\n\n return Promise.reject(error);\n }\n\n return this.#onSuccess(responseData);\n }\n\n #onLoginRequired() {\n this.emit(\"LoginRequired\");\n }\n\n #onPhoneVerificationRequired() {\n this.emit(\"PhoneVerificationRequired\");\n }\n\n /**\n * @param {Command} config\n * @returns {Request}\n */\n createRequest(config) {\n if (typeof config.headers !== \"object\") {\n config.headers = {};\n }\n\n let apiPath = config.url;\n\n if (apiPath.startsWith(\"/\")) {\n apiPath = `.${apiPath}`;\n }\n const url = new URL(apiPath, this.baseUrl);\n const method = config.method?.toUpperCase() || \"GET\";\n\n // Add parameters to URL if they exist\n if (config.params && typeof config.params === \"object\") {\n Object.entries(config.params).forEach(([key, value]) => {\n // Handle array values\n if (Array.isArray(value)) {\n value.forEach((item) => {\n if (typeof item === \"object\" && item !== null) {\n Object.entries(item).forEach(([itemKey, itemValue]) => {\n url.searchParams.append(`${key}[][${itemKey}]`, itemValue);\n });\n } else {\n url.searchParams.append(`${key}[]`, item);\n }\n });\n }\n // Handle null/undefined\n else if (value === null || value === undefined) {\n url.searchParams.append(key, \"\");\n }\n // Handle nested objects\n else if (typeof value === \"object\") {\n Object.entries(value).forEach(([nestedKey, nestedValue]) => {\n if (Array.isArray(nestedValue)) {\n nestedValue.forEach((item) => {\n url.searchParams.append(`${key}[${nestedKey}][]`, item);\n });\n } else {\n url.searchParams.append(`${key}[${nestedKey}]`, nestedValue);\n }\n });\n }\n // Handle primitive values\n else {\n url.searchParams.append(key, value);\n }\n });\n }\n\n const headers = new Headers(this.headers);\n // Per-request headers override the client's ambient ones. An empty or\n // nullish value removes the ambient header entirely — callers use this to\n // strip a scope header (e.g. X-Property-Id) the singleton has armed.\n if (config.headers) {\n Object.entries(config.headers).forEach(([key, value]) => {\n if (value === null || value === undefined || value === \"\") {\n headers.delete(key);\n } else {\n headers.set(key, value);\n }\n });\n }\n\n const body =\n config.data !== null && [\"POST\", \"PUT\", \"PATCH\"].includes(method)\n ? headers.get(\"Content-Type\") === \"application/json\"\n ? JSON.stringify(config.data)\n : config.data\n : undefined;\n\n const request = new Request(url, {\n method: method,\n headers: headers,\n credentials: \"include\",\n body: body,\n });\n\n return request;\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"httpClient.js","names":["#onSuccess","#onError","#onPhoneVerificationRequired","#onLoginRequired"],"sources":["../.generated/httpClient.js"],"sourcesContent":["export class KohostHTTPClient {\n #onSuccess;\n #onError;\n\n /** \n @param {Object} options - The options to create the client\n @param {String} options.organizationId - The organization ID\n @param {String} options.propertyId - The property ID\n @param {String | URL} options.url - The base URL for the API endpint\n @param {String} options.apiKey - The API key to use for requests\n @param {Headers} options.headers - Additional headers to send with each request\n @param {Function} options.onSuccess - A callback to handle successful responses\n @param {Function} options.onError - A callback to handle errors\n */\n constructor(\n options = {\n url: \"\",\n propertyId: \"\",\n organizationId: \"\",\n apiKey: \"\",\n headers: new Headers({}),\n onSuccess: (response) => response,\n onError: (error) => error,\n },\n ) {\n if (!options.url) throw new Error(\"options.url is required\");\n this.options = options;\n\n this.baseUrl = new URL(options.url);\n this.headers = new Headers({\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...options.headers,\n });\n\n if (options.apiKey) {\n this.headers.set(KohostHTTPClient.defs.apiKeyHeader, options.apiKey);\n }\n\n if (options.propertyId) {\n this.propertyId = options.propertyId;\n }\n\n if (options.organizationId) {\n this.organizationId = options.organizationId;\n }\n\n this.#onSuccess = options.onSuccess\n ? options.onSuccess\n : (response) => response;\n\n this.#onError = options.onError ? options.onError : (error) => error;\n\n this.callbacks = {};\n }\n\n /**\n *\n * @param {\"LoginRequired\" | \"PhoneVerificationRequired\"} event\n * @param {Function} callback\n */\n on(event, callback) {\n if (typeof callback !== \"function\") {\n throw new Error(\"Callback must be a function\");\n }\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n this.callbacks[event].push(callback);\n }\n\n emit(event, ...args) {\n if (this.callbacks[event]) {\n this.callbacks[event].forEach((callback) => callback(...args));\n }\n }\n\n /**\n * @param {string} orgId\n * @returns {void}\n * @memberof KohostApiClient\n * @example\n * client.organizationId = \"1234\";\n */\n set organizationId(orgId) {\n const key = KohostHTTPClient.defs.organizationHeader;\n this.headers.set(key, orgId);\n }\n\n get organizationId() {\n const key = KohostHTTPClient.defs.organizationHeader;\n return this.headers.get(key);\n }\n\n /**\n * @param {string} propertyId\n * @returns {void}\n * @memberof KohostApiClient\n * @example\n * client.propertyId = \"1234\";\n */\n\n set propertyId(propertyId) {\n const key = KohostHTTPClient.defs.propertyHeader;\n this.headers.set(key, propertyId);\n }\n\n get propertyId() {\n const key = KohostHTTPClient.defs.propertyHeader;\n return this.headers.get(key);\n }\n\n static get defs() {\n return {\n apiKeyHeader: \"X-Api-Key\",\n propertyHeader: \"X-Property-Id\",\n organizationHeader: \"X-Organization-Id\",\n };\n }\n\n /**\n * @typedef {keyof typeof import('./useCases')} CommandName\n * @typedef {import('./useCases')[CommandName]} Command\n *\n * @param {Command} command\n */\n async send(command) {\n const commandConfig = command.config;\n const request = this.createRequest(commandConfig);\n\n const response = await fetch(request);\n\n const isJsonResponse =\n response.headers.get(\"Content-Type\")?.includes(\"application/json\") ||\n false;\n\n const responseData = isJsonResponse ? await response.json() : response.body;\n\n if (!response.ok) {\n let error = responseData?.error || new Error(response.statusText);\n\n const status = response.status;\n const errorMessage = responseData?.error?.message;\n\n const expectedError = status >= 400 && status < 500;\n\n if (expectedError && errorMessage === \"Phone Verification is required\") {\n this.#onPhoneVerificationRequired();\n return Promise.reject(error);\n }\n\n if (expectedError && errorMessage === \"Login Required\") {\n this.#onLoginRequired();\n return Promise.reject(error);\n }\n\n if (\n expectedError &&\n errorMessage === \"No auth header or cookie provided\"\n ) {\n this.#onLoginRequired();\n return Promise.reject(error);\n }\n\n error = this.#onError(error);\n\n return Promise.reject(error);\n }\n\n return this.#onSuccess(responseData);\n }\n\n #onLoginRequired() {\n this.emit(\"LoginRequired\");\n }\n\n #onPhoneVerificationRequired() {\n this.emit(\"PhoneVerificationRequired\");\n }\n\n /**\n * @param {Command} config\n * @returns {Request}\n */\n createRequest(config) {\n if (typeof config.headers !== \"object\") {\n config.headers = {};\n }\n\n let apiPath = config.url;\n\n if (apiPath.startsWith(\"/\")) {\n apiPath = `.${apiPath}`;\n }\n const url = new URL(apiPath, this.baseUrl);\n const method = config.method?.toUpperCase() || \"GET\";\n\n // Add parameters to URL if they exist\n if (config.params && typeof config.params === \"object\") {\n Object.entries(config.params).forEach(([key, value]) => {\n // Handle array values\n if (Array.isArray(value)) {\n value.forEach((item) => {\n if (typeof item === \"object\" && item !== null) {\n Object.entries(item).forEach(([itemKey, itemValue]) => {\n url.searchParams.append(`${key}[][${itemKey}]`, itemValue);\n });\n } else {\n url.searchParams.append(`${key}[]`, item);\n }\n });\n }\n // Handle null/undefined\n else if (value === null || value === undefined) {\n url.searchParams.append(key, \"\");\n }\n // Handle nested objects\n else if (typeof value === \"object\") {\n Object.entries(value).forEach(([nestedKey, nestedValue]) => {\n if (Array.isArray(nestedValue)) {\n nestedValue.forEach((item) => {\n url.searchParams.append(`${key}[${nestedKey}][]`, item);\n });\n } else {\n url.searchParams.append(`${key}[${nestedKey}]`, nestedValue);\n }\n });\n }\n // Handle primitive values\n else {\n url.searchParams.append(key, value);\n }\n });\n }\n\n const headers = new Headers(this.headers);\n // Add any additional headers\n if (config.headers) {\n Object.keys(config.headers).forEach((key) => {\n headers.set(key, config.headers[key]);\n });\n }\n\n const body =\n config.data !== null && [\"POST\", \"PUT\", \"PATCH\"].includes(method)\n ? headers.get(\"Content-Type\") === \"application/json\"\n ? JSON.stringify(config.data)\n : config.data\n : undefined;\n\n const request = new Request(url, {\n method: method,\n headers: headers,\n credentials: \"include\",\n body: body,\n });\n\n return request;\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export declare const DELIVERY_OUTCOMES: readonly ["sent", "delivered", "failed"];
2
+ export type DeliveryOutcome = (typeof DELIVERY_OUTCOMES)[number];
3
+ export declare function deliveryOutcomeForStatus(status: string | null | undefined): DeliveryOutcome | null;
@@ -0,0 +1,31 @@
1
+ //#region .generated/lib/deliveryStatus.ts
2
+ const DELIVERY_OUTCOMES = [
3
+ "sent",
4
+ "delivered",
5
+ "failed"
6
+ ];
7
+ const STATUS_TO_OUTCOME = {
8
+ queued: "sent",
9
+ accepted: "sent",
10
+ sending: "sent",
11
+ sent: "sent",
12
+ deferred: "sent",
13
+ delivered: "delivered",
14
+ read: "delivered",
15
+ opened: "delivered",
16
+ clicked: "delivered",
17
+ unsubscribed: "delivered",
18
+ spamReport: "delivered",
19
+ failed: "failed",
20
+ undelivered: "failed",
21
+ bounced: "failed",
22
+ blocked: "failed"
23
+ };
24
+ function deliveryOutcomeForStatus(status) {
25
+ if (!status) return null;
26
+ return STATUS_TO_OUTCOME[status] ?? null;
27
+ }
28
+ //#endregion
29
+ export { DELIVERY_OUTCOMES, deliveryOutcomeForStatus };
30
+
31
+ //# sourceMappingURL=deliveryStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deliveryStatus.js","names":[],"sources":["../../.generated/lib/deliveryStatus.ts"],"sourcesContent":["export const DELIVERY_OUTCOMES = [\"sent\", \"delivered\", \"failed\"] as const;\n\nexport type DeliveryOutcome = (typeof DELIVERY_OUTCOMES)[number];\n\n// Coarse outcome bucket for a raw sms/email vendor status. `sent` covers\n// accepted/in-flight states that are not yet terminal; `delivered` covers\n// terminal success (including read/open/click, and the post-delivery\n// unsubscribe/spam-report signals — a message was delivered before the\n// recipient could unsubscribe or mark it spam); `failed` covers terminal\n// failure. Inbound statuses (receiving/received) and other signals with no\n// bearing on reach return null and are not counted.\nconst STATUS_TO_OUTCOME: Record<string, DeliveryOutcome> = {\n queued: \"sent\",\n accepted: \"sent\",\n sending: \"sent\",\n sent: \"sent\",\n deferred: \"sent\",\n\n delivered: \"delivered\",\n read: \"delivered\",\n opened: \"delivered\",\n clicked: \"delivered\",\n unsubscribed: \"delivered\",\n spamReport: \"delivered\",\n\n failed: \"failed\",\n undelivered: \"failed\",\n bounced: \"failed\",\n blocked: \"failed\",\n};\n\nexport function deliveryOutcomeForStatus(\n status: string | null | undefined,\n): DeliveryOutcome | null {\n if (!status) return null;\n return STATUS_TO_OUTCOME[status] ?? null;\n}\n"],"mappings":";AAAA,MAAa,oBAAoB;CAAC;CAAQ;CAAa;AAAQ;AAW/D,MAAM,oBAAqD;CACzD,QAAQ;CACR,UAAU;CACV,SAAS;CACT,MAAM;CACN,UAAU;CAEV,WAAW;CACX,MAAM;CACN,QAAQ;CACR,SAAS;CACT,cAAc;CACd,YAAY;CAEZ,QAAQ;CACR,aAAa;CACb,SAAS;CACT,SAAS;AACX;AAEA,SAAgB,yBACd,QACwB;CACxB,IAAI,CAAC,QAAQ,OAAO;CACpB,OAAO,kBAAkB,WAAW;AACtC"}
@@ -0,0 +1,14 @@
1
+ import type { SISDriver } from "./sisDrivers.js";
2
+ export interface EmergencyContactRoleGroup {
3
+ role: string;
4
+ total: number;
5
+ reachable: number;
6
+ }
7
+ export interface EmergencyContactAudience {
8
+ driver: SISDriver;
9
+ live: boolean;
10
+ syncedAt: string | null;
11
+ total: number;
12
+ reachable: number;
13
+ byRole: EmergencyContactRoleGroup[];
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,13 @@
1
1
  export { inferDeviceNotifications, type DeviceNotificationName, type InferDeviceNotificationsInput, } from "./deviceNotifications.js";
2
2
  export { categoryForDevice, SYSTEM_CATEGORIES, SYSTEM_CATEGORY_LABELS, type SystemCategory, type CategoryForDeviceInput, } from "./systemCategories.js";
3
3
  export { getAllowedResourceIds, getAllowedDeviceTypes, getAllowedFeatures, type PolicyLike, type PolicyPermissionLike, } from "./policy-resolvers.js";
4
+ export { SIS_DRIVERS, isSISDriver, type SISDriver } from "./sisDrivers.js";
5
+ export { SOS_AUDIENCES, type SOSAudience } from "./sosAudiences.js";
6
+ export { MESSAGE_ERROR_CATEGORIES, categoryForMessageErrorCode, isMessageErrorCategory, type MessageErrorCategory, } from "./messageErrorCodes.js";
7
+ export { DELIVERY_OUTCOMES, deliveryOutcomeForStatus, type DeliveryOutcome, } from "./deliveryStatus.js";
8
+ export type { EmergencyContactAudience, EmergencyContactRoleGroup, } from "./emergencyContacts.js";
4
9
  export { MAX_MESSAGE_ATTACHMENTS } from "./messageAttachments.js";
5
- export { DEFAULT_MARKUP_TIERS, resolveMarkupTierTable, keyedMarkupPercent, DEFAULT_TAX_RATE, derivePrice, billTotal, billTaxAmount, billGrandTotal, formatMoney, } from "./money.js";
10
+ export { DEFAULT_MARKUP_TIERS, DEFAULT_DNE_AMOUNT, resolveMarkupTierTable, keyedMarkupPercent, DEFAULT_TAX_RATE, derivePrice, billTotal, billTaxAmount, billGrandTotal, formatMoney, } from "./money.js";
6
11
  export { effectiveTaxRate, taxableSubtotal, billTotals, resolveBillTaxExempt, settledBillTotal, billEffectiveDate, type BillTaxFields, type TaxableLine, type SettledBillTotalSource, type BillEffectiveDateSource, } from "./bills.js";
7
12
  export { KFC_STATS_TIMEZONE, KFC_STATS_DEFAULT_WINDOW_DAYS, KFC_STATS_MAX_RANGE_DAYS, resolveKfcStatsWindowBounds, type KfcStatsWindowBounds, } from "./kfcStatsWindow.js";
8
13
  export { serializeRichTextBody, isWellFormedRichText, type RichTextContent, type RichTextBlockNode, type RichTextInlineNode, type RichTextListItemNode, type RichTextMentionNode, } from "./ticketRichText.js";
package/dist/lib/index.js CHANGED
@@ -2,19 +2,28 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { inferDeviceNotifications } from "./deviceNotifications.js";
3
3
  import { SYSTEM_CATEGORIES, SYSTEM_CATEGORY_LABELS, categoryForDevice } from "./systemCategories.js";
4
4
  import { getAllowedDeviceTypes, getAllowedFeatures, getAllowedResourceIds } from "./policy-resolvers.js";
5
+ import { SIS_DRIVERS, isSISDriver } from "./sisDrivers.js";
6
+ import { SOS_AUDIENCES } from "./sosAudiences.js";
7
+ import { MESSAGE_ERROR_CATEGORIES, categoryForMessageErrorCode, isMessageErrorCategory } from "./messageErrorCodes.js";
8
+ import { DELIVERY_OUTCOMES, deliveryOutcomeForStatus } from "./deliveryStatus.js";
5
9
  import { MAX_MESSAGE_ATTACHMENTS } from "./messageAttachments.js";
6
- import { DEFAULT_MARKUP_TIERS, DEFAULT_TAX_RATE, billGrandTotal, billTaxAmount, billTotal, derivePrice, formatMoney, keyedMarkupPercent, resolveMarkupTierTable } from "./money.js";
10
+ import { DEFAULT_DNE_AMOUNT, DEFAULT_MARKUP_TIERS, DEFAULT_TAX_RATE, billGrandTotal, billTaxAmount, billTotal, derivePrice, formatMoney, keyedMarkupPercent, resolveMarkupTierTable } from "./money.js";
7
11
  import { billEffectiveDate, billTotals, effectiveTaxRate, resolveBillTaxExempt, settledBillTotal, taxableSubtotal } from "./bills.js";
8
12
  import { KFC_STATS_DEFAULT_WINDOW_DAYS, KFC_STATS_MAX_RANGE_DAYS, KFC_STATS_TIMEZONE, resolveKfcStatsWindowBounds } from "./kfcStatsWindow.js";
9
13
  import { isWellFormedRichText, serializeRichTextBody } from "./ticketRichText.js";
10
14
  //#region .generated/lib/index.ts
11
15
  var lib_exports = /* @__PURE__ */ __exportAll({
16
+ DEFAULT_DNE_AMOUNT: () => DEFAULT_DNE_AMOUNT,
12
17
  DEFAULT_MARKUP_TIERS: () => DEFAULT_MARKUP_TIERS,
13
18
  DEFAULT_TAX_RATE: () => DEFAULT_TAX_RATE,
19
+ DELIVERY_OUTCOMES: () => DELIVERY_OUTCOMES,
14
20
  KFC_STATS_DEFAULT_WINDOW_DAYS: () => 30,
15
21
  KFC_STATS_MAX_RANGE_DAYS: () => 366,
16
22
  KFC_STATS_TIMEZONE: () => KFC_STATS_TIMEZONE,
17
23
  MAX_MESSAGE_ATTACHMENTS: () => 15,
24
+ MESSAGE_ERROR_CATEGORIES: () => MESSAGE_ERROR_CATEGORIES,
25
+ SIS_DRIVERS: () => SIS_DRIVERS,
26
+ SOS_AUDIENCES: () => SOS_AUDIENCES,
18
27
  SYSTEM_CATEGORIES: () => SYSTEM_CATEGORIES,
19
28
  SYSTEM_CATEGORY_LABELS: () => SYSTEM_CATEGORY_LABELS,
20
29
  billEffectiveDate: () => billEffectiveDate,
@@ -23,6 +32,8 @@ var lib_exports = /* @__PURE__ */ __exportAll({
23
32
  billTotal: () => billTotal,
24
33
  billTotals: () => billTotals,
25
34
  categoryForDevice: () => categoryForDevice,
35
+ categoryForMessageErrorCode: () => categoryForMessageErrorCode,
36
+ deliveryOutcomeForStatus: () => deliveryOutcomeForStatus,
26
37
  derivePrice: () => derivePrice,
27
38
  effectiveTaxRate: () => effectiveTaxRate,
28
39
  formatMoney: () => formatMoney,
@@ -30,6 +41,8 @@ var lib_exports = /* @__PURE__ */ __exportAll({
30
41
  getAllowedFeatures: () => getAllowedFeatures,
31
42
  getAllowedResourceIds: () => getAllowedResourceIds,
32
43
  inferDeviceNotifications: () => inferDeviceNotifications,
44
+ isMessageErrorCategory: () => isMessageErrorCategory,
45
+ isSISDriver: () => isSISDriver,
33
46
  isWellFormedRichText: () => isWellFormedRichText,
34
47
  keyedMarkupPercent: () => keyedMarkupPercent,
35
48
  resolveBillTaxExempt: () => resolveBillTaxExempt,
@@ -40,6 +53,6 @@ var lib_exports = /* @__PURE__ */ __exportAll({
40
53
  taxableSubtotal: () => taxableSubtotal
41
54
  });
42
55
  //#endregion
43
- export { DEFAULT_MARKUP_TIERS, DEFAULT_TAX_RATE, KFC_STATS_DEFAULT_WINDOW_DAYS, KFC_STATS_MAX_RANGE_DAYS, KFC_STATS_TIMEZONE, MAX_MESSAGE_ATTACHMENTS, SYSTEM_CATEGORIES, SYSTEM_CATEGORY_LABELS, billEffectiveDate, billGrandTotal, billTaxAmount, billTotal, billTotals, categoryForDevice, derivePrice, effectiveTaxRate, formatMoney, getAllowedDeviceTypes, getAllowedFeatures, getAllowedResourceIds, inferDeviceNotifications, isWellFormedRichText, keyedMarkupPercent, lib_exports, resolveBillTaxExempt, resolveKfcStatsWindowBounds, resolveMarkupTierTable, serializeRichTextBody, settledBillTotal, taxableSubtotal };
56
+ export { DEFAULT_DNE_AMOUNT, DEFAULT_MARKUP_TIERS, DEFAULT_TAX_RATE, DELIVERY_OUTCOMES, KFC_STATS_DEFAULT_WINDOW_DAYS, KFC_STATS_MAX_RANGE_DAYS, KFC_STATS_TIMEZONE, MAX_MESSAGE_ATTACHMENTS, MESSAGE_ERROR_CATEGORIES, SIS_DRIVERS, SOS_AUDIENCES, SYSTEM_CATEGORIES, SYSTEM_CATEGORY_LABELS, billEffectiveDate, billGrandTotal, billTaxAmount, billTotal, billTotals, categoryForDevice, categoryForMessageErrorCode, deliveryOutcomeForStatus, derivePrice, effectiveTaxRate, formatMoney, getAllowedDeviceTypes, getAllowedFeatures, getAllowedResourceIds, inferDeviceNotifications, isMessageErrorCategory, isSISDriver, isWellFormedRichText, keyedMarkupPercent, lib_exports, resolveBillTaxExempt, resolveKfcStatsWindowBounds, resolveMarkupTierTable, serializeRichTextBody, settledBillTotal, taxableSubtotal };
44
57
 
45
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../.generated/lib/index.ts"],"sourcesContent":["export {\n inferDeviceNotifications,\n type DeviceNotificationName,\n type InferDeviceNotificationsInput,\n} from \"./deviceNotifications.js\";\nexport {\n categoryForDevice,\n SYSTEM_CATEGORIES,\n SYSTEM_CATEGORY_LABELS,\n type SystemCategory,\n type CategoryForDeviceInput,\n} from \"./systemCategories.js\";\nexport {\n getAllowedResourceIds,\n getAllowedDeviceTypes,\n getAllowedFeatures,\n type PolicyLike,\n type PolicyPermissionLike,\n} from \"./policy-resolvers.js\";\nexport { MAX_MESSAGE_ATTACHMENTS } from \"./messageAttachments.js\";\nexport {\n DEFAULT_MARKUP_TIERS,\n resolveMarkupTierTable,\n keyedMarkupPercent,\n DEFAULT_TAX_RATE,\n derivePrice,\n billTotal,\n billTaxAmount,\n billGrandTotal,\n formatMoney,\n} from \"./money.js\";\nexport {\n effectiveTaxRate,\n taxableSubtotal,\n billTotals,\n resolveBillTaxExempt,\n settledBillTotal,\n billEffectiveDate,\n type BillTaxFields,\n type TaxableLine,\n type SettledBillTotalSource,\n type BillEffectiveDateSource,\n} from \"./bills.js\";\nexport {\n KFC_STATS_TIMEZONE,\n KFC_STATS_DEFAULT_WINDOW_DAYS,\n KFC_STATS_MAX_RANGE_DAYS,\n resolveKfcStatsWindowBounds,\n type KfcStatsWindowBounds,\n} from \"./kfcStatsWindow.js\";\nexport {\n serializeRichTextBody,\n isWellFormedRichText,\n type RichTextContent,\n type RichTextBlockNode,\n type RichTextInlineNode,\n type RichTextListItemNode,\n type RichTextMentionNode,\n} from \"./ticketRichText.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../.generated/lib/index.ts"],"sourcesContent":["export {\n inferDeviceNotifications,\n type DeviceNotificationName,\n type InferDeviceNotificationsInput,\n} from \"./deviceNotifications.js\";\nexport {\n categoryForDevice,\n SYSTEM_CATEGORIES,\n SYSTEM_CATEGORY_LABELS,\n type SystemCategory,\n type CategoryForDeviceInput,\n} from \"./systemCategories.js\";\nexport {\n getAllowedResourceIds,\n getAllowedDeviceTypes,\n getAllowedFeatures,\n type PolicyLike,\n type PolicyPermissionLike,\n} from \"./policy-resolvers.js\";\nexport { SIS_DRIVERS, isSISDriver, type SISDriver } from \"./sisDrivers.js\";\nexport { SOS_AUDIENCES, type SOSAudience } from \"./sosAudiences.js\";\nexport {\n MESSAGE_ERROR_CATEGORIES,\n categoryForMessageErrorCode,\n isMessageErrorCategory,\n type MessageErrorCategory,\n} from \"./messageErrorCodes.js\";\nexport {\n DELIVERY_OUTCOMES,\n deliveryOutcomeForStatus,\n type DeliveryOutcome,\n} from \"./deliveryStatus.js\";\nexport type {\n EmergencyContactAudience,\n EmergencyContactRoleGroup,\n} from \"./emergencyContacts.js\";\nexport { MAX_MESSAGE_ATTACHMENTS } from \"./messageAttachments.js\";\nexport {\n DEFAULT_MARKUP_TIERS,\n DEFAULT_DNE_AMOUNT,\n resolveMarkupTierTable,\n keyedMarkupPercent,\n DEFAULT_TAX_RATE,\n derivePrice,\n billTotal,\n billTaxAmount,\n billGrandTotal,\n formatMoney,\n} from \"./money.js\";\nexport {\n effectiveTaxRate,\n taxableSubtotal,\n billTotals,\n resolveBillTaxExempt,\n settledBillTotal,\n billEffectiveDate,\n type BillTaxFields,\n type TaxableLine,\n type SettledBillTotalSource,\n type BillEffectiveDateSource,\n} from \"./bills.js\";\nexport {\n KFC_STATS_TIMEZONE,\n KFC_STATS_DEFAULT_WINDOW_DAYS,\n KFC_STATS_MAX_RANGE_DAYS,\n resolveKfcStatsWindowBounds,\n type KfcStatsWindowBounds,\n} from \"./kfcStatsWindow.js\";\nexport {\n serializeRichTextBody,\n isWellFormedRichText,\n type RichTextContent,\n type RichTextBlockNode,\n type RichTextInlineNode,\n type RichTextListItemNode,\n type RichTextMentionNode,\n} from \"./ticketRichText.js\";\n"],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare const MESSAGE_ERROR_CATEGORIES: readonly ["optedOut", "carrierFiltered", "rateCapped", "expired"];
2
+ export type MessageErrorCategory = (typeof MESSAGE_ERROR_CATEGORIES)[number];
3
+ export declare function categoryForMessageErrorCode(code: string | null | undefined): MessageErrorCategory | null;
4
+ export declare function isMessageErrorCategory(value: string | null | undefined): value is MessageErrorCategory;
@@ -0,0 +1,24 @@
1
+ //#region .generated/lib/messageErrorCodes.ts
2
+ const MESSAGE_ERROR_CATEGORIES = [
3
+ "optedOut",
4
+ "carrierFiltered",
5
+ "rateCapped",
6
+ "expired"
7
+ ];
8
+ const CODE_TO_CATEGORY = {
9
+ "21610": "optedOut",
10
+ "30007": "carrierFiltered",
11
+ "30023": "rateCapped",
12
+ "30027": "rateCapped"
13
+ };
14
+ function categoryForMessageErrorCode(code) {
15
+ if (!code) return null;
16
+ return CODE_TO_CATEGORY[code.trim()] ?? null;
17
+ }
18
+ function isMessageErrorCategory(value) {
19
+ return typeof value === "string" && MESSAGE_ERROR_CATEGORIES.includes(value);
20
+ }
21
+ //#endregion
22
+ export { MESSAGE_ERROR_CATEGORIES, categoryForMessageErrorCode, isMessageErrorCategory };
23
+
24
+ //# sourceMappingURL=messageErrorCodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageErrorCodes.js","names":[],"sources":["../../.generated/lib/messageErrorCodes.ts"],"sourcesContent":["export const MESSAGE_ERROR_CATEGORIES = [\n \"optedOut\",\n \"carrierFiltered\",\n \"rateCapped\",\n \"expired\",\n] as const;\n\nexport type MessageErrorCategory = (typeof MESSAGE_ERROR_CATEGORIES)[number];\n\n// Raw vendor code → display category. Kept for debugging; not shown in the SOS\n// UI. Codes locked in kohost/kohost#332 (Twilio). `expired` has no confirmed\n// code yet — the issues recommend a short ValidityPeriod but never lock the\n// vendor code — so it remains a category with no mapping until confirmed.\nconst CODE_TO_CATEGORY: Record<string, MessageErrorCategory> = {\n \"21610\": \"optedOut\",\n \"30007\": \"carrierFiltered\",\n \"30023\": \"rateCapped\",\n \"30027\": \"rateCapped\",\n};\n\nexport function categoryForMessageErrorCode(\n code: string | null | undefined,\n): MessageErrorCategory | null {\n if (!code) return null;\n return CODE_TO_CATEGORY[code.trim()] ?? null;\n}\n\nexport function isMessageErrorCategory(\n value: string | null | undefined,\n): value is MessageErrorCategory {\n return (\n typeof value === \"string\" &&\n (MESSAGE_ERROR_CATEGORIES as readonly string[]).includes(value)\n );\n}\n"],"mappings":";AAAA,MAAa,2BAA2B;CACtC;CACA;CACA;CACA;AACF;AAQA,MAAM,mBAAyD;CAC7D,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;AACX;AAEA,SAAgB,4BACd,MAC6B;CAC7B,IAAI,CAAC,MAAM,OAAO;CAClB,OAAO,iBAAiB,KAAK,KAAK,MAAM;AAC1C;AAEA,SAAgB,uBACd,OAC+B;CAC/B,OACE,OAAO,UAAU,YAChB,yBAA+C,SAAS,KAAK;AAElE"}
@@ -9,11 +9,17 @@ import type { MarkupTier } from "../schemas/organization.js";
9
9
  /**
10
10
  * The tier table an organization keys against before anyone configures one.
11
11
  * KFC work is never billed at vendor cost, so an unconfigured organization
12
- * keys to a single flat tier rather than to zero. A saved table replaces this
12
+ * keys to this table rather than to zero. A saved table replaces this
13
13
  * outright — it is a fallback, not a floor, so an organization that should
14
14
  * carry no markup writes an explicit `0` tier.
15
15
  */
16
16
  export declare const DEFAULT_MARKUP_TIERS: readonly MarkupTier[];
17
+ /**
18
+ * The do-not-exceed amount seeded onto an organization when KFC is enabled and
19
+ * no amount is configured yet, in integer cents. Enablement refuses to leave
20
+ * the gate off by accident; an explicit amount can still replace it afterward.
21
+ */
22
+ export declare const DEFAULT_DNE_AMOUNT = 150000;
17
23
  /** An organization's markup tiers, or the default when it has none of its own. */
18
24
  export declare function resolveMarkupTierTable(tiers: readonly MarkupTier[] | undefined | null): MarkupTier[];
19
25
  /**
package/dist/lib/money.js CHANGED
@@ -2,14 +2,23 @@
2
2
  /**
3
3
  * The tier table an organization keys against before anyone configures one.
4
4
  * KFC work is never billed at vendor cost, so an unconfigured organization
5
- * keys to a single flat tier rather than to zero. A saved table replaces this
5
+ * keys to this table rather than to zero. A saved table replaces this
6
6
  * outright — it is a fallback, not a floor, so an organization that should
7
7
  * carry no markup writes an explicit `0` tier.
8
8
  */
9
9
  const DEFAULT_MARKUP_TIERS = [{
10
10
  minAmount: 0,
11
+ percent: 15
12
+ }, {
13
+ minAmount: 3e5,
11
14
  percent: 10
12
15
  }];
16
+ /**
17
+ * The do-not-exceed amount seeded onto an organization when KFC is enabled and
18
+ * no amount is configured yet, in integer cents. Enablement refuses to leave
19
+ * the gate off by accident; an explicit amount can still replace it afterward.
20
+ */
21
+ const DEFAULT_DNE_AMOUNT = 15e4;
13
22
  /** An organization's markup tiers, or the default when it has none of its own. */
14
23
  function resolveMarkupTierTable(tiers) {
15
24
  if (tiers && tiers.length > 0) return [...tiers];
@@ -75,6 +84,6 @@ function formatMoney(cents, currency = "USD", locale = "en-US") {
75
84
  }).format(cents / 100);
76
85
  }
77
86
  //#endregion
78
- export { DEFAULT_MARKUP_TIERS, DEFAULT_TAX_RATE, billGrandTotal, billTaxAmount, billTotal, derivePrice, formatMoney, keyedMarkupPercent, resolveMarkupTierTable };
87
+ export { DEFAULT_DNE_AMOUNT, DEFAULT_MARKUP_TIERS, DEFAULT_TAX_RATE, billGrandTotal, billTaxAmount, billTotal, derivePrice, formatMoney, keyedMarkupPercent, resolveMarkupTierTable };
79
88
 
80
89
  //# sourceMappingURL=money.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"money.js","names":[],"sources":["../../.generated/lib/money.ts"],"sourcesContent":["/**\n * The money rules the API and the app must apply identically, so a price shown\n * in the browser can never disagree with the price the server persists or the\n * approval gate compares to the DNE. Before this module each rule was written\n * once per side, and the duplication had already shipped a divergence between\n * persisted copy and the live UI.\n */\n\nimport type { MarkupTier } from \"../schemas/organization.js\";\n\n/**\n * The tier table an organization keys against before anyone configures one.\n * KFC work is never billed at vendor cost, so an unconfigured organization\n * keys to a single flat tier rather than to zero. A saved table replaces this\n * outright — it is a fallback, not a floor, so an organization that should\n * carry no markup writes an explicit `0` tier.\n */\nexport const DEFAULT_MARKUP_TIERS: readonly MarkupTier[] = [\n { minAmount: 0, percent: 10 },\n];\n\n/** An organization's markup tiers, or the default when it has none of its own. */\nexport function resolveMarkupTierTable(\n tiers: readonly MarkupTier[] | undefined | null,\n): MarkupTier[] {\n if (tiers && tiers.length > 0) return [...tiers];\n return DEFAULT_MARKUP_TIERS.map((tier) => ({ ...tier }));\n}\n\n/**\n * Keys a cost entry's markup percent from the org's lower-bound tier table by\n * the entry's vendor-cost estimate (never the ticket total): the highest row\n * whose `minAmount` the estimate meets. Null when no tiers are configured.\n */\nexport function keyedMarkupPercent(\n tiers: readonly MarkupTier[],\n estimateAmount: number,\n): number | null {\n let match: MarkupTier | null = null;\n for (const tier of tiers) {\n if (tier.minAmount > estimateAmount) continue;\n if (match === null || tier.minAmount > match.minAmount) match = tier;\n }\n return match === null ? null : match.percent;\n}\n\n/**\n * The marked-up price of a vendor cost, in integer cents. Price is never stored\n * anywhere — it is always derived from vendor cost and markup on integer cents,\n * so the two sides can never let the vendor cost, markup, and price disagree.\n */\nexport function derivePrice(amount: number, percent: number): number {\n return Math.round(amount * (1 + percent / 100));\n}\n\n/** The sum of already-derived line amounts, in integer cents. */\nexport function billTotal(lineAmounts: readonly number[]): number {\n return lineAmounts.reduce((sum, amount) => sum + amount, 0);\n}\n\n/**\n * The tax rate (a plain float percent) a draft bill uses until a biller writes\n * its own onto the bill.\n */\nexport const DEFAULT_TAX_RATE = 8.375;\n\n/**\n * Tax in integer cents on a bill's taxable subtotal. Taxable credits reduce the\n * base; when they push it negative the tax clamps at zero rather than going\n * negative — a bill never emits a tax refund.\n */\nexport function billTaxAmount(\n taxableSubtotalCents: number,\n ratePercent: number,\n): number {\n return Math.max(0, Math.round((taxableSubtotalCents * ratePercent) / 100));\n}\n\n/** The bill's grand total in integer cents: line sum plus tax and shipping. */\nexport function billGrandTotal({\n subtotal,\n tax,\n shipping,\n}: {\n subtotal: number;\n tax: number;\n shipping: number;\n}): number {\n return subtotal + tax + shipping;\n}\n\n/**\n * Render integer cents as a currency string, e.g.\n * `formatMoney(123456, \"USD\")` → `\"$1,234.56\"`.\n *\n * Locale policy: `locale` defaults to `\"en-US\"` — the pin for any copy that is\n * persisted or shipped to a fixed audience (bill PDFs, emails, and the stored\n * approval/notification messages a customer reads back later). Live UI that\n * should follow the viewer passes `locale = null`, which falls back to the\n * runtime's default locale. Persisted-en-US / live-locale-aware is the\n * deliberate split; a persisted caller must never inherit the browser locale.\n */\nexport function formatMoney(\n cents: number,\n currency = \"USD\",\n locale: string | null = \"en-US\",\n): string {\n return new Intl.NumberFormat(locale ?? undefined, {\n style: \"currency\",\n currency,\n }).format(cents / 100);\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,uBAA8C,CACzD;CAAE,WAAW;CAAG,SAAS;AAAG,CAC9B;;AAGA,SAAgB,uBACd,OACc;CACd,IAAI,SAAS,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,KAAK;CAC/C,OAAO,qBAAqB,KAAK,UAAU,EAAE,GAAG,KAAK,EAAE;AACzD;;;;;;AAOA,SAAgB,mBACd,OACA,gBACe;CACf,IAAI,QAA2B;CAC/B,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,YAAY,gBAAgB;EACrC,IAAI,UAAU,QAAQ,KAAK,YAAY,MAAM,WAAW,QAAQ;CAClE;CACA,OAAO,UAAU,OAAO,OAAO,MAAM;AACvC;;;;;;AAOA,SAAgB,YAAY,QAAgB,SAAyB;CACnE,OAAO,KAAK,MAAM,UAAU,IAAI,UAAU,IAAI;AAChD;;AAGA,SAAgB,UAAU,aAAwC;CAChE,OAAO,YAAY,QAAQ,KAAK,WAAW,MAAM,QAAQ,CAAC;AAC5D;;;;;AAMA,MAAa,mBAAmB;;;;;;AAOhC,SAAgB,cACd,sBACA,aACQ;CACR,OAAO,KAAK,IAAI,GAAG,KAAK,MAAO,uBAAuB,cAAe,GAAG,CAAC;AAC3E;;AAGA,SAAgB,eAAe,EAC7B,UACA,KACA,YAKS;CACT,OAAO,WAAW,MAAM;AAC1B;;;;;;;;;;;;AAaA,SAAgB,YACd,OACA,WAAW,OACX,SAAwB,SAChB;CACR,OAAO,IAAI,KAAK,aAAa,UAAU,KAAA,GAAW;EAChD,OAAO;EACP;CACF,CAAC,CAAC,CAAC,OAAO,QAAQ,GAAG;AACvB"}
1
+ {"version":3,"file":"money.js","names":[],"sources":["../../.generated/lib/money.ts"],"sourcesContent":["/**\n * The money rules the API and the app must apply identically, so a price shown\n * in the browser can never disagree with the price the server persists or the\n * approval gate compares to the DNE. Before this module each rule was written\n * once per side, and the duplication had already shipped a divergence between\n * persisted copy and the live UI.\n */\n\nimport type { MarkupTier } from \"../schemas/organization.js\";\n\n/**\n * The tier table an organization keys against before anyone configures one.\n * KFC work is never billed at vendor cost, so an unconfigured organization\n * keys to this table rather than to zero. A saved table replaces this\n * outright — it is a fallback, not a floor, so an organization that should\n * carry no markup writes an explicit `0` tier.\n */\nexport const DEFAULT_MARKUP_TIERS: readonly MarkupTier[] = [\n { minAmount: 0, percent: 15 },\n { minAmount: 300_000, percent: 10 },\n];\n\n/**\n * The do-not-exceed amount seeded onto an organization when KFC is enabled and\n * no amount is configured yet, in integer cents. Enablement refuses to leave\n * the gate off by accident; an explicit amount can still replace it afterward.\n */\nexport const DEFAULT_DNE_AMOUNT = 150_000;\n\n/** An organization's markup tiers, or the default when it has none of its own. */\nexport function resolveMarkupTierTable(\n tiers: readonly MarkupTier[] | undefined | null,\n): MarkupTier[] {\n if (tiers && tiers.length > 0) return [...tiers];\n return DEFAULT_MARKUP_TIERS.map((tier) => ({ ...tier }));\n}\n\n/**\n * Keys a cost entry's markup percent from the org's lower-bound tier table by\n * the entry's vendor-cost estimate (never the ticket total): the highest row\n * whose `minAmount` the estimate meets. Null when no tiers are configured.\n */\nexport function keyedMarkupPercent(\n tiers: readonly MarkupTier[],\n estimateAmount: number,\n): number | null {\n let match: MarkupTier | null = null;\n for (const tier of tiers) {\n if (tier.minAmount > estimateAmount) continue;\n if (match === null || tier.minAmount > match.minAmount) match = tier;\n }\n return match === null ? null : match.percent;\n}\n\n/**\n * The marked-up price of a vendor cost, in integer cents. Price is never stored\n * anywhere — it is always derived from vendor cost and markup on integer cents,\n * so the two sides can never let the vendor cost, markup, and price disagree.\n */\nexport function derivePrice(amount: number, percent: number): number {\n return Math.round(amount * (1 + percent / 100));\n}\n\n/** The sum of already-derived line amounts, in integer cents. */\nexport function billTotal(lineAmounts: readonly number[]): number {\n return lineAmounts.reduce((sum, amount) => sum + amount, 0);\n}\n\n/**\n * The tax rate (a plain float percent) a draft bill uses until a biller writes\n * its own onto the bill.\n */\nexport const DEFAULT_TAX_RATE = 8.375;\n\n/**\n * Tax in integer cents on a bill's taxable subtotal. Taxable credits reduce the\n * base; when they push it negative the tax clamps at zero rather than going\n * negative — a bill never emits a tax refund.\n */\nexport function billTaxAmount(\n taxableSubtotalCents: number,\n ratePercent: number,\n): number {\n return Math.max(0, Math.round((taxableSubtotalCents * ratePercent) / 100));\n}\n\n/** The bill's grand total in integer cents: line sum plus tax and shipping. */\nexport function billGrandTotal({\n subtotal,\n tax,\n shipping,\n}: {\n subtotal: number;\n tax: number;\n shipping: number;\n}): number {\n return subtotal + tax + shipping;\n}\n\n/**\n * Render integer cents as a currency string, e.g.\n * `formatMoney(123456, \"USD\")` → `\"$1,234.56\"`.\n *\n * Locale policy: `locale` defaults to `\"en-US\"` — the pin for any copy that is\n * persisted or shipped to a fixed audience (bill PDFs, emails, and the stored\n * approval/notification messages a customer reads back later). Live UI that\n * should follow the viewer passes `locale = null`, which falls back to the\n * runtime's default locale. Persisted-en-US / live-locale-aware is the\n * deliberate split; a persisted caller must never inherit the browser locale.\n */\nexport function formatMoney(\n cents: number,\n currency = \"USD\",\n locale: string | null = \"en-US\",\n): string {\n return new Intl.NumberFormat(locale ?? undefined, {\n style: \"currency\",\n currency,\n }).format(cents / 100);\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,uBAA8C,CACzD;CAAE,WAAW;CAAG,SAAS;AAAG,GAC5B;CAAE,WAAW;CAAS,SAAS;AAAG,CACpC;;;;;;AAOA,MAAa,qBAAqB;;AAGlC,SAAgB,uBACd,OACc;CACd,IAAI,SAAS,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,KAAK;CAC/C,OAAO,qBAAqB,KAAK,UAAU,EAAE,GAAG,KAAK,EAAE;AACzD;;;;;;AAOA,SAAgB,mBACd,OACA,gBACe;CACf,IAAI,QAA2B;CAC/B,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,YAAY,gBAAgB;EACrC,IAAI,UAAU,QAAQ,KAAK,YAAY,MAAM,WAAW,QAAQ;CAClE;CACA,OAAO,UAAU,OAAO,OAAO,MAAM;AACvC;;;;;;AAOA,SAAgB,YAAY,QAAgB,SAAyB;CACnE,OAAO,KAAK,MAAM,UAAU,IAAI,UAAU,IAAI;AAChD;;AAGA,SAAgB,UAAU,aAAwC;CAChE,OAAO,YAAY,QAAQ,KAAK,WAAW,MAAM,QAAQ,CAAC;AAC5D;;;;;AAMA,MAAa,mBAAmB;;;;;;AAOhC,SAAgB,cACd,sBACA,aACQ;CACR,OAAO,KAAK,IAAI,GAAG,KAAK,MAAO,uBAAuB,cAAe,GAAG,CAAC;AAC3E;;AAGA,SAAgB,eAAe,EAC7B,UACA,KACA,YAKS;CACT,OAAO,WAAW,MAAM;AAC1B;;;;;;;;;;;;AAaA,SAAgB,YACd,OACA,WAAW,OACX,SAAwB,SAChB;CACR,OAAO,IAAI,KAAK,aAAa,UAAU,KAAA,GAAW;EAChD,OAAO;EACP;CACF,CAAC,CAAC,CAAC,OAAO,QAAQ,GAAG;AACvB"}
@@ -0,0 +1,3 @@
1
+ export declare const SIS_DRIVERS: readonly ["veracross", "one-roster"];
2
+ export type SISDriver = (typeof SIS_DRIVERS)[number];
3
+ export declare function isSISDriver(driver: string | null | undefined): driver is SISDriver;
@@ -0,0 +1,9 @@
1
+ //#region .generated/lib/sisDrivers.ts
2
+ const SIS_DRIVERS = ["veracross", "one-roster"];
3
+ function isSISDriver(driver) {
4
+ return typeof driver === "string" && SIS_DRIVERS.includes(driver);
5
+ }
6
+ //#endregion
7
+ export { SIS_DRIVERS, isSISDriver };
8
+
9
+ //# sourceMappingURL=sisDrivers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sisDrivers.js","names":[],"sources":["../../.generated/lib/sisDrivers.ts"],"sourcesContent":["export const SIS_DRIVERS = [\"veracross\", \"one-roster\"] as const;\n\nexport type SISDriver = (typeof SIS_DRIVERS)[number];\n\nexport function isSISDriver(\n driver: string | null | undefined,\n): driver is SISDriver {\n return (\n typeof driver === \"string\" &&\n (SIS_DRIVERS as readonly string[]).includes(driver)\n );\n}\n"],"mappings":";AAAA,MAAa,cAAc,CAAC,aAAa,YAAY;AAIrD,SAAgB,YACd,QACqB;CACrB,OACE,OAAO,WAAW,YACjB,YAAkC,SAAS,MAAM;AAEtD"}
@@ -0,0 +1,2 @@
1
+ export declare const SOS_AUDIENCES: readonly ["internal", "emergencyContacts"];
2
+ export type SOSAudience = (typeof SOS_AUDIENCES)[number];
@@ -0,0 +1,6 @@
1
+ //#region .generated/lib/sosAudiences.ts
2
+ const SOS_AUDIENCES = ["internal", "emergencyContacts"];
3
+ //#endregion
4
+ export { SOS_AUDIENCES };
5
+
6
+ //# sourceMappingURL=sosAudiences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sosAudiences.js","names":[],"sources":["../../.generated/lib/sosAudiences.ts"],"sourcesContent":["export const SOS_AUDIENCES = [\"internal\", \"emergencyContacts\"] as const;\n\nexport type SOSAudience = (typeof SOS_AUDIENCES)[number];\n"],"mappings":";AAAA,MAAa,gBAAgB,CAAC,YAAY,mBAAmB"}
@@ -8,8 +8,10 @@ var Announcement = class extends Entity {
8
8
  this.id = data.id;
9
9
  if (data.propertyId !== void 0) this.propertyId = data.propertyId;
10
10
  this.type = data.type;
11
- if (data.users !== void 0) this.users = data.users;
12
- if (data.group !== void 0) this.group = data.group;
11
+ if (data.audience !== void 0) this.audience = data.audience;
12
+ if (data.channels !== void 0) this.channels = data.channels;
13
+ if (data.subject !== void 0) this.subject = data.subject;
14
+ if (data.surfaces !== void 0) this.surfaces = data.surfaces;
13
15
  this.body = data.body;
14
16
  if (data.media !== void 0) this.media = data.media;
15
17
  if (data.sentBy !== void 0) this.sentBy = data.sentBy;
@@ -1 +1 @@
1
- {"version":3,"file":"announcement.js","names":["validate"],"sources":["../../.generated/models/announcement.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateAnnouncement as validate } from \"../validate.js\";\nimport { announcementSchema, type AnnouncementSchema } from \"../schemas/announcement.js\";\n\n/**\n * Data type for Announcement constructor - exported for backwards compatibility\n */\nexport type AnnouncementData = AnnouncementSchema;\n\n/**\n * Announcement message sent to users\n */\nexport interface Announcement extends AnnouncementSchema {}\nexport class Announcement extends Entity {\n declare schema: typeof announcementSchema;\n declare validator: typeof validate;\n\n constructor(data: AnnouncementSchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n this.type = data.type;\n if (data.users !== undefined) this.users = data.users;\n if (data.group !== undefined) this.group = data.group;\n this.body = data.body;\n if (data.media !== undefined) this.media = data.media;\n if (data.sentBy !== undefined) this.sentBy = data.sentBy;\n if (data.tags !== undefined) this.tags = data.tags;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Announcement.prototype, \"schema\", {\n value: announcementSchema\n});\n\nObject.defineProperty(Announcement.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,eAAb,cAAkC,OAAO;CAIvC,YAAY,MAA0B;EACpC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,aAAa,WAAW,UAAU,EACtD,OAAO,mBACT,CAAC;AAED,OAAO,eAAe,aAAa,WAAW,aAAa,EACzD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
1
+ {"version":3,"file":"announcement.js","names":["validate"],"sources":["../../.generated/models/announcement.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateAnnouncement as validate } from \"../validate.js\";\nimport { announcementSchema, type AnnouncementSchema } from \"../schemas/announcement.js\";\n\n/**\n * Data type for Announcement constructor - exported for backwards compatibility\n */\nexport type AnnouncementData = AnnouncementSchema;\n\n/**\n * Announcement message sent to users\n */\nexport interface Announcement extends AnnouncementSchema {}\nexport class Announcement extends Entity {\n declare schema: typeof announcementSchema;\n declare validator: typeof validate;\n\n constructor(data: AnnouncementSchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n this.type = data.type;\n if (data.audience !== undefined) this.audience = data.audience;\n if (data.channels !== undefined) this.channels = data.channels;\n if (data.subject !== undefined) this.subject = data.subject;\n if (data.surfaces !== undefined) this.surfaces = data.surfaces;\n this.body = data.body;\n if (data.media !== undefined) this.media = data.media;\n if (data.sentBy !== undefined) this.sentBy = data.sentBy;\n if (data.tags !== undefined) this.tags = data.tags;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Announcement.prototype, \"schema\", {\n value: announcementSchema\n});\n\nObject.defineProperty(Announcement.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,eAAb,cAAkC,OAAO;CAIvC,YAAY,MAA0B;EACpC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,aAAa,WAAW,UAAU,EACtD,OAAO,mBACT,CAAC;AAED,OAAO,eAAe,aAAa,WAAW,aAAa,EACzD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
@@ -14,6 +14,8 @@ var Category = class extends Entity {
14
14
  if (data.image !== void 0) this.image = data.image;
15
15
  if (data.rating !== void 0) this.rating = data.rating;
16
16
  this.discriminator = data.discriminator;
17
+ if (data.iconKey !== void 0) this.iconKey = data.iconKey;
18
+ if (data.color !== void 0) this.color = data.color;
17
19
  if (data.systemId !== void 0) this.systemId = data.systemId;
18
20
  if (data.createdAt !== void 0) this.createdAt = data.createdAt;
19
21
  if (data.updatedAt !== void 0) this.updatedAt = data.updatedAt;
@@ -1 +1 @@
1
- {"version":3,"file":"category.js","names":["validate"],"sources":["../../.generated/models/category.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateCategory as validate } from \"../validate.js\";\nimport { categorySchema, type CategorySchema } from \"../schemas/category.js\";\n\n/**\n * Data type for Category constructor - exported for backwards compatibility\n */\nexport type CategoryData = CategorySchema;\n\n/**\n * Category\n */\nexport interface Category extends CategorySchema {}\nexport class Category extends Entity {\n declare schema: typeof categorySchema;\n declare validator: typeof validate;\n\n constructor(data: CategorySchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n this.type = data.type;\n if (data.name !== undefined) this.name = data.name;\n if (data.driver !== undefined) this.driver = data.driver;\n if (data.description !== undefined) this.description = data.description;\n if (data.image !== undefined) this.image = data.image;\n if (data.rating !== undefined) this.rating = data.rating;\n this.discriminator = data.discriminator;\n if (data.systemId !== undefined) this.systemId = data.systemId;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Category.prototype, \"schema\", {\n value: categorySchema\n});\n\nObject.defineProperty(Category.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,WAAb,cAA8B,OAAO;CAInC,YAAY,MAAsB;EAChC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,KAAK,gBAAgB,KAAK;EAC1B,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,SAAS,WAAW,UAAU,EAClD,OAAO,eACT,CAAC;AAED,OAAO,eAAe,SAAS,WAAW,aAAa,EACrD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
1
+ {"version":3,"file":"category.js","names":["validate"],"sources":["../../.generated/models/category.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateCategory as validate } from \"../validate.js\";\nimport { categorySchema, type CategorySchema } from \"../schemas/category.js\";\n\n/**\n * Data type for Category constructor - exported for backwards compatibility\n */\nexport type CategoryData = CategorySchema;\n\n/**\n * Category\n */\nexport interface Category extends CategorySchema {}\nexport class Category extends Entity {\n declare schema: typeof categorySchema;\n declare validator: typeof validate;\n\n constructor(data: CategorySchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n this.type = data.type;\n if (data.name !== undefined) this.name = data.name;\n if (data.driver !== undefined) this.driver = data.driver;\n if (data.description !== undefined) this.description = data.description;\n if (data.image !== undefined) this.image = data.image;\n if (data.rating !== undefined) this.rating = data.rating;\n this.discriminator = data.discriminator;\n if (data.iconKey !== undefined) this.iconKey = data.iconKey;\n if (data.color !== undefined) this.color = data.color;\n if (data.systemId !== undefined) this.systemId = data.systemId;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Category.prototype, \"schema\", {\n value: categorySchema\n});\n\nObject.defineProperty(Category.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,WAAb,cAA8B,OAAO;CAInC,YAAY,MAAsB;EAChC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,KAAK,gBAAgB,KAAK;EAC1B,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,SAAS,WAAW,UAAU,EAClD,OAAO,eACT,CAAC;AAED,OAAO,eAAe,SAAS,WAAW,aAAa,EACrD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
@@ -13,6 +13,7 @@ var EmailMessage = class extends Entity {
13
13
  this.subject = data.subject;
14
14
  this.status = data.status;
15
15
  if (data.statusMessage !== void 0) this.statusMessage = data.statusMessage;
16
+ if (data.errorCode !== void 0) this.errorCode = data.errorCode;
16
17
  if (data.html !== void 0) this.html = data.html;
17
18
  if (data.text !== void 0) this.text = data.text;
18
19
  if (data.driver !== void 0) this.driver = data.driver;
@@ -1 +1 @@
1
- {"version":3,"file":"emailMessage.js","names":["validate"],"sources":["../../.generated/models/emailMessage.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateEmailMessage as validate } from \"../validate.js\";\nimport { emailMessageSchema, type EmailMessageSchema } from \"../schemas/emailMessage.js\";\n\n/**\n * Data type for EmailMessage constructor - exported for backwards compatibility\n */\nexport type EmailMessageData = EmailMessageSchema;\n\n/**\n * EmailMessage\n */\nexport interface EmailMessage extends EmailMessageSchema {}\nexport class EmailMessage extends Entity {\n declare schema: typeof emailMessageSchema;\n declare validator: typeof validate;\n\n constructor(data: EmailMessageSchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n this.type = data.type;\n this.to = data.to;\n this.from = data.from;\n this.subject = data.subject;\n this.status = data.status;\n if (data.statusMessage !== undefined) this.statusMessage = data.statusMessage;\n if (data.html !== undefined) this.html = data.html;\n if (data.text !== undefined) this.text = data.text;\n if (data.driver !== undefined) this.driver = data.driver;\n if (data.headers !== undefined) this.headers = data.headers;\n if (data.replyTo !== undefined) this.replyTo = data.replyTo;\n if (data.appData !== undefined) this.appData = data.appData;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n if (data.systemId !== undefined) this.systemId = data.systemId;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(EmailMessage.prototype, \"schema\", {\n value: emailMessageSchema\n});\n\nObject.defineProperty(EmailMessage.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,eAAb,cAAkC,OAAO;CAIvC,YAAY,MAA0B;EACpC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,KAAK,OAAO,KAAK;EACjB,KAAK,KAAK,KAAK;EACf,KAAK,OAAO,KAAK;EACjB,KAAK,UAAU,KAAK;EACpB,KAAK,SAAS,KAAK;EACnB,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;CACxD;AASF;AAEA,OAAO,eAAe,aAAa,WAAW,UAAU,EACtD,OAAO,mBACT,CAAC;AAED,OAAO,eAAe,aAAa,WAAW,aAAa,EACzD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
1
+ {"version":3,"file":"emailMessage.js","names":["validate"],"sources":["../../.generated/models/emailMessage.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateEmailMessage as validate } from \"../validate.js\";\nimport { emailMessageSchema, type EmailMessageSchema } from \"../schemas/emailMessage.js\";\n\n/**\n * Data type for EmailMessage constructor - exported for backwards compatibility\n */\nexport type EmailMessageData = EmailMessageSchema;\n\n/**\n * EmailMessage\n */\nexport interface EmailMessage extends EmailMessageSchema {}\nexport class EmailMessage extends Entity {\n declare schema: typeof emailMessageSchema;\n declare validator: typeof validate;\n\n constructor(data: EmailMessageSchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n this.type = data.type;\n this.to = data.to;\n this.from = data.from;\n this.subject = data.subject;\n this.status = data.status;\n if (data.statusMessage !== undefined) this.statusMessage = data.statusMessage;\n if (data.errorCode !== undefined) this.errorCode = data.errorCode;\n if (data.html !== undefined) this.html = data.html;\n if (data.text !== undefined) this.text = data.text;\n if (data.driver !== undefined) this.driver = data.driver;\n if (data.headers !== undefined) this.headers = data.headers;\n if (data.replyTo !== undefined) this.replyTo = data.replyTo;\n if (data.appData !== undefined) this.appData = data.appData;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n if (data.systemId !== undefined) this.systemId = data.systemId;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(EmailMessage.prototype, \"schema\", {\n value: emailMessageSchema\n});\n\nObject.defineProperty(EmailMessage.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,eAAb,cAAkC,OAAO;CAIvC,YAAY,MAA0B;EACpC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,KAAK,OAAO,KAAK;EACjB,KAAK,KAAK,KAAK;EACf,KAAK,OAAO,KAAK;EACjB,KAAK,UAAU,KAAK;EACpB,KAAK,SAAS,KAAK;EACnB,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;CACxD;AASF;AAEA,OAAO,eAAe,aAAa,WAAW,UAAU,EACtD,OAAO,mBACT,CAAC;AAED,OAAO,eAAe,aAAa,WAAW,aAAa,EACzD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
@@ -31,10 +31,12 @@ export { Policy, type PolicyData } from "./policy.js";
31
31
  export { Product, type ProductData } from "./product.js";
32
32
  export { Property, type PropertyData } from "./property.js";
33
33
  export { Reservation, type ReservationData } from "./reservation.js";
34
+ export { Resource, type ResourceData } from "./resource.js";
34
35
  export { Server, type ServerData } from "./server.js";
35
36
  export { Session, type SessionData } from "./session.js";
36
37
  export { ShortLink, type ShortLinkData } from "./shortLink.js";
37
38
  export { SmsMessage, type SmsMessageData } from "./smsMessage.js";
39
+ export { SOSEvent, type SOSEventData } from "./sosEvent.js";
38
40
  export { SOSType, type SOSTypeData } from "./sosType.js";
39
41
  export { Space, type SpaceData } from "./space.js";
40
42
  export { Switch, type SwitchData } from "./switch.js";
@@ -32,10 +32,12 @@ import { Policy } from "./policy.js";
32
32
  import { Product } from "./product.js";
33
33
  import { Property } from "./property.js";
34
34
  import { Reservation } from "./reservation.js";
35
+ import { Resource } from "./resource.js";
35
36
  import { Server } from "./server.js";
36
37
  import { Session } from "./session.js";
37
38
  import { ShortLink } from "./shortLink.js";
38
39
  import { SmsMessage } from "./smsMessage.js";
40
+ import { SOSEvent } from "./sosEvent.js";
39
41
  import { SOSType } from "./sosType.js";
40
42
  import { Space } from "./space.js";
41
43
  import { Switch } from "./switch.js";
@@ -82,6 +84,8 @@ var models_exports = /* @__PURE__ */ __exportAll({
82
84
  Product: () => Product,
83
85
  Property: () => Property,
84
86
  Reservation: () => Reservation,
87
+ Resource: () => Resource,
88
+ SOSEvent: () => SOSEvent,
85
89
  SOSType: () => SOSType,
86
90
  Server: () => Server,
87
91
  Session: () => Session,
@@ -99,6 +103,6 @@ var models_exports = /* @__PURE__ */ __exportAll({
99
103
  WindowCovering: () => WindowCovering
100
104
  });
101
105
  //#endregion
102
- export { Alarm, Announcement, Automation, Bill, BillingCategory, Camera, Category, Courtesy, Credential, Department, Dimmer, DiscoveredDevice, EmailMessage, EnergyReport, EnergyReportShard, Entity, Gateway, Group, Identification, Integration, Issue, Lock, Log, MediaFile, MediaSource, MotionSensor, Notification, Organization, Payment, Policy, Product, Property, Reservation, SOSType, Server, Session, ShortLink, SmsMessage, Space, Switch, System, SystemUser, Thermostat, Ticket, TimeSheet, User, Vendor, WindowCovering, models_exports };
106
+ export { Alarm, Announcement, Automation, Bill, BillingCategory, Camera, Category, Courtesy, Credential, Department, Dimmer, DiscoveredDevice, EmailMessage, EnergyReport, EnergyReportShard, Entity, Gateway, Group, Identification, Integration, Issue, Lock, Log, MediaFile, MediaSource, MotionSensor, Notification, Organization, Payment, Policy, Product, Property, Reservation, Resource, SOSEvent, SOSType, Server, Session, ShortLink, SmsMessage, Space, Switch, System, SystemUser, Thermostat, Ticket, TimeSheet, User, Vendor, WindowCovering, models_exports };
103
107
 
104
108
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../.generated/models/index.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nexport { Entity } from \"./entity.js\";\n\nexport { Alarm, type AlarmData } from \"./alarm.js\";\nexport { Announcement, type AnnouncementData } from \"./announcement.js\";\nexport { Automation, type AutomationData } from \"./automation.js\";\nexport { Bill, type BillData } from \"./bill.js\";\nexport { BillingCategory, type BillingCategoryData } from \"./billingCategory.js\";\nexport { Camera, type CameraData } from \"./camera.js\";\nexport { Category, type CategoryData } from \"./category.js\";\nexport { Courtesy, type CourtesyData } from \"./courtesy.js\";\nexport { Credential, type CredentialData } from \"./credential.js\";\nexport { Department, type DepartmentData } from \"./department.js\";\nexport { Dimmer, type DimmerData } from \"./dimmer.js\";\nexport { DiscoveredDevice, type DiscoveredDeviceData } from \"./discoveredDevice.js\";\nexport { EmailMessage, type EmailMessageData } from \"./emailMessage.js\";\nexport { EnergyReport, type EnergyReportData } from \"./energyReport.js\";\nexport { EnergyReportShard, type EnergyReportShardData } from \"./energyReportShard.js\";\nexport { Gateway, type GatewayData } from \"./gateway.js\";\nexport { Group, type GroupData } from \"./group.js\";\nexport { Identification, type IdentificationData } from \"./identification.js\";\nexport { Integration, type IntegrationData } from \"./integration.js\";\nexport { Issue, type IssueData } from \"./issue.js\";\nexport { Lock, type LockData } from \"./lock.js\";\nexport { Log, type LogData } from \"./log.js\";\nexport { MediaFile, type MediaFileData } from \"./mediaFile.js\";\nexport { MediaSource, type MediaSourceData } from \"./mediaSource.js\";\nexport { MotionSensor, type MotionSensorData } from \"./motionSensor.js\";\nexport { Notification, type NotificationData } from \"./notification.js\";\nexport { Organization, type OrganizationData } from \"./organization.js\";\nexport { Payment, type PaymentData } from \"./payment.js\";\nexport { Policy, type PolicyData } from \"./policy.js\";\nexport { Product, type ProductData } from \"./product.js\";\nexport { Property, type PropertyData } from \"./property.js\";\nexport { Reservation, type ReservationData } from \"./reservation.js\";\nexport { Server, type ServerData } from \"./server.js\";\nexport { Session, type SessionData } from \"./session.js\";\nexport { ShortLink, type ShortLinkData } from \"./shortLink.js\";\nexport { SmsMessage, type SmsMessageData } from \"./smsMessage.js\";\nexport { SOSType, type SOSTypeData } from \"./sosType.js\";\nexport { Space, type SpaceData } from \"./space.js\";\nexport { Switch, type SwitchData } from \"./switch.js\";\nexport { System, type SystemData } from \"./system.js\";\nexport { SystemUser, type SystemUserData } from \"./systemUser.js\";\nexport { Thermostat, type ThermostatData } from \"./thermostat.js\";\nexport { Ticket, type TicketData } from \"./ticket.js\";\nexport { TimeSheet, type TimeSheetData } from \"./timeSheet.js\";\nexport { User, type UserData } from \"./user.js\";\nexport { Vendor, type VendorData } from \"./vendor.js\";\nexport { WindowCovering, type WindowCoveringData } from \"./windowCovering.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../.generated/models/index.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nexport { Entity } from \"./entity.js\";\n\nexport { Alarm, type AlarmData } from \"./alarm.js\";\nexport { Announcement, type AnnouncementData } from \"./announcement.js\";\nexport { Automation, type AutomationData } from \"./automation.js\";\nexport { Bill, type BillData } from \"./bill.js\";\nexport { BillingCategory, type BillingCategoryData } from \"./billingCategory.js\";\nexport { Camera, type CameraData } from \"./camera.js\";\nexport { Category, type CategoryData } from \"./category.js\";\nexport { Courtesy, type CourtesyData } from \"./courtesy.js\";\nexport { Credential, type CredentialData } from \"./credential.js\";\nexport { Department, type DepartmentData } from \"./department.js\";\nexport { Dimmer, type DimmerData } from \"./dimmer.js\";\nexport { DiscoveredDevice, type DiscoveredDeviceData } from \"./discoveredDevice.js\";\nexport { EmailMessage, type EmailMessageData } from \"./emailMessage.js\";\nexport { EnergyReport, type EnergyReportData } from \"./energyReport.js\";\nexport { EnergyReportShard, type EnergyReportShardData } from \"./energyReportShard.js\";\nexport { Gateway, type GatewayData } from \"./gateway.js\";\nexport { Group, type GroupData } from \"./group.js\";\nexport { Identification, type IdentificationData } from \"./identification.js\";\nexport { Integration, type IntegrationData } from \"./integration.js\";\nexport { Issue, type IssueData } from \"./issue.js\";\nexport { Lock, type LockData } from \"./lock.js\";\nexport { Log, type LogData } from \"./log.js\";\nexport { MediaFile, type MediaFileData } from \"./mediaFile.js\";\nexport { MediaSource, type MediaSourceData } from \"./mediaSource.js\";\nexport { MotionSensor, type MotionSensorData } from \"./motionSensor.js\";\nexport { Notification, type NotificationData } from \"./notification.js\";\nexport { Organization, type OrganizationData } from \"./organization.js\";\nexport { Payment, type PaymentData } from \"./payment.js\";\nexport { Policy, type PolicyData } from \"./policy.js\";\nexport { Product, type ProductData } from \"./product.js\";\nexport { Property, type PropertyData } from \"./property.js\";\nexport { Reservation, type ReservationData } from \"./reservation.js\";\nexport { Resource, type ResourceData } from \"./resource.js\";\nexport { Server, type ServerData } from \"./server.js\";\nexport { Session, type SessionData } from \"./session.js\";\nexport { ShortLink, type ShortLinkData } from \"./shortLink.js\";\nexport { SmsMessage, type SmsMessageData } from \"./smsMessage.js\";\nexport { SOSEvent, type SOSEventData } from \"./sosEvent.js\";\nexport { SOSType, type SOSTypeData } from \"./sosType.js\";\nexport { Space, type SpaceData } from \"./space.js\";\nexport { Switch, type SwitchData } from \"./switch.js\";\nexport { System, type SystemData } from \"./system.js\";\nexport { SystemUser, type SystemUserData } from \"./systemUser.js\";\nexport { Thermostat, type ThermostatData } from \"./thermostat.js\";\nexport { Ticket, type TicketData } from \"./ticket.js\";\nexport { TimeSheet, type TimeSheetData } from \"./timeSheet.js\";\nexport { User, type UserData } from \"./user.js\";\nexport { Vendor, type VendorData } from \"./vendor.js\";\nexport { WindowCovering, type WindowCoveringData } from \"./windowCovering.js\";\n"],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Entity } from "./entity.js";
2
+ import { validateResource as validate } from "../validate.js";
3
+ import { resourceSchema, type ResourceSchema } from "../schemas/resource.js";
4
+ /**
5
+ * Data type for Resource constructor - exported for backwards compatibility
6
+ */
7
+ export type ResourceData = ResourceSchema;
8
+ /**
9
+ * An entry in the organization's resource library — an uploaded file or an external link.
10
+ */
11
+ export interface Resource extends ResourceSchema {
12
+ }
13
+ export declare class Resource extends Entity {
14
+ schema: typeof resourceSchema;
15
+ validator: typeof validate;
16
+ constructor(data: ResourceSchema);
17
+ }
@@ -0,0 +1,31 @@
1
+ import { Entity } from "./entity.js";
2
+ import { resourceSchema } from "../schemas/resource.js";
3
+ import { validateResource } from "../validate.js";
4
+ //#region .generated/models/resource.ts
5
+ var Resource = class extends Entity {
6
+ constructor(data) {
7
+ super(data);
8
+ this.id = data.id;
9
+ this.type = data.type;
10
+ this.discriminator = data.discriminator;
11
+ this.name = data.name;
12
+ if (data.description !== void 0) this.description = data.description;
13
+ if (data.url !== void 0) this.url = data.url;
14
+ if (data.media !== void 0) this.media = data.media;
15
+ if (data.preview !== void 0) this.preview = data.preview;
16
+ if (data.categoryIds !== void 0) this.categoryIds = data.categoryIds;
17
+ this.scope = data.scope;
18
+ if (data.createdBy !== void 0) this.createdBy = data.createdBy;
19
+ if (data.createdAt !== void 0) this.createdAt = data.createdAt;
20
+ if (data.updatedAt !== void 0) this.updatedAt = data.updatedAt;
21
+ if (data.deletedAt !== void 0) this.deletedAt = data.deletedAt;
22
+ }
23
+ };
24
+ Object.defineProperty(Resource.prototype, "schema", { value: resourceSchema });
25
+ Object.defineProperty(Resource.prototype, "validator", { get: function() {
26
+ return validateResource;
27
+ } });
28
+ //#endregion
29
+ export { Resource };
30
+
31
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","names":["validate"],"sources":["../../.generated/models/resource.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateResource as validate } from \"../validate.js\";\nimport { resourceSchema, type ResourceSchema } from \"../schemas/resource.js\";\n\n/**\n * Data type for Resource constructor - exported for backwards compatibility\n */\nexport type ResourceData = ResourceSchema;\n\n/**\n * An entry in the organization's resource library — an uploaded file or an external link.\n */\nexport interface Resource extends ResourceSchema {}\nexport class Resource extends Entity {\n declare schema: typeof resourceSchema;\n declare validator: typeof validate;\n\n constructor(data: ResourceSchema) {\n super(data);\n this.id = data.id;\n this.type = data.type;\n this.discriminator = data.discriminator;\n this.name = data.name;\n if (data.description !== undefined) this.description = data.description;\n if (data.url !== undefined) this.url = data.url;\n if (data.media !== undefined) this.media = data.media;\n if (data.preview !== undefined) this.preview = data.preview;\n if (data.categoryIds !== undefined) this.categoryIds = data.categoryIds;\n this.scope = data.scope;\n if (data.createdBy !== undefined) this.createdBy = data.createdBy;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Resource.prototype, \"schema\", {\n value: resourceSchema\n});\n\nObject.defineProperty(Resource.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,WAAb,cAA8B,OAAO;CAInC,YAAY,MAAsB;EAChC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,KAAK,OAAO,KAAK;EACjB,KAAK,gBAAgB,KAAK;EAC1B,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,QAAQ,KAAA,GAAW,KAAK,MAAM,KAAK;EAC5C,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,KAAK,QAAQ,KAAK;EAClB,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,SAAS,WAAW,UAAU,EAClD,OAAO,eACT,CAAC;AAED,OAAO,eAAe,SAAS,WAAW,aAAa,EACrD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
@@ -12,6 +12,7 @@ var SmsMessage = class extends Entity {
12
12
  this.from = data.from;
13
13
  if (data.media !== void 0) this.media = data.media;
14
14
  this.status = data.status;
15
+ if (data.errorCode !== void 0) this.errorCode = data.errorCode;
15
16
  if (data.body !== void 0) this.body = data.body;
16
17
  if (data.driver !== void 0) this.driver = data.driver;
17
18
  if (data.appData !== void 0) this.appData = data.appData;