@adaas/a-utils 0.2.5 → 0.2.6
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/index.cjs +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +74 -22
- package/dist/index.d.ts +74 -22
- package/dist/index.mjs +28 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/A-Signal/A-Signal.types.ts +21 -4
- package/src/lib/A-Signal/context/A-SignalState.context.ts +1 -4
- package/src/lib/A-Signal/entities/A-Signal.entity.ts +108 -4
- package/src/lib/A-Signal/entities/A-SignalVector.entity.ts +89 -21
- package/tests/A-Signal.test.ts +52 -14
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/A-Channel/A-Channel.component.ts","../src/lib/A-Execution/A-Execution.context.ts","../src/lib/A-Operation/A-Operation.context.ts","../src/lib/A-Channel/A-Channel.error.ts","../src/lib/A-Channel/A-Channel.constants.ts","../src/lib/A-Channel/A-ChannelRequest.context.ts","../src/lib/A-Command/A-Command.constants.ts","../src/lib/A-Command/A-Command.error.ts","../src/lib/A-StateMachine/A-StateMachine.error.ts","../src/lib/A-StateMachine/A-StateMachine.constants.ts","../src/lib/A-StateMachine/A-StateMachineTransition.context.ts","../src/lib/A-StateMachine/A-StateMachine.component.ts","../src/lib/A-Config/A-Config.constants.ts","../src/lib/A-Config/A-Config.error.ts","../src/lib/A-Config/A-Config.context.ts","../src/lib/A-Logger/A-Logger.constants.ts","../src/lib/A-Logger/A-Logger.component.ts","../src/lib/A-Command/A-Command.entity.ts","../src/lib/A-Polyfill/classes/A-FS-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Crypto-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Http-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Https-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Path-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Url-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Buffer-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Process-Polyfill.class.ts","../src/lib/A-Polyfill/A-Polyfill.component.ts","../src/lib/A-Config/components/ConfigReader.component.ts","../src/lib/A-Config/components/FileConfigReader.component.ts","../src/lib/A-Config/components/ENVConfigReader.component.ts","../src/lib/A-Config/A-Config.container.ts","../src/lib/A-Config/A-Config.types.ts","../src/lib/A-Logger/A-Logger.env.ts","../src/lib/A-Manifest/A-Manifest.error.ts","../src/lib/A-Manifest/classes/A-ManifestChecker.class.ts","../src/lib/A-Manifest/A-Manifest.context.ts","../src/lib/A-Memory/A-Memory.constants.ts","../src/lib/A-Memory/A-Memory.context.ts","../src/lib/A-Memory/A-Memory.error.ts","../src/lib/A-Memory/A-Memory.component.ts","../src/lib/A-Service/A-Service.constants.ts","../src/lib/A-Service/A-Service.error.ts","../src/lib/A-Service/A-Service.container.ts","../src/lib/A-Route/A-Route.entity.ts","../src/lib/A-Signal/entities/A-Signal.entity.ts","../src/lib/A-Signal/entities/A-SignalVector.entity.ts","../src/lib/A-Signal/context/A-SignalState.context.ts","../src/lib/A-Signal/context/A-SignalConfig.context.ts","../src/lib/A-Signal/components/A-SignalBus.constants.ts","../src/lib/A-Signal/components/A-SignalBus.error.ts","../src/lib/A-Signal/components/A-SignalBus.component.ts","../src/lib/A-Schedule/A-Deferred.class.ts","../src/lib/A-Schedule/A-ScheduleObject.class.ts","../src/lib/A-Schedule/A-Schedule.component.ts"],"names":["A_ExecutionContext","A_Fragment","name","defaults","A_Meta","key","value","__name","__decorateClass","A_Frame","A_OperationContext","operation","params","error","result","_A_ChannelError","A_Error","originalError","context","A_TypeGuards","A_ChannelError","A_ChannelFeatures","A_ChannelRequestStatuses","A_ChannelRequest","existed","A_Channel","A_Component","args","requestScope","A_Scope","A_IdentityHelper","A_Context","channelError","message","A_Feature","A_Command_Status","A_CommandTransitions","A_CommandFeatures","A_CommandEvent","_A_CommandError","A_CommandError","_A_StateMachineError","A_StateMachineError","A_StateMachineFeatures","A_StateMachineTransition","_a","_b","_c","_d","A_StateMachine","from","to","props","transitionName","A_FormatterHelper","transition","scope","wrappedError","A_CONSTANTS__CONFIG_ENV_VARIABLES","A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY","_A_ConfigError","A_ConfigError","A_Config","config","A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY","property","array","A_LOGGER_DEFAULT_SCOPE_LENGTH","A_LOGGER_DEFAULT_LEVEL","A_LOGGER_COLORS","A_LOGGER_SAFE_RANDOM_COLORS","A_LOGGER_ANSI","A_LOGGER_TIME_FORMAT","A_LOGGER_FORMAT","A_LOGGER_TERMINAL","A_LOGGER_ENV_KEYS","A_Logger","configScopeColor","configLogColor","complementaryColors","str","hash","i","char","scopeName","safeColors","colorIndex","colorPairs","pairIndex","cols","text","scopePadding","isFirstLine","scopeHeaderLength","continuationIndent","firstLineMaxWidth","continuationMaxWidth","lines","words","currentLine","currentMaxWidth","word","spaceNeeded","chunks","maxLength","totalLength","totalPadding","leftPadding","rightPadding","messageColor","timeString","isMultiArg","arg","shouldAddNewline","obj","jsonString","seen","maxJsonLineWidth","formatted","line","stringValueMatch","prefix","suffix","wrappedValue","maxWidth","wrappedLines","formattedLines","index","logMethod","param1","time","separator","errorMessage","errorDescription","originalMessage","stackLines","linkText","stack","baseIndent","stackIndent","wrappedLine","now","minutes","seconds","milliseconds","__decorateParam","A_Inject","_e","_f","_g","_h","_i","_j","_k","A_Command","A_Entity","logger","stateMachine","resolve","reject","onBeforeExecuteFeature","onExecuteFeature","onAfterExecuteFeature","targetError","event","listener","newEntity","serialized","attachedScope","A_Dependency","_A_FSPolyfillClass","path","encoding","A_FSPolyfillClass","_A_CryptoPolyfillClass","fsPolyfill","crypto","algorithm","filePath","fileStream","data","err","hashBuffer","hashArray","hashBase64","A_CryptoPolyfillClass","_A_HttpPolyfillClass","httpModule","options","callback","url","isHttps","mockResponse","handler","dest","A_HttpPolyfillClass","_A_HttpsPolyfillClass","httpsModule","A_HttpsPolyfillClass","_A_PathPolyfillClass","paths","resolvedPath","ext","base","parts","pathObject","A_PathPolyfillClass","_A_UrlPolyfillClass","urlModule","urlString","urlObject","A_UrlPolyfillClass","_A_BufferPolyfillClass","bufferModule","size","fill","buffer","list","length","sum","buf","offset","A_BufferPolyfillClass","_A_ProcessPolyfillClass","code","A_ProcessPolyfillClass","A_Polyfill","A_Concept","ConfigReader","polyfill","container","rootDir","variables","startPath","A_Container","FileConfigReader","fs","ENVConfigReader","feature","allVariables","variable","A_ConfigLoader","newConfig","A_ScopeError","A_TYPES__ConfigFeature","A_LoggerEnvVariables","A_LoggerEnvVariablesArray","_A_ManifestError","A_ManifestError","_A_ManifestChecker","manifest","component","method","checkExclusion","target","A_ManifestChecker","A_Manifest","item","componentRegex","methodRegex","methodConfig","ctor","components","patterns","componentCtor","query","componentName","methodName","targetName","matchingRules","rule","a","b","aIsGeneral","bIsGeneral","A_MemoryFeatures","A_MemoryContext","param","_A_MemoryError","A_MemoryError","A_Memory","initError","destroyError","getError","setError","dropError","clearError","serializeError","A_ServiceFeatures","_A_Service_Error","A_Service_Error","A_Service","A_Route","p","pathStartIndex","urlSegments","maskSegments","maskSegment","urlSegment","paramName","queryString","cleanQuery","pair","extensionScope","A_Signal","serializedEntity","A_SignalVector","s","pointer","signals","signalConstructor","signalIndex","structure","usedStructure","results","signalName","signal","A_SignalState","param2","vector","A_SignalConfig","e","A_CommonHelper","stringStructure","A_SignalBusFeatures","_A_SignalBusError","A_SignalBusError","A_SignalBus","globalConfig","state","componentContext","_A_Deferred","reason","A_Deferred","_A_ScheduleObject","ms","action","A_ScheduleObject","A_Schedule","date","timestamp"],"mappings":"gTAAA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,wBAAA,CAAA,IAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,GAAA,E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CAAA,EAE/D,CACJ,CAAA,CAjEmDT,CAAAA,CAAAuU,EAAAA,CAAA,kBAAA,CAAA,CAA5C,IAAMG,EAAAA,CAANH,GCSA,IAAMI,EAAAA,CAAN,cAAyBxT,WAAY,CAqCxC,MAAM,QAAA,CACFyT,CAAAA,CACAtJ,CAAAA,CACA9H,CAAAA,CAC4B,CAE5B,IAAMqR,CAAAA,CAAYjU,YAAAA,CAAa,SAASgU,CAAI,CAAA,CACrC,IAAI,IAAA,CAAKA,CAAI,CAAA,CAAG,OAAA,EAAQ,CACzBA,CAAAA,CAEN,OAAO,IAAIF,EAAAA,CACPG,CAAAA,CAAY,IAAA,CAAK,GAAA,EAAI,CACrBvJ,EACA9H,CACJ,CACJ,CAUA,MAAM,KAAA,CAIFgR,CAAAA,CAIAlJ,CAAAA,CAIA9H,CAAAA,CAC4B,CAC5B,OAAO,IAAIkR,EAAAA,CACPF,CAAAA,CACAlJ,CAAAA,CACA9H,CACJ,CACJ,CACJ,EAlF4CxD,CAAAA,CAAA2U,EAAAA,CAAA,YAAA,CAAA,CAA/BA,EAAAA,CAAN1U,CAAAA,CAAA,CALNC,OAAAA,CAAQ,SAAA,CAAU,CACf,SAAA,CAAW,SAAA,CACX,IAAA,CAAM,YAAA,CACN,WAAA,CAAa,4WACjB,CAAC,CAAA,CAAA,CACYyU,EAAAA,CAAAA","file":"index.mjs","sourcesContent":["import { A_Component, A_Context, A_Feature, A_IdentityHelper, A_Scope } from \"@adaas/a-concept\";\nimport { A_ChannelError } from \"./A-Channel.error\";\nimport { A_ChannelFeatures } from \"./A-Channel.constants\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_ChannelRequest } from \"./A-ChannelRequest.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A-Channel - A powerful, extensible communication channel component\n * \n * A-Channel provides a structured approach to implementing various communication patterns\n * such as HTTP clients, WebSocket connections, message queues, and other messaging systems.\n * It offers a complete lifecycle management system with extensible hooks for custom behavior.\n * \n * ## Key Features:\n * - 🔄 **Lifecycle Management** - Complete connection and processing lifecycle with hooks\n * - 📡 **Multiple Communication Patterns** - Request/Response and Fire-and-Forget messaging \n * - 🛡️ **Error Handling** - Comprehensive error capture and management\n * - 🎯 **Type Safety** - Full TypeScript support with generic types\n * - 🔧 **Extensible** - Component-based architecture for custom behavior\n * - ⚡ **Concurrent Processing** - Handle multiple requests simultaneously\n * \n * ## Basic Usage:\n * ```typescript\n * const channel = new A_Channel();\n * A_Context.root.register(channel);\n * \n * // Request/Response pattern\n * const response = await channel.request({ action: 'getData', id: 123 });\n * \n * // Fire-and-forget pattern \n * await channel.send({ type: 'notification', message: 'Hello World' });\n * ```\n * \n * ## Custom Implementation:\n * ```typescript\n * class HttpChannel extends A_Channel {}\n * \n * class HttpProcessor extends A_Component {\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * const response = await fetch(context.params.url);\n * (context as any)._result = await response.json();\n * }\n * }\n * ```\n * \n * @see {@link ./README.md} For complete documentation and examples\n */\n@A_Frame.Namespace('A-Utils')\n@A_Frame.Component({\n name: 'A-Channel',\n description: 'Component uses as abstract channel for communication patterns. Can be inherited and extended to implement custom channels.'\n})\nexport class A_Channel extends A_Component {\n\n /**\n * Indicates whether the channel is currently processing requests.\n * This flag is managed automatically during request/send operations.\n * \n * @readonly\n */\n protected _processing: boolean = false;\n\n /**\n * Promise that resolves when the channel initialization is complete.\n * Ensures that onConnect lifecycle hook has been executed before\n * any communication operations.\n * \n * @private\n */\n protected _initialized?: Promise<void>;\n\n /**\n * Internal cache storage for channel-specific data.\n * Can be used by custom implementations for caching responses,\n * connection pools, or other channel-specific state.\n * \n * @protected\n */\n protected _cache: Map<string, any> = new Map();\n\n /**\n * Creates a new A_Channel instance.\n * \n * The channel must be registered with A_Context before use:\n * ```typescript\n * const channel = new A_Channel();\n * A_Context.root.register(channel);\n * ```\n */\n constructor() {\n super();\n }\n\n /**\n * Indicates whether the channel is currently processing requests.\n * \n * @returns {boolean} True if channel is processing, false otherwise\n */\n get processing(): boolean {\n return this._processing;\n }\n\n /**\n * Promise that resolves when the channel is fully initialized.\n * \n * Automatically calls the onConnect lifecycle hook if not already called.\n * This ensures the channel is ready for communication operations.\n * \n * @returns {Promise<void>} Promise that resolves when initialization is complete\n */\n get initialize(): Promise<void> {\n if (!this._initialized) {\n this._initialized = this.connect();\n }\n return this._initialized;\n }\n\n // ==========================================================\n // ================ Lifecycle Extension Points =============\n // ==========================================================\n\n /**\n * Connection lifecycle hook - called during channel initialization.\n * \n * Override this method in custom components to implement connection logic:\n * - Initialize network connections\n * - Load configuration\n * - Validate environment\n * - Set up connection pools\n * \n * @example\n * ```typescript\n * class DatabaseChannel extends A_Channel {}\n * \n * class DatabaseConnector extends A_Component {\n * @A_Feature.Extend({ scope: [DatabaseChannel] })\n * async [A_ChannelFeatures.onConnect]() {\n * await this.initializeDatabase();\n * console.log('Database channel connected');\n * }\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onConnect\n })\n async onConnect(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Disconnection lifecycle hook - called during channel cleanup.\n * \n * Override this method in custom components to implement cleanup logic:\n * - Close network connections\n * - Save state\n * - Release resources\n * - Clear caches\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [DatabaseChannel] })\n * async [A_ChannelFeatures.onDisconnect]() {\n * await this.closeConnections();\n * console.log('Database channel disconnected');\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onDisconnect\n })\n async onDisconnect(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Pre-request processing hook - called before main request processing.\n * \n * Use this hook for:\n * - Request validation\n * - Authentication\n * - Rate limiting\n * - Logging\n * - Request transformation\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onBeforeRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * // Validate required parameters\n * if (!context.params.url) {\n * throw new Error('URL is required');\n * }\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onBeforeRequest\n })\n async onBeforeRequest(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Main request processing hook - core business logic goes here.\n * \n * This is where the main communication logic should be implemented:\n * - Make HTTP requests\n * - Send messages to queues\n * - Execute database queries\n * - Process business logic\n * \n * Set the result in the context: `(context as any)._result = yourResult;`\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * const response = await fetch(context.params.url);\n * (context as any)._result = await response.json();\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onRequest\n })\n async onRequest(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Post-request processing hook - called after successful request processing.\n * \n * Use this hook for:\n * - Response transformation\n * - Logging\n * - Analytics\n * - Caching results\n * - Cleanup\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onAfterRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * console.log(`Request completed in ${Date.now() - context.startTime}ms`);\n * await this.cacheResponse(context.params, context.data);\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onAfterRequest\n })\n async onAfterRequest(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Error handling hook - called when any operation fails.\n * \n * Use this hook for:\n * - Error logging\n * - Error transformation\n * - Alerting\n * - Retry logic\n * - Fallback mechanisms\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onError](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * console.error('Request failed:', context.params, context.failed);\n * await this.logError(context);\n * await this.sendAlert(context);\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onError\n })\n async onError(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Send operation hook - called for fire-and-forget messaging.\n * \n * Use this hook for:\n * - Message broadcasting\n * - Event publishing\n * - Notification sending\n * - Queue operations\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [EventChannel] })\n * async [A_ChannelFeatures.onSend](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * const { eventType, payload } = context.params;\n * await this.publishEvent(eventType, payload);\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onSend\n })\n async onSend(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n // ==========================================================\n // ================= Public API Methods ===================\n // ==========================================================\n\n /**\n * Initializes the channel by calling the onConnect lifecycle hook.\n * \n * This method is called automatically when accessing the `initialize` property.\n * You can also call it manually if needed.\n * \n * @returns {Promise<void>} Promise that resolves when connection is established\n */\n async connect() {\n await this.call(A_ChannelFeatures.onConnect);\n }\n\n /**\n * Disconnects the channel by calling the onDisconnect lifecycle hook.\n * \n * Use this method to properly cleanup resources when the channel is no longer needed.\n * \n * @returns {Promise<void>} Promise that resolves when cleanup is complete\n */\n async disconnect() {\n await this.call(A_ChannelFeatures.onDisconnect);\n }\n\n /**\n * Sends a request and waits for a response (Request/Response pattern).\n * \n * This method follows the complete request lifecycle:\n * 1. Ensures channel is initialized\n * 2. Creates request scope and context\n * 3. Calls onBeforeRequest hook\n * 4. Calls onRequest hook (main processing)\n * 5. Calls onAfterRequest hook\n * 6. Returns the response context\n * \n * If any step fails, the onError hook is called and the error is captured\n * in the returned context.\n * \n * @template _ParamsType The type of request parameters\n * @template _ResultType The type of response data\n * @param params The request parameters\n * @returns {Promise<A_ChannelRequest<_ParamsType, _ResultType>>} Request context with response\n * \n * @example\n * ```typescript\n * // Basic usage\n * const response = await channel.request({ action: 'getData', id: 123 });\n * \n * // Typed usage\n * interface UserRequest { userId: string; }\n * interface UserResponse { name: string; email: string; }\n * \n * const userResponse = await channel.request<UserRequest, UserResponse>({\n * userId: 'user-123'\n * });\n * \n * if (!userResponse.failed) {\n * console.log('User:', userResponse.data.name);\n * }\n * ```\n */\n async request<\n _ParamsType extends Record<string, any> = Record<string, any>,\n _ResultType extends Record<string, any> = Record<string, any>,\n >(params: _ParamsType): Promise<A_ChannelRequest<_ParamsType, _ResultType>> {\n // Ensure channel is initialized before processing\n await this.initialize;\n\n // Set processing flag\n this._processing = true;\n\n // Create isolated scope for this request\n const requestScope = new A_Scope({\n name: `a-channel@scope:request:${A_IdentityHelper.generateTimeId()}`\n })\n .inherit(A_Context.scope(this));\n\n // Create request context\n const context = new A_ChannelRequest<_ParamsType, _ResultType>(params);\n\n try {\n // Set up dependency injection scope\n requestScope.register(context);\n\n // Execute request lifecycle\n await this.call(A_ChannelFeatures.onBeforeRequest, requestScope);\n await this.call(A_ChannelFeatures.onRequest, requestScope);\n await this.call(A_ChannelFeatures.onAfterRequest, requestScope);\n\n this._processing = false;\n\n return context;\n\n } catch (error) {\n this._processing = false;\n\n // Create channel-specific error\n const channelError = new A_ChannelError(error);\n context.fail(channelError);\n requestScope.register(channelError);\n\n // Call error handling hook\n await this.call(A_ChannelFeatures.onError, requestScope);\n\n requestScope.destroy();\n\n throw channelError;\n }\n }\n\n /**\n * Sends a fire-and-forget message (Send pattern).\n * \n * This method is used for one-way communication where no response is expected:\n * - Event broadcasting\n * - Notification sending\n * - Message queuing\n * - Logging operations\n * \n * The method follows this lifecycle:\n * 1. Ensures channel is initialized\n * 2. Creates send scope and context\n * 3. Calls onSend hook\n * 4. Completes without returning data\n * \n * If the operation fails, the onError hook is called but no error is thrown\n * to the caller (fire-and-forget semantics).\n * \n * @template _ParamsType The type of message parameters\n * @param message The message to send\n * @returns {Promise<void>} Promise that resolves when send is complete\n * \n * @example\n * ```typescript\n * // Send notification\n * await channel.send({\n * type: 'user.login',\n * userId: 'user-123',\n * timestamp: new Date().toISOString()\n * });\n * \n * // Send to message queue\n * await channel.send({\n * queue: 'email-queue',\n * payload: {\n * to: 'user@example.com',\n * subject: 'Welcome!',\n * body: 'Welcome to our service!'\n * }\n * });\n * ```\n */\n async send<_ParamsType extends Record<string, any> = Record<string, any>>(\n message: _ParamsType\n ): Promise<void> {\n // Ensure channel is initialized before processing\n await this.initialize;\n\n // Set processing flag\n this._processing = true;\n\n // Create isolated scope for this send operation\n const requestScope = new A_Scope({\n name: `a-channel@scope:send:${A_IdentityHelper.generateTimeId()}`\n })\n .inherit(A_Context.scope(this));\n\n\n // Create request context for the message\n const context = new A_OperationContext('send', message);\n\n try {\n // Set up dependency injection scope\n requestScope.inherit(A_Context.scope(this));\n requestScope.register(context);\n\n // Execute send operation\n await this.call(A_ChannelFeatures.onSend, requestScope);\n\n this._processing = false;\n\n } catch (error) {\n this._processing = false;\n\n // Create channel-specific error\n const channelError = new A_ChannelError(error);\n requestScope.register(channelError);\n context.fail(channelError);\n\n // Call error handling hook\n await this.call(A_ChannelFeatures.onError, requestScope);\n\n requestScope.destroy();\n\n // Note: We don't re-throw the error for fire-and-forget operations\n // The error is handled by the onError hook\n }\n }\n\n /**\n * @deprecated This method is deprecated and will be removed in future versions.\n * Use request() or send() methods instead depending on your communication pattern.\n * \n * For request/response pattern: Use request()\n * For fire-and-forget pattern: Use send()\n * For consumer patterns: Implement custom consumer logic using request() in a loop\n */\n async consume<T extends Record<string, any> = Record<string, any>>(): Promise<A_OperationContext<any, T>> {\n await this.initialize;\n\n this._processing = true;\n\n const requestScope = new A_Scope({ name: `a-channel@scope:consume:${A_IdentityHelper.generateTimeId()}` })\n .inherit(A_Context.scope(this));\n\n\n const context = new A_OperationContext('consume', {} as T);\n\n try {\n requestScope.inherit(A_Context.scope(this));\n requestScope.register(context);\n\n\n await this.call(A_ChannelFeatures.onConsume, requestScope);\n\n this._processing = false;\n\n return context as A_OperationContext<any, T>;\n\n } catch (error) {\n\n this._processing = false;\n\n const channelError = new A_ChannelError(error)\n\n context.fail(channelError);\n\n await this.call(A_ChannelFeatures.onError, requestScope);\n\n return context as A_OperationContext<any, T>;\n }\n }\n\n}","import { A_Fragment, A_Meta, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-ExecutionContext',\n description: 'Execution context fragment that provides a structured way to manage metadata and serialized data for execution environments. It allows storing and retrieving key-value pairs, facilitating context-aware operations within the application. It useful in cases when it\\'s necessary to share some runtime data across multiple steps of thee features, or components.'\n})\nexport class A_ExecutionContext<\n _MetaType extends Record<string, any> = Record<string, any>,\n _SerializedType extends Record<string, any> = Record<string, any>\n> extends A_Fragment {\n\n\n protected _meta: A_Meta<_MetaType, _SerializedType>;\n\n constructor(\n name: string,\n defaults?: Partial<_MetaType>,\n ) {\n super({ name });\n this._meta = new A_Meta<_MetaType, _SerializedType>();\n\n for (const key in defaults) {\n this._meta.set(key as keyof _MetaType, defaults[key as keyof _MetaType] as _MetaType[keyof _MetaType]);\n }\n }\n\n\n [Symbol.iterator](): Iterator<[keyof _MetaType, _MetaType[keyof _MetaType]]> {\n return this._meta[Symbol.iterator]();\n }\n\n\n get meta(): A_Meta<_MetaType> {\n return this._meta;\n }\n\n\n get<K extends keyof _MetaType>(key: K): _MetaType[K] | undefined {\n return this._meta.get(key);\n }\n\n set<K extends keyof _MetaType>(key: K, value: _MetaType[K]): this {\n this._meta.set(key, value);\n return this;\n }\n\n has(key: keyof _MetaType): boolean {\n return this._meta.has(key);\n }\n\n drop(key: keyof _MetaType): void {\n this._meta.delete(key);\n }\n\n clear(): this {\n this._meta.clear();\n return this;\n }\n\n\n toRaw(): _SerializedType {\n return this._meta.toJSON();\n }\n\n toJSON(): A_TYPES__Fragment_Serialized {\n return {\n name: this.name,\n ...this.meta.toJSON(),\n }\n }\n}","import { A_Error, A_Fragment } from \"@adaas/a-concept\";\nimport { A_Operation_Serialized, A_Operation_Storage } from \"./A-Operation.types\";\nimport { A_ExecutionContext } from \"../A-Execution/A-Execution.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-OperationContext',\n description: 'Operation execution context that encapsulates the metadata and serialized data related to a specific operation. It provides structured access to operation parameters, results, and error handling, facilitating the management of operation lifecycles within the application.'\n})\nexport class A_OperationContext<\n _AllowedOperations extends string = string,\n _ParamsType extends Record<string, any> = Record<string, any>,\n _ResultType = any,\n _StorageType extends A_Operation_Storage<_ResultType, _ParamsType> = A_Operation_Storage<_ResultType, _ParamsType>\n> extends A_ExecutionContext<\n _StorageType,\n A_Operation_Serialized<_ResultType, _ParamsType>\n> {\n\n constructor(\n operation: _AllowedOperations,\n params?: _ParamsType\n ) {\n super('operation-context');\n\n this.meta.set('name', operation);\n this.meta.set('params', params || {} as _ParamsType);\n }\n\n get name(): _AllowedOperations {\n return (this._meta.get('name') || this._name) as _AllowedOperations;\n }\n\n get result(): _ResultType | undefined {\n return this._meta.get('result');\n }\n\n get error(): A_Error | undefined {\n return this._meta.get('error');\n }\n\n get params(): _ParamsType {\n return this._meta.get('params') || {} as _ParamsType;\n }\n\n\n fail(error: A_Error): void {\n this._meta.set('error', error);\n }\n\n succeed(result: _ResultType): void {\n this._meta.set('result', result);\n }\n\n\n toJSON(): A_Operation_Serialized<_ResultType, _ParamsType> {\n return {\n name: this.name,\n params: this.params,\n result: this.result || {} as _ResultType,\n error: this.error?.toJSON(),\n }\n }\n}","import { A_Error, A_TypeGuards } from \"@adaas/a-concept\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\n\n\nexport class A_ChannelError extends A_Error {\n\n // ==========================================================\n // ==================== Error Types =========================\n // ==========================================================\n\n\n static readonly MethodNotImplemented = 'A-Channel Method Not Implemented';\n\n // ==========================================================\n // ==================== Properties ==========================\n // ==========================================================\n\n protected _context?: A_OperationContext\n\n\n /**\n * Channel Error allows to keep track of errors within a channel if something goes wrong\n * \n * \n * @param originalError \n * @param context \n */\n constructor(\n originalError: string | A_Error | Error | any,\n context?: A_OperationContext | string\n ) {\n if (A_TypeGuards.isString(context))\n super(originalError, context);\n else\n super(originalError);\n\n if (context instanceof A_OperationContext)\n this._context = context\n }\n\n /***\n * Returns Context of the error\n */\n get context(): A_OperationContext | undefined {\n return this._context\n }\n\n\n}","\n\n// ===============================================================\n// ADAAS A-Channel Constants\n// ===============================================================\nexport enum A_ChannelFeatures {\n /**\n * Allows to extend timeout logic and behavior\n */\n onTimeout = '_A_Channel_onTimeout',\n /**\n * Allows to extend retry logic and behavior\n */\n onRetry = '_A_Channel_onRetry',\n /**\n * Allows to extend circuit breaker logic and behavior\n */\n onCircuitBreakerOpen = '_A_Channel_onCircuitBreakerOpen',\n /**\n * Allows to extend cache logic and behavior\n */\n onCache = '_A_Channel_onCache',\n /**\n * Allows to extend connection logic and behavior\n */\n onConnect = '_A_Channel_onConnect',\n /**\n * Allows to extend disconnection logic and behavior\n */\n onDisconnect = '_A_Channel_onDisconnect',\n /**\n * Allows to extend request preparation logic and behavior\n */\n onBeforeRequest = '_A_Channel_onBeforeRequest',\n /**\n * Allows to extend request sending logic and behavior\n */\n onRequest = '_A_Channel_onRequest',\n /**\n * Allows to extend request post-processing logic and behavior\n */\n onAfterRequest = '_A_Channel_onAfterRequest',\n /**\n * Allows to extend error handling logic and behavior\n * \n * [!] The same approach uses for ALL errors within the channel\n */\n onError = '_A_Channel_onError',\n /**\n * Allows to extend send logic and behavior\n */\n onSend = '_A_Channel_onSend',\n /**\n * Allows to extend consume logic and behavior\n */\n onConsume = '_A_Channel_onConsume',\n}\n\n\n// ==============================================================\n// A-Channel Request Constants\n// ===============================================================\nexport enum A_ChannelRequestStatuses {\n /**\n * Request is pending\n */\n PENDING = 'PENDING',\n /***\n * Request was successful\n */\n SUCCESS = 'SUCCESS',\n /**\n * Request failed\n */\n FAILED = 'FAILED',\n}","import { A_Frame } from \"@adaas/a-frame\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_ChannelRequestStatuses } from \"./A-Channel.constants\";\n\n\n\n@A_Frame.Fragment({\n name: 'A-ChannelRequest',\n description: 'Context for managing channel requests. It encapsulates the request parameters and the result including status and data.'\n})\nexport class A_ChannelRequest<\n _ParamsType extends Record<string, any> = Record<string, any>,\n _ResultType extends Record<string, any> = Record<string, any>,\n> extends A_OperationContext<\n 'request',\n _ParamsType,\n {\n data?: _ResultType;\n status?: A_ChannelRequestStatuses;\n }\n> {\n\n constructor(\n params?: _ParamsType,\n ) {\n super('request', params);\n }\n\n\n get status(): A_ChannelRequestStatuses | undefined {\n return this.result?.status;\n }\n\n get data(): _ResultType | undefined {\n return this.result?.data;\n }\n\n\n succeed(result: _ResultType): void {\n const existed = this.result;\n\n super.succeed({\n ...existed,\n data: result,\n status: A_ChannelRequestStatuses.SUCCESS,\n });\n }\n\n} ","/**\n * A-Command Status Enumeration\n * \n * Defines all possible states a command can be in during its lifecycle.\n * Commands progress through these states in a specific order:\n * CREATED → INITIALIZED → COMPILED → EXECUTING → COMPLETED/FAILED\n */\nexport enum A_Command_Status {\n /**\n * Initial state when command is instantiated but not yet ready for execution\n */\n CREATED = 'CREATED',\n\n /**\n * Command has been initialized with execution scope and dependencies\n */\n INITIALIZED = 'INITIALIZED',\n\n /**\n * Command has been compiled and is ready for execution\n */\n COMPILED = 'COMPILED',\n\n /**\n * Command is currently being executed\n */\n EXECUTING = 'EXECUTING',\n\n /**\n * Command has completed successfully\n */\n COMPLETED = 'COMPLETED',\n\n /**\n * Command execution has failed with errors\n */\n FAILED = 'FAILED',\n}\n\n\n/**\n * A-Command State Transitions\n * \n * Defines valid state transitions for command lifecycle management.\n * These transitions are used by the StateMachine to enforce proper command flow.\n */\nexport enum A_CommandTransitions {\n /** Transition from CREATED to INITIALIZED state */\n CREATED_TO_INITIALIZED = 'created_initialized',\n\n /** Transition from INITIALIZED to EXECUTING state */\n INITIALIZED_TO_EXECUTING = 'initialized_executing',\n\n /** Transition from EXECUTING to COMPLETED state (success path) */\n EXECUTING_TO_COMPLETED = 'executing_completed',\n\n /** Transition from EXECUTING to FAILED state (error path) */\n EXECUTING_TO_FAILED = 'executing_failed',\n}\n\n/**\n * A-Command Lifecycle Features\n * \n * Defines feature extension points that components can implement to customize\n * command behavior at different stages of the lifecycle.\n * \n * Components can use @A_Feature.Extend() decorator with these feature names\n * to inject custom logic into command execution.\n */\nexport enum A_CommandFeatures {\n /**\n * Triggered during command initialization phase\n * Use to set up execution environment, validate parameters, or prepare resources\n */\n onInit = '_A_Command_onInit',\n\n /**\n * Triggered before command execution starts\n * Use for pre-execution validation, logging, or setup tasks\n */\n onBeforeExecute = '_A_Command_onBeforeExecute',\n\n /**\n * Main command execution logic\n * Core business logic should be implemented here\n */\n onExecute = '_A_Command_onExecute',\n\n /**\n * Triggered after command execution completes (success or failure)\n * Use for cleanup, logging, or post-processing tasks\n */\n onAfterExecute = '_A_Command_onAfterExecute',\n\n /**\n * Triggered when command completes successfully\n * Use for success-specific operations like notifications or result processing\n */\n onComplete = '_A_Command_onComplete',\n\n /**\n * Triggered when command execution fails\n * Use for error handling, cleanup, or failure notifications\n */\n onFail = '_A_Command_onFail',\n\n /**\n * Triggered when an error occurs during execution\n * Use for error logging, transformation, or recovery attempts\n */\n onError = '_A_Command_onError',\n}\n\n\nexport enum A_CommandEvent {\n /**\n * Triggered during command initialization phase\n * Use to set up execution environment, validate parameters, or prepare resources\n */\n onInit = 'onInit',\n\n /**\n * Triggered before command execution starts\n * Use for pre-execution validation, logging, or setup tasks\n */\n onBeforeExecute = 'onBeforeExecute',\n\n /**\n * Main command execution logic\n * Core business logic should be implemented here\n */\n onExecute = 'onExecute',\n\n /**\n * Triggered after command execution completes (success or failure)\n * Use for cleanup, logging, or post-processing tasks\n */\n onAfterExecute = 'onAfterExecute',\n\n /**\n * Triggered when command completes successfully\n * Use for success-specific operations like notifications or result processing\n */\n onComplete = 'onComplete',\n\n /**\n * Triggered when command execution fails\n * Use for error handling, cleanup, or failure notifications\n */\n onFail = 'onFail',\n\n /**\n * Triggered when an error occurs during execution\n * Use for error logging, transformation, or recovery attempts\n */\n onError = 'onError',\n}\n\n/**\n * Type alias for command lifecycle event names\n * Represents all available events that can be listened to on a command instance\n */\nexport type A_CommandEvents = keyof typeof A_CommandEvent;\n\n\n\n\n\n","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_CommandError extends A_Error {\n\n\n static readonly CommandScopeBindingError = 'A-Command Scope Binding Error';\n\n static readonly ExecutionError = 'A-Command Execution Error';\n\n static readonly ResultProcessingError = 'A-Command Result Processing Error';\n\n\n /**\n * Error indicating that the command was interrupted during execution\n */\n static readonly CommandInterruptedError = 'A-Command Interrupted Error';\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_StateMachineError extends A_Error {\n\n static readonly InitializationError = 'A-StateMachine Initialization Error';\n\n static readonly TransitionError = 'A-StateMachine Transition Error';\n \n}","export enum A_StateMachineFeatures {\n /**\n * Allows to extend error handling logic and behavior\n */\n onError = '_A_StateMachine_onError',\n /**\n * Allows to extend initialization logic and behavior\n */\n onInitialize = '_A_StateMachine_onInitialize',\n /**\n * Allows to extend transition validation logic and behavior\n */\n onBeforeTransition = '_A_StateMachine_onBeforeTransition',\n /**\n * Allows to extend post-transition logic and behavior\n */\n onAfterTransition = '_A_StateMachine_onAfterTransition',\n}","import { A_Frame } from \"@adaas/a-frame\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_StateMachineTransitionParams, A_StateMachineTransitionStorage } from \"./A-StateMachine.types\";\n\n\n\n@A_Frame.Fragment({\n name: 'A-StateMachineTransition',\n description: 'Context for managing state machine transitions.'\n})\nexport class A_StateMachineTransition<\n _ParamsType = any,\n _ResultType = any\n> extends A_OperationContext<\n 'a-state-machine-transition',\n A_StateMachineTransitionParams<_ParamsType>,\n _ResultType,\n A_StateMachineTransitionStorage<_ResultType, _ParamsType>\n> {\n\n constructor(\n params: A_StateMachineTransitionParams<_ParamsType>\n ) {\n super(\n 'a-state-machine-transition',\n params\n );\n\n this._meta.set('from', params.from);\n this._meta.set('to', params.to);\n }\n\n /**\n * The state to transition from\n */\n get from(): string {\n return this._meta.get('from')!;\n }\n\n /**\n * The state to transition to\n */\n get to(): string {\n return this._meta.get('to')!;\n }\n\n}","import { A_Component, A_Context, A_Feature, A_FormatterHelper, A_Scope } from \"@adaas/a-concept\";\nimport { A_StateMachineError } from \"./A-StateMachine.error\";\nimport { A_StateMachineFeatures } from \"./A-StateMachine.constants\";\nimport { A_StateMachineTransition } from \"./A-StateMachineTransition.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_StateMachine is a powerful state machine implementation that allows you to define and manage\n * complex state transitions with validation, hooks, and error handling.\n * \n * @template T - A record type defining the state transitions and their associated data types.\n * Each key represents a state name, and the value represents the data type for that state.\n * \n * @example\n * ```typescript\n * interface OrderStates {\n * pending: { orderId: string };\n * processing: { orderId: string; processedBy: string };\n * completed: { orderId: string; completedAt: Date };\n * cancelled: { orderId: string; reason: string };\n * }\n * \n * class OrderStateMachine extends A_StateMachine<OrderStates> {\n * // Define custom transition logic\n * async pending_processing(scope: A_Scope) {\n * const operation = scope.resolve(A_StateMachineTransition)!;\n * const { orderId } = operation.props;\n * // Custom validation and business logic\n * }\n * }\n * ```\n */\n\n@A_Frame.Namespace('A-Utils')\n@A_Frame.Component({\n name: 'A-StateMachine',\n description: 'A powerful state machine component for managing complex state transitions.'\n})\nexport class A_StateMachine<\n T extends Record<string, any> = Record<string, any>\n> extends A_Component {\n\n /**\n * Internal promise that tracks the initialization state of the state machine.\n * Used to ensure the state machine is properly initialized before allowing transitions.\n */\n protected _initialized?: Promise<void>;\n\n /**\n * Gets a promise that resolves when the state machine is fully initialized and ready for transitions.\n * This ensures that all initialization hooks have been executed before allowing state transitions.\n * \n * @returns Promise<void> that resolves when initialization is complete\n * \n * @example\n * ```typescript\n * const stateMachine = new MyStateMachine();\n * await stateMachine.ready; // Wait for initialization\n * await stateMachine.transition('idle', 'running');\n * ```\n */\n get ready(): Promise<void> {\n if (!this._initialized) {\n this._initialized = this.call(A_StateMachineFeatures.onInitialize);\n }\n\n return this._initialized;\n }\n\n\n\n /**\n * Initialization hook that runs when the state machine is first created.\n * This method can be extended to add custom initialization logic.\n * \n * @param args - Variable arguments passed during initialization\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onInitialize]() {\n * // Custom initialization logic\n * console.log('State machine initialized');\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onInitialize](...args: any[]): Promise<void> {\n // Initialization logic can be added here\n }\n\n /**\n * Hook that runs before any state transition occurs.\n * Use this to add validation, logging, or preparation logic that should run for all transitions.\n * \n * @param args - Variable arguments, typically includes the transition scope\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onBeforeTransition](scope: A_Scope) {\n * const operation = scope.resolve(A_StateMachineTransition)!;\n * console.log(`Transitioning from ${operation.props.from} to ${operation.props.to}`);\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onBeforeTransition](...args: any[]): Promise<void> {\n\n }\n\n /**\n * Hook that runs after a successful state transition.\n * Use this to add cleanup, logging, or post-transition logic that should run for all transitions.\n * \n * @param args - Variable arguments, typically includes the transition scope\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onAfterTransition](scope: A_Scope) {\n * const operation = scope.resolve(A_StateMachineTransition)!;\n * console.log(`Successfully transitioned to ${operation.props.to}`);\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onAfterTransition](...args: any[]): Promise<void> {\n\n }\n\n /**\n * Error handling hook that runs when a transition fails.\n * Use this to add custom error handling, logging, or recovery logic.\n * \n * @param args - Variable arguments, typically includes the error scope\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onError](scope: A_Scope) {\n * const error = scope.resolve(A_StateMachineError);\n * console.error('Transition failed:', error?.message);\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onError](...args: any[]): Promise<void> {\n // Default error handling logic can be added here\n }\n\n\n\n /**\n * Executes a state transition from one state to another.\n * This is the core method of the state machine that handles the complete transition lifecycle.\n * \n * @param from - The state to transition from (must be a key of T)\n * @param to - The state to transition to (must be a key of T)\n * @param props - Optional properties to pass to the transition context (should match T[keyof T])\n * @returns Promise<void> that resolves when the transition is complete\n * \n * @throws {A_StateMachineError} When the transition fails for any reason\n * \n * @example\n * ```typescript\n * interface OrderStates {\n * pending: { orderId: string };\n * processing: { orderId: string; processedBy: string };\n * }\n * \n * const orderMachine = new A_StateMachine<OrderStates>();\n * \n * // Transition with props\n * await orderMachine.transition('pending', 'processing', {\n * orderId: '12345',\n * processedBy: 'user-456'\n * });\n * ```\n * \n * The transition process follows this lifecycle:\n * 1. Wait for state machine initialization (ready)\n * 2. Create transition name in camelCase format (e.g., \"pending_processing\")\n * 3. Create operation context with transition data\n * 4. Create isolated scope for the transition\n * 5. Call onBeforeTransition hook\n * 6. Execute the specific transition method (if defined)\n * 7. Call onAfterTransition hook\n * 8. Clean up scope and return result\n * \n * If any step fails, the onError hook is called and a wrapped error is thrown.\n */\n @A_Frame.Method({\n name: 'transition',\n description: 'Executes a state transition from one state to another.'\n })\n async transition(\n /**\n * The state to transition from\n */\n from: keyof T,\n /**\n * The state to transition to\n */\n to: keyof T,\n /**\n * Optional properties to pass to the transition context\n */\n props?: T[keyof T]\n ): Promise<void> {\n\n await this.ready;\n\n const transitionName = `${A_FormatterHelper.toCamelCase(String(from))}_${A_FormatterHelper.toCamelCase(String(to))}`;\n\n const transition = new A_StateMachineTransition({\n from: String(from),\n to: String(to),\n props\n });\n\n const scope = new A_Scope({\n name: `A-StateMachine-Transition-Scope-${transitionName}`,\n fragments: [transition]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_StateMachineFeatures.onBeforeTransition, scope);\n\n await this.call(transitionName, scope);\n\n await this.call(A_StateMachineFeatures.onAfterTransition, scope);\n\n scope.destroy();\n\n return transition.result;\n\n } catch (error) {\n const wrappedError = new A_StateMachineError({\n title: A_StateMachineError.TransitionError,\n description: `An error occurred while transitioning to \"${transitionName}\"`,\n originalError: error\n });\n\n scope.register(wrappedError);\n\n await this.call(A_StateMachineFeatures.onError, scope);\n\n scope.destroy();\n\n throw wrappedError;\n }\n }\n}\n\n\n","export const A_CONSTANTS__CONFIG_ENV_VARIABLES = {\n\n} as const\n\n\n//should be an array\nexport type A_TYPES__ConfigENVVariables = (typeof A_CONSTANTS__CONFIG_ENV_VARIABLES)[keyof typeof A_CONSTANTS__CONFIG_ENV_VARIABLES][];\n\n\nexport const A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY = [\n\n] as const;\n\n","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_ConfigError extends A_Error {\n\n static readonly InitializationError = 'A-Config Initialization Error';\n}","import { A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_FormatterHelper, A_TYPES__ConceptENVVariables } from \"@adaas/a-concept\";\nimport { A_TYPES__ConfigContainerConstructor } from \"./A-Config.types\";\nimport { A_ExecutionContext } from \"../A-Execution/A-Execution.context\";\nimport { A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY } from \"./A-Config.constants\";\nimport { A_ConfigError } from \"./A-Config.error\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-Config',\n description: 'Configuration management context that provides structured access to application configuration variables, supporting defaults and strict mode for enhanced reliability. Default environment variables are included for comprehensive configuration handling.'\n})\nexport class A_Config<\n T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]\n> extends A_ExecutionContext<\n { [key in T[number]]: any; } & {\n [key in typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY[number]]: any\n } & {\n [key in typeof A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY[number]]: any\n }\n> {\n protected _strict: boolean;\n protected _configProperties!: T;\n\n protected DEFAULT_ALLOWED_TO_READ_PROPERTIES = [\n ...A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,\n ...A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY\n ];\n\n\n constructor(\n config: Partial<A_TYPES__ConfigContainerConstructor<T>>\n ) {\n super('a-config');\n\n this._strict = config.strict ?? false;\n this._configProperties = config.variables ?? [] as any;\n\n\n for (const key in config.defaults) {\n this.set(\n A_FormatterHelper.toUpperSnakeCase(key),\n config.defaults[key as T[number]]\n );\n }\n }\n\n\n get strict(): boolean {\n return this._strict;\n }\n\n\n /** \n * This method is used to get the configuration property by name\n * \n * @param property \n * @returns \n */\n get<K extends T[number]>(\n property: K | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]\n ): { [key in T[number]]: any; }[K] | undefined {\n if (this._configProperties.includes(property as any)\n || this.DEFAULT_ALLOWED_TO_READ_PROPERTIES.includes(property as any)\n || !this._strict\n )\n return super.get(A_FormatterHelper.toUpperSnakeCase(property));\n\n throw new A_ConfigError('Property not exists or not allowed to read');\n }\n\n\n /**\n * \n * This method is used to set the configuration property by name\n * OR set multiple properties at once by passing an array of objects\n * \n * @param variables \n */\n set(\n variables: Array<{\n property: T[number] | A_TYPES__ConceptENVVariables[number],\n value: any\n }>\n )\n set(\n variables: Partial<Record<T[number] | A_TYPES__ConceptENVVariables[number], any>>\n )\n set(\n property: T[number] | A_TYPES__ConceptENVVariables[number],\n value: any\n )\n set(\n property: T[number] | A_TYPES__ConceptENVVariables[number] | Array<{\n property: T[number] | A_TYPES__ConceptENVVariables[number],\n value: any\n }> | Partial<Record<T[number] | A_TYPES__ConceptENVVariables[number], any>>,\n value?: any\n ) {\n const array = Array.isArray(property)\n ? property\n : typeof property === 'string'\n ? [{ property, value }]\n : Object\n .keys(property)\n .map((key) => ({\n property: key,\n value: property[key]\n }));\n\n for (const { property, value } of array) {\n super.set(A_FormatterHelper.toUpperSnakeCase(property), value);\n }\n }\n}","/**\n * A-Logger Constants\n * \n * Configuration constants and default values for the A_Logger component\n */\n\n/**\n * Default scope length for consistent message alignment\n */\nexport const A_LOGGER_DEFAULT_SCOPE_LENGTH = 20;\n\n/**\n * Default log level when none is specified\n */\nexport const A_LOGGER_DEFAULT_LEVEL = 'all';\n\n/**\n * Terminal color codes mapping\n */\nexport const A_LOGGER_COLORS = {\n // System colors (reserved for specific purposes)\n red: '31', // Errors, critical issues\n yellow: '33', // Warnings, caution messages\n green: '32', // Success, completion messages\n \n // Safe palette for random selection (grey-blue-violet theme)\n blue: '34', // Info, general messages\n cyan: '36', // Headers, titles\n magenta: '35', // Special highlighting\n gray: '90', // Debug, less important info\n brightBlue: '94', // Bright blue variant\n brightCyan: '96', // Bright cyan variant\n brightMagenta: '95', // Bright magenta variant\n darkGray: '30', // Dark gray\n lightGray: '37', // Light gray (white)\n \n // Extended blue-violet palette\n indigo: '38;5;54', // Deep indigo\n violet: '38;5;93', // Violet\n purple: '38;5;129', // Purple\n lavender: '38;5;183', // Lavender\n skyBlue: '38;5;117', // Sky blue\n steelBlue: '38;5;67', // Steel blue\n slateBlue: '38;5;62', // Slate blue\n deepBlue: '38;5;18', // Deep blue\n lightBlue: '38;5;153', // Light blue\n periwinkle: '38;5;111', // Periwinkle\n cornflower: '38;5;69', // Cornflower blue\n powder: '38;5;152', // Powder blue\n \n // Additional grays for variety\n charcoal: '38;5;236', // Charcoal\n silver: '38;5;250', // Silver\n smoke: '38;5;244', // Smoke gray\n slate: '38;5;240', // Slate gray\n} as const;\n\n/**\n * Safe colors for random selection - grey-blue-violet palette\n * Excludes system colors (red, yellow, green) to avoid confusion with warnings/errors\n */\nexport const A_LOGGER_SAFE_RANDOM_COLORS = [\n 'blue', 'cyan', 'magenta', 'gray', 'brightBlue', 'brightCyan', 'brightMagenta',\n 'darkGray', 'lightGray', 'indigo', 'violet', 'purple', 'lavender', 'skyBlue',\n 'steelBlue', 'slateBlue', 'deepBlue', 'lightBlue', 'periwinkle', 'cornflower',\n 'powder', 'charcoal', 'silver', 'smoke', 'slate'\n] as const;\n\n/**\n * ANSI escape codes\n */\nexport const A_LOGGER_ANSI = {\n RESET: '\\x1b[0m',\n PREFIX: '\\x1b[',\n SUFFIX: 'm'\n} as const;\n\n/**\n * Timestamp format configuration\n */\nexport const A_LOGGER_TIME_FORMAT = {\n MINUTES_PAD: 2,\n SECONDS_PAD: 2,\n MILLISECONDS_PAD: 3,\n SEPARATOR: ':'\n} as const;\n\n/**\n * Log message structure constants\n */\nexport const A_LOGGER_FORMAT = {\n SCOPE_OPEN: '[',\n SCOPE_CLOSE: ']',\n TIME_OPEN: '|',\n TIME_CLOSE: '|',\n SEPARATOR: '-------------------------------',\n INDENT_BASE: 3,\n PIPE: '| '\n} as const;\n\n/**\n * Environment variable keys\n */\n/**\n * Terminal width configuration\n */\nexport const A_LOGGER_TERMINAL = {\n DEFAULT_WIDTH: 80, // Default terminal width when can't be detected\n MIN_WIDTH: 40, // Minimum width for formatted output\n MAX_LINE_LENGTH_RATIO: 0.8, // Use 80% of terminal width for content\n BROWSER_DEFAULT_WIDTH: 120 // Default width for browser console\n} as const;\n\n/**\n * Environment variable keys\n */\nexport const A_LOGGER_ENV_KEYS = {\n LOG_LEVEL: 'A_LOGGER_LEVEL',\n DEFAULT_SCOPE_LENGTH: 'A_LOGGER_DEFAULT_SCOPE_LENGTH',\n DEFAULT_SCOPE_COLOR: 'A_LOGGER_DEFAULT_SCOPE_COLOR',\n DEFAULT_LOG_COLOR: 'A_LOGGER_DEFAULT_LOG_COLOR'\n} as const;","import { A_Component, A_Context, A_Error, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_Config } from \"../A-Config/A-Config.context\";\nimport { A_LoggerEnvVariablesType } from \"./A-Logger.env\";\nimport { A_LoggerLevel, A_LoggerColorName } from \"./A-Logger.types\";\nimport {\n A_LOGGER_DEFAULT_SCOPE_LENGTH,\n A_LOGGER_COLORS,\n A_LOGGER_ANSI,\n A_LOGGER_TIME_FORMAT,\n A_LOGGER_FORMAT,\n A_LOGGER_ENV_KEYS,\n A_LOGGER_SAFE_RANDOM_COLORS,\n A_LOGGER_TERMINAL\n} from \"./A-Logger.constants\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_Logger - Advanced Logging Component with Scope-based Output Formatting\n * \n * This component provides comprehensive logging capabilities with:\n * - Color-coded console output for different log levels\n * - Scope-based message formatting with consistent alignment\n * - Support for multiple data types (objects, errors, strings)\n * - Configurable log levels for filtering output\n * - Special handling for A_Error and native Error objects\n * - Timestamp inclusion for better debugging\n * \n * Key Features:\n * - **Scope Integration**: Uses A_Scope for consistent message prefixing\n * - **Color Support**: Terminal color codes for visual distinction\n * - **Object Formatting**: Pretty-prints JSON objects with proper indentation\n * - **Error Handling**: Special formatting for A_Error and Error objects\n * - **Log Level Filtering**: Configurable filtering based on severity\n * - **Multi-line Support**: Proper alignment for multi-line messages\n * \n * @example\n * ```typescript\n * // Basic usage with dependency injection (uses deterministic colors based on scope name)\n * class MyService {\n * constructor(@A_Inject(A_Logger) private logger: A_Logger) {}\n * \n * doSomething() {\n * this.logger.info('Processing started'); // Uses scope-name-based colors, always shows\n * this.logger.debug('Debug information'); // Only shows when debug level enabled\n * \n * // Color overload methods with enum support\n * this.logger.info('green', 'Success message'); // Green message, scope stays default\n * this.logger.debug('gray', 'Verbose debug info'); // Gray message for less important info\n * this.logger.info('brightBlue', 'Important notification');\n * \n * // Terminal width aware formatting - automatically wraps long lines\n * this.logger.info('This is a very long message that will be automatically wrapped to fit within the terminal width while maintaining proper indentation and formatting');\n * \n * this.logger.warning('Something might be wrong');\n * this.logger.error(new Error('Something failed'));\n * }\n * }\n * \n * // Same scope names will always get the same colors automatically\n * const logger1 = new A_Logger(new A_Scope({name: 'UserService'})); // Gets consistent colors\n * const logger2 = new A_Logger(new A_Scope({name: 'UserService'})); // Gets same colors as logger1\n * \n * // Available color names (A_LoggerColorName enum):\n * // 'red', 'yellow', 'green', 'blue', 'cyan', 'magenta', 'gray',\n * // 'brightBlue', 'brightCyan', 'brightMagenta', 'darkGray', 'lightGray',\n * // 'indigo', 'violet', 'purple', 'lavender', 'skyBlue', 'steelBlue',\n * // 'slateBlue', 'deepBlue', 'lightBlue', 'periwinkle', 'cornflower',\n * // 'powder', 'charcoal', 'silver', 'smoke', 'slate'\n * \n * // Configuration via environment variables or A_Config (overrides automatic selection)\n * process.env.A_LOGGER_DEFAULT_SCOPE_COLOR = 'magenta';\n * process.env.A_LOGGER_DEFAULT_LOG_COLOR = 'green';\n * \n * // Or through A_Config instance\n * const config = new A_Config({\n * A_LOGGER_DEFAULT_SCOPE_COLOR: 'red',\n * A_LOGGER_DEFAULT_LOG_COLOR: 'white'\n * });\n * const logger = new A_Logger(scope, config);\n * ```\n */\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A_Logger',\n description: 'Advanced Logging Component with Scope-based Output Formatting that provides color-coded console output, multi-type support, and configurable log levels for enhanced debugging and monitoring.'\n})\nexport class A_Logger extends A_Component {\n\n // =============================================\n // Configuration and Constants\n // =============================================\n\n /**\n * Terminal color codes for different log levels and custom styling\n * These codes work with ANSI escape sequences for colored terminal output\n */\n readonly COLORS;\n\n /**\n * Standard scope length for consistent formatting\n * This ensures all log messages align properly regardless of scope name length\n */\n private readonly STANDARD_SCOPE_LENGTH;\n\n /**\n * Default color for the scope portion of log messages\n * This color is used for the scope brackets and content, and remains consistent\n * for this logger instance regardless of message color overrides\n */\n private readonly DEFAULT_SCOPE_COLOR: keyof typeof A_LOGGER_COLORS;\n\n /**\n * Default color for log message content when no explicit color is provided\n * This color is used for the message body when logging without specifying a color\n */\n private readonly DEFAULT_LOG_COLOR: keyof typeof A_LOGGER_COLORS;\n\n /**\n * Current terminal width for responsive formatting\n * Automatically detected or falls back to default values\n */\n private readonly TERMINAL_WIDTH: number;\n\n /**\n * Maximum content width based on terminal size\n * Used for word wrapping and line length calculations\n */\n private readonly MAX_CONTENT_WIDTH: number;\n\n // =============================================\n // Constructor and Initialization\n // =============================\n\n /**\n * Initialize A_Logger with dependency injection\n * Colors are configured through A_Config or generated randomly if not provided\n * \n * @param scope - The current scope context for message prefixing\n * @param config - Optional configuration for log level filtering and color settings\n */\n constructor(\n @A_Inject(A_Scope) protected scope: A_Scope,\n @A_Inject(A_Config) protected config?: A_Config<A_LoggerEnvVariablesType>\n ) {\n super();\n this.COLORS = A_LOGGER_COLORS;\n this.STANDARD_SCOPE_LENGTH = config?.get(A_LOGGER_ENV_KEYS.DEFAULT_SCOPE_LENGTH) || A_LOGGER_DEFAULT_SCOPE_LENGTH;\n\n // Get colors from config or generate deterministic colors based on scope name\n const configScopeColor = config?.get(A_LOGGER_ENV_KEYS.DEFAULT_SCOPE_COLOR) as keyof typeof A_LOGGER_COLORS;\n const configLogColor = config?.get(A_LOGGER_ENV_KEYS.DEFAULT_LOG_COLOR) as keyof typeof A_LOGGER_COLORS;\n\n if (configScopeColor || configLogColor) {\n // If any color is configured, use config values or fallback to scope-based selection\n this.DEFAULT_SCOPE_COLOR = configScopeColor || this.generateColorFromScopeName(this.scope.name);\n this.DEFAULT_LOG_COLOR = configLogColor || this.generateColorFromScopeName(this.scope.name);\n } else {\n // If no colors configured, generate complementary pair based on scope name\n const complementaryColors = this.generateComplementaryColorsFromScope(this.scope.name);\n this.DEFAULT_SCOPE_COLOR = complementaryColors.scopeColor;\n this.DEFAULT_LOG_COLOR = complementaryColors.logColor;\n }\n\n // Initialize terminal width detection\n this.TERMINAL_WIDTH = this.detectTerminalWidth();\n this.MAX_CONTENT_WIDTH = Math.floor(this.TERMINAL_WIDTH * A_LOGGER_TERMINAL.MAX_LINE_LENGTH_RATIO);\n }\n\n // =============================================\n // Color Generation Utilities\n // =============================================\n\n /**\n * Generate a simple hash from a string\n * Used to create deterministic color selection based on scope name\n * \n * @param str - The string to hash\n * @returns A numeric hash value\n */\n private simpleHash(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32-bit integer\n }\n return Math.abs(hash);\n }\n\n /**\n * Generate a deterministic color based on scope name\n * Same scope names will always get the same color, but uses safe color palette\n * \n * @param scopeName - The scope name to generate color for\n * @returns A color key from the safe colors palette\n */\n private generateColorFromScopeName(scopeName: string): keyof typeof A_LOGGER_COLORS {\n const safeColors = A_LOGGER_SAFE_RANDOM_COLORS;\n const hash = this.simpleHash(scopeName);\n const colorIndex = hash % safeColors.length;\n return safeColors[colorIndex];\n }\n\n /**\n * Generate a pair of complementary colors based on scope name\n * Ensures visual harmony between scope and message colors while being deterministic\n * \n * @param scopeName - The scope name to base colors on\n * @returns Object with scopeColor and logColor that work well together\n */\n private generateComplementaryColorsFromScope(scopeName: string): { scopeColor: keyof typeof A_LOGGER_COLORS, logColor: keyof typeof A_LOGGER_COLORS } {\n // Define color groups that work well together\n const colorPairs = [\n { scopeColor: 'indigo' as const, logColor: 'lightBlue' as const },\n { scopeColor: 'deepBlue' as const, logColor: 'cyan' as const },\n { scopeColor: 'purple' as const, logColor: 'lavender' as const },\n { scopeColor: 'steelBlue' as const, logColor: 'skyBlue' as const },\n { scopeColor: 'slateBlue' as const, logColor: 'periwinkle' as const },\n { scopeColor: 'charcoal' as const, logColor: 'silver' as const },\n { scopeColor: 'violet' as const, logColor: 'brightMagenta' as const },\n { scopeColor: 'darkGray' as const, logColor: 'lightGray' as const },\n { scopeColor: 'cornflower' as const, logColor: 'powder' as const },\n { scopeColor: 'slate' as const, logColor: 'smoke' as const },\n ];\n\n const hash = this.simpleHash(scopeName);\n const pairIndex = hash % colorPairs.length;\n return colorPairs[pairIndex];\n }\n\n // =============================================\n // Terminal Width Detection\n // =============================================\n\n /**\n * Detect current terminal width based on environment\n * \n * Returns appropriate width for different environments:\n * - Node.js: Uses process.stdout.columns if available\n * - Browser: Returns browser default width\n * - Fallback: Returns default terminal width\n * \n * @returns Terminal width in characters\n */\n private detectTerminalWidth(): number {\n try {\n // Browser environment\n if (A_Context.environment === 'browser') {\n return A_LOGGER_TERMINAL.BROWSER_DEFAULT_WIDTH;\n }\n\n // Node.js environment - try to get actual terminal width\n if (typeof process !== 'undefined' && process.stdout && process.stdout.columns) {\n const cols = process.stdout.columns;\n // Ensure minimum width for readability\n return Math.max(cols, A_LOGGER_TERMINAL.MIN_WIDTH);\n }\n\n // Fallback to default width\n return A_LOGGER_TERMINAL.DEFAULT_WIDTH;\n } catch (error) {\n // If any error occurs, fall back to default width\n return A_LOGGER_TERMINAL.DEFAULT_WIDTH;\n }\n }\n\n /**\n * Wrap text to fit within terminal width while preserving formatting\n * \n * @param text - Text to wrap\n * @param scopePadding - The scope padding string for alignment\n * @param isFirstLine - Whether this is the first line (affects available width calculation)\n * @returns Array of wrapped lines with proper indentation\n */\n private wrapText(text: string, scopePadding: string, isFirstLine: boolean = true): string[] {\n if (A_Context.environment === 'browser') {\n // In browser, don't wrap - let browser console handle it\n return [text];\n }\n\n // Calculate available width for text content\n // First line: terminal_width - scope_header_length (includes [scope] |time| part)\n // Continuation lines: terminal_width - scope_padding - pipe_length\n const scopeHeaderLength = this.formattedScope.length + 4 + this.getTime().length + 4; // [scope] |time| \n const continuationIndent = `${scopePadding}${A_LOGGER_FORMAT.PIPE}`;\n\n const firstLineMaxWidth = Math.max(this.TERMINAL_WIDTH - scopeHeaderLength - 1, 20); // -1 for space\n const continuationMaxWidth = Math.max(this.TERMINAL_WIDTH - continuationIndent.length, 20);\n\n // If text fits on first line, return as is\n if (isFirstLine && text.length <= firstLineMaxWidth) {\n return [text];\n }\n\n const lines: string[] = [];\n const words = text.split(' ');\n let currentLine = '';\n let currentMaxWidth = isFirstLine ? firstLineMaxWidth : continuationMaxWidth;\n let isCurrentLineFirst = isFirstLine;\n\n for (const word of words) {\n const spaceNeeded = currentLine ? 1 : 0; // Space before word\n const totalLength = currentLine.length + spaceNeeded + word.length;\n\n // If adding this word would exceed current line's max width\n if (totalLength > currentMaxWidth) {\n if (currentLine) {\n lines.push(currentLine);\n currentLine = word;\n // After first line, all subsequent lines use continuation width\n currentMaxWidth = continuationMaxWidth;\n isCurrentLineFirst = false;\n } else {\n // Word itself is too long, split it\n if (word.length > currentMaxWidth) {\n const chunks = this.splitLongWord(word, currentMaxWidth);\n lines.push(...chunks.slice(0, -1));\n currentLine = chunks[chunks.length - 1];\n } else {\n currentLine = word;\n }\n currentMaxWidth = continuationMaxWidth;\n isCurrentLineFirst = false;\n }\n } else {\n currentLine += (currentLine ? ' ' : '') + word;\n }\n }\n\n if (currentLine) {\n lines.push(currentLine);\n }\n\n return lines.length ? lines : [text];\n }\n\n /**\n * Split a long word that doesn't fit on a single line\n * \n * @param word - Word to split\n * @param maxLength - Maximum length per chunk\n * @returns Array of word chunks\n */\n private splitLongWord(word: string, maxLength: number): string[] {\n const chunks: string[] = [];\n for (let i = 0; i < word.length; i += maxLength) {\n chunks.push(word.slice(i, i + maxLength));\n }\n return chunks;\n }\n\n // =============================================\n // Factory Methods\n // =============================\n\n\n\n // =============================================\n // Scope and Formatting Utilities\n // =============================================\n\n /**\n * Get the formatted scope length for consistent message alignment\n * Uses a standard length to ensure all messages align properly regardless of scope name\n * \n * @returns The scope length to use for padding calculations\n */\n get scopeLength(): number {\n return Math.max(this.scope.name.length, this.STANDARD_SCOPE_LENGTH);\n }\n\n /**\n * Get the formatted scope name with proper padding, centered within the container\n * Ensures consistent width for all scope names in log output with centered alignment\n * \n * @returns Centered and padded scope name for consistent formatting\n */\n get formattedScope(): string {\n const scopeName = this.scope.name;\n const totalLength = this.STANDARD_SCOPE_LENGTH;\n\n // If scope name is longer than standard length, truncate it\n if (scopeName.length >= totalLength) {\n return scopeName.substring(0, totalLength);\n }\n\n // Calculate padding for centering\n const totalPadding = totalLength - scopeName.length;\n const leftPadding = Math.floor(totalPadding / 2);\n const rightPadding = totalPadding - leftPadding;\n\n return ' '.repeat(leftPadding) + scopeName + ' '.repeat(rightPadding);\n }\n\n\n // =============================================\n // Message Compilation and Formatting\n // =============================================\n\n /**\n * Compile log arguments into formatted console output with colors and proper alignment\n * \n * This method handles the core formatting logic for all log messages:\n * - Applies separate colors for scope and message content\n * - Formats scope names with consistent padding\n * - Handles different data types appropriately\n * - Maintains proper indentation for multi-line content\n * \n * @param messageColor - The color key to apply to the message content\n * @param args - Variable arguments to format and display\n * @returns Array of formatted strings and/or objects ready for console output\n */\n compile(\n messageColor: keyof typeof this.COLORS,\n ...args: any[]\n ): Array<any> {\n const timeString = this.getTime();\n // Calculate padding based on actual displayed scope width (STANDARD_SCOPE_LENGTH)\n // Plus 3 for the brackets and space: [scope] \n const scopePadding = ' '.repeat(this.STANDARD_SCOPE_LENGTH + 3);\n const isMultiArg = args.length > 1;\n\n return [\n // Header with separate colors for scope and message content\n `${A_LOGGER_ANSI.PREFIX}${this.COLORS[this.DEFAULT_SCOPE_COLOR]}${A_LOGGER_ANSI.SUFFIX}${A_LOGGER_FORMAT.SCOPE_OPEN}${this.formattedScope}${A_LOGGER_FORMAT.SCOPE_CLOSE}${A_LOGGER_ANSI.RESET} ${A_LOGGER_ANSI.PREFIX}${this.COLORS[messageColor]}${A_LOGGER_ANSI.SUFFIX}${A_LOGGER_FORMAT.TIME_OPEN}${timeString}${A_LOGGER_FORMAT.TIME_CLOSE}`,\n\n // Top separator for multi-argument messages\n isMultiArg ? '\\n' + `${scopePadding}${A_LOGGER_FORMAT.TIME_OPEN}${A_LOGGER_FORMAT.SEPARATOR}` : '',\n\n // Process each argument with appropriate formatting\n ...args.map((arg, i) => {\n const shouldAddNewline = i > 0 || isMultiArg;\n\n switch (true) {\n case arg instanceof A_Error:\n return this.compile_A_Error(arg);\n\n case arg instanceof Error:\n return this.compile_Error(arg);\n\n case typeof arg === 'object' && arg !== null:\n return this.formatObject(arg, shouldAddNewline, scopePadding);\n\n default:\n return this.formatString(String(arg), shouldAddNewline, scopePadding);\n }\n }),\n\n // Bottom separator and color reset\n isMultiArg\n ? '\\n' + `${scopePadding}${A_LOGGER_FORMAT.TIME_OPEN}${A_LOGGER_FORMAT.SEPARATOR}${A_LOGGER_ANSI.RESET}`\n : A_LOGGER_ANSI.RESET\n ];\n }\n\n /**\n * Format an object for display with proper JSON indentation and terminal width awareness\n * \n * @param obj - The object to format\n * @param shouldAddNewline - Whether to add a newline prefix\n * @param scopePadding - The padding string for consistent alignment\n * @returns Formatted object string or the object itself for browser environments\n */\n private formatObject(obj: any, shouldAddNewline: boolean, scopePadding: string): any {\n\n // In case it's browser, return the object as is to use native console object rendering\n // This allows the browser console to display objects with its native interactive features\n if (A_Context.environment === 'browser') {\n return obj;\n }\n\n // Handle null and undefined values\n if (obj === null) {\n return shouldAddNewline ? `\\n${scopePadding}${A_LOGGER_FORMAT.PIPE}null` : 'null';\n }\n if (obj === undefined) {\n return shouldAddNewline ? `\\n${scopePadding}${A_LOGGER_FORMAT.PIPE}undefined` : 'undefined';\n }\n\n let jsonString: string;\n try {\n jsonString = JSON.stringify(obj, null, 2);\n } catch (error) {\n // Handle circular references and other JSON errors\n try {\n const seen = new WeakSet();\n jsonString = JSON.stringify(obj, (key, value) => {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return '[Circular Reference]';\n }\n seen.add(value);\n }\n return value;\n }, 2);\n } catch (fallbackError) {\n // If all else fails, convert to string\n jsonString = String(obj);\n }\n }\n\n // Apply terminal width wrapping to long JSON string values\n const continuationIndent = `${scopePadding}${A_LOGGER_FORMAT.PIPE}`;\n const maxJsonLineWidth = this.TERMINAL_WIDTH - continuationIndent.length - 4; // -4 for JSON indentation\n\n // Split into lines and wrap long string values\n const lines = jsonString.split('\\n').map(line => {\n // Check if this line contains a long string value\n const stringValueMatch = line.match(/^(\\s*\"[^\"]+\":\\s*\")([^\"]+)(\".*)?$/);\n if (stringValueMatch && stringValueMatch[2].length > maxJsonLineWidth - stringValueMatch[1].length - (stringValueMatch[3] || '').length) {\n const [, prefix, value, suffix = ''] = stringValueMatch;\n\n // Wrap the string value if it's too long\n if (value.length > maxJsonLineWidth - prefix.length - suffix.length) {\n const wrappedValue = this.wrapJsonStringValue(value, maxJsonLineWidth - prefix.length - suffix.length);\n return prefix + wrappedValue + suffix;\n }\n }\n return line;\n });\n\n const formatted = lines.join('\\n' + continuationIndent);\n return shouldAddNewline ? '\\n' + continuationIndent + formatted : formatted;\n }\n\n /**\n * Wrap a long JSON string value while preserving readability\n * \n * @param value - The string value to wrap\n * @param maxWidth - Maximum width for the value\n * @returns Wrapped string value\n */\n private wrapJsonStringValue(value: string, maxWidth: number): string {\n if (value.length <= maxWidth) {\n return value;\n }\n\n // For JSON string values, truncate with ellipsis to maintain JSON validity\n // This prevents the JSON from becoming unreadable due to excessive wrapping\n // while still showing the most important part of the string\n if (maxWidth > 6) { // Ensure we have room for ellipsis\n return value.substring(0, maxWidth - 3) + '...';\n } else {\n // If maxWidth is very small, just return truncated value\n return value.substring(0, Math.max(1, maxWidth));\n }\n }\n\n /**\n * Format a string for display with proper indentation and terminal width wrapping\n * \n * @param str - The string to format\n * @param shouldAddNewline - Whether to add a newline prefix\n * @param scopePadding - The padding string for consistent alignment\n * @returns Formatted string\n */\n private formatString(str: string, shouldAddNewline: boolean, scopePadding: string): string {\n // In browser environment, keep simple formatting\n if (A_Context.environment === 'browser') {\n const prefix = shouldAddNewline ? '\\n' : '';\n return (prefix + str).replace(/\\n/g, '\\n' + `${scopePadding}${A_LOGGER_FORMAT.PIPE}`);\n }\n\n // For terminal, apply intelligent text wrapping\n const wrappedLines = this.wrapText(str, scopePadding, !shouldAddNewline);\n const continuationIndent = `${scopePadding}${A_LOGGER_FORMAT.PIPE}`;\n\n // Format the wrapped lines with proper indentation\n const formattedLines = wrappedLines.map((line, index) => {\n if (index === 0 && !shouldAddNewline) {\n // First line in inline mode (no newline prefix)\n return line;\n } else {\n // Continuation lines or first line with newline prefix\n return `${continuationIndent}${line}`;\n }\n });\n\n if (shouldAddNewline) {\n return '\\n' + formattedLines.join('\\n');\n } else {\n return formattedLines.join('\\n');\n }\n }\n\n // =============================================\n // Log Level Management\n // =============================================\n\n /**\n * Determine if a log message should be output based on configured log level\n * \n * Log level hierarchy:\n * - debug: Shows all messages (debug, info, warning, error)\n * - info: Shows info, warning, and error messages\n * - warn: Shows warning and error messages only\n * - error: Shows error messages only\n * - all: Shows all messages (alias for debug)\n * \n * @param logMethod - The type of log method being called\n * @returns True if the message should be logged, false otherwise\n */\n protected shouldLog(logMethod: 'debug' | 'info' | 'warning' | 'error'): boolean {\n const shouldLog: A_LoggerLevel = this.config?.get(A_LOGGER_ENV_KEYS.LOG_LEVEL) || 'info';\n\n switch (shouldLog) {\n case 'debug':\n return true;\n case 'info':\n return logMethod === 'info' || logMethod === 'warning' || logMethod === 'error';\n case 'warn':\n return logMethod === 'warning' || logMethod === 'error';\n case 'error':\n return logMethod === 'error';\n case 'all':\n return true;\n default:\n return false;\n }\n }\n\n\n // =============================================\n // Public Logging Methods\n // =============================================\n\n /**\n * Debug logging method with optional color specification\n * Only logs when debug level is enabled\n * \n * Supports two usage patterns:\n * 1. debug(message, ...args) - Uses instance's default log color\n * 2. debug(color, message, ...args) - Uses specified color for message content only\n * \n * Note: The scope color always remains the instance's default scope color,\n * only the message content color changes when explicitly specified.\n * \n * @param color - Optional color name from A_LoggerColorName enum or the first message argument\n * @param args - Additional arguments to log\n * \n * @example\n * ```typescript\n * logger.debug('Debug information'); // Uses instance default colors\n * logger.debug('gray', 'Debug message'); // Gray message, scope stays instance color\n * logger.debug('Processing user:', { id: 1, name: 'John' });\n * ```\n */\n debug(color: A_LoggerColorName, ...args: any[]): void;\n debug(...args: any[]): void;\n debug(param1: any, ...args: any[]): void {\n if (!this.shouldLog('debug')) return;\n\n // Check if first parameter is a valid color key\n if (typeof param1 === 'string' && this.COLORS[param1 as keyof typeof this.COLORS]) {\n console.log(...this.compile(param1 as keyof typeof this.COLORS, ...args));\n } else {\n // Use instance's default log color and treat param1 as first message argument\n console.log(...this.compile(this.DEFAULT_LOG_COLOR, param1, ...args));\n }\n }\n\n /**\n * Info logging method with optional color specification\n * Logs without any restrictions (always shows regardless of log level)\n * \n * Supports two usage patterns:\n * 1. info(message, ...args) - Uses instance's default log color\n * 2. info(color, message, ...args) - Uses specified color for message content only\n * \n * Note: The scope color always remains the instance's default scope color,\n * only the message content color changes when explicitly specified.\n * \n * @param color - Optional color name from A_LoggerColorName enum or the first message argument\n * @param args - Additional arguments to log\n * \n * @example\n * ```typescript\n * logger.info('Hello World'); // Uses instance default colors\n * logger.info('green', 'Success message'); // Green message, scope stays instance color\n * logger.info('Processing user:', { id: 1, name: 'John' });\n * ```\n */\n info(color: A_LoggerColorName, ...args: any[]): void;\n info(...args: any[]): void;\n info(param1: any, ...args: any[]): void {\n if (!this.shouldLog('info')) return;\n\n // Check if first parameter is a valid color key\n if (typeof param1 === 'string' && this.COLORS[param1 as keyof typeof this.COLORS]) {\n console.log(...this.compile(param1 as keyof typeof this.COLORS, ...args));\n } else {\n // Use instance's default log color and treat param1 as first message argument\n console.log(...this.compile(this.DEFAULT_LOG_COLOR, param1, ...args));\n }\n }\n\n /**\n * Legacy log method (kept for backward compatibility)\n * @deprecated Use info() method instead\n * \n * @param color - Optional color name from A_LoggerColorName enum or the first message argument\n * @param args - Additional arguments to log\n */\n log(color: A_LoggerColorName, ...args: any[]): void;\n log(...args: any[]): void;\n log(param1: any, ...args: any[]): void {\n // Delegate to info method for backward compatibility\n this.info(param1, ...args);\n }\n\n /**\n * Log warning messages with yellow color coding\n * \n * Use for non-critical issues that should be brought to attention\n * but don't prevent normal operation\n * \n * @param args - Arguments to log as warnings\n * \n * @example\n * ```typescript\n * logger.warning('Deprecated method used');\n * logger.warning('Rate limit approaching:', { current: 95, limit: 100 });\n * ```\n */\n warning(...args: any[]): void {\n if (!this.shouldLog('warning')) return;\n console.log(...this.compile('yellow', ...args));\n }\n\n /**\n * Log error messages with red color coding\n * \n * Use for critical issues, exceptions, and failures that need immediate attention\n * \n * @param args - Arguments to log as errors\n * @returns void (for compatibility with console.log)\n * \n * @example\n * ```typescript\n * logger.error('Database connection failed');\n * logger.error(new Error('Validation failed'));\n * logger.error('Critical error:', error, { context: 'user-registration' });\n * ```\n */\n error(...args: any[]): void {\n if (!this.shouldLog('error')) return;\n console.log(...this.compile('red', ...args));\n }\n\n // =============================================\n // Specialized Error Formatting\n // =============================================\n\n /**\n * Legacy method for A_Error logging (kept for backward compatibility)\n * \n * @deprecated Use error() method instead which handles A_Error automatically\n * @param error - The A_Error instance to log\n */\n protected log_A_Error(error: A_Error): void {\n const time = this.getTime();\n const scopePadding = ' '.repeat(this.STANDARD_SCOPE_LENGTH + 3);\n\n console.log(`\\x1b[31m[${this.formattedScope}] |${time}| ERROR ${error.code}\n${scopePadding}| ${error.message}\n${scopePadding}| ${error.description} \n${scopePadding}|-------------------------------\n${scopePadding}| ${error.stack?.split('\\n').map((line, index) => index === 0 ? line : `${scopePadding}| ${line}`).join('\\n') || 'No stack trace'}\n${scopePadding}|-------------------------------\n\\x1b[0m`\n + (error.originalError ? `\\x1b[31m${scopePadding}| Wrapped From ${error.originalError.message}\n${scopePadding}|-------------------------------\n${scopePadding}| ${error.originalError.stack?.split('\\n').map((line, index) => index === 0 ? line : `${scopePadding}| ${line}`).join('\\n') || 'No stack trace'}\n${scopePadding}|-------------------------------\n\\x1b[0m`: '')\n + (error.link ? `\\x1b[31m${scopePadding}| Read in docs: ${error.link}\n${scopePadding}|-------------------------------\n\\x1b[0m`: ''));\n }\n\n /**\n * Format A_Error instances for inline display within compiled messages\n * \n * Provides detailed formatting for A_Error objects with:\n * - Error code, message, and description\n * - Original error information FIRST (better UX for debugging)\n * - Stack traces with terminal width awareness\n * - Documentation links (if available)\n * - Consistent formatting with rest of logger\n * \n * @param error - The A_Error instance to format\n * @returns Formatted string ready for display\n */\n protected compile_A_Error(error: A_Error): string {\n const continuationIndent = `${' '.repeat(this.STANDARD_SCOPE_LENGTH + 3)}${A_LOGGER_FORMAT.PIPE}`;\n const separator = `${continuationIndent}-------------------------------`;\n const lines: string[] = [];\n\n // Add error header\n lines.push('');\n lines.push(separator);\n lines.push(`${continuationIndent}A_ERROR: ${error.code}`);\n lines.push(separator);\n\n // Format and wrap error message and description\n const errorMessage = this.wrapText(`Message: ${error.message}`, continuationIndent, false);\n const errorDescription = this.wrapText(`Description: ${error.description}`, continuationIndent, false);\n\n lines.push(...errorMessage.map(line => `${continuationIndent}${line}`));\n lines.push(...errorDescription.map(line => `${continuationIndent}${line}`));\n\n // Show original error FIRST (more important for debugging)\n if (error.originalError) {\n lines.push(separator);\n lines.push(`${continuationIndent}ORIGINAL ERROR:`);\n lines.push(separator);\n\n const originalMessage = this.wrapText(`${error.originalError.name}: ${error.originalError.message}`, continuationIndent, false);\n lines.push(...originalMessage.map(line => `${continuationIndent}${line}`));\n\n if (error.originalError.stack) {\n lines.push(`${continuationIndent}Stack trace:`);\n const stackLines = this.formatStackTrace(error.originalError.stack, continuationIndent);\n lines.push(...stackLines);\n }\n }\n\n // Then show A_Error stack trace\n if (error.stack) {\n lines.push(separator);\n lines.push(`${continuationIndent}A_ERROR STACK:`);\n lines.push(separator);\n const stackLines = this.formatStackTrace(error.stack, continuationIndent);\n lines.push(...stackLines);\n }\n\n // Documentation link at the end\n if (error.link) {\n lines.push(separator);\n const linkText = this.wrapText(`Documentation: ${error.link}`, continuationIndent, false);\n lines.push(...linkText.map(line => `${continuationIndent}${line}`));\n }\n\n lines.push(separator);\n\n return lines.join('\\n');\n }\n\n /**\n * Format stack trace with proper terminal width wrapping and indentation\n * \n * @param stack - The stack trace string\n * @param baseIndent - Base indentation for continuation lines\n * @returns Array of formatted stack trace lines\n */\n private formatStackTrace(stack: string, baseIndent: string): string[] {\n const stackLines = stack.split('\\n');\n const formatted: string[] = [];\n\n stackLines.forEach((line, index) => {\n if (line.trim()) {\n // Add extra indentation for stack trace lines\n const stackIndent = index === 0 ? baseIndent : `${baseIndent} `;\n const wrappedLines = this.wrapText(line.trim(), stackIndent, false);\n formatted.push(...wrappedLines.map(wrappedLine =>\n index === 0 && wrappedLine === wrappedLines[0]\n ? `${baseIndent}${wrappedLine}`\n : `${baseIndent} ${wrappedLine}`\n ));\n }\n });\n\n return formatted;\n }\n\n /**\n * Format standard Error instances for inline display within compiled messages\n * \n * Provides clean, readable formatting for standard JavaScript errors with:\n * - Terminal width aware message wrapping\n * - Properly formatted stack traces\n * - Consistent indentation with rest of logger\n * \n * @param error - The Error instance to format\n * @returns Formatted string ready for display\n */\n protected compile_Error(error: Error): string {\n const continuationIndent = `${' '.repeat(this.STANDARD_SCOPE_LENGTH + 3)}${A_LOGGER_FORMAT.PIPE}`;\n const separator = `${continuationIndent}-------------------------------`;\n const lines: string[] = [];\n\n // Add error header\n lines.push('');\n lines.push(separator);\n lines.push(`${continuationIndent}ERROR: ${error.name}`);\n lines.push(separator);\n\n // Format and wrap error message\n const errorMessage = this.wrapText(`Message: ${error.message}`, continuationIndent, false);\n lines.push(...errorMessage.map(line => `${continuationIndent}${line}`));\n\n // Format stack trace if available\n if (error.stack) {\n lines.push(separator);\n lines.push(`${continuationIndent}STACK TRACE:`);\n lines.push(separator);\n const stackLines = this.formatStackTrace(error.stack, continuationIndent);\n lines.push(...stackLines);\n }\n\n lines.push(separator);\n\n return lines.join('\\n');\n }\n\n // =============================================\n // Utility Methods\n // =============================================\n\n /**\n * Generate timestamp string for log messages\n * \n * Format: MM:SS:mmm (minutes:seconds:milliseconds)\n * This provides sufficient precision for debugging while remaining readable\n * \n * @returns Formatted timestamp string\n * \n * @example\n * Returns: \"15:42:137\" for 3:42:15 PM and 137 milliseconds\n */\n protected getTime(): string {\n const now = new Date();\n const minutes = String(now.getMinutes()).padStart(A_LOGGER_TIME_FORMAT.MINUTES_PAD, '0');\n const seconds = String(now.getSeconds()).padStart(A_LOGGER_TIME_FORMAT.SECONDS_PAD, '0');\n const milliseconds = String(now.getMilliseconds()).padStart(A_LOGGER_TIME_FORMAT.MILLISECONDS_PAD, '0');\n return `${minutes}${A_LOGGER_TIME_FORMAT.SEPARATOR}${seconds}${A_LOGGER_TIME_FORMAT.SEPARATOR}${milliseconds}`;\n }\n}","import {\n A_Command_ExecutionContext,\n A_TYPES__Command_Init,\n A_TYPES__Command_Listener,\n A_TYPES__Command_Serialized\n} from \"./A-Command.types\";\nimport {\n A_CommandFeatures,\n A_Command_Status,\n A_CommandTransitions,\n A_CommandEvent\n} from \"./A-Command.constants\";\nimport { A_Context, A_Dependency, A_Entity, A_Error, A_Feature, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_CommandError } from \"./A-Command.error\";\nimport { A_StateMachine } from \"../A-StateMachine/A-StateMachine.component\";\nimport { A_StateMachineFeatures } from \"../A-StateMachine/A-StateMachine.constants\";\nimport { A_Logger } from \"../A-Logger/A-Logger.component\";\nimport { A_StateMachineTransition } from \"../A-StateMachine/A-StateMachineTransition.context\";\nimport { A_ExecutionContext } from \"../A-Execution/A-Execution.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_Command - Advanced Command Pattern Implementation\n * \n * A comprehensive command pattern implementation that encapsulates business logic\n * as executable commands with full lifecycle management, event handling, and \n * state persistence capabilities.\n * \n * ## Key Features\n * - **Structured Lifecycle**: Automatic progression through init → compile → execute → complete/fail\n * - **Event-Driven**: Subscribe to lifecycle events and emit custom events\n * - **State Persistence**: Full serialization/deserialization for cross-service communication\n * - **Type Safety**: Generic types for parameters, results, and custom events\n * - **Dependency Injection**: Integrated with A-Concept's DI system\n * - **Error Management**: Comprehensive error capture and handling\n * - **Execution Tracking**: Built-in timing and performance metrics\n * \n * ## Lifecycle Phases\n * 1. **CREATED** - Command instantiated but not initialized\n * 2. **INITIALIZED** - Execution scope and dependencies set up\n * 3. **COMPILED** - Ready for execution with all resources prepared\n * 4. **EXECUTING** - Currently running business logic\n * 5. **COMPLETED** - Successfully finished execution\n * 6. **FAILED** - Execution failed with errors captured\n * \n * @template InvokeType - Type definition for command parameters\n * @template ResultType - Type definition for command execution result\n * @template LifecycleEvents - Union type of custom lifecycle event names\n * \n * @example\n * ```typescript\n * // Define parameter and result types\n * interface UserCreateParams {\n * name: string;\n * email: string;\n * role: 'admin' | 'user';\n * }\n * \n * interface UserCreateResult {\n * userId: string;\n * success: boolean;\n * }\n * \n * // Create custom command\n * class CreateUserCommand extends A_Command<UserCreateParams, UserCreateResult> {}\n * \n * // Execute command\n * const command = new CreateUserCommand({\n * name: 'John Doe',\n * email: 'john@example.com',\n * role: 'user'\n * });\n * \n * scope.register(command);\n * await command.execute();\n * \n * console.log('Result:', command.result);\n * console.log('Status:', command.status);\n * ```\n */\n@A_Frame.Entity({\n namespace: 'A-Utils',\n name: 'A-Command',\n description: 'Advanced Command Pattern Implementation with full lifecycle management, event handling, and state persistence. This entity allows to execute commands in distributed environment across multiple services.'\n})\nexport class A_Command<\n InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init,\n ResultType extends Record<string, any> = Record<string, any>,\n LifecycleEvents extends string | keyof typeof A_CommandEvent = keyof typeof A_CommandEvent,\n> extends A_Entity<InvokeType, A_TYPES__Command_Serialized<InvokeType, ResultType>> {\n\n // ====================================================================\n // ================== Static Command Information ======================\n // ====================================================================\n\n /**\n * Static command identifier derived from the class name\n * Used for command registration and serialization\n */\n static get code(): string {\n return super.entity;\n }\n\n // ====================================================================\n // ================== Instance Properties =============================\n // ====================================================================\n\n /** The origin of the command, used to know has it been created from serialization or invoked */\n protected _origin!: 'invoked' | 'serialized';\n\n /** Command execution scope for dependency injection and feature resolution */\n protected _executionScope!: A_Scope;\n\n /** Result data produced by successful command execution */\n protected _result?: ResultType;\n\n /** Set of errors that occurred during command execution */\n protected _error!: A_Error;\n\n /** Command initialization parameters */\n protected _params!: InvokeType;\n\n /** Current lifecycle status of the command */\n protected _status!: A_Command_Status\n\n /** Map of event listeners organized by event name */\n protected _listeners: Map<\n LifecycleEvents | keyof typeof A_CommandEvent,\n Set<A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>>\n > = new Map();\n\n /** Timestamp when command execution started */\n protected _startTime?: Date;\n\n /** Timestamp when command execution ended */\n protected _endTime?: Date;\n\n /** Timestamp when command was created */\n protected _createdAt!: Date;\n\n\n // ====================================================================\n // ================== Public Getter Properties =======================\n // ====================================================================\n\n /**\n * Total execution duration in milliseconds\n * \n * - If completed/failed: Returns total time from start to end\n * - If currently executing: Returns elapsed time since start\n * - If not started: Returns undefined\n */\n get duration(): number | undefined {\n return this._endTime && this._startTime\n ? this._endTime.getTime() - this._startTime.getTime()\n : this._startTime\n ? new Date().getTime() - this._startTime.getTime()\n : undefined;\n }\n\n /**\n * Idle time before execution started in milliseconds\n * \n * Time between command creation and execution start.\n * Useful for monitoring command queue performance.\n */\n get idleTime(): number | undefined {\n return this._startTime && this._createdAt\n ? this._startTime.getTime() - this._createdAt.getTime()\n : undefined;\n }\n\n /**\n * Command execution scope for dependency injection\n * \n * Provides access to components, services, and shared resources\n * during command execution. Inherits from the scope where the\n * command was registered.\n */\n get scope(): A_Scope {\n return this._executionScope;\n }\n /**\n * Execution context associated with the command\n */\n get context(): A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>> {\n return this.scope.resolve(A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>)!;\n }\n\n /**\n * Unique command type identifier\n * \n * Derived from the class name and used for:\n * - Command registration and resolution\n * - Serialization and deserialization\n * - Logging and debugging\n * \n * @example 'create-user-command', 'process-order-command'\n */\n get code(): string {\n return (this.constructor as typeof A_Command).code;\n }\n /**\n * Current lifecycle status of the command\n * \n * Indicates the current phase in the command execution lifecycle.\n * Used to track progress and determine available operations.\n */\n get status(): A_Command_Status {\n return this._status;\n }\n\n /**\n * Timestamp when the command was created\n * \n * Marks the initial instantiation time, useful for tracking\n * command age and queue performance metrics.\n */\n get createdAt(): Date {\n return this._createdAt!;\n }\n\n /**\n * Timestamp when command execution started\n * \n * Undefined until execution begins. Used for calculating\n * execution duration and idle time.\n */\n get startedAt(): Date | undefined {\n return this._startTime;\n }\n\n /**\n * Timestamp when command execution ended\n * \n * Set when command reaches COMPLETED or FAILED status.\n * Used for calculating total execution duration.\n */\n get endedAt(): Date | undefined {\n return this._endTime;\n }\n\n /**\n * Result data produced by command execution\n * \n * Contains the output data from successful command execution.\n * Undefined until command completes successfully.\n */\n get result(): ResultType | undefined {\n return this._result;\n }\n\n /**\n * Array of errors that occurred during execution\n * \n * Automatically wraps native errors in A_Error instances\n * for consistent error handling. Empty array if no errors occurred.\n */\n get error(): A_Error | undefined {\n return this._error;\n }\n\n /**\n * Command initialization parameters\n * \n * Contains the input data used to create and configure the command.\n * These parameters are immutable during command execution.\n return new A_Error(err);\n }\n });\n }\n\n /**\n * Command initialization parameters\n * \n * Contains the input data used to create and configure the command.\n * These parameters are immutable during command execution.\n */\n get params(): InvokeType {\n return this._params;\n }\n\n /**\n * Indicates if the command has been processed (completed or failed)\n * \n * Returns true if the command has completed or failed, false otherwise.\n */\n get isProcessed(): boolean {\n return this._status === A_Command_Status.COMPLETED\n || this._status === A_Command_Status.FAILED;\n }\n\n /**\n * \n * A-Command represents an executable command with a specific code and parameters.\n * It can be executed within a given scope and stores execution results and errors.\n * \n * \n * A-Command should be context independent and execution logic should be based on attached components \n * \n * @param code \n * @param params \n */\n constructor(\n /**\n * Command invocation parameters\n */\n params: InvokeType | A_TYPES__Command_Serialized<InvokeType, ResultType> | string,\n ) {\n super(params as any);\n }\n\n // --------------------------------------------------------------------------\n // A-StateMachine Feature Extensions\n // --------------------------------------------------------------------------\n @A_Feature.Extend()\n protected async [A_StateMachineFeatures.onBeforeTransition](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n this.checkScopeInheritance();\n\n // and register all allowed status transitions\n // switch across allowed transitions, if not allowed throw an error\n logger?.debug('yellow', `Command ${this.aseid.toString()} transitioning from ${transition.from} to ${transition.to}`);\n }\n\n @A_Feature.Extend()\n protected async [A_CommandTransitions.CREATED_TO_INITIALIZED](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n ...args: any[]\n ): Promise<void> {\n if (this._status !== A_Command_Status.CREATED) {\n return;\n }\n\n this._createdAt = new Date();\n this._status = A_Command_Status.INITIALIZED;\n\n this.emit(A_CommandEvent.onInit);\n }\n\n @A_Feature.Extend()\n protected async [A_CommandTransitions.INITIALIZED_TO_EXECUTING](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n ...args: any[]\n ): Promise<void> {\n if (this._status !== A_Command_Status.INITIALIZED\n && this._status !== A_Command_Status.CREATED\n ) {\n return;\n }\n\n this._startTime = new Date();\n this._status = A_Command_Status.EXECUTING;\n\n this.emit(A_CommandEvent.onExecute);\n }\n\n @A_Feature.Extend()\n /**\n * Handles command completion after successful execution\n * \n * EXECUTION -> COMPLETED transition\n */\n protected async [A_CommandTransitions.EXECUTING_TO_COMPLETED](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n ...args: any[]\n ): Promise<void> {\n this._endTime = new Date();\n this._status = A_Command_Status.COMPLETED;\n\n this.emit(A_CommandEvent.onComplete);\n }\n\n @A_Feature.Extend()\n /**\n * Handles command failure during execution\n * \n * EXECUTION -> FAILED transition\n */\n protected async [A_CommandTransitions.EXECUTING_TO_FAILED](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n @A_Inject(A_Error) error: A_Error,\n ...args: any[]\n ): Promise<void> {\n this._endTime = new Date();\n\n this._status = A_Command_Status.FAILED;\n\n this.emit(A_CommandEvent.onFail);\n }\n\n\n // --------------------------------------------------------------------------\n // A-Command Lifecycle Feature Extensions\n // --------------------------------------------------------------------------\n @A_Feature.Extend()\n /**\n * Default behavior for Command Initialization uses StateMachine to transition states\n */\n protected async [A_CommandFeatures.onInit](\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.CREATED, A_Command_Status.INITIALIZED);\n }\n\n @A_Feature.Extend({\n after: /.*/\n })\n protected async [A_CommandFeatures.onBeforeExecute](\n @A_Dependency.Required()\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.INITIALIZED, A_Command_Status.EXECUTING);\n }\n\n @A_Feature.Extend()\n protected async [A_CommandFeatures.onExecute](\n ...args: any[]\n ): Promise<void> {\n }\n\n @A_Feature.Extend()\n /**\n * By Default on AfterExecute calls the Completion method to mark the command as completed\n * \n * [!] This can be overridden to implement custom behavior using A_Feature overrides\n */\n protected async [A_CommandFeatures.onAfterExecute](\n ...args: any[]\n ): Promise<void> {\n }\n\n @A_Feature.Extend({\n after: /.*/\n })\n protected async [A_CommandFeatures.onComplete](\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.EXECUTING, A_Command_Status.COMPLETED);\n }\n\n @A_Feature.Extend({\n after: /.*/\n })\n protected async [A_CommandFeatures.onFail](\n @A_Dependency.Required()\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n @A_Inject(A_ExecutionContext) operation: A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.EXECUTING, A_Command_Status.FAILED);\n }\n\n // --------------------------------------------------------------------------\n // A-Command Lifecycle Methods\n // --------------------------------------------------------------------------\n /**\n * Initializes the command before execution.\n */\n async init(): Promise<void> {\n await this.call(A_CommandFeatures.onInit, this.scope);\n }\n\n /**\n * Executes the command logic.\n */\n async execute(): Promise<any> {\n\n if (this.isProcessed) return;\n\n try {\n this.checkScopeInheritance();\n\n const context = new A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>('execute-command');\n\n this.scope.register(context);\n\n await new Promise<void>(async (resolve, reject) => {\n\n try {\n const onBeforeExecuteFeature = new A_Feature({\n name: A_CommandFeatures.onBeforeExecute,\n component: this,\n scope: this.scope\n })\n\n const onExecuteFeature = new A_Feature({\n name: A_CommandFeatures.onExecute,\n component: this,\n scope: this.scope\n })\n\n const onAfterExecuteFeature = new A_Feature({\n name: A_CommandFeatures.onAfterExecute,\n component: this,\n scope: this.scope\n })\n\n\n\n this.on(A_CommandEvent.onComplete, () => {\n\n onBeforeExecuteFeature.interrupt();\n onExecuteFeature.interrupt();\n onAfterExecuteFeature.interrupt();\n\n resolve();\n });\n\n this.on(A_CommandEvent.onFail, () => {\n\n onBeforeExecuteFeature.interrupt();\n onExecuteFeature.interrupt();\n onAfterExecuteFeature.interrupt();\n\n reject(this.error);\n });\n\n\n await onBeforeExecuteFeature.process(this.scope);\n\n await onExecuteFeature.process(this.scope);\n\n await onAfterExecuteFeature.process(this.scope);\n\n /** only in case it was really invoked we automatically transit it to COMPLETED state */\n if (this._origin === 'invoked') {\n await this.complete();\n }\n\n resolve();\n\n } catch (error) {\n reject(error);\n }\n });\n\n } catch (error) {\n let targetError = error instanceof A_Error\n ? error\n : new A_CommandError({\n title: A_CommandError.ExecutionError,\n description: `An error occurred while executing command \"${this.aseid.toString()}\".`,\n originalError: error\n });\n\n await this.fail(targetError);\n }\n }\n\n /**\n * Marks the command as completed\n * \n * \n * Calling This method will set the command status to COMPLETED, record the end time,\n * store the result, emit the onComplete event, and destroy the execution scope.\n *\n * [!] After Calling this method, the command is considered fully processed And further processing will be INTERRUPTED. \n * [!] If the command is already processed (COMPLETED or FAILED), this method does nothing.\n * [!] This method can be called with optional result data to store with the command.\n * \n * @param result - Optional result data to store with the command\n */\n async complete(result?: ResultType) {\n if (this.isProcessed) return;\n\n this._status = A_Command_Status.COMPLETED;\n\n this._result = result;\n\n await this.call(A_CommandFeatures.onComplete, this.scope);\n\n this.scope.destroy();\n }\n\n\n\n /**\n * Marks the command as failed\n */\n async fail(error?: A_Error) {\n if (this.isProcessed) return;\n\n this._status = A_Command_Status.FAILED;\n if (error) {\n this._error = error;\n this.scope.register(error);\n }\n\n await this.call(A_CommandFeatures.onFail, this.scope);\n\n this.scope.destroy();\n }\n\n\n // -------------------------------------------------------------------------- \n // A-Command Event-Emitter methods\n // --------------------------------------------------------------------------\n\n /**\n * Registers an event listener for a specific event\n * \n * @param event \n * @param listener \n */\n on(event: LifecycleEvents | A_CommandEvent, listener: A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>) {\n if (!this._listeners.has(event)) {\n this._listeners.set(event, new Set());\n }\n this._listeners.get(event)!.add(listener);\n }\n /**\n * Removes an event listener for a specific event\n * \n * @param event \n * @param listener \n */\n off(event: LifecycleEvents | A_CommandEvent, listener: A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>) {\n this._listeners.get(event)?.delete(listener);\n }\n /**\n * Emits an event to all registered listeners\n * \n * @param event \n */\n emit(event: LifecycleEvents | keyof typeof A_CommandEvent) {\n this._listeners.get(event)?.forEach(async listener => {\n listener(this);\n });\n }\n\n\n // --------------------------------------------------------------------------\n // A-Entity Base Class Overrides\n // --------------------------------------------------------------------------\n // Serialization / Deserialization\n // -------------------------------------------------------------------------\n\n\n /**\n * Allows to create a Command instance from new data\n * \n * @param newEntity \n */\n fromNew(newEntity: InvokeType): void {\n super.fromNew(newEntity);\n\n this._origin = 'invoked';\n\n this._executionScope = new A_Scope({\n name: `A-Command-Execution-Scope-${this.aseid.toString()}`,\n components: [A_StateMachine],\n });\n\n this._createdAt = new Date();\n\n this._params = newEntity;\n\n this._status = A_Command_Status.CREATED;\n }\n\n\n\n /**\n * Allows to convert serialized data to Command instance\n * \n * [!] By default it omits params as they are not stored in the serialized data\n * \n * @param serialized \n */\n fromJSON(serialized: A_TYPES__Command_Serialized<InvokeType, ResultType>): void {\n super.fromJSON(serialized);\n\n this._origin = 'serialized';\n\n this._executionScope = new A_Scope({\n name: `A-Command-Execution-Scope-${this.aseid.toString()}`,\n components: [A_StateMachine],\n });\n\n if (serialized.createdAt) this._createdAt = new Date(serialized.createdAt);\n if (serialized.startedAt) this._startTime = new Date(serialized.startedAt);\n if (serialized.endedAt) this._endTime = new Date(serialized.endedAt);\n\n this._params = serialized.params\n this._status = serialized.status;\n\n if (serialized.error)\n this._error = new A_CommandError(serialized.error)\n\n if (serialized.result)\n this._result = serialized.result;\n }\n\n\n /**\n * Converts the Command instance to a plain object\n * \n * @returns \n */\n toJSON(): A_TYPES__Command_Serialized<InvokeType, ResultType> {\n return {\n ...super.toJSON(),\n code: this.code,\n status: this._status,\n params: this._params,\n createdAt: this._createdAt.toISOString(),\n startedAt: this._startTime ? this._startTime.toISOString() : undefined,\n endedAt: this._endTime ? this._endTime.toISOString() : undefined,\n duration: this.duration,\n idleTime: this.idleTime,\n result: this.result,\n error: this.error ? this.error.toJSON() : undefined,\n }\n };\n\n\n //============================================================================================\n // Helpers Methods\n //============================================================================================\n /**\n * Ensures that the command's execution scope inherits from the context scope\n * \n * Throws an error if the command is not bound to any context scope\n */\n protected checkScopeInheritance(): void {\n let attachedScope: A_Scope;\n\n try {\n attachedScope = A_Context.scope(this);\n } catch (error) {\n throw new A_CommandError({\n title: A_CommandError.CommandScopeBindingError,\n description: `Command ${this.aseid.toString()} is not bound to any context scope. Ensure the command is properly registered within a context before execution.`,\n originalError: error\n });\n }\n\n if (!this.scope.isInheritedFrom(A_Context.scope(this))) {\n this.scope.inherit(A_Context.scope(this));\n }\n }\n}\n\n","import { A_Context } from \"@adaas/a-concept\";\nimport { Ifspolyfill } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_FSPolyfillClass {\n private _fs!: Ifspolyfill;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n\n async get(): Promise<Ifspolyfill> {\n if (!this._initialized) {\n await this.init();\n }\n return this._fs;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment=== 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n this._fs = await import('fs') as Ifspolyfill;\n }\n\n private initBrowser(): void {\n this._fs = {\n readFileSync: (path: string, encoding: string) => {\n this.logger.warning('fs.readFileSync not available in browser environment');\n return '';\n },\n existsSync: (path: string) => {\n this.logger.warning('fs.existsSync not available in browser environment');\n return false;\n },\n createReadStream: (path: string) => {\n this.logger.warning('fs.createReadStream not available in browser environment');\n return null;\n }\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IcryptoInterface, Ifspolyfill } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_CryptoPolyfillClass {\n private _crypto!: IcryptoInterface;\n private _initialized: boolean = false;\n private _fsPolyfill?: Ifspolyfill;\n\n constructor(\n protected logger: A_Logger\n ) {\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n async get(fsPolyfill?: Ifspolyfill): Promise<IcryptoInterface> {\n if (!this._initialized) {\n this._fsPolyfill = fsPolyfill;\n await this.init();\n }\n return this._crypto;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const crypto = await import('crypto');\n this._crypto = {\n createTextHash: (text: string, algorithm: string = 'sha384') => Promise.resolve(\n `${algorithm}-${crypto.createHash(algorithm).update(text).digest('base64')}`\n ),\n createFileHash: (filePath: string, algorithm: string = 'sha384') => new Promise(async (resolve, reject) => {\n try {\n if (!this._fsPolyfill) {\n throw new Error('FS polyfill is required for file hashing');\n }\n const hash = crypto.createHash(algorithm);\n const fileStream = this._fsPolyfill.createReadStream(filePath);\n fileStream.on('data', (data: any) => hash.update(data));\n fileStream.on('end', () => resolve(`${algorithm}-${hash.digest('base64')}`));\n fileStream.on('error', (err: any) => reject(err));\n } catch (error) {\n reject(error);\n }\n })\n };\n }\n\n private initBrowser(): void {\n this._crypto = {\n createFileHash: () => {\n this.logger.warning('File hash not available in browser environment');\n return Promise.resolve('');\n },\n createTextHash: (text: string, algorithm: string = 'SHA-384') => new Promise<string>(async (resolve, reject) => {\n try {\n if (!crypto.subtle) {\n throw new Error('SubtleCrypto not available');\n }\n const encoder = new TextEncoder();\n const data = encoder.encode(text);\n const hashBuffer = await crypto.subtle.digest(algorithm, data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashBase64 = btoa(String.fromCharCode(...hashArray));\n resolve(`${algorithm}-${hashBase64}`);\n } catch (error) {\n reject(error);\n }\n })\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IhttpInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_HttpPolyfillClass {\n private _http!: IhttpInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n async get(): Promise<IhttpInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._http;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const httpModule = await import('http');\n this._http = {\n request: httpModule.request,\n get: httpModule.get,\n createServer: httpModule.createServer\n };\n }\n\n private initBrowser(): void {\n this._http = {\n request: (options: any, callback?: (res: any) => void) => {\n this.logger.warning('http.request not available in browser/test environment, use fetch instead');\n return this.createMockRequest(options, callback, false);\n },\n get: (url: string | any, callback?: (res: any) => void) => {\n this.logger.warning('http.get not available in browser/test environment, use fetch instead');\n return this.createMockRequest(typeof url === 'string' ? { hostname: url } : url, callback, false);\n },\n createServer: () => {\n this.logger.error('http.createServer not available in browser/test environment');\n return null;\n }\n };\n }\n\n private createMockRequest(options: any, callback?: (res: any) => void, isHttps: boolean = false) {\n // Return a mock request that doesn't make real network calls\n const request = {\n end: () => {\n // Mock response for all environments\n if (callback) {\n const mockResponse = {\n statusCode: 200,\n headers: {},\n on: (event: string, handler: Function) => {\n if (event === 'data') {\n setTimeout(() => handler('mock data'), 0);\n } else if (event === 'end') {\n setTimeout(() => handler(), 0);\n }\n },\n pipe: (dest: any) => {\n if (dest.write) dest.write('mock data');\n if (dest.end) dest.end();\n }\n };\n setTimeout(() => callback(mockResponse), 0);\n }\n },\n write: (data: any) => {\n // Mock write\n },\n on: (event: string, handler: Function) => {\n // Mock event handling\n }\n };\n\n return request;\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IhttpsInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_HttpsPolyfillClass {\n private _https!: IhttpsInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n async get(): Promise<IhttpsInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._https;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const httpsModule = await import('https');\n this._https = {\n request: httpsModule.request,\n get: httpsModule.get,\n createServer: httpsModule.createServer\n };\n }\n\n private initBrowser(): void {\n this._https = {\n request: (options: any, callback?: (res: any) => void) => {\n this.logger.warning('https.request not available in browser/test environment, use fetch instead');\n return this.createMockRequest(options, callback, true);\n },\n get: (url: string | any, callback?: (res: any) => void) => {\n this.logger.warning('https.get not available in browser/test environment, use fetch instead');\n return this.createMockRequest(typeof url === 'string' ? { hostname: url } : url, callback, true);\n },\n createServer: () => {\n this.logger.error('https.createServer not available in browser/test environment');\n return null;\n }\n };\n }\n\n private createMockRequest(options: any, callback?: (res: any) => void, isHttps: boolean = true) {\n // Return a mock request that doesn't make real network calls\n const request = {\n end: () => {\n // Mock response for all environments\n if (callback) {\n const mockResponse = {\n statusCode: 200,\n headers: {},\n on: (event: string, handler: Function) => {\n if (event === 'data') {\n setTimeout(() => handler('mock data'), 0);\n } else if (event === 'end') {\n setTimeout(() => handler(), 0);\n }\n },\n pipe: (dest: any) => {\n if (dest.write) dest.write('mock data');\n if (dest.end) dest.end();\n }\n };\n setTimeout(() => callback(mockResponse), 0);\n }\n },\n write: (data: any) => {\n // Mock write\n },\n on: (event: string, handler: Function) => {\n // Mock event handling\n }\n };\n\n return request;\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IpathInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_PathPolyfillClass {\n private _path!: IpathInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n\n async get(): Promise<IpathInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._path;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n this._path = await import('path') as IpathInterface;\n }\n\n private initBrowser(): void {\n this._path = {\n join: (...paths: string[]) => {\n return paths.join('/').replace(/\\/+/g, '/');\n },\n resolve: (...paths: string[]) => {\n let resolvedPath = '';\n for (const path of paths) {\n if (path.startsWith('/')) {\n resolvedPath = path;\n } else {\n resolvedPath = this._path.join(resolvedPath, path);\n }\n }\n return resolvedPath || '/';\n },\n dirname: (path: string) => {\n const parts = path.split('/');\n return parts.slice(0, -1).join('/') || '/';\n },\n basename: (path: string, ext?: string) => {\n const base = path.split('/').pop() || '';\n return ext && base.endsWith(ext) ? base.slice(0, -ext.length) : base;\n },\n extname: (path: string) => {\n const parts = path.split('.');\n return parts.length > 1 ? '.' + parts.pop() : '';\n },\n relative: (from: string, to: string) => {\n // Simplified relative path calculation\n return to.replace(from, '').replace(/^\\//, '');\n },\n normalize: (path: string) => {\n return path.replace(/\\/+/g, '/').replace(/\\/$/, '') || '/';\n },\n isAbsolute: (path: string) => {\n return path.startsWith('/') || /^[a-zA-Z]:/.test(path);\n },\n parse: (path: string) => {\n const ext = this._path.extname(path);\n const base = this._path.basename(path);\n const name = this._path.basename(path, ext);\n const dir = this._path.dirname(path);\n return { root: '/', dir, base, ext, name };\n },\n format: (pathObject: any) => {\n return this._path.join(pathObject.dir || '', pathObject.base || '');\n },\n sep: '/',\n delimiter: ':'\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IurlInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_UrlPolyfillClass {\n private _url!: IurlInterface;\n private _initialized: boolean = false;\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n async get(): Promise<IurlInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._url;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const urlModule = await import('url');\n this._url = {\n parse: urlModule.parse,\n format: urlModule.format,\n resolve: urlModule.resolve,\n URL: (urlModule.URL || globalThis.URL) as any,\n URLSearchParams: (urlModule.URLSearchParams || globalThis.URLSearchParams) as any\n };\n }\n\n private initBrowser(): void {\n this._url = {\n parse: (urlString: string) => {\n try {\n const url = new URL(urlString);\n return {\n protocol: url.protocol,\n hostname: url.hostname,\n port: url.port,\n pathname: url.pathname,\n search: url.search,\n hash: url.hash,\n host: url.host,\n href: url.href\n };\n } catch {\n return {};\n }\n },\n format: (urlObject: any) => {\n try {\n return new URL('', urlObject.href || `${urlObject.protocol}//${urlObject.host}${urlObject.pathname}${urlObject.search}${urlObject.hash}`).href;\n } catch {\n return '';\n }\n },\n resolve: (from: string, to: string) => {\n try {\n return new URL(to, from).href;\n } catch {\n return to;\n }\n },\n URL: globalThis.URL,\n URLSearchParams: globalThis.URLSearchParams\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IbufferInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_BufferPolyfillClass {\n private _buffer!: IbufferInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n\n async get(): Promise<IbufferInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._buffer;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const bufferModule = await import('buffer');\n this._buffer = {\n from: bufferModule.Buffer.from,\n alloc: bufferModule.Buffer.alloc,\n allocUnsafe: bufferModule.Buffer.allocUnsafe,\n isBuffer: bufferModule.Buffer.isBuffer,\n concat: bufferModule.Buffer.concat\n };\n }\n\n private initBrowser(): void {\n this._buffer = {\n from: (data: any, encoding?: string) => {\n if (typeof data === 'string') {\n return new TextEncoder().encode(data);\n }\n return new Uint8Array(data);\n },\n alloc: (size: number, fill?: any) => {\n const buffer = new Uint8Array(size);\n if (fill !== undefined) {\n buffer.fill(fill);\n }\n return buffer;\n },\n allocUnsafe: (size: number) => {\n return new Uint8Array(size);\n },\n isBuffer: (obj: any) => {\n return obj instanceof Uint8Array || obj instanceof ArrayBuffer;\n },\n concat: (list: any[], totalLength?: number) => {\n const length = totalLength || list.reduce((sum, buf) => sum + buf.length, 0);\n const result = new Uint8Array(length);\n let offset = 0;\n for (const buf of list) {\n result.set(buf, offset);\n offset += buf.length;\n }\n return result;\n }\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IprocessInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_ProcessPolyfillClass {\n private _process!: IprocessInterface;\n private _initialized: boolean = false;\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n async get(): Promise<IprocessInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._process;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private initServer(): void {\n this._process = {\n env: process.env as Record<string, string>,\n argv: process.argv,\n platform: process.platform,\n version: process.version,\n versions: process.versions as Record<string, string>,\n cwd: process.cwd,\n exit: process.exit,\n nextTick: process.nextTick\n };\n }\n\n private initBrowser(): void {\n this._process = {\n env: {\n NODE_ENV: 'browser',\n ...((globalThis as any).process?.env || {})\n },\n argv: ['browser'],\n platform: 'browser',\n version: 'browser',\n versions: { node: 'browser' },\n cwd: () => '/',\n exit: (code?: number) => {\n this.logger.warning('process.exit not available in browser');\n throw new Error(`Process exit with code ${code}`);\n },\n nextTick: (callback: Function, ...args: any[]) => {\n setTimeout(() => callback(...args), 0);\n }\n };\n }\n}","import { A_Component, A_Concept, A_Context, A_Inject } from \"@adaas/a-concept\";\nimport { A_Logger } from \"../A-Logger/A-Logger.component\";\nimport { A_FSPolyfillClass } from \"./classes/A-FS-Polyfill.class\";\nimport { A_CryptoPolyfillClass } from \"./classes/A-Crypto-Polyfill.class\";\nimport { A_HttpPolyfillClass } from \"./classes/A-Http-Polyfill.class\";\nimport { A_HttpsPolyfillClass } from \"./classes/A-Https-Polyfill.class\";\nimport { A_PathPolyfillClass } from \"./classes/A-Path-Polyfill.class\";\nimport { A_UrlPolyfillClass } from \"./classes/A-Url-Polyfill.class\";\nimport { A_BufferPolyfillClass } from \"./classes/A-Buffer-Polyfill.class\";\nimport { A_ProcessPolyfillClass } from \"./classes/A-Process-Polyfill.class\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-Polyfill',\n description: 'Polyfill component that provides cross-environment compatibility for Node.js core modules such as fs, crypto, http, https, path, url, buffer, and process. It dynamically loads appropriate polyfills based on the execution environment (Node.js or browser), enabling seamless usage of these modules in different contexts.'\n})\nexport class A_Polyfill extends A_Component {\n\n protected _fsPolyfill!: A_FSPolyfillClass;\n protected _cryptoPolyfill!: A_CryptoPolyfillClass;\n protected _httpPolyfill!: A_HttpPolyfillClass;\n protected _httpsPolyfill!: A_HttpsPolyfillClass;\n protected _pathPolyfill!: A_PathPolyfillClass;\n protected _urlPolyfill!: A_UrlPolyfillClass;\n protected _bufferPolyfill!: A_BufferPolyfillClass;\n protected _processPolyfill!: A_ProcessPolyfillClass;\n\n protected _initializing: Promise<void> | null = null;\n /**\n * Indicates whether the channel is connected\n */\n protected _initialized?: Promise<void>;\n\n\n constructor(\n @A_Inject(A_Logger) protected logger: A_Logger\n ) {\n super();\n }\n\n /**\n * Indicates whether the channel is connected\n */\n get ready(): Promise<void> {\n if (!this._initialized) {\n this._initialized = this._loadInternal();\n }\n return this._initialized;\n }\n\n\n\n @A_Concept.Load()\n async load() {\n await this.ready;\n }\n\n @A_Concept.Load()\n async attachToWindow() {\n if (A_Context.environment !== 'browser') return;\n\n\n (globalThis as any).A_Polyfill = this;\n // attach env variables\n (globalThis as any).process = { env: { NODE_ENV: 'production' }, cwd: () => \"/\" };\n (globalThis as any).__dirname = \"/\";\n\n }\n\n\n protected async _loadInternal() {\n\n this._fsPolyfill = new A_FSPolyfillClass(this.logger);\n this._cryptoPolyfill = new A_CryptoPolyfillClass(this.logger);\n this._httpPolyfill = new A_HttpPolyfillClass(this.logger);\n this._httpsPolyfill = new A_HttpsPolyfillClass(this.logger);\n this._pathPolyfill = new A_PathPolyfillClass(this.logger);\n this._urlPolyfill = new A_UrlPolyfillClass(this.logger);\n this._bufferPolyfill = new A_BufferPolyfillClass(this.logger);\n this._processPolyfill = new A_ProcessPolyfillClass(this.logger);\n\n // Initialize all polyfills to ensure they're ready\n await this._fsPolyfill.get();\n await this._cryptoPolyfill.get(await this._fsPolyfill.get());\n await this._httpPolyfill.get();\n await this._httpsPolyfill.get();\n await this._pathPolyfill.get();\n await this._urlPolyfill.get();\n await this._bufferPolyfill.get();\n await this._processPolyfill.get();\n }\n\n /**\n * Allows to use the 'fs' polyfill methods regardless of the environment\n * This method loads the 'fs' polyfill and returns its instance\n * \n * @returns \n */\n async fs() {\n await this.ready;\n\n return await this._fsPolyfill.get();\n }\n\n /**\n * Allows to use the 'crypto' polyfill methods regardless of the environment\n * This method loads the 'crypto' polyfill and returns its instance\n * \n * @returns \n */\n async crypto() {\n await this.ready;\n\n return await this._cryptoPolyfill.get();\n }\n\n /**\n * Allows to use the 'http' polyfill methods regardless of the environment\n * This method loads the 'http' polyfill and returns its instance\n * \n * @returns \n */\n async http() {\n await this.ready;\n\n return await this._httpPolyfill.get();\n }\n\n /**\n * Allows to use the 'https' polyfill methods regardless of the environment\n * This method loads the 'https' polyfill and returns its instance\n * \n * @returns \n */\n async https() {\n await this.ready;\n\n return await this._httpsPolyfill.get();\n }\n\n /**\n * Allows to use the 'path' polyfill methods regardless of the environment\n * This method loads the 'path' polyfill and returns its instance\n * \n * @returns \n */\n async path() {\n await this.ready;\n\n return await this._pathPolyfill.get();\n }\n\n /**\n * Allows to use the 'url' polyfill methods regardless of the environment\n * This method loads the 'url' polyfill and returns its instance\n * \n * @returns \n */\n async url() {\n await this.ready;\n\n return await this._urlPolyfill.get();\n }\n\n /**\n * Allows to use the 'buffer' polyfill methods regardless of the environment\n * This method loads the 'buffer' polyfill and returns its instance\n * \n * @returns \n */\n async buffer() {\n await this.ready;\n\n return await this._bufferPolyfill.get();\n }\n\n /**\n * Allows to use the 'process' polyfill methods regardless of the environment\n * This method loads the 'process' polyfill and returns its instance\n * \n * @returns \n */\n async process() {\n await this.ready;\n\n return await this._processPolyfill.get();\n }\n}","import { A_Component, A_Concept, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_Container, A_Context, A_Dependency, A_Feature, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_Config } from \"../A-Config.context\";\nimport { A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY } from \"../A-Config.constants\";\nimport { A_Polyfill } from \"../../A-Polyfill/A-Polyfill.component\";\nimport { A_Memory } from \"../../A-Memory/A-Memory.component\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * Config Reader\n */\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'ConfigReader',\n description: 'Abstract component for reading configuration data from various sources such as files, environment variables, or remote services. This component can be extended to implement specific configuration reading strategies.'\n})\nexport class ConfigReader extends A_Component {\n\n protected DEFAULT_ALLOWED_TO_READ_PROPERTIES = [\n ...A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,\n ...A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY\n ];\n\n constructor(\n @A_Dependency.Required()\n @A_Inject(A_Polyfill) protected polyfill: A_Polyfill,\n ) {\n super();\n }\n\n @A_Concept.Load()\n async attachContext(\n @A_Inject(A_Container) container: A_Container,\n @A_Inject(A_Scope) context: A_Scope,\n @A_Inject(A_Config) config?: A_Config<any>,\n ) {\n if (!config) {\n config = new A_Config({\n defaults: {}\n });\n\n container.scope.register(config);\n }\n\n const rootDir = await this.getProjectRoot();\n\n config.set('A_CONCEPT_ROOT_FOLDER', rootDir);\n }\n\n @A_Concept.Load()\n async initialize(\n @A_Dependency.Required()\n @A_Inject(A_Config) config: A_Config,\n ) {\n const data = await this.read();\n\n for (const key in data) {\n config.set(key, data[key]);\n }\n }\n\n /**\n * Get the configuration property by Name\n * @param property \n */\n resolve<_ReturnType = any>(property: string): _ReturnType {\n return property as _ReturnType;\n }\n\n /**\n * This method reads the configuration and sets the values to the context\n * \n * @returns \n */\n async read<T extends string>(\n variables: Array<T> = []\n ): Promise<Record<T, any>> {\n return {} as Record<T, any>;\n }\n\n\n /**\n * Finds the root directory of the project by locating the folder containing package.json\n * \n * @param {string} startPath - The initial directory to start searching from (default is __dirname)\n * @returns {string|null} - The path to the root directory or null if package.json is not found\n */\n protected async getProjectRoot(startPath = __dirname) {\n const process = await this.polyfill.process();\n\n return process.cwd();\n }\n}","import { A_Context, A_FormatterHelper } from \"@adaas/a-concept\";\nimport { ConfigReader } from \"./ConfigReader.component\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'FileConfigReader',\n description: 'Configuration reader that loads configuration data from a JSON file located in the application root directory. It reads the file named after the current concept with a .conf.json extension and parses its contents into the configuration context.'\n})\nexport class FileConfigReader extends ConfigReader {\n\n private FileData: Map<string, any> = new Map<string, any>();\n\n /**\n * Get the configuration property Name\n * @param property \n */\n getConfigurationProperty_File_Alias(property: string): string {\n return A_FormatterHelper.toCamelCase(property);\n }\n\n\n resolve<_ReturnType = any>(property: string): _ReturnType {\n return this.FileData.get(this.getConfigurationProperty_File_Alias(property)) as _ReturnType;\n }\n\n\n async read<T extends string>(\n variables?: Array<T>\n ): Promise<Record<T, any>> {\n\n const fs = await this.polyfill.fs();\n\n try {\n const data = fs.readFileSync(`${A_Context.concept}.conf.json`, 'utf8');\n\n const config: Record<T, any> = JSON.parse(data);\n\n this.FileData = new Map(Object.entries(config));\n\n return config;\n\n } catch (error) {\n // this.context.Logger.error(error);\n return {} as Record<T, any>;\n }\n }\n}\n","import { A_Concept, A_Feature, A_FormatterHelper, A_Inject, A_TYPES__ConceptENVVariables } from \"@adaas/a-concept\";\nimport { ConfigReader } from \"./ConfigReader.component\";\nimport { A_Config } from \"../A-Config.context\";\nimport { A_Polyfill } from \"../../A-Polyfill/A-Polyfill.component\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'ENVConfigReader',\n description: 'Configuration reader that sources configuration data from environment variables. It supports loading variables from a .env file and maps them to the configuration context, making it suitable for applications running in diverse environments such as local development, staging, and production.'\n})\nexport class ENVConfigReader extends ConfigReader {\n\n\n @A_Concept.Load({\n before: ['ENVConfigReader.initialize']\n })\n async readEnvFile(\n @A_Inject(A_Config) config: A_Config<A_TYPES__ConceptENVVariables>,\n @A_Inject(A_Polyfill) polyfill: A_Polyfill,\n @A_Inject(A_Feature) feature: A_Feature,\n\n ) {\n const fs = await polyfill.fs();\n\n if (fs.existsSync('.env'))\n fs.readFileSync(`${config.get('A_CONCEPT_ROOT_FOLDER')}/.env`, 'utf-8').split('\\n').forEach(line => {\n const [key, value] = line.split('=');\n if (key && value) {\n process.env[key.trim()] = value.trim();\n }\n });\n }\n\n\n /**\n * Get the configuration property Name \n * @param property \n */\n getConfigurationProperty_ENV_Alias(property: string): string {\n return A_FormatterHelper.toUpperSnakeCase(property);\n }\n\n\n resolve<_ReturnType = any>(property: string): _ReturnType {\n return process.env[this.getConfigurationProperty_ENV_Alias(property)] as _ReturnType;\n }\n\n\n async read<T extends string>(variables: Array<T> = []): Promise<Record<T, any>> {\n const allVariables = [\n ...variables,\n ...Object.keys(process.env),\n ]\n\n const config: Record<T, any> = {} as Record<T, any>;\n\n allVariables.forEach(variable => {\n config[variable] = this.resolve(variable);\n });\n\n return config;\n }\n} ","import { A_Caller, A_Concept, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_Container, A_Context, A_Fragment, A_Inject, A_Scope, A_ScopeError } from \"@adaas/a-concept\";\nimport { ConfigReader } from \"./components/ConfigReader.component\";\nimport { A_Config } from \"./A-Config.context\";\nimport { A_Polyfill } from \"../A-Polyfill/A-Polyfill.component\";\nimport { A_ConfigError } from \"./A-Config.error\";\nimport { FileConfigReader } from \"./components/FileConfigReader.component\";\nimport { ENVConfigReader } from \"./components/ENVConfigReader.component\";\nimport { A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY } from \"./A-Config.constants\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Container({\n namespace: 'A-Utils',\n name: 'A-ConfigLoader',\n description: 'Container responsible for loading and initializing the A_Config component based on the environment and available configuration sources. It can be useful for application that need a separated configuration management and sharable across multiple containers.'\n})\nexport class A_ConfigLoader extends A_Container {\n\n private reader!: ConfigReader\n\n\n @A_Concept.Load({\n before: /.*/\n })\n async prepare(\n @A_Inject(A_Polyfill) polyfill: A_Polyfill\n ) {\n if (!this.scope.has(A_Config)) {\n const newConfig = new A_Config({\n variables: [\n ...A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,\n ...A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY\n ] as const,\n defaults: {}\n });\n\n this.scope.register<A_Fragment>(newConfig);\n }\n\n\n const fs = await polyfill.fs();\n\n try {\n switch (true) {\n\n case A_Context.environment === 'server' && !!fs.existsSync(`${A_Context.concept}.conf.json`):\n this.reader = this.scope.resolve<ConfigReader>(FileConfigReader)!;\n break;\n\n case A_Context.environment === 'server' && !fs.existsSync(`${A_Context.concept}.conf.json`):\n this.reader = this.scope.resolve<ConfigReader>(ENVConfigReader)!;\n break;\n\n case A_Context.environment === 'browser':\n this.reader = this.scope.resolve<ConfigReader>(ENVConfigReader)!;\n break;\n\n default:\n throw new A_ConfigError(\n A_ConfigError.InitializationError,\n `Environment ${A_Context.environment} is not supported`\n );\n }\n } catch (error) {\n if (error instanceof A_ScopeError) {\n throw new A_ConfigError({\n title: A_ConfigError.InitializationError,\n description: `Failed to initialize A_ConfigLoader. Reader not found for environment ${A_Context.environment}`,\n originalError: error,\n })\n }\n }\n }\n}","import { A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor } from \"@adaas/a-concept\";\n\nexport enum A_TYPES__ConfigFeature {\n\n}\n\n\nexport type A_TYPES__ConfigContainerConstructor<T extends Array<string | A_TYPES__ConceptENVVariables[number]>> = {\n\n /**\n * If set to true, the SDK will throw an error if the variable is not defined OR not presented in the defaults\n */\n strict: boolean\n\n /**\n * Allows to define the names of variable to be loaded\n */\n variables: T\n\n /**\n * Allows to set the default values for the variables\n */\n defaults: {\n [key in T[number]]?: any\n }\n} & A_TYPES__Fragment_Constructor;\n","\n\nexport const A_LoggerEnvVariables = {\n /**\n * Sets the log level for the logger\n * \n * @example 'debug', 'info', 'warn', 'error'\n */\n A_LOGGER_LEVEL: 'A_LOGGER_LEVEL',\n\n /** \n * Sets the default scope length for log messages\n * \n * @example 'A_LOGGER_DEFAULT_SCOPE_LENGTH'\n */\n A_LOGGER_DEFAULT_SCOPE_LENGTH: 'A_LOGGER_DEFAULT_SCOPE_LENGTH',\n\n /**\n * Sets the default color for scope display in log messages\n * \n * @example 'green', 'blue', 'red', 'yellow', 'gray', 'magenta', 'cyan', 'white', 'pink'\n */\n A_LOGGER_DEFAULT_SCOPE_COLOR: 'A_LOGGER_DEFAULT_SCOPE_COLOR',\n\n /**\n * Sets the default color for log message content\n * \n * @example 'green', 'blue', 'red', 'yellow', 'gray', 'magenta', 'cyan', 'white', 'pink'\n */\n A_LOGGER_DEFAULT_LOG_COLOR: 'A_LOGGER_DEFAULT_LOG_COLOR',\n} as const;\n\n\n\nexport const A_LoggerEnvVariablesArray = [\n A_LoggerEnvVariables.A_LOGGER_LEVEL,\n A_LoggerEnvVariables.A_LOGGER_DEFAULT_SCOPE_LENGTH,\n A_LoggerEnvVariables.A_LOGGER_DEFAULT_SCOPE_COLOR,\n A_LoggerEnvVariables.A_LOGGER_DEFAULT_LOG_COLOR,\n] as const;\n\n\nexport type A_LoggerEnvVariablesType = (typeof A_LoggerEnvVariables)[keyof typeof A_LoggerEnvVariables][];","import { A_Error } from \"@adaas/a-concept\";\n\nexport class A_ManifestError extends A_Error {\n\n static readonly ManifestInitializationError = 'A-Manifest Initialization Error';\n\n}\n","import { A_TYPES__Component_Constructor } from \"@adaas/a-concept\";\nimport { A_Manifest } from \"../A-Manifest.context\";\nimport { A_UTILS_TYPES__Manifest_AllowedComponents } from \"../A-Manifest.types\";\n\n/**\n * Fluent API for checking manifest permissions\n */\nexport class A_ManifestChecker {\n constructor(\n private manifest: A_Manifest,\n private component: A_TYPES__Component_Constructor,\n private method: string,\n private checkExclusion: boolean = false\n ) {}\n\n for(target: A_UTILS_TYPES__Manifest_AllowedComponents): boolean {\n const result = this.manifest.internal_checkAccess({\n component: this.component,\n method: this.method,\n target: target\n });\n\n return this.checkExclusion ? !result : result;\n }\n}","import { A_Component, A_Fragment, A_TypeGuards, A_TYPES__Component_Constructor } from \"@adaas/a-concept\";\nimport { A_UTILS_TYPES__Manifest_Init, A_UTILS_TYPES__Manifest_ComponentLevelConfig, A_UTILS_TYPES__Manifest_AllowedComponents, A_UTILS_TYPES__ManifestRule, A_UTILS_TYPES__ManifestQuery } from \"./A-Manifest.types\";\nimport { A_ManifestError } from \"./A-Manifest.error\";\nimport { A_ManifestChecker } from \"./classes/A-ManifestChecker.class\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-Manifest',\n description: 'A-Manifest is a configuration fragment that allows to include or exclude component application for particular methods. It provides fine-grained control over which components are applied to which targets and methods within the application, enabling flexible and dynamic behavior based on defined rules.'\n})\nexport class A_Manifest extends A_Fragment {\n\n private rules: A_UTILS_TYPES__ManifestRule[] = [];\n\n /**\n * A-Manifest is a configuration set that allows to include or exclude component application for the particular methods.\n *\n * For example, if A-Scope provides polymorphic A-Component that applies for All A-Entities in it but you have another component that should be used for only One particular Entity, you can use A-Manifest to specify this behavior.\n * \n * \n * By default if Component is provided in the scope - it applies for all entities in it. However, if you want to exclude some entities or include only some entities for the particular component - you can use A-Manifest to define this behavior.\n * \n * @param config - Array of component configurations\n */\n constructor(config: A_UTILS_TYPES__Manifest_Init = []) {\n super({\n name: 'A-Manifest',\n });\n\n this.prepare(config);\n }\n\n\n /**\n * Should convert received configuration into internal Regexp applicable for internal storage\n */\n protected prepare(config: A_UTILS_TYPES__Manifest_Init) {\n if (!A_TypeGuards.isArray(config))\n throw new A_ManifestError(\n A_ManifestError.ManifestInitializationError,\n `A-Manifest configuration should be an array of configurations`\n );\n\n for (const item of config) {\n this.processConfigItem(item);\n }\n }\n\n /**\n * Process a single configuration item and convert it to internal rules\n */\n private processConfigItem(item: A_UTILS_TYPES__Manifest_ComponentLevelConfig) {\n if (!A_TypeGuards.isComponentConstructor(item.component))\n throw new A_ManifestError(\n A_ManifestError.ManifestInitializationError,\n `A-Manifest configuration item should be a A-Component constructor`\n );\n\n const componentRegex = this.constructorToRegex(item.component);\n\n // Always add component-level rule first (applies to all methods)\n if (item.apply || item.exclude) {\n const methodRegex = /.*/; // Match all methods\n\n this.rules.push({\n componentRegex,\n methodRegex,\n applyRegex: item.apply ? this.allowedComponentsToRegex(item.apply) : undefined,\n excludeRegex: item.exclude ? this.allowedComponentsToRegex(item.exclude) : undefined,\n });\n }\n\n // Then add method-level configurations (these will override component-level)\n if (item.methods && item.methods.length > 0) {\n for (const methodConfig of item.methods) {\n const methodRegex = this.methodToRegex(methodConfig.method);\n\n this.rules.push({\n componentRegex,\n methodRegex,\n applyRegex: methodConfig.apply ? this.allowedComponentsToRegex(methodConfig.apply) : undefined,\n excludeRegex: methodConfig.exclude ? this.allowedComponentsToRegex(methodConfig.exclude) : undefined,\n });\n }\n }\n }\n\n\n\n /**\n * Convert a constructor to a regex pattern\n */\n private constructorToRegex(ctor: A_TYPES__Component_Constructor): RegExp {\n return new RegExp(`^${this.escapeRegex(ctor.name)}$`);\n }\n\n /**\n * Convert a method name or regex to a regex pattern\n */\n private methodToRegex(method: string | RegExp): RegExp {\n if (method instanceof RegExp) {\n return method;\n }\n return new RegExp(`^${this.escapeRegex(method as string)}$`);\n }\n\n /**\n * Convert allowed components array or regex to a single regex\n */\n private allowedComponentsToRegex(components: A_UTILS_TYPES__Manifest_AllowedComponents[] | RegExp): RegExp {\n if (components instanceof RegExp) {\n return components;\n }\n\n const patterns = components.map(ctor => this.escapeRegex(ctor.name));\n return new RegExp(`^(${patterns.join('|')})$`);\n }\n\n /**\n * Escape special regex characters in a string\n */\n private escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n }\n\n protected configItemToRegexp(item: A_TYPES__Component_Constructor): RegExp {\n return this.constructorToRegex(item);\n }\n\n\n protected ID(component: A_TYPES__Component_Constructor, method: string) {\n return `${component.name}.${method}`;\n }\n\n /**\n * Check if a component and method combination is allowed for a target\n */\n isAllowed<T extends A_Component>(\n ctor: T | A_TYPES__Component_Constructor<T>,\n method: string\n ): A_ManifestChecker {\n const componentCtor = typeof ctor === 'function' ? ctor : ctor.constructor as A_TYPES__Component_Constructor;\n return new A_ManifestChecker(this, componentCtor, method);\n }\n\n /**\n * Internal method to check if access is allowed\n */\n internal_checkAccess(query: A_UTILS_TYPES__ManifestQuery): boolean {\n const componentName = query.component.name;\n const methodName = query.method;\n const targetName = query.target.name;\n\n // Find matching rules, sorted by specificity (method-specific rules first)\n const matchingRules = this.rules\n .filter(rule =>\n rule.componentRegex.test(componentName) &&\n rule.methodRegex.test(methodName)\n )\n .sort((a, b) => {\n // Method-specific rules (not .* pattern) should come before general rules\n const aIsGeneral = a.methodRegex.source === '.*';\n const bIsGeneral = b.methodRegex.source === '.*';\n\n if (aIsGeneral && !bIsGeneral) return 1; // b comes first\n if (!aIsGeneral && bIsGeneral) return -1; // a comes first\n return 0; // same priority\n });\n\n // If no rules match, allow by default\n if (matchingRules.length === 0) {\n return true;\n }\n\n // Process rules in order of specificity (most specific first)\n for (const rule of matchingRules) {\n // If this rule has an exclusion that matches, deny access\n if (rule.excludeRegex && rule.excludeRegex.test(targetName)) {\n return false;\n }\n\n // If this rule has an apply list, check if target is in it\n if (rule.applyRegex) {\n return rule.applyRegex.test(targetName);\n }\n }\n\n // If we have rules but no specific apply/exclude, allow by default\n return true;\n }\n\n isExcluded<T extends A_Component>(\n ctor: T | A_TYPES__Component_Constructor<T>,\n method: string\n ): A_ManifestChecker {\n const componentCtor = typeof ctor === 'function' ? ctor : ctor.constructor as A_TYPES__Component_Constructor;\n return new A_ManifestChecker(this, componentCtor, method, true);\n }\n}\n","\n\nexport enum A_MemoryFeatures {\n /**\n * Allows to extend initialization logic and behavior\n */\n onInit = '_A_Memory_onInit',\n\n /**\n * Allows to extend destruction logic and behavior\n */\n onDestroy = '_A_Memory_onDestroy',\n\n /**\n * Allows to extend expiration logic and behavior\n */\n onExpire = '_A_Memory_onExpire',\n\n /**\n * Allows to extend error handling logic and behavior\n */\n onError = '_A_Memory_onError',\n\n /**\n * Allows to extend serialization logic and behavior\n */\n onSerialize = '_A_Memory_onSerialize',\n\n /**\n * Allows to extend set operation logic and behavior\n */\n onSet = '_A_Memory_onSet',\n /**\n * Allows to extend get operation logic and behavior\n */\n onGet = '_A_Memory_onGet',\n /**\n * Allows to extend drop operation logic and behavior\n */\n onDrop = '_A_Memory_onDrop',\n /**\n * Allows to extend clear operation logic and behavior\n */\n onClear = '_A_Memory_onClear',\n /**\n * Allows to extend has operation logic and behavior\n */\n onHas = '_A_Memory_onHas',\n}","import { A_Error, A_Fragment, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame\";\nimport { error } from \"console\";\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-MemoryContext',\n description: 'In-memory context fragment that provides a simple key-value store for temporary data storage during application runtime. It allows setting, getting, deleting, and checking the existence of key-value pairs, facilitating quick access to transient data without persistent storage. This context is useful for scenarios where data needs to be shared across different components or operations within the same execution context.'\n})\nexport class A_MemoryContext<\n _MemoryType extends Record<string, any> = Record<string, any>,\n _SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized\n> extends A_Fragment {\n protected _storage: Map<keyof _MemoryType, _MemoryType[keyof _MemoryType]> = new Map();\n\n set<K extends keyof _MemoryType>(param: K, value: _MemoryType[K]): void {\n this._storage.set(param, value);\n }\n\n\n get<K extends keyof _MemoryType>(param: K): _MemoryType[K] | undefined {\n return this._storage.get(param);\n }\n\n\n delete<K extends keyof _MemoryType>(param: K): void {\n this._storage.delete(param);\n }\n\n\n has<K extends keyof _MemoryType>(param: K): boolean {\n return this._storage.has(param);\n }\n\n clear(): void {\n this._storage.clear();\n }\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_MemoryError extends A_Error {\n\n static readonly MemoryInitializationError = 'Memory initialization error';\n\n static readonly MemoryDestructionError = 'Memory destruction error';\n\n static readonly MemoryGetError = 'Memory GET operation failed';\n\n static readonly MemorySetError = 'Memory SET operation failed';\n\n static readonly MemoryDropError = 'Memory DROP operation failed';\n\n static readonly MemoryClearError = 'Memory CLEAR operation failed';\n\n static readonly MemoryHasError = 'Memory HAS operation failed';\n\n static readonly MemorySerializeError = 'Memory toJSON operation failed';\n}\n","import { A_Component, A_Inject, A_Scope, A_Feature, A_Dependency, A_Context } from \"@adaas/a-concept\";\nimport { A_MemoryFeatures } from \"./A-Memory.constants\";\nimport { A_MemoryContext } from \"./A-Memory.context\";\nimport { A_MemoryError } from \"./A-Memory.error\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_MemoryOperationContext } from \"./A-Memory.types\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-Memory',\n description: 'In-memory data storage component that provides a simple key-value store with asynchronous operations. It supports basic memory operations such as get, set, has, drop, and clear, along with lifecycle management and error handling features. This components features can be extended with other components to provide ability store data across multiple storage, or extract data from multiple external sources. Good example is to store some runtime data that needs to be shared across multiple containers or concepts.'\n})\nexport class A_Memory<\n _StorageType extends Record<string, any> = Record<string, any>,\n _SerializedType extends Record<string, any> = Record<string, any>\n> extends A_Component {\n\n protected _ready?: Promise<void>\n\n\n get ready(): Promise<void> {\n if (!this._ready) {\n this._ready = this.init();\n }\n return this._ready;\n }\n\n // ======================================================================\n // ======================A-Memory Lifecycle Hooks========================\n // ======================================================================\n\n @A_Feature.Extend()\n /**\n * Handles errors during memory operations\n */\n async [A_MemoryFeatures.onError](...args: any[]): Promise<void> {\n // Handle error\n }\n\n @A_Feature.Extend()\n /**\n * Handles memory expiration\n */\n async [A_MemoryFeatures.onExpire](...args: any[]): Promise<void> {\n // Clear memory on expire\n }\n\n @A_Feature.Extend()\n /**\n * Initializes the memory context\n */\n async [A_MemoryFeatures.onInit](\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Initialize memory\n if (!context) {\n context = new A_MemoryContext<_StorageType>();\n A_Context.scope(this).register(context);\n }\n }\n\n @A_Feature.Extend()\n async [A_MemoryFeatures.onDestroy](\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]): Promise<void> {\n // Cleanup memory\n context.clear();\n }\n\n /**\n * Handles the 'get' operation for retrieving a value from memory\n */\n @A_Feature.Extend()\n async [A_MemoryFeatures.onGet](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle get operation\n operation.succeed(context.get(operation.params.key));\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'has' operation for checking existence of a key in memory\n */\n async [A_MemoryFeatures.onHas](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext<boolean>,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle has operation\n operation.succeed(context.has(operation.params.key));\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'set' operation for saving a value in memory\n */\n async [A_MemoryFeatures.onSet](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n @A_Inject(A_Scope) scope: A_Scope,\n ...args: any[]\n ): Promise<void> {\n // Handle set operation\n context.set(operation.params.key, operation.params.value);\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'drop' operation for removing a value from memory\n */\n async [A_MemoryFeatures.onDrop](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle drop operation\n context.delete(operation.params.key);\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'clear' operation for clearing all values from memory\n */\n async [A_MemoryFeatures.onClear](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle clear operation\n context.clear();\n }\n\n\n\n // ======================================================================\n // =========================A-Memory Methods=============================\n // ======================================================================\n\n /**\n * Initializes the memory context\n */\n async init() {\n if (this._ready)\n return this._ready;\n\n const scope = new A_Scope({ name: 'A-Memory-Init-Scope' })\n .inherit(A_Context.scope(this));\n\n try {\n await this.call(A_MemoryFeatures.onInit, scope);\n\n } catch (error) {\n const initError = new A_MemoryError({\n title: A_MemoryError.MemoryInitializationError,\n description: 'An error occurred during memory initialization',\n originalError: error\n })\n\n scope.register(initError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw initError;\n }\n }\n\n /**\n * Destroys the memory context\n *\n * This method is responsible for cleaning up any resources\n * used by the memory context and resetting its state.\n */\n async destroy() {\n\n const scope = new A_Scope({ name: 'A-Memory-Destroy-Scope' })\n .inherit(A_Context.scope(this));\n\n try {\n this._ready = undefined;\n\n await this.call(A_MemoryFeatures.onDestroy, scope);\n\n } catch (error) {\n const destroyError = new A_MemoryError({\n title: A_MemoryError.MemoryDestructionError,\n description: 'An error occurred during memory destruction',\n originalError: error\n })\n\n scope.register(destroyError);\n\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw destroyError;\n }\n }\n\n /**\n * Retrieves a value from the context memory\n * \n * @param key - memory key to retrieve\n * @returns - value associated with the key or undefined if not found\n */\n async get<K extends keyof _StorageType>(\n /**\n * Key to retrieve the value for\n */\n key: K\n ): Promise<_StorageType[K] | undefined> {\n\n const operation = new A_OperationContext('get', { key });\n\n const scope = new A_Scope({\n name: 'A-Memory-Get-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onGet, scope);\n\n scope.destroy();\n\n return operation.result;\n\n } catch (error) {\n const getError = new A_MemoryError({\n title: A_MemoryError.MemoryGetError,\n description: `An error occurred while getting the value for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(getError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw getError;\n }\n }\n\n /**\n * Checks if a value exists in the context memory\n * \n * @param key - memory key to check\n * @returns - true if key exists, false otherwise\n */\n async has(key: keyof _StorageType): Promise<boolean> {\n const operation = new A_OperationContext('has', { key });\n\n const scope = new A_Scope({\n name: 'A-Memory-Has-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onHas, scope);\n\n scope.destroy();\n\n return operation.result;\n\n } catch (error) {\n const getError = new A_MemoryError({\n title: A_MemoryError.MemoryHasError,\n description: `An error occurred while checking existence for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(getError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw getError;\n }\n }\n\n /**\n * Saves a value in the context memory\n * \n * @param key \n * @param value \n */\n async set<K extends keyof _StorageType>(\n /**\n * Key to save the value under\n */\n key: K,\n /**\n * Value to save\n */\n value: _StorageType[K]\n ): Promise<void> {\n const operation = new A_OperationContext('set', { key, value });\n\n const scope = new A_Scope({\n name: 'A-Memory-Set-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onSet, scope);\n\n } catch (error) {\n const setError = new A_MemoryError({\n title: A_MemoryError.MemorySetError,\n description: `An error occurred while setting the value for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(setError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw setError;\n }\n }\n\n\n /**\n * Removes a value from the context memory by key\n * \n * @param key \n */\n async drop(key: keyof _StorageType): Promise<void> {\n\n const operation = new A_OperationContext('drop', { key });\n\n const scope = new A_Scope({\n name: 'A-Memory-Drop-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onDrop, scope);\n\n } catch (error) {\n const dropError = new A_MemoryError({\n title: A_MemoryError.MemoryDropError,\n description: `An error occurred while dropping the value for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(dropError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw dropError;\n }\n }\n\n /**\n * Clears all stored values in the context memory\n */\n async clear(): Promise<void> {\n const operation = new A_OperationContext('clear');\n\n const scope = new A_Scope({\n name: 'A-Memory-Clear-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onClear, scope);\n\n } catch (error) {\n const clearError = new A_MemoryError({\n title: A_MemoryError.MemoryClearError,\n description: `An error occurred while clearing the memory`,\n originalError: error\n });\n\n scope.register(clearError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw clearError;\n }\n }\n\n\n /**\n * Serializes the memory context to a JSON object\n * \n * @returns - serialized memory object \n */\n async toJSON(): Promise<_SerializedType> {\n const operation = new A_OperationContext('serialize');\n\n const scope = new A_Scope({\n name: 'A-Memory-Serialize-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onSerialize, scope);\n\n return operation.result as _SerializedType;\n\n } catch (error) {\n const serializeError = new A_MemoryError({\n title: A_MemoryError.MemorySerializeError,\n description: `An error occurred while serializing the memory`,\n originalError: error\n });\n\n scope.register(serializeError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw serializeError;\n }\n\n }\n}","export enum A_ServiceFeatures {\n\n onBeforeLoad = '_A_Service_onBeforeLoad',\n onLoad = '_A_Service_onLoad',\n onAfterLoad = '_A_Service_onAfterLoad',\n\n onBeforeStart = '_A_Service_onBeforeStart',\n onStart = '_A_Service_onStart',\n onAfterStart = '_A_Service_onAfterStart',\n\n onBeforeStop = '_A_Service_onBeforeStop',\n onStop = '_A_Service_onStop',\n onAfterStop = '_A_Service_onAfterStop',\n\n\n onError = '_A_Service_onError',\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\n\nexport class A_Service_Error extends A_Error {\n\n static readonly ServiceLoadError = 'Service load error';\n\n static readonly ServiceStartError = 'Service start error';\n\n static readonly ServiceStopError = 'Service stop error';\n\n \n\n}","import { A_Concept, A_Container, A_Error, A_Feature, A_Inject } from \"@adaas/a-concept\";\nimport { A_ServiceFeatures } from \"./A-Service.constants\";\nimport { A_Polyfill } from \"../A-Polyfill/A-Polyfill.component\";\nimport { A_Config } from \"../A-Config/A-Config.context\";\nimport { A_Logger } from \"../A-Logger/A-Logger.component\";\nimport { A_Service_Error } from \"./A-Service.error\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n/**\n * A-Service is a container that can run different types of services, such as HTTP servers, workers, etc.\n * Depending on the provided config and configuration, it will load the necessary components and start the service.\n * \n */\n@A_Frame.Container({\n namespace: 'A-Utils',\n name: 'A-Service',\n description: 'Service container that manages the lifecycle of various types of services, such as HTTP servers and workers or UI loader. It dynamically loads necessary components based on the provided configuration and orchestrates the start and stop processes, ensuring proper error handling and extensibility through feature hooks.'\n})\nexport class A_Service extends A_Container {\n\n\n @A_Concept.Load()\n /**\n * Load the service\n */\n async load() {\n try {\n await this.call(A_ServiceFeatures.onBeforeLoad);\n\n await this.call(A_ServiceFeatures.onLoad);\n\n await this.call(A_ServiceFeatures.onAfterLoad);\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_Service_Error:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_Service_Error:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_Service_Error({\n title: A_Service_Error.ServiceLoadError,\n description: 'An error occurred while processing the request.',\n originalError: error\n })\n break;\n }\n\n this.scope.register(wrappedError);\n\n await this.call(A_ServiceFeatures.onError);\n }\n\n }\n\n\n @A_Concept.Start()\n /**\n * Start the server\n */\n async start() {\n try {\n await this.call(A_ServiceFeatures.onBeforeStart);\n\n await this.call(A_ServiceFeatures.onStart);\n\n await this.call(A_ServiceFeatures.onAfterStart);\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_Service_Error:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_Service_Error:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_Service_Error({\n title: A_Service_Error.ServiceStartError,\n description: 'An error occurred while processing the request.',\n originalError: error\n })\n break;\n }\n\n this.scope.register(wrappedError);\n\n await this.call(A_ServiceFeatures.onError);\n }\n\n }\n\n @A_Concept.Stop()\n /**\n * Stop the server\n */\n async stop() {\n try {\n await this.call(A_ServiceFeatures.onBeforeStop);\n\n await this.call(A_ServiceFeatures.onStop);\n\n await this.call(A_ServiceFeatures.onAfterStop);\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_Service_Error:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_Service_Error:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_Service_Error({\n title: A_Service_Error.ServiceStopError,\n description: 'An error occurred while processing the request.',\n originalError: error\n })\n break;\n }\n\n this.scope.register(wrappedError);\n\n await this.call(A_ServiceFeatures.onError);\n }\n }\n\n\n\n\n // ======================================================================================\n // ============================= A-Service Lifecycle =================================\n // ======================================================================================\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onBeforeLoad](\n @A_Inject(A_Polyfill) polyfill: A_Polyfill,\n ...args: any[]\n ): Promise<void> {\n // Initialize Polyfill\n if (!polyfill) {\n this.scope.register(A_Polyfill);\n polyfill = this.scope.resolve(A_Polyfill)!\n }\n }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onLoad](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onAfterLoad](...args: any[]) { }\n\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onBeforeStart](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onStart](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onAfterStart](...args: any[]) { }\n\n\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onBeforeStop](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onStop](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onAfterStop](...args: any[]) { }\n\n\n\n @A_Feature.Extend({\n before: /.*/\n })\n protected async [A_ServiceFeatures.onError](\n @A_Inject(A_Error) error: A_Error,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n logger?.error(error);\n }\n\n}\n\n\n\n\n\n\n\n\n","import { A_Fragment } from '@adaas/a-concept';\nimport { A_Frame } from '@adaas/a-frame';\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-Route',\n description: 'Route fragment that defines URL patterns for routing purposes. It supports dynamic parameters and query extraction, allowing for flexible route definitions. This fragment can be used in routing systems to match incoming URLs against defined routes and extract relevant parameters and query strings.'\n})\nexport class A_Route<\n _TParams extends Record<string, any> = Record<string, any>,\n _TQuery extends Record<string, any> = Record<string, any>\n> extends A_Fragment {\n\n public url!: string;\n\n\n constructor(\n url: string | RegExp,\n ) {\n super();\n this.url = url instanceof RegExp ? url.source : url;\n }\n\n /**\n * Returns path only without query and hash\n */\n get path(): string {\n const p = this.url.split('?')[0].split('#')[0];\n\n\n // ensure that last char is not /\n // and remove protocol and domain if present\n if (p.includes('://')) {\n const pathStartIndex = p.indexOf('/', p.indexOf('://') + 3);\n if (pathStartIndex === -1) {\n return '/';\n } else {\n const path = p.slice(pathStartIndex);\n return path.endsWith('/') ? path.slice(0, -1) : path;\n }\n }\n return p.endsWith('/') ? p.slice(0, -1) : p;\n }\n /**\n * Returns array of parameter names in the route path\n */\n get params(): string[] {\n return this.path\n .match(/:([^\\/]+)/g)\n ?.map((param) => param.slice(1))\n || [];\n }\n\n\n /**\n * Returns protocol based on URL scheme\n */\n get protocol(): string {\n switch (true) {\n case this.url.startsWith('http://'):\n return 'http';\n case this.url.startsWith('https://'):\n return 'https';\n case this.url.startsWith('ws://'):\n return 'ws';\n case this.url.startsWith('wss://'):\n return 'wss';\n default:\n return this.url.includes('://') ? this.url.split('://')[0] : 'http';\n }\n }\n\n\n extractParams(url: string): _TParams {\n // Remove query string (anything after ?)\n const cleanUrl = url.split('?')[0];\n\n const urlSegments = cleanUrl.split('/').filter(Boolean);\n const maskSegments = this.path.split('/').filter(Boolean);\n\n const params = {};\n\n for (let i = 0; i < maskSegments.length; i++) {\n\n const maskSegment = maskSegments[i];\n const urlSegment = urlSegments[i];\n\n if (maskSegment.startsWith(':')) {\n const paramName = maskSegment.slice(1); // Remove ':' from mask\n params[paramName] = urlSegment;\n } else if (maskSegment !== urlSegment) {\n // If static segments don’t match → fail\n return {} as _TParams;\n }\n }\n\n return params as _TParams;\n }\n\n extractQuery(url: string): _TQuery {\n const query: Record<string, string> = {};\n\n // Take only the part after \"?\"\n const queryString = url.split('?')[1];\n if (!queryString) return query as _TQuery;\n\n // Remove fragment (#...) if present\n const cleanQuery = queryString.split('#')[0];\n\n // Split into key=value pairs\n for (const pair of cleanQuery.split('&')) {\n if (!pair) continue;\n const [key, value = ''] = pair.split('=');\n query[decodeURIComponent(key)] = decodeURIComponent(value);\n }\n\n return query as _TQuery;\n }\n\n\n\n toString(): string {\n // path can be like /api/v1/users/:id\n // and because of that :id we need to replace it with regex that matches chars and numbers only \n return `${this.path}`;\n // .replace(/\\/:([^\\/]+)/g, '\\\\/([^\\/]+)')\n }\n\n toRegExp(): RegExp {\n return new RegExp(`^${this.path.replace(/\\/:([^\\/]+)/g, '/([^/]+)')}$`);\n }\n\n toAFeatureExtension(extensionScope: Array<string> = []): RegExp {\n return new RegExp(`^${extensionScope.length\n ? `(${extensionScope.join('|')})`\n : '.*'\n }\\\\.${this.path.replace(/\\/:([^\\/]+)/g, '/([^/]+)')}$`);\n }\n}\n\n","import { A_Entity, A_Scope } from \"@adaas/a-concept\";\nimport { A_Signal_Init, A_Signal_Serialized } from \"../A-Signal.types\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A Signal Entity is an individual signal instance that carries data.\n * Signals is a event types that uses for vectors of signals to be used for further processing. \n * \n * Comparing to standard events, signals should be used in case when the event impacts some \"state\" \n * and the state should be used instead of the event itself.\n * \n * For example, a signal can represent the current status of a user (online/offline/away), \n * while an event would represent a single action (user logged in/logged out).\n * \n * Signals are typically used in scenarios where the current state is more important than individual events, \n * such as monitoring systems, real-time dashboards, or stateful applications.\n */\n@A_Frame.Entity({\n namespace: 'A-Utils',\n name: 'A-Signal',\n description: 'A Signal Entity represents an individual signal instance that carries data, used for managing state within an application context. Signals are designed to reflect the current state rather than individual events, making them suitable for scenarios where state monitoring and real-time updates are essential.'\n})\nexport class A_Signal<\n _TSignalDataType extends Record<string, any> = Record<string, any>\n> extends A_Entity<A_Signal_Init<_TSignalDataType>, A_Signal_Serialized<_TSignalDataType>> {\n\n data!: _TSignalDataType;\n\n\n /**\n * Allows to define default data for the signal.\n * \n * If no data is provided during initialization, the default data will be used.\n * \n * @returns \n */\n static async default(): Promise<A_Signal | undefined> {\n return undefined;\n }\n\n\n\n fromJSON(serializedEntity: A_Signal_Serialized<_TSignalDataType>): void {\n super.fromJSON(serializedEntity);\n this.data = serializedEntity.data;\n }\n\n\n fromNew(newEntity: A_Signal_Init<_TSignalDataType>): void {\n this.aseid = this.generateASEID({ entity: newEntity.name });\n this.data = newEntity.data;\n }\n\n\n\n toJSON(): A_Signal_Serialized<_TSignalDataType> {\n return {\n ...super.toJSON(),\n data: this.data\n };\n }\n\n}","import { A_Entity, A_Scope, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor } from \"@adaas/a-concept\";\nimport { A_SignalVector_Serialized, A_SignalVector_Init } from \"../A-Signal.types\";\nimport { A_Signal } from \"./A-Signal.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n/**\n * A Signal Vector Entity is a collection of signals structured in a specific way.\n * It allows grouping multiple signals together for batch processing or transmission.\n * \n * Signal Vectors are useful in scenarios where multiple related signals need to be handled together,\n * as a state of the system or a snapshot of various parameters at a given time.\n * \n * @template TSignalsConstructors - Array of signal constructor types (e.g., [typeof MySignal, typeof CustomSignal])\n * @template TSignals - Array of signal instances derived from constructors\n */\n@A_Frame.Entity({\n namespace: 'A-Utils',\n name: 'A-SignalVector',\n description: 'A Signal Vector Entity represents a collection of signals structured in a specific way, allowing for batch processing and transmission of related signals as a unified state representation.'\n})\nexport class A_SignalVector<\n TSignals extends Array<A_Signal> = Array<A_Signal>,\n TSignalsConstructors extends Array<A_TYPES__Entity_Constructor<A_Signal>> = TSignals extends Array<infer U> ? U extends A_Signal ? A_TYPES__Entity_Constructor<U>[] : never : never\n> extends A_Entity<A_SignalVector_Init<TSignals[number][], TSignalsConstructors>, A_SignalVector_Serialized> {\n\n /**\n * The structure of the signal vector, defining the types of signals it contains.\n * \n * For example:\n * [UserSignInSignal, UserStatusSignal, UserActivitySignal]\n * \n * [!] if not provided, it will be derived from the signals values.\n */\n protected _structure?: TSignalsConstructors;\n /**\n * It's actual vector Values of Signals like :\n * [UserActionSignal, UserMousePositionSignal, ExternalDependencySignal]\n */\n protected _signals!: TSignals[number][]\n\n\n fromNew(newEntity: A_SignalVector_Init<TSignals[number][], TSignalsConstructors>): void {\n super.fromNew(newEntity);\n this._structure = newEntity.structure;\n this._signals = newEntity.values;\n }\n\n /**\n * The structure of the signal vector, defining the types of signals it contains.\n * \n * For example:\n * [UserSignInSignal, UserStatusSignal, UserActivitySignal]\n * \n */\n get structure(): TSignalsConstructors {\n return this._structure || this._signals.map(s => s.constructor as A_TYPES__Entity_Constructor<A_Signal>) as TSignalsConstructors;\n }\n\n\n get length(): number {\n return this.structure.length;\n }\n\n\n /**\n * Enables iteration over the signals in the vector.\n * \n * @returns \n */\n [Symbol.iterator](): Iterator<TSignals[number]> {\n let pointer = 0;\n const signals = this.structure.map((signalConstructor) => {\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n return signalIndex !== -1 ? this._signals[signalIndex] : undefined;\n }) as TSignals[number][];\n\n return {\n next(): IteratorResult<TSignals[number]> {\n if (pointer < signals.length) {\n return {\n done: false,\n value: signals[pointer++]\n };\n } else {\n return {\n done: true,\n value: undefined as any\n };\n }\n }\n };\n }\n\n\n \n /**\n * Checks if the vector contains a signal of the specified type.\n * \n * @param signal \n */\n has(signal: A_Signal): boolean\n has(signalConstructor: A_TYPES__Component_Constructor<A_Signal>): boolean\n has(param1: A_Signal | A_TYPES__Component_Constructor<A_Signal>): boolean {\n let signalConstructor: A_TYPES__Component_Constructor<A_Signal>;\n if (param1 instanceof A_Entity) {\n signalConstructor = param1.constructor as A_TYPES__Component_Constructor<A_Signal>;\n } else {\n signalConstructor = param1;\n }\n return this.structure.includes(signalConstructor);\n }\n\n /**\n * Retrieves the signal of the specified type from the vector.\n * \n * @param signal \n */\n get<T extends A_Signal>(signal: T): T | undefined\n get<T extends A_Signal>(signalConstructor: A_TYPES__Entity_Constructor<T>): T | undefined\n get<T extends A_Signal>(param1: T | A_TYPES__Entity_Constructor<T>): T | undefined {\n let signalConstructor: A_TYPES__Entity_Constructor<A_Signal>;\n\n if (param1 instanceof A_Entity) {\n signalConstructor = param1.constructor as A_TYPES__Entity_Constructor<A_Signal>;\n } else {\n signalConstructor = param1 as A_TYPES__Entity_Constructor<A_Signal>;\n }\n\n const index = this._signals.findIndex(s => s.constructor === signalConstructor);\n if (index === -1) {\n return undefined;\n }\n return this._signals[index] as T;\n }\n\n\n /**\n * Converts to Array of values of signals in the vector\n * Maintains the order specified in the structure/generic type\n * \n * @param structure - Optional structure to override the default ordering\n * @returns Array of signal instances in the specified order\n */\n async toVector<\n T extends Array<A_Signal> = TSignals,\n >(\n structure?: { [K in keyof T]: T[K] extends A_Signal ? A_TYPES__Entity_Constructor<T[K]> : never }\n ): Promise<{ [K in keyof T]: T[K] }> {\n const usedStructure = structure || this.structure;\n\n return usedStructure.map((signalConstructor) => {\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n return signalIndex !== -1 ? this._signals[signalIndex] : undefined;\n }) as { [K in keyof T]: T[K] };\n }\n\n\n /**\n * Converts to Array of data of signals in the vector\n * Maintains the order specified in the structure/generic type\n * \n * @param structure - Optional structure to override the default ordering\n * @returns Array of serialized signal data in the specified order\n */\n async toDataVector<\n T extends Array<A_Signal> = TSignals,\n >(\n structure?: { [K in keyof T]: T[K] extends A_Signal ? A_TYPES__Entity_Constructor<T[K]> : never }\n ): Promise<{ [K in keyof T]: T[K] extends A_Signal<infer D> ? D | undefined : never }> {\n\n const usedStructure = structure || this.structure;\n\n const results: Array<any> = [];\n\n for (const signalConstructor of usedStructure) {\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n let data: any;\n if (signalIndex === -1) {\n\n data = await (signalConstructor as typeof A_Signal).default()\n\n } else {\n const signal = this._signals[signalIndex];\n data = signal;\n }\n\n\n results.push(data?.toJSON().data);\n }\n\n return results as { [K in keyof T]: T[K] extends A_Signal<infer D> ? D | undefined : never };\n }\n\n /**\n * Converts to Object with signal constructor names as keys and their corresponding data values\n * Uses the structure ordering to ensure consistent key ordering\n * \n * @returns Object with signal constructor names as keys and signal data as values\n */\n async toObject<\n T extends Array<A_Signal> = TSignals,\n >(\n structure?: { [K in keyof T]: T[K] extends A_Signal ? A_TYPES__Entity_Constructor<T[K]> : never }\n ): Promise<{ [key: string]: T[number] extends A_Signal<infer D> ? D | undefined : never }> {\n\n const usedStructure = structure || this.structure;\n\n const obj: { [key: string]: T[number] extends A_Signal<infer D> ? D | undefined : never } = {};\n usedStructure.forEach((signalConstructor) => {\n const signalName = signalConstructor.name;\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n\n if (signalIndex !== -1) {\n const signal = this._signals[signalIndex];\n obj[signalName] = signal.toJSON().data as any;\n } else {\n obj[signalName] = undefined as any;\n }\n });\n\n return obj;\n }\n\n\n /**\n * Serializes the Signal Vector to a JSON-compatible format.\n * \n * \n * @returns \n */\n toJSON(): A_SignalVector_Serialized {\n return {\n ...super.toJSON(),\n structure: this.structure.map(s => s.name),\n values: this._signals.map(s => s.toJSON())\n };\n }\n}\n","import { A_Context, A_Fragment, A_TYPES__Component_Constructor } from \"@adaas/a-concept\";\nimport { A_Signal } from \"../entities/A-Signal.entity\";\nimport { A_SignalVector } from \"../entities/A-SignalVector.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_SignalState manages the latest state of all signals within a given scope.\n * \n * This class maintains a mapping between signal constructors and their most recently emitted values,\n * providing a centralized state store for signal management within an application context.\n * \n * @template TSignalData - Union type of all possible signal data types that can be stored (must extend Record<string, any>)\n * \n * The generic ensures type safety by maintaining correspondence between:\n * - Signal constructor types and their data types\n * - Signal instances and their emitted value types\n * - Vector structure and the data it contains\n */\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-SignalState',\n description: 'Manages the latest state of all signals within a given scope, maintaining a mapping between signal constructors and their most recently emitted values.'\n})\nexport class A_SignalState<\n TSignalData extends Record<string, any> = Record<string, any>\n> extends A_Fragment {\n\n /**\n * Internal map storing the relationship between signal constructors and their latest values\n * Key: Signal constructor function\n * Value: Latest emitted data from that signal type\n */\n protected _state: Map<A_TYPES__Component_Constructor<A_Signal>, A_Signal> = new Map();\n\n /**\n * Previous state map to track changes between signal emissions\n * Key: Signal constructor function\n * Value: Previous emitted data from that signal type\n */\n protected _prevState: Map<A_TYPES__Component_Constructor<A_Signal>, A_Signal> = new Map();\n\n /**\n * Optional structure defining the ordered list of signal constructors\n * Used for vector operations and initialization\n */\n protected _structure: Array<A_TYPES__Component_Constructor<A_Signal>>;\n\n\n /**\n * Gets the ordered structure of signal constructors\n * @returns Array of signal constructors in their defined order\n */\n get structure(): Array<A_TYPES__Component_Constructor<A_Signal>> {\n return this._structure || [];\n }\n\n /**\n * Creates a new A_SignalState instance\n * \n * @param structure - Optional array defining the ordered structure of signal constructors\n * This structure is used for vector operations and determines the order\n * in which signals are processed and serialized\n */\n constructor(\n structure: A_TYPES__Component_Constructor<A_Signal>[]\n ) {\n super({ name: \"A_SignalState\" });\n\n this._structure = structure;\n\n // Initialize the state map with undefined values for each signal in the structure\n // This ensures all expected signals have entries in the state map from the start\n \n }\n\n\n /**\n * Sets the latest value for a specific signal type\n * \n * @param signal - The signal constructor to associate the value with\n * @param value - The data value emitted by the signal\n */\n set(\n signal: A_Signal,\n value: A_Signal\n ): void\n set(\n signal: A_Signal\n ): void\n set(\n signal: A_TYPES__Component_Constructor<A_Signal>,\n value: A_Signal\n ): void\n set(\n param1: A_TYPES__Component_Constructor<A_Signal> | A_Signal,\n param2?: A_Signal\n ): void {\n const signal = param1 instanceof A_Signal ? param1.constructor as A_TYPES__Component_Constructor<A_Signal> : param1;\n const value = param1 instanceof A_Signal ? param1 : param2!;\n\n this._prevState.set(signal, this._state.get(signal)!);\n this._state.set(signal, value);\n }\n\n /**\n * Retrieves the latest value for a specific signal type\n * \n * @param signal - The signal constructor to get the value for\n * @returns The latest data value or undefined if no value has been set\n */\n get(\n signal: A_Signal\n ): A_Signal | undefined\n get(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): A_Signal | undefined\n get(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): A_Signal | undefined {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n return this._state.get(signal);\n }\n\n /**\n * Retrieves the previous value for a specific signal type\n * \n * @param signal \n */\n getPrev(\n signal: A_Signal\n ): A_Signal | undefined\n getPrev(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): A_Signal | undefined\n getPrev(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): A_Signal | undefined {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n return this._prevState.get(signal);\n } \n\n /**\n * Checks if a signal type has been registered in the state\n * \n * @param signal - The signal constructor to check for\n * @returns True if the signal type exists in the state map\n */\n has(\n signal: A_Signal\n ): boolean\n has(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): boolean\n has(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): boolean {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n\n return this.structure.includes(signal);\n }\n\n /**\n * Removes a signal type and its associated value from the state\n * \n * @param signal - The signal constructor to remove\n * @returns True if the signal was successfully deleted, false if it didn't exist\n */\n delete(\n signal: A_Signal\n ): boolean\n delete(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): boolean\n delete(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): boolean {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n return this._state.delete(signal);\n }\n\n\n /**\n * Converts the current state to a vector (ordered array) format\n * \n * The order is determined by the structure array provided during construction.\n * Each position in the vector corresponds to a specific signal type's latest value.\n * \n * @returns Array of signal values in the order defined by the structure\n * @throws Error if structure is not defined or if any signal value is undefined\n */\n toVector(): A_SignalVector {\n const vector: Array<A_Signal> = [];\n\n this._state.forEach((value, key) => {\n vector.push(value);\n });\n\n return new A_SignalVector({\n structure: this.structure,\n values: vector\n });\n }\n\n /**\n * Converts the current state to an object with signal constructor names as keys\n * \n * This provides a more readable representation of the state where each signal\n * type is identified by its constructor name.\n * \n * @returns Object mapping signal constructor names to their latest values\n * @throws Error if any signal value is undefined\n */\n toObject(): Record<string, A_Signal> {\n const obj: Record<string, A_Signal> = {};\n\n this.structure.forEach((signalConstructor) => {\n const value = this._state.get(signalConstructor);\n if (value === undefined) {\n throw new Error(`Signal ${signalConstructor.name} has no value in state`);\n }\n obj[signalConstructor.name] = value;\n });\n\n return obj;\n }\n\n}","import { A_CommonHelper, A_Context, A_Fragment, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor } from \"@adaas/a-concept\";\nimport { A_SignalConfig_Init } from \"../A-Signal.types\";\nimport { A_Signal } from \"../entities/A-Signal.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n/**\n * This component should dictate a structure of the vector for all signals within a given scope.\n * so if there're multiple signals it should say what type at what position should be expected.\n * \n * e.g. [A_RouterWatcher, A_ScopeWatcher, A_LoggerWatcher]\n * This structure then should be used for any further processing of signals within the scope.\n */\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-SignalConfig',\n description: 'Signal configuration fragment that defines the structure and types of signals within a given scope. It allows specifying the expected signal constructors and their order, facilitating consistent signal management and processing across components that emit or listen to signals.'\n})\nexport class A_SignalConfig extends A_Fragment {\n\n protected _structure?: Array<A_TYPES__Entity_Constructor<A_Signal>>;\n\n protected _config: A_SignalConfig_Init\n\n protected _ready?: Promise<void>;\n\n get structure(): Array<A_TYPES__Entity_Constructor<A_Signal>> {\n if (this._structure) {\n return this._structure;\n }\n\n const scope = A_Context.scope(this);\n\n // just sort by constructor name to have consistent order\n const constructors = [...scope.allowedEntities]\n .filter(e => A_CommonHelper.isInheritedFrom(e, A_Signal))\n .sort((a, b) => a.constructor.name.localeCompare(b.name))\n .map(s => scope.resolveConstructor<A_Signal>(s.name));\n\n return constructors.filter(s => s) as Array<A_TYPES__Entity_Constructor<A_Signal>>;\n }\n\n /**\n * Uses for synchronization to ensure the config is initialized.\n * \n * @returns True if the configuration has been initialized.\n */\n get ready() {\n return this._ready;\n }\n\n constructor(\n params: A_SignalConfig_Init\n ) {\n super({ name: \"A_SignalConfig\" });\n this._config = params;\n }\n\n\n /**\n * Initializes the signal configuration if not already initialized.\n * \n * @returns \n */\n async initialize() {\n if (!this._ready) {\n this._ready = this._initialize();\n }\n return this._ready;\n }\n\n /**\n * Initializes the signal configuration by processing the provided structure or string representation.\n * This method sets up the internal structure of signal constructors based on the configuration.\n */\n protected async _initialize() {\n if (this._config.structure) {\n this._structure = this._config.structure;\n } else if (this._config.stringStructure) {\n const stringStructure = this._config.stringStructure.split(',').map(s => s.trim());\n this._structure = stringStructure\n .map(name => A_Context.scope(this).resolveConstructor<A_Signal>(name))\n .filter(s => s);\n }\n\n }\n\n}","\nexport enum A_SignalBusFeatures {\n onBeforeNext = '_A_SignalBusFeatures_onBeforeNext',\n onNext = '_A_SignalBusFeatures_onNext',\n\n onError = '_A_SignalBusFeatures_onError',\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\n\nexport class A_SignalBusError extends A_Error {\n\n\n static readonly SignalProcessingError = 'Signal processing error';\n}","import { A_Caller, A_Component, A_Context, A_Dependency, A_Error, A_Feature, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_SignalState } from \"../context/A-SignalState.context\";\nimport { A_SignalConfig } from \"../context/A-SignalConfig.context\";\nimport { A_Config } from \"../../A-Config/A-Config.context\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\nimport { A_Signal } from \"../entities/A-Signal.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\nimport { A_SignalBusFeatures } from \"./A-SignalBus.constants\";\nimport { A_SignalBusError } from \"./A-SignalBus.error\";\n\n\n\n/**\n * This component should listen for all available signal watchers components in this and all parent scopes. \n * When a signal is emitted, it should forward the signal to all registered watchers.\n * \n * A_SignalBus should always return the same vector structure of the signals, and that's why it should store the state of the latest behavior. \n * For example if there are 3 watchers registered, the bus should always return a vector of 3 elements, based on the A_SignalConfig structure.\n * \n * \n * The component itself is stateless and all methods uses only parameters (context) is provided with.\n */\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-SignalBus',\n description: 'Signal bus component that manages the emission and state of signals within a given scope. It listens for emitted signals, updates their state, and forwards them to registered watchers. The bus ensures a consistent signal vector structure based on the defined configuration, facilitating signal management across multiple components.'\n})\nexport class A_SignalBus extends A_Component {\n\n\n @A_Frame.Method({\n description: 'Emit multiple signals through the signal bus.'\n })\n async next(...signals: A_Signal[]) {\n const scope = new A_Scope({\n name: `A_SignalBus-Next-Scope`,\n entities: signals\n })\n .inherit(A_Context.scope(this));\n\n try {\n await this.call(A_SignalBusFeatures.onBeforeNext, scope);\n\n await this.call(A_SignalBusFeatures.onNext, scope);\n\n scope.destroy();\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_SignalBusError:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_SignalBusError:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_SignalBusError({\n title: A_SignalBusError.SignalProcessingError,\n description: `An error occurred while processing the signal.`,\n originalError: error\n })\n break;\n }\n\n scope.register(wrappedError);\n\n await this.call(A_SignalBusFeatures.onError);\n\n scope.destroy();\n }\n }\n\n\n @A_Feature.Extend({\n before: /.*/\n })\n protected async [A_SignalBusFeatures.onError](\n @A_Inject(A_Error) error: A_Error,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n logger?.error(error);\n }\n\n @A_Feature.Extend({\n scope: [A_SignalBus],\n before: /.*/\n })\n async [A_SignalBusFeatures.onBeforeNext](\n @A_Inject(A_Scope) scope: A_Scope,\n\n @A_Inject(A_Config) globalConfig?: A_Config<['A_SIGNAL_VECTOR_STRUCTURE']>,\n @A_Inject(A_SignalState) state?: A_SignalState,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n @A_Inject(A_SignalConfig) config?: A_SignalConfig,\n ) {\n /**\n * We need a context where component is registered, to prevent any duplicate registrations\n */\n const componentContext = A_Context.scope(this);\n\n if (!config) {\n config = new A_SignalConfig({\n stringStructure: globalConfig?.get('A_SIGNAL_VECTOR_STRUCTURE') || undefined\n });\n\n componentContext.register(config);\n }\n\n if (!config.ready)\n await config.initialize();\n\n if (!state) {\n state = new A_SignalState(config.structure);\n componentContext.register(state);\n }\n }\n\n /**\n * This methods extends A-Signal Emit feature to handle signal emission within the bus.\n * \n * It updates the signal state and emits the updated signal vector.\n * \n * @param signal \n * @param globalConfig \n * @param logger \n * @param state \n * @param config \n * @returns \n */\n @A_Feature.Extend({\n scope: [A_SignalBus],\n before: /.*/\n })\n async [A_SignalBusFeatures.onNext](\n @A_Dependency.Flat()\n @A_Dependency.All()\n @A_Inject(A_Signal) signals: A_Signal[],\n @A_Inject(A_Scope) scope: A_Scope,\n\n @A_Dependency.Required()\n @A_Inject(A_SignalState) state: A_SignalState,\n\n @A_Inject(A_Config) globalConfig?: A_Config<['A_SIGNAL_VECTOR_STRUCTURE']>,\n @A_Inject(A_Logger) logger?: A_Logger,\n @A_Inject(A_SignalConfig) config?: A_SignalConfig,\n ) {\n /*\n 1) create a signal when it occurs via new A_Signal('somedata')\n 2) emit a signal when needed via bus.next(signal)\n 3) the bus should listen for all emitted signals within the scope\n 4) when a signal is emitted, the bus should store a signal in some place (probably it's memory)\n */\n // const signals = scope.resolveFlatAll<A_Signal>(A_Signal);\n\n for (const signal of signals) {\n\n if (!state.has(signal))\n return;\n\n // ------------------------------------------------------------------\n // And finally if all checks are passed, we can update the state\n // ------------------------------------------------------------------\n\n logger?.debug(`A_SignalBus: Updating state for signal '${signal.constructor.name}' with data:`, signal.data);\n\n state.set(signal);\n }\n\n const vector = state.toVector();\n\n scope.register(vector);\n }\n}\n","export class A_Deferred<T> {\n public promise: Promise<T>;\n private resolveFn!: (value: T | PromiseLike<T>) => void;\n private rejectFn!: (reason?: any) => void;\n\n /**\n * Creates a deferred promise\n * @returns A promise that can be resolved or rejected later\n */\n constructor() {\n this.promise = new Promise<T>((resolve, reject) => {\n this.resolveFn = resolve;\n this.rejectFn = reject;\n });\n }\n\n resolve(value: T | PromiseLike<T>): void {\n this.resolveFn(value);\n }\n\n reject(reason?: any): void {\n this.rejectFn(reason);\n }\n}","import { A_Deferred } from \"./A-Deferred.class\";\nimport { A_Error } from \"@adaas/a-concept\";\nimport { A_UTILS_TYPES__ScheduleObjectCallback, A_UTILS_TYPES__ScheduleObjectConfig } from \"./A-Schedule.types\";\n\nexport class A_ScheduleObject<T extends any = any> {\n\n private timeout!: NodeJS.Timeout;\n private deferred!: A_Deferred<T>;\n\n private config: A_UTILS_TYPES__ScheduleObjectConfig = {\n /**\n * If the timeout is cleared, should the promise resolve or reject?\n * BY Default it rejects\n * \n * !!!NOTE: If the property is set to true, the promise will resolve with undefined\n */\n resolveOnClear: false\n };\n\n\n /**\n * Creates a scheduled object that will execute the action after specified milliseconds\n * \n * \n * @param ms - milliseconds to wait before executing the action\n * @param action - the action to execute\n * @param config - configuration options for the schedule object\n */\n constructor(\n /**\n * Milliseconds to wait before executing the action\n */\n ms: number,\n /**\n * The action to execute after the specified milliseconds\n */\n action: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ) {\n if (config)\n this.config = { ...this.config, ...config };\n\n this.deferred = new A_Deferred<T>();\n\n this.timeout = setTimeout(\n () => action()\n .then((...args) => this.deferred.resolve(...args))\n .catch((...args) => this.deferred.reject(...args)),\n ms\n );\n }\n\n get promise(): Promise<T> {\n return this.deferred.promise;\n }\n\n clear(): void {\n if (this.timeout) {\n clearTimeout(this.timeout);\n\n if (this.config.resolveOnClear)\n this.deferred.resolve(undefined as T);\n else\n this.deferred.reject(new A_Error(\"Timeout Cleared\"));\n }\n }\n}\n\n","import { A_Component, A_Fragment, A_TypeGuards } from \"@adaas/a-concept\";\nimport { A_ScheduleObject } from \"./A-ScheduleObject.class\";\nimport { A_UTILS_TYPES__ScheduleObjectCallback, A_UTILS_TYPES__ScheduleObjectConfig } from \"./A-Schedule.types\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-Schedule',\n description: 'Scheduling component that allows scheduling of callbacks to be executed at specific times or after certain delays. It provides methods to schedule callbacks based on Unix timestamps or ISO date strings, as well as a method to execute callbacks after a specified delay in milliseconds. This component is useful for managing timed operations within an application.'\n})\nexport class A_Schedule extends A_Component {\n\n /**\n * Allows to schedule a callback for particular time in the future\n * \n * @param timestamp - Unix timestamp in milliseconds\n * @param callback - The callback to execute\n * @returns A promise that resolves to the schedule object\n */\n async schedule<T extends any = any>(\n /**\n * Unix timestamp in milliseconds\n */\n timestamp: number,\n /**\n * The callback to execute\n */\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>>\n async schedule<T extends any = any>(\n /**\n * ISO date string representing the date and time to schedule the callback for\n */\n date: string,\n /**\n * The callback to execute\n */\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>>\n async schedule<T extends any = any>(\n date: string | number,\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>> {\n\n const timestamp = A_TypeGuards.isString(date)\n ? (new Date(date)).getTime()\n : date;\n\n return new A_ScheduleObject<T>(\n timestamp - Date.now(),\n callback,\n config\n );\n }\n\n\n\n /**\n * Allows to execute callback after particular delay in milliseconds\n * So the callback will be executed after the specified delay\n * \n * @param ms \n */\n async delay<T extends any = any>(\n /**\n * Delay in milliseconds\n */\n ms: number,\n /**\n * The callback to execute after the delay\n */\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>> {\n return new A_ScheduleObject<T>(\n ms,\n callback,\n config\n );\n }\n}"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/A-Channel/A-Channel.component.ts","../src/lib/A-Execution/A-Execution.context.ts","../src/lib/A-Operation/A-Operation.context.ts","../src/lib/A-Channel/A-Channel.error.ts","../src/lib/A-Channel/A-Channel.constants.ts","../src/lib/A-Channel/A-ChannelRequest.context.ts","../src/lib/A-Command/A-Command.constants.ts","../src/lib/A-Command/A-Command.error.ts","../src/lib/A-StateMachine/A-StateMachine.error.ts","../src/lib/A-StateMachine/A-StateMachine.constants.ts","../src/lib/A-StateMachine/A-StateMachineTransition.context.ts","../src/lib/A-StateMachine/A-StateMachine.component.ts","../src/lib/A-Config/A-Config.constants.ts","../src/lib/A-Config/A-Config.error.ts","../src/lib/A-Config/A-Config.context.ts","../src/lib/A-Logger/A-Logger.constants.ts","../src/lib/A-Logger/A-Logger.component.ts","../src/lib/A-Command/A-Command.entity.ts","../src/lib/A-Polyfill/classes/A-FS-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Crypto-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Http-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Https-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Path-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Url-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Buffer-Polyfill.class.ts","../src/lib/A-Polyfill/classes/A-Process-Polyfill.class.ts","../src/lib/A-Polyfill/A-Polyfill.component.ts","../src/lib/A-Config/components/ConfigReader.component.ts","../src/lib/A-Config/components/FileConfigReader.component.ts","../src/lib/A-Config/components/ENVConfigReader.component.ts","../src/lib/A-Config/A-Config.container.ts","../src/lib/A-Config/A-Config.types.ts","../src/lib/A-Logger/A-Logger.env.ts","../src/lib/A-Manifest/A-Manifest.error.ts","../src/lib/A-Manifest/classes/A-ManifestChecker.class.ts","../src/lib/A-Manifest/A-Manifest.context.ts","../src/lib/A-Memory/A-Memory.constants.ts","../src/lib/A-Memory/A-Memory.context.ts","../src/lib/A-Memory/A-Memory.error.ts","../src/lib/A-Memory/A-Memory.component.ts","../src/lib/A-Service/A-Service.constants.ts","../src/lib/A-Service/A-Service.error.ts","../src/lib/A-Service/A-Service.container.ts","../src/lib/A-Route/A-Route.entity.ts","../src/lib/A-Signal/entities/A-Signal.entity.ts","../src/lib/A-Signal/entities/A-SignalVector.entity.ts","../src/lib/A-Signal/context/A-SignalState.context.ts","../src/lib/A-Signal/context/A-SignalConfig.context.ts","../src/lib/A-Signal/components/A-SignalBus.constants.ts","../src/lib/A-Signal/components/A-SignalBus.error.ts","../src/lib/A-Signal/components/A-SignalBus.component.ts","../src/lib/A-Schedule/A-Deferred.class.ts","../src/lib/A-Schedule/A-ScheduleObject.class.ts","../src/lib/A-Schedule/A-Schedule.component.ts"],"names":["A_ExecutionContext","A_Fragment","name","defaults","A_Meta","key","value","__name","__decorateClass","A_Frame","A_OperationContext","operation","params","error","result","_A_ChannelError","A_Error","originalError","context","A_TypeGuards","A_ChannelError","A_ChannelFeatures","A_ChannelRequestStatuses","A_ChannelRequest","existed","A_Channel","A_Component","args","requestScope","A_Scope","A_IdentityHelper","A_Context","channelError","message","A_Feature","A_Command_Status","A_CommandTransitions","A_CommandFeatures","A_CommandEvent","_A_CommandError","A_CommandError","_A_StateMachineError","A_StateMachineError","A_StateMachineFeatures","A_StateMachineTransition","_a","_b","_c","_d","A_StateMachine","from","to","props","transitionName","A_FormatterHelper","transition","scope","wrappedError","A_CONSTANTS__CONFIG_ENV_VARIABLES","A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY","_A_ConfigError","A_ConfigError","A_Config","config","A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY","property","array","A_LOGGER_DEFAULT_SCOPE_LENGTH","A_LOGGER_DEFAULT_LEVEL","A_LOGGER_COLORS","A_LOGGER_SAFE_RANDOM_COLORS","A_LOGGER_ANSI","A_LOGGER_TIME_FORMAT","A_LOGGER_FORMAT","A_LOGGER_TERMINAL","A_LOGGER_ENV_KEYS","A_Logger","configScopeColor","configLogColor","complementaryColors","str","hash","i","char","scopeName","safeColors","colorIndex","colorPairs","pairIndex","cols","text","scopePadding","isFirstLine","scopeHeaderLength","continuationIndent","firstLineMaxWidth","continuationMaxWidth","lines","words","currentLine","currentMaxWidth","word","spaceNeeded","chunks","maxLength","totalLength","totalPadding","leftPadding","rightPadding","messageColor","timeString","isMultiArg","arg","shouldAddNewline","obj","jsonString","seen","maxJsonLineWidth","formatted","line","stringValueMatch","prefix","suffix","wrappedValue","maxWidth","wrappedLines","formattedLines","index","logMethod","param1","time","separator","errorMessage","errorDescription","originalMessage","stackLines","linkText","stack","baseIndent","stackIndent","wrappedLine","now","minutes","seconds","milliseconds","__decorateParam","A_Inject","_e","_f","_g","_h","_i","_j","_k","A_Command","A_Entity","logger","stateMachine","resolve","reject","onBeforeExecuteFeature","onExecuteFeature","onAfterExecuteFeature","targetError","event","listener","newEntity","serialized","attachedScope","A_Dependency","_A_FSPolyfillClass","path","encoding","A_FSPolyfillClass","_A_CryptoPolyfillClass","fsPolyfill","crypto","algorithm","filePath","fileStream","data","err","hashBuffer","hashArray","hashBase64","A_CryptoPolyfillClass","_A_HttpPolyfillClass","httpModule","options","callback","url","isHttps","mockResponse","handler","dest","A_HttpPolyfillClass","_A_HttpsPolyfillClass","httpsModule","A_HttpsPolyfillClass","_A_PathPolyfillClass","paths","resolvedPath","ext","base","parts","pathObject","A_PathPolyfillClass","_A_UrlPolyfillClass","urlModule","urlString","urlObject","A_UrlPolyfillClass","_A_BufferPolyfillClass","bufferModule","size","fill","buffer","list","length","sum","buf","offset","A_BufferPolyfillClass","_A_ProcessPolyfillClass","code","A_ProcessPolyfillClass","A_Polyfill","A_Concept","ConfigReader","polyfill","container","rootDir","variables","startPath","A_Container","FileConfigReader","fs","ENVConfigReader","feature","allVariables","variable","A_ConfigLoader","newConfig","A_ScopeError","A_TYPES__ConfigFeature","A_LoggerEnvVariables","A_LoggerEnvVariablesArray","_A_ManifestError","A_ManifestError","_A_ManifestChecker","manifest","component","method","checkExclusion","target","A_ManifestChecker","A_Manifest","item","componentRegex","methodRegex","methodConfig","ctor","components","patterns","componentCtor","query","componentName","methodName","targetName","matchingRules","rule","a","b","aIsGeneral","bIsGeneral","A_MemoryFeatures","A_MemoryContext","param","_A_MemoryError","A_MemoryError","A_Memory","initError","destroyError","getError","setError","dropError","clearError","serializeError","A_ServiceFeatures","_A_Service_Error","A_Service_Error","A_Service","A_Route","p","pathStartIndex","urlSegments","maskSegments","maskSegment","urlSegment","paramName","queryString","cleanQuery","pair","extensionScope","A_Signal","hashSource","chr","other","serializedEntity","identity","id","A_SignalVector","param2","s","pointer","signals","signalConstructor","signalIndex","thisSignalConstructor","otherSignalConstructor","thisSignalIndex","otherSignalIndex","thisSignal","otherSignal","signal","structure","usedStructure","results","signalName","A_SignalState","vector","A_SignalConfig","e","A_CommonHelper","stringStructure","A_SignalBusFeatures","_A_SignalBusError","A_SignalBusError","A_SignalBus","globalConfig","state","componentContext","_A_Deferred","reason","A_Deferred","_A_ScheduleObject","ms","action","A_ScheduleObject","A_Schedule","date","timestamp"],"mappings":"gTAAA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,wBAAA,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F,EAAAA,CACPG,CAAAA,CAAY,IAAA,CAAK,KAAI,CACrBlK,CAAAA,CACA9H,CACJ,CACJ,CAUA,MAAM,KAAA,CAIF2R,CAAAA,CAIA7J,EAIA9H,CAAAA,CAC4B,CAC5B,OAAO,IAAI6R,EAAAA,CACPF,CAAAA,CACA7J,CAAAA,CACA9H,CACJ,CACJ,CACJ,EAlF4CxD,CAAAA,CAAAsV,EAAAA,CAAA,YAAA,CAAA,CAA/BA,EAAAA,CAANrV,CAAAA,CAAA,CALNC,QAAQ,SAAA,CAAU,CACf,SAAA,CAAW,SAAA,CACX,IAAA,CAAM,YAAA,CACN,WAAA,CAAa,4WACjB,CAAC,CAAA,CAAA,CACYoV,EAAAA,CAAAA","file":"index.mjs","sourcesContent":["import { A_Component, A_Context, A_Feature, A_IdentityHelper, A_Scope } from \"@adaas/a-concept\";\nimport { A_ChannelError } from \"./A-Channel.error\";\nimport { A_ChannelFeatures } from \"./A-Channel.constants\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_ChannelRequest } from \"./A-ChannelRequest.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A-Channel - A powerful, extensible communication channel component\n * \n * A-Channel provides a structured approach to implementing various communication patterns\n * such as HTTP clients, WebSocket connections, message queues, and other messaging systems.\n * It offers a complete lifecycle management system with extensible hooks for custom behavior.\n * \n * ## Key Features:\n * - 🔄 **Lifecycle Management** - Complete connection and processing lifecycle with hooks\n * - 📡 **Multiple Communication Patterns** - Request/Response and Fire-and-Forget messaging \n * - 🛡️ **Error Handling** - Comprehensive error capture and management\n * - 🎯 **Type Safety** - Full TypeScript support with generic types\n * - 🔧 **Extensible** - Component-based architecture for custom behavior\n * - ⚡ **Concurrent Processing** - Handle multiple requests simultaneously\n * \n * ## Basic Usage:\n * ```typescript\n * const channel = new A_Channel();\n * A_Context.root.register(channel);\n * \n * // Request/Response pattern\n * const response = await channel.request({ action: 'getData', id: 123 });\n * \n * // Fire-and-forget pattern \n * await channel.send({ type: 'notification', message: 'Hello World' });\n * ```\n * \n * ## Custom Implementation:\n * ```typescript\n * class HttpChannel extends A_Channel {}\n * \n * class HttpProcessor extends A_Component {\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * const response = await fetch(context.params.url);\n * (context as any)._result = await response.json();\n * }\n * }\n * ```\n * \n * @see {@link ./README.md} For complete documentation and examples\n */\n@A_Frame.Namespace('A-Utils')\n@A_Frame.Component({\n name: 'A-Channel',\n description: 'Component uses as abstract channel for communication patterns. Can be inherited and extended to implement custom channels.'\n})\nexport class A_Channel extends A_Component {\n\n /**\n * Indicates whether the channel is currently processing requests.\n * This flag is managed automatically during request/send operations.\n * \n * @readonly\n */\n protected _processing: boolean = false;\n\n /**\n * Promise that resolves when the channel initialization is complete.\n * Ensures that onConnect lifecycle hook has been executed before\n * any communication operations.\n * \n * @private\n */\n protected _initialized?: Promise<void>;\n\n /**\n * Internal cache storage for channel-specific data.\n * Can be used by custom implementations for caching responses,\n * connection pools, or other channel-specific state.\n * \n * @protected\n */\n protected _cache: Map<string, any> = new Map();\n\n /**\n * Creates a new A_Channel instance.\n * \n * The channel must be registered with A_Context before use:\n * ```typescript\n * const channel = new A_Channel();\n * A_Context.root.register(channel);\n * ```\n */\n constructor() {\n super();\n }\n\n /**\n * Indicates whether the channel is currently processing requests.\n * \n * @returns {boolean} True if channel is processing, false otherwise\n */\n get processing(): boolean {\n return this._processing;\n }\n\n /**\n * Promise that resolves when the channel is fully initialized.\n * \n * Automatically calls the onConnect lifecycle hook if not already called.\n * This ensures the channel is ready for communication operations.\n * \n * @returns {Promise<void>} Promise that resolves when initialization is complete\n */\n get initialize(): Promise<void> {\n if (!this._initialized) {\n this._initialized = this.connect();\n }\n return this._initialized;\n }\n\n // ==========================================================\n // ================ Lifecycle Extension Points =============\n // ==========================================================\n\n /**\n * Connection lifecycle hook - called during channel initialization.\n * \n * Override this method in custom components to implement connection logic:\n * - Initialize network connections\n * - Load configuration\n * - Validate environment\n * - Set up connection pools\n * \n * @example\n * ```typescript\n * class DatabaseChannel extends A_Channel {}\n * \n * class DatabaseConnector extends A_Component {\n * @A_Feature.Extend({ scope: [DatabaseChannel] })\n * async [A_ChannelFeatures.onConnect]() {\n * await this.initializeDatabase();\n * console.log('Database channel connected');\n * }\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onConnect\n })\n async onConnect(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Disconnection lifecycle hook - called during channel cleanup.\n * \n * Override this method in custom components to implement cleanup logic:\n * - Close network connections\n * - Save state\n * - Release resources\n * - Clear caches\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [DatabaseChannel] })\n * async [A_ChannelFeatures.onDisconnect]() {\n * await this.closeConnections();\n * console.log('Database channel disconnected');\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onDisconnect\n })\n async onDisconnect(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Pre-request processing hook - called before main request processing.\n * \n * Use this hook for:\n * - Request validation\n * - Authentication\n * - Rate limiting\n * - Logging\n * - Request transformation\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onBeforeRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * // Validate required parameters\n * if (!context.params.url) {\n * throw new Error('URL is required');\n * }\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onBeforeRequest\n })\n async onBeforeRequest(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Main request processing hook - core business logic goes here.\n * \n * This is where the main communication logic should be implemented:\n * - Make HTTP requests\n * - Send messages to queues\n * - Execute database queries\n * - Process business logic\n * \n * Set the result in the context: `(context as any)._result = yourResult;`\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * const response = await fetch(context.params.url);\n * (context as any)._result = await response.json();\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onRequest\n })\n async onRequest(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Post-request processing hook - called after successful request processing.\n * \n * Use this hook for:\n * - Response transformation\n * - Logging\n * - Analytics\n * - Caching results\n * - Cleanup\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onAfterRequest](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * console.log(`Request completed in ${Date.now() - context.startTime}ms`);\n * await this.cacheResponse(context.params, context.data);\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onAfterRequest\n })\n async onAfterRequest(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Error handling hook - called when any operation fails.\n * \n * Use this hook for:\n * - Error logging\n * - Error transformation\n * - Alerting\n * - Retry logic\n * - Fallback mechanisms\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [HttpChannel] })\n * async [A_ChannelFeatures.onError](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * console.error('Request failed:', context.params, context.failed);\n * await this.logError(context);\n * await this.sendAlert(context);\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onError\n })\n async onError(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n /**\n * Send operation hook - called for fire-and-forget messaging.\n * \n * Use this hook for:\n * - Message broadcasting\n * - Event publishing\n * - Notification sending\n * - Queue operations\n * \n * @example\n * ```typescript\n * @A_Feature.Extend({ scope: [EventChannel] })\n * async [A_ChannelFeatures.onSend](\n * @A_Inject(A_ChannelRequest) context: A_ChannelRequest\n * ) {\n * const { eventType, payload } = context.params;\n * await this.publishEvent(eventType, payload);\n * }\n * ```\n */\n @A_Feature.Extend({\n name: A_ChannelFeatures.onSend\n })\n async onSend(...args: any[]) {\n // Default implementation - no operation\n // Override in custom implementations\n }\n\n // ==========================================================\n // ================= Public API Methods ===================\n // ==========================================================\n\n /**\n * Initializes the channel by calling the onConnect lifecycle hook.\n * \n * This method is called automatically when accessing the `initialize` property.\n * You can also call it manually if needed.\n * \n * @returns {Promise<void>} Promise that resolves when connection is established\n */\n async connect() {\n await this.call(A_ChannelFeatures.onConnect);\n }\n\n /**\n * Disconnects the channel by calling the onDisconnect lifecycle hook.\n * \n * Use this method to properly cleanup resources when the channel is no longer needed.\n * \n * @returns {Promise<void>} Promise that resolves when cleanup is complete\n */\n async disconnect() {\n await this.call(A_ChannelFeatures.onDisconnect);\n }\n\n /**\n * Sends a request and waits for a response (Request/Response pattern).\n * \n * This method follows the complete request lifecycle:\n * 1. Ensures channel is initialized\n * 2. Creates request scope and context\n * 3. Calls onBeforeRequest hook\n * 4. Calls onRequest hook (main processing)\n * 5. Calls onAfterRequest hook\n * 6. Returns the response context\n * \n * If any step fails, the onError hook is called and the error is captured\n * in the returned context.\n * \n * @template _ParamsType The type of request parameters\n * @template _ResultType The type of response data\n * @param params The request parameters\n * @returns {Promise<A_ChannelRequest<_ParamsType, _ResultType>>} Request context with response\n * \n * @example\n * ```typescript\n * // Basic usage\n * const response = await channel.request({ action: 'getData', id: 123 });\n * \n * // Typed usage\n * interface UserRequest { userId: string; }\n * interface UserResponse { name: string; email: string; }\n * \n * const userResponse = await channel.request<UserRequest, UserResponse>({\n * userId: 'user-123'\n * });\n * \n * if (!userResponse.failed) {\n * console.log('User:', userResponse.data.name);\n * }\n * ```\n */\n async request<\n _ParamsType extends Record<string, any> = Record<string, any>,\n _ResultType extends Record<string, any> = Record<string, any>,\n >(params: _ParamsType): Promise<A_ChannelRequest<_ParamsType, _ResultType>> {\n // Ensure channel is initialized before processing\n await this.initialize;\n\n // Set processing flag\n this._processing = true;\n\n // Create isolated scope for this request\n const requestScope = new A_Scope({\n name: `a-channel@scope:request:${A_IdentityHelper.generateTimeId()}`\n })\n .inherit(A_Context.scope(this));\n\n // Create request context\n const context = new A_ChannelRequest<_ParamsType, _ResultType>(params);\n\n try {\n // Set up dependency injection scope\n requestScope.register(context);\n\n // Execute request lifecycle\n await this.call(A_ChannelFeatures.onBeforeRequest, requestScope);\n await this.call(A_ChannelFeatures.onRequest, requestScope);\n await this.call(A_ChannelFeatures.onAfterRequest, requestScope);\n\n this._processing = false;\n\n return context;\n\n } catch (error) {\n this._processing = false;\n\n // Create channel-specific error\n const channelError = new A_ChannelError(error);\n context.fail(channelError);\n requestScope.register(channelError);\n\n // Call error handling hook\n await this.call(A_ChannelFeatures.onError, requestScope);\n\n requestScope.destroy();\n\n throw channelError;\n }\n }\n\n /**\n * Sends a fire-and-forget message (Send pattern).\n * \n * This method is used for one-way communication where no response is expected:\n * - Event broadcasting\n * - Notification sending\n * - Message queuing\n * - Logging operations\n * \n * The method follows this lifecycle:\n * 1. Ensures channel is initialized\n * 2. Creates send scope and context\n * 3. Calls onSend hook\n * 4. Completes without returning data\n * \n * If the operation fails, the onError hook is called but no error is thrown\n * to the caller (fire-and-forget semantics).\n * \n * @template _ParamsType The type of message parameters\n * @param message The message to send\n * @returns {Promise<void>} Promise that resolves when send is complete\n * \n * @example\n * ```typescript\n * // Send notification\n * await channel.send({\n * type: 'user.login',\n * userId: 'user-123',\n * timestamp: new Date().toISOString()\n * });\n * \n * // Send to message queue\n * await channel.send({\n * queue: 'email-queue',\n * payload: {\n * to: 'user@example.com',\n * subject: 'Welcome!',\n * body: 'Welcome to our service!'\n * }\n * });\n * ```\n */\n async send<_ParamsType extends Record<string, any> = Record<string, any>>(\n message: _ParamsType\n ): Promise<void> {\n // Ensure channel is initialized before processing\n await this.initialize;\n\n // Set processing flag\n this._processing = true;\n\n // Create isolated scope for this send operation\n const requestScope = new A_Scope({\n name: `a-channel@scope:send:${A_IdentityHelper.generateTimeId()}`\n })\n .inherit(A_Context.scope(this));\n\n\n // Create request context for the message\n const context = new A_OperationContext('send', message);\n\n try {\n // Set up dependency injection scope\n requestScope.inherit(A_Context.scope(this));\n requestScope.register(context);\n\n // Execute send operation\n await this.call(A_ChannelFeatures.onSend, requestScope);\n\n this._processing = false;\n\n } catch (error) {\n this._processing = false;\n\n // Create channel-specific error\n const channelError = new A_ChannelError(error);\n requestScope.register(channelError);\n context.fail(channelError);\n\n // Call error handling hook\n await this.call(A_ChannelFeatures.onError, requestScope);\n\n requestScope.destroy();\n\n // Note: We don't re-throw the error for fire-and-forget operations\n // The error is handled by the onError hook\n }\n }\n\n /**\n * @deprecated This method is deprecated and will be removed in future versions.\n * Use request() or send() methods instead depending on your communication pattern.\n * \n * For request/response pattern: Use request()\n * For fire-and-forget pattern: Use send()\n * For consumer patterns: Implement custom consumer logic using request() in a loop\n */\n async consume<T extends Record<string, any> = Record<string, any>>(): Promise<A_OperationContext<any, T>> {\n await this.initialize;\n\n this._processing = true;\n\n const requestScope = new A_Scope({ name: `a-channel@scope:consume:${A_IdentityHelper.generateTimeId()}` })\n .inherit(A_Context.scope(this));\n\n\n const context = new A_OperationContext('consume', {} as T);\n\n try {\n requestScope.inherit(A_Context.scope(this));\n requestScope.register(context);\n\n\n await this.call(A_ChannelFeatures.onConsume, requestScope);\n\n this._processing = false;\n\n return context as A_OperationContext<any, T>;\n\n } catch (error) {\n\n this._processing = false;\n\n const channelError = new A_ChannelError(error)\n\n context.fail(channelError);\n\n await this.call(A_ChannelFeatures.onError, requestScope);\n\n return context as A_OperationContext<any, T>;\n }\n }\n\n}","import { A_Fragment, A_Meta, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-ExecutionContext',\n description: 'Execution context fragment that provides a structured way to manage metadata and serialized data for execution environments. It allows storing and retrieving key-value pairs, facilitating context-aware operations within the application. It useful in cases when it\\'s necessary to share some runtime data across multiple steps of thee features, or components.'\n})\nexport class A_ExecutionContext<\n _MetaType extends Record<string, any> = Record<string, any>,\n _SerializedType extends Record<string, any> = Record<string, any>\n> extends A_Fragment {\n\n\n protected _meta: A_Meta<_MetaType, _SerializedType>;\n\n constructor(\n name: string,\n defaults?: Partial<_MetaType>,\n ) {\n super({ name });\n this._meta = new A_Meta<_MetaType, _SerializedType>();\n\n for (const key in defaults) {\n this._meta.set(key as keyof _MetaType, defaults[key as keyof _MetaType] as _MetaType[keyof _MetaType]);\n }\n }\n\n\n [Symbol.iterator](): Iterator<[keyof _MetaType, _MetaType[keyof _MetaType]]> {\n return this._meta[Symbol.iterator]();\n }\n\n\n get meta(): A_Meta<_MetaType> {\n return this._meta;\n }\n\n\n get<K extends keyof _MetaType>(key: K): _MetaType[K] | undefined {\n return this._meta.get(key);\n }\n\n set<K extends keyof _MetaType>(key: K, value: _MetaType[K]): this {\n this._meta.set(key, value);\n return this;\n }\n\n has(key: keyof _MetaType): boolean {\n return this._meta.has(key);\n }\n\n drop(key: keyof _MetaType): void {\n this._meta.delete(key);\n }\n\n clear(): this {\n this._meta.clear();\n return this;\n }\n\n\n toRaw(): _SerializedType {\n return this._meta.toJSON();\n }\n\n toJSON(): A_TYPES__Fragment_Serialized {\n return {\n name: this.name,\n ...this.meta.toJSON(),\n }\n }\n}","import { A_Error, A_Fragment } from \"@adaas/a-concept\";\nimport { A_Operation_Serialized, A_Operation_Storage } from \"./A-Operation.types\";\nimport { A_ExecutionContext } from \"../A-Execution/A-Execution.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-OperationContext',\n description: 'Operation execution context that encapsulates the metadata and serialized data related to a specific operation. It provides structured access to operation parameters, results, and error handling, facilitating the management of operation lifecycles within the application.'\n})\nexport class A_OperationContext<\n _AllowedOperations extends string = string,\n _ParamsType extends Record<string, any> = Record<string, any>,\n _ResultType = any,\n _StorageType extends A_Operation_Storage<_ResultType, _ParamsType> = A_Operation_Storage<_ResultType, _ParamsType>\n> extends A_ExecutionContext<\n _StorageType,\n A_Operation_Serialized<_ResultType, _ParamsType>\n> {\n\n constructor(\n operation: _AllowedOperations,\n params?: _ParamsType\n ) {\n super('operation-context');\n\n this.meta.set('name', operation);\n this.meta.set('params', params || {} as _ParamsType);\n }\n\n get name(): _AllowedOperations {\n return (this._meta.get('name') || this._name) as _AllowedOperations;\n }\n\n get result(): _ResultType | undefined {\n return this._meta.get('result');\n }\n\n get error(): A_Error | undefined {\n return this._meta.get('error');\n }\n\n get params(): _ParamsType {\n return this._meta.get('params') || {} as _ParamsType;\n }\n\n\n fail(error: A_Error): void {\n this._meta.set('error', error);\n }\n\n succeed(result: _ResultType): void {\n this._meta.set('result', result);\n }\n\n\n toJSON(): A_Operation_Serialized<_ResultType, _ParamsType> {\n return {\n name: this.name,\n params: this.params,\n result: this.result || {} as _ResultType,\n error: this.error?.toJSON(),\n }\n }\n}","import { A_Error, A_TypeGuards } from \"@adaas/a-concept\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\n\n\nexport class A_ChannelError extends A_Error {\n\n // ==========================================================\n // ==================== Error Types =========================\n // ==========================================================\n\n\n static readonly MethodNotImplemented = 'A-Channel Method Not Implemented';\n\n // ==========================================================\n // ==================== Properties ==========================\n // ==========================================================\n\n protected _context?: A_OperationContext\n\n\n /**\n * Channel Error allows to keep track of errors within a channel if something goes wrong\n * \n * \n * @param originalError \n * @param context \n */\n constructor(\n originalError: string | A_Error | Error | any,\n context?: A_OperationContext | string\n ) {\n if (A_TypeGuards.isString(context))\n super(originalError, context);\n else\n super(originalError);\n\n if (context instanceof A_OperationContext)\n this._context = context\n }\n\n /***\n * Returns Context of the error\n */\n get context(): A_OperationContext | undefined {\n return this._context\n }\n\n\n}","\n\n// ===============================================================\n// ADAAS A-Channel Constants\n// ===============================================================\nexport enum A_ChannelFeatures {\n /**\n * Allows to extend timeout logic and behavior\n */\n onTimeout = '_A_Channel_onTimeout',\n /**\n * Allows to extend retry logic and behavior\n */\n onRetry = '_A_Channel_onRetry',\n /**\n * Allows to extend circuit breaker logic and behavior\n */\n onCircuitBreakerOpen = '_A_Channel_onCircuitBreakerOpen',\n /**\n * Allows to extend cache logic and behavior\n */\n onCache = '_A_Channel_onCache',\n /**\n * Allows to extend connection logic and behavior\n */\n onConnect = '_A_Channel_onConnect',\n /**\n * Allows to extend disconnection logic and behavior\n */\n onDisconnect = '_A_Channel_onDisconnect',\n /**\n * Allows to extend request preparation logic and behavior\n */\n onBeforeRequest = '_A_Channel_onBeforeRequest',\n /**\n * Allows to extend request sending logic and behavior\n */\n onRequest = '_A_Channel_onRequest',\n /**\n * Allows to extend request post-processing logic and behavior\n */\n onAfterRequest = '_A_Channel_onAfterRequest',\n /**\n * Allows to extend error handling logic and behavior\n * \n * [!] The same approach uses for ALL errors within the channel\n */\n onError = '_A_Channel_onError',\n /**\n * Allows to extend send logic and behavior\n */\n onSend = '_A_Channel_onSend',\n /**\n * Allows to extend consume logic and behavior\n */\n onConsume = '_A_Channel_onConsume',\n}\n\n\n// ==============================================================\n// A-Channel Request Constants\n// ===============================================================\nexport enum A_ChannelRequestStatuses {\n /**\n * Request is pending\n */\n PENDING = 'PENDING',\n /***\n * Request was successful\n */\n SUCCESS = 'SUCCESS',\n /**\n * Request failed\n */\n FAILED = 'FAILED',\n}","import { A_Frame } from \"@adaas/a-frame\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_ChannelRequestStatuses } from \"./A-Channel.constants\";\n\n\n\n@A_Frame.Fragment({\n name: 'A-ChannelRequest',\n description: 'Context for managing channel requests. It encapsulates the request parameters and the result including status and data.'\n})\nexport class A_ChannelRequest<\n _ParamsType extends Record<string, any> = Record<string, any>,\n _ResultType extends Record<string, any> = Record<string, any>,\n> extends A_OperationContext<\n 'request',\n _ParamsType,\n {\n data?: _ResultType;\n status?: A_ChannelRequestStatuses;\n }\n> {\n\n constructor(\n params?: _ParamsType,\n ) {\n super('request', params);\n }\n\n\n get status(): A_ChannelRequestStatuses | undefined {\n return this.result?.status;\n }\n\n get data(): _ResultType | undefined {\n return this.result?.data;\n }\n\n\n succeed(result: _ResultType): void {\n const existed = this.result;\n\n super.succeed({\n ...existed,\n data: result,\n status: A_ChannelRequestStatuses.SUCCESS,\n });\n }\n\n} ","/**\n * A-Command Status Enumeration\n * \n * Defines all possible states a command can be in during its lifecycle.\n * Commands progress through these states in a specific order:\n * CREATED → INITIALIZED → COMPILED → EXECUTING → COMPLETED/FAILED\n */\nexport enum A_Command_Status {\n /**\n * Initial state when command is instantiated but not yet ready for execution\n */\n CREATED = 'CREATED',\n\n /**\n * Command has been initialized with execution scope and dependencies\n */\n INITIALIZED = 'INITIALIZED',\n\n /**\n * Command has been compiled and is ready for execution\n */\n COMPILED = 'COMPILED',\n\n /**\n * Command is currently being executed\n */\n EXECUTING = 'EXECUTING',\n\n /**\n * Command has completed successfully\n */\n COMPLETED = 'COMPLETED',\n\n /**\n * Command execution has failed with errors\n */\n FAILED = 'FAILED',\n}\n\n\n/**\n * A-Command State Transitions\n * \n * Defines valid state transitions for command lifecycle management.\n * These transitions are used by the StateMachine to enforce proper command flow.\n */\nexport enum A_CommandTransitions {\n /** Transition from CREATED to INITIALIZED state */\n CREATED_TO_INITIALIZED = 'created_initialized',\n\n /** Transition from INITIALIZED to EXECUTING state */\n INITIALIZED_TO_EXECUTING = 'initialized_executing',\n\n /** Transition from EXECUTING to COMPLETED state (success path) */\n EXECUTING_TO_COMPLETED = 'executing_completed',\n\n /** Transition from EXECUTING to FAILED state (error path) */\n EXECUTING_TO_FAILED = 'executing_failed',\n}\n\n/**\n * A-Command Lifecycle Features\n * \n * Defines feature extension points that components can implement to customize\n * command behavior at different stages of the lifecycle.\n * \n * Components can use @A_Feature.Extend() decorator with these feature names\n * to inject custom logic into command execution.\n */\nexport enum A_CommandFeatures {\n /**\n * Triggered during command initialization phase\n * Use to set up execution environment, validate parameters, or prepare resources\n */\n onInit = '_A_Command_onInit',\n\n /**\n * Triggered before command execution starts\n * Use for pre-execution validation, logging, or setup tasks\n */\n onBeforeExecute = '_A_Command_onBeforeExecute',\n\n /**\n * Main command execution logic\n * Core business logic should be implemented here\n */\n onExecute = '_A_Command_onExecute',\n\n /**\n * Triggered after command execution completes (success or failure)\n * Use for cleanup, logging, or post-processing tasks\n */\n onAfterExecute = '_A_Command_onAfterExecute',\n\n /**\n * Triggered when command completes successfully\n * Use for success-specific operations like notifications or result processing\n */\n onComplete = '_A_Command_onComplete',\n\n /**\n * Triggered when command execution fails\n * Use for error handling, cleanup, or failure notifications\n */\n onFail = '_A_Command_onFail',\n\n /**\n * Triggered when an error occurs during execution\n * Use for error logging, transformation, or recovery attempts\n */\n onError = '_A_Command_onError',\n}\n\n\nexport enum A_CommandEvent {\n /**\n * Triggered during command initialization phase\n * Use to set up execution environment, validate parameters, or prepare resources\n */\n onInit = 'onInit',\n\n /**\n * Triggered before command execution starts\n * Use for pre-execution validation, logging, or setup tasks\n */\n onBeforeExecute = 'onBeforeExecute',\n\n /**\n * Main command execution logic\n * Core business logic should be implemented here\n */\n onExecute = 'onExecute',\n\n /**\n * Triggered after command execution completes (success or failure)\n * Use for cleanup, logging, or post-processing tasks\n */\n onAfterExecute = 'onAfterExecute',\n\n /**\n * Triggered when command completes successfully\n * Use for success-specific operations like notifications or result processing\n */\n onComplete = 'onComplete',\n\n /**\n * Triggered when command execution fails\n * Use for error handling, cleanup, or failure notifications\n */\n onFail = 'onFail',\n\n /**\n * Triggered when an error occurs during execution\n * Use for error logging, transformation, or recovery attempts\n */\n onError = 'onError',\n}\n\n/**\n * Type alias for command lifecycle event names\n * Represents all available events that can be listened to on a command instance\n */\nexport type A_CommandEvents = keyof typeof A_CommandEvent;\n\n\n\n\n\n","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_CommandError extends A_Error {\n\n\n static readonly CommandScopeBindingError = 'A-Command Scope Binding Error';\n\n static readonly ExecutionError = 'A-Command Execution Error';\n\n static readonly ResultProcessingError = 'A-Command Result Processing Error';\n\n\n /**\n * Error indicating that the command was interrupted during execution\n */\n static readonly CommandInterruptedError = 'A-Command Interrupted Error';\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_StateMachineError extends A_Error {\n\n static readonly InitializationError = 'A-StateMachine Initialization Error';\n\n static readonly TransitionError = 'A-StateMachine Transition Error';\n \n}","export enum A_StateMachineFeatures {\n /**\n * Allows to extend error handling logic and behavior\n */\n onError = '_A_StateMachine_onError',\n /**\n * Allows to extend initialization logic and behavior\n */\n onInitialize = '_A_StateMachine_onInitialize',\n /**\n * Allows to extend transition validation logic and behavior\n */\n onBeforeTransition = '_A_StateMachine_onBeforeTransition',\n /**\n * Allows to extend post-transition logic and behavior\n */\n onAfterTransition = '_A_StateMachine_onAfterTransition',\n}","import { A_Frame } from \"@adaas/a-frame\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_StateMachineTransitionParams, A_StateMachineTransitionStorage } from \"./A-StateMachine.types\";\n\n\n\n@A_Frame.Fragment({\n name: 'A-StateMachineTransition',\n description: 'Context for managing state machine transitions.'\n})\nexport class A_StateMachineTransition<\n _ParamsType = any,\n _ResultType = any\n> extends A_OperationContext<\n 'a-state-machine-transition',\n A_StateMachineTransitionParams<_ParamsType>,\n _ResultType,\n A_StateMachineTransitionStorage<_ResultType, _ParamsType>\n> {\n\n constructor(\n params: A_StateMachineTransitionParams<_ParamsType>\n ) {\n super(\n 'a-state-machine-transition',\n params\n );\n\n this._meta.set('from', params.from);\n this._meta.set('to', params.to);\n }\n\n /**\n * The state to transition from\n */\n get from(): string {\n return this._meta.get('from')!;\n }\n\n /**\n * The state to transition to\n */\n get to(): string {\n return this._meta.get('to')!;\n }\n\n}","import { A_Component, A_Context, A_Feature, A_FormatterHelper, A_Scope } from \"@adaas/a-concept\";\nimport { A_StateMachineError } from \"./A-StateMachine.error\";\nimport { A_StateMachineFeatures } from \"./A-StateMachine.constants\";\nimport { A_StateMachineTransition } from \"./A-StateMachineTransition.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_StateMachine is a powerful state machine implementation that allows you to define and manage\n * complex state transitions with validation, hooks, and error handling.\n * \n * @template T - A record type defining the state transitions and their associated data types.\n * Each key represents a state name, and the value represents the data type for that state.\n * \n * @example\n * ```typescript\n * interface OrderStates {\n * pending: { orderId: string };\n * processing: { orderId: string; processedBy: string };\n * completed: { orderId: string; completedAt: Date };\n * cancelled: { orderId: string; reason: string };\n * }\n * \n * class OrderStateMachine extends A_StateMachine<OrderStates> {\n * // Define custom transition logic\n * async pending_processing(scope: A_Scope) {\n * const operation = scope.resolve(A_StateMachineTransition)!;\n * const { orderId } = operation.props;\n * // Custom validation and business logic\n * }\n * }\n * ```\n */\n\n@A_Frame.Namespace('A-Utils')\n@A_Frame.Component({\n name: 'A-StateMachine',\n description: 'A powerful state machine component for managing complex state transitions.'\n})\nexport class A_StateMachine<\n T extends Record<string, any> = Record<string, any>\n> extends A_Component {\n\n /**\n * Internal promise that tracks the initialization state of the state machine.\n * Used to ensure the state machine is properly initialized before allowing transitions.\n */\n protected _initialized?: Promise<void>;\n\n /**\n * Gets a promise that resolves when the state machine is fully initialized and ready for transitions.\n * This ensures that all initialization hooks have been executed before allowing state transitions.\n * \n * @returns Promise<void> that resolves when initialization is complete\n * \n * @example\n * ```typescript\n * const stateMachine = new MyStateMachine();\n * await stateMachine.ready; // Wait for initialization\n * await stateMachine.transition('idle', 'running');\n * ```\n */\n get ready(): Promise<void> {\n if (!this._initialized) {\n this._initialized = this.call(A_StateMachineFeatures.onInitialize);\n }\n\n return this._initialized;\n }\n\n\n\n /**\n * Initialization hook that runs when the state machine is first created.\n * This method can be extended to add custom initialization logic.\n * \n * @param args - Variable arguments passed during initialization\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onInitialize]() {\n * // Custom initialization logic\n * console.log('State machine initialized');\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onInitialize](...args: any[]): Promise<void> {\n // Initialization logic can be added here\n }\n\n /**\n * Hook that runs before any state transition occurs.\n * Use this to add validation, logging, or preparation logic that should run for all transitions.\n * \n * @param args - Variable arguments, typically includes the transition scope\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onBeforeTransition](scope: A_Scope) {\n * const operation = scope.resolve(A_StateMachineTransition)!;\n * console.log(`Transitioning from ${operation.props.from} to ${operation.props.to}`);\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onBeforeTransition](...args: any[]): Promise<void> {\n\n }\n\n /**\n * Hook that runs after a successful state transition.\n * Use this to add cleanup, logging, or post-transition logic that should run for all transitions.\n * \n * @param args - Variable arguments, typically includes the transition scope\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onAfterTransition](scope: A_Scope) {\n * const operation = scope.resolve(A_StateMachineTransition)!;\n * console.log(`Successfully transitioned to ${operation.props.to}`);\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onAfterTransition](...args: any[]): Promise<void> {\n\n }\n\n /**\n * Error handling hook that runs when a transition fails.\n * Use this to add custom error handling, logging, or recovery logic.\n * \n * @param args - Variable arguments, typically includes the error scope\n * @returns Promise<void>\n * \n * @example\n * ```typescript\n * class MyStateMachine extends A_StateMachine {\n * @A_Feature.Extend()\n * async [A_StateMachineFeatures.onError](scope: A_Scope) {\n * const error = scope.resolve(A_StateMachineError);\n * console.error('Transition failed:', error?.message);\n * }\n * }\n * ```\n */\n @A_Feature.Extend()\n async [A_StateMachineFeatures.onError](...args: any[]): Promise<void> {\n // Default error handling logic can be added here\n }\n\n\n\n /**\n * Executes a state transition from one state to another.\n * This is the core method of the state machine that handles the complete transition lifecycle.\n * \n * @param from - The state to transition from (must be a key of T)\n * @param to - The state to transition to (must be a key of T)\n * @param props - Optional properties to pass to the transition context (should match T[keyof T])\n * @returns Promise<void> that resolves when the transition is complete\n * \n * @throws {A_StateMachineError} When the transition fails for any reason\n * \n * @example\n * ```typescript\n * interface OrderStates {\n * pending: { orderId: string };\n * processing: { orderId: string; processedBy: string };\n * }\n * \n * const orderMachine = new A_StateMachine<OrderStates>();\n * \n * // Transition with props\n * await orderMachine.transition('pending', 'processing', {\n * orderId: '12345',\n * processedBy: 'user-456'\n * });\n * ```\n * \n * The transition process follows this lifecycle:\n * 1. Wait for state machine initialization (ready)\n * 2. Create transition name in camelCase format (e.g., \"pending_processing\")\n * 3. Create operation context with transition data\n * 4. Create isolated scope for the transition\n * 5. Call onBeforeTransition hook\n * 6. Execute the specific transition method (if defined)\n * 7. Call onAfterTransition hook\n * 8. Clean up scope and return result\n * \n * If any step fails, the onError hook is called and a wrapped error is thrown.\n */\n @A_Frame.Method({\n name: 'transition',\n description: 'Executes a state transition from one state to another.'\n })\n async transition(\n /**\n * The state to transition from\n */\n from: keyof T,\n /**\n * The state to transition to\n */\n to: keyof T,\n /**\n * Optional properties to pass to the transition context\n */\n props?: T[keyof T]\n ): Promise<void> {\n\n await this.ready;\n\n const transitionName = `${A_FormatterHelper.toCamelCase(String(from))}_${A_FormatterHelper.toCamelCase(String(to))}`;\n\n const transition = new A_StateMachineTransition({\n from: String(from),\n to: String(to),\n props\n });\n\n const scope = new A_Scope({\n name: `A-StateMachine-Transition-Scope-${transitionName}`,\n fragments: [transition]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_StateMachineFeatures.onBeforeTransition, scope);\n\n await this.call(transitionName, scope);\n\n await this.call(A_StateMachineFeatures.onAfterTransition, scope);\n\n scope.destroy();\n\n return transition.result;\n\n } catch (error) {\n const wrappedError = new A_StateMachineError({\n title: A_StateMachineError.TransitionError,\n description: `An error occurred while transitioning to \"${transitionName}\"`,\n originalError: error\n });\n\n scope.register(wrappedError);\n\n await this.call(A_StateMachineFeatures.onError, scope);\n\n scope.destroy();\n\n throw wrappedError;\n }\n }\n}\n\n\n","export const A_CONSTANTS__CONFIG_ENV_VARIABLES = {\n\n} as const\n\n\n//should be an array\nexport type A_TYPES__ConfigENVVariables = (typeof A_CONSTANTS__CONFIG_ENV_VARIABLES)[keyof typeof A_CONSTANTS__CONFIG_ENV_VARIABLES][];\n\n\nexport const A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY = [\n\n] as const;\n\n","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_ConfigError extends A_Error {\n\n static readonly InitializationError = 'A-Config Initialization Error';\n}","import { A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_FormatterHelper, A_TYPES__ConceptENVVariables } from \"@adaas/a-concept\";\nimport { A_TYPES__ConfigContainerConstructor } from \"./A-Config.types\";\nimport { A_ExecutionContext } from \"../A-Execution/A-Execution.context\";\nimport { A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY } from \"./A-Config.constants\";\nimport { A_ConfigError } from \"./A-Config.error\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-Config',\n description: 'Configuration management context that provides structured access to application configuration variables, supporting defaults and strict mode for enhanced reliability. Default environment variables are included for comprehensive configuration handling.'\n})\nexport class A_Config<\n T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]\n> extends A_ExecutionContext<\n { [key in T[number]]: any; } & {\n [key in typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY[number]]: any\n } & {\n [key in typeof A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY[number]]: any\n }\n> {\n protected _strict: boolean;\n protected _configProperties!: T;\n\n protected DEFAULT_ALLOWED_TO_READ_PROPERTIES = [\n ...A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,\n ...A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY\n ];\n\n\n constructor(\n config: Partial<A_TYPES__ConfigContainerConstructor<T>>\n ) {\n super('a-config');\n\n this._strict = config.strict ?? false;\n this._configProperties = config.variables ?? [] as any;\n\n\n for (const key in config.defaults) {\n this.set(\n A_FormatterHelper.toUpperSnakeCase(key),\n config.defaults[key as T[number]]\n );\n }\n }\n\n\n get strict(): boolean {\n return this._strict;\n }\n\n\n /** \n * This method is used to get the configuration property by name\n * \n * @param property \n * @returns \n */\n get<K extends T[number]>(\n property: K | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]\n ): { [key in T[number]]: any; }[K] | undefined {\n if (this._configProperties.includes(property as any)\n || this.DEFAULT_ALLOWED_TO_READ_PROPERTIES.includes(property as any)\n || !this._strict\n )\n return super.get(A_FormatterHelper.toUpperSnakeCase(property));\n\n throw new A_ConfigError('Property not exists or not allowed to read');\n }\n\n\n /**\n * \n * This method is used to set the configuration property by name\n * OR set multiple properties at once by passing an array of objects\n * \n * @param variables \n */\n set(\n variables: Array<{\n property: T[number] | A_TYPES__ConceptENVVariables[number],\n value: any\n }>\n )\n set(\n variables: Partial<Record<T[number] | A_TYPES__ConceptENVVariables[number], any>>\n )\n set(\n property: T[number] | A_TYPES__ConceptENVVariables[number],\n value: any\n )\n set(\n property: T[number] | A_TYPES__ConceptENVVariables[number] | Array<{\n property: T[number] | A_TYPES__ConceptENVVariables[number],\n value: any\n }> | Partial<Record<T[number] | A_TYPES__ConceptENVVariables[number], any>>,\n value?: any\n ) {\n const array = Array.isArray(property)\n ? property\n : typeof property === 'string'\n ? [{ property, value }]\n : Object\n .keys(property)\n .map((key) => ({\n property: key,\n value: property[key]\n }));\n\n for (const { property, value } of array) {\n super.set(A_FormatterHelper.toUpperSnakeCase(property), value);\n }\n }\n}","/**\n * A-Logger Constants\n * \n * Configuration constants and default values for the A_Logger component\n */\n\n/**\n * Default scope length for consistent message alignment\n */\nexport const A_LOGGER_DEFAULT_SCOPE_LENGTH = 20;\n\n/**\n * Default log level when none is specified\n */\nexport const A_LOGGER_DEFAULT_LEVEL = 'all';\n\n/**\n * Terminal color codes mapping\n */\nexport const A_LOGGER_COLORS = {\n // System colors (reserved for specific purposes)\n red: '31', // Errors, critical issues\n yellow: '33', // Warnings, caution messages\n green: '32', // Success, completion messages\n \n // Safe palette for random selection (grey-blue-violet theme)\n blue: '34', // Info, general messages\n cyan: '36', // Headers, titles\n magenta: '35', // Special highlighting\n gray: '90', // Debug, less important info\n brightBlue: '94', // Bright blue variant\n brightCyan: '96', // Bright cyan variant\n brightMagenta: '95', // Bright magenta variant\n darkGray: '30', // Dark gray\n lightGray: '37', // Light gray (white)\n \n // Extended blue-violet palette\n indigo: '38;5;54', // Deep indigo\n violet: '38;5;93', // Violet\n purple: '38;5;129', // Purple\n lavender: '38;5;183', // Lavender\n skyBlue: '38;5;117', // Sky blue\n steelBlue: '38;5;67', // Steel blue\n slateBlue: '38;5;62', // Slate blue\n deepBlue: '38;5;18', // Deep blue\n lightBlue: '38;5;153', // Light blue\n periwinkle: '38;5;111', // Periwinkle\n cornflower: '38;5;69', // Cornflower blue\n powder: '38;5;152', // Powder blue\n \n // Additional grays for variety\n charcoal: '38;5;236', // Charcoal\n silver: '38;5;250', // Silver\n smoke: '38;5;244', // Smoke gray\n slate: '38;5;240', // Slate gray\n} as const;\n\n/**\n * Safe colors for random selection - grey-blue-violet palette\n * Excludes system colors (red, yellow, green) to avoid confusion with warnings/errors\n */\nexport const A_LOGGER_SAFE_RANDOM_COLORS = [\n 'blue', 'cyan', 'magenta', 'gray', 'brightBlue', 'brightCyan', 'brightMagenta',\n 'darkGray', 'lightGray', 'indigo', 'violet', 'purple', 'lavender', 'skyBlue',\n 'steelBlue', 'slateBlue', 'deepBlue', 'lightBlue', 'periwinkle', 'cornflower',\n 'powder', 'charcoal', 'silver', 'smoke', 'slate'\n] as const;\n\n/**\n * ANSI escape codes\n */\nexport const A_LOGGER_ANSI = {\n RESET: '\\x1b[0m',\n PREFIX: '\\x1b[',\n SUFFIX: 'm'\n} as const;\n\n/**\n * Timestamp format configuration\n */\nexport const A_LOGGER_TIME_FORMAT = {\n MINUTES_PAD: 2,\n SECONDS_PAD: 2,\n MILLISECONDS_PAD: 3,\n SEPARATOR: ':'\n} as const;\n\n/**\n * Log message structure constants\n */\nexport const A_LOGGER_FORMAT = {\n SCOPE_OPEN: '[',\n SCOPE_CLOSE: ']',\n TIME_OPEN: '|',\n TIME_CLOSE: '|',\n SEPARATOR: '-------------------------------',\n INDENT_BASE: 3,\n PIPE: '| '\n} as const;\n\n/**\n * Environment variable keys\n */\n/**\n * Terminal width configuration\n */\nexport const A_LOGGER_TERMINAL = {\n DEFAULT_WIDTH: 80, // Default terminal width when can't be detected\n MIN_WIDTH: 40, // Minimum width for formatted output\n MAX_LINE_LENGTH_RATIO: 0.8, // Use 80% of terminal width for content\n BROWSER_DEFAULT_WIDTH: 120 // Default width for browser console\n} as const;\n\n/**\n * Environment variable keys\n */\nexport const A_LOGGER_ENV_KEYS = {\n LOG_LEVEL: 'A_LOGGER_LEVEL',\n DEFAULT_SCOPE_LENGTH: 'A_LOGGER_DEFAULT_SCOPE_LENGTH',\n DEFAULT_SCOPE_COLOR: 'A_LOGGER_DEFAULT_SCOPE_COLOR',\n DEFAULT_LOG_COLOR: 'A_LOGGER_DEFAULT_LOG_COLOR'\n} as const;","import { A_Component, A_Context, A_Error, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_Config } from \"../A-Config/A-Config.context\";\nimport { A_LoggerEnvVariablesType } from \"./A-Logger.env\";\nimport { A_LoggerLevel, A_LoggerColorName } from \"./A-Logger.types\";\nimport {\n A_LOGGER_DEFAULT_SCOPE_LENGTH,\n A_LOGGER_COLORS,\n A_LOGGER_ANSI,\n A_LOGGER_TIME_FORMAT,\n A_LOGGER_FORMAT,\n A_LOGGER_ENV_KEYS,\n A_LOGGER_SAFE_RANDOM_COLORS,\n A_LOGGER_TERMINAL\n} from \"./A-Logger.constants\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_Logger - Advanced Logging Component with Scope-based Output Formatting\n * \n * This component provides comprehensive logging capabilities with:\n * - Color-coded console output for different log levels\n * - Scope-based message formatting with consistent alignment\n * - Support for multiple data types (objects, errors, strings)\n * - Configurable log levels for filtering output\n * - Special handling for A_Error and native Error objects\n * - Timestamp inclusion for better debugging\n * \n * Key Features:\n * - **Scope Integration**: Uses A_Scope for consistent message prefixing\n * - **Color Support**: Terminal color codes for visual distinction\n * - **Object Formatting**: Pretty-prints JSON objects with proper indentation\n * - **Error Handling**: Special formatting for A_Error and Error objects\n * - **Log Level Filtering**: Configurable filtering based on severity\n * - **Multi-line Support**: Proper alignment for multi-line messages\n * \n * @example\n * ```typescript\n * // Basic usage with dependency injection (uses deterministic colors based on scope name)\n * class MyService {\n * constructor(@A_Inject(A_Logger) private logger: A_Logger) {}\n * \n * doSomething() {\n * this.logger.info('Processing started'); // Uses scope-name-based colors, always shows\n * this.logger.debug('Debug information'); // Only shows when debug level enabled\n * \n * // Color overload methods with enum support\n * this.logger.info('green', 'Success message'); // Green message, scope stays default\n * this.logger.debug('gray', 'Verbose debug info'); // Gray message for less important info\n * this.logger.info('brightBlue', 'Important notification');\n * \n * // Terminal width aware formatting - automatically wraps long lines\n * this.logger.info('This is a very long message that will be automatically wrapped to fit within the terminal width while maintaining proper indentation and formatting');\n * \n * this.logger.warning('Something might be wrong');\n * this.logger.error(new Error('Something failed'));\n * }\n * }\n * \n * // Same scope names will always get the same colors automatically\n * const logger1 = new A_Logger(new A_Scope({name: 'UserService'})); // Gets consistent colors\n * const logger2 = new A_Logger(new A_Scope({name: 'UserService'})); // Gets same colors as logger1\n * \n * // Available color names (A_LoggerColorName enum):\n * // 'red', 'yellow', 'green', 'blue', 'cyan', 'magenta', 'gray',\n * // 'brightBlue', 'brightCyan', 'brightMagenta', 'darkGray', 'lightGray',\n * // 'indigo', 'violet', 'purple', 'lavender', 'skyBlue', 'steelBlue',\n * // 'slateBlue', 'deepBlue', 'lightBlue', 'periwinkle', 'cornflower',\n * // 'powder', 'charcoal', 'silver', 'smoke', 'slate'\n * \n * // Configuration via environment variables or A_Config (overrides automatic selection)\n * process.env.A_LOGGER_DEFAULT_SCOPE_COLOR = 'magenta';\n * process.env.A_LOGGER_DEFAULT_LOG_COLOR = 'green';\n * \n * // Or through A_Config instance\n * const config = new A_Config({\n * A_LOGGER_DEFAULT_SCOPE_COLOR: 'red',\n * A_LOGGER_DEFAULT_LOG_COLOR: 'white'\n * });\n * const logger = new A_Logger(scope, config);\n * ```\n */\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A_Logger',\n description: 'Advanced Logging Component with Scope-based Output Formatting that provides color-coded console output, multi-type support, and configurable log levels for enhanced debugging and monitoring.'\n})\nexport class A_Logger extends A_Component {\n\n // =============================================\n // Configuration and Constants\n // =============================================\n\n /**\n * Terminal color codes for different log levels and custom styling\n * These codes work with ANSI escape sequences for colored terminal output\n */\n readonly COLORS;\n\n /**\n * Standard scope length for consistent formatting\n * This ensures all log messages align properly regardless of scope name length\n */\n private readonly STANDARD_SCOPE_LENGTH;\n\n /**\n * Default color for the scope portion of log messages\n * This color is used for the scope brackets and content, and remains consistent\n * for this logger instance regardless of message color overrides\n */\n private readonly DEFAULT_SCOPE_COLOR: keyof typeof A_LOGGER_COLORS;\n\n /**\n * Default color for log message content when no explicit color is provided\n * This color is used for the message body when logging without specifying a color\n */\n private readonly DEFAULT_LOG_COLOR: keyof typeof A_LOGGER_COLORS;\n\n /**\n * Current terminal width for responsive formatting\n * Automatically detected or falls back to default values\n */\n private readonly TERMINAL_WIDTH: number;\n\n /**\n * Maximum content width based on terminal size\n * Used for word wrapping and line length calculations\n */\n private readonly MAX_CONTENT_WIDTH: number;\n\n // =============================================\n // Constructor and Initialization\n // =============================\n\n /**\n * Initialize A_Logger with dependency injection\n * Colors are configured through A_Config or generated randomly if not provided\n * \n * @param scope - The current scope context for message prefixing\n * @param config - Optional configuration for log level filtering and color settings\n */\n constructor(\n @A_Inject(A_Scope) protected scope: A_Scope,\n @A_Inject(A_Config) protected config?: A_Config<A_LoggerEnvVariablesType>\n ) {\n super();\n this.COLORS = A_LOGGER_COLORS;\n this.STANDARD_SCOPE_LENGTH = config?.get(A_LOGGER_ENV_KEYS.DEFAULT_SCOPE_LENGTH) || A_LOGGER_DEFAULT_SCOPE_LENGTH;\n\n // Get colors from config or generate deterministic colors based on scope name\n const configScopeColor = config?.get(A_LOGGER_ENV_KEYS.DEFAULT_SCOPE_COLOR) as keyof typeof A_LOGGER_COLORS;\n const configLogColor = config?.get(A_LOGGER_ENV_KEYS.DEFAULT_LOG_COLOR) as keyof typeof A_LOGGER_COLORS;\n\n if (configScopeColor || configLogColor) {\n // If any color is configured, use config values or fallback to scope-based selection\n this.DEFAULT_SCOPE_COLOR = configScopeColor || this.generateColorFromScopeName(this.scope.name);\n this.DEFAULT_LOG_COLOR = configLogColor || this.generateColorFromScopeName(this.scope.name);\n } else {\n // If no colors configured, generate complementary pair based on scope name\n const complementaryColors = this.generateComplementaryColorsFromScope(this.scope.name);\n this.DEFAULT_SCOPE_COLOR = complementaryColors.scopeColor;\n this.DEFAULT_LOG_COLOR = complementaryColors.logColor;\n }\n\n // Initialize terminal width detection\n this.TERMINAL_WIDTH = this.detectTerminalWidth();\n this.MAX_CONTENT_WIDTH = Math.floor(this.TERMINAL_WIDTH * A_LOGGER_TERMINAL.MAX_LINE_LENGTH_RATIO);\n }\n\n // =============================================\n // Color Generation Utilities\n // =============================================\n\n /**\n * Generate a simple hash from a string\n * Used to create deterministic color selection based on scope name\n * \n * @param str - The string to hash\n * @returns A numeric hash value\n */\n private simpleHash(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32-bit integer\n }\n return Math.abs(hash);\n }\n\n /**\n * Generate a deterministic color based on scope name\n * Same scope names will always get the same color, but uses safe color palette\n * \n * @param scopeName - The scope name to generate color for\n * @returns A color key from the safe colors palette\n */\n private generateColorFromScopeName(scopeName: string): keyof typeof A_LOGGER_COLORS {\n const safeColors = A_LOGGER_SAFE_RANDOM_COLORS;\n const hash = this.simpleHash(scopeName);\n const colorIndex = hash % safeColors.length;\n return safeColors[colorIndex];\n }\n\n /**\n * Generate a pair of complementary colors based on scope name\n * Ensures visual harmony between scope and message colors while being deterministic\n * \n * @param scopeName - The scope name to base colors on\n * @returns Object with scopeColor and logColor that work well together\n */\n private generateComplementaryColorsFromScope(scopeName: string): { scopeColor: keyof typeof A_LOGGER_COLORS, logColor: keyof typeof A_LOGGER_COLORS } {\n // Define color groups that work well together\n const colorPairs = [\n { scopeColor: 'indigo' as const, logColor: 'lightBlue' as const },\n { scopeColor: 'deepBlue' as const, logColor: 'cyan' as const },\n { scopeColor: 'purple' as const, logColor: 'lavender' as const },\n { scopeColor: 'steelBlue' as const, logColor: 'skyBlue' as const },\n { scopeColor: 'slateBlue' as const, logColor: 'periwinkle' as const },\n { scopeColor: 'charcoal' as const, logColor: 'silver' as const },\n { scopeColor: 'violet' as const, logColor: 'brightMagenta' as const },\n { scopeColor: 'darkGray' as const, logColor: 'lightGray' as const },\n { scopeColor: 'cornflower' as const, logColor: 'powder' as const },\n { scopeColor: 'slate' as const, logColor: 'smoke' as const },\n ];\n\n const hash = this.simpleHash(scopeName);\n const pairIndex = hash % colorPairs.length;\n return colorPairs[pairIndex];\n }\n\n // =============================================\n // Terminal Width Detection\n // =============================================\n\n /**\n * Detect current terminal width based on environment\n * \n * Returns appropriate width for different environments:\n * - Node.js: Uses process.stdout.columns if available\n * - Browser: Returns browser default width\n * - Fallback: Returns default terminal width\n * \n * @returns Terminal width in characters\n */\n private detectTerminalWidth(): number {\n try {\n // Browser environment\n if (A_Context.environment === 'browser') {\n return A_LOGGER_TERMINAL.BROWSER_DEFAULT_WIDTH;\n }\n\n // Node.js environment - try to get actual terminal width\n if (typeof process !== 'undefined' && process.stdout && process.stdout.columns) {\n const cols = process.stdout.columns;\n // Ensure minimum width for readability\n return Math.max(cols, A_LOGGER_TERMINAL.MIN_WIDTH);\n }\n\n // Fallback to default width\n return A_LOGGER_TERMINAL.DEFAULT_WIDTH;\n } catch (error) {\n // If any error occurs, fall back to default width\n return A_LOGGER_TERMINAL.DEFAULT_WIDTH;\n }\n }\n\n /**\n * Wrap text to fit within terminal width while preserving formatting\n * \n * @param text - Text to wrap\n * @param scopePadding - The scope padding string for alignment\n * @param isFirstLine - Whether this is the first line (affects available width calculation)\n * @returns Array of wrapped lines with proper indentation\n */\n private wrapText(text: string, scopePadding: string, isFirstLine: boolean = true): string[] {\n if (A_Context.environment === 'browser') {\n // In browser, don't wrap - let browser console handle it\n return [text];\n }\n\n // Calculate available width for text content\n // First line: terminal_width - scope_header_length (includes [scope] |time| part)\n // Continuation lines: terminal_width - scope_padding - pipe_length\n const scopeHeaderLength = this.formattedScope.length + 4 + this.getTime().length + 4; // [scope] |time| \n const continuationIndent = `${scopePadding}${A_LOGGER_FORMAT.PIPE}`;\n\n const firstLineMaxWidth = Math.max(this.TERMINAL_WIDTH - scopeHeaderLength - 1, 20); // -1 for space\n const continuationMaxWidth = Math.max(this.TERMINAL_WIDTH - continuationIndent.length, 20);\n\n // If text fits on first line, return as is\n if (isFirstLine && text.length <= firstLineMaxWidth) {\n return [text];\n }\n\n const lines: string[] = [];\n const words = text.split(' ');\n let currentLine = '';\n let currentMaxWidth = isFirstLine ? firstLineMaxWidth : continuationMaxWidth;\n let isCurrentLineFirst = isFirstLine;\n\n for (const word of words) {\n const spaceNeeded = currentLine ? 1 : 0; // Space before word\n const totalLength = currentLine.length + spaceNeeded + word.length;\n\n // If adding this word would exceed current line's max width\n if (totalLength > currentMaxWidth) {\n if (currentLine) {\n lines.push(currentLine);\n currentLine = word;\n // After first line, all subsequent lines use continuation width\n currentMaxWidth = continuationMaxWidth;\n isCurrentLineFirst = false;\n } else {\n // Word itself is too long, split it\n if (word.length > currentMaxWidth) {\n const chunks = this.splitLongWord(word, currentMaxWidth);\n lines.push(...chunks.slice(0, -1));\n currentLine = chunks[chunks.length - 1];\n } else {\n currentLine = word;\n }\n currentMaxWidth = continuationMaxWidth;\n isCurrentLineFirst = false;\n }\n } else {\n currentLine += (currentLine ? ' ' : '') + word;\n }\n }\n\n if (currentLine) {\n lines.push(currentLine);\n }\n\n return lines.length ? lines : [text];\n }\n\n /**\n * Split a long word that doesn't fit on a single line\n * \n * @param word - Word to split\n * @param maxLength - Maximum length per chunk\n * @returns Array of word chunks\n */\n private splitLongWord(word: string, maxLength: number): string[] {\n const chunks: string[] = [];\n for (let i = 0; i < word.length; i += maxLength) {\n chunks.push(word.slice(i, i + maxLength));\n }\n return chunks;\n }\n\n // =============================================\n // Factory Methods\n // =============================\n\n\n\n // =============================================\n // Scope and Formatting Utilities\n // =============================================\n\n /**\n * Get the formatted scope length for consistent message alignment\n * Uses a standard length to ensure all messages align properly regardless of scope name\n * \n * @returns The scope length to use for padding calculations\n */\n get scopeLength(): number {\n return Math.max(this.scope.name.length, this.STANDARD_SCOPE_LENGTH);\n }\n\n /**\n * Get the formatted scope name with proper padding, centered within the container\n * Ensures consistent width for all scope names in log output with centered alignment\n * \n * @returns Centered and padded scope name for consistent formatting\n */\n get formattedScope(): string {\n const scopeName = this.scope.name;\n const totalLength = this.STANDARD_SCOPE_LENGTH;\n\n // If scope name is longer than standard length, truncate it\n if (scopeName.length >= totalLength) {\n return scopeName.substring(0, totalLength);\n }\n\n // Calculate padding for centering\n const totalPadding = totalLength - scopeName.length;\n const leftPadding = Math.floor(totalPadding / 2);\n const rightPadding = totalPadding - leftPadding;\n\n return ' '.repeat(leftPadding) + scopeName + ' '.repeat(rightPadding);\n }\n\n\n // =============================================\n // Message Compilation and Formatting\n // =============================================\n\n /**\n * Compile log arguments into formatted console output with colors and proper alignment\n * \n * This method handles the core formatting logic for all log messages:\n * - Applies separate colors for scope and message content\n * - Formats scope names with consistent padding\n * - Handles different data types appropriately\n * - Maintains proper indentation for multi-line content\n * \n * @param messageColor - The color key to apply to the message content\n * @param args - Variable arguments to format and display\n * @returns Array of formatted strings and/or objects ready for console output\n */\n compile(\n messageColor: keyof typeof this.COLORS,\n ...args: any[]\n ): Array<any> {\n const timeString = this.getTime();\n // Calculate padding based on actual displayed scope width (STANDARD_SCOPE_LENGTH)\n // Plus 3 for the brackets and space: [scope] \n const scopePadding = ' '.repeat(this.STANDARD_SCOPE_LENGTH + 3);\n const isMultiArg = args.length > 1;\n\n return [\n // Header with separate colors for scope and message content\n `${A_LOGGER_ANSI.PREFIX}${this.COLORS[this.DEFAULT_SCOPE_COLOR]}${A_LOGGER_ANSI.SUFFIX}${A_LOGGER_FORMAT.SCOPE_OPEN}${this.formattedScope}${A_LOGGER_FORMAT.SCOPE_CLOSE}${A_LOGGER_ANSI.RESET} ${A_LOGGER_ANSI.PREFIX}${this.COLORS[messageColor]}${A_LOGGER_ANSI.SUFFIX}${A_LOGGER_FORMAT.TIME_OPEN}${timeString}${A_LOGGER_FORMAT.TIME_CLOSE}`,\n\n // Top separator for multi-argument messages\n isMultiArg ? '\\n' + `${scopePadding}${A_LOGGER_FORMAT.TIME_OPEN}${A_LOGGER_FORMAT.SEPARATOR}` : '',\n\n // Process each argument with appropriate formatting\n ...args.map((arg, i) => {\n const shouldAddNewline = i > 0 || isMultiArg;\n\n switch (true) {\n case arg instanceof A_Error:\n return this.compile_A_Error(arg);\n\n case arg instanceof Error:\n return this.compile_Error(arg);\n\n case typeof arg === 'object' && arg !== null:\n return this.formatObject(arg, shouldAddNewline, scopePadding);\n\n default:\n return this.formatString(String(arg), shouldAddNewline, scopePadding);\n }\n }),\n\n // Bottom separator and color reset\n isMultiArg\n ? '\\n' + `${scopePadding}${A_LOGGER_FORMAT.TIME_OPEN}${A_LOGGER_FORMAT.SEPARATOR}${A_LOGGER_ANSI.RESET}`\n : A_LOGGER_ANSI.RESET\n ];\n }\n\n /**\n * Format an object for display with proper JSON indentation and terminal width awareness\n * \n * @param obj - The object to format\n * @param shouldAddNewline - Whether to add a newline prefix\n * @param scopePadding - The padding string for consistent alignment\n * @returns Formatted object string or the object itself for browser environments\n */\n private formatObject(obj: any, shouldAddNewline: boolean, scopePadding: string): any {\n\n // In case it's browser, return the object as is to use native console object rendering\n // This allows the browser console to display objects with its native interactive features\n if (A_Context.environment === 'browser') {\n return obj;\n }\n\n // Handle null and undefined values\n if (obj === null) {\n return shouldAddNewline ? `\\n${scopePadding}${A_LOGGER_FORMAT.PIPE}null` : 'null';\n }\n if (obj === undefined) {\n return shouldAddNewline ? `\\n${scopePadding}${A_LOGGER_FORMAT.PIPE}undefined` : 'undefined';\n }\n\n let jsonString: string;\n try {\n jsonString = JSON.stringify(obj, null, 2);\n } catch (error) {\n // Handle circular references and other JSON errors\n try {\n const seen = new WeakSet();\n jsonString = JSON.stringify(obj, (key, value) => {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return '[Circular Reference]';\n }\n seen.add(value);\n }\n return value;\n }, 2);\n } catch (fallbackError) {\n // If all else fails, convert to string\n jsonString = String(obj);\n }\n }\n\n // Apply terminal width wrapping to long JSON string values\n const continuationIndent = `${scopePadding}${A_LOGGER_FORMAT.PIPE}`;\n const maxJsonLineWidth = this.TERMINAL_WIDTH - continuationIndent.length - 4; // -4 for JSON indentation\n\n // Split into lines and wrap long string values\n const lines = jsonString.split('\\n').map(line => {\n // Check if this line contains a long string value\n const stringValueMatch = line.match(/^(\\s*\"[^\"]+\":\\s*\")([^\"]+)(\".*)?$/);\n if (stringValueMatch && stringValueMatch[2].length > maxJsonLineWidth - stringValueMatch[1].length - (stringValueMatch[3] || '').length) {\n const [, prefix, value, suffix = ''] = stringValueMatch;\n\n // Wrap the string value if it's too long\n if (value.length > maxJsonLineWidth - prefix.length - suffix.length) {\n const wrappedValue = this.wrapJsonStringValue(value, maxJsonLineWidth - prefix.length - suffix.length);\n return prefix + wrappedValue + suffix;\n }\n }\n return line;\n });\n\n const formatted = lines.join('\\n' + continuationIndent);\n return shouldAddNewline ? '\\n' + continuationIndent + formatted : formatted;\n }\n\n /**\n * Wrap a long JSON string value while preserving readability\n * \n * @param value - The string value to wrap\n * @param maxWidth - Maximum width for the value\n * @returns Wrapped string value\n */\n private wrapJsonStringValue(value: string, maxWidth: number): string {\n if (value.length <= maxWidth) {\n return value;\n }\n\n // For JSON string values, truncate with ellipsis to maintain JSON validity\n // This prevents the JSON from becoming unreadable due to excessive wrapping\n // while still showing the most important part of the string\n if (maxWidth > 6) { // Ensure we have room for ellipsis\n return value.substring(0, maxWidth - 3) + '...';\n } else {\n // If maxWidth is very small, just return truncated value\n return value.substring(0, Math.max(1, maxWidth));\n }\n }\n\n /**\n * Format a string for display with proper indentation and terminal width wrapping\n * \n * @param str - The string to format\n * @param shouldAddNewline - Whether to add a newline prefix\n * @param scopePadding - The padding string for consistent alignment\n * @returns Formatted string\n */\n private formatString(str: string, shouldAddNewline: boolean, scopePadding: string): string {\n // In browser environment, keep simple formatting\n if (A_Context.environment === 'browser') {\n const prefix = shouldAddNewline ? '\\n' : '';\n return (prefix + str).replace(/\\n/g, '\\n' + `${scopePadding}${A_LOGGER_FORMAT.PIPE}`);\n }\n\n // For terminal, apply intelligent text wrapping\n const wrappedLines = this.wrapText(str, scopePadding, !shouldAddNewline);\n const continuationIndent = `${scopePadding}${A_LOGGER_FORMAT.PIPE}`;\n\n // Format the wrapped lines with proper indentation\n const formattedLines = wrappedLines.map((line, index) => {\n if (index === 0 && !shouldAddNewline) {\n // First line in inline mode (no newline prefix)\n return line;\n } else {\n // Continuation lines or first line with newline prefix\n return `${continuationIndent}${line}`;\n }\n });\n\n if (shouldAddNewline) {\n return '\\n' + formattedLines.join('\\n');\n } else {\n return formattedLines.join('\\n');\n }\n }\n\n // =============================================\n // Log Level Management\n // =============================================\n\n /**\n * Determine if a log message should be output based on configured log level\n * \n * Log level hierarchy:\n * - debug: Shows all messages (debug, info, warning, error)\n * - info: Shows info, warning, and error messages\n * - warn: Shows warning and error messages only\n * - error: Shows error messages only\n * - all: Shows all messages (alias for debug)\n * \n * @param logMethod - The type of log method being called\n * @returns True if the message should be logged, false otherwise\n */\n protected shouldLog(logMethod: 'debug' | 'info' | 'warning' | 'error'): boolean {\n const shouldLog: A_LoggerLevel = this.config?.get(A_LOGGER_ENV_KEYS.LOG_LEVEL) || 'info';\n\n switch (shouldLog) {\n case 'debug':\n return true;\n case 'info':\n return logMethod === 'info' || logMethod === 'warning' || logMethod === 'error';\n case 'warn':\n return logMethod === 'warning' || logMethod === 'error';\n case 'error':\n return logMethod === 'error';\n case 'all':\n return true;\n default:\n return false;\n }\n }\n\n\n // =============================================\n // Public Logging Methods\n // =============================================\n\n /**\n * Debug logging method with optional color specification\n * Only logs when debug level is enabled\n * \n * Supports two usage patterns:\n * 1. debug(message, ...args) - Uses instance's default log color\n * 2. debug(color, message, ...args) - Uses specified color for message content only\n * \n * Note: The scope color always remains the instance's default scope color,\n * only the message content color changes when explicitly specified.\n * \n * @param color - Optional color name from A_LoggerColorName enum or the first message argument\n * @param args - Additional arguments to log\n * \n * @example\n * ```typescript\n * logger.debug('Debug information'); // Uses instance default colors\n * logger.debug('gray', 'Debug message'); // Gray message, scope stays instance color\n * logger.debug('Processing user:', { id: 1, name: 'John' });\n * ```\n */\n debug(color: A_LoggerColorName, ...args: any[]): void;\n debug(...args: any[]): void;\n debug(param1: any, ...args: any[]): void {\n if (!this.shouldLog('debug')) return;\n\n // Check if first parameter is a valid color key\n if (typeof param1 === 'string' && this.COLORS[param1 as keyof typeof this.COLORS]) {\n console.log(...this.compile(param1 as keyof typeof this.COLORS, ...args));\n } else {\n // Use instance's default log color and treat param1 as first message argument\n console.log(...this.compile(this.DEFAULT_LOG_COLOR, param1, ...args));\n }\n }\n\n /**\n * Info logging method with optional color specification\n * Logs without any restrictions (always shows regardless of log level)\n * \n * Supports two usage patterns:\n * 1. info(message, ...args) - Uses instance's default log color\n * 2. info(color, message, ...args) - Uses specified color for message content only\n * \n * Note: The scope color always remains the instance's default scope color,\n * only the message content color changes when explicitly specified.\n * \n * @param color - Optional color name from A_LoggerColorName enum or the first message argument\n * @param args - Additional arguments to log\n * \n * @example\n * ```typescript\n * logger.info('Hello World'); // Uses instance default colors\n * logger.info('green', 'Success message'); // Green message, scope stays instance color\n * logger.info('Processing user:', { id: 1, name: 'John' });\n * ```\n */\n info(color: A_LoggerColorName, ...args: any[]): void;\n info(...args: any[]): void;\n info(param1: any, ...args: any[]): void {\n if (!this.shouldLog('info')) return;\n\n // Check if first parameter is a valid color key\n if (typeof param1 === 'string' && this.COLORS[param1 as keyof typeof this.COLORS]) {\n console.log(...this.compile(param1 as keyof typeof this.COLORS, ...args));\n } else {\n // Use instance's default log color and treat param1 as first message argument\n console.log(...this.compile(this.DEFAULT_LOG_COLOR, param1, ...args));\n }\n }\n\n /**\n * Legacy log method (kept for backward compatibility)\n * @deprecated Use info() method instead\n * \n * @param color - Optional color name from A_LoggerColorName enum or the first message argument\n * @param args - Additional arguments to log\n */\n log(color: A_LoggerColorName, ...args: any[]): void;\n log(...args: any[]): void;\n log(param1: any, ...args: any[]): void {\n // Delegate to info method for backward compatibility\n this.info(param1, ...args);\n }\n\n /**\n * Log warning messages with yellow color coding\n * \n * Use for non-critical issues that should be brought to attention\n * but don't prevent normal operation\n * \n * @param args - Arguments to log as warnings\n * \n * @example\n * ```typescript\n * logger.warning('Deprecated method used');\n * logger.warning('Rate limit approaching:', { current: 95, limit: 100 });\n * ```\n */\n warning(...args: any[]): void {\n if (!this.shouldLog('warning')) return;\n console.log(...this.compile('yellow', ...args));\n }\n\n /**\n * Log error messages with red color coding\n * \n * Use for critical issues, exceptions, and failures that need immediate attention\n * \n * @param args - Arguments to log as errors\n * @returns void (for compatibility with console.log)\n * \n * @example\n * ```typescript\n * logger.error('Database connection failed');\n * logger.error(new Error('Validation failed'));\n * logger.error('Critical error:', error, { context: 'user-registration' });\n * ```\n */\n error(...args: any[]): void {\n if (!this.shouldLog('error')) return;\n console.log(...this.compile('red', ...args));\n }\n\n // =============================================\n // Specialized Error Formatting\n // =============================================\n\n /**\n * Legacy method for A_Error logging (kept for backward compatibility)\n * \n * @deprecated Use error() method instead which handles A_Error automatically\n * @param error - The A_Error instance to log\n */\n protected log_A_Error(error: A_Error): void {\n const time = this.getTime();\n const scopePadding = ' '.repeat(this.STANDARD_SCOPE_LENGTH + 3);\n\n console.log(`\\x1b[31m[${this.formattedScope}] |${time}| ERROR ${error.code}\n${scopePadding}| ${error.message}\n${scopePadding}| ${error.description} \n${scopePadding}|-------------------------------\n${scopePadding}| ${error.stack?.split('\\n').map((line, index) => index === 0 ? line : `${scopePadding}| ${line}`).join('\\n') || 'No stack trace'}\n${scopePadding}|-------------------------------\n\\x1b[0m`\n + (error.originalError ? `\\x1b[31m${scopePadding}| Wrapped From ${error.originalError.message}\n${scopePadding}|-------------------------------\n${scopePadding}| ${error.originalError.stack?.split('\\n').map((line, index) => index === 0 ? line : `${scopePadding}| ${line}`).join('\\n') || 'No stack trace'}\n${scopePadding}|-------------------------------\n\\x1b[0m`: '')\n + (error.link ? `\\x1b[31m${scopePadding}| Read in docs: ${error.link}\n${scopePadding}|-------------------------------\n\\x1b[0m`: ''));\n }\n\n /**\n * Format A_Error instances for inline display within compiled messages\n * \n * Provides detailed formatting for A_Error objects with:\n * - Error code, message, and description\n * - Original error information FIRST (better UX for debugging)\n * - Stack traces with terminal width awareness\n * - Documentation links (if available)\n * - Consistent formatting with rest of logger\n * \n * @param error - The A_Error instance to format\n * @returns Formatted string ready for display\n */\n protected compile_A_Error(error: A_Error): string {\n const continuationIndent = `${' '.repeat(this.STANDARD_SCOPE_LENGTH + 3)}${A_LOGGER_FORMAT.PIPE}`;\n const separator = `${continuationIndent}-------------------------------`;\n const lines: string[] = [];\n\n // Add error header\n lines.push('');\n lines.push(separator);\n lines.push(`${continuationIndent}A_ERROR: ${error.code}`);\n lines.push(separator);\n\n // Format and wrap error message and description\n const errorMessage = this.wrapText(`Message: ${error.message}`, continuationIndent, false);\n const errorDescription = this.wrapText(`Description: ${error.description}`, continuationIndent, false);\n\n lines.push(...errorMessage.map(line => `${continuationIndent}${line}`));\n lines.push(...errorDescription.map(line => `${continuationIndent}${line}`));\n\n // Show original error FIRST (more important for debugging)\n if (error.originalError) {\n lines.push(separator);\n lines.push(`${continuationIndent}ORIGINAL ERROR:`);\n lines.push(separator);\n\n const originalMessage = this.wrapText(`${error.originalError.name}: ${error.originalError.message}`, continuationIndent, false);\n lines.push(...originalMessage.map(line => `${continuationIndent}${line}`));\n\n if (error.originalError.stack) {\n lines.push(`${continuationIndent}Stack trace:`);\n const stackLines = this.formatStackTrace(error.originalError.stack, continuationIndent);\n lines.push(...stackLines);\n }\n }\n\n // Then show A_Error stack trace\n if (error.stack) {\n lines.push(separator);\n lines.push(`${continuationIndent}A_ERROR STACK:`);\n lines.push(separator);\n const stackLines = this.formatStackTrace(error.stack, continuationIndent);\n lines.push(...stackLines);\n }\n\n // Documentation link at the end\n if (error.link) {\n lines.push(separator);\n const linkText = this.wrapText(`Documentation: ${error.link}`, continuationIndent, false);\n lines.push(...linkText.map(line => `${continuationIndent}${line}`));\n }\n\n lines.push(separator);\n\n return lines.join('\\n');\n }\n\n /**\n * Format stack trace with proper terminal width wrapping and indentation\n * \n * @param stack - The stack trace string\n * @param baseIndent - Base indentation for continuation lines\n * @returns Array of formatted stack trace lines\n */\n private formatStackTrace(stack: string, baseIndent: string): string[] {\n const stackLines = stack.split('\\n');\n const formatted: string[] = [];\n\n stackLines.forEach((line, index) => {\n if (line.trim()) {\n // Add extra indentation for stack trace lines\n const stackIndent = index === 0 ? baseIndent : `${baseIndent} `;\n const wrappedLines = this.wrapText(line.trim(), stackIndent, false);\n formatted.push(...wrappedLines.map(wrappedLine =>\n index === 0 && wrappedLine === wrappedLines[0]\n ? `${baseIndent}${wrappedLine}`\n : `${baseIndent} ${wrappedLine}`\n ));\n }\n });\n\n return formatted;\n }\n\n /**\n * Format standard Error instances for inline display within compiled messages\n * \n * Provides clean, readable formatting for standard JavaScript errors with:\n * - Terminal width aware message wrapping\n * - Properly formatted stack traces\n * - Consistent indentation with rest of logger\n * \n * @param error - The Error instance to format\n * @returns Formatted string ready for display\n */\n protected compile_Error(error: Error): string {\n const continuationIndent = `${' '.repeat(this.STANDARD_SCOPE_LENGTH + 3)}${A_LOGGER_FORMAT.PIPE}`;\n const separator = `${continuationIndent}-------------------------------`;\n const lines: string[] = [];\n\n // Add error header\n lines.push('');\n lines.push(separator);\n lines.push(`${continuationIndent}ERROR: ${error.name}`);\n lines.push(separator);\n\n // Format and wrap error message\n const errorMessage = this.wrapText(`Message: ${error.message}`, continuationIndent, false);\n lines.push(...errorMessage.map(line => `${continuationIndent}${line}`));\n\n // Format stack trace if available\n if (error.stack) {\n lines.push(separator);\n lines.push(`${continuationIndent}STACK TRACE:`);\n lines.push(separator);\n const stackLines = this.formatStackTrace(error.stack, continuationIndent);\n lines.push(...stackLines);\n }\n\n lines.push(separator);\n\n return lines.join('\\n');\n }\n\n // =============================================\n // Utility Methods\n // =============================================\n\n /**\n * Generate timestamp string for log messages\n * \n * Format: MM:SS:mmm (minutes:seconds:milliseconds)\n * This provides sufficient precision for debugging while remaining readable\n * \n * @returns Formatted timestamp string\n * \n * @example\n * Returns: \"15:42:137\" for 3:42:15 PM and 137 milliseconds\n */\n protected getTime(): string {\n const now = new Date();\n const minutes = String(now.getMinutes()).padStart(A_LOGGER_TIME_FORMAT.MINUTES_PAD, '0');\n const seconds = String(now.getSeconds()).padStart(A_LOGGER_TIME_FORMAT.SECONDS_PAD, '0');\n const milliseconds = String(now.getMilliseconds()).padStart(A_LOGGER_TIME_FORMAT.MILLISECONDS_PAD, '0');\n return `${minutes}${A_LOGGER_TIME_FORMAT.SEPARATOR}${seconds}${A_LOGGER_TIME_FORMAT.SEPARATOR}${milliseconds}`;\n }\n}","import {\n A_Command_ExecutionContext,\n A_TYPES__Command_Init,\n A_TYPES__Command_Listener,\n A_TYPES__Command_Serialized\n} from \"./A-Command.types\";\nimport {\n A_CommandFeatures,\n A_Command_Status,\n A_CommandTransitions,\n A_CommandEvent\n} from \"./A-Command.constants\";\nimport { A_Context, A_Dependency, A_Entity, A_Error, A_Feature, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_CommandError } from \"./A-Command.error\";\nimport { A_StateMachine } from \"../A-StateMachine/A-StateMachine.component\";\nimport { A_StateMachineFeatures } from \"../A-StateMachine/A-StateMachine.constants\";\nimport { A_Logger } from \"../A-Logger/A-Logger.component\";\nimport { A_StateMachineTransition } from \"../A-StateMachine/A-StateMachineTransition.context\";\nimport { A_ExecutionContext } from \"../A-Execution/A-Execution.context\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_Command - Advanced Command Pattern Implementation\n * \n * A comprehensive command pattern implementation that encapsulates business logic\n * as executable commands with full lifecycle management, event handling, and \n * state persistence capabilities.\n * \n * ## Key Features\n * - **Structured Lifecycle**: Automatic progression through init → compile → execute → complete/fail\n * - **Event-Driven**: Subscribe to lifecycle events and emit custom events\n * - **State Persistence**: Full serialization/deserialization for cross-service communication\n * - **Type Safety**: Generic types for parameters, results, and custom events\n * - **Dependency Injection**: Integrated with A-Concept's DI system\n * - **Error Management**: Comprehensive error capture and handling\n * - **Execution Tracking**: Built-in timing and performance metrics\n * \n * ## Lifecycle Phases\n * 1. **CREATED** - Command instantiated but not initialized\n * 2. **INITIALIZED** - Execution scope and dependencies set up\n * 3. **COMPILED** - Ready for execution with all resources prepared\n * 4. **EXECUTING** - Currently running business logic\n * 5. **COMPLETED** - Successfully finished execution\n * 6. **FAILED** - Execution failed with errors captured\n * \n * @template InvokeType - Type definition for command parameters\n * @template ResultType - Type definition for command execution result\n * @template LifecycleEvents - Union type of custom lifecycle event names\n * \n * @example\n * ```typescript\n * // Define parameter and result types\n * interface UserCreateParams {\n * name: string;\n * email: string;\n * role: 'admin' | 'user';\n * }\n * \n * interface UserCreateResult {\n * userId: string;\n * success: boolean;\n * }\n * \n * // Create custom command\n * class CreateUserCommand extends A_Command<UserCreateParams, UserCreateResult> {}\n * \n * // Execute command\n * const command = new CreateUserCommand({\n * name: 'John Doe',\n * email: 'john@example.com',\n * role: 'user'\n * });\n * \n * scope.register(command);\n * await command.execute();\n * \n * console.log('Result:', command.result);\n * console.log('Status:', command.status);\n * ```\n */\n@A_Frame.Entity({\n namespace: 'A-Utils',\n name: 'A-Command',\n description: 'Advanced Command Pattern Implementation with full lifecycle management, event handling, and state persistence. This entity allows to execute commands in distributed environment across multiple services.'\n})\nexport class A_Command<\n InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init,\n ResultType extends Record<string, any> = Record<string, any>,\n LifecycleEvents extends string | keyof typeof A_CommandEvent = keyof typeof A_CommandEvent,\n> extends A_Entity<InvokeType, A_TYPES__Command_Serialized<InvokeType, ResultType>> {\n\n // ====================================================================\n // ================== Static Command Information ======================\n // ====================================================================\n\n /**\n * Static command identifier derived from the class name\n * Used for command registration and serialization\n */\n static get code(): string {\n return super.entity;\n }\n\n // ====================================================================\n // ================== Instance Properties =============================\n // ====================================================================\n\n /** The origin of the command, used to know has it been created from serialization or invoked */\n protected _origin!: 'invoked' | 'serialized';\n\n /** Command execution scope for dependency injection and feature resolution */\n protected _executionScope!: A_Scope;\n\n /** Result data produced by successful command execution */\n protected _result?: ResultType;\n\n /** Set of errors that occurred during command execution */\n protected _error!: A_Error;\n\n /** Command initialization parameters */\n protected _params!: InvokeType;\n\n /** Current lifecycle status of the command */\n protected _status!: A_Command_Status\n\n /** Map of event listeners organized by event name */\n protected _listeners: Map<\n LifecycleEvents | keyof typeof A_CommandEvent,\n Set<A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>>\n > = new Map();\n\n /** Timestamp when command execution started */\n protected _startTime?: Date;\n\n /** Timestamp when command execution ended */\n protected _endTime?: Date;\n\n /** Timestamp when command was created */\n protected _createdAt!: Date;\n\n\n // ====================================================================\n // ================== Public Getter Properties =======================\n // ====================================================================\n\n /**\n * Total execution duration in milliseconds\n * \n * - If completed/failed: Returns total time from start to end\n * - If currently executing: Returns elapsed time since start\n * - If not started: Returns undefined\n */\n get duration(): number | undefined {\n return this._endTime && this._startTime\n ? this._endTime.getTime() - this._startTime.getTime()\n : this._startTime\n ? new Date().getTime() - this._startTime.getTime()\n : undefined;\n }\n\n /**\n * Idle time before execution started in milliseconds\n * \n * Time between command creation and execution start.\n * Useful for monitoring command queue performance.\n */\n get idleTime(): number | undefined {\n return this._startTime && this._createdAt\n ? this._startTime.getTime() - this._createdAt.getTime()\n : undefined;\n }\n\n /**\n * Command execution scope for dependency injection\n * \n * Provides access to components, services, and shared resources\n * during command execution. Inherits from the scope where the\n * command was registered.\n */\n get scope(): A_Scope {\n return this._executionScope;\n }\n /**\n * Execution context associated with the command\n */\n get context(): A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>> {\n return this.scope.resolve(A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>)!;\n }\n\n /**\n * Unique command type identifier\n * \n * Derived from the class name and used for:\n * - Command registration and resolution\n * - Serialization and deserialization\n * - Logging and debugging\n * \n * @example 'create-user-command', 'process-order-command'\n */\n get code(): string {\n return (this.constructor as typeof A_Command).code;\n }\n /**\n * Current lifecycle status of the command\n * \n * Indicates the current phase in the command execution lifecycle.\n * Used to track progress and determine available operations.\n */\n get status(): A_Command_Status {\n return this._status;\n }\n\n /**\n * Timestamp when the command was created\n * \n * Marks the initial instantiation time, useful for tracking\n * command age and queue performance metrics.\n */\n get createdAt(): Date {\n return this._createdAt!;\n }\n\n /**\n * Timestamp when command execution started\n * \n * Undefined until execution begins. Used for calculating\n * execution duration and idle time.\n */\n get startedAt(): Date | undefined {\n return this._startTime;\n }\n\n /**\n * Timestamp when command execution ended\n * \n * Set when command reaches COMPLETED or FAILED status.\n * Used for calculating total execution duration.\n */\n get endedAt(): Date | undefined {\n return this._endTime;\n }\n\n /**\n * Result data produced by command execution\n * \n * Contains the output data from successful command execution.\n * Undefined until command completes successfully.\n */\n get result(): ResultType | undefined {\n return this._result;\n }\n\n /**\n * Array of errors that occurred during execution\n * \n * Automatically wraps native errors in A_Error instances\n * for consistent error handling. Empty array if no errors occurred.\n */\n get error(): A_Error | undefined {\n return this._error;\n }\n\n /**\n * Command initialization parameters\n * \n * Contains the input data used to create and configure the command.\n * These parameters are immutable during command execution.\n return new A_Error(err);\n }\n });\n }\n\n /**\n * Command initialization parameters\n * \n * Contains the input data used to create and configure the command.\n * These parameters are immutable during command execution.\n */\n get params(): InvokeType {\n return this._params;\n }\n\n /**\n * Indicates if the command has been processed (completed or failed)\n * \n * Returns true if the command has completed or failed, false otherwise.\n */\n get isProcessed(): boolean {\n return this._status === A_Command_Status.COMPLETED\n || this._status === A_Command_Status.FAILED;\n }\n\n /**\n * \n * A-Command represents an executable command with a specific code and parameters.\n * It can be executed within a given scope and stores execution results and errors.\n * \n * \n * A-Command should be context independent and execution logic should be based on attached components \n * \n * @param code \n * @param params \n */\n constructor(\n /**\n * Command invocation parameters\n */\n params: InvokeType | A_TYPES__Command_Serialized<InvokeType, ResultType> | string,\n ) {\n super(params as any);\n }\n\n // --------------------------------------------------------------------------\n // A-StateMachine Feature Extensions\n // --------------------------------------------------------------------------\n @A_Feature.Extend()\n protected async [A_StateMachineFeatures.onBeforeTransition](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n this.checkScopeInheritance();\n\n // and register all allowed status transitions\n // switch across allowed transitions, if not allowed throw an error\n logger?.debug('yellow', `Command ${this.aseid.toString()} transitioning from ${transition.from} to ${transition.to}`);\n }\n\n @A_Feature.Extend()\n protected async [A_CommandTransitions.CREATED_TO_INITIALIZED](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n ...args: any[]\n ): Promise<void> {\n if (this._status !== A_Command_Status.CREATED) {\n return;\n }\n\n this._createdAt = new Date();\n this._status = A_Command_Status.INITIALIZED;\n\n this.emit(A_CommandEvent.onInit);\n }\n\n @A_Feature.Extend()\n protected async [A_CommandTransitions.INITIALIZED_TO_EXECUTING](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n ...args: any[]\n ): Promise<void> {\n if (this._status !== A_Command_Status.INITIALIZED\n && this._status !== A_Command_Status.CREATED\n ) {\n return;\n }\n\n this._startTime = new Date();\n this._status = A_Command_Status.EXECUTING;\n\n this.emit(A_CommandEvent.onExecute);\n }\n\n @A_Feature.Extend()\n /**\n * Handles command completion after successful execution\n * \n * EXECUTION -> COMPLETED transition\n */\n protected async [A_CommandTransitions.EXECUTING_TO_COMPLETED](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n ...args: any[]\n ): Promise<void> {\n this._endTime = new Date();\n this._status = A_Command_Status.COMPLETED;\n\n this.emit(A_CommandEvent.onComplete);\n }\n\n @A_Feature.Extend()\n /**\n * Handles command failure during execution\n * \n * EXECUTION -> FAILED transition\n */\n protected async [A_CommandTransitions.EXECUTING_TO_FAILED](\n @A_Inject(A_StateMachineTransition) transition: A_StateMachineTransition,\n @A_Inject(A_Error) error: A_Error,\n ...args: any[]\n ): Promise<void> {\n this._endTime = new Date();\n\n this._status = A_Command_Status.FAILED;\n\n this.emit(A_CommandEvent.onFail);\n }\n\n\n // --------------------------------------------------------------------------\n // A-Command Lifecycle Feature Extensions\n // --------------------------------------------------------------------------\n @A_Feature.Extend()\n /**\n * Default behavior for Command Initialization uses StateMachine to transition states\n */\n protected async [A_CommandFeatures.onInit](\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.CREATED, A_Command_Status.INITIALIZED);\n }\n\n @A_Feature.Extend({\n after: /.*/\n })\n protected async [A_CommandFeatures.onBeforeExecute](\n @A_Dependency.Required()\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.INITIALIZED, A_Command_Status.EXECUTING);\n }\n\n @A_Feature.Extend()\n protected async [A_CommandFeatures.onExecute](\n ...args: any[]\n ): Promise<void> {\n }\n\n @A_Feature.Extend()\n /**\n * By Default on AfterExecute calls the Completion method to mark the command as completed\n * \n * [!] This can be overridden to implement custom behavior using A_Feature overrides\n */\n protected async [A_CommandFeatures.onAfterExecute](\n ...args: any[]\n ): Promise<void> {\n }\n\n @A_Feature.Extend({\n after: /.*/\n })\n protected async [A_CommandFeatures.onComplete](\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.EXECUTING, A_Command_Status.COMPLETED);\n }\n\n @A_Feature.Extend({\n after: /.*/\n })\n protected async [A_CommandFeatures.onFail](\n @A_Dependency.Required()\n @A_Inject(A_StateMachine) stateMachine: A_StateMachine,\n @A_Inject(A_ExecutionContext) operation: A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>,\n ...args: any[]\n ): Promise<void> {\n await stateMachine.transition(A_Command_Status.EXECUTING, A_Command_Status.FAILED);\n }\n\n // --------------------------------------------------------------------------\n // A-Command Lifecycle Methods\n // --------------------------------------------------------------------------\n /**\n * Initializes the command before execution.\n */\n async init(): Promise<void> {\n await this.call(A_CommandFeatures.onInit, this.scope);\n }\n\n /**\n * Executes the command logic.\n */\n async execute(): Promise<any> {\n\n if (this.isProcessed) return;\n\n try {\n this.checkScopeInheritance();\n\n const context = new A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>('execute-command');\n\n this.scope.register(context);\n\n await new Promise<void>(async (resolve, reject) => {\n\n try {\n const onBeforeExecuteFeature = new A_Feature({\n name: A_CommandFeatures.onBeforeExecute,\n component: this,\n scope: this.scope\n })\n\n const onExecuteFeature = new A_Feature({\n name: A_CommandFeatures.onExecute,\n component: this,\n scope: this.scope\n })\n\n const onAfterExecuteFeature = new A_Feature({\n name: A_CommandFeatures.onAfterExecute,\n component: this,\n scope: this.scope\n })\n\n\n\n this.on(A_CommandEvent.onComplete, () => {\n\n onBeforeExecuteFeature.interrupt();\n onExecuteFeature.interrupt();\n onAfterExecuteFeature.interrupt();\n\n resolve();\n });\n\n this.on(A_CommandEvent.onFail, () => {\n\n onBeforeExecuteFeature.interrupt();\n onExecuteFeature.interrupt();\n onAfterExecuteFeature.interrupt();\n\n reject(this.error);\n });\n\n\n await onBeforeExecuteFeature.process(this.scope);\n\n await onExecuteFeature.process(this.scope);\n\n await onAfterExecuteFeature.process(this.scope);\n\n /** only in case it was really invoked we automatically transit it to COMPLETED state */\n if (this._origin === 'invoked') {\n await this.complete();\n }\n\n resolve();\n\n } catch (error) {\n reject(error);\n }\n });\n\n } catch (error) {\n let targetError = error instanceof A_Error\n ? error\n : new A_CommandError({\n title: A_CommandError.ExecutionError,\n description: `An error occurred while executing command \"${this.aseid.toString()}\".`,\n originalError: error\n });\n\n await this.fail(targetError);\n }\n }\n\n /**\n * Marks the command as completed\n * \n * \n * Calling This method will set the command status to COMPLETED, record the end time,\n * store the result, emit the onComplete event, and destroy the execution scope.\n *\n * [!] After Calling this method, the command is considered fully processed And further processing will be INTERRUPTED. \n * [!] If the command is already processed (COMPLETED or FAILED), this method does nothing.\n * [!] This method can be called with optional result data to store with the command.\n * \n * @param result - Optional result data to store with the command\n */\n async complete(result?: ResultType) {\n if (this.isProcessed) return;\n\n this._status = A_Command_Status.COMPLETED;\n\n this._result = result;\n\n await this.call(A_CommandFeatures.onComplete, this.scope);\n\n this.scope.destroy();\n }\n\n\n\n /**\n * Marks the command as failed\n */\n async fail(error?: A_Error) {\n if (this.isProcessed) return;\n\n this._status = A_Command_Status.FAILED;\n if (error) {\n this._error = error;\n this.scope.register(error);\n }\n\n await this.call(A_CommandFeatures.onFail, this.scope);\n\n this.scope.destroy();\n }\n\n\n // -------------------------------------------------------------------------- \n // A-Command Event-Emitter methods\n // --------------------------------------------------------------------------\n\n /**\n * Registers an event listener for a specific event\n * \n * @param event \n * @param listener \n */\n on(event: LifecycleEvents | A_CommandEvent, listener: A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>) {\n if (!this._listeners.has(event)) {\n this._listeners.set(event, new Set());\n }\n this._listeners.get(event)!.add(listener);\n }\n /**\n * Removes an event listener for a specific event\n * \n * @param event \n * @param listener \n */\n off(event: LifecycleEvents | A_CommandEvent, listener: A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>) {\n this._listeners.get(event)?.delete(listener);\n }\n /**\n * Emits an event to all registered listeners\n * \n * @param event \n */\n emit(event: LifecycleEvents | keyof typeof A_CommandEvent) {\n this._listeners.get(event)?.forEach(async listener => {\n listener(this);\n });\n }\n\n\n // --------------------------------------------------------------------------\n // A-Entity Base Class Overrides\n // --------------------------------------------------------------------------\n // Serialization / Deserialization\n // -------------------------------------------------------------------------\n\n\n /**\n * Allows to create a Command instance from new data\n * \n * @param newEntity \n */\n fromNew(newEntity: InvokeType): void {\n super.fromNew(newEntity);\n\n this._origin = 'invoked';\n\n this._executionScope = new A_Scope({\n name: `A-Command-Execution-Scope-${this.aseid.toString()}`,\n components: [A_StateMachine],\n });\n\n this._createdAt = new Date();\n\n this._params = newEntity;\n\n this._status = A_Command_Status.CREATED;\n }\n\n\n\n /**\n * Allows to convert serialized data to Command instance\n * \n * [!] By default it omits params as they are not stored in the serialized data\n * \n * @param serialized \n */\n fromJSON(serialized: A_TYPES__Command_Serialized<InvokeType, ResultType>): void {\n super.fromJSON(serialized);\n\n this._origin = 'serialized';\n\n this._executionScope = new A_Scope({\n name: `A-Command-Execution-Scope-${this.aseid.toString()}`,\n components: [A_StateMachine],\n });\n\n if (serialized.createdAt) this._createdAt = new Date(serialized.createdAt);\n if (serialized.startedAt) this._startTime = new Date(serialized.startedAt);\n if (serialized.endedAt) this._endTime = new Date(serialized.endedAt);\n\n this._params = serialized.params\n this._status = serialized.status;\n\n if (serialized.error)\n this._error = new A_CommandError(serialized.error)\n\n if (serialized.result)\n this._result = serialized.result;\n }\n\n\n /**\n * Converts the Command instance to a plain object\n * \n * @returns \n */\n toJSON(): A_TYPES__Command_Serialized<InvokeType, ResultType> {\n return {\n ...super.toJSON(),\n code: this.code,\n status: this._status,\n params: this._params,\n createdAt: this._createdAt.toISOString(),\n startedAt: this._startTime ? this._startTime.toISOString() : undefined,\n endedAt: this._endTime ? this._endTime.toISOString() : undefined,\n duration: this.duration,\n idleTime: this.idleTime,\n result: this.result,\n error: this.error ? this.error.toJSON() : undefined,\n }\n };\n\n\n //============================================================================================\n // Helpers Methods\n //============================================================================================\n /**\n * Ensures that the command's execution scope inherits from the context scope\n * \n * Throws an error if the command is not bound to any context scope\n */\n protected checkScopeInheritance(): void {\n let attachedScope: A_Scope;\n\n try {\n attachedScope = A_Context.scope(this);\n } catch (error) {\n throw new A_CommandError({\n title: A_CommandError.CommandScopeBindingError,\n description: `Command ${this.aseid.toString()} is not bound to any context scope. Ensure the command is properly registered within a context before execution.`,\n originalError: error\n });\n }\n\n if (!this.scope.isInheritedFrom(A_Context.scope(this))) {\n this.scope.inherit(A_Context.scope(this));\n }\n }\n}\n\n","import { A_Context } from \"@adaas/a-concept\";\nimport { Ifspolyfill } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_FSPolyfillClass {\n private _fs!: Ifspolyfill;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n\n async get(): Promise<Ifspolyfill> {\n if (!this._initialized) {\n await this.init();\n }\n return this._fs;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment=== 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n this._fs = await import('fs') as Ifspolyfill;\n }\n\n private initBrowser(): void {\n this._fs = {\n readFileSync: (path: string, encoding: string) => {\n this.logger.warning('fs.readFileSync not available in browser environment');\n return '';\n },\n existsSync: (path: string) => {\n this.logger.warning('fs.existsSync not available in browser environment');\n return false;\n },\n createReadStream: (path: string) => {\n this.logger.warning('fs.createReadStream not available in browser environment');\n return null;\n }\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IcryptoInterface, Ifspolyfill } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_CryptoPolyfillClass {\n private _crypto!: IcryptoInterface;\n private _initialized: boolean = false;\n private _fsPolyfill?: Ifspolyfill;\n\n constructor(\n protected logger: A_Logger\n ) {\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n async get(fsPolyfill?: Ifspolyfill): Promise<IcryptoInterface> {\n if (!this._initialized) {\n this._fsPolyfill = fsPolyfill;\n await this.init();\n }\n return this._crypto;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const crypto = await import('crypto');\n this._crypto = {\n createTextHash: (text: string, algorithm: string = 'sha384') => Promise.resolve(\n `${algorithm}-${crypto.createHash(algorithm).update(text).digest('base64')}`\n ),\n createFileHash: (filePath: string, algorithm: string = 'sha384') => new Promise(async (resolve, reject) => {\n try {\n if (!this._fsPolyfill) {\n throw new Error('FS polyfill is required for file hashing');\n }\n const hash = crypto.createHash(algorithm);\n const fileStream = this._fsPolyfill.createReadStream(filePath);\n fileStream.on('data', (data: any) => hash.update(data));\n fileStream.on('end', () => resolve(`${algorithm}-${hash.digest('base64')}`));\n fileStream.on('error', (err: any) => reject(err));\n } catch (error) {\n reject(error);\n }\n })\n };\n }\n\n private initBrowser(): void {\n this._crypto = {\n createFileHash: () => {\n this.logger.warning('File hash not available in browser environment');\n return Promise.resolve('');\n },\n createTextHash: (text: string, algorithm: string = 'SHA-384') => new Promise<string>(async (resolve, reject) => {\n try {\n if (!crypto.subtle) {\n throw new Error('SubtleCrypto not available');\n }\n const encoder = new TextEncoder();\n const data = encoder.encode(text);\n const hashBuffer = await crypto.subtle.digest(algorithm, data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashBase64 = btoa(String.fromCharCode(...hashArray));\n resolve(`${algorithm}-${hashBase64}`);\n } catch (error) {\n reject(error);\n }\n })\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IhttpInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_HttpPolyfillClass {\n private _http!: IhttpInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n async get(): Promise<IhttpInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._http;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const httpModule = await import('http');\n this._http = {\n request: httpModule.request,\n get: httpModule.get,\n createServer: httpModule.createServer\n };\n }\n\n private initBrowser(): void {\n this._http = {\n request: (options: any, callback?: (res: any) => void) => {\n this.logger.warning('http.request not available in browser/test environment, use fetch instead');\n return this.createMockRequest(options, callback, false);\n },\n get: (url: string | any, callback?: (res: any) => void) => {\n this.logger.warning('http.get not available in browser/test environment, use fetch instead');\n return this.createMockRequest(typeof url === 'string' ? { hostname: url } : url, callback, false);\n },\n createServer: () => {\n this.logger.error('http.createServer not available in browser/test environment');\n return null;\n }\n };\n }\n\n private createMockRequest(options: any, callback?: (res: any) => void, isHttps: boolean = false) {\n // Return a mock request that doesn't make real network calls\n const request = {\n end: () => {\n // Mock response for all environments\n if (callback) {\n const mockResponse = {\n statusCode: 200,\n headers: {},\n on: (event: string, handler: Function) => {\n if (event === 'data') {\n setTimeout(() => handler('mock data'), 0);\n } else if (event === 'end') {\n setTimeout(() => handler(), 0);\n }\n },\n pipe: (dest: any) => {\n if (dest.write) dest.write('mock data');\n if (dest.end) dest.end();\n }\n };\n setTimeout(() => callback(mockResponse), 0);\n }\n },\n write: (data: any) => {\n // Mock write\n },\n on: (event: string, handler: Function) => {\n // Mock event handling\n }\n };\n\n return request;\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IhttpsInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_HttpsPolyfillClass {\n private _https!: IhttpsInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n async get(): Promise<IhttpsInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._https;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const httpsModule = await import('https');\n this._https = {\n request: httpsModule.request,\n get: httpsModule.get,\n createServer: httpsModule.createServer\n };\n }\n\n private initBrowser(): void {\n this._https = {\n request: (options: any, callback?: (res: any) => void) => {\n this.logger.warning('https.request not available in browser/test environment, use fetch instead');\n return this.createMockRequest(options, callback, true);\n },\n get: (url: string | any, callback?: (res: any) => void) => {\n this.logger.warning('https.get not available in browser/test environment, use fetch instead');\n return this.createMockRequest(typeof url === 'string' ? { hostname: url } : url, callback, true);\n },\n createServer: () => {\n this.logger.error('https.createServer not available in browser/test environment');\n return null;\n }\n };\n }\n\n private createMockRequest(options: any, callback?: (res: any) => void, isHttps: boolean = true) {\n // Return a mock request that doesn't make real network calls\n const request = {\n end: () => {\n // Mock response for all environments\n if (callback) {\n const mockResponse = {\n statusCode: 200,\n headers: {},\n on: (event: string, handler: Function) => {\n if (event === 'data') {\n setTimeout(() => handler('mock data'), 0);\n } else if (event === 'end') {\n setTimeout(() => handler(), 0);\n }\n },\n pipe: (dest: any) => {\n if (dest.write) dest.write('mock data');\n if (dest.end) dest.end();\n }\n };\n setTimeout(() => callback(mockResponse), 0);\n }\n },\n write: (data: any) => {\n // Mock write\n },\n on: (event: string, handler: Function) => {\n // Mock event handling\n }\n };\n\n return request;\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IpathInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_PathPolyfillClass {\n private _path!: IpathInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n\n async get(): Promise<IpathInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._path;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n this._path = await import('path') as IpathInterface;\n }\n\n private initBrowser(): void {\n this._path = {\n join: (...paths: string[]) => {\n return paths.join('/').replace(/\\/+/g, '/');\n },\n resolve: (...paths: string[]) => {\n let resolvedPath = '';\n for (const path of paths) {\n if (path.startsWith('/')) {\n resolvedPath = path;\n } else {\n resolvedPath = this._path.join(resolvedPath, path);\n }\n }\n return resolvedPath || '/';\n },\n dirname: (path: string) => {\n const parts = path.split('/');\n return parts.slice(0, -1).join('/') || '/';\n },\n basename: (path: string, ext?: string) => {\n const base = path.split('/').pop() || '';\n return ext && base.endsWith(ext) ? base.slice(0, -ext.length) : base;\n },\n extname: (path: string) => {\n const parts = path.split('.');\n return parts.length > 1 ? '.' + parts.pop() : '';\n },\n relative: (from: string, to: string) => {\n // Simplified relative path calculation\n return to.replace(from, '').replace(/^\\//, '');\n },\n normalize: (path: string) => {\n return path.replace(/\\/+/g, '/').replace(/\\/$/, '') || '/';\n },\n isAbsolute: (path: string) => {\n return path.startsWith('/') || /^[a-zA-Z]:/.test(path);\n },\n parse: (path: string) => {\n const ext = this._path.extname(path);\n const base = this._path.basename(path);\n const name = this._path.basename(path, ext);\n const dir = this._path.dirname(path);\n return { root: '/', dir, base, ext, name };\n },\n format: (pathObject: any) => {\n return this._path.join(pathObject.dir || '', pathObject.base || '');\n },\n sep: '/',\n delimiter: ':'\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IurlInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_UrlPolyfillClass {\n private _url!: IurlInterface;\n private _initialized: boolean = false;\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n async get(): Promise<IurlInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._url;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const urlModule = await import('url');\n this._url = {\n parse: urlModule.parse,\n format: urlModule.format,\n resolve: urlModule.resolve,\n URL: (urlModule.URL || globalThis.URL) as any,\n URLSearchParams: (urlModule.URLSearchParams || globalThis.URLSearchParams) as any\n };\n }\n\n private initBrowser(): void {\n this._url = {\n parse: (urlString: string) => {\n try {\n const url = new URL(urlString);\n return {\n protocol: url.protocol,\n hostname: url.hostname,\n port: url.port,\n pathname: url.pathname,\n search: url.search,\n hash: url.hash,\n host: url.host,\n href: url.href\n };\n } catch {\n return {};\n }\n },\n format: (urlObject: any) => {\n try {\n return new URL('', urlObject.href || `${urlObject.protocol}//${urlObject.host}${urlObject.pathname}${urlObject.search}${urlObject.hash}`).href;\n } catch {\n return '';\n }\n },\n resolve: (from: string, to: string) => {\n try {\n return new URL(to, from).href;\n } catch {\n return to;\n }\n },\n URL: globalThis.URL,\n URLSearchParams: globalThis.URLSearchParams\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IbufferInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_BufferPolyfillClass {\n private _buffer!: IbufferInterface;\n private _initialized: boolean = false;\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n\n async get(): Promise<IbufferInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._buffer;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n await this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private async initServer(): Promise<void> {\n const bufferModule = await import('buffer');\n this._buffer = {\n from: bufferModule.Buffer.from,\n alloc: bufferModule.Buffer.alloc,\n allocUnsafe: bufferModule.Buffer.allocUnsafe,\n isBuffer: bufferModule.Buffer.isBuffer,\n concat: bufferModule.Buffer.concat\n };\n }\n\n private initBrowser(): void {\n this._buffer = {\n from: (data: any, encoding?: string) => {\n if (typeof data === 'string') {\n return new TextEncoder().encode(data);\n }\n return new Uint8Array(data);\n },\n alloc: (size: number, fill?: any) => {\n const buffer = new Uint8Array(size);\n if (fill !== undefined) {\n buffer.fill(fill);\n }\n return buffer;\n },\n allocUnsafe: (size: number) => {\n return new Uint8Array(size);\n },\n isBuffer: (obj: any) => {\n return obj instanceof Uint8Array || obj instanceof ArrayBuffer;\n },\n concat: (list: any[], totalLength?: number) => {\n const length = totalLength || list.reduce((sum, buf) => sum + buf.length, 0);\n const result = new Uint8Array(length);\n let offset = 0;\n for (const buf of list) {\n result.set(buf, offset);\n offset += buf.length;\n }\n return result;\n }\n };\n }\n}","import { A_Context } from \"@adaas/a-concept\";\nimport { IprocessInterface } from \"../A-Polyfill.types\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\n\nexport class A_ProcessPolyfillClass {\n private _process!: IprocessInterface;\n private _initialized: boolean = false;\n\n get isInitialized(): boolean {\n return this._initialized;\n }\n\n constructor(\n protected logger: A_Logger\n ) {\n\n }\n\n async get(): Promise<IprocessInterface> {\n if (!this._initialized) {\n await this.init();\n }\n return this._process;\n }\n\n private async init(): Promise<void> {\n try {\n if (A_Context.environment === 'server') {\n this.initServer();\n } else {\n this.initBrowser();\n }\n this._initialized = true;\n } catch (error) {\n this.initBrowser();\n this._initialized = true;\n }\n }\n\n private initServer(): void {\n this._process = {\n env: process.env as Record<string, string>,\n argv: process.argv,\n platform: process.platform,\n version: process.version,\n versions: process.versions as Record<string, string>,\n cwd: process.cwd,\n exit: process.exit,\n nextTick: process.nextTick\n };\n }\n\n private initBrowser(): void {\n this._process = {\n env: {\n NODE_ENV: 'browser',\n ...((globalThis as any).process?.env || {})\n },\n argv: ['browser'],\n platform: 'browser',\n version: 'browser',\n versions: { node: 'browser' },\n cwd: () => '/',\n exit: (code?: number) => {\n this.logger.warning('process.exit not available in browser');\n throw new Error(`Process exit with code ${code}`);\n },\n nextTick: (callback: Function, ...args: any[]) => {\n setTimeout(() => callback(...args), 0);\n }\n };\n }\n}","import { A_Component, A_Concept, A_Context, A_Inject } from \"@adaas/a-concept\";\nimport { A_Logger } from \"../A-Logger/A-Logger.component\";\nimport { A_FSPolyfillClass } from \"./classes/A-FS-Polyfill.class\";\nimport { A_CryptoPolyfillClass } from \"./classes/A-Crypto-Polyfill.class\";\nimport { A_HttpPolyfillClass } from \"./classes/A-Http-Polyfill.class\";\nimport { A_HttpsPolyfillClass } from \"./classes/A-Https-Polyfill.class\";\nimport { A_PathPolyfillClass } from \"./classes/A-Path-Polyfill.class\";\nimport { A_UrlPolyfillClass } from \"./classes/A-Url-Polyfill.class\";\nimport { A_BufferPolyfillClass } from \"./classes/A-Buffer-Polyfill.class\";\nimport { A_ProcessPolyfillClass } from \"./classes/A-Process-Polyfill.class\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-Polyfill',\n description: 'Polyfill component that provides cross-environment compatibility for Node.js core modules such as fs, crypto, http, https, path, url, buffer, and process. It dynamically loads appropriate polyfills based on the execution environment (Node.js or browser), enabling seamless usage of these modules in different contexts.'\n})\nexport class A_Polyfill extends A_Component {\n\n protected _fsPolyfill!: A_FSPolyfillClass;\n protected _cryptoPolyfill!: A_CryptoPolyfillClass;\n protected _httpPolyfill!: A_HttpPolyfillClass;\n protected _httpsPolyfill!: A_HttpsPolyfillClass;\n protected _pathPolyfill!: A_PathPolyfillClass;\n protected _urlPolyfill!: A_UrlPolyfillClass;\n protected _bufferPolyfill!: A_BufferPolyfillClass;\n protected _processPolyfill!: A_ProcessPolyfillClass;\n\n protected _initializing: Promise<void> | null = null;\n /**\n * Indicates whether the channel is connected\n */\n protected _initialized?: Promise<void>;\n\n\n constructor(\n @A_Inject(A_Logger) protected logger: A_Logger\n ) {\n super();\n }\n\n /**\n * Indicates whether the channel is connected\n */\n get ready(): Promise<void> {\n if (!this._initialized) {\n this._initialized = this._loadInternal();\n }\n return this._initialized;\n }\n\n\n\n @A_Concept.Load()\n async load() {\n await this.ready;\n }\n\n @A_Concept.Load()\n async attachToWindow() {\n if (A_Context.environment !== 'browser') return;\n\n\n (globalThis as any).A_Polyfill = this;\n // attach env variables\n (globalThis as any).process = { env: { NODE_ENV: 'production' }, cwd: () => \"/\" };\n (globalThis as any).__dirname = \"/\";\n\n }\n\n\n protected async _loadInternal() {\n\n this._fsPolyfill = new A_FSPolyfillClass(this.logger);\n this._cryptoPolyfill = new A_CryptoPolyfillClass(this.logger);\n this._httpPolyfill = new A_HttpPolyfillClass(this.logger);\n this._httpsPolyfill = new A_HttpsPolyfillClass(this.logger);\n this._pathPolyfill = new A_PathPolyfillClass(this.logger);\n this._urlPolyfill = new A_UrlPolyfillClass(this.logger);\n this._bufferPolyfill = new A_BufferPolyfillClass(this.logger);\n this._processPolyfill = new A_ProcessPolyfillClass(this.logger);\n\n // Initialize all polyfills to ensure they're ready\n await this._fsPolyfill.get();\n await this._cryptoPolyfill.get(await this._fsPolyfill.get());\n await this._httpPolyfill.get();\n await this._httpsPolyfill.get();\n await this._pathPolyfill.get();\n await this._urlPolyfill.get();\n await this._bufferPolyfill.get();\n await this._processPolyfill.get();\n }\n\n /**\n * Allows to use the 'fs' polyfill methods regardless of the environment\n * This method loads the 'fs' polyfill and returns its instance\n * \n * @returns \n */\n async fs() {\n await this.ready;\n\n return await this._fsPolyfill.get();\n }\n\n /**\n * Allows to use the 'crypto' polyfill methods regardless of the environment\n * This method loads the 'crypto' polyfill and returns its instance\n * \n * @returns \n */\n async crypto() {\n await this.ready;\n\n return await this._cryptoPolyfill.get();\n }\n\n /**\n * Allows to use the 'http' polyfill methods regardless of the environment\n * This method loads the 'http' polyfill and returns its instance\n * \n * @returns \n */\n async http() {\n await this.ready;\n\n return await this._httpPolyfill.get();\n }\n\n /**\n * Allows to use the 'https' polyfill methods regardless of the environment\n * This method loads the 'https' polyfill and returns its instance\n * \n * @returns \n */\n async https() {\n await this.ready;\n\n return await this._httpsPolyfill.get();\n }\n\n /**\n * Allows to use the 'path' polyfill methods regardless of the environment\n * This method loads the 'path' polyfill and returns its instance\n * \n * @returns \n */\n async path() {\n await this.ready;\n\n return await this._pathPolyfill.get();\n }\n\n /**\n * Allows to use the 'url' polyfill methods regardless of the environment\n * This method loads the 'url' polyfill and returns its instance\n * \n * @returns \n */\n async url() {\n await this.ready;\n\n return await this._urlPolyfill.get();\n }\n\n /**\n * Allows to use the 'buffer' polyfill methods regardless of the environment\n * This method loads the 'buffer' polyfill and returns its instance\n * \n * @returns \n */\n async buffer() {\n await this.ready;\n\n return await this._bufferPolyfill.get();\n }\n\n /**\n * Allows to use the 'process' polyfill methods regardless of the environment\n * This method loads the 'process' polyfill and returns its instance\n * \n * @returns \n */\n async process() {\n await this.ready;\n\n return await this._processPolyfill.get();\n }\n}","import { A_Component, A_Concept, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_Container, A_Context, A_Dependency, A_Feature, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_Config } from \"../A-Config.context\";\nimport { A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY } from \"../A-Config.constants\";\nimport { A_Polyfill } from \"../../A-Polyfill/A-Polyfill.component\";\nimport { A_Memory } from \"../../A-Memory/A-Memory.component\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * Config Reader\n */\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'ConfigReader',\n description: 'Abstract component for reading configuration data from various sources such as files, environment variables, or remote services. This component can be extended to implement specific configuration reading strategies.'\n})\nexport class ConfigReader extends A_Component {\n\n protected DEFAULT_ALLOWED_TO_READ_PROPERTIES = [\n ...A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,\n ...A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY\n ];\n\n constructor(\n @A_Dependency.Required()\n @A_Inject(A_Polyfill) protected polyfill: A_Polyfill,\n ) {\n super();\n }\n\n @A_Concept.Load()\n async attachContext(\n @A_Inject(A_Container) container: A_Container,\n @A_Inject(A_Scope) context: A_Scope,\n @A_Inject(A_Config) config?: A_Config<any>,\n ) {\n if (!config) {\n config = new A_Config({\n defaults: {}\n });\n\n container.scope.register(config);\n }\n\n const rootDir = await this.getProjectRoot();\n\n config.set('A_CONCEPT_ROOT_FOLDER', rootDir);\n }\n\n @A_Concept.Load()\n async initialize(\n @A_Dependency.Required()\n @A_Inject(A_Config) config: A_Config,\n ) {\n const data = await this.read();\n\n for (const key in data) {\n config.set(key, data[key]);\n }\n }\n\n /**\n * Get the configuration property by Name\n * @param property \n */\n resolve<_ReturnType = any>(property: string): _ReturnType {\n return property as _ReturnType;\n }\n\n /**\n * This method reads the configuration and sets the values to the context\n * \n * @returns \n */\n async read<T extends string>(\n variables: Array<T> = []\n ): Promise<Record<T, any>> {\n return {} as Record<T, any>;\n }\n\n\n /**\n * Finds the root directory of the project by locating the folder containing package.json\n * \n * @param {string} startPath - The initial directory to start searching from (default is __dirname)\n * @returns {string|null} - The path to the root directory or null if package.json is not found\n */\n protected async getProjectRoot(startPath = __dirname) {\n const process = await this.polyfill.process();\n\n return process.cwd();\n }\n}","import { A_Context, A_FormatterHelper } from \"@adaas/a-concept\";\nimport { ConfigReader } from \"./ConfigReader.component\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'FileConfigReader',\n description: 'Configuration reader that loads configuration data from a JSON file located in the application root directory. It reads the file named after the current concept with a .conf.json extension and parses its contents into the configuration context.'\n})\nexport class FileConfigReader extends ConfigReader {\n\n private FileData: Map<string, any> = new Map<string, any>();\n\n /**\n * Get the configuration property Name\n * @param property \n */\n getConfigurationProperty_File_Alias(property: string): string {\n return A_FormatterHelper.toCamelCase(property);\n }\n\n\n resolve<_ReturnType = any>(property: string): _ReturnType {\n return this.FileData.get(this.getConfigurationProperty_File_Alias(property)) as _ReturnType;\n }\n\n\n async read<T extends string>(\n variables?: Array<T>\n ): Promise<Record<T, any>> {\n\n const fs = await this.polyfill.fs();\n\n try {\n const data = fs.readFileSync(`${A_Context.concept}.conf.json`, 'utf8');\n\n const config: Record<T, any> = JSON.parse(data);\n\n this.FileData = new Map(Object.entries(config));\n\n return config;\n\n } catch (error) {\n // this.context.Logger.error(error);\n return {} as Record<T, any>;\n }\n }\n}\n","import { A_Concept, A_Feature, A_FormatterHelper, A_Inject, A_TYPES__ConceptENVVariables } from \"@adaas/a-concept\";\nimport { ConfigReader } from \"./ConfigReader.component\";\nimport { A_Config } from \"../A-Config.context\";\nimport { A_Polyfill } from \"../../A-Polyfill/A-Polyfill.component\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'ENVConfigReader',\n description: 'Configuration reader that sources configuration data from environment variables. It supports loading variables from a .env file and maps them to the configuration context, making it suitable for applications running in diverse environments such as local development, staging, and production.'\n})\nexport class ENVConfigReader extends ConfigReader {\n\n\n @A_Concept.Load({\n before: ['ENVConfigReader.initialize']\n })\n async readEnvFile(\n @A_Inject(A_Config) config: A_Config<A_TYPES__ConceptENVVariables>,\n @A_Inject(A_Polyfill) polyfill: A_Polyfill,\n @A_Inject(A_Feature) feature: A_Feature,\n\n ) {\n const fs = await polyfill.fs();\n\n if (fs.existsSync('.env'))\n fs.readFileSync(`${config.get('A_CONCEPT_ROOT_FOLDER')}/.env`, 'utf-8').split('\\n').forEach(line => {\n const [key, value] = line.split('=');\n if (key && value) {\n process.env[key.trim()] = value.trim();\n }\n });\n }\n\n\n /**\n * Get the configuration property Name \n * @param property \n */\n getConfigurationProperty_ENV_Alias(property: string): string {\n return A_FormatterHelper.toUpperSnakeCase(property);\n }\n\n\n resolve<_ReturnType = any>(property: string): _ReturnType {\n return process.env[this.getConfigurationProperty_ENV_Alias(property)] as _ReturnType;\n }\n\n\n async read<T extends string>(variables: Array<T> = []): Promise<Record<T, any>> {\n const allVariables = [\n ...variables,\n ...Object.keys(process.env),\n ]\n\n const config: Record<T, any> = {} as Record<T, any>;\n\n allVariables.forEach(variable => {\n config[variable] = this.resolve(variable);\n });\n\n return config;\n }\n} ","import { A_Caller, A_Concept, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_Container, A_Context, A_Fragment, A_Inject, A_Scope, A_ScopeError } from \"@adaas/a-concept\";\nimport { ConfigReader } from \"./components/ConfigReader.component\";\nimport { A_Config } from \"./A-Config.context\";\nimport { A_Polyfill } from \"../A-Polyfill/A-Polyfill.component\";\nimport { A_ConfigError } from \"./A-Config.error\";\nimport { FileConfigReader } from \"./components/FileConfigReader.component\";\nimport { ENVConfigReader } from \"./components/ENVConfigReader.component\";\nimport { A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY } from \"./A-Config.constants\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Container({\n namespace: 'A-Utils',\n name: 'A-ConfigLoader',\n description: 'Container responsible for loading and initializing the A_Config component based on the environment and available configuration sources. It can be useful for application that need a separated configuration management and sharable across multiple containers.'\n})\nexport class A_ConfigLoader extends A_Container {\n\n private reader!: ConfigReader\n\n\n @A_Concept.Load({\n before: /.*/\n })\n async prepare(\n @A_Inject(A_Polyfill) polyfill: A_Polyfill\n ) {\n if (!this.scope.has(A_Config)) {\n const newConfig = new A_Config({\n variables: [\n ...A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,\n ...A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY\n ] as const,\n defaults: {}\n });\n\n this.scope.register<A_Fragment>(newConfig);\n }\n\n\n const fs = await polyfill.fs();\n\n try {\n switch (true) {\n\n case A_Context.environment === 'server' && !!fs.existsSync(`${A_Context.concept}.conf.json`):\n this.reader = this.scope.resolve<ConfigReader>(FileConfigReader)!;\n break;\n\n case A_Context.environment === 'server' && !fs.existsSync(`${A_Context.concept}.conf.json`):\n this.reader = this.scope.resolve<ConfigReader>(ENVConfigReader)!;\n break;\n\n case A_Context.environment === 'browser':\n this.reader = this.scope.resolve<ConfigReader>(ENVConfigReader)!;\n break;\n\n default:\n throw new A_ConfigError(\n A_ConfigError.InitializationError,\n `Environment ${A_Context.environment} is not supported`\n );\n }\n } catch (error) {\n if (error instanceof A_ScopeError) {\n throw new A_ConfigError({\n title: A_ConfigError.InitializationError,\n description: `Failed to initialize A_ConfigLoader. Reader not found for environment ${A_Context.environment}`,\n originalError: error,\n })\n }\n }\n }\n}","import { A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor } from \"@adaas/a-concept\";\n\nexport enum A_TYPES__ConfigFeature {\n\n}\n\n\nexport type A_TYPES__ConfigContainerConstructor<T extends Array<string | A_TYPES__ConceptENVVariables[number]>> = {\n\n /**\n * If set to true, the SDK will throw an error if the variable is not defined OR not presented in the defaults\n */\n strict: boolean\n\n /**\n * Allows to define the names of variable to be loaded\n */\n variables: T\n\n /**\n * Allows to set the default values for the variables\n */\n defaults: {\n [key in T[number]]?: any\n }\n} & A_TYPES__Fragment_Constructor;\n","\n\nexport const A_LoggerEnvVariables = {\n /**\n * Sets the log level for the logger\n * \n * @example 'debug', 'info', 'warn', 'error'\n */\n A_LOGGER_LEVEL: 'A_LOGGER_LEVEL',\n\n /** \n * Sets the default scope length for log messages\n * \n * @example 'A_LOGGER_DEFAULT_SCOPE_LENGTH'\n */\n A_LOGGER_DEFAULT_SCOPE_LENGTH: 'A_LOGGER_DEFAULT_SCOPE_LENGTH',\n\n /**\n * Sets the default color for scope display in log messages\n * \n * @example 'green', 'blue', 'red', 'yellow', 'gray', 'magenta', 'cyan', 'white', 'pink'\n */\n A_LOGGER_DEFAULT_SCOPE_COLOR: 'A_LOGGER_DEFAULT_SCOPE_COLOR',\n\n /**\n * Sets the default color for log message content\n * \n * @example 'green', 'blue', 'red', 'yellow', 'gray', 'magenta', 'cyan', 'white', 'pink'\n */\n A_LOGGER_DEFAULT_LOG_COLOR: 'A_LOGGER_DEFAULT_LOG_COLOR',\n} as const;\n\n\n\nexport const A_LoggerEnvVariablesArray = [\n A_LoggerEnvVariables.A_LOGGER_LEVEL,\n A_LoggerEnvVariables.A_LOGGER_DEFAULT_SCOPE_LENGTH,\n A_LoggerEnvVariables.A_LOGGER_DEFAULT_SCOPE_COLOR,\n A_LoggerEnvVariables.A_LOGGER_DEFAULT_LOG_COLOR,\n] as const;\n\n\nexport type A_LoggerEnvVariablesType = (typeof A_LoggerEnvVariables)[keyof typeof A_LoggerEnvVariables][];","import { A_Error } from \"@adaas/a-concept\";\n\nexport class A_ManifestError extends A_Error {\n\n static readonly ManifestInitializationError = 'A-Manifest Initialization Error';\n\n}\n","import { A_TYPES__Component_Constructor } from \"@adaas/a-concept\";\nimport { A_Manifest } from \"../A-Manifest.context\";\nimport { A_UTILS_TYPES__Manifest_AllowedComponents } from \"../A-Manifest.types\";\n\n/**\n * Fluent API for checking manifest permissions\n */\nexport class A_ManifestChecker {\n constructor(\n private manifest: A_Manifest,\n private component: A_TYPES__Component_Constructor,\n private method: string,\n private checkExclusion: boolean = false\n ) {}\n\n for(target: A_UTILS_TYPES__Manifest_AllowedComponents): boolean {\n const result = this.manifest.internal_checkAccess({\n component: this.component,\n method: this.method,\n target: target\n });\n\n return this.checkExclusion ? !result : result;\n }\n}","import { A_Component, A_Fragment, A_TypeGuards, A_TYPES__Component_Constructor } from \"@adaas/a-concept\";\nimport { A_UTILS_TYPES__Manifest_Init, A_UTILS_TYPES__Manifest_ComponentLevelConfig, A_UTILS_TYPES__Manifest_AllowedComponents, A_UTILS_TYPES__ManifestRule, A_UTILS_TYPES__ManifestQuery } from \"./A-Manifest.types\";\nimport { A_ManifestError } from \"./A-Manifest.error\";\nimport { A_ManifestChecker } from \"./classes/A-ManifestChecker.class\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-Manifest',\n description: 'A-Manifest is a configuration fragment that allows to include or exclude component application for particular methods. It provides fine-grained control over which components are applied to which targets and methods within the application, enabling flexible and dynamic behavior based on defined rules.'\n})\nexport class A_Manifest extends A_Fragment {\n\n private rules: A_UTILS_TYPES__ManifestRule[] = [];\n\n /**\n * A-Manifest is a configuration set that allows to include or exclude component application for the particular methods.\n *\n * For example, if A-Scope provides polymorphic A-Component that applies for All A-Entities in it but you have another component that should be used for only One particular Entity, you can use A-Manifest to specify this behavior.\n * \n * \n * By default if Component is provided in the scope - it applies for all entities in it. However, if you want to exclude some entities or include only some entities for the particular component - you can use A-Manifest to define this behavior.\n * \n * @param config - Array of component configurations\n */\n constructor(config: A_UTILS_TYPES__Manifest_Init = []) {\n super({\n name: 'A-Manifest',\n });\n\n this.prepare(config);\n }\n\n\n /**\n * Should convert received configuration into internal Regexp applicable for internal storage\n */\n protected prepare(config: A_UTILS_TYPES__Manifest_Init) {\n if (!A_TypeGuards.isArray(config))\n throw new A_ManifestError(\n A_ManifestError.ManifestInitializationError,\n `A-Manifest configuration should be an array of configurations`\n );\n\n for (const item of config) {\n this.processConfigItem(item);\n }\n }\n\n /**\n * Process a single configuration item and convert it to internal rules\n */\n private processConfigItem(item: A_UTILS_TYPES__Manifest_ComponentLevelConfig) {\n if (!A_TypeGuards.isComponentConstructor(item.component))\n throw new A_ManifestError(\n A_ManifestError.ManifestInitializationError,\n `A-Manifest configuration item should be a A-Component constructor`\n );\n\n const componentRegex = this.constructorToRegex(item.component);\n\n // Always add component-level rule first (applies to all methods)\n if (item.apply || item.exclude) {\n const methodRegex = /.*/; // Match all methods\n\n this.rules.push({\n componentRegex,\n methodRegex,\n applyRegex: item.apply ? this.allowedComponentsToRegex(item.apply) : undefined,\n excludeRegex: item.exclude ? this.allowedComponentsToRegex(item.exclude) : undefined,\n });\n }\n\n // Then add method-level configurations (these will override component-level)\n if (item.methods && item.methods.length > 0) {\n for (const methodConfig of item.methods) {\n const methodRegex = this.methodToRegex(methodConfig.method);\n\n this.rules.push({\n componentRegex,\n methodRegex,\n applyRegex: methodConfig.apply ? this.allowedComponentsToRegex(methodConfig.apply) : undefined,\n excludeRegex: methodConfig.exclude ? this.allowedComponentsToRegex(methodConfig.exclude) : undefined,\n });\n }\n }\n }\n\n\n\n /**\n * Convert a constructor to a regex pattern\n */\n private constructorToRegex(ctor: A_TYPES__Component_Constructor): RegExp {\n return new RegExp(`^${this.escapeRegex(ctor.name)}$`);\n }\n\n /**\n * Convert a method name or regex to a regex pattern\n */\n private methodToRegex(method: string | RegExp): RegExp {\n if (method instanceof RegExp) {\n return method;\n }\n return new RegExp(`^${this.escapeRegex(method as string)}$`);\n }\n\n /**\n * Convert allowed components array or regex to a single regex\n */\n private allowedComponentsToRegex(components: A_UTILS_TYPES__Manifest_AllowedComponents[] | RegExp): RegExp {\n if (components instanceof RegExp) {\n return components;\n }\n\n const patterns = components.map(ctor => this.escapeRegex(ctor.name));\n return new RegExp(`^(${patterns.join('|')})$`);\n }\n\n /**\n * Escape special regex characters in a string\n */\n private escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n }\n\n protected configItemToRegexp(item: A_TYPES__Component_Constructor): RegExp {\n return this.constructorToRegex(item);\n }\n\n\n protected ID(component: A_TYPES__Component_Constructor, method: string) {\n return `${component.name}.${method}`;\n }\n\n /**\n * Check if a component and method combination is allowed for a target\n */\n isAllowed<T extends A_Component>(\n ctor: T | A_TYPES__Component_Constructor<T>,\n method: string\n ): A_ManifestChecker {\n const componentCtor = typeof ctor === 'function' ? ctor : ctor.constructor as A_TYPES__Component_Constructor;\n return new A_ManifestChecker(this, componentCtor, method);\n }\n\n /**\n * Internal method to check if access is allowed\n */\n internal_checkAccess(query: A_UTILS_TYPES__ManifestQuery): boolean {\n const componentName = query.component.name;\n const methodName = query.method;\n const targetName = query.target.name;\n\n // Find matching rules, sorted by specificity (method-specific rules first)\n const matchingRules = this.rules\n .filter(rule =>\n rule.componentRegex.test(componentName) &&\n rule.methodRegex.test(methodName)\n )\n .sort((a, b) => {\n // Method-specific rules (not .* pattern) should come before general rules\n const aIsGeneral = a.methodRegex.source === '.*';\n const bIsGeneral = b.methodRegex.source === '.*';\n\n if (aIsGeneral && !bIsGeneral) return 1; // b comes first\n if (!aIsGeneral && bIsGeneral) return -1; // a comes first\n return 0; // same priority\n });\n\n // If no rules match, allow by default\n if (matchingRules.length === 0) {\n return true;\n }\n\n // Process rules in order of specificity (most specific first)\n for (const rule of matchingRules) {\n // If this rule has an exclusion that matches, deny access\n if (rule.excludeRegex && rule.excludeRegex.test(targetName)) {\n return false;\n }\n\n // If this rule has an apply list, check if target is in it\n if (rule.applyRegex) {\n return rule.applyRegex.test(targetName);\n }\n }\n\n // If we have rules but no specific apply/exclude, allow by default\n return true;\n }\n\n isExcluded<T extends A_Component>(\n ctor: T | A_TYPES__Component_Constructor<T>,\n method: string\n ): A_ManifestChecker {\n const componentCtor = typeof ctor === 'function' ? ctor : ctor.constructor as A_TYPES__Component_Constructor;\n return new A_ManifestChecker(this, componentCtor, method, true);\n }\n}\n","\n\nexport enum A_MemoryFeatures {\n /**\n * Allows to extend initialization logic and behavior\n */\n onInit = '_A_Memory_onInit',\n\n /**\n * Allows to extend destruction logic and behavior\n */\n onDestroy = '_A_Memory_onDestroy',\n\n /**\n * Allows to extend expiration logic and behavior\n */\n onExpire = '_A_Memory_onExpire',\n\n /**\n * Allows to extend error handling logic and behavior\n */\n onError = '_A_Memory_onError',\n\n /**\n * Allows to extend serialization logic and behavior\n */\n onSerialize = '_A_Memory_onSerialize',\n\n /**\n * Allows to extend set operation logic and behavior\n */\n onSet = '_A_Memory_onSet',\n /**\n * Allows to extend get operation logic and behavior\n */\n onGet = '_A_Memory_onGet',\n /**\n * Allows to extend drop operation logic and behavior\n */\n onDrop = '_A_Memory_onDrop',\n /**\n * Allows to extend clear operation logic and behavior\n */\n onClear = '_A_Memory_onClear',\n /**\n * Allows to extend has operation logic and behavior\n */\n onHas = '_A_Memory_onHas',\n}","import { A_Error, A_Fragment, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame\";\nimport { error } from \"console\";\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-MemoryContext',\n description: 'In-memory context fragment that provides a simple key-value store for temporary data storage during application runtime. It allows setting, getting, deleting, and checking the existence of key-value pairs, facilitating quick access to transient data without persistent storage. This context is useful for scenarios where data needs to be shared across different components or operations within the same execution context.'\n})\nexport class A_MemoryContext<\n _MemoryType extends Record<string, any> = Record<string, any>,\n _SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized\n> extends A_Fragment {\n protected _storage: Map<keyof _MemoryType, _MemoryType[keyof _MemoryType]> = new Map();\n\n set<K extends keyof _MemoryType>(param: K, value: _MemoryType[K]): void {\n this._storage.set(param, value);\n }\n\n\n get<K extends keyof _MemoryType>(param: K): _MemoryType[K] | undefined {\n return this._storage.get(param);\n }\n\n\n delete<K extends keyof _MemoryType>(param: K): void {\n this._storage.delete(param);\n }\n\n\n has<K extends keyof _MemoryType>(param: K): boolean {\n return this._storage.has(param);\n }\n\n clear(): void {\n this._storage.clear();\n }\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\nexport class A_MemoryError extends A_Error {\n\n static readonly MemoryInitializationError = 'Memory initialization error';\n\n static readonly MemoryDestructionError = 'Memory destruction error';\n\n static readonly MemoryGetError = 'Memory GET operation failed';\n\n static readonly MemorySetError = 'Memory SET operation failed';\n\n static readonly MemoryDropError = 'Memory DROP operation failed';\n\n static readonly MemoryClearError = 'Memory CLEAR operation failed';\n\n static readonly MemoryHasError = 'Memory HAS operation failed';\n\n static readonly MemorySerializeError = 'Memory toJSON operation failed';\n}\n","import { A_Component, A_Inject, A_Scope, A_Feature, A_Dependency, A_Context } from \"@adaas/a-concept\";\nimport { A_MemoryFeatures } from \"./A-Memory.constants\";\nimport { A_MemoryContext } from \"./A-Memory.context\";\nimport { A_MemoryError } from \"./A-Memory.error\";\nimport { A_OperationContext } from \"../A-Operation/A-Operation.context\";\nimport { A_MemoryOperationContext } from \"./A-Memory.types\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-Memory',\n description: 'In-memory data storage component that provides a simple key-value store with asynchronous operations. It supports basic memory operations such as get, set, has, drop, and clear, along with lifecycle management and error handling features. This components features can be extended with other components to provide ability store data across multiple storage, or extract data from multiple external sources. Good example is to store some runtime data that needs to be shared across multiple containers or concepts.'\n})\nexport class A_Memory<\n _StorageType extends Record<string, any> = Record<string, any>,\n _SerializedType extends Record<string, any> = Record<string, any>\n> extends A_Component {\n\n protected _ready?: Promise<void>\n\n\n get ready(): Promise<void> {\n if (!this._ready) {\n this._ready = this.init();\n }\n return this._ready;\n }\n\n // ======================================================================\n // ======================A-Memory Lifecycle Hooks========================\n // ======================================================================\n\n @A_Feature.Extend()\n /**\n * Handles errors during memory operations\n */\n async [A_MemoryFeatures.onError](...args: any[]): Promise<void> {\n // Handle error\n }\n\n @A_Feature.Extend()\n /**\n * Handles memory expiration\n */\n async [A_MemoryFeatures.onExpire](...args: any[]): Promise<void> {\n // Clear memory on expire\n }\n\n @A_Feature.Extend()\n /**\n * Initializes the memory context\n */\n async [A_MemoryFeatures.onInit](\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Initialize memory\n if (!context) {\n context = new A_MemoryContext<_StorageType>();\n A_Context.scope(this).register(context);\n }\n }\n\n @A_Feature.Extend()\n async [A_MemoryFeatures.onDestroy](\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]): Promise<void> {\n // Cleanup memory\n context.clear();\n }\n\n /**\n * Handles the 'get' operation for retrieving a value from memory\n */\n @A_Feature.Extend()\n async [A_MemoryFeatures.onGet](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle get operation\n operation.succeed(context.get(operation.params.key));\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'has' operation for checking existence of a key in memory\n */\n async [A_MemoryFeatures.onHas](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext<boolean>,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle has operation\n operation.succeed(context.has(operation.params.key));\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'set' operation for saving a value in memory\n */\n async [A_MemoryFeatures.onSet](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n @A_Inject(A_Scope) scope: A_Scope,\n ...args: any[]\n ): Promise<void> {\n // Handle set operation\n context.set(operation.params.key, operation.params.value);\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'drop' operation for removing a value from memory\n */\n async [A_MemoryFeatures.onDrop](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle drop operation\n context.delete(operation.params.key);\n }\n\n @A_Feature.Extend()\n /**\n * Handles the 'clear' operation for clearing all values from memory\n */\n async [A_MemoryFeatures.onClear](\n @A_Dependency.Required()\n @A_Inject(A_OperationContext) operation: A_MemoryOperationContext,\n @A_Inject(A_MemoryContext) context: A_MemoryContext<_StorageType>,\n ...args: any[]\n ): Promise<void> {\n // Handle clear operation\n context.clear();\n }\n\n\n\n // ======================================================================\n // =========================A-Memory Methods=============================\n // ======================================================================\n\n /**\n * Initializes the memory context\n */\n async init() {\n if (this._ready)\n return this._ready;\n\n const scope = new A_Scope({ name: 'A-Memory-Init-Scope' })\n .inherit(A_Context.scope(this));\n\n try {\n await this.call(A_MemoryFeatures.onInit, scope);\n\n } catch (error) {\n const initError = new A_MemoryError({\n title: A_MemoryError.MemoryInitializationError,\n description: 'An error occurred during memory initialization',\n originalError: error\n })\n\n scope.register(initError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw initError;\n }\n }\n\n /**\n * Destroys the memory context\n *\n * This method is responsible for cleaning up any resources\n * used by the memory context and resetting its state.\n */\n async destroy() {\n\n const scope = new A_Scope({ name: 'A-Memory-Destroy-Scope' })\n .inherit(A_Context.scope(this));\n\n try {\n this._ready = undefined;\n\n await this.call(A_MemoryFeatures.onDestroy, scope);\n\n } catch (error) {\n const destroyError = new A_MemoryError({\n title: A_MemoryError.MemoryDestructionError,\n description: 'An error occurred during memory destruction',\n originalError: error\n })\n\n scope.register(destroyError);\n\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw destroyError;\n }\n }\n\n /**\n * Retrieves a value from the context memory\n * \n * @param key - memory key to retrieve\n * @returns - value associated with the key or undefined if not found\n */\n async get<K extends keyof _StorageType>(\n /**\n * Key to retrieve the value for\n */\n key: K\n ): Promise<_StorageType[K] | undefined> {\n\n const operation = new A_OperationContext('get', { key });\n\n const scope = new A_Scope({\n name: 'A-Memory-Get-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onGet, scope);\n\n scope.destroy();\n\n return operation.result;\n\n } catch (error) {\n const getError = new A_MemoryError({\n title: A_MemoryError.MemoryGetError,\n description: `An error occurred while getting the value for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(getError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw getError;\n }\n }\n\n /**\n * Checks if a value exists in the context memory\n * \n * @param key - memory key to check\n * @returns - true if key exists, false otherwise\n */\n async has(key: keyof _StorageType): Promise<boolean> {\n const operation = new A_OperationContext('has', { key });\n\n const scope = new A_Scope({\n name: 'A-Memory-Has-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onHas, scope);\n\n scope.destroy();\n\n return operation.result;\n\n } catch (error) {\n const getError = new A_MemoryError({\n title: A_MemoryError.MemoryHasError,\n description: `An error occurred while checking existence for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(getError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw getError;\n }\n }\n\n /**\n * Saves a value in the context memory\n * \n * @param key \n * @param value \n */\n async set<K extends keyof _StorageType>(\n /**\n * Key to save the value under\n */\n key: K,\n /**\n * Value to save\n */\n value: _StorageType[K]\n ): Promise<void> {\n const operation = new A_OperationContext('set', { key, value });\n\n const scope = new A_Scope({\n name: 'A-Memory-Set-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onSet, scope);\n\n } catch (error) {\n const setError = new A_MemoryError({\n title: A_MemoryError.MemorySetError,\n description: `An error occurred while setting the value for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(setError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw setError;\n }\n }\n\n\n /**\n * Removes a value from the context memory by key\n * \n * @param key \n */\n async drop(key: keyof _StorageType): Promise<void> {\n\n const operation = new A_OperationContext('drop', { key });\n\n const scope = new A_Scope({\n name: 'A-Memory-Drop-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onDrop, scope);\n\n } catch (error) {\n const dropError = new A_MemoryError({\n title: A_MemoryError.MemoryDropError,\n description: `An error occurred while dropping the value for key \"${String(key)}\"`,\n originalError: error\n });\n\n scope.register(dropError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw dropError;\n }\n }\n\n /**\n * Clears all stored values in the context memory\n */\n async clear(): Promise<void> {\n const operation = new A_OperationContext('clear');\n\n const scope = new A_Scope({\n name: 'A-Memory-Clear-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onClear, scope);\n\n } catch (error) {\n const clearError = new A_MemoryError({\n title: A_MemoryError.MemoryClearError,\n description: `An error occurred while clearing the memory`,\n originalError: error\n });\n\n scope.register(clearError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw clearError;\n }\n }\n\n\n /**\n * Serializes the memory context to a JSON object\n * \n * @returns - serialized memory object \n */\n async toJSON(): Promise<_SerializedType> {\n const operation = new A_OperationContext('serialize');\n\n const scope = new A_Scope({\n name: 'A-Memory-Serialize-Operation-Scope',\n fragments: [operation]\n })\n .inherit(A_Context.scope(this));\n\n try {\n\n await this.call(A_MemoryFeatures.onSerialize, scope);\n\n return operation.result as _SerializedType;\n\n } catch (error) {\n const serializeError = new A_MemoryError({\n title: A_MemoryError.MemorySerializeError,\n description: `An error occurred while serializing the memory`,\n originalError: error\n });\n\n scope.register(serializeError);\n\n await this.call(A_MemoryFeatures.onError, scope);\n\n scope.destroy();\n\n throw serializeError;\n }\n\n }\n}","export enum A_ServiceFeatures {\n\n onBeforeLoad = '_A_Service_onBeforeLoad',\n onLoad = '_A_Service_onLoad',\n onAfterLoad = '_A_Service_onAfterLoad',\n\n onBeforeStart = '_A_Service_onBeforeStart',\n onStart = '_A_Service_onStart',\n onAfterStart = '_A_Service_onAfterStart',\n\n onBeforeStop = '_A_Service_onBeforeStop',\n onStop = '_A_Service_onStop',\n onAfterStop = '_A_Service_onAfterStop',\n\n\n onError = '_A_Service_onError',\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\n\nexport class A_Service_Error extends A_Error {\n\n static readonly ServiceLoadError = 'Service load error';\n\n static readonly ServiceStartError = 'Service start error';\n\n static readonly ServiceStopError = 'Service stop error';\n\n \n\n}","import { A_Concept, A_Container, A_Error, A_Feature, A_Inject } from \"@adaas/a-concept\";\nimport { A_ServiceFeatures } from \"./A-Service.constants\";\nimport { A_Polyfill } from \"../A-Polyfill/A-Polyfill.component\";\nimport { A_Config } from \"../A-Config/A-Config.context\";\nimport { A_Logger } from \"../A-Logger/A-Logger.component\";\nimport { A_Service_Error } from \"./A-Service.error\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n/**\n * A-Service is a container that can run different types of services, such as HTTP servers, workers, etc.\n * Depending on the provided config and configuration, it will load the necessary components and start the service.\n * \n */\n@A_Frame.Container({\n namespace: 'A-Utils',\n name: 'A-Service',\n description: 'Service container that manages the lifecycle of various types of services, such as HTTP servers and workers or UI loader. It dynamically loads necessary components based on the provided configuration and orchestrates the start and stop processes, ensuring proper error handling and extensibility through feature hooks.'\n})\nexport class A_Service extends A_Container {\n\n\n @A_Concept.Load()\n /**\n * Load the service\n */\n async load() {\n try {\n await this.call(A_ServiceFeatures.onBeforeLoad);\n\n await this.call(A_ServiceFeatures.onLoad);\n\n await this.call(A_ServiceFeatures.onAfterLoad);\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_Service_Error:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_Service_Error:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_Service_Error({\n title: A_Service_Error.ServiceLoadError,\n description: 'An error occurred while processing the request.',\n originalError: error\n })\n break;\n }\n\n this.scope.register(wrappedError);\n\n await this.call(A_ServiceFeatures.onError);\n }\n\n }\n\n\n @A_Concept.Start()\n /**\n * Start the server\n */\n async start() {\n try {\n await this.call(A_ServiceFeatures.onBeforeStart);\n\n await this.call(A_ServiceFeatures.onStart);\n\n await this.call(A_ServiceFeatures.onAfterStart);\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_Service_Error:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_Service_Error:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_Service_Error({\n title: A_Service_Error.ServiceStartError,\n description: 'An error occurred while processing the request.',\n originalError: error\n })\n break;\n }\n\n this.scope.register(wrappedError);\n\n await this.call(A_ServiceFeatures.onError);\n }\n\n }\n\n @A_Concept.Stop()\n /**\n * Stop the server\n */\n async stop() {\n try {\n await this.call(A_ServiceFeatures.onBeforeStop);\n\n await this.call(A_ServiceFeatures.onStop);\n\n await this.call(A_ServiceFeatures.onAfterStop);\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_Service_Error:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_Service_Error:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_Service_Error({\n title: A_Service_Error.ServiceStopError,\n description: 'An error occurred while processing the request.',\n originalError: error\n })\n break;\n }\n\n this.scope.register(wrappedError);\n\n await this.call(A_ServiceFeatures.onError);\n }\n }\n\n\n\n\n // ======================================================================================\n // ============================= A-Service Lifecycle =================================\n // ======================================================================================\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onBeforeLoad](\n @A_Inject(A_Polyfill) polyfill: A_Polyfill,\n ...args: any[]\n ): Promise<void> {\n // Initialize Polyfill\n if (!polyfill) {\n this.scope.register(A_Polyfill);\n polyfill = this.scope.resolve(A_Polyfill)!\n }\n }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onLoad](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onAfterLoad](...args: any[]) { }\n\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onBeforeStart](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onStart](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onAfterStart](...args: any[]) { }\n\n\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onBeforeStop](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onStop](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onAfterStop](...args: any[]) { }\n\n\n\n @A_Feature.Extend({\n before: /.*/\n })\n protected async [A_ServiceFeatures.onError](\n @A_Inject(A_Error) error: A_Error,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n logger?.error(error);\n }\n\n}\n\n\n\n\n\n\n\n\n","import { A_Fragment } from '@adaas/a-concept';\nimport { A_Frame } from '@adaas/a-frame';\n\n\n\n\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-Route',\n description: 'Route fragment that defines URL patterns for routing purposes. It supports dynamic parameters and query extraction, allowing for flexible route definitions. This fragment can be used in routing systems to match incoming URLs against defined routes and extract relevant parameters and query strings.'\n})\nexport class A_Route<\n _TParams extends Record<string, any> = Record<string, any>,\n _TQuery extends Record<string, any> = Record<string, any>\n> extends A_Fragment {\n\n public url!: string;\n\n\n constructor(\n url: string | RegExp,\n ) {\n super();\n this.url = url instanceof RegExp ? url.source : url;\n }\n\n /**\n * Returns path only without query and hash\n */\n get path(): string {\n const p = this.url.split('?')[0].split('#')[0];\n\n\n // ensure that last char is not /\n // and remove protocol and domain if present\n if (p.includes('://')) {\n const pathStartIndex = p.indexOf('/', p.indexOf('://') + 3);\n if (pathStartIndex === -1) {\n return '/';\n } else {\n const path = p.slice(pathStartIndex);\n return path.endsWith('/') ? path.slice(0, -1) : path;\n }\n }\n return p.endsWith('/') ? p.slice(0, -1) : p;\n }\n /**\n * Returns array of parameter names in the route path\n */\n get params(): string[] {\n return this.path\n .match(/:([^\\/]+)/g)\n ?.map((param) => param.slice(1))\n || [];\n }\n\n\n /**\n * Returns protocol based on URL scheme\n */\n get protocol(): string {\n switch (true) {\n case this.url.startsWith('http://'):\n return 'http';\n case this.url.startsWith('https://'):\n return 'https';\n case this.url.startsWith('ws://'):\n return 'ws';\n case this.url.startsWith('wss://'):\n return 'wss';\n default:\n return this.url.includes('://') ? this.url.split('://')[0] : 'http';\n }\n }\n\n\n extractParams(url: string): _TParams {\n // Remove query string (anything after ?)\n const cleanUrl = url.split('?')[0];\n\n const urlSegments = cleanUrl.split('/').filter(Boolean);\n const maskSegments = this.path.split('/').filter(Boolean);\n\n const params = {};\n\n for (let i = 0; i < maskSegments.length; i++) {\n\n const maskSegment = maskSegments[i];\n const urlSegment = urlSegments[i];\n\n if (maskSegment.startsWith(':')) {\n const paramName = maskSegment.slice(1); // Remove ':' from mask\n params[paramName] = urlSegment;\n } else if (maskSegment !== urlSegment) {\n // If static segments don’t match → fail\n return {} as _TParams;\n }\n }\n\n return params as _TParams;\n }\n\n extractQuery(url: string): _TQuery {\n const query: Record<string, string> = {};\n\n // Take only the part after \"?\"\n const queryString = url.split('?')[1];\n if (!queryString) return query as _TQuery;\n\n // Remove fragment (#...) if present\n const cleanQuery = queryString.split('#')[0];\n\n // Split into key=value pairs\n for (const pair of cleanQuery.split('&')) {\n if (!pair) continue;\n const [key, value = ''] = pair.split('=');\n query[decodeURIComponent(key)] = decodeURIComponent(value);\n }\n\n return query as _TQuery;\n }\n\n\n\n toString(): string {\n // path can be like /api/v1/users/:id\n // and because of that :id we need to replace it with regex that matches chars and numbers only \n return `${this.path}`;\n // .replace(/\\/:([^\\/]+)/g, '\\\\/([^\\/]+)')\n }\n\n toRegExp(): RegExp {\n return new RegExp(`^${this.path.replace(/\\/:([^\\/]+)/g, '/([^/]+)')}$`);\n }\n\n toAFeatureExtension(extensionScope: Array<string> = []): RegExp {\n return new RegExp(`^${extensionScope.length\n ? `(${extensionScope.join('|')})`\n : '.*'\n }\\\\.${this.path.replace(/\\/:([^\\/]+)/g, '/([^/]+)')}$`);\n }\n}\n\n","import { A_Entity, A_Scope } from \"@adaas/a-concept\";\nimport { A_Signal_Init, A_Signal_Serialized } from \"../A-Signal.types\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A Signal Entity is an individual signal instance that carries data.\n * Signals is a event types that uses for vectors of signals to be used for further processing. \n * \n * Comparing to standard events, signals should be used in case when the event impacts some \"state\" \n * and the state should be used instead of the event itself.\n * \n * For example, a signal can represent the current status of a user (online/offline/away), \n * while an event would represent a single action (user logged in/logged out).\n * \n * Signals are typically used in scenarios where the current state is more important than individual events, \n * such as monitoring systems, real-time dashboards, or stateful applications.\n */\n@A_Frame.Entity({\n namespace: 'A-Utils',\n name: 'A-Signal',\n description: 'A Signal Entity represents an individual signal instance that carries data, used for managing state within an application context. Signals are designed to reflect the current state rather than individual events, making them suitable for scenarios where state monitoring and real-time updates are essential.'\n})\nexport class A_Signal<\n _TSignalDataType extends Record<string, any> = Record<string, any>\n> extends A_Entity<A_Signal_Init<_TSignalDataType>, A_Signal_Serialized<_TSignalDataType>> {\n\n\n // ========================================================================\n // ========================== Static Methods ==============================\n // ========================================================================\n /**\n * Allows to define default data for the signal.\n * \n * If no data is provided during initialization, the default data will be used.\n * \n * @returns \n */\n static async default(): Promise<A_Signal | undefined> {\n return undefined;\n }\n\n // ========================================================================\n // ========================== Instance Properties ========================\n // ========================================================================\n\n /**\n * The actual data carried by the signal.\n */\n data!: _TSignalDataType;\n\n /**\n * Generates signal hash uses for comparison\n * \n * @param str \n */\n protected createHash(str?: string): string\n protected createHash(str?: undefined): string\n protected createHash(str?: Record<string, any>): string\n protected createHash(str?: Array<any>): string\n protected createHash(str?: number): string\n protected createHash(str?: boolean): string\n protected createHash(str?: null): string\n protected createHash(map?: Map<any, any>): string\n protected createHash(set?: Set<any>): string\n protected createHash(str?: any): string {\n let hashSource: string;\n\n if (str instanceof Map) {\n hashSource = JSON.stringify(Array.from(str.entries()));\n } else if (str instanceof Set) {\n hashSource = JSON.stringify(Array.from(str.values()));\n } else {\n switch (typeof str) {\n case 'string':\n hashSource = str;\n break;\n case 'undefined':\n hashSource = 'undefined';\n break;\n\n case 'object':\n if ('toJSON' in str)\n hashSource = JSON.stringify(str.toJSON());\n\n else\n hashSource = JSON.stringify(str);\n break;\n case 'number':\n hashSource = str.toString();\n break;\n case 'boolean':\n hashSource = str ? 'true' : 'false';\n break;\n case 'function':\n hashSource = str.toString();\n break;\n default:\n hashSource = String(str);\n }\n }\n\n let hash = 0, i, chr;\n for (i = 0; i < hashSource.length; i++) {\n chr = hashSource.charCodeAt(i);\n hash = ((hash << 5) - hash) + chr;\n hash |= 0; // Convert to 32bit integer\n }\n\n const hashString = hash.toString();\n\n return hashString;\n }\n\n /**\n * This method compares the current signal with another signal instance by deduplication ID\n * this id can be configured during initialization with the \"id\" property.\n * \n * example: \n * * const signalA = new A_Signal({ id: ['user-status', 'user123'], data: { status: 'online' } });\n * * const signalB = new A_Signal({ id: ['user-status', 'user123'], data: { status: 'offline' } });\n * \n * signalA.compare(signalB) // true because both signals have the same deduplication ID\n * \n * @param other \n * @returns \n */\n compare(other: A_Signal<_TSignalDataType>): boolean {\n if (this.aseid.id !== other.aseid.id) {\n return false;\n }\n\n return true;\n }\n \n\n\n fromJSON(serializedEntity: A_Signal_Serialized<_TSignalDataType>): void {\n super.fromJSON(serializedEntity);\n this.data = serializedEntity.data;\n }\n\n\n fromNew(newEntity: A_Signal_Init<_TSignalDataType>): void {\n this.data = newEntity.data;\n\n const identity = newEntity.id || {\n name: newEntity.name,\n data: this.data\n };\n\n const id = this.createHash(identity);\n\n this.aseid = this.generateASEID({\n entity: newEntity.name,\n id: id,\n });\n }\n\n\n toJSON(): A_Signal_Serialized<_TSignalDataType> {\n return {\n ...super.toJSON(),\n data: this.data\n };\n }\n\n}","import { A_Entity, A_Scope, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor } from \"@adaas/a-concept\";\nimport { A_SignalVector_Serialized, A_SignalVector_Init, A_Signal_TSignalsConstructors, A_SignalTValue, A_SignalTValueArray } from \"../A-Signal.types\";\nimport { A_Signal } from \"./A-Signal.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n/**\n * A Signal Vector Entity is a collection of signals structured in a specific way.\n * It allows grouping multiple signals together for batch processing or transmission.\n * \n * Signal Vectors are useful in scenarios where multiple related signals need to be handled together,\n * as a state of the system or a snapshot of various parameters at a given time.\n * \n * @template TSignalsConstructors - Array of signal constructor types (e.g., [typeof MySignal, typeof CustomSignal])\n * @template TSignals - Array of signal instances derived from constructors\n */\n@A_Frame.Entity({\n namespace: 'A-Utils',\n name: 'A-SignalVector',\n description: 'A Signal Vector Entity represents a collection of signals structured in a specific way, allowing for batch processing and transmission of related signals as a unified state representation.'\n})\nexport class A_SignalVector<\n TSignals extends A_Signal[] = A_Signal[],\n> extends A_Entity<A_SignalVector_Init<TSignals>> {\n\n /**\n * The structure of the signal vector, defining the types of signals it contains.\n * \n * For example:\n * [UserSignInSignal, UserStatusSignal, UserActivitySignal]\n * \n * [!] if not provided, it will be derived from the signals values.\n */\n protected _structure?: A_Signal_TSignalsConstructors<TSignals>;\n /**\n * It's actual vector Values of Signals like :\n * [UserActionSignal, UserMousePositionSignal, ExternalDependencySignal]\n */\n protected _signals!: TSignals\n\n constructor(values: TSignals, structure?: { [K in keyof TSignals]: TSignals[K] extends A_Signal ? A_TYPES__Entity_Constructor<TSignals[K]> : never })\n constructor(serialized: A_SignalVector_Serialized)\n constructor(param1: TSignals | A_SignalVector_Serialized, param2?: A_Signal_TSignalsConstructors<TSignals>) {\n\n if ('aseid' in param1) {\n // Handle serialized case\n super(param1 as A_SignalVector_Serialized);\n } else {\n // Handle init case \n super({\n structure: param2 ? param2 : (param1 as TSignals).map(s => s.constructor as A_TYPES__Entity_Constructor<TSignals[number]>) as A_Signal_TSignalsConstructors<TSignals>,\n values: param1 as TSignals\n } as A_SignalVector_Init<TSignals>);\n }\n }\n\n\n fromNew(newEntity: A_SignalVector_Init<TSignals>): void {\n super.fromNew(newEntity);\n this._structure = newEntity.structure;\n this._signals = newEntity.values;\n }\n\n /**\n * The structure of the signal vector, defining the types of signals it contains.\n * \n * For example:\n * [UserSignInSignal, UserStatusSignal, UserActivitySignal]\n * \n */\n get structure(): A_Signal_TSignalsConstructors<TSignals> {\n return this._structure || this._signals.map(s => s.constructor as A_TYPES__Entity_Constructor<TSignals[number]>) as A_Signal_TSignalsConstructors<TSignals>;\n }\n\n\n get length(): number {\n return this.structure.length;\n }\n\n\n /**\n * Enables iteration over the signals in the vector.\n * \n * @returns \n */\n [Symbol.iterator](): Iterator<TSignals[number]> {\n let pointer = 0;\n const signals = this.structure.map((signalConstructor) => {\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n return signalIndex !== -1 ? this._signals[signalIndex] : undefined;\n }) as TSignals[number][];\n\n return {\n next(): IteratorResult<TSignals[number]> {\n if (pointer < signals.length) {\n return {\n done: false,\n value: signals[pointer++]\n };\n } else {\n return {\n done: true,\n value: undefined as any\n };\n }\n }\n };\n }\n\n\n /**\n * Allows to match the current Signal Vector with another Signal Vector by comparing each signal in the structure.\n * This method returns true if all signals in the vector match the corresponding signals in the other vector.\n * \n * @param other \n * @returns \n */\n match(other: A_SignalVector<TSignals>): boolean {\n if (this.length !== other.length) {\n return false;\n }\n\n for (let i = 0; i < this.length; i++) {\n const thisSignalConstructor = this.structure[i];\n const otherSignalConstructor = other.structure[i];\n\n if (thisSignalConstructor !== otherSignalConstructor) {\n return false;\n }\n\n const thisSignalIndex = this._signals.findIndex(s => s.constructor === thisSignalConstructor);\n const otherSignalIndex = other._signals.findIndex(s => s.constructor === otherSignalConstructor);\n\n const thisSignal = thisSignalIndex !== -1 ? this._signals[thisSignalIndex] : undefined;\n const otherSignal = otherSignalIndex !== -1 ? other._signals[otherSignalIndex] : undefined;\n\n if (thisSignal && otherSignal) {\n if (!thisSignal.compare(otherSignal)) {\n return false;\n }\n } else if (thisSignal || otherSignal) {\n return false;\n }\n }\n\n return true;\n }\n\n \n /**\n * This method should ensure that the current Signal Vector contains all signals from the provided Signal Vector.\n * \n * @param signal \n */\n contains(signal: A_SignalVector): boolean{\n for (const signalConstructor of signal.structure) {\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n if (signalIndex === -1) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Checks if the vector contains a signal of the specified type.\n * \n * @param signal \n */\n has(signal: A_Signal): boolean\n has(signalConstructor: A_TYPES__Entity_Constructor<A_Signal>): boolean\n has(param1: A_Signal | A_TYPES__Entity_Constructor<A_Signal>): boolean {\n let signalConstructor: A_TYPES__Entity_Constructor<A_Signal>;\n if (param1 instanceof A_Entity) {\n signalConstructor = param1.constructor as A_TYPES__Entity_Constructor<A_Signal>;\n } else {\n signalConstructor = param1;\n }\n return this.structure.includes(signalConstructor as any);\n }\n\n /**\n * Retrieves the signal of the specified type from the vector.\n * \n * @param signal \n */\n get<T extends A_Signal>(signal: T): T | undefined\n get<T extends A_Signal>(signalConstructor: A_TYPES__Entity_Constructor<T>): T | undefined\n get<T extends A_Signal>(param1: T | A_TYPES__Entity_Constructor<T>): T | undefined {\n let signalConstructor: A_TYPES__Entity_Constructor<A_Signal>;\n\n if (param1 instanceof A_Entity) {\n signalConstructor = param1.constructor as A_TYPES__Entity_Constructor<A_Signal>;\n } else {\n signalConstructor = param1 as A_TYPES__Entity_Constructor<A_Signal>;\n }\n\n const index = this._signals.findIndex(s => s.constructor === signalConstructor);\n if (index === -1) {\n return undefined;\n }\n return this._signals[index] as T;\n }\n\n\n /**\n * Converts to Array of values of signals in the vector\n * Maintains the order specified in the structure/generic type\n * \n * @param structure - Optional structure to override the default ordering\n * @returns Array of signal instances in the specified order\n */\n async toVector<\n T extends Array<A_Signal> = TSignals,\n >(\n structure?: A_Signal_TSignalsConstructors<T>\n ): Promise<T> {\n const usedStructure = structure || this.structure;\n\n return usedStructure.map((signalConstructor) => {\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n return signalIndex !== -1 ? this._signals[signalIndex] : undefined;\n }) as T;\n }\n\n\n /**\n * Converts to Array of data of signals in the vector\n * Maintains the order specified in the structure/generic type\n * \n * @param structure - Optional structure to override the default ordering\n * @returns Array of serialized signal data in the specified order\n */\n async toDataVector<\n T extends A_Signal[] = TSignals,\n >(\n structure?: A_Signal_TSignalsConstructors<T>\n ): Promise<A_SignalTValueArray<T>> {\n\n const usedStructure = structure || this.structure;\n\n const results: Array<any> = [];\n\n for (const signalConstructor of usedStructure) {\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n let data: any;\n if (signalIndex === -1) {\n\n data = await (signalConstructor as typeof A_Signal).default()\n\n } else {\n const signal = this._signals[signalIndex];\n data = signal;\n }\n\n\n results.push(data?.toJSON().data);\n }\n\n return results as A_SignalTValueArray<T>;\n }\n\n /**\n * Converts to Object with signal constructor names as keys and their corresponding data values\n * Uses the structure ordering to ensure consistent key ordering\n * \n * @returns Object with signal constructor names as keys and signal data as values\n */\n async toObject<\n T extends Array<A_Signal> = TSignals,\n >(\n structure?: { [K in keyof T]: T[K] extends A_Signal ? A_TYPES__Entity_Constructor<T[K]> : never }\n ): Promise<{ [key: string]: T[number] extends A_Signal<infer D> ? D | undefined : never }> {\n\n const usedStructure = structure || this.structure;\n\n const obj: { [key: string]: T[number] extends A_Signal<infer D> ? D | undefined : never } = {};\n usedStructure.forEach((signalConstructor) => {\n const signalName = signalConstructor.name;\n const signalIndex = this._signals.findIndex(s => s.constructor === signalConstructor);\n\n if (signalIndex !== -1) {\n const signal = this._signals[signalIndex];\n obj[signalName] = signal.toJSON().data as any;\n } else {\n obj[signalName] = undefined as any;\n }\n });\n\n return obj;\n }\n\n\n /**\n * Serializes the Signal Vector to a JSON-compatible format.\n * \n * \n * @returns \n */\n toJSON(): A_SignalVector_Serialized {\n return {\n ...super.toJSON(),\n structure: this.structure.map(s => s.name),\n values: this._signals.map(s => s.toJSON())\n };\n }\n}\n","import { A_Context, A_Fragment, A_TYPES__Component_Constructor } from \"@adaas/a-concept\";\nimport { A_Signal } from \"../entities/A-Signal.entity\";\nimport { A_SignalVector } from \"../entities/A-SignalVector.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n/**\n * A_SignalState manages the latest state of all signals within a given scope.\n * \n * This class maintains a mapping between signal constructors and their most recently emitted values,\n * providing a centralized state store for signal management within an application context.\n * \n * @template TSignalData - Union type of all possible signal data types that can be stored (must extend Record<string, any>)\n * \n * The generic ensures type safety by maintaining correspondence between:\n * - Signal constructor types and their data types\n * - Signal instances and their emitted value types\n * - Vector structure and the data it contains\n */\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-SignalState',\n description: 'Manages the latest state of all signals within a given scope, maintaining a mapping between signal constructors and their most recently emitted values.'\n})\nexport class A_SignalState<\n TSignalData extends Record<string, any> = Record<string, any>\n> extends A_Fragment {\n\n /**\n * Internal map storing the relationship between signal constructors and their latest values\n * Key: Signal constructor function\n * Value: Latest emitted data from that signal type\n */\n protected _state: Map<A_TYPES__Component_Constructor<A_Signal>, A_Signal> = new Map();\n\n /**\n * Previous state map to track changes between signal emissions\n * Key: Signal constructor function\n * Value: Previous emitted data from that signal type\n */\n protected _prevState: Map<A_TYPES__Component_Constructor<A_Signal>, A_Signal> = new Map();\n\n /**\n * Optional structure defining the ordered list of signal constructors\n * Used for vector operations and initialization\n */\n protected _structure: Array<A_TYPES__Component_Constructor<A_Signal>>;\n\n\n /**\n * Gets the ordered structure of signal constructors\n * @returns Array of signal constructors in their defined order\n */\n get structure(): Array<A_TYPES__Component_Constructor<A_Signal>> {\n return this._structure || [];\n }\n\n /**\n * Creates a new A_SignalState instance\n * \n * @param structure - Optional array defining the ordered structure of signal constructors\n * This structure is used for vector operations and determines the order\n * in which signals are processed and serialized\n */\n constructor(\n structure: A_TYPES__Component_Constructor<A_Signal>[]\n ) {\n super({ name: \"A_SignalState\" });\n\n this._structure = structure;\n\n // Initialize the state map with undefined values for each signal in the structure\n // This ensures all expected signals have entries in the state map from the start\n \n }\n\n\n /**\n * Sets the latest value for a specific signal type\n * \n * @param signal - The signal constructor to associate the value with\n * @param value - The data value emitted by the signal\n */\n set(\n signal: A_Signal,\n value: A_Signal\n ): void\n set(\n signal: A_Signal\n ): void\n set(\n signal: A_TYPES__Component_Constructor<A_Signal>,\n value: A_Signal\n ): void\n set(\n param1: A_TYPES__Component_Constructor<A_Signal> | A_Signal,\n param2?: A_Signal\n ): void {\n const signal = param1 instanceof A_Signal ? param1.constructor as A_TYPES__Component_Constructor<A_Signal> : param1;\n const value = param1 instanceof A_Signal ? param1 : param2!;\n\n this._prevState.set(signal, this._state.get(signal)!);\n this._state.set(signal, value);\n }\n\n /**\n * Retrieves the latest value for a specific signal type\n * \n * @param signal - The signal constructor to get the value for\n * @returns The latest data value or undefined if no value has been set\n */\n get(\n signal: A_Signal\n ): A_Signal | undefined\n get(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): A_Signal | undefined\n get(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): A_Signal | undefined {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n return this._state.get(signal);\n }\n\n /**\n * Retrieves the previous value for a specific signal type\n * \n * @param signal \n */\n getPrev(\n signal: A_Signal\n ): A_Signal | undefined\n getPrev(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): A_Signal | undefined\n getPrev(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): A_Signal | undefined {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n return this._prevState.get(signal);\n } \n\n /**\n * Checks if a signal type has been registered in the state\n * \n * @param signal - The signal constructor to check for\n * @returns True if the signal type exists in the state map\n */\n has(\n signal: A_Signal\n ): boolean\n has(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): boolean\n has(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): boolean {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n\n return this.structure.includes(signal);\n }\n\n /**\n * Removes a signal type and its associated value from the state\n * \n * @param signal - The signal constructor to remove\n * @returns True if the signal was successfully deleted, false if it didn't exist\n */\n delete(\n signal: A_Signal\n ): boolean\n delete(\n signal: A_TYPES__Component_Constructor<A_Signal>\n ): boolean\n delete(\n param: A_TYPES__Component_Constructor<A_Signal> | A_Signal\n ): boolean {\n const signal = param instanceof A_Signal ? param.constructor as A_TYPES__Component_Constructor<A_Signal> : param;\n return this._state.delete(signal);\n }\n\n\n /**\n * Converts the current state to a vector (ordered array) format\n * \n * The order is determined by the structure array provided during construction.\n * Each position in the vector corresponds to a specific signal type's latest value.\n * \n * @returns Array of signal values in the order defined by the structure\n * @throws Error if structure is not defined or if any signal value is undefined\n */\n toVector(): A_SignalVector {\n const vector: Array<A_Signal> = [];\n\n this._state.forEach((value, key) => {\n vector.push(value);\n });\n\n return new A_SignalVector(vector, this.structure);\n }\n\n /**\n * Converts the current state to an object with signal constructor names as keys\n * \n * This provides a more readable representation of the state where each signal\n * type is identified by its constructor name.\n * \n * @returns Object mapping signal constructor names to their latest values\n * @throws Error if any signal value is undefined\n */\n toObject(): Record<string, A_Signal> {\n const obj: Record<string, A_Signal> = {};\n\n this.structure.forEach((signalConstructor) => {\n const value = this._state.get(signalConstructor);\n if (value === undefined) {\n throw new Error(`Signal ${signalConstructor.name} has no value in state`);\n }\n obj[signalConstructor.name] = value;\n });\n\n return obj;\n }\n\n}","import { A_CommonHelper, A_Context, A_Fragment, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor } from \"@adaas/a-concept\";\nimport { A_SignalConfig_Init } from \"../A-Signal.types\";\nimport { A_Signal } from \"../entities/A-Signal.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n/**\n * This component should dictate a structure of the vector for all signals within a given scope.\n * so if there're multiple signals it should say what type at what position should be expected.\n * \n * e.g. [A_RouterWatcher, A_ScopeWatcher, A_LoggerWatcher]\n * This structure then should be used for any further processing of signals within the scope.\n */\n@A_Frame.Fragment({\n namespace: 'A-Utils',\n name: 'A-SignalConfig',\n description: 'Signal configuration fragment that defines the structure and types of signals within a given scope. It allows specifying the expected signal constructors and their order, facilitating consistent signal management and processing across components that emit or listen to signals.'\n})\nexport class A_SignalConfig extends A_Fragment {\n\n protected _structure?: Array<A_TYPES__Entity_Constructor<A_Signal>>;\n\n protected _config: A_SignalConfig_Init\n\n protected _ready?: Promise<void>;\n\n get structure(): Array<A_TYPES__Entity_Constructor<A_Signal>> {\n if (this._structure) {\n return this._structure;\n }\n\n const scope = A_Context.scope(this);\n\n // just sort by constructor name to have consistent order\n const constructors = [...scope.allowedEntities]\n .filter(e => A_CommonHelper.isInheritedFrom(e, A_Signal))\n .sort((a, b) => a.constructor.name.localeCompare(b.name))\n .map(s => scope.resolveConstructor<A_Signal>(s.name));\n\n return constructors.filter(s => s) as Array<A_TYPES__Entity_Constructor<A_Signal>>;\n }\n\n /**\n * Uses for synchronization to ensure the config is initialized.\n * \n * @returns True if the configuration has been initialized.\n */\n get ready() {\n return this._ready;\n }\n\n constructor(\n params: A_SignalConfig_Init\n ) {\n super({ name: \"A_SignalConfig\" });\n this._config = params;\n }\n\n\n /**\n * Initializes the signal configuration if not already initialized.\n * \n * @returns \n */\n async initialize() {\n if (!this._ready) {\n this._ready = this._initialize();\n }\n return this._ready;\n }\n\n /**\n * Initializes the signal configuration by processing the provided structure or string representation.\n * This method sets up the internal structure of signal constructors based on the configuration.\n */\n protected async _initialize() {\n if (this._config.structure) {\n this._structure = this._config.structure;\n } else if (this._config.stringStructure) {\n const stringStructure = this._config.stringStructure.split(',').map(s => s.trim());\n this._structure = stringStructure\n .map(name => A_Context.scope(this).resolveConstructor<A_Signal>(name))\n .filter(s => s);\n }\n\n }\n\n}","\nexport enum A_SignalBusFeatures {\n onBeforeNext = '_A_SignalBusFeatures_onBeforeNext',\n onNext = '_A_SignalBusFeatures_onNext',\n\n onError = '_A_SignalBusFeatures_onError',\n}","import { A_Error } from \"@adaas/a-concept\";\n\n\n\nexport class A_SignalBusError extends A_Error {\n\n\n static readonly SignalProcessingError = 'Signal processing error';\n}","import { A_Caller, A_Component, A_Context, A_Dependency, A_Error, A_Feature, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_SignalState } from \"../context/A-SignalState.context\";\nimport { A_SignalConfig } from \"../context/A-SignalConfig.context\";\nimport { A_Config } from \"../../A-Config/A-Config.context\";\nimport { A_Logger } from \"../../A-Logger/A-Logger.component\";\nimport { A_Signal } from \"../entities/A-Signal.entity\";\nimport { A_Frame } from \"@adaas/a-frame\";\nimport { A_SignalBusFeatures } from \"./A-SignalBus.constants\";\nimport { A_SignalBusError } from \"./A-SignalBus.error\";\n\n\n\n/**\n * This component should listen for all available signal watchers components in this and all parent scopes. \n * When a signal is emitted, it should forward the signal to all registered watchers.\n * \n * A_SignalBus should always return the same vector structure of the signals, and that's why it should store the state of the latest behavior. \n * For example if there are 3 watchers registered, the bus should always return a vector of 3 elements, based on the A_SignalConfig structure.\n * \n * \n * The component itself is stateless and all methods uses only parameters (context) is provided with.\n */\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-SignalBus',\n description: 'Signal bus component that manages the emission and state of signals within a given scope. It listens for emitted signals, updates their state, and forwards them to registered watchers. The bus ensures a consistent signal vector structure based on the defined configuration, facilitating signal management across multiple components.'\n})\nexport class A_SignalBus extends A_Component {\n\n\n @A_Frame.Method({\n description: 'Emit multiple signals through the signal bus.'\n })\n async next(...signals: A_Signal[]) {\n const scope = new A_Scope({\n name: `A_SignalBus-Next-Scope`,\n entities: signals\n })\n .inherit(A_Context.scope(this));\n\n try {\n await this.call(A_SignalBusFeatures.onBeforeNext, scope);\n\n await this.call(A_SignalBusFeatures.onNext, scope);\n\n scope.destroy();\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_SignalBusError:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_SignalBusError:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_SignalBusError({\n title: A_SignalBusError.SignalProcessingError,\n description: `An error occurred while processing the signal.`,\n originalError: error\n })\n break;\n }\n\n scope.register(wrappedError);\n\n await this.call(A_SignalBusFeatures.onError);\n\n scope.destroy();\n }\n }\n\n\n @A_Feature.Extend({\n before: /.*/\n })\n protected async [A_SignalBusFeatures.onError](\n @A_Inject(A_Error) error: A_Error,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n logger?.error(error);\n }\n\n @A_Feature.Extend({\n scope: [A_SignalBus],\n before: /.*/\n })\n async [A_SignalBusFeatures.onBeforeNext](\n @A_Inject(A_Scope) scope: A_Scope,\n\n @A_Inject(A_Config) globalConfig?: A_Config<['A_SIGNAL_VECTOR_STRUCTURE']>,\n @A_Inject(A_SignalState) state?: A_SignalState,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n @A_Inject(A_SignalConfig) config?: A_SignalConfig,\n ) {\n /**\n * We need a context where component is registered, to prevent any duplicate registrations\n */\n const componentContext = A_Context.scope(this);\n\n if (!config) {\n config = new A_SignalConfig({\n stringStructure: globalConfig?.get('A_SIGNAL_VECTOR_STRUCTURE') || undefined\n });\n\n componentContext.register(config);\n }\n\n if (!config.ready)\n await config.initialize();\n\n if (!state) {\n state = new A_SignalState(config.structure);\n componentContext.register(state);\n }\n }\n\n /**\n * This methods extends A-Signal Emit feature to handle signal emission within the bus.\n * \n * It updates the signal state and emits the updated signal vector.\n * \n * @param signal \n * @param globalConfig \n * @param logger \n * @param state \n * @param config \n * @returns \n */\n @A_Feature.Extend({\n scope: [A_SignalBus],\n before: /.*/\n })\n async [A_SignalBusFeatures.onNext](\n @A_Dependency.Flat()\n @A_Dependency.All()\n @A_Inject(A_Signal) signals: A_Signal[],\n @A_Inject(A_Scope) scope: A_Scope,\n\n @A_Dependency.Required()\n @A_Inject(A_SignalState) state: A_SignalState,\n\n @A_Inject(A_Config) globalConfig?: A_Config<['A_SIGNAL_VECTOR_STRUCTURE']>,\n @A_Inject(A_Logger) logger?: A_Logger,\n @A_Inject(A_SignalConfig) config?: A_SignalConfig,\n ) {\n /*\n 1) create a signal when it occurs via new A_Signal('somedata')\n 2) emit a signal when needed via bus.next(signal)\n 3) the bus should listen for all emitted signals within the scope\n 4) when a signal is emitted, the bus should store a signal in some place (probably it's memory)\n */\n // const signals = scope.resolveFlatAll<A_Signal>(A_Signal);\n\n for (const signal of signals) {\n\n if (!state.has(signal))\n return;\n\n // ------------------------------------------------------------------\n // And finally if all checks are passed, we can update the state\n // ------------------------------------------------------------------\n\n logger?.debug(`A_SignalBus: Updating state for signal '${signal.constructor.name}' with data:`, signal.data);\n\n state.set(signal);\n }\n\n const vector = state.toVector();\n\n scope.register(vector);\n }\n}\n","export class A_Deferred<T> {\n public promise: Promise<T>;\n private resolveFn!: (value: T | PromiseLike<T>) => void;\n private rejectFn!: (reason?: any) => void;\n\n /**\n * Creates a deferred promise\n * @returns A promise that can be resolved or rejected later\n */\n constructor() {\n this.promise = new Promise<T>((resolve, reject) => {\n this.resolveFn = resolve;\n this.rejectFn = reject;\n });\n }\n\n resolve(value: T | PromiseLike<T>): void {\n this.resolveFn(value);\n }\n\n reject(reason?: any): void {\n this.rejectFn(reason);\n }\n}","import { A_Deferred } from \"./A-Deferred.class\";\nimport { A_Error } from \"@adaas/a-concept\";\nimport { A_UTILS_TYPES__ScheduleObjectCallback, A_UTILS_TYPES__ScheduleObjectConfig } from \"./A-Schedule.types\";\n\nexport class A_ScheduleObject<T extends any = any> {\n\n private timeout!: NodeJS.Timeout;\n private deferred!: A_Deferred<T>;\n\n private config: A_UTILS_TYPES__ScheduleObjectConfig = {\n /**\n * If the timeout is cleared, should the promise resolve or reject?\n * BY Default it rejects\n * \n * !!!NOTE: If the property is set to true, the promise will resolve with undefined\n */\n resolveOnClear: false\n };\n\n\n /**\n * Creates a scheduled object that will execute the action after specified milliseconds\n * \n * \n * @param ms - milliseconds to wait before executing the action\n * @param action - the action to execute\n * @param config - configuration options for the schedule object\n */\n constructor(\n /**\n * Milliseconds to wait before executing the action\n */\n ms: number,\n /**\n * The action to execute after the specified milliseconds\n */\n action: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ) {\n if (config)\n this.config = { ...this.config, ...config };\n\n this.deferred = new A_Deferred<T>();\n\n this.timeout = setTimeout(\n () => action()\n .then((...args) => this.deferred.resolve(...args))\n .catch((...args) => this.deferred.reject(...args)),\n ms\n );\n }\n\n get promise(): Promise<T> {\n return this.deferred.promise;\n }\n\n clear(): void {\n if (this.timeout) {\n clearTimeout(this.timeout);\n\n if (this.config.resolveOnClear)\n this.deferred.resolve(undefined as T);\n else\n this.deferred.reject(new A_Error(\"Timeout Cleared\"));\n }\n }\n}\n\n","import { A_Component, A_Fragment, A_TypeGuards } from \"@adaas/a-concept\";\nimport { A_ScheduleObject } from \"./A-ScheduleObject.class\";\nimport { A_UTILS_TYPES__ScheduleObjectCallback, A_UTILS_TYPES__ScheduleObjectConfig } from \"./A-Schedule.types\";\nimport { A_Frame } from \"@adaas/a-frame\";\n\n\n\n\n@A_Frame.Component({\n namespace: 'A-Utils',\n name: 'A-Schedule',\n description: 'Scheduling component that allows scheduling of callbacks to be executed at specific times or after certain delays. It provides methods to schedule callbacks based on Unix timestamps or ISO date strings, as well as a method to execute callbacks after a specified delay in milliseconds. This component is useful for managing timed operations within an application.'\n})\nexport class A_Schedule extends A_Component {\n\n /**\n * Allows to schedule a callback for particular time in the future\n * \n * @param timestamp - Unix timestamp in milliseconds\n * @param callback - The callback to execute\n * @returns A promise that resolves to the schedule object\n */\n async schedule<T extends any = any>(\n /**\n * Unix timestamp in milliseconds\n */\n timestamp: number,\n /**\n * The callback to execute\n */\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>>\n async schedule<T extends any = any>(\n /**\n * ISO date string representing the date and time to schedule the callback for\n */\n date: string,\n /**\n * The callback to execute\n */\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>>\n async schedule<T extends any = any>(\n date: string | number,\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>> {\n\n const timestamp = A_TypeGuards.isString(date)\n ? (new Date(date)).getTime()\n : date;\n\n return new A_ScheduleObject<T>(\n timestamp - Date.now(),\n callback,\n config\n );\n }\n\n\n\n /**\n * Allows to execute callback after particular delay in milliseconds\n * So the callback will be executed after the specified delay\n * \n * @param ms \n */\n async delay<T extends any = any>(\n /**\n * Delay in milliseconds\n */\n ms: number,\n /**\n * The callback to execute after the delay\n */\n callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,\n /**\n * Configuration options for the schedule object\n */\n config?: A_UTILS_TYPES__ScheduleObjectConfig\n ): Promise<A_ScheduleObject<T>> {\n return new A_ScheduleObject<T>(\n ms,\n callback,\n config\n );\n }\n}"]}
|