@opensourcekd/ng-common-libs 1.2.8 → 2.0.0

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.
@@ -1,86 +0,0 @@
1
- 'use strict';
2
-
3
- var rxjs = require('rxjs');
4
- var operators = require('rxjs/operators');
5
-
6
- /**
7
- * EventBus - A centralized event bus for application-wide communication
8
- * Framework-agnostic implementation using only RxJS
9
- *
10
- * @example
11
- * ```typescript
12
- * // Create an instance
13
- * const eventBus = new EventBus();
14
- *
15
- * // Emit an event
16
- * eventBus.emit('user:login', { userId: '123', username: 'john' });
17
- *
18
- * // Subscribe to an event
19
- * eventBus.on('user:login').subscribe(data => {
20
- * console.log('User logged in:', data);
21
- * });
22
- * ```
23
- */
24
- class EventBus {
25
- eventSubject = new rxjs.Subject();
26
- /**
27
- * Emit an event with optional data
28
- * @param eventType - The type/name of the event
29
- * @param data - Optional data to send with the event
30
- */
31
- emit(eventType, data) {
32
- this.eventSubject.next({
33
- type: eventType,
34
- data,
35
- timestamp: Date.now()
36
- });
37
- }
38
- /**
39
- * Subscribe to a specific event type
40
- * @param eventType - The type/name of the event to listen for
41
- * @returns Observable that emits the event data
42
- */
43
- on(eventType) {
44
- return this.eventSubject.asObservable().pipe(operators.filter(event => event.type === eventType), operators.map(event => event.data));
45
- }
46
- /**
47
- * Subscribe to multiple event types
48
- * @param eventTypes - Array of event types to listen for
49
- * @returns Observable that emits the full event payload
50
- */
51
- onMultiple(eventTypes) {
52
- return this.eventSubject.asObservable().pipe(operators.filter(event => eventTypes.includes(event.type)));
53
- }
54
- /**
55
- * Subscribe to all events
56
- * @returns Observable that emits all event payloads
57
- */
58
- onAll() {
59
- return this.eventSubject.asObservable();
60
- }
61
- }
62
-
63
- /**
64
- * Framework-agnostic Configuration
65
- * Centralized configuration for all consuming applications
66
- *
67
- * This configuration can be used across different frameworks (Angular, React, Vue, etc.)
68
- * and by various Micro-Frontends (MFEs) and shell applications.
69
- *
70
- * Values are statically configured during build time from GitHub repository variables.
71
- */
72
- /**
73
- * Application configuration object
74
- * Contains all environment-specific variables
75
- *
76
- * These values are replaced during build time with actual values from GitHub repository variables.
77
- */
78
- const APP_CONFIG = {
79
- auth0Domain: '',
80
- auth0ClientId: '',
81
- apiUrl: '',
82
- };
83
-
84
- exports.APP_CONFIG = APP_CONFIG;
85
- exports.EventBus = EventBus;
86
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/core/event-bus.ts","../../src/core/config.ts"],"sourcesContent":["import { Subject, Observable } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\n\n/**\n * Event payload interface\n */\nexport interface EventPayload<T = any> {\n type: string;\n data: T;\n timestamp?: number;\n}\n\n/**\n * EventBus - A centralized event bus for application-wide communication\n * Framework-agnostic implementation using only RxJS\n * \n * @example\n * ```typescript\n * // Create an instance\n * const eventBus = new EventBus();\n * \n * // Emit an event\n * eventBus.emit('user:login', { userId: '123', username: 'john' });\n * \n * // Subscribe to an event\n * eventBus.on('user:login').subscribe(data => {\n * console.log('User logged in:', data);\n * });\n * ```\n */\nexport class EventBus {\n private eventSubject = new Subject<EventPayload>();\n\n /**\n * Emit an event with optional data\n * @param eventType - The type/name of the event\n * @param data - Optional data to send with the event\n */\n emit<T = any>(eventType: string, data?: T): void {\n this.eventSubject.next({\n type: eventType,\n data,\n timestamp: Date.now()\n });\n }\n\n /**\n * Subscribe to a specific event type\n * @param eventType - The type/name of the event to listen for\n * @returns Observable that emits the event data\n */\n on<T = any>(eventType: string): Observable<T> {\n return this.eventSubject.asObservable().pipe(\n filter(event => event.type === eventType),\n map(event => event.data as T)\n );\n }\n\n /**\n * Subscribe to multiple event types\n * @param eventTypes - Array of event types to listen for\n * @returns Observable that emits the full event payload\n */\n onMultiple(eventTypes: string[]): Observable<EventPayload> {\n return this.eventSubject.asObservable().pipe(\n filter(event => eventTypes.includes(event.type))\n );\n }\n\n /**\n * Subscribe to all events\n * @returns Observable that emits all event payloads\n */\n onAll(): Observable<EventPayload> {\n return this.eventSubject.asObservable();\n }\n}\n","/**\n * Framework-agnostic Configuration\n * Centralized configuration for all consuming applications\n * \n * This configuration can be used across different frameworks (Angular, React, Vue, etc.)\n * and by various Micro-Frontends (MFEs) and shell applications.\n * \n * Values are statically configured during build time from GitHub repository variables.\n */\n\n/**\n * Application configuration object\n * Contains all environment-specific variables\n * \n * These values are replaced during build time with actual values from GitHub repository variables.\n */\nexport const APP_CONFIG = {\n auth0Domain: '__AUTH0_DOMAIN__',\n auth0ClientId: '__AUTH0_CLIENT_ID__',\n apiUrl: '__API_URL__',\n};\n"],"names":["Subject","filter","map"],"mappings":";;;;;AAYA;;;;;;;;;;;;;;;;;AAiBG;MACU,QAAQ,CAAA;AACX,IAAA,YAAY,GAAG,IAAIA,YAAO,EAAgB;AAElD;;;;AAIG;IACH,IAAI,CAAU,SAAiB,EAAE,IAAQ,EAAA;AACvC,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;AACrB,YAAA,IAAI,EAAE,SAAS;YACf,IAAI;AACJ,YAAA,SAAS,EAAE,IAAI,CAAC,GAAG;AACpB,SAAA,CAAC;IACJ;AAEA;;;;AAIG;AACH,IAAA,EAAE,CAAU,SAAiB,EAAA;AAC3B,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,IAAI,CAC1CC,gBAAM,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,EACzCC,aAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAS,CAAC,CAC9B;IACH;AAEA;;;;AAIG;AACH,IAAA,UAAU,CAAC,UAAoB,EAAA;QAC7B,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,IAAI,CAC1CD,gBAAM,CAAC,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CACjD;IACH;AAEA;;;AAGG;IACH,KAAK,GAAA;AACH,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;IACzC;AACD;;AC5ED;;;;;;;;AAQG;AAEH;;;;;AAKG;AACI,MAAM,UAAU,GAAG;AACxB,IAAA,WAAW,EAAE,EAAkB;AAC/B,IAAA,aAAa,EAAE,EAAqB;AACpC,IAAA,MAAM,EAAE,EAAa;;;;;;"}
@@ -1,78 +0,0 @@
1
- import { Observable } from 'rxjs';
2
-
3
- /**
4
- * Event payload interface
5
- */
6
- interface EventPayload<T = any> {
7
- type: string;
8
- data: T;
9
- timestamp?: number;
10
- }
11
- /**
12
- * EventBus - A centralized event bus for application-wide communication
13
- * Framework-agnostic implementation using only RxJS
14
- *
15
- * @example
16
- * ```typescript
17
- * // Create an instance
18
- * const eventBus = new EventBus();
19
- *
20
- * // Emit an event
21
- * eventBus.emit('user:login', { userId: '123', username: 'john' });
22
- *
23
- * // Subscribe to an event
24
- * eventBus.on('user:login').subscribe(data => {
25
- * console.log('User logged in:', data);
26
- * });
27
- * ```
28
- */
29
- declare class EventBus {
30
- private eventSubject;
31
- /**
32
- * Emit an event with optional data
33
- * @param eventType - The type/name of the event
34
- * @param data - Optional data to send with the event
35
- */
36
- emit<T = any>(eventType: string, data?: T): void;
37
- /**
38
- * Subscribe to a specific event type
39
- * @param eventType - The type/name of the event to listen for
40
- * @returns Observable that emits the event data
41
- */
42
- on<T = any>(eventType: string): Observable<T>;
43
- /**
44
- * Subscribe to multiple event types
45
- * @param eventTypes - Array of event types to listen for
46
- * @returns Observable that emits the full event payload
47
- */
48
- onMultiple(eventTypes: string[]): Observable<EventPayload>;
49
- /**
50
- * Subscribe to all events
51
- * @returns Observable that emits all event payloads
52
- */
53
- onAll(): Observable<EventPayload>;
54
- }
55
-
56
- /**
57
- * Framework-agnostic Configuration
58
- * Centralized configuration for all consuming applications
59
- *
60
- * This configuration can be used across different frameworks (Angular, React, Vue, etc.)
61
- * and by various Micro-Frontends (MFEs) and shell applications.
62
- *
63
- * Values are statically configured during build time from GitHub repository variables.
64
- */
65
- /**
66
- * Application configuration object
67
- * Contains all environment-specific variables
68
- *
69
- * These values are replaced during build time with actual values from GitHub repository variables.
70
- */
71
- declare const APP_CONFIG: {
72
- auth0Domain: string;
73
- auth0ClientId: string;
74
- apiUrl: string;
75
- };
76
-
77
- export { APP_CONFIG, EventBus };
78
- export type { EventPayload };
@@ -1,83 +0,0 @@
1
- import { Subject } from 'rxjs';
2
- import { filter, map } from 'rxjs/operators';
3
-
4
- /**
5
- * EventBus - A centralized event bus for application-wide communication
6
- * Framework-agnostic implementation using only RxJS
7
- *
8
- * @example
9
- * ```typescript
10
- * // Create an instance
11
- * const eventBus = new EventBus();
12
- *
13
- * // Emit an event
14
- * eventBus.emit('user:login', { userId: '123', username: 'john' });
15
- *
16
- * // Subscribe to an event
17
- * eventBus.on('user:login').subscribe(data => {
18
- * console.log('User logged in:', data);
19
- * });
20
- * ```
21
- */
22
- class EventBus {
23
- eventSubject = new Subject();
24
- /**
25
- * Emit an event with optional data
26
- * @param eventType - The type/name of the event
27
- * @param data - Optional data to send with the event
28
- */
29
- emit(eventType, data) {
30
- this.eventSubject.next({
31
- type: eventType,
32
- data,
33
- timestamp: Date.now()
34
- });
35
- }
36
- /**
37
- * Subscribe to a specific event type
38
- * @param eventType - The type/name of the event to listen for
39
- * @returns Observable that emits the event data
40
- */
41
- on(eventType) {
42
- return this.eventSubject.asObservable().pipe(filter(event => event.type === eventType), map(event => event.data));
43
- }
44
- /**
45
- * Subscribe to multiple event types
46
- * @param eventTypes - Array of event types to listen for
47
- * @returns Observable that emits the full event payload
48
- */
49
- onMultiple(eventTypes) {
50
- return this.eventSubject.asObservable().pipe(filter(event => eventTypes.includes(event.type)));
51
- }
52
- /**
53
- * Subscribe to all events
54
- * @returns Observable that emits all event payloads
55
- */
56
- onAll() {
57
- return this.eventSubject.asObservable();
58
- }
59
- }
60
-
61
- /**
62
- * Framework-agnostic Configuration
63
- * Centralized configuration for all consuming applications
64
- *
65
- * This configuration can be used across different frameworks (Angular, React, Vue, etc.)
66
- * and by various Micro-Frontends (MFEs) and shell applications.
67
- *
68
- * Values are statically configured during build time from GitHub repository variables.
69
- */
70
- /**
71
- * Application configuration object
72
- * Contains all environment-specific variables
73
- *
74
- * These values are replaced during build time with actual values from GitHub repository variables.
75
- */
76
- const APP_CONFIG = {
77
- auth0Domain: '',
78
- auth0ClientId: '',
79
- apiUrl: '',
80
- };
81
-
82
- export { APP_CONFIG, EventBus };
83
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/core/event-bus.ts","../../src/core/config.ts"],"sourcesContent":["import { Subject, Observable } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\n\n/**\n * Event payload interface\n */\nexport interface EventPayload<T = any> {\n type: string;\n data: T;\n timestamp?: number;\n}\n\n/**\n * EventBus - A centralized event bus for application-wide communication\n * Framework-agnostic implementation using only RxJS\n * \n * @example\n * ```typescript\n * // Create an instance\n * const eventBus = new EventBus();\n * \n * // Emit an event\n * eventBus.emit('user:login', { userId: '123', username: 'john' });\n * \n * // Subscribe to an event\n * eventBus.on('user:login').subscribe(data => {\n * console.log('User logged in:', data);\n * });\n * ```\n */\nexport class EventBus {\n private eventSubject = new Subject<EventPayload>();\n\n /**\n * Emit an event with optional data\n * @param eventType - The type/name of the event\n * @param data - Optional data to send with the event\n */\n emit<T = any>(eventType: string, data?: T): void {\n this.eventSubject.next({\n type: eventType,\n data,\n timestamp: Date.now()\n });\n }\n\n /**\n * Subscribe to a specific event type\n * @param eventType - The type/name of the event to listen for\n * @returns Observable that emits the event data\n */\n on<T = any>(eventType: string): Observable<T> {\n return this.eventSubject.asObservable().pipe(\n filter(event => event.type === eventType),\n map(event => event.data as T)\n );\n }\n\n /**\n * Subscribe to multiple event types\n * @param eventTypes - Array of event types to listen for\n * @returns Observable that emits the full event payload\n */\n onMultiple(eventTypes: string[]): Observable<EventPayload> {\n return this.eventSubject.asObservable().pipe(\n filter(event => eventTypes.includes(event.type))\n );\n }\n\n /**\n * Subscribe to all events\n * @returns Observable that emits all event payloads\n */\n onAll(): Observable<EventPayload> {\n return this.eventSubject.asObservable();\n }\n}\n","/**\n * Framework-agnostic Configuration\n * Centralized configuration for all consuming applications\n * \n * This configuration can be used across different frameworks (Angular, React, Vue, etc.)\n * and by various Micro-Frontends (MFEs) and shell applications.\n * \n * Values are statically configured during build time from GitHub repository variables.\n */\n\n/**\n * Application configuration object\n * Contains all environment-specific variables\n * \n * These values are replaced during build time with actual values from GitHub repository variables.\n */\nexport const APP_CONFIG = {\n auth0Domain: '__AUTH0_DOMAIN__',\n auth0ClientId: '__AUTH0_CLIENT_ID__',\n apiUrl: '__API_URL__',\n};\n"],"names":[],"mappings":";;;AAYA;;;;;;;;;;;;;;;;;AAiBG;MACU,QAAQ,CAAA;AACX,IAAA,YAAY,GAAG,IAAI,OAAO,EAAgB;AAElD;;;;AAIG;IACH,IAAI,CAAU,SAAiB,EAAE,IAAQ,EAAA;AACvC,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;AACrB,YAAA,IAAI,EAAE,SAAS;YACf,IAAI;AACJ,YAAA,SAAS,EAAE,IAAI,CAAC,GAAG;AACpB,SAAA,CAAC;IACJ;AAEA;;;;AAIG;AACH,IAAA,EAAE,CAAU,SAAiB,EAAA;AAC3B,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,IAAI,CAC1C,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,EACzC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAS,CAAC,CAC9B;IACH;AAEA;;;;AAIG;AACH,IAAA,UAAU,CAAC,UAAoB,EAAA;QAC7B,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,IAAI,CAC1C,MAAM,CAAC,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CACjD;IACH;AAEA;;;AAGG;IACH,KAAK,GAAA;AACH,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;IACzC;AACD;;AC5ED;;;;;;;;AAQG;AAEH;;;;;AAKG;AACI,MAAM,UAAU,GAAG;AACxB,IAAA,WAAW,EAAE,EAAkB;AAC/B,IAAA,aAAa,EAAE,EAAqB;AACpC,IAAA,MAAM,EAAE,EAAa;;;;;"}