@ampsec/platform-client 58.8.0 → 58.9.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.
@@ -13,6 +13,37 @@ export declare const _SimpleAssetDto: z.ZodObject<{
13
13
  displayValue?: string | undefined;
14
14
  }>;
15
15
  export type SimpleAssetDto = z.infer<typeof _SimpleAssetDto>;
16
+ export declare const _SummaryAssetDto: z.ZodObject<{
17
+ /** Id of the asset */
18
+ id: z.ZodOptional<z.ZodString>;
19
+ uid: z.ZodOptional<z.ZodString>;
20
+ /** Human readable name of the asset */
21
+ displayValue: z.ZodOptional<z.ZodString>;
22
+ sn: z.ZodOptional<z.ZodString>;
23
+ hostname: z.ZodOptional<z.ZodString>;
24
+ lastCheckinTs: z.ZodOptional<z.ZodString>;
25
+ os: z.ZodOptional<z.ZodString>;
26
+ model: z.ZodOptional<z.ZodString>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ id?: string | undefined;
29
+ uid?: string | undefined;
30
+ displayValue?: string | undefined;
31
+ sn?: string | undefined;
32
+ hostname?: string | undefined;
33
+ lastCheckinTs?: string | undefined;
34
+ os?: string | undefined;
35
+ model?: string | undefined;
36
+ }, {
37
+ id?: string | undefined;
38
+ uid?: string | undefined;
39
+ displayValue?: string | undefined;
40
+ sn?: string | undefined;
41
+ hostname?: string | undefined;
42
+ lastCheckinTs?: string | undefined;
43
+ os?: string | undefined;
44
+ model?: string | undefined;
45
+ }>;
46
+ export type SummaryAssetDto = z.infer<typeof _SummaryAssetDto>;
16
47
  export declare const _AssetUpsertDto: z.ZodObject<{
17
48
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUndefined]>>;
18
49
  etag: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._AssetDto = exports._AssetUpsertDto = exports._SimpleAssetDto = void 0;
3
+ exports._AssetDto = exports._AssetUpsertDto = exports._SummaryAssetDto = exports._SimpleAssetDto = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const assetKeys_1 = require("./assetKeys");
6
6
  const base_dto_1 = require("./base.dto");
@@ -11,6 +11,18 @@ exports._SimpleAssetDto = zod_1.z.object({
11
11
  /** Human readable name of the asset */
12
12
  displayValue: zod_1.z.string().optional(),
13
13
  });
14
+ exports._SummaryAssetDto = zod_1.z.object({
15
+ /** Id of the asset */
16
+ id: zod_1.z.string().optional(),
17
+ uid: zod_1.z.string().optional(),
18
+ /** Human readable name of the asset */
19
+ displayValue: zod_1.z.string().optional(),
20
+ sn: zod_1.z.string().optional(),
21
+ hostname: zod_1.z.string().optional(),
22
+ lastCheckinTs: zod_1.z.string().optional(),
23
+ os: zod_1.z.string().optional(),
24
+ model: zod_1.z.string().optional(),
25
+ });
14
26
  exports._AssetUpsertDto = base_dto_1._ChangeAwareUpsertDto.merge(zod_1.z.object({
15
27
  /** External Keys */
16
28
  extKeys: assetKeys_1._AssetKeys,
@@ -1 +1 @@
1
- {"version":3,"file":"assets.dto.js","sourceRoot":"","sources":["../../../src/dto/assets.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,2CAAuC;AACvC,yCAAkE;AAClE,+DAAyD;AAE5C,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,sBAAsB;IACtB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,uCAAuC;IACvC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAIU,QAAA,eAAe,GAAG,gCAAqB,CAAC,KAAK,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,oBAAoB;IACpB,OAAO,EAAE,sBAAU;IACnB,0BAA0B;IAC1B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,iCAAiC;IACjC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,iBAA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U;IACnB,0BAA0B;IAC1B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,iCAAiC;IACjC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,iBAAiB;IACjB,SAAS,EAAE,OAAC,CAAC,UAAU,CAAC,kCAAe,CAAC,CAAC,QAAQ,EAAE;CACpD,CAAC,CACH,CAAC;AAIW,QAAA,SAAS,GAAG,uBAAe,CAAC,KAAK,CAAC,0BAAe,CAAC,CAAC"}
@@ -1,4 +1,36 @@
1
1
  import { z } from 'zod';
2
+ export declare const _AssetCoverageSummary: z.ZodObject<{
3
+ id: z.ZodOptional<z.ZodString>;
4
+ uid: z.ZodOptional<z.ZodString>;
5
+ sn: z.ZodOptional<z.ZodString>;
6
+ displayValue: z.ZodOptional<z.ZodString>;
7
+ hostname: z.ZodOptional<z.ZodString>;
8
+ lastCheckinTs: z.ZodOptional<z.ZodString>;
9
+ os: z.ZodOptional<z.ZodString>;
10
+ model: z.ZodOptional<z.ZodString>;
11
+ assetAccounts: z.ZodRecord<z.ZodString, z.ZodUnknown>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ assetAccounts: Record<string, unknown>;
14
+ id?: string | undefined;
15
+ uid?: string | undefined;
16
+ sn?: string | undefined;
17
+ displayValue?: string | undefined;
18
+ hostname?: string | undefined;
19
+ lastCheckinTs?: string | undefined;
20
+ os?: string | undefined;
21
+ model?: string | undefined;
22
+ }, {
23
+ assetAccounts: Record<string, unknown>;
24
+ id?: string | undefined;
25
+ uid?: string | undefined;
26
+ sn?: string | undefined;
27
+ displayValue?: string | undefined;
28
+ hostname?: string | undefined;
29
+ lastCheckinTs?: string | undefined;
30
+ os?: string | undefined;
31
+ model?: string | undefined;
32
+ }>;
33
+ export type AssetCoverageSummary = z.infer<typeof _AssetCoverageSummary>;
2
34
  export declare const _UserCoverageSummary: z.ZodObject<{
3
35
  id: z.ZodOptional<z.ZodString>;
4
36
  organization: z.ZodOptional<z.ZodString>;
@@ -7,12 +39,57 @@ export declare const _UserCoverageSummary: z.ZodObject<{
7
39
  score: z.ZodOptional<z.ZodNumber>;
8
40
  firstName: z.ZodOptional<z.ZodString>;
9
41
  lastName: z.ZodOptional<z.ZodString>;
42
+ active: z.ZodOptional<z.ZodBoolean>;
43
+ lastActivity: z.ZodOptional<z.ZodString>;
10
44
  name: z.ZodOptional<z.ZodString>;
45
+ notifications: z.ZodOptional<z.ZodNumber>;
11
46
  userAccounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
12
47
  assetAccounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
48
+ assets: z.ZodArray<z.ZodObject<{
49
+ id: z.ZodOptional<z.ZodString>;
50
+ uid: z.ZodOptional<z.ZodString>;
51
+ sn: z.ZodOptional<z.ZodString>;
52
+ displayValue: z.ZodOptional<z.ZodString>;
53
+ hostname: z.ZodOptional<z.ZodString>;
54
+ lastCheckinTs: z.ZodOptional<z.ZodString>;
55
+ os: z.ZodOptional<z.ZodString>;
56
+ model: z.ZodOptional<z.ZodString>;
57
+ assetAccounts: z.ZodRecord<z.ZodString, z.ZodUnknown>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ assetAccounts: Record<string, unknown>;
60
+ id?: string | undefined;
61
+ uid?: string | undefined;
62
+ sn?: string | undefined;
63
+ displayValue?: string | undefined;
64
+ hostname?: string | undefined;
65
+ lastCheckinTs?: string | undefined;
66
+ os?: string | undefined;
67
+ model?: string | undefined;
68
+ }, {
69
+ assetAccounts: Record<string, unknown>;
70
+ id?: string | undefined;
71
+ uid?: string | undefined;
72
+ sn?: string | undefined;
73
+ displayValue?: string | undefined;
74
+ hostname?: string | undefined;
75
+ lastCheckinTs?: string | undefined;
76
+ os?: string | undefined;
77
+ model?: string | undefined;
78
+ }>, "many">;
13
79
  }, "strip", z.ZodTypeAny, {
14
- userAccounts: Record<string, number>;
15
80
  assetAccounts: Record<string, number>;
81
+ userAccounts: Record<string, number>;
82
+ assets: {
83
+ assetAccounts: Record<string, unknown>;
84
+ id?: string | undefined;
85
+ uid?: string | undefined;
86
+ sn?: string | undefined;
87
+ displayValue?: string | undefined;
88
+ hostname?: string | undefined;
89
+ lastCheckinTs?: string | undefined;
90
+ os?: string | undefined;
91
+ model?: string | undefined;
92
+ }[];
16
93
  id?: string | undefined;
17
94
  organization?: string | undefined;
18
95
  department?: string | undefined;
@@ -20,10 +97,24 @@ export declare const _UserCoverageSummary: z.ZodObject<{
20
97
  score?: number | undefined;
21
98
  firstName?: string | undefined;
22
99
  lastName?: string | undefined;
100
+ active?: boolean | undefined;
101
+ lastActivity?: string | undefined;
23
102
  name?: string | undefined;
103
+ notifications?: number | undefined;
24
104
  }, {
25
- userAccounts: Record<string, number>;
26
105
  assetAccounts: Record<string, number>;
106
+ userAccounts: Record<string, number>;
107
+ assets: {
108
+ assetAccounts: Record<string, unknown>;
109
+ id?: string | undefined;
110
+ uid?: string | undefined;
111
+ sn?: string | undefined;
112
+ displayValue?: string | undefined;
113
+ hostname?: string | undefined;
114
+ lastCheckinTs?: string | undefined;
115
+ os?: string | undefined;
116
+ model?: string | undefined;
117
+ }[];
27
118
  id?: string | undefined;
28
119
  organization?: string | undefined;
29
120
  department?: string | undefined;
@@ -31,7 +122,10 @@ export declare const _UserCoverageSummary: z.ZodObject<{
31
122
  score?: number | undefined;
32
123
  firstName?: string | undefined;
33
124
  lastName?: string | undefined;
125
+ active?: boolean | undefined;
126
+ lastActivity?: string | undefined;
34
127
  name?: string | undefined;
128
+ notifications?: number | undefined;
35
129
  }>;
36
130
  export type UserCoverageSummary = z.infer<typeof _UserCoverageSummary>;
37
131
  export declare const _UserCoverageReport: z.ZodObject<{
@@ -42,6 +136,8 @@ export declare const _UserCoverageReport: z.ZodObject<{
42
136
  score: z.ZodOptional<z.ZodNumber>;
43
137
  firstName: z.ZodOptional<z.ZodString>;
44
138
  lastName: z.ZodOptional<z.ZodString>;
139
+ active: z.ZodOptional<z.ZodBoolean>;
140
+ lastActivity: z.ZodOptional<z.ZodString>;
45
141
  userAccounts: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
46
142
  cid: z.ZodString;
47
143
  uid: z.ZodString;
@@ -185,18 +281,6 @@ export declare const _UserCoverageReport: z.ZodObject<{
185
281
  assetType?: import("./enums").GlobalAssetType | undefined;
186
282
  }>, "many">;
187
283
  }, "strip", z.ZodTypeAny, {
188
- userAccounts: Record<string, {
189
- id: string;
190
- cid: string;
191
- uid: string;
192
- createdAt: string;
193
- updatedAt: string;
194
- deletedAt: string | null;
195
- email: string;
196
- etag: string;
197
- extId: string;
198
- meta?: unknown;
199
- }[]>;
200
284
  assetAccounts: Record<string, {
201
285
  id: string;
202
286
  cid: string;
@@ -214,6 +298,18 @@ export declare const _UserCoverageReport: z.ZodObject<{
214
298
  uid?: string | undefined;
215
299
  meta?: unknown;
216
300
  }[]>;
301
+ userAccounts: Record<string, {
302
+ id: string;
303
+ cid: string;
304
+ uid: string;
305
+ createdAt: string;
306
+ updatedAt: string;
307
+ deletedAt: string | null;
308
+ email: string;
309
+ etag: string;
310
+ extId: string;
311
+ meta?: unknown;
312
+ }[]>;
217
313
  assets: {
218
314
  id: string;
219
315
  createdAt: string;
@@ -236,19 +332,9 @@ export declare const _UserCoverageReport: z.ZodObject<{
236
332
  score?: number | undefined;
237
333
  firstName?: string | undefined;
238
334
  lastName?: string | undefined;
335
+ active?: boolean | undefined;
336
+ lastActivity?: string | undefined;
239
337
  }, {
240
- userAccounts: Record<string, {
241
- id: string;
242
- cid: string;
243
- uid: string;
244
- createdAt: string;
245
- updatedAt: string;
246
- deletedAt: string | null;
247
- email: string;
248
- etag: string;
249
- extId: string;
250
- meta?: unknown;
251
- }[]>;
252
338
  assetAccounts: Record<string, {
253
339
  id: string;
254
340
  cid: string;
@@ -266,6 +352,18 @@ export declare const _UserCoverageReport: z.ZodObject<{
266
352
  uid?: string | undefined;
267
353
  meta?: unknown;
268
354
  }[]>;
355
+ userAccounts: Record<string, {
356
+ id: string;
357
+ cid: string;
358
+ uid: string;
359
+ createdAt: string;
360
+ updatedAt: string;
361
+ deletedAt: string | null;
362
+ email: string;
363
+ etag: string;
364
+ extId: string;
365
+ meta?: unknown;
366
+ }[]>;
269
367
  assets: {
270
368
  id: string;
271
369
  createdAt: string;
@@ -288,5 +386,7 @@ export declare const _UserCoverageReport: z.ZodObject<{
288
386
  score?: number | undefined;
289
387
  firstName?: string | undefined;
290
388
  lastName?: string | undefined;
389
+ active?: boolean | undefined;
390
+ lastActivity?: string | undefined;
291
391
  }>;
292
392
  export type UserCoverageReport = z.infer<typeof _UserCoverageReport>;
@@ -1,15 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._UserCoverageReport = exports._UserCoverageSummary = void 0;
3
+ exports._UserCoverageReport = exports._UserCoverageSummary = exports._AssetCoverageSummary = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const assets_dto_1 = require("./assets.dto");
6
6
  const saasAssets_dto_1 = require("./saasAssets.dto");
7
7
  const saasUsers_dto_1 = require("./saasUsers.dto");
8
8
  const users_dto_1 = require("./users.dto");
9
+ exports._AssetCoverageSummary = assets_dto_1._SummaryAssetDto.merge(zod_1.z.object({
10
+ assetAccounts: zod_1.z.record(zod_1.z.unknown()),
11
+ }));
9
12
  exports._UserCoverageSummary = users_dto_1._SimpleUserDto.merge(zod_1.z.object({
10
13
  name: zod_1.z.string().optional(),
14
+ notifications: zod_1.z.number().optional(),
11
15
  userAccounts: zod_1.z.record(zod_1.z.number()),
16
+ /** @deprecated */
12
17
  assetAccounts: zod_1.z.record(zod_1.z.number()),
18
+ assets: zod_1.z.array(exports._AssetCoverageSummary),
13
19
  }));
14
20
  exports._UserCoverageReport = users_dto_1._SimpleUserDto.merge(zod_1.z.object({
15
21
  userAccounts: zod_1.z.record(zod_1.z.array(saasUsers_dto_1._SaasUserDto)),
@@ -1 +1 @@
1
- {"version":3,"file":"coverage.dto.js","sourceRoot":"","sources":["../../../src/dto/coverage.dto.ts"],"names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AAC,QAAQ,EAAE;IACpC,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IAClC,kBAAkB;IAClB,aAAa,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IACnC,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,6BAAqB,CAAC;CACvC,CAAC,CACH,CAAC;AAGW,QAAA,mBAAmB,GAAG,0BAAc,CAAC,KAAK,CACrD,OAAC,CAAC,MAAM,CAAC;IACP,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,4BAAY,CAAC,CAAC;IAC7C,aAAa,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,8BAAa,CAAC,CAAC;IAC/C,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,sBAAS,CAAC;CAC3B,CAAC,CACH,CAAC"}
@@ -10,6 +10,10 @@ export declare const _SimpleUserDto: z.ZodObject<{
10
10
  email: z.ZodOptional<z.ZodString>;
11
11
  organization: z.ZodOptional<z.ZodString>;
12
12
  department: z.ZodOptional<z.ZodString>;
13
+ /** Derived */
14
+ active: z.ZodOptional<z.ZodBoolean>;
15
+ /** TODO Does not exist in DB yet but DTO placeholder */
16
+ lastActivity: z.ZodOptional<z.ZodString>;
13
17
  }, "strip", z.ZodTypeAny, {
14
18
  id?: string | undefined;
15
19
  score?: number | undefined;
@@ -18,6 +22,8 @@ export declare const _SimpleUserDto: z.ZodObject<{
18
22
  email?: string | undefined;
19
23
  organization?: string | undefined;
20
24
  department?: string | undefined;
25
+ active?: boolean | undefined;
26
+ lastActivity?: string | undefined;
21
27
  }, {
22
28
  id?: string | undefined;
23
29
  score?: number | undefined;
@@ -26,6 +32,8 @@ export declare const _SimpleUserDto: z.ZodObject<{
26
32
  email?: string | undefined;
27
33
  organization?: string | undefined;
28
34
  department?: string | undefined;
35
+ active?: boolean | undefined;
36
+ lastActivity?: string | undefined;
29
37
  }>;
30
38
  export type SimpleUserDto = z.infer<typeof _SimpleUserDto>;
31
39
  export type UserUpsertDto = ChangeAwareUpsertDto & {
@@ -10,5 +10,9 @@ exports._SimpleUserDto = zod_1.z.object({
10
10
  email: zod_1.z.string().optional(),
11
11
  organization: zod_1.z.string().optional(),
12
12
  department: zod_1.z.string().optional(),
13
+ /** Derived */
14
+ active: zod_1.z.boolean().optional(),
15
+ /** TODO Does not exist in DB yet but DTO placeholder */
16
+ lastActivity: zod_1.z.string().optional(),
13
17
  });
14
18
  //# sourceMappingURL=users.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"users.dto.js","sourceRoot":"","sources":["../../../src/dto/users.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAKT,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
1
+ {"version":3,"file":"users.dto.js","sourceRoot":"","sources":["../../../src/dto/users.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAKT,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,cAAc;IACd,MAAM,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B,wDAAwD;IACxD,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC"}
@@ -1 +1,10 @@
1
1
  export declare function formatMacAddress(raw: string): string;
2
+ export type AssetDisplayValueMeta = {
3
+ name: string;
4
+ MDL?: string;
5
+ OS?: string;
6
+ SN?: string;
7
+ MAC?: string;
8
+ HNAME?: string;
9
+ };
10
+ export declare function parseAssetDisplayValue(displayValue: string): AssetDisplayValueMeta;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatMacAddress = void 0;
6
+ exports.parseAssetDisplayValue = exports.formatMacAddress = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  function formatMacAddress(raw) {
9
9
  const lower = raw.toLowerCase().replace(/[^a-f0-9]/g, '');
@@ -12,4 +12,32 @@ function formatMacAddress(raw) {
12
12
  .join(':');
13
13
  }
14
14
  exports.formatMacAddress = formatMacAddress;
15
+ function parseAssetDisplayValue(displayValue) {
16
+ const asHostname = (s) => (/^[\w.-]+$/g.test(s.trim()) ? s.trim() : undefined);
17
+ const i = displayValue.indexOf('(');
18
+ if (i < 0)
19
+ return { name: displayValue.trim(), HNAME: asHostname(displayValue.trim()) };
20
+ const name = displayValue.substring(0, i).trim();
21
+ const meta = { name };
22
+ const HNAME = asHostname(name);
23
+ if (HNAME)
24
+ meta.HNAME = HNAME;
25
+ const kv = displayValue.substring(i + 1, displayValue.length - 1);
26
+ const values = kv
27
+ .split(/,?[A-Z]+:/g)
28
+ .map(s => s.replace('null', '').trim())
29
+ .filter(v => v.trim().length > 0);
30
+ const keys = [];
31
+ const KEY_PATTERN = /,?([A-Z]+):/g;
32
+ let result;
33
+ while ((result = KEY_PATTERN.exec(kv))) {
34
+ keys.push(result[1]);
35
+ }
36
+ for (let i = 0; i < values.length; i++) {
37
+ const key = keys[i];
38
+ meta[key] = values[i];
39
+ }
40
+ return meta;
41
+ }
42
+ exports.parseAssetDisplayValue = parseAssetDisplayValue;
15
43
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/services/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC1D,OAAO,gBAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC/B,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC5B,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AALD,4CAKC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/services/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC1D,OAAO,gB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AM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,EAAc,CAAC;IAC5B,MAAM,WAAW,GAAG,cAAc,CAAC;IACnC,IAAI,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAW,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,IAA6B,CAAC;AACvC,CAAC;AAxBD,wDAwBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "58.8.0",
3
+ "version": "58.9.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -12,6 +12,20 @@ export const _SimpleAssetDto = z.object({
12
12
 
13
13
  export type SimpleAssetDto = z.infer<typeof _SimpleAssetDto>;
14
14
 
15
+ export const _SummaryAssetDto = z.object({
16
+ /** Id of the asset */
17
+ id: z.string().optional(),
18
+ uid: z.string().optional(),
19
+ /** Human readable name of the asset */
20
+ displayValue: z.string().optional(),
21
+ sn: z.string().optional(),
22
+ hostname: z.string().optional(),
23
+ lastCheckinTs: z.string().optional(),
24
+ os: z.string().optional(),
25
+ model: z.string().optional(),
26
+ });
27
+ export type SummaryAssetDto = z.infer<typeof _SummaryAssetDto>;
28
+
15
29
  export const _AssetUpsertDto = _ChangeAwareUpsertDto.merge(
16
30
  z.object({
17
31
  /** External Keys */
@@ -1,17 +1,26 @@
1
1
  import {z} from 'zod';
2
- import {_AssetDto} from './assets.dto';
2
+ import {_AssetDto, _SummaryAssetDto} from './assets.dto';
3
3
  import {_SaasAssetDto} from './saasAssets.dto';
4
4
  import {_SaasUserDto} from './saasUsers.dto';
5
5
  import {_SimpleUserDto} from './users.dto';
6
6
 
7
+ export const _AssetCoverageSummary = _SummaryAssetDto.merge(
8
+ z.object({
9
+ assetAccounts: z.record(z.unknown()),
10
+ })
11
+ );
12
+ export type AssetCoverageSummary = z.infer<typeof _AssetCoverageSummary>;
13
+
7
14
  export const _UserCoverageSummary = _SimpleUserDto.merge(
8
15
  z.object({
9
16
  name: z.string().optional(),
17
+ notifications: z.number().optional(),
10
18
  userAccounts: z.record(z.number()),
19
+ /** @deprecated */
11
20
  assetAccounts: z.record(z.number()),
21
+ assets: z.array(_AssetCoverageSummary),
12
22
  })
13
23
  );
14
-
15
24
  export type UserCoverageSummary = z.infer<typeof _UserCoverageSummary>;
16
25
 
17
26
  export const _UserCoverageReport = _SimpleUserDto.merge(
@@ -11,6 +11,10 @@ export const _SimpleUserDto = z.object({
11
11
  email: z.string().optional(),
12
12
  organization: z.string().optional(),
13
13
  department: z.string().optional(),
14
+ /** Derived */
15
+ active: z.boolean().optional(),
16
+ /** TODO Does not exist in DB yet but DTO placeholder */
17
+ lastActivity: z.string().optional(),
14
18
  });
15
19
 
16
20
  export type SimpleUserDto = z.infer<typeof _SimpleUserDto>;
@@ -6,3 +6,38 @@ export function formatMacAddress(raw: string): string {
6
6
  .map(chunk => chunk.join(''))
7
7
  .join(':');
8
8
  }
9
+
10
+ export type AssetDisplayValueMeta = {
11
+ name: string;
12
+ MDL?: string;
13
+ OS?: string;
14
+ SN?: string;
15
+ MAC?: string;
16
+ HNAME?: string;
17
+ };
18
+
19
+ export function parseAssetDisplayValue(displayValue: string): AssetDisplayValueMeta {
20
+ const asHostname = (s: string) => (/^[\w.-]+$/g.test(s.trim()) ? s.trim() : undefined);
21
+ const i = displayValue.indexOf('(');
22
+ if (i < 0) return {name: displayValue.trim(), HNAME: asHostname(displayValue.trim())};
23
+ const name = displayValue.substring(0, i).trim();
24
+ const meta: Record<string, string> = {name};
25
+ const HNAME = asHostname(name);
26
+ if (HNAME) meta.HNAME = HNAME;
27
+ const kv = displayValue.substring(i + 1, displayValue.length - 1);
28
+ const values = kv
29
+ .split(/,?[A-Z]+:/g)
30
+ .map(s => s.replace('null', '').trim())
31
+ .filter(v => v.trim().length > 0);
32
+ const keys = [] as string[];
33
+ const KEY_PATTERN = /,?([A-Z]+):/g;
34
+ let result;
35
+ while ((result = KEY_PATTERN.exec(kv))) {
36
+ keys.push(result[1]);
37
+ }
38
+ for (let i = 0; i < values.length; i++) {
39
+ const key = keys[i] as string;
40
+ meta[key] = values[i];
41
+ }
42
+ return meta as AssetDisplayValueMeta;
43
+ }