@owox/backend 0.31.0-next-20260805153934 → 0.31.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 (24) hide show
  1. package/dist/src/data-marts/controllers/data-mart.controller.d.ts +5 -1
  2. package/dist/src/data-marts/controllers/data-mart.controller.js +19 -1
  3. package/dist/src/data-marts/controllers/spec/data-mart.api.d.ts +1 -0
  4. package/dist/src/data-marts/controllers/spec/data-mart.api.js +8 -0
  5. package/dist/src/data-marts/data-marts.module.js +2 -0
  6. package/dist/src/data-marts/dto/domain/data-mart-input-source-change-impact.dto.d.ts +6 -0
  7. package/dist/src/data-marts/dto/domain/data-mart-input-source-change-impact.dto.js +15 -0
  8. package/dist/src/data-marts/dto/domain/get-data-mart-input-source-change-impact.command.d.ts +7 -0
  9. package/dist/src/data-marts/dto/domain/get-data-mart-input-source-change-impact.command.js +17 -0
  10. package/dist/src/data-marts/dto/presentation/data-mart-input-source-change-impact-response-api.dto.d.ts +5 -0
  11. package/dist/src/data-marts/dto/presentation/data-mart-input-source-change-impact-response-api.dto.js +38 -0
  12. package/dist/src/data-marts/events/data-mart-definition-type-changed.event.d.ts +13 -0
  13. package/dist/src/data-marts/events/data-mart-definition-type-changed.event.js +14 -0
  14. package/dist/src/data-marts/mappers/data-mart.mapper.d.ts +2 -0
  15. package/dist/src/data-marts/mappers/data-mart.mapper.js +4 -0
  16. package/dist/src/data-marts/services/data-mart-relationship.service.d.ts +1 -0
  17. package/dist/src/data-marts/services/data-mart-relationship.service.js +5 -0
  18. package/dist/src/data-marts/services/report.service.d.ts +1 -0
  19. package/dist/src/data-marts/services/report.service.js +10 -0
  20. package/dist/src/data-marts/use-cases/get-data-mart-input-source-change-impact.service.d.ts +14 -0
  21. package/dist/src/data-marts/use-cases/get-data-mart-input-source-change-impact.service.js +54 -0
  22. package/dist/src/data-marts/use-cases/update-data-mart-definition.service.d.ts +4 -1
  23. package/dist/src/data-marts/use-cases/update-data-mart-definition.service.js +32 -4
  24. package/package.json +5 -5
@@ -24,6 +24,8 @@ import { CreateDataMartService } from '../use-cases/create-data-mart.service';
24
24
  import { DeleteDataMartService } from '../use-cases/delete-data-mart.service';
25
25
  import { GetDataMartRunService } from '../use-cases/get-data-mart-run.service';
26
26
  import { GetDataMartService } from '../use-cases/get-data-mart.service';
27
+ import { GetDataMartInputSourceChangeImpactService } from '../use-cases/get-data-mart-input-source-change-impact.service';
28
+ import { DataMartInputSourceChangeImpactResponseApiDto } from '../dto/presentation/data-mart-input-source-change-impact-response-api.dto';
27
29
  import { ListDataMartRunsService } from '../use-cases/list-data-mart-runs.service';
28
30
  import { ListDataMartsByConnectorNameService } from '../use-cases/list-data-marts-by-connector-name.service';
29
31
  import { ListDataMartsService } from '../use-cases/list-data-marts.service';
@@ -51,6 +53,7 @@ export declare class DataMartController {
51
53
  private readonly createDataMartService;
52
54
  private readonly listDataMartsService;
53
55
  private readonly getDataMartService;
56
+ private readonly getInputSourceChangeImpactService;
54
57
  private readonly updateDefinitionService;
55
58
  private readonly updateTitleService;
56
59
  private readonly updateDescriptionService;
@@ -73,12 +76,13 @@ export declare class DataMartController {
73
76
  private readonly contextAccessService;
74
77
  private readonly aiInsightsConfig;
75
78
  private readonly refreshDataLastUpdatedService;
76
- constructor(createDataMartService: CreateDataMartService, listDataMartsService: ListDataMartsService, getDataMartService: GetDataMartService, updateDefinitionService: UpdateDataMartDefinitionService, updateTitleService: UpdateDataMartTitleService, updateDescriptionService: UpdateDataMartDescriptionService, publishDataMartService: PublishDataMartService, deleteDataMartService: DeleteDataMartService, mapper: DataMartMapper, runDataMartService: RunDataMartService, validateDefinitionService: ValidateDataMartDefinitionService, updateSchemaService: UpdateDataMartSchemaService, getDataMartRunsService: ListDataMartRunsService, getDataMartRunService: GetDataMartRunService, cancelDataMartRunService: CancelDataMartRunService, listDataMartsByConnectorNameService: ListDataMartsByConnectorNameService, batchDataMartHealthStatusService: BatchDataMartHealthStatusService, updateOwnersService: UpdateDataMartOwnersService, updateAvailabilityService: UpdateAvailabilityService, memberOwnershipWarningsService: MemberOwnershipWarningsService, getBlendableSchemaService: GetBlendableSchemaService, updateBlendedFieldsConfigService: UpdateBlendedFieldsConfigService, contextAccessService: ContextAccessService, aiInsightsConfig: AiInsightsConfigService, refreshDataLastUpdatedService: RefreshDataMartDataLastUpdatedService);
79
+ constructor(createDataMartService: CreateDataMartService, listDataMartsService: ListDataMartsService, getDataMartService: GetDataMartService, getInputSourceChangeImpactService: GetDataMartInputSourceChangeImpactService, updateDefinitionService: UpdateDataMartDefinitionService, updateTitleService: UpdateDataMartTitleService, updateDescriptionService: UpdateDataMartDescriptionService, publishDataMartService: PublishDataMartService, deleteDataMartService: DeleteDataMartService, mapper: DataMartMapper, runDataMartService: RunDataMartService, validateDefinitionService: ValidateDataMartDefinitionService, updateSchemaService: UpdateDataMartSchemaService, getDataMartRunsService: ListDataMartRunsService, getDataMartRunService: GetDataMartRunService, cancelDataMartRunService: CancelDataMartRunService, listDataMartsByConnectorNameService: ListDataMartsByConnectorNameService, batchDataMartHealthStatusService: BatchDataMartHealthStatusService, updateOwnersService: UpdateDataMartOwnersService, updateAvailabilityService: UpdateAvailabilityService, memberOwnershipWarningsService: MemberOwnershipWarningsService, getBlendableSchemaService: GetBlendableSchemaService, updateBlendedFieldsConfigService: UpdateBlendedFieldsConfigService, contextAccessService: ContextAccessService, aiInsightsConfig: AiInsightsConfigService, refreshDataLastUpdatedService: RefreshDataMartDataLastUpdatedService);
77
80
  create(context: AuthorizationContext, dto: CreateDataMartRequestApiDto): Promise<CreateDataMartResponseApiDto>;
78
81
  list(context: AuthorizationContext, query: ListDataMartsQueryApiDto): Promise<PaginatedDataMartsResponseApiDto>;
79
82
  listDataMartsByConnectorName(context: AuthorizationContext, connectorName: string): Promise<DataMartResponseApiDto[]>;
80
83
  getMemberOwnershipWarnings(context: AuthorizationContext): Promise<import("../services/member-ownership-warnings.service").MemberOwnershipWarning[]>;
81
84
  getAiHelperAvailability(): DataMartAiHelperAvailabilityResponseApiDto;
85
+ getInputSourceChangeImpact(context: AuthorizationContext, id: string): Promise<DataMartInputSourceChangeImpactResponseApiDto>;
82
86
  get(context: AuthorizationContext, id: string): Promise<DataMartResponseApiDto>;
83
87
  updateDefinition(context: AuthorizationContext, id: string, dto: UpdateDataMartDefinitionApiDto): Promise<DataMartResponseApiDto>;
84
88
  updateTitle(context: AuthorizationContext, id: string, dto: UpdateDataMartTitleApiDto): Promise<DataMartResponseApiDto>;
@@ -33,6 +33,7 @@ const create_data_mart_service_1 = require("../use-cases/create-data-mart.servic
33
33
  const delete_data_mart_service_1 = require("../use-cases/delete-data-mart.service");
34
34
  const get_data_mart_run_service_1 = require("../use-cases/get-data-mart-run.service");
35
35
  const get_data_mart_service_1 = require("../use-cases/get-data-mart.service");
36
+ const get_data_mart_input_source_change_impact_service_1 = require("../use-cases/get-data-mart-input-source-change-impact.service");
36
37
  const list_data_mart_runs_service_1 = require("../use-cases/list-data-mart-runs.service");
37
38
  const list_data_marts_by_connector_name_service_1 = require("../use-cases/list-data-marts-by-connector-name.service");
38
39
  const list_data_marts_service_1 = require("../use-cases/list-data-marts.service");
@@ -60,6 +61,7 @@ let DataMartController = class DataMartController {
60
61
  createDataMartService;
61
62
  listDataMartsService;
62
63
  getDataMartService;
64
+ getInputSourceChangeImpactService;
63
65
  updateDefinitionService;
64
66
  updateTitleService;
65
67
  updateDescriptionService;
@@ -82,10 +84,11 @@ let DataMartController = class DataMartController {
82
84
  contextAccessService;
83
85
  aiInsightsConfig;
84
86
  refreshDataLastUpdatedService;
85
- constructor(createDataMartService, listDataMartsService, getDataMartService, updateDefinitionService, updateTitleService, updateDescriptionService, publishDataMartService, deleteDataMartService, mapper, runDataMartService, validateDefinitionService, updateSchemaService, getDataMartRunsService, getDataMartRunService, cancelDataMartRunService, listDataMartsByConnectorNameService, batchDataMartHealthStatusService, updateOwnersService, updateAvailabilityService, memberOwnershipWarningsService, getBlendableSchemaService, updateBlendedFieldsConfigService, contextAccessService, aiInsightsConfig, refreshDataLastUpdatedService) {
87
+ constructor(createDataMartService, listDataMartsService, getDataMartService, getInputSourceChangeImpactService, updateDefinitionService, updateTitleService, updateDescriptionService, publishDataMartService, deleteDataMartService, mapper, runDataMartService, validateDefinitionService, updateSchemaService, getDataMartRunsService, getDataMartRunService, cancelDataMartRunService, listDataMartsByConnectorNameService, batchDataMartHealthStatusService, updateOwnersService, updateAvailabilityService, memberOwnershipWarningsService, getBlendableSchemaService, updateBlendedFieldsConfigService, contextAccessService, aiInsightsConfig, refreshDataLastUpdatedService) {
86
88
  this.createDataMartService = createDataMartService;
87
89
  this.listDataMartsService = listDataMartsService;
88
90
  this.getDataMartService = getDataMartService;
91
+ this.getInputSourceChangeImpactService = getInputSourceChangeImpactService;
89
92
  this.updateDefinitionService = updateDefinitionService;
90
93
  this.updateTitleService = updateTitleService;
91
94
  this.updateDescriptionService = updateDescriptionService;
@@ -130,6 +133,10 @@ let DataMartController = class DataMartController {
130
133
  getAiHelperAvailability() {
131
134
  return { enabled: this.aiInsightsConfig.isInsightsEnabled() };
132
135
  }
136
+ async getInputSourceChangeImpact(context, id) {
137
+ const command = this.mapper.toGetInputSourceChangeImpactCommand(id, context);
138
+ return this.getInputSourceChangeImpactService.run(command);
139
+ }
133
140
  async get(context, id) {
134
141
  const command = this.mapper.toGetCommand(id, context);
135
142
  const dataMart = await this.getDataMartService.run(command);
@@ -267,6 +274,16 @@ __decorate([
267
274
  __metadata("design:paramtypes", []),
268
275
  __metadata("design:returntype", data_mart_ai_helper_availability_response_api_dto_1.DataMartAiHelperAvailabilityResponseApiDto)
269
276
  ], DataMartController.prototype, "getAiHelperAvailability", null);
277
+ __decorate([
278
+ (0, idp_1.Auth)(idp_1.Role.editor(idp_1.Strategy.INTROSPECT)),
279
+ (0, common_1.Get)(':id/input-source-change-impact'),
280
+ (0, data_mart_api_1.GetDataMartInputSourceChangeImpactSpec)(),
281
+ __param(0, (0, idp_1.AuthContext)()),
282
+ __param(1, (0, common_1.Param)('id')),
283
+ __metadata("design:type", Function),
284
+ __metadata("design:paramtypes", [Object, String]),
285
+ __metadata("design:returntype", Promise)
286
+ ], DataMartController.prototype, "getInputSourceChangeImpact", null);
270
287
  __decorate([
271
288
  (0, idp_1.Auth)(idp_1.Role.viewer(idp_1.Strategy.PARSE)),
272
289
  (0, common_1.Get)(':id'),
@@ -481,6 +498,7 @@ exports.DataMartController = DataMartController = __decorate([
481
498
  __metadata("design:paramtypes", [create_data_mart_service_1.CreateDataMartService,
482
499
  list_data_marts_service_1.ListDataMartsService,
483
500
  get_data_mart_service_1.GetDataMartService,
501
+ get_data_mart_input_source_change_impact_service_1.GetDataMartInputSourceChangeImpactService,
484
502
  update_data_mart_definition_service_1.UpdateDataMartDefinitionService,
485
503
  update_data_mart_title_service_1.UpdateDataMartTitleService,
486
504
  update_data_mart_description_service_1.UpdateDataMartDescriptionService,
@@ -1,6 +1,7 @@
1
1
  export declare function CreateDataMartSpec(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
2
  export declare function ListDataMartsSpec(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
3
3
  export declare function GetDataMartSpec(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
4
+ export declare function GetDataMartInputSourceChangeImpactSpec(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
4
5
  export declare function RefreshDataMartDataLastUpdatedSpec(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
5
6
  export declare function BatchDataMartHealthStatusSpec(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
6
7
  export declare function UpdateDataMartDefinitionSpec(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CreateDataMartSpec = CreateDataMartSpec;
4
4
  exports.ListDataMartsSpec = ListDataMartsSpec;
5
5
  exports.GetDataMartSpec = GetDataMartSpec;
6
+ exports.GetDataMartInputSourceChangeImpactSpec = GetDataMartInputSourceChangeImpactSpec;
6
7
  exports.RefreshDataMartDataLastUpdatedSpec = RefreshDataMartDataLastUpdatedSpec;
7
8
  exports.BatchDataMartHealthStatusSpec = BatchDataMartHealthStatusSpec;
8
9
  exports.UpdateDataMartDefinitionSpec = UpdateDataMartDefinitionSpec;
@@ -39,6 +40,7 @@ const update_data_mart_definition_api_dto_1 = require("../../dto/presentation/up
39
40
  const update_data_mart_schema_api_dto_1 = require("../../dto/presentation/update-data-mart-schema-api.dto");
40
41
  const data_mart_ai_helper_availability_response_api_dto_1 = require("../../dto/presentation/data-mart-ai-helper-availability-response-api.dto");
41
42
  const data_mart_validation_response_api_dto_1 = require("../../dto/presentation/data-mart-validation-response-api.dto");
43
+ const data_mart_input_source_change_impact_response_api_dto_1 = require("../../dto/presentation/data-mart-input-source-change-impact-response-api.dto");
42
44
  const data_mart_runs_response_api_dto_1 = require("../../dto/presentation/data-mart-runs-response-api.dto");
43
45
  const data_mart_run_response_api_dto_1 = require("../../dto/presentation/data-mart-run-response-api.dto");
44
46
  const update_data_mart_owners_api_dto_1 = require("../../dto/presentation/update-data-mart-owners-api.dto");
@@ -65,6 +67,12 @@ function ListDataMartsSpec() {
65
67
  function GetDataMartSpec() {
66
68
  return (0, common_1.applyDecorators)((0, swagger_1.ApiOperation)({ summary: 'Get a DataMart by ID' }), (0, swagger_1.ApiParam)({ name: 'id', description: 'DataMart ID' }), (0, swagger_1.ApiResponse)({ status: 200, type: data_mart_response_api_dto_1.DataMartResponseApiDto }));
67
69
  }
70
+ function GetDataMartInputSourceChangeImpactSpec() {
71
+ return (0, common_1.applyDecorators)((0, swagger_1.ApiOperation)({
72
+ summary: 'Count what depends on a DataMart before its input source is changed',
73
+ description: 'Returns how many relationships reference this DataMart in each direction and how many reports are built on it, so the caller can show the blast radius of repointing it at another input source.',
74
+ }), (0, swagger_1.ApiParam)({ name: 'id', description: 'DataMart ID' }), (0, swagger_1.ApiOkResponse)({ type: data_mart_input_source_change_impact_response_api_dto_1.DataMartInputSourceChangeImpactResponseApiDto }));
75
+ }
68
76
  function RefreshDataMartDataLastUpdatedSpec() {
69
77
  return (0, common_1.applyDecorators)((0, swagger_1.ApiOperation)({
70
78
  summary: 'Refresh the Data Last Updated snapshot for one or more DataMarts',
@@ -71,6 +71,7 @@ const list_project_data_mart_runs_service_1 = require("./use-cases/list-project-
71
71
  const list_project_insight_templates_service_1 = require("./use-cases/list-project-insight-templates.service");
72
72
  const list_project_scheduled_triggers_service_1 = require("./use-cases/list-project-scheduled-triggers.service");
73
73
  const get_data_mart_service_1 = require("./use-cases/get-data-mart.service");
74
+ const get_data_mart_input_source_change_impact_service_1 = require("./use-cases/get-data-mart-input-source-change-impact.service");
74
75
  const data_mart_mapper_1 = require("./mappers/data-mart.mapper");
75
76
  const mcp_data_catalog_summary_mapper_1 = require("./mappers/mcp-data-catalog-summary.mapper");
76
77
  const scheduled_trigger_mapper_1 = require("./mappers/scheduled-trigger.mapper");
@@ -598,6 +599,7 @@ exports.DataMartsModule = DataMartsModule = __decorate([
598
599
  },
599
600
  list_data_marts_by_connector_name_service_1.ListDataMartsByConnectorNameService,
600
601
  get_data_mart_service_1.GetDataMartService,
602
+ get_data_mart_input_source_change_impact_service_1.GetDataMartInputSourceChangeImpactService,
601
603
  list_data_mart_runs_service_1.ListDataMartRunsService,
602
604
  list_project_data_mart_runs_service_1.ListProjectDataMartRunsService,
603
605
  list_project_insight_templates_service_1.ListProjectInsightTemplatesService,
@@ -0,0 +1,6 @@
1
+ export declare class DataMartInputSourceChangeImpactDto {
2
+ readonly outboundRelationshipsCount: number;
3
+ readonly inboundRelationshipsCount: number;
4
+ readonly reportsCount: number;
5
+ constructor(outboundRelationshipsCount: number, inboundRelationshipsCount: number, reportsCount: number);
6
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataMartInputSourceChangeImpactDto = void 0;
4
+ class DataMartInputSourceChangeImpactDto {
5
+ outboundRelationshipsCount;
6
+ inboundRelationshipsCount;
7
+ reportsCount;
8
+ constructor(outboundRelationshipsCount, inboundRelationshipsCount, reportsCount) {
9
+ this.outboundRelationshipsCount = outboundRelationshipsCount;
10
+ this.inboundRelationshipsCount = inboundRelationshipsCount;
11
+ this.reportsCount = reportsCount;
12
+ }
13
+ }
14
+ exports.DataMartInputSourceChangeImpactDto = DataMartInputSourceChangeImpactDto;
15
+ //# sourceMappingURL=data-mart-input-source-change-impact.dto.js.map
@@ -0,0 +1,7 @@
1
+ export declare class GetDataMartInputSourceChangeImpactCommand {
2
+ readonly id: string;
3
+ readonly projectId: string;
4
+ readonly userId: string;
5
+ readonly roles: string[];
6
+ constructor(id: string, projectId: string, userId?: string, roles?: string[]);
7
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetDataMartInputSourceChangeImpactCommand = void 0;
4
+ class GetDataMartInputSourceChangeImpactCommand {
5
+ id;
6
+ projectId;
7
+ userId;
8
+ roles;
9
+ constructor(id, projectId, userId = '', roles = []) {
10
+ this.id = id;
11
+ this.projectId = projectId;
12
+ this.userId = userId;
13
+ this.roles = roles;
14
+ }
15
+ }
16
+ exports.GetDataMartInputSourceChangeImpactCommand = GetDataMartInputSourceChangeImpactCommand;
17
+ //# sourceMappingURL=get-data-mart-input-source-change-impact.command.js.map
@@ -0,0 +1,5 @@
1
+ export declare class DataMartInputSourceChangeImpactResponseApiDto {
2
+ outboundRelationshipsCount: number;
3
+ inboundRelationshipsCount: number;
4
+ reportsCount: number;
5
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DataMartInputSourceChangeImpactResponseApiDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ class DataMartInputSourceChangeImpactResponseApiDto {
15
+ outboundRelationshipsCount;
16
+ inboundRelationshipsCount;
17
+ reportsCount;
18
+ }
19
+ exports.DataMartInputSourceChangeImpactResponseApiDto = DataMartInputSourceChangeImpactResponseApiDto;
20
+ __decorate([
21
+ (0, swagger_1.ApiProperty)({
22
+ example: 2,
23
+ description: 'Relationships where this DataMart joins another one',
24
+ }),
25
+ __metadata("design:type", Number)
26
+ ], DataMartInputSourceChangeImpactResponseApiDto.prototype, "outboundRelationshipsCount", void 0);
27
+ __decorate([
28
+ (0, swagger_1.ApiProperty)({
29
+ example: 3,
30
+ description: 'Relationships where another DataMart joins this one',
31
+ }),
32
+ __metadata("design:type", Number)
33
+ ], DataMartInputSourceChangeImpactResponseApiDto.prototype, "inboundRelationshipsCount", void 0);
34
+ __decorate([
35
+ (0, swagger_1.ApiProperty)({ example: 5, description: 'Reports built on this DataMart' }),
36
+ __metadata("design:type", Number)
37
+ ], DataMartInputSourceChangeImpactResponseApiDto.prototype, "reportsCount", void 0);
38
+ //# sourceMappingURL=data-mart-input-source-change-impact-response-api.dto.js.map
@@ -0,0 +1,13 @@
1
+ import { BaseEvent } from '@owox/internal-helpers';
2
+ import { DataMartDefinitionType } from '../enums/data-mart-definition-type.enum';
3
+ export interface DataMartDefinitionTypeChangedEventPayload {
4
+ dataMartId: string;
5
+ projectId: string;
6
+ previousDefinitionType: DataMartDefinitionType;
7
+ definitionType: DataMartDefinitionType;
8
+ createdById: string;
9
+ }
10
+ export declare class DataMartDefinitionTypeChangedEvent extends BaseEvent<DataMartDefinitionTypeChangedEventPayload> {
11
+ get name(): "data-mart.definition-type.changed";
12
+ constructor(dataMartId: string, projectId: string, previousDefinitionType: DataMartDefinitionType, definitionType: DataMartDefinitionType, createdById: string);
13
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataMartDefinitionTypeChangedEvent = void 0;
4
+ const internal_helpers_1 = require("@owox/internal-helpers");
5
+ class DataMartDefinitionTypeChangedEvent extends internal_helpers_1.BaseEvent {
6
+ get name() {
7
+ return 'data-mart.definition-type.changed';
8
+ }
9
+ constructor(dataMartId, projectId, previousDefinitionType, definitionType, createdById) {
10
+ super({ dataMartId, projectId, previousDefinitionType, definitionType, createdById });
11
+ }
12
+ }
13
+ exports.DataMartDefinitionTypeChangedEvent = DataMartDefinitionTypeChangedEvent;
14
+ //# sourceMappingURL=data-mart-definition-type-changed.event.js.map
@@ -15,6 +15,7 @@ import { DeleteDataMartCommand } from '../dto/domain/delete-data-mart.command';
15
15
  import { GetDataMartRunCommand } from '../dto/domain/get-data-mart-run.command';
16
16
  import { GetDataMartRunsCommand } from '../dto/domain/get-data-mart-runs.command';
17
17
  import { GetDataMartCommand } from '../dto/domain/get-data-mart.command';
18
+ import { GetDataMartInputSourceChangeImpactCommand } from '../dto/domain/get-data-mart-input-source-change-impact.command';
18
19
  import { ListDataMartsByConnectorNameCommand } from '../dto/domain/list-data-mart-by-connector-name';
19
20
  import { ListDataMartsCommand } from '../dto/domain/list-data-marts.command';
20
21
  import { PaginatedDataMartListItemsDto } from '../dto/domain/paginated-data-mart-list-items.dto';
@@ -79,6 +80,7 @@ export declare class DataMartMapper {
79
80
  toBatchHealthStatusResponse(dto: BatchDataMartHealthStatusResponseDto): Promise<BatchDataMartHealthStatusResponseApiDto>;
80
81
  toUpdateDefinitionCommand(id: string, context: AuthorizationContext, dto: UpdateDataMartDefinitionApiDto): UpdateDataMartDefinitionCommand;
81
82
  toGetCommand(id: string, context: AuthorizationContext): GetDataMartCommand;
83
+ toGetInputSourceChangeImpactCommand(id: string, context: AuthorizationContext): GetDataMartInputSourceChangeImpactCommand;
82
84
  toGetDataMartRunsCommand(id: string, context: AuthorizationContext, limit: number, offset: number): GetDataMartRunsCommand;
83
85
  toListCommand(context: AuthorizationContext, offset?: number, ownerFilter?: OwnerFilter): ListDataMartsCommand;
84
86
  toListItemDto(entity: DataMart, counters: {
@@ -27,6 +27,7 @@ const delete_data_mart_command_1 = require("../dto/domain/delete-data-mart.comma
27
27
  const get_data_mart_run_command_1 = require("../dto/domain/get-data-mart-run.command");
28
28
  const get_data_mart_runs_command_1 = require("../dto/domain/get-data-mart-runs.command");
29
29
  const get_data_mart_command_1 = require("../dto/domain/get-data-mart.command");
30
+ const get_data_mart_input_source_change_impact_command_1 = require("../dto/domain/get-data-mart-input-source-change-impact.command");
30
31
  const list_data_mart_by_connector_name_1 = require("../dto/domain/list-data-mart-by-connector-name");
31
32
  const list_data_marts_command_1 = require("../dto/domain/list-data-marts.command");
32
33
  const publish_data_mart_command_1 = require("../dto/domain/publish-data-mart.command");
@@ -160,6 +161,9 @@ let DataMartMapper = class DataMartMapper {
160
161
  toGetCommand(id, context) {
161
162
  return new get_data_mart_command_1.GetDataMartCommand(id, context.projectId, context.userId, context.roles ?? []);
162
163
  }
164
+ toGetInputSourceChangeImpactCommand(id, context) {
165
+ return new get_data_mart_input_source_change_impact_command_1.GetDataMartInputSourceChangeImpactCommand(id, context.projectId, context.userId, context.roles ?? []);
166
+ }
163
167
  toGetDataMartRunsCommand(id, context, limit, offset) {
164
168
  return new get_data_mart_runs_command_1.GetDataMartRunsCommand(id, context.projectId, limit, offset, context.userId, context.roles ?? []);
165
169
  }
@@ -18,6 +18,7 @@ export declare class DataMartRelationshipService {
18
18
  findGraphEdgesByProjectIdAndSourceDataMartIds(projectId: string, sourceDataMartIds: string[]): Promise<DataMartRelationshipGraphEdgeDto[]>;
19
19
  findGraphEdgesByStorageId(storageId: string, projectId: string): Promise<DataMartRelationshipGraphEdgeDto[]>;
20
20
  findSourceDataMartIdsByTargetDataMartId(targetDataMartId: string, projectId: string): Promise<string[]>;
21
+ countByTargetDataMartId(targetDataMartId: string, projectId: string): Promise<number>;
21
22
  findByStorageId(storageId: string, projectId: string): Promise<DataMartRelationship[]>;
22
23
  findById(id: string): Promise<DataMartRelationship | null>;
23
24
  findByIds(ids: string[]): Promise<DataMartRelationship[]>;
@@ -69,6 +69,11 @@ let DataMartRelationshipService = class DataMartRelationshipService {
69
69
  .getRawMany();
70
70
  return [...new Set(rows.map(row => row.sourceDataMartId))];
71
71
  }
72
+ async countByTargetDataMartId(targetDataMartId, projectId) {
73
+ return this.repository.count({
74
+ where: { targetDataMart: { id: targetDataMartId }, projectId },
75
+ });
76
+ }
72
77
  async findByStorageId(storageId, projectId) {
73
78
  return this.repository.find({
74
79
  where: { dataStorage: { id: storageId }, projectId },
@@ -20,5 +20,6 @@ export declare class ReportService {
20
20
  updateLastRunOutcome(report: Report): Promise<void>;
21
21
  updateReportWithVersionControl(report: Report): Promise<void>;
22
22
  deleteReport(report: Report): Promise<void>;
23
+ countByDataMartIdAndProjectId(dataMartId: string, projectId: string): Promise<number>;
23
24
  deleteAllByDataMartIdAndProjectId(dataMartId: string, projectId: string): Promise<void>;
24
25
  }
@@ -169,6 +169,16 @@ let ReportService = class ReportService {
169
169
  await this.scheduledTriggerService.deleteAllByReportIdAndDataMartIdAndProjectId(report.id, report.dataMart.id, report.dataMart.projectId);
170
170
  await this.repository.remove(report);
171
171
  }
172
+ async countByDataMartIdAndProjectId(dataMartId, projectId) {
173
+ return this.repository.count({
174
+ where: {
175
+ dataMart: {
176
+ id: dataMartId,
177
+ projectId,
178
+ },
179
+ },
180
+ });
181
+ }
172
182
  async deleteAllByDataMartIdAndProjectId(dataMartId, projectId) {
173
183
  const reports = await this.repository.find({
174
184
  where: {
@@ -0,0 +1,14 @@
1
+ import { DataMartInputSourceChangeImpactDto } from '../dto/domain/data-mart-input-source-change-impact.dto';
2
+ import { GetDataMartInputSourceChangeImpactCommand } from '../dto/domain/get-data-mart-input-source-change-impact.command';
3
+ import { DataMartRelationshipService } from '../services/data-mart-relationship.service';
4
+ import { DataMartService } from '../services/data-mart.service';
5
+ import { ReportService } from '../services/report.service';
6
+ import { AccessDecisionService } from '../services/access-decision';
7
+ export declare class GetDataMartInputSourceChangeImpactService {
8
+ private readonly dataMartService;
9
+ private readonly relationshipService;
10
+ private readonly reportService;
11
+ private readonly accessDecisionService;
12
+ constructor(dataMartService: DataMartService, relationshipService: DataMartRelationshipService, reportService: ReportService, accessDecisionService: AccessDecisionService);
13
+ run(command: GetDataMartInputSourceChangeImpactCommand): Promise<DataMartInputSourceChangeImpactDto>;
14
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GetDataMartInputSourceChangeImpactService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const data_mart_input_source_change_impact_dto_1 = require("../dto/domain/data-mart-input-source-change-impact.dto");
15
+ const data_mart_relationship_service_1 = require("../services/data-mart-relationship.service");
16
+ const data_mart_service_1 = require("../services/data-mart.service");
17
+ const report_service_1 = require("../services/report.service");
18
+ const access_decision_1 = require("../services/access-decision");
19
+ let GetDataMartInputSourceChangeImpactService = class GetDataMartInputSourceChangeImpactService {
20
+ dataMartService;
21
+ relationshipService;
22
+ reportService;
23
+ accessDecisionService;
24
+ constructor(dataMartService, relationshipService, reportService, accessDecisionService) {
25
+ this.dataMartService = dataMartService;
26
+ this.relationshipService = relationshipService;
27
+ this.reportService = reportService;
28
+ this.accessDecisionService = accessDecisionService;
29
+ }
30
+ async run(command) {
31
+ await this.dataMartService.getByIdAndProjectId(command.id, command.projectId);
32
+ if (command.userId) {
33
+ const canEdit = await this.accessDecisionService.canAccess(command.userId, command.roles, access_decision_1.EntityType.DATA_MART, command.id, access_decision_1.Action.EDIT, command.projectId);
34
+ if (!canEdit) {
35
+ throw new common_1.ForbiddenException('You do not have permission to edit this DataMart');
36
+ }
37
+ }
38
+ const [outbound, inboundCount, reportsCount] = await Promise.all([
39
+ this.relationshipService.findBySourceDataMartId(command.id),
40
+ this.relationshipService.countByTargetDataMartId(command.id, command.projectId),
41
+ this.reportService.countByDataMartIdAndProjectId(command.id, command.projectId),
42
+ ]);
43
+ return new data_mart_input_source_change_impact_dto_1.DataMartInputSourceChangeImpactDto(outbound.length, inboundCount, reportsCount);
44
+ }
45
+ };
46
+ exports.GetDataMartInputSourceChangeImpactService = GetDataMartInputSourceChangeImpactService;
47
+ exports.GetDataMartInputSourceChangeImpactService = GetDataMartInputSourceChangeImpactService = __decorate([
48
+ (0, common_1.Injectable)(),
49
+ __metadata("design:paramtypes", [data_mart_service_1.DataMartService,
50
+ data_mart_relationship_service_1.DataMartRelationshipService,
51
+ report_service_1.ReportService,
52
+ access_decision_1.AccessDecisionService])
53
+ ], GetDataMartInputSourceChangeImpactService);
54
+ //# sourceMappingURL=get-data-mart-input-source-change-impact.service.js.map
@@ -1,4 +1,5 @@
1
1
  import { OwoxEventDispatcher } from '../../common/event-dispatcher/owox-event-dispatcher';
2
+ import { DataMartDefinitionValidatorFacade } from '../data-storage-types/facades/data-mart-definition-validator-facade.service';
2
3
  import { DataMartDto } from '../dto/domain/data-mart.dto';
3
4
  import { UpdateDataMartDefinitionCommand } from '../dto/domain/update-data-mart-definition.command';
4
5
  import { DataMartMapper } from '../mappers/data-mart.mapper';
@@ -14,13 +15,15 @@ export declare class UpdateDataMartDefinitionService {
14
15
  private readonly connectorSecretService;
15
16
  private readonly legacyDataMartsService;
16
17
  private readonly accessDecisionService;
18
+ private readonly definitionValidatorFacade;
17
19
  private readonly eventDispatcher;
18
20
  private readonly connectorService;
19
21
  private readonly advancedSearchIndexSync?;
20
- constructor(dataMartService: DataMartService, mapper: DataMartMapper, connectorSecretService: ConnectorSecretService, legacyDataMartsService: LegacyDataMartsService, accessDecisionService: AccessDecisionService, eventDispatcher: OwoxEventDispatcher, connectorService: ConnectorService, advancedSearchIndexSync?: AdvancedSearchIndexSyncService | undefined);
22
+ constructor(dataMartService: DataMartService, mapper: DataMartMapper, connectorSecretService: ConnectorSecretService, legacyDataMartsService: LegacyDataMartsService, accessDecisionService: AccessDecisionService, definitionValidatorFacade: DataMartDefinitionValidatorFacade, eventDispatcher: OwoxEventDispatcher, connectorService: ConnectorService, advancedSearchIndexSync?: AdvancedSearchIndexSyncService | undefined);
21
23
  run(command: UpdateDataMartDefinitionCommand): Promise<DataMartDto>;
22
24
  private getConnectorCapabilities;
23
25
  private validateConnectorConfigurationCount;
24
26
  private validateCredentialCopyAccess;
25
27
  private validateSecretReferences;
28
+ private assertDefinitionTypeChangeAllowed;
26
29
  }
@@ -11,11 +11,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UpdateDataMartDefinitionService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
+ const typeorm_transactional_1 = require("typeorm-transactional");
14
15
  const business_violation_exception_1 = require("../../common/exceptions/business-violation.exception");
15
16
  const owox_event_dispatcher_1 = require("../../common/event-dispatcher/owox-event-dispatcher");
17
+ const data_mart_definition_validator_facade_service_1 = require("../data-storage-types/facades/data-mart-definition-validator-facade.service");
16
18
  const data_storage_type_enum_1 = require("../data-storage-types/enums/data-storage-type.enum");
19
+ const update_data_mart_definition_command_1 = require("../dto/domain/update-data-mart-definition.command");
17
20
  const data_mart_definition_type_enum_1 = require("../enums/data-mart-definition-type.enum");
18
21
  const data_mart_definition_set_event_1 = require("../events/data-mart-definition-set.event");
22
+ const data_mart_definition_type_changed_event_1 = require("../events/data-mart-definition-type-changed.event");
19
23
  const data_mart_definition_type_set_event_1 = require("../events/data-mart-definition-type-set.event");
20
24
  const data_mart_mapper_1 = require("../mappers/data-mart.mapper");
21
25
  const connector_secret_service_1 = require("../services/connector/connector-secret.service");
@@ -31,15 +35,17 @@ let UpdateDataMartDefinitionService = class UpdateDataMartDefinitionService {
31
35
  connectorSecretService;
32
36
  legacyDataMartsService;
33
37
  accessDecisionService;
38
+ definitionValidatorFacade;
34
39
  eventDispatcher;
35
40
  connectorService;
36
41
  advancedSearchIndexSync;
37
- constructor(dataMartService, mapper, connectorSecretService, legacyDataMartsService, accessDecisionService, eventDispatcher, connectorService, advancedSearchIndexSync) {
42
+ constructor(dataMartService, mapper, connectorSecretService, legacyDataMartsService, accessDecisionService, definitionValidatorFacade, eventDispatcher, connectorService, advancedSearchIndexSync) {
38
43
  this.dataMartService = dataMartService;
39
44
  this.mapper = mapper;
40
45
  this.connectorSecretService = connectorSecretService;
41
46
  this.legacyDataMartsService = legacyDataMartsService;
42
47
  this.accessDecisionService = accessDecisionService;
48
+ this.definitionValidatorFacade = definitionValidatorFacade;
43
49
  this.eventDispatcher = eventDispatcher;
44
50
  this.connectorService = connectorService;
45
51
  this.advancedSearchIndexSync = advancedSearchIndexSync;
@@ -52,10 +58,13 @@ let UpdateDataMartDefinitionService = class UpdateDataMartDefinitionService {
52
58
  throw new common_1.ForbiddenException('You do not have permission to edit this DataMart');
53
59
  }
54
60
  }
55
- const definitionTypeWasEmpty = !dataMart.definitionType;
61
+ const previousDefinitionType = dataMart.definitionType;
62
+ const definitionTypeWasEmpty = !previousDefinitionType;
56
63
  const definitionWasEmpty = !dataMart.definition;
57
- if (dataMart.definitionType && dataMart.definitionType !== command.definitionType) {
58
- throw new business_violation_exception_1.BusinessViolationException('DataMart already has definition');
64
+ let definitionTypeChanged = false;
65
+ if (previousDefinitionType && previousDefinitionType !== command.definitionType) {
66
+ this.assertDefinitionTypeChangeAllowed(previousDefinitionType, command.definitionType);
67
+ definitionTypeChanged = true;
59
68
  }
60
69
  const connectorCapabilities = this.getConnectorCapabilities(command);
61
70
  this.validateConnectorConfigurationCount(command, connectorCapabilities);
@@ -97,6 +106,9 @@ let UpdateDataMartDefinitionService = class UpdateDataMartDefinitionService {
97
106
  else {
98
107
  dataMart.definition = command.definition;
99
108
  }
109
+ if (definitionTypeChanged) {
110
+ await this.definitionValidatorFacade.checkIsValid(dataMart);
111
+ }
100
112
  await this.dataMartService.save(dataMart);
101
113
  if (definitionTypeWasEmpty && dataMart.definitionType) {
102
114
  await this.eventDispatcher.publishExternal(new data_mart_definition_type_set_event_1.DataMartDefinitionTypeSetEvent(dataMart.id, command.projectId, dataMart.definitionType, dataMart.createdById));
@@ -104,6 +116,9 @@ let UpdateDataMartDefinitionService = class UpdateDataMartDefinitionService {
104
116
  if (definitionWasEmpty && dataMart.definition) {
105
117
  await this.eventDispatcher.publishExternal(new data_mart_definition_set_event_1.DataMartDefinitionSetEvent(dataMart.id, command.projectId, dataMart.createdById, dataMart.definitionType));
106
118
  }
119
+ if (definitionTypeChanged && previousDefinitionType) {
120
+ await this.eventDispatcher.publishExternal(new data_mart_definition_type_changed_event_1.DataMartDefinitionTypeChangedEvent(dataMart.id, command.projectId, previousDefinitionType, dataMart.definitionType, dataMart.createdById));
121
+ }
107
122
  await this.advancedSearchIndexSync?.scheduleReindex(search_facade_1.SearchableEntityType.DATA_MART, dataMart.id, command.projectId);
108
123
  return this.mapper.toDomainDto(dataMart);
109
124
  }
@@ -163,8 +178,20 @@ let UpdateDataMartDefinitionService = class UpdateDataMartDefinitionService {
163
178
  }
164
179
  }
165
180
  }
181
+ assertDefinitionTypeChangeAllowed(currentType, nextType) {
182
+ if (currentType === data_mart_definition_type_enum_1.DataMartDefinitionType.CONNECTOR ||
183
+ nextType === data_mart_definition_type_enum_1.DataMartDefinitionType.CONNECTOR) {
184
+ throw new business_violation_exception_1.BusinessViolationException('Input source type cannot be changed to or from a connector. Create a separate Data Mart instead.');
185
+ }
186
+ }
166
187
  };
167
188
  exports.UpdateDataMartDefinitionService = UpdateDataMartDefinitionService;
189
+ __decorate([
190
+ (0, typeorm_transactional_1.Transactional)(),
191
+ __metadata("design:type", Function),
192
+ __metadata("design:paramtypes", [update_data_mart_definition_command_1.UpdateDataMartDefinitionCommand]),
193
+ __metadata("design:returntype", Promise)
194
+ ], UpdateDataMartDefinitionService.prototype, "run", null);
168
195
  exports.UpdateDataMartDefinitionService = UpdateDataMartDefinitionService = __decorate([
169
196
  (0, common_1.Injectable)(),
170
197
  __metadata("design:paramtypes", [data_mart_service_1.DataMartService,
@@ -172,6 +199,7 @@ exports.UpdateDataMartDefinitionService = UpdateDataMartDefinitionService = __de
172
199
  connector_secret_service_1.ConnectorSecretService,
173
200
  legacy_data_marts_service_1.LegacyDataMartsService,
174
201
  access_decision_1.AccessDecisionService,
202
+ data_mart_definition_validator_facade_service_1.DataMartDefinitionValidatorFacade,
175
203
  owox_event_dispatcher_1.OwoxEventDispatcher,
176
204
  connector_service_1.ConnectorService,
177
205
  advanced_search_index_sync_service_1.AdvancedSearchIndexSyncService])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owox/backend",
3
- "version": "0.31.0-next-20260805153934",
3
+ "version": "0.31.0",
4
4
  "description": "OWOX Data Marts Backend - Full-stack data orchestration platform",
5
5
  "author": "OWOX",
6
6
  "license": "ELv2",
@@ -86,9 +86,9 @@
86
86
  "@opentelemetry/exporter-trace-otlp-http": "^0.220.0",
87
87
  "@opentelemetry/sdk-trace-base": "^2.9.0",
88
88
  "@opentelemetry/sdk-trace-node": "^2.9.0",
89
- "@owox/connectors": "0.31.0-next-20260805153934",
90
- "@owox/idp-protocol": "0.31.0-next-20260805153934",
91
- "@owox/internal-helpers": "0.31.0-next-20260805153934",
89
+ "@owox/connectors": "0.31.0",
90
+ "@owox/idp-protocol": "0.31.0",
91
+ "@owox/internal-helpers": "0.31.0",
92
92
  "better-sqlite3": "^12.2.0",
93
93
  "class-transformer": "^0.5.1",
94
94
  "class-validator": "^0.14.2",
@@ -129,7 +129,7 @@
129
129
  "@nestjs/testing": "^11.1.2",
130
130
  "@owox/eslint-config": "*",
131
131
  "@owox/prettier-config": "*",
132
- "@owox/test-utils": "10.0.0-next-20260805153934",
132
+ "@owox/test-utils": "*",
133
133
  "@swc/cli": "^0.6.0",
134
134
  "@swc/core": "^1.10.7",
135
135
  "@types/better-sqlite3": "^7.6.13",