@ampsec/platform-client 71.1.0 → 72.0.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.
@@ -1,6 +1,60 @@
1
- import { BaseDto, BaseUpsertDto } from './base.dto';
2
- export type TenantUpsertDto = BaseUpsertDto & {
1
+ import { z } from 'zod';
2
+ export declare const TENANT_STATUS_FLAGS: {
3
+ HAS_ETL_ERROR: number;
4
+ HAS_RECONCILIATION_ERROR: number;
5
+ HAS_FINDINGS_GENERATION_ERROR: number;
6
+ HAS_RISK_CONTRIBUTORS_ERROR: number;
7
+ HAS_REPORTING_ERROR: number;
8
+ HAS_NOTIFICATIONS_ERROR: number;
9
+ HAS_FLOWS_ERROR: number;
10
+ };
11
+ export declare const _TenantUpsertDto: z.ZodObject<z.objectUtil.extendShape<{
12
+ id: z.ZodOptional<z.ZodString>;
13
+ createdAt: z.ZodOptional<z.ZodString>;
14
+ updatedAt: z.ZodOptional<z.ZodString>;
15
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ }, {
3
17
  /** Human readable name of the tenant */
18
+ displayValue: z.ZodString;
19
+ status: z.ZodDefault<z.ZodNumber>;
20
+ }>, "strip", z.ZodTypeAny, {
21
+ status: number;
4
22
  displayValue: string;
5
- };
6
- export type TenantDto = BaseDto & TenantUpsertDto;
23
+ id?: string | undefined;
24
+ createdAt?: string | undefined;
25
+ updatedAt?: string | undefined;
26
+ deletedAt?: string | null | undefined;
27
+ }, {
28
+ displayValue: string;
29
+ status?: number | undefined;
30
+ id?: string | undefined;
31
+ createdAt?: string | undefined;
32
+ updatedAt?: string | undefined;
33
+ deletedAt?: string | null | undefined;
34
+ }>;
35
+ export type TenantUpsertDto = z.infer<typeof _TenantUpsertDto>;
36
+ export declare const _TenantDto: z.ZodObject<z.objectUtil.extendShape<{
37
+ id: z.ZodString;
38
+ createdAt: z.ZodString;
39
+ updatedAt: z.ZodString;
40
+ deletedAt: z.ZodNullable<z.ZodString>;
41
+ }, {
42
+ /** Human readable name of the tenant */
43
+ displayValue: z.ZodString;
44
+ status: z.ZodDefault<z.ZodNumber>;
45
+ }>, "strip", z.ZodTypeAny, {
46
+ status: number;
47
+ id: string;
48
+ createdAt: string;
49
+ updatedAt: string;
50
+ deletedAt: string | null;
51
+ displayValue: string;
52
+ }, {
53
+ id: string;
54
+ createdAt: string;
55
+ updatedAt: string;
56
+ deletedAt: string | null;
57
+ displayValue: string;
58
+ status?: number | undefined;
59
+ }>;
60
+ export type TenantDto = z.infer<typeof _TenantDto>;
@@ -1,3 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._TenantDto = exports._TenantUpsertDto = exports.TENANT_STATUS_FLAGS = void 0;
4
+ const base_dto_1 = require("./base.dto");
5
+ const zod_1 = require("zod");
6
+ exports.TENANT_STATUS_FLAGS = {
7
+ HAS_ETL_ERROR: 1,
8
+ HAS_RECONCILIATION_ERROR: 1 << 1,
9
+ HAS_FINDINGS_GENERATION_ERROR: 1 << 2,
10
+ HAS_RISK_CONTRIBUTORS_ERROR: 1 << 3,
11
+ HAS_REPORTING_ERROR: 1 << 4,
12
+ HAS_NOTIFICATIONS_ERROR: 1 << 5,
13
+ HAS_FLOWS_ERROR: 1 << 6,
14
+ };
15
+ const DisplayValueAndStatusSchema = zod_1.z.object({
16
+ /** Human readable name of the tenant */
17
+ displayValue: zod_1.z.string(),
18
+ status: zod_1.z.number().default(0),
19
+ });
20
+ exports._TenantUpsertDto = base_dto_1._BaseUpsertDto.extend({
21
+ ...DisplayValueAndStatusSchema.shape,
22
+ });
23
+ exports._TenantDto = base_dto_1._BaseDto.extend({
24
+ ...DisplayValueAndStatusSchema.shape,
25
+ });
3
26
  //# sourceMappingURL=tenants.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.dto.js","sourceRoot":"","sources":["../../../src/dto/tenants.dto.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"tenants.dto.js","sourceRoot":"","sources":["../../../src/dto/tenants.dto.ts"],"names":[],"mappings":";;;AAAA,yCAAoD;AACpD,6BAAsB;AAET,QAAA,mBAAmB,GAAG;IACjC,aAAa,EAAE,CAAC;IAChB,wBAAwB,EAAE,CAAC,IAAI,CAAC;IAChC,6BAA6B,EAAE,CAAC,IAAI,CAAC;IACrC,2BAA2B,EAAE,CAAC,IAAI,CAAC;IACnC,mBAAmB,EAAE,CAAC,IAAI,CAAC;IAC3B,uBAAuB,EAAE,CAAC,IAAI,CAAC;IAC/B,eAAe,EAAE,CAAC,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,wCAAwC;IACxC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,yBAAc,CAAC,MAAM,CAAC;IACpD,GAAG,2BAA2B,CAAC,KAAK;CACrC,CAAC,CAAC;AAGU,QAAA,UAAU,GAAG,mBAAQ,CAAC,MAAM,CAAC;IACxC,GAAG,2BAA2B,CAAC,KAAK;CACrC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { TenantCountReportDto, TenantDto, TenantUpsertDto } from '../../dto';
1
+ import { PlatformTenantDto, TenantCountReportDto, TenantDto, TenantUpsertDto } from '../../dto';
2
2
  import { TargetApi } from '../constants';
3
3
  import { AmpEntityServiceImpl } from '../entity.service';
4
4
  import { RestClient } from './RestClient';
@@ -6,6 +6,7 @@ import { OpsRpcResult } from '../../dto/platform/platform.ops.dto';
6
6
  export declare class TenantsService extends AmpEntityServiceImpl<TenantUpsertDto, TenantDto> {
7
7
  constructor(rest: RestClient, targetApi?: TargetApi);
8
8
  countReport(tid: string): Promise<TenantCountReportDto>;
9
+ updateStatus(tid: string, status: number): Promise<PlatformTenantDto>;
9
10
  /**
10
11
  * !!! WARNING !!! 🚨 💀 🚨 💀 🚨 💀 🚨 💀
11
12
  * This method will permanently HARD delete any soft deleted tenant data, including the tenant itsself. There is no UNDO!
@@ -18,6 +18,16 @@ class TenantsService extends entity_service_1.AmpEntityServiceImpl {
18
18
  })
19
19
  .then(res => dto_1._TenantCountReportDto.parse(res.data));
20
20
  }
21
+ updateStatus(tid, status) {
22
+ const url = `/${this.targetApi}/v1/${this.kind}/${tid}/status`;
23
+ return this.rest
24
+ .call({
25
+ url,
26
+ method: 'PUT',
27
+ data: { status },
28
+ })
29
+ .then(res => dto_1._TenantDto.parse(res.data));
30
+ }
21
31
  /**
22
32
  * !!! WARNING !!! 🚨 💀 🚨 💀 🚨 💀 🚨 💀
23
33
  * This method will permanently HARD delete any soft deleted tenant data, including the tenant itsself. There is no UNDO!
@@ -1 +1 @@
1
- {"version":3,"file":"TenantsService.js","sourceRoot":"","sources":["../../../../src/services/rest/TenantsService.ts"],"names":[],"mappings":";;;AAAA,mCAAkG;AAClG,4CAA6C;AAC7C,sDAAuD;AAEvD,0EAAgF;AAEhF,MAAa,cAAe,SAAQ,qCAAgD;IAClF,YAAY,IAAgB,EAAE,YAAuB,KAAK;QACxD,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,IAAI,GAAG,eAAe,CAAC;QACrE,OAAO,IAAI,CAAC,IAAI;aACb,IAAI,CAAC;YACJ,GAAG;YACH,MAAM,EAAE,KAAK;SACd,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,2BAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,GAAW;QACpB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,aAAa,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI;aACb,IAAI,CAAC;YACJ,GAAG;YACH,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,EAAE,EAAE,YAAY;gBAChB,KAAK,EAAE;oBACL,GAAG;iBACJ;aACF;SACF,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,gCAAa,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;OAOG;IACH,YAAY,CAAC,GAAW;QACtB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,aAAa,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI;aACb,IAAI,CAAC;YACJ,GAAG;YACH,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,EAAE,EAAE,cAAc;gBAClB,KAAK,EAAE;oBACL,GAAG;iBACJ;aACF;SACF,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,gCAAa,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;CACF;AA9DD,wCA8DC"}
1
+ {"version":3,"file":"TenantsService.js","sourceRoot":"","sources":["../../../../src/services/rest/TenantsService.ts"],"names":[],"mappings":";;;AAAA,mCAAmJ;AACnJ,4CAA6C;AAC7C,sDAAuD;AAEvD,0EAAgF;AAEhF,MAAa,cAAe,SAAQ,qCAAgD;IAClF,YAAY,IAAgB,EAAE,YAAuB,KAAK;QACxD,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,IAAI,GAAG,eAAe,CAAC;QACrE,OAAO,IAAI,CAAC,IAAI;aACb,IAAI,CAAC;YACJ,GAAG;YACH,MAAM,EAAE,KAAK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KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;CACF;AAzED,wCAyEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "71.1.0",
3
+ "version": "72.0.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -1,8 +1,28 @@
1
- import {BaseDto, BaseUpsertDto} from './base.dto';
1
+ import {_BaseDto, _BaseUpsertDto} from './base.dto';
2
+ import {z} from 'zod';
2
3
 
3
- export type TenantUpsertDto = BaseUpsertDto & {
4
- /** Human readable name of the tenant */
5
- displayValue: string;
4
+ export const TENANT_STATUS_FLAGS = {
5
+ HAS_ETL_ERROR: 1,
6
+ HAS_RECONCILIATION_ERROR: 1 << 1,
7
+ HAS_FINDINGS_GENERATION_ERROR: 1 << 2,
8
+ HAS_RISK_CONTRIBUTORS_ERROR: 1 << 3,
9
+ HAS_REPORTING_ERROR: 1 << 4,
10
+ HAS_NOTIFICATIONS_ERROR: 1 << 5,
11
+ HAS_FLOWS_ERROR: 1 << 6,
6
12
  };
7
13
 
8
- export type TenantDto = BaseDto & TenantUpsertDto;
14
+ const DisplayValueAndStatusSchema = z.object({
15
+ /** Human readable name of the tenant */
16
+ displayValue: z.string(),
17
+ status: z.number().default(0),
18
+ });
19
+
20
+ export const _TenantUpsertDto = _BaseUpsertDto.extend({
21
+ ...DisplayValueAndStatusSchema.shape,
22
+ });
23
+ export type TenantUpsertDto = z.infer<typeof _TenantUpsertDto>;
24
+
25
+ export const _TenantDto = _BaseDto.extend({
26
+ ...DisplayValueAndStatusSchema.shape,
27
+ });
28
+ export type TenantDto = z.infer<typeof _TenantDto>;
@@ -1,4 +1,4 @@
1
- import {TenantCountReportDto, TenantDto, TenantUpsertDto, _TenantCountReportDto} from '../../dto';
1
+ import {PlatformTenantDto, TenantCountReportDto, TenantDto, TenantUpsertDto, _TenantCountReportDto, _TenantDto, _TenantUpsertDto} from '../../dto';
2
2
  import {KIND, TargetApi} from '../constants';
3
3
  import {AmpEntityServiceImpl} from '../entity.service';
4
4
  import {RestClient} from './RestClient';
@@ -19,6 +19,17 @@ export class TenantsService extends AmpEntityServiceImpl<TenantUpsertDto, Tenant
19
19
  .then(res => _TenantCountReportDto.parse(res.data));
20
20
  }
21
21
 
22
+ updateStatus(tid: string, status: number): Promise<PlatformTenantDto> {
23
+ const url = `/${this.targetApi}/v1/${this.kind}/${tid}/status`;
24
+ return this.rest
25
+ .call({
26
+ url,
27
+ method: 'PUT',
28
+ data: {status},
29
+ })
30
+ .then(res => _TenantDto.parse(res.data));
31
+ }
32
+
22
33
  /**
23
34
  * !!! WARNING !!! 🚨 💀 🚨 💀 🚨 💀 🚨 💀
24
35
  * This method will permanently HARD delete any soft deleted tenant data, including the tenant itsself. There is no UNDO!