@solidxai/core 0.1.6-beta.2 → 0.1.6-beta.21
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/dashboard-layout.controller.d.ts +47 -0
- package/dist/controllers/dashboard-layout.controller.d.ts.map +1 -0
- package/dist/controllers/dashboard-layout.controller.js +204 -0
- package/dist/controllers/dashboard-layout.controller.js.map +1 -0
- package/dist/controllers/scheduled-job.controller.d.ts +1 -0
- package/dist/controllers/scheduled-job.controller.d.ts.map +1 -1
- package/dist/controllers/scheduled-job.controller.js +12 -0
- package/dist/controllers/scheduled-job.controller.js.map +1 -1
- package/dist/dtos/create-dashboard-layout.dto.d.ts +8 -0
- package/dist/dtos/create-dashboard-layout.dto.d.ts.map +1 -0
- package/dist/dtos/create-dashboard-layout.dto.js +53 -0
- package/dist/dtos/create-dashboard-layout.dto.js.map +1 -0
- package/dist/dtos/create-dashboard-variable.dto.d.ts +1 -0
- package/dist/dtos/create-dashboard-variable.dto.d.ts.map +1 -1
- package/dist/dtos/create-dashboard-variable.dto.js +7 -1
- package/dist/dtos/create-dashboard-variable.dto.js.map +1 -1
- package/dist/dtos/update-dashboard-layout.dto.d.ts +8 -0
- package/dist/dtos/update-dashboard-layout.dto.d.ts.map +1 -0
- package/dist/dtos/update-dashboard-layout.dto.js +53 -0
- package/dist/dtos/update-dashboard-layout.dto.js.map +1 -0
- package/dist/dtos/update-dashboard-variable.dto.d.ts +1 -0
- package/dist/dtos/update-dashboard-variable.dto.d.ts.map +1 -1
- package/dist/dtos/update-dashboard-variable.dto.js +7 -1
- package/dist/dtos/update-dashboard-variable.dto.js.map +1 -1
- package/dist/entities/action-metadata.entity.d.ts.map +1 -1
- package/dist/entities/action-metadata.entity.js.map +1 -1
- package/dist/entities/ai-interaction.entity.d.ts.map +1 -1
- package/dist/entities/ai-interaction.entity.js +5 -4
- package/dist/entities/ai-interaction.entity.js.map +1 -1
- package/dist/entities/chatter-message-details.entity.d.ts +1 -0
- package/dist/entities/chatter-message-details.entity.d.ts.map +1 -1
- package/dist/entities/chatter-message-details.entity.js +9 -4
- package/dist/entities/chatter-message-details.entity.js.map +1 -1
- package/dist/entities/chatter-message.entity.d.ts.map +1 -1
- package/dist/entities/chatter-message.entity.js +4 -3
- package/dist/entities/chatter-message.entity.js.map +1 -1
- package/dist/entities/common.entity.js +1 -1
- package/dist/entities/common.entity.js.map +1 -1
- package/dist/entities/dashboard-layout.entity.d.ts +9 -0
- package/dist/entities/dashboard-layout.entity.d.ts.map +1 -0
- package/dist/entities/dashboard-layout.entity.js +41 -0
- package/dist/entities/dashboard-layout.entity.js.map +1 -0
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +1 -1
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js +5 -4
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +1 -1
- package/dist/entities/dashboard-question.entity.d.ts.map +1 -1
- package/dist/entities/dashboard-question.entity.js +5 -4
- package/dist/entities/dashboard-question.entity.js.map +1 -1
- package/dist/entities/dashboard-variable.entity.d.ts +1 -0
- package/dist/entities/dashboard-variable.entity.d.ts.map +1 -1
- package/dist/entities/dashboard-variable.entity.js +10 -4
- package/dist/entities/dashboard-variable.entity.js.map +1 -1
- package/dist/entities/dashboard.entity.d.ts +2 -0
- package/dist/entities/dashboard.entity.d.ts.map +1 -1
- package/dist/entities/dashboard.entity.js +9 -3
- package/dist/entities/dashboard.entity.js.map +1 -1
- package/dist/entities/email-attachment.entity.d.ts.map +1 -1
- package/dist/entities/email-attachment.entity.js +2 -1
- package/dist/entities/email-attachment.entity.js.map +1 -1
- package/dist/entities/email-template.entity.js +1 -1
- package/dist/entities/email-template.entity.js.map +1 -1
- package/dist/entities/export-transaction.entity.d.ts.map +1 -1
- package/dist/entities/export-transaction.entity.js +2 -1
- package/dist/entities/export-transaction.entity.js.map +1 -1
- package/dist/entities/field-metadata.entity.js +2 -2
- package/dist/entities/field-metadata.entity.js.map +1 -1
- package/dist/entities/import-transaction-error-log.entity.d.ts.map +1 -1
- package/dist/entities/import-transaction-error-log.entity.js +3 -2
- package/dist/entities/import-transaction-error-log.entity.js.map +1 -1
- package/dist/entities/import-transaction.entity.d.ts.map +1 -1
- package/dist/entities/import-transaction.entity.js +2 -1
- package/dist/entities/import-transaction.entity.js.map +1 -1
- package/dist/entities/legacy-common.entity.d.ts.map +1 -1
- package/dist/entities/legacy-common.entity.js +1 -1
- package/dist/entities/legacy-common.entity.js.map +1 -1
- package/dist/entities/mq-message.entity.d.ts.map +1 -1
- package/dist/entities/mq-message.entity.js +5 -3
- package/dist/entities/mq-message.entity.js.map +1 -1
- package/dist/entities/saved-filters.entity.d.ts.map +1 -1
- package/dist/entities/saved-filters.entity.js +3 -2
- package/dist/entities/saved-filters.entity.js.map +1 -1
- package/dist/entities/security-rule.entity.d.ts.map +1 -1
- package/dist/entities/security-rule.entity.js +2 -1
- package/dist/entities/security-rule.entity.js.map +1 -1
- package/dist/entities/sms-template.entity.js +1 -1
- package/dist/entities/sms-template.entity.js.map +1 -1
- package/dist/entities/user-view-metadata.entity.d.ts.map +1 -1
- package/dist/entities/user-view-metadata.entity.js +2 -1
- package/dist/entities/user-view-metadata.entity.js.map +1 -1
- package/dist/entities/user.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.js +2 -0
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/entities/view-metadata.entity.d.ts.map +1 -1
- package/dist/entities/view-metadata.entity.js.map +1 -1
- package/dist/helpers/bootstrap.helper.d.ts +14 -0
- package/dist/helpers/bootstrap.helper.d.ts.map +1 -0
- package/dist/helpers/bootstrap.helper.js +132 -0
- package/dist/helpers/bootstrap.helper.js.map +1 -0
- package/dist/helpers/cache.helper.d.ts +2 -0
- package/dist/helpers/cache.helper.d.ts.map +1 -0
- package/dist/helpers/cache.helper.js +8 -0
- package/dist/helpers/cache.helper.js.map +1 -0
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.d.ts +1 -0
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.d.ts.map +1 -1
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.js +8 -9
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.js.map +1 -1
- package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.d.ts +2 -2
- package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.d.ts.map +1 -1
- package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.js +8 -5
- package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.js.map +1 -1
- package/dist/helpers/solid-registry.d.ts.map +1 -1
- package/dist/helpers/solid-registry.js.map +1 -1
- package/dist/helpers/typeorm-db-helper.d.ts.map +1 -1
- package/dist/helpers/typeorm-db-helper.js +21 -0
- package/dist/helpers/typeorm-db-helper.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +5 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/jobs/computed-field-evaluation-queue-options.d.ts +1 -0
- package/dist/jobs/computed-field-evaluation-queue-options.d.ts.map +1 -1
- package/dist/jobs/computed-field-evaluation-queue-options.js +1 -0
- package/dist/jobs/computed-field-evaluation-queue-options.js.map +1 -1
- package/dist/repository/dashboard-layout.repository.d.ts +12 -0
- package/dist/repository/dashboard-layout.repository.d.ts.map +1 -0
- package/dist/repository/dashboard-layout.repository.js +34 -0
- package/dist/repository/dashboard-layout.repository.js.map +1 -0
- package/dist/seeders/module-metadata-seeder.service.js +4 -4
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +445 -35
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +44 -21
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/chatter-message.service.d.ts +0 -1
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +22 -19
- package/dist/services/chatter-message.service.js.map +1 -1
- package/dist/services/computed-fields/entity/sequence-num-computed-field-provider.d.ts +7 -3
- package/dist/services/computed-fields/entity/sequence-num-computed-field-provider.d.ts.map +1 -1
- package/dist/services/computed-fields/entity/sequence-num-computed-field-provider.js +61 -22
- package/dist/services/computed-fields/entity/sequence-num-computed-field-provider.js.map +1 -1
- package/dist/services/crud.service.js +1 -1
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/dashboard-layout.service.d.ts +20 -0
- package/dist/services/dashboard-layout.service.d.ts.map +1 -0
- package/dist/services/dashboard-layout.service.js +120 -0
- package/dist/services/dashboard-layout.service.js.map +1 -0
- package/dist/services/dashboard-question.service.d.ts +4 -0
- package/dist/services/dashboard-question.service.d.ts.map +1 -1
- package/dist/services/dashboard-question.service.js +22 -8
- package/dist/services/dashboard-question.service.js.map +1 -1
- package/dist/services/dashboard.service.d.ts +2 -0
- package/dist/services/dashboard.service.d.ts.map +1 -1
- package/dist/services/dashboard.service.js +4 -0
- package/dist/services/dashboard.service.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts +6 -1
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +151 -8
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/services/permission-metadata.service.d.ts +5 -1
- package/dist/services/permission-metadata.service.d.ts.map +1 -1
- package/dist/services/permission-metadata.service.js +66 -20
- package/dist/services/permission-metadata.service.js.map +1 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts +2 -4
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts.map +1 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js +2 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js.map +1 -1
- package/dist/services/question-data-providers/interfaces.d.ts +1 -0
- package/dist/services/question-data-providers/interfaces.d.ts.map +1 -0
- package/dist/services/question-data-providers/interfaces.js +1 -0
- package/dist/services/question-data-providers/interfaces.js.map +1 -0
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts +2 -5
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts.map +1 -1
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js +2 -1
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js.map +1 -1
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts +2 -5
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts.map +1 -1
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js +2 -1
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js.map +1 -1
- package/dist/services/queues/database-subscriber.service.d.ts +4 -2
- package/dist/services/queues/database-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/database-subscriber.service.js +15 -2
- package/dist/services/queues/database-subscriber.service.js.map +1 -1
- package/dist/services/queues/publisher-factory.service.d.ts.map +1 -1
- package/dist/services/queues/publisher-factory.service.js +4 -6
- package/dist/services/queues/publisher-factory.service.js.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts +8 -3
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js +78 -6
- package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
- package/dist/services/scheduled-job.service.d.ts +6 -1
- package/dist/services/scheduled-job.service.d.ts.map +1 -1
- package/dist/services/scheduled-job.service.js +26 -2
- package/dist/services/scheduled-job.service.js.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.interface.d.ts +2 -0
- package/dist/services/scheduled-jobs/scheduler.interface.d.ts.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.interface.js.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.service.d.ts +6 -2
- package/dist/services/scheduled-jobs/scheduler.service.d.ts.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.service.js +75 -17
- 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.map +1 -1
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js +4 -1
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js.map +1 -1
- package/dist/services/solid-ts-morph.service.d.ts +9 -0
- package/dist/services/solid-ts-morph.service.d.ts.map +1 -1
- package/dist/services/solid-ts-morph.service.js +76 -0
- package/dist/services/solid-ts-morph.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +8 -0
- package/dist/solid-core.module.js.map +1 -1
- package/dist/subscribers/computed-entity-field.subscriber.js +3 -1
- package/dist/subscribers/computed-entity-field.subscriber.js.map +1 -1
- package/dist/transformers/typeorm/local-date-time-transformer.d.ts +4 -4
- package/dist/transformers/typeorm/local-date-time-transformer.d.ts.map +1 -1
- package/dist/transformers/typeorm/local-date-time-transformer.js +25 -28
- package/dist/transformers/typeorm/local-date-time-transformer.js.map +1 -1
- package/dist-tests/api/authenticate.spec.js +119 -0
- package/dist-tests/api/authenticate.spec.js.map +1 -0
- package/dist-tests/api/crud-service.findOne.cityMaster.spec.js +97 -0
- package/dist-tests/api/crud-service.findOne.cityMaster.spec.js.map +1 -0
- package/dist-tests/api/ping.spec.js +21 -0
- package/dist-tests/api/ping.spec.js.map +1 -0
- package/dist-tests/helpers/auth.js +41 -0
- package/dist-tests/helpers/auth.js.map +1 -0
- package/dist-tests/helpers/env.js +11 -0
- package/dist-tests/helpers/env.js.map +1 -0
- package/package.json +3 -1
- package/sql/default/mariadb/proc_CleanupModelMetadata.sql +153 -0
- package/sql/default/mariadb/proc_CleanupModuleMetadata.sql +56 -0
- package/sql/default/mysql/proc_CleanupModelMetadata.sql +153 -0
- package/sql/default/mysql/proc_CleanupModuleMetadata.sql +56 -0
- package/src/controllers/dashboard-layout.controller.ts +106 -0
- package/src/controllers/scheduled-job.controller.ts +6 -0
- package/src/dtos/create-dashboard-layout.dto.ts +31 -0
- package/src/dtos/create-dashboard-variable.dto.ts +4 -0
- package/src/dtos/update-dashboard-layout.dto.ts +30 -0
- package/src/dtos/update-dashboard-variable.dto.ts +5 -1
- package/src/entities/action-metadata.entity.ts +3 -2
- package/src/entities/ai-interaction.entity.ts +5 -4
- package/src/entities/chatter-message-details.entity.ts +7 -3
- package/src/entities/chatter-message.entity.ts +4 -3
- package/src/entities/common.entity.ts +2 -2
- package/src/entities/dashboard-layout.entity.ts +18 -0
- package/src/entities/dashboard-question-sql-dataset-config.entity.ts +5 -4
- package/src/entities/dashboard-question.entity.ts +5 -4
- package/src/entities/dashboard-variable.entity.ts +9 -4
- package/src/entities/dashboard.entity.ts +7 -2
- package/src/entities/email-attachment.entity.ts +2 -1
- package/src/entities/email-template.entity.ts +1 -1
- package/src/entities/export-transaction.entity.ts +2 -1
- package/src/entities/field-metadata.entity.ts +2 -2
- package/src/entities/import-transaction-error-log.entity.ts +3 -2
- package/src/entities/import-transaction.entity.ts +2 -1
- package/src/entities/legacy-common.entity.ts +3 -4
- package/src/entities/mq-message.entity.ts +5 -3
- package/src/entities/saved-filters.entity.ts +3 -2
- package/src/entities/security-rule.entity.ts +2 -1
- package/src/entities/sms-template.entity.ts +1 -1
- package/src/entities/user-view-metadata.entity.ts +2 -1
- package/src/entities/user.entity.ts +37 -2
- package/src/entities/view-metadata.entity.ts +3 -0
- package/src/helpers/bootstrap.helper.ts +222 -0
- package/src/helpers/cache.helper.ts +5 -0
- package/src/helpers/field-crud-managers/MediaFieldCrudManager.ts +9 -9
- package/src/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.ts +9 -6
- package/src/helpers/solid-registry.ts +1 -5
- package/src/helpers/typeorm-db-helper.ts +26 -0
- package/src/index.ts +3 -0
- package/src/interfaces.ts +9 -1
- package/src/jobs/computed-field-evaluation-queue-options.ts +1 -0
- package/src/repository/dashboard-layout.repository.ts +17 -0
- package/src/seeders/module-metadata-seeder.service.ts +5 -5
- package/src/seeders/seed-data/solid-core-metadata.json +446 -36
- package/src/services/authentication.service.ts +46 -24
- package/src/services/chatter-message.service.ts +21 -21
- package/src/services/computed-fields/entity/sequence-num-computed-field-provider.ts +79 -40
- package/src/services/crud.service.ts +1 -1
- package/src/services/dashboard-layout.service.ts +111 -0
- package/src/services/dashboard-question.service.ts +23 -4
- package/src/services/dashboard.service.ts +7 -0
- package/src/services/model-metadata.service.ts +173 -50
- package/src/services/permission-metadata.service.ts +73 -20
- package/src/services/question-data-providers/chartjs-sql-data-provider.service.ts +3 -7
- package/src/services/question-data-providers/interfaces.ts +0 -0
- package/src/services/question-data-providers/prime-react-datatable-sql-data-provider.service.ts +4 -8
- package/src/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.ts +4 -8
- package/src/services/queues/database-subscriber.service.ts +19 -2
- package/src/services/queues/publisher-factory.service.ts +8 -6
- package/src/services/queues/rabbitmq-subscriber.service.ts +123 -6
- package/src/services/scheduled-job.service.ts +31 -2
- package/src/services/scheduled-jobs/scheduler.interface.ts +4 -1
- package/src/services/scheduled-jobs/scheduler.service.ts +82 -20
- package/src/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.ts +4 -1
- package/src/services/solid-ts-morph.service.ts +98 -0
- package/src/solid-core.module.ts +13 -0
- package/src/subscribers/computed-entity-field.subscriber.ts +3 -3
- package/src/transformers/typeorm/local-date-time-transformer.ts +41 -33
- package/.claude/settings.local.json +0 -15
- package/src/services/1.js +0 -6
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
2
|
import { Entity, Column, Index, OneToMany, JoinColumn, ManyToOne } from 'typeorm';
|
|
3
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
3
4
|
import { DashboardVariable } from 'src/entities/dashboard-variable.entity';
|
|
4
5
|
import { DashboardQuestion } from 'src/entities/dashboard-question.entity';
|
|
5
6
|
import { ModuleMetadata } from 'src/entities/module-metadata.entity'
|
|
7
|
+
import { DashboardLayout } from './dashboard-layout.entity';
|
|
6
8
|
|
|
7
9
|
@Entity("ss_dashboard")
|
|
8
10
|
export class Dashboard extends CommonEntity {
|
|
@@ -10,7 +12,7 @@ export class Dashboard extends CommonEntity {
|
|
|
10
12
|
@Column({ type: "varchar" })
|
|
11
13
|
name: string;
|
|
12
14
|
|
|
13
|
-
@Column({
|
|
15
|
+
@Column({ ...getColumnType('longText'), nullable: true })
|
|
14
16
|
layoutJson: any;
|
|
15
17
|
|
|
16
18
|
@OneToMany(() => DashboardVariable, dashboardVariable => dashboardVariable.dashboard, { cascade: true })
|
|
@@ -19,6 +21,9 @@ export class Dashboard extends CommonEntity {
|
|
|
19
21
|
@OneToMany(() => DashboardQuestion, dashboardQuestion => dashboardQuestion.dashboard, { cascade: true })
|
|
20
22
|
questions: DashboardQuestion[];
|
|
21
23
|
|
|
24
|
+
@OneToMany(() => DashboardLayout, dashboardLayout => dashboardLayout.dashboard, { cascade: true })
|
|
25
|
+
dashboardLayouts: DashboardLayout[];
|
|
26
|
+
|
|
22
27
|
@ManyToOne(() => ModuleMetadata, { nullable: false })
|
|
23
28
|
@JoinColumn()
|
|
24
29
|
module: ModuleMetadata;
|
|
@@ -26,6 +31,6 @@ export class Dashboard extends CommonEntity {
|
|
|
26
31
|
@Column({ type: "varchar", nullable: true })
|
|
27
32
|
displayName: string;
|
|
28
33
|
|
|
29
|
-
@Column({
|
|
34
|
+
@Column({ nullable: true })
|
|
30
35
|
description: string;
|
|
31
36
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
2
2
|
import { CommonEntity } from "./common.entity";
|
|
3
3
|
import { EmailTemplate } from "./email-template.entity";
|
|
4
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
4
5
|
import { IndentLogger } from "@angular-devkit/core/src/logger";
|
|
5
6
|
|
|
6
7
|
@Entity("ss_email_attachment")
|
|
@@ -14,7 +15,7 @@ export class EmailAttachment extends CommonEntity {
|
|
|
14
15
|
relativePath: string; // This is the path relative to the email service being used. For e.g if the attahchment is uploaded in the media manager of elastic email service
|
|
15
16
|
@Column({ name: "url", type: "varchar", nullable: true })
|
|
16
17
|
url: string;
|
|
17
|
-
@Column({ name: "template",
|
|
18
|
+
@Column({ name: "template", nullable: true, ...getColumnType('longText') })
|
|
18
19
|
template: string;
|
|
19
20
|
@Index()
|
|
20
21
|
@ManyToOne(() => EmailTemplate, (template) => template.attachments, { onDelete: 'CASCADE' })
|
|
@@ -14,7 +14,7 @@ export class EmailTemplate extends CommonEntity {
|
|
|
14
14
|
body: string;
|
|
15
15
|
@Column({ name: "subject", type: "varchar", default: "{}" })
|
|
16
16
|
subject: string = "{}";
|
|
17
|
-
@Column({ name: "description",
|
|
17
|
+
@Column({ name: "description", nullable: true })
|
|
18
18
|
description: string;
|
|
19
19
|
@Column({ name: "active", nullable: true, default: true })
|
|
20
20
|
active: boolean = true;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
2
|
import { Entity, Column, Index, ManyToOne } from 'typeorm';
|
|
3
3
|
import { ExportTemplate } from 'src/entities/export-template.entity'
|
|
4
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
4
5
|
|
|
5
6
|
@Entity("ss_export_transaction")
|
|
6
7
|
@Index(["exportTransactionId", "deletedTracker"], { unique: true })
|
|
@@ -14,7 +15,7 @@ export class ExportTransaction extends CommonEntity {
|
|
|
14
15
|
@Index()
|
|
15
16
|
@Column({ type: "varchar" })
|
|
16
17
|
status: string;
|
|
17
|
-
@Column({
|
|
18
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
18
19
|
error: string;
|
|
19
20
|
@Index()
|
|
20
21
|
@ManyToOne(() => ExportTemplate, { nullable: true })
|
|
@@ -36,7 +36,7 @@ export class FieldMetadata extends CommonEntity {
|
|
|
36
36
|
@Column({ name: 'regex_pattern', nullable: true })
|
|
37
37
|
regexPattern: string;
|
|
38
38
|
|
|
39
|
-
@Column({ name: 'regex_pattern_not_matching_error_msg',
|
|
39
|
+
@Column({ name: 'regex_pattern_not_matching_error_msg', nullable: true, default: ERROR_MESSAGES.DEFAULT_REGEX_PATTERN_NOT_MATCHING_ERROR_MSG })
|
|
40
40
|
regexPatternNotMatchingErrorMsg: string;
|
|
41
41
|
|
|
42
42
|
@Column({ name: "required", default: false })
|
|
@@ -119,7 +119,7 @@ export class FieldMetadata extends CommonEntity {
|
|
|
119
119
|
@Column({ name: 'selection_static_values', nullable: true, type: 'simple-array' })
|
|
120
120
|
selectionStaticValues: string[];
|
|
121
121
|
|
|
122
|
-
@Column({ name: 'selection_value_type', nullable: true
|
|
122
|
+
@Column({ name: 'selection_value_type', nullable: true })
|
|
123
123
|
selectionValueType: string = 'string';
|
|
124
124
|
|
|
125
125
|
// @Column({ name: "computed", default: false })
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
2
|
import { Entity, Column, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
3
3
|
import { ImportTransaction } from 'src/entities/import-transaction.entity'
|
|
4
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
4
5
|
|
|
5
6
|
@Entity("ss_import_transaction_error_log")
|
|
6
7
|
export class ImportTransactionErrorLog extends CommonEntity {
|
|
@@ -9,7 +10,7 @@ export class ImportTransactionErrorLog extends CommonEntity {
|
|
|
9
10
|
importTransactionErrorLogId: string;
|
|
10
11
|
@Column({ type: "integer" })
|
|
11
12
|
rowNumber: number;
|
|
12
|
-
@Column({
|
|
13
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
13
14
|
rowData: any;
|
|
14
15
|
@Index()
|
|
15
16
|
@ManyToOne(() => ImportTransaction, { nullable: false })
|
|
@@ -17,6 +18,6 @@ export class ImportTransactionErrorLog extends CommonEntity {
|
|
|
17
18
|
importTransaction: ImportTransaction;
|
|
18
19
|
@Column({ type: "varchar" })
|
|
19
20
|
errorMessage: string;
|
|
20
|
-
@Column({
|
|
21
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
21
22
|
errorTrace: string;
|
|
22
23
|
}
|
|
@@ -2,13 +2,14 @@ import { CommonEntity } from 'src/entities/common.entity'
|
|
|
2
2
|
import { Entity, Column, Index, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
|
|
3
3
|
import { ModelMetadata } from 'src/entities/model-metadata.entity';
|
|
4
4
|
import { ImportTransactionErrorLog } from 'src/entities/import-transaction-error-log.entity'
|
|
5
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
5
6
|
|
|
6
7
|
@Entity("ss_import_transaction")
|
|
7
8
|
export class ImportTransaction extends CommonEntity {
|
|
8
9
|
@Index()
|
|
9
10
|
@Column({ type: "varchar", nullable: true, default: "draft" })
|
|
10
11
|
status: string = "draft";
|
|
11
|
-
@Column({
|
|
12
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
12
13
|
mapping: any;
|
|
13
14
|
@Index()
|
|
14
15
|
@ManyToOne(() => ModelMetadata, { nullable: true })
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Exclude, Expose
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { LocalDateTimeTransformer, UtcDateTimeTransformer } from "src/transformers/typeorm/local-date-time-transformer";
|
|
1
|
+
import { Exclude, Expose } from "class-transformer";
|
|
2
|
+
import { LocalDateTimeTransformer } from "src/transformers/typeorm/local-date-time-transformer";
|
|
3
|
+
import { Column, CreateDateColumn, DeleteDateColumn, Index, UpdateDateColumn } from "typeorm";
|
|
5
4
|
|
|
6
5
|
export const LEGACY_TABLE_FIELDS_PREFIX = 'ss';
|
|
7
6
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CommonEntity } from "src/entities/common.entity"
|
|
2
2
|
import { Entity, Column, Index, ManyToOne } from "typeorm";
|
|
3
3
|
import { MqMessageQueue } from 'src/entities/mq-message-queue.entity'
|
|
4
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
4
5
|
@Entity("ss_mq_message")
|
|
5
6
|
export class MqMessage extends CommonEntity {
|
|
7
|
+
@Index()
|
|
6
8
|
@Column({ type: "varchar", nullable: true })
|
|
7
9
|
messageId: string;
|
|
8
10
|
|
|
@@ -31,13 +33,13 @@ export class MqMessage extends CommonEntity {
|
|
|
31
33
|
@Column({ type: "integer", nullable: true })
|
|
32
34
|
elapsedMillis: number;
|
|
33
35
|
|
|
34
|
-
@Column({
|
|
36
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
35
37
|
input: string;
|
|
36
38
|
|
|
37
|
-
@Column({
|
|
39
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
38
40
|
output: string;
|
|
39
41
|
|
|
40
|
-
@Column({
|
|
42
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
41
43
|
error: string;
|
|
42
44
|
|
|
43
45
|
@Column({ type: "integer", nullable: true })
|
|
@@ -3,10 +3,11 @@ import { Entity, Column, JoinColumn, ManyToOne, Index } from 'typeorm';
|
|
|
3
3
|
import { User } from 'src/entities/user.entity';
|
|
4
4
|
import { ModelMetadata } from 'src/entities/model-metadata.entity';
|
|
5
5
|
import { ViewMetadata } from 'src/entities/view-metadata.entity'
|
|
6
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
6
7
|
|
|
7
8
|
@Entity("ss_saved_fitlers")
|
|
8
9
|
export class SavedFilters extends CommonEntity {
|
|
9
|
-
@Column({
|
|
10
|
+
@Column({ nullable: true, ...getColumnType('longText') })
|
|
10
11
|
filterQueryJson: any;
|
|
11
12
|
|
|
12
13
|
@Index({ unique: true })
|
|
@@ -28,7 +29,7 @@ export class SavedFilters extends CommonEntity {
|
|
|
28
29
|
@JoinColumn()
|
|
29
30
|
view: ViewMetadata;
|
|
30
31
|
|
|
31
|
-
@Column({ name: "description",
|
|
32
|
+
@Column({ name: "description", nullable: true })
|
|
32
33
|
description: string;
|
|
33
34
|
|
|
34
35
|
@Column({ nullable: true, default: false })
|
|
@@ -2,6 +2,7 @@ import { CommonEntity } from 'src/entities/common.entity';
|
|
|
2
2
|
import { ModelMetadata } from 'src/entities/model-metadata.entity';
|
|
3
3
|
import { RoleMetadata } from 'src/entities/role-metadata.entity';
|
|
4
4
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
5
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
5
6
|
|
|
6
7
|
@Entity("ss_security_rule")
|
|
7
8
|
export class SecurityRule extends CommonEntity {
|
|
@@ -22,7 +23,7 @@ export class SecurityRule extends CommonEntity {
|
|
|
22
23
|
@JoinColumn()
|
|
23
24
|
modelMetadata: ModelMetadata;
|
|
24
25
|
|
|
25
|
-
@Column({
|
|
26
|
+
@Column({ ...getColumnType('longText'), nullable: true })
|
|
26
27
|
securityRuleConfig: any;
|
|
27
28
|
|
|
28
29
|
@Column({ type: "varchar", nullable: true })
|
|
@@ -12,7 +12,7 @@ export class SmsTemplate extends CommonEntity {
|
|
|
12
12
|
body: string;
|
|
13
13
|
@Column({ type: "varchar", nullable: true })
|
|
14
14
|
smsProviderTemplateId: string;
|
|
15
|
-
@Column({ name: "description",
|
|
15
|
+
@Column({ name: "description", nullable: true })
|
|
16
16
|
description: string;
|
|
17
17
|
@Column({ name: "active", nullable: true, default: true })
|
|
18
18
|
active: boolean = true;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
2
|
import { Entity, JoinColumn, ManyToOne, Index, Column } from 'typeorm';
|
|
3
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
3
4
|
import { ViewMetadata } from 'src/entities/view-metadata.entity';
|
|
4
5
|
import { User } from 'src/entities/user.entity'
|
|
5
6
|
|
|
@@ -9,7 +10,7 @@ export class UserViewMetadata extends CommonEntity {
|
|
|
9
10
|
@ManyToOne(() => User, { nullable: false })
|
|
10
11
|
@JoinColumn()
|
|
11
12
|
user: User;
|
|
12
|
-
@Column({ name: "layout",
|
|
13
|
+
@Column({ name: "layout", nullable: true, ...getColumnType('longText') })
|
|
13
14
|
layout: any = "{}";
|
|
14
15
|
@Index()
|
|
15
16
|
@ManyToOne(() => ViewMetadata, { nullable: false })
|
|
@@ -11,109 +11,144 @@ export class User extends CommonEntity {
|
|
|
11
11
|
@Column({ type: "varchar", nullable: true })
|
|
12
12
|
@Expose()
|
|
13
13
|
fullName: string;
|
|
14
|
+
|
|
14
15
|
@Index({ unique: true })
|
|
15
16
|
@Column({ type: "varchar" })
|
|
16
17
|
@Expose()
|
|
17
18
|
username: string;
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
@Index()
|
|
19
21
|
@Column({ type: "varchar", nullable: true })
|
|
20
22
|
@Expose()
|
|
21
23
|
email: string;
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
@Index()
|
|
23
26
|
@Column({ type: "varchar", nullable: true })
|
|
24
27
|
@Expose()
|
|
25
28
|
mobile: string;
|
|
29
|
+
|
|
26
30
|
@Column({ type: "varchar", nullable: true })
|
|
27
31
|
// don't send to client
|
|
28
32
|
password: string;
|
|
33
|
+
|
|
29
34
|
@Column({ nullable: true, default: true })
|
|
30
35
|
@Expose()
|
|
31
36
|
forcePasswordChange: boolean = true;
|
|
37
|
+
|
|
32
38
|
@Column({ type: "varchar", default: "local" })
|
|
33
39
|
// don't send to client
|
|
34
40
|
lastLoginProvider: string = "local";
|
|
41
|
+
|
|
35
42
|
@Column({ type: "varchar", nullable: true })
|
|
36
43
|
// don't send to client (test)
|
|
37
44
|
accessCode: string;
|
|
45
|
+
|
|
38
46
|
@Column({ type: "varchar", nullable: true })
|
|
39
47
|
// don't send to client
|
|
40
48
|
googleAccessToken: string;
|
|
49
|
+
|
|
41
50
|
@Column({ type: "varchar", nullable: true })
|
|
42
51
|
// don't send to client
|
|
43
52
|
googleId: string;
|
|
53
|
+
|
|
44
54
|
@Column({ type: "varchar", nullable: true })
|
|
45
55
|
// don't send to client
|
|
46
56
|
googleProfilePicture: string;
|
|
57
|
+
|
|
47
58
|
@Column({ default: true })
|
|
48
59
|
@Expose()
|
|
49
60
|
active: boolean = true;
|
|
61
|
+
|
|
50
62
|
@Column({ nullable: true })
|
|
51
63
|
// don't send to client
|
|
52
64
|
forgotPasswordConfirmedAt: Date;
|
|
65
|
+
|
|
53
66
|
@Column({ type: "varchar", nullable: true })
|
|
54
67
|
// don't send to client
|
|
55
68
|
verificationTokenOnForgotPassword: string;
|
|
69
|
+
|
|
56
70
|
@Column({ nullable: true })
|
|
57
71
|
// don't send to client
|
|
58
72
|
verificationTokenOnForgotPasswordExpiresAt: Date;
|
|
73
|
+
|
|
59
74
|
@Column({ nullable: true })
|
|
60
75
|
// don't send to client
|
|
61
76
|
emailVerifiedOnRegistrationAt: Date;
|
|
77
|
+
|
|
62
78
|
@Column({ type: "varchar", nullable: true })
|
|
63
79
|
// don't send to client
|
|
64
80
|
emailVerificationTokenOnRegistration: string;
|
|
81
|
+
|
|
65
82
|
@Column({ nullable: true })
|
|
66
83
|
// don't send to client
|
|
67
84
|
emailVerificationTokenOnRegistrationExpiresAt: Date;
|
|
85
|
+
|
|
68
86
|
@Column({ nullable: true })
|
|
69
87
|
// don't send to client
|
|
70
88
|
mobileVerifiedOnRegistrationAt: Date;
|
|
89
|
+
|
|
71
90
|
@Column({ type: "varchar", nullable: true })
|
|
72
91
|
// don't send to client
|
|
73
92
|
mobileVerificationTokenOnRegistration: string;
|
|
93
|
+
|
|
74
94
|
@Column({ nullable: true })
|
|
75
95
|
// don't send to client
|
|
76
96
|
mobileVerificationTokenOnRegistrationExpiresAt: Date;
|
|
97
|
+
|
|
77
98
|
@Column({ nullable: true })
|
|
78
99
|
// don't send to client
|
|
79
100
|
emailVerifiedOnLoginAt: Date;
|
|
101
|
+
|
|
80
102
|
@Column({ type: "varchar", nullable: true })
|
|
81
103
|
// don't send to client
|
|
82
104
|
emailVerificationTokenOnLogin: string;
|
|
105
|
+
|
|
83
106
|
@Column({ nullable: true })
|
|
84
107
|
// don't send to client
|
|
85
108
|
emailVerificationTokenOnLoginExpiresAt: Date;
|
|
109
|
+
|
|
86
110
|
@Column({ nullable: true })
|
|
87
111
|
// don't send to client
|
|
88
112
|
mobileVerifiedOnLoginAt: Date;
|
|
113
|
+
|
|
89
114
|
@Column({ type: "varchar", nullable: true })
|
|
90
115
|
// don't send to client
|
|
91
116
|
mobileVerificationTokenOnLogin: string;
|
|
117
|
+
|
|
92
118
|
@Column({ nullable: true })
|
|
93
119
|
// don't send to client
|
|
94
120
|
mobileVerificationTokenOnLoginExpiresAt: Date;
|
|
121
|
+
|
|
95
122
|
@Column({ type: "varchar", nullable: true })
|
|
96
123
|
@Expose()
|
|
97
124
|
customPayload: string;
|
|
125
|
+
|
|
98
126
|
@ManyToMany(() => RoleMetadata, roleMetadata => roleMetadata.users, { cascade: true })
|
|
99
127
|
@JoinTable()
|
|
100
128
|
@Expose()
|
|
101
129
|
roles: RoleMetadata[];
|
|
130
|
+
|
|
102
131
|
@OneToMany(() => UserViewMetadata, userViewMetadata => userViewMetadata.user, { cascade: true })
|
|
103
132
|
// don't send to client
|
|
104
133
|
userViewMetadata: UserViewMetadata[];
|
|
134
|
+
|
|
105
135
|
// dont send to client
|
|
106
136
|
@Column({ type: "varchar", default: "bcrypt" })
|
|
107
137
|
passwordScheme: string;
|
|
138
|
+
|
|
108
139
|
// dont send to client
|
|
109
140
|
@Column({ type: "int", default: 1 })
|
|
110
141
|
passwordSchemeVersion: number;
|
|
142
|
+
|
|
111
143
|
// dont send to client
|
|
112
144
|
@Column({ nullable: true })
|
|
113
145
|
rehashedAt: Date;
|
|
146
|
+
|
|
114
147
|
// dont send to client
|
|
115
148
|
@Column({ type: "int", default: 0 })
|
|
116
149
|
failedLoginAttempts: number = 0;
|
|
150
|
+
|
|
117
151
|
@Expose()
|
|
118
152
|
_media: any;
|
|
153
|
+
|
|
119
154
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommonEntity } from "src/entities/common.entity"
|
|
2
2
|
import { Entity, Column, ManyToOne, Index, JoinColumn, OneToMany } from "typeorm";
|
|
3
|
+
import { getColumnType } from 'src/helpers/typeorm-db-helper';
|
|
3
4
|
import { ModuleMetadata } from 'src/entities/module-metadata.entity';
|
|
4
5
|
import { ModelMetadata } from 'src/entities/model-metadata.entity';
|
|
5
6
|
import { UserViewMetadata } from 'src/entities/user-view-metadata.entity'
|
|
@@ -16,9 +17,11 @@ export class ViewMetadata extends CommonEntity {
|
|
|
16
17
|
@Column({ name: "type", type: "varchar" })
|
|
17
18
|
type: string;
|
|
18
19
|
|
|
20
|
+
//TODO: To make this truly cross db compatible, we should avoid setting a db type
|
|
19
21
|
@Column({ name: "context", type: "text" })
|
|
20
22
|
context: any = "{}";
|
|
21
23
|
|
|
24
|
+
//TODO: To make this truly cross db compatible, we should avoid setting a db type
|
|
22
25
|
@Column({ name: "layout", type: "text" })
|
|
23
26
|
layout: any;
|
|
24
27
|
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { ValidationPipe } from '@nestjs/common';
|
|
2
|
+
import { NestFactory } from '@nestjs/core';
|
|
3
|
+
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
4
|
+
import { NextFunction, Request, Response } from 'express';
|
|
5
|
+
import helmet from 'helmet';
|
|
6
|
+
import qs from 'qs';
|
|
7
|
+
import { existsSync } from 'fs';
|
|
8
|
+
import { resolve } from 'path';
|
|
9
|
+
import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston';
|
|
10
|
+
import { CommandFactory } from 'nest-commander';
|
|
11
|
+
import { WrapResponseInterceptor } from '../interceptors/wrap-response.interceptor';
|
|
12
|
+
import { buildDefaultCorsOptions } from './cors.helper';
|
|
13
|
+
import { buildDefaultSecurityHeaderOptions, buildPermissionsPolicyHeader, PermissionsPolicyConfig } from './security.helper';
|
|
14
|
+
import { parseBooleanEnv } from './environment.helper';
|
|
15
|
+
|
|
16
|
+
// ---- Shared process handlers ----
|
|
17
|
+
|
|
18
|
+
function registerGlobalProcessHandlers() {
|
|
19
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
20
|
+
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
process.on('uncaughtException', (err) => {
|
|
24
|
+
console.error('Uncaught Exception thrown:', err);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Suppress pg deprecation warning caused by TypeORM's internal query scheduling
|
|
28
|
+
process.on('warning', (warning) => {
|
|
29
|
+
if (warning.name === 'DeprecationWarning' && (warning.message.includes('client.query()') || warning.message.includes('punycode'))) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.warn(warning);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ---- HTTP server bootstrap ----
|
|
37
|
+
|
|
38
|
+
export interface SolidSwaggerOptions {
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
version?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface SolidBootstrapOptions {
|
|
45
|
+
/** Global API prefix. Defaults to 'api'. Set to '' to disable. */
|
|
46
|
+
globalPrefix?: string;
|
|
47
|
+
/** Swagger configuration. Set to false to disable Swagger entirely. */
|
|
48
|
+
swagger?: SolidSwaggerOptions | false;
|
|
49
|
+
/** Permissions-Policy header overrides (merged with defaults). */
|
|
50
|
+
permissionsPolicyOverrides?: Partial<PermissionsPolicyConfig>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Bootstraps a SolidX NestJS HTTP application with sensible defaults:
|
|
55
|
+
* security headers, CORS, Winston logger, ValidationPipe,
|
|
56
|
+
* WrapResponseInterceptor, qs deep query parsing, Swagger, and the
|
|
57
|
+
* pg BIGINT type parser.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // main.ts
|
|
61
|
+
* bootstrapSolidApp(() => AppModule.forRoot(), {
|
|
62
|
+
* swagger: { title: 'My API', description: 'My API description' },
|
|
63
|
+
* });
|
|
64
|
+
*/
|
|
65
|
+
export async function bootstrapSolidApp(
|
|
66
|
+
appModuleFactory: () => Promise<any>,
|
|
67
|
+
options: SolidBootstrapOptions = {},
|
|
68
|
+
): Promise<void> {
|
|
69
|
+
registerGlobalProcessHandlers();
|
|
70
|
+
|
|
71
|
+
const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {} } = options;
|
|
72
|
+
|
|
73
|
+
const appModule = await appModuleFactory();
|
|
74
|
+
const app = await NestFactory.create(appModule);
|
|
75
|
+
|
|
76
|
+
const apiEnabled = parseBooleanEnv('API_ENABLED', true);
|
|
77
|
+
|
|
78
|
+
if (!apiEnabled) {
|
|
79
|
+
await app.init();
|
|
80
|
+
app
|
|
81
|
+
.get(WINSTON_MODULE_NEST_PROVIDER)
|
|
82
|
+
.log('API server disabled via API_ENABLED=false. Skipping HTTP listen.', 'Bootstrap');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Health check at root path
|
|
87
|
+
const server = app.getHttpAdapter().getInstance();
|
|
88
|
+
server.get('/', (_req, res) => res.status(200).send('SOLID OK'));
|
|
89
|
+
|
|
90
|
+
// Security headers
|
|
91
|
+
app.use(helmet(buildDefaultSecurityHeaderOptions()));
|
|
92
|
+
|
|
93
|
+
// Permissions-Policy header
|
|
94
|
+
app.use((_req: Request, res: Response, next: NextFunction) => {
|
|
95
|
+
res.setHeader('Permissions-Policy', buildPermissionsPolicyHeader(permissionsPolicyOverrides));
|
|
96
|
+
next();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Winston logger
|
|
100
|
+
app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));
|
|
101
|
+
|
|
102
|
+
const port = process.env.PORT || 3000;
|
|
103
|
+
|
|
104
|
+
if (globalPrefix) {
|
|
105
|
+
app.setGlobalPrefix(globalPrefix);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// qs-based deep query parsing (dot notation, nested objects, arrays)
|
|
109
|
+
app.use((req: Request, _res: Response, next: NextFunction) => {
|
|
110
|
+
if (req.query) {
|
|
111
|
+
req.query = qs.parse(req.url.split('?')[1], {
|
|
112
|
+
allowDots: true,
|
|
113
|
+
depth: 10,
|
|
114
|
+
arrayLimit: 100,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
next();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Global ValidationPipe
|
|
121
|
+
app.useGlobalPipes(
|
|
122
|
+
new ValidationPipe({
|
|
123
|
+
transform: true,
|
|
124
|
+
transformOptions: { enableImplicitConversion: true },
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
// Swagger
|
|
129
|
+
if (swagger !== false) {
|
|
130
|
+
const { title = 'Solid Starters', description = 'Solid Starters API', version = '1.0' } = swagger;
|
|
131
|
+
const swaggerConfig = new DocumentBuilder()
|
|
132
|
+
.setTitle(title)
|
|
133
|
+
.setDescription(description)
|
|
134
|
+
.setVersion(version)
|
|
135
|
+
.setExternalDoc('Postman Collection', '/docs-json')
|
|
136
|
+
.addBearerAuth(
|
|
137
|
+
{
|
|
138
|
+
description: 'Please enter token in following format: Bearer <JWT>',
|
|
139
|
+
name: 'Authorization',
|
|
140
|
+
bearerFormat: 'Bearer',
|
|
141
|
+
scheme: 'Bearer',
|
|
142
|
+
type: 'http',
|
|
143
|
+
in: 'Header',
|
|
144
|
+
},
|
|
145
|
+
'jwt',
|
|
146
|
+
)
|
|
147
|
+
.build();
|
|
148
|
+
const document = SwaggerModule.createDocument(app, swaggerConfig);
|
|
149
|
+
SwaggerModule.setup('/docs', app, document);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Global interceptor
|
|
153
|
+
app.useGlobalInterceptors(new WrapResponseInterceptor());
|
|
154
|
+
|
|
155
|
+
// CORS
|
|
156
|
+
app.enableCors(buildDefaultCorsOptions());
|
|
157
|
+
|
|
158
|
+
// Fix pg returning BIGINT columns as strings
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
160
|
+
const types = require('pg').types;
|
|
161
|
+
types.setTypeParser(types.builtins.INT8, (val: string) => parseInt(val));
|
|
162
|
+
|
|
163
|
+
await app.listen(port);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ---- CLI bootstrap ----
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Bootstraps a SolidX NestJS CLI application using nest-commander.
|
|
170
|
+
* Handles verbose flag stripping, project root validation, and clean process exit.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* // main-cli.ts
|
|
174
|
+
* #!/usr/bin/env node
|
|
175
|
+
* import { bootstrapSolidCli } from '@solidxai/core';
|
|
176
|
+
* import { AppModule } from './app.module';
|
|
177
|
+
*
|
|
178
|
+
* bootstrapSolidCli(() => AppModule.forRoot());
|
|
179
|
+
*/
|
|
180
|
+
export async function bootstrapSolidCli(
|
|
181
|
+
appModuleFactory: () => Promise<any>,
|
|
182
|
+
): Promise<void> {
|
|
183
|
+
registerGlobalProcessHandlers();
|
|
184
|
+
|
|
185
|
+
process.on('exit', (code) => {
|
|
186
|
+
if (code !== 0) {
|
|
187
|
+
console.error(`Exiting with error status code: ${code}`);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Validate that cwd is a valid Solid API project
|
|
192
|
+
const packageJsonPath = resolve(process.cwd(), 'package.json');
|
|
193
|
+
if (!existsSync(packageJsonPath)) {
|
|
194
|
+
console.error('Does not seem to be a valid solid-api project.');
|
|
195
|
+
console.error('Exit reason: missing package.json in the current directory.');
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Strip --verbose / -v before nest-commander processes argv
|
|
200
|
+
const showLogs = process.argv.includes('--verbose') || process.argv.includes('-v');
|
|
201
|
+
for (const flag of ['--verbose', '-v']) {
|
|
202
|
+
const idx = process.argv.indexOf(flag);
|
|
203
|
+
if (idx !== -1) process.argv.splice(idx, 1);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const appModule = await appModuleFactory();
|
|
207
|
+
process.env.SOLID_CLI_RUNNING = 'true';
|
|
208
|
+
|
|
209
|
+
// @ts-ignore
|
|
210
|
+
const app = await CommandFactory.createWithoutRunning(appModule, {
|
|
211
|
+
logger: showLogs ? ['debug', 'error', 'fatal', 'log', 'verbose', 'warn'] : false,
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
await CommandFactory.runApplication(app);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
console.error('CLI exited abruptly due to an error:', e);
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
process.exit(0);
|
|
222
|
+
}
|