gingersnap 0.22.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/_virtual/_tslib.cjs +102 -0
- package/_virtual/_tslib.mjs +93 -0
- package/data/AtomicValue.d.ts +15 -0
- package/data/bus.cjs +179 -0
- package/data/bus.d.ts +72 -0
- package/data/bus.mjs +177 -0
- package/data/decoders/index.d.ts +4 -0
- package/data/decoders/json.cjs +12 -0
- package/data/decoders/json.d.ts +7 -0
- package/data/decoders/json.mjs +10 -0
- package/data/decoders/msgpack.cjs +14 -0
- package/data/decoders/msgpack.d.ts +7 -0
- package/data/decoders/msgpack.mjs +12 -0
- package/data/decoders/protobuf.d.ts +13 -0
- package/data/decoders/string.cjs +12 -0
- package/data/decoders/string.d.ts +7 -0
- package/data/decoders/string.mjs +10 -0
- package/data/decoders/type.d.ts +7 -0
- package/data/decoders.cjs +11 -0
- package/data/decoders.mjs +3 -0
- package/data/model/credentials.cjs +114 -0
- package/data/model/credentials.d.ts +61 -0
- package/data/model/credentials.mjs +109 -0
- package/data/model/extra.cjs +88 -0
- package/data/model/extra.d.ts +5 -0
- package/data/model/extra.mjs +66 -0
- package/data/model/index.d.ts +6 -0
- package/data/model/model.cjs +541 -0
- package/data/model/model.d.ts +207 -0
- package/data/model/model.mjs +518 -0
- package/data/model/plugin.cjs +96 -0
- package/data/model/plugin.d.ts +38 -0
- package/data/model/plugin.mjs +72 -0
- package/data/model/property.cjs +310 -0
- package/data/model/property.d.ts +83 -0
- package/data/model/property.mjs +278 -0
- package/data/model/types.cjs +32 -0
- package/data/model/types.d.ts +28 -0
- package/data/model/types.mjs +32 -0
- package/data/model.cjs +43 -0
- package/data/model.mjs +6 -0
- package/data/signal.cjs +47 -0
- package/data/signal.d.ts +17 -0
- package/data/signal.mjs +45 -0
- package/data/store/index.d.ts +4 -0
- package/data/store/json.cjs +58 -0
- package/data/store/json.d.ts +18 -0
- package/data/store/json.mjs +56 -0
- package/data/store/manager.cjs +206 -0
- package/data/store/manager.d.ts +44 -0
- package/data/store/manager.mjs +203 -0
- package/data/store/web.cjs +92 -0
- package/data/store/web.d.ts +25 -0
- package/data/store/web.mjs +89 -0
- package/data/value.cjs +66 -0
- package/data/value.mjs +64 -0
- package/data-structures/array/CyclicalList.cjs +57 -0
- package/data-structures/array/CyclicalList.d.ts +12 -0
- package/data-structures/array/CyclicalList.mjs +55 -0
- package/data-structures/array/Pair.cjs +30 -0
- package/data-structures/array/Pair.d.ts +17 -0
- package/data-structures/array/Pair.mjs +27 -0
- package/data-structures/array/Stack.cjs +96 -0
- package/data-structures/array/Stack.d.ts +41 -0
- package/data-structures/array/Stack.mjs +94 -0
- package/data-structures/array/Triple.cjs +34 -0
- package/data-structures/array/Triple.d.ts +19 -0
- package/data-structures/array/Triple.mjs +31 -0
- package/data-structures/array/Tuple.d.ts +8 -0
- package/data-structures/array/index.d.ts +5 -0
- package/data-structures/array.cjs +15 -0
- package/data-structures/array.mjs +4 -0
- package/data-structures/object/BufferQueue.cjs +98 -0
- package/data-structures/object/BufferQueue.d.ts +21 -0
- package/data-structures/object/BufferQueue.mjs +77 -0
- package/data-structures/object/CyclicalObject.cjs +155 -0
- package/data-structures/object/CyclicalObject.d.ts +74 -0
- package/data-structures/object/CyclicalObject.mjs +134 -0
- package/data-structures/object/Queue.cjs +178 -0
- package/data-structures/object/Queue.d.ts +31 -0
- package/data-structures/object/Queue.mjs +176 -0
- package/data-structures/object/SimpleQueue.cjs +53 -0
- package/data-structures/object/SimpleQueue.d.ts +13 -0
- package/data-structures/object/SimpleQueue.mjs +51 -0
- package/data-structures/object/TimeableObject.cjs +73 -0
- package/data-structures/object/TimeableObject.d.ts +30 -0
- package/data-structures/object/TimeableObject.mjs +71 -0
- package/data-structures/object/WaitableObject.cjs +61 -0
- package/data-structures/object/WaitableObject.d.ts +29 -0
- package/data-structures/object/WaitableObject.mjs +59 -0
- package/data-structures/object/WatchableObject.cjs +251 -0
- package/data-structures/object/WatchableObject.d.ts +88 -0
- package/data-structures/object/WatchableObject.mjs +230 -0
- package/data-structures/object/index.d.ts +7 -0
- package/data-structures/object.cjs +23 -0
- package/data-structures/object.mjs +7 -0
- package/errors/AbortError.cjs +9 -0
- package/errors/AbortError.d.ts +5 -0
- package/errors/AbortError.mjs +7 -0
- package/errors/CallExecutionError.cjs +13 -0
- package/errors/CallExecutionError.d.ts +7 -0
- package/errors/CallExecutionError.mjs +11 -0
- package/errors/FutureCancelled.cjs +11 -0
- package/errors/FutureCancelled.d.ts +6 -0
- package/errors/FutureCancelled.mjs +9 -0
- package/errors/FutureError.cjs +11 -0
- package/errors/FutureError.d.ts +6 -0
- package/errors/FutureError.mjs +9 -0
- package/errors/IllegalArgumentsError.cjs +13 -0
- package/errors/IllegalArgumentsError.d.ts +7 -0
- package/errors/IllegalArgumentsError.mjs +11 -0
- package/errors/IllegalOperationError.cjs +6 -0
- package/errors/IllegalOperationError.d.ts +2 -0
- package/errors/IllegalOperationError.mjs +4 -0
- package/errors/InvalidType.cjs +6 -0
- package/errors/InvalidType.d.ts +2 -0
- package/errors/InvalidType.mjs +4 -0
- package/errors/InvalidValue.cjs +11 -0
- package/errors/InvalidValue.d.ts +4 -0
- package/errors/InvalidValue.mjs +9 -0
- package/errors/MissingArgumentsError.cjs +13 -0
- package/errors/MissingArgumentsError.d.ts +7 -0
- package/errors/MissingArgumentsError.mjs +11 -0
- package/errors/NetworkError.cjs +13 -0
- package/errors/NetworkError.d.ts +8 -0
- package/errors/NetworkError.mjs +11 -0
- package/errors/NoSuchElement.cjs +6 -0
- package/errors/NoSuchElement.d.ts +2 -0
- package/errors/NoSuchElement.mjs +4 -0
- package/errors/NotImplemented.cjs +9 -0
- package/errors/NotImplemented.d.ts +5 -0
- package/errors/NotImplemented.mjs +7 -0
- package/errors/ParsingError.cjs +10 -0
- package/errors/ParsingError.d.ts +5 -0
- package/errors/ParsingError.mjs +8 -0
- package/errors/QueueEmptyError.cjs +6 -0
- package/errors/QueueEmptyError.d.ts +2 -0
- package/errors/QueueEmptyError.mjs +4 -0
- package/errors/QueueFullError.cjs +6 -0
- package/errors/QueueFullError.d.ts +2 -0
- package/errors/QueueFullError.mjs +4 -0
- package/errors/StackEmptyError.cjs +6 -0
- package/errors/StackEmptyError.d.ts +2 -0
- package/errors/StackEmptyError.mjs +4 -0
- package/errors/StackFullError.cjs +6 -0
- package/errors/StackFullError.d.ts +2 -0
- package/errors/StackFullError.mjs +4 -0
- package/errors/StreamEnded.cjs +6 -0
- package/errors/StreamEnded.d.ts +2 -0
- package/errors/StreamEnded.mjs +4 -0
- package/errors/TimeoutError.cjs +11 -0
- package/errors/TimeoutError.d.ts +6 -0
- package/errors/TimeoutError.mjs +9 -0
- package/errors/ValueDestroyedError.cjs +6 -0
- package/errors/ValueDestroyedError.d.ts +2 -0
- package/errors/ValueDestroyedError.mjs +4 -0
- package/errors/VerificationError.cjs +9 -0
- package/errors/VerificationError.d.ts +5 -0
- package/errors/VerificationError.mjs +7 -0
- package/errors/index.d.ts +18 -0
- package/errors.cjs +41 -0
- package/errors.mjs +18 -0
- package/files.cjs +201 -0
- package/files.d.ts +31 -0
- package/files.mjs +180 -0
- package/functools/index.d.ts +31 -0
- package/functools.cjs +371 -0
- package/functools.mjs +334 -0
- package/future/future.cjs +570 -0
- package/future/future.d.ts +208 -0
- package/future/future.mjs +548 -0
- package/future/group.cjs +180 -0
- package/future/group.d.ts +82 -0
- package/future/group.mjs +159 -0
- package/future/index.d.ts +3 -0
- package/future/result.cjs +19 -0
- package/future/result.d.ts +18 -0
- package/future/result.mjs +17 -0
- package/future.cjs +11 -0
- package/future.mjs +3 -0
- package/managers/context.d.ts +8 -0
- package/managers/index.d.ts +1 -0
- package/managers.cjs +2 -0
- package/managers.mjs +1 -0
- package/mocks.cjs +301 -0
- package/mocks.d.ts +125 -0
- package/mocks.mjs +293 -0
- package/networking/EventSourceService.cjs +104 -0
- package/networking/EventSourceService.d.ts +11 -0
- package/networking/EventSourceService.mjs +83 -0
- package/networking/NetworkService.cjs +394 -0
- package/networking/NetworkService.d.ts +97 -0
- package/networking/NetworkService.mjs +373 -0
- package/networking/SocketService.cjs +218 -0
- package/networking/SocketService.d.ts +23 -0
- package/networking/SocketService.mjs +197 -0
- package/networking/decorators/index.d.ts +4 -0
- package/networking/decorators/options.cjs +289 -0
- package/networking/decorators/options.d.ts +148 -0
- package/networking/decorators/options.mjs +242 -0
- package/networking/decorators/requests.cjs +80 -0
- package/networking/decorators/requests.d.ts +34 -0
- package/networking/decorators/requests.mjs +52 -0
- package/networking/decorators/socket.cjs +81 -0
- package/networking/decorators/socket.d.ts +13 -0
- package/networking/decorators/socket.mjs +51 -0
- package/networking/http.cjs +69 -0
- package/networking/http.d.ts +66 -0
- package/networking/http.mjs +69 -0
- package/networking/index.d.ts +39 -0
- package/networking/request.cjs +18 -0
- package/networking/request.d.ts +9 -0
- package/networking/request.mjs +16 -0
- package/networking/types.cjs +37 -0
- package/networking/types.d.ts +132 -0
- package/networking/types.mjs +35 -0
- package/networking.cjs +91 -0
- package/networking.mjs +33 -0
- package/package.json +1 -0
- package/reflection/injector.cjs +43 -0
- package/reflection/injector.d.ts +3 -0
- package/reflection/injector.mjs +40 -0
- package/socket.cjs +239 -0
- package/socket.d.ts +65 -0
- package/socket.mjs +237 -0
- package/store.cjs +12 -0
- package/store.mjs +3 -0
- package/stream/call.cjs +157 -0
- package/stream/call.d.ts +66 -0
- package/stream/call.mjs +154 -0
- package/stream/collector.cjs +217 -0
- package/stream/collector.d.ts +14 -0
- package/stream/collector.mjs +215 -0
- package/stream/index.d.ts +257 -0
- package/stream/observable.cjs +110 -0
- package/stream/observable.d.ts +65 -0
- package/stream/observable.mjs +106 -0
- package/stream/state.cjs +10 -0
- package/stream/state.d.ts +5 -0
- package/stream/state.mjs +8 -0
- package/stream.cjs +1153 -0
- package/stream.mjs +1132 -0
- package/synchronize.cjs +106 -0
- package/synchronize.d.ts +54 -0
- package/synchronize.mjs +103 -0
- package/typing/types.d.ts +24 -0
- package/typing.cjs +2 -0
- package/typing.mjs +1 -0
- package/utils/parser.cjs +37 -0
- package/utils/parser.d.ts +7 -0
- package/utils/parser.mjs +16 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { namespacedModelInternalProps, Optional, Model } from './model.mjs';
|
|
3
|
+
import { InvalidType } from '../../errors/InvalidType.mjs';
|
|
4
|
+
import { InvalidValue } from '../../errors/InvalidValue.mjs';
|
|
5
|
+
import { DataType } from './types.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates a decorator that updates a field
|
|
9
|
+
* @param functor updater function
|
|
10
|
+
* @returns a decorator
|
|
11
|
+
*/
|
|
12
|
+
const createFieldUpdater = (functor) => (target, key) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const props = (_a = namespacedModelInternalProps.get(target.constructor.name)) !== null && _a !== void 0 ? _a : {
|
|
15
|
+
fields: new Map(),
|
|
16
|
+
};
|
|
17
|
+
const field = R.find((v) => v === key, Array.from(props.fields.keys()));
|
|
18
|
+
if (!field) {
|
|
19
|
+
throw new Error(`No field found that matches ${key}`);
|
|
20
|
+
}
|
|
21
|
+
functor({ field: props.fields.get(field), target, key });
|
|
22
|
+
props.parent = Object.getPrototypeOf(target).constructor.name;
|
|
23
|
+
namespacedModelInternalProps.set(target.constructor.name, props);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Creates a validator decorator
|
|
27
|
+
* @param functor validation function
|
|
28
|
+
* @param error error to be thrown when validation fails
|
|
29
|
+
* @param updater optional argument to update the current field
|
|
30
|
+
* @returns a decorator
|
|
31
|
+
*/
|
|
32
|
+
const createValidator = (functor, error, updater) => createFieldUpdater(({ field, target, key }) => {
|
|
33
|
+
const symbol = Symbol(key);
|
|
34
|
+
Object.defineProperty(target, key, {
|
|
35
|
+
get: function () {
|
|
36
|
+
return this[symbol];
|
|
37
|
+
},
|
|
38
|
+
set: function (v) {
|
|
39
|
+
if (v instanceof Optional) {
|
|
40
|
+
if (v.isPresent()) {
|
|
41
|
+
v = v.get();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this[symbol] = v;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!functor(v))
|
|
49
|
+
throw error;
|
|
50
|
+
this[symbol] = v;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
if (updater)
|
|
54
|
+
updater(field);
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* A property that exist in the incoming data
|
|
58
|
+
* @param name Name of the property in the incoming data. If not provided, the variable name will be assumed as the
|
|
59
|
+
* property name
|
|
60
|
+
* @param type type of the field. Not required (useful when the field is an Optional)
|
|
61
|
+
* @constructor
|
|
62
|
+
*/
|
|
63
|
+
const Field = (name, type = undefined) => (target, key) => {
|
|
64
|
+
var _a, _b, _c, _d;
|
|
65
|
+
const schema = {};
|
|
66
|
+
const props = (_a = namespacedModelInternalProps.get(target.constructor.name)) !== null && _a !== void 0 ? _a : {
|
|
67
|
+
fields: new Map(),
|
|
68
|
+
};
|
|
69
|
+
const dtype = Reflect.getMetadata("design:type", target, key);
|
|
70
|
+
const fieldProp = (_b = props.fields.get(key)) !== null && _b !== void 0 ? _b : {};
|
|
71
|
+
if (type && dtype === Optional) {
|
|
72
|
+
schema.options = { useOptionalObj: true };
|
|
73
|
+
fieldProp.ignore = Object.assign(Object.assign({}, ((_c = fieldProp.ignore) !== null && _c !== void 0 ? _c : {})), { deserialize: true });
|
|
74
|
+
}
|
|
75
|
+
else if (!type) {
|
|
76
|
+
type = dtype;
|
|
77
|
+
}
|
|
78
|
+
else if (!(dtype instanceof type)) {
|
|
79
|
+
throw new InvalidType(`Type mismatch for property ${key}`);
|
|
80
|
+
}
|
|
81
|
+
if (type instanceof Number) {
|
|
82
|
+
schema.dataType = DataType.DOUBLE;
|
|
83
|
+
}
|
|
84
|
+
else if (type instanceof String) {
|
|
85
|
+
schema.dataType = DataType.STRING;
|
|
86
|
+
}
|
|
87
|
+
else if (type instanceof Boolean) {
|
|
88
|
+
schema.dataType = DataType.BOOLEAN;
|
|
89
|
+
}
|
|
90
|
+
else if (type instanceof Model) {
|
|
91
|
+
schema.dataType = DataType.RECORD;
|
|
92
|
+
schema.options = Object.assign(Object.assign({}, ((_d = schema.options) !== null && _d !== void 0 ? _d : {})), { recordClass: type });
|
|
93
|
+
}
|
|
94
|
+
fieldProp.name = name !== null && name !== void 0 ? name : key;
|
|
95
|
+
fieldProp.Type = type;
|
|
96
|
+
fieldProp.isArray = false;
|
|
97
|
+
fieldProp.schema = schema;
|
|
98
|
+
props.fields.set(key, fieldProp);
|
|
99
|
+
if (name) {
|
|
100
|
+
if (fieldProp.aliases) {
|
|
101
|
+
fieldProp.aliases.push(name);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
fieldProp.aliases = [name];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
props.parent = Object.getPrototypeOf(target).constructor.name;
|
|
108
|
+
namespacedModelInternalProps.set(target.constructor.name, props);
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* A property that exists on the incoming data, that contains an array of same data types
|
|
112
|
+
* @param type Type of data in the array
|
|
113
|
+
* @param name Name of the property in the incoming data. If not provided, the variable name will be assumed as the
|
|
114
|
+
* property name
|
|
115
|
+
* @constructor
|
|
116
|
+
*/
|
|
117
|
+
const ArrayField = (type, name) => (target, key) => {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
const props = (_a = namespacedModelInternalProps.get(target.constructor.name)) !== null && _a !== void 0 ? _a : {
|
|
120
|
+
fields: new Map(),
|
|
121
|
+
};
|
|
122
|
+
const schema = { dataType: DataType.ARRAY };
|
|
123
|
+
const dtype = Reflect.getMetadata("design:type", target, key);
|
|
124
|
+
const optional = dtype === Optional;
|
|
125
|
+
schema.options = { useOptionalObj: optional, optional };
|
|
126
|
+
if (type instanceof Number) {
|
|
127
|
+
schema.itemType = DataType.DOUBLE;
|
|
128
|
+
}
|
|
129
|
+
else if (type instanceof String) {
|
|
130
|
+
schema.itemType = DataType.STRING;
|
|
131
|
+
}
|
|
132
|
+
else if (type instanceof Boolean) {
|
|
133
|
+
schema.itemType = DataType.BOOLEAN;
|
|
134
|
+
}
|
|
135
|
+
else if (type instanceof Model) {
|
|
136
|
+
schema.options.recordClass = type;
|
|
137
|
+
}
|
|
138
|
+
const fieldProp = (_b = props.fields.get(key)) !== null && _b !== void 0 ? _b : {};
|
|
139
|
+
fieldProp.name = key;
|
|
140
|
+
fieldProp.Type = type;
|
|
141
|
+
fieldProp.isArray = true;
|
|
142
|
+
fieldProp.schema = schema;
|
|
143
|
+
props.fields.set(key, fieldProp);
|
|
144
|
+
if (name) {
|
|
145
|
+
if (fieldProp.aliases) {
|
|
146
|
+
fieldProp.aliases.push(name);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
fieldProp.aliases = [name];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
props.parent = Object.getPrototypeOf(target).constructor.name;
|
|
153
|
+
namespacedModelInternalProps.set(target.constructor.name, props);
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* A property that exists on the incoming data, that contains an object/array that can be represented as a hashmap
|
|
157
|
+
* @param keyType type for the keys in the map
|
|
158
|
+
* @param valueType type for the values in the map
|
|
159
|
+
* @param name optional name of the field
|
|
160
|
+
* @constructor
|
|
161
|
+
*/
|
|
162
|
+
const MapField = (keyType, valueType, name) => (target, key) => {
|
|
163
|
+
var _a, _b;
|
|
164
|
+
const props = (_a = namespacedModelInternalProps.get(target.constructor.name)) !== null && _a !== void 0 ? _a : {
|
|
165
|
+
fields: new Map(),
|
|
166
|
+
};
|
|
167
|
+
const schema = { dataType: DataType.MAP };
|
|
168
|
+
const dtype = Reflect.getMetadata("design:type", target, key);
|
|
169
|
+
const optional = dtype === Optional;
|
|
170
|
+
schema.options = { useOptionalObj: optional, optional };
|
|
171
|
+
const fieldProp = (_b = props.fields.get(key)) !== null && _b !== void 0 ? _b : {};
|
|
172
|
+
fieldProp.name = key;
|
|
173
|
+
fieldProp.Type = Map;
|
|
174
|
+
fieldProp.isMap = true;
|
|
175
|
+
fieldProp.KeyType = keyType;
|
|
176
|
+
fieldProp.ValueType = valueType;
|
|
177
|
+
fieldProp.schema = schema;
|
|
178
|
+
props.fields.set(key, fieldProp);
|
|
179
|
+
if (name) {
|
|
180
|
+
props.fields.set(name, fieldProp);
|
|
181
|
+
}
|
|
182
|
+
props.parent = Object.getPrototypeOf(target).constructor.name;
|
|
183
|
+
namespacedModelInternalProps.set(target.constructor.name, props);
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Alternative name for the associated field
|
|
187
|
+
* @param name
|
|
188
|
+
*/
|
|
189
|
+
const Alias = (name) => createFieldUpdater(({ field }) => {
|
|
190
|
+
var _a;
|
|
191
|
+
const aliases = (_a = field.aliases) !== null && _a !== void 0 ? _a : [];
|
|
192
|
+
aliases.push(name);
|
|
193
|
+
field.aliases = aliases;
|
|
194
|
+
});
|
|
195
|
+
/**
|
|
196
|
+
* Makes the given property only readable
|
|
197
|
+
* @constructor
|
|
198
|
+
*/
|
|
199
|
+
const Readonly = (target, key) => {
|
|
200
|
+
var _a, _b;
|
|
201
|
+
const props = (_a = namespacedModelInternalProps.get(target.constructor.name)) !== null && _a !== void 0 ? _a : {
|
|
202
|
+
fields: new Map(),
|
|
203
|
+
};
|
|
204
|
+
const fieldProps = (_b = props.fields.get(key)) !== null && _b !== void 0 ? _b : {};
|
|
205
|
+
fieldProps.readonly = true;
|
|
206
|
+
props.fields.set(key, fieldProps);
|
|
207
|
+
props.parent = Object.getPrototypeOf(target).constructor.name;
|
|
208
|
+
namespacedModelInternalProps.set(target.constructor.name, props);
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Validates the value assigned to the associated property
|
|
212
|
+
* @param matcher functor to check if the assigned value is valid
|
|
213
|
+
*/
|
|
214
|
+
const Validator = (matcher) => createValidator(matcher instanceof Function ? matcher : matcher instanceof RegExp ? (v) => matcher.test(v) : (v) => v === matcher, new InvalidValue(`Invalid value assigned`));
|
|
215
|
+
/**
|
|
216
|
+
* Raises an error if the field contains an error
|
|
217
|
+
* @constructor
|
|
218
|
+
*/
|
|
219
|
+
const RaiseError = createFieldUpdater(({ field, target, key }) => {
|
|
220
|
+
const symbol = Symbol(key);
|
|
221
|
+
Object.defineProperty(target, key, {
|
|
222
|
+
get: function () {
|
|
223
|
+
return this[symbol];
|
|
224
|
+
},
|
|
225
|
+
set: function (v) {
|
|
226
|
+
if (v) {
|
|
227
|
+
throw v instanceof Error ? v : new Error(v);
|
|
228
|
+
}
|
|
229
|
+
this[symbol] = v;
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* Ignores the annotated field during deserialization (by default) and/or serialization
|
|
235
|
+
* @param value an object for enabling/disabling which directions should ignore be used
|
|
236
|
+
* @constructor
|
|
237
|
+
*/
|
|
238
|
+
const Ignore = (value = { serialize: false, deserialize: true }) => createFieldUpdater(({ field }) => {
|
|
239
|
+
var _a, _b;
|
|
240
|
+
field.ignore = value;
|
|
241
|
+
if (value.serialize)
|
|
242
|
+
delete field.schema;
|
|
243
|
+
else if (field.schema) {
|
|
244
|
+
const options = (_b = (_a = field.schema) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : {};
|
|
245
|
+
options.optional = true;
|
|
246
|
+
field.schema.options = options;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
/**
|
|
250
|
+
* Registers a schema type for the given field
|
|
251
|
+
* @param dataType
|
|
252
|
+
* @param options
|
|
253
|
+
*/
|
|
254
|
+
const SchemaType = (dataType, options) => createFieldUpdater(({ field }) => (field.schema = {
|
|
255
|
+
dataType,
|
|
256
|
+
options,
|
|
257
|
+
}));
|
|
258
|
+
/**
|
|
259
|
+
* Decorator that applies a lower limit validation on a numeric field
|
|
260
|
+
* @param value limit
|
|
261
|
+
* @param inclusive should the limit be included. Default is false
|
|
262
|
+
*/
|
|
263
|
+
const LowerBound = (value, inclusive = true) => createValidator(inclusive ? (v) => v >= value : (v) => v > value, new InvalidValue(`value is lower than the minimum value of ${value}`));
|
|
264
|
+
/**
|
|
265
|
+
* Decorator that applies an upper limit validation on a numeric field
|
|
266
|
+
* @param value limit
|
|
267
|
+
* @param inclusive should the limit be included. Default is false
|
|
268
|
+
*/
|
|
269
|
+
const UpperBound = (value, inclusive = false) => createValidator(inclusive ? (v) => v <= value : (v) => v < value, new InvalidValue(`value is higher than the maximum value of ${value}`));
|
|
270
|
+
/**
|
|
271
|
+
* Decorator that applies a range validation on a numeric field
|
|
272
|
+
* @param lower lower bound
|
|
273
|
+
* @param upper upper bound
|
|
274
|
+
* @param inclusive should the upper bound be included. Default is false
|
|
275
|
+
*/
|
|
276
|
+
const Range = (lower, upper, inclusive = false) => createValidator(inclusive ? (v) => lower <= v && v <= upper : (v) => lower <= v && v < upper, new InvalidValue(`value is not within the range of ${lower} <= v ` + (inclusive ? `<= ${upper}` : `< ${upper}`)));
|
|
277
|
+
|
|
278
|
+
export { Alias, ArrayField, Field, Ignore, LowerBound, MapField, RaiseError, Range, Readonly, SchemaType, UpperBound, Validator };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Formatting used with converting data to models
|
|
5
|
+
*/
|
|
6
|
+
exports.DataFormat = void 0;
|
|
7
|
+
(function (DataFormat) {
|
|
8
|
+
DataFormat[DataFormat["CSV"] = 0] = "CSV";
|
|
9
|
+
DataFormat[DataFormat["XML"] = 1] = "XML";
|
|
10
|
+
DataFormat[DataFormat["JSON"] = 2] = "JSON";
|
|
11
|
+
DataFormat[DataFormat["MESSAGE_PACK"] = 3] = "MESSAGE_PACK";
|
|
12
|
+
})(exports.DataFormat || (exports.DataFormat = {}));
|
|
13
|
+
/**
|
|
14
|
+
* Supported data types
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
exports.DataType = void 0;
|
|
18
|
+
(function (DataType) {
|
|
19
|
+
DataType["RECORD"] = "record";
|
|
20
|
+
DataType["NULL"] = "null";
|
|
21
|
+
DataType["BOOLEAN"] = "boolean";
|
|
22
|
+
DataType["INT"] = "int";
|
|
23
|
+
DataType["LONG"] = "long";
|
|
24
|
+
DataType["FLOAT"] = "float";
|
|
25
|
+
DataType["DOUBLE"] = "double";
|
|
26
|
+
DataType["BYTES"] = "bytes";
|
|
27
|
+
DataType["STRING"] = "string";
|
|
28
|
+
DataType["ENUM"] = "enum";
|
|
29
|
+
DataType["MAP"] = "map";
|
|
30
|
+
DataType["FIXED_STRING"] = "fixed";
|
|
31
|
+
DataType["ARRAY"] = "array";
|
|
32
|
+
})(exports.DataType || (exports.DataType = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting used with converting data to models
|
|
3
|
+
*/
|
|
4
|
+
export declare enum DataFormat {
|
|
5
|
+
CSV = 0,
|
|
6
|
+
XML = 1,
|
|
7
|
+
JSON = 2,
|
|
8
|
+
MESSAGE_PACK = 3
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Supported data types
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export declare enum DataType {
|
|
15
|
+
RECORD = "record",
|
|
16
|
+
NULL = "null",
|
|
17
|
+
BOOLEAN = "boolean",
|
|
18
|
+
INT = "int",
|
|
19
|
+
LONG = "long",
|
|
20
|
+
FLOAT = "float",
|
|
21
|
+
DOUBLE = "double",
|
|
22
|
+
BYTES = "bytes",
|
|
23
|
+
STRING = "string",
|
|
24
|
+
ENUM = "enum",
|
|
25
|
+
MAP = "map",
|
|
26
|
+
FIXED_STRING = "fixed",
|
|
27
|
+
ARRAY = "array"
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting used with converting data to models
|
|
3
|
+
*/
|
|
4
|
+
var DataFormat;
|
|
5
|
+
(function (DataFormat) {
|
|
6
|
+
DataFormat[DataFormat["CSV"] = 0] = "CSV";
|
|
7
|
+
DataFormat[DataFormat["XML"] = 1] = "XML";
|
|
8
|
+
DataFormat[DataFormat["JSON"] = 2] = "JSON";
|
|
9
|
+
DataFormat[DataFormat["MESSAGE_PACK"] = 3] = "MESSAGE_PACK";
|
|
10
|
+
})(DataFormat || (DataFormat = {}));
|
|
11
|
+
/**
|
|
12
|
+
* Supported data types
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
var DataType;
|
|
16
|
+
(function (DataType) {
|
|
17
|
+
DataType["RECORD"] = "record";
|
|
18
|
+
DataType["NULL"] = "null";
|
|
19
|
+
DataType["BOOLEAN"] = "boolean";
|
|
20
|
+
DataType["INT"] = "int";
|
|
21
|
+
DataType["LONG"] = "long";
|
|
22
|
+
DataType["FLOAT"] = "float";
|
|
23
|
+
DataType["DOUBLE"] = "double";
|
|
24
|
+
DataType["BYTES"] = "bytes";
|
|
25
|
+
DataType["STRING"] = "string";
|
|
26
|
+
DataType["ENUM"] = "enum";
|
|
27
|
+
DataType["MAP"] = "map";
|
|
28
|
+
DataType["FIXED_STRING"] = "fixed";
|
|
29
|
+
DataType["ARRAY"] = "array";
|
|
30
|
+
})(DataType || (DataType = {}));
|
|
31
|
+
|
|
32
|
+
export { DataFormat, DataType };
|
package/data/model.cjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var model = require('./model/model.cjs');
|
|
4
|
+
var property = require('./model/property.cjs');
|
|
5
|
+
var types = require('./model/types.cjs');
|
|
6
|
+
var credentials = require('./model/credentials.cjs');
|
|
7
|
+
var plugin = require('./model/plugin.cjs');
|
|
8
|
+
var extra = require('./model/extra.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.Model = model.Model;
|
|
13
|
+
exports.Optional = model.Optional;
|
|
14
|
+
exports.Alias = property.Alias;
|
|
15
|
+
exports.ArrayField = property.ArrayField;
|
|
16
|
+
exports.Field = property.Field;
|
|
17
|
+
exports.Ignore = property.Ignore;
|
|
18
|
+
exports.LowerBound = property.LowerBound;
|
|
19
|
+
exports.MapField = property.MapField;
|
|
20
|
+
exports.RaiseError = property.RaiseError;
|
|
21
|
+
exports.Range = property.Range;
|
|
22
|
+
exports.Readonly = property.Readonly;
|
|
23
|
+
exports.SchemaType = property.SchemaType;
|
|
24
|
+
exports.UpperBound = property.UpperBound;
|
|
25
|
+
exports.Validator = property.Validator;
|
|
26
|
+
Object.defineProperty(exports, 'DataFormat', {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return types.DataFormat; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, 'DataType', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return types.DataType; }
|
|
33
|
+
});
|
|
34
|
+
exports.APIKeyCredentials = credentials.APIKeyCredentials;
|
|
35
|
+
exports.BasicCredentials = credentials.BasicCredentials;
|
|
36
|
+
exports.BearerCredentials = credentials.BearerCredentials;
|
|
37
|
+
exports.Credentials = credentials.Credentials;
|
|
38
|
+
exports.createModelClassAnnotationTag = plugin.createModelClassAnnotationTag;
|
|
39
|
+
exports.createModelFieldAnnotationTag = plugin.createModelFieldAnnotationTag;
|
|
40
|
+
exports.getModelClassAnnotationTagProperties = plugin.getModelClassAnnotationTagProperties;
|
|
41
|
+
exports.getModelFieldAnnotationTagProperties = plugin.getModelFieldAnnotationTagProperties;
|
|
42
|
+
exports.Union = extra.Union;
|
|
43
|
+
exports.View = extra.View;
|
package/data/model.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Model, Optional } from './model/model.mjs';
|
|
2
|
+
export { Alias, ArrayField, Field, Ignore, LowerBound, MapField, RaiseError, Range, Readonly, SchemaType, UpperBound, Validator } from './model/property.mjs';
|
|
3
|
+
export { DataFormat, DataType } from './model/types.mjs';
|
|
4
|
+
export { APIKeyCredentials, BasicCredentials, BearerCredentials, Credentials } from './model/credentials.mjs';
|
|
5
|
+
export { createModelClassAnnotationTag, createModelFieldAnnotationTag, getModelClassAnnotationTagProperties, getModelFieldAnnotationTagProperties } from './model/plugin.mjs';
|
|
6
|
+
export { Union, View } from './model/extra.mjs';
|
package/data/signal.cjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var stream = require('../stream.cjs');
|
|
4
|
+
require('../data-structures/object/WatchableObject.cjs');
|
|
5
|
+
require('object-hash');
|
|
6
|
+
require('ramda');
|
|
7
|
+
require('../_virtual/_tslib.cjs');
|
|
8
|
+
require('uuid');
|
|
9
|
+
var Queue = require('../data-structures/object/Queue.cjs');
|
|
10
|
+
|
|
11
|
+
class Signal {
|
|
12
|
+
constructor(source) {
|
|
13
|
+
this.subscribers = new Set();
|
|
14
|
+
this.source = source instanceof stream.Stream ? source : source.streamEntries;
|
|
15
|
+
}
|
|
16
|
+
start() {
|
|
17
|
+
this.task = this.source.forEach((value) => {
|
|
18
|
+
for (const subscriber of this.subscribers) {
|
|
19
|
+
subscriber(value);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
stop() {
|
|
24
|
+
var _a;
|
|
25
|
+
(_a = this.task) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
26
|
+
}
|
|
27
|
+
subscribe(callback) {
|
|
28
|
+
this.subscribers.add(callback);
|
|
29
|
+
if (this.latestValue !== undefined) {
|
|
30
|
+
callback(this.latestValue);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
cancel: () => {
|
|
34
|
+
this.subscribers.delete(callback);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
stream(objectMaxSize, expiryPeriod) {
|
|
39
|
+
const queue = new Queue.Queue(objectMaxSize, expiryPeriod);
|
|
40
|
+
const token = this.subscribe((value) => {
|
|
41
|
+
queue.enqueue(value);
|
|
42
|
+
});
|
|
43
|
+
return queue.streamEntries.onCancellation(token.cancel);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.Signal = Signal;
|
package/data/signal.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Stream } from "../stream";
|
|
2
|
+
import { WaitPeriod } from "../future";
|
|
3
|
+
import { Queue } from "../data-structures/object";
|
|
4
|
+
export interface Token {
|
|
5
|
+
cancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class Signal<T> {
|
|
8
|
+
private readonly subscribers;
|
|
9
|
+
private readonly latestValue;
|
|
10
|
+
private task?;
|
|
11
|
+
private readonly source;
|
|
12
|
+
constructor(source: Stream<T> | Queue<T>);
|
|
13
|
+
start(): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
subscribe(callback: (value: T) => void): Token;
|
|
16
|
+
stream(objectMaxSize?: number, expiryPeriod?: WaitPeriod): Stream<T>;
|
|
17
|
+
}
|
package/data/signal.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Stream } from '../stream.mjs';
|
|
2
|
+
import '../data-structures/object/WatchableObject.mjs';
|
|
3
|
+
import 'object-hash';
|
|
4
|
+
import 'ramda';
|
|
5
|
+
import '../_virtual/_tslib.mjs';
|
|
6
|
+
import 'uuid';
|
|
7
|
+
import { Queue } from '../data-structures/object/Queue.mjs';
|
|
8
|
+
|
|
9
|
+
class Signal {
|
|
10
|
+
constructor(source) {
|
|
11
|
+
this.subscribers = new Set();
|
|
12
|
+
this.source = source instanceof Stream ? source : source.streamEntries;
|
|
13
|
+
}
|
|
14
|
+
start() {
|
|
15
|
+
this.task = this.source.forEach((value) => {
|
|
16
|
+
for (const subscriber of this.subscribers) {
|
|
17
|
+
subscriber(value);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
stop() {
|
|
22
|
+
var _a;
|
|
23
|
+
(_a = this.task) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
24
|
+
}
|
|
25
|
+
subscribe(callback) {
|
|
26
|
+
this.subscribers.add(callback);
|
|
27
|
+
if (this.latestValue !== undefined) {
|
|
28
|
+
callback(this.latestValue);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
cancel: () => {
|
|
32
|
+
this.subscribers.delete(callback);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
stream(objectMaxSize, expiryPeriod) {
|
|
37
|
+
const queue = new Queue(objectMaxSize, expiryPeriod);
|
|
38
|
+
const token = this.subscribe((value) => {
|
|
39
|
+
queue.enqueue(value);
|
|
40
|
+
});
|
|
41
|
+
return queue.streamEntries.onCancellation(token.cancel);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { Signal };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var files = require('../../files.cjs');
|
|
4
|
+
var future = require('../../future/future.cjs');
|
|
5
|
+
require('ramda');
|
|
6
|
+
require('../../stream.cjs');
|
|
7
|
+
|
|
8
|
+
class JSONFileStore {
|
|
9
|
+
constructor(filename) {
|
|
10
|
+
this.filename = filename;
|
|
11
|
+
}
|
|
12
|
+
close() {
|
|
13
|
+
return future.Future.completed(null);
|
|
14
|
+
}
|
|
15
|
+
open() {
|
|
16
|
+
return future.Future.completed(null);
|
|
17
|
+
}
|
|
18
|
+
clear() {
|
|
19
|
+
return files.Files.remove(this.filename);
|
|
20
|
+
}
|
|
21
|
+
get(key) {
|
|
22
|
+
return this.loadJSONData().thenApply(({ value }) => value[key]);
|
|
23
|
+
}
|
|
24
|
+
keys() {
|
|
25
|
+
return this.loadJSONData()
|
|
26
|
+
.thenApply(({ value }) => Object.keys(value))
|
|
27
|
+
.stream.flatten();
|
|
28
|
+
}
|
|
29
|
+
length() {
|
|
30
|
+
return this.loadJSONData().thenApply(({ value }) => Object.keys(value).length);
|
|
31
|
+
}
|
|
32
|
+
remove(key) {
|
|
33
|
+
return this.loadJSONData().thenApply(({ value }) => {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
35
|
+
delete value[key];
|
|
36
|
+
return this.saveJSONData(value);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
set(key, value) {
|
|
40
|
+
return this.loadJSONData().thenApply(({ value: data }) => {
|
|
41
|
+
data[key] = value;
|
|
42
|
+
return this.saveJSONData(data);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
values() {
|
|
46
|
+
return this.loadJSONData()
|
|
47
|
+
.thenApply(({ value }) => Object.values(value))
|
|
48
|
+
.stream.flatten();
|
|
49
|
+
}
|
|
50
|
+
loadJSONData() {
|
|
51
|
+
return files.Files.readString(this.filename).thenApply(({ value }) => (value ? JSON.parse(value) : {}));
|
|
52
|
+
}
|
|
53
|
+
saveJSONData(data) {
|
|
54
|
+
return files.Files.write(JSON.stringify(data), this.filename);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
exports.JSONFileStore = JSONFileStore;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PersistenceStore } from "./manager";
|
|
2
|
+
import { Future } from "../../future";
|
|
3
|
+
import { Stream } from "../../stream";
|
|
4
|
+
export declare class JSONFileStore implements PersistenceStore {
|
|
5
|
+
private readonly filename;
|
|
6
|
+
constructor(filename: string);
|
|
7
|
+
close(): Future<void>;
|
|
8
|
+
open(): Future<void>;
|
|
9
|
+
clear(): Future<void>;
|
|
10
|
+
get(key: string): Future<string | undefined>;
|
|
11
|
+
keys(): Stream<string>;
|
|
12
|
+
length(): Future<number>;
|
|
13
|
+
remove(key: string): Future<void>;
|
|
14
|
+
set(key: string, value: string): Future<void>;
|
|
15
|
+
values(): Stream<string>;
|
|
16
|
+
private loadJSONData;
|
|
17
|
+
private saveJSONData;
|
|
18
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Files } from '../../files.mjs';
|
|
2
|
+
import { Future } from '../../future/future.mjs';
|
|
3
|
+
import 'ramda';
|
|
4
|
+
import '../../stream.mjs';
|
|
5
|
+
|
|
6
|
+
class JSONFileStore {
|
|
7
|
+
constructor(filename) {
|
|
8
|
+
this.filename = filename;
|
|
9
|
+
}
|
|
10
|
+
close() {
|
|
11
|
+
return Future.completed(null);
|
|
12
|
+
}
|
|
13
|
+
open() {
|
|
14
|
+
return Future.completed(null);
|
|
15
|
+
}
|
|
16
|
+
clear() {
|
|
17
|
+
return Files.remove(this.filename);
|
|
18
|
+
}
|
|
19
|
+
get(key) {
|
|
20
|
+
return this.loadJSONData().thenApply(({ value }) => value[key]);
|
|
21
|
+
}
|
|
22
|
+
keys() {
|
|
23
|
+
return this.loadJSONData()
|
|
24
|
+
.thenApply(({ value }) => Object.keys(value))
|
|
25
|
+
.stream.flatten();
|
|
26
|
+
}
|
|
27
|
+
length() {
|
|
28
|
+
return this.loadJSONData().thenApply(({ value }) => Object.keys(value).length);
|
|
29
|
+
}
|
|
30
|
+
remove(key) {
|
|
31
|
+
return this.loadJSONData().thenApply(({ value }) => {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
33
|
+
delete value[key];
|
|
34
|
+
return this.saveJSONData(value);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
set(key, value) {
|
|
38
|
+
return this.loadJSONData().thenApply(({ value: data }) => {
|
|
39
|
+
data[key] = value;
|
|
40
|
+
return this.saveJSONData(data);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
values() {
|
|
44
|
+
return this.loadJSONData()
|
|
45
|
+
.thenApply(({ value }) => Object.values(value))
|
|
46
|
+
.stream.flatten();
|
|
47
|
+
}
|
|
48
|
+
loadJSONData() {
|
|
49
|
+
return Files.readString(this.filename).thenApply(({ value }) => (value ? JSON.parse(value) : {}));
|
|
50
|
+
}
|
|
51
|
+
saveJSONData(data) {
|
|
52
|
+
return Files.write(JSON.stringify(data), this.filename);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { JSONFileStore };
|