home-assistant-javascript-templates 5.5.0 → 5.6.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.
package/README.md CHANGED
@@ -153,7 +153,8 @@ The `hass` object
153
153
 
154
154
  `states` could be used in two ways, as a function or as an object. When using it as function it only allows an entity id (containing the domain) as a parameter and it will return the state of that entity. As an object it allows you to access a domain or the full entity state object.
155
155
 
156
- >Note: If you try to use `states` as a function sending a domain it will throw an error.
156
+ >[!IMPORTANT]
157
+ >If you try to use `states` as a function sending a domain it will throw an error.
157
158
 
158
159
  ```javascript
159
160
  // Using states as a function
@@ -165,7 +166,8 @@ states.device_tracker.paulus.state // returns the state of the entity id 'device
165
166
  states.device_tracker // returns an object containing all the entities states of the 'device_tracker' domain
166
167
  ```
167
168
 
168
- >Note: Avoid using `states['device_tracker.paulus'].state` or `states.device_tracker.paulus.state`, instead use `states('device_tracker.paulus')` which will return `undefined` if the device id doesn‘t exist or the entity isn’t ready yet (the former will throw an error). If you still want to use them it is advisable to use the [Optional chaining operator], e.g. `states['device_tracker.paulus']?.state` or `states.device_tracker?.paulus?.state`.
169
+ >[!TIP]
170
+ >Avoid using `states['device_tracker.paulus'].state` or `states.device_tracker.paulus.state`, instead use `states('device_tracker.paulus')` which will return `undefined` if the device id doesn‘t exist or the entity isn’t ready yet (the former will throw an error). If you still want to use them it is advisable to use the [Optional chaining operator], e.g. `states['device_tracker.paulus']?.state` or `states.device_tracker?.paulus?.state`.
169
171
 
170
172
  #### is_state
171
173
 
@@ -354,6 +356,30 @@ Property to return the current Home Assistant panel URL (`window.location.pathna
354
356
  panel_url
355
357
  ```
356
358
 
359
+ #### ref and unref
360
+
361
+ `ref` and `unref` method allows to work with reactive variables. Reactive variables are variables that can be accessed globally from any template and changing their values in any template will trigger a re-render in the tracked templates using them.
362
+
363
+ ```javascript
364
+ // create a ref to a variable named name
365
+ const name = ref('name');
366
+
367
+ // Changing the value of the ref name
368
+ // This will re-evaluate any template in which ref('name') has been used
369
+ name.value = 'ElChiniNet';
370
+
371
+ // Accesing the value of the ref name
372
+ const myName = name.value;
373
+
374
+ // Remove the ref name
375
+ // This will stop any re-evaluation of this reactive variable in any template
376
+ unref('name');
377
+ ```
378
+
379
+ >[!IMPORTANT]
380
+ >1. A `ref` has only one property, and it is `value`. Trying to access or assign another property than value will throw an error.
381
+ >2. `unref` should be called if a `ref` has been created previously or if it has not been already _unrefed_. Trying to call `unref` in a non-existent `ref` will throw an error.
382
+
357
383
  ## Examples
358
384
 
359
385
  #### Get a device attribute and return a formatted text with it
@@ -55,6 +55,7 @@ declare class HomeAssistantJavaScriptTemplatesRenderer {
55
55
  private _throwWarnings;
56
56
  private _variables;
57
57
  private _autoReturn;
58
+ private _clientSideEntitiesRegExp;
58
59
  private _subscriptions;
59
60
  private _scopped;
60
61
  private _executeRenderingFunctions;
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{getPromisableResult as t}from"get-promisable-result";function e(t,e,n){if(n||2===arguments.length)for(var i,s=0,r=e.length;s<r;s++)!i&&s in e||(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var n,i,s,r,a="[home-assistant-javascript-templates]",o=/^([a-z_]+)\.(\w+)$/;!function(t){t.UNKNOWN="unknown",t.UNAVAILABLE="unavailable"}(n||(n={})),function(t){t.AREA_ID="area_id",t.NAME="name"}(i||(i={})),function(t){t.PANEL_URL="panel_url"}(s||(s={})),function(t){t.LOCATION_CHANGED="location-changed",t.POPSTATE="popstate",t.SUBSCRIBE_EVENTS="subscribe_events",t.STATE_CHANGE_EVENT="state_changed"}(r||(r={}));var c=function(t){return t.reduce((function(t,e){var n=e[0],i=e[1];return t[n.replace(o,"$2")]=i,t}),{})},u=function(t){return t.includes(".")};function d(t,e){var r=function(){return Object.entries(t.hass.areas)},o=function(){return Object.entries(t.hass.entities)},d=new Set,_=function(t,n){e&&console.warn("".concat(t," ").concat(n," used in a JavaScript template doesn't exist"))},p=function(t){return _("Entity",t)},h=function(t){return _("Domain",t)},v=function(e){t.hass.states[e]?d.add(e):p(e)};return{get hass(){return t.hass},states:new Proxy((function(e){var n;if(u(e))return v(e),null===(n=t.hass.states[e])||void 0===n?void 0:n.state;throw SyntaxError("".concat(a,": states method cannot be used with a domain, use it as an object instead."))}),{get:function(e,n){if(u(n))return v(n),t.hass.states[n];var i=Object.entries(t.hass.states).filter((function(t){return t[0].startsWith(n)}));return i.length||h(n),new Proxy(c(i),{get:function(t,e){return v("".concat(n,".").concat(e)),t[e]}})}}),is_state:function(e,n){var i;return v(e),(null===(i=t.hass.states[e])||void 0===i?void 0:i.state)===n},state_attr:function(e,n){var i,s;return v(e),null===(s=null===(i=t.hass.states[e])||void 0===i?void 0:i.attributes)||void 0===s?void 0:s[n]},is_state_attr:function(t,e,n){return this.state_attr(t,e)===n},has_value:function(t){return this.states(t)?!(this.is_state(t,n.UNKNOWN)||this.is_state(t,n.UNAVAILABLE)):(p(t),!1)},entities:new Proxy((function(e){if(void 0===e)return t.hass.entities;if(u(e))return v(e),t.hass.entities[e];var n=o().filter((function(t){return t[0].startsWith(e)}));return n.length||h(e),new Proxy(c(n),{get:function(t,n){return v("".concat(e,".").concat(n)),t[n]}})}),{get:function(t,e){return t(e)}}),entity_prop:function(e,n){var i;return v(e),null===(i=t.hass.entities[e])||void 0===i?void 0:i[n]},is_entity_prop:function(t,e,n){return this.entity_prop(t,e)===n},devices:new Proxy((function(e){if(void 0===e)return t.hass.devices;if(u(e))throw SyntaxError("".concat(a,": devices method cannot be used with an entity id, you should use a device id instead."));return t.hass.devices[e]}),{get:function(e,n){if(u(n))throw SyntaxError("".concat(a,": devices cannot be accesed using an entity id, you should use a device id instead."));return t.hass.devices[n]}}),device_attr:function(e,n){var i;return null===(i=t.hass.devices[e])||void 0===i?void 0:i[n]},is_device_attr:function(t,e,n){return this.device_attr(t,e)===n},device_id:function(e){var n;return v(e),null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id},areas:function(){return r().map((function(t){return t[1].area_id}))},area_id:function(e){var n,s;if(e in t.hass.devices)return this.device_attr(e,i.AREA_ID);var a=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;if(a)return this.device_attr(a,i.AREA_ID);var o=r().find((function(t){return t[1].name===e}));return null===(s=null==o?void 0:o[1])||void 0===s?void 0:s.area_id},area_name:function(e){var n,s,a;e in t.hass.devices&&(a=this.device_attr(e,i.AREA_ID));var o=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;o&&(a=this.device_attr(o,i.AREA_ID));var c=r().find((function(t){var n=t[1];return n.area_id===e||n.area_id===a}));return null===(s=null==c?void 0:c[1])||void 0===s?void 0:s.name},area_entities:function(t){var e=r().find((function(e){var n=e[1];return n.area_id===t||n.name===t}));return e?o().filter((function(t){return t[1].area_id===e[1].area_id})).map((function(t){return t[0]})):[]},area_devices:function(e){var n=r().find((function(t){var n=t[1];return n.area_id===e||n.name===e}));return n?Object.entries(t.hass.devices).filter((function(t){return t[1].area_id===n[1].area_id})).map((function(t){return t[1].id})):[]},get user_name(){return t.hass.user.name},get user_is_admin(){return t.hass.user.is_admin},get user_is_owner(){return t.hass.user.is_owner},get user_agent(){return window.navigator.userAgent},get panel_url(){var t;return t=s.PANEL_URL,d.add(t),location.pathname},get tracked(){return d},cleanTracked:function(){d.clear()}}}var _=function(){function t(t,e){var n=e.throwErrors,i=void 0!==n&&n,s=e.throwWarnings,r=void 0===s||s,a=e.variables,o=void 0===a?{}:a,c=e.autoReturn,u=void 0===c||c;this._throwErrors=i,this._throwWarnings=r,this._variables=o,this._autoReturn=u,this._subscriptions=new Map,this._scopped=d(t,r),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return t.prototype._executeRenderingFunctions=function(t){var e=this;this._subscriptions.get(t).forEach((function(t,n){t.forEach((function(t){e.trackTemplate(n,t)}))}))},t.prototype._watchForPanelUrlChange=function(){var t=this;window.addEventListener(r.LOCATION_CHANGED,(function(e){t._panelUrlWatchCallback()})),window.addEventListener(r.POPSTATE,(function(){t._panelUrlWatchCallback()}))},t.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(s.PANEL_URL)&&this._executeRenderingFunctions(s.PANEL_URL)},t.prototype._watchForEntitiesChange=function(){var t=this;window.hassConnection.then((function(e){e.conn.subscribeMessage((function(e){return t._entityWatchCallback(e)}),{type:r.SUBSCRIBE_EVENTS,event_type:r.STATE_CHANGE_EVENT})}))},t.prototype._entityWatchCallback=function(t){if(this._subscriptions.size){var e=t.data.entity_id;this._subscriptions.has(e)&&this._executeRenderingFunctions(e)}},t.prototype._storeTracked=function(t,e){var n=this;this._scopped.tracked.forEach((function(i){if(n._subscriptions.has(i)){var s=n._subscriptions.get(i);if(s.has(t)){var r=s.get(t);r.has(e)||r.add(e)}else s.set(t,new Set([e]))}else n._subscriptions.set(i,new Map([[t,new Set([e])]]))}))},t.prototype._untrackTemplate=function(t,e){var n=this;this._subscriptions.forEach((function(i,s){if(i.has(t)){var r=i.get(t);r.has(e)&&r.delete(e),0===r.size&&(i.delete(t),0===i.size&&n._subscriptions.delete(s))}}))},t.prototype.renderTemplate=function(t){try{var n=new Map(Object.entries(this._variables)),i=t.trim(),s=i.includes("return")||!this._autoReturn?i:"return ".concat(i);return(new(Function.bind.apply(Function,e(e([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","panel_url","user_agent"],Array.from(n.keys()),!1),["".concat('"use strict";'," ").concat(s)],!1)))).apply(void 0,e([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.panel_url,this._scopped.user_agent],Array.from(n.values()),!1))}catch(t){if(this._throwErrors)throw t;return void(this._throwWarnings&&console.warn(t))}},t.prototype.trackTemplate=function(t,e){var n=this;this._scopped.cleanTracked();var i=this.renderTemplate(t);return this._storeTracked(t,e),e(i),function(){return n._untrackTemplate(t,e)}},t.prototype.cleanTracked=function(t){t?this._subscriptions.has(t)&&this._subscriptions.delete(t):this._subscriptions.clear()},Object.defineProperty(t.prototype,"variables",{get:function(){return this._variables},set:function(t){this._variables=t},enumerable:!1,configurable:!0}),t}(),p=function(){function e(e,n){void 0===n&&(n={}),this._renderer=t((function(){return e.hass}),(function(t){return!!(t&&t.areas&&t.devices&&t.entities&&t.states&&t.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new _(e,n)}))}return e.prototype.getRenderer=function(){return this._renderer},e}();export{p as default};
1
+ import{getPromisableResult as t}from"get-promisable-result";function e(t,e,n){if(n||2===arguments.length)for(var i,s=0,r=e.length;s<r;s++)!i&&s in e||(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var n,i,s,r,a="[home-assistant-javascript-templates]",o=/^([a-z_]+)\.(\w+)$/;!function(t){t.UNKNOWN="unknown",t.UNAVAILABLE="unavailable"}(n||(n={})),function(t){t.AREA_ID="area_id",t.NAME="name"}(i||(i={})),function(t){t.PANEL_URL="panel_url"}(s||(s={})),function(t){t.LOCATION_CHANGED="location-changed",t.POPSTATE="popstate",t.SUBSCRIBE_EVENTS="subscribe_events",t.STATE_CHANGE_EVENT="state_changed"}(r||(r={}));var c=function(t){return t.reduce((function(t,e){var n=e[0],i=e[1];return t[n.replace(o,"$2")]=i,t}),{})},u=function(t){return t.includes(".")};function d(t,e,o){var d=function(){return Object.entries(t.hass.areas)},_=function(){return Object.entries(t.hass.entities)},p=new Set,h=new Map,v="ref",l="value",f=function(t){return"".concat(v,".").concat(t)},b=function(t,e){o&&console.warn("".concat(t," ").concat(e," used in a JavaScript template doesn't exist"))},y=function(t){return b("Entity",t)},E=function(t){return b("Domain",t)},w=function(t){var n=new SyntaxError(t);if(e)throw n;o&&console.warn(n)},g=function(e){t.hass.states[e]?p.add(e):y(e)},m=function(t){p.add(t)};return{get hass(){return t.hass},states:new Proxy((function(e){var n;if(u(e))return g(e),null===(n=t.hass.states[e])||void 0===n?void 0:n.state;throw SyntaxError("".concat(a,": states method cannot be used with a domain, use it as an object instead."))}),{get:function(e,n){if(u(n))return g(n),t.hass.states[n];var i=Object.entries(t.hass.states).filter((function(t){return t[0].startsWith(n)}));return i.length||E(n),new Proxy(c(i),{get:function(t,e){return g("".concat(n,".").concat(e)),t[e]}})}}),is_state:function(e,n){var i;return g(e),(null===(i=t.hass.states[e])||void 0===i?void 0:i.state)===n},state_attr:function(e,n){var i,s;return g(e),null===(s=null===(i=t.hass.states[e])||void 0===i?void 0:i.attributes)||void 0===s?void 0:s[n]},is_state_attr:function(t,e,n){return this.state_attr(t,e)===n},has_value:function(t){return this.states(t)?!(this.is_state(t,n.UNKNOWN)||this.is_state(t,n.UNAVAILABLE)):(y(t),!1)},entities:new Proxy((function(e){if(void 0===e)return t.hass.entities;if(u(e))return g(e),t.hass.entities[e];var n=_().filter((function(t){return t[0].startsWith(e)}));return n.length||E(e),new Proxy(c(n),{get:function(t,n){return g("".concat(e,".").concat(n)),t[n]}})}),{get:function(t,e){return t(e)}}),entity_prop:function(e,n){var i;return g(e),null===(i=t.hass.entities[e])||void 0===i?void 0:i[n]},is_entity_prop:function(t,e,n){return this.entity_prop(t,e)===n},devices:new Proxy((function(e){if(void 0===e)return t.hass.devices;if(u(e))throw SyntaxError("".concat(a,": devices method cannot be used with an entity id, you should use a device id instead."));return t.hass.devices[e]}),{get:function(e,n){if(u(n))throw SyntaxError("".concat(a,": devices cannot be accesed using an entity id, you should use a device id instead."));return t.hass.devices[n]}}),device_attr:function(e,n){var i;return null===(i=t.hass.devices[e])||void 0===i?void 0:i[n]},is_device_attr:function(t,e,n){return this.device_attr(t,e)===n},device_id:function(e){var n;return g(e),null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id},areas:function(){return d().map((function(t){return t[1].area_id}))},area_id:function(e){var n,s;if(e in t.hass.devices)return this.device_attr(e,i.AREA_ID);var r=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;if(r)return this.device_attr(r,i.AREA_ID);var a=d().find((function(t){return t[1].name===e}));return null===(s=null==a?void 0:a[1])||void 0===s?void 0:s.area_id},area_name:function(e){var n,s,r;e in t.hass.devices&&(r=this.device_attr(e,i.AREA_ID));var a=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;a&&(r=this.device_attr(a,i.AREA_ID));var o=d().find((function(t){var n=t[1];return n.area_id===e||n.area_id===r}));return null===(s=null==o?void 0:o[1])||void 0===s?void 0:s.name},area_entities:function(t){var e=d().find((function(e){var n=e[1];return n.area_id===t||n.name===t}));return e?_().filter((function(t){return t[1].area_id===e[1].area_id})).map((function(t){return t[0]})):[]},area_devices:function(e){var n=d().find((function(t){var n=t[1];return n.area_id===e||n.name===e}));return n?Object.entries(t.hass.devices).filter((function(t){return t[1].area_id===n[1].area_id})).map((function(t){return t[1].id})):[]},get user_name(){return t.hass.user.name},get user_is_admin(){return t.hass.user.is_admin},get user_is_owner(){return t.hass.user.is_owner},get user_agent(){return window.navigator.userAgent},get tracked(){return p},cleanTracked:function(){p.clear()},ref:function(t,e){var n=f(e);if(h.has(e))return h.get(e);var i=new Proxy({value:void 0},{get:function(t,e){if(e===l)return m(n),t.value;w("".concat(e," is not a valid ").concat(v," property. A ").concat(v," only exposes a ").concat(l," property"))},set:function(e,i,s){if(i===l){var a=e.value;return e.value=s,t({event_type:r.STATE_CHANGE_EVENT,data:{entity_id:n,old_state:{state:JSON.stringify(a)},new_state:{state:JSON.stringify(s)}}}),!0}return w("property ".concat(i," cannot be set in a ").concat(v)),!1}});return h.set(e,i),i},unref:function(t,e){var n=f(e);h.has(e)?(h.delete(e),t(n)):w("".concat(e," is not a ref or it has been unrefed already"))},clientSideProxy:new Proxy({},{get:function(t,e){if(e===s.PANEL_URL)return m(s.PANEL_URL),location.pathname;o&&console.warn("clientSideProxy should only be used to access these variables: ".concat(Object.values(s).join(", ")))}})}}var _=function(){function t(t,e){var n=e.throwErrors,i=void 0!==n&&n,r=e.throwWarnings,a=void 0===r||r,o=e.variables,c=void 0===o?{}:o,u=e.autoReturn,_=void 0===u||u;this._throwErrors=i,this._throwWarnings=a,this._variables=c,this._autoReturn=_,this._subscriptions=new Map,this._clientSideEntitiesRegExp=new RegExp("(^|[ \\?(+:\\{\\[><])(".concat(Object.values(s).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=d(t,i,a),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return t.prototype._executeRenderingFunctions=function(t){var e=this;this._subscriptions.get(t).forEach((function(t,n){t.forEach((function(t){e.trackTemplate(n,t)}))}))},t.prototype._watchForPanelUrlChange=function(){var t=this;window.addEventListener(r.LOCATION_CHANGED,(function(e){t._panelUrlWatchCallback()})),window.addEventListener(r.POPSTATE,(function(){t._panelUrlWatchCallback()}))},t.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(s.PANEL_URL)&&this._executeRenderingFunctions(s.PANEL_URL)},t.prototype._watchForEntitiesChange=function(){var t=this;window.hassConnection.then((function(e){e.conn.subscribeMessage((function(e){return t._entityWatchCallback(e)}),{type:r.SUBSCRIBE_EVENTS,event_type:r.STATE_CHANGE_EVENT})}))},t.prototype._entityWatchCallback=function(t){if(this._subscriptions.size){var e=t.data.entity_id;this._subscriptions.has(e)&&this._executeRenderingFunctions(e)}},t.prototype._storeTracked=function(t,e){var n=this;this._scopped.tracked.forEach((function(i){if(n._subscriptions.has(i)){var s=n._subscriptions.get(i);if(s.has(t)){var r=s.get(t);r.has(e)||r.add(e)}else s.set(t,new Set([e]))}else n._subscriptions.set(i,new Map([[t,new Set([e])]]))}))},t.prototype._untrackTemplate=function(t,e){var n=this;this._subscriptions.forEach((function(i,s){if(i.has(t)){var r=i.get(t);r.has(e)&&r.delete(e),0===r.size&&(i.delete(t),0===i.size&&n._subscriptions.delete(s))}}))},t.prototype.renderTemplate=function(t){try{var n=new Map(Object.entries(this._variables)),i=t.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),s=i.includes("return")||!this._autoReturn?i:"return ".concat(i);return(new(Function.bind.apply(Function,e(e([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide","ref","unref"],Array.from(n.keys()),!1),["".concat('"use strict";'," ").concat(s)],!1)))).apply(void 0,e([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy,this._scopped.ref.bind(this._scopped,this._entityWatchCallback.bind(this)),this._scopped.unref.bind(this._scopped,this.cleanTracked.bind(this))],Array.from(n.values()),!1))}catch(t){if(this._throwErrors)throw t;return void(this._throwWarnings&&console.warn(t))}},t.prototype.trackTemplate=function(t,e){var n=this;this._scopped.cleanTracked();var i=this.renderTemplate(t);return this._storeTracked(t,e),e(i),function(){return n._untrackTemplate(t,e)}},t.prototype.cleanTracked=function(t){t?this._subscriptions.has(t)&&this._subscriptions.delete(t):this._subscriptions.clear()},Object.defineProperty(t.prototype,"variables",{get:function(){return this._variables},set:function(t){this._variables=t},enumerable:!1,configurable:!0}),t}(),p=function(){function e(e,n){void 0===n&&(n={}),this._renderer=t((function(){return e.hass}),(function(t){return!!(t&&t.areas&&t.devices&&t.entities&&t.states&&t.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new _(e,n)}))}return e.prototype.getRenderer=function(){return this._renderer},e}();export{p as default};
package/dist/index.d.ts CHANGED
@@ -55,6 +55,7 @@ declare class HomeAssistantJavaScriptTemplatesRenderer {
55
55
  private _throwWarnings;
56
56
  private _variables;
57
57
  private _autoReturn;
58
+ private _clientSideEntitiesRegExp;
58
59
  private _subscriptions;
59
60
  private _scopped;
60
61
  private _executeRenderingFunctions;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("get-promisable-result");function e(t,e,n){if(n||2===arguments.length)for(var i,s=0,r=e.length;s<r;s++)!i&&s in e||(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var n,i,s,r,a="[home-assistant-javascript-templates]",o=/^([a-z_]+)\.(\w+)$/;!function(t){t.UNKNOWN="unknown",t.UNAVAILABLE="unavailable"}(n||(n={})),function(t){t.AREA_ID="area_id",t.NAME="name"}(i||(i={})),function(t){t.PANEL_URL="panel_url"}(s||(s={})),function(t){t.LOCATION_CHANGED="location-changed",t.POPSTATE="popstate",t.SUBSCRIBE_EVENTS="subscribe_events",t.STATE_CHANGE_EVENT="state_changed"}(r||(r={}));var c=function(t){return t.reduce((function(t,e){var n=e[0],i=e[1];return t[n.replace(o,"$2")]=i,t}),{})},u=function(t){return t.includes(".")};function d(t,e){var r=function(){return Object.entries(t.hass.areas)},o=function(){return Object.entries(t.hass.entities)},d=new Set,_=function(t,n){e&&console.warn("".concat(t," ").concat(n," used in a JavaScript template doesn't exist"))},p=function(t){return _("Entity",t)},h=function(t){return _("Domain",t)},v=function(e){t.hass.states[e]?d.add(e):p(e)};return{get hass(){return t.hass},states:new Proxy((function(e){var n;if(u(e))return v(e),null===(n=t.hass.states[e])||void 0===n?void 0:n.state;throw SyntaxError("".concat(a,": states method cannot be used with a domain, use it as an object instead."))}),{get:function(e,n){if(u(n))return v(n),t.hass.states[n];var i=Object.entries(t.hass.states).filter((function(t){return t[0].startsWith(n)}));return i.length||h(n),new Proxy(c(i),{get:function(t,e){return v("".concat(n,".").concat(e)),t[e]}})}}),is_state:function(e,n){var i;return v(e),(null===(i=t.hass.states[e])||void 0===i?void 0:i.state)===n},state_attr:function(e,n){var i,s;return v(e),null===(s=null===(i=t.hass.states[e])||void 0===i?void 0:i.attributes)||void 0===s?void 0:s[n]},is_state_attr:function(t,e,n){return this.state_attr(t,e)===n},has_value:function(t){return this.states(t)?!(this.is_state(t,n.UNKNOWN)||this.is_state(t,n.UNAVAILABLE)):(p(t),!1)},entities:new Proxy((function(e){if(void 0===e)return t.hass.entities;if(u(e))return v(e),t.hass.entities[e];var n=o().filter((function(t){return t[0].startsWith(e)}));return n.length||h(e),new Proxy(c(n),{get:function(t,n){return v("".concat(e,".").concat(n)),t[n]}})}),{get:function(t,e){return t(e)}}),entity_prop:function(e,n){var i;return v(e),null===(i=t.hass.entities[e])||void 0===i?void 0:i[n]},is_entity_prop:function(t,e,n){return this.entity_prop(t,e)===n},devices:new Proxy((function(e){if(void 0===e)return t.hass.devices;if(u(e))throw SyntaxError("".concat(a,": devices method cannot be used with an entity id, you should use a device id instead."));return t.hass.devices[e]}),{get:function(e,n){if(u(n))throw SyntaxError("".concat(a,": devices cannot be accesed using an entity id, you should use a device id instead."));return t.hass.devices[n]}}),device_attr:function(e,n){var i;return null===(i=t.hass.devices[e])||void 0===i?void 0:i[n]},is_device_attr:function(t,e,n){return this.device_attr(t,e)===n},device_id:function(e){var n;return v(e),null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id},areas:function(){return r().map((function(t){return t[1].area_id}))},area_id:function(e){var n,s;if(e in t.hass.devices)return this.device_attr(e,i.AREA_ID);var a=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;if(a)return this.device_attr(a,i.AREA_ID);var o=r().find((function(t){return t[1].name===e}));return null===(s=null==o?void 0:o[1])||void 0===s?void 0:s.area_id},area_name:function(e){var n,s,a;e in t.hass.devices&&(a=this.device_attr(e,i.AREA_ID));var o=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;o&&(a=this.device_attr(o,i.AREA_ID));var c=r().find((function(t){var n=t[1];return n.area_id===e||n.area_id===a}));return null===(s=null==c?void 0:c[1])||void 0===s?void 0:s.name},area_entities:function(t){var e=r().find((function(e){var n=e[1];return n.area_id===t||n.name===t}));return e?o().filter((function(t){return t[1].area_id===e[1].area_id})).map((function(t){return t[0]})):[]},area_devices:function(e){var n=r().find((function(t){var n=t[1];return n.area_id===e||n.name===e}));return n?Object.entries(t.hass.devices).filter((function(t){return t[1].area_id===n[1].area_id})).map((function(t){return t[1].id})):[]},get user_name(){return t.hass.user.name},get user_is_admin(){return t.hass.user.is_admin},get user_is_owner(){return t.hass.user.is_owner},get user_agent(){return window.navigator.userAgent},get panel_url(){var t;return t=s.PANEL_URL,d.add(t),location.pathname},get tracked(){return d},cleanTracked:function(){d.clear()}}}var _=function(){function t(t,e){var n=e.throwErrors,i=void 0!==n&&n,s=e.throwWarnings,r=void 0===s||s,a=e.variables,o=void 0===a?{}:a,c=e.autoReturn,u=void 0===c||c;this._throwErrors=i,this._throwWarnings=r,this._variables=o,this._autoReturn=u,this._subscriptions=new Map,this._scopped=d(t,r),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return t.prototype._executeRenderingFunctions=function(t){var e=this;this._subscriptions.get(t).forEach((function(t,n){t.forEach((function(t){e.trackTemplate(n,t)}))}))},t.prototype._watchForPanelUrlChange=function(){var t=this;window.addEventListener(r.LOCATION_CHANGED,(function(e){t._panelUrlWatchCallback()})),window.addEventListener(r.POPSTATE,(function(){t._panelUrlWatchCallback()}))},t.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(s.PANEL_URL)&&this._executeRenderingFunctions(s.PANEL_URL)},t.prototype._watchForEntitiesChange=function(){var t=this;window.hassConnection.then((function(e){e.conn.subscribeMessage((function(e){return t._entityWatchCallback(e)}),{type:r.SUBSCRIBE_EVENTS,event_type:r.STATE_CHANGE_EVENT})}))},t.prototype._entityWatchCallback=function(t){if(this._subscriptions.size){var e=t.data.entity_id;this._subscriptions.has(e)&&this._executeRenderingFunctions(e)}},t.prototype._storeTracked=function(t,e){var n=this;this._scopped.tracked.forEach((function(i){if(n._subscriptions.has(i)){var s=n._subscriptions.get(i);if(s.has(t)){var r=s.get(t);r.has(e)||r.add(e)}else s.set(t,new Set([e]))}else n._subscriptions.set(i,new Map([[t,new Set([e])]]))}))},t.prototype._untrackTemplate=function(t,e){var n=this;this._subscriptions.forEach((function(i,s){if(i.has(t)){var r=i.get(t);r.has(e)&&r.delete(e),0===r.size&&(i.delete(t),0===i.size&&n._subscriptions.delete(s))}}))},t.prototype.renderTemplate=function(t){try{var n=new Map(Object.entries(this._variables)),i=t.trim(),s=i.includes("return")||!this._autoReturn?i:"return ".concat(i);return(new(Function.bind.apply(Function,e(e([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","panel_url","user_agent"],Array.from(n.keys()),!1),["".concat('"use strict";'," ").concat(s)],!1)))).apply(void 0,e([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.panel_url,this._scopped.user_agent],Array.from(n.values()),!1))}catch(t){if(this._throwErrors)throw t;return void(this._throwWarnings&&console.warn(t))}},t.prototype.trackTemplate=function(t,e){var n=this;this._scopped.cleanTracked();var i=this.renderTemplate(t);return this._storeTracked(t,e),e(i),function(){return n._untrackTemplate(t,e)}},t.prototype.cleanTracked=function(t){t?this._subscriptions.has(t)&&this._subscriptions.delete(t):this._subscriptions.clear()},Object.defineProperty(t.prototype,"variables",{get:function(){return this._variables},set:function(t){this._variables=t},enumerable:!1,configurable:!0}),t}(),p=function(){function e(e,n){void 0===n&&(n={}),this._renderer=t.getPromisableResult((function(){return e.hass}),(function(t){return!!(t&&t.areas&&t.devices&&t.entities&&t.states&&t.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new _(e,n)}))}return e.prototype.getRenderer=function(){return this._renderer},e}();module.exports=p;
1
+ "use strict";var t=require("get-promisable-result");function e(t,e,n){if(n||2===arguments.length)for(var i,s=0,r=e.length;s<r;s++)!i&&s in e||(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var n,i,s,r,a="[home-assistant-javascript-templates]",o=/^([a-z_]+)\.(\w+)$/;!function(t){t.UNKNOWN="unknown",t.UNAVAILABLE="unavailable"}(n||(n={})),function(t){t.AREA_ID="area_id",t.NAME="name"}(i||(i={})),function(t){t.PANEL_URL="panel_url"}(s||(s={})),function(t){t.LOCATION_CHANGED="location-changed",t.POPSTATE="popstate",t.SUBSCRIBE_EVENTS="subscribe_events",t.STATE_CHANGE_EVENT="state_changed"}(r||(r={}));var c=function(t){return t.reduce((function(t,e){var n=e[0],i=e[1];return t[n.replace(o,"$2")]=i,t}),{})},u=function(t){return t.includes(".")};function d(t,e,o){var d=function(){return Object.entries(t.hass.areas)},_=function(){return Object.entries(t.hass.entities)},p=new Set,h=new Map,v="ref",l="value",f=function(t){return"".concat(v,".").concat(t)},b=function(t,e){o&&console.warn("".concat(t," ").concat(e," used in a JavaScript template doesn't exist"))},y=function(t){return b("Entity",t)},E=function(t){return b("Domain",t)},w=function(t){var n=new SyntaxError(t);if(e)throw n;o&&console.warn(n)},g=function(e){t.hass.states[e]?p.add(e):y(e)},m=function(t){p.add(t)};return{get hass(){return t.hass},states:new Proxy((function(e){var n;if(u(e))return g(e),null===(n=t.hass.states[e])||void 0===n?void 0:n.state;throw SyntaxError("".concat(a,": states method cannot be used with a domain, use it as an object instead."))}),{get:function(e,n){if(u(n))return g(n),t.hass.states[n];var i=Object.entries(t.hass.states).filter((function(t){return t[0].startsWith(n)}));return i.length||E(n),new Proxy(c(i),{get:function(t,e){return g("".concat(n,".").concat(e)),t[e]}})}}),is_state:function(e,n){var i;return g(e),(null===(i=t.hass.states[e])||void 0===i?void 0:i.state)===n},state_attr:function(e,n){var i,s;return g(e),null===(s=null===(i=t.hass.states[e])||void 0===i?void 0:i.attributes)||void 0===s?void 0:s[n]},is_state_attr:function(t,e,n){return this.state_attr(t,e)===n},has_value:function(t){return this.states(t)?!(this.is_state(t,n.UNKNOWN)||this.is_state(t,n.UNAVAILABLE)):(y(t),!1)},entities:new Proxy((function(e){if(void 0===e)return t.hass.entities;if(u(e))return g(e),t.hass.entities[e];var n=_().filter((function(t){return t[0].startsWith(e)}));return n.length||E(e),new Proxy(c(n),{get:function(t,n){return g("".concat(e,".").concat(n)),t[n]}})}),{get:function(t,e){return t(e)}}),entity_prop:function(e,n){var i;return g(e),null===(i=t.hass.entities[e])||void 0===i?void 0:i[n]},is_entity_prop:function(t,e,n){return this.entity_prop(t,e)===n},devices:new Proxy((function(e){if(void 0===e)return t.hass.devices;if(u(e))throw SyntaxError("".concat(a,": devices method cannot be used with an entity id, you should use a device id instead."));return t.hass.devices[e]}),{get:function(e,n){if(u(n))throw SyntaxError("".concat(a,": devices cannot be accesed using an entity id, you should use a device id instead."));return t.hass.devices[n]}}),device_attr:function(e,n){var i;return null===(i=t.hass.devices[e])||void 0===i?void 0:i[n]},is_device_attr:function(t,e,n){return this.device_attr(t,e)===n},device_id:function(e){var n;return g(e),null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id},areas:function(){return d().map((function(t){return t[1].area_id}))},area_id:function(e){var n,s;if(e in t.hass.devices)return this.device_attr(e,i.AREA_ID);var r=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;if(r)return this.device_attr(r,i.AREA_ID);var a=d().find((function(t){return t[1].name===e}));return null===(s=null==a?void 0:a[1])||void 0===s?void 0:s.area_id},area_name:function(e){var n,s,r;e in t.hass.devices&&(r=this.device_attr(e,i.AREA_ID));var a=null===(n=t.hass.entities[e])||void 0===n?void 0:n.device_id;a&&(r=this.device_attr(a,i.AREA_ID));var o=d().find((function(t){var n=t[1];return n.area_id===e||n.area_id===r}));return null===(s=null==o?void 0:o[1])||void 0===s?void 0:s.name},area_entities:function(t){var e=d().find((function(e){var n=e[1];return n.area_id===t||n.name===t}));return e?_().filter((function(t){return t[1].area_id===e[1].area_id})).map((function(t){return t[0]})):[]},area_devices:function(e){var n=d().find((function(t){var n=t[1];return n.area_id===e||n.name===e}));return n?Object.entries(t.hass.devices).filter((function(t){return t[1].area_id===n[1].area_id})).map((function(t){return t[1].id})):[]},get user_name(){return t.hass.user.name},get user_is_admin(){return t.hass.user.is_admin},get user_is_owner(){return t.hass.user.is_owner},get user_agent(){return window.navigator.userAgent},get tracked(){return p},cleanTracked:function(){p.clear()},ref:function(t,e){var n=f(e);if(h.has(e))return h.get(e);var i=new Proxy({value:void 0},{get:function(t,e){if(e===l)return m(n),t.value;w("".concat(e," is not a valid ").concat(v," property. A ").concat(v," only exposes a ").concat(l," property"))},set:function(e,i,s){if(i===l){var a=e.value;return e.value=s,t({event_type:r.STATE_CHANGE_EVENT,data:{entity_id:n,old_state:{state:JSON.stringify(a)},new_state:{state:JSON.stringify(s)}}}),!0}return w("property ".concat(i," cannot be set in a ").concat(v)),!1}});return h.set(e,i),i},unref:function(t,e){var n=f(e);h.has(e)?(h.delete(e),t(n)):w("".concat(e," is not a ref or it has been unrefed already"))},clientSideProxy:new Proxy({},{get:function(t,e){if(e===s.PANEL_URL)return m(s.PANEL_URL),location.pathname;o&&console.warn("clientSideProxy should only be used to access these variables: ".concat(Object.values(s).join(", ")))}})}}var _=function(){function t(t,e){var n=e.throwErrors,i=void 0!==n&&n,r=e.throwWarnings,a=void 0===r||r,o=e.variables,c=void 0===o?{}:o,u=e.autoReturn,_=void 0===u||u;this._throwErrors=i,this._throwWarnings=a,this._variables=c,this._autoReturn=_,this._subscriptions=new Map,this._clientSideEntitiesRegExp=new RegExp("(^|[ \\?(+:\\{\\[><])(".concat(Object.values(s).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=d(t,i,a),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return t.prototype._executeRenderingFunctions=function(t){var e=this;this._subscriptions.get(t).forEach((function(t,n){t.forEach((function(t){e.trackTemplate(n,t)}))}))},t.prototype._watchForPanelUrlChange=function(){var t=this;window.addEventListener(r.LOCATION_CHANGED,(function(e){t._panelUrlWatchCallback()})),window.addEventListener(r.POPSTATE,(function(){t._panelUrlWatchCallback()}))},t.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(s.PANEL_URL)&&this._executeRenderingFunctions(s.PANEL_URL)},t.prototype._watchForEntitiesChange=function(){var t=this;window.hassConnection.then((function(e){e.conn.subscribeMessage((function(e){return t._entityWatchCallback(e)}),{type:r.SUBSCRIBE_EVENTS,event_type:r.STATE_CHANGE_EVENT})}))},t.prototype._entityWatchCallback=function(t){if(this._subscriptions.size){var e=t.data.entity_id;this._subscriptions.has(e)&&this._executeRenderingFunctions(e)}},t.prototype._storeTracked=function(t,e){var n=this;this._scopped.tracked.forEach((function(i){if(n._subscriptions.has(i)){var s=n._subscriptions.get(i);if(s.has(t)){var r=s.get(t);r.has(e)||r.add(e)}else s.set(t,new Set([e]))}else n._subscriptions.set(i,new Map([[t,new Set([e])]]))}))},t.prototype._untrackTemplate=function(t,e){var n=this;this._subscriptions.forEach((function(i,s){if(i.has(t)){var r=i.get(t);r.has(e)&&r.delete(e),0===r.size&&(i.delete(t),0===i.size&&n._subscriptions.delete(s))}}))},t.prototype.renderTemplate=function(t){try{var n=new Map(Object.entries(this._variables)),i=t.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),s=i.includes("return")||!this._autoReturn?i:"return ".concat(i);return(new(Function.bind.apply(Function,e(e([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide","ref","unref"],Array.from(n.keys()),!1),["".concat('"use strict";'," ").concat(s)],!1)))).apply(void 0,e([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy,this._scopped.ref.bind(this._scopped,this._entityWatchCallback.bind(this)),this._scopped.unref.bind(this._scopped,this.cleanTracked.bind(this))],Array.from(n.values()),!1))}catch(t){if(this._throwErrors)throw t;return void(this._throwWarnings&&console.warn(t))}},t.prototype.trackTemplate=function(t,e){var n=this;this._scopped.cleanTracked();var i=this.renderTemplate(t);return this._storeTracked(t,e),e(i),function(){return n._untrackTemplate(t,e)}},t.prototype.cleanTracked=function(t){t?this._subscriptions.has(t)&&this._subscriptions.delete(t):this._subscriptions.clear()},Object.defineProperty(t.prototype,"variables",{get:function(){return this._variables},set:function(t){this._variables=t},enumerable:!1,configurable:!0}),t}(),p=function(){function e(e,n){void 0===n&&(n={}),this._renderer=t.getPromisableResult((function(){return e.hass}),(function(t){return!!(t&&t.areas&&t.devices&&t.entities&&t.states&&t.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new _(e,n)}))}return e.prototype.getRenderer=function(){return this._renderer},e}();module.exports=p;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "home-assistant-javascript-templates",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "description": "A JavaScript utility to render Home Assistant JavaScript templates",
5
5
  "keywords": [
6
6
  "home-assistant",
@@ -47,16 +47,16 @@
47
47
  "devDependencies": {
48
48
  "@rollup/plugin-terser": "^0.4.4",
49
49
  "@types/jest": "^29.5.14",
50
- "@types/node": "^22.9.0",
50
+ "@types/node": "^22.10.5",
51
51
  "get-promisable-result": "^1.0.1",
52
52
  "jest": "^29.7.0",
53
53
  "jest-environment-jsdom": "^29.7.0",
54
54
  "jest-location-mock": "^2.0.0",
55
- "rollup": "^4.25.0",
55
+ "rollup": "^4.30.1",
56
56
  "rollup-plugin-ts": "^3.4.5",
57
57
  "ts-jest": "^29.2.5",
58
58
  "tslib": "^2.8.1",
59
- "typescript": "^5.6.3"
59
+ "typescript": "^5.7.3"
60
60
  },
61
61
  "dependencies": {
62
62
  "get-promisable-result": "^1.0.0"