@adaas/a-utils 0.1.20 → 0.1.22

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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A_Error, A_TYPES__Error_Serialized, A_Fragment, A_Component, A_TYPES__Entity_Serialized, A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor, A_Scope, A_Entity, A_Container, A_Feature, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor, A_TYPES__Container_Constructor, A_TYPES__Fragment_Serialized } from '@adaas/a-concept';
1
+ import { A_Error, A_TYPES__Error_Serialized, A_Fragment, A_Meta, A_TYPES__Fragment_Serialized, A_Component, A_TYPES__Entity_Serialized, A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_Scope, A_Entity, A_Container, A_Feature, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor, A_TYPES__Container_Constructor } from '@adaas/a-concept';
2
2
 
3
3
  type A_Operation_Storage<_Result_type extends any = any, _ParamsType extends Record<string, any> = Record<string, any>> = {
4
4
  /**
@@ -37,7 +37,21 @@ type A_Operation_Serialized<_Result_type extends any = any, _ParamsType extends
37
37
  error?: A_TYPES__Error_Serialized;
38
38
  };
39
39
 
40
- declare class A_OperationContext<_AllowedOperations extends string = string, _ParamsType extends Record<string, any> = Record<string, any>, _ResultType = any, _StorageType extends A_Operation_Storage<_ResultType, _ParamsType> = A_Operation_Storage<_ResultType, _ParamsType>> extends A_Fragment<_StorageType, A_Operation_Serialized<_ResultType, _ParamsType>> {
40
+ declare class A_ExecutionContext<_MetaType extends Record<string, any> = Record<string, any>, _SerializedType extends Record<string, any> = Record<string, any>> extends A_Fragment {
41
+ protected _meta: A_Meta<_MetaType, _SerializedType>;
42
+ constructor(name: string, defaults?: Partial<_MetaType>);
43
+ [Symbol.iterator](): Iterator<[keyof _MetaType, _MetaType[keyof _MetaType]]>;
44
+ get meta(): A_Meta<_MetaType>;
45
+ get(key: keyof _MetaType): _MetaType[keyof _MetaType] | undefined;
46
+ set(key: keyof _MetaType, value: _MetaType[keyof _MetaType]): void;
47
+ has(key: keyof _MetaType): boolean;
48
+ drop(key: keyof _MetaType): void;
49
+ clear(): void;
50
+ toRaw(): _SerializedType;
51
+ toJSON(): A_TYPES__Fragment_Serialized;
52
+ }
53
+
54
+ declare class A_OperationContext<_AllowedOperations extends string = string, _ParamsType extends Record<string, any> = Record<string, any>, _ResultType = any, _StorageType extends A_Operation_Storage<_ResultType, _ParamsType> = A_Operation_Storage<_ResultType, _ParamsType>> extends A_ExecutionContext<_StorageType, A_Operation_Serialized<_ResultType, _ParamsType>> {
41
55
  constructor(operation: _AllowedOperations, params?: _ParamsType);
42
56
  get name(): _AllowedOperations;
43
57
  get result(): _ResultType | undefined;
@@ -706,6 +720,10 @@ type A_TYPES__Command_Serialized<ParamsType extends Record<string, any> = Record
706
720
  * ```
707
721
  */
708
722
  type A_TYPES__Command_Listener<InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init, ResultType extends Record<string, any> = Record<string, any>, LifecycleEvents extends string = A_Command_Event> = (command?: A_Command<InvokeType, ResultType, LifecycleEvents>) => void;
723
+ type A_Command_ExecutionContext<InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init, ResultType extends Record<string, any> = Record<string, any>> = {
724
+ result: ResultType;
725
+ params: InvokeType;
726
+ };
709
727
 
710
728
  declare enum A_StateMachineFeatures {
711
729
  /**
@@ -921,20 +939,28 @@ type A_TYPES__ConfigContainerConstructor<T extends Array<string | A_TYPES__Conce
921
939
  };
922
940
  } & A_TYPES__Fragment_Constructor;
923
941
 
924
- declare class A_Config<T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]> extends A_Fragment<{
942
+ declare const A_CONSTANTS__CONFIG_ENV_VARIABLES: {};
943
+ type A_TYPES__ConfigENVVariables = (typeof A_CONSTANTS__CONFIG_ENV_VARIABLES)[keyof typeof A_CONSTANTS__CONFIG_ENV_VARIABLES][];
944
+ declare const A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY: readonly [];
945
+
946
+ declare class A_Config<T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]> extends A_ExecutionContext<{
925
947
  [key in T[number]]: any;
948
+ } & {
949
+ [key in typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY[number]]: any;
950
+ } & {
951
+ [key in typeof A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY[number]]: any;
926
952
  }> {
927
- config: A_TYPES__ConfigContainerConstructor<T>;
928
- private VARIABLES;
929
- CONFIG_PROPERTIES: T;
953
+ protected _strict: boolean;
954
+ protected _configProperties: T;
930
955
  protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: ("A_CONCEPT_NAME" | "A_CONCEPT_ROOT_SCOPE" | "A_CONCEPT_ENVIRONMENT" | "A_CONCEPT_ROOT_FOLDER" | "A_ERROR_DEFAULT_DESCRIPTION")[];
931
956
  constructor(config: Partial<A_TYPES__ConfigContainerConstructor<T>>);
957
+ get strict(): boolean;
932
958
  /**
933
- * This method is used to get the configuration property by name
934
- *
935
- * @param property
936
- * @returns
937
- */
959
+ * This method is used to get the configuration property by name
960
+ *
961
+ * @param property
962
+ * @returns
963
+ */
938
964
  get<K extends T[number]>(property: K | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]): {
939
965
  [key in T[number]]: any;
940
966
  }[K] | undefined;
@@ -979,6 +1005,7 @@ declare const A_LoggerEnvVariables: {
979
1005
  */
980
1006
  readonly A_LOGGER_DEFAULT_LOG_COLOR: "A_LOGGER_DEFAULT_LOG_COLOR";
981
1007
  };
1008
+ declare const A_LoggerEnvVariablesArray: readonly ["A_LOGGER_LEVEL", "A_LOGGER_DEFAULT_SCOPE_LENGTH", "A_LOGGER_DEFAULT_SCOPE_COLOR", "A_LOGGER_DEFAULT_LOG_COLOR"];
982
1009
  type A_LoggerEnvVariablesType = (typeof A_LoggerEnvVariables)[keyof typeof A_LoggerEnvVariables][];
983
1010
 
984
1011
  /**
@@ -1401,6 +1428,10 @@ declare class A_Command<InvokeType extends A_TYPES__Command_Init = A_TYPES__Comm
1401
1428
  * command was registered.
1402
1429
  */
1403
1430
  get scope(): A_Scope;
1431
+ /**
1432
+ * Execution context associated with the command
1433
+ */
1434
+ get context(): A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>;
1404
1435
  /**
1405
1436
  * Unique command type identifier
1406
1437
  *
@@ -1503,7 +1534,7 @@ declare class A_Command<InvokeType extends A_TYPES__Command_Init = A_TYPES__Comm
1503
1534
  protected [A_CommandFeatures.onExecute](...args: any[]): Promise<void>;
1504
1535
  protected [A_CommandFeatures.onAfterExecute](...args: any[]): Promise<void>;
1505
1536
  protected [A_CommandFeatures.onComplete](stateMachine: A_StateMachine, ...args: any[]): Promise<void>;
1506
- protected [A_CommandFeatures.onFail](stateMachine: A_StateMachine, operation: A_OperationContext, ...args: any[]): Promise<void>;
1537
+ protected [A_CommandFeatures.onFail](stateMachine: A_StateMachine, operation: A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>, ...args: any[]): Promise<void>;
1507
1538
  /**
1508
1539
  * Initializes the command before execution.
1509
1540
  */
@@ -1514,6 +1545,16 @@ declare class A_Command<InvokeType extends A_TYPES__Command_Init = A_TYPES__Comm
1514
1545
  execute(): Promise<any>;
1515
1546
  /**
1516
1547
  * Marks the command as completed
1548
+ *
1549
+ *
1550
+ * Calling This method will set the command status to COMPLETED, record the end time,
1551
+ * store the result, emit the onComplete event, and destroy the execution scope.
1552
+ *
1553
+ * [!] After Calling this method, the command is considered fully processed And further processing will be INTERRUPTED.
1554
+ * [!] If the command is already processed (COMPLETED or FAILED), this method does nothing.
1555
+ * [!] This method can be called with optional result data to store with the command.
1556
+ *
1557
+ * @param result - Optional result data to store with the command
1517
1558
  */
1518
1559
  complete(result?: ResultType): Promise<void>;
1519
1560
  /**
@@ -1830,8 +1871,9 @@ declare class A_ConfigError extends A_Error {
1830
1871
  */
1831
1872
  declare class ConfigReader extends A_Component {
1832
1873
  protected polyfill: A_Polyfill;
1874
+ protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: ("A_CONCEPT_NAME" | "A_CONCEPT_ROOT_SCOPE" | "A_CONCEPT_ENVIRONMENT" | "A_CONCEPT_ROOT_FOLDER" | "A_ERROR_DEFAULT_DESCRIPTION")[];
1833
1875
  constructor(polyfill: A_Polyfill);
1834
- attachContext(container: A_Container, feature: A_Feature, config?: A_Config<any>): Promise<void>;
1876
+ attachContext(container: A_Container, context: A_Scope, config?: A_Config<any>): Promise<void>;
1835
1877
  initialize(config: A_Config): Promise<void>;
1836
1878
  /**
1837
1879
  * Get the configuration property by Name
@@ -1875,9 +1917,97 @@ declare class FileConfigReader extends ConfigReader {
1875
1917
  read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
1876
1918
  }
1877
1919
 
1878
- declare const A_CONSTANTS__CONFIG_ENV_VARIABLES: {};
1879
- type A_TYPES__ConfigENVVariables = (typeof A_CONSTANTS__CONFIG_ENV_VARIABLES)[keyof typeof A_CONSTANTS__CONFIG_ENV_VARIABLES][];
1880
- declare const A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY: readonly [];
1920
+ type A_LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'all';
1921
+
1922
+ /**
1923
+ * A-Logger Constants
1924
+ *
1925
+ * Configuration constants and default values for the A_Logger component
1926
+ */
1927
+ /**
1928
+ * Default scope length for consistent message alignment
1929
+ */
1930
+ declare const A_LOGGER_DEFAULT_SCOPE_LENGTH = 20;
1931
+ /**
1932
+ * Default log level when none is specified
1933
+ */
1934
+ declare const A_LOGGER_DEFAULT_LEVEL = "all";
1935
+ /**
1936
+ * Terminal color codes mapping
1937
+ */
1938
+ declare const A_LOGGER_COLORS: {
1939
+ readonly red: "31";
1940
+ readonly yellow: "33";
1941
+ readonly green: "32";
1942
+ readonly blue: "34";
1943
+ readonly cyan: "36";
1944
+ readonly magenta: "35";
1945
+ readonly gray: "90";
1946
+ readonly brightBlue: "94";
1947
+ readonly brightCyan: "96";
1948
+ readonly brightMagenta: "95";
1949
+ readonly darkGray: "30";
1950
+ readonly lightGray: "37";
1951
+ readonly indigo: "38;5;54";
1952
+ readonly violet: "38;5;93";
1953
+ readonly purple: "38;5;129";
1954
+ readonly lavender: "38;5;183";
1955
+ readonly skyBlue: "38;5;117";
1956
+ readonly steelBlue: "38;5;67";
1957
+ readonly slateBlue: "38;5;62";
1958
+ readonly deepBlue: "38;5;18";
1959
+ readonly lightBlue: "38;5;153";
1960
+ readonly periwinkle: "38;5;111";
1961
+ readonly cornflower: "38;5;69";
1962
+ readonly powder: "38;5;152";
1963
+ readonly charcoal: "38;5;236";
1964
+ readonly silver: "38;5;250";
1965
+ readonly smoke: "38;5;244";
1966
+ readonly slate: "38;5;240";
1967
+ };
1968
+ /**
1969
+ * Safe colors for random selection - grey-blue-violet palette
1970
+ * Excludes system colors (red, yellow, green) to avoid confusion with warnings/errors
1971
+ */
1972
+ declare const A_LOGGER_SAFE_RANDOM_COLORS: readonly ["blue", "cyan", "magenta", "gray", "brightBlue", "brightCyan", "brightMagenta", "darkGray", "lightGray", "indigo", "violet", "purple", "lavender", "skyBlue", "steelBlue", "slateBlue", "deepBlue", "lightBlue", "periwinkle", "cornflower", "powder", "charcoal", "silver", "smoke", "slate"];
1973
+ /**
1974
+ * ANSI escape codes
1975
+ */
1976
+ declare const A_LOGGER_ANSI: {
1977
+ readonly RESET: "\u001B[0m";
1978
+ readonly PREFIX: "\u001B[";
1979
+ readonly SUFFIX: "m";
1980
+ };
1981
+ /**
1982
+ * Timestamp format configuration
1983
+ */
1984
+ declare const A_LOGGER_TIME_FORMAT: {
1985
+ readonly MINUTES_PAD: 2;
1986
+ readonly SECONDS_PAD: 2;
1987
+ readonly MILLISECONDS_PAD: 3;
1988
+ readonly SEPARATOR: ":";
1989
+ };
1990
+ /**
1991
+ * Log message structure constants
1992
+ */
1993
+ declare const A_LOGGER_FORMAT: {
1994
+ readonly SCOPE_OPEN: "[";
1995
+ readonly SCOPE_CLOSE: "]";
1996
+ readonly TIME_OPEN: "|";
1997
+ readonly TIME_CLOSE: "|";
1998
+ readonly SEPARATOR: "-------------------------------";
1999
+ readonly INDENT_BASE: 3;
2000
+ readonly PIPE: "| ";
2001
+ };
2002
+ /**
2003
+ * Environment variable keys
2004
+ */
2005
+ declare const A_LOGGER_ENV_KEYS: {
2006
+ readonly LOG_LEVEL: "A_LOGGER_LEVEL";
2007
+ readonly DEFAULT_SCOPE_LENGTH: "A_LOGGER_DEFAULT_SCOPE_LENGTH";
2008
+ readonly DEFAULT_SCOPE_COLOR: "A_LOGGER_DEFAULT_SCOPE_COLOR";
2009
+ readonly DEFAULT_LOG_COLOR: "A_LOGGER_DEFAULT_LOG_COLOR";
2010
+ };
1881
2011
 
1882
2012
  type A_UTILS_TYPES__Manifest_Init = Array<A_UTILS_TYPES__Manifest_ComponentLevelConfig>;
1883
2013
  type A_UTILS_TYPES__Manifest_ComponentLevelConfig<T extends A_Component = A_Component> = {
@@ -2030,18 +2160,32 @@ declare enum A_MemoryFeatures {
2030
2160
  onHas = "onHas"
2031
2161
  }
2032
2162
 
2033
- declare class A_MemoryContext<_MemoryType extends Record<string, any> = Record<string, any>, _SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> extends A_Fragment<_MemoryType, _MemoryType & _SerializedType> {
2034
- set<K extends keyof _MemoryType>(param: 'error', value: A_Error): void;
2163
+ declare class A_MemoryContext<_MemoryType extends Record<string, any> = Record<string, any>, _SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> extends A_Fragment {
2164
+ protected _storage: Map<keyof _MemoryType, _MemoryType[keyof _MemoryType]>;
2035
2165
  set<K extends keyof _MemoryType>(param: K, value: _MemoryType[K]): void;
2036
- get<K extends keyof A_Error>(param: 'error'): A_Error | undefined;
2037
2166
  get<K extends keyof _MemoryType>(param: K): _MemoryType[K] | undefined;
2167
+ delete<K extends keyof _MemoryType>(param: K): void;
2168
+ has<K extends keyof _MemoryType>(param: K): boolean;
2169
+ clear(): void;
2038
2170
  }
2039
2171
 
2172
+ type A_MemoryContextMeta<T extends Record<string, any> = Record<string, any>> = Omit<T, 'error'> & {
2173
+ error?: A_Error;
2174
+ };
2175
+ type A_Memory_Storage = Record<string, any> & {
2176
+ error?: A_Error;
2177
+ };
2040
2178
  type A_MemoryOperations = 'get' | 'set' | 'drop' | 'clear' | 'has' | 'serialize';
2041
2179
  type A_MemoryOperationContext<T extends any = any> = A_OperationContext<A_MemoryOperations, {
2042
2180
  key: string;
2043
2181
  value?: any;
2044
2182
  }, T>;
2183
+ type A_MemoryOperationContextMeta<T extends any = any, I extends any = any> = {
2184
+ result: T;
2185
+ operation: A_MemoryOperations;
2186
+ key: string;
2187
+ value?: I;
2188
+ };
2045
2189
 
2046
2190
  declare class A_Memory<_StorageType extends Record<string, any> = Record<string, any>, _SerializedType extends Record<string, any> = Record<string, any>> extends A_Component {
2047
2191
  protected _ready?: Promise<void>;
@@ -2117,6 +2261,17 @@ declare class A_Memory<_StorageType extends Record<string, any> = Record<string,
2117
2261
  toJSON(): Promise<_SerializedType>;
2118
2262
  }
2119
2263
 
2264
+ declare class A_MemoryError extends A_Error {
2265
+ static readonly MemoryInitializationError = "Memory initialization error";
2266
+ static readonly MemoryDestructionError = "Memory destruction error";
2267
+ static readonly MemoryGetError = "Memory GET operation failed";
2268
+ static readonly MemorySetError = "Memory SET operation failed";
2269
+ static readonly MemoryDropError = "Memory DROP operation failed";
2270
+ static readonly MemoryClearError = "Memory CLEAR operation failed";
2271
+ static readonly MemoryHasError = "Memory HAS operation failed";
2272
+ static readonly MemorySerializeError = "Memory toJSON operation failed";
2273
+ }
2274
+
2120
2275
  type A_UTILS_TYPES__ScheduleObjectConfig = {
2121
2276
  /**
2122
2277
  * If the timeout is cleared, should the promise resolve or reject?
@@ -2225,4 +2380,9 @@ declare class A_Deferred<T> {
2225
2380
  reject(reason?: any): void;
2226
2381
  }
2227
2382
 
2228
- export { A_CONSTANTS__CONFIG_ENV_VARIABLES, A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY, A_Channel, A_ChannelError, A_ChannelFeatures, A_ChannelRequestStatuses, A_Command, A_CommandError, A_CommandFeatures, A_CommandTransitions, type A_Command_Event, A_Command_Status, A_Config, A_ConfigError, A_ConfigLoader, A_Deferred, A_Logger, A_Manifest, A_ManifestChecker, A_ManifestError, A_Memory, A_Polyfill, A_Schedule, A_ScheduleObject, type A_TYPES__Command_Constructor, type A_TYPES__Command_Init, type A_TYPES__Command_Listener, type A_TYPES__Command_Serialized, type A_TYPES__ConfigContainerConstructor, type A_TYPES__ConfigENVVariables, A_TYPES__ConfigFeature, type A_UTILS_TYPES__ManifestQuery, type A_UTILS_TYPES__ManifestRule, type A_UTILS_TYPES__Manifest_AllowedComponents, type A_UTILS_TYPES__Manifest_ComponentLevelConfig, type A_UTILS_TYPES__Manifest_Init, type A_UTILS_TYPES__Manifest_MethodLevelConfig, type A_UTILS_TYPES__Manifest_Rules, type A_UTILS_TYPES__ScheduleObjectCallback, type A_UTILS_TYPES__ScheduleObjectConfig, ConfigReader, ENVConfigReader, FileConfigReader, type IbufferInterface, type IcryptoInterface, type Ifspolyfill, type IhttpInterface, type IhttpsInterface, type IpathInterface, type IprocessInterface, type IurlInterface };
2383
+ declare class A_StateMachineError extends A_Error {
2384
+ static readonly InitializationError = "A-StateMachine Initialization Error";
2385
+ static readonly TransitionError = "A-StateMachine Transition Error";
2386
+ }
2387
+
2388
+ export { A_CONSTANTS__CONFIG_ENV_VARIABLES, A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY, A_Channel, A_ChannelError, A_ChannelFeatures, A_ChannelRequest, A_ChannelRequestStatuses, A_Command, A_CommandError, A_CommandFeatures, A_CommandTransitions, type A_Command_Event, type A_Command_ExecutionContext, A_Command_Status, A_Config, A_ConfigError, A_ConfigLoader, A_Deferred, A_ExecutionContext, A_LOGGER_ANSI, A_LOGGER_COLORS, A_LOGGER_DEFAULT_LEVEL, A_LOGGER_DEFAULT_SCOPE_LENGTH, A_LOGGER_ENV_KEYS, A_LOGGER_FORMAT, A_LOGGER_SAFE_RANDOM_COLORS, A_LOGGER_TIME_FORMAT, A_Logger, A_LoggerEnvVariables, A_LoggerEnvVariablesArray, type A_LoggerEnvVariablesType, type A_LoggerLevel, A_Manifest, A_ManifestChecker, A_ManifestError, A_Memory, A_MemoryContext, type A_MemoryContextMeta, A_MemoryError, A_MemoryFeatures, type A_MemoryOperationContext, type A_MemoryOperationContextMeta, type A_MemoryOperations, type A_Memory_Storage, A_OperationContext, type A_Operation_Serialized, type A_Operation_Storage, A_Polyfill, A_Schedule, A_ScheduleObject, A_StateMachine, A_StateMachineError, A_StateMachineFeatures, A_StateMachineTransition, type A_StateMachineTransitionParams, type A_StateMachineTransitionStorage, type A_TYPES__Command_Constructor, type A_TYPES__Command_Init, type A_TYPES__Command_Listener, type A_TYPES__Command_Serialized, type A_TYPES__ConfigContainerConstructor, type A_TYPES__ConfigENVVariables, A_TYPES__ConfigFeature, type A_UTILS_TYPES__ManifestQuery, type A_UTILS_TYPES__ManifestRule, type A_UTILS_TYPES__Manifest_AllowedComponents, type A_UTILS_TYPES__Manifest_ComponentLevelConfig, type A_UTILS_TYPES__Manifest_Init, type A_UTILS_TYPES__Manifest_MethodLevelConfig, type A_UTILS_TYPES__Manifest_Rules, type A_UTILS_TYPES__ScheduleObjectCallback, type A_UTILS_TYPES__ScheduleObjectConfig, ConfigReader, ENVConfigReader, FileConfigReader, type IbufferInterface, type IcryptoInterface, type Ifspolyfill, type IhttpInterface, type IhttpsInterface, type IpathInterface, type IprocessInterface, type IurlInterface };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A_Error, A_TYPES__Error_Serialized, A_Fragment, A_Component, A_TYPES__Entity_Serialized, A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor, A_Scope, A_Entity, A_Container, A_Feature, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor, A_TYPES__Container_Constructor, A_TYPES__Fragment_Serialized } from '@adaas/a-concept';
1
+ import { A_Error, A_TYPES__Error_Serialized, A_Fragment, A_Meta, A_TYPES__Fragment_Serialized, A_Component, A_TYPES__Entity_Serialized, A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_Scope, A_Entity, A_Container, A_Feature, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor, A_TYPES__Container_Constructor } from '@adaas/a-concept';
2
2
 
3
3
  type A_Operation_Storage<_Result_type extends any = any, _ParamsType extends Record<string, any> = Record<string, any>> = {
4
4
  /**
@@ -37,7 +37,21 @@ type A_Operation_Serialized<_Result_type extends any = any, _ParamsType extends
37
37
  error?: A_TYPES__Error_Serialized;
38
38
  };
39
39
 
40
- declare class A_OperationContext<_AllowedOperations extends string = string, _ParamsType extends Record<string, any> = Record<string, any>, _ResultType = any, _StorageType extends A_Operation_Storage<_ResultType, _ParamsType> = A_Operation_Storage<_ResultType, _ParamsType>> extends A_Fragment<_StorageType, A_Operation_Serialized<_ResultType, _ParamsType>> {
40
+ declare class A_ExecutionContext<_MetaType extends Record<string, any> = Record<string, any>, _SerializedType extends Record<string, any> = Record<string, any>> extends A_Fragment {
41
+ protected _meta: A_Meta<_MetaType, _SerializedType>;
42
+ constructor(name: string, defaults?: Partial<_MetaType>);
43
+ [Symbol.iterator](): Iterator<[keyof _MetaType, _MetaType[keyof _MetaType]]>;
44
+ get meta(): A_Meta<_MetaType>;
45
+ get(key: keyof _MetaType): _MetaType[keyof _MetaType] | undefined;
46
+ set(key: keyof _MetaType, value: _MetaType[keyof _MetaType]): void;
47
+ has(key: keyof _MetaType): boolean;
48
+ drop(key: keyof _MetaType): void;
49
+ clear(): void;
50
+ toRaw(): _SerializedType;
51
+ toJSON(): A_TYPES__Fragment_Serialized;
52
+ }
53
+
54
+ declare class A_OperationContext<_AllowedOperations extends string = string, _ParamsType extends Record<string, any> = Record<string, any>, _ResultType = any, _StorageType extends A_Operation_Storage<_ResultType, _ParamsType> = A_Operation_Storage<_ResultType, _ParamsType>> extends A_ExecutionContext<_StorageType, A_Operation_Serialized<_ResultType, _ParamsType>> {
41
55
  constructor(operation: _AllowedOperations, params?: _ParamsType);
42
56
  get name(): _AllowedOperations;
43
57
  get result(): _ResultType | undefined;
@@ -706,6 +720,10 @@ type A_TYPES__Command_Serialized<ParamsType extends Record<string, any> = Record
706
720
  * ```
707
721
  */
708
722
  type A_TYPES__Command_Listener<InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init, ResultType extends Record<string, any> = Record<string, any>, LifecycleEvents extends string = A_Command_Event> = (command?: A_Command<InvokeType, ResultType, LifecycleEvents>) => void;
723
+ type A_Command_ExecutionContext<InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init, ResultType extends Record<string, any> = Record<string, any>> = {
724
+ result: ResultType;
725
+ params: InvokeType;
726
+ };
709
727
 
710
728
  declare enum A_StateMachineFeatures {
711
729
  /**
@@ -921,20 +939,28 @@ type A_TYPES__ConfigContainerConstructor<T extends Array<string | A_TYPES__Conce
921
939
  };
922
940
  } & A_TYPES__Fragment_Constructor;
923
941
 
924
- declare class A_Config<T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]> extends A_Fragment<{
942
+ declare const A_CONSTANTS__CONFIG_ENV_VARIABLES: {};
943
+ type A_TYPES__ConfigENVVariables = (typeof A_CONSTANTS__CONFIG_ENV_VARIABLES)[keyof typeof A_CONSTANTS__CONFIG_ENV_VARIABLES][];
944
+ declare const A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY: readonly [];
945
+
946
+ declare class A_Config<T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]> extends A_ExecutionContext<{
925
947
  [key in T[number]]: any;
948
+ } & {
949
+ [key in typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY[number]]: any;
950
+ } & {
951
+ [key in typeof A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY[number]]: any;
926
952
  }> {
927
- config: A_TYPES__ConfigContainerConstructor<T>;
928
- private VARIABLES;
929
- CONFIG_PROPERTIES: T;
953
+ protected _strict: boolean;
954
+ protected _configProperties: T;
930
955
  protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: ("A_CONCEPT_NAME" | "A_CONCEPT_ROOT_SCOPE" | "A_CONCEPT_ENVIRONMENT" | "A_CONCEPT_ROOT_FOLDER" | "A_ERROR_DEFAULT_DESCRIPTION")[];
931
956
  constructor(config: Partial<A_TYPES__ConfigContainerConstructor<T>>);
957
+ get strict(): boolean;
932
958
  /**
933
- * This method is used to get the configuration property by name
934
- *
935
- * @param property
936
- * @returns
937
- */
959
+ * This method is used to get the configuration property by name
960
+ *
961
+ * @param property
962
+ * @returns
963
+ */
938
964
  get<K extends T[number]>(property: K | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]): {
939
965
  [key in T[number]]: any;
940
966
  }[K] | undefined;
@@ -979,6 +1005,7 @@ declare const A_LoggerEnvVariables: {
979
1005
  */
980
1006
  readonly A_LOGGER_DEFAULT_LOG_COLOR: "A_LOGGER_DEFAULT_LOG_COLOR";
981
1007
  };
1008
+ declare const A_LoggerEnvVariablesArray: readonly ["A_LOGGER_LEVEL", "A_LOGGER_DEFAULT_SCOPE_LENGTH", "A_LOGGER_DEFAULT_SCOPE_COLOR", "A_LOGGER_DEFAULT_LOG_COLOR"];
982
1009
  type A_LoggerEnvVariablesType = (typeof A_LoggerEnvVariables)[keyof typeof A_LoggerEnvVariables][];
983
1010
 
984
1011
  /**
@@ -1401,6 +1428,10 @@ declare class A_Command<InvokeType extends A_TYPES__Command_Init = A_TYPES__Comm
1401
1428
  * command was registered.
1402
1429
  */
1403
1430
  get scope(): A_Scope;
1431
+ /**
1432
+ * Execution context associated with the command
1433
+ */
1434
+ get context(): A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>;
1404
1435
  /**
1405
1436
  * Unique command type identifier
1406
1437
  *
@@ -1503,7 +1534,7 @@ declare class A_Command<InvokeType extends A_TYPES__Command_Init = A_TYPES__Comm
1503
1534
  protected [A_CommandFeatures.onExecute](...args: any[]): Promise<void>;
1504
1535
  protected [A_CommandFeatures.onAfterExecute](...args: any[]): Promise<void>;
1505
1536
  protected [A_CommandFeatures.onComplete](stateMachine: A_StateMachine, ...args: any[]): Promise<void>;
1506
- protected [A_CommandFeatures.onFail](stateMachine: A_StateMachine, operation: A_OperationContext, ...args: any[]): Promise<void>;
1537
+ protected [A_CommandFeatures.onFail](stateMachine: A_StateMachine, operation: A_ExecutionContext<A_Command_ExecutionContext<InvokeType, ResultType>>, ...args: any[]): Promise<void>;
1507
1538
  /**
1508
1539
  * Initializes the command before execution.
1509
1540
  */
@@ -1514,6 +1545,16 @@ declare class A_Command<InvokeType extends A_TYPES__Command_Init = A_TYPES__Comm
1514
1545
  execute(): Promise<any>;
1515
1546
  /**
1516
1547
  * Marks the command as completed
1548
+ *
1549
+ *
1550
+ * Calling This method will set the command status to COMPLETED, record the end time,
1551
+ * store the result, emit the onComplete event, and destroy the execution scope.
1552
+ *
1553
+ * [!] After Calling this method, the command is considered fully processed And further processing will be INTERRUPTED.
1554
+ * [!] If the command is already processed (COMPLETED or FAILED), this method does nothing.
1555
+ * [!] This method can be called with optional result data to store with the command.
1556
+ *
1557
+ * @param result - Optional result data to store with the command
1517
1558
  */
1518
1559
  complete(result?: ResultType): Promise<void>;
1519
1560
  /**
@@ -1830,8 +1871,9 @@ declare class A_ConfigError extends A_Error {
1830
1871
  */
1831
1872
  declare class ConfigReader extends A_Component {
1832
1873
  protected polyfill: A_Polyfill;
1874
+ protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: ("A_CONCEPT_NAME" | "A_CONCEPT_ROOT_SCOPE" | "A_CONCEPT_ENVIRONMENT" | "A_CONCEPT_ROOT_FOLDER" | "A_ERROR_DEFAULT_DESCRIPTION")[];
1833
1875
  constructor(polyfill: A_Polyfill);
1834
- attachContext(container: A_Container, feature: A_Feature, config?: A_Config<any>): Promise<void>;
1876
+ attachContext(container: A_Container, context: A_Scope, config?: A_Config<any>): Promise<void>;
1835
1877
  initialize(config: A_Config): Promise<void>;
1836
1878
  /**
1837
1879
  * Get the configuration property by Name
@@ -1875,9 +1917,97 @@ declare class FileConfigReader extends ConfigReader {
1875
1917
  read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
1876
1918
  }
1877
1919
 
1878
- declare const A_CONSTANTS__CONFIG_ENV_VARIABLES: {};
1879
- type A_TYPES__ConfigENVVariables = (typeof A_CONSTANTS__CONFIG_ENV_VARIABLES)[keyof typeof A_CONSTANTS__CONFIG_ENV_VARIABLES][];
1880
- declare const A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY: readonly [];
1920
+ type A_LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'all';
1921
+
1922
+ /**
1923
+ * A-Logger Constants
1924
+ *
1925
+ * Configuration constants and default values for the A_Logger component
1926
+ */
1927
+ /**
1928
+ * Default scope length for consistent message alignment
1929
+ */
1930
+ declare const A_LOGGER_DEFAULT_SCOPE_LENGTH = 20;
1931
+ /**
1932
+ * Default log level when none is specified
1933
+ */
1934
+ declare const A_LOGGER_DEFAULT_LEVEL = "all";
1935
+ /**
1936
+ * Terminal color codes mapping
1937
+ */
1938
+ declare const A_LOGGER_COLORS: {
1939
+ readonly red: "31";
1940
+ readonly yellow: "33";
1941
+ readonly green: "32";
1942
+ readonly blue: "34";
1943
+ readonly cyan: "36";
1944
+ readonly magenta: "35";
1945
+ readonly gray: "90";
1946
+ readonly brightBlue: "94";
1947
+ readonly brightCyan: "96";
1948
+ readonly brightMagenta: "95";
1949
+ readonly darkGray: "30";
1950
+ readonly lightGray: "37";
1951
+ readonly indigo: "38;5;54";
1952
+ readonly violet: "38;5;93";
1953
+ readonly purple: "38;5;129";
1954
+ readonly lavender: "38;5;183";
1955
+ readonly skyBlue: "38;5;117";
1956
+ readonly steelBlue: "38;5;67";
1957
+ readonly slateBlue: "38;5;62";
1958
+ readonly deepBlue: "38;5;18";
1959
+ readonly lightBlue: "38;5;153";
1960
+ readonly periwinkle: "38;5;111";
1961
+ readonly cornflower: "38;5;69";
1962
+ readonly powder: "38;5;152";
1963
+ readonly charcoal: "38;5;236";
1964
+ readonly silver: "38;5;250";
1965
+ readonly smoke: "38;5;244";
1966
+ readonly slate: "38;5;240";
1967
+ };
1968
+ /**
1969
+ * Safe colors for random selection - grey-blue-violet palette
1970
+ * Excludes system colors (red, yellow, green) to avoid confusion with warnings/errors
1971
+ */
1972
+ declare const A_LOGGER_SAFE_RANDOM_COLORS: readonly ["blue", "cyan", "magenta", "gray", "brightBlue", "brightCyan", "brightMagenta", "darkGray", "lightGray", "indigo", "violet", "purple", "lavender", "skyBlue", "steelBlue", "slateBlue", "deepBlue", "lightBlue", "periwinkle", "cornflower", "powder", "charcoal", "silver", "smoke", "slate"];
1973
+ /**
1974
+ * ANSI escape codes
1975
+ */
1976
+ declare const A_LOGGER_ANSI: {
1977
+ readonly RESET: "\u001B[0m";
1978
+ readonly PREFIX: "\u001B[";
1979
+ readonly SUFFIX: "m";
1980
+ };
1981
+ /**
1982
+ * Timestamp format configuration
1983
+ */
1984
+ declare const A_LOGGER_TIME_FORMAT: {
1985
+ readonly MINUTES_PAD: 2;
1986
+ readonly SECONDS_PAD: 2;
1987
+ readonly MILLISECONDS_PAD: 3;
1988
+ readonly SEPARATOR: ":";
1989
+ };
1990
+ /**
1991
+ * Log message structure constants
1992
+ */
1993
+ declare const A_LOGGER_FORMAT: {
1994
+ readonly SCOPE_OPEN: "[";
1995
+ readonly SCOPE_CLOSE: "]";
1996
+ readonly TIME_OPEN: "|";
1997
+ readonly TIME_CLOSE: "|";
1998
+ readonly SEPARATOR: "-------------------------------";
1999
+ readonly INDENT_BASE: 3;
2000
+ readonly PIPE: "| ";
2001
+ };
2002
+ /**
2003
+ * Environment variable keys
2004
+ */
2005
+ declare const A_LOGGER_ENV_KEYS: {
2006
+ readonly LOG_LEVEL: "A_LOGGER_LEVEL";
2007
+ readonly DEFAULT_SCOPE_LENGTH: "A_LOGGER_DEFAULT_SCOPE_LENGTH";
2008
+ readonly DEFAULT_SCOPE_COLOR: "A_LOGGER_DEFAULT_SCOPE_COLOR";
2009
+ readonly DEFAULT_LOG_COLOR: "A_LOGGER_DEFAULT_LOG_COLOR";
2010
+ };
1881
2011
 
1882
2012
  type A_UTILS_TYPES__Manifest_Init = Array<A_UTILS_TYPES__Manifest_ComponentLevelConfig>;
1883
2013
  type A_UTILS_TYPES__Manifest_ComponentLevelConfig<T extends A_Component = A_Component> = {
@@ -2030,18 +2160,32 @@ declare enum A_MemoryFeatures {
2030
2160
  onHas = "onHas"
2031
2161
  }
2032
2162
 
2033
- declare class A_MemoryContext<_MemoryType extends Record<string, any> = Record<string, any>, _SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> extends A_Fragment<_MemoryType, _MemoryType & _SerializedType> {
2034
- set<K extends keyof _MemoryType>(param: 'error', value: A_Error): void;
2163
+ declare class A_MemoryContext<_MemoryType extends Record<string, any> = Record<string, any>, _SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> extends A_Fragment {
2164
+ protected _storage: Map<keyof _MemoryType, _MemoryType[keyof _MemoryType]>;
2035
2165
  set<K extends keyof _MemoryType>(param: K, value: _MemoryType[K]): void;
2036
- get<K extends keyof A_Error>(param: 'error'): A_Error | undefined;
2037
2166
  get<K extends keyof _MemoryType>(param: K): _MemoryType[K] | undefined;
2167
+ delete<K extends keyof _MemoryType>(param: K): void;
2168
+ has<K extends keyof _MemoryType>(param: K): boolean;
2169
+ clear(): void;
2038
2170
  }
2039
2171
 
2172
+ type A_MemoryContextMeta<T extends Record<string, any> = Record<string, any>> = Omit<T, 'error'> & {
2173
+ error?: A_Error;
2174
+ };
2175
+ type A_Memory_Storage = Record<string, any> & {
2176
+ error?: A_Error;
2177
+ };
2040
2178
  type A_MemoryOperations = 'get' | 'set' | 'drop' | 'clear' | 'has' | 'serialize';
2041
2179
  type A_MemoryOperationContext<T extends any = any> = A_OperationContext<A_MemoryOperations, {
2042
2180
  key: string;
2043
2181
  value?: any;
2044
2182
  }, T>;
2183
+ type A_MemoryOperationContextMeta<T extends any = any, I extends any = any> = {
2184
+ result: T;
2185
+ operation: A_MemoryOperations;
2186
+ key: string;
2187
+ value?: I;
2188
+ };
2045
2189
 
2046
2190
  declare class A_Memory<_StorageType extends Record<string, any> = Record<string, any>, _SerializedType extends Record<string, any> = Record<string, any>> extends A_Component {
2047
2191
  protected _ready?: Promise<void>;
@@ -2117,6 +2261,17 @@ declare class A_Memory<_StorageType extends Record<string, any> = Record<string,
2117
2261
  toJSON(): Promise<_SerializedType>;
2118
2262
  }
2119
2263
 
2264
+ declare class A_MemoryError extends A_Error {
2265
+ static readonly MemoryInitializationError = "Memory initialization error";
2266
+ static readonly MemoryDestructionError = "Memory destruction error";
2267
+ static readonly MemoryGetError = "Memory GET operation failed";
2268
+ static readonly MemorySetError = "Memory SET operation failed";
2269
+ static readonly MemoryDropError = "Memory DROP operation failed";
2270
+ static readonly MemoryClearError = "Memory CLEAR operation failed";
2271
+ static readonly MemoryHasError = "Memory HAS operation failed";
2272
+ static readonly MemorySerializeError = "Memory toJSON operation failed";
2273
+ }
2274
+
2120
2275
  type A_UTILS_TYPES__ScheduleObjectConfig = {
2121
2276
  /**
2122
2277
  * If the timeout is cleared, should the promise resolve or reject?
@@ -2225,4 +2380,9 @@ declare class A_Deferred<T> {
2225
2380
  reject(reason?: any): void;
2226
2381
  }
2227
2382
 
2228
- export { A_CONSTANTS__CONFIG_ENV_VARIABLES, A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY, A_Channel, A_ChannelError, A_ChannelFeatures, A_ChannelRequestStatuses, A_Command, A_CommandError, A_CommandFeatures, A_CommandTransitions, type A_Command_Event, A_Command_Status, A_Config, A_ConfigError, A_ConfigLoader, A_Deferred, A_Logger, A_Manifest, A_ManifestChecker, A_ManifestError, A_Memory, A_Polyfill, A_Schedule, A_ScheduleObject, type A_TYPES__Command_Constructor, type A_TYPES__Command_Init, type A_TYPES__Command_Listener, type A_TYPES__Command_Serialized, type A_TYPES__ConfigContainerConstructor, type A_TYPES__ConfigENVVariables, A_TYPES__ConfigFeature, type A_UTILS_TYPES__ManifestQuery, type A_UTILS_TYPES__ManifestRule, type A_UTILS_TYPES__Manifest_AllowedComponents, type A_UTILS_TYPES__Manifest_ComponentLevelConfig, type A_UTILS_TYPES__Manifest_Init, type A_UTILS_TYPES__Manifest_MethodLevelConfig, type A_UTILS_TYPES__Manifest_Rules, type A_UTILS_TYPES__ScheduleObjectCallback, type A_UTILS_TYPES__ScheduleObjectConfig, ConfigReader, ENVConfigReader, FileConfigReader, type IbufferInterface, type IcryptoInterface, type Ifspolyfill, type IhttpInterface, type IhttpsInterface, type IpathInterface, type IprocessInterface, type IurlInterface };
2383
+ declare class A_StateMachineError extends A_Error {
2384
+ static readonly InitializationError = "A-StateMachine Initialization Error";
2385
+ static readonly TransitionError = "A-StateMachine Transition Error";
2386
+ }
2387
+
2388
+ export { A_CONSTANTS__CONFIG_ENV_VARIABLES, A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY, A_Channel, A_ChannelError, A_ChannelFeatures, A_ChannelRequest, A_ChannelRequestStatuses, A_Command, A_CommandError, A_CommandFeatures, A_CommandTransitions, type A_Command_Event, type A_Command_ExecutionContext, A_Command_Status, A_Config, A_ConfigError, A_ConfigLoader, A_Deferred, A_ExecutionContext, A_LOGGER_ANSI, A_LOGGER_COLORS, A_LOGGER_DEFAULT_LEVEL, A_LOGGER_DEFAULT_SCOPE_LENGTH, A_LOGGER_ENV_KEYS, A_LOGGER_FORMAT, A_LOGGER_SAFE_RANDOM_COLORS, A_LOGGER_TIME_FORMAT, A_Logger, A_LoggerEnvVariables, A_LoggerEnvVariablesArray, type A_LoggerEnvVariablesType, type A_LoggerLevel, A_Manifest, A_ManifestChecker, A_ManifestError, A_Memory, A_MemoryContext, type A_MemoryContextMeta, A_MemoryError, A_MemoryFeatures, type A_MemoryOperationContext, type A_MemoryOperationContextMeta, type A_MemoryOperations, type A_Memory_Storage, A_OperationContext, type A_Operation_Serialized, type A_Operation_Storage, A_Polyfill, A_Schedule, A_ScheduleObject, A_StateMachine, A_StateMachineError, A_StateMachineFeatures, A_StateMachineTransition, type A_StateMachineTransitionParams, type A_StateMachineTransitionStorage, type A_TYPES__Command_Constructor, type A_TYPES__Command_Init, type A_TYPES__Command_Listener, type A_TYPES__Command_Serialized, type A_TYPES__ConfigContainerConstructor, type A_TYPES__ConfigENVVariables, A_TYPES__ConfigFeature, type A_UTILS_TYPES__ManifestQuery, type A_UTILS_TYPES__ManifestRule, type A_UTILS_TYPES__Manifest_AllowedComponents, type A_UTILS_TYPES__Manifest_ComponentLevelConfig, type A_UTILS_TYPES__Manifest_Init, type A_UTILS_TYPES__Manifest_MethodLevelConfig, type A_UTILS_TYPES__Manifest_Rules, type A_UTILS_TYPES__ScheduleObjectCallback, type A_UTILS_TYPES__ScheduleObjectConfig, ConfigReader, ENVConfigReader, FileConfigReader, type IbufferInterface, type IcryptoInterface, type Ifspolyfill, type IhttpInterface, type IhttpsInterface, type IpathInterface, type IprocessInterface, type IurlInterface };