@signalk/server-api 2.22.0 → 2.24.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.
- package/dist/deltas.d.ts +8 -0
- package/dist/deltas.d.ts.map +1 -1
- package/dist/history.d.ts +40 -8
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +7 -2
- package/dist/propertyvalues.d.ts.map +1 -1
- package/dist/propertyvalues.js +35 -5
- package/dist/serverapi.d.ts +3 -2
- package/dist/serverapi.d.ts.map +1 -1
- package/dist/streambundle.d.ts +4 -4
- package/dist/streambundle.d.ts.map +1 -1
- package/dist/typebox/autopilot-schemas.d.ts +59 -0
- package/dist/typebox/autopilot-schemas.d.ts.map +1 -0
- package/dist/typebox/autopilot-schemas.js +86 -0
- package/dist/typebox/course-schemas.d.ts +218 -0
- package/dist/typebox/course-schemas.d.ts.map +1 -0
- package/dist/typebox/course-schemas.js +317 -0
- package/dist/typebox/discovery-schemas.d.ts +53 -0
- package/dist/typebox/discovery-schemas.d.ts.map +1 -0
- package/dist/typebox/discovery-schemas.js +73 -0
- package/dist/typebox/history-schemas.d.ts +34 -0
- package/dist/typebox/history-schemas.d.ts.map +1 -0
- package/dist/typebox/history-schemas.js +75 -0
- package/dist/typebox/index.d.ts +11 -0
- package/dist/typebox/index.d.ts.map +1 -0
- package/dist/typebox/index.js +26 -0
- package/dist/typebox/notifications-schemas.d.ts +50 -0
- package/dist/typebox/notifications-schemas.d.ts.map +1 -0
- package/dist/typebox/notifications-schemas.js +53 -0
- package/dist/typebox/protocol-schemas.d.ts +432 -0
- package/dist/typebox/protocol-schemas.d.ts.map +1 -0
- package/dist/typebox/protocol-schemas.js +352 -0
- package/dist/typebox/radar-schemas.d.ts +50 -0
- package/dist/typebox/radar-schemas.d.ts.map +1 -0
- package/dist/typebox/radar-schemas.js +70 -0
- package/dist/typebox/resources-schemas.d.ts +152 -0
- package/dist/typebox/resources-schemas.d.ts.map +1 -0
- package/dist/typebox/resources-schemas.js +214 -0
- package/dist/typebox/shared-schemas.d.ts +92 -0
- package/dist/typebox/shared-schemas.d.ts.map +1 -0
- package/dist/typebox/shared-schemas.js +149 -0
- package/dist/typebox/weather-schemas.d.ts +82 -0
- package/dist/typebox/weather-schemas.d.ts.map +1 -0
- package/dist/typebox/weather-schemas.js +215 -0
- package/package.json +12 -8
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TypeBox Schema Definitions for the Signal K Resources API
|
|
4
|
+
*
|
|
5
|
+
* Covers routes, waypoints, regions, notes, and charts.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ResourceActionCreatedResponseSchema = exports.ResourceActionOkResponseSchema = exports.ChartSchema = exports.MapServerSourceSchema = exports.TileLayerSourceSchema = exports.NoteSchema = exports.NoteBaseModelSchema = exports.RegionSchema = exports.WaypointSchema = exports.RouteSchema = exports.RoutePointMetaSchema = exports.BaseResponseModelSchema = exports.PositionAttributeSchema = exports.HrefAttributeSchema = exports.SignalKHrefSchema = void 0;
|
|
9
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
10
|
+
const shared_schemas_1 = require("./shared-schemas");
|
|
11
|
+
/**
|
|
12
|
+
* Signal K resource href — generic pointer to any resource type by UUID.
|
|
13
|
+
*/
|
|
14
|
+
exports.SignalKHrefSchema = typebox_1.Type.String({
|
|
15
|
+
$id: 'SignalKHref',
|
|
16
|
+
pattern: `^/resources/(\\w*)/${shared_schemas_1.SignalKUuidPattern}$`,
|
|
17
|
+
description: 'Reference to a related resource. A pointer to the resource UUID.'
|
|
18
|
+
});
|
|
19
|
+
/** Href attribute — used to link a note to another resource */
|
|
20
|
+
exports.HrefAttributeSchema = typebox_1.Type.Object({
|
|
21
|
+
href: exports.SignalKHrefSchema
|
|
22
|
+
}, { $id: 'HrefAttribute' });
|
|
23
|
+
/** Position attribute — used to give a note a geographic position */
|
|
24
|
+
exports.PositionAttributeSchema = typebox_1.Type.Object({
|
|
25
|
+
position: shared_schemas_1.PositionSchema
|
|
26
|
+
}, { $id: 'ResourcePositionAttribute', description: 'Resource location.' });
|
|
27
|
+
exports.BaseResponseModelSchema = typebox_1.Type.Object({
|
|
28
|
+
timestamp: typebox_1.Type.String({
|
|
29
|
+
description: 'ISO 8601 timestamp of when the resource was last modified',
|
|
30
|
+
examples: ['2024-01-15T12:30:00.000Z']
|
|
31
|
+
}),
|
|
32
|
+
$source: typebox_1.Type.String({
|
|
33
|
+
description: 'Dot-separated identifier of the source that provided this resource (e.g. the resource provider plugin)',
|
|
34
|
+
examples: ['resources-provider']
|
|
35
|
+
})
|
|
36
|
+
}, {
|
|
37
|
+
$id: 'BaseResponseModel',
|
|
38
|
+
description: 'Metadata fields included in resource responses'
|
|
39
|
+
});
|
|
40
|
+
/** Route point metadata */
|
|
41
|
+
exports.RoutePointMetaSchema = typebox_1.Type.Object({
|
|
42
|
+
name: typebox_1.Type.String({ description: 'Point name / identifier' })
|
|
43
|
+
}, {
|
|
44
|
+
$id: 'RoutePointMeta',
|
|
45
|
+
additionalProperties: true
|
|
46
|
+
});
|
|
47
|
+
/** Route resource */
|
|
48
|
+
exports.RouteSchema = typebox_1.Type.Object({
|
|
49
|
+
name: typebox_1.Type.Optional(typebox_1.Type.String({ description: "Route's common name" })),
|
|
50
|
+
description: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'A description of the route' })),
|
|
51
|
+
distance: typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
52
|
+
description: 'Total distance from start to end in meters',
|
|
53
|
+
units: 'm',
|
|
54
|
+
minimum: 0
|
|
55
|
+
})),
|
|
56
|
+
feature: typebox_1.Type.Object({
|
|
57
|
+
geometry: shared_schemas_1.GeoJsonLinestringGeometrySchema,
|
|
58
|
+
properties: typebox_1.Type.Optional(typebox_1.Type.Object({
|
|
59
|
+
coordinatesMeta: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Union([exports.RoutePointMetaSchema, exports.HrefAttributeSchema]), {
|
|
60
|
+
description: 'Metadata for each point within the route'
|
|
61
|
+
}))
|
|
62
|
+
}, { additionalProperties: true }))
|
|
63
|
+
})
|
|
64
|
+
}, {
|
|
65
|
+
$id: 'Route',
|
|
66
|
+
description: 'A route resource'
|
|
67
|
+
});
|
|
68
|
+
/** Waypoint resource */
|
|
69
|
+
exports.WaypointSchema = typebox_1.Type.Object({
|
|
70
|
+
name: typebox_1.Type.Optional(typebox_1.Type.String({ description: "Waypoint's common name" })),
|
|
71
|
+
description: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'A description of the waypoint' })),
|
|
72
|
+
type: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
73
|
+
description: 'The type of point (e.g. Waypoint, PoI, Race Mark, etc)'
|
|
74
|
+
})),
|
|
75
|
+
feature: typebox_1.Type.Object({
|
|
76
|
+
geometry: shared_schemas_1.GeoJsonPointGeometrySchema,
|
|
77
|
+
properties: typebox_1.Type.Optional(typebox_1.Type.Object({}, {
|
|
78
|
+
additionalProperties: true,
|
|
79
|
+
description: 'Additional feature properties'
|
|
80
|
+
}))
|
|
81
|
+
})
|
|
82
|
+
}, {
|
|
83
|
+
$id: 'Waypoint',
|
|
84
|
+
description: 'A waypoint resource'
|
|
85
|
+
});
|
|
86
|
+
/** Region resource */
|
|
87
|
+
exports.RegionSchema = typebox_1.Type.Object({
|
|
88
|
+
name: typebox_1.Type.Optional(typebox_1.Type.String({ description: "Region's common name" })),
|
|
89
|
+
description: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'A description of the region' })),
|
|
90
|
+
feature: typebox_1.Type.Object({
|
|
91
|
+
geometry: typebox_1.Type.Union([
|
|
92
|
+
shared_schemas_1.GeoJsonPolygonGeometrySchema,
|
|
93
|
+
shared_schemas_1.GeoJsonMultiPolygonGeometrySchema
|
|
94
|
+
]),
|
|
95
|
+
properties: typebox_1.Type.Optional(typebox_1.Type.Object({}, {
|
|
96
|
+
additionalProperties: true,
|
|
97
|
+
description: 'Additional feature properties'
|
|
98
|
+
}))
|
|
99
|
+
})
|
|
100
|
+
}, {
|
|
101
|
+
$id: 'Region',
|
|
102
|
+
description: 'A region resource'
|
|
103
|
+
});
|
|
104
|
+
/** Note base model */
|
|
105
|
+
exports.NoteBaseModelSchema = typebox_1.Type.Object({
|
|
106
|
+
title: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'Title of note' })),
|
|
107
|
+
description: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'Text describing note' })),
|
|
108
|
+
mimeType: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
109
|
+
description: 'MIME type of the note content',
|
|
110
|
+
examples: ['text/plain', 'text/html', 'application/pdf']
|
|
111
|
+
})),
|
|
112
|
+
url: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'Location of the note' })),
|
|
113
|
+
properties: typebox_1.Type.Optional(typebox_1.Type.Object({}, {
|
|
114
|
+
additionalProperties: true,
|
|
115
|
+
description: 'Additional user defined note properties'
|
|
116
|
+
}))
|
|
117
|
+
}, { $id: 'NoteBaseModel' });
|
|
118
|
+
/** Note resource — a note linked to either an href or a position */
|
|
119
|
+
exports.NoteSchema = typebox_1.Type.Intersect([
|
|
120
|
+
exports.NoteBaseModelSchema,
|
|
121
|
+
typebox_1.Type.Partial(typebox_1.Type.Object({
|
|
122
|
+
href: exports.SignalKHrefSchema,
|
|
123
|
+
position: shared_schemas_1.PositionSchema
|
|
124
|
+
}))
|
|
125
|
+
], {
|
|
126
|
+
$id: 'Note',
|
|
127
|
+
description: 'A note resource — linked to either an href or a position'
|
|
128
|
+
});
|
|
129
|
+
/** Tile layer source */
|
|
130
|
+
exports.TileLayerSourceSchema = typebox_1.Type.Object({
|
|
131
|
+
type: typebox_1.Type.Literal('tilelayer'),
|
|
132
|
+
bounds: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Number(), {
|
|
133
|
+
minItems: 4,
|
|
134
|
+
maxItems: 4,
|
|
135
|
+
description: 'Geographic bounding box in [west, south, east, north] order (longitude, latitude, longitude, latitude) in degrees'
|
|
136
|
+
})),
|
|
137
|
+
format: typebox_1.Type.Optional(typebox_1.Type.Union([
|
|
138
|
+
typebox_1.Type.Literal('jpg'),
|
|
139
|
+
typebox_1.Type.Literal('pbf'),
|
|
140
|
+
typebox_1.Type.Literal('png'),
|
|
141
|
+
typebox_1.Type.Literal('webp')
|
|
142
|
+
], { description: 'Tile image format' })),
|
|
143
|
+
maxzoom: typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
144
|
+
minimum: 0,
|
|
145
|
+
maximum: 30,
|
|
146
|
+
default: 0,
|
|
147
|
+
description: 'Maximum zoom level available'
|
|
148
|
+
})),
|
|
149
|
+
minzoom: typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
150
|
+
minimum: 0,
|
|
151
|
+
maximum: 30,
|
|
152
|
+
default: 0,
|
|
153
|
+
description: 'Minimum zoom level available'
|
|
154
|
+
})),
|
|
155
|
+
scale: typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
156
|
+
minimum: 1,
|
|
157
|
+
default: 250000,
|
|
158
|
+
description: 'Chart scale denominator (e.g. 250000 for 1:250000)'
|
|
159
|
+
}))
|
|
160
|
+
}, {
|
|
161
|
+
$id: 'TileLayerSource',
|
|
162
|
+
description: 'A tile layer chart source (XYZ/TMS tiles)'
|
|
163
|
+
});
|
|
164
|
+
/** Map server source */
|
|
165
|
+
exports.MapServerSourceSchema = typebox_1.Type.Object({
|
|
166
|
+
type: typebox_1.Type.Union([
|
|
167
|
+
typebox_1.Type.Literal('tileJSON'),
|
|
168
|
+
typebox_1.Type.Literal('WMS'),
|
|
169
|
+
typebox_1.Type.Literal('WMTS'),
|
|
170
|
+
typebox_1.Type.Literal('mapstyleJSON'),
|
|
171
|
+
typebox_1.Type.Literal('S-57')
|
|
172
|
+
])
|
|
173
|
+
}, {
|
|
174
|
+
$id: 'MapServerSource',
|
|
175
|
+
description: 'A map server chart source (WMS, WMTS, tileJSON, mapstyleJSON, or S-57)'
|
|
176
|
+
});
|
|
177
|
+
/** Chart resource */
|
|
178
|
+
exports.ChartSchema = typebox_1.Type.Intersect([
|
|
179
|
+
typebox_1.Type.Object({
|
|
180
|
+
identifier: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'Chart identifier / number' })),
|
|
181
|
+
name: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'Chart name' })),
|
|
182
|
+
description: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'A text description of the chart' })),
|
|
183
|
+
url: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'URL to tile / map source' })),
|
|
184
|
+
layers: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String(), {
|
|
185
|
+
description: 'List of chart layer ids'
|
|
186
|
+
}))
|
|
187
|
+
}),
|
|
188
|
+
typebox_1.Type.Union([exports.TileLayerSourceSchema, exports.MapServerSourceSchema])
|
|
189
|
+
], {
|
|
190
|
+
$id: 'Chart',
|
|
191
|
+
description: 'A chart resource'
|
|
192
|
+
});
|
|
193
|
+
/**
|
|
194
|
+
* 200 success response with resource ID.
|
|
195
|
+
*/
|
|
196
|
+
exports.ResourceActionOkResponseSchema = typebox_1.Type.Object({
|
|
197
|
+
state: typebox_1.Type.Literal('COMPLETED'),
|
|
198
|
+
statusCode: typebox_1.Type.Literal(200),
|
|
199
|
+
id: typebox_1.Type.String({
|
|
200
|
+
pattern: `${shared_schemas_1.SignalKUuidPattern}$`,
|
|
201
|
+
description: 'Resource UUID'
|
|
202
|
+
})
|
|
203
|
+
}, { $id: 'ResourceActionOkResponse' });
|
|
204
|
+
/**
|
|
205
|
+
* 201 created response with resource ID.
|
|
206
|
+
*/
|
|
207
|
+
exports.ResourceActionCreatedResponseSchema = typebox_1.Type.Object({
|
|
208
|
+
state: typebox_1.Type.Literal('COMPLETED'),
|
|
209
|
+
statusCode: typebox_1.Type.Literal(201),
|
|
210
|
+
id: typebox_1.Type.String({
|
|
211
|
+
pattern: `${shared_schemas_1.SignalKUuidPattern}$`,
|
|
212
|
+
description: 'Resource UUID'
|
|
213
|
+
})
|
|
214
|
+
}, { $id: 'ResourceActionCreatedResponse' });
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TypeBox Schema Definitions for Signal K
|
|
3
|
+
*
|
|
4
|
+
* Domain object schemas and common patterns used across multiple APIs.
|
|
5
|
+
*
|
|
6
|
+
* Metadata (descriptions, units, examples) sourced from:
|
|
7
|
+
* specification/schemas/definitions.json
|
|
8
|
+
* specification/schemas/groups/navigation.json
|
|
9
|
+
*/
|
|
10
|
+
import { type Static } from '@sinclair/typebox';
|
|
11
|
+
/** Signal K UUID v4 pattern (without anchors) */
|
|
12
|
+
export declare const SignalKUuidPattern = "[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}";
|
|
13
|
+
/** ISO 8601 date-time pattern */
|
|
14
|
+
export declare const IsoTimePattern = "^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:\\.\\d*)?)((-(\\d{2}):(\\d{2})|Z)?)$";
|
|
15
|
+
/**
|
|
16
|
+
* ISO 8601 date-time string.
|
|
17
|
+
* @see specification/schemas/definitions.json#/definitions/timestamp
|
|
18
|
+
*/
|
|
19
|
+
export declare const IsoTimeSchema: import("@sinclair/typebox").TString;
|
|
20
|
+
export type IsoTimeType = Static<typeof IsoTimeSchema>;
|
|
21
|
+
/**
|
|
22
|
+
* Signal K UUID — Maritime Resource Name.
|
|
23
|
+
* Format: urn:mrn:signalk:uuid:{uuid-v4}
|
|
24
|
+
* @see specification/schemas/definitions.json#/definitions/uuid
|
|
25
|
+
*/
|
|
26
|
+
export declare const SignalKUuidSchema: import("@sinclair/typebox").TString;
|
|
27
|
+
/**
|
|
28
|
+
* MMSI — Maritime Mobile Service Identity (vessel).
|
|
29
|
+
* @see specification/schemas/definitions.json#/definitions/mmsi
|
|
30
|
+
*/
|
|
31
|
+
export declare const MmsiSchema: import("@sinclair/typebox").TString;
|
|
32
|
+
/**
|
|
33
|
+
* Geographic position with latitude, longitude, and optional altitude.
|
|
34
|
+
*
|
|
35
|
+
* Canonical Position schema — all APIs reference this single definition.
|
|
36
|
+
* @see specification/schemas/definitions.json#/definitions/position
|
|
37
|
+
*/
|
|
38
|
+
export declare const PositionSchema: import("@sinclair/typebox").TObject<{
|
|
39
|
+
latitude: import("@sinclair/typebox").TNumber;
|
|
40
|
+
longitude: import("@sinclair/typebox").TNumber;
|
|
41
|
+
altitude: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
42
|
+
}>;
|
|
43
|
+
export type Position = Static<typeof PositionSchema>;
|
|
44
|
+
/**
|
|
45
|
+
* Relative position origin — a circle defined by radius and center position.
|
|
46
|
+
* Used for subscription context filtering.
|
|
47
|
+
*/
|
|
48
|
+
export declare const RelativePositionOriginSchema: import("@sinclair/typebox").TObject<{
|
|
49
|
+
radius: import("@sinclair/typebox").TNumber;
|
|
50
|
+
position: import("@sinclair/typebox").TObject<{
|
|
51
|
+
latitude: import("@sinclair/typebox").TNumber;
|
|
52
|
+
longitude: import("@sinclair/typebox").TNumber;
|
|
53
|
+
altitude: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
export type RelativePositionOrigin = Static<typeof RelativePositionOriginSchema>;
|
|
57
|
+
/** GeoJSON Point geometry object (type + coordinates) */
|
|
58
|
+
export declare const GeoJsonPointGeometrySchema: import("@sinclair/typebox").TObject<{
|
|
59
|
+
type: import("@sinclair/typebox").TLiteral<"Point">;
|
|
60
|
+
coordinates: import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNumber]>;
|
|
61
|
+
}>;
|
|
62
|
+
export type GeoJsonPointGeometry = Static<typeof GeoJsonPointGeometrySchema>;
|
|
63
|
+
/** GeoJSON LineString geometry object (type + coordinates) */
|
|
64
|
+
export declare const GeoJsonLinestringGeometrySchema: import("@sinclair/typebox").TObject<{
|
|
65
|
+
type: import("@sinclair/typebox").TLiteral<"LineString">;
|
|
66
|
+
coordinates: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNumber]>>;
|
|
67
|
+
}>;
|
|
68
|
+
export type GeoJsonLinestringGeometry = Static<typeof GeoJsonLinestringGeometrySchema>;
|
|
69
|
+
/** GeoJSON Polygon geometry object (type + coordinates) */
|
|
70
|
+
export declare const GeoJsonPolygonGeometrySchema: import("@sinclair/typebox").TObject<{
|
|
71
|
+
type: import("@sinclair/typebox").TLiteral<"Polygon">;
|
|
72
|
+
coordinates: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNumber]>>>;
|
|
73
|
+
}>;
|
|
74
|
+
export type GeoJsonPolygonGeometry = Static<typeof GeoJsonPolygonGeometrySchema>;
|
|
75
|
+
/** GeoJSON MultiPolygon geometry object (type + coordinates) */
|
|
76
|
+
export declare const GeoJsonMultiPolygonGeometrySchema: import("@sinclair/typebox").TObject<{
|
|
77
|
+
type: import("@sinclair/typebox").TLiteral<"MultiPolygon">;
|
|
78
|
+
coordinates: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNumber]>>>>;
|
|
79
|
+
}>;
|
|
80
|
+
export type GeoJsonMultiPolygonGeometry = Static<typeof GeoJsonMultiPolygonGeometrySchema>;
|
|
81
|
+
/** Standard success response */
|
|
82
|
+
export declare const OkResponseSchema: import("@sinclair/typebox").TObject<{
|
|
83
|
+
state: import("@sinclair/typebox").TLiteral<"COMPLETED">;
|
|
84
|
+
statusCode: import("@sinclair/typebox").TLiteral<200>;
|
|
85
|
+
}>;
|
|
86
|
+
/** Standard error response */
|
|
87
|
+
export declare const ErrorResponseSchema: import("@sinclair/typebox").TObject<{
|
|
88
|
+
state: import("@sinclair/typebox").TLiteral<"FAILED">;
|
|
89
|
+
statusCode: import("@sinclair/typebox").TNumber;
|
|
90
|
+
message: import("@sinclair/typebox").TString;
|
|
91
|
+
}>;
|
|
92
|
+
//# sourceMappingURL=shared-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-schemas.d.ts","sourceRoot":"","sources":["../../src/typebox/shared-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAErD,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,yFACyD,CAAA;AAExF,iCAAiC;AACjC,eAAO,MAAM,cAAc,iGACqE,CAAA;AAEhG;;;GAGG;AACH,eAAO,MAAM,aAAa,qCAKxB,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,aAAa,CAAC,CAAA;AAEtD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,qCAO5B,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,qCAMrB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;EA4B1B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpD;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;EAaxC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAEhF,yDAAyD;AACzD,eAAO,MAAM,0BAA0B;;;EAYtC,CAAA;AACD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE5E,8DAA8D;AAC9D,eAAO,MAAM,+BAA+B;;;EAe3C,CAAA;AACD,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAC5C,OAAO,+BAA+B,CACvC,CAAA;AAED,2DAA2D;AAC3D,eAAO,MAAM,4BAA4B;;;EAiBxC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAEhF,gEAAgE;AAChE,eAAO,MAAM,iCAAiC;;;EAmB7C,CAAA;AACD,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,OAAO,iCAAiC,CACzC,CAAA;AAED,gCAAgC;AAChC,eAAO,MAAM,gBAAgB;;;EAM5B,CAAA;AAED,8BAA8B;AAC9B,eAAO,MAAM,mBAAmB;;;;EAO/B,CAAA"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared TypeBox Schema Definitions for Signal K
|
|
4
|
+
*
|
|
5
|
+
* Domain object schemas and common patterns used across multiple APIs.
|
|
6
|
+
*
|
|
7
|
+
* Metadata (descriptions, units, examples) sourced from:
|
|
8
|
+
* specification/schemas/definitions.json
|
|
9
|
+
* specification/schemas/groups/navigation.json
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ErrorResponseSchema = exports.OkResponseSchema = exports.GeoJsonMultiPolygonGeometrySchema = exports.GeoJsonPolygonGeometrySchema = exports.GeoJsonLinestringGeometrySchema = exports.GeoJsonPointGeometrySchema = exports.RelativePositionOriginSchema = exports.PositionSchema = exports.MmsiSchema = exports.SignalKUuidSchema = exports.IsoTimeSchema = exports.IsoTimePattern = exports.SignalKUuidPattern = void 0;
|
|
13
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
14
|
+
/** Signal K UUID v4 pattern (without anchors) */
|
|
15
|
+
exports.SignalKUuidPattern = '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}';
|
|
16
|
+
/** ISO 8601 date-time pattern */
|
|
17
|
+
exports.IsoTimePattern = '^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:\\.\\d*)?)((-(\\d{2}):(\\d{2})|Z)?)$';
|
|
18
|
+
/**
|
|
19
|
+
* ISO 8601 date-time string.
|
|
20
|
+
* @see specification/schemas/definitions.json#/definitions/timestamp
|
|
21
|
+
*/
|
|
22
|
+
exports.IsoTimeSchema = typebox_1.Type.String({
|
|
23
|
+
$id: 'IsoTime',
|
|
24
|
+
pattern: exports.IsoTimePattern,
|
|
25
|
+
description: 'ISO 8601 date-time string',
|
|
26
|
+
examples: ['2022-04-22T05:02:56.484Z']
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Signal K UUID — Maritime Resource Name.
|
|
30
|
+
* Format: urn:mrn:signalk:uuid:{uuid-v4}
|
|
31
|
+
* @see specification/schemas/definitions.json#/definitions/uuid
|
|
32
|
+
*/
|
|
33
|
+
exports.SignalKUuidSchema = typebox_1.Type.String({
|
|
34
|
+
$id: 'SignalKUuid',
|
|
35
|
+
pattern: `^urn:mrn:signalk:uuid:${exports.SignalKUuidPattern}$`,
|
|
36
|
+
description: 'A unique Signal K flavoured maritime resource identifier (MRN). ' +
|
|
37
|
+
'Format: urn:mrn:signalk:uuid:{uuid-v4}',
|
|
38
|
+
examples: ['urn:mrn:signalk:uuid:b7590868-1d62-47d9-989c-32321b349fb9']
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* MMSI — Maritime Mobile Service Identity (vessel).
|
|
42
|
+
* @see specification/schemas/definitions.json#/definitions/mmsi
|
|
43
|
+
*/
|
|
44
|
+
exports.MmsiSchema = typebox_1.Type.String({
|
|
45
|
+
$id: 'Mmsi',
|
|
46
|
+
pattern: '^[2-7][0-9]{8}$',
|
|
47
|
+
description: 'Maritime Mobile Service Identity (MMSI). 9 digits, first digit 2-7.',
|
|
48
|
+
examples: ['503123456']
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Geographic position with latitude, longitude, and optional altitude.
|
|
52
|
+
*
|
|
53
|
+
* Canonical Position schema — all APIs reference this single definition.
|
|
54
|
+
* @see specification/schemas/definitions.json#/definitions/position
|
|
55
|
+
*/
|
|
56
|
+
exports.PositionSchema = typebox_1.Type.Object({
|
|
57
|
+
latitude: typebox_1.Type.Number({
|
|
58
|
+
minimum: -90,
|
|
59
|
+
maximum: 90,
|
|
60
|
+
description: 'Latitude',
|
|
61
|
+
units: 'deg',
|
|
62
|
+
examples: [52.0987654]
|
|
63
|
+
}),
|
|
64
|
+
longitude: typebox_1.Type.Number({
|
|
65
|
+
minimum: -180,
|
|
66
|
+
maximum: 180,
|
|
67
|
+
description: 'Longitude',
|
|
68
|
+
units: 'deg',
|
|
69
|
+
examples: [4.98765245]
|
|
70
|
+
}),
|
|
71
|
+
altitude: typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
72
|
+
description: 'Altitude',
|
|
73
|
+
units: 'm',
|
|
74
|
+
examples: [12.5]
|
|
75
|
+
}))
|
|
76
|
+
}, {
|
|
77
|
+
$id: 'SignalKPosition',
|
|
78
|
+
description: 'The position in 3 dimensions'
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* Relative position origin — a circle defined by radius and center position.
|
|
82
|
+
* Used for subscription context filtering.
|
|
83
|
+
*/
|
|
84
|
+
exports.RelativePositionOriginSchema = typebox_1.Type.Object({
|
|
85
|
+
radius: typebox_1.Type.Number({
|
|
86
|
+
minimum: 0,
|
|
87
|
+
description: 'Radius in meters',
|
|
88
|
+
units: 'm'
|
|
89
|
+
}),
|
|
90
|
+
position: exports.PositionSchema
|
|
91
|
+
}, {
|
|
92
|
+
$id: 'RelativePositionOrigin',
|
|
93
|
+
description: 'A circle defined by radius and center position'
|
|
94
|
+
});
|
|
95
|
+
/** GeoJSON Point geometry object (type + coordinates) */
|
|
96
|
+
exports.GeoJsonPointGeometrySchema = typebox_1.Type.Object({
|
|
97
|
+
type: typebox_1.Type.Literal('Point'),
|
|
98
|
+
coordinates: typebox_1.Type.Tuple([
|
|
99
|
+
typebox_1.Type.Number({ description: 'Longitude' }),
|
|
100
|
+
typebox_1.Type.Number({ description: 'Latitude' })
|
|
101
|
+
])
|
|
102
|
+
}, {
|
|
103
|
+
$id: 'GeoJsonPointGeometry',
|
|
104
|
+
description: 'GeoJSON Point geometry — [longitude, latitude]'
|
|
105
|
+
});
|
|
106
|
+
/** GeoJSON LineString geometry object (type + coordinates) */
|
|
107
|
+
exports.GeoJsonLinestringGeometrySchema = typebox_1.Type.Object({
|
|
108
|
+
type: typebox_1.Type.Literal('LineString'),
|
|
109
|
+
coordinates: typebox_1.Type.Array(typebox_1.Type.Tuple([
|
|
110
|
+
typebox_1.Type.Number({ description: 'Longitude' }),
|
|
111
|
+
typebox_1.Type.Number({ description: 'Latitude' })
|
|
112
|
+
]), { minItems: 2 })
|
|
113
|
+
}, {
|
|
114
|
+
$id: 'GeoJsonLineStringGeometry',
|
|
115
|
+
description: 'GeoJSON LineString geometry — array of [lon, lat] pairs'
|
|
116
|
+
});
|
|
117
|
+
/** GeoJSON Polygon geometry object (type + coordinates) */
|
|
118
|
+
exports.GeoJsonPolygonGeometrySchema = typebox_1.Type.Object({
|
|
119
|
+
type: typebox_1.Type.Literal('Polygon'),
|
|
120
|
+
coordinates: typebox_1.Type.Array(typebox_1.Type.Array(typebox_1.Type.Tuple([
|
|
121
|
+
typebox_1.Type.Number({ description: 'Longitude' }),
|
|
122
|
+
typebox_1.Type.Number({ description: 'Latitude' })
|
|
123
|
+
]), { minItems: 4 }))
|
|
124
|
+
}, {
|
|
125
|
+
$id: 'GeoJsonPolygonGeometry',
|
|
126
|
+
description: 'GeoJSON Polygon geometry — array of linear rings'
|
|
127
|
+
});
|
|
128
|
+
/** GeoJSON MultiPolygon geometry object (type + coordinates) */
|
|
129
|
+
exports.GeoJsonMultiPolygonGeometrySchema = typebox_1.Type.Object({
|
|
130
|
+
type: typebox_1.Type.Literal('MultiPolygon'),
|
|
131
|
+
coordinates: typebox_1.Type.Array(typebox_1.Type.Array(typebox_1.Type.Array(typebox_1.Type.Tuple([
|
|
132
|
+
typebox_1.Type.Number({ description: 'Longitude' }),
|
|
133
|
+
typebox_1.Type.Number({ description: 'Latitude' })
|
|
134
|
+
]), { minItems: 4 })))
|
|
135
|
+
}, {
|
|
136
|
+
$id: 'GeoJsonMultiPolygonGeometry',
|
|
137
|
+
description: 'GeoJSON MultiPolygon geometry'
|
|
138
|
+
});
|
|
139
|
+
/** Standard success response */
|
|
140
|
+
exports.OkResponseSchema = typebox_1.Type.Object({
|
|
141
|
+
state: typebox_1.Type.Literal('COMPLETED'),
|
|
142
|
+
statusCode: typebox_1.Type.Literal(200)
|
|
143
|
+
}, { $id: 'OkResponse' });
|
|
144
|
+
/** Standard error response */
|
|
145
|
+
exports.ErrorResponseSchema = typebox_1.Type.Object({
|
|
146
|
+
state: typebox_1.Type.Literal('FAILED'),
|
|
147
|
+
statusCode: typebox_1.Type.Number(),
|
|
148
|
+
message: typebox_1.Type.String()
|
|
149
|
+
}, { $id: 'ErrorResponse', description: 'Request error response' });
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeBox Schema Definitions for the Signal K Weather API
|
|
3
|
+
*
|
|
4
|
+
* Units follow SI conventions: K (temperature), Pa (pressure), m/s (speed),
|
|
5
|
+
* rad (direction), m (distance/visibility), ratio (humidity/cloud).
|
|
6
|
+
*/
|
|
7
|
+
import { type Static } from '@sinclair/typebox';
|
|
8
|
+
/** Weather data type */
|
|
9
|
+
export declare const WeatherDataTypeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"daily">, import("@sinclair/typebox").TLiteral<"point">, import("@sinclair/typebox").TLiteral<"observation">]>;
|
|
10
|
+
/** Pressure tendency */
|
|
11
|
+
export declare const PressureTendencySchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"steady">, import("@sinclair/typebox").TLiteral<"decreasing">, import("@sinclair/typebox").TLiteral<"increasing">]>;
|
|
12
|
+
/** Precipitation type */
|
|
13
|
+
export declare const PrecipitationTypeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"rain">, import("@sinclair/typebox").TLiteral<"thunderstorm">, import("@sinclair/typebox").TLiteral<"snow">, import("@sinclair/typebox").TLiteral<"freezing rain">, import("@sinclair/typebox").TLiteral<"mixed/ice">]>;
|
|
14
|
+
/**
|
|
15
|
+
* Weather data model — observation, daily forecast, or point forecast.
|
|
16
|
+
*/
|
|
17
|
+
export declare const WeatherDataModelSchema: import("@sinclair/typebox").TObject<{
|
|
18
|
+
date: import("@sinclair/typebox").TString;
|
|
19
|
+
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
20
|
+
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"daily">, import("@sinclair/typebox").TLiteral<"point">, import("@sinclair/typebox").TLiteral<"observation">]>;
|
|
21
|
+
sun: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
22
|
+
sunrise: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
23
|
+
sunset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
24
|
+
}>>;
|
|
25
|
+
outside: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
26
|
+
uvIndex: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
27
|
+
cloudCover: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
28
|
+
horizontalVisibility: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
29
|
+
horizontalVisibilityOverRange: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
30
|
+
temperature: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
31
|
+
feelsLikeTemperature: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
32
|
+
dewPointTemperature: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
33
|
+
pressure: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
34
|
+
pressureTendency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"steady">, import("@sinclair/typebox").TLiteral<"decreasing">, import("@sinclair/typebox").TLiteral<"increasing">]>>;
|
|
35
|
+
absoluteHumidity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
36
|
+
relativeHumidity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
37
|
+
precipitationType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"rain">, import("@sinclair/typebox").TLiteral<"thunderstorm">, import("@sinclair/typebox").TLiteral<"snow">, import("@sinclair/typebox").TLiteral<"freezing rain">, import("@sinclair/typebox").TLiteral<"mixed/ice">]>>;
|
|
38
|
+
precipitationVolume: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
39
|
+
}>>;
|
|
40
|
+
wind: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
41
|
+
averageSpeed: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
42
|
+
speedTrue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
43
|
+
directionTrue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
44
|
+
gust: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
45
|
+
gustDirectionTrue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
46
|
+
}>>;
|
|
47
|
+
water: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
48
|
+
temperature: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
49
|
+
level: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
50
|
+
levelTendency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"steady">, import("@sinclair/typebox").TLiteral<"decreasing">, import("@sinclair/typebox").TLiteral<"increasing">]>>;
|
|
51
|
+
waves: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
52
|
+
significantHeight: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
53
|
+
directionTrue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
54
|
+
period: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
55
|
+
}>>;
|
|
56
|
+
swell: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
57
|
+
height: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
58
|
+
directionTrue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
59
|
+
period: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
60
|
+
}>>;
|
|
61
|
+
seaState: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
62
|
+
salinity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
63
|
+
ice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
64
|
+
}>>;
|
|
65
|
+
current: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
66
|
+
drift: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
67
|
+
set: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
68
|
+
}>>;
|
|
69
|
+
}>;
|
|
70
|
+
export type WeatherDataModel = Static<typeof WeatherDataModelSchema>;
|
|
71
|
+
/**
|
|
72
|
+
* Weather warning — time-bound severe weather advisory.
|
|
73
|
+
*/
|
|
74
|
+
export declare const WeatherWarningModelSchema: import("@sinclair/typebox").TObject<{
|
|
75
|
+
startTime: import("@sinclair/typebox").TString;
|
|
76
|
+
endTime: import("@sinclair/typebox").TString;
|
|
77
|
+
source: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
78
|
+
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
79
|
+
details: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
80
|
+
}>;
|
|
81
|
+
export type WeatherWarningModel = Static<typeof WeatherWarningModelSchema>;
|
|
82
|
+
//# sourceMappingURL=weather-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weather-schemas.d.ts","sourceRoot":"","sources":["../../src/typebox/weather-schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAGrD,wBAAwB;AACxB,eAAO,MAAM,qBAAqB,yLAGjC,CAAA;AAED,wBAAwB;AACxB,eAAO,MAAM,sBAAsB,8LAOlC,CAAA;AAED,yBAAyB;AACzB,eAAO,MAAM,uBAAuB,kSASnC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmPlC,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAEpE;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;EAwBrC,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
|