@solidxai/core 0.1.5-beta.2 → 0.1.5-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/commands/info.command.d.ts +3 -1
  2. package/dist/commands/info.command.d.ts.map +1 -1
  3. package/dist/commands/info.command.js +6 -2
  4. package/dist/commands/info.command.js.map +1 -1
  5. package/dist/controllers/info.controller.d.ts +7 -0
  6. package/dist/controllers/info.controller.d.ts.map +1 -0
  7. package/dist/controllers/info.controller.js +39 -0
  8. package/dist/controllers/info.controller.js.map +1 -0
  9. package/dist/entities/ai-interaction.entity.d.ts.map +1 -1
  10. package/dist/entities/ai-interaction.entity.js +1 -1
  11. package/dist/entities/ai-interaction.entity.js.map +1 -1
  12. package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +1 -1
  13. package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +1 -1
  14. package/dist/entities/dashboard-question.entity.d.ts.map +1 -1
  15. package/dist/entities/dashboard-question.entity.js.map +1 -1
  16. package/dist/entities/dashboard-variable.entity.d.ts.map +1 -1
  17. package/dist/entities/dashboard-variable.entity.js.map +1 -1
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/interfaces.d.ts +1 -0
  23. package/dist/interfaces.d.ts.map +1 -1
  24. package/dist/interfaces.js.map +1 -1
  25. package/dist/seeders/seed-data/solid-core-metadata.json +1 -1
  26. package/dist/services/info.service.d.ts +18 -0
  27. package/dist/services/info.service.d.ts.map +1 -0
  28. package/dist/services/info.service.js +96 -0
  29. package/dist/services/info.service.js.map +1 -0
  30. package/dist/services/queues/rabbitmq-subscriber.service.d.ts.map +1 -1
  31. package/dist/services/queues/rabbitmq-subscriber.service.js +6 -1
  32. package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
  33. package/dist/solid-core.module.d.ts.map +1 -1
  34. package/dist/solid-core.module.js +4 -0
  35. package/dist/solid-core.module.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/commands/info.command.ts +3 -0
  38. package/src/controllers/info.controller.ts +15 -0
  39. package/src/entities/ai-interaction.entity.ts +17 -2
  40. package/src/entities/dashboard-question-sql-dataset-config.entity.ts +9 -1
  41. package/src/entities/dashboard-question.entity.ts +10 -0
  42. package/src/entities/dashboard-variable.entity.ts +9 -0
  43. package/src/index.ts +2 -0
  44. package/src/interfaces.ts +1 -0
  45. package/src/seeders/seed-data/solid-core-metadata.json +1 -1
  46. package/src/services/info.service.ts +60 -0
  47. package/src/services/queues/rabbitmq-subscriber.service.ts +7 -1
  48. package/src/solid-core.module.ts +4 -0
@@ -4,6 +4,7 @@ import { ISolidDatabaseModule } from 'src/interfaces';
4
4
  import { getDynamicModuleNames } from 'src/helpers/module.helper';
5
5
  import { SolidRegistry } from 'src/helpers/solid-registry';
6
6
  import { SettingService } from 'src/services/setting.service';
7
+ import { InfoService } from 'src/services/info.service';
7
8
 
8
9
  interface InfoCommandOptions {
9
10
  detailed?: boolean;
@@ -16,6 +17,7 @@ export class InfoCommand extends CommandRunner {
16
17
  constructor(
17
18
  private readonly solidRegistry: SolidRegistry,
18
19
  private readonly settingService: SettingService,
20
+ private readonly infoService: InfoService,
19
21
  ) {
20
22
  super();
21
23
  }
@@ -25,6 +27,7 @@ export class InfoCommand extends CommandRunner {
25
27
  const dataSources = this.getDataSources();
26
28
 
27
29
  const output: Record<string, any> = {
30
+ packages: this.infoService.getPackageVersions(),
28
31
  modules: {
29
32
  count: enabledModules.length,
30
33
  names: enabledModules,
@@ -0,0 +1,15 @@
1
+ import { Controller, Get } from '@nestjs/common';
2
+ import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
3
+ import { InfoService } from '../services/info.service';
4
+
5
+ @ApiTags('Solid Core')
6
+ @ApiBearerAuth('jwt')
7
+ @Controller('info')
8
+ export class InfoController {
9
+ constructor(private readonly infoService: InfoService) {}
10
+
11
+ @Get('/versions')
12
+ getVersions() {
13
+ return this.infoService.getPackageVersions();
14
+ }
15
+ }
@@ -5,38 +5,51 @@ import { User } from 'src/entities/user.entity'
5
5
  @Entity("ss_ai_interactions")
6
6
  export class AiInteraction extends CommonEntity {
7
7
  @Index()
8
- @ManyToOne(() => User, { nullable: false })
8
+ @ManyToOne(() => User, { nullable: true })
9
9
  @JoinColumn()
10
10
  user: User;
11
+
11
12
  @Index()
12
13
  @Column({ type: "varchar" })
13
14
  threadId: string;
15
+
14
16
  @Column({ type: "varchar" })
15
17
  role: string;
18
+
16
19
  @Column({ type: "text" })
17
20
  message: string;
21
+
18
22
  @Column({ type: "varchar", nullable: true })
19
23
  contentType: string;
24
+
20
25
  @Index()
21
26
  @Column({ type: "varchar", nullable: true })
22
27
  status: string;
28
+
23
29
  @Column({ type: "text", nullable: true })
24
30
  errorMessage: string;
31
+
25
32
  @Column({ type: "varchar", nullable: true })
26
33
  modelUsed: string;
34
+
27
35
  @Column({ type: "integer", nullable: true })
28
36
  responseTimeMs: number;
37
+
29
38
  @Column({ type: "simple-json", nullable: true })
30
39
  metadata: any;
40
+
31
41
  @Column({ nullable: true, default: false })
32
42
  isApplied: boolean = false;
43
+
33
44
  @Index()
34
45
  @ManyToOne(() => AiInteraction, { nullable: true })
35
46
  @JoinColumn()
36
47
  parentInteraction: AiInteraction;
48
+
37
49
  @Index({ unique: true })
38
50
  @Column({ type: "varchar" })
39
51
  externalId: string;
52
+
40
53
  @Column({ nullable: true, default: false })
41
54
  isAutoApply: boolean = false;
42
55
 
@@ -48,8 +61,10 @@ export class AiInteraction extends CommonEntity {
48
61
 
49
62
  @Column({ type: "integer", nullable: true })
50
63
  totalTokens: number;
64
+
51
65
  @Column({ type: "text", nullable: true })
52
66
  originalMessage: string;
67
+
53
68
  @Column({ nullable: true, default: false })
54
69
  isEdited: boolean = false;
55
- }
70
+ }
@@ -7,22 +7,30 @@ export class DashboardQuestionSqlDatasetConfig extends CommonEntity {
7
7
  @Index({ unique: true })
8
8
  @Column({ type: "varchar" })
9
9
  datasetName: string;
10
+
10
11
  @Column({ type: "varchar" })
11
12
  datasetDisplayName: string;
13
+
12
14
  @Column({ type: "text", nullable: true })
13
15
  description: string;
16
+
14
17
  @Column({ type: "text" })
15
18
  sql: string;
19
+
16
20
  @Column({ type: "varchar" })
17
21
  labelColumnName: string;
22
+
18
23
  @Column({ type: "varchar" })
19
24
  valueColumnName: string;
25
+
20
26
  @ManyToOne(() => DashboardQuestion, { nullable: false })
21
27
  @JoinColumn()
22
28
  question: DashboardQuestion;
29
+
23
30
  @Column({ type: "text", nullable: true })
24
31
  options: any;
32
+
25
33
  @Index({ unique: true })
26
34
  @Column({ type: "varchar", nullable: false })
27
35
  externalId: string;
28
- }
36
+ }
@@ -8,27 +8,37 @@ export class DashboardQuestion extends CommonEntity {
8
8
  @Index({ unique: true })
9
9
  @Column({ type: "varchar" })
10
10
  name: string;
11
+
11
12
  @Index()
12
13
  @Column({})
13
14
  sourceType: string;
15
+
14
16
  @Index()
15
17
  @Column({})
16
18
  visualisedAs: string;
19
+
17
20
  @Column({ type: "varchar", nullable: true })
18
21
  providerName: string;
22
+
19
23
  @ManyToOne(() => Dashboard, { nullable: true })
20
24
  @JoinColumn()
21
25
  dashboard: Dashboard;
26
+
22
27
  @OneToMany(() => DashboardQuestionSqlDatasetConfig, dashboardQuestionSqlDatasetConfig => dashboardQuestionSqlDatasetConfig.question, { cascade: true })
23
28
  questionSqlDatasetConfigs: DashboardQuestionSqlDatasetConfig[];
29
+
24
30
  @Column({ type: "simple-json", nullable: true })
25
31
  chartOptions: any;
32
+
26
33
  @Column({ type: "text", nullable: true })
27
34
  labelSql: string;
35
+
28
36
  @Column({ type: "text", nullable: true })
29
37
  kpiSql: string;
38
+
30
39
  @Column({ type: "integer", nullable: true })
31
40
  sequenceNumber: number;
41
+
32
42
  @Index({ unique: true })
33
43
  @Column({ type: "varchar", nullable: false })
34
44
  externalId: string;
@@ -7,24 +7,33 @@ export class DashboardVariable extends CommonEntity {
7
7
  @Index({ unique: true })
8
8
  @Column({ type: "varchar" })
9
9
  variableName: string;
10
+
10
11
  @Index()
11
12
  @Column({ type: "varchar" })
12
13
  variableType: string;
14
+
13
15
  @Column({ type: "simple-json", nullable: true })
14
16
  selectionStaticValues: any;
17
+
15
18
  @Column({ nullable: true })
16
19
  selectionDynamicSourceType: string;
20
+
17
21
  @Column({ type: "text", nullable: true })
18
22
  selectionDynamicSQL: string;
23
+
19
24
  @Column({ type: "varchar", nullable: true })
20
25
  selectionDynamicProviderName: string;
26
+
21
27
  @Column({ nullable: true, default: true })
22
28
  isMultiSelect: boolean = true;
29
+
23
30
  @ManyToOne(() => Dashboard, { nullable: true })
24
31
  @JoinColumn()
25
32
  dashboard: Dashboard;
33
+
26
34
  @Column({ type: "text", nullable: true })
27
35
  defaultValue: string;
36
+
28
37
  @Column({ type: "varchar", nullable: true })
29
38
  defaultOperator: string;
30
39
  }
package/src/index.ts CHANGED
@@ -264,6 +264,8 @@ export * from './services/user.service'
264
264
  export * from './services/view-metadata.service'
265
265
  export * from './services/whatsapp/Msg91WhatsappService' //rename
266
266
  export * from './services/setting.service'
267
+ export * from './services/info.service'
268
+ export * from './controllers/info.controller'
267
269
  export * from './services/settings/default-settings-provider.service'
268
270
  export * from './services/security-rule.service'
269
271
  export * from './services/request-context.service'
package/src/interfaces.ts CHANGED
@@ -262,6 +262,7 @@ export interface QueuesModuleOptions {
262
262
  name: string;
263
263
  type: BrokerType;
264
264
  queueName: string;
265
+ prefetch?: number;
265
266
  }
266
267
 
267
268
  export type MediaWithFullUrl = Media & {
@@ -4932,7 +4932,7 @@
4932
4932
  "name": "user",
4933
4933
  "displayName": "User",
4934
4934
  "type": "relation",
4935
- "required": true,
4935
+ "required": false,
4936
4936
  "unique": false,
4937
4937
  "index": true,
4938
4938
  "private": false,
@@ -0,0 +1,60 @@
1
+ import { Injectable, Logger } from '@nestjs/common';
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
4
+
5
+ interface PackageVersionInfo {
6
+ repo: 'local' | 'npm';
7
+ version: string;
8
+ }
9
+
10
+ export interface SolidVersionsInfo {
11
+ 'solid-core': PackageVersionInfo;
12
+ 'solid-core-ui': PackageVersionInfo;
13
+ 'solid-code-builder': PackageVersionInfo;
14
+ }
15
+
16
+ @Injectable()
17
+ export class InfoService {
18
+ private readonly logger = new Logger(InfoService.name);
19
+
20
+ getPackageVersions(): SolidVersionsInfo {
21
+ return {
22
+ 'solid-core': this.getPackageInfo('@solidxai/core'),
23
+ 'solid-core-ui': this.getPackageInfo('@solidxai/core-ui'),
24
+ 'solid-code-builder': this.getPackageInfo('@solidxai/code-builder'),
25
+ };
26
+ }
27
+
28
+ private getPackageInfo(packageName: string): PackageVersionInfo {
29
+ const result = this.resolvePackageJson(packageName);
30
+ if (result) return result;
31
+
32
+ const siblingUiPath = path.resolve(process.cwd(), '..', 'solid-ui', 'node_modules', packageName, 'package.json');
33
+ const siblingResult = this.readPackageJson(siblingUiPath);
34
+ if (siblingResult) return siblingResult;
35
+
36
+ this.logger.warn(`Could not resolve package: ${packageName}`);
37
+ return { repo: 'npm', version: 'not installed' };
38
+ }
39
+
40
+ private resolvePackageJson(packageName: string): PackageVersionInfo | null {
41
+ try {
42
+ const pkgJsonPath = require.resolve(`${packageName}/package.json`);
43
+ return this.readPackageJson(pkgJsonPath);
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+
49
+ private readPackageJson(pkgJsonPath: string): PackageVersionInfo | null {
50
+ try {
51
+ if (!fs.existsSync(pkgJsonPath)) return null;
52
+ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
53
+ const version = pkgJson.version ? `v${pkgJson.version}` : 'unknown';
54
+ const repo = pkgJsonPath.includes(path.sep + 'node_modules' + path.sep) ? 'npm' : 'local';
55
+ return { repo, version };
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+ }
@@ -97,6 +97,12 @@ export abstract class RabbitMqSubscriber<T> implements OnModuleInit, QueueSubscr
97
97
  await this.cleanup();
98
98
  this.logger.log(`RabbitMqSubscriber in connectAndConsume for queue: ${queueName} and url: ${this.url}`);
99
99
 
100
+ const options = this.options();
101
+ const prefetch = options.prefetch ?? 1;
102
+ if (prefetch < 1) {
103
+ throw new Error(`RabbitMqSubscriber prefetch must be >= 1 for queue ${queueName}`);
104
+ }
105
+
100
106
  let connection: amqp.Connection;
101
107
  try {
102
108
  connection = await this.establishConnection();
@@ -133,7 +139,7 @@ export abstract class RabbitMqSubscriber<T> implements OnModuleInit, QueueSubscr
133
139
  });
134
140
 
135
141
  // Process one message at a time per consumer to avoid parallel work on the same subscriber instance.
136
- await channel.prefetch(1);
142
+ await channel.prefetch(prefetch);
137
143
 
138
144
  // Use a direct exchange with a stable routing key so retry DLX can route back to the main queue.
139
145
  const exchangeName = `${queueName}.exchange`;
@@ -145,6 +145,8 @@ import { SavedFiltersController } from './controllers/saved-filters.controller';
145
145
  import { ScheduledJobController } from './controllers/scheduled-job.controller';
146
146
  import { SecurityRuleController } from './controllers/security-rule.controller';
147
147
  import { SettingController } from './controllers/setting.controller';
148
+ import { InfoController } from './controllers/info.controller';
149
+ import { InfoService } from './services/info.service';
148
150
  import { UserActivityHistoryController } from './controllers/user-activity-history.controller';
149
151
  import { UserViewMetadataController } from './controllers/user-view-metadata.controller';
150
152
  import { UserController } from './controllers/user.controller';
@@ -436,6 +438,7 @@ import { ListOfRolesSelectionProvider } from './services/selection-providers/lis
436
438
  SecurityRuleController,
437
439
  ServiceController,
438
440
  SettingController,
441
+ InfoController,
439
442
  SmsTemplateController,
440
443
  TestController,
441
444
  TestQueueController,
@@ -475,6 +478,7 @@ import { ListOfRolesSelectionProvider } from './services/selection-providers/lis
475
478
  RefreshModelCommand,
476
479
  RefreshModuleCommand,
477
480
  InfoCommand,
481
+ InfoService,
478
482
  SolidIntrospectService,
479
483
  DiscoveryService,
480
484
  R2RHelperService,