@devicechain/dashboards 0.23.0 → 0.24.0-rc.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.
@@ -9,6 +9,9 @@ export interface AlarmSearchCriteriaInput {
9
9
  severity?: string | null;
10
10
  acknowledged?: boolean | null;
11
11
  alarmKey?: string | null;
12
+ deviceType?: string | null;
13
+ startTime?: string | null;
14
+ endTime?: string | null;
12
15
  }
13
16
  export interface AlarmsQueryResult {
14
17
  alarms: {
@@ -22,6 +25,45 @@ export interface AlarmsQueryVariables {
22
25
  criteria: AlarmSearchCriteriaInput;
23
26
  }
24
27
  export declare const ALARMS_QUERY: TypedDocument<AlarmsQueryResult, AlarmsQueryVariables>;
28
+ export interface AlarmDeviceTypesResult {
29
+ devicesByToken: Array<{
30
+ token: string;
31
+ deviceType: {
32
+ token: string;
33
+ name: string | null;
34
+ };
35
+ }>;
36
+ }
37
+ export interface AlarmDeviceTypesVariables {
38
+ tokens: string[];
39
+ }
40
+ export declare const ALARM_DEVICE_TYPES: TypedDocument<AlarmDeviceTypesResult, AlarmDeviceTypesVariables>;
41
+ export type AlarmCountCriteriaInput = Omit<AlarmSearchCriteriaInput, 'pageNumber' | 'pageSize' | 'deviceType' | 'startTime' | 'endTime'>;
42
+ export interface AlarmTypeCountsResult {
43
+ alarmCountsByDeviceType: Array<{
44
+ deviceType: {
45
+ token: string;
46
+ name: string | null;
47
+ };
48
+ severity: string;
49
+ count: number;
50
+ }>;
51
+ }
52
+ export interface AlarmTypeCountsVariables {
53
+ criteria: AlarmCountCriteriaInput;
54
+ }
55
+ export declare const ALARM_TYPE_COUNTS: TypedDocument<AlarmTypeCountsResult, AlarmTypeCountsVariables>;
56
+ export interface AlarmSeverityCountsResult {
57
+ alarmCountsBySeverity: Array<{
58
+ severity: string;
59
+ count: number;
60
+ }>;
61
+ }
62
+ export interface AlarmSeverityCountsVariables {
63
+ criteria: AlarmCountCriteriaInput;
64
+ deviceType: string | null;
65
+ }
66
+ export declare const ALARM_SEVERITY_COUNTS: TypedDocument<AlarmSeverityCountsResult, AlarmSeverityCountsVariables>;
25
67
  export interface AlarmStreamResult {
26
68
  alarmStream: {
27
69
  alarmToken: string;
@@ -6,6 +6,8 @@ export interface CommandSearchCriteriaInput {
6
6
  deviceToken?: string | null;
7
7
  status?: string | null;
8
8
  statuses?: string[] | null;
9
+ startTime?: string | null;
10
+ endTime?: string | null;
9
11
  }
10
12
  export interface CommandsQueryResult {
11
13
  commands: {
@@ -0,0 +1,9 @@
1
+ import type { TypedDocument } from '@devicechain/client';
2
+ import type { DevicePresence } from '../types';
3
+ export interface DeviceStatesResult {
4
+ deviceStatesByDeviceToken: DevicePresence[];
5
+ }
6
+ export interface DeviceStatesVariables {
7
+ deviceTokens: string[];
8
+ }
9
+ export declare const DEVICE_PRESENCE_QUERY: TypedDocument<DeviceStatesResult, DeviceStatesVariables>;
package/dist/members.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import type { MeasurementBucket } from './queries';
2
- import type { MeasurementSample } from './types';
2
+ import type { DevicePresence, MeasurementSample } from './types';
3
3
  export interface MemberRef {
4
4
  token: string;
5
5
  name: string | null;
6
+ deviceType?: string | null;
6
7
  }
7
8
  export interface MemberRoster {
8
9
  members: MemberRef[];
@@ -16,6 +17,12 @@ export interface MemberSink {
16
17
  error?(err: unknown): void;
17
18
  reconnected?(): void;
18
19
  }
20
+ export interface PresenceSink {
21
+ roster(roster: MemberRoster): void;
22
+ next(states: readonly DevicePresence[]): void;
23
+ forbidden?(): void;
24
+ error?(err: unknown): void;
25
+ }
19
26
  export type SeedFailure = 'forbidden' | 'failed';
20
27
  export interface MemberBucketCriteria {
21
28
  startTime: string;
@@ -7,7 +7,7 @@ interface OptionSpecBase {
7
7
  helpId?: string;
8
8
  control?: string;
9
9
  }
10
- export declare const HOST_OPTION_CONTROLS: readonly ['command-vocabulary', 'slot-target', 'basemap'];
10
+ export declare const HOST_OPTION_CONTROLS: readonly ['command-vocabulary', 'slot-target', 'basemap', 'device-type'];
11
11
  export type HostOptionControl = (typeof HOST_OPTION_CONTROLS)[number];
12
12
  export interface StringOptionSpec extends OptionSpecBase {
13
13
  kind: 'string';
@@ -35,6 +35,7 @@ export interface ListOptionSpec extends OptionSpecBase {
35
35
  kind: 'list';
36
36
  item: Readonly<Record<string, ListItemFieldSpec>>;
37
37
  maxItems?: number;
38
+ ordered?: boolean;
38
39
  }
39
40
  export type OptionSpec = StringOptionSpec | NumberOptionSpec | BooleanOptionSpec | EnumOptionSpec | ListOptionSpec;
40
41
  export type WidgetOptionSpecs = Record<string, OptionSpec>;
package/dist/queries.d.ts CHANGED
@@ -27,6 +27,9 @@ export interface CustomerDevicesResult {
27
27
  results: Array<{
28
28
  token: string;
29
29
  name: string | null;
30
+ deviceType?: {
31
+ token: string;
32
+ } | null;
30
33
  }>;
31
34
  pagination?: {
32
35
  totalRecords: number | null;
@@ -55,9 +58,28 @@ export interface DeviceNamesResult {
55
58
  devicesByToken: Array<{
56
59
  token: string;
57
60
  name: string | null;
61
+ deviceType?: {
62
+ token: string;
63
+ } | null;
58
64
  }>;
59
65
  }
60
66
  export declare const DEVICE_NAMES: TypedDocument<DeviceNamesResult, DevicesByTokenVariables>;
67
+ export interface DeclaredMetricsResult {
68
+ deviceTypesByToken: Array<{
69
+ token: string;
70
+ profile: {
71
+ activeProfileVersion: {
72
+ metrics: Array<{
73
+ metricKey: string;
74
+ }>;
75
+ } | null;
76
+ } | null;
77
+ }>;
78
+ }
79
+ export interface DeclaredMetricsVariables {
80
+ tokens: string[];
81
+ }
82
+ export declare const DECLARED_METRICS: TypedDocument<DeclaredMetricsResult, DeclaredMetricsVariables>;
61
83
  export interface EntityListResult {
62
84
  results: Array<{
63
85
  token: string;
@@ -67,6 +67,7 @@ export declare class RecordedDataSource implements WidgetDataSource {
67
67
  private readonly index;
68
68
  private readonly startMs;
69
69
  private readonly devices;
70
+ private readonly kinds;
70
71
  private readonly subs;
71
72
  private readonly unlisten;
72
73
  private cursor;
@@ -84,6 +85,7 @@ export declare class RecordedDataSource implements WidgetDataSource {
84
85
  private failLater;
85
86
  subscribeWidget(datasource: DatasourceSelector, sink: WidgetStreamSink): () => void;
86
87
  subscribeMembers(datasource: DatasourceSelector, sink: MemberSink): () => void;
88
+ declaredMetrics(kind: string): Promise<readonly string[] | null>;
87
89
  readMemberSeeds(deviceTokens: readonly string[], _plan: MemberSeedPlan, onSeed: (deviceToken: string, seed: MemberSeed | null) => void): Promise<void>;
88
90
  subscribeAlarms(subscription: AlarmSubscription, sink: AlarmStreamSink): () => void;
89
91
  subscribeCommands(_subscription: CommandSubscription, sink: CommandStreamSink): () => void;
@@ -63,6 +63,7 @@ export interface RecordedLocationColumns {
63
63
  hdg: Array<number | null>;
64
64
  spd: Array<number | null>;
65
65
  }
66
+ export type RecordedDeclarations = Record<string, string[]>;
66
67
  export interface BoardRecording {
67
68
  kind: typeof RECORDING_KIND;
68
69
  formatVersion: (typeof RECORDING_FORMAT_VERSIONS)[number];
@@ -78,6 +79,7 @@ export interface BoardRecording {
78
79
  };
79
80
  clock: RecordedClockSegment[];
80
81
  devices: RecordedDevice[];
82
+ declaredMetrics?: RecordedDeclarations;
81
83
  channels: RecordedChannels;
82
84
  board: {
83
85
  path: string;
@@ -1,5 +1,5 @@
1
1
  import type { HistoryWindow } from './history';
2
- import type { MemberSeed, MemberSeedPlan, MemberSink } from './members';
2
+ import type { MemberSeed, MemberSeedPlan, MemberSink, PresenceSink } from './members';
3
3
  import type { MeasurementBucket } from './queries';
4
4
  import type { AlarmStreamSink, AlarmSubscription, CommandDispatch, CommandStreamSink, CommandSubscription, LocationStreamSink, LocationSubscription, WidgetActions, WidgetDataSource, WidgetStreamSink } from './hub';
5
5
  import type { DatasourceSelector } from './types';
@@ -34,6 +34,7 @@ export declare class SyntheticDataSource implements WidgetDataSource, WidgetActi
34
34
  bucketMeasurements(datasource: DatasourceSelector, window: HistoryWindow): Promise<MeasurementBucket[]>;
35
35
  private previewMembers;
36
36
  subscribeMembers(datasource: DatasourceSelector, sink: MemberSink): () => void;
37
+ subscribePresence(datasource: DatasourceSelector, sink: PresenceSink): () => void;
37
38
  readMemberSeeds(deviceTokens: readonly string[], _plan: MemberSeedPlan, onSeed: (deviceToken: string, seed: MemberSeed | null) => void): Promise<void>;
38
39
  disposeAll(): void;
39
40
  private valueFor;
package/dist/types.d.ts CHANGED
@@ -49,7 +49,7 @@ export interface UnboundSelector {
49
49
  location?: LocationSelection;
50
50
  }
51
51
  export type DatasourceSelector = DeviceSelector | AnchorSelector | DevicesSelector | RelatedTraversalSelector | SlotSelector | UnboundSelector;
52
- export declare const WIDGET_TYPES: readonly ['timeseries-chart', 'latest-card', 'gauge', 'table', 'label', 'image', 'alarm-table', 'alarm-count', 'command-button', 'entity-selector', 'map', 'linear-gauge', 'level-gauge', 'battery', 'status-light', 'signal-bars', 'compass', 'progress-ring', 'command-slider', 'command-toggle', 'stat-card', 'bar-chart', 'pie-chart', 'fleet-table'];
52
+ export declare const WIDGET_TYPES: readonly ['timeseries-chart', 'latest-card', 'gauge', 'table', 'label', 'image', 'alarm-table', 'alarm-count', 'alarm-severity', 'command-button', 'entity-selector', 'map', 'linear-gauge', 'level-gauge', 'battery', 'status-light', 'signal-bars', 'compass', 'progress-ring', 'command-slider', 'command-toggle', 'stat-card', 'bar-chart', 'pie-chart', 'fleet-table', 'fleet-count', 'device-status', 'online-doughnut'];
53
53
  export type WidgetType = (typeof WIDGET_TYPES)[number];
54
54
  export declare const PLACEMENT_ANCHORS: readonly ['top-left', 'top', 'top-right', 'left', 'center', 'right', 'bottom-left', 'bottom', 'bottom-right'];
55
55
  export type PlacementAnchor = (typeof PLACEMENT_ANCHORS)[number];
@@ -278,6 +278,26 @@ export interface AlarmRow {
278
278
  acknowledgedTime: string | null;
279
279
  acknowledgedBy: string | null;
280
280
  lastValue: number | null;
281
+ deviceType?: AlarmDeviceType | null;
282
+ }
283
+ export interface AlarmDeviceType {
284
+ token: string;
285
+ name: string | null;
286
+ }
287
+ export interface DevicePresence {
288
+ deviceToken: string;
289
+ active: boolean;
290
+ lastActivityTime: string | null;
291
+ inactivityTimeout: number;
292
+ }
293
+ export interface AlarmSeverityCount {
294
+ severity: string;
295
+ count: number;
296
+ }
297
+ export interface AlarmTypeCount {
298
+ deviceType: AlarmDeviceType;
299
+ severity: string;
300
+ count: number;
281
301
  }
282
302
  export interface LocationSample {
283
303
  id: string;
@@ -49,11 +49,17 @@ export type ChannelBindingPolicy<C extends WidgetChannel, S extends WidgetOption
49
49
  members?: ConstBinding<true> | (StringOptionRef<S> & {
50
50
  equals: string;
51
51
  });
52
+ presence?: ConstBinding<true>;
52
53
  } : C extends 'alarm' ? {
53
54
  pageSize: PageSize<S>;
54
55
  state?: StringOptionRef<S>;
55
56
  severity?: StringOptionRef<S>;
56
57
  acknowledged?: AckOptionRef<S>;
58
+ groupBy?: StringOptionRef<S> & {
59
+ equals: string;
60
+ };
61
+ countBySeverity?: ConstBinding<true>;
62
+ deviceType?: StringOptionRef<S>;
57
63
  } : C extends 'control' ? {
58
64
  pageSize: PageSize<S>;
59
65
  } : Record<string, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devicechain/dashboards",
3
- "version": "0.23.0",
3
+ "version": "0.24.0-rc.1",
4
4
  "description": "DeviceChain dashboard runtime — the DashboardHub (telemetry subscription multiplexing over the client wire, plus the alarm, command and location channels) and the dashboard-definition, selector, slot, and binding-manifest types.",
5
5
  "keywords": [
6
6
  "devicechain",
@@ -46,14 +46,14 @@
46
46
  "@graphql-typed-document-node/core": "^3.2.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@devicechain/client": "0.23.0",
49
+ "@devicechain/client": "0.24.0-rc.1",
50
50
  "graphql": "^16.0.0 || ^17.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@devicechain/client": "0.23.0",
53
+ "@devicechain/client": "0.24.0-rc.1",
54
54
  "@types/node": "^26.6.5",
55
55
  "graphql": "^17.0.2",
56
56
  "typescript": "~7.0.2",
57
- "vitest": "^5.0.3"
57
+ "vitest": "^5.0.5"
58
58
  }
59
59
  }