@rxap/ngx-pub-sub 19.0.4-dev.0 โ 19.1.0-dev.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.
- package/CHANGELOG.md +23 -0
- package/compodoc/changelog.html +20 -0
- package/compodoc/injectables/PubSubService.html +15 -14
- package/compodoc/js/menu-wc.js +5 -0
- package/compodoc/js/menu-wc_es5.js +1 -1
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/compodoc/todo.html +225 -0
- package/docs/documentation.json +100 -100
- package/docs/html/assets/hierarchy.js +1 -1
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/MessageMetaData.html +6 -6
- package/docs/html/classes/PubSubService.html +7 -7
- package/docs/html/functions/ProvidePubSub.html +1 -1
- package/docs/html/functions/withDisableCache.html +1 -1
- package/docs/html/functions/withDisableGarbageCollector.html +1 -1
- package/docs/html/functions/withGarbageCollectorInterval.html +1 -1
- package/docs/html/functions/withMaxCacheSize.html +1 -1
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/CachedPubSubMessage.html +3 -3
- package/docs/html/interfaces/PubSubMessage.html +3 -3
- package/docs/html/modules.html +1 -1
- package/docs/html/variables/RXAP_PUB_SUB_CACHE_SIZE.html +1 -1
- package/docs/html/variables/RXAP_PUB_SUB_DISABLE_CACHE.html +1 -1
- package/docs/html/variables/RXAP_PUB_SUB_DISABLE_GARBAGE_COLLECTOR.html +1 -1
- package/docs/html/variables/RXAP_PUB_SUB_GARBAGE_COLLECTOR_INTERVAL.html +1 -1
- package/docs/html/variables/RXAP_TOPICS.html +2 -2
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/MessageMetaData.md +7 -7
- package/docs/markdown/classes/PubSubService.md +12 -12
- package/docs/markdown/functions/ProvidePubSub.md +2 -2
- package/docs/markdown/functions/withDisableCache.md +2 -2
- package/docs/markdown/functions/withDisableGarbageCollector.md +2 -2
- package/docs/markdown/functions/withGarbageCollectorInterval.md +2 -2
- package/docs/markdown/functions/withMaxCacheSize.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/CachedPubSubMessage.md +5 -5
- package/docs/markdown/interfaces/PubSubMessage.md +4 -4
- package/docs/markdown/variables/RXAP_PUB_SUB_CACHE_SIZE.md +2 -2
- package/docs/markdown/variables/RXAP_PUB_SUB_DISABLE_CACHE.md +2 -2
- package/docs/markdown/variables/RXAP_PUB_SUB_DISABLE_GARBAGE_COLLECTOR.md +2 -2
- package/docs/markdown/variables/RXAP_PUB_SUB_GARBAGE_COLLECTOR_INTERVAL.md +2 -2
- package/docs/markdown/variables/RXAP_TOPICS.md +2 -2
- package/docs/wiki/Class.MessageMetaData.md +6 -6
- package/docs/wiki/Class.PubSubService.md +11 -11
- package/docs/wiki/Function.ProvidePubSub.md +1 -1
- package/docs/wiki/Function.withDisableCache.md +1 -1
- package/docs/wiki/Function.withDisableGarbageCollector.md +1 -1
- package/docs/wiki/Function.withGarbageCollectorInterval.md +1 -1
- package/docs/wiki/Function.withMaxCacheSize.md +1 -1
- package/docs/wiki/Interface.CachedPubSubMessage.md +4 -4
- package/docs/wiki/Interface.PubSubMessage.md +3 -3
- package/docs/wiki/Variable.RXAP_PUB_SUB_CACHE_SIZE.md +1 -1
- package/docs/wiki/Variable.RXAP_PUB_SUB_DISABLE_CACHE.md +1 -1
- package/docs/wiki/Variable.RXAP_PUB_SUB_DISABLE_GARBAGE_COLLECTOR.md +1 -1
- package/docs/wiki/Variable.RXAP_PUB_SUB_GARBAGE_COLLECTOR_INTERVAL.md +1 -1
- package/docs/wiki/Variable.RXAP_TOPICS.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-ngx-pub-sub.mjs +10 -9
- package/fesm2022/rxap-ngx-pub-sub.mjs.map +1 -1
- package/package.json +2 -3
package/compodoc/properties.html
CHANGED
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
</ol>
|
|
103
103
|
<ul class="properties-list">
|
|
104
104
|
<li>
|
|
105
|
-
<b>Version</b> : 19.0
|
|
105
|
+
<b>Version</b> : 19.1.0-dev.0</li>
|
|
106
106
|
<li>
|
|
107
107
|
<b>Description</b> : Provides a simple publish/subscribe service for Angular applications. It supports caching of messages with optional retention policies and a garbage collector to manage the cache size. The service also supports wildcard topic matching.
|
|
108
108
|
</li>
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="no-js" lang="">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
6
|
+
<title>angular-pub-sub</title>
|
|
7
|
+
<meta name="description" content="">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
|
|
10
|
+
<link rel="icon" type="image/x-icon" href="./images/favicon.ico">
|
|
11
|
+
<link rel="stylesheet" href="./styles/style.css">
|
|
12
|
+
<link rel="stylesheet" href="./styles/dark.css">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<script>
|
|
16
|
+
// Blocking script to avoid flickering dark mode
|
|
17
|
+
// Dark mode toggle button
|
|
18
|
+
var useDark = window.matchMedia('(prefers-color-scheme: dark)');
|
|
19
|
+
var darkModeState = useDark.matches;
|
|
20
|
+
var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
|
|
21
|
+
var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
|
|
22
|
+
var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
|
|
23
|
+
|
|
24
|
+
function checkToggle(check) {
|
|
25
|
+
for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
|
|
26
|
+
$darkModeToggleSwitchers[i].checked = check;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function toggleDarkMode(state) {
|
|
31
|
+
if (window.localStorage) {
|
|
32
|
+
localStorage.setItem('compodoc_darkmode-state', state);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
checkToggle(state);
|
|
36
|
+
|
|
37
|
+
const hasClass = document.body.classList.contains('dark');
|
|
38
|
+
|
|
39
|
+
if (state) {
|
|
40
|
+
for (var i = 0; i < $darkModeToggles.length; i++) {
|
|
41
|
+
$darkModeToggles[i].classList.add('dark');
|
|
42
|
+
}
|
|
43
|
+
if (!hasClass) {
|
|
44
|
+
document.body.classList.add('dark');
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
for (var i = 0; i < $darkModeToggles.length; i++) {
|
|
48
|
+
$darkModeToggles[i].classList.remove('dark');
|
|
49
|
+
}
|
|
50
|
+
if (hasClass) {
|
|
51
|
+
document.body.classList.remove('dark');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
useDark.addEventListener('change', function (evt) {
|
|
57
|
+
toggleDarkMode(evt.matches);
|
|
58
|
+
});
|
|
59
|
+
if (darkModeStateLocal) {
|
|
60
|
+
darkModeState = darkModeStateLocal === 'true';
|
|
61
|
+
}
|
|
62
|
+
toggleDarkMode(darkModeState);
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
|
|
66
|
+
<div class="d-flex">
|
|
67
|
+
<a href="./" class="navbar-brand">angular-pub-sub</a>
|
|
68
|
+
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="xs-menu menu" id="mobile-menu">
|
|
73
|
+
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="container-fluid main">
|
|
77
|
+
<div class="row main">
|
|
78
|
+
<div class="d-none d-md-block menu">
|
|
79
|
+
<compodoc-menu mode="normal"></compodoc-menu>
|
|
80
|
+
</div>
|
|
81
|
+
<!-- START CONTENT -->
|
|
82
|
+
<div class="content getting-started">
|
|
83
|
+
<div class="content-data">
|
|
84
|
+
|
|
85
|
+
<h1>TODO: @rxap/ngx-pub-sub Refactoring & Bug Fixes</h1>
|
|
86
|
+
<p>This document outlines the findings of the project audit for <code>@rxap/ngx-pub-sub</code> (<code>packages/angular/pub-sub</code>). It categorizes issues by severity and provides concrete recommendations for resolving them.</p>
|
|
87
|
+
<hr>
|
|
88
|
+
<h2>๐ Architectural Debt & Code Quality</h2>
|
|
89
|
+
<h3>1. Reverse Chronological Replay Order</h3>
|
|
90
|
+
<p>In <code>packages/angular/pub-sub/src/lib/pub-sub.service.ts</code>:</p>
|
|
91
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-typescript"> public getFromCache<T = unknown>(topic: string, limit = 0): Array<MessageMetaData<T>> {
|
|
92
|
+
const messages: Array<MessageMetaData<T>> = [];
|
|
93
|
+
for (let i = this.cache.length - 1; i >= 0; i--) {
|
|
94
|
+
const message = this.cache[i];
|
|
95
|
+
if (this.topicMatch(message.topic, topic)) {
|
|
96
|
+
messages.push(message.metadata as MessageMetaData<T>);
|
|
97
|
+
if (limit && messages.length >= limit) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return messages;
|
|
103
|
+
}</code></pre></div><ul>
|
|
104
|
+
<li><strong>Issue:</strong> Since the loop starts from the end of the cache (<code>this.cache.length - 1</code>) and pushes to <code>messages</code>, replayed cached messages are returned (and emitted via <code>subscribe</code>) in <strong>reverse chronological order</strong> (newest first). Usually, subscriber components expect replayed historical messages to be chronological.</li>
|
|
105
|
+
<li><strong>Fix:</strong> Reverse the array before returning:<b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">return messages.reverse();</code></pre></div></li>
|
|
106
|
+
</ul>
|
|
107
|
+
<h3>2. Manual/Insecure UUID Generation</h3>
|
|
108
|
+
<p>In <code>packages/angular/pub-sub/src/lib/message-meta-data.ts</code>:</p>
|
|
109
|
+
<ul>
|
|
110
|
+
<li><strong>Issue:</strong> The <code>uuid</code> generation uses a custom <code>Math.random()</code>-based generator. <code>Math.random()</code> is not cryptographically secure and can cause ID collisions or poor performance.</li>
|
|
111
|
+
<li><strong>Fix:</strong> Use standard modern Web API <code>crypto.randomUUID()</code> which is widely supported in Node.js 14.17+ and standard browsers.</li>
|
|
112
|
+
</ul>
|
|
113
|
+
<hr>
|
|
114
|
+
<h2>๐งช Test Suite Flaws</h2>
|
|
115
|
+
<p>The test suite in <code>packages/angular/pub-sub/src/lib/pub-sub.service.spec.ts</code> passes successfully but contains hidden flaws:</p>
|
|
116
|
+
<h3>1. False Positive in GC Startup Verification</h3>
|
|
117
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-typescript"> it('should start the garbage collector', () => {
|
|
118
|
+
expect(Reflect.get(service, 'garbageCollectorSubscription')).toBeDefined();
|
|
119
|
+
});</code></pre></div><ul>
|
|
120
|
+
<li><strong>Issue:</strong> <code>garbageCollectorSubscription</code> is initialized as <code>null</code>. In Jest/Jasmine, <code>toBeDefined()</code> passes for <code>null</code> (since <code>null</code> is defined, only <code>undefined</code> is not). This test passed even though the subscription was <code>null</code> and the garbage collector failed to start.</li>
|
|
121
|
+
<li><strong>Fix:</strong> Use <code>expect(Reflect.get(service, 'garbageCollectorSubscription')).not.toBeNull();</code> or <code>toBeInstanceOf(Subscription)</code>.</li>
|
|
122
|
+
</ul>
|
|
123
|
+
<h3>2. No Assertion on Message Replay Order</h3>
|
|
124
|
+
<ul>
|
|
125
|
+
<li><strong>Issue:</strong> Tests assert that the correct number of replayed messages is received, but not the order of emission.</li>
|
|
126
|
+
<li><strong>Fix:</strong> Add assertions verifying that replayed messages are emitted in chronological order.</li>
|
|
127
|
+
</ul>
|
|
128
|
+
<h3>3. Missing Coverage for Configuration Functions</h3>
|
|
129
|
+
<ul>
|
|
130
|
+
<li><strong>Issue:</strong> No unit tests exist for <code>withMaxCacheSize</code> or <code>withGarbageCollectorInterval</code>, which is why their provider mapping bugs were not detected during local test runs.</li>
|
|
131
|
+
<li><strong>Fix:</strong> Implement unit tests validating that each configuration provider overrides the correct injection token.</li>
|
|
132
|
+
</ul>
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
</div><div class="search-results">
|
|
155
|
+
<div class="has-results">
|
|
156
|
+
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
|
157
|
+
<ul class="search-results-list"></ul>
|
|
158
|
+
</div>
|
|
159
|
+
<div class="no-results">
|
|
160
|
+
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
<!-- END CONTENT -->
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<label class="dark-mode-switch">
|
|
169
|
+
<input type="checkbox">
|
|
170
|
+
<span class="slider">
|
|
171
|
+
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
|
172
|
+
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
|
173
|
+
</svg>
|
|
174
|
+
</span>
|
|
175
|
+
</label>
|
|
176
|
+
|
|
177
|
+
<script>
|
|
178
|
+
var COMPODOC_CURRENT_PAGE_DEPTH = 0;
|
|
179
|
+
var COMPODOC_CURRENT_PAGE_CONTEXT = 'getting-started';
|
|
180
|
+
var COMPODOC_CURRENT_PAGE_URL = 'todo.html';
|
|
181
|
+
var MAX_SEARCH_RESULTS = 15;
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<script>
|
|
185
|
+
$darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
|
|
186
|
+
checkToggle(darkModeState);
|
|
187
|
+
if ($darkModeToggleSwitchers.length > 0) {
|
|
188
|
+
for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
|
|
189
|
+
$darkModeToggleSwitchers[i].addEventListener('change', function (event) {
|
|
190
|
+
darkModeState = !darkModeState;
|
|
191
|
+
toggleDarkMode(darkModeState);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<script src="./js/libs/custom-elements.min.js"></script>
|
|
198
|
+
<script src="./js/libs/lit-html.js"></script>
|
|
199
|
+
|
|
200
|
+
<script src="./js/menu-wc.js" defer></script>
|
|
201
|
+
<script nomodule src="./js/menu-wc_es5.js" defer></script>
|
|
202
|
+
|
|
203
|
+
<script src="./js/libs/bootstrap-native.js"></script>
|
|
204
|
+
|
|
205
|
+
<script src="./js/libs/es6-shim.min.js"></script>
|
|
206
|
+
<script src="./js/libs/EventDispatcher.js"></script>
|
|
207
|
+
<script src="./js/libs/promise.min.js"></script>
|
|
208
|
+
<script src="./js/libs/zepto.min.js"></script>
|
|
209
|
+
|
|
210
|
+
<script src="./js/compodoc.js"></script>
|
|
211
|
+
|
|
212
|
+
<script src="./js/tabs.js"></script>
|
|
213
|
+
<script src="./js/menu.js"></script>
|
|
214
|
+
<script src="./js/libs/clipboard.min.js"></script>
|
|
215
|
+
<script src="./js/libs/prism.js"></script>
|
|
216
|
+
<script src="./js/sourceCode.js"></script>
|
|
217
|
+
<script src="./js/search/search.js"></script>
|
|
218
|
+
<script src="./js/search/lunr.min.js"></script>
|
|
219
|
+
<script src="./js/search/search-lunr.js"></script>
|
|
220
|
+
<script src="./js/search/search_index.js"></script>
|
|
221
|
+
<script src="./js/lazy-load-graphs.js"></script>
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
</body>
|
|
225
|
+
</html>
|