@rxap/ngx-memory 19.0.4 โ†’ 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.
Files changed (68) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/compodoc/changelog.html +16 -0
  3. package/compodoc/js/menu-wc.js +5 -0
  4. package/compodoc/js/menu-wc_es5.js +1 -1
  5. package/compodoc/js/search/search_index.js +2 -2
  6. package/compodoc/properties.html +1 -1
  7. package/compodoc/todo.html +232 -0
  8. package/docs/documentation.json +95 -95
  9. package/docs/html/classes/EphemeralStorageService.html +3 -3
  10. package/docs/html/classes/LocalStorageService.html +3 -3
  11. package/docs/html/classes/MockStorage.html +8 -8
  12. package/docs/html/classes/SessionStorageService.html +3 -3
  13. package/docs/html/classes/StorageService.html +3 -3
  14. package/docs/html/functions/LocalStorage.html +2 -2
  15. package/docs/html/functions/SessionStorage.html +2 -2
  16. package/docs/html/functions/StorageGet.html +1 -1
  17. package/docs/html/functions/StorageHas.html +1 -1
  18. package/docs/html/functions/StorageKey.html +1 -1
  19. package/docs/html/functions/StorageRemove.html +1 -1
  20. package/docs/html/functions/StorageSet.html +1 -1
  21. package/docs/html/functions/WebStorage.html +1 -1
  22. package/docs/html/functions/getExpired.html +1 -1
  23. package/docs/html/functions/stringify.html +1 -1
  24. package/docs/html/hierarchy.html +1 -1
  25. package/docs/html/index.html +2 -2
  26. package/docs/html/modules.html +1 -1
  27. package/docs/html/types/ExpiredUnit.html +2 -2
  28. package/docs/html/variables/isBrowser.html +2 -2
  29. package/docs/markdown/README.md +1 -1
  30. package/docs/markdown/classes/EphemeralStorageService.md +8 -8
  31. package/docs/markdown/classes/LocalStorageService.md +8 -8
  32. package/docs/markdown/classes/MockStorage.md +9 -9
  33. package/docs/markdown/classes/SessionStorageService.md +8 -8
  34. package/docs/markdown/classes/StorageService.md +8 -8
  35. package/docs/markdown/functions/LocalStorage.md +2 -2
  36. package/docs/markdown/functions/SessionStorage.md +2 -2
  37. package/docs/markdown/functions/StorageGet.md +2 -2
  38. package/docs/markdown/functions/StorageHas.md +2 -2
  39. package/docs/markdown/functions/StorageKey.md +2 -2
  40. package/docs/markdown/functions/StorageRemove.md +2 -2
  41. package/docs/markdown/functions/StorageSet.md +2 -2
  42. package/docs/markdown/functions/WebStorage.md +2 -2
  43. package/docs/markdown/functions/getExpired.md +2 -2
  44. package/docs/markdown/functions/stringify.md +2 -2
  45. package/docs/markdown/globals.md +2 -2
  46. package/docs/markdown/type-aliases/ExpiredUnit.md +2 -2
  47. package/docs/markdown/variables/isBrowser.md +2 -2
  48. package/docs/wiki/Class.EphemeralStorageService.md +7 -7
  49. package/docs/wiki/Class.LocalStorageService.md +7 -7
  50. package/docs/wiki/Class.MockStorage.md +8 -8
  51. package/docs/wiki/Class.SessionStorageService.md +7 -7
  52. package/docs/wiki/Class.StorageService.md +7 -7
  53. package/docs/wiki/Function.LocalStorage.md +1 -1
  54. package/docs/wiki/Function.SessionStorage.md +1 -1
  55. package/docs/wiki/Function.StorageGet.md +1 -1
  56. package/docs/wiki/Function.StorageHas.md +1 -1
  57. package/docs/wiki/Function.StorageKey.md +1 -1
  58. package/docs/wiki/Function.StorageRemove.md +1 -1
  59. package/docs/wiki/Function.StorageSet.md +1 -1
  60. package/docs/wiki/Function.WebStorage.md +1 -1
  61. package/docs/wiki/Function.getExpired.md +1 -1
  62. package/docs/wiki/Function.stringify.md +1 -1
  63. package/docs/wiki/TypeAlias.ExpiredUnit.md +1 -1
  64. package/docs/wiki/Variable.isBrowser.md +1 -1
  65. package/docs/wiki/globals.md +1 -1
  66. package/fesm2022/rxap-ngx-memory.mjs +12 -12
  67. package/fesm2022/rxap-ngx-memory.mjs.map +1 -1
  68. package/package.json +2 -3
@@ -102,7 +102,7 @@
102
102
  </ol>
103
103
  <ul class="properties-list">
104
104
  <li>
105
- <b>Version</b> : 19.0.4</li>
105
+ <b>Version</b> : 19.1.0-dev.0</li>
106
106
  <li>
107
107
  <b>Description</b> : This package provides Angular services and decorators for interacting with web storage (localStorage and sessionStorage) and in-memory storage. It offers a simple way to manage data persistence with expiration options and provides decorators for binding class properties directly to storage values. The package includes services for local storage, session storage, and ephemeral (in-memory) storage.
108
108
  </li>
@@ -0,0 +1,232 @@
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-memory</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-memory</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: Angular Memory Library Audit Findings</h1>
86
+ <p>This document outlines the findings and recommended improvements identified during the audit of the <code>@rxap/ngx-memory</code> (<code>angular-memory</code>) project.</p>
87
+ <hr>
88
+ <h2>๐Ÿšจ Critical Bugs</h2>
89
+ <h3>1. Silent Interception and Overwrite in <code>WebStorage</code> Decorator Setter</h3>
90
+ <ul>
91
+ <li><strong>Location:</strong> <code>src/lib/decorators/web-storage.ts</code> (Lines 36โ€“45)</li>
92
+ <li><strong>Problem:</strong>
93
+ The setter in the <code>WebStorage</code> decorator intercepts the initial assignment if the internal <code>propertyValue</code> is <code>undefined</code>. It checks if <code>StorageHas(storage, storageKey)</code> is true. If it is, it loads the storage value and <strong>returns immediately</strong>, ignoring the newly assigned value:<b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">set: (value: unknown) =&gt; {
94
+ if (propertyValue === undefined) {
95
+ if (StorageHas(storage, storageKey)) {
96
+ propertyValue = StorageGet(storage, storageKey);
97
+ return; // &lt;--- SILENTLY IGNORES THE ASSIGNED VALUE!
98
+ }
99
+ }
100
+ propertyValue = value;
101
+ ...
102
+ }</code></pre></div>While this was designed to stop TS property initializers (e.g., <code>@LocalStorage() prop = &#39;default&#39;</code>) from overwriting existing storage values, it introduces a severe race condition and state-dependent bug.
103
+ <strong>If a property is declared without an initializer:</strong><b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">&#64;LocalStorage() myProperty?: string;</code></pre></div>The first call to <code>myComponent.myProperty = &#39;newValue&#39;</code> will have <code>propertyValue === undefined</code>. If local storage already contains a value (e.g., <code>&#39;oldValue&#39;</code>), the setter will ignore <code>&#39;newValue&#39;</code>, set <code>propertyValue</code> to <code>&#39;oldValue&#39;</code>, and return. The assignment is silently dropped!</li>
104
+ <li><strong>Recommended Fix:</strong>
105
+ Instead of overloading the setter with state checks on <code>propertyValue === undefined</code>, use a unique Symbol or boolean flag (e.g. <code>isInitialized</code>) to track whether the property has been initialized, or avoid setter interception entirely. Let the getter resolve defaults when the underlying storage value is empty, and let the setter always write the value when called explicitly after construction.</li>
106
+ </ul>
107
+ <hr>
108
+ <h2>๐Ÿ“ Architectural Debt &amp; Anti-Patterns</h2>
109
+ <h3>1. Rigid/Incompatible Storage Format in <code>StorageGet</code></h3>
110
+ <ul>
111
+ <li><strong>Location:</strong> <code>src/lib/storage-utility.ts</code> (Lines 20โ€“35)</li>
112
+ <li><strong>Problem:</strong>
113
+ <code>StorageGet</code> expects every item in storage to be a JSON string representing an object with <code>_value</code> and optional <code>_expired</code> properties. If a value was set externally (by another library, standard Web APIs, or legacy code) as a plain string, number, or standard JSON object without a <code>_value</code> key:<ol>
114
+ <li><code>parse(...)</code> catches the parse error and returns the original string or parsed object.</li>
115
+ <li>The check <code>typeof value === &#39;object&#39;</code> might fail (for strings) or succeed (for plain objects).</li>
116
+ <li>But finally, it returns <code>value._value ?? null</code>. Since <code>value</code> doesn&#39;t have <code>_value</code>, it returns <code>null</code>!
117
+ This makes the library completely incompatible with standard storage entries, reducing interoperability.</li>
118
+ </ol>
119
+ </li>
120
+ <li><strong>Recommended Fix:</strong>
121
+ Make the storage format backward-compatible. If the parsed value is an object containing <code>_value</code>, extract it. Otherwise, return the parsed value (or the plain string) as-is. E.g.:<b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">if (value &amp;&amp; typeof value === &#39;object&#39; &amp;&amp; &#39;_value&#39; in value) {
122
+ // Treat as wrapped rxap-memory item with optional expiry
123
+ ...
124
+ return value._value;
125
+ }
126
+ // Treat as a standard/external plain value
127
+ return value;</code></pre></div></li>
128
+ </ul>
129
+ <hr>
130
+ <h2>๐Ÿงช Test Coverage &amp; Diagnostics</h2>
131
+ <ul>
132
+ <li><strong>Current Status:</strong> All 29 unit tests pass.</li>
133
+ <li><strong>Missing Tests:</strong><ul>
134
+ <li><strong>No Initializer Setter Bug:</strong> There is no unit test confirming that an uninitialized property decorated with <code>@WebStorage</code> can be set when local storage already has a value.</li>
135
+ <li><strong>Peer Dependency / Init Generator Tests:</strong> There are no tests verifying <code>initGenerator</code> behavior, especially around dependency placement and routing.</li>
136
+ </ul>
137
+ </li>
138
+ <li><strong>Action Item:</strong> Add a regression test to <code>src/lib/decorators/web-storage.spec.ts</code> demonstrating the setter override behavior when no initial value is defined on the class property.</li>
139
+ </ul>
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ </div><div class="search-results">
162
+ <div class="has-results">
163
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
164
+ <ul class="search-results-list"></ul>
165
+ </div>
166
+ <div class="no-results">
167
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ <!-- END CONTENT -->
172
+ </div>
173
+ </div>
174
+
175
+ <label class="dark-mode-switch">
176
+ <input type="checkbox">
177
+ <span class="slider">
178
+ <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">
179
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
180
+ </svg>
181
+ </span>
182
+ </label>
183
+
184
+ <script>
185
+ var COMPODOC_CURRENT_PAGE_DEPTH = 0;
186
+ var COMPODOC_CURRENT_PAGE_CONTEXT = 'getting-started';
187
+ var COMPODOC_CURRENT_PAGE_URL = 'todo.html';
188
+ var MAX_SEARCH_RESULTS = 15;
189
+ </script>
190
+
191
+ <script>
192
+ $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
193
+ checkToggle(darkModeState);
194
+ if ($darkModeToggleSwitchers.length > 0) {
195
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
196
+ $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
197
+ darkModeState = !darkModeState;
198
+ toggleDarkMode(darkModeState);
199
+ });
200
+ }
201
+ }
202
+ </script>
203
+
204
+ <script src="./js/libs/custom-elements.min.js"></script>
205
+ <script src="./js/libs/lit-html.js"></script>
206
+
207
+ <script src="./js/menu-wc.js" defer></script>
208
+ <script nomodule src="./js/menu-wc_es5.js" defer></script>
209
+
210
+ <script src="./js/libs/bootstrap-native.js"></script>
211
+
212
+ <script src="./js/libs/es6-shim.min.js"></script>
213
+ <script src="./js/libs/EventDispatcher.js"></script>
214
+ <script src="./js/libs/promise.min.js"></script>
215
+ <script src="./js/libs/zepto.min.js"></script>
216
+
217
+ <script src="./js/compodoc.js"></script>
218
+
219
+ <script src="./js/tabs.js"></script>
220
+ <script src="./js/menu.js"></script>
221
+ <script src="./js/libs/clipboard.min.js"></script>
222
+ <script src="./js/libs/prism.js"></script>
223
+ <script src="./js/sourceCode.js"></script>
224
+ <script src="./js/search/search.js"></script>
225
+ <script src="./js/search/lunr.min.js"></script>
226
+ <script src="./js/search/search-lunr.js"></script>
227
+ <script src="./js/search/search_index.js"></script>
228
+ <script src="./js/lazy-load-graphs.js"></script>
229
+
230
+
231
+ </body>
232
+ </html>