Repository navigation
Releases: thinger-io/dashboard-sdk
Releases · thinger-io/dashboard-sdk
Release list
0.3.1
0.3.0
The console only hands the token to the page it loaded: a page the app's frame navigates to (a
link in the app) no longer gets it. This needs this SDK version inside consoles that send a frame
key; older SDKs get no token there.
Added
- Frame key (
PROTOCOL.md, "Frame key"): the SDK takesthinger_frameout of the frame URL
before the app reads its route and sends it back asframeinthinger:ready,
thinger:refresh-token,thinger:open-fileandthinger:navigate.FRAME_PARAM,
FRAME_KEYED_MESSAGESandwithFrameKey()in@thinger-io/dashboard-sdk/protocol. Thinger.reload(): reload the app keeping the frame key. Apps use it instead of
location.reload().
0.2.1
Changed
- README: "Reviewing the layout" explains how to check an app at several sizes with the
browser's own tools; the server's/sdk/preview.htmlis retired, with the rest of/sdk/.
Platform concepts are read from the Thinger CLI's documentation.
0.2.0
The dashboard SDK becomes an npm package, rewritten in TypeScript. SDK 0.1, the script the server
served at /sdk/0.1/thinger-dashboard.js, never reached production, so 0.2 keeps its API but not
its delivery.
Migrating from 0.1
npm install @thinger-io/dashboard-sdk.- Remove
<script src="/sdk/…/thinger-dashboard.js">from index.html, and the dev server proxy
for/sdkif you had one. import { Thinger } from '@thinger-io/dashboard-sdk'where you used the global, and drop the
copiedthinger-dashboard.d.ts: the types come with the package (ThingerSDK.Device→
import type { Device }).
Pages that cannot have a build step can still load dist/thinger-dashboard.min.js, which defines
the global as before (deprecated).
Added
- npm package
@thinger-io/dashboard-sdk: ESM with type declarations generated from the source,
and a minified classic script defining the globalThinger. PROTOCOL.md: the contract with the console in writing (messages,thinger:initfields,
standalone parameters, iframe sandbox), and its types in@thinger-io/dashboard-sdk/protocol,
a module without side effects for the console to import.standaloneFragment()builds
standalone links.thinger:readycarries the SDK version (sdk), the only new field of the protocol.- Server versions: the SDK reads
GET /v1/server/versiononce, beforeready()resolves.
Thinger.serverVersion,Thinger.supports(name), a warning for servers older than Thinger 7.5,
and functions declared with a minimum server version fail witherr.code === 'unsupported'.
@thinger-io/dashboard-sdk/compat.jsonlists those minimums for tools (none in this version). ThingerError, withcode(http,unsupported,no-session,invalid-argument,
unexpected-response),statusandrequires. API errors keep the 0.1 message,
HTTP <status> <reason>.- Device properties carry
source(device,type,grouporproduct): the level an
inherited value comes from. /// <reference types="@thinger-io/dashboard-sdk/global" />types the global for script users,
with the 0.1 names underThingerSDK.- Exports
ALARM_STATE,ALARM_SEVERITY,ALARM_INSTANCE_EVENTS,SDK_VERSION,parseTime.
Changed
Thinger.versionis the full package version ("0.2.0"), not the served path ("0.1").- Every call that returns a promise rejects instead of throwing synchronously (e.g. calling before
ready(), which now rejects withcode: 'no-session'). - The app only accepts console messages (
thinger:init,thinger:token,thinger:route) from
its parent window, not from frames the app itself embeds. alarms.acknowledge/shelve/latch/clearalways set their own state, even when
optscarries astate.ready()also waits (up to 3 s) for the server version.- Inside a frame,
ready()rejects withcode: 'no-session'when nothinger:initarrives in
10 s (a page framed by a website without a token), instead of waiting forever. fetch()/request()only add the token and?project=to the Thinger server's URLs
(relative paths,apiBase, the page's origin): an absolute URL of another server gets a plain
fetch, without the viewer's token.- Importing the package without a browser window (server-side rendering, tests) leaves the SDK
idle instead of failing.
Fixed
devices.callResourceandbuckets.writesend their input as JSON whatever it is, a string
too, as 0.1 did.- Asking for a token refresh with no console to answer fails at once instead of after 8 s.
navigate(null)from untyped code is ignored instead of throwing.