@solidxai/core 0.1.9-beta.5 → 0.1.9-beta.7
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/helpers/bootstrap.helper.d.ts.map +1 -1
- package/dist/helpers/bootstrap.helper.js +4 -1
- package/dist/helpers/bootstrap.helper.js.map +1 -1
- package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.js +5 -5
- package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.js.map +1 -1
- package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.d.ts.map +1 -1
- package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.js +2 -2
- package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.js.map +1 -1
- package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.js +5 -5
- package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.js.map +1 -1
- package/dist/helpers/module-metadata-helper.service.js +3 -3
- package/dist/helpers/module-metadata-helper.service.js.map +1 -1
- package/dist/helpers/string.helper.d.ts +1 -0
- package/dist/helpers/string.helper.d.ts.map +1 -1
- package/dist/helpers/string.helper.js +4 -1
- package/dist/helpers/string.helper.js.map +1 -1
- package/dist/interfaces/mq.d.ts +1 -1
- package/dist/interfaces/mq.d.ts.map +1 -1
- package/dist/interfaces/mq.js.map +1 -1
- package/dist/jobs/database/api-email-subscriber-database.service.d.ts +1 -1
- package/dist/jobs/database/api-email-subscriber-database.service.js +1 -1
- package/dist/jobs/database/api-email-subscriber-database.service.js.map +1 -1
- package/dist/jobs/database/msg91-whatsapp-subscriber-database.service.d.ts +1 -1
- package/dist/jobs/database/msg91-whatsapp-subscriber-database.service.js +1 -1
- package/dist/jobs/database/msg91-whatsapp-subscriber-database.service.js.map +1 -1
- package/dist/jobs/database/three60-whatsapp-subscriber-database.service.d.ts +1 -1
- package/dist/jobs/database/three60-whatsapp-subscriber-database.service.js +1 -1
- package/dist/jobs/database/three60-whatsapp-subscriber-database.service.js.map +1 -1
- package/dist/jobs/rabbitmq/api-email-subscriber.service.d.ts +1 -1
- package/dist/jobs/rabbitmq/api-email-subscriber.service.js +1 -1
- package/dist/jobs/rabbitmq/api-email-subscriber.service.js.map +1 -1
- package/dist/jobs/rabbitmq/msg91-whatsapp-subscriber.service.d.ts +1 -1
- package/dist/jobs/rabbitmq/msg91-whatsapp-subscriber.service.js +1 -1
- package/dist/jobs/rabbitmq/msg91-whatsapp-subscriber.service.js.map +1 -1
- package/dist/jobs/rabbitmq/test-queue-subscriber.service.d.ts +1 -1
- package/dist/jobs/rabbitmq/test-queue-subscriber.service.d.ts.map +1 -1
- package/dist/jobs/rabbitmq/test-queue-subscriber.service.js +6 -3
- package/dist/jobs/rabbitmq/test-queue-subscriber.service.js.map +1 -1
- package/dist/jobs/rabbitmq/three60-whatsapp-subscriber.service.d.ts +1 -1
- package/dist/jobs/rabbitmq/three60-whatsapp-subscriber.service.js +1 -1
- package/dist/jobs/rabbitmq/three60-whatsapp-subscriber.service.js.map +1 -1
- package/dist/jobs/redis/api-email-subscriber-redis.service.d.ts +1 -1
- package/dist/jobs/redis/api-email-subscriber-redis.service.js +1 -1
- package/dist/jobs/redis/api-email-subscriber-redis.service.js.map +1 -1
- package/dist/jobs/redis/msg91-whatsapp-subscriber-redis.service.d.ts +1 -1
- package/dist/jobs/redis/msg91-whatsapp-subscriber-redis.service.js +1 -1
- package/dist/jobs/redis/msg91-whatsapp-subscriber-redis.service.js.map +1 -1
- package/dist/jobs/redis/three60-whatsapp-subscriber-redis.service.d.ts +1 -1
- package/dist/jobs/redis/three60-whatsapp-subscriber-redis.service.js +1 -1
- package/dist/jobs/redis/three60-whatsapp-subscriber-redis.service.js.map +1 -1
- package/dist/repository/chatter-message-details.repository.d.ts.map +1 -1
- package/dist/repository/chatter-message-details.repository.js +7 -6
- package/dist/repository/chatter-message-details.repository.js.map +1 -1
- package/dist/repository/chatter-message.repository.d.ts.map +1 -1
- package/dist/repository/chatter-message.repository.js +4 -4
- package/dist/repository/chatter-message.repository.js.map +1 -1
- package/dist/repository/solid-base.repository.js +2 -2
- package/dist/repository/solid-base.repository.js.map +1 -1
- package/dist/seeders/module-test-data.service.js +4 -4
- package/dist/seeders/module-test-data.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +7 -3
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +7 -7
- package/dist/services/chatter-message.service.js.map +1 -1
- 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 +2 -2
- package/dist/services/computed-fields/entity/sequence-num-computed-field-provider.js.map +1 -1
- package/dist/services/crud-helper.service.d.ts.map +1 -1
- package/dist/services/crud-helper.service.js +9 -9
- package/dist/services/crud-helper.service.js.map +1 -1
- package/dist/services/export-transaction.service.d.ts.map +1 -1
- package/dist/services/export-transaction.service.js +4 -3
- package/dist/services/export-transaction.service.js.map +1 -1
- package/dist/services/field-metadata.service.d.ts.map +1 -1
- package/dist/services/field-metadata.service.js +7 -7
- package/dist/services/field-metadata.service.js.map +1 -1
- package/dist/services/fixtures.service.js +2 -2
- package/dist/services/fixtures.service.js.map +1 -1
- package/dist/services/genai/mcp-handlers/mcp-handler-factory.service.d.ts.map +1 -1
- package/dist/services/genai/mcp-handlers/mcp-handler-factory.service.js +2 -2
- package/dist/services/genai/mcp-handlers/mcp-handler-factory.service.js.map +1 -1
- package/dist/services/import-transaction.service.d.ts.map +1 -1
- package/dist/services/import-transaction.service.js +2 -2
- package/dist/services/import-transaction.service.js.map +1 -1
- package/dist/services/menu-item-metadata.service.js +2 -2
- package/dist/services/menu-item-metadata.service.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +11 -10
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/services/module-metadata.service.d.ts.map +1 -1
- package/dist/services/module-metadata.service.js +2 -2
- package/dist/services/module-metadata.service.js.map +1 -1
- package/dist/services/queues/database-subscriber.service.d.ts +1 -1
- package/dist/services/queues/database-subscriber.service.d.ts.map +1 -1
- 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 +2 -2
- package/dist/services/queues/publisher-factory.service.js.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js +3 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
- package/dist/services/queues/redis-subscriber.service.d.ts +1 -1
- package/dist/services/queues/redis-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/redis-subscriber.service.js.map +1 -1
- package/dist/services/selection-providers/pseudo-foreign-key-selection-provider.service.js +3 -3
- package/dist/services/selection-providers/pseudo-foreign-key-selection-provider.service.js.map +1 -1
- package/dist/services/solid-introspect.service.js +2 -2
- package/dist/services/solid-introspect.service.js.map +1 -1
- package/dist/services/view-metadata.service.d.ts.map +1 -1
- package/dist/services/view-metadata.service.js +2 -2
- package/dist/services/view-metadata.service.js.map +1 -1
- package/dist/subscribers/computed-entity-field.subscriber.js +6 -6
- package/dist/subscribers/computed-entity-field.subscriber.js.map +1 -1
- package/dist/winston.logger.js +1 -1
- package/dist/winston.logger.js.map +1 -1
- package/package.json +1 -2
- package/src/helpers/bootstrap.helper.ts +5 -2
- package/src/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.ts +1 -1
- package/src/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.ts +1 -2
- package/src/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.ts +1 -1
- package/src/helpers/module-metadata-helper.service.ts +3 -3
- package/src/helpers/string.helper.ts +3 -0
- package/src/interfaces/mq.ts +2 -2
- package/src/jobs/database/api-email-subscriber-database.service.ts +1 -1
- package/src/jobs/database/msg91-whatsapp-subscriber-database.service.ts +1 -1
- package/src/jobs/database/three60-whatsapp-subscriber-database.service.ts +1 -1
- package/src/jobs/rabbitmq/api-email-subscriber.service.ts +1 -1
- package/src/jobs/rabbitmq/msg91-whatsapp-subscriber.service.ts +1 -1
- package/src/jobs/rabbitmq/test-queue-subscriber.service.ts +6 -7
- package/src/jobs/rabbitmq/three60-whatsapp-subscriber.service.ts +1 -1
- package/src/jobs/redis/api-email-subscriber-redis.service.ts +1 -1
- package/src/jobs/redis/msg91-whatsapp-subscriber-redis.service.ts +1 -1
- package/src/jobs/redis/three60-whatsapp-subscriber-redis.service.ts +1 -1
- package/src/repository/chatter-message-details.repository.ts +4 -3
- package/src/repository/chatter-message.repository.ts +4 -4
- package/src/repository/solid-base.repository.ts +2 -2
- package/src/seeders/module-test-data.service.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +7 -3
- package/src/services/chatter-message.service.ts +1 -3
- package/src/services/computed-fields/entity/sequence-num-computed-field-provider.ts +1 -2
- package/src/services/crud-helper.service.ts +1 -4
- package/src/services/export-transaction.service.ts +3 -4
- package/src/services/field-metadata.service.ts +1 -4
- package/src/services/fixtures.service.ts +1 -1
- package/src/services/genai/mcp-handlers/mcp-handler-factory.service.ts +1 -2
- package/src/services/import-transaction.service.ts +1 -1
- package/src/services/menu-item-metadata.service.ts +2 -2
- package/src/services/model-metadata.service.ts +10 -12
- package/src/services/module-metadata.service.ts +1 -2
- package/src/services/queues/database-subscriber.service.ts +1 -1
- package/src/services/queues/publisher-factory.service.ts +1 -2
- package/src/services/queues/rabbitmq-subscriber.service.ts +13 -11
- package/src/services/queues/redis-subscriber.service.ts +2 -2
- package/src/services/selection-providers/pseudo-foreign-key-selection-provider.service.ts +1 -1
- package/src/services/solid-introspect.service.ts +1 -1
- package/src/services/view-metadata.service.ts +1 -5
- package/src/subscribers/computed-entity-field.subscriber.ts +6 -6
- package/src/winston.logger.ts +1 -1
|
@@ -1 +1 @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4CAAgB,CAAC,CAAC,CAAA;qCADX,8BAAa;QAEV,4CAAgB;GAR9C,6BAA6B,CAqLzC","sourcesContent":["import { camelize } from \"@angular-devkit/core/src/utils/strings\";\nimport { Delete } from \"@aws-sdk/client-s3\";\nimport { forwardRef, Inject, Injectable, InternalServerErrorException, Logger, Scope } from \"@nestjs/common\";\nimport { model } from \"mongoose\";\nimport { ComputedFieldTriggerOperation } from \"src/dtos/create-field-metadata.dto\";\nimport { ComputedFieldMetadata, SolidRegistry, TypeOrmEventContext } from \"src/helpers/solid-registry\";\nimport { IEntityPreComputeFieldProvider } from \"src/interfaces\";\nimport { PublisherFactory } from \"src/services/queues/publisher-factory.service\";\nimport { DataSource, EntitySubscriberInterface, InsertEvent, RemoveEvent, UpdateEvent } from \"typeorm\";\n\n// Create an interface i.e ComputedFieldEvaluationPayload which has same fields as the ComputedFieldMetadata and an additional field for the database entity\nexport interface ComputedFieldEvaluationPayload extends ComputedFieldMetadata {\n databaseEntity: any;\n}\n\n@Injectable({ scope: Scope.TRANSIENT })\n// @EventSubscriber()\nexport class ComputedEntityFieldSubscriber implements EntitySubscriberInterface {\n private readonly logger = new Logger(this.constructor.name);\n private dataSource: DataSource;\n constructor(\n // @InjectDataSource()\n // private readonly dataSource: DataSource,\n private readonly solidRegistry: SolidRegistry,\n @Inject(forwardRef(() => PublisherFactory))\n private readonly publisherFactory: PublisherFactory<ComputedFieldEvaluationPayload>\n // private readonly computedFieldPublisher: ComputedFieldEvaluationPublisherDatabase,\n ) {\n // this.dataSource.subscribers.push(this);\n }\n\n bindToDataSource(dataSource: DataSource) {\n this.dataSource = dataSource;\n this.dataSource.subscribers.push(this);\n }\n\n async beforeInsert(event: InsertEvent<any>): Promise<any> {\n const modelName = camelize(event.metadata?.name ?? event.entity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'beforeInsert');\n await this.handleComputedFieldEvaluation(event.entity, ComputedFieldTriggerOperation.beforeInsert, modelName, eventContext);\n }\n\n async beforeUpdate(event: UpdateEvent<any>): Promise<any> {\n const modelName = camelize(event.metadata?.name ?? event.entity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'beforeUpdate');\n // await this.handleComputedFieldEvaluation(event.databaseEntity, ComputedFieldTriggerOperation.beforeUpdate, modelName, eventContext);\n await this.handleComputedFieldEvaluation(event.entity, ComputedFieldTriggerOperation.beforeUpdate, modelName, eventContext);\n }\n\n afterInsert(event: InsertEvent<any>) {\n const modelName = camelize(event.metadata?.name ?? event.entity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'afterInsert');\n this.handleComputedFieldEvaluationJob(event.entity, ComputedFieldTriggerOperation.afterInsert, modelName, eventContext);\n }\n\n afterUpdate(event: UpdateEvent<any>) {\n const modelName = camelize(event.metadata?.name ?? event.entity?.constructor?.name ?? event.databaseEntity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'afterUpdate');\n // this.handleComputedFieldEvaluationJob(event.databaseEntity, ComputedFieldTriggerOperation.afterUpdate, modelName, eventContext);\n this.handleComputedFieldEvaluationJob(event.entity, ComputedFieldTriggerOperation.afterUpdate, modelName, eventContext);\n }\n\n afterRemove(event: RemoveEvent<any>) {\n const modelName = camelize(event.metadata?.name ?? event.entity?.constructor?.name ?? event.databaseEntity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'afterRemove');\n this.handleComputedFieldEvaluationJob(event.databaseEntity, ComputedFieldTriggerOperation.afterRemove, modelName, eventContext);\n }\n\n //FIXME: Need to add support for beforeRemove, beforeSoftRemove, afterSoftRemove, beforeRecover, afterRecover\n\n private async handleComputedFieldEvaluation(entity: any, currentOperation: ComputedFieldTriggerOperation, modelName: string, eventContext?: TypeOrmEventContext): Promise<void> {\n if (!entity) {\n return;\n }\n const computedFieldsTobeEvaluated = this.getComputedFieldsForEvaluation(\n this.solidRegistry.getComputedFieldMetadata(),\n currentOperation,\n modelName\n );\n //TODO: We can add a feature i.e dependsOn, where we can check if the computed field depends on other computed fields and evaluate them first\n for (const computedField of computedFieldsTobeEvaluated) {\n await this.evaluateComputedField(this.attachContext(computedField, eventContext), entity, currentOperation);\n }\n }\n\n private handleComputedFieldEvaluationJob(entity: any, currentOperation: ComputedFieldTriggerOperation, modelName: string, eventContext?: TypeOrmEventContext) {\n if (!entity) {\n return;\n }\n const computedFieldsTobeEvaluated = this.getComputedFieldsForEvaluation(\n this.solidRegistry.getComputedFieldMetadata(),\n currentOperation,\n modelName\n );\n //TODO: We can add a feature i.e dependsOn, where we can check if the computed field depends on other computed fields and evaluate them first\n for (const computedField of computedFieldsTobeEvaluated) {\n this.enqueueComputedFieldEvaluationJob(this.attachContext(computedField, eventContext), entity, eventContext);\n }\n }\n\n // Based on the current model name and current operation, identify all the computed providers that need to be evaluated\n // Pass the database entity and the context to the provider of type IEntityComputedFieldProvider\n private getComputedFieldsForEvaluation(computedFieldMetadata: ComputedFieldMetadata[] = [], currentOperation: ComputedFieldTriggerOperation, currentModelName: string) {\n return computedFieldMetadata.filter(\n (computedField) => computedField.computedFieldTriggerConfig.some(\n (trigger) => trigger.operations.includes(currentOperation) &&\n trigger.modelName === currentModelName\n )\n );\n }\n\n private async evaluateComputedField(computedFieldMetadata: ComputedFieldMetadata<any>, entity: any, currentOperation: ComputedFieldTriggerOperation) {\n // Skip pre-compute on insert when the payload already supplies the target field value.\n if (this.shouldSkipPreComputeOnInsert(computedFieldMetadata, entity, currentOperation)) {\n return;\n }\n const computedValue = await this.preComputeValue(computedFieldMetadata, entity);\n if (computedValue) {\n entity[computedFieldMetadata.fieldName] = computedValue; //TODO: This line here is just for backward compatibility, once the pre compute interface is change to return void, we will get rid of it.\n }\n }\n\n private shouldSkipPreComputeOnInsert(computedFieldMetadata: ComputedFieldMetadata<any>, entity: any, currentOperation: ComputedFieldTriggerOperation): boolean {\n if (currentOperation !== ComputedFieldTriggerOperation.beforeInsert) {\n return false;\n }\n if (!entity) {\n return false;\n }\n const fieldName = computedFieldMetadata.fieldName;\n if (!fieldName) {\n return false;\n }\n const hasValue = Object.prototype.hasOwnProperty.call(entity, fieldName) && entity[fieldName] !== undefined && entity[fieldName] !== null;\n return hasValue;\n }\n\n private async preComputeValue(computedFieldMetadata: ComputedFieldMetadata<any>, entity: any) {\n try {\n const provider = this.solidRegistry.getComputedFieldProvider(computedFieldMetadata.computedFieldValueProviderName);\n // Get the instance of the provider and assert it is of type IEntityComputedFieldProvider\n const providerInstance = provider.instance as IEntityPreComputeFieldProvider<any, any, any>; // IEntityComputedFieldProvider\n const computedValue = await providerInstance.preComputeValue(entity, computedFieldMetadata); //FIXME There should some way to check/assert if the provider actually has a postComputeAndSaveValue\n return computedValue; //TODO: This line here is just for backward compatibility, once the pre compute interface is change to return void, we will get rid of it.\n } catch (error) {\n throw new InternalServerErrorException(`Error evaluating computed field ${computedFieldMetadata.fieldName} for model ${computedFieldMetadata.modelName} for triggered entity ${entity.constructor.name}: ${error.message}`);\n }\n }\n\n private enqueueComputedFieldEvaluationJob(computedField: ComputedFieldMetadata<any>, databaseEntity: any, eventContext?: any) {\n const payload = {\n ...computedField,\n databaseEntity,\n // eventContext,\n };\n this.publisherFactory.publish({ payload }, 'ComputedFieldEvaluationPublisher')\n // this.computedFieldPublisher.publish({\n // payload\n // });\n }\n\n private attachContext<T extends ComputedFieldMetadata<any>>(computedField: T, eventContext?: any): T {\n if (!eventContext) return computedField;\n return {\n ...computedField,\n computedFieldValueProviderCtxt: {\n ...(computedField.computedFieldValueProviderCtxt || {}),\n },\n eventContext,\n };\n }\n\n private sanitizeEventContext(event: InsertEvent<any> | UpdateEvent<any> | RemoveEvent<any>, eventType: string): TypeOrmEventContext {\n if (!event) return undefined;\n const base: TypeOrmEventContext = {\n metadataName: event.metadata?.name,\n eventType: eventType,\n };\n if (\"entityId\" in event && event.entityId) {\n base.entityId = event.entityId;\n } else if (event.entity && (event.entity as any).id != null) {\n base.entityId = (event.entity as any).id;\n } else if (\"databaseEntity\" in event && (event.databaseEntity as any)?.id != null) {\n base.entityId = (event.databaseEntity as any).id;\n }\n if (\"updatedColumns\" in event && event.updatedColumns) {\n base.updatedColumns = event.updatedColumns.map((c: any) => c.propertyName);\n }\n if (\"updatedRelations\" in event && event.updatedRelations) {\n base.updatedRelations = event.updatedRelations.map((r: any) => r.propertyName);\n }\n if (event.entity) base.entity = event.entity;\n if (\"databaseEntity\" in event && event.databaseEntity) {\n base.databaseEntity = event.databaseEntity;\n }\n return base;\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"computed-entity-field.subscriber.js","sourceRoot":"","sources":["../../src/subscribers/computed-entity-field.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAmC;AAEnC,2CAA6G;AAE7G,iFAAmF;AACnF,8DAAuG;AAEvG,4FAAiF;AAU1E,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAGtC,YAGqB,aAA4B,EAE7C,gBAAmF;QAFlE,kBAAa,GAAb,aAAa,CAAe;QAE5B,qBAAgB,GAAhB,gBAAgB,CAAkD;QAPtE,WAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAW5D,CAAC;IAED,gBAAgB,CAAC,UAAsB;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAuB;QACtC,MAAM,SAAS,GAAG,IAAA,kBAAS,EAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;QAC3F,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QACtE,MAAM,IAAI,CAAC,6BAA6B,CAAC,KAAK,CAAC,MAAM,EAAE,yDAA6B,CAAC,YAAY,EAAE,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C,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;QAC/C,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ,CAAA;AArLY,sEAA6B;wCAA7B,6BAA6B;IAFzC,IAAA,mBAAU,EAAC,EAAE,KAAK,EAAE,cAAK,CAAC,SAAS,EAAE,CAAC;IAS9B,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,4CAAgB,CAAC,CAAC,CAAA;qCADX,8BAAa;QAEV,4CAAgB;GAR9C,6BAA6B,CAqLzC","sourcesContent":["import { camelCase } from 'lodash';\nimport { Delete } from \"@aws-sdk/client-s3\";\nimport { forwardRef, Inject, Injectable, InternalServerErrorException, Logger, Scope } from \"@nestjs/common\";\nimport { model } from \"mongoose\";\nimport { ComputedFieldTriggerOperation } from \"src/dtos/create-field-metadata.dto\";\nimport { ComputedFieldMetadata, SolidRegistry, TypeOrmEventContext } from \"src/helpers/solid-registry\";\nimport { IEntityPreComputeFieldProvider } from \"src/interfaces\";\nimport { PublisherFactory } from \"src/services/queues/publisher-factory.service\";\nimport { DataSource, EntitySubscriberInterface, InsertEvent, RemoveEvent, UpdateEvent } from \"typeorm\";\n\n// Create an interface i.e ComputedFieldEvaluationPayload which has same fields as the ComputedFieldMetadata and an additional field for the database entity\nexport interface ComputedFieldEvaluationPayload extends ComputedFieldMetadata {\n databaseEntity: any;\n}\n\n@Injectable({ scope: Scope.TRANSIENT })\n// @EventSubscriber()\nexport class ComputedEntityFieldSubscriber implements EntitySubscriberInterface {\n private readonly logger = new Logger(this.constructor.name);\n private dataSource: DataSource;\n constructor(\n // @InjectDataSource()\n // private readonly dataSource: DataSource,\n private readonly solidRegistry: SolidRegistry,\n @Inject(forwardRef(() => PublisherFactory))\n private readonly publisherFactory: PublisherFactory<ComputedFieldEvaluationPayload>\n // private readonly computedFieldPublisher: ComputedFieldEvaluationPublisherDatabase,\n ) {\n // this.dataSource.subscribers.push(this);\n }\n\n bindToDataSource(dataSource: DataSource) {\n this.dataSource = dataSource;\n this.dataSource.subscribers.push(this);\n }\n\n async beforeInsert(event: InsertEvent<any>): Promise<any> {\n const modelName = camelCase(event.metadata?.name ?? event.entity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'beforeInsert');\n await this.handleComputedFieldEvaluation(event.entity, ComputedFieldTriggerOperation.beforeInsert, modelName, eventContext);\n }\n\n async beforeUpdate(event: UpdateEvent<any>): Promise<any> {\n const modelName = camelCase(event.metadata?.name ?? event.entity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'beforeUpdate');\n // await this.handleComputedFieldEvaluation(event.databaseEntity, ComputedFieldTriggerOperation.beforeUpdate, modelName, eventContext);\n await this.handleComputedFieldEvaluation(event.entity, ComputedFieldTriggerOperation.beforeUpdate, modelName, eventContext);\n }\n\n afterInsert(event: InsertEvent<any>) {\n const modelName = camelCase(event.metadata?.name ?? event.entity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'afterInsert');\n this.handleComputedFieldEvaluationJob(event.entity, ComputedFieldTriggerOperation.afterInsert, modelName, eventContext);\n }\n\n afterUpdate(event: UpdateEvent<any>) {\n const modelName = camelCase(event.metadata?.name ?? event.entity?.constructor?.name ?? event.databaseEntity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'afterUpdate');\n // this.handleComputedFieldEvaluationJob(event.databaseEntity, ComputedFieldTriggerOperation.afterUpdate, modelName, eventContext);\n this.handleComputedFieldEvaluationJob(event.entity, ComputedFieldTriggerOperation.afterUpdate, modelName, eventContext);\n }\n\n afterRemove(event: RemoveEvent<any>) {\n const modelName = camelCase(event.metadata?.name ?? event.entity?.constructor?.name ?? event.databaseEntity?.constructor?.name ?? '');\n const eventContext = this.sanitizeEventContext(event, 'afterRemove');\n this.handleComputedFieldEvaluationJob(event.databaseEntity, ComputedFieldTriggerOperation.afterRemove, modelName, eventContext);\n }\n\n //FIXME: Need to add support for beforeRemove, beforeSoftRemove, afterSoftRemove, beforeRecover, afterRecover\n\n private async handleComputedFieldEvaluation(entity: any, currentOperation: ComputedFieldTriggerOperation, modelName: string, eventContext?: TypeOrmEventContext): Promise<void> {\n if (!entity) {\n return;\n }\n const computedFieldsTobeEvaluated = this.getComputedFieldsForEvaluation(\n this.solidRegistry.getComputedFieldMetadata(),\n currentOperation,\n modelName\n );\n //TODO: We can add a feature i.e dependsOn, where we can check if the computed field depends on other computed fields and evaluate them first\n for (const computedField of computedFieldsTobeEvaluated) {\n await this.evaluateComputedField(this.attachContext(computedField, eventContext), entity, currentOperation);\n }\n }\n\n private handleComputedFieldEvaluationJob(entity: any, currentOperation: ComputedFieldTriggerOperation, modelName: string, eventContext?: TypeOrmEventContext) {\n if (!entity) {\n return;\n }\n const computedFieldsTobeEvaluated = this.getComputedFieldsForEvaluation(\n this.solidRegistry.getComputedFieldMetadata(),\n currentOperation,\n modelName\n );\n //TODO: We can add a feature i.e dependsOn, where we can check if the computed field depends on other computed fields and evaluate them first\n for (const computedField of computedFieldsTobeEvaluated) {\n this.enqueueComputedFieldEvaluationJob(this.attachContext(computedField, eventContext), entity, eventContext);\n }\n }\n\n // Based on the current model name and current operation, identify all the computed providers that need to be evaluated\n // Pass the database entity and the context to the provider of type IEntityComputedFieldProvider\n private getComputedFieldsForEvaluation(computedFieldMetadata: ComputedFieldMetadata[] = [], currentOperation: ComputedFieldTriggerOperation, currentModelName: string) {\n return computedFieldMetadata.filter(\n (computedField) => computedField.computedFieldTriggerConfig.some(\n (trigger) => trigger.operations.includes(currentOperation) &&\n trigger.modelName === currentModelName\n )\n );\n }\n\n private async evaluateComputedField(computedFieldMetadata: ComputedFieldMetadata<any>, entity: any, currentOperation: ComputedFieldTriggerOperation) {\n // Skip pre-compute on insert when the payload already supplies the target field value.\n if (this.shouldSkipPreComputeOnInsert(computedFieldMetadata, entity, currentOperation)) {\n return;\n }\n const computedValue = await this.preComputeValue(computedFieldMetadata, entity);\n if (computedValue) {\n entity[computedFieldMetadata.fieldName] = computedValue; //TODO: This line here is just for backward compatibility, once the pre compute interface is change to return void, we will get rid of it.\n }\n }\n\n private shouldSkipPreComputeOnInsert(computedFieldMetadata: ComputedFieldMetadata<any>, entity: any, currentOperation: ComputedFieldTriggerOperation): boolean {\n if (currentOperation !== ComputedFieldTriggerOperation.beforeInsert) {\n return false;\n }\n if (!entity) {\n return false;\n }\n const fieldName = computedFieldMetadata.fieldName;\n if (!fieldName) {\n return false;\n }\n const hasValue = Object.prototype.hasOwnProperty.call(entity, fieldName) && entity[fieldName] !== undefined && entity[fieldName] !== null;\n return hasValue;\n }\n\n private async preComputeValue(computedFieldMetadata: ComputedFieldMetadata<any>, entity: any) {\n try {\n const provider = this.solidRegistry.getComputedFieldProvider(computedFieldMetadata.computedFieldValueProviderName);\n // Get the instance of the provider and assert it is of type IEntityComputedFieldProvider\n const providerInstance = provider.instance as IEntityPreComputeFieldProvider<any, any, any>; // IEntityComputedFieldProvider\n const computedValue = await providerInstance.preComputeValue(entity, computedFieldMetadata); //FIXME There should some way to check/assert if the provider actually has a postComputeAndSaveValue\n return computedValue; //TODO: This line here is just for backward compatibility, once the pre compute interface is change to return void, we will get rid of it.\n } catch (error) {\n throw new InternalServerErrorException(`Error evaluating computed field ${computedFieldMetadata.fieldName} for model ${computedFieldMetadata.modelName} for triggered entity ${entity.constructor.name}: ${error.message}`);\n }\n }\n\n private enqueueComputedFieldEvaluationJob(computedField: ComputedFieldMetadata<any>, databaseEntity: any, eventContext?: any) {\n const payload = {\n ...computedField,\n databaseEntity,\n // eventContext,\n };\n this.publisherFactory.publish({ payload }, 'ComputedFieldEvaluationPublisher')\n // this.computedFieldPublisher.publish({\n // payload\n // });\n }\n\n private attachContext<T extends ComputedFieldMetadata<any>>(computedField: T, eventContext?: any): T {\n if (!eventContext) return computedField;\n return {\n ...computedField,\n computedFieldValueProviderCtxt: {\n ...(computedField.computedFieldValueProviderCtxt || {}),\n },\n eventContext,\n };\n }\n\n private sanitizeEventContext(event: InsertEvent<any> | UpdateEvent<any> | RemoveEvent<any>, eventType: string): TypeOrmEventContext {\n if (!event) return undefined;\n const base: TypeOrmEventContext = {\n metadataName: event.metadata?.name,\n eventType: eventType,\n };\n if (\"entityId\" in event && event.entityId) {\n base.entityId = event.entityId;\n } else if (event.entity && (event.entity as any).id != null) {\n base.entityId = (event.entity as any).id;\n } else if (\"databaseEntity\" in event && (event.databaseEntity as any)?.id != null) {\n base.entityId = (event.databaseEntity as any).id;\n }\n if (\"updatedColumns\" in event && event.updatedColumns) {\n base.updatedColumns = event.updatedColumns.map((c: any) => c.propertyName);\n }\n if (\"updatedRelations\" in event && event.updatedRelations) {\n base.updatedRelations = event.updatedRelations.map((r: any) => r.propertyName);\n }\n if (event.entity) base.entity = event.entity;\n if (\"databaseEntity\" in event && event.databaseEntity) {\n base.databaseEntity = event.databaseEntity;\n }\n return base;\n }\n\n}\n"]}
|
package/dist/winston.logger.js
CHANGED
|
@@ -52,7 +52,7 @@ const nest_winston_1 = require("nest-winston");
|
|
|
52
52
|
const winston = __importStar(require("winston"));
|
|
53
53
|
const disallow_in_production_decorator_1 = require("./decorators/disallow-in-production.decorator");
|
|
54
54
|
exports.WinstonLoggerConfig = {
|
|
55
|
-
level: process.env.LOG_LEVEL || (process.env.ENV === disallow_in_production_decorator_1.Environment.Production ? '
|
|
55
|
+
level: process.env.LOG_LEVEL || (process.env.ENV === disallow_in_production_decorator_1.Environment.Production ? 'info' : 'debug'),
|
|
56
56
|
format: winston.format.combine(winston.format.timestamp(), winston.format.errors({ stack: true }), winston.format.printf(({ level, message, timestamp }) => {
|
|
57
57
|
if (!message) {
|
|
58
58
|
return `[${timestamp}] ${level.toUpperCase()}: (No message provided)`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"winston.logger.js","sourceRoot":"","sources":["../src/winston.logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qCAAiC;AACjC,2CAAwC;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C","sourcesContent":["\nimport { Logger as TypeORMLogger, QueryRunner } from 'typeorm';\nimport { Logger } from 'winston';\nimport { Inject } from '@nestjs/common';\nimport { WINSTON_MODULE_PROVIDER } from 'nest-winston';\nimport * as winston from 'winston';\nimport { Environment } from './decorators/disallow-in-production.decorator';\n\nexport const WinstonLoggerConfig = {\n level: process.env.LOG_LEVEL || (process.env.ENV === Environment.Production ? '
|
|
1
|
+
{"version":3,"file":"winston.logger.js","sourceRoot":"","sources":["../src/winston.logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qCAAiC;AACjC,2CAAwC;AACxC,+CAAuD;AACvD,iDAAmC;AACnC,oGAA4E;AAE/D,QAAA,mBAAmB,GAAG;IAC/B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,8CAAW,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/F,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAC1B,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACtC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;QACpD,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,yBAAyB,CAAC;QAC1E,CAAC;QACD,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,KAAK,OAAO,EAAE,CAAC;IAC/D,CAAC,CAAC,CACL;IACD,UAAU,EAAE;QACR,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAC3B,MAAM,EAAE,OA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C,iBAAiB,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,YAAY,CAAC,OAAe,EAAE,WAAyB;QACnD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,GAAG,CAAC,KAAwC,EAAE,OAAY;QACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;CACJ,CAAA;AA5BY,oDAAoB;+BAApB,oBAAoB;IAChB,WAAA,IAAA,eAAM,EAAC,sCAAuB,CAAC,CAAA;qCAA0B,gBAAM;GADnE,oBAAoB,CA4BhC","sourcesContent":["\nimport { Logger as TypeORMLogger, QueryRunner } from 'typeorm';\nimport { Logger } from 'winston';\nimport { Inject } from '@nestjs/common';\nimport { WINSTON_MODULE_PROVIDER } from 'nest-winston';\nimport * as winston from 'winston';\nimport { Environment } from './decorators/disallow-in-production.decorator';\n\nexport const WinstonLoggerConfig = {\n level: process.env.LOG_LEVEL || (process.env.ENV === Environment.Production ? 'info' : 'debug'),\n format: winston.format.combine(\n winston.format.timestamp(),\n winston.format.errors({ stack: true }),\n winston.format.printf(({ level, message, timestamp }) => {\n if (!message) {\n return `[${timestamp}] ${level.toUpperCase()}: (No message provided)`;\n }\n return `[${timestamp}] ${level.toUpperCase()}: ${message}`;\n }),\n ),\n transports: [\n new winston.transports.Console({\n format: winston.format.combine(\n // winston.format.colorize(),\n // winston.format.timestamp(),\n winston.format.printf(({ level, message, timestamp }) => {\n return `[${timestamp}] ${level.toUpperCase()}: ${message}`;\n }),\n ),\n }),\n new winston.transports.File({\n filename: 'logs/application.log',\n // format: winston.format.json(),\n }),\n new winston.transports.File({\n filename: 'logs/error.log',\n level: 'error',\n // format: winston.format.json(),\n }),\n ],\n};\n\nexport class WinstonTypeORMLogger implements TypeORMLogger {\n constructor(@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) { }\n\n logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner): void {\n if (Boolean(process.env.DEFAULT_DATABASE_LOGGING)) {\n this.logger.info(`Query: ${query} Parameters: ${parameters}`);\n }\n }\n\n logQueryError(error: string, query: string, parameters?: any[], queryRunner?: QueryRunner): void {\n this.logger.error(`Query failed: ${error} | Query: ${query} | Parameters: ${parameters}`);\n }\n\n logQuerySlow(time: number, query: string, parameters?: any[], queryRunner?: QueryRunner): void {\n this.logger.warn(`Slow query: ${time}ms | Query: ${query} | Parameters: ${parameters}`);\n }\n\n logSchemaBuild(message: string, queryRunner?: QueryRunner): void {\n this.logger.info(`Schema Build: ${message}`);\n }\n\n logMigration(message: string, queryRunner?: QueryRunner): void {\n this.logger.info(`Migration: ${message}`);\n }\n\n log(level: 'log' | 'info' | 'warn' | 'error', message: any): void {\n this.logger[level](message);\n }\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidxai/core",
|
|
3
|
-
"version": "0.1.9-beta.
|
|
3
|
+
"version": "0.1.9-beta.7",
|
|
4
4
|
"description": "This module is a NestJS module containing all the required core providers required by a Solid application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"author": "Oswald Rodrigues <oswald@logicloop.io>",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@angular-devkit/core": "^18.0.3",
|
|
34
33
|
"@aws-sdk/client-s3": "^3.637.0",
|
|
35
34
|
"@aws-sdk/client-textract": "^3.873.0",
|
|
36
35
|
"@aws-sdk/s3-request-presigner": "^3.828.0",
|
|
@@ -6,8 +6,9 @@ import helmet from 'helmet';
|
|
|
6
6
|
import qs from 'qs';
|
|
7
7
|
import { existsSync } from 'fs';
|
|
8
8
|
import { resolve } from 'path';
|
|
9
|
-
import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston';
|
|
9
|
+
import { WINSTON_MODULE_NEST_PROVIDER, WinstonModule } from 'nest-winston';
|
|
10
10
|
import { CommandFactory } from 'nest-commander';
|
|
11
|
+
import { WinstonLoggerConfig } from '../winston.logger';
|
|
11
12
|
import { WrapResponseInterceptor } from '../interceptors/wrap-response.interceptor';
|
|
12
13
|
import { buildDefaultCorsOptions } from './cors.helper';
|
|
13
14
|
import { buildDefaultSecurityHeaderOptions, buildPermissionsPolicyHeader, PermissionsPolicyConfig } from './security.helper';
|
|
@@ -71,7 +72,9 @@ export async function bootstrapSolidApp(
|
|
|
71
72
|
const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {} } = options;
|
|
72
73
|
|
|
73
74
|
const appModule = await appModuleFactory();
|
|
74
|
-
const app = await NestFactory.create(appModule
|
|
75
|
+
const app = await NestFactory.create(appModule, {
|
|
76
|
+
logger: WinstonModule.createLogger(WinstonLoggerConfig),
|
|
77
|
+
});
|
|
75
78
|
|
|
76
79
|
const apiEnabled = parseBooleanEnv('API_ENABLED', true);
|
|
77
80
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classify } from
|
|
1
|
+
import { classify } from '../string.helper';
|
|
2
2
|
import { Logger } from "@nestjs/common";
|
|
3
3
|
import { isEmpty, isEnum, isNotEmpty } from "class-validator";
|
|
4
4
|
import { RelationFieldsCommand } from "src/dtos/create-field-metadata.dto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classify } from
|
|
1
|
+
import { classify } from '../string.helper';
|
|
2
2
|
import { BadRequestException } from "@nestjs/common";
|
|
3
3
|
import { isEmpty, isNotEmpty, isString } from "class-validator";
|
|
4
4
|
import { FieldCrudManager, ValidationError } from "src/interfaces";
|
|
@@ -87,7 +87,6 @@ export class ManyToOneRelationFieldCrudManager implements FieldCrudManager {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
91
90
|
return dto;
|
|
92
91
|
}
|
|
93
92
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classify } from
|
|
1
|
+
import { classify } from '../string.helper';
|
|
2
2
|
import { Logger } from "@nestjs/common";
|
|
3
3
|
import { isEmpty, isEnum, isInt, isNotEmpty } from "class-validator";
|
|
4
4
|
import { RelationFieldsCommand } from "src/dtos/create-field-metadata.dto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { kebabCase } from 'lodash';
|
|
2
2
|
import { Injectable, Logger } from "@nestjs/common";
|
|
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'; // To handle file paths
|
|
@@ -41,7 +41,7 @@ export class ModuleMetadataHelperService {
|
|
|
41
41
|
if (!moduleName) {
|
|
42
42
|
return '';
|
|
43
43
|
}
|
|
44
|
-
const dashModuleName =
|
|
44
|
+
const dashModuleName = kebabCase(moduleName);
|
|
45
45
|
const folderPath = path.resolve(process.cwd(), 'module-metadata', dashModuleName);
|
|
46
46
|
const filePath = path.join(folderPath, `${dashModuleName}-metadata.json`);
|
|
47
47
|
// Check if filePath exists
|
|
@@ -62,7 +62,7 @@ export class ModuleMetadataHelperService {
|
|
|
62
62
|
return '';
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const dashModuleName =
|
|
65
|
+
const dashModuleName = kebabCase(moduleName);
|
|
66
66
|
|
|
67
67
|
const folderPath = path.resolve(
|
|
68
68
|
process.cwd(),
|
package/src/interfaces/mq.ts
CHANGED
|
@@ -27,6 +27,6 @@ export class Msg91WhatsappQueueSubscriberDatabase extends DatabaseSubscriber<any
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
subscribe(message: QueueMessage<any>) {
|
|
30
|
-
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
30
|
+
return this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -27,6 +27,6 @@ export class Three60WhatsappQueueSubscriberDatabase extends DatabaseSubscriber<a
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
subscribe(message: QueueMessage<any>) {
|
|
30
|
-
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
30
|
+
return this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -25,6 +25,6 @@ export class Msg91WhatsappQueueSubscriber extends RabbitMqSubscriber<any> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
subscribe(message: QueueMessage<any>) {
|
|
28
|
-
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
28
|
+
return this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -35,12 +35,11 @@ export class TestQueueSubscriber extends RabbitMqSubscriber<any> {
|
|
|
35
35
|
|
|
36
36
|
this.testQueueLogger.debug(`Processing message with timeout: ${timeoutSecondsParsed}`);
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// return new Promise((resolve, reject) => {});
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
this.testQueueLogger.debug(`Processed message: ${JSON.stringify(message)}`);
|
|
41
|
+
resolve({ status: 'success', messageId: message.messageId, message: 'Processed message' });
|
|
42
|
+
}, timeoutSecondsParsed * 1000);
|
|
43
|
+
});
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -25,6 +25,6 @@ export class Three60WhatsappQueueSubscriber extends RabbitMqSubscriber<any> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
subscribe(message: QueueMessage<any>) {
|
|
28
|
-
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
28
|
+
return this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -25,6 +25,6 @@ export class Msg91WhatsappQueueSubscriberRedis extends RedisSubscriber<any> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
subscribe(message: QueueMessage<any>) {
|
|
28
|
-
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
28
|
+
return this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -25,6 +25,6 @@ export class Three60WhatsappQueueSubscriberRedis extends RedisSubscriber<any> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
subscribe(message: QueueMessage<any>) {
|
|
28
|
-
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
28
|
+
return this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
QueryRunner,
|
|
5
5
|
SelectQueryBuilder,
|
|
6
6
|
} from 'typeorm';
|
|
7
|
-
import {
|
|
7
|
+
import { upperFirst, camelCase } from 'lodash';
|
|
8
|
+
import { classify } from '../helpers/string.helper';
|
|
8
9
|
|
|
9
10
|
import { ChatterMessageDetails } from 'src/entities/chatter-message-details.entity';
|
|
10
11
|
import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
|
|
@@ -80,7 +81,7 @@ export class ChatterMessageDetailsRepository extends SolidBaseRepository<Chatter
|
|
|
80
81
|
const entityName = classify(coModelName); // "client" -> "Client"
|
|
81
82
|
const meta = this.dataSource.getMetadata(entityName); // throws if not registered
|
|
82
83
|
// const table = meta.tablePath; // schema-qualified
|
|
83
|
-
const coAlias =
|
|
84
|
+
const coAlias = camelCase(meta.name); // stable alias, e.g., "client"
|
|
84
85
|
|
|
85
86
|
// LEFT JOIN "<schema>"."<table>" "<coAlias>"
|
|
86
87
|
// ON "<coAlias>"."id" = "message"."co_model_entity_id"
|
|
@@ -103,7 +104,7 @@ export class ChatterMessageDetailsRepository extends SolidBaseRepository<Chatter
|
|
|
103
104
|
const coModelName = get(requestFilter, this.CO_MODEL_NAME_PATH);
|
|
104
105
|
if (!coModelName) return [undefined, undefined];
|
|
105
106
|
|
|
106
|
-
const alias =
|
|
107
|
+
const alias = camelCase(coModelName);
|
|
107
108
|
return [coModelName, alias];
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { camelize, classify } from "@angular-devkit/core/src/utils/strings";
|
|
2
1
|
import { Injectable } from "@nestjs/common";
|
|
3
2
|
import { ChatterMessage } from "src/entities/chatter-message.entity";
|
|
4
3
|
import { ActiveUserData } from "src/interfaces/active-user-data.interface";
|
|
@@ -6,7 +5,8 @@ import { RequestContextService } from "src/services/request-context.service";
|
|
|
6
5
|
import { DataSource, QueryRunner, SelectQueryBuilder } from "typeorm";
|
|
7
6
|
import { SecurityRuleRepository } from "./security-rule.repository";
|
|
8
7
|
import { SolidBaseRepository } from "./solid-base.repository";
|
|
9
|
-
import {get} from
|
|
8
|
+
import { get, camelCase } from 'lodash';
|
|
9
|
+
import { classify } from '../helpers/string.helper';
|
|
10
10
|
|
|
11
11
|
@Injectable()
|
|
12
12
|
export class ChatterMessageRepository extends SolidBaseRepository<ChatterMessage> {
|
|
@@ -44,7 +44,7 @@ export class ChatterMessageRepository extends SolidBaseRepository<ChatterMessage
|
|
|
44
44
|
// const Target = resolveEntityFromCoModelName(coModelName); // your mapping
|
|
45
45
|
const entityName = classify(coModelName)
|
|
46
46
|
const meta = this.dataSource.getMetadata(entityName);
|
|
47
|
-
const alias =
|
|
47
|
+
const alias = camelCase(meta.name);
|
|
48
48
|
qb.leftJoin(
|
|
49
49
|
entityName,
|
|
50
50
|
alias,
|
|
@@ -63,7 +63,7 @@ export class ChatterMessageRepository extends SolidBaseRepository<ChatterMessage
|
|
|
63
63
|
|
|
64
64
|
const coModelName = get(requestFilter, this.CO_MODEL_NAME_PATH);
|
|
65
65
|
if (!coModelName) return [undefined, undefined];
|
|
66
|
-
const alias =
|
|
66
|
+
const alias = camelCase(coModelName);
|
|
67
67
|
return [coModelName, alias];
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { camelCase } from 'lodash';
|
|
2
2
|
import { Logger } from '@nestjs/common';
|
|
3
3
|
import { CommonEntity } from 'src/entities/common.entity';
|
|
4
4
|
import { ModelMetadata } from 'src/entities/model-metadata.entity';
|
|
@@ -33,7 +33,7 @@ export class SolidBaseRepository<T extends CommonEntity> extends Repository<T> {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
modelSingularName(): string {
|
|
36
|
-
return
|
|
36
|
+
return camelCase(this.metadata.name);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
async findOneByUserKey(userKeyValue: string | number): Promise<T | null> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable, Logger } from '@nestjs/common';
|
|
2
2
|
import { DiscoveryService, ModuleRef } from '@nestjs/core';
|
|
3
3
|
import { getDataSourceToken } from '@nestjs/typeorm';
|
|
4
|
-
import { classify } from '
|
|
4
|
+
import { classify } from '../helpers/string.helper';
|
|
5
5
|
import { DataSource, EntityManager } from 'typeorm';
|
|
6
6
|
import * as fs from 'fs';
|
|
7
7
|
import * as path from 'path';
|
|
@@ -11214,6 +11214,7 @@
|
|
|
11214
11214
|
"label": "Scheduled Job",
|
|
11215
11215
|
"className": "grid"
|
|
11216
11216
|
},
|
|
11217
|
+
"onFieldChange": "scheduleFrequencyOnFieldChangeHandler",
|
|
11217
11218
|
"children": [
|
|
11218
11219
|
{
|
|
11219
11220
|
"type": "sheet",
|
|
@@ -11291,7 +11292,8 @@
|
|
|
11291
11292
|
{
|
|
11292
11293
|
"type": "field",
|
|
11293
11294
|
"attrs": {
|
|
11294
|
-
"name": "cronExpression"
|
|
11295
|
+
"name": "cronExpression",
|
|
11296
|
+
"visible": false
|
|
11295
11297
|
}
|
|
11296
11298
|
},
|
|
11297
11299
|
{
|
|
@@ -11321,13 +11323,15 @@
|
|
|
11321
11323
|
{
|
|
11322
11324
|
"type": "field",
|
|
11323
11325
|
"attrs": {
|
|
11324
|
-
"name": "dayOfWeek"
|
|
11326
|
+
"name": "dayOfWeek",
|
|
11327
|
+
"visible": false
|
|
11325
11328
|
}
|
|
11326
11329
|
},
|
|
11327
11330
|
{
|
|
11328
11331
|
"type": "field",
|
|
11329
11332
|
"attrs": {
|
|
11330
|
-
"name": "dayOfMonth"
|
|
11333
|
+
"name": "dayOfMonth",
|
|
11334
|
+
"visible": false
|
|
11331
11335
|
}
|
|
11332
11336
|
}
|
|
11333
11337
|
]
|
|
@@ -4,7 +4,7 @@ import { ModuleRef } from "@nestjs/core";
|
|
|
4
4
|
import { InjectEntityManager } from '@nestjs/typeorm';
|
|
5
5
|
import { Brackets, EntityManager, EntityMetadata } from 'typeorm';
|
|
6
6
|
|
|
7
|
-
import { classify } from '
|
|
7
|
+
import { classify } from '../helpers/string.helper';
|
|
8
8
|
import { CHATTER_MESSAGE_SUBTYPE, CHATTER_MESSAGE_TYPE } from 'src/constants/chatter-message.constants';
|
|
9
9
|
import { PostChatterMessageDto } from 'src/dtos/post-chatter-message.dto';
|
|
10
10
|
import { ModelMetadataHelperService } from 'src/helpers/model-metadata-helper.service';
|
|
@@ -228,7 +228,6 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
|
|
232
231
|
const allChangedFields = [
|
|
233
232
|
...changedNonRelationFields.map(field => ({
|
|
234
233
|
field,
|
|
@@ -413,7 +412,6 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
|
|
|
413
412
|
}
|
|
414
413
|
}
|
|
415
414
|
|
|
416
|
-
|
|
417
415
|
return value.toString();
|
|
418
416
|
}
|
|
419
417
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classify } from
|
|
1
|
+
import { classify } from '../../../helpers/string.helper';
|
|
2
2
|
import { Injectable } from "@nestjs/common";
|
|
3
3
|
import { InjectDataSource } from "@nestjs/typeorm";
|
|
4
4
|
import { ComputedFieldTriggerOperation } from "src/dtos/create-field-metadata.dto";
|
|
@@ -9,7 +9,6 @@ import { ComputedFieldMetadata } from "src/helpers/solid-registry";
|
|
|
9
9
|
import { IEntityPostComputeFieldProvider } from "src/interfaces";
|
|
10
10
|
import { DataSource, EntityManager } from "typeorm";
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
export interface SequenceNumComputedFieldContext {
|
|
14
13
|
sequenceName: string;
|
|
15
14
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Brackets, SelectQueryBuilder, WhereExpressionBuilder } from "typeorm";
|
|
2
2
|
import { BasicFilterDto } from "../dtos/basic-filters.dto";
|
|
3
|
-
import { classify } from
|
|
3
|
+
import { classify } from '../helpers/string.helper';
|
|
4
4
|
import { ActiveUserData } from "src/interfaces/active-user-data.interface";
|
|
5
5
|
import { SolidRegistry } from "src/helpers/solid-registry";
|
|
6
6
|
import { BadRequestException, Logger } from "@nestjs/common";
|
|
@@ -287,7 +287,6 @@ export class CrudHelperService {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
|
|
291
290
|
if (showSoftDeleted === 'inclusive') {
|
|
292
291
|
qb.withDeleted();
|
|
293
292
|
}
|
|
@@ -744,6 +743,4 @@ export class CrudHelperService {
|
|
|
744
743
|
return matchingPermssions.length > 0
|
|
745
744
|
}
|
|
746
745
|
|
|
747
|
-
|
|
748
|
-
|
|
749
746
|
}
|
|
@@ -5,8 +5,8 @@ import { EntityManager } from 'typeorm';
|
|
|
5
5
|
|
|
6
6
|
import { CRUDService } from 'src/services/crud.service';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
import { classify
|
|
8
|
+
import { kebabCase } from 'lodash';
|
|
9
|
+
import { classify } from '../helpers/string.helper';
|
|
10
10
|
import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
|
|
11
11
|
import { validate } from 'class-validator';
|
|
12
12
|
import { BasicFilterDto } from 'src/dtos/basic-filters.dto';
|
|
@@ -196,7 +196,7 @@ export class ExportTransactionService extends CRUDService<ExportTransaction> {
|
|
|
196
196
|
|
|
197
197
|
private getFileName(templateName: string, exportTransactionUUID: string, fileFormat: string): string {
|
|
198
198
|
const extension = (fileFormat === ExportFormat.EXCEL) ? 'xlsx' : 'csv';
|
|
199
|
-
return `${
|
|
199
|
+
return `${kebabCase(templateName)}-${exportTransactionUUID}.${extension}`;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
private getMimeType(fileFormat: string): string {
|
|
@@ -237,7 +237,6 @@ export class ExportTransactionService extends CRUDService<ExportTransaction> {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
|
|
241
240
|
return async (chunkIndex: number, chunkSize: number) => {
|
|
242
241
|
const offset = chunkIndex * chunkSize;
|
|
243
242
|
const recordFilterDto: BasicFilterDto = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classify } from '
|
|
1
|
+
import { classify } from '../helpers/string.helper';
|
|
2
2
|
import { Injectable, Logger, NotFoundException, OnApplicationBootstrap } from '@nestjs/common';
|
|
3
3
|
import { InjectDataSource } from '@nestjs/typeorm';
|
|
4
4
|
import * as fs from 'fs/promises'; // Use the Promise-based version of fs for async/await
|
|
@@ -21,7 +21,6 @@ import { MediaStorageProviderMetadataRepository } from 'src/repository/media-sto
|
|
|
21
21
|
import { S3FileService } from './file';
|
|
22
22
|
import { MediaStorageProviderMetadata } from 'src/entities/media-storage-provider-metadata.entity';
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
@Injectable()
|
|
26
25
|
export class FieldMetadataService implements OnApplicationBootstrap {
|
|
27
26
|
constructor(
|
|
@@ -806,7 +805,6 @@ export class FieldMetadataService implements OnApplicationBootstrap {
|
|
|
806
805
|
"columnName"
|
|
807
806
|
];
|
|
808
807
|
|
|
809
|
-
|
|
810
808
|
case SolidFieldType.json:
|
|
811
809
|
return [
|
|
812
810
|
"name",
|
|
@@ -1194,7 +1192,6 @@ export class FieldMetadataService implements OnApplicationBootstrap {
|
|
|
1194
1192
|
const parsedFormValues = typeof formValues === 'string' ? qs.parse(formValues, { allowDots: true }) : formValues;
|
|
1195
1193
|
selectionDynamicProviderCtxt['formValues'] = parsedFormValues;
|
|
1196
1194
|
|
|
1197
|
-
|
|
1198
1195
|
// 3. get hold of the provider instance from the SolidRegistry
|
|
1199
1196
|
const selectionProviderInstance = this.solidRegistry.getSelectionProviderInstance(selectionDynamicProvider);
|
|
1200
1197
|
if (!selectionProviderInstance) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable, Logger } from "@nestjs/common";
|
|
2
2
|
import { SolidIntrospectService } from "./solid-introspect.service";
|
|
3
3
|
import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
|
|
4
|
-
import { classify } from
|
|
4
|
+
import { classify } from '../helpers/string.helper';
|
|
5
5
|
|
|
6
6
|
interface ScenarioFixture {
|
|
7
7
|
name: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Injectable, Logger } from '@nestjs/common';
|
|
2
2
|
|
|
3
|
-
import { classify } from '
|
|
3
|
+
import { classify } from '../../../helpers/string.helper';
|
|
4
4
|
import { IMcpToolResponseHandler } from 'src/interfaces';
|
|
5
5
|
import { SolidIntrospectService } from '../../solid-introspect.service';
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
@Injectable()
|
|
9
8
|
export class McpHandlerFactory {
|
|
10
9
|
private readonly logger = new Logger(McpHandlerFactory.name);
|
|
@@ -6,7 +6,6 @@ import { EntityManager } from 'typeorm';
|
|
|
6
6
|
import { CRUDService } from 'src/services/crud.service';
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
import { classify } from '@angular-devkit/core/src/utils/strings';
|
|
10
9
|
import { HttpService } from '@nestjs/axios';
|
|
11
10
|
import { ERROR_MESSAGES } from 'src/constants/error-messages';
|
|
12
11
|
import { RelationFieldsCommand, RelationType, SolidFieldType } from 'src/dtos/create-field-metadata.dto';
|
|
@@ -27,6 +26,7 @@ import { ModelMetadataHelperService } from 'src/helpers/model-metadata-helper.se
|
|
|
27
26
|
import { getUserExcludedFields } from 'src/helpers/user-helper';
|
|
28
27
|
import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
|
|
29
28
|
import {upperFirst, camelCase} from 'lodash';
|
|
29
|
+
import { classify } from '../helpers/string.helper';
|
|
30
30
|
|
|
31
31
|
interface ImportTemplateFileInfo {
|
|
32
32
|
stream: NodeJS.ReadableStream;
|