Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guardian analytics: labels and top down data way points #4523

Merged
merged 93 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 90 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
54cd3a1
update
Stepan-Kirjakov Nov 7, 2024
45e7a5b
[skip ci] Add swagger.yaml
envision-ci-agent Nov 7, 2024
5e25752
update
Stepan-Kirjakov Nov 11, 2024
788e520
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Nov 11, 2024
6b519ec
[skip ci] Add swagger.yaml
envision-ci-agent Nov 11, 2024
3b4f25c
fix
Stepan-Kirjakov Nov 12, 2024
2dd9b2f
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Nov 12, 2024
f3a6049
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 12, 2024
d594ee2
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 12, 2024
93fe0a3
fix
Stepan-Kirjakov Nov 12, 2024
49f1f57
update
Stepan-Kirjakov Nov 12, 2024
1230fe8
update
Stepan-Kirjakov Nov 13, 2024
55e610f
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 14, 2024
889f07e
update
Stepan-Kirjakov Nov 14, 2024
38322bc
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 14, 2024
2e857f7
update
Stepan-Kirjakov Nov 15, 2024
3737790
update
Stepan-Kirjakov Nov 18, 2024
ea7dc4f
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 18, 2024
89897ea
update
Stepan-Kirjakov Nov 19, 2024
b00d333
[skip ci] Add swagger.yaml
envision-ci-agent Nov 19, 2024
5889d96
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 20, 2024
b91c7e9
update
Stepan-Kirjakov Nov 20, 2024
a25016f
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 20, 2024
132c14c
update
Stepan-Kirjakov Nov 21, 2024
a1bdae0
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 21, 2024
6a5e249
[skip ci] Add swagger.yaml
envision-ci-agent Nov 21, 2024
58ef77c
fix
Stepan-Kirjakov Nov 22, 2024
94d216e
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Nov 22, 2024
9ee63d6
update
Stepan-Kirjakov Nov 22, 2024
8cb241d
fix
Stepan-Kirjakov Nov 22, 2024
b4d8230
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 27, 2024
52065e6
update
Stepan-Kirjakov Nov 27, 2024
acc5d3f
fix
Stepan-Kirjakov Nov 27, 2024
bcc1114
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Nov 27, 2024
45f05da
[skip ci] Add swagger.yaml
envision-ci-agent Nov 27, 2024
415cc2a
update
Stepan-Kirjakov Nov 28, 2024
b50d157
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Nov 28, 2024
ec2104b
update
Stepan-Kirjakov Nov 29, 2024
120509b
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Dec 2, 2024
c638a5f
update
Stepan-Kirjakov Dec 2, 2024
13083cf
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Dec 3, 2024
eb0cc45
update
Stepan-Kirjakov Dec 4, 2024
408ee8b
update
Stepan-Kirjakov Dec 6, 2024
efc8485
update
Stepan-Kirjakov Dec 10, 2024
06b6b6f
update
Stepan-Kirjakov Dec 11, 2024
db77163
update
Stepan-Kirjakov Dec 13, 2024
29b86d5
[skip ci] Add swagger.yaml
envision-ci-agent Dec 13, 2024
b5aa60d
update
Stepan-Kirjakov Dec 16, 2024
d019e63
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 16, 2024
9bb2c76
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Dec 16, 2024
81b460f
[skip ci] Add swagger.yaml
envision-ci-agent Dec 16, 2024
4964551
update
Stepan-Kirjakov Dec 17, 2024
de85e5b
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Dec 17, 2024
3fe2026
[skip ci] Add swagger.yaml
envision-ci-agent Dec 17, 2024
33e5e10
update
Stepan-Kirjakov Dec 18, 2024
c79e0c4
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 18, 2024
63df3fa
fix
Stepan-Kirjakov Dec 18, 2024
d312bae
update
Stepan-Kirjakov Dec 19, 2024
d7382fb
fix
Stepan-Kirjakov Dec 19, 2024
db435c4
update
Stepan-Kirjakov Dec 20, 2024
d64aaa1
[skip ci] Add swagger.yaml
envision-ci-agent Dec 20, 2024
2dba571
update
Stepan-Kirjakov Dec 20, 2024
c6be596
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 20, 2024
9884f20
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Dec 20, 2024
b3790ec
update
Stepan-Kirjakov Dec 23, 2024
275cd37
[skip ci] Add swagger.yaml
envision-ci-agent Dec 23, 2024
b914e52
fix
Stepan-Kirjakov Dec 23, 2024
9d12b7a
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 23, 2024
d454fe2
fix
Stepan-Kirjakov Dec 23, 2024
af17c97
update
Stepan-Kirjakov Dec 24, 2024
613c62b
[skip ci] Add swagger.yaml
envision-ci-agent Dec 24, 2024
e06092d
update
Stepan-Kirjakov Dec 25, 2024
56c8705
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 25, 2024
3450fe9
[skip ci] Add swagger.yaml
envision-ci-agent Dec 25, 2024
96587eb
update
Stepan-Kirjakov Dec 26, 2024
6ac0287
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 26, 2024
ca4fd4d
[skip ci] Add swagger.yaml
envision-ci-agent Dec 26, 2024
245f4aa
update
Stepan-Kirjakov Dec 26, 2024
d1ed29c
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 26, 2024
2db8b7c
[skip ci] Add swagger.yaml
envision-ci-agent Dec 26, 2024
bd2a0ea
update
Stepan-Kirjakov Dec 27, 2024
bde527c
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 27, 2024
53be341
update
Stepan-Kirjakov Dec 27, 2024
0b6d7ff
Merge branch 'develop' into feature/4322
Stepan-Kirjakov Dec 27, 2024
e52a3b7
fix
Stepan-Kirjakov Dec 27, 2024
f8c8ca8
[skip ci] Add swagger.yaml
envision-ci-agent Dec 27, 2024
106533d
fix
Stepan-Kirjakov Dec 27, 2024
95e30be
Merge branch 'feature/4322' of github.com:hashgraph/guardian into fea…
Stepan-Kirjakov Dec 27, 2024
74e3751
fix
Stepan-Kirjakov Dec 30, 2024
9d42d7e
fix
Stepan-Kirjakov Dec 30, 2024
6b30bc4
fix
Stepan-Kirjakov Dec 30, 2024
4793d46
fix
Stepan-Kirjakov Dec 30, 2024
7d8fe0b
fix
Stepan-Kirjakov Dec 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
872 changes: 872 additions & 0 deletions api-gateway/src/api/service/policy-labels.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions api-gateway/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { WorkerTasksController } from './api/service/worker-tasks.js';
import { PolicyStatisticsApi } from './api/service/policy-statistics.js';
import { SchemaRulesApi } from './api/service/schema-rules.js';
import { loggerMongoProvider, pinoLoggerProvider } from './helpers/providers/index.js';
import { PolicyLabelsApi } from './api/service/policy-labels.js';

// const JSON_REQUEST_LIMIT = process.env.JSON_REQUEST_LIMIT || '1mb';
// const RAW_REQUEST_LIMIT = process.env.RAW_REQUEST_LIMIT || '1gb';
Expand Down Expand Up @@ -96,6 +97,7 @@ import { loggerMongoProvider, pinoLoggerProvider } from './helpers/providers/ind
PermissionsApi,
PolicyStatisticsApi,
SchemaRulesApi,
PolicyLabelsApi,
WorkerTasksController
],
providers: [
Expand Down
259 changes: 258 additions & 1 deletion api-gateway/src/helpers/guardians.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ import {
StatisticDefinitionRelationshipsDTO,
SchemaRuleDTO,
SchemaRuleRelationshipsDTO,
SchemaRuleDataDTO
SchemaRuleDataDTO,
PolicyLabelDTO,
PolicyLabelDocumentDTO,
PolicyLabelRelationshipsDTO,
PolicyLabelDocumentRelationshipsDTO,
PolicyLabelComponentsDTO,
PolicyLabelFiltersDTO
} from '#middlewares';

/**
Expand Down Expand Up @@ -3197,4 +3203,255 @@ export class Guardians extends NatsService {
public async previewSchemaRule(zip: any, owner: IOwner) {
return await this.sendMessage(MessageAPI.PREVIEW_SCHEMA_RULE_FILE, { zip, owner });
}

/**
* Create policy label
*
* @param label
* @param owner
* @returns policy label
*/
public async createPolicyLabel(label: PolicyLabelDTO, owner: IOwner): Promise<PolicyLabelDTO> {
return await this.sendMessage(MessageAPI.CREATE_POLICY_LABEL, { label, owner });
}

/**
* Return policy labels
*
* @param filters
* @param owner
*
* @returns {ResponseAndCount<PolicyLabelDTO>}
*/
public async getPolicyLabels(filters: IFilter, owner: IOwner): Promise<ResponseAndCount<PolicyLabelDTO>> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABELS, { filters, owner });
}

/**
* Get policy label
*
* @param definitionId
* @param owner
* @returns Operation Success
*/
public async getPolicyLabelById(definitionId: string, owner: IOwner): Promise<PolicyLabelDTO> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABEL, { definitionId, owner });
}

/**
* Get relationships
*
* @param definitionId
* @param owner
*
* @returns Relationships
*/
public async getPolicyLabelRelationships(definitionId: string, owner: IOwner): Promise<PolicyLabelRelationshipsDTO> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABEL_RELATIONSHIPS, { definitionId, owner });
}

/**
* Update policy label
*
* @param definitionId
* @param label
* @param owner
*
* @returns theme
*/
public async updatePolicyLabel(
definitionId: string,
label: PolicyLabelDTO,
owner: IOwner
): Promise<PolicyLabelDTO> {
return await this.sendMessage(MessageAPI.UPDATE_POLICY_LABEL, { definitionId, label, owner });
}

/**
* Delete policy label
*
* @param definitionId
* @param owner
*
* @returns Operation Success
*/
public async deletePolicyLabel(definitionId: string, owner: IOwner): Promise<boolean> {
return await this.sendMessage(MessageAPI.DELETE_POLICY_LABEL, { definitionId, owner });
}

/**
* Publish policy label
*
* @param definitionId
* @param owner
*
* @returns Operation Success
*/
public async publishPolicyLabel(definitionId: string, owner: IOwner): Promise<PolicyLabelDTO> {
return await this.sendMessage(MessageAPI.PUBLISH_POLICY_LABEL, { definitionId, owner });
}

/**
* Async publish policy
* @param definitionId
* @param owner
* @param task
*/
public async publishPolicyLabelAsync(
definitionId: string,
owner: IOwner,
task: NewTask
): Promise<NewTask> {
return await this.sendMessage(MessageAPI.PUBLISH_POLICY_LABEL_ASYNC, { definitionId, owner, task });
}

/**
* Load policy label file for import
* @param zip
* @param owner
*/
public async importPolicyLabel(zip: any, policyId: string, owner: IOwner): Promise<any> {
return await this.sendMessage(MessageAPI.IMPORT_POLICY_LABEL_FILE, { zip, policyId, owner });
}

/**
* Get policy label export file
* @param definitionId
* @param owner
*/
public async exportPolicyLabel(definitionId: string, owner: IOwner) {
const file = await this.sendMessage(MessageAPI.EXPORT_POLICY_LABEL_FILE, { definitionId, owner }) as any;
return Buffer.from(file, 'base64');
}

/**
* Get policy label info from file
* @param zip
* @param owner
*/
public async previewPolicyLabel(zip: any, owner: IOwner): Promise<PolicyLabelDTO> {
return await this.sendMessage(MessageAPI.PREVIEW_POLICY_LABEL_FILE, { zip, owner });
}

/**
* Search labels and statistics
* @param options
* @param owner
*/
public async searchComponents(
options: PolicyLabelFiltersDTO,
owner: IOwner
): Promise<PolicyLabelComponentsDTO> {
return await this.sendMessage(MessageAPI.SEARCH_POLICY_LABEL_COMPONENTS, { options, owner });
}

/**
* Return documents
*
* @param definitionId
* @param owner
* @param pageIndex
* @param pageSize
*
* @returns {ResponseAndCount<any>}
*/
public async getPolicyLabelTokens(
definitionId: string,
owner: IOwner,
pageIndex?: number,
pageSize?: number
): Promise<ResponseAndCount<any>> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABEL_TOKENS, { definitionId, owner, pageIndex, pageSize });
}

/**
* Return documents
*
* @param documentId
* @param definitionId
* @param owner
*
* @returns {any}
*/
public async getPolicyLabelTokenDocuments(
documentId: string,
definitionId: string,
owner: IOwner,
): Promise<any> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABEL_TOKEN_DOCUMENTS, { documentId, definitionId, owner });
}

/**
* Create label document
*
* @param definitionId
* @param data
* @param owner
*
* @returns report
*/
public async createLabelDocument(
definitionId: string,
data: PolicyLabelDocumentDTO,
owner: IOwner
): Promise<PolicyLabelDocumentDTO> {
return await this.sendMessage(MessageAPI.CREATE_POLICY_LABEL_DOCUMENT, { definitionId, data, owner });
}

/**
* Return label documents
*
* @param definitionId
* @param filters
* @param owner
*
* @returns {ResponseAndCount<PolicyLabelDocumentDTO>}
*/
public async getLabelDocuments(
definitionId: string,
filters: IFilter,
owner: IOwner
): Promise<ResponseAndCount<PolicyLabelDocumentDTO>> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABEL_DOCUMENTS,
{ definitionId, filters, owner }
);
}

/**
* Get label document
*
* @param definitionId
* @param documentId
* @param owner
*
* @returns Operation Success
*/
public async getLabelDocument(
definitionId: string,
documentId: string,
owner: IOwner
): Promise<PolicyLabelDocumentDTO> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABEL_DOCUMENT,
{ definitionId, documentId, owner }
);
}

/**
* Get statistic assessment relationships
*
* @param definitionId
* @param documentId
* @param owner
*
* @returns Operation Success
*/
public async getLabelDocumentRelationships(
definitionId: string,
documentId: string,
owner: IOwner
): Promise<PolicyLabelDocumentRelationshipsDTO> {
return await this.sendMessage(MessageAPI.GET_POLICY_LABEL_DOCUMENT_RELATIONSHIPS,
{ definitionId, documentId, owner }
);
}
}
3 changes: 2 additions & 1 deletion api-gateway/src/helpers/task-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export class TaskManager {
[TaskAction.CREATE_TOOL, 8],
[TaskAction.IMPORT_TOOL_FILE, 9],
[TaskAction.IMPORT_TOOL_MESSAGE, 11],
[TaskAction.MIGRATE_DATA, 4]
[TaskAction.MIGRATE_DATA, 4],
[TaskAction.PUBLISH_POLICY_LABEL, 4]
]);

/**
Expand Down
3 changes: 2 additions & 1 deletion api-gateway/src/middlewares/validation/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ export * from './policies.dto.js'
export * from './profiles.dto.js'
export * from './worker-tasks.dto.js'
export * from './policy-statistics.dto.js'
export * from './schema-rules.dto.js'
export * from './schema-rules.dto.js'
export * from './policy-labels.dto.js'
Loading
Loading