react-native-onyx 2.0.24 → 2.0.26
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/Logger.d.ts +6 -2
- package/dist/Logger.js +8 -1
- package/dist/index.d.ts +2 -2
- package/dist/storage/index.js +1 -1
- package/dist/useOnyx.d.ts +1 -1
- package/package.json +1 -1
package/dist/Logger.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type LogData = {
|
|
2
2
|
message: string;
|
|
3
|
-
level: 'alert' | 'info';
|
|
3
|
+
level: 'alert' | 'info' | 'hmmm';
|
|
4
4
|
};
|
|
5
5
|
type LoggerCallback = (data: LogData) => void;
|
|
6
6
|
/**
|
|
@@ -15,4 +15,8 @@ declare function logAlert(message: string): void;
|
|
|
15
15
|
* Send an info message to the logger
|
|
16
16
|
*/
|
|
17
17
|
declare function logInfo(message: string): void;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Send an hmmm message to the logger
|
|
20
|
+
*/
|
|
21
|
+
declare function logHmmm(message: string): void;
|
|
22
|
+
export { registerLogger, logInfo, logAlert, logHmmm };
|
package/dist/Logger.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logAlert = exports.logInfo = exports.registerLogger = void 0;
|
|
3
|
+
exports.logHmmm = exports.logAlert = exports.logInfo = exports.registerLogger = void 0;
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5
5
|
let logger = () => { };
|
|
6
6
|
/**
|
|
@@ -24,3 +24,10 @@ function logInfo(message) {
|
|
|
24
24
|
logger({ message: `[Onyx] ${message}`, level: 'info' });
|
|
25
25
|
}
|
|
26
26
|
exports.logInfo = logInfo;
|
|
27
|
+
/**
|
|
28
|
+
* Send an hmmm message to the logger
|
|
29
|
+
*/
|
|
30
|
+
function logHmmm(message) {
|
|
31
|
+
logger({ message: `[Onyx] ${message}`, level: 'hmmm' });
|
|
32
|
+
}
|
|
33
|
+
exports.logHmmm = logHmmm;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Onyx from './Onyx';
|
|
2
2
|
import type { OnyxUpdate, ConnectOptions } from './Onyx';
|
|
3
3
|
import type { CustomTypeOptions, OnyxCollection, OnyxEntry, NullishDeep, KeyValueMapping, OnyxKey, Selector, WithOnyxInstanceState, OnyxValue } from './types';
|
|
4
|
-
import type { UseOnyxResult, FetchStatus } from './useOnyx';
|
|
4
|
+
import type { UseOnyxResult, FetchStatus, ResultMetadata } from './useOnyx';
|
|
5
5
|
import useOnyx from './useOnyx';
|
|
6
6
|
import withOnyx from './withOnyx';
|
|
7
7
|
export default Onyx;
|
|
8
8
|
export { withOnyx, useOnyx };
|
|
9
|
-
export type { CustomTypeOptions, OnyxCollection, OnyxEntry, OnyxUpdate, ConnectOptions, NullishDeep, KeyValueMapping, OnyxKey, Selector, WithOnyxInstanceState, UseOnyxResult, OnyxValue, FetchStatus, };
|
|
9
|
+
export type { CustomTypeOptions, OnyxCollection, OnyxEntry, OnyxUpdate, ConnectOptions, NullishDeep, KeyValueMapping, OnyxKey, Selector, WithOnyxInstanceState, UseOnyxResult, OnyxValue, FetchStatus, ResultMetadata, };
|
package/dist/storage/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const initPromise = new Promise((resolve) => {
|
|
|
40
40
|
* Degrade performance by removing the storage provider and only using cache
|
|
41
41
|
*/
|
|
42
42
|
function degradePerformance(error) {
|
|
43
|
-
Logger.
|
|
43
|
+
Logger.logHmmm(`Error while using ${provider.name}. Falling back to only using cache and dropping storage.\n Error: ${error.message}\n Stack: ${error.stack}\n Cause: ${error.cause}`);
|
|
44
44
|
console.error(error);
|
|
45
45
|
provider = MemoryOnlyProvider_1.default;
|
|
46
46
|
}
|
package/dist/useOnyx.d.ts
CHANGED
|
@@ -33,4 +33,4 @@ type ResultMetadata = {
|
|
|
33
33
|
type UseOnyxResult<TKey extends OnyxKey, TValue> = [CachedValue<TKey, TValue>, ResultMetadata];
|
|
34
34
|
declare function useOnyx<TKey extends OnyxKey, TReturnValue = OnyxValue<TKey>>(key: TKey, options?: UseOnyxOptions<TKey, TReturnValue>): UseOnyxResult<TKey, TReturnValue>;
|
|
35
35
|
export default useOnyx;
|
|
36
|
-
export type { UseOnyxResult, FetchStatus };
|
|
36
|
+
export type { UseOnyxResult, ResultMetadata, FetchStatus };
|