@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
@@ -3,35 +3,356 @@ export declare const SIGNALKRESOURCETYPES: SignalKResourceType[];
3
3
  export declare const isSignalKResourceType: (s: string) => boolean;
4
4
  export type ResourceType = SignalKResourceType | string;
5
5
  export interface ResourcesApi {
6
- register: (pluginId: string, provider: ResourceProvider) => void;
7
- unRegister: (pluginId: string) => void;
8
- listResources: (resType: SignalKResourceType, params: {
6
+ register(pluginId: string, provider: ResourceProvider): void;
7
+ unRegister(pluginId: string): void;
8
+ /**
9
+ * Retrieve collection of resource entries of the supplied resource_type matching the provided criteria.
10
+ *
11
+ * > [!note]
12
+ * > Requires a registered Resource Provider. See {@link ResourceProviderRegistry.registerResourceProvider}.
13
+ *
14
+ * @example
15
+ * ```javascript
16
+ * app.resourcesApi.listResources(
17
+ * 'waypoints',
18
+ * {region: 'fishing_zone'}
19
+ * ).then (data => {
20
+ * // success
21
+ * console.log(data);
22
+ * ...
23
+ * }).catch (error) {
24
+ * // handle error
25
+ * console.log(error.message);
26
+ * ...
27
+ * }
28
+ * ```
29
+ *
30
+ * @param resType - A {@link SignalKResourceType} or user defined resource type.
31
+ * @param params - Object containing `key | value` pairs representing the criteria by which to filter the returned entries.
32
+ * > [!note]
33
+ * > The registered Resource Provider must support the supplied parameters for results to be filtered.
34
+ * @param providerId - The id of the Resource Provider plugin to use to complete the request.
35
+ */
36
+ listResources(resType: SignalKResourceType, params: {
9
37
  [key: string]: any;
10
- }, providerId?: string) => Promise<{
38
+ }, providerId?: string): Promise<{
11
39
  [id: string]: any;
12
40
  }>;
13
- getResource: (resType: SignalKResourceType, resId: string, providerId?: string) => Promise<object>;
14
- setResource: (resType: SignalKResourceType, resId: string, data: {
41
+ /**
42
+ * Retrieve the resource with the supplied SignalK resource_type and resource_id.
43
+ *
44
+ * > [!note]
45
+ * > Requires a registered Resource Provider. See {@link ResourceProviderRegistry.registerResourceProvider}.
46
+ *
47
+ * @example
48
+ * ```javascript
49
+ * try {
50
+ * const waypoint = await app.resourcesApi.getResource('waypoints', 'ac3a3b2d-07e8-4f25-92bc-98e7c92f7f1a');
51
+ * // success
52
+ * } catch (error) {
53
+ * // handle error
54
+ * console.error(error);
55
+ * // ...
56
+ * }
57
+ * ```
58
+ *
59
+ * @param resType - A {@link SignalKResourceType} or user defined resource type.
60
+ * @param resId - The resource identifier. _(e.g. `ac3a3b2d-07e8-4f25-92bc-98e7c92f7f1a`)_
61
+ * @param providerId - The id of the Resource Provider plugin to use to complete the request. Most commonly used for creating a new resource entry when more than one provider is registered for the specified resource type.
62
+ */
63
+ getResource(resType: ResourceType, resId: string, providerId?: string): Promise<object>;
64
+ /**
65
+ * Create / update value of the resource with the supplied SignalK resource_type and resource_id.
66
+ *
67
+ * > [!note]
68
+ * > Requires a registered Resource Provider. See {@link ResourceProviderRegistry.registerResourceProvider}.
69
+ *
70
+ * @example
71
+ * ```javascript
72
+ * app.resourcesApi.setResource(
73
+ * 'waypoints',
74
+ * 'ac3a3b2d-07e8-4f25-92bc-98e7c92f7f1a',
75
+ * {
76
+ * "name": "My Waypoint",
77
+ * "feature": {
78
+ * "type":"Feature",
79
+ * "geometry": {
80
+ * "type": "Point",
81
+ * "coordinates": [138.5, -38.6]
82
+ * },
83
+ * "properties":{}
84
+ * }
85
+ * }
86
+ * ).then ( () => {
87
+ * // success
88
+ * ...
89
+ * }).catch (error) {
90
+ * // handle error
91
+ * console.log(error.message);
92
+ * ...
93
+ * }
94
+ * ```
95
+ *
96
+ * @param resType - A {@link SignalKResourceType} or user defined resource type.
97
+ * @param resId - The resource identifier. _(e.g. `ac3a3b2d-07e8-4f25-92bc-98e7c92f7f1a`)_
98
+ * @param data - A complete and valid resource record.
99
+ * @param providerId - The id of the Resource Provider plugin to use to complete the request. Most commonly used for creating a new resource entry when more than one provider is registered for the specified resource type.
100
+ */
101
+ setResource(resType: SignalKResourceType, resId: string, data: {
15
102
  [key: string]: any;
16
- }, providerId?: string) => Promise<void>;
17
- deleteResource: (resType: SignalKResourceType, resId: string, providerId?: string) => Promise<void>;
103
+ }, providerId?: string): Promise<void>;
104
+ /**
105
+ * Delete the resource with the supplied SignalK resource_type and resource_id.
106
+ *
107
+ * > [!note]
108
+ * > Requires a registered Resource Provider. See {@link ResourceProviderRegistry.registerResourceProvider}.
109
+ *
110
+ * @example
111
+ * ```javascript
112
+ * app.resourcesApi.deleteResource(
113
+ * 'notes',
114
+ * 'ac3a3b2d-07e8-4f25-92bc-98e7c92f7f1a'
115
+ * ).then ( () => {
116
+ * // success
117
+ * ...
118
+ * }).catch (error) {
119
+ * // handle error
120
+ * console.log(error.message);
121
+ * ...
122
+ * }
123
+ * ```
124
+ *
125
+ * @param resType - A {@link SignalKResourceType} or user defined resource type.
126
+ * @param resId - The resource identifier. _(e.g. `ac3a3b2d-07e8-4f25-92bc-98e7c92f7f1a`)_
127
+ * @param providerId - The id of the Resource Provider plugin to use to complete the request.
128
+ */
129
+ deleteResource(resType: SignalKResourceType, resId: string, providerId?: string): Promise<void>;
18
130
  }
19
131
  export interface ResourceProvider {
132
+ /**
133
+ * The resource type provided for by the plugin.These can be either __Standard__ _(Signal K defined)_ types defined in {@link SignalKResourceType}, or __Custom__ _(user defined)_ resource types _(e.g. `'fishingZones'`)_
134
+ */
20
135
  type: ResourceType;
136
+ /**
137
+ * An object implementing the `ResourceProviderMethods` interface defining the functions to which resource requests are passed by the SignalK server.
138
+ */
21
139
  methods: ResourceProviderMethods;
22
140
  }
23
141
  export interface ResourceProviderMethods {
24
- listResources: (query: {
142
+ /**
143
+ * This method is called when a request is made for resource entries that match a specific criteria.
144
+ *
145
+ * > [!NOTE]
146
+ * > It is the responsibility of the resource provider plugin to filter the resources returned as per the supplied query parameters._
147
+ *
148
+ * @example
149
+ * Return waypoints within the bounded area with lower left corner at E5.4 N25.7 & upper right corner E6.9 & N31.2:
150
+ * ```
151
+ * GET /signalk/v2/api/resources/waypoints?bbox=[5.4,25.7,6.9,31.2]
152
+ * ```
153
+ * _ResourceProvider method invocation:_
154
+ * ```javascript
155
+ * listResources(
156
+ * {
157
+ * bbox: '5.4,25.7,6.9,31.2'
158
+ * }
159
+ * );
160
+ * ```
161
+ *
162
+ * _Returns:_
163
+ * ```JSON
164
+ * {
165
+ * "07894aba-f151-4099-aa4f-5e5773734b69": {
166
+ * "name":"my Point",
167
+ * "description":"A Signal K waypoint",
168
+ * "distance":124226.65183615577,
169
+ * "feature":{
170
+ * "type":"Feature",
171
+ * "geometry":{
172
+ * "type":"Point",
173
+ * "coordinates":[5.7,26.4]
174
+ * },
175
+ * "properties":{}
176
+ * },
177
+ * "timestamp":"2023-01-01T05:02:54.561Z",
178
+ * "$source":"resources-provider"
179
+ * },
180
+ * "0c894aba-d151-4099-aa4f-be5773734e99": {
181
+ * "name":"another point",
182
+ * "description":"Another Signal K waypoint",
183
+ * "distance":107226.84,
184
+ * "feature":{
185
+ * "type":"Feature",
186
+ * "geometry":{
187
+ * "type":"Point",
188
+ * "coordinates":[6.1,29.43]
189
+ * },
190
+ * "properties":{}
191
+ * },
192
+ * "timestamp":"2023-01-01T05:02:54.561Z",
193
+ * "$source":"resources-provider"
194
+ * }
195
+ * }
196
+ * ```
197
+ *
198
+ * @param query - Object containing `key | value` pairs representing the parameters by which to filter the returned entries. _e.g. {region: 'fishing_zone'}_
199
+ */
200
+ listResources(query: {
25
201
  [key: string]: any;
26
- }) => Promise<{
202
+ }): Promise<{
27
203
  [id: string]: any;
28
204
  }>;
29
- getResource: (id: string, property?: string) => Promise<object>;
30
- setResource: (id: string, value: {
205
+ /**
206
+ * This method is called when a request is made for a specific resource entry with the supplied `id`. If `property` is supplied then the value of the resource property is returned. If there is no resource associated with the id the call should return Promise.reject.
207
+ *
208
+ * @param id - String containing the target resource entry id. _(e.g. '07894aba-f151-4099-aa4f-5e5773734b99')_
209
+ * @param property - Name of resource property for which to return the value (in dot notation). _e.g. feature.geometry.coordinates_
210
+ *
211
+ * @example Resource request:
212
+ *
213
+ * ```
214
+ * GET /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99
215
+ * ```
216
+ * _ResourceProvider method invocation:_
217
+ * ```javascript
218
+ * getResource(
219
+ * '07894aba-f151-4099-aa4f-5e5773734b99'
220
+ * );
221
+ * ```
222
+ *
223
+ * _Returns:_
224
+ * ```JSON
225
+ * {
226
+ * "name":"myRoute",
227
+ * "description":"A Signal K route",
228
+ * "distance":124226.65183615577,
229
+ * "feature":{
230
+ * "type":"Feature",
231
+ * "geometry":{
232
+ * "type":"LineString",
233
+ * "coordinates":[[-8,-8],[-8.5,-8],[-8.5,-8.4],[-8.7,-8.3]]
234
+ * },
235
+ * "properties":{}
236
+ * },
237
+ * "timestamp":"2023-01-01T05:02:54.561Z",
238
+ * "$source":"resources-provider"
239
+ * }
240
+ * ```
241
+ *
242
+ * @example resource property value request:
243
+ * ```
244
+ * GET /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99/feature/geometry/type
245
+ * ```
246
+ * _ResourceProvider method invocation:_
247
+ * ```javascript
248
+ * getResource(
249
+ * '07894aba-f151-4099-aa4f-5e5773734b99',
250
+ * 'feature.geometry.type'
251
+ * );
252
+ * ```
253
+ *
254
+ * _Returns:_
255
+ * ```JSON
256
+ * {
257
+ * "value": "LineString",
258
+ * "timestamp":"2023-01-01T05:02:54.561Z",
259
+ * "$source":"resources-provider"
260
+ * }
261
+ * ```
262
+ *
263
+ */
264
+ getResource(id: string, property?: string): Promise<object>;
265
+ /**
266
+ * This method is called when a request is made to save / update a resource entry with the supplied id. The supplied data is a complete resource record.
267
+ *
268
+ * @param id - String containing the id of the resource entry created / updated. _e.g. '07894aba-f151-4099-aa4f-5e5773734b99'_
269
+ * @param value - Resource data to be stored.
270
+ *
271
+ * @example PUT resource request:
272
+ * ```
273
+ * PUT /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99 {resource_data}
274
+ * ```
275
+ * _ResourceProvider method invocation:_
276
+ *
277
+ * ```javascript
278
+ * setResource(
279
+ * '07894aba-f151-4099-aa4f-5e5773734b99',
280
+ * {
281
+ * name: 'test route',
282
+ * distance': 8000,
283
+ * feature: {
284
+ * type: 'Feature',
285
+ * geometry: {
286
+ * type: 'LineString',
287
+ * coordinates: [[138.5, -38.6], [138.7, -38.2], [138.9, -38.0]]
288
+ * },
289
+ * properties:{}
290
+ * }
291
+ * }
292
+ * );
293
+ * ```
294
+ *
295
+ * @example POST resource request:
296
+ * ```
297
+ * POST /signalk/v2/api/resources/routes {resource_data}
298
+ * ```
299
+ * _ResourceProvider method invocation:_
300
+ *
301
+ * ```javascript
302
+ * setResource(
303
+ * '<server_generated_id>',
304
+ * {
305
+ * name: 'test route',
306
+ * distance': 8000,
307
+ * feature: {
308
+ * type: 'Feature',
309
+ * geometry: {
310
+ * type: 'LineString',
311
+ * coordinates: [[138.5, -38.6], [138.7, -38.2], [138.9, -38.0]]
312
+ * },
313
+ * properties:{}
314
+ * }
315
+ * }
316
+ * );
317
+ * ```
318
+ *
319
+ */
320
+ setResource(id: string, value: {
31
321
  [key: string]: any;
32
- }) => Promise<void>;
33
- deleteResource: (id: string) => Promise<void>;
322
+ }): Promise<void>;
323
+ /**
324
+ * This method is called when a request is made to remove the specific resource entry with the supplied resource id.
325
+ *
326
+ * @param id - String containing the target resource entry id. _e.g. '07894aba-f151-4099-aa4f-5e5773734b99'_
327
+ *
328
+ * @example: resource request:
329
+ *
330
+ * ```
331
+ * DELETE /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99
332
+ * ```
333
+ * _ResourceProvider method invocation:_
334
+ *
335
+ * ```javascript
336
+ * deleteResource(
337
+ * '07894aba-f151-4099-aa4f-5e5773734b99'
338
+ * );
339
+ * ```
340
+ */
341
+ deleteResource(id: string): Promise<void>;
34
342
  }
35
343
  export interface ResourceProviderRegistry {
36
- registerResourceProvider: (provider: ResourceProvider) => void;
344
+ /**
345
+ * Used by _Resource Provider plugins_ to register each resource type it handles.
346
+ * See [`Resource Provider Plugins`](../../../docs/develop/plugins/resource_provider_plugins.md#registering-as-a-resource-provider) for details.
347
+ *
348
+ * @category Resources API
349
+ */
350
+ registerResourceProvider(provider: ResourceProvider): void;
351
+ /**
352
+ * Access the Resources API to list, get, set, and delete resources.
353
+ *
354
+ * @category Resources API
355
+ */
356
+ resourcesApi: ResourcesApi;
37
357
  }
358
+ //# sourceMappingURL=resourcesapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourcesapi.d.ts","sourceRoot":"","sources":["../src/resourcesapi.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,WAAW,GACX,OAAO,GACP,SAAS,GACT,QAAQ,CAAA;AAEZ,eAAO,MAAM,oBAAoB,EAAE,mBAAmB,EAMrD,CAAA;AACD,eAAO,MAAM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,CAAA;CACjC;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyDG;IACH,aAAa,CAAC,KAAK,EAAE;QAEnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAEnB,GAAG,OAAO,CAAC;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;IAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsDG;IACH,WAAW,CACT,EAAE,EAAE,MAAM,EAEV,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhB;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,wBAAwB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAE1D;;;;OAIG;IACH,YAAY,EAAE,YAAY,CAAA;CAC3B"}
@@ -8,7 +8,6 @@ exports.SIGNALKRESOURCETYPES = [
8
8
  'regions',
9
9
  'charts'
10
10
  ];
11
- var isSignalKResourceType = function (s) {
12
- return exports.SIGNALKRESOURCETYPES.includes(s);
13
- };
11
+ const isSignalKResourceType = (s) => exports.SIGNALKRESOURCETYPES.includes(s);
14
12
  exports.isSignalKResourceType = isSignalKResourceType;
13
+ //# sourceMappingURL=resourcesapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourcesapi.js","sourceRoot":"","sources":["../src/resourcesapi.ts"],"names":[],"mappings":";;;AAOa,QAAA,oBAAoB,GAA0B;IACzD,QAAQ;IACR,WAAW;IACX,OAAO;IACP,SAAS;IACT,QAAQ;CACT,CAAA;AACM,MAAM,qBAAqB,GAAG,CAAC,CAAS,EAAE,EAAE,CACjD,4BAAoB,CAAC,QAAQ,CAAC,CAAwB,CAAC,CAAA;AAD5C,QAAA,qBAAqB,yBACuB"}
@@ -1,4 +1,9 @@
1
1
  import { Position } from '.';
2
+ /** A resource returned from the API will always have these fields */
3
+ export type Resource<T> = T & {
4
+ timestamp: string;
5
+ $source: string;
6
+ };
2
7
  export interface Route {
3
8
  name?: string;
4
9
  description?: string;
@@ -18,6 +23,7 @@ export interface Route {
18
23
  export interface Waypoint {
19
24
  name?: string;
20
25
  description?: string;
26
+ type?: string;
21
27
  feature: {
22
28
  type: 'Feature';
23
29
  geometry: {
@@ -59,7 +65,7 @@ export type GeoJsonPoint = [number, number, number?];
59
65
  export type GeoJsonLinestring = GeoJsonPoint[];
60
66
  export type GeoJsonPolygon = GeoJsonLinestring[];
61
67
  export type GeoJsonMultiPolygon = GeoJsonPolygon[];
62
- interface Polygon {
68
+ export interface Polygon {
63
69
  type: 'Feature';
64
70
  geometry: {
65
71
  type: 'Polygon';
@@ -68,7 +74,7 @@ interface Polygon {
68
74
  properties?: object;
69
75
  id?: string;
70
76
  }
71
- interface MultiPolygon {
77
+ export interface MultiPolygon {
72
78
  type: 'Feature';
73
79
  geometry: {
74
80
  type: 'MultiPolygon';
@@ -77,4 +83,4 @@ interface MultiPolygon {
77
83
  properties?: object;
78
84
  id?: string;
79
85
  }
80
- export {};
86
+ //# sourceMappingURL=resourcetypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourcetypes.d.ts","sourceRoot":"","sources":["../src/resourcetypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,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AC,EAAE,MAAM,CAAA;IACnB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=resourcetypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourcetypes.js","sourceRoot":"","sources":["../src/resourcetypes.ts"],"names":[],"mappings":""}