clarion-shared-types 1.0.92 → 1.0.94
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/cjs/modules/tracking/index.js +1 -0
- package/dist/cjs/modules/tracking/index.js.map +1 -1
- package/dist/cjs/modules/tracking/interfaces/tracking-provider-descriptor.js +17 -0
- package/dist/cjs/modules/tracking/interfaces/tracking-provider-descriptor.js.map +1 -0
- package/dist/esm/modules/tracking/index.js +1 -0
- package/dist/esm/modules/tracking/index.js.map +1 -1
- package/dist/esm/modules/tracking/interfaces/tracking-provider-descriptor.js +14 -0
- package/dist/esm/modules/tracking/interfaces/tracking-provider-descriptor.js.map +1 -0
- package/dist/types/modules/tracking/index.d.ts +1 -0
- package/dist/types/modules/tracking/interfaces/tracking-position.dto.d.ts +6 -0
- package/dist/types/modules/tracking/interfaces/tracking-provider-descriptor.d.ts +111 -0
- package/dist/types/modules/tracking/interfaces/tracking-socket-events.d.ts +6 -1
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ __exportStar(require("./enums/tracking-connection-status.enum"), exports);
|
|
|
21
21
|
__exportStar(require("./enums/tracking-unit-online-status.enum"), exports);
|
|
22
22
|
// Interfaces / DTOs
|
|
23
23
|
__exportStar(require("./interfaces/tracking-provider-connection.dto"), exports);
|
|
24
|
+
__exportStar(require("./interfaces/tracking-provider-descriptor"), exports);
|
|
24
25
|
__exportStar(require("./interfaces/tracking-device-binding.dto"), exports);
|
|
25
26
|
__exportStar(require("./interfaces/tracking-position.dto"), exports);
|
|
26
27
|
__exportStar(require("./interfaces/tracking-socket-events"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/tracking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,sEAAoD;AACpD,uEAAqD;AACrD,0EAAwD;AACxD,2EAAyD;AAEzD,oBAAoB;AACpB,gFAA8D;AAC9D,2EAAyD;AACzD,qEAAmD;AACnD,sEAAoD;AACpD,uEAAqD;AACrD,qEAAmD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/tracking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,sEAAoD;AACpD,uEAAqD;AACrD,0EAAwD;AACxD,2EAAyD;AAEzD,oBAAoB;AACpB,gFAA8D;AAC9D,4EAA0D;AAC1D,2EAAyD;AACzD,qEAAmD;AACnD,sEAAoD;AACpD,uEAAqD;AACrD,qEAAmD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildDefaultTrackingProviderConfiguration = buildDefaultTrackingProviderConfiguration;
|
|
4
|
+
/**
|
|
5
|
+
* The `configuration` a connection gets when the operator supplies none: every
|
|
6
|
+
* setting at its default. Stored explicitly on the connection so that readers
|
|
7
|
+
* which know nothing about adapters (the status evaluator, ingestion guards) see
|
|
8
|
+
* the provider's thresholds rather than the service-wide fallbacks.
|
|
9
|
+
*/
|
|
10
|
+
function buildDefaultTrackingProviderConfiguration(descriptor) {
|
|
11
|
+
const configuration = {};
|
|
12
|
+
for (const setting of descriptor.settings) {
|
|
13
|
+
configuration[setting.key] = setting.defaultValue;
|
|
14
|
+
}
|
|
15
|
+
return configuration;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=tracking-provider-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking-provider-descriptor.js","sourceRoot":"","sources":["../../../../../src/modules/tracking/interfaces/tracking-provider-descriptor.ts"],"names":[],"mappings":";;AAwHA,8FAQC;AAdD;;;;;GAKG;AACH,SAAgB,yCAAyC,CACrD,UAAwD;IAExD,MAAM,aAAa,GAA8C,EAAE,CAAC;IACpE,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IACtD,CAAC;IACD,OAAO,aAAa,CAAC;AACzB,CAAC"}
|
|
@@ -5,6 +5,7 @@ export * from './enums/tracking-connection-status.enum';
|
|
|
5
5
|
export * from './enums/tracking-unit-online-status.enum';
|
|
6
6
|
// Interfaces / DTOs
|
|
7
7
|
export * from './interfaces/tracking-provider-connection.dto';
|
|
8
|
+
export * from './interfaces/tracking-provider-descriptor';
|
|
8
9
|
export * from './interfaces/tracking-device-binding.dto';
|
|
9
10
|
export * from './interfaces/tracking-position.dto';
|
|
10
11
|
export * from './interfaces/tracking-socket-events';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/tracking/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AAEzD,oBAAoB;AACpB,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/tracking/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AAEzD,oBAAoB;AACpB,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `configuration` a connection gets when the operator supplies none: every
|
|
3
|
+
* setting at its default. Stored explicitly on the connection so that readers
|
|
4
|
+
* which know nothing about adapters (the status evaluator, ingestion guards) see
|
|
5
|
+
* the provider's thresholds rather than the service-wide fallbacks.
|
|
6
|
+
*/
|
|
7
|
+
export function buildDefaultTrackingProviderConfiguration(descriptor) {
|
|
8
|
+
const configuration = {};
|
|
9
|
+
for (const setting of descriptor.settings) {
|
|
10
|
+
configuration[setting.key] = setting.defaultValue;
|
|
11
|
+
}
|
|
12
|
+
return configuration;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=tracking-provider-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking-provider-descriptor.js","sourceRoot":"","sources":["../../../../../src/modules/tracking/interfaces/tracking-provider-descriptor.ts"],"names":[],"mappings":"AAkHA;;;;;GAKG;AACH,MAAM,UAAU,yCAAyC,CACrD,UAAwD;IAExD,MAAM,aAAa,GAA8C,EAAE,CAAC;IACpE,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IACtD,CAAC;IACD,OAAO,aAAa,CAAC;AACzB,CAAC"}
|
|
@@ -3,6 +3,7 @@ export * from './enums/tracking-transport-type.enum';
|
|
|
3
3
|
export * from './enums/tracking-connection-status.enum';
|
|
4
4
|
export * from './enums/tracking-unit-online-status.enum';
|
|
5
5
|
export * from './interfaces/tracking-provider-connection.dto';
|
|
6
|
+
export * from './interfaces/tracking-provider-descriptor';
|
|
6
7
|
export * from './interfaces/tracking-device-binding.dto';
|
|
7
8
|
export * from './interfaces/tracking-position.dto';
|
|
8
9
|
export * from './interfaces/tracking-socket-events';
|
|
@@ -60,6 +60,12 @@ export interface TrackingBoundingBox {
|
|
|
60
60
|
west: number;
|
|
61
61
|
}
|
|
62
62
|
export interface TrackingCurrentPositionQuery {
|
|
63
|
+
/**
|
|
64
|
+
* Tenant to read. REQUIRED for a Super-Admin, who has no tenant of their own
|
|
65
|
+
* (the service answers 403 without it); ignored for everyone else, whose scope
|
|
66
|
+
* always comes from their own access context and cannot be widened from here.
|
|
67
|
+
*/
|
|
68
|
+
organizationId?: number;
|
|
63
69
|
controlCentreId?: number;
|
|
64
70
|
status?: TrackingUnitOnlineStatus;
|
|
65
71
|
north?: number;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { TrackingProviderCode } from '../enums/tracking-provider-code.enum';
|
|
2
|
+
import { TrackingTransportType } from '../enums/tracking-transport-type.enum';
|
|
3
|
+
/**
|
|
4
|
+
* Self-description of a tracking provider, published by clarion-response-tracking
|
|
5
|
+
* (`GET /tracking/providers`) and rendered by the admin client.
|
|
6
|
+
*
|
|
7
|
+
* Why it exists: every provider needs different things from an operator. Telox
|
|
8
|
+
* wants a WebSocket URL, a username, a domain and a password; Wialon wants an
|
|
9
|
+
* HTTPS host and an API token and has no domain at all; and each scales its raw
|
|
10
|
+
* telemetry differently. Encoding that in the client meant a form that only fit
|
|
11
|
+
* one provider and defaults that had to be kept in step with the service by hand.
|
|
12
|
+
* With a descriptor the service that owns the adapter is the single source of
|
|
13
|
+
* truth: adding a provider changes no client code, and a default can never drift.
|
|
14
|
+
*
|
|
15
|
+
* Only providers with a registered adapter are described, so the catalog also
|
|
16
|
+
* answers "which providers can I actually connect?" — the enum alone cannot,
|
|
17
|
+
* because it reserves codes for adapters that do not exist yet.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors `grm-shared-library`'s TrackingProviderDescriptor (the backend copy also
|
|
20
|
+
* carries the validator the service enforces these bounds with).
|
|
21
|
+
*
|
|
22
|
+
* SECURITY: a descriptor is static metadata. It never carries a secret, a secret
|
|
23
|
+
* reference, or anything tenant-specific.
|
|
24
|
+
*/
|
|
25
|
+
export type TrackingProviderSettingType = 'number' | 'boolean' | 'select' | 'text';
|
|
26
|
+
export interface TrackingProviderSettingOption {
|
|
27
|
+
value: string;
|
|
28
|
+
label: string;
|
|
29
|
+
}
|
|
30
|
+
/** One key of a provider connection's `configuration` blob. */
|
|
31
|
+
export interface TrackingProviderSettingDescriptor {
|
|
32
|
+
/** The `configuration` key this setting is stored under. */
|
|
33
|
+
key: string;
|
|
34
|
+
label: string;
|
|
35
|
+
type: TrackingProviderSettingType;
|
|
36
|
+
/** Key of the {@link TrackingProviderSettingGroupDescriptor} it is shown under. */
|
|
37
|
+
group: string;
|
|
38
|
+
/** Applied by the service when the key is absent, and pre-filled by the client. */
|
|
39
|
+
defaultValue: number | boolean | string;
|
|
40
|
+
description?: string;
|
|
41
|
+
/** Display unit, e.g. `s`, `m`, `km/h`. */
|
|
42
|
+
unit?: string;
|
|
43
|
+
/** `number` settings only. Bounds are inclusive and enforced by the service. */
|
|
44
|
+
min?: number;
|
|
45
|
+
max?: number;
|
|
46
|
+
step?: number;
|
|
47
|
+
/** `number` settings only: reject fractional values. */
|
|
48
|
+
integer?: boolean;
|
|
49
|
+
/** `text` settings only. */
|
|
50
|
+
maxLength?: number;
|
|
51
|
+
/** `select` settings only: the closed set of accepted values. */
|
|
52
|
+
options?: TrackingProviderSettingOption[];
|
|
53
|
+
}
|
|
54
|
+
export interface TrackingProviderSettingGroupDescriptor {
|
|
55
|
+
key: string;
|
|
56
|
+
label: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
}
|
|
59
|
+
/** An optional connection field whose meaning (or existence) depends on the provider. */
|
|
60
|
+
export interface TrackingProviderFieldDescriptor {
|
|
61
|
+
/** false ⇒ the provider has no such concept: hide the field and send nothing. */
|
|
62
|
+
used: boolean;
|
|
63
|
+
required: boolean;
|
|
64
|
+
label: string;
|
|
65
|
+
placeholder?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface TrackingProviderEndpointDescriptor {
|
|
69
|
+
label: string;
|
|
70
|
+
placeholder: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
/** Pre-filled for providers with one well-known public endpoint. */
|
|
73
|
+
defaultValue?: string;
|
|
74
|
+
/** Accepted URL schemes, with the trailing colon: `wss:`, `https:`… */
|
|
75
|
+
protocols: string[];
|
|
76
|
+
}
|
|
77
|
+
/** What the referenced secret must contain. Describes the secret; never holds it. */
|
|
78
|
+
export interface TrackingProviderSecretDescriptor {
|
|
79
|
+
label: string;
|
|
80
|
+
description: string;
|
|
81
|
+
placeholder?: string;
|
|
82
|
+
}
|
|
83
|
+
/** How the provider identifies a unit — what an operator binds to a response unit. */
|
|
84
|
+
export interface TrackingProviderExternalUnitDescriptor {
|
|
85
|
+
label: string;
|
|
86
|
+
description: string;
|
|
87
|
+
placeholder?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface TrackingProviderDescriptor {
|
|
90
|
+
providerCode: TrackingProviderCode;
|
|
91
|
+
displayName: string;
|
|
92
|
+
description: string;
|
|
93
|
+
/** Supported transports; the first is the default. */
|
|
94
|
+
transportTypes: TrackingTransportType[];
|
|
95
|
+
endpoint: TrackingProviderEndpointDescriptor;
|
|
96
|
+
externalUsername: TrackingProviderFieldDescriptor;
|
|
97
|
+
externalDomain: TrackingProviderFieldDescriptor;
|
|
98
|
+
secret: TrackingProviderSecretDescriptor;
|
|
99
|
+
externalUnitId: TrackingProviderExternalUnitDescriptor;
|
|
100
|
+
/** Display order of the setting groups. */
|
|
101
|
+
settingGroups: TrackingProviderSettingGroupDescriptor[];
|
|
102
|
+
settings: TrackingProviderSettingDescriptor[];
|
|
103
|
+
documentationUrl?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The `configuration` a connection gets when the operator supplies none: every
|
|
107
|
+
* setting at its default. Stored explicitly on the connection so that readers
|
|
108
|
+
* which know nothing about adapters (the status evaluator, ingestion guards) see
|
|
109
|
+
* the provider's thresholds rather than the service-wide fallbacks.
|
|
110
|
+
*/
|
|
111
|
+
export declare function buildDefaultTrackingProviderConfiguration(descriptor: Pick<TrackingProviderDescriptor, 'settings'>): Record<string, number | boolean | string>;
|
|
@@ -15,7 +15,12 @@ export interface TrackingPositionSocketEvent {
|
|
|
15
15
|
longitude: number;
|
|
16
16
|
accuracyMetres?: number;
|
|
17
17
|
speedKph?: number;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Heading in degrees clockwise from north, [0,360). Resolved by the server:
|
|
20
|
+
* the provider's course while moving, else the direction actually travelled,
|
|
21
|
+
* else the last known heading. Omitted ONLY when it is genuinely unknown —
|
|
22
|
+
* keep whatever heading is already shown; do not reset the unit to north.
|
|
23
|
+
*/
|
|
19
24
|
courseDegrees?: number;
|
|
20
25
|
moving?: boolean;
|
|
21
26
|
ignitionOn?: boolean;
|