@signalk/server-api 1.39.0 → 2.0.0-beta.2
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/autopilot.d.ts +28 -0
- package/dist/autopilot.js +2 -0
- package/dist/index.d.ts +70 -1
- package/dist/index.js +21 -1
- package/dist/propertyvalues.test.js +5 -7
- package/dist/resourcetypes.d.ts +80 -0
- package/dist/resourcetypes.js +2 -0
- package/package.json +4 -2
- package/tsconfig.json +2 -2
- package/tsconfig.tsbuildinfo +3475 -0
- package/docs/assets/css/main.css +0 -2638
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/docs/classes/propertyvalues.propertyvalues-1.html +0 -361
- package/docs/index.html +0 -348
- package/docs/interfaces/index.plugin.html +0 -400
- package/docs/interfaces/index.pluginserverapp.html +0 -257
- package/docs/interfaces/index.propertyvaluesemitter.html +0 -247
- package/docs/interfaces/propertyvalues.propertyvalue.html +0 -213
- package/docs/interfaces/types.bus.html +0 -339
- package/docs/modules/index.html +0 -174
- package/docs/modules/propertyvalues.html +0 -183
- package/docs/modules/propertyvalues_test.html +0 -106
- package/docs/modules/types.html +0 -131
- package/docs/modules/types_baconjs.html +0 -106
- package/docs/modules.html +0 -124
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface AutopilotApi {
|
|
2
|
+
register: (pluginId: string, provider: AutopilotProvider) => void;
|
|
3
|
+
unRegister: (pluginId: string) => void;
|
|
4
|
+
getStates: () => Promise<[string]>;
|
|
5
|
+
setState: (state: string) => Promise<void>;
|
|
6
|
+
getModes: () => Promise<[string]>;
|
|
7
|
+
setMode: (mode: string) => Promise<void>;
|
|
8
|
+
setTarget: (value: number) => Promise<void>;
|
|
9
|
+
adjustTarget: (value: number) => Promise<void>;
|
|
10
|
+
tack: (port: boolean) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface AutopilotProvider {
|
|
13
|
+
pilotType: string;
|
|
14
|
+
methods: AutopilotProviderMethods;
|
|
15
|
+
}
|
|
16
|
+
export interface AutopilotProviderMethods {
|
|
17
|
+
pluginId?: string;
|
|
18
|
+
getStates: () => Promise<[string]>;
|
|
19
|
+
setState: (state: string) => Promise<void>;
|
|
20
|
+
getModes: () => Promise<[string]>;
|
|
21
|
+
setMode: (mode: string) => Promise<void>;
|
|
22
|
+
setTarget: (value: number) => Promise<void>;
|
|
23
|
+
adjustTarget: (value: number) => Promise<void>;
|
|
24
|
+
tack: (port: boolean) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export interface AutopilotProviderRegistry {
|
|
27
|
+
registerAutopilotProvider: (provider: AutopilotProvider) => void;
|
|
28
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
import { IRouter } from 'express';
|
|
2
2
|
import { PropertyValuesCallback } from './propertyvalues';
|
|
3
|
+
export interface Position {
|
|
4
|
+
latitude: number;
|
|
5
|
+
longitude: number;
|
|
6
|
+
altitude?: number;
|
|
7
|
+
}
|
|
3
8
|
export { PropertyValue, PropertyValues, PropertyValuesCallback } from './propertyvalues';
|
|
9
|
+
export * from './resourcetypes';
|
|
10
|
+
export declare type SignalKResourceType = 'routes' | 'waypoints' | 'notes' | 'regions' | 'charts';
|
|
11
|
+
export declare const SIGNALKRESOURCETYPES: SignalKResourceType[];
|
|
12
|
+
export declare const isSignalKResourceType: (s: string) => boolean;
|
|
13
|
+
export declare type ResourceType = SignalKResourceType | string;
|
|
14
|
+
export interface ResourcesApi {
|
|
15
|
+
register: (pluginId: string, provider: ResourceProvider) => void;
|
|
16
|
+
unRegister: (pluginId: string) => void;
|
|
17
|
+
listResources: (resType: SignalKResourceType, params: {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
[id: string]: any;
|
|
21
|
+
}>;
|
|
22
|
+
getResource: (resType: SignalKResourceType, resId: string) => Promise<object>;
|
|
23
|
+
setResource: (resType: SignalKResourceType, resId: string, data: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}) => Promise<void>;
|
|
26
|
+
deleteResource: (resType: SignalKResourceType, resId: string) => Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export interface ResourceProvider {
|
|
29
|
+
type: ResourceType;
|
|
30
|
+
methods: ResourceProviderMethods;
|
|
31
|
+
}
|
|
32
|
+
export interface ResourceProviderMethods {
|
|
33
|
+
pluginId?: string;
|
|
34
|
+
listResources: (query: {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}) => Promise<{
|
|
37
|
+
[id: string]: any;
|
|
38
|
+
}>;
|
|
39
|
+
getResource: (id: string) => Promise<object>;
|
|
40
|
+
setResource: (id: string, value: {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}) => Promise<void>;
|
|
43
|
+
deleteResource: (id: string) => Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export interface ResourceProviderRegistry {
|
|
46
|
+
registerResourceProvider: (provider: ResourceProvider) => void;
|
|
47
|
+
}
|
|
48
|
+
export interface AutopilotApi {
|
|
49
|
+
register: (pluginId: string, provider: AutopilotProvider) => void;
|
|
50
|
+
unRegister: (pluginId: string) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface AutopilotProvider {
|
|
53
|
+
pilotType: string;
|
|
54
|
+
methods: AutopilotProviderMethods;
|
|
55
|
+
}
|
|
56
|
+
export interface AutopilotProviderMethods {
|
|
57
|
+
pluginId?: string;
|
|
58
|
+
engage: (enable: boolean) => Promise<void>;
|
|
59
|
+
getConfig: () => Promise<{
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}>;
|
|
62
|
+
getState: () => Promise<string>;
|
|
63
|
+
setState: (state: string) => Promise<void>;
|
|
64
|
+
getMode: () => Promise<string>;
|
|
65
|
+
setMode: (mode: string) => Promise<void>;
|
|
66
|
+
setTarget: (value: number) => Promise<void>;
|
|
67
|
+
adjustTarget: (value: number) => Promise<void>;
|
|
68
|
+
tack: (port: boolean) => Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
export interface AutopilotProviderRegistry {
|
|
71
|
+
registerAutopilotProvider: (provider: AutopilotProvider) => void;
|
|
72
|
+
}
|
|
4
73
|
declare type Unsubscribe = () => {};
|
|
5
74
|
export interface PropertyValuesEmitter {
|
|
6
75
|
emitPropertyValue: (name: string, value: any) => void;
|
|
@@ -12,7 +81,7 @@ export interface PropertyValuesEmitter {
|
|
|
12
81
|
*
|
|
13
82
|
* INCOMPLETE, work in progress.
|
|
14
83
|
*/
|
|
15
|
-
export interface PluginServerApp extends PropertyValuesEmitter {
|
|
84
|
+
export interface PluginServerApp extends PropertyValuesEmitter, ResourceProviderRegistry, AutopilotProviderRegistry {
|
|
16
85
|
}
|
|
17
86
|
/**
|
|
18
87
|
* This is the API that a [server plugin](https://github.com/SignalK/signalk-server/blob/master/SERVERPLUGINS.md) must implement.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropertyValues = void 0;
|
|
13
|
+
exports.isSignalKResourceType = exports.SIGNALKRESOURCETYPES = exports.PropertyValues = void 0;
|
|
4
14
|
var propertyvalues_1 = require("./propertyvalues");
|
|
5
15
|
Object.defineProperty(exports, "PropertyValues", { enumerable: true, get: function () { return propertyvalues_1.PropertyValues; } });
|
|
16
|
+
__exportStar(require("./resourcetypes"), exports);
|
|
17
|
+
exports.SIGNALKRESOURCETYPES = [
|
|
18
|
+
'routes',
|
|
19
|
+
'waypoints',
|
|
20
|
+
'notes',
|
|
21
|
+
'regions',
|
|
22
|
+
'charts'
|
|
23
|
+
];
|
|
24
|
+
var isSignalKResourceType = function (s) { return exports.SIGNALKRESOURCETYPES.includes(s); };
|
|
25
|
+
exports.isSignalKResourceType = isSignalKResourceType;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
for (var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
r[k] = a[j];
|
|
7
|
-
return r;
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
3
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
4
|
+
to[j] = from[i];
|
|
5
|
+
return to;
|
|
8
6
|
};
|
|
9
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
8
|
var chai_1 = require("chai");
|
|
@@ -21,7 +19,7 @@ var setupTest = function (done, startAt) {
|
|
|
21
19
|
var pv = new propertyvalues_1.PropertyValues();
|
|
22
20
|
var cbCount = 0;
|
|
23
21
|
var cb = function (values) {
|
|
24
|
-
chai_1.expect(values).to.deep.equal(
|
|
22
|
+
chai_1.expect(values).to.deep.equal(__spreadArray([
|
|
25
23
|
undefined
|
|
26
24
|
], testValues.slice(0, startAt + cbCount++)));
|
|
27
25
|
if (cbCount === testValues.length) {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Position } from '.';
|
|
2
|
+
export interface Route {
|
|
3
|
+
name?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
distance?: number;
|
|
6
|
+
start?: string;
|
|
7
|
+
end?: string;
|
|
8
|
+
feature: {
|
|
9
|
+
type: 'Feature';
|
|
10
|
+
geometry: {
|
|
11
|
+
type: 'LineString';
|
|
12
|
+
coordinates: GeoJsonLinestring;
|
|
13
|
+
};
|
|
14
|
+
properties?: object;
|
|
15
|
+
id?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface Waypoint {
|
|
19
|
+
name?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
feature: {
|
|
22
|
+
type: 'Feature';
|
|
23
|
+
geometry: {
|
|
24
|
+
type: 'Point';
|
|
25
|
+
coordinates: GeoJsonPoint;
|
|
26
|
+
};
|
|
27
|
+
properties?: object;
|
|
28
|
+
id?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface Note {
|
|
32
|
+
name?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
href?: string;
|
|
35
|
+
position?: Position;
|
|
36
|
+
geohash?: string;
|
|
37
|
+
mimeType?: string;
|
|
38
|
+
url?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Region {
|
|
41
|
+
name?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
feature: Polygon | MultiPolygon;
|
|
44
|
+
}
|
|
45
|
+
export interface Chart {
|
|
46
|
+
name: string;
|
|
47
|
+
identifier: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
tilemapUrl?: string;
|
|
50
|
+
chartUrl?: string;
|
|
51
|
+
geohash?: string;
|
|
52
|
+
region?: string;
|
|
53
|
+
scale?: number;
|
|
54
|
+
chartLayers?: string[];
|
|
55
|
+
bounds?: [[number, number], [number, number]];
|
|
56
|
+
chartFormat: string;
|
|
57
|
+
}
|
|
58
|
+
export declare type GeoJsonPoint = [number, number, number?];
|
|
59
|
+
export declare type GeoJsonLinestring = GeoJsonPoint[];
|
|
60
|
+
export declare type GeoJsonPolygon = GeoJsonLinestring[];
|
|
61
|
+
export declare type GeoJsonMultiPolygon = GeoJsonPolygon[];
|
|
62
|
+
interface Polygon {
|
|
63
|
+
type: 'Feature';
|
|
64
|
+
geometry: {
|
|
65
|
+
type: 'Polygon';
|
|
66
|
+
coordinates: GeoJsonPolygon;
|
|
67
|
+
};
|
|
68
|
+
properties?: object;
|
|
69
|
+
id?: string;
|
|
70
|
+
}
|
|
71
|
+
interface MultiPolygon {
|
|
72
|
+
type: 'Feature';
|
|
73
|
+
geometry: {
|
|
74
|
+
type: 'MultiPolygon';
|
|
75
|
+
coordinates: GeoJsonMultiPolygon;
|
|
76
|
+
};
|
|
77
|
+
properties?: object;
|
|
78
|
+
id?: string;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalk/server-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "signalk-server Typescript API for plugins etc with relevant implementation classes",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc --declaration",
|
|
9
|
-
"watch": "tsc --watch",
|
|
9
|
+
"watch": "tsc --declaration --watch",
|
|
10
10
|
"prepublishOnly": "npm run build",
|
|
11
11
|
"typedoc": "typedoc --out docs src",
|
|
12
12
|
"test": "mocha --require ts-node/register src/**/*.test.ts"
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"author": "teppo.kurki@iki.fi",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"express": "^4.10.4",
|
|
21
22
|
"@types/chai": "^4.2.15",
|
|
23
|
+
"@types/express": "^4.17.1",
|
|
22
24
|
"@types/mocha": "^8.2.0",
|
|
23
25
|
"chai": "^4.3.0",
|
|
24
26
|
"mocha": "^8.3.0",
|
package/tsconfig.json
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
16
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
17
|
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
+
"composite": true, /* Enable project compilation */
|
|
20
20
|
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
21
|
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
22
|
// "noEmit": true, /* Do not emit outputs. */
|