kiss-for-react 1.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.
- package/LICENSE +21 -0
- package/README.md +555 -0
- package/lib/cjs/ClassPersistor.js +112 -0
- package/lib/cjs/Esserializer/DeserializationOptions.js +4 -0
- package/lib/cjs/Esserializer/SerializeOptions.js +4 -0
- package/lib/cjs/Esserializer/constant.js +131 -0
- package/lib/cjs/Esserializer/deserializer.js +313 -0
- package/lib/cjs/Esserializer/general.js +39 -0
- package/lib/cjs/Esserializer/index.js +43 -0
- package/lib/cjs/Esserializer/serializer.js +133 -0
- package/lib/cjs/Hooks.js +969 -0
- package/lib/cjs/KissAction.js +1268 -0
- package/lib/cjs/Persistor.js +120 -0
- package/lib/cjs/ProcessPersistence.js +262 -0
- package/lib/cjs/Store.js +1534 -0
- package/lib/cjs/StoreException.js +75 -0
- package/lib/cjs/UnmodifiableSetView.js +53 -0
- package/lib/cjs/UserException.js +218 -0
- package/lib/cjs/Wait.js +309 -0
- package/lib/cjs/index.js +42 -0
- package/lib/cjs/types/ClassPersistor.d.ts +113 -0
- package/lib/cjs/types/ClassPersistor.d.ts.map +1 -0
- package/lib/cjs/types/Esserializer/DeserializationOptions.d.ts +7 -0
- package/lib/cjs/types/Esserializer/DeserializationOptions.d.ts.map +1 -0
- package/lib/cjs/types/Esserializer/SerializeOptions.d.ts +6 -0
- package/lib/cjs/types/Esserializer/SerializeOptions.d.ts.map +1 -0
- package/lib/cjs/types/Esserializer/constant.d.ts +50 -0
- package/lib/cjs/types/Esserializer/constant.d.ts.map +1 -0
- package/lib/cjs/types/Esserializer/deserializer.d.ts +18 -0
- package/lib/cjs/types/Esserializer/deserializer.d.ts.map +1 -0
- package/lib/cjs/types/Esserializer/general.d.ts +5 -0
- package/lib/cjs/types/Esserializer/general.d.ts.map +1 -0
- package/lib/cjs/types/Esserializer/index.d.ts +30 -0
- package/lib/cjs/types/Esserializer/index.d.ts.map +1 -0
- package/lib/cjs/types/Esserializer/serializer.d.ts +4 -0
- package/lib/cjs/types/Esserializer/serializer.d.ts.map +1 -0
- package/lib/cjs/types/Hooks.d.ts +838 -0
- package/lib/cjs/types/Hooks.d.ts.map +1 -0
- package/lib/cjs/types/KissAction.d.ts +1324 -0
- package/lib/cjs/types/KissAction.d.ts.map +1 -0
- package/lib/cjs/types/Persistor.d.ts +119 -0
- package/lib/cjs/types/Persistor.d.ts.map +1 -0
- package/lib/cjs/types/ProcessPersistence.d.ts +100 -0
- package/lib/cjs/types/ProcessPersistence.d.ts.map +1 -0
- package/lib/cjs/types/Store.d.ts +1043 -0
- package/lib/cjs/types/Store.d.ts.map +1 -0
- package/lib/cjs/types/StoreException.d.ts +29 -0
- package/lib/cjs/types/StoreException.d.ts.map +1 -0
- package/lib/cjs/types/UnmodifiableSetView.d.ts +24 -0
- package/lib/cjs/types/UnmodifiableSetView.d.ts.map +1 -0
- package/lib/cjs/types/UserException.d.ts +170 -0
- package/lib/cjs/types/UserException.d.ts.map +1 -0
- package/lib/cjs/types/Wait.d.ts +1 -0
- package/lib/cjs/types/Wait.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +10 -0
- package/lib/cjs/types/index.d.ts.map +1 -0
- package/lib/cjs/types/utils.d.ts +2 -0
- package/lib/cjs/types/utils.d.ts.map +1 -0
- package/lib/cjs/utils.js +7 -0
- package/lib/esm/ClassPersistor.js +112 -0
- package/lib/esm/Esserializer/DeserializationOptions.js +3 -0
- package/lib/esm/Esserializer/SerializeOptions.js +3 -0
- package/lib/esm/Esserializer/constant.js +81 -0
- package/lib/esm/Esserializer/deserializer.js +307 -0
- package/lib/esm/Esserializer/general.js +34 -0
- package/lib/esm/Esserializer/index.js +39 -0
- package/lib/esm/Esserializer/serializer.js +130 -0
- package/lib/esm/Hooks.js +955 -0
- package/lib/esm/KissAction.js +1368 -0
- package/lib/esm/Persistor.js +113 -0
- package/lib/esm/ProcessPersistence.js +262 -0
- package/lib/esm/Store.js +1606 -0
- package/lib/esm/StoreException.js +69 -0
- package/lib/esm/UnmodifiableSetView.js +50 -0
- package/lib/esm/UserException.js +246 -0
- package/lib/esm/Wait.js +309 -0
- package/lib/esm/index.mjs +9 -0
- package/lib/esm/types/ClassPersistor.d.ts +113 -0
- package/lib/esm/types/ClassPersistor.d.ts.map +1 -0
- package/lib/esm/types/Esserializer/DeserializationOptions.d.ts +7 -0
- package/lib/esm/types/Esserializer/DeserializationOptions.d.ts.map +1 -0
- package/lib/esm/types/Esserializer/SerializeOptions.d.ts +6 -0
- package/lib/esm/types/Esserializer/SerializeOptions.d.ts.map +1 -0
- package/lib/esm/types/Esserializer/constant.d.ts +50 -0
- package/lib/esm/types/Esserializer/constant.d.ts.map +1 -0
- package/lib/esm/types/Esserializer/deserializer.d.ts +18 -0
- package/lib/esm/types/Esserializer/deserializer.d.ts.map +1 -0
- package/lib/esm/types/Esserializer/general.d.ts +5 -0
- package/lib/esm/types/Esserializer/general.d.ts.map +1 -0
- package/lib/esm/types/Esserializer/index.d.ts +30 -0
- package/lib/esm/types/Esserializer/index.d.ts.map +1 -0
- package/lib/esm/types/Esserializer/serializer.d.ts +4 -0
- package/lib/esm/types/Esserializer/serializer.d.ts.map +1 -0
- package/lib/esm/types/Hooks.d.ts +838 -0
- package/lib/esm/types/Hooks.d.ts.map +1 -0
- package/lib/esm/types/KissAction.d.ts +1324 -0
- package/lib/esm/types/KissAction.d.ts.map +1 -0
- package/lib/esm/types/Persistor.d.ts +119 -0
- package/lib/esm/types/Persistor.d.ts.map +1 -0
- package/lib/esm/types/ProcessPersistence.d.ts +100 -0
- package/lib/esm/types/ProcessPersistence.d.ts.map +1 -0
- package/lib/esm/types/Store.d.ts +1043 -0
- package/lib/esm/types/Store.d.ts.map +1 -0
- package/lib/esm/types/StoreException.d.ts +29 -0
- package/lib/esm/types/StoreException.d.ts.map +1 -0
- package/lib/esm/types/UnmodifiableSetView.d.ts +24 -0
- package/lib/esm/types/UnmodifiableSetView.d.ts.map +1 -0
- package/lib/esm/types/UserException.d.ts +170 -0
- package/lib/esm/types/UserException.d.ts.map +1 -0
- package/lib/esm/types/Wait.d.ts +1 -0
- package/lib/esm/types/Wait.d.ts.map +1 -0
- package/lib/esm/types/index.d.ts +10 -0
- package/lib/esm/types/index.d.ts.map +1 -0
- package/lib/esm/types/utils.d.ts +2 -0
- package/lib/esm/types/utils.d.ts.map +1 -0
- package/lib/esm/utils.js +3 -0
- package/package.json +87 -0
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OptimisticUpdate = exports.UserException = exports.StoreException = exports.useDispatcher = exports.useDispatchSync = exports.useDispatchAndWaitAll = exports.useDispatchAndWait = exports.useDispatchAll = exports.useDispatch = exports.useClearExceptionFor = exports.useExceptionFor = exports.useIsFailed = exports.useIsWaiting = exports.StoreProvider = exports.useSelector = exports.useSelect = exports.useAllState = exports.useStore = exports.createStore = exports.Store = exports.ActionStatus = exports.UserExceptionAction = exports.KissAction = exports.ProcessPersistence = exports.ClassPersistor = exports.UpdateStateAction = exports.PersistAction = exports.PersistException = exports.PersistorDummy = exports.PersistorPrinterDecorator = exports.Persistor = void 0;
|
|
4
|
+
const Persistor_1 = require("./Persistor");
|
|
5
|
+
Object.defineProperty(exports, "PersistAction", { enumerable: true, get: function () { return Persistor_1.PersistAction; } });
|
|
6
|
+
Object.defineProperty(exports, "PersistException", { enumerable: true, get: function () { return Persistor_1.PersistException; } });
|
|
7
|
+
Object.defineProperty(exports, "Persistor", { enumerable: true, get: function () { return Persistor_1.Persistor; } });
|
|
8
|
+
Object.defineProperty(exports, "PersistorDummy", { enumerable: true, get: function () { return Persistor_1.PersistorDummy; } });
|
|
9
|
+
Object.defineProperty(exports, "PersistorPrinterDecorator", { enumerable: true, get: function () { return Persistor_1.PersistorPrinterDecorator; } });
|
|
10
|
+
const ClassPersistor_1 = require("./ClassPersistor");
|
|
11
|
+
Object.defineProperty(exports, "ClassPersistor", { enumerable: true, get: function () { return ClassPersistor_1.ClassPersistor; } });
|
|
12
|
+
const ProcessPersistence_1 = require("./ProcessPersistence");
|
|
13
|
+
Object.defineProperty(exports, "ProcessPersistence", { enumerable: true, get: function () { return ProcessPersistence_1.ProcessPersistence; } });
|
|
14
|
+
const KissAction_1 = require("./KissAction");
|
|
15
|
+
Object.defineProperty(exports, "ActionStatus", { enumerable: true, get: function () { return KissAction_1.ActionStatus; } });
|
|
16
|
+
Object.defineProperty(exports, "OptimisticUpdate", { enumerable: true, get: function () { return KissAction_1.OptimisticUpdate; } });
|
|
17
|
+
Object.defineProperty(exports, "KissAction", { enumerable: true, get: function () { return KissAction_1.KissAction; } });
|
|
18
|
+
Object.defineProperty(exports, "UserExceptionAction", { enumerable: true, get: function () { return KissAction_1.UserExceptionAction; } });
|
|
19
|
+
Object.defineProperty(exports, "UpdateStateAction", { enumerable: true, get: function () { return KissAction_1.UpdateStateAction; } });
|
|
20
|
+
const Store_1 = require("./Store");
|
|
21
|
+
Object.defineProperty(exports, "Store", { enumerable: true, get: function () { return Store_1.Store; } });
|
|
22
|
+
Object.defineProperty(exports, "createStore", { enumerable: true, get: function () { return Store_1.createStore; } });
|
|
23
|
+
Object.defineProperty(exports, "StoreProvider", { enumerable: true, get: function () { return Store_1.StoreProvider; } });
|
|
24
|
+
const Hooks_1 = require("./Hooks");
|
|
25
|
+
Object.defineProperty(exports, "useAllState", { enumerable: true, get: function () { return Hooks_1.useAllState; } });
|
|
26
|
+
Object.defineProperty(exports, "useClearExceptionFor", { enumerable: true, get: function () { return Hooks_1.useClearExceptionFor; } });
|
|
27
|
+
Object.defineProperty(exports, "useDispatch", { enumerable: true, get: function () { return Hooks_1.useDispatch; } });
|
|
28
|
+
Object.defineProperty(exports, "useDispatchAll", { enumerable: true, get: function () { return Hooks_1.useDispatchAll; } });
|
|
29
|
+
Object.defineProperty(exports, "useDispatchAndWait", { enumerable: true, get: function () { return Hooks_1.useDispatchAndWait; } });
|
|
30
|
+
Object.defineProperty(exports, "useDispatchAndWaitAll", { enumerable: true, get: function () { return Hooks_1.useDispatchAndWaitAll; } });
|
|
31
|
+
Object.defineProperty(exports, "useDispatcher", { enumerable: true, get: function () { return Hooks_1.useDispatcher; } });
|
|
32
|
+
Object.defineProperty(exports, "useDispatchSync", { enumerable: true, get: function () { return Hooks_1.useDispatchSync; } });
|
|
33
|
+
Object.defineProperty(exports, "useExceptionFor", { enumerable: true, get: function () { return Hooks_1.useExceptionFor; } });
|
|
34
|
+
Object.defineProperty(exports, "useIsFailed", { enumerable: true, get: function () { return Hooks_1.useIsFailed; } });
|
|
35
|
+
Object.defineProperty(exports, "useIsWaiting", { enumerable: true, get: function () { return Hooks_1.useIsWaiting; } });
|
|
36
|
+
Object.defineProperty(exports, "useSelect", { enumerable: true, get: function () { return Hooks_1.useSelect; } });
|
|
37
|
+
Object.defineProperty(exports, "useSelector", { enumerable: true, get: function () { return Hooks_1.useSelector; } });
|
|
38
|
+
Object.defineProperty(exports, "useStore", { enumerable: true, get: function () { return Hooks_1.useStore; } });
|
|
39
|
+
const StoreException_1 = require("./StoreException");
|
|
40
|
+
Object.defineProperty(exports, "StoreException", { enumerable: true, get: function () { return StoreException_1.StoreException; } });
|
|
41
|
+
const UserException_1 = require("./UserException");
|
|
42
|
+
Object.defineProperty(exports, "UserException", { enumerable: true, get: function () { return UserException_1.UserException; } });
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ClassOrEnum } from './Esserializer';
|
|
2
|
+
import { Persistor } from './Persistor';
|
|
3
|
+
/**
|
|
4
|
+
* Use it like this:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* const store = createStore<AppState>({
|
|
8
|
+
* initialState: initialState,
|
|
9
|
+
* persistor: new MyPersistor(),
|
|
10
|
+
* });
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Example for web:
|
|
14
|
+
* ```
|
|
15
|
+
* return new ClassPersistor<State>(
|
|
16
|
+
* async () => window.localStorage.getItem('state'),
|
|
17
|
+
* async (serialized) => window.localStorage.setItem('state', serialized),
|
|
18
|
+
* async () => window.localStorage.clear(),
|
|
19
|
+
* [State, TodoList, TodoItem, Filter] // All state classes the app uses.
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Example for React Native:
|
|
24
|
+
* ```
|
|
25
|
+
* return new ClassPersistor<State>(
|
|
26
|
+
* async () => AsyncStorage.getItem('state'),
|
|
27
|
+
* async (serialized) => AsyncStorage.setItem('state', serialized),
|
|
28
|
+
* async () => AsyncStorage.clear(),
|
|
29
|
+
* [State, TodoList, TodoItem, Filter] // All state classes the app uses.
|
|
30
|
+
* );
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class ClassPersistor<St> extends Persistor<St> {
|
|
34
|
+
/**
|
|
35
|
+
* Returns the serialized state. You can use this to load from localStorage or IndexedDB
|
|
36
|
+
* (in React web), or AsyncStorage (in React Native) or other.
|
|
37
|
+
* It should return a Promise that resolves to the serialized state, or to null if the state
|
|
38
|
+
* is not yet persisted.
|
|
39
|
+
*/
|
|
40
|
+
loadSerialized: () => Promise<string | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Saves the given serialized state. You can use this to save to localStorage or IndexedDB
|
|
43
|
+
* (in React web), or AsyncStorage (in React Native) or other.
|
|
44
|
+
* It should return a Promise that resolves when the state is saved.
|
|
45
|
+
*/
|
|
46
|
+
saveSerialized: (serialized: string) => Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Deletes the serialized state. You can use this to delete from the localStorage or IndexedDB
|
|
49
|
+
* (in React web), or AsyncStorage (in React Native) or other.
|
|
50
|
+
* It should return a Promise that resolves when the state is deleted.
|
|
51
|
+
*/
|
|
52
|
+
deleteSerialized: () => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* You HAVE to list here all the custom classes that are part of your state, directly or
|
|
55
|
+
* indirectly. Note: You don't need to list native JavaScript classes, like Date.
|
|
56
|
+
* For example, suppose you have a class `State` that has a property `todoList` of
|
|
57
|
+
* type `TodoList`.
|
|
58
|
+
* And the class `TodoList` has a property `items` of type `Array<TodoItem>`.
|
|
59
|
+
* Then you have to list all three classes here: `[State, TodoList, TodoItem]`.
|
|
60
|
+
*/
|
|
61
|
+
classesToSerialize: Array<ClassOrEnum>;
|
|
62
|
+
constructor(
|
|
63
|
+
/**
|
|
64
|
+
* Returns the serialized state. You can use this to load from localStorage or IndexedDB
|
|
65
|
+
* (in React web), or AsyncStorage (in React Native) or other.
|
|
66
|
+
* It should return a Promise that resolves to the serialized state, or to null if the state
|
|
67
|
+
* is not yet persisted.
|
|
68
|
+
*/
|
|
69
|
+
loadSerialized: () => Promise<string | null>,
|
|
70
|
+
/**
|
|
71
|
+
* Saves the given serialized state. You can use this to save to localStorage or IndexedDB
|
|
72
|
+
* (in React web), or AsyncStorage (in React Native) or other.
|
|
73
|
+
* It should return a Promise that resolves when the state is saved.
|
|
74
|
+
*/
|
|
75
|
+
saveSerialized: (serialized: string) => Promise<void>,
|
|
76
|
+
/**
|
|
77
|
+
* Deletes the serialized state. You can use this to delete from the localStorage or IndexedDB
|
|
78
|
+
* (in React web), or AsyncStorage (in React Native) or other.
|
|
79
|
+
* It should return a Promise that resolves when the state is deleted.
|
|
80
|
+
*/
|
|
81
|
+
deleteSerialized: () => Promise<void>,
|
|
82
|
+
/**
|
|
83
|
+
* You HAVE to list here all the custom classes that are part of your state, directly or
|
|
84
|
+
* indirectly. Note: You don't need to list native JavaScript classes, like Date.
|
|
85
|
+
* For example, suppose you have a class `State` that has a property `todoList` of
|
|
86
|
+
* type `TodoList`.
|
|
87
|
+
* And the class `TodoList` has a property `items` of type `Array<TodoItem>`.
|
|
88
|
+
* Then you have to list all three classes here: `[State, TodoList, TodoItem]`.
|
|
89
|
+
*/
|
|
90
|
+
classesToSerialize: Array<ClassOrEnum>);
|
|
91
|
+
/**
|
|
92
|
+
* Read the saved state from the persistence. Should return null if the state is not yet
|
|
93
|
+
* persisted. This method should be called only once, when the app starts, before the store
|
|
94
|
+
* is created. The state it returns may become the store's initial-state. If some error
|
|
95
|
+
* occurs while loading the info, we have to deal with it by fixing the problem. In the worse
|
|
96
|
+
* case, if we think the state is corrupted and cannot be fixed, one alternative is deleting
|
|
97
|
+
* all persisted files and returning null.
|
|
98
|
+
*/
|
|
99
|
+
readState(): Promise<St | null>;
|
|
100
|
+
/**
|
|
101
|
+
* Save an initial-state to the persistence.
|
|
102
|
+
*/
|
|
103
|
+
saveInitialState(state: St): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Delete the saved state from the persistence.
|
|
106
|
+
*/
|
|
107
|
+
deleteState(): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* We assume the state is small, and we save `newState` everytime, ignoring `lastPersistedState`.
|
|
110
|
+
*/
|
|
111
|
+
persistDifference(_lastPersistedState: St | null, newState: St): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=ClassPersistor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassPersistor.d.ts","sourceRoot":"","sources":["../../../src/ClassPersistor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,cAAc,CAAC,EAAE,CAAE,SAAQ,SAAS,CAAC,EAAE,CAAC;IAGjD;;;;;OAKG;IACI,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAEnD;;;;OAIG;IACI,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;IAE5D;;;;OAIG;IACI,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAE5C;;;;;;;OAOG;IACI,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC;;IA9B7C;;;;;OAKG;IACI,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAEnD;;;;OAIG;IACI,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;IAE5D;;;;OAIG;IACI,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAE5C;;;;;;;OAOG;IACI,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC;IAK/C;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAWrC;;OAEG;IACG,gBAAgB,CAAC,KAAK,EAAE,EAAE;IAKhC;;OAEG;IACG,WAAW;IAIjB;;OAEG;IACG,iBAAiB,CAAC,mBAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,EAAE;CAIrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeserializationOptions.d.ts","sourceRoot":"","sources":["../../../../src/Esserializer/DeserializationOptions.ts"],"names":[],"mappings":"AAGA,UAAU,kBAAkB;IAC1B,8BAA8B,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/C,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAC9B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SerializeOptions.d.ts","sourceRoot":"","sources":["../../../../src/Esserializer/SerializeOptions.ts"],"names":[],"mappings":"AAGA,UAAU,gBAAgB;IACxB,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAC/C;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
declare const ESSERIALIZER_NULL = "__ESSERIALIZER_NULL__";
|
|
2
|
+
declare const ARRAY_FIELD = "ess_arr";
|
|
3
|
+
declare const BOOLEAN_FIELD = "ess_bool";
|
|
4
|
+
declare const CLASS_NAME_FIELD = "*type";
|
|
5
|
+
declare const OPTIONS_FIELD = "ess_opt";
|
|
6
|
+
declare const TIMESTAMP_FIELD = "ess_ts";
|
|
7
|
+
declare const TO_STRING_FIELD = "ess_str";
|
|
8
|
+
declare const BUILTIN_CLASS_INT8ARRAY = "Int8Array";
|
|
9
|
+
declare const BUILTIN_CLASS_UINT8ARRAY = "Uint8Array";
|
|
10
|
+
declare const BUILTIN_CLASS_UINT8CLAMPEDARRAY = "Uint8ClampedArray";
|
|
11
|
+
declare const BUILTIN_CLASS_INT16ARRAY = "Int16Array";
|
|
12
|
+
declare const BUILTIN_CLASS_UINT16ARRAY = "Uint16Array";
|
|
13
|
+
declare const BUILTIN_CLASS_INT32ARRAY = "Int32Array";
|
|
14
|
+
declare const BUILTIN_CLASS_UINT32ARRAY = "Uint32Array";
|
|
15
|
+
declare const BUILTIN_CLASS_FLOAT32ARRAY = "Float32Array";
|
|
16
|
+
declare const BUILTIN_CLASS_FLOAT64ARRAY = "Float64Array";
|
|
17
|
+
declare const BUILTIN_CLASS_BIGINT64ARRAY = "BigInt64Array";
|
|
18
|
+
declare const BUILTIN_CLASS_BIGUINT64ARRAY = "BigUint64Array";
|
|
19
|
+
declare const BUILTIN_CLASS_ARRAYBUFFER = "ArrayBuffer";
|
|
20
|
+
declare const BUILTIN_CLASS_SHAREDARRAYBUFFER = "SharedArrayBuffer";
|
|
21
|
+
declare const BUILTIN_CLASS_BOOLEAN = "Boolean";
|
|
22
|
+
declare const BUILTIN_CLASS_DATAVIEW = "DataView";
|
|
23
|
+
declare const BUILTIN_CLASS_DATE = "Date";
|
|
24
|
+
declare const BUILTIN_CLASS_INTL_COLLATOR = "Collator";
|
|
25
|
+
declare const BUILTIN_CLASS_INTL_DATETIMEFORMAT = "DateTimeFormat";
|
|
26
|
+
declare const BUILTIN_CLASS_INTL_LISTFORMAT = "ListFormat";
|
|
27
|
+
declare const BUILTIN_CLASS_INTL_LOCALE = "Locale";
|
|
28
|
+
declare const BUILTIN_CLASS_INTL_NUMBERFORMAT = "NumberFormat";
|
|
29
|
+
declare const BUILTIN_CLASS_INTL_PLURALRULES = "PluralRules";
|
|
30
|
+
declare const BUILTIN_CLASS_INTL_RELATIVETIMEFORMAT = "RelativeTimeFormat";
|
|
31
|
+
declare const BUILTIN_CLASS_REGEXP = "RegExp";
|
|
32
|
+
declare const BUILTIN_CLASS_SET = "Set";
|
|
33
|
+
declare const BUILTIN_CLASS_STRING = "String";
|
|
34
|
+
declare const BUILTIN_CLASS_ERROR = "Error";
|
|
35
|
+
declare const BUILTIN_CLASS_EVAL_ERROR = "EvalError";
|
|
36
|
+
declare const BUILTIN_CLASS_RANGE_ERROR = "RangeError";
|
|
37
|
+
declare const BUILTIN_CLASS_REFERENCE_ERROR = "ReferenceError";
|
|
38
|
+
declare const BUILTIN_CLASS_SYNTAX_ERROR = "SyntaxError";
|
|
39
|
+
declare const BUILTIN_CLASS_TYPE_ERROR = "TypeError";
|
|
40
|
+
declare const BUILTIN_CLASS_URI_ERROR = "URIError";
|
|
41
|
+
declare const BUILTIN_CLASS_AGGREGATE_ERROR = "AggregateError";
|
|
42
|
+
declare const BUILTIN_TYPE_BIG_INT = "BI";
|
|
43
|
+
declare const BUILTIN_TYPE_NOT_FINITE = "NF";
|
|
44
|
+
declare const BUILTIN_TYPE_UNDEFINED = "UD";
|
|
45
|
+
declare const ALL_BUILTIN_ARRAYS: string[];
|
|
46
|
+
declare const ALL_BUILTIN_ERRORS: string[];
|
|
47
|
+
declare const ALL_BUILTIN_INTLS: string[];
|
|
48
|
+
declare const CLASSNAMES_WHOSE_ENUMERABLE_PROPERTIES_SHOULD_BE_IGNORED: string[];
|
|
49
|
+
export { ESSERIALIZER_NULL, ALL_BUILTIN_ARRAYS, ALL_BUILTIN_ERRORS, ALL_BUILTIN_INTLS, CLASSNAMES_WHOSE_ENUMERABLE_PROPERTIES_SHOULD_BE_IGNORED, BUILTIN_CLASS_INT8ARRAY, BUILTIN_CLASS_UINT8ARRAY, BUILTIN_CLASS_UINT8CLAMPEDARRAY, BUILTIN_CLASS_INT16ARRAY, BUILTIN_CLASS_UINT16ARRAY, BUILTIN_CLASS_INT32ARRAY, BUILTIN_CLASS_UINT32ARRAY, BUILTIN_CLASS_FLOAT32ARRAY, BUILTIN_CLASS_FLOAT64ARRAY, BUILTIN_CLASS_BIGINT64ARRAY, BUILTIN_CLASS_BIGUINT64ARRAY, BUILTIN_CLASS_ARRAYBUFFER, BUILTIN_CLASS_SHAREDARRAYBUFFER, BUILTIN_CLASS_BOOLEAN, BUILTIN_CLASS_DATAVIEW, BUILTIN_CLASS_DATE, BUILTIN_CLASS_INTL_COLLATOR, BUILTIN_CLASS_INTL_DATETIMEFORMAT, BUILTIN_CLASS_INTL_LISTFORMAT, BUILTIN_CLASS_INTL_LOCALE, BUILTIN_CLASS_INTL_NUMBERFORMAT, BUILTIN_CLASS_INTL_PLURALRULES, BUILTIN_CLASS_INTL_RELATIVETIMEFORMAT, BUILTIN_CLASS_REGEXP, BUILTIN_CLASS_SET, BUILTIN_CLASS_STRING, BUILTIN_CLASS_ERROR, BUILTIN_CLASS_EVAL_ERROR, BUILTIN_CLASS_RANGE_ERROR, BUILTIN_CLASS_REFERENCE_ERROR, BUILTIN_CLASS_SYNTAX_ERROR, BUILTIN_CLASS_TYPE_ERROR, BUILTIN_CLASS_URI_ERROR, BUILTIN_CLASS_AGGREGATE_ERROR, BUILTIN_TYPE_BIG_INT, BUILTIN_TYPE_NOT_FINITE, BUILTIN_TYPE_UNDEFINED, ARRAY_FIELD, BOOLEAN_FIELD, CLASS_NAME_FIELD, OPTIONS_FIELD, TIMESTAMP_FIELD, TO_STRING_FIELD };
|
|
50
|
+
//#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C,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EAChB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ClassOrEnum } from '.';
|
|
2
|
+
import DeserializeOptions from './DeserializationOptions';
|
|
3
|
+
declare function deserializeFromParsedObj(parsedObj: any, classes: Array<ClassOrEnum>, options: DeserializeOptions): any;
|
|
4
|
+
declare function deserializeFromParsedObjWithClassMapping(parsedObj: any, classMapping: object, options?: DeserializeOptions): any;
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param classes It's an array of Class definition. "any" is used in code only
|
|
8
|
+
* because there is no TypeScript type definition for Class.
|
|
9
|
+
*/
|
|
10
|
+
declare function getClassMappingFromClassArray(classes?: Array<any>): object;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param classObj It's a Class definition. "any" is used in code only
|
|
14
|
+
* because there is no TypeScript type definition for Class.
|
|
15
|
+
*/
|
|
16
|
+
declare function getParentClassName(classObj: any): string;
|
|
17
|
+
export { deserializeFromParsedObj, deserializeFromParsedObjWithClassMapping, getClassMappingFromClassArray, getParentClassName };
|
|
18
|
+
//# sourceMappingURL=deserializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../../../../src/Esserializer/deserializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAgDhC,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAI1D,iBAAS,wBAAwB,CAC/B,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAC3B,OAAO,EAAE,kBAAkB,GAAG,GAAG,CAMlC;AAED,iBAAS,wCAAwC,CAC/C,SAAS,EAAE,GAAG,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,kBAAuB,GAC/B,GAAG,CA+BL;AAiRD;;;;GAIG;AACH,iBAAS,6BAA6B,CAAC,OAAO,GAAE,KAAK,CAAC,GAAG,CAAM,GAAG,MAAM,CAgBvE;AAED;;;;GAIG;AACH,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CAEjD;AAED,OAAO,EACL,wBAAwB,EACxB,wCAAwC,EACxC,6BAA6B,EAC7B,kBAAkB,EACnB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare function notObject(target: any): boolean;
|
|
2
|
+
declare function getValueFromToStringResult(result: string): number | null;
|
|
3
|
+
declare function isClass(target: any): boolean;
|
|
4
|
+
export { getValueFromToStringResult, notObject, isClass };
|
|
5
|
+
//# sourceMappingURL=general.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../src/Esserializer/general.ts"],"names":[],"mappings":"AAGA,iBAAS,SAAS,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAEvC;AAED,iBAAS,0BAA0B,CAAC,MAAM,EAAE,MAAM,iBAWjD;AAMD,iBAAS,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAYrC;AAED,OAAO,EACL,0BAA0B,EAC1B,SAAS,EACT,OAAO,EACR,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import DeserializeOptions from './DeserializationOptions';
|
|
2
|
+
import SerializeOptions from './SerializeOptions';
|
|
3
|
+
export declare type ClassOrEnum = {
|
|
4
|
+
new (...args: any[]): any;
|
|
5
|
+
} | object;
|
|
6
|
+
export declare class ESSerializer {
|
|
7
|
+
private static registeredClasses;
|
|
8
|
+
/**
|
|
9
|
+
* Globally register classes or enums.
|
|
10
|
+
*/
|
|
11
|
+
static registerClasses(classesOrEnums: Array<ClassOrEnum>): void;
|
|
12
|
+
static registerClass(classOrEnum: ClassOrEnum): void;
|
|
13
|
+
/**
|
|
14
|
+
* Clear all registered classes.
|
|
15
|
+
*/
|
|
16
|
+
static clearRegisteredClasses(): void;
|
|
17
|
+
/**
|
|
18
|
+
* @param target
|
|
19
|
+
* @param options Serialization options
|
|
20
|
+
*/
|
|
21
|
+
static serialize(target: any, options?: SerializeOptions): string;
|
|
22
|
+
/**
|
|
23
|
+
* @param serializedText
|
|
24
|
+
* @param classes
|
|
25
|
+
* because there is no TypeScript type definition for Class.
|
|
26
|
+
* @param options Deserialization options
|
|
27
|
+
*/
|
|
28
|
+
static deserialize(serializedText: string, classes?: Array<ClassOrEnum>, options?: DeserializeOptions): any;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Esserializer/index.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAKlD,oBAAY,WAAW,GAAG;IAAE,KAAI,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;CAAE,GAAG,MAAM,CAAC;AAEhE,qBAAa,YAAY;IAEvB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA0B;IAE1D;;OAEG;WACW,eAAe,CAAC,cAAc,EAAE,KAAK,CAAC,WAAW,CAAC;WAIlD,aAAa,CAAC,WAAW,EAAE,WAAW;IAIpD;;OAEG;WACW,sBAAsB;IAIpC;;;OAGG;WACW,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAI5E;;;;;OAKG;WACW,WAAW,CACvB,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,KAAK,CAAC,WAAW,CAAM,EAChC,OAAO,GAAE,kBAAuB,GAAG,GAAG;CAQzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../../../src/Esserializer/serializer.ts"],"names":[],"mappings":"AAGA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AA6BlD,iBAAS,8BAA8B,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,GAAE,gBAAqB,GAAG,GAAG,CA4BxF;AAyGD,OAAO,EACL,8BAA8B,EAC/B,CAAC"}
|