@solidxai/core 0.1.11-beta.9 → 0.1.11
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/CHANGELOG.md +456 -0
- package/dist/controllers/datasource-introspection.controller.d.ts +8 -0
- package/dist/controllers/datasource-introspection.controller.d.ts.map +1 -1
- package/dist/controllers/media.controller.js +0 -2
- package/dist/controllers/media.controller.js.map +1 -1
- package/dist/helpers/environment.helper.d.ts +0 -1
- package/dist/helpers/environment.helper.d.ts.map +1 -1
- package/dist/helpers/environment.helper.js +0 -4
- package/dist/helpers/environment.helper.js.map +1 -1
- package/dist/helpers/model-metadata-helper.service.d.ts +1 -2
- package/dist/helpers/model-metadata-helper.service.d.ts.map +1 -1
- package/dist/helpers/model-metadata-helper.service.js +2 -6
- package/dist/helpers/model-metadata-helper.service.js.map +1 -1
- package/dist/helpers/module-metadata-helper.service.js +1 -1
- package/dist/helpers/module-metadata-helper.service.js.map +1 -1
- package/dist/helpers/solid-registry.d.ts +1 -2
- package/dist/helpers/solid-registry.d.ts.map +1 -1
- package/dist/helpers/solid-registry.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +1 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/repository/scheduled-job.repository.d.ts +2 -2
- package/dist/repository/scheduled-job.repository.d.ts.map +1 -1
- package/dist/repository/scheduled-job.repository.js +3 -6
- package/dist/repository/scheduled-job.repository.js.map +1 -1
- package/dist/repository/security-rule.repository.d.ts +2 -2
- package/dist/repository/security-rule.repository.d.ts.map +1 -1
- package/dist/repository/security-rule.repository.js +3 -6
- package/dist/repository/security-rule.repository.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +62 -33
- package/dist/services/authentication.service.d.ts +2 -0
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +32 -11
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/computed-fields/entity/alpha-num-external-id-computed-field-provider.d.ts.map +1 -1
- package/dist/services/computed-fields/entity/alpha-num-external-id-computed-field-provider.js +5 -7
- package/dist/services/computed-fields/entity/alpha-num-external-id-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 +7 -0
- package/dist/services/crud-helper.service.js.map +1 -1
- package/dist/services/datasource-introspection.service.d.ts +10 -0
- package/dist/services/datasource-introspection.service.d.ts.map +1 -1
- package/dist/services/datasource-introspection.service.js +109 -17
- package/dist/services/datasource-introspection.service.js.map +1 -1
- package/dist/services/menu-item-metadata.service.d.ts.map +1 -1
- package/dist/services/menu-item-metadata.service.js +1 -0
- package/dist/services/menu-item-metadata.service.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts +2 -0
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +49 -16
- 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 +0 -28
- package/dist/services/module-metadata.service.js.map +1 -1
- package/dist/services/settings/default-settings-provider.service.d.ts +212 -0
- package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
- package/dist/services/settings/default-settings-provider.service.js +106 -0
- package/dist/services/settings/default-settings-provider.service.js.map +1 -1
- package/dist/services/solid-ts-morph.service.d.ts +6 -0
- package/dist/services/solid-ts-morph.service.d.ts.map +1 -1
- package/dist/services/solid-ts-morph.service.js +43 -0
- package/dist/services/solid-ts-morph.service.js.map +1 -1
- package/dist/subscribers/audit.subscriber.d.ts.map +1 -1
- package/dist/subscribers/audit.subscriber.js +2 -8
- package/dist/subscribers/audit.subscriber.js.map +1 -1
- package/dist/subscribers/computed-entity-field.subscriber.d.ts +0 -8
- package/dist/subscribers/computed-entity-field.subscriber.d.ts.map +1 -1
- package/dist/subscribers/computed-entity-field.subscriber.js +3 -36
- package/dist/subscribers/computed-entity-field.subscriber.js.map +1 -1
- package/dist/subscribers/created-by-updated-by.subscriber.d.ts.map +1 -1
- package/dist/subscribers/created-by-updated-by.subscriber.js.map +1 -1
- package/dist/subscribers/field-metadata.subscriber.d.ts.map +1 -1
- package/dist/subscribers/field-metadata.subscriber.js.map +1 -1
- package/dist/subscribers/scheduled-job.subscriber.d.ts.map +1 -1
- package/dist/subscribers/scheduled-job.subscriber.js +2 -3
- package/dist/subscribers/scheduled-job.subscriber.js.map +1 -1
- package/dist/subscribers/security-rule.subscriber.d.ts.map +1 -1
- package/dist/subscribers/security-rule.subscriber.js +3 -5
- package/dist/subscribers/security-rule.subscriber.js.map +1 -1
- package/package.json +1 -1
- package/src/controllers/media.controller.ts +1 -1
- package/src/helpers/environment.helper.ts +0 -11
- package/src/helpers/model-metadata-helper.service.ts +2 -7
- package/src/helpers/module-metadata-helper.service.ts +1 -1
- package/src/helpers/solid-registry.ts +1 -7
- package/src/index.ts +0 -1
- package/src/interfaces.ts +1 -0
- package/src/repository/scheduled-job.repository.ts +4 -10
- package/src/repository/security-rule.repository.ts +4 -10
- package/src/seeders/seed-data/solid-core-metadata.json +62 -33
- package/src/services/authentication.service.ts +46 -12
- package/src/services/computed-fields/entity/alpha-num-external-id-computed-field-provider.ts +5 -11
- package/src/services/crud-helper.service.ts +7 -0
- package/src/services/datasource-introspection.service.ts +176 -16
- package/src/services/menu-item-metadata.service.ts +2 -1
- package/src/services/model-metadata.service.ts +63 -22
- package/src/services/module-metadata.service.ts +0 -36
- package/src/services/settings/default-settings-provider.service.ts +106 -0
- package/src/services/solid-ts-morph.service.ts +61 -1
- package/src/subscribers/audit.subscriber.ts +2 -11
- package/src/subscribers/computed-entity-field.subscriber.ts +6 -63
- package/src/subscribers/created-by-updated-by.subscriber.ts +0 -3
- package/src/subscribers/field-metadata.subscriber.ts +0 -3
- package/src/subscribers/scheduled-job.subscriber.ts +2 -3
- package/src/subscribers/security-rule.subscriber.ts +3 -8
- package/dist/helpers/nodemon-heartbeat.d.ts +0 -5
- package/dist/helpers/nodemon-heartbeat.d.ts.map +0 -1
- package/dist/helpers/nodemon-heartbeat.js +0 -67
- package/dist/helpers/nodemon-heartbeat.js.map +0 -1
- package/src/helpers/nodemon-heartbeat.ts +0 -59
package/dist/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AA4DA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,wCAAwB,CAAA;IACxB,6DAA6C,CAAA;IAC7C,6DAA6C,CAAA;IAC7C,8CAA8B,CAAA;AAChC,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAkKD,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,gDAAmC,CAAA;AACrC,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,MAAa,YAAY;IACvB,YACS,IAAS,EACT,OAAU;QADV,SAAI,GAAJ,IAAI,CAAK;QACT,YAAO,GAAP,OAAO,CAAG;IACf,CAAC;CACN;AALD,oCAKC;AAyED,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB","sourcesContent":["import { Repository } from 'typeorm';\nimport { User } from 'src/entities/user.entity';\nimport { CreateUserDto } from 'src/dtos/create-user.dto';\nimport { CreateEmailTemplateDto } from 'src/dtos/create-email-template.dto';\nimport { CreateSmsTemplateDto } from 'src/dtos/create-sms-template.dto';\nimport { SignUpDto } from 'src/dtos/sign-up.dto';\nimport { Readable } from 'stream';\nimport { CreateMediaStorageProviderMetadataDto } from './dtos/create-media-storage-provider-metadata.dto';\nimport { DatasourceType } from './dtos/create-model-metadata.dto';\nimport { CreateModuleMetadataDto } from './dtos/create-module-metadata.dto';\nimport { CreateRoleMetadataDto } from './dtos/create-role-metadata.dto';\nimport { CreateSecurityRuleDto } from './dtos/create-security-rule.dto';\nimport { FieldMetadata } from './entities/field-metadata.entity';\nimport { Media } from './entities/media.entity';\nimport { ComputedFieldMetadata } from './helpers/solid-registry';\nimport { ActiveUserData } from './interfaces/active-user-data.interface';\nimport { SecurityRuleConfig } from './dtos/security-rule-config.dto';\nimport { SecurityRule } from './entities/security-rule.entity';\n\nexport interface FieldCrudManager {\n // fieldMetadata: FieldMetadata;\n // entityManager?: EntityManager;\n // createDto: any;\n // files : Array<Express.Multer.File>;\n validate(\n dto: any,\n files: Array<Express.Multer.File>,\n ): ValidationError[] | Promise<ValidationError[]>;\n transformForCreate(dto: any, ctxt?: any): any | Promise<any>;\n}\n\nexport interface ValidationError {\n field: string;\n error: string;\n}\n\n// export interface MediaStorage\nexport interface MediaStorageProvider<T> {\n store(files: Express.Multer.File[], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n delete(entity: T, mediaFieldMetadata: FieldMetadata): Promise<void>;\n deleteByMediaRecord(media: Media): Promise<void>;\n retrieve(entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n storeStreams(streamPairs: [Readable, string][], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n // delete(file: string): Promise<void>;\n}\n\nexport interface ModuleMetadataConfiguration {\n moduleMetadata?: CreateModuleMetadataDto,\n roles?: CreateRoleMetadataDto[],\n users?: SignUpDto[],\n actions?: any[],\n menus?: any[],\n views?: any[],\n emailTemplates?: CreateEmailTemplateDto[],\n smsTemplates?: CreateSmsTemplateDto[],\n mediaStorageProviders?: CreateMediaStorageProviderMetadataDto[]\n securityRules?: CreateSecurityRuleDto[],\n dashboards?: any[],\n}\n\nexport enum SettingLevel {\n SystemEnv = 'system-env',\n SystemAdminReadonly = 'system-admin-readonly',\n SystemAdminEditable = 'system-admin-editable',\n InternalUser = \"internal-user\"\n}\n\nexport type SettingControlType =\n | 'shortText'\n | 'longText'\n | 'numeric'\n | 'boolean'\n | 'date'\n | 'datetime'\n | 'mediaSingle'\n | 'selectionStatic'\n | 'custom';\n\nexport interface SettingOption {\n label: string;\n value: string | number | boolean;\n}\n\nexport interface SettingDefinition<T = any> {\n moduleName: string;\n key: string;\n value: T;\n level: SettingLevel;\n encrypted?: boolean;\n label?: string;\n description?: string;\n placeholder?: string;\n group?: string;\n sortOrder?: number;\n controlType?: SettingControlType;\n options?: SettingOption[];\n settingsWidget?: string; // for custom controlType, specify the frontend widget to use\n}\n\nexport interface AdminSettingDefinition<T = any> extends SettingDefinition<T> {\n editable: boolean;\n}\n\nexport interface AdminSettingsResponse<T = any> {\n data: AdminSettingDefinition<T>[];\n}\n\n// solid-core/settings/settings-provider.interface.ts\nexport interface ISettingsProvider {\n getSettings(): SettingDefinition[];\n}\n\nexport interface CodeGenerationOptions {\n moduleId?: number;\n moduleUserKey?: string;\n modelId?: number;\n modelUserKey?: string;\n fieldIdsForRemoval?: number[];\n fieldNamesForRemoval?: string[];\n dryRun?: boolean;\n}\n\n\nexport interface McpResponse {\n success: boolean;\n request: string;\n response: string;\n model?: string;\n tools_invoked?: string[];\n tool_calls?: any[];\n duration_ms?: number;\n errors?: string[];\n error_trace?: string[];\n content_type?: string;\n}\n\nexport interface ISelectionProviderContext {\n limit: number;\n offset: number;\n formValues: Record<string, any>;\n //Attribute to control the validation on creating the record\n validateOnSave?: boolean;\n // query: string;\n}\n\nexport interface ISelectionProviderValues {\n label: string;\n value: string;\n}\n\nexport interface ISelectionProvider<T extends ISelectionProviderContext> {\n help(): string;\n\n name(): string;\n\n value(optionValue: string, ctxt: T): Promise<ISelectionProviderValues | any>;\n\n values(query: any, ctxt: T): Promise<readonly ISelectionProviderValues[]>;\n}\n\nexport interface IDashboardWidgetDataProviderContext<TVariables = Record<string, any>, TProviderContext = Record<string, any>> {\n moduleName: string;\n dashboardName: string;\n widgetName: string;\n variables: TVariables;\n providerContext: TProviderContext;\n activeUser?: ActiveUserData;\n}\n\nexport interface IDashboardWidgetDataResponseEnvelope<TData = any, TUiHints = Record<string, any>> {\n meta: {\n providerName: string;\n generatedAt: string;\n widgetName: string;\n durationMs: number;\n [key: string]: any;\n };\n data: TData;\n uiHints?: TUiHints;\n}\n\nexport interface IDashboardWidgetDataProvider<\n TContext extends IDashboardWidgetDataProviderContext = IDashboardWidgetDataProviderContext,\n TResponse = any,\n> {\n help(): string;\n name(): string;\n getData(\n widgetDefinition: Record<string, any>,\n ctxt: TContext,\n ): Promise<IDashboardWidgetDataResponseEnvelope<TResponse> | any>;\n}\n\n\n/**\n * @deprecated Use `IEntityComputedFieldProvider` instead.\n */\nexport interface IComputedFieldProvider<T> {\n help(): string;\n\n name(): string;\n\n valueType(): string;\n\n computeValue(dto: any, ctxt: T): Promise<string | number>; // FIXME : Improve the types to make it more specific using generics\n}\n\nexport interface IEntityComputedFieldProvider {\n help(): string;\n\n name(): string;\n}\n\nexport interface IEntityPreComputeFieldProvider<TTriggerEntity, TContext, TValue = void> extends IEntityComputedFieldProvider {\n preComputeValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<TValue>;\n}\n\nexport interface IEntityPostComputeFieldProvider<TTriggerEntity, TContext> extends IEntityComputedFieldProvider {\n postComputeAndSaveValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<void>;\n}\n\nexport interface ISolidDatabaseModule {\n name(): string;\n\n type(): DatasourceType;\n}\n\nexport enum EventType {\n USER_REGISTERED = 'user.registered',\n}\n\nexport class EventDetails<T> {\n constructor(\n public type: any,\n public payload: T,\n ) { }\n}\n\nexport interface IExtensionUserCreationProvider<T extends User = User, TDto extends CreateUserDto = CreateUserDto> {\n readonly repo: Repository<T>;\n buildExtensionEntity(dto: TDto): Promise<T>;\n roles(dto: TDto): string[];\n}\n\nexport interface IMail<TResponse = unknown> {\n sendEmail(\n to: string,\n subject: string,\n body: string,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n\n sendEmailUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n}\n\nexport interface ISMS {\n sendSMS(to: string, body: string, shouldQueueSms: boolean): Promise<any>;\n\n sendSMSUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueSms: boolean,\n ): Promise<any>;\n}\n\nexport interface IWhatsAppTransport {\n sendWhatsAppMessage(\n to: string,\n templateId: string,\n parameters: any,\n parentEntity?: any,\n parentEntityId?: any\n ): Promise<any>;\n}\n\nexport interface MailAttachmentWrapper {\n relativePath?: string;\n attachment?: MailAttachment;\n}\n\nexport interface MailAttachment {\n filename: string;\n templatePath?: string; // deprecated\n templateParams?: any; // deprecated\n content?: string | Buffer;\n contentType?: string;\n path?: string; //Filesystem absolute path or URL. \n}\n\nexport enum BrokerType {\n RabbitMQ = 'rabbitmq',\n Database = 'database',\n Redis = 'redis',\n}\n\nexport interface QueuesModuleOptions {\n name: string;\n type: BrokerType;\n queueName: string;\n prefetch?: number;\n persistToDatabase?: boolean;\n}\n\nexport type MediaWithFullUrl = Media & {\n _full_url: string;\n};\n\n\nexport type ErrorCode = string;\n\nexport type ErrorMeta = {\n message: string;\n httpStatus?: number;\n};\n\nexport type ErrorRule = {\n /** Canonical error code. Keep them kebab-case for consistency. */\n code: ErrorCode;\n /** Higher runs earlier. Defaults to 0 if not provided. */\n priority?: number;\n /** Return true if this rule matches the combined error text. */\n match: (combinedErrorText: string) => boolean;\n /** Display + HTTP mapping for this code. */\n meta: ErrorMeta;\n};\n\nexport interface IErrorCodeProvider {\n /** Used for registry identity & logs */\n name(): string;\n\n /**\n * Return all rules this provider contributes.\n * These will be merged with other providers’ rules, then sorted by priority.\n */\n rules(): ReadonlyArray<ErrorRule>;\n\n /**\n * Optional fallback meta for codes this provider owns (when called by getMessage/getHttpStatus).\n * If omitted, the ErrorMapperService will rely on the rule.meta of the first matching rule.\n */\n resolve?(code: ErrorCode): ErrorMeta | undefined;\n}\n\n// MCP Tool Related\n\nexport type PlanStep = CreateNewFileStep | RegisterNestProviderStep | AddMethodToExistingClassStep | RegisterSolidXExtensionComponentStep | AddListViewButtonStep | AddFormViewButtonStep | AddImportStep;\nexport interface AddImportStep {\n type: \"addImport\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n importStatement: string; // e.g. import { Something } from 'somewhere';\n overwrite?: boolean; // default=false\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface CreateNewFileStep {\n type: \"createNewFile\";\n path: string; // repo-relative e.g. solid-api/api/src/computed-providers/foo.provider.ts\n content: string; // full file content\n overwrite?: boolean; // default=false\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterNestProviderStep {\n type: \"registerNestProvider\";\n modulePath: string; // e.g. apps/api/src/address-master/address-master.module.ts\n providerClassName: string; // e.g. StateTotalCitiesComputedFieldProvider\n importFrom: string; // e.g. \"@/computed-providers/state-total-cities.provider\"\n registerIn: Array<\"providers\" | \"exports\">; // which arrays to add to\n uniqueGuard?: boolean; // default=true\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface AddMethodToExistingClassStep {\n type: \"addMethodToExistingClass\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n className: string // e.g. CountryService\n methodName: string // e.g. addCountry\n content: string // Full Method Code\n importStatements?: string[]; // e.g. [ \"import { X } from 'y';\" ]\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterSolidXExtensionComponentStep {\n type: \"registerSolidXExtensionComponent\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n content?: string; // Code\n importExtensionComponent?: string;\n}\n\nexport interface AddListViewButtonStep {\n type: \"addListViewButton\";\n moduleName?: string;\n modelName?: string;\n buttonType?: string;\n content?: string; // Code\n}\n\nexport interface AddFormViewButtonStep {\n type: \"addFormViewButton\";\n moduleName?: string;\n modelName?: string;\n buttonType?: string;\n content?: string; // Code\n}\n\nexport interface McpComputedProviderResponse {\n plan: PlanStep[];\n // provider?: any; // (intentionally ignored per your note)\n}\n\nexport interface ISecurityRuleConfigProvider {\n securityRuleConfig(activeUser: ActiveUserData, securityRule: SecurityRule): Promise<SecurityRuleConfig>;\n}\n\n\nexport interface AwsS3Config {\n S3_AWS_ACCESS_KEY: string;\n S3_AWS_SECRET_KEY: string;\n S3_AWS_REGION_NAME: string;\n}\n\n// Prevents inference so callers must provide explicit type arguments; reusable for other APIs.\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n\nexport type AuditEventType = 'insert' | 'update' | 'delete';\n\nexport interface AuditQueuePayload {\n eventType: AuditEventType;\n modelName: string;\n entityId: string | number | null;\n occurredAt: string;\n after?: any;\n before?: any;\n updatedColumnNames?: string[];\n userId?: number | null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AA4DA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,wCAAwB,CAAA;IACxB,6DAA6C,CAAA;IAC7C,6DAA6C,CAAA;IAC7C,8CAA8B,CAAA;AAChC,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAmKD,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,gDAAmC,CAAA;AACrC,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,MAAa,YAAY;IACvB,YACS,IAAS,EACT,OAAU;QADV,SAAI,GAAJ,IAAI,CAAK;QACT,YAAO,GAAP,OAAO,CAAG;IACf,CAAC;CACN;AALD,oCAKC;AAyED,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB","sourcesContent":["import { Repository } from 'typeorm';\nimport { User } from 'src/entities/user.entity';\nimport { CreateUserDto } from 'src/dtos/create-user.dto';\nimport { CreateEmailTemplateDto } from 'src/dtos/create-email-template.dto';\nimport { CreateSmsTemplateDto } from 'src/dtos/create-sms-template.dto';\nimport { SignUpDto } from 'src/dtos/sign-up.dto';\nimport { Readable } from 'stream';\nimport { CreateMediaStorageProviderMetadataDto } from './dtos/create-media-storage-provider-metadata.dto';\nimport { DatasourceType } from './dtos/create-model-metadata.dto';\nimport { CreateModuleMetadataDto } from './dtos/create-module-metadata.dto';\nimport { CreateRoleMetadataDto } from './dtos/create-role-metadata.dto';\nimport { CreateSecurityRuleDto } from './dtos/create-security-rule.dto';\nimport { FieldMetadata } from './entities/field-metadata.entity';\nimport { Media } from './entities/media.entity';\nimport { ComputedFieldMetadata } from './helpers/solid-registry';\nimport { ActiveUserData } from './interfaces/active-user-data.interface';\nimport { SecurityRuleConfig } from './dtos/security-rule-config.dto';\nimport { SecurityRule } from './entities/security-rule.entity';\n\nexport interface FieldCrudManager {\n // fieldMetadata: FieldMetadata;\n // entityManager?: EntityManager;\n // createDto: any;\n // files : Array<Express.Multer.File>;\n validate(\n dto: any,\n files: Array<Express.Multer.File>,\n ): ValidationError[] | Promise<ValidationError[]>;\n transformForCreate(dto: any, ctxt?: any): any | Promise<any>;\n}\n\nexport interface ValidationError {\n field: string;\n error: string;\n}\n\n// export interface MediaStorage\nexport interface MediaStorageProvider<T> {\n store(files: Express.Multer.File[], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n delete(entity: T, mediaFieldMetadata: FieldMetadata): Promise<void>;\n deleteByMediaRecord(media: Media): Promise<void>;\n retrieve(entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n storeStreams(streamPairs: [Readable, string][], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n // delete(file: string): Promise<void>;\n}\n\nexport interface ModuleMetadataConfiguration {\n moduleMetadata?: CreateModuleMetadataDto,\n roles?: CreateRoleMetadataDto[],\n users?: SignUpDto[],\n actions?: any[],\n menus?: any[],\n views?: any[],\n emailTemplates?: CreateEmailTemplateDto[],\n smsTemplates?: CreateSmsTemplateDto[],\n mediaStorageProviders?: CreateMediaStorageProviderMetadataDto[]\n securityRules?: CreateSecurityRuleDto[],\n dashboards?: any[],\n}\n\nexport enum SettingLevel {\n SystemEnv = 'system-env',\n SystemAdminReadonly = 'system-admin-readonly',\n SystemAdminEditable = 'system-admin-editable',\n InternalUser = \"internal-user\"\n}\n\nexport type SettingControlType =\n | 'shortText'\n | 'longText'\n | 'numeric'\n | 'boolean'\n | 'date'\n | 'datetime'\n | 'mediaSingle'\n | 'selectionStatic'\n | 'custom';\n\nexport interface SettingOption {\n label: string;\n value: string | number | boolean;\n}\n\nexport interface SettingDefinition<T = any> {\n moduleName: string;\n key: string;\n value: T;\n level: SettingLevel;\n encrypted?: boolean;\n label?: string;\n description?: string;\n helpText?: string;\n placeholder?: string;\n group?: string;\n sortOrder?: number;\n controlType?: SettingControlType;\n options?: SettingOption[];\n settingsWidget?: string; // for custom controlType, specify the frontend widget to use\n}\n\nexport interface AdminSettingDefinition<T = any> extends SettingDefinition<T> {\n editable: boolean;\n}\n\nexport interface AdminSettingsResponse<T = any> {\n data: AdminSettingDefinition<T>[];\n}\n\n// solid-core/settings/settings-provider.interface.ts\nexport interface ISettingsProvider {\n getSettings(): SettingDefinition[];\n}\n\nexport interface CodeGenerationOptions {\n moduleId?: number;\n moduleUserKey?: string;\n modelId?: number;\n modelUserKey?: string;\n fieldIdsForRemoval?: number[];\n fieldNamesForRemoval?: string[];\n dryRun?: boolean;\n}\n\n\nexport interface McpResponse {\n success: boolean;\n request: string;\n response: string;\n model?: string;\n tools_invoked?: string[];\n tool_calls?: any[];\n duration_ms?: number;\n errors?: string[];\n error_trace?: string[];\n content_type?: string;\n}\n\nexport interface ISelectionProviderContext {\n limit: number;\n offset: number;\n formValues: Record<string, any>;\n //Attribute to control the validation on creating the record\n validateOnSave?: boolean;\n // query: string;\n}\n\nexport interface ISelectionProviderValues {\n label: string;\n value: string;\n}\n\nexport interface ISelectionProvider<T extends ISelectionProviderContext> {\n help(): string;\n\n name(): string;\n\n value(optionValue: string, ctxt: T): Promise<ISelectionProviderValues | any>;\n\n values(query: any, ctxt: T): Promise<readonly ISelectionProviderValues[]>;\n}\n\nexport interface IDashboardWidgetDataProviderContext<TVariables = Record<string, any>, TProviderContext = Record<string, any>> {\n moduleName: string;\n dashboardName: string;\n widgetName: string;\n variables: TVariables;\n providerContext: TProviderContext;\n activeUser?: ActiveUserData;\n}\n\nexport interface IDashboardWidgetDataResponseEnvelope<TData = any, TUiHints = Record<string, any>> {\n meta: {\n providerName: string;\n generatedAt: string;\n widgetName: string;\n durationMs: number;\n [key: string]: any;\n };\n data: TData;\n uiHints?: TUiHints;\n}\n\nexport interface IDashboardWidgetDataProvider<\n TContext extends IDashboardWidgetDataProviderContext = IDashboardWidgetDataProviderContext,\n TResponse = any,\n> {\n help(): string;\n name(): string;\n getData(\n widgetDefinition: Record<string, any>,\n ctxt: TContext,\n ): Promise<IDashboardWidgetDataResponseEnvelope<TResponse> | any>;\n}\n\n\n/**\n * @deprecated Use `IEntityComputedFieldProvider` instead.\n */\nexport interface IComputedFieldProvider<T> {\n help(): string;\n\n name(): string;\n\n valueType(): string;\n\n computeValue(dto: any, ctxt: T): Promise<string | number>; // FIXME : Improve the types to make it more specific using generics\n}\n\nexport interface IEntityComputedFieldProvider {\n help(): string;\n\n name(): string;\n}\n\nexport interface IEntityPreComputeFieldProvider<TTriggerEntity, TContext, TValue = void> extends IEntityComputedFieldProvider {\n preComputeValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<TValue>;\n}\n\nexport interface IEntityPostComputeFieldProvider<TTriggerEntity, TContext> extends IEntityComputedFieldProvider {\n postComputeAndSaveValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<void>;\n}\n\nexport interface ISolidDatabaseModule {\n name(): string;\n\n type(): DatasourceType;\n}\n\nexport enum EventType {\n USER_REGISTERED = 'user.registered',\n}\n\nexport class EventDetails<T> {\n constructor(\n public type: any,\n public payload: T,\n ) { }\n}\n\nexport interface IExtensionUserCreationProvider<T extends User = User, TDto extends CreateUserDto = CreateUserDto> {\n readonly repo: Repository<T>;\n buildExtensionEntity(dto: TDto): Promise<T>;\n roles(dto: TDto): string[];\n}\n\nexport interface IMail<TResponse = unknown> {\n sendEmail(\n to: string,\n subject: string,\n body: string,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n\n sendEmailUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n}\n\nexport interface ISMS {\n sendSMS(to: string, body: string, shouldQueueSms: boolean): Promise<any>;\n\n sendSMSUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueSms: boolean,\n ): Promise<any>;\n}\n\nexport interface IWhatsAppTransport {\n sendWhatsAppMessage(\n to: string,\n templateId: string,\n parameters: any,\n parentEntity?: any,\n parentEntityId?: any\n ): Promise<any>;\n}\n\nexport interface MailAttachmentWrapper {\n relativePath?: string;\n attachment?: MailAttachment;\n}\n\nexport interface MailAttachment {\n filename: string;\n templatePath?: string; // deprecated\n templateParams?: any; // deprecated\n content?: string | Buffer;\n contentType?: string;\n path?: string; //Filesystem absolute path or URL. \n}\n\nexport enum BrokerType {\n RabbitMQ = 'rabbitmq',\n Database = 'database',\n Redis = 'redis',\n}\n\nexport interface QueuesModuleOptions {\n name: string;\n type: BrokerType;\n queueName: string;\n prefetch?: number;\n persistToDatabase?: boolean;\n}\n\nexport type MediaWithFullUrl = Media & {\n _full_url: string;\n};\n\n\nexport type ErrorCode = string;\n\nexport type ErrorMeta = {\n message: string;\n httpStatus?: number;\n};\n\nexport type ErrorRule = {\n /** Canonical error code. Keep them kebab-case for consistency. */\n code: ErrorCode;\n /** Higher runs earlier. Defaults to 0 if not provided. */\n priority?: number;\n /** Return true if this rule matches the combined error text. */\n match: (combinedErrorText: string) => boolean;\n /** Display + HTTP mapping for this code. */\n meta: ErrorMeta;\n};\n\nexport interface IErrorCodeProvider {\n /** Used for registry identity & logs */\n name(): string;\n\n /**\n * Return all rules this provider contributes.\n * These will be merged with other providers’ rules, then sorted by priority.\n */\n rules(): ReadonlyArray<ErrorRule>;\n\n /**\n * Optional fallback meta for codes this provider owns (when called by getMessage/getHttpStatus).\n * If omitted, the ErrorMapperService will rely on the rule.meta of the first matching rule.\n */\n resolve?(code: ErrorCode): ErrorMeta | undefined;\n}\n\n// MCP Tool Related\n\nexport type PlanStep = CreateNewFileStep | RegisterNestProviderStep | AddMethodToExistingClassStep | RegisterSolidXExtensionComponentStep | AddListViewButtonStep | AddFormViewButtonStep | AddImportStep;\nexport interface AddImportStep {\n type: \"addImport\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n importStatement: string; // e.g. import { Something } from 'somewhere';\n overwrite?: boolean; // default=false\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface CreateNewFileStep {\n type: \"createNewFile\";\n path: string; // repo-relative e.g. solid-api/api/src/computed-providers/foo.provider.ts\n content: string; // full file content\n overwrite?: boolean; // default=false\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterNestProviderStep {\n type: \"registerNestProvider\";\n modulePath: string; // e.g. apps/api/src/address-master/address-master.module.ts\n providerClassName: string; // e.g. StateTotalCitiesComputedFieldProvider\n importFrom: string; // e.g. \"@/computed-providers/state-total-cities.provider\"\n registerIn: Array<\"providers\" | \"exports\">; // which arrays to add to\n uniqueGuard?: boolean; // default=true\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface AddMethodToExistingClassStep {\n type: \"addMethodToExistingClass\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n className: string // e.g. CountryService\n methodName: string // e.g. addCountry\n content: string // Full Method Code\n importStatements?: string[]; // e.g. [ \"import { X } from 'y';\" ]\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterSolidXExtensionComponentStep {\n type: \"registerSolidXExtensionComponent\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n content?: string; // Code\n importExtensionComponent?: string;\n}\n\nexport interface AddListViewButtonStep {\n type: \"addListViewButton\";\n moduleName?: string;\n modelName?: string;\n buttonType?: string;\n content?: string; // Code\n}\n\nexport interface AddFormViewButtonStep {\n type: \"addFormViewButton\";\n moduleName?: string;\n modelName?: string;\n buttonType?: string;\n content?: string; // Code\n}\n\nexport interface McpComputedProviderResponse {\n plan: PlanStep[];\n // provider?: any; // (intentionally ignored per your note)\n}\n\nexport interface ISecurityRuleConfigProvider {\n securityRuleConfig(activeUser: ActiveUserData, securityRule: SecurityRule): Promise<SecurityRuleConfig>;\n}\n\n\nexport interface AwsS3Config {\n S3_AWS_ACCESS_KEY: string;\n S3_AWS_SECRET_KEY: string;\n S3_AWS_REGION_NAME: string;\n}\n\n// Prevents inference so callers must provide explicit type arguments; reusable for other APIs.\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n\nexport type AuditEventType = 'insert' | 'update' | 'delete';\n\nexport interface AuditQueuePayload {\n eventType: AuditEventType;\n modelName: string;\n entityId: string | number | null;\n occurredAt: string;\n after?: any;\n before?: any;\n updatedColumnNames?: string[];\n userId?: number | null;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateScheduledJobDto } from "../dtos/create-scheduled-job.dto";
|
|
2
2
|
import { ScheduledJob } from "../entities/scheduled-job.entity";
|
|
3
3
|
import { RequestContextService } from "../services/request-context.service";
|
|
4
|
-
import { DataSource
|
|
4
|
+
import { DataSource } from "typeorm";
|
|
5
5
|
import { SecurityRuleRepository } from "./security-rule.repository";
|
|
6
6
|
import { SolidBaseRepository } from "./solid-base.repository";
|
|
7
7
|
export declare class ScheduledJobRepository extends SolidBaseRepository<ScheduledJob> {
|
|
@@ -12,7 +12,7 @@ export declare class ScheduledJobRepository extends SolidBaseRepository<Schedule
|
|
|
12
12
|
private normalizeComparableValue;
|
|
13
13
|
private areValuesDifferent;
|
|
14
14
|
private hasChanges;
|
|
15
|
-
toDto(scheduledJob: ScheduledJob
|
|
15
|
+
toDto(scheduledJob: ScheduledJob): Promise<CreateScheduledJobDto>;
|
|
16
16
|
upsertWithDto(dto: CreateScheduledJobDto): Promise<ScheduledJob>;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=scheduled-job.repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-job.repository.d.ts","sourceRoot":"","sources":["../../src/repository/scheduled-job.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"scheduled-job.repository.d.ts","sourceRoot":"","sources":["../../src/repository/scheduled-job.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAmB9D,qBACa,sBAAuB,SAAQ,mBAAmB,CAAC,YAAY,CAAC;IAErE,QAAQ,CAAC,UAAU,EAAE,UAAU;IAC/B,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;IACrD,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB;gBAF9C,UAAU,EAAE,UAAU,EACtB,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,sBAAsB;IAK7D,OAAO,CAAC,wBAAwB;IAoChC,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,UAAU;IAkBZ,KAAK,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAqCjE,aAAa,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC;CAoCvE"}
|
|
@@ -77,20 +77,17 @@ let ScheduledJobRepository = class ScheduledJobRepository extends solid_base_rep
|
|
|
77
77
|
|| this.areValuesDifferent(existing.cronExpression, dto.cronExpression)
|
|
78
78
|
|| existing.module?.id !== moduleEntity.id;
|
|
79
79
|
}
|
|
80
|
-
async toDto(scheduledJob
|
|
80
|
+
async toDto(scheduledJob) {
|
|
81
81
|
let populatedScheduledJob = scheduledJob;
|
|
82
82
|
if (!scheduledJob.module) {
|
|
83
|
-
|
|
84
|
-
? manager.getRepository(scheduled_job_entity_1.ScheduledJob)
|
|
85
|
-
: this;
|
|
86
|
-
populatedScheduledJob = await repo.findOne({
|
|
83
|
+
populatedScheduledJob = await this.findOne({
|
|
87
84
|
where: {
|
|
88
85
|
id: scheduledJob.id,
|
|
89
86
|
},
|
|
90
87
|
relations: {
|
|
91
88
|
module: true,
|
|
92
89
|
},
|
|
93
|
-
})
|
|
90
|
+
});
|
|
94
91
|
}
|
|
95
92
|
if (!populatedScheduledJob.module) {
|
|
96
93
|
throw new Error(`Module not found for scheduled job ID ${populatedScheduledJob.id}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-job.repository.js","sourceRoot":"","sources":["../../src/repository/scheduled-job.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,+EAAqE;AACrE,2EAAiE;AACjE,iFAA6E;AAC7E,qCAAoD;AACpD,yEAAoE;AACpE,mEAA8D;AAoBvD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,2CAAiC;IACzE,YACa,UAAsB,EACtB,qBAA4C,EAC5C,sBAA8C;QAEvD,KAAK,CAAC,mCAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;QAJtE,eAAU,GAAV,UAAU,CAAY;QACtB,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,2BAAsB,GAAtB,sBAAsB,CAAwB;IAG3D,CAAC;IAEK,wBAAwB,CAAC,KAAU;QACzC,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YAClC,IACE,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC5D,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAC5D,CAAC;gBACD,IAAI,CAAC;oBACH,OAAO,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBACjE,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,K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YACN,MAAM,EAAE,YAAY;SACrB,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAClC,KAAK,EAAE,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE;YACzC,SAAS,EAAE;gBACT,MAAM,EAAE,IAAI;aACb;SACF,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,CAAC;gBAClD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,CAAC,YAAY,wBAAwB,CAAC,CAAC;gBACjG,OAAO,QAAQ,CAAC;YAClB,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;YACjE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;YACjE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;CACF,CAAA;AA5JY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAGgB,oBAAU;QACC,+CAAqB;QACpB,iDAAsB;GAJlD,sBAAsB,CA4JlC","sourcesContent":["import { Injectable } from \"@nestjs/common\";\nimport { CreateScheduledJobDto } from \"src/dtos/create-scheduled-job.dto\";\nimport { ModuleMetadata } from \"src/entities/module-metadata.entity\";\nimport { ScheduledJob } from \"src/entities/scheduled-job.entity\";\nimport { RequestContextService } from \"src/services/request-context.service\";\nimport { DataSource, EntityManager } from \"typeorm\";\nimport { SecurityRuleRepository } from \"./security-rule.repository\";\nimport { SolidBaseRepository } from \"./solid-base.repository\";\n\n// This should match whatever DTO structure you’re using in your seeding logic\n// export type CreateScheduledJobDto = {\n// scheduleName: string;\n// isActive?: boolean;\n// frequency: string;\n// startTime?: Date;\n// endTime?: Date;\n// startDate?: Date;\n// endDate?: Date;\n// dayOfMonth?: number;\n// lastRunAt?: Date;\n// nextRunAt?: Date;\n// dayOfWeek?: string;\n// job: string;\n// moduleUserKey: string;\n// };\n\n@Injectable()\nexport class ScheduledJobRepository extends SolidBaseRepository<ScheduledJob> {\n constructor(\n readonly dataSource: DataSource,\n readonly requestContextService: RequestContextService,\n readonly securityRuleRepository: SecurityRuleRepository,\n ) {\n super(ScheduledJob, dataSource, requestContextService, securityRuleRepository);\n }\n\n private normalizeComparableValue(value: any): any {\n if (value instanceof Date) {\n return value.toISOString();\n }\n\n if (typeof value === \"string\") {\n const trimmedValue = value.trim();\n if (\n (trimmedValue.startsWith(\"{\") && trimmedValue.endsWith(\"}\")) ||\n (trimmedValue.startsWith(\"[\") && trimmedValue.endsWith(\"]\"))\n ) {\n try {\n return this.normalizeComparableValue(JSON.parse(trimmedValue));\n } catch {\n return value;\n }\n }\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => this.normalizeComparableValue(item));\n }\n\n if (value && typeof value === \"object\") {\n return Object.keys(value)\n .sort()\n .reduce((result, key) => {\n result[key] = this.normalizeComparableValue(value[key]);\n return result;\n }, {} as Record<string, any>);\n }\n\n return value;\n }\n\n private areValuesDifferent(currentValue: any, nextValue: any): boolean {\n const normalizedCurrentValue = this.normalizeComparableValue(currentValue);\n const normalizedNextValue = this.normalizeComparableValue(nextValue);\n\n if (\n (normalizedCurrentValue && typeof normalizedCurrentValue === \"object\") ||\n (normalizedNextValue && typeof normalizedNextValue === \"object\")\n ) {\n return JSON.stringify(normalizedCurrentValue ?? null) !== JSON.stringify(normalizedNextValue ?? null);\n }\n\n return normalizedCurrentValue !== normalizedNextValue;\n }\n\n private hasChanges(existing: ScheduledJob, dto: CreateScheduledJobDto, moduleEntity: ModuleMetadata): boolean {\n return existing.scheduleName !== dto.scheduleName\n || existing.isActive !== dto.isActive\n || this.areValuesDifferent(existing.frequency, dto.frequency)\n || this.areValuesDifferent(existing.startTime, dto.startTime)\n || this.areValuesDifferent(existing.endTime, dto.endTime)\n || this.areValuesDifferent(existing.startDate, dto.startDate)\n || this.areValuesDifferent(existing.endDate, dto.endDate)\n || this.areValuesDifferent(existing.dayOfMonth, dto.dayOfMonth)\n || this.areValuesDifferent(existing.dayOfWeek, dto.dayOfWeek)\n || this.areValuesDifferent(existing.job, dto.job)\n || this.areValuesDifferent(existing.cronExpression, dto.cronExpression)\n || existing.module?.id !== moduleEntity.id;\n }\n\n /**\n * Converts an entity to a plain DTO object.\n * When manager is provided (e.g. from a TypeORM subscriber event), the\n * fallback relation load uses it so the query runs on the active\n * transaction's connection instead of the default DataSource pool.\n */\n async toDto(scheduledJob: ScheduledJob, manager?: EntityManager): Promise<CreateScheduledJobDto> {\n let populatedScheduledJob: ScheduledJob = scheduledJob;\n // If the scheduled job does not have the module relation loaded, load it\n if (!scheduledJob.module) {\n const repo = manager\n ? manager.getRepository(ScheduledJob)\n : this;\n populatedScheduledJob = await repo.findOne({\n where: {\n id: scheduledJob.id,\n },\n relations: {\n module: true,\n },\n }) ?? scheduledJob;\n }\n\n if (!populatedScheduledJob.module) {\n throw new Error(`Module not found for scheduled job ID ${populatedScheduledJob.id}`);\n }\n\n return {\n scheduleName: populatedScheduledJob.scheduleName,\n isActive: populatedScheduledJob.isActive,\n frequency: populatedScheduledJob.frequency,\n startTime: populatedScheduledJob.startTime,\n endTime: populatedScheduledJob.endTime,\n startDate: populatedScheduledJob.startDate,\n endDate: populatedScheduledJob.endDate,\n dayOfMonth: populatedScheduledJob.dayOfMonth,\n lastRunAt: populatedScheduledJob.lastRunAt,\n nextRunAt: populatedScheduledJob.nextRunAt,\n dayOfWeek: populatedScheduledJob.dayOfWeek,\n job: populatedScheduledJob.job,\n moduleUserKey: populatedScheduledJob.module.name,\n moduleId: populatedScheduledJob.module.id,\n cronExpression: populatedScheduledJob.cronExpression,\n };\n }\n\n async upsertWithDto(dto: CreateScheduledJobDto): Promise<ScheduledJob> {\n const moduleRepo = this.dataSource.getRepository(ModuleMetadata);\n\n const moduleEntity = await moduleRepo.findOne({\n where: { name: dto.moduleUserKey },\n });\n\n if (!moduleEntity) {\n throw new Error(`Module with userKey ${dto.moduleUserKey} not found`);\n }\n\n const jobData = {\n ...dto,\n module: moduleEntity,\n };\n const existing = await this.findOne({\n where: { scheduleName: dto.scheduleName },\n relations: {\n module: true,\n },\n });\n\n if (existing) {\n if (!this.hasChanges(existing, dto, moduleEntity)) {\n this.logger.debug(`Skipping scheduled job upsert for ${dto.scheduleName}; no changes detected.`);\n return existing;\n }\n\n const merged = this.merge(existing, jobData);\n this.logger.debug(`Updating scheduled job: ${dto.scheduleName}`);\n return this.save(merged);\n } else {\n this.logger.debug(`Creating scheduled job: ${dto.scheduleName}`);\n return this.save(this.create(jobData));\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scheduled-job.repository.js","sourceRoot":"","sources":["../../src/repository/scheduled-job.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,+EAAqE;AACrE,2EAAiE;AACjE,iFAA6E;AAC7E,qCAAqC;AACrC,yEAAoE;AACpE,mEAA8D;AAoBvD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,2CAAiC;IACzE,YACa,UAAsB,EACtB,qBAA4C,EAC5C,sBAA8C;QAEvD,KAAK,CAAC,mCAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;QAJtE,eAAU,GAAV,UAAU,CAAY;QACtB,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,2BAAsB,GAAtB,sBAAsB,CAAwB;IAG3D,CAAC;IAEK,wBA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B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;YACjE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;CACF,CAAA;AAtJY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAGgB,oBAAU;QACC,+CAAqB;QACpB,iDAAsB;GAJlD,sBAAsB,CAsJlC","sourcesContent":["import { Injectable } from \"@nestjs/common\";\nimport { CreateScheduledJobDto } from \"src/dtos/create-scheduled-job.dto\";\nimport { ModuleMetadata } from \"src/entities/module-metadata.entity\";\nimport { ScheduledJob } from \"src/entities/scheduled-job.entity\";\nimport { RequestContextService } from \"src/services/request-context.service\";\nimport { DataSource } from \"typeorm\";\nimport { SecurityRuleRepository } from \"./security-rule.repository\";\nimport { SolidBaseRepository } from \"./solid-base.repository\";\n\n// This should match whatever DTO structure you’re using in your seeding logic\n// export type CreateScheduledJobDto = {\n// scheduleName: string;\n// isActive?: boolean;\n// frequency: string;\n// startTime?: Date;\n// endTime?: Date;\n// startDate?: Date;\n// endDate?: Date;\n// dayOfMonth?: number;\n// lastRunAt?: Date;\n// nextRunAt?: Date;\n// dayOfWeek?: string;\n// job: string;\n// moduleUserKey: string;\n// };\n\n@Injectable()\nexport class ScheduledJobRepository extends SolidBaseRepository<ScheduledJob> {\n constructor(\n readonly dataSource: DataSource,\n readonly requestContextService: RequestContextService,\n readonly securityRuleRepository: SecurityRuleRepository,\n ) {\n super(ScheduledJob, dataSource, requestContextService, securityRuleRepository);\n }\n\n private normalizeComparableValue(value: any): any {\n if (value instanceof Date) {\n return value.toISOString();\n }\n\n if (typeof value === \"string\") {\n const trimmedValue = value.trim();\n if (\n (trimmedValue.startsWith(\"{\") && trimmedValue.endsWith(\"}\")) ||\n (trimmedValue.startsWith(\"[\") && trimmedValue.endsWith(\"]\"))\n ) {\n try {\n return this.normalizeComparableValue(JSON.parse(trimmedValue));\n } catch {\n return value;\n }\n }\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => this.normalizeComparableValue(item));\n }\n\n if (value && typeof value === \"object\") {\n return Object.keys(value)\n .sort()\n .reduce((result, key) => {\n result[key] = this.normalizeComparableValue(value[key]);\n return result;\n }, {} as Record<string, any>);\n }\n\n return value;\n }\n\n private areValuesDifferent(currentValue: any, nextValue: any): boolean {\n const normalizedCurrentValue = this.normalizeComparableValue(currentValue);\n const normalizedNextValue = this.normalizeComparableValue(nextValue);\n\n if (\n (normalizedCurrentValue && typeof normalizedCurrentValue === \"object\") ||\n (normalizedNextValue && typeof normalizedNextValue === \"object\")\n ) {\n return JSON.stringify(normalizedCurrentValue ?? null) !== JSON.stringify(normalizedNextValue ?? null);\n }\n\n return normalizedCurrentValue !== normalizedNextValue;\n }\n\n private hasChanges(existing: ScheduledJob, dto: CreateScheduledJobDto, moduleEntity: ModuleMetadata): boolean {\n return existing.scheduleName !== dto.scheduleName\n || existing.isActive !== dto.isActive\n || this.areValuesDifferent(existing.frequency, dto.frequency)\n || this.areValuesDifferent(existing.startTime, dto.startTime)\n || this.areValuesDifferent(existing.endTime, dto.endTime)\n || this.areValuesDifferent(existing.startDate, dto.startDate)\n || this.areValuesDifferent(existing.endDate, dto.endDate)\n || this.areValuesDifferent(existing.dayOfMonth, dto.dayOfMonth)\n || this.areValuesDifferent(existing.dayOfWeek, dto.dayOfWeek)\n || this.areValuesDifferent(existing.job, dto.job)\n || this.areValuesDifferent(existing.cronExpression, dto.cronExpression)\n || existing.module?.id !== moduleEntity.id;\n }\n\n /**\n * Converts an entity to a plain DTO object.\n */\n async toDto(scheduledJob: ScheduledJob): Promise<CreateScheduledJobDto> {\n let populatedScheduledJob: ScheduledJob = scheduledJob;\n // If the scheduled job does not have the module relation loaded, load it\n if (!scheduledJob.module) {\n populatedScheduledJob = await this.findOne({\n where: {\n id: scheduledJob.id,\n },\n relations: {\n module: true,\n },\n });\n }\n\n if (!populatedScheduledJob.module) {\n throw new Error(`Module not found for scheduled job ID ${populatedScheduledJob.id}`);\n }\n\n return {\n scheduleName: populatedScheduledJob.scheduleName,\n isActive: populatedScheduledJob.isActive,\n frequency: populatedScheduledJob.frequency,\n startTime: populatedScheduledJob.startTime,\n endTime: populatedScheduledJob.endTime,\n startDate: populatedScheduledJob.startDate,\n endDate: populatedScheduledJob.endDate,\n dayOfMonth: populatedScheduledJob.dayOfMonth,\n lastRunAt: populatedScheduledJob.lastRunAt,\n nextRunAt: populatedScheduledJob.nextRunAt,\n dayOfWeek: populatedScheduledJob.dayOfWeek,\n job: populatedScheduledJob.job,\n moduleUserKey: populatedScheduledJob.module.name,\n moduleId: populatedScheduledJob.module.id,\n cronExpression: populatedScheduledJob.cronExpression,\n };\n }\n\n async upsertWithDto(dto: CreateScheduledJobDto): Promise<ScheduledJob> {\n const moduleRepo = this.dataSource.getRepository(ModuleMetadata);\n\n const moduleEntity = await moduleRepo.findOne({\n where: { name: dto.moduleUserKey },\n });\n\n if (!moduleEntity) {\n throw new Error(`Module with userKey ${dto.moduleUserKey} not found`);\n }\n\n const jobData = {\n ...dto,\n module: moduleEntity,\n };\n const existing = await this.findOne({\n where: { scheduleName: dto.scheduleName },\n relations: {\n module: true,\n },\n });\n\n if (existing) {\n if (!this.hasChanges(existing, dto, moduleEntity)) {\n this.logger.debug(`Skipping scheduled job upsert for ${dto.scheduleName}; no changes detected.`);\n return existing;\n }\n\n const merged = this.merge(existing, jobData);\n this.logger.debug(`Updating scheduled job: ${dto.scheduleName}`);\n return this.save(merged);\n } else {\n this.logger.debug(`Creating scheduled job: ${dto.scheduleName}`);\n return this.save(this.create(jobData));\n }\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { SecurityRule } from '../entities/security-rule.entity';
|
|
|
5
5
|
import { SolidRegistry } from '../helpers/solid-registry';
|
|
6
6
|
import { ActiveUserData } from '../interfaces/active-user-data.interface';
|
|
7
7
|
import { CrudHelperService } from '../services/crud-helper.service';
|
|
8
|
-
import { DataSource,
|
|
8
|
+
import { DataSource, SelectQueryBuilder } from 'typeorm';
|
|
9
9
|
import { SolidBaseRepository } from './solid-base.repository';
|
|
10
10
|
export declare class SecurityRuleRepository extends SolidBaseRepository<SecurityRule> {
|
|
11
11
|
readonly dataSource: DataSource;
|
|
@@ -14,7 +14,7 @@ export declare class SecurityRuleRepository extends SolidBaseRepository<Security
|
|
|
14
14
|
constructor(dataSource: DataSource, solidRegistry: SolidRegistry, crudHelperService: CrudHelperService);
|
|
15
15
|
applySecurityRules<T extends CommonEntity>(qb: SelectQueryBuilder<T>, modelSingularName: string, activeUser: ActiveUserData, securityRuleAlias?: string): Promise<SelectQueryBuilder<T>>;
|
|
16
16
|
private resolveSecurityRuleConfig;
|
|
17
|
-
toDto(securityRule: SecurityRule
|
|
17
|
+
toDto(securityRule: SecurityRule): Promise<UpdateSecurityRuleDto>;
|
|
18
18
|
upsertWithDto(createDto: CreateSecurityRuleDto): Promise<SecurityRule>;
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=security-rule.repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-rule.repository.d.ts","sourceRoot":"","sources":["../../src/repository/security-rule.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAY,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"security-rule.repository.d.ts","sourceRoot":"","sources":["../../src/repository/security-rule.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAY,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,qBACa,sBAAuB,SAAQ,mBAAmB,CAAC,YAAY,CAAC;IAErE,QAAQ,CAAC,UAAU,EAAE,UAAU;IAE/B,QAAQ,CAAC,aAAa,EAAE,aAAa;IACrC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB;gBAHpC,UAAU,EAAE,UAAU,EAEtB,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB;IAK3C,kBAAkB,CAAC,CAAC,SAAS,YAAY,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,GAAE,MAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAyDxM,OAAO,CAAC,yBAAyB;IAI3B,KAAK,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA6BjE,aAAa,CAAC,SAAS,EAAE,qBAAqB;CAyDvD"}
|
|
@@ -66,13 +66,10 @@ let SecurityRuleRepository = class SecurityRuleRepository extends solid_base_rep
|
|
|
66
66
|
resolveSecurityRuleConfig(configString, activeUser) {
|
|
67
67
|
return configString.replace('$activeUserId', activeUser.sub.toString());
|
|
68
68
|
}
|
|
69
|
-
async toDto(securityRule
|
|
69
|
+
async toDto(securityRule) {
|
|
70
70
|
let populatedSecurityRule = securityRule;
|
|
71
71
|
if (!securityRule.role || !securityRule.modelMetadata) {
|
|
72
|
-
|
|
73
|
-
? manager.getRepository(security_rule_entity_1.SecurityRule)
|
|
74
|
-
: this;
|
|
75
|
-
populatedSecurityRule = await repo.findOne({
|
|
72
|
+
populatedSecurityRule = await this.findOne({
|
|
76
73
|
where: {
|
|
77
74
|
id: securityRule.id,
|
|
78
75
|
},
|
|
@@ -80,7 +77,7 @@ let SecurityRuleRepository = class SecurityRuleRepository extends solid_base_rep
|
|
|
80
77
|
role: true,
|
|
81
78
|
modelMetadata: true,
|
|
82
79
|
},
|
|
83
|
-
})
|
|
80
|
+
});
|
|
84
81
|
}
|
|
85
82
|
return {
|
|
86
83
|
id: populatedSecurityRule.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-rule.repository.js","sourceRoot":"","sources":["../../src/repository/security-rule.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAK5C,6EAAmE;AACnE,2EAAiE;AACjE,2EAAiE;AACjE,8DAA2D;AAE3D,yEAAqE;AACrE,qCAAkF;AAClF,mEAA8D;AAGvD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,2CAAiC;IACzE,YACa,UAAsB,EAEtB,aAA4B,EAC5B,iBAAoC;QAE7C,KAAK,CAAC,mCAAY,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QALnC,eAAU,GAAV,UAAU,CAAY;QAEtB,kBAAa,GAAb,aAAa,CAAe;QAC5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IAGjD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAyB,EAAyB,EAAE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C,eAAe,CAAC,GAAG,aAAa,CAAC;QAC/C,CAAC;QACD,IAAI,SAAS,CAAC,oBAAoB,EAAE,CAAC;YACjC,MAAM,aAAa,GAAG,MAAM,uBAAuB,CAAC,OAAO,CAAC;gBACxD,KAAK,EAAE;oBACH,YAAY,EAAE,SAAS,CAAC,oBAAoB;iBAC/C;aACJ,CAAC,CAAC;YACH,SAAS,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC;QAC/C,CAAC;QAGD,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE;gBACH,IAAI,EAAE,SAAS,CAAC,IAAI;aACvB;SACJ,CAAC,CAAC;QAEH,IAAI,oBAAoB,EAAE,CAAC;YACvB,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC1C,CAAC;aACI,CAAC;YACF,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnC,CAAC;IACL,CAAC;CAEJ,CAAA;AAnKY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAGgB,oBAAU;QAEP,8BAAa;QACT,uCAAiB;GALxC,sBAAsB,CAmKlC","sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { CreateSecurityRuleDto } from 'src/dtos/create-security-rule.dto';\nimport { SecurityRuleConfig } from 'src/dtos/security-rule-config.dto';\nimport { UpdateSecurityRuleDto } from 'src/dtos/update-security-rule.dto';\nimport { CommonEntity } from 'src/entities/common.entity';\nimport { ModelMetadata } from 'src/entities/model-metadata.entity';\nimport { RoleMetadata } from 'src/entities/role-metadata.entity';\nimport { SecurityRule } from 'src/entities/security-rule.entity';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { ActiveUserData } from 'src/interfaces/active-user-data.interface';\nimport { CrudHelperService } from 'src/services/crud-helper.service';\nimport { Brackets, DataSource, EntityManager, SelectQueryBuilder } from 'typeorm';\nimport { SolidBaseRepository } from './solid-base.repository';\n\n@Injectable()\nexport class SecurityRuleRepository extends SolidBaseRepository<SecurityRule> {\n constructor(\n readonly dataSource: DataSource,\n // readonly requestContextService: RequestContextService,\n readonly solidRegistry: SolidRegistry,\n readonly crudHelperService: CrudHelperService,\n ) {\n super(SecurityRule, dataSource, null, null);\n }\n\n async applySecurityRules<T extends CommonEntity>(qb: SelectQueryBuilder<T>, modelSingularName: string, activeUser: ActiveUserData, securityRuleAlias: string = qb.alias): Promise<SelectQueryBuilder<T>> {\n // Fetch the security rules for the model and roles\n const securityRules = this.solidRegistry.getSecurityRules(modelSingularName, activeUser.roles);\n\n // If no security rules, return the original query builder\n if (!securityRules.length) {\n return qb;\n }\n\n const evaluatedRules = [];\n\n for (const rule of securityRules) {\n\n let evaluatedRule = null;\n\n try {\n // First check if the rule has a \"dynamic\" security rule config provider. \n if (rule.securityRuleConfigProvider) {\n // TODO: Evaluation of the securityRuleConfig Provider should happen outside first...\n const securityRuleConfigProviderInstance = this.solidRegistry.getSecurityRuleConfigProviderInstance(rule.securityRuleConfigProvider);\n if (!securityRuleConfigProviderInstance) {\n throw new Error(`Unable to resolve instance for security rule config provider: ${rule.securityRuleConfigProvider}`);\n }\n evaluatedRule = await securityRuleConfigProviderInstance.securityRuleConfig(activeUser, rule);\n }\n else {\n evaluatedRule = JSON.parse(\n this.resolveSecurityRuleConfig(rule.securityRuleConfig, activeUser)\n ) as SecurityRuleConfig;\n }\n\n evaluatedRules.push(evaluatedRule);\n\n } catch (error: any) {\n this.logger.error(`Error parsing security rule: ${rule.securityRuleConfig}`, error);\n this.logger.error(error.stack);\n throw error;\n }\n }\n\n\n // Apply each security rule to the query builder. The rules are combined with OR logic at the top level.\n qb.andWhere(new Brackets(async (outerQb) => {\n for (const evaluatedRule of evaluatedRules) {\n if (evaluatedRule && evaluatedRule.filters) {\n outerQb.orWhere( // combine each rule-group with OR at the outer level\n new Brackets((innerQb) => {\n this.crudHelperService.applyFilters(innerQb, evaluatedRule.filters, securityRuleAlias, qb); // AND within a rule\n })\n );\n }\n }\n }));\n\n return qb;\n }\n\n private resolveSecurityRuleConfig(configString: string, activeUser: ActiveUserData) {\n return configString.replace('$activeUserId', activeUser.sub.toString());\n }\n\n async toDto(securityRule: SecurityRule, manager?: EntityManager): Promise<UpdateSecurityRuleDto> {\n // load the role and model relations for the security rule\n let populatedSecurityRule: SecurityRule = securityRule;\n // If the security rule does not have the role and model relations loaded, load them\n if (!securityRule.role || !securityRule.modelMetadata) {\n // When a manager is provided (e.g. from a TypeORM subscriber event),\n // use it so the query runs on the active transaction's connection\n // instead of trying to acquire a second connection from the pool.\n const repo = manager\n ? manager.getRepository(SecurityRule)\n : this;\n populatedSecurityRule = await repo.findOne({\n where: {\n id: securityRule.id,\n },\n relations: {\n role: true,\n modelMetadata: true,\n },\n }) ?? securityRule;\n }\n\n return {\n id: populatedSecurityRule.id,\n name: populatedSecurityRule.name,\n description: populatedSecurityRule.description,\n roleId: populatedSecurityRule.role.id,\n roleUserKey: populatedSecurityRule.role.name,\n modelMetadataId: populatedSecurityRule.modelMetadata.id,\n modelMetadataUserKey: populatedSecurityRule.modelMetadata.singularName,\n securityRuleConfig: populatedSecurityRule.securityRuleConfig,\n securityRuleConfigProvider: populatedSecurityRule.securityRuleConfigProvider,\n };\n }\n\n async upsertWithDto(createDto: CreateSecurityRuleDto) {\n // Populate the role from roleId or roleUserKey\n const roleRepository = this.dataSource.getRepository(RoleMetadata);\n if (createDto.roleId) {\n const role = await roleRepository.findOne({\n where: {\n id: createDto.roleId,\n },\n });\n createDto['role'] = role;\n }\n\n if (createDto.roleUserKey) {\n const role = await roleRepository.findOne({\n where: {\n name: createDto.roleUserKey,\n },\n });\n createDto['role'] = role;\n }\n\n // Populate the model from modelMetadataId or modelMetadataUserKey\n const modelMetadataRepository = this.dataSource.getRepository(ModelMetadata);\n if (createDto.modelMetadataId) {\n const modelMetadata = await modelMetadataRepository.findOne({\n where: {\n id: createDto.modelMetadataId,\n },\n });\n createDto['modelMetadata'] = modelMetadata;\n }\n if (createDto.modelMetadataUserKey) {\n const modelMetadata = await modelMetadataRepository.findOne({\n where: {\n singularName: createDto.modelMetadataUserKey,\n },\n });\n createDto['modelMetadata'] = modelMetadata;\n }\n\n // First check if module already exists using name\n const existingSecurityRule = await this.findOne({\n where: {\n name: createDto.name,\n },\n });\n\n if (existingSecurityRule) {\n const updatedSecurityRule = this.merge(existingSecurityRule, createDto);\n return this.save(updatedSecurityRule);\n }\n else {\n const securityRule = this.create(createDto);\n return this.save(securityRule);\n }\n }\n\n}"]}
|
|
1
|
+
{"version":3,"file":"security-rule.repository.js","sourceRoot":"","sources":["../../src/repository/security-rule.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAK5C,6EAAmE;AACnE,2EAAiE;AACjE,2EAAiE;AACjE,8DAA2D;AAE3D,yEAAqE;AACrE,qCAAmE;AACnE,mEAA8D;AAGvD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,2CAAiC;IACzE,YACa,UAAsB,EAEtB,aAA4B,EAC5B,iBAAoC;QAE7C,KAAK,CAAC,mCAAY,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QALnC,eAAU,GAAV,UAAU,CAAY;QAEtB,kBAAa,GAAb,aAAa,CAAe;QAC5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IAGjD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAyB,EAAyB,EAAE,iBAAyB,EAAE,UAA0B,EAAE,oBAA4B,EAAE,CAAC,KAAK;QAEnK,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAG/F,IAAI,CAAC,aAAa,CAA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O,CAAC;YAC5C,KAAK,EAAE;gBACH,IAAI,EAAE,SAAS,CAAC,IAAI;aACvB;SACJ,CAAC,CAAC;QAEH,IAAI,oBAAoB,EAAE,CAAC;YACvB,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC1C,CAAC;aACI,CAAC;YACF,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnC,CAAC;IACL,CAAC;CAEJ,CAAA;AA7JY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAGgB,oBAAU;QAEP,8BAAa;QACT,uCAAiB;GALxC,sBAAsB,CA6JlC","sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { CreateSecurityRuleDto } from 'src/dtos/create-security-rule.dto';\nimport { SecurityRuleConfig } from 'src/dtos/security-rule-config.dto';\nimport { UpdateSecurityRuleDto } from 'src/dtos/update-security-rule.dto';\nimport { CommonEntity } from 'src/entities/common.entity';\nimport { ModelMetadata } from 'src/entities/model-metadata.entity';\nimport { RoleMetadata } from 'src/entities/role-metadata.entity';\nimport { SecurityRule } from 'src/entities/security-rule.entity';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { ActiveUserData } from 'src/interfaces/active-user-data.interface';\nimport { CrudHelperService } from 'src/services/crud-helper.service';\nimport { Brackets, DataSource, SelectQueryBuilder } from 'typeorm';\nimport { SolidBaseRepository } from './solid-base.repository';\n\n@Injectable()\nexport class SecurityRuleRepository extends SolidBaseRepository<SecurityRule> {\n constructor(\n readonly dataSource: DataSource,\n // readonly requestContextService: RequestContextService,\n readonly solidRegistry: SolidRegistry,\n readonly crudHelperService: CrudHelperService,\n ) {\n super(SecurityRule, dataSource, null, null);\n }\n\n async applySecurityRules<T extends CommonEntity>(qb: SelectQueryBuilder<T>, modelSingularName: string, activeUser: ActiveUserData, securityRuleAlias: string = qb.alias): Promise<SelectQueryBuilder<T>> {\n // Fetch the security rules for the model and roles\n const securityRules = this.solidRegistry.getSecurityRules(modelSingularName, activeUser.roles);\n\n // If no security rules, return the original query builder\n if (!securityRules.length) {\n return qb;\n }\n\n const evaluatedRules = [];\n\n for (const rule of securityRules) {\n\n let evaluatedRule = null;\n\n try {\n // First check if the rule has a \"dynamic\" security rule config provider. \n if (rule.securityRuleConfigProvider) {\n // TODO: Evaluation of the securityRuleConfig Provider should happen outside first...\n const securityRuleConfigProviderInstance = this.solidRegistry.getSecurityRuleConfigProviderInstance(rule.securityRuleConfigProvider);\n if (!securityRuleConfigProviderInstance) {\n throw new Error(`Unable to resolve instance for security rule config provider: ${rule.securityRuleConfigProvider}`);\n }\n evaluatedRule = await securityRuleConfigProviderInstance.securityRuleConfig(activeUser, rule);\n }\n else {\n evaluatedRule = JSON.parse(\n this.resolveSecurityRuleConfig(rule.securityRuleConfig, activeUser)\n ) as SecurityRuleConfig;\n }\n\n evaluatedRules.push(evaluatedRule);\n\n } catch (error: any) {\n this.logger.error(`Error parsing security rule: ${rule.securityRuleConfig}`, error);\n this.logger.error(error.stack);\n throw error;\n }\n }\n\n\n // Apply each security rule to the query builder. The rules are combined with OR logic at the top level.\n qb.andWhere(new Brackets(async (outerQb) => {\n for (const evaluatedRule of evaluatedRules) {\n if (evaluatedRule && evaluatedRule.filters) {\n outerQb.orWhere( // combine each rule-group with OR at the outer level\n new Brackets((innerQb) => {\n this.crudHelperService.applyFilters(innerQb, evaluatedRule.filters, securityRuleAlias, qb); // AND within a rule\n })\n );\n }\n }\n }));\n\n return qb;\n }\n\n private resolveSecurityRuleConfig(configString: string, activeUser: ActiveUserData) {\n return configString.replace('$activeUserId', activeUser.sub.toString());\n }\n\n async toDto(securityRule: SecurityRule): Promise<UpdateSecurityRuleDto> {\n // load the role and model relations for the security rule\n let populatedSecurityRule: SecurityRule = securityRule;\n // If the security rule does not have the role and model relations loaded, load them\n if (!securityRule.role || !securityRule.modelMetadata) {\n populatedSecurityRule = await this.findOne({\n where: {\n id: securityRule.id,\n },\n relations: {\n role: true,\n modelMetadata: true,\n },\n });\n }\n\n return {\n id: populatedSecurityRule.id,\n name: populatedSecurityRule.name,\n description: populatedSecurityRule.description,\n roleId: populatedSecurityRule.role.id,\n roleUserKey: populatedSecurityRule.role.name,\n modelMetadataId: populatedSecurityRule.modelMetadata.id,\n modelMetadataUserKey: populatedSecurityRule.modelMetadata.singularName,\n securityRuleConfig: populatedSecurityRule.securityRuleConfig,\n securityRuleConfigProvider: populatedSecurityRule.securityRuleConfigProvider,\n };\n }\n\n async upsertWithDto(createDto: CreateSecurityRuleDto) {\n // Populate the role from roleId or roleUserKey\n const roleRepository = this.dataSource.getRepository(RoleMetadata);\n if (createDto.roleId) {\n const role = await roleRepository.findOne({\n where: {\n id: createDto.roleId,\n },\n });\n createDto['role'] = role;\n }\n\n if (createDto.roleUserKey) {\n const role = await roleRepository.findOne({\n where: {\n name: createDto.roleUserKey,\n },\n });\n createDto['role'] = role;\n }\n\n // Populate the model from modelMetadataId or modelMetadataUserKey\n const modelMetadataRepository = this.dataSource.getRepository(ModelMetadata);\n if (createDto.modelMetadataId) {\n const modelMetadata = await modelMetadataRepository.findOne({\n where: {\n id: createDto.modelMetadataId,\n },\n });\n createDto['modelMetadata'] = modelMetadata;\n }\n if (createDto.modelMetadataUserKey) {\n const modelMetadata = await modelMetadataRepository.findOne({\n where: {\n singularName: createDto.modelMetadataUserKey,\n },\n });\n createDto['modelMetadata'] = modelMetadata;\n }\n\n // First check if module already exists using name\n const existingSecurityRule = await this.findOne({\n where: {\n name: createDto.name,\n },\n });\n\n if (existingSecurityRule) {\n const updatedSecurityRule = this.merge(existingSecurityRule, createDto);\n return this.save(updatedSecurityRule);\n }\n else {\n const securityRule = this.create(createDto);\n return this.save(securityRule);\n }\n }\n\n}"]}
|
|
@@ -6116,7 +6116,8 @@
|
|
|
6116
6116
|
"sequenceNumber": 1,
|
|
6117
6117
|
"actionUserKey": "moduleMetadata-list-action",
|
|
6118
6118
|
"moduleUserKey": "solid-core",
|
|
6119
|
-
"parentMenuItemUserKey": "appBuilder-menu-item"
|
|
6119
|
+
"parentMenuItemUserKey": "appBuilder-menu-item",
|
|
6120
|
+
"iconName": "view_module"
|
|
6120
6121
|
},
|
|
6121
6122
|
{
|
|
6122
6123
|
"displayName": "Model",
|
|
@@ -6124,7 +6125,8 @@
|
|
|
6124
6125
|
"sequenceNumber": 2,
|
|
6125
6126
|
"actionUserKey": "modelMetadata-list-action",
|
|
6126
6127
|
"moduleUserKey": "solid-core",
|
|
6127
|
-
"parentMenuItemUserKey": "appBuilder-menu-item"
|
|
6128
|
+
"parentMenuItemUserKey": "appBuilder-menu-item",
|
|
6129
|
+
"iconName": "table_rows"
|
|
6128
6130
|
},
|
|
6129
6131
|
{
|
|
6130
6132
|
"displayName": "Field",
|
|
@@ -6132,7 +6134,8 @@
|
|
|
6132
6134
|
"sequenceNumber": 3,
|
|
6133
6135
|
"actionUserKey": "fieldMetadata-list-action",
|
|
6134
6136
|
"moduleUserKey": "solid-core",
|
|
6135
|
-
"parentMenuItemUserKey": "appBuilder-menu-item"
|
|
6137
|
+
"parentMenuItemUserKey": "appBuilder-menu-item",
|
|
6138
|
+
"iconName": "label"
|
|
6136
6139
|
},
|
|
6137
6140
|
{
|
|
6138
6141
|
"displayName": "Datasources",
|
|
@@ -6140,7 +6143,8 @@
|
|
|
6140
6143
|
"sequenceNumber": 4,
|
|
6141
6144
|
"actionUserKey": "datasource-management-action",
|
|
6142
6145
|
"moduleUserKey": "solid-core",
|
|
6143
|
-
"parentMenuItemUserKey": "appBuilder-menu-item"
|
|
6146
|
+
"parentMenuItemUserKey": "appBuilder-menu-item",
|
|
6147
|
+
"iconName": "storage"
|
|
6144
6148
|
},
|
|
6145
6149
|
{
|
|
6146
6150
|
"displayName": "Menu Item",
|
|
@@ -6148,7 +6152,8 @@
|
|
|
6148
6152
|
"sequenceNumber": 1,
|
|
6149
6153
|
"actionUserKey": "menuItemMetadata-list-action",
|
|
6150
6154
|
"moduleUserKey": "solid-core",
|
|
6151
|
-
"parentMenuItemUserKey": "layoutBuilder-menu-item"
|
|
6155
|
+
"parentMenuItemUserKey": "layoutBuilder-menu-item",
|
|
6156
|
+
"iconName": "menu"
|
|
6152
6157
|
},
|
|
6153
6158
|
{
|
|
6154
6159
|
"displayName": "View",
|
|
@@ -6156,7 +6161,8 @@
|
|
|
6156
6161
|
"sequenceNumber": 2,
|
|
6157
6162
|
"actionUserKey": "viewMetadata-list-action",
|
|
6158
6163
|
"moduleUserKey": "solid-core",
|
|
6159
|
-
"parentMenuItemUserKey": "layoutBuilder-menu-item"
|
|
6164
|
+
"parentMenuItemUserKey": "layoutBuilder-menu-item",
|
|
6165
|
+
"iconName": "pageview"
|
|
6160
6166
|
},
|
|
6161
6167
|
{
|
|
6162
6168
|
"displayName": "Action",
|
|
@@ -6164,7 +6170,8 @@
|
|
|
6164
6170
|
"sequenceNumber": 3,
|
|
6165
6171
|
"actionUserKey": "actionMetadata-list-action",
|
|
6166
6172
|
"moduleUserKey": "solid-core",
|
|
6167
|
-
"parentMenuItemUserKey": "layoutBuilder-menu-item"
|
|
6173
|
+
"parentMenuItemUserKey": "layoutBuilder-menu-item",
|
|
6174
|
+
"iconName": "bolt"
|
|
6168
6175
|
},
|
|
6169
6176
|
{
|
|
6170
6177
|
"displayName": "User View",
|
|
@@ -6172,7 +6179,8 @@
|
|
|
6172
6179
|
"sequenceNumber": 5,
|
|
6173
6180
|
"actionUserKey": "userViewMetadata-list-action",
|
|
6174
6181
|
"moduleUserKey": "solid-core",
|
|
6175
|
-
"parentMenuItemUserKey": "layoutBuilder-menu-item"
|
|
6182
|
+
"parentMenuItemUserKey": "layoutBuilder-menu-item",
|
|
6183
|
+
"iconName": "person"
|
|
6176
6184
|
},
|
|
6177
6185
|
{
|
|
6178
6186
|
"displayName": "Media Management",
|
|
@@ -6189,7 +6197,8 @@
|
|
|
6189
6197
|
"sequenceNumber": 1,
|
|
6190
6198
|
"actionUserKey": "media-list-action",
|
|
6191
6199
|
"moduleUserKey": "solid-core",
|
|
6192
|
-
"parentMenuItemUserKey": "mediaManagement-menu-item"
|
|
6200
|
+
"parentMenuItemUserKey": "mediaManagement-menu-item",
|
|
6201
|
+
"iconName": "perm_media"
|
|
6193
6202
|
},
|
|
6194
6203
|
{
|
|
6195
6204
|
"displayName": "Media Storage Provider",
|
|
@@ -6197,7 +6206,8 @@
|
|
|
6197
6206
|
"sequenceNumber": 2,
|
|
6198
6207
|
"actionUserKey": "mediaStorageProviderMetadata-list-action",
|
|
6199
6208
|
"moduleUserKey": "solid-core",
|
|
6200
|
-
"parentMenuItemUserKey": "mediaManagement-menu-item"
|
|
6209
|
+
"parentMenuItemUserKey": "mediaManagement-menu-item",
|
|
6210
|
+
"iconName": "cloud"
|
|
6201
6211
|
},
|
|
6202
6212
|
{
|
|
6203
6213
|
"displayName": "IAM",
|
|
@@ -6206,7 +6216,7 @@
|
|
|
6206
6216
|
"actionUserKey": "",
|
|
6207
6217
|
"moduleUserKey": "solid-core",
|
|
6208
6218
|
"parentMenuItemUserKey": "",
|
|
6209
|
-
"iconName": "
|
|
6219
|
+
"iconName": "manage_accounts"
|
|
6210
6220
|
},
|
|
6211
6221
|
{
|
|
6212
6222
|
"displayName": "User",
|
|
@@ -6214,7 +6224,8 @@
|
|
|
6214
6224
|
"sequenceNumber": 1,
|
|
6215
6225
|
"actionUserKey": "user-list-action",
|
|
6216
6226
|
"moduleUserKey": "solid-core",
|
|
6217
|
-
"parentMenuItemUserKey": "iam-menu-item"
|
|
6227
|
+
"parentMenuItemUserKey": "iam-menu-item",
|
|
6228
|
+
"iconName": "person"
|
|
6218
6229
|
},
|
|
6219
6230
|
{
|
|
6220
6231
|
"displayName": "Role",
|
|
@@ -6222,7 +6233,8 @@
|
|
|
6222
6233
|
"sequenceNumber": 2,
|
|
6223
6234
|
"actionUserKey": "roleMetadata-list-action",
|
|
6224
6235
|
"moduleUserKey": "solid-core",
|
|
6225
|
-
"parentMenuItemUserKey": "iam-menu-item"
|
|
6236
|
+
"parentMenuItemUserKey": "iam-menu-item",
|
|
6237
|
+
"iconName": "admin_panel_settings"
|
|
6226
6238
|
},
|
|
6227
6239
|
{
|
|
6228
6240
|
"displayName": "Permission",
|
|
@@ -6230,7 +6242,8 @@
|
|
|
6230
6242
|
"sequenceNumber": 3,
|
|
6231
6243
|
"actionUserKey": "permissionMetadata-list-action",
|
|
6232
6244
|
"moduleUserKey": "solid-core",
|
|
6233
|
-
"parentMenuItemUserKey": "iam-menu-item"
|
|
6245
|
+
"parentMenuItemUserKey": "iam-menu-item",
|
|
6246
|
+
"iconName": "key"
|
|
6234
6247
|
},
|
|
6235
6248
|
{
|
|
6236
6249
|
"displayName": "Security rules",
|
|
@@ -6238,7 +6251,8 @@
|
|
|
6238
6251
|
"sequenceNumber": 4,
|
|
6239
6252
|
"actionUserKey": "securityRule-list-action",
|
|
6240
6253
|
"moduleUserKey": "solid-core",
|
|
6241
|
-
"parentMenuItemUserKey": "iam-menu-item"
|
|
6254
|
+
"parentMenuItemUserKey": "iam-menu-item",
|
|
6255
|
+
"iconName": "gavel"
|
|
6242
6256
|
},
|
|
6243
6257
|
{
|
|
6244
6258
|
"displayName": "User Activity History",
|
|
@@ -6246,7 +6260,8 @@
|
|
|
6246
6260
|
"sequenceNumber": 5,
|
|
6247
6261
|
"actionUserKey": "userActivityHistory-list-action",
|
|
6248
6262
|
"moduleUserKey": "solid-core",
|
|
6249
|
-
"parentMenuItemUserKey": "iam-menu-item"
|
|
6263
|
+
"parentMenuItemUserKey": "iam-menu-item",
|
|
6264
|
+
"iconName": "history"
|
|
6250
6265
|
},
|
|
6251
6266
|
{
|
|
6252
6267
|
"displayName": "Queues",
|
|
@@ -6263,7 +6278,8 @@
|
|
|
6263
6278
|
"sequenceNumber": 1,
|
|
6264
6279
|
"actionUserKey": "solid-core-queue-health-dashboard-action",
|
|
6265
6280
|
"moduleUserKey": "solid-core",
|
|
6266
|
-
"parentMenuItemUserKey": "queues-menu-item"
|
|
6281
|
+
"parentMenuItemUserKey": "queues-menu-item",
|
|
6282
|
+
"iconName": "analytics"
|
|
6267
6283
|
},
|
|
6268
6284
|
{
|
|
6269
6285
|
"displayName": "Queues",
|
|
@@ -6271,7 +6287,8 @@
|
|
|
6271
6287
|
"sequenceNumber": 2,
|
|
6272
6288
|
"actionUserKey": "mqMessageQueue-list-action",
|
|
6273
6289
|
"moduleUserKey": "solid-core",
|
|
6274
|
-
"parentMenuItemUserKey": "queues-menu-item"
|
|
6290
|
+
"parentMenuItemUserKey": "queues-menu-item",
|
|
6291
|
+
"iconName": "dns"
|
|
6275
6292
|
},
|
|
6276
6293
|
{
|
|
6277
6294
|
"displayName": "Messages",
|
|
@@ -6279,7 +6296,8 @@
|
|
|
6279
6296
|
"sequenceNumber": 3,
|
|
6280
6297
|
"actionUserKey": "mqMessage-list-action",
|
|
6281
6298
|
"moduleUserKey": "solid-core",
|
|
6282
|
-
"parentMenuItemUserKey": "queues-menu-item"
|
|
6299
|
+
"parentMenuItemUserKey": "queues-menu-item",
|
|
6300
|
+
"iconName": "message"
|
|
6283
6301
|
},
|
|
6284
6302
|
{
|
|
6285
6303
|
"displayName": "Notification",
|
|
@@ -6288,7 +6306,7 @@
|
|
|
6288
6306
|
"actionUserKey": "",
|
|
6289
6307
|
"moduleUserKey": "solid-core",
|
|
6290
6308
|
"parentMenuItemUserKey": "",
|
|
6291
|
-
"iconName": "
|
|
6309
|
+
"iconName": "notification_add"
|
|
6292
6310
|
},
|
|
6293
6311
|
{
|
|
6294
6312
|
"displayName": "Email",
|
|
@@ -6296,7 +6314,8 @@
|
|
|
6296
6314
|
"sequenceNumber": 1,
|
|
6297
6315
|
"actionUserKey": "emailTemplate-list-action",
|
|
6298
6316
|
"moduleUserKey": "solid-core",
|
|
6299
|
-
"parentMenuItemUserKey": "notification-menu-item"
|
|
6317
|
+
"parentMenuItemUserKey": "notification-menu-item",
|
|
6318
|
+
"iconName": "email"
|
|
6300
6319
|
},
|
|
6301
6320
|
{
|
|
6302
6321
|
"displayName": "SMS",
|
|
@@ -6304,7 +6323,8 @@
|
|
|
6304
6323
|
"sequenceNumber": 2,
|
|
6305
6324
|
"actionUserKey": "smsTemplate-list-action",
|
|
6306
6325
|
"moduleUserKey": "solid-core",
|
|
6307
|
-
"parentMenuItemUserKey": "notification-menu-item"
|
|
6326
|
+
"parentMenuItemUserKey": "notification-menu-item",
|
|
6327
|
+
"iconName": "sms"
|
|
6308
6328
|
},
|
|
6309
6329
|
{
|
|
6310
6330
|
"displayName": "Other",
|
|
@@ -6313,7 +6333,7 @@
|
|
|
6313
6333
|
"actionUserKey": "",
|
|
6314
6334
|
"moduleUserKey": "solid-core",
|
|
6315
6335
|
"parentMenuItemUserKey": "",
|
|
6316
|
-
"iconName": "
|
|
6336
|
+
"iconName": "more_horiz"
|
|
6317
6337
|
},
|
|
6318
6338
|
{
|
|
6319
6339
|
"displayName": "List of Values",
|
|
@@ -6321,7 +6341,8 @@
|
|
|
6321
6341
|
"sequenceNumber": 1,
|
|
6322
6342
|
"actionUserKey": "listOfValues-list-action",
|
|
6323
6343
|
"moduleUserKey": "solid-core",
|
|
6324
|
-
"parentMenuItemUserKey": "other-menu-item"
|
|
6344
|
+
"parentMenuItemUserKey": "other-menu-item",
|
|
6345
|
+
"iconName": "list"
|
|
6325
6346
|
},
|
|
6326
6347
|
{
|
|
6327
6348
|
"displayName": "Scheduled Jobs",
|
|
@@ -6329,7 +6350,8 @@
|
|
|
6329
6350
|
"sequenceNumber": 2,
|
|
6330
6351
|
"actionUserKey": "scheduledJob-list-action",
|
|
6331
6352
|
"moduleUserKey": "solid-core",
|
|
6332
|
-
"parentMenuItemUserKey": "other-menu-item"
|
|
6353
|
+
"parentMenuItemUserKey": "other-menu-item",
|
|
6354
|
+
"iconName": "event_repeat"
|
|
6333
6355
|
},
|
|
6334
6356
|
{
|
|
6335
6357
|
"displayName": "Saved Filters",
|
|
@@ -6337,7 +6359,8 @@
|
|
|
6337
6359
|
"sequenceNumber": 4,
|
|
6338
6360
|
"actionUserKey": "savedFilters-list-action",
|
|
6339
6361
|
"moduleUserKey": "solid-core",
|
|
6340
|
-
"parentMenuItemUserKey": "other-menu-item"
|
|
6362
|
+
"parentMenuItemUserKey": "other-menu-item",
|
|
6363
|
+
"iconName": "filter_list_alt"
|
|
6341
6364
|
},
|
|
6342
6365
|
{
|
|
6343
6366
|
"displayName": "Chatter Message",
|
|
@@ -6345,7 +6368,8 @@
|
|
|
6345
6368
|
"sequenceNumber": 5,
|
|
6346
6369
|
"actionUserKey": "chatterMessage-list-action",
|
|
6347
6370
|
"moduleUserKey": "solid-core",
|
|
6348
|
-
"parentMenuItemUserKey": "other-menu-item"
|
|
6371
|
+
"parentMenuItemUserKey": "other-menu-item",
|
|
6372
|
+
"iconName": "forum"
|
|
6349
6373
|
},
|
|
6350
6374
|
{
|
|
6351
6375
|
"displayName": "Locale",
|
|
@@ -6353,7 +6377,8 @@
|
|
|
6353
6377
|
"sequenceNumber": 7,
|
|
6354
6378
|
"actionUserKey": "locale-list-action",
|
|
6355
6379
|
"moduleUserKey": "solid-core",
|
|
6356
|
-
"parentMenuItemUserKey": "other-menu-item"
|
|
6380
|
+
"parentMenuItemUserKey": "other-menu-item",
|
|
6381
|
+
"iconName": "language"
|
|
6357
6382
|
},
|
|
6358
6383
|
{
|
|
6359
6384
|
"displayName": "Import Transactions",
|
|
@@ -6361,7 +6386,8 @@
|
|
|
6361
6386
|
"sequenceNumber": 8,
|
|
6362
6387
|
"actionUserKey": "importTransaction-list-action",
|
|
6363
6388
|
"moduleUserKey": "solid-core",
|
|
6364
|
-
"parentMenuItemUserKey": "other-menu-item"
|
|
6389
|
+
"parentMenuItemUserKey": "other-menu-item",
|
|
6390
|
+
"iconName": "upload_file"
|
|
6365
6391
|
},
|
|
6366
6392
|
{
|
|
6367
6393
|
"displayName": "Settings",
|
|
@@ -6378,7 +6404,8 @@
|
|
|
6378
6404
|
"sequenceNumber": 1,
|
|
6379
6405
|
"actionUserKey": "modelSequence-list-action",
|
|
6380
6406
|
"moduleUserKey": "solid-core",
|
|
6381
|
-
"parentMenuItemUserKey": "other-menu-item"
|
|
6407
|
+
"parentMenuItemUserKey": "other-menu-item",
|
|
6408
|
+
"iconName": "format_list_numbered"
|
|
6382
6409
|
},
|
|
6383
6410
|
{
|
|
6384
6411
|
"displayName": "Dashboard User Layout",
|
|
@@ -6387,7 +6414,7 @@
|
|
|
6387
6414
|
"actionUserKey": "dashboardUserLayout-list-action",
|
|
6388
6415
|
"moduleUserKey": "solid-core",
|
|
6389
6416
|
"parentMenuItemUserKey": "",
|
|
6390
|
-
"iconName": ""
|
|
6417
|
+
"iconName": "dashboard_customize"
|
|
6391
6418
|
},
|
|
6392
6419
|
{
|
|
6393
6420
|
"displayName": "Agent",
|
|
@@ -6404,7 +6431,8 @@
|
|
|
6404
6431
|
"sequenceNumber": 1,
|
|
6405
6432
|
"actionUserKey": "agentSession-list-action",
|
|
6406
6433
|
"moduleUserKey": "solid-core",
|
|
6407
|
-
"parentMenuItemUserKey": "agent-menu-item"
|
|
6434
|
+
"parentMenuItemUserKey": "agent-menu-item",
|
|
6435
|
+
"iconName": "chat"
|
|
6408
6436
|
},
|
|
6409
6437
|
{
|
|
6410
6438
|
"displayName": "MCP Audit Log",
|
|
@@ -6412,7 +6440,8 @@
|
|
|
6412
6440
|
"sequenceNumber": 3,
|
|
6413
6441
|
"actionUserKey": "mcpAuditLog-list-action",
|
|
6414
6442
|
"moduleUserKey": "solid-core",
|
|
6415
|
-
"parentMenuItemUserKey": "agent-menu-item"
|
|
6443
|
+
"parentMenuItemUserKey": "agent-menu-item",
|
|
6444
|
+
"iconName": "fact_check"
|
|
6416
6445
|
}
|
|
6417
6446
|
],
|
|
6418
6447
|
"views": [
|
|
@@ -112,8 +112,10 @@ export declare class AuthenticationService {
|
|
|
112
112
|
}>;
|
|
113
113
|
private resolveLoginType;
|
|
114
114
|
private findUserForLogin;
|
|
115
|
+
private findUserForLoginOrNull;
|
|
115
116
|
private assignLoginOtp;
|
|
116
117
|
private buildLoginOtpResponse;
|
|
118
|
+
private buildMaskedLoginIdentifier;
|
|
117
119
|
private notifyUserOnOtpInititateLogin;
|
|
118
120
|
otpConfirmLogin(confirmSignInDto: OTPConfirmOTPDto): Promise<{
|
|
119
121
|
accessToken: string;
|