@awarevue/api-types 2.0.141 → 2.0.143

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.
@@ -514,7 +514,12 @@ export declare const sPushTrackableUpdate: z.ZodObject<{
514
514
  timestamp: z.ZodNumber;
515
515
  objectId: z.ZodString;
516
516
  objectName: z.ZodOptional<z.ZodString>;
517
- objectKind: z.ZodOptional<z.ZodString>;
517
+ objectKind: z.ZodOptional<z.ZodEnum<{
518
+ vessel: "vessel";
519
+ "base-station": "base-station";
520
+ "aid-to-navigation": "aid-to-navigation";
521
+ "sar-aircraft": "sar-aircraft";
522
+ }>>;
518
523
  metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
519
524
  longitude: z.ZodOptional<z.ZodNumber>;
520
525
  latitude: z.ZodOptional<z.ZodNumber>;
@@ -1,27 +1,52 @@
1
1
  import { z } from 'zod';
2
2
  export declare const sTrackableProfileSnapshot: z.ZodObject<{
3
3
  objectName: z.ZodOptional<z.ZodString>;
4
- objectKind: z.ZodOptional<z.ZodString>;
4
+ objectKind: z.ZodOptional<z.ZodEnum<{
5
+ vessel: "vessel";
6
+ "base-station": "base-station";
7
+ "aid-to-navigation": "aid-to-navigation";
8
+ "sar-aircraft": "sar-aircraft";
9
+ }>>;
5
10
  }, z.core.$strip>;
6
11
  export declare const sSetTrackableFavoriteRequest: z.ZodObject<{
7
12
  objectName: z.ZodOptional<z.ZodString>;
8
- objectKind: z.ZodOptional<z.ZodString>;
13
+ objectKind: z.ZodOptional<z.ZodEnum<{
14
+ vessel: "vessel";
15
+ "base-station": "base-station";
16
+ "aid-to-navigation": "aid-to-navigation";
17
+ "sar-aircraft": "sar-aircraft";
18
+ }>>;
9
19
  }, z.core.$strip>;
10
20
  export type SetTrackableFavoriteRequest = z.infer<typeof sSetTrackableFavoriteRequest>;
11
21
  export declare const sCreateTrackableRequest: z.ZodObject<{
12
22
  objectName: z.ZodOptional<z.ZodString>;
13
- objectKind: z.ZodOptional<z.ZodString>;
23
+ objectKind: z.ZodOptional<z.ZodEnum<{
24
+ vessel: "vessel";
25
+ "base-station": "base-station";
26
+ "aid-to-navigation": "aid-to-navigation";
27
+ "sar-aircraft": "sar-aircraft";
28
+ }>>;
14
29
  objectId: z.ZodString;
15
30
  }, z.core.$strip>;
16
31
  export type CreateTrackableRequest = z.infer<typeof sCreateTrackableRequest>;
17
32
  export declare const sUpdateTrackableRequest: z.ZodObject<{
18
33
  objectName: z.ZodOptional<z.ZodString>;
19
- objectKind: z.ZodOptional<z.ZodString>;
34
+ objectKind: z.ZodOptional<z.ZodEnum<{
35
+ vessel: "vessel";
36
+ "base-station": "base-station";
37
+ "aid-to-navigation": "aid-to-navigation";
38
+ "sar-aircraft": "sar-aircraft";
39
+ }>>;
20
40
  }, z.core.$strip>;
21
41
  export type UpdateTrackableRequest = z.infer<typeof sUpdateTrackableRequest>;
22
42
  export declare const sAttachTrackableImageRequest: z.ZodObject<{
23
43
  objectName: z.ZodOptional<z.ZodString>;
24
- objectKind: z.ZodOptional<z.ZodString>;
44
+ objectKind: z.ZodOptional<z.ZodEnum<{
45
+ vessel: "vessel";
46
+ "base-station": "base-station";
47
+ "aid-to-navigation": "aid-to-navigation";
48
+ "sar-aircraft": "sar-aircraft";
49
+ }>>;
25
50
  imageId: z.ZodUUID;
26
51
  reviewed: z.ZodOptional<z.ZodBoolean>;
27
52
  }, z.core.$strip>;
@@ -30,3 +55,19 @@ export declare const sSetTrackableImageReviewedRequest: z.ZodObject<{
30
55
  reviewed: z.ZodBoolean;
31
56
  }, z.core.$strip>;
32
57
  export type SetTrackableImageReviewedRequest = z.infer<typeof sSetTrackableImageReviewedRequest>;
58
+ export declare const sCreateTrackableRetentionPolicyRequest: z.ZodObject<{
59
+ ttlSeconds: z.ZodNumber;
60
+ outOfDateSeconds: z.ZodNumber;
61
+ objectKind: z.ZodEnum<{
62
+ vessel: "vessel";
63
+ "base-station": "base-station";
64
+ "aid-to-navigation": "aid-to-navigation";
65
+ "sar-aircraft": "sar-aircraft";
66
+ }>;
67
+ }, z.core.$strip>;
68
+ export type CreateTrackableRetentionPolicyRequest = z.infer<typeof sCreateTrackableRetentionPolicyRequest>;
69
+ export declare const sUpdateTrackableRetentionPolicyRequest: z.ZodObject<{
70
+ ttlSeconds: z.ZodNumber;
71
+ outOfDateSeconds: z.ZodNumber;
72
+ }, z.core.$strip>;
73
+ export type UpdateTrackableRetentionPolicyRequest = z.infer<typeof sUpdateTrackableRetentionPolicyRequest>;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sSetTrackableImageReviewedRequest = exports.sAttachTrackableImageRequest = exports.sUpdateTrackableRequest = exports.sCreateTrackableRequest = exports.sSetTrackableFavoriteRequest = exports.sTrackableProfileSnapshot = void 0;
3
+ exports.sUpdateTrackableRetentionPolicyRequest = exports.sCreateTrackableRetentionPolicyRequest = exports.sSetTrackableImageReviewedRequest = exports.sAttachTrackableImageRequest = exports.sUpdateTrackableRequest = exports.sCreateTrackableRequest = exports.sSetTrackableFavoriteRequest = exports.sTrackableProfileSnapshot = void 0;
4
4
  const zod_1 = require("zod");
5
+ const trackable_1 = require("../../objects/trackable");
5
6
  exports.sTrackableProfileSnapshot = zod_1.z.object({
6
7
  objectName: zod_1.z.string().trim().max(255).optional(),
7
- objectKind: zod_1.z.string().trim().max(64).optional(),
8
+ objectKind: trackable_1.sTrackableKind.optional(),
8
9
  });
9
10
  exports.sSetTrackableFavoriteRequest = exports.sTrackableProfileSnapshot;
10
11
  exports.sCreateTrackableRequest = exports.sTrackableProfileSnapshot.extend({
@@ -18,3 +19,19 @@ exports.sAttachTrackableImageRequest = exports.sTrackableProfileSnapshot.extend(
18
19
  exports.sSetTrackableImageReviewedRequest = zod_1.z.object({
19
20
  reviewed: zod_1.z.boolean(),
20
21
  });
22
+ const refineRetention = (v) => v.outOfDateSeconds < v.ttlSeconds;
23
+ const retentionRefineMessage = {
24
+ message: 'outOfDateSeconds must be less than ttlSeconds',
25
+ path: ['outOfDateSeconds'],
26
+ };
27
+ const sTrackableRetentionValues = zod_1.z.object({
28
+ ttlSeconds: zod_1.z.number().int().positive(),
29
+ outOfDateSeconds: zod_1.z.number().int().positive(),
30
+ });
31
+ // Adds a policy for a specific kind (the default policy always exists)
32
+ exports.sCreateTrackableRetentionPolicyRequest = sTrackableRetentionValues
33
+ .extend({ objectKind: trackable_1.sTrackableKind })
34
+ .refine(refineRetention, retentionRefineMessage);
35
+ // Replaces both values, so the ttl/out-of-date relationship can be validated
36
+ // here rather than against stored values
37
+ exports.sUpdateTrackableRetentionPolicyRequest = sTrackableRetentionValues.refine(refineRetention, retentionRefineMessage);
@@ -4,7 +4,12 @@ export declare const sTrackableUpdate: z.ZodObject<{
4
4
  timestamp: z.ZodNumber;
5
5
  objectId: z.ZodString;
6
6
  objectName: z.ZodOptional<z.ZodString>;
7
- objectKind: z.ZodOptional<z.ZodString>;
7
+ objectKind: z.ZodOptional<z.ZodEnum<{
8
+ vessel: "vessel";
9
+ "base-station": "base-station";
10
+ "aid-to-navigation": "aid-to-navigation";
11
+ "sar-aircraft": "sar-aircraft";
12
+ }>>;
8
13
  metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
9
14
  longitude: z.ZodOptional<z.ZodNumber>;
10
15
  latitude: z.ZodOptional<z.ZodNumber>;
@@ -26,7 +31,12 @@ export declare const sTrackableUpdatePayload: z.ZodObject<{
26
31
  timestamp: z.ZodNumber;
27
32
  objectId: z.ZodString;
28
33
  objectName: z.ZodOptional<z.ZodString>;
29
- objectKind: z.ZodOptional<z.ZodString>;
34
+ objectKind: z.ZodOptional<z.ZodEnum<{
35
+ vessel: "vessel";
36
+ "base-station": "base-station";
37
+ "aid-to-navigation": "aid-to-navigation";
38
+ "sar-aircraft": "sar-aircraft";
39
+ }>>;
30
40
  metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
31
41
  longitude: z.ZodOptional<z.ZodNumber>;
32
42
  latitude: z.ZodOptional<z.ZodNumber>;
@@ -48,10 +58,15 @@ export declare const sSubscribeTrackablePayload: z.ZodObject<{}, z.core.$strip>;
48
58
  export type SubscribeTrackablePayload = z.infer<typeof sSubscribeTrackablePayload>;
49
59
  export declare const sUnsubscribeTrackablePayload: z.ZodObject<{}, z.core.$strip>;
50
60
  export type UnsubscribeTrackablePayload = z.infer<typeof sUnsubscribeTrackablePayload>;
61
+ export declare const sTrackableRemovePayload: z.ZodObject<{
62
+ objectIds: z.ZodArray<z.ZodString>;
63
+ }, z.core.$strip>;
64
+ export type TrackableRemovePayload = z.infer<typeof sTrackableRemovePayload>;
51
65
  interface TrackableMessageMap {
52
66
  subscribe: SubscribeTrackablePayload;
53
67
  unsubscribe: UnsubscribeTrackablePayload;
54
68
  update: TrackableUpdatePayload;
69
+ remove: TrackableRemovePayload;
55
70
  }
56
71
  export type TrackableWsMessage = {
57
72
  [K in keyof TrackableMessageMap]: {
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTrackableMessage = exports.sUnsubscribeTrackablePayload = exports.sSubscribeTrackablePayload = exports.sTrackableUpdatePayload = exports.sTrackableUpdate = void 0;
3
+ exports.isTrackableMessage = exports.sTrackableRemovePayload = exports.sUnsubscribeTrackablePayload = exports.sSubscribeTrackablePayload = exports.sTrackableUpdatePayload = exports.sTrackableUpdate = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const primitives_1 = require("../../primitives");
6
+ const trackable_1 = require("../../objects/trackable");
6
7
  exports.sTrackableUpdate = zod_1.z.object({
7
8
  timestamp: zod_1.z.number(),
8
9
  objectId: zod_1.z.string().nonempty(),
9
10
  objectName: zod_1.z.string().optional(),
10
- objectKind: primitives_1.sWorldObjectId.optional(),
11
+ objectKind: trackable_1.sTrackableKind.optional(),
11
12
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
12
13
  longitude: zod_1.z.number().min(-180).max(180).optional(),
13
14
  latitude: zod_1.z.number().min(-90).max(90).optional(),
@@ -20,10 +21,14 @@ exports.sTrackableUpdatePayload = zod_1.z.object({
20
21
  });
21
22
  exports.sSubscribeTrackablePayload = zod_1.z.object({});
22
23
  exports.sUnsubscribeTrackablePayload = zod_1.z.object({});
24
+ exports.sTrackableRemovePayload = zod_1.z.object({
25
+ objectIds: zod_1.z.array(zod_1.z.string()),
26
+ });
23
27
  const validators = {
24
28
  subscribe: exports.sSubscribeTrackablePayload,
25
29
  unsubscribe: exports.sUnsubscribeTrackablePayload,
26
30
  update: exports.sTrackableUpdatePayload,
31
+ remove: exports.sTrackableRemovePayload,
27
32
  };
28
33
  const isTrackableMessage = (message) => {
29
34
  const validator = validators[message.event];
@@ -18,6 +18,7 @@ import { UserDto } from './user';
18
18
  import { ViewDto } from './view';
19
19
  import { ZoneDto, ZoneProps } from './zone';
20
20
  import { TrackableProfileDto } from './trackable';
21
+ import { TrackableRetentionPolicyDto } from './trackable-retention-policy';
21
22
  export declare const sObjectKind: z.ZodEnum<{
22
23
  accessRule: "accessRule";
23
24
  schedule: "schedule";
@@ -38,6 +39,7 @@ export declare const sObjectKind: z.ZodEnum<{
38
39
  securityLevel: "securityLevel";
39
40
  personType: "personType";
40
41
  apiKey: "apiKey";
42
+ trackableRetentionPolicy: "trackableRetentionPolicy";
41
43
  }>;
42
44
  export type ObjectKind = z.infer<typeof sObjectKind>;
43
45
  export type ObjectKinds = {
@@ -60,6 +62,7 @@ export type ObjectKinds = {
60
62
  agreement: AgreementDto;
61
63
  apiKey: ApiKeyDto;
62
64
  trackable: TrackableProfileDto;
65
+ trackableRetentionPolicy: TrackableRetentionPolicyDto;
63
66
  };
64
67
  export type ObjectDto = ObjectKinds;
65
68
  export type ObjectProps = {
@@ -22,6 +22,7 @@ exports.sObjectKind = zod_1.z.enum([
22
22
  'agreement',
23
23
  'apiKey',
24
24
  'trackable',
25
+ 'trackableRetentionPolicy',
25
26
  ]);
26
27
  exports.objectLabels = {
27
28
  accessRule: 'Access Rule',
@@ -43,5 +44,6 @@ exports.objectLabels = {
43
44
  agreement: 'Agreement',
44
45
  apiKey: 'API Key',
45
46
  trackable: 'Trackable Profile',
47
+ trackableRetentionPolicy: 'Trackable Retention Policy',
46
48
  };
47
49
  exports.objectKinds = exports.sObjectKind.options;
@@ -27,3 +27,4 @@ export * from './world-object';
27
27
  export * from './device';
28
28
  export * from './module-config';
29
29
  export * from './trackable';
30
+ export * from './trackable-retention-policy';
@@ -43,3 +43,4 @@ __exportStar(require("./world-object"), exports);
43
43
  __exportStar(require("./device"), exports);
44
44
  __exportStar(require("./module-config"), exports);
45
45
  __exportStar(require("./trackable"), exports);
46
+ __exportStar(require("./trackable-retention-policy"), exports);
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ export declare const sTrackableRetentionPolicyDto: z.ZodObject<{
3
+ id: z.ZodUUID;
4
+ objectKind: z.ZodNullable<z.ZodEnum<{
5
+ vessel: "vessel";
6
+ "base-station": "base-station";
7
+ "aid-to-navigation": "aid-to-navigation";
8
+ "sar-aircraft": "sar-aircraft";
9
+ }>>;
10
+ ttlSeconds: z.ZodNumber;
11
+ outOfDateSeconds: z.ZodNumber;
12
+ createdOn: z.ZodString;
13
+ lastModifiedOn: z.ZodString;
14
+ }, z.core.$strip>;
15
+ export type TrackableRetentionPolicyDto = z.infer<typeof sTrackableRetentionPolicyDto>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sTrackableRetentionPolicyDto = void 0;
4
+ const zod_1 = require("zod");
5
+ const trackable_1 = require("./trackable");
6
+ exports.sTrackableRetentionPolicyDto = zod_1.z.object({
7
+ id: zod_1.z.uuid(),
8
+ objectKind: trackable_1.sTrackableKind.nullable(), // null = the default policy, used by any kind without its own entry
9
+ ttlSeconds: zod_1.z.number().int().positive(), // Remove the trackable after this long without an update
10
+ outOfDateSeconds: zod_1.z.number().int().positive(), // Show the trackable as out of date (faded) after this long without an update
11
+ createdOn: zod_1.z.string(),
12
+ lastModifiedOn: zod_1.z.string(),
13
+ });
@@ -1,4 +1,10 @@
1
1
  import { z } from 'zod';
2
+ export declare const sTrackableKind: z.ZodEnum<{
3
+ vessel: "vessel";
4
+ "base-station": "base-station";
5
+ "aid-to-navigation": "aid-to-navigation";
6
+ "sar-aircraft": "sar-aircraft";
7
+ }>;
2
8
  export declare const sTrackableImageDto: z.ZodObject<{
3
9
  imageId: z.ZodUUID;
4
10
  reviewed: z.ZodBoolean;
@@ -10,7 +16,12 @@ export type TrackableImageDto = z.infer<typeof sTrackableImageDto>;
10
16
  export declare const sTrackableProfileDto: z.ZodObject<{
11
17
  id: z.ZodString;
12
18
  name: z.ZodNullable<z.ZodString>;
13
- kind: z.ZodNullable<z.ZodString>;
19
+ kind: z.ZodNullable<z.ZodEnum<{
20
+ vessel: "vessel";
21
+ "base-station": "base-station";
22
+ "aid-to-navigation": "aid-to-navigation";
23
+ "sar-aircraft": "sar-aircraft";
24
+ }>>;
14
25
  isUserFavorite: z.ZodBoolean;
15
26
  isGlobalFavorite: z.ZodBoolean;
16
27
  images: z.ZodArray<z.ZodObject<{
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sTrackableHistoryDto = exports.sTrackableProfileDto = exports.sTrackableImageDto = void 0;
3
+ exports.sTrackableHistoryDto = exports.sTrackableProfileDto = exports.sTrackableImageDto = exports.sTrackableKind = void 0;
4
4
  const zod_1 = require("zod");
5
+ exports.sTrackableKind = zod_1.z.enum([
6
+ //AIS
7
+ 'vessel',
8
+ 'base-station',
9
+ 'aid-to-navigation',
10
+ 'sar-aircraft',
11
+ ]);
5
12
  exports.sTrackableImageDto = zod_1.z.object({
6
13
  imageId: zod_1.z.uuid(),
7
14
  reviewed: zod_1.z.boolean(),
@@ -12,7 +19,7 @@ exports.sTrackableImageDto = zod_1.z.object({
12
19
  exports.sTrackableProfileDto = zod_1.z.object({
13
20
  id: zod_1.z.string(),
14
21
  name: zod_1.z.string().nullable(),
15
- kind: zod_1.z.string().nullable(),
22
+ kind: exports.sTrackableKind.nullable(),
16
23
  isUserFavorite: zod_1.z.boolean(),
17
24
  isGlobalFavorite: zod_1.z.boolean(),
18
25
  images: zod_1.z.array(exports.sTrackableImageDto),
package/dist/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/Linc-Security-Systems/aware-essentials.git"
6
6
  },
7
- "version": "2.0.141",
7
+ "version": "2.0.143",
8
8
  "description": "Common types between backend, agent(s) and frontend(s)",
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/Linc-Security-Systems/aware-essentials.git"
6
6
  },
7
- "version": "2.0.141",
7
+ "version": "2.0.143",
8
8
  "description": "Common types between backend, agent(s) and frontend(s)",
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",