kiss-for-react 1.1.0 → 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.
Files changed (155) hide show
  1. package/README.md +699 -156
  2. package/lib/cjs/ClassPersistor.js +177 -112
  3. package/lib/cjs/Esserializer/DeserializationOptions.js +4 -4
  4. package/lib/cjs/Esserializer/SerializeOptions.js +4 -4
  5. package/lib/cjs/Esserializer/builtins.js +258 -0
  6. package/lib/cjs/Esserializer/constant.js +39 -131
  7. package/lib/cjs/Esserializer/deserializer.js +226 -313
  8. package/lib/cjs/Esserializer/general.js +91 -39
  9. package/lib/cjs/Esserializer/index.js +47 -43
  10. package/lib/cjs/Esserializer/serializer.js +168 -133
  11. package/lib/cjs/Evt.js +132 -0
  12. package/lib/cjs/Hooks.js +1472 -969
  13. package/lib/cjs/KissAction.js +4635 -1333
  14. package/lib/cjs/LoadPages.js +336 -0
  15. package/lib/cjs/Persistor.js +189 -120
  16. package/lib/cjs/ProcessPersistence.js +579 -262
  17. package/lib/cjs/Store.js +4278 -1534
  18. package/lib/cjs/StoreException.js +162 -75
  19. package/lib/cjs/StoreProvider.js +88 -0
  20. package/lib/cjs/UserException.js +212 -218
  21. package/lib/cjs/Wait.js +309 -309
  22. package/lib/cjs/index.js +69 -42
  23. package/lib/cjs/server.js +54 -0
  24. package/lib/cjs/types/ClassPersistor.d.ts +143 -112
  25. package/lib/cjs/types/ClassPersistor.d.ts.map +1 -1
  26. package/lib/cjs/types/Esserializer/DeserializationOptions.d.ts +13 -6
  27. package/lib/cjs/types/Esserializer/DeserializationOptions.d.ts.map +1 -1
  28. package/lib/cjs/types/Esserializer/SerializeOptions.d.ts +11 -5
  29. package/lib/cjs/types/Esserializer/SerializeOptions.d.ts.map +1 -1
  30. package/lib/cjs/types/Esserializer/builtins.d.ts +36 -0
  31. package/lib/cjs/types/Esserializer/builtins.d.ts.map +1 -0
  32. package/lib/cjs/types/Esserializer/constant.d.ts +25 -49
  33. package/lib/cjs/types/Esserializer/constant.d.ts.map +1 -1
  34. package/lib/cjs/types/Esserializer/deserializer.d.ts +27 -17
  35. package/lib/cjs/types/Esserializer/deserializer.d.ts.map +1 -1
  36. package/lib/cjs/types/Esserializer/general.d.ts +28 -4
  37. package/lib/cjs/types/Esserializer/general.d.ts.map +1 -1
  38. package/lib/cjs/types/Esserializer/index.d.ts +33 -29
  39. package/lib/cjs/types/Esserializer/index.d.ts.map +1 -1
  40. package/lib/cjs/types/Esserializer/serializer.d.ts +14 -3
  41. package/lib/cjs/types/Esserializer/serializer.d.ts.map +1 -1
  42. package/lib/cjs/types/Evt.d.ts +124 -0
  43. package/lib/cjs/types/Evt.d.ts.map +1 -0
  44. package/lib/cjs/types/Hooks.d.ts +1174 -837
  45. package/lib/cjs/types/Hooks.d.ts.map +1 -1
  46. package/lib/cjs/types/KissAction.d.ts +5199 -1398
  47. package/lib/cjs/types/KissAction.d.ts.map +1 -1
  48. package/lib/cjs/types/LoadPages.d.ts +287 -0
  49. package/lib/cjs/types/LoadPages.d.ts.map +1 -0
  50. package/lib/cjs/types/Persistor.d.ts +187 -118
  51. package/lib/cjs/types/Persistor.d.ts.map +1 -1
  52. package/lib/cjs/types/ProcessPersistence.d.ts +197 -99
  53. package/lib/cjs/types/ProcessPersistence.d.ts.map +1 -1
  54. package/lib/cjs/types/Store.d.ts +2253 -1042
  55. package/lib/cjs/types/Store.d.ts.map +1 -1
  56. package/lib/cjs/types/StoreException.d.ts +97 -28
  57. package/lib/cjs/types/StoreException.d.ts.map +1 -1
  58. package/lib/cjs/types/StoreProvider.d.ts +80 -0
  59. package/lib/cjs/types/StoreProvider.d.ts.map +1 -0
  60. package/lib/cjs/types/UserException.d.ts +178 -169
  61. package/lib/cjs/types/UserException.d.ts.map +1 -1
  62. package/lib/cjs/types/index.d.ts +12 -9
  63. package/lib/cjs/types/index.d.ts.map +1 -1
  64. package/lib/cjs/types/server.d.ts +12 -0
  65. package/lib/cjs/types/server.d.ts.map +1 -0
  66. package/lib/cjs/types/utils.d.ts +15 -1
  67. package/lib/cjs/types/utils.d.ts.map +1 -1
  68. package/lib/cjs/utils.js +45 -7
  69. package/lib/esm/ClassPersistor.mjs +177 -0
  70. package/lib/esm/Esserializer/{DeserializationOptions.js → DeserializationOptions.mjs} +3 -3
  71. package/lib/esm/Esserializer/{SerializeOptions.js → SerializeOptions.mjs} +3 -3
  72. package/lib/esm/Esserializer/builtins.mjs +254 -0
  73. package/lib/esm/Esserializer/constant.mjs +28 -0
  74. package/lib/esm/Esserializer/deserializer.mjs +221 -0
  75. package/lib/esm/Esserializer/general.mjs +81 -0
  76. package/lib/esm/Esserializer/index.mjs +43 -0
  77. package/lib/esm/Esserializer/serializer.mjs +164 -0
  78. package/lib/esm/Evt.mjs +151 -0
  79. package/lib/esm/Hooks.mjs +1446 -0
  80. package/lib/esm/KissAction.mjs +4689 -0
  81. package/lib/esm/LoadPages.mjs +340 -0
  82. package/lib/esm/Persistor.mjs +180 -0
  83. package/lib/esm/ProcessPersistence.mjs +581 -0
  84. package/lib/esm/Store.mjs +4400 -0
  85. package/lib/esm/StoreException.mjs +153 -0
  86. package/lib/esm/StoreProvider.mjs +80 -0
  87. package/lib/esm/{UserException.js → UserException.mjs} +240 -246
  88. package/lib/esm/{Wait.js → Wait.mjs} +309 -309
  89. package/lib/esm/index.mjs +12 -9
  90. package/lib/esm/server.mjs +23 -0
  91. package/lib/esm/types/ClassPersistor.d.ts +143 -112
  92. package/lib/esm/types/ClassPersistor.d.ts.map +1 -1
  93. package/lib/esm/types/Esserializer/DeserializationOptions.d.ts +13 -6
  94. package/lib/esm/types/Esserializer/DeserializationOptions.d.ts.map +1 -1
  95. package/lib/esm/types/Esserializer/SerializeOptions.d.ts +11 -5
  96. package/lib/esm/types/Esserializer/SerializeOptions.d.ts.map +1 -1
  97. package/lib/esm/types/Esserializer/builtins.d.ts +36 -0
  98. package/lib/esm/types/Esserializer/builtins.d.ts.map +1 -0
  99. package/lib/esm/types/Esserializer/constant.d.ts +25 -49
  100. package/lib/esm/types/Esserializer/constant.d.ts.map +1 -1
  101. package/lib/esm/types/Esserializer/deserializer.d.ts +27 -17
  102. package/lib/esm/types/Esserializer/deserializer.d.ts.map +1 -1
  103. package/lib/esm/types/Esserializer/general.d.ts +28 -4
  104. package/lib/esm/types/Esserializer/general.d.ts.map +1 -1
  105. package/lib/esm/types/Esserializer/index.d.ts +33 -29
  106. package/lib/esm/types/Esserializer/index.d.ts.map +1 -1
  107. package/lib/esm/types/Esserializer/serializer.d.ts +14 -3
  108. package/lib/esm/types/Esserializer/serializer.d.ts.map +1 -1
  109. package/lib/esm/types/Evt.d.ts +124 -0
  110. package/lib/esm/types/Evt.d.ts.map +1 -0
  111. package/lib/esm/types/Hooks.d.ts +1174 -837
  112. package/lib/esm/types/Hooks.d.ts.map +1 -1
  113. package/lib/esm/types/KissAction.d.ts +5199 -1398
  114. package/lib/esm/types/KissAction.d.ts.map +1 -1
  115. package/lib/esm/types/LoadPages.d.ts +287 -0
  116. package/lib/esm/types/LoadPages.d.ts.map +1 -0
  117. package/lib/esm/types/Persistor.d.ts +187 -118
  118. package/lib/esm/types/Persistor.d.ts.map +1 -1
  119. package/lib/esm/types/ProcessPersistence.d.ts +197 -99
  120. package/lib/esm/types/ProcessPersistence.d.ts.map +1 -1
  121. package/lib/esm/types/Store.d.ts +2253 -1042
  122. package/lib/esm/types/Store.d.ts.map +1 -1
  123. package/lib/esm/types/StoreException.d.ts +97 -28
  124. package/lib/esm/types/StoreException.d.ts.map +1 -1
  125. package/lib/esm/types/StoreProvider.d.ts +80 -0
  126. package/lib/esm/types/StoreProvider.d.ts.map +1 -0
  127. package/lib/esm/types/UserException.d.ts +178 -169
  128. package/lib/esm/types/UserException.d.ts.map +1 -1
  129. package/lib/esm/types/index.d.ts +12 -9
  130. package/lib/esm/types/index.d.ts.map +1 -1
  131. package/lib/esm/types/server.d.ts +12 -0
  132. package/lib/esm/types/server.d.ts.map +1 -0
  133. package/lib/esm/types/utils.d.ts +15 -1
  134. package/lib/esm/types/utils.d.ts.map +1 -1
  135. package/lib/esm/utils.mjs +38 -0
  136. package/package.json +54 -30
  137. package/lib/cjs/UnmodifiableSetView.js +0 -53
  138. package/lib/cjs/types/UnmodifiableSetView.d.ts +0 -24
  139. package/lib/cjs/types/UnmodifiableSetView.d.ts.map +0 -1
  140. package/lib/esm/ClassPersistor.js +0 -112
  141. package/lib/esm/Esserializer/constant.js +0 -81
  142. package/lib/esm/Esserializer/deserializer.js +0 -307
  143. package/lib/esm/Esserializer/general.js +0 -34
  144. package/lib/esm/Esserializer/index.js +0 -39
  145. package/lib/esm/Esserializer/serializer.js +0 -130
  146. package/lib/esm/Hooks.js +0 -955
  147. package/lib/esm/KissAction.js +0 -1459
  148. package/lib/esm/Persistor.js +0 -113
  149. package/lib/esm/ProcessPersistence.js +0 -262
  150. package/lib/esm/Store.js +0 -1606
  151. package/lib/esm/StoreException.js +0 -69
  152. package/lib/esm/UnmodifiableSetView.js +0 -50
  153. package/lib/esm/types/UnmodifiableSetView.d.ts +0 -24
  154. package/lib/esm/types/UnmodifiableSetView.d.ts.map +0 -1
  155. package/lib/esm/utils.js +0 -3
@@ -1,119 +1,188 @@
1
- import { KissAction } from './KissAction';
2
- /**
3
- * Use it like this:
4
- *
5
- * ```ts
6
- * const persistor = new MyPersistor();
7
- *
8
- * let initialState = await persistor.readState();
9
- *
10
- * if (initialState === null) {
11
- * initialState = AppState.initialState();
12
- * await persistor.saveInitialState(initialState);
13
- * }
14
- *
15
- * const store = createStore<AppState>({
16
- * initialState: initialState,
17
- * persistor: persistor,
18
- * });
19
- * ```
20
- *
21
- * IMPORTANT: When the store is created with a Persistor, it assumes
22
- * the provided initial state was already persisted. Ensure this is the case.
23
- */
24
- export declare abstract class Persistor<St> {
25
- /**
26
- * Function `readState` should read/load the saved state from the persistence.
27
- * It will be called only once per run, when the app starts, during the store creation.
28
- *
29
- * - If the state is not yet saved (first app run), `readState` should return `null`.
30
- *
31
- * - If the saved state is valid, `readState` should return the saved state.
32
- *
33
- * - If the saved state is corrupted but can be fixed, `readState` should save the fixed
34
- * state and then return it.
35
- *
36
- * - If the saved state is corrupted and cannot be fixed, or some other serious error occurs
37
- * while reading the state, `readState` should thrown an error, with an appropriate error
38
- * message.
39
- *
40
- * Note: If an error is thrown by `readState`, Kiss will log it with `Store.log()`.
41
- *
42
- */
43
- abstract readState(): Promise<St | null>;
44
- /**
45
- * Function `deleteState` should delete/remove the saved state from the persistence.
46
- */
47
- abstract deleteState(): Promise<void>;
48
- /**
49
- * Function `persistDifference` should save the new state to the persistence,
50
- * and return a `Promise` that completes only after it is persisted.
51
- *
52
- * This new state is provided to the function as a parameter called `newState`.
53
- * For simpler apps where your state is small, you can simply persist the whole `newState`
54
- * every time.
55
- *
56
- * But for larger apps, you may compare it with the last persisted state, and persist only
57
- * the difference between them. The last persisted state is provided to the function as a
58
- * parameter called `lastPersistedState`. It may be `null` if there is no persisted state
59
- * yet (first app run).
60
- *
61
- * @param lastPersistedState The last state that was persisted. It may be null.
62
- * @param newState The new state to be persisted.
63
- */
64
- abstract persistDifference(lastPersistedState: St | null, newState: St): Promise<void>;
65
- /**
66
- * Function `saveInitialState` should save the given `state` to the persistence,
67
- * replacing any previous state that was saved.
68
- */
69
- abstract saveInitialState(state: St): Promise<void>;
70
- /**
71
- * The default throttle is 2 seconds (2000 milliseconds).
72
- * Return `null` to turn off the throttle.
73
- */
74
- get throttle(): number | null;
75
- }
76
- /**
77
- * A decorator to print persistor information to the console.
78
- * Use it like this:
79
- *
80
- * ```ts
81
- * const store = createStore<AppState>({
82
- * ...otherOptions,
83
- * persistor: new PersistorPrinterDecorator<AppState>(persistor),
84
- * });
85
- * ```
86
- */
87
- export declare class PersistorPrinterDecorator<St> implements Persistor<St> {
88
- private _persistor;
89
- constructor(persistor: Persistor<St>);
90
- readState(): Promise<St | null>;
91
- deleteState(): Promise<void>;
92
- persistDifference(lastPersistedState: St | null, newState: St): Promise<void>;
93
- saveInitialState(state: St): Promise<void>;
94
- get throttle(): number | null;
95
- }
96
- /**
97
- * A dummy persistor.
98
- */
99
- export declare class PersistorDummy<St> implements Persistor<St | null> {
100
- readState(): Promise<St | null>;
101
- deleteState(): Promise<void>;
102
- persistDifference(_lastPersistedState: St | null, _newState: St): Promise<void>;
103
- saveInitialState(_state: St | null): Promise<void>;
104
- get throttle(): number | null;
105
- }
106
- export declare class PersistException extends Error {
107
- constructor(message: string);
108
- }
109
- /**
110
- * An action that can be dispatched to force the Persistor to persist the state immediately.
111
- * It does not change the state.
112
- *
113
- * Note: This only works if the Persistor is waiting for the throttle period.
114
- * If the Persistor is currently persisting the state, this action will be ignored.
115
- */
116
- export declare class PersistAction<St> extends KissAction<St> {
117
- reduce(): null;
118
- }
1
+ import { KissAction } from './KissAction';
2
+ /**
3
+ * Use it like this:
4
+ *
5
+ * ```ts
6
+ * const store = createStore<AppState>({
7
+ * initialState: AppState.initialState(),
8
+ * persistor: new MyPersistor(),
9
+ * });
10
+ *
11
+ * await store.ready();
12
+ * store.dispatch(new InitAppAction());
13
+ * ```
14
+ *
15
+ * Do NOT read the state yourself before creating the store. When the store is created,
16
+ * Kiss calls `readState` once. If there is a saved state, it replaces the initial state in the
17
+ * store. If there is none, Kiss calls `saveInitialState` with the initial state.
18
+ *
19
+ * Until the persisted state is loaded, the store state is the `initialState`, which your UI can
20
+ * use while loading. Changes made to the state before `store.ready()` resolves may be
21
+ * overwritten by the persisted state, so wait for it before dispatching the actions that
22
+ * start your app.
23
+ */
24
+ export declare abstract class Persistor<St> {
25
+ /**
26
+ * Function `readState` should read/load the saved state from the persistence.
27
+ * It will be called only once per run, when the app starts, during the store creation.
28
+ *
29
+ * - If the state is not yet saved (first app run), `readState` should return `null`.
30
+ *
31
+ * - If the saved state is valid, `readState` should return the saved state.
32
+ *
33
+ * - If the saved state is corrupted but can be fixed, `readState` should save the fixed
34
+ * state and then return it.
35
+ *
36
+ * - If the saved state is corrupted and cannot be fixed, or some other serious error occurs
37
+ * while reading the state, `readState` should thrown an error, with an appropriate error
38
+ * message.
39
+ *
40
+ * Note: If an error is thrown by `readState`, Kiss will log it with `Store.log()`, and give
41
+ * it to the store's `errorObserver` (with a `null` action). The saved state is then
42
+ * deleted, and the initial-state is saved instead.
43
+ *
44
+ * If you prefer to fix the problem yourself, but still let the user know about it, you
45
+ * can report an error with `addError` instead of throwing. For example:
46
+ *
47
+ * ```ts
48
+ * async readState(): Promise<AppState | null> {
49
+ * try {
50
+ * return await this.read();
51
+ * } catch (error) {
52
+ * await this.deleteState();
53
+ * this.addError(new UserException('Could not read your data, so it was reset.'));
54
+ * return null;
55
+ * }
56
+ * }
57
+ * ```
58
+ */
59
+ abstract readState(): Promise<St | null>;
60
+ /**
61
+ * Function `deleteState` should delete/remove the saved state from the persistence.
62
+ */
63
+ abstract deleteState(): Promise<void>;
64
+ /**
65
+ * Function `persistDifference` should save the new state to the persistence,
66
+ * and return a `Promise` that completes only after it is persisted.
67
+ *
68
+ * This new state is provided to the function as a parameter called `newState`.
69
+ * For simpler apps where your state is small, you can simply persist the whole `newState`
70
+ * every time.
71
+ *
72
+ * But for larger apps, you may compare it with the last persisted state, and persist only
73
+ * the difference between them. The last persisted state is provided to the function as a
74
+ * parameter called `lastPersistedState`. It may be `null` if there is no persisted state
75
+ * yet (first app run).
76
+ *
77
+ * If this method throws an error, it will first be processed by `wrapError`, and then
78
+ * given to the store's `errorObserver` (with a `null` action). If the resulting error is
79
+ * a `UserException`, it is shown to the user. If it's another error, it's thrown as an
80
+ * unhandled promise rejection. If it's `null`, it's swallowed. Also, `newState` will NOT be considered persisted,
81
+ * so the next call will receive the same `lastPersistedState`. Note the save is not retried
82
+ * by itself: it will be tried again the next time the state changes. Throwing synchronously,
83
+ * instead of returning a rejected `Promise`, is handled the same way.
84
+ *
85
+ * @param lastPersistedState The last state that was persisted. It may be null.
86
+ * @param newState The new state to be persisted.
87
+ */
88
+ abstract persistDifference(lastPersistedState: St | null, newState: St): Promise<void>;
89
+ /**
90
+ * Function `saveInitialState` should save the given `state` to the persistence,
91
+ * replacing any previous state that was saved.
92
+ *
93
+ * The default implementation calls `persistDifference` with a `null` last persisted state.
94
+ *
95
+ * If this method throws, nothing is considered persisted, so the next call to
96
+ * `persistDifference` will receive a `null` last persisted state.
97
+ */
98
+ saveInitialState(state: St): Promise<void>;
99
+ /**
100
+ * The default throttle is 2 seconds (2000 milliseconds).
101
+ * Return `null` to turn off the throttle.
102
+ */
103
+ get throttle(): number | null;
104
+ /**
105
+ * If any error is thrown by `persistDifference`, you have the chance to further process
106
+ * it by using `wrapError`. Usually this is used to wrap the error inside another that
107
+ * better describes the failure. For example, you could turn a storage error into a
108
+ * `UserException`, so that it's shown to the user:
109
+ *
110
+ * ```ts
111
+ * wrapError(error: any) {
112
+ * return (error instanceof StorageError)
113
+ * ? new UserException('Could not save your data.', { hardCause: error })
114
+ * : error;
115
+ * }
116
+ * ```
117
+ *
118
+ * To ignore the error, return `null`. Note the state that failed to save is still NOT
119
+ * considered persisted.
120
+ *
121
+ * If instead of RETURNING an error you THROW an error inside `wrapError`, Kiss will use
122
+ * the thrown error instead of the original error. But it's recommended that you return it.
123
+ */
124
+ wrapError(error: any): any;
125
+ private readonly _errors;
126
+ /**
127
+ * Reports an error without throwing it. The error will be given to the store's
128
+ * `errorObserver` (with a `null` action), and if it's a `UserException`, it will be shown
129
+ * to the user. Other errors are thrown as unhandled promise rejections. Errors added here don't go through `wrapError`.
130
+ *
131
+ * This is useful in `readState`, `deleteState` and `saveInitialState`, when you can fix
132
+ * the problem yourself, but still want to let the user know about it.
133
+ */
134
+ addError(error: any): void;
135
+ /**
136
+ * Returns the first error added with `addError`, and removes it.
137
+ * Returns `null` if there are no errors. Used by Kiss.
138
+ */
139
+ getAndRemoveFirstError(): any;
140
+ }
141
+ /**
142
+ * A decorator to print persistor information to the console.
143
+ * Use it like this:
144
+ *
145
+ * ```ts
146
+ * const store = createStore<AppState>({
147
+ * ...otherOptions,
148
+ * persistor: new PersistorPrinterDecorator<AppState>(persistor),
149
+ * });
150
+ * ```
151
+ */
152
+ export declare class PersistorPrinterDecorator<St> extends Persistor<St> {
153
+ private _persistor;
154
+ constructor(persistor: Persistor<St>);
155
+ readState(): Promise<St | null>;
156
+ deleteState(): Promise<void>;
157
+ persistDifference(lastPersistedState: St | null, newState: St): Promise<void>;
158
+ saveInitialState(state: St): Promise<void>;
159
+ get throttle(): number | null;
160
+ wrapError(error: any): any;
161
+ addError(error: any): void;
162
+ getAndRemoveFirstError(): any;
163
+ }
164
+ /**
165
+ * A dummy persistor.
166
+ */
167
+ export declare class PersistorDummy<St> extends Persistor<St | null> {
168
+ readState(): Promise<St | null>;
169
+ deleteState(): Promise<void>;
170
+ persistDifference(_lastPersistedState: St | null, _newState: St): Promise<void>;
171
+ saveInitialState(_state: St | null): Promise<void>;
172
+ get throttle(): number | null;
173
+ }
174
+ export declare class PersistException extends Error {
175
+ constructor(message: string);
176
+ }
177
+ /**
178
+ * An action that can be dispatched to force the Persistor to persist the state immediately,
179
+ * ignoring the throttle period. It does not change the state.
180
+ *
181
+ * If the Persistor is currently persisting the state, the state is persisted as soon as it
182
+ * finishes (still ignoring the throttle). It does nothing if the state is already persisted,
183
+ * or if the Persistor is paused.
184
+ */
185
+ export declare class PersistAction<St> extends KissAction<St> {
186
+ reduce(): null;
187
+ }
119
188
  //# sourceMappingURL=Persistor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Persistor.d.ts","sourceRoot":"","sources":["../../../src/Persistor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,8BAAsB,SAAS,CAAC,EAAE;IAEhC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAErC;;;;;;;;;;;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U,CAAgB;gBAEtB,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;IAK9B,SAAS,IAAI,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAK/B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,iBAAiB,CACrB,kBAAkB,EAAE,EAAE,GAAG,IAAI,EAC7B,QAAQ,EAAE,EAAE,GACX,OAAO,CAAC,IAAI,CAAC;IAQV,gBAAgB,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhD,IAAI,QAAQ,IAAI,MAAM,GAAG,IAAI,CAE5B;IAED,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG;IAI1B,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAI1B,sBAAsB,IAAI,GAAG;CAG9B;AAED;;GAEG;AACH,qBAAa,cAAc,CAAC,EAAE,CAAE,SAAQ,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;IACpD,SAAS,IAAI,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAI/B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,iBAAiB,CAAC,mBAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E,gBAAgB,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,IAAI,QAAQ,IAAI,MAAM,GAAG,IAAI,CAE5B;CACF;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAU5B;AAED;;;;;;;GAOG;AACH,qBAAa,aAAa,CAAC,EAAE,CAAE,SAAQ,UAAU,CAAC,EAAE,CAAC;IACnD,MAAM,IAAI,IAAI;CAGf"}
@@ -1,100 +1,198 @@
1
- import { Persistor } from "./Persistor";
2
- import { KissAction } from "./KissAction";
3
- import { Store } from "./Store";
4
- export declare class ProcessPersistence<St> {
5
- persistor: Persistor<St>;
6
- lastPersistedState: St | null;
7
- newestState: St | null;
8
- isPersisting: boolean;
9
- isANewStateAvailable: boolean;
10
- lastPersistTime: Date;
11
- timer?: ReturnType<typeof setTimeout>;
12
- isPaused: boolean;
13
- isInit: boolean;
14
- finishedPersistingCallback: (() => void) | null;
15
- constructor(persistor: Persistor<St>, lastPersistedState: St | null);
16
- readInitialState(store: Store<St>, initialState: St): Promise<void>;
17
- private log;
18
- get throttle(): number;
19
- saveInitialState(initialState: St): Promise<void>;
20
- /**
21
- * Same as `Persistor.readState` but will remember the read state as the `lastPersistedState`.
22
- */
23
- readState(): Promise<St | null>;
24
- /**
25
- * Same as `Persistor.deleteState` but will clear the `lastPersistedState`.
26
- */
27
- deleteState(): Promise<void>;
28
- /**
29
- * Call `logOut()` when you want to delete the persisted state, and return the store
30
- * state to the given initial-state. That's usually necessary when the user logs out
31
- * of your app, or the user deletes its account, so that another user may log in,
32
- * or start a new sign-up process.
33
- *
34
- * Note: If you know about any timers or async processes that you may have started,
35
- * you should stop/cancel them all before calling this method.
36
- *
37
- * You may opt to:
38
- *
39
- * - Wait for `throttle` milliseconds to make sure all async processes that the app may
40
- * have started have time to finish. The default `throttle` is 3000 milliseconds (3 seconds).
41
- *
42
- * - Wait for all actions currently running to finish, but wait at most `actionsThrottle`
43
- * milliseconds. If the actions are not finished by then, the state will be deleted anyway.
44
- * The default `actionsThrottle` is 6000 milliseconds (6 seconds).
45
- */
46
- logOut({ store, initialState, throttle, actionsThrottle, }: {
47
- store: Store<St>;
48
- initialState: St;
49
- throttle?: number;
50
- actionsThrottle?: number;
51
- }): Promise<void>;
52
- /**
53
- * 1) If we're still persisting the last time, don't persist no matter what.
54
- * 2) If action is of type `UpdateStateAction` with `ifPersists` false,
55
- * don't persist, but consider the state as persisted.
56
- * 3) If throttle period is done (or if action is PersistAction), persist.
57
- * 4) If throttle period is NOT done, create a timer to persist as soon as it finishes.
58
- *
59
- * Return true if the persist process started.
60
- * Return false if persistence was postponed.
61
- *
62
- */
63
- process(action: KissAction<St> | null, newState: St): boolean;
64
- private _cancelTimer;
65
- private _persist;
66
- /**
67
- * Pause the `Persistor` temporarily.
68
- *
69
- * When `pause` is called, the Persistor will not start a new persistence process, until method
70
- * `resume` is called. This will not affect the current persistence process, if one is currently
71
- * running.
72
- *
73
- * Note: A persistence process starts when the `persistDifference` method is called, and
74
- * finishes when the promise returned by that method completes.
75
- *
76
- */
77
- pause(): void;
78
- /**
79
- * Persists the current state (if it's not yet persisted), then pauses the `Persistor`
80
- * temporarily.
81
- *
82
- *
83
- * When `persistAndPause` is called, this will not affect the current persistence process, if
84
- * one is currently running. If no persistence process was running, it will immediately start a
85
- * new persistence process (ignoring `throttle`).
86
- *
87
- * Then, the Persistor will not start another persistence process, until method `resume` is
88
- * called.
89
- *
90
- * Note: A persistence process starts when the `persistDifference` method is called, and
91
- * finishes when the promise returned by that method completes.
92
- *
93
- */
94
- persistAndPause(): Promise<void>;
95
- /**
96
- * Resumes persistence by the `Persistor`, after calling `pause` or `persistAndPause`.
97
- */
98
- resume(): void;
99
- }
1
+ import { Persistor } from "./Persistor";
2
+ import { KissAction } from "./KissAction";
3
+ import { Store } from "./Store";
4
+ export declare class ProcessPersistence<St> {
5
+ persistor: Persistor<St>;
6
+ lastPersistedState: St | null;
7
+ newestState: St | null;
8
+ isPersisting: boolean;
9
+ isANewStateAvailable: boolean;
10
+ lastPersistTime: Date;
11
+ timer?: ReturnType<typeof setTimeout>;
12
+ isPaused: boolean;
13
+ isInit: boolean;
14
+ isReady: boolean;
15
+ isApplyingReadState: boolean;
16
+ onReady: (() => void) | null;
17
+ private readonly _ready;
18
+ private _resolveReady;
19
+ private _persistingWaiters;
20
+ private _isPersistActionWaiting;
21
+ private _logOutsRunning;
22
+ private _logOutWaiters;
23
+ /**
24
+ * Called with the persistence errors: the errors thrown by `Persistor.persistDifference`
25
+ * (after `Persistor.wrapError`, and only if it didn't return `null`), the errors thrown
26
+ * while reading the persisted state, and the errors added with `Persistor.addError`.
27
+ * The `originalError` is the error before `Persistor.wrapError` (or the same error, if it
28
+ * didn't go through `wrapError`). If not set, the errors are logged with `Store.log()`.
29
+ * The `observeOnly` is true when the error is also thrown to the caller (by `logOut`), so it
30
+ * should only be observed (given to the `errorObserver`), and not thrown again.
31
+ */
32
+ onError: ((error: any, originalError: any, observeOnly: boolean) => void) | null;
33
+ constructor(persistor: Persistor<St>, lastPersistedState: St | null);
34
+ /**
35
+ * Resolves when the persisted state has been read (or failed to read) at startup.
36
+ * Never rejects.
37
+ */
38
+ ready(): Promise<void>;
39
+ readInitialState(store: Store<St>, initialState: St): Promise<void>;
40
+ private _readInitialState;
41
+ private log;
42
+ /**
43
+ * Gives the error to `onError`, or logs it if `onError` is not set.
44
+ */
45
+ private reportError;
46
+ /**
47
+ * Reports the errors added with `Persistor.addError`, removing them from the persistor.
48
+ */
49
+ processAddedErrors(): void;
50
+ get throttle(): number;
51
+ /**
52
+ * Same as `Persistor.saveInitialState` but will remember the `initialState` as the
53
+ * `lastPersistedState`. If a save is running, waits for it to finish first, so that it can't
54
+ * overwrite the `initialState` later.
55
+ */
56
+ saveInitialState(initialState: St): Promise<void>;
57
+ /**
58
+ * Same as `Persistor.readState` but will remember the read state as the `lastPersistedState`.
59
+ * If a save is running, waits for it to finish first, so that it reads the saved state, and
60
+ * so that the save can't change the `lastPersistedState` later.
61
+ */
62
+ readState(): Promise<St | null>;
63
+ /**
64
+ * Same as `Persistor.deleteState` but will clear the `lastPersistedState`.
65
+ * If a save is running, waits for it to finish first, so that it can't put the deleted
66
+ * state back later.
67
+ */
68
+ deleteState(): Promise<void>;
69
+ /**
70
+ * Runs the `operation` when no other persistence operation is running, so that they don't
71
+ * overlap. While it runs, state changes are not saved. They are saved when it finishes, if
72
+ * necessary.
73
+ */
74
+ private _runAlone;
75
+ private _startOperation;
76
+ /**
77
+ * Called when a persistence operation finishes (even if it failed). If the state may have
78
+ * changed while it was running, persists it if necessary.
79
+ */
80
+ private _finishOperation;
81
+ /**
82
+ * Call `logOut()` when you want to delete the persisted state, and return the store
83
+ * state to the given initial-state. That's usually necessary when the user logs out
84
+ * of your app, or the user deletes its account, so that another user may log in,
85
+ * or start a new sign-up process.
86
+ *
87
+ * Note: If you know about any timers or async processes that you may have started,
88
+ * you should stop/cancel them all before calling this method.
89
+ *
90
+ * You may opt to:
91
+ *
92
+ * - Wait for `throttle` milliseconds to make sure all async processes that the app may
93
+ * have started have time to finish. The default `throttle` is 3000 milliseconds (3 seconds).
94
+ *
95
+ * - Wait for all actions currently running to finish, but wait at most `actionsThrottle`
96
+ * milliseconds. If the actions are not finished by then, the state will be deleted anyway.
97
+ * The default `actionsThrottle` is 6000 milliseconds (6 seconds).
98
+ *
99
+ * The result of the actions dispatched before logOut is discarded, and so are the actions
100
+ * they dispatch after it.
101
+ *
102
+ * Same as `store.logOut`. See it for more details.
103
+ */
104
+ logOut({ store, initialState, throttle, actionsThrottle, }: {
105
+ store: Store<St>;
106
+ initialState: St;
107
+ throttle?: number;
108
+ actionsThrottle?: number;
109
+ }): Promise<void>;
110
+ /**
111
+ * Resolves when no `logOut` is running anymore.
112
+ * Only call it while `_logOutsRunning` is more than zero.
113
+ */
114
+ private _waitForLogOut;
115
+ /**
116
+ * 1) If we're still persisting the last time, don't persist no matter what.
117
+ * Instead, check again when it finishes.
118
+ * 2) If action is of type `UpdateStateAction` with `ifPersists` false,
119
+ * don't persist, but consider the state as persisted (if no earlier change is waiting to
120
+ * be saved). This is done even while the persistor is paused.
121
+ * 3) If throttle period is done (or if action is PersistAction), persist.
122
+ * 4) If throttle period is NOT done, create a timer to persist as soon as it finishes.
123
+ *
124
+ * Return true if the persist process started.
125
+ * Return false if persistence was postponed.
126
+ *
127
+ */
128
+ process(action: KissAction<St> | null, newState: St): boolean;
129
+ /**
130
+ * Same as `process`, but if `ignoreThrottle` is true, the throttle is ignored,
131
+ * as if the action were a `PersistAction`.
132
+ */
133
+ private _process;
134
+ private _cancelTimer;
135
+ /**
136
+ * Resolves when the persistence process currently running finishes.
137
+ * Only call it while `isPersisting` is true.
138
+ *
139
+ * Note we use the `isPersisting` flag, and don't keep the promise of the running process.
140
+ * When `persistDifference` throws synchronously, instead of returning a rejected promise,
141
+ * `_persist` finishes before it even returns its promise. A kept promise would then never be
142
+ * cleared, and waiting for it in a loop would freeze the app.
143
+ */
144
+ private _waitForPersisting;
145
+ /**
146
+ * Returns the error (after `Persistor.wrapError`) if the save failed, or `null` if it
147
+ * succeeded, or if `wrapError` swallowed the error. If `observeOnly` is true, the error is
148
+ * only observed, since the caller throws it.
149
+ */
150
+ private _persist;
151
+ /**
152
+ * Pause the `Persistor` temporarily.
153
+ *
154
+ * When `pause` is called, the Persistor will not start a new persistence process, until method
155
+ * `resume` is called. This will not affect the current persistence process, if one is currently
156
+ * running.
157
+ *
158
+ * Note: A persistence process starts when the `persistDifference` method is called, and
159
+ * finishes when the promise returned by that method completes.
160
+ *
161
+ */
162
+ pause(): void;
163
+ /**
164
+ * For Kiss internal use only. Called by `store.dispose()`. Pauses the persistor, and cancels
165
+ * the pending save (a state change waiting for the throttle). A save that is already running
166
+ * still finishes.
167
+ */
168
+ dispose(): void;
169
+ /**
170
+ * Persists the current state (if it's not yet persisted), then pauses the `Persistor`
171
+ * temporarily.
172
+ *
173
+ *
174
+ * When `persistAndPause` is called while the persisted state is still being read, while a
175
+ * `logOut` is running, or while a persistence process is running, it waits for them to
176
+ * finish. Note logOut persists its initial-state, and the state before it is never persisted. Then, if the current state is
177
+ * not yet persisted, it immediately starts a new persistence process (ignoring `throttle`).
178
+ * The returned promise completes when the current state is persisted.
179
+ *
180
+ * If the save fails, the returned promise still resolves. It never rejects. This is on
181
+ * purpose, not a bug: this method is usually called when the app is shutting down or going to
182
+ * the background, and then the app can't recover from a failed save anyway. The error is not
183
+ * lost: it's reported (see `onError`) before the promise resolves, so it can be logged.
184
+ *
185
+ * Then, the Persistor will not start another persistence process, until method `resume` is
186
+ * called.
187
+ *
188
+ * Note: A persistence process starts when the `persistDifference` method is called, and
189
+ * finishes when the promise returned by that method completes.
190
+ *
191
+ */
192
+ persistAndPause(): Promise<void>;
193
+ /**
194
+ * Resumes persistence by the `Persistor`, after calling `pause` or `persistAndPause`.
195
+ */
196
+ resume(): void;
197
+ }
100
198
  //# sourceMappingURL=ProcessPersistence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessPersistence.d.ts","sourceRoot":"","sources":["../../../src/ProcessPersistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,UAAU,EAAqB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,kBAAkB,CAAC,EAAE;IAChC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IACzB,kBAAkB,EAAE,EAAE,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC;IACvB,YAAY,UAAS;IACrB,oBAAoB,UAAS;IAC7B,eAAe,EAAE,IAAI,CAAc;IACnC,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IACtC,QAAQ,UAAS;IACjB,MAAM,UAAS;IACf,0BAA0B,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;gBAE3C,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,EAAE,kBAAkB,EAAE,EAAE,GAAG,IAAI;IAM7D,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE;IAuCzD,OAAO,CAAC,GAAG;IAQX,IAAI,QAAQ,IAAI,MAAM,CAErB;IAEK,gBAAgB,CAAC,YAAY,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAMrC;;OAEG;IAC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