@signalk/server-api 2.6.0 → 2.7.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.
Files changed (69) hide show
  1. package/dist/autopilotapi.d.ts +241 -0
  2. package/dist/autopilotapi.d.ts.map +1 -0
  3. package/dist/autopilotapi.guard.d.ts +1 -0
  4. package/dist/autopilotapi.guard.d.ts.map +1 -0
  5. package/dist/autopilotapi.guard.js +3 -3
  6. package/dist/autopilotapi.guard.js.map +1 -0
  7. package/dist/autopilotapi.js +5 -8
  8. package/dist/autopilotapi.js.map +1 -0
  9. package/dist/brand.d.ts +24 -0
  10. package/dist/brand.d.ts.map +1 -0
  11. package/dist/{types.js → brand.js} +1 -1
  12. package/dist/brand.js.map +1 -0
  13. package/dist/course.d.ts +40 -0
  14. package/dist/course.d.ts.map +1 -0
  15. package/dist/course.js +3 -0
  16. package/dist/course.js.map +1 -0
  17. package/dist/coursetypes.d.ts +10 -11
  18. package/dist/coursetypes.d.ts.map +1 -0
  19. package/dist/coursetypes.js +1 -0
  20. package/dist/coursetypes.js.map +1 -0
  21. package/dist/deltas.d.ts +27 -20
  22. package/dist/deltas.d.ts.map +1 -0
  23. package/dist/deltas.js +6 -5
  24. package/dist/deltas.js.map +1 -0
  25. package/dist/deltas.test.d.ts +2 -0
  26. package/dist/deltas.test.d.ts.map +1 -0
  27. package/dist/features.d.ts +65 -0
  28. package/dist/features.d.ts.map +1 -0
  29. package/dist/features.js +3 -0
  30. package/dist/features.js.map +1 -0
  31. package/dist/index.d.ts +19 -134
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +15 -8
  34. package/dist/index.js.map +1 -0
  35. package/dist/plugin.d.ts +171 -0
  36. package/dist/plugin.d.ts.map +1 -0
  37. package/dist/plugin.js +3 -0
  38. package/dist/plugin.js.map +1 -0
  39. package/dist/propertyvalues.d.ts +50 -0
  40. package/dist/propertyvalues.d.ts.map +1 -0
  41. package/dist/propertyvalues.js +22 -27
  42. package/dist/propertyvalues.js.map +1 -0
  43. package/dist/propertyvalues.test.d.ts +2 -0
  44. package/dist/propertyvalues.test.d.ts.map +1 -0
  45. package/dist/resourcesapi.d.ts +336 -15
  46. package/dist/resourcesapi.d.ts.map +1 -0
  47. package/dist/resourcesapi.js +2 -3
  48. package/dist/resourcesapi.js.map +1 -0
  49. package/dist/resourcetypes.d.ts +9 -3
  50. package/dist/resourcetypes.d.ts.map +1 -0
  51. package/dist/resourcetypes.js +1 -0
  52. package/dist/resourcetypes.js.map +1 -0
  53. package/dist/serverapi.d.ts +369 -0
  54. package/dist/serverapi.d.ts.map +1 -0
  55. package/dist/serverapi.js +3 -0
  56. package/dist/serverapi.js.map +1 -0
  57. package/dist/streambundle.d.ts +148 -0
  58. package/dist/streambundle.d.ts.map +1 -0
  59. package/dist/streambundle.js +3 -0
  60. package/dist/streambundle.js.map +1 -0
  61. package/dist/subscriptionmanager.d.ts +84 -0
  62. package/dist/subscriptionmanager.d.ts.map +1 -0
  63. package/dist/subscriptionmanager.js +3 -0
  64. package/dist/subscriptionmanager.js.map +1 -0
  65. package/package.json +7 -22
  66. package/tsconfig.json +2 -72
  67. package/tsconfig.tsbuildinfo +1 -1
  68. package/typedoc.json +4 -0
  69. package/dist/types.d.ts +0 -7
@@ -13,18 +13,247 @@ export interface AutopilotApi {
13
13
  }
14
14
  /** @see {isAutopilotProvider} ts-auto-guard:type-guard */
15
15
  export interface AutopilotProvider {
16
+ /**
17
+ * This method returns an AutopilotInfo object containing the current data values and valid options for the supplied autopilot device identifier.
18
+ *
19
+ * > [!NOTE]
20
+ * > It is the responsibility of the autopilot provider plugin to map the value of `engaged` to the current `state`.
21
+ *
22
+ * @example
23
+ * API request:
24
+ * ```
25
+ * GET /signalk/v2/api/vessels/self/autopilots/mypilot1
26
+ * ```
27
+ *
28
+ * AutopilotProvider method invocation:
29
+ * ```javascript
30
+ * getData('mypilot1');
31
+ *
32
+ * // Returns:
33
+ * {
34
+ * options: {
35
+ * states: [
36
+ * {
37
+ * name: 'auto' // autopilot state name
38
+ * engaged: true // actively steering
39
+ * },
40
+ * {
41
+ * name: 'standby' // autopilot state name
42
+ * engaged: false // not actively steering
43
+ * }
44
+ * ]
45
+ * modes: ['compass', 'gps', 'wind']
46
+ * },
47
+ * target: 0.326
48
+ * mode: 'compass'
49
+ * state: 'auto'
50
+ * engaged: true
51
+ * }
52
+ * ```
53
+ *
54
+ * @param deviceId - identifier of the autopilot device to query.
55
+ */
16
56
  getData(deviceId: string): Promise<AutopilotInfo>;
57
+ /**
58
+ * Returns the current state of the supplied autopilot device identifier. If the autopilot device is not connected or unreachable then `off-line` should be returned.
59
+ *
60
+ * @example
61
+ * API request
62
+ * ```
63
+ * GET /signalk/v2/api/vessels/self/autopilots/mypilot1/state
64
+ * ```
65
+ *
66
+ * AutopilotProvider method invocation
67
+ * ```javascript
68
+ * await getState('mypilot1'); // Returns: 'auto'
69
+ * ```
70
+ *
71
+ * @param deviceId - identifier of the autopilot device to query.
72
+ */
17
73
  getState(deviceId: string): Promise<string>;
74
+ /**
75
+ * Sets the autopilot device with the supplied identifier to the supplied state value.
76
+ *
77
+ * @example
78
+ * API request
79
+ * ```
80
+ * PUT /signalk/v2/api/vessels/self/autopilots/mypilot1/state {value: "standby"}
81
+ * ```
82
+ *
83
+ * AutopilotProvider method invocation
84
+ * ```javascript
85
+ * setState('standby', 'mypilot1');
86
+ * ```
87
+ *
88
+ * @param state - state value to set. Must be a valid state value.
89
+ * @param deviceId - identifier of the autopilot device to query.
90
+ * @throws if supplied state value is invalid.
91
+ */
18
92
  setState(state: string, deviceId: string): Promise<void>;
19
93
  getMode(deviceId: string): Promise<string>;
94
+ /**
95
+ * Sets the autopilot device with the supplied identifier to the supplied mode value.
96
+ *
97
+ * @example
98
+ * API request
99
+ * ```
100
+ * PUT /signalk/v2/api/vessels/self/autopilots/mypilot1/mode {value: "gps"}
101
+ * ```
102
+ * AutopilotProvider method invocation
103
+ * ```javascript *
104
+ * setMode('gps', 'mypilot1');
105
+ * ```
106
+ *
107
+ * @param mode - Must be a valid mode value.
108
+ * @param deviceId - identifier of the autopilot device to query.
109
+ * @throws if supplied mode value is invalid.
110
+ */
20
111
  setMode(mode: string, deviceId: string): Promise<void>;
21
112
  getTarget(deviceId: string): Promise<number>;
113
+ /**
114
+ * Sets target for the autopilot device with the supplied identifier to the supplied value.
115
+ *
116
+ * @example
117
+ * API request
118
+ * ```
119
+ * PUT /signalk/v2/api/vessels/self/autopilots/mypilot1/target {value: 129}
120
+ * ```
121
+ *
122
+ * // AutopilotProvider method invocation
123
+ * ```javascript
124
+ * setTarget(129, 'mypilot1');
125
+ * ```
126
+ *
127
+ * @param value - target value in radians.
128
+ * @param deviceId - identifier of the autopilot device to query.
129
+ * @throws if supplied target value is outside the valid range.
130
+ */
22
131
  setTarget(value: number, deviceId: string): Promise<void>;
132
+ /**
133
+ * Adjusts target for the autopilot device with the supplied identifier by the supplied value.
134
+ *
135
+ * @example
136
+ * API request
137
+ * ```
138
+ * PUT /signalk/v2/api/vessels/self/autopilots/mypilot1/target {value: 2}
139
+ * ```
140
+ * AutopilotProvider method invocation
141
+ * ```javascript
142
+ * adjustTarget(2, 'mypilot1');
143
+ * ```
144
+ *
145
+ * @param value - value in radians to add to current target value.
146
+ * @param deviceId - identifier of the autopilot device to query.
147
+ * @throws if supplied target value is outside the valid range.
148
+ */
23
149
  adjustTarget(value: number, deviceId: string): Promise<void>;
150
+ /**
151
+ * Sets the state of the autopilot device with the supplied identifier to a state that is actively steering the vessel.
152
+ *
153
+ * @example
154
+ * API request
155
+ * ```
156
+ * POST /signalk/v2/api/vessels/self/autopilots/mypilot1/engage
157
+ * ```
158
+ * AutopilotProvider method invocation
159
+ * ```javascript
160
+ * engage('mypilot1');
161
+ * ```
162
+ *
163
+ * @param deviceId - identifier of the autopilot device to query.
164
+ * @throws on error.
165
+ */
24
166
  engage(deviceId: string): Promise<void>;
167
+ /**
168
+ * **`disengage(deviceId)`**: This method sets the state of the autopilot device with the supplied identifier to a state that is NOT actively steering the vessel.
169
+ *
170
+ * @example
171
+ * API request
172
+ * ```
173
+ * POST /signalk/v2/api/vessels/self/autopilots/mypilot1/disengage
174
+ * ```
175
+ * AutopilotProvider method invocation
176
+ * ```javascript
177
+ * disengage('mypilot1');
178
+ * ```
179
+ *
180
+ * @param deviceId - identifier of the autopilot device to query.
181
+ * @throws on error.
182
+ */
25
183
  disengage(deviceId: string): Promise<void>;
184
+ /**
185
+ * Instructs the autopilot device with the supplied identifier to perform a tack in the supplied direction.
186
+ *
187
+ * @example
188
+ * API request
189
+ * ```
190
+ * POST /signalk/v2/api/vessels/self/autopilots/mypilot1/tack/port
191
+ * ```
192
+ * AutopilotProvider method invocation
193
+ * ```javascript
194
+ * tack('port', 'mypilot1');
195
+ * ```
196
+ *
197
+ * @param direction - `port` or `starboard`
198
+ * @param deviceId - identifier of the autopilot device to query.
199
+ * @throws on error.
200
+ */
26
201
  tack(direction: TackGybeDirection, deviceId: string): Promise<void>;
202
+ /**
203
+ * **`gybe(direction, deviceId)`**: This method instructs the autopilot device with the supplied identifier to perform a gybe in the supplied direction.
204
+ *
205
+ * @example
206
+ * API request
207
+ * ```
208
+ * POST /signalk/v2/api/vessels/self/autopilots/mypilot1/gybe/starboard
209
+ * ```
210
+ * AutopilotProvider method invocation
211
+ * ```javascript
212
+ * gybe('starboard', 'mypilot1');
213
+ * ```
214
+ *
215
+ * @param direction - `port` or `starboard`
216
+ * @param deviceId - identifier of the autopilot device to query.
217
+ * @throws on error.
218
+ */
27
219
  gybe(direction: TackGybeDirection, deviceId: string): Promise<void>;
220
+ /**
221
+ * Instructs the autopilot device with the supplied identifier to enter / exit dodge mode and alter the current course by the supplied value (radians) direction.
222
+ *
223
+ * @example
224
+ * To address different pilot behaviour, the `dodge` function can be used in the following ways:
225
+ *
226
+ * **1. Enter dodge mode at the current course**
227
+ * ```javascript
228
+ * // API request
229
+ * POST /signalk/v2/api/vessels/self/autopilots/mypilot1/dodge
230
+ *
231
+ * // _AutopilotProvider method invocation
232
+ * dodge(0, 'mypilot1');
233
+ * ```
234
+ *
235
+ * **2. Enter dodge mode and change course**
236
+ * ```javascript
237
+ * // API request
238
+ * PUT /signalk/v2/api/vessels/self/autopilots/mypilot1/dodge {"value": 5}
239
+ *
240
+ * // AutopilotProvider method invocation
241
+ * dodge(5, 'mypilot1');
242
+ * ```
243
+ *
244
+ * **3. Cancel dodge mode**
245
+ * ```javascript
246
+ * // API request
247
+ * DELETE /signalk/v2/api/vessels/self/autopilots/mypilot1/dodge
248
+ *
249
+ * // AutopilotProvider method invocation
250
+ * dodge(null, 'mypilot1');
251
+ * ```
252
+ *
253
+ * @param value - +/- value in radians 'port (-ive)' or 'starboard' to change direction. _Setting the value to `null` indicates exit of dodge mode._
254
+ * @param deviceId - identifier of the autopilot device to query.
255
+ * @throws on error.
256
+ */
28
257
  dodge(value: number | null, deviceId: string): Promise<void>;
29
258
  }
30
259
  export interface AutopilotStateDef {
@@ -42,9 +271,21 @@ export interface AutopilotInfo {
42
271
  state: string | null;
43
272
  engaged: boolean;
44
273
  }
274
+ /**
275
+ * @hidden visible through ServerAPI
276
+ */
45
277
  export interface AutopilotProviderRegistry {
278
+ /**
279
+ * @category Autopilot API
280
+ */
46
281
  registerAutopilotProvider(provider: AutopilotProvider, devices: string[]): void;
282
+ /**
283
+ * @category Autopilot API
284
+ * @param deviceId - the autopilot device identifier
285
+ * @param apInfo - object containing values keyed by {@link AutopilotInfo}
286
+ */
47
287
  autopilotUpdate(deviceId: string, apInfo: {
48
288
  [path: string]: Value;
49
289
  }): void;
50
290
  }
291
+ //# sourceMappingURL=autopilotapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autopilotapi.d.ts","sourceRoot":"","sources":["../src/autopilotapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,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AAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,yBAAyB,CACvB,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,MAAM,EAAE,GAChB,IAAI,CAAA;IAEP;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;KAAE,GAAG,IAAI,CAAA;CAC3E"}
@@ -1,2 +1,3 @@
1
1
  import { AutopilotProvider } from "./autopilotapi";
2
2
  export declare function isAutopilotProvider(obj: unknown): obj is AutopilotProvider;
3
+ //# sourceMappingURL=autopilotapi.guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autopilotapi.guard.d.ts","sourceRoot":"","sources":["../src/autopilotapi.guard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB,CAoB1E"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAutopilotProvider = void 0;
3
+ exports.isAutopilotProvider = isAutopilotProvider;
4
4
  function isAutopilotProvider(obj) {
5
- var typedObj = obj;
5
+ const typedObj = obj;
6
6
  return ((typedObj !== null &&
7
7
  typeof typedObj === "object" ||
8
8
  typeof typedObj === "function") &&
@@ -20,4 +20,4 @@ function isAutopilotProvider(obj) {
20
20
  typeof typedObj["gybe"] === "function" &&
21
21
  typeof typedObj["dodge"] === "function");
22
22
  }
23
- exports.isAutopilotProvider = isAutopilotProvider;
23
+ //# sourceMappingURL=autopilotapi.guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autopilotapi.guard.js","sourceRoot":"","sources":["../src/autopilotapi.guard.ts"],"names":[],"mappings":";;AAMA,kDAoBC;AApBD,SAAgB,mBAAmB,CAAC,GAAY;IAC5C,MAAM,QAAQ,GAAG,GAAwB,CAAA;IACzC,OAAO,CACH,CAAC,QAAQ,KAAK,IAAI;QACd,OAAO,QAAQ,KAAK,QAAQ;QAC5B,OAAO,QAAQ,KAAK,UAAU,CAAC;QACnC,OAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,UAAU;QACzC,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,UAAU;QAC1C,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,UAAU;QAC1C,OAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,UAAU;QACzC,OAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,UAAU;QACzC,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,UAAU;QAC3C,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,UAAU;QAC3C,OAAO,QAAQ,CAAC,cAAc,CAAC,KAAK,UAAU;QAC9C,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,UAAU;QACxC,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,UAAU;QAC3C,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,UAAU;QACtC,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,UAAU;QACtC,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,UAAU,CAC1C,CAAA;AACL,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAutopilotAlarm = exports.isAutopilotUpdateAttrib = void 0;
4
- var AUTOPILOTUPDATEATTRIBS = [
4
+ const AUTOPILOTUPDATEATTRIBS = [
5
5
  'mode',
6
6
  'state',
7
7
  'target',
@@ -9,11 +9,9 @@ var AUTOPILOTUPDATEATTRIBS = [
9
9
  'options',
10
10
  'alarm'
11
11
  ];
12
- var isAutopilotUpdateAttrib = function (s) {
13
- return AUTOPILOTUPDATEATTRIBS.includes(s);
14
- };
12
+ const isAutopilotUpdateAttrib = (s) => AUTOPILOTUPDATEATTRIBS.includes(s);
15
13
  exports.isAutopilotUpdateAttrib = isAutopilotUpdateAttrib;
16
- var AUTOPILOTALARMS = [
14
+ const AUTOPILOTALARMS = [
17
15
  'waypointAdvance',
18
16
  'waypointArrival',
19
17
  'routeComplete',
@@ -21,7 +19,6 @@ var AUTOPILOTALARMS = [
21
19
  'heading',
22
20
  'wind'
23
21
  ];
24
- var isAutopilotAlarm = function (s) {
25
- return AUTOPILOTALARMS.includes(s);
26
- };
22
+ const isAutopilotAlarm = (s) => AUTOPILOTALARMS.includes(s);
27
23
  exports.isAutopilotAlarm = isAutopilotAlarm;
24
+ //# sourceMappingURL=autopilotapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autopilotapi.js","sourceRoot":"","sources":["../src/autopilotapi.ts"],"names":[],"mappings":";;;AAUA,MAAM,sBAAsB,GAA4B;IACtD,MAAM;IACN,OAAO;IACP,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OAAO;CACR,CAAA;AAEM,MAAM,uBAAuB,GAAG,CAAC,CAAS,EAAE,EAAE,CACnD,sBAAsB,CAAC,QAAQ,CAAC,CAA0B,CAAC,CAAA;AADhD,QAAA,uBAAuB,2BACyB;AAU7D,MAAM,eAAe,GAAqB;IACxC,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,KAAK;IACL,SAAS;IACT,MAAM;CACP,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,EAAE,CAC5C,eAAe,CAAC,QAAQ,CAAC,CAAmB,CAAC,CAAA;AADlC,QAAA,gBAAgB,oBACkB"}
@@ -0,0 +1,24 @@
1
+ declare const __brand: unique symbol;
2
+ /**
3
+ * An interface for creating branded types, which create a more specific and unique data type
4
+ * with greater clarity and specificity,
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * type Path = Branded<string, "path">
9
+ *
10
+ * function getSelfPath(path: Path): Delta {
11
+ * // ...
12
+ * }
13
+ * ```
14
+ *
15
+ * @see https://egghead.io/blog/using-branded-types-in-typescript
16
+ * @internal
17
+ * @typeParam Type - The real type to use (e.g. `string`, `boolean`, etc.)
18
+ * @typeParam Name - The name of this type (e.g. `path`, `sourceRef`, etc.)
19
+ */
20
+ export type Brand<Type, Name> = Type & {
21
+ [__brand]: Name;
22
+ };
23
+ export {};
24
+ //# sourceMappingURL=brand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../src/brand.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAA;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,KAAK,CAAC,IAAI,EAAE,IAAI,IAAI,IAAI,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=brand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.js","sourceRoot":"","sources":["../src/brand.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { PointDestination, RouteDestination, CourseInfo } from './coursetypes';
2
+ /**
3
+ * @see [Course REST API](../../../docs/develop/rest-api/course_api.md) provides the following functions for use by plugins.
4
+ */
5
+ export interface CourseApi {
6
+ /**
7
+ * Retrieves the current course information.
8
+ *
9
+ * @category Course API
10
+ */
11
+ getCourse(): Promise<CourseInfo>;
12
+ /**
13
+ * Cancels navigation to the current point or route being followed.
14
+ *
15
+ * @category Course API
16
+ */
17
+ clearDestination(): Promise<void>;
18
+ /**
19
+ * Set course to a specified position / waypoint.
20
+ *
21
+ * @category Course API
22
+ *
23
+ * @param dest - Object containing destination position information.
24
+ *
25
+ */
26
+ setDestination(dest: (PointDestination & {
27
+ arrivalCircle?: number;
28
+ }) | null): Promise<void>;
29
+ /**
30
+ * Follow a route in the specified direction and starting at the specified point.
31
+ *
32
+ * @param dest - Object containing route information.
33
+ *
34
+ * - returns: Resolved Promise on success.
35
+ *
36
+ * @category Course API
37
+ */
38
+ activateRoute(dest: RouteDestination | null): Promise<void>;
39
+ }
40
+ //# sourceMappingURL=course.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"course.d.ts","sourceRoot":"","sources":["../src/course.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE9E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,CAAA;IAEhC;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjC;;;;;;;OAOG;IACH,cAAc,CACZ,IAAI,EAAE,CAAC,gBAAgB,GAAG;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,GAC3D,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhB;;;;;;;;OAQG;IACH,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5D"}
package/dist/course.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=course.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"course.js","sourceRoot":"","sources":["../src/course.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
- import { Brand, Position } from '.';
1
+ import { Position } from '.';
2
+ import { Brand } from './brand';
2
3
  export interface HrefDestination {
3
4
  href: string;
4
5
  }
@@ -19,6 +20,11 @@ export interface ActiveRoute {
19
20
  reverse: boolean;
20
21
  name: string;
21
22
  }
23
+ export interface NextPreviousPoint {
24
+ href?: string;
25
+ type: CoursePointType;
26
+ position: Position;
27
+ }
22
28
  export type CoursePointType = Brand<string, 'coursepointtype'>;
23
29
  export declare const COURSE_POINT_TYPES: {
24
30
  VesselPosition: CoursePointType;
@@ -30,14 +36,7 @@ export interface CourseInfo {
30
36
  targetArrivalTime: string | null;
31
37
  arrivalCircle: number;
32
38
  activeRoute: ActiveRoute | null;
33
- nextPoint: {
34
- href?: string;
35
- type: CoursePointType;
36
- position: Position;
37
- } | null;
38
- previousPoint: {
39
- href?: string;
40
- type: CoursePointType;
41
- position: Position;
42
- } | null;
39
+ nextPoint: NextPreviousPoint | null;
40
+ previousPoint: NextPreviousPoint | null;
43
41
  }
42
+ //# sourceMappingURL=coursetypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coursetypes.d.ts","sourceRoot":"","sources":["../src/coursetypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,mBAAmB,CAAA;AAEpE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,eAAe,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AAE9D,eAAO,MAAM,kBAAkB;oBACO,eAAe;gBACvB,eAAe;cACnB,eAAe;CACxC,CAAA;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACnC,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAA;CACxC"}
@@ -6,3 +6,4 @@ exports.COURSE_POINT_TYPES = {
6
6
  RoutePoint: 'RoutePoint',
7
7
  Location: 'Location'
8
8
  };
9
+ //# sourceMappingURL=coursetypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coursetypes.js","sourceRoot":"","sources":["../src/coursetypes.ts"],"names":[],"mappings":";;;AAoCa,QAAA,kBAAkB,GAAG;IAChC,cAAc,EAAE,gBAAmC;IACnD,UAAU,EAAE,YAA+B;IAC3C,QAAQ,EAAE,UAA6B;CACxC,CAAA"}
package/dist/deltas.d.ts CHANGED
@@ -1,40 +1,42 @@
1
- import { Brand } from '.';
1
+ import { Brand } from './brand';
2
2
  export interface WithContext {
3
3
  context: Context;
4
4
  }
5
- export interface NormalizedDelta extends WithContext {
5
+ /** @inline - Not exported as part of the public API */
6
+ type NormalizedBaseDelta = {
7
+ context: Context;
6
8
  $source: SourceRef;
7
9
  source: Source;
8
10
  path: Path;
11
+ timestamp: Timestamp;
12
+ };
13
+ export type NormalizedMetaDelta = NormalizedBaseDelta & {
14
+ value: MetaValue;
15
+ isMeta: true;
16
+ };
17
+ export type NormalizedValueDelta = NormalizedBaseDelta & {
9
18
  value: Value;
10
- isMeta: boolean;
11
- }
19
+ isMeta: false;
20
+ };
21
+ export type NormalizedDelta = NormalizedValueDelta | NormalizedMetaDelta;
12
22
  export type SourceRef = Brand<string, 'sourceRef'>;
13
23
  export type Source = any;
14
24
  export type Path = Brand<string, 'path'>;
15
25
  export type Timestamp = Brand<string, 'timestamp'>;
16
26
  export type Context = Brand<string, 'context'>;
17
- export type Value = object | number | string | null | Notification;
18
- export interface DeltaSubscription {
19
- context: Context;
20
- subscribe: Array<{
21
- path: Path;
22
- period: number;
23
- format: 'delta' | 'full';
24
- policy: 'instant' | 'ideal' | 'fixed';
25
- minPeriod: number;
26
- }>;
27
- }
27
+ export type Value = object | number | string | null | Notification | boolean;
28
28
  export interface Delta {
29
29
  context?: Context;
30
30
  updates: Update[];
31
31
  }
32
32
  /**
33
33
  * @deprecated earlier mistake assumed ValuesDelta and MetaDelta were separate
34
+ * @hidden
34
35
  */
35
36
  export type ValuesDelta = Delta;
36
37
  /**
37
38
  * @deprecated earlier mistake assumed ValuesDelta and MetaDelta were separate
39
+ * @hidden
38
40
  */
39
41
  export type MetaDelta = Delta;
40
42
  export type Update = {
@@ -75,11 +77,8 @@ export interface MetaValue {
75
77
  lower: number;
76
78
  upper: number;
77
79
  };
78
- zones?: {
79
- upper: number;
80
- lower: number;
81
- state: string;
82
- }[];
80
+ zones?: Zone[];
81
+ supportsPut?: boolean;
83
82
  }
84
83
  export declare enum ALARM_STATE {
85
84
  nominal = "nominal",
@@ -93,3 +92,11 @@ export declare enum ALARM_METHOD {
93
92
  visual = "visual",
94
93
  sound = "sound"
95
94
  }
95
+ export interface Zone {
96
+ lower: number | undefined;
97
+ upper: number | undefined;
98
+ state: ALARM_STATE;
99
+ message: string;
100
+ }
101
+ export {};
102
+ //# sourceMappingURL=deltas.d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AC,EAAE,IAAI,EAAE,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAGD,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;CACxB;AAED,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB"}
package/dist/deltas.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALARM_METHOD = exports.ALARM_STATE = exports.hasMeta = exports.hasValues = void 0;
3
+ exports.ALARM_METHOD = exports.ALARM_STATE = void 0;
4
+ exports.hasValues = hasValues;
5
+ exports.hasMeta = hasMeta;
4
6
  function hasValues(u) {
5
7
  return 'values' in u && Array.isArray(u.values);
6
8
  }
7
- exports.hasValues = hasValues;
8
9
  function hasMeta(u) {
9
10
  return 'meta' in u && Array.isArray(u.meta);
10
11
  }
11
- exports.hasMeta = hasMeta;
12
12
  // Notification attribute types
13
13
  var ALARM_STATE;
14
14
  (function (ALARM_STATE) {
@@ -18,9 +18,10 @@ var ALARM_STATE;
18
18
  ALARM_STATE["warn"] = "warn";
19
19
  ALARM_STATE["alarm"] = "alarm";
20
20
  ALARM_STATE["emergency"] = "emergency";
21
- })(ALARM_STATE = exports.ALARM_STATE || (exports.ALARM_STATE = {}));
21
+ })(ALARM_STATE || (exports.ALARM_STATE = ALARM_STATE = {}));
22
22
  var ALARM_METHOD;
23
23
  (function (ALARM_METHOD) {
24
24
  ALARM_METHOD["visual"] = "visual";
25
25
  ALARM_METHOD["sound"] = "sound";
26
- })(ALARM_METHOD = exports.ALARM_METHOD || (exports.ALARM_METHOD = {}));
26
+ })(ALARM_METHOD || (exports.ALARM_METHOD = ALARM_METHOD = {}));
27
+ //# sourceMappingURL=deltas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltas.js","sourceRoot":"","sources":["../src/deltas.ts"],"names":[],"mappings":";;;AA2DA,8BAEC;AAED,0BAEC;AAND,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO,QAAQ,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AACjD,CAAC;AAED,SAAgB,OAAO,CAAC,CAAS;IAC/B,OAAO,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAC7C,CAAC;AAoCD,+BAA+B;AAC/B,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,sCAAuB,CAAA;AACzB,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=deltas.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltas.test.d.ts","sourceRoot":"","sources":["../src/deltas.test.ts"],"names":[],"mappings":""}