@solidxai/core 0.1.10-beta.23 → 0.1.10-beta.24
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/CLAUDE.md +9 -1
- package/dist/dtos/create-model-metadata.dto.d.ts +2 -2
- package/dist/dtos/create-model-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-model-metadata.dto.js +6 -11
- package/dist/dtos/create-model-metadata.dto.js.map +1 -1
- package/dist/entities/legacy-common-with-id.entity.d.ts +2 -2
- package/dist/entities/legacy-common-with-id.entity.d.ts.map +1 -1
- package/dist/entities/legacy-common-with-id.entity.js +6 -6
- package/dist/entities/legacy-common-with-id.entity.js.map +1 -1
- package/dist/entities/legacy-common.entity.d.ts +1 -1
- package/dist/entities/legacy-common.entity.d.ts.map +1 -1
- package/dist/entities/legacy-common.entity.js +14 -14
- package/dist/entities/legacy-common.entity.js.map +1 -1
- package/dist/entities/model-metadata.entity.d.ts +2 -2
- package/dist/entities/model-metadata.entity.d.ts.map +1 -1
- package/dist/entities/model-metadata.entity.js +5 -8
- package/dist/entities/model-metadata.entity.js.map +1 -1
- package/dist/enums/legacy-table-type.enum.d.ts +6 -0
- package/dist/enums/legacy-table-type.enum.d.ts.map +1 -0
- package/dist/enums/legacy-table-type.enum.js +10 -0
- package/dist/enums/legacy-table-type.enum.js.map +1 -0
- package/dist/helpers/model-metadata-helper.service.d.ts +2 -1
- package/dist/helpers/model-metadata-helper.service.d.ts.map +1 -1
- package/dist/helpers/model-metadata-helper.service.js +4 -3
- package/dist/helpers/model-metadata-helper.service.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +8 -2
- package/dist/seeders/system-fields-seeder.service.js +1 -1
- package/dist/seeders/system-fields-seeder.service.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js +9 -9
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts +2 -2
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +3 -4
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/subscribers/model-metadata.subscriber.d.ts.map +1 -1
- package/dist/subscribers/model-metadata.subscriber.js +1 -3
- package/dist/subscribers/model-metadata.subscriber.js.map +1 -1
- package/package.json +1 -1
- package/src/dtos/create-model-metadata.dto.ts +5 -9
- package/src/entities/legacy-common-with-id.entity.ts +2 -2
- package/src/entities/legacy-common.entity.ts +1 -1
- package/src/entities/model-metadata.entity.ts +3 -5
- package/src/enums/legacy-table-type.enum.ts +5 -0
- package/src/helpers/model-metadata-helper.service.ts +4 -3
- package/src/index.ts +1 -0
- package/src/seeders/seed-data/solid-core-metadata.json +8 -2
- package/src/seeders/system-fields-seeder.service.ts +1 -1
- package/src/services/mediaStorageProviders/file-s3-storage-provider.ts +11 -11
- package/src/services/model-metadata.service.ts +6 -8
- package/src/subscribers/model-metadata.subscriber.ts +1 -3
- package/CURRENT_PROMPT +0 -6
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { forwardRef, Inject, Injectable, Logger } from "@nestjs/common";
|
|
4
4
|
import { _ } from "lodash";
|
|
5
5
|
import { LEGACY_TABLE_FIELDS_PREFIX } from "src/entities/legacy-common.entity";
|
|
6
|
+
import { LegacyTableType } from "src/enums/legacy-table-type.enum";
|
|
6
7
|
import { ModelMetadataRepository } from "src/repository/model-metadata.repository";
|
|
7
8
|
import { SolidRegistry } from "./solid-registry";
|
|
8
9
|
|
|
@@ -19,12 +20,12 @@ export class ModelMetadataHelperService {
|
|
|
19
20
|
) {
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
getSystemFieldsMetadata(
|
|
23
|
+
getSystemFieldsMetadata(legacyTableType: LegacyTableType = LegacyTableType.NONE): any[] {
|
|
23
24
|
let systemFieldsMetadata: any[];
|
|
24
|
-
if (
|
|
25
|
+
if (legacyTableType === LegacyTableType.GENERATED_ID) {
|
|
25
26
|
systemFieldsMetadata = this.getSystemFieldsMetadataMappingForLegacyTable(true);
|
|
26
27
|
}
|
|
27
|
-
else if (
|
|
28
|
+
else if (legacyTableType === LegacyTableType.EXISTING_ID) {
|
|
28
29
|
systemFieldsMetadata = this.getSystemFieldsMetadataMappingForLegacyTable(false);
|
|
29
30
|
}
|
|
30
31
|
else {
|
package/src/index.ts
CHANGED
|
@@ -157,6 +157,7 @@ export * from './entities/dashboard-user-layout.entity'
|
|
|
157
157
|
export * from './entities/user-api-key.entity'
|
|
158
158
|
|
|
159
159
|
export * from './enums/auth-type.enum'
|
|
160
|
+
export * from './enums/legacy-table-type.enum'
|
|
160
161
|
export * from './decorators/disallow-in-production.decorator'
|
|
161
162
|
|
|
162
163
|
export * from './filters/http-exception.filter'
|
|
@@ -5569,6 +5569,12 @@
|
|
|
5569
5569
|
"AgentEventController.findOne",
|
|
5570
5570
|
"McpAuditLogController.findMany",
|
|
5571
5571
|
"McpAuditLogController.findOne",
|
|
5572
|
+
"DashboardController.getDefinition",
|
|
5573
|
+
"DashboardController.getWidgetData",
|
|
5574
|
+
"DashboardController.getDashboardData",
|
|
5575
|
+
"DashboardController.getVariableOptions",
|
|
5576
|
+
"DashboardController.getLayout",
|
|
5577
|
+
"DashboardController.saveLayout",
|
|
5572
5578
|
"mcp:invoke",
|
|
5573
5579
|
"agent:invoke"
|
|
5574
5580
|
]
|
|
@@ -6142,7 +6148,7 @@
|
|
|
6142
6148
|
},
|
|
6143
6149
|
{
|
|
6144
6150
|
"displayName": "Queue Health",
|
|
6145
|
-
"name": "solid-core-queue-health-dashboard-
|
|
6151
|
+
"name": "solid-core-queue-health-dashboard-action",
|
|
6146
6152
|
"type": "custom",
|
|
6147
6153
|
"domain": "",
|
|
6148
6154
|
"context": "",
|
|
@@ -6342,7 +6348,7 @@
|
|
|
6342
6348
|
"displayName": "Queue Health",
|
|
6343
6349
|
"name": "solid-core-queue-health-dashboard-menu-item",
|
|
6344
6350
|
"sequenceNumber": 1,
|
|
6345
|
-
"actionUserKey": "solid-core-queue-health-dashboard-
|
|
6351
|
+
"actionUserKey": "solid-core-queue-health-dashboard-action",
|
|
6346
6352
|
"moduleUserKey": "solid-core",
|
|
6347
6353
|
"parentMenuItemUserKey": "queues-menu-item"
|
|
6348
6354
|
},
|
|
@@ -37,7 +37,7 @@ export class SystemFieldsSeederService {
|
|
|
37
37
|
private async seedMissingSystemFields(model: ModelMetadata) {
|
|
38
38
|
this.logger.debug(`Checking system fields for model: ${model.singularName}`);
|
|
39
39
|
const existingSystemFields = model.fields.filter(field => field.isSystem);
|
|
40
|
-
const systemFieldsMetadata = this.modelHelperService.getSystemFieldsMetadata(model.
|
|
40
|
+
const systemFieldsMetadata = this.modelHelperService.getSystemFieldsMetadata(model.legacyTableType);
|
|
41
41
|
this.logger.debug(`Model: ${model.singularName} has ${existingSystemFields.length} existing system fields.`);
|
|
42
42
|
// Find out which system fields are missing
|
|
43
43
|
const missingFields = systemFieldsMetadata.filter(
|
|
@@ -2,8 +2,8 @@ import { Injectable, Logger } from "@nestjs/common";
|
|
|
2
2
|
import { ConfigService } from "@nestjs/config";
|
|
3
3
|
import { CommonEntity } from "src/entities/common.entity";
|
|
4
4
|
import { FieldMetadata } from "src/entities/field-metadata.entity";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { LegacyCommonEntityWithExistingId } from "src/entities/legacy-common.entity";
|
|
6
|
+
import { LegacyCommonEntityWithGeneratedId } from "src/entities/legacy-common-with-id.entity";
|
|
7
7
|
import { Media } from "src/entities/media.entity";
|
|
8
8
|
import { MediaStorageProvider } from "src/interfaces";
|
|
9
9
|
import { DiskFileService, S3FileService } from "src/services/file";
|
|
@@ -27,10 +27,10 @@ export class FileS3StorageProvider<T> implements MediaStorageProvider<T> {
|
|
|
27
27
|
|
|
28
28
|
async retrieve(entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]> {
|
|
29
29
|
const isSupportedEntity = entity instanceof CommonEntity
|
|
30
|
-
|| entity instanceof
|
|
31
|
-
|| entity instanceof
|
|
30
|
+
|| entity instanceof LegacyCommonEntityWithExistingId
|
|
31
|
+
|| entity instanceof LegacyCommonEntityWithGeneratedId;
|
|
32
32
|
if (!isSupportedEntity) {
|
|
33
|
-
throw new Error("Entity must be an instance of CommonEntity,
|
|
33
|
+
throw new Error("Entity must be an instance of CommonEntity, LegacyCommonEntityWithExistingId or LegacyCommonEntityWithGeneratedId"); // FIXME This needs to be handled through generics. e.g T extends CommonEntity
|
|
34
34
|
}
|
|
35
35
|
// @ts-ignore
|
|
36
36
|
const media = await this.mediaRepository.findByEntityIdAndFieldIdAndModelMetadataId(entity.id, mediaFieldMetadata.id, mediaFieldMetadata.model.id, ['mediaStorageProviderMetadata']);
|
|
@@ -60,10 +60,10 @@ export class FileS3StorageProvider<T> implements MediaStorageProvider<T> {
|
|
|
60
60
|
|
|
61
61
|
async store(files: Express.Multer.File[], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]> {
|
|
62
62
|
const isSupportedEntity = entity instanceof CommonEntity
|
|
63
|
-
|| entity instanceof
|
|
64
|
-
|| entity instanceof
|
|
63
|
+
|| entity instanceof LegacyCommonEntityWithExistingId
|
|
64
|
+
|| entity instanceof LegacyCommonEntityWithGeneratedId;
|
|
65
65
|
if (!isSupportedEntity) {
|
|
66
|
-
throw new Error("Entity must be an instance of CommonEntity,
|
|
66
|
+
throw new Error("Entity must be an instance of CommonEntity, LegacyCommonEntityWithExistingId or LegacyCommonEntityWithGeneratedId"); // FIXME This needs to be handled through generics. e.g T extends CommonEntity
|
|
67
67
|
}
|
|
68
68
|
const result: Media[] = [];
|
|
69
69
|
const storageProvider = mediaFieldMetadata.mediaStorageProvider;
|
|
@@ -102,10 +102,10 @@ export class FileS3StorageProvider<T> implements MediaStorageProvider<T> {
|
|
|
102
102
|
|
|
103
103
|
async delete(entity: T, mediaFieldMetadata: FieldMetadata): Promise<void> {
|
|
104
104
|
const isSupportedEntity = entity instanceof CommonEntity
|
|
105
|
-
|| entity instanceof
|
|
106
|
-
|| entity instanceof
|
|
105
|
+
|| entity instanceof LegacyCommonEntityWithExistingId
|
|
106
|
+
|| entity instanceof LegacyCommonEntityWithGeneratedId;
|
|
107
107
|
if (!isSupportedEntity) {
|
|
108
|
-
throw new Error("Entity must be an instance of CommonEntity,
|
|
108
|
+
throw new Error("Entity must be an instance of CommonEntity, LegacyCommonEntityWithExistingId or LegacyCommonEntityWithGeneratedId"); // FIXME This needs to be handled through generics. e.g T extends CommonEntity
|
|
109
109
|
}
|
|
110
110
|
const storageProvider = mediaFieldMetadata.mediaStorageProvider;
|
|
111
111
|
const region = this.getEffectiveRegion(storageProvider.region);
|
|
@@ -2,17 +2,16 @@ import { BadRequestException, forwardRef, Inject, Injectable, Logger, NotFoundEx
|
|
|
2
2
|
import { InjectDataSource } from '@nestjs/typeorm';
|
|
3
3
|
import * as fs from 'fs/promises'; // Use the Promise-based version of fs for async/await
|
|
4
4
|
import * as path from 'path';
|
|
5
|
-
import { DataSource, EntityManager,
|
|
5
|
+
import { DataSource, EntityManager, Repository, SelectQueryBuilder } from 'typeorm';
|
|
6
6
|
import { CreateModelMetadataDto } from '../dtos/create-model-metadata.dto';
|
|
7
7
|
import { ModelMetadata } from '../entities/model-metadata.entity';
|
|
8
8
|
import { ModuleMetadata } from '../entities/module-metadata.entity';
|
|
9
9
|
|
|
10
10
|
import { kebabCase } from 'lodash';
|
|
11
|
-
import { classify } from '../helpers/string.helper';
|
|
12
11
|
import { ERROR_MESSAGES } from 'src/constants/error-messages';
|
|
13
12
|
import { DisallowInProduction } from 'src/decorators/disallow-in-production.decorator';
|
|
14
13
|
import { SolidFieldType } from 'src/dtos/create-field-metadata.dto';
|
|
15
|
-
import {
|
|
14
|
+
import { NavigationDto } from 'src/dtos/navigation.dto';
|
|
16
15
|
import { ModuleMetadataHelperService } from 'src/helpers/module-metadata-helper.service';
|
|
17
16
|
import { FieldMetadataRepository } from 'src/repository/field-metadata.repository';
|
|
18
17
|
import { ModelMetadataRepository } from 'src/repository/model-metadata.repository';
|
|
@@ -22,20 +21,20 @@ import { ActionMetadata } from '../entities/action-metadata.entity';
|
|
|
22
21
|
import { FieldMetadata } from '../entities/field-metadata.entity';
|
|
23
22
|
import { MenuItemMetadata } from '../entities/menu-item-metadata.entity';
|
|
24
23
|
import { ViewMetadata } from '../entities/view-metadata.entity';
|
|
24
|
+
import { CommandService } from '../helpers/command.service';
|
|
25
25
|
import {
|
|
26
26
|
REFRESH_MODEL_COMMAND,
|
|
27
27
|
REMOVE_FIELDS_COMMAND,
|
|
28
28
|
SchematicService
|
|
29
29
|
} from '../helpers/schematic.service';
|
|
30
|
-
import {
|
|
30
|
+
import { classify } from '../helpers/string.helper';
|
|
31
31
|
import { CodeGenerationOptions } from '../interfaces';
|
|
32
32
|
import { CrudHelperService } from './crud-helper.service';
|
|
33
|
+
import { CRUDService } from './crud.service';
|
|
33
34
|
import { FieldMetadataService } from './field-metadata.service';
|
|
34
35
|
import { MediaStorageProviderMetadataService } from './media-storage-provider-metadata.service';
|
|
35
36
|
import { RoleMetadataService } from './role-metadata.service';
|
|
36
|
-
import { NavigationDto } from 'src/dtos/navigation.dto';
|
|
37
37
|
import { SolidIntrospectService } from './solid-introspect.service';
|
|
38
|
-
import { CRUDService } from './crud.service';
|
|
39
38
|
import { SolidTsMorphService } from './solid-ts-morph.service';
|
|
40
39
|
|
|
41
40
|
@Injectable()
|
|
@@ -288,8 +287,7 @@ export class ModelMetadataService {
|
|
|
288
287
|
tableName: model.tableName,
|
|
289
288
|
userKeyFieldUserKey: model.fields.find(field => field.isUserKey)?.name,
|
|
290
289
|
isChild: model?.isChild,
|
|
291
|
-
|
|
292
|
-
isLegacyTableWithId: model?.isLegacyTableWithId,
|
|
290
|
+
legacyTableType: model?.legacyTableType,
|
|
293
291
|
parentModelUserKey: model?.parentModel?.singularName,
|
|
294
292
|
enableAuditTracking: model?.enableAuditTracking,
|
|
295
293
|
enableSoftDelete: model?.enableSoftDelete,
|
|
@@ -35,9 +35,7 @@ export class ModelMetadataSubscriber implements EntitySubscriberInterface<ModelM
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
private systemFieldMetadataToBeAdded(event: InsertEvent<ModelMetadata>) {
|
|
38
|
-
const
|
|
39
|
-
const isLegacyTableWithId = event.entity.isLegacyTableWithId;
|
|
40
|
-
const systemFieldsDefaultMetadata = this.modelHelperService.getSystemFieldsMetadata(isLegacyTable, isLegacyTableWithId);
|
|
38
|
+
const systemFieldsDefaultMetadata = this.modelHelperService.getSystemFieldsMetadata(event.entity.legacyTableType);
|
|
41
39
|
// map and add the model as event.entity for the above metadata
|
|
42
40
|
const systemFieldsMetadata = systemFieldsDefaultMetadata.map(field => ({
|
|
43
41
|
...field,
|
package/CURRENT_PROMPT
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
Have a look at the generate command in the control plane project. It generates code i.e boilerplate for modules and models. For the generation of api code is delegate to the solid cli in the api project.
|
|
2
|
-
|
|
3
|
-
The modelMetadataService generateCode and moduleMetadataService generateCode are what are called eventually. These are called from both the refresh-model and refresh-module commands and the controllers for module-metadata and model-metadata.
|
|
4
|
-
|
|
5
|
-
Change the code in schematic service to use the solidctl generate command instead of using the schematic command directly. This will ensure that the code generation is consistent and follows the same patterns as the rest of the project.
|
|
6
|
-
|