@glasshome/sync-layer 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export { fetchForecast, fetchForecastData, fetchForecasts } from "./weather/fetc
|
|
|
43
43
|
export { getForecast, getForecasts, refreshForecast, refreshForecasts } from "./weather/query";
|
|
44
44
|
export type { EntityForecastQueryOptions, ForecastQueryOptions, ForecastResult, ForecastsResult, ForecastType, WeatherForecast, WeatherForecastData, WeatherForecasts, WeatherForecastsData, } from "./weather/types";
|
|
45
45
|
export { applyDemoServiceCall, createDemoFixtures, isDemoMode, loadDemoData, startDemoEnergyTicker, stopDemoEnergyTicker, unloadDemoData, } from "./demo/demo-provider";
|
|
46
|
-
export declare const VERSION = "0.2.
|
|
46
|
+
export declare const VERSION = "0.2.1";
|
|
47
47
|
export { applyBridgeConnState, attachBridgeToStore, detachBridgeFromStore, reloadAfterBridgeReconnect, } from "./connection/bridged";
|
|
48
48
|
export { BridgeNeedsAuthError, createHaBridge, type BridgeConnectOptions, type BridgeEvents, type HaBridge, } from "./worker/bridge-client";
|
|
49
49
|
export type { AuthMode, ConnState, OAuthTokenData } from "./worker/protocol";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENERGY_ENTITY_IDS, createDemoFixtures, demoEnergyPreferences, energyEntityValue, formatEnergyState, isEnergyEntity, isSunUp, resetStore, setState, simulateEnergy, state, sunEvents, synthesizeEnergyHistory, synthesizeEnergyStatistics } from "./demo-data-CavpxBw3.js";
|
|
2
|
-
import { runHaBridgeWorker } from "./worker-main-
|
|
2
|
+
import { runHaBridgeWorker } from "./worker-main-C93MR-AO.js";
|
|
3
3
|
import { createConnection, createLongLivedTokenAuth, getAuth } from "home-assistant-js-websocket";
|
|
4
4
|
import { produce, reconcile } from "solid-js/store";
|
|
5
5
|
|
|
@@ -2915,7 +2915,7 @@ function createHaBridge(worker, events = {}) {
|
|
|
2915
2915
|
|
|
2916
2916
|
//#endregion
|
|
2917
2917
|
//#region src/index.ts
|
|
2918
|
-
const VERSION = "0.2.
|
|
2918
|
+
const VERSION = "0.2.1";
|
|
2919
2919
|
|
|
2920
2920
|
//#endregion
|
|
2921
2921
|
export { BridgeNeedsAuthError, DOMAINS_USE_LAST_UPDATED, LINE_ATTRIBUTES_TO_KEEP, MAX_HISTORY_POINTS, NEED_ATTRIBUTE_DOMAINS, VERSION, addDebugIncomingMessageListener, addDebugOutgoingMessageListener, appendHistoryPoint, applyBridgeConnState, applyDemoServiceCall, area, areas, attachBridgeToStore, authenticateWithOAuth, authenticateWithToken, batchEntityUpdates, batchServiceCalls, buildAreaView, buildDeviceView, buildEntityView, bulkAppendHistoryPoints, callService, createDemoFixtures, createHaBridge, detachBridgeFromStore, disconnect, entities, entitiesByAreaAndDomain, entitiesWhere, entity, entityIdHistoryNeedsAttributes, entityViewEquals, extractDomain, fetchEnergyPreferences, fetchEntityHistory, fetchForecast, fetchForecastData, fetchForecasts, fetchHistory, fetchStatisticsDuringPeriod, fetchStream, fetchStreamData, getAllEntityViews, getAreaView, getAreaViews, getConnection, getConnectionState, getEntityView, getEntityViews, getForecast, getForecasts, getStream, getWebRtcClientConfig, historyStateToTimeline, initConnection, isAuthValid, isConnected, isDemoMode, isHistoryTracked, loadDemoData, normalizeStatisticTime, refreshAuth, refreshForecast, refreshForecasts, refreshStream, registerEntity, reloadAfterBridgeReconnect, resetStore, runHaBridgeWorker, searchEntities, sendCommand, sendWebRtcCandidate, setState, startDemoEnergyTicker, startWebRtcSession, state, stopDemoEnergyTicker, toggle, trackEntityHistory, turnOff, turnOn, unloadDemoData, untrackEntityHistory, updateEntity };
|
|
@@ -134,8 +134,12 @@ var BrokeredAuth = class extends Auth {
|
|
|
134
134
|
this.mintUrl = mintUrl;
|
|
135
135
|
}
|
|
136
136
|
async refreshAccessToken() {
|
|
137
|
-
const res = await fetch(this.mintUrl, {
|
|
137
|
+
const res = await fetch(this.mintUrl, {
|
|
138
|
+
credentials: "same-origin",
|
|
139
|
+
headers: { accept: "application/json" }
|
|
140
|
+
});
|
|
138
141
|
if (!res.ok) throw new Error(`Token broker responded ${res.status}`);
|
|
142
|
+
if (!res.headers.get("content-type")?.includes("application/json")) throw new Error(`Token broker did not return JSON (is ${this.mintUrl} reachable?)`);
|
|
139
143
|
const broker = await res.json();
|
|
140
144
|
this.data = {
|
|
141
145
|
...this.data,
|