@solidstarters/solid-core 1.2.134 → 1.2.136
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.
- package/dist/controllers/ai-interaction.controller.d.ts +46 -0
- package/dist/controllers/ai-interaction.controller.d.ts.map +1 -0
- package/dist/controllers/ai-interaction.controller.js +204 -0
- package/dist/controllers/ai-interaction.controller.js.map +1 -0
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts +43 -0
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts.map +1 -0
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.js +179 -0
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.js.map +1 -0
- package/dist/controllers/dashboard-question.controller.d.ts +45 -0
- package/dist/controllers/dashboard-question.controller.d.ts.map +1 -0
- package/dist/controllers/dashboard-question.controller.js +194 -0
- package/dist/controllers/dashboard-question.controller.js.map +1 -0
- package/dist/controllers/dashboard-variable.controller.d.ts +43 -0
- package/dist/controllers/dashboard-variable.controller.d.ts.map +1 -0
- package/dist/controllers/dashboard-variable.controller.js +179 -0
- package/dist/controllers/dashboard-variable.controller.js.map +1 -0
- package/dist/controllers/dashboard.controller.d.ts +45 -0
- package/dist/controllers/dashboard.controller.d.ts.map +1 -0
- package/dist/controllers/dashboard.controller.js +192 -0
- package/dist/controllers/dashboard.controller.js.map +1 -0
- package/dist/controllers/test.controller.d.ts.map +1 -1
- package/dist/controllers/test.controller.js.map +1 -1
- package/dist/decorators/dashboard-question-data-provider.decorator.d.ts +3 -0
- package/dist/decorators/dashboard-question-data-provider.decorator.d.ts.map +1 -0
- package/dist/decorators/dashboard-question-data-provider.decorator.js +11 -0
- package/dist/decorators/dashboard-question-data-provider.decorator.js.map +1 -0
- package/dist/decorators/dashboard-selection-provider.decorator.d.ts +3 -0
- package/dist/decorators/dashboard-selection-provider.decorator.d.ts.map +1 -0
- package/dist/decorators/dashboard-selection-provider.decorator.js +11 -0
- package/dist/decorators/dashboard-selection-provider.decorator.js.map +1 -0
- package/dist/dtos/create-ai-interaction.dto.d.ts +14 -0
- package/dist/dtos/create-ai-interaction.dto.d.ts.map +1 -0
- package/dist/dtos/create-ai-interaction.dto.js +90 -0
- package/dist/dtos/create-ai-interaction.dto.js.map +1 -0
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts +12 -0
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts.map +1 -0
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js +77 -0
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js.map +1 -0
- package/dist/dtos/create-dashboard-question.dto.d.ts +17 -0
- package/dist/dtos/create-dashboard-question.dto.d.ts.map +1 -0
- package/dist/dtos/create-dashboard-question.dto.js +105 -0
- package/dist/dtos/create-dashboard-question.dto.js.map +1 -0
- package/dist/dtos/create-dashboard-variable.dto.d.ts +18 -0
- package/dist/dtos/create-dashboard-variable.dto.d.ts.map +1 -0
- package/dist/dtos/create-dashboard-variable.dto.js +97 -0
- package/dist/dtos/create-dashboard-variable.dto.js.map +1 -0
- package/dist/dtos/create-dashboard.dto.d.ts +15 -0
- package/dist/dtos/create-dashboard.dto.d.ts.map +1 -0
- package/dist/dtos/create-dashboard.dto.js +90 -0
- package/dist/dtos/create-dashboard.dto.js.map +1 -0
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts +8 -0
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts.map +1 -0
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js +52 -0
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js.map +1 -0
- package/dist/dtos/invoke-ai-prompt.dto.d.ts +4 -0
- package/dist/dtos/invoke-ai-prompt.dto.d.ts.map +1 -0
- package/dist/dtos/invoke-ai-prompt.dto.js +25 -0
- package/dist/dtos/invoke-ai-prompt.dto.js.map +1 -0
- package/dist/dtos/update-ai-interaction.dto.d.ts +15 -0
- package/dist/dtos/update-ai-interaction.dto.d.ts.map +1 -0
- package/dist/dtos/update-ai-interaction.dto.js +96 -0
- package/dist/dtos/update-ai-interaction.dto.js.map +1 -0
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts +13 -0
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts.map +1 -0
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js +86 -0
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js.map +1 -0
- package/dist/dtos/update-dashboard-question.dto.d.ts +18 -0
- package/dist/dtos/update-dashboard-question.dto.d.ts.map +1 -0
- package/dist/dtos/update-dashboard-question.dto.js +112 -0
- package/dist/dtos/update-dashboard-question.dto.js.map +1 -0
- package/dist/dtos/update-dashboard-variable.dto.d.ts +15 -0
- package/dist/dtos/update-dashboard-variable.dto.d.ts.map +1 -0
- package/dist/dtos/update-dashboard-variable.dto.js +95 -0
- package/dist/dtos/update-dashboard-variable.dto.js.map +1 -0
- package/dist/dtos/update-dashboard.dto.d.ts +16 -0
- package/dist/dtos/update-dashboard.dto.d.ts.map +1 -0
- package/dist/dtos/update-dashboard.dto.js +96 -0
- package/dist/dtos/update-dashboard.dto.js.map +1 -0
- package/dist/entities/ai-interaction.entity.d.ts +15 -0
- package/dist/entities/ai-interaction.entity.d.ts.map +1 -0
- package/dist/entities/ai-interaction.entity.js +70 -0
- package/dist/entities/ai-interaction.entity.js.map +1 -0
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts +13 -0
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +1 -0
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js +60 -0
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +1 -0
- package/dist/entities/dashboard-question.entity.d.ts +16 -0
- package/dist/entities/dashboard-question.entity.d.ts.map +1 -0
- package/dist/entities/dashboard-question.entity.js +71 -0
- package/dist/entities/dashboard-question.entity.js.map +1 -0
- package/dist/entities/dashboard-variable.entity.d.ts +15 -0
- package/dist/entities/dashboard-variable.entity.d.ts.map +1 -0
- package/dist/entities/dashboard-variable.entity.js +73 -0
- package/dist/entities/dashboard-variable.entity.js.map +1 -0
- package/dist/entities/dashboard.entity.d.ts +12 -0
- package/dist/entities/dashboard.entity.d.ts.map +1 -0
- package/dist/entities/dashboard.entity.js +50 -0
- package/dist/entities/dashboard.entity.js.map +1 -0
- package/dist/helpers/solid-registry.d.ts +9 -1
- package/dist/helpers/solid-registry.d.ts.map +1 -1
- package/dist/helpers/solid-registry.js +32 -0
- package/dist/helpers/solid-registry.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +26 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.d.ts +11 -0
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.d.ts.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.js +39 -0
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.js.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.d.ts +8 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.d.ts.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.js +10 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.js.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts +16 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js +71 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js.map +1 -0
- package/dist/mappers/dashboard-mapper.d.ts +6 -0
- package/dist/mappers/dashboard-mapper.d.ts.map +1 -0
- package/dist/mappers/dashboard-mapper.js +60 -0
- package/dist/mappers/dashboard-mapper.js.map +1 -0
- package/dist/repository/dashboard.repository.d.ts +9 -0
- package/dist/repository/dashboard.repository.d.ts.map +1 -0
- package/dist/repository/dashboard.repository.js +98 -0
- package/dist/repository/dashboard.repository.js.map +1 -0
- package/dist/seeders/module-metadata-seeder.service.d.ts +5 -1
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +18 -2
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +4172 -2411
- package/dist/services/ai-interaction.service.d.ts +31 -0
- package/dist/services/ai-interaction.service.d.ts.map +1 -0
- package/dist/services/ai-interaction.service.js +182 -0
- package/dist/services/ai-interaction.service.js.map +1 -0
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +8 -6
- package/dist/services/chatter-message.service.js.map +1 -1
- package/dist/services/dashboard-question-sql-dataset-config.service.d.ts +22 -0
- package/dist/services/dashboard-question-sql-dataset-config.service.d.ts.map +1 -0
- package/dist/services/dashboard-question-sql-dataset-config.service.js +56 -0
- package/dist/services/dashboard-question-sql-dataset-config.service.js.map +1 -0
- package/dist/services/dashboard-question.service.d.ts +29 -0
- package/dist/services/dashboard-question.service.d.ts.map +1 -0
- package/dist/services/dashboard-question.service.js +117 -0
- package/dist/services/dashboard-question.service.js.map +1 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts +12 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js +55 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js.map +1 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts +11 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js +45 -0
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js.map +1 -0
- package/dist/services/dashboard-variable.service.d.ts +23 -0
- package/dist/services/dashboard-variable.service.d.ts.map +1 -0
- package/dist/services/dashboard-variable.service.js +57 -0
- package/dist/services/dashboard-variable.service.js.map +1 -0
- package/dist/services/dashboard.service.d.ts +38 -0
- package/dist/services/dashboard.service.d.ts.map +1 -0
- package/dist/services/dashboard.service.js +179 -0
- package/dist/services/dashboard.service.js.map +1 -0
- package/dist/services/field-metadata.service.d.ts.map +1 -1
- package/dist/services/field-metadata.service.js +1 -0
- package/dist/services/field-metadata.service.js.map +1 -1
- package/dist/services/import-transaction.service.d.ts +3 -1
- package/dist/services/import-transaction.service.d.ts.map +1 -1
- package/dist/services/import-transaction.service.js +22 -0
- package/dist/services/import-transaction.service.js.map +1 -1
- package/dist/services/list-of-values.service.d.ts +1 -0
- package/dist/services/list-of-values.service.d.ts.map +1 -1
- package/dist/services/list-of-values.service.js +3 -0
- package/dist/services/list-of-values.service.js.map +1 -1
- package/dist/services/menu-item-metadata.service.d.ts.map +1 -1
- package/dist/services/menu-item-metadata.service.js +1 -1
- package/dist/services/menu-item-metadata.service.js.map +1 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts +36 -0
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts.map +1 -0
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js +89 -0
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js.map +1 -0
- package/dist/services/question-data-providers/helpers.d.ts +7 -0
- package/dist/services/question-data-providers/helpers.d.ts.map +1 -0
- package/dist/services/question-data-providers/helpers.js +25 -0
- package/dist/services/question-data-providers/helpers.js.map +1 -0
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts +17 -0
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts.map +1 -0
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js +70 -0
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js.map +1 -0
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts +19 -0
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts.map +1 -0
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js +92 -0
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js.map +1 -0
- package/dist/services/queues/publisher-factory.service.js +1 -1
- package/dist/services/queues/publisher-factory.service.js.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.service.d.ts.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.service.js +22 -11
- package/dist/services/scheduled-jobs/scheduler.service.js.map +1 -1
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts +11 -0
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts.map +1 -0
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js +46 -0
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js.map +1 -0
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts +11 -0
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts.map +1 -0
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js +47 -0
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js.map +1 -0
- package/dist/services/solid-introspect.service.d.ts +2 -0
- package/dist/services/solid-introspect.service.d.ts.map +1 -1
- package/dist/services/solid-introspect.service.js +28 -0
- package/dist/services/solid-introspect.service.js.map +1 -1
- package/dist/services/sql-expression-resolver.service.d.ts +9 -0
- package/dist/services/sql-expression-resolver.service.d.ts.map +1 -0
- package/dist/services/sql-expression-resolver.service.js +105 -0
- package/dist/services/sql-expression-resolver.service.js.map +1 -0
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +75 -1
- package/dist/solid-core.module.js.map +1 -1
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts +16 -0
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts.map +1 -0
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js +72 -0
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js.map +1 -0
- package/dist/subscribers/dashboard-question.subscriber.d.ts +16 -0
- package/dist/subscribers/dashboard-question.subscriber.d.ts.map +1 -0
- package/dist/subscribers/dashboard-question.subscriber.js +72 -0
- package/dist/subscribers/dashboard-question.subscriber.js.map +1 -0
- package/dist/subscribers/dashboard-variable.subscriber.d.ts +16 -0
- package/dist/subscribers/dashboard-variable.subscriber.d.ts.map +1 -0
- package/dist/subscribers/dashboard-variable.subscriber.js +72 -0
- package/dist/subscribers/dashboard-variable.subscriber.js.map +1 -0
- package/dist/subscribers/dashboard.subscriber.d.ts +15 -0
- package/dist/subscribers/dashboard.subscriber.d.ts.map +1 -0
- package/dist/subscribers/dashboard.subscriber.js +56 -0
- package/dist/subscribers/dashboard.subscriber.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/controllers/ai-interaction.controller.ts +104 -0
- package/src/controllers/dashboard-question-sql-dataset-config.controller.ts +93 -0
- package/src/controllers/dashboard-question.controller.ts +104 -0
- package/src/controllers/dashboard-variable.controller.ts +93 -0
- package/src/controllers/dashboard.controller.ts +99 -0
- package/src/controllers/test.controller.ts +1 -2
- package/src/decorators/dashboard-question-data-provider.decorator.ts +7 -0
- package/src/decorators/dashboard-selection-provider.decorator.ts +7 -0
- package/src/dtos/create-ai-interaction.dto.ts +60 -0
- package/src/dtos/create-dashboard-question-sql-dataset-config.dto.ts +42 -0
- package/src/dtos/create-dashboard-question.dto.ts +63 -0
- package/src/dtos/create-dashboard-variable.dto.ts +56 -0
- package/src/dtos/create-dashboard.dto.ts +53 -0
- package/src/dtos/dashboard-variable-selection-dynamic-query.dto.ts +29 -0
- package/src/dtos/invoke-ai-prompt.dto.ts +6 -0
- package/src/dtos/update-ai-interaction.dto.ts +65 -0
- package/src/dtos/update-dashboard-question-sql-dataset-config.dto.ts +49 -0
- package/src/dtos/update-dashboard-question.dto.ts +68 -0
- package/src/dtos/update-dashboard-variable.dto.ts +54 -0
- package/src/dtos/update-dashboard.dto.ts +57 -0
- package/src/entities/ai-interaction.entity.ts +39 -0
- package/src/entities/dashboard-question-sql-dataset-config.entity.ts +25 -0
- package/src/entities/dashboard-question.entity.ts +33 -0
- package/src/entities/dashboard-variable.entity.ts +30 -0
- package/src/entities/dashboard.entity.ts +21 -0
- package/src/helpers/solid-registry.ts +44 -2
- package/src/index.ts +10 -2
- package/src/interfaces.ts +57 -29
- package/src/jobs/database/trigger-mcp-client-publisher-database.service.ts +22 -0
- package/src/jobs/database/trigger-mcp-client-queue-options.ts +9 -0
- package/src/jobs/database/trigger-mcp-client-subscriber-database.service.ts +71 -0
- package/src/mappers/dashboard-mapper.ts +52 -0
- package/src/repository/dashboard.repository.ts +101 -0
- package/src/seeders/module-metadata-seeder.service.ts +21 -1
- package/src/seeders/seed-data/solid-core-metadata.json +4175 -2414
- package/src/services/ai-interaction.service.ts +163 -0
- package/src/services/chatter-message.service.ts +12 -6
- package/src/services/dashboard-question-sql-dataset-config.service.ts +34 -0
- package/src/services/dashboard-question.service.ts +115 -0
- package/src/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.ts +56 -0
- package/src/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.ts +37 -0
- package/src/services/dashboard-variable.service.ts +36 -0
- package/src/services/dashboard.service.ts +147 -0
- package/src/services/field-metadata.service.ts +1 -0
- package/src/services/import-transaction.service.ts +29 -1
- package/src/services/list-of-values.service.ts +5 -0
- package/src/services/menu-item-metadata.service.ts +2 -1
- package/src/services/question-data-providers/chartjs-sql-data-provider.service.ts +125 -0
- package/src/services/question-data-providers/helpers.ts +30 -0
- package/src/services/question-data-providers/prime-react-datatable-sql-data-provider.service.ts +78 -0
- package/src/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.ts +119 -0
- package/src/services/question-data-providers/test.sql +1 -0
- package/src/services/queues/publisher-factory.service.ts +1 -1
- package/src/services/scheduled-jobs/scheduler.service.ts +32 -64
- package/src/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.ts +41 -0
- package/src/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.ts +41 -0
- package/src/services/solid-introspect.service.ts +42 -0
- package/src/services/sql-expression-resolver.service.ts +125 -0
- package/src/solid-core.module.ts +77 -2
- package/src/subscribers/dashboard-question-sql-dataset-config.subscriber.ts +61 -0
- package/src/subscribers/dashboard-question.subscriber.ts +62 -0
- package/src/subscribers/dashboard-variable.subscriber.ts +63 -0
- package/src/subscribers/dashboard.subscriber.ts +43 -0
|
@@ -8,6 +8,8 @@ import { IS_SOLID_DATABASE_MODULE } from 'src/decorators/solid-database-module.d
|
|
|
8
8
|
import { SolidRegistry } from 'src/helpers/solid-registry';
|
|
9
9
|
import { CRUDService } from './crud.service';
|
|
10
10
|
import { IS_SCHEDULED_JOB_PROVIDER } from 'src/decorators/scheduled-job-provider.decorator';
|
|
11
|
+
import { IS_DASHBOARD_VARIABLE_SELECTION_PROVIDER } from 'src/decorators/dashboard-selection-provider.decorator';
|
|
12
|
+
import { IS_DASHBOARD_QUESTION_DATA_PROVIDER } from 'src/decorators/dashboard-question-data-provider.decorator';
|
|
11
13
|
|
|
12
14
|
@Injectable()
|
|
13
15
|
export class SolidIntrospectService implements OnApplicationBootstrap {
|
|
@@ -42,6 +44,26 @@ export class SolidIntrospectService implements OnApplicationBootstrap {
|
|
|
42
44
|
this.solidRegistry.registerSelectionProvider(selectionProvider);
|
|
43
45
|
});
|
|
44
46
|
|
|
47
|
+
// Register all IDashboardSelectionProvider implementations
|
|
48
|
+
const dashboardVariableSelectionProviders = this.discoveryService
|
|
49
|
+
.getProviders()
|
|
50
|
+
.filter((provider) => this.isDashboardVariableSelectionProvider(provider));
|
|
51
|
+
|
|
52
|
+
dashboardVariableSelectionProviders.forEach((dashboardSelectionProvider) => {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
this.solidRegistry.registerDashboardVariableSelectionProvider(dashboardSelectionProvider);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Register all IDashboardSelectionProvider implementations
|
|
58
|
+
const dashboardQuestionDataProviders = this.discoveryService
|
|
59
|
+
.getProviders()
|
|
60
|
+
.filter((provider) => this.isDashboardQuestionDataProvider(provider));
|
|
61
|
+
|
|
62
|
+
dashboardQuestionDataProviders.forEach((provider) => {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
this.solidRegistry.registerDashboardQuestionDataProvider(provider);
|
|
65
|
+
});
|
|
66
|
+
|
|
45
67
|
|
|
46
68
|
// Register all IComputedProvider implementations
|
|
47
69
|
const computedFieldProviders = this.discoveryService
|
|
@@ -94,6 +116,16 @@ export class SolidIntrospectService implements OnApplicationBootstrap {
|
|
|
94
116
|
|
|
95
117
|
}
|
|
96
118
|
|
|
119
|
+
isDashboardQuestionDataProvider(providerWrapper: InstanceWrapper<any>) {
|
|
120
|
+
const { instance } = providerWrapper;
|
|
121
|
+
if (!instance) return false;
|
|
122
|
+
const provider = this.reflector.get<boolean>(
|
|
123
|
+
IS_DASHBOARD_QUESTION_DATA_PROVIDER,
|
|
124
|
+
instance.constructor,
|
|
125
|
+
);
|
|
126
|
+
return !!provider;
|
|
127
|
+
}
|
|
128
|
+
|
|
97
129
|
// This method identifies a provider as a seeder if it has a seed method i.e duck typing
|
|
98
130
|
private isSeeder(provider: InstanceWrapper) {
|
|
99
131
|
const { instance } = provider;
|
|
@@ -118,6 +150,16 @@ export class SolidIntrospectService implements OnApplicationBootstrap {
|
|
|
118
150
|
return !!isSelectionProvider;
|
|
119
151
|
}
|
|
120
152
|
|
|
153
|
+
private isDashboardVariableSelectionProvider(provider: InstanceWrapper) {
|
|
154
|
+
const { instance } = provider;
|
|
155
|
+
if (!instance) return false;
|
|
156
|
+
const isDashboardSelectionProvider = this.reflector.get<boolean>(
|
|
157
|
+
IS_DASHBOARD_VARIABLE_SELECTION_PROVIDER,
|
|
158
|
+
instance.constructor,
|
|
159
|
+
);
|
|
160
|
+
return !!isDashboardSelectionProvider;
|
|
161
|
+
}
|
|
162
|
+
|
|
121
163
|
private isComputedFieldProvider(provider: InstanceWrapper) {
|
|
122
164
|
const { instance } = provider;
|
|
123
165
|
if (!instance) return false;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Injectable } from "@nestjs/common";
|
|
2
|
+
import { SqlExpression, SqlExpressionOperator } from "./question-data-providers/chartjs-sql-data-provider.service";
|
|
3
|
+
|
|
4
|
+
export interface SqlReplacementResult {
|
|
5
|
+
rawSql: string;
|
|
6
|
+
parameters: any[]; // Positional parameters
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class SqlExpressionResolverService {
|
|
11
|
+
resolveSqlWithExpressions(sql: string, expressions: SqlExpression[]): SqlReplacementResult {
|
|
12
|
+
const variableToColumnMap: Record<string, string> = {};
|
|
13
|
+
const variablePattern = /{{\s*(\w+)\s*\[\s*([\w.]+)\s*\]\s*}}/g;
|
|
14
|
+
|
|
15
|
+
// --- Pass 1: extract variable -> column mappings ---
|
|
16
|
+
let simplifiedSql = sql.replace(variablePattern, (_, variableName, columnName) => {
|
|
17
|
+
variableToColumnMap[variableName] = columnName;
|
|
18
|
+
return `{{${variableName}}}`;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// --- Pass 2: Replace each variable with positional fragment ---
|
|
22
|
+
let paramIndex = 1;
|
|
23
|
+
const parameters: any[] = [];
|
|
24
|
+
|
|
25
|
+
for (const expr of expressions) {
|
|
26
|
+
const column = variableToColumnMap[expr.variableName];
|
|
27
|
+
if (!column) continue;
|
|
28
|
+
|
|
29
|
+
let sqlFragment = '';
|
|
30
|
+
const placeholder = `{{${expr.variableName}}}`;
|
|
31
|
+
|
|
32
|
+
switch (expr.operator) {
|
|
33
|
+
case SqlExpressionOperator.EQUALS:
|
|
34
|
+
sqlFragment = `${column} = $${paramIndex++}`;
|
|
35
|
+
parameters.push(expr.value[0]);
|
|
36
|
+
break;
|
|
37
|
+
|
|
38
|
+
case SqlExpressionOperator.NOT_EQUALS:
|
|
39
|
+
sqlFragment = `${column} != $${paramIndex++}`;
|
|
40
|
+
parameters.push(expr.value[0]);
|
|
41
|
+
break;
|
|
42
|
+
|
|
43
|
+
case SqlExpressionOperator.CONTAINS:
|
|
44
|
+
sqlFragment = `${column} LIKE $${paramIndex++}`;
|
|
45
|
+
parameters.push(`%${expr.value[0]}%`);
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
case SqlExpressionOperator.NOT_CONTAINS:
|
|
49
|
+
sqlFragment = `${column} NOT LIKE $${paramIndex++}`;
|
|
50
|
+
parameters.push(`%${expr.value[0]}%`);
|
|
51
|
+
break;
|
|
52
|
+
|
|
53
|
+
case SqlExpressionOperator.STARTS_WITH:
|
|
54
|
+
sqlFragment = `${column} LIKE $${paramIndex++}`;
|
|
55
|
+
parameters.push(`${expr.value[0]}%`);
|
|
56
|
+
break;
|
|
57
|
+
|
|
58
|
+
case SqlExpressionOperator.ENDS_WITH:
|
|
59
|
+
sqlFragment = `${column} LIKE $${paramIndex++}`;
|
|
60
|
+
parameters.push(`%${expr.value[0]}`);
|
|
61
|
+
break;
|
|
62
|
+
|
|
63
|
+
case SqlExpressionOperator.IN:
|
|
64
|
+
const inParams = expr.value.map(val => {
|
|
65
|
+
parameters.push(val);
|
|
66
|
+
return `$${paramIndex++}`;
|
|
67
|
+
});
|
|
68
|
+
sqlFragment = `${column} IN (${inParams.join(", ")})`;
|
|
69
|
+
break;
|
|
70
|
+
|
|
71
|
+
case SqlExpressionOperator.NOT_IN:
|
|
72
|
+
const notInParams = expr.value.map(val => {
|
|
73
|
+
parameters.push(val);
|
|
74
|
+
return `$${paramIndex++}`;
|
|
75
|
+
});
|
|
76
|
+
sqlFragment = `${column} NOT IN (${notInParams.join(", ")})`;
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
case SqlExpressionOperator.BETWEEN:
|
|
80
|
+
sqlFragment = `${column} BETWEEN $${paramIndex} AND $${paramIndex + 1}`;
|
|
81
|
+
parameters.push(expr.value[0], expr.value[1]);
|
|
82
|
+
paramIndex += 2;
|
|
83
|
+
break;
|
|
84
|
+
|
|
85
|
+
case SqlExpressionOperator.LT:
|
|
86
|
+
sqlFragment = `${column} < $${paramIndex++}`;
|
|
87
|
+
parameters.push(expr.value[0]);
|
|
88
|
+
break;
|
|
89
|
+
|
|
90
|
+
case SqlExpressionOperator.LTE:
|
|
91
|
+
sqlFragment = `${column} <= $${paramIndex++}`;
|
|
92
|
+
parameters.push(expr.value[0]);
|
|
93
|
+
break;
|
|
94
|
+
|
|
95
|
+
case SqlExpressionOperator.GT:
|
|
96
|
+
sqlFragment = `${column} > $${paramIndex++}`;
|
|
97
|
+
parameters.push(expr.value[0]);
|
|
98
|
+
break;
|
|
99
|
+
|
|
100
|
+
case SqlExpressionOperator.GTE:
|
|
101
|
+
sqlFragment = `${column} >= $${paramIndex++}`;
|
|
102
|
+
parameters.push(expr.value[0]);
|
|
103
|
+
break;
|
|
104
|
+
|
|
105
|
+
default:
|
|
106
|
+
throw new Error(`Unsupported SQL operator: ${expr.operator}`);
|
|
107
|
+
}
|
|
108
|
+
simplifiedSql = simplifiedSql.replace(placeholder, sqlFragment);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// --- Final cleanup: remove any remaining placeholders ---
|
|
112
|
+
simplifiedSql = simplifiedSql.replace(/{{\s*\w+\s*}}/g, '');
|
|
113
|
+
|
|
114
|
+
// Remove dangling where clause if no expressions were applied
|
|
115
|
+
simplifiedSql = simplifiedSql.replace(/\bwhere\b\s*$/i, '').trim();
|
|
116
|
+
|
|
117
|
+
// Need to handle scenarios of complex expression i.e with and / or clauses. probably need to have this logic in the sql expression object itself
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
rawSql: simplifiedSql,
|
|
122
|
+
parameters
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
package/src/solid-core.module.ts
CHANGED
|
@@ -128,9 +128,15 @@ import { PermissionMetadataController } from './controllers/permission-metadata.
|
|
|
128
128
|
import { PermissionMetadata } from './entities/permission-metadata.entity';
|
|
129
129
|
import { PermissionMetadataService } from './services/permission-metadata.service';
|
|
130
130
|
|
|
131
|
+
import { ScheduleModule } from '@nestjs/schedule';
|
|
131
132
|
import { ClsModule } from 'nestjs-cls';
|
|
133
|
+
import { AiInteractionController } from './controllers/ai-interaction.controller';
|
|
132
134
|
import { ChatterMessageDetailsController } from './controllers/chatter-message-details.controller';
|
|
133
135
|
import { ChatterMessageController } from './controllers/chatter-message.controller';
|
|
136
|
+
import { DashboardQuestionSqlDatasetConfigController } from './controllers/dashboard-question-sql-dataset-config.controller';
|
|
137
|
+
import { DashboardQuestionController } from './controllers/dashboard-question.controller';
|
|
138
|
+
import { DashboardVariableController } from './controllers/dashboard-variable.controller';
|
|
139
|
+
import { DashboardController } from './controllers/dashboard.controller';
|
|
134
140
|
import { ExportTemplateController } from './controllers/export-template.controller';
|
|
135
141
|
import { ExportTransactionController } from './controllers/export-transaction.controller';
|
|
136
142
|
import { ImportTransactionErrorLogController } from './controllers/import-transaction-error-log.controller';
|
|
@@ -145,8 +151,13 @@ import { SettingController } from './controllers/setting.controller';
|
|
|
145
151
|
import { UserActivityHistoryController } from './controllers/user-activity-history.controller';
|
|
146
152
|
import { UserViewMetadataController } from './controllers/user-view-metadata.controller';
|
|
147
153
|
import { UserController } from './controllers/user.controller';
|
|
154
|
+
import { AiInteraction } from './entities/ai-interaction.entity';
|
|
148
155
|
import { ChatterMessageDetails } from './entities/chatter-message-details.entity';
|
|
149
156
|
import { ChatterMessage } from './entities/chatter-message.entity';
|
|
157
|
+
import { DashboardQuestionSqlDatasetConfig } from './entities/dashboard-question-sql-dataset-config.entity';
|
|
158
|
+
import { DashboardQuestion } from './entities/dashboard-question.entity';
|
|
159
|
+
import { DashboardVariable } from './entities/dashboard-variable.entity';
|
|
160
|
+
import { Dashboard } from './entities/dashboard.entity';
|
|
150
161
|
import { ExportTemplate } from './entities/export-template.entity';
|
|
151
162
|
import { ExportTransaction } from './entities/export-transaction.entity';
|
|
152
163
|
import { ImportTransactionErrorLog } from './entities/import-transaction-error-log.entity';
|
|
@@ -160,6 +171,7 @@ import { Setting } from './entities/setting.entity';
|
|
|
160
171
|
import { UserActivityHistory } from './entities/user-activity-history.entity';
|
|
161
172
|
import { UserViewMetadata } from './entities/user-view-metadata.entity';
|
|
162
173
|
import { User } from './entities/user.entity';
|
|
174
|
+
import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
163
175
|
import { ModelMetadataHelperService } from './helpers/model-metadata-helper.service';
|
|
164
176
|
import { ModuleMetadataHelperService } from './helpers/module-metadata-helper.service';
|
|
165
177
|
import { ApiEmailQueuePublisherDatabase } from './jobs/database/api-email-publisher-database.service';
|
|
@@ -174,19 +186,30 @@ import { OTPQueuePublisherDatabase } from './jobs/database/otp-publisher-databas
|
|
|
174
186
|
import { OTPQueueSubscriberDatabase } from './jobs/database/otp-subscriber-database.service';
|
|
175
187
|
import { SmsQueuePublisherDatabase } from './jobs/database/sms-publisher-database.service';
|
|
176
188
|
import { SmsQueueSubscriberDatabase } from './jobs/database/sms-subscriber-database.service';
|
|
189
|
+
import { TriggerMcpClientPublisherDatabase } from './jobs/database/trigger-mcp-client-publisher-database.service';
|
|
190
|
+
import { TriggerMcpClientSubscriberDatabase } from './jobs/database/trigger-mcp-client-subscriber-database.service';
|
|
177
191
|
import { WhatsappQueuePublisherDatabase } from './jobs/database/whatsapp-publisher-database.service';
|
|
178
192
|
import { WhatsappQueueSubscriberDatabase } from './jobs/database/whatsapp-subscriber-database.service';
|
|
193
|
+
import { DashboardMapper } from './mappers/dashboard-mapper';
|
|
194
|
+
import { DashboardRepository } from './repository/dashboard.repository';
|
|
179
195
|
import { FieldMetadataRepository } from './repository/field-metadata.repository';
|
|
180
196
|
import { FieldRepository } from './repository/field.repository';
|
|
181
197
|
import { MediaRepository } from './repository/media.repository';
|
|
182
198
|
import { SecurityRuleRepository } from './repository/security-rule.repository';
|
|
183
199
|
import { PermissionMetadataSeederService } from './seeders/permission-metadata-seeder.service';
|
|
184
200
|
import { SystemFieldsSeederService } from './seeders/system-fields-seeder.service';
|
|
201
|
+
import { AiInteractionService } from './services/ai-interaction.service';
|
|
185
202
|
import { ChatterMessageDetailsService } from './services/chatter-message-details.service';
|
|
186
203
|
import { ChatterMessageService } from './services/chatter-message.service';
|
|
187
204
|
import { ConcatComputedFieldProvider } from './services/computed-fields/concat-computed-field-provider.service';
|
|
188
205
|
import { ConcatEntityComputedFieldProvider } from './services/computed-fields/entity/concat-entity-computed-field-provider.service';
|
|
189
206
|
import { CsvService } from './services/csv.service';
|
|
207
|
+
import { DashboardQuestionSqlDatasetConfigService } from './services/dashboard-question-sql-dataset-config.service';
|
|
208
|
+
import { DashboardQuestionService } from './services/dashboard-question.service';
|
|
209
|
+
import { DashboardVariableSQLDynamicProvider } from './services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service';
|
|
210
|
+
import { DasbhoardVariableTestDynamicProvider } from './services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service';
|
|
211
|
+
import { DashboardVariableService } from './services/dashboard-variable.service';
|
|
212
|
+
import { DashboardService } from './services/dashboard.service';
|
|
190
213
|
import { ExcelService } from './services/excel.service';
|
|
191
214
|
import { ExportTemplateService } from './services/export-template.service';
|
|
192
215
|
import { ExportTransactionService } from './services/export-transaction.service';
|
|
@@ -195,6 +218,9 @@ import { ImportTransactionService } from './services/import-transaction.service'
|
|
|
195
218
|
import { LocaleService } from './services/locale.service';
|
|
196
219
|
import { FileS3StorageProvider } from './services/mediaStorageProviders/file-s3-storage-provider';
|
|
197
220
|
import { FileStorageProvider } from './services/mediaStorageProviders/file-storage-provider';
|
|
221
|
+
import { ChartJsSqlDataProvider } from './services/question-data-providers/chartjs-sql-data-provider.service';
|
|
222
|
+
import { PrimeReactDatatableSqlDataProvider } from './services/question-data-providers/prime-react-datatable-sql-data-provider.service';
|
|
223
|
+
import { PrimeReactMeterGroupSqlDataProvider } from './services/question-data-providers/prime-react-meter-group-sql-data-provider.service';
|
|
198
224
|
import { PublisherFactory } from './services/queues/publisher-factory.service';
|
|
199
225
|
import { RequestContextService } from './services/request-context.service';
|
|
200
226
|
import { RoleMetadataService } from './services/role-metadata.service';
|
|
@@ -202,18 +228,25 @@ import { SavedFiltersService } from './services/saved-filters.service';
|
|
|
202
228
|
import { ScheduledJobService } from './services/scheduled-job.service';
|
|
203
229
|
import { SchedulerServiceImpl } from './services/scheduled-jobs/scheduler.service';
|
|
204
230
|
import { SecurityRuleService } from './services/security-rule.service';
|
|
231
|
+
import { ListOfDashboardQuestionProvidersSelectionProvider } from './services/selection-providers/list-of-dashboard-question-providers-selection-provider.service';
|
|
232
|
+
import { ListOfDashboardVariableProvidersSelectionProvider } from './services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service';
|
|
205
233
|
import { ListOfScheduledJobsSelectionProvider } from './services/selection-providers/list-of-scheduled-jobs-selection-provider.service';
|
|
206
234
|
import { LocaleListSelectionProvider } from './services/selection-providers/locale-list-selection-provider.service';
|
|
207
235
|
import { SettingService } from './services/setting.service';
|
|
236
|
+
import { SqlExpressionResolverService } from './services/sql-expression-resolver.service';
|
|
208
237
|
import { UserActivityHistoryService } from './services/user-activity-history.service';
|
|
209
238
|
import { UserViewMetadataService } from './services/user-view-metadata.service';
|
|
210
239
|
import { UserService } from './services/user.service';
|
|
211
240
|
import { AuditSubscriber } from './subscribers/audit.subscriber';
|
|
212
241
|
import { ComputedEntityFieldSubscriber } from './subscribers/computed-entity-field.subscriber';
|
|
213
242
|
import { CreatedByUpdatedBySubscriber } from './subscribers/created-by-updated-by.subscriber';
|
|
243
|
+
import { DashboardQuestionSqlDatasetConfigSubscriber } from './subscribers/dashboard-question-sql-dataset-config.subscriber';
|
|
244
|
+
import { DashboardQuestionSubscriber } from './subscribers/dashboard-question.subscriber';
|
|
245
|
+
import { DashboardVariableSubscriber } from './subscribers/dashboard-variable.subscriber';
|
|
246
|
+
import { DashboardSubscriber } from './subscribers/dashboard.subscriber';
|
|
214
247
|
import { SecurityRuleSubscriber } from './subscribers/security-rule.subscriber';
|
|
215
248
|
import { ViewMetadataSubsciber } from './subscribers/view-metadata.subscriber';
|
|
216
|
-
import {
|
|
249
|
+
import { CRUDService } from './services/crud.service';
|
|
217
250
|
|
|
218
251
|
|
|
219
252
|
@Global()
|
|
@@ -252,12 +285,14 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
252
285
|
ImportTransaction,
|
|
253
286
|
ImportTransactionErrorLog,
|
|
254
287
|
UserActivityHistory,
|
|
288
|
+
AiInteraction,
|
|
255
289
|
]),
|
|
256
290
|
ConfigModule.forFeature(appBuilderConfig),
|
|
257
291
|
ConfigModule.forFeature(commonConfig),
|
|
258
292
|
ConfigModule.forFeature(iamConfig),
|
|
259
293
|
ConfigModule.forFeature(jwtConfig),
|
|
260
294
|
JwtModule.registerAsync(jwtConfig.asProvider()),
|
|
295
|
+
ScheduleModule.forRoot(),
|
|
261
296
|
ServeStaticModule.forRoot({
|
|
262
297
|
rootPath: join(process.cwd(), 'media-files-storage'),
|
|
263
298
|
serveRoot: '/media-files-storage',
|
|
@@ -272,6 +307,11 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
272
307
|
HttpModule,
|
|
273
308
|
ConfigModule,
|
|
274
309
|
ClsModule,
|
|
310
|
+
TypeOrmModule.forFeature([Dashboard]),
|
|
311
|
+
TypeOrmModule.forFeature([DashboardVariable]),
|
|
312
|
+
TypeOrmModule.forFeature([DashboardQuestion]),
|
|
313
|
+
TypeOrmModule.forFeature([DashboardQuestionSqlDatasetConfig]),
|
|
314
|
+
TypeOrmModule.forFeature([AiInteraction]),
|
|
275
315
|
],
|
|
276
316
|
controllers: [
|
|
277
317
|
ModuleMetadataController,
|
|
@@ -310,6 +350,11 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
310
350
|
ImportTransactionController,
|
|
311
351
|
ImportTransactionErrorLogController,
|
|
312
352
|
UserActivityHistoryController,
|
|
353
|
+
DashboardController,
|
|
354
|
+
DashboardVariableController,
|
|
355
|
+
DashboardQuestionController,
|
|
356
|
+
DashboardQuestionSqlDatasetConfigController,
|
|
357
|
+
AiInteractionController,
|
|
313
358
|
],
|
|
314
359
|
providers: [
|
|
315
360
|
{
|
|
@@ -343,6 +388,7 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
343
388
|
SolidIntrospectService,
|
|
344
389
|
DiscoveryService,
|
|
345
390
|
CrudHelperService,
|
|
391
|
+
CRUDService,
|
|
346
392
|
Reflector,
|
|
347
393
|
MetadataScanner,
|
|
348
394
|
CommandService,
|
|
@@ -371,6 +417,10 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
371
417
|
SmsTemplateService,
|
|
372
418
|
EmailTemplateService,
|
|
373
419
|
PublisherFactory,
|
|
420
|
+
|
|
421
|
+
TriggerMcpClientPublisherDatabase,
|
|
422
|
+
TriggerMcpClientSubscriberDatabase,
|
|
423
|
+
|
|
374
424
|
EmailQueuePublisher,
|
|
375
425
|
EmailQueueSubscriber,
|
|
376
426
|
EmailQueuePublisherDatabase,
|
|
@@ -454,7 +504,25 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
454
504
|
ComputedFieldEvaluationSubscriber,
|
|
455
505
|
ConcatEntityComputedFieldProvider,
|
|
456
506
|
UserActivityHistoryService,
|
|
457
|
-
|
|
507
|
+
DashboardService,
|
|
508
|
+
DashboardVariableService,
|
|
509
|
+
DashboardQuestionService,
|
|
510
|
+
DashboardVariableSQLDynamicProvider,
|
|
511
|
+
DasbhoardVariableTestDynamicProvider,
|
|
512
|
+
ListOfDashboardVariableProvidersSelectionProvider,
|
|
513
|
+
ListOfDashboardQuestionProvidersSelectionProvider,
|
|
514
|
+
DashboardQuestionSqlDatasetConfigService,
|
|
515
|
+
ChartJsSqlDataProvider,
|
|
516
|
+
PrimeReactMeterGroupSqlDataProvider,
|
|
517
|
+
PrimeReactDatatableSqlDataProvider,
|
|
518
|
+
SqlExpressionResolverService,
|
|
519
|
+
AiInteractionService,
|
|
520
|
+
DashboardMapper,
|
|
521
|
+
DashboardRepository,
|
|
522
|
+
DashboardSubscriber,
|
|
523
|
+
DashboardVariableSubscriber,
|
|
524
|
+
DashboardQuestionSubscriber,
|
|
525
|
+
DashboardQuestionSqlDatasetConfigSubscriber,
|
|
458
526
|
],
|
|
459
527
|
exports: [
|
|
460
528
|
ModuleMetadataService,
|
|
@@ -464,6 +532,7 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
464
532
|
MediaService,
|
|
465
533
|
DiscoveryService,
|
|
466
534
|
CrudHelperService,
|
|
535
|
+
CRUDService,
|
|
467
536
|
MulterModule,
|
|
468
537
|
FileService,
|
|
469
538
|
SolidRegistry,
|
|
@@ -487,6 +556,12 @@ import { HttpExceptionFilter } from './filters/http-exception.filter';
|
|
|
487
556
|
FieldRepository,
|
|
488
557
|
SchedulerServiceImpl,
|
|
489
558
|
UserActivityHistoryService,
|
|
559
|
+
CsvService,
|
|
560
|
+
ExcelService,
|
|
561
|
+
SolidIntrospectService,
|
|
562
|
+
ImportTransactionService,
|
|
563
|
+
HttpModule,
|
|
564
|
+
ListOfValuesService
|
|
490
565
|
],
|
|
491
566
|
})
|
|
492
567
|
export class SolidCoreModule { }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Injectable, Logger } from "@nestjs/common";
|
|
2
|
+
import { InjectDataSource } from "@nestjs/typeorm";
|
|
3
|
+
import { DashboardQuestionSqlDatasetConfig } from "src/entities/dashboard-question-sql-dataset-config.entity";
|
|
4
|
+
import { DashboardQuestion } from "src/entities/dashboard-question.entity";
|
|
5
|
+
import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
|
|
6
|
+
import { DashboardService } from "src/services/dashboard.service";
|
|
7
|
+
import { DataSource, EntityManager, EntitySubscriberInterface, InsertEvent, UpdateEvent } from "typeorm";
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class DashboardQuestionSqlDatasetConfigSubscriber implements EntitySubscriberInterface<DashboardQuestionSqlDatasetConfig> {
|
|
11
|
+
private readonly logger = new Logger(this.constructor.name);
|
|
12
|
+
constructor(
|
|
13
|
+
@InjectDataSource()
|
|
14
|
+
private readonly dataSource: DataSource,
|
|
15
|
+
readonly moduleMetadataHelperService: ModuleMetadataHelperService,
|
|
16
|
+
readonly dashboardService: DashboardService, // Assuming you have a DashboardService for custom queries
|
|
17
|
+
) {
|
|
18
|
+
this.dataSource.subscribers.push(this);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
listenTo() {
|
|
22
|
+
return DashboardQuestionSqlDatasetConfig;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async afterInsert(event: InsertEvent<DashboardQuestionSqlDatasetConfig>) {
|
|
26
|
+
const question = event.entity.question;
|
|
27
|
+
if (!question) {
|
|
28
|
+
this.logger.debug('No question found in the QuestionSqlDatasetConfigSubscriber afterInsert method');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await this.saveQuestionToConfig(question, event.queryRunner.manager);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async afterUpdate(event: UpdateEvent<DashboardQuestionSqlDatasetConfig>) {
|
|
35
|
+
const question = event.databaseEntity.question;
|
|
36
|
+
if (!question) {
|
|
37
|
+
this.logger.debug('No question found in the QuestionSqlDatasetConfigSubscriber afterUpdate method');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
await this.saveQuestionToConfig(question, event.queryRunner.manager);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private async saveQuestionToConfig(question: DashboardQuestion, entityManager: EntityManager): Promise<void> {
|
|
44
|
+
// Populate the dashboard for the question
|
|
45
|
+
const populatedQuestion = await entityManager.findOne(DashboardQuestion, {
|
|
46
|
+
where: {
|
|
47
|
+
id: question.id,
|
|
48
|
+
},
|
|
49
|
+
relations: ['dashboard', 'dashboard.module', 'dashboard.dashboardVariables', 'dashboard.questions', 'dashboard.questions.questionSqlDatasetConfigs'],
|
|
50
|
+
});
|
|
51
|
+
const dashboard = populatedQuestion?.dashboard;
|
|
52
|
+
|
|
53
|
+
if (!dashboard) {
|
|
54
|
+
throw new Error(`Dashboard not found for question id ${question.id}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Call the saveDashboardToConfig method from the DashboardService
|
|
58
|
+
await this.dashboardService.saveDashboardToConfig(dashboard);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Injectable, Logger } from "@nestjs/common";
|
|
2
|
+
import { InjectDataSource } from "@nestjs/typeorm";
|
|
3
|
+
import { DashboardQuestion } from "src/entities/dashboard-question.entity";
|
|
4
|
+
import { Dashboard } from "src/entities/dashboard.entity";
|
|
5
|
+
import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
|
|
6
|
+
import { DashboardService } from "src/services/dashboard.service";
|
|
7
|
+
import { DataSource, EntityManager, EntitySubscriberInterface, InsertEvent, UpdateEvent } from "typeorm";
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class DashboardQuestionSubscriber implements EntitySubscriberInterface<DashboardQuestion> {
|
|
11
|
+
private readonly logger = new Logger(this.constructor.name);
|
|
12
|
+
constructor(
|
|
13
|
+
@InjectDataSource()
|
|
14
|
+
private readonly dataSource: DataSource,
|
|
15
|
+
readonly moduleMetadataHelperService: ModuleMetadataHelperService,
|
|
16
|
+
readonly dashboardService: DashboardService,
|
|
17
|
+
) {
|
|
18
|
+
this.dataSource.subscribers.push(this);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
listenTo() {
|
|
22
|
+
return DashboardQuestion;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async afterInsert(event: InsertEvent<DashboardQuestion>) {
|
|
26
|
+
if (!event.entity) {
|
|
27
|
+
this.logger.debug('No question entity found in the QuestionSubscriber afterInsert method');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
await this.saveDashboardToConfig(event.entity, event.queryRunner.manager);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async afterUpdate(event: UpdateEvent<DashboardQuestion>) {
|
|
34
|
+
if (!event.databaseEntity) {
|
|
35
|
+
this.logger.debug('No question entity found in the QuestionSubscriber afterUpdate method');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
await this.saveDashboardToConfig(event.databaseEntity, event.queryRunner.manager);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private async saveDashboardToConfig(question: DashboardQuestion, entityManager: EntityManager): Promise<void> {
|
|
42
|
+
const dashboard = question.dashboard;
|
|
43
|
+
// Get the dashboard from the question & call the saveDashboardToConfig method
|
|
44
|
+
if (!dashboard) {
|
|
45
|
+
this.logger.debug(`Dashboard is undefined for question id ${question.id}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// populate the dashboard with its variables
|
|
50
|
+
const populatedDashboard = await entityManager.findOne(Dashboard, {
|
|
51
|
+
where: { id: dashboard.id },
|
|
52
|
+
relations: ['module','dashboardVariables', 'questions', 'questions.questionSqlDatasetConfigs'],
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (!populatedDashboard) {
|
|
56
|
+
throw new Error(`Dashboard not found for question id ${populatedDashboard.id}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Call the saveDashboardToConfig method from the DashboardService
|
|
60
|
+
await this.dashboardService.saveDashboardToConfig(populatedDashboard);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Injectable, Logger } from "@nestjs/common";
|
|
2
|
+
import { InjectDataSource } from "@nestjs/typeorm";
|
|
3
|
+
import { DashboardVariable } from "src/entities/dashboard-variable.entity";
|
|
4
|
+
import { Dashboard } from "src/entities/dashboard.entity";
|
|
5
|
+
import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
|
|
6
|
+
import { DashboardVariableService } from "src/services/dashboard-variable.service";
|
|
7
|
+
import { DashboardService } from "src/services/dashboard.service";
|
|
8
|
+
import { EntitySubscriberInterface, DataSource, InsertEvent, UpdateEvent, EntityManager } from "typeorm";
|
|
9
|
+
|
|
10
|
+
@Injectable()
|
|
11
|
+
export class DashboardVariableSubscriber implements EntitySubscriberInterface<DashboardVariable> {
|
|
12
|
+
private readonly logger = new Logger(this.constructor.name);
|
|
13
|
+
constructor(
|
|
14
|
+
@InjectDataSource()
|
|
15
|
+
private readonly dataSource: DataSource,
|
|
16
|
+
readonly moduleMetadataHelperService: ModuleMetadataHelperService,
|
|
17
|
+
readonly dashboardService: DashboardService, // Assuming you have a DashboardService for custom queries
|
|
18
|
+
) {
|
|
19
|
+
this.dataSource.subscribers.push(this);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
listenTo() {
|
|
23
|
+
return DashboardVariable;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async afterInsert(event: InsertEvent<DashboardVariable>) {
|
|
27
|
+
if (!event.entity) {
|
|
28
|
+
this.logger.debug('No dashboard variable entity found in the DashboardVariableSubscriber afterInsert method');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await this.saveDashboardToConfig(event.entity, event.queryRunner.manager);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async afterUpdate(event: UpdateEvent<DashboardVariable>) {
|
|
35
|
+
if (!event.databaseEntity) {
|
|
36
|
+
this.logger.debug('No dashboard variable entity found in the DashboardVariableSubscriber afterUpdate method');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
await this.saveDashboardToConfig(event.databaseEntity, event.queryRunner.manager);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private async saveDashboardToConfig(dashboardVariable: DashboardVariable, entityManager: EntityManager): Promise<void> {
|
|
43
|
+
const dashboard = dashboardVariable.dashboard;
|
|
44
|
+
// Get the dashboard from the question & call the saveDashboardToConfig method
|
|
45
|
+
if (!dashboard) {
|
|
46
|
+
this.logger.debug(`Dashboard is undefined for dashboard variable id ${dashboardVariable.id}`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// populate the dashboard with its variables
|
|
51
|
+
const populatedDashboard = await entityManager.findOne(Dashboard, {
|
|
52
|
+
where: { id: dashboard.id },
|
|
53
|
+
relations: ['module','dashboardVariables', 'questions', 'questions.questionSqlDatasetConfigs'],
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (!populatedDashboard) {
|
|
57
|
+
throw new Error(`Dashboard not found for question id ${populatedDashboard.id}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Call the saveDashboardToConfig method from the DashboardService
|
|
61
|
+
await this.dashboardService.saveDashboardToConfig(populatedDashboard);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
2
|
+
import { InjectDataSource } from "@nestjs/typeorm";
|
|
3
|
+
import * as fs from 'fs/promises'; // Use the Promise-based version of fs for async/await
|
|
4
|
+
import { Dashboard } from 'src/entities/dashboard.entity';
|
|
5
|
+
import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
|
|
6
|
+
import { DashboardMapper } from 'src/mappers/dashboard-mapper';
|
|
7
|
+
import { DashboardService } from 'src/services/dashboard.service';
|
|
8
|
+
import { DataSource, EntitySubscriberInterface, InsertEvent, UpdateEvent } from "typeorm";
|
|
9
|
+
|
|
10
|
+
@Injectable()
|
|
11
|
+
export class DashboardSubscriber implements EntitySubscriberInterface<Dashboard> {
|
|
12
|
+
private readonly logger = new Logger(this.constructor.name);
|
|
13
|
+
constructor(
|
|
14
|
+
@InjectDataSource()
|
|
15
|
+
private readonly dataSource: DataSource,
|
|
16
|
+
readonly moduleMetadataHelperService: ModuleMetadataHelperService,
|
|
17
|
+
readonly dashboardService: DashboardService, // Assuming you have a DashboardService for custom queries
|
|
18
|
+
) {
|
|
19
|
+
this.dataSource.subscribers.push(this);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
listenTo() {
|
|
23
|
+
return Dashboard;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async afterInsert(event: InsertEvent<Dashboard>) {
|
|
27
|
+
if (!event.entity) {
|
|
28
|
+
this.logger.debug('No dashboard entity found in the DashboardSubscriber afterInsert method');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await this.dashboardService.saveDashboardToConfig(event.entity);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async afterUpdate(event: UpdateEvent<Dashboard>) {
|
|
35
|
+
if (!event.entity) {
|
|
36
|
+
this.logger.debug('No dashboard entity found in the DashboardSubscriber afterInsert method');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await this.dashboardService.saveDashboardToConfig(event.databaseEntity);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|