@skipruntime/core 0.0.5 → 0.0.10
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/README.md +20 -0
- package/dist/api.d.ts +561 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +75 -0
- package/dist/api.js.map +1 -0
- package/dist/binding.d.ts +1 -1
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +1 -1
- package/dist/binding.js.map +1 -1
- package/dist/errors.d.ts +46 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +46 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -43
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +2 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/api.ts +665 -0
- package/src/binding.ts +1 -1
- package/src/errors.ts +46 -1
- package/src/index.ts +74 -48
- package/src/utils.ts +2 -3
- package/src/binding.js +0 -14
- package/src/errors.js +0 -26
- package/src/index.js +0 -742
- package/src/internal.js +0 -2
- package/src/utils.js +0 -57
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @skipruntime/core
|
|
2
|
+
|
|
3
|
+
This is the Skip runtime public API: types and operations that can be used to
|
|
4
|
+
write and interact with reactive computations.
|
|
5
|
+
|
|
6
|
+
See the [docs](https://skiplabs.io/docs/api/core) for more details.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Install directly using npm (`npm i @skipruntime/core`), or along with other
|
|
11
|
+
components of the runtime by installing the
|
|
12
|
+
[`@skiplabs/skip`](https://www.npmjs.com/package/@skiplabs/skip) meta-package
|
|
13
|
+
(`npm i @skiplabs/skip`).
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Support
|
|
18
|
+
|
|
19
|
+
Join the [Discord](https://discord.gg/ss4zxfgUBH) to talk to other community
|
|
20
|
+
members and developers or ask any questions.
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the Skip Runtime public API: types and operations that can be used to write and interact with reactive computations.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import type { int, Nullable, Opaque } from "@skiplang/std";
|
|
7
|
+
import type { Managed, Json, JsonObject, DepSafe } from "@skiplang/json";
|
|
8
|
+
export * from "./errors.js";
|
|
9
|
+
export type { Managed, Json, JsonObject, Opaque, DepSafe };
|
|
10
|
+
export { deepFreeze } from "@skiplang/json";
|
|
11
|
+
export type { Nullable };
|
|
12
|
+
/**
|
|
13
|
+
* Reactive function that can be mapped over a collection.
|
|
14
|
+
*
|
|
15
|
+
* `EagerCollection.map` accepts a constructor function of a top-level class that implements this `Mapper` interface.
|
|
16
|
+
* Each implementation of `Mapper` provides a `mapEntry` function, which produces some key-value pairs from each key-values `Entry`.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam K1 - Type of input keys.
|
|
19
|
+
* @typeParam V1 - Type of input values.
|
|
20
|
+
* @typeParam K2 - Type of output keys.
|
|
21
|
+
* @typeParam V2 - Type of output values.
|
|
22
|
+
*/
|
|
23
|
+
export interface Mapper<K1 extends Json, V1 extends Json, K2 extends Json, V2 extends Json> {
|
|
24
|
+
/**
|
|
25
|
+
* From an input `key`-`values` entry, produce some key-value pairs to associate in the output.
|
|
26
|
+
*
|
|
27
|
+
* @param key - A key found in the input collection.
|
|
28
|
+
* @param values - The values associated with `key` in the input collection.
|
|
29
|
+
* @returns Key-value pairs to associate in the output collection.
|
|
30
|
+
*/
|
|
31
|
+
mapEntry(key: K1, values: Values<V1>): Iterable<[K2, V2]>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Specialized `Mapper` which maps values one-to-one.
|
|
35
|
+
*
|
|
36
|
+
* A specialized form of `Mapper` which maps values one-to-one, reusing the input collection's key structure in the output collection.
|
|
37
|
+
* Use this form to map each value associated with a key to an output value for that key.
|
|
38
|
+
* This saves some boilerplate: instead of writing the fully general `mapEntry` that potentially modifies, adds, or removes keys, just implement the simpler `mapValue` to transform individual values.
|
|
39
|
+
*
|
|
40
|
+
* @typeParam K - Type of input and output keys.
|
|
41
|
+
* @typeParam V1 - Type of input values.
|
|
42
|
+
* @typeParam V2 - Type of output values.
|
|
43
|
+
* @hideconstructor
|
|
44
|
+
*/
|
|
45
|
+
export declare abstract class OneToOneMapper<K extends Json, V1 extends Json, V2 extends Json> implements Mapper<K, V1, K, V2> {
|
|
46
|
+
/**
|
|
47
|
+
* From an input `key`-`value` association, produce an output value to associate to `key`.
|
|
48
|
+
*
|
|
49
|
+
* @param key - A key found in the input collection.
|
|
50
|
+
* @param value - A value associated with `key` in the input collection.
|
|
51
|
+
* @returns A value to associate with `key` in the output collection.
|
|
52
|
+
*/
|
|
53
|
+
abstract mapValue(value: V1 & DepSafe, key: K): V2;
|
|
54
|
+
/**
|
|
55
|
+
* @ignore
|
|
56
|
+
* @hidden
|
|
57
|
+
*/
|
|
58
|
+
mapEntry(key: K, values: Values<V1>): Iterable<[K, V2]>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Specialized `Mapper` which maps values one-to-many.
|
|
62
|
+
*
|
|
63
|
+
* A specialized form of `Mapper` which maps values one-to-many, reusing the input collection's key structure in the output collection.
|
|
64
|
+
* Use this form to map each value associated with a key to any number of values for that same key.
|
|
65
|
+
* This saves some boilerplate: instead of writing the fully general `mapEntry` that potentially modifies, adds, or removes keys, just implement the simpler `mapValue` to transform the values associated with each key.
|
|
66
|
+
*
|
|
67
|
+
* @typeParam K - Type of input and output keys.
|
|
68
|
+
* @typeParam V1 - Type of input values.
|
|
69
|
+
* @typeParam V2 - Type of output values.
|
|
70
|
+
* @hideconstructor
|
|
71
|
+
*/
|
|
72
|
+
export declare abstract class OneToManyMapper<K extends Json, V1 extends Json, V2 extends Json> implements Mapper<K, V1, K, V2> {
|
|
73
|
+
/**
|
|
74
|
+
* From an input `key`-`values` association, produce some output values to associate to `key`.
|
|
75
|
+
*
|
|
76
|
+
* @param key - A key found in the input collection.
|
|
77
|
+
* @param value - A value associated with `key` in the input collection.
|
|
78
|
+
* @returns Values to associate with `key` in the output collection.
|
|
79
|
+
*/
|
|
80
|
+
abstract mapValue(value: V1 & DepSafe, key: K): V2[];
|
|
81
|
+
/**
|
|
82
|
+
* @ignore
|
|
83
|
+
* @hidden
|
|
84
|
+
*/
|
|
85
|
+
mapEntry(key: K, values: Values<V1>): Iterable<[K, V2]>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Specialized `Mapper` which maps values many-to-one.
|
|
89
|
+
*
|
|
90
|
+
* A specialized form of `Mapper` which maps values many-to-one, reusing the input collection's key structure in the output collection.
|
|
91
|
+
* Use this form to map all the values associated with a key to a single output value for that same key.
|
|
92
|
+
* This saves some boilerplate: instead of writing the fully general `mapEntry` that potentially modifies, adds, or removes keys, just implement the simpler `mapValues` to transform the values associated with each key.
|
|
93
|
+
*
|
|
94
|
+
* @typeParam K - Type of input and output keys.
|
|
95
|
+
* @typeParam V1 - Type of input values.
|
|
96
|
+
* @typeParam V2 - Type of output values.
|
|
97
|
+
* @hideconstructor
|
|
98
|
+
*/
|
|
99
|
+
export declare abstract class ManyToOneMapper<K extends Json, V1 extends Json, V2 extends Json> implements Mapper<K, V1, K, V2> {
|
|
100
|
+
/**
|
|
101
|
+
* From an input `key`-`values` entry, produce some output values to associate to `key`.
|
|
102
|
+
*
|
|
103
|
+
* @param key - A key found in the input collection.
|
|
104
|
+
* @param values - The values associated with `key` in the input collection.
|
|
105
|
+
* @returns The value to associate with `key` in the output collection.
|
|
106
|
+
*/
|
|
107
|
+
abstract mapValues(values: Values<V1>, key: K): V2;
|
|
108
|
+
/**
|
|
109
|
+
* @ignore
|
|
110
|
+
* @hidden
|
|
111
|
+
*/
|
|
112
|
+
mapEntry(key: K, values: Values<V1>): Iterable<[K, V2]>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Reactive function that can be used to accumulate each key's values.
|
|
116
|
+
*
|
|
117
|
+
* `EagerCollection.reduce` accepts a constructor function of a top-level class that implements this `Reducer` interface.
|
|
118
|
+
* For each key in a collection, a `Reducer` can compute and maintain an accumulated value of the key's values as associations are added and removed from the collection.
|
|
119
|
+
*
|
|
120
|
+
* @typeParam V - Type of input values.
|
|
121
|
+
* @typeParam A - Type of accumulated and output values.
|
|
122
|
+
*/
|
|
123
|
+
export interface Reducer<V extends Json, A extends Json> {
|
|
124
|
+
/**
|
|
125
|
+
* Initial accumulated value, providing the accumulated value for keys that are not associated to any values.
|
|
126
|
+
*/
|
|
127
|
+
initial: Nullable<A>;
|
|
128
|
+
/**
|
|
129
|
+
* Include a new value into the accumulated value.
|
|
130
|
+
*
|
|
131
|
+
* @param accum - The current accumulated value; `null` only if `initial` is `null` and `value` is the first to be added.
|
|
132
|
+
* @param value - The added value.
|
|
133
|
+
* @returns The updated accumulated value.
|
|
134
|
+
*/
|
|
135
|
+
add(accum: Nullable<A>, value: V & DepSafe): A;
|
|
136
|
+
/**
|
|
137
|
+
* Exclude a previously added value from the accumulated value.
|
|
138
|
+
*
|
|
139
|
+
* It is always valid for `remove` to return `null`, in which case the correct accumulated value will be computed using `initial` and `add` on each of the key's values.
|
|
140
|
+
*
|
|
141
|
+
* **WARNING**: If `remove` returns a non-`null` value, then it **must** be equal to calling `add` on each of the values associated to the key, starting from `initial`.
|
|
142
|
+
* That is, `accum`, `add(remove(accum, value), value)`, and `remove(add(accum, value), value)` must all be equal for any `accum` and `value` unless both the mentioned `remove` calls return `null`.
|
|
143
|
+
*
|
|
144
|
+
* @param accum - The current accumulated value.
|
|
145
|
+
* @param value - The removed value.
|
|
146
|
+
* @returns The updated accumulated value, or `null` indicating that the accumulated value should be recomputed using `add` and `initial`.
|
|
147
|
+
*/
|
|
148
|
+
remove(accum: A, value: V & DepSafe): Nullable<A>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* An iterable collection of dependency-safe values.
|
|
152
|
+
*/
|
|
153
|
+
export interface Values<T> extends Iterable<T & DepSafe> {
|
|
154
|
+
/**
|
|
155
|
+
* Return the first value, if there is exactly one.
|
|
156
|
+
* @throws {@link SkipNonUniqueValueError} if this iterable contains either zero or multiple values.
|
|
157
|
+
*/
|
|
158
|
+
getUnique(): T & DepSafe;
|
|
159
|
+
/**
|
|
160
|
+
* Return all the values.
|
|
161
|
+
*/
|
|
162
|
+
toArray(): (T & DepSafe)[];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* A _lazy_ reactive collection, whose values are computed only when queried.
|
|
166
|
+
*
|
|
167
|
+
* A `LazyCollection` is a reactive collection of entries that associate keys to values where the entries are computed on-demand in response to queries.
|
|
168
|
+
* Once an entry has been computed, later queries will not need to recompute it, unless it's dependencies have changed.
|
|
169
|
+
*
|
|
170
|
+
* @typeParam K - Type of keys.
|
|
171
|
+
* @typeParam V - Type of values.
|
|
172
|
+
*/
|
|
173
|
+
export interface LazyCollection<K extends Json, V extends Json> extends Managed {
|
|
174
|
+
/**
|
|
175
|
+
* Get (and potentially compute) all values associated to `key`.
|
|
176
|
+
* @param key - The key to query.
|
|
177
|
+
* @returns The values associated to `key`.
|
|
178
|
+
*/
|
|
179
|
+
getArray(key: K): (V & DepSafe)[];
|
|
180
|
+
/**
|
|
181
|
+
* Get (and potentially compute) the single value associated to `key`.
|
|
182
|
+
*
|
|
183
|
+
* For collections that do not use the generality of associating multiple values to a key, `getUnique` saves some boilerplate over `getArray`.
|
|
184
|
+
*
|
|
185
|
+
* @param key - The key to query.
|
|
186
|
+
* @returns The value associated to `key`.
|
|
187
|
+
* @throws {@link SkipNonUniqueValueError} if `key` is associated to either zero or multiple values.
|
|
188
|
+
*/
|
|
189
|
+
getUnique(key: K): V & DepSafe;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* A reactive collection eagerly kept up-to-date.
|
|
193
|
+
*
|
|
194
|
+
* An `EagerCollection` is a reactive collection of entries that associate keys to values where the entries are computed eagerly and kept up to date whenever inputs change.
|
|
195
|
+
*
|
|
196
|
+
* @typeParam K - Type of keys.
|
|
197
|
+
* @typeParam V - Type of values.
|
|
198
|
+
*/
|
|
199
|
+
export interface EagerCollection<K extends Json, V extends Json> extends Managed {
|
|
200
|
+
/**
|
|
201
|
+
* Get all values associated to a key.
|
|
202
|
+
*
|
|
203
|
+
* @param key - The key to query.
|
|
204
|
+
* @returns The values associated to `key`.
|
|
205
|
+
*/
|
|
206
|
+
getArray(key: K): (V & DepSafe)[];
|
|
207
|
+
/**
|
|
208
|
+
* Get the single value associated to a key.
|
|
209
|
+
*
|
|
210
|
+
* For collections that do not use the generality of associating multiple values to a key, `getUnique` saves some boilerplate over `getArray`.
|
|
211
|
+
*
|
|
212
|
+
* @param key - The key to query.
|
|
213
|
+
* @returns The value associated to `key`.
|
|
214
|
+
* @throws {@link SkipNonUniqueValueError} if `key` is associated to either zero or multiple values.
|
|
215
|
+
*/
|
|
216
|
+
getUnique(key: K): V & DepSafe;
|
|
217
|
+
/**
|
|
218
|
+
* Create a new eager collection by mapping a function over the values in this one.
|
|
219
|
+
*
|
|
220
|
+
* For `collection.map(MapperClass, params)`, the `MapperClass` parameter should be the constructor function of a top-level class that implements the `Mapper` interface.
|
|
221
|
+
* This `MapperClass` is instantiated to obtain a mapper object `MapperClass(params)`.
|
|
222
|
+
* For each entry `[key, values]` in `collection`, the result of `MapperClass(params).mapEntry(key, values)` is some `key`-`value` pairs.
|
|
223
|
+
* These `key`-`value` pairs, from calling `mapEntry` on each of the entries in `collection`, are combined to form the contents of the new collection.
|
|
224
|
+
* If there are multiple pairs with the same key, the values are collected so that the result collection associates the key to all such values.
|
|
225
|
+
*
|
|
226
|
+
* This not only produces the output collection, but also records a dependency edge in the computation graph, so that future updates to the input collection will eagerly trigger recomputation of the affected part of the output collection.
|
|
227
|
+
*
|
|
228
|
+
* @remarks
|
|
229
|
+
* The reason `map` accepts the `Mapper` class constructor and `params` separately and instantiates the class internally is to avoid the resulting `mapEntry` functions from being able to access other objects that the Skip Runtime is not aware of, and hence cannot track updates to.
|
|
230
|
+
* This is also the reason the `params` need to have type `DepSafe[]`, as this requires them to be either constant or tracked by the Skip Runtime.
|
|
231
|
+
* It is a **bad idea** to attempt to circumvent the spirit of the constraints this interface imposes.
|
|
232
|
+
*
|
|
233
|
+
* @typeParam K2 - Type of keys of the new collection.
|
|
234
|
+
* @typeParam V2 - Type of values of the new collection.
|
|
235
|
+
* @typeParam Params - Types of additional parameters passed to `mapper`.
|
|
236
|
+
* @param mapper - Constructor of `Mapper` class to transform each entry of this collection.
|
|
237
|
+
* @param params - Additional parameters to `mapper`.
|
|
238
|
+
* @returns The resulting eager collection.
|
|
239
|
+
*/
|
|
240
|
+
map<K2 extends Json, V2 extends Json, Params extends DepSafe[]>(mapper: new (...params: Params) => Mapper<K, V, K2, V2>, ...params: Params): EagerCollection<K2, V2>;
|
|
241
|
+
/**
|
|
242
|
+
* Create a new eager collection from this one that accumulates each key's values.
|
|
243
|
+
*
|
|
244
|
+
* For `collection.reduce(ReducerClass, reducerParams)`, the `ReducerClass` parameter should be the constructor function of a top-level class that implements the `Reducer` interface.
|
|
245
|
+
* This `ReducerClass` is instantiated to obtain a reducer object `ReducerClass(reducerParams)`.
|
|
246
|
+
* For each entry `[key, values]` in `collection`, the result collection associates each `key` to the accumulated result of calling `ReducerClass(reducerParams).add` on each value in `values`, starting from `ReducerClass(reducerParams).initial`.
|
|
247
|
+
* That is, if `values` is `[v1,...,vN]`, then `key` will be associated with `add(...add(add(initial, v1), v2),...,vN)` in the output collection.
|
|
248
|
+
*
|
|
249
|
+
* This not only produces the output collection, but also records a dependency edge in the computation graph, so that future updates to the input collection will eagerly trigger recomputation of the affected part of the output collection.
|
|
250
|
+
*
|
|
251
|
+
* During such recomputations, if an update is made to the input collection that results in a value that used to be associated to a key no longer being associated, then the reducer object's `remove` function is used to update the accumulated value.
|
|
252
|
+
* The `remove` function may return `null`, in which case the accumulated value is recomputed using `add` and `initial`.
|
|
253
|
+
*
|
|
254
|
+
* @remarks
|
|
255
|
+
* The reason `reduce` accepts the `Reducer` class constructor and `params` separately and instantiates the class internally is to avoid the resulting `add` and `remove` functions from being able to access other objects that the Skip Runtime is not aware of, and hence cannot track updates to.
|
|
256
|
+
* This is also the reason the `params` need to have type `DepSafe[]`, as this requires them to be either constant values or tracked by the Skip Runtime.
|
|
257
|
+
* It is a **bad idea** to attempt to circumvent the spirit of the constraints this interface imposes.
|
|
258
|
+
*
|
|
259
|
+
* @typeParam Accum - Type of accumulated values.
|
|
260
|
+
* @typeParam Params - Types of additional parameters passed to `reducer`
|
|
261
|
+
* @param reducer - Constructor of `Reducer` class to accumulate values of this collection.
|
|
262
|
+
* @param params - Additional parameters to `reducer`
|
|
263
|
+
* @returns The resulting eager collection.
|
|
264
|
+
*/
|
|
265
|
+
reduce<Accum extends Json, Params extends DepSafe[]>(reducer: new (...params: Params) => Reducer<V, Accum>, ...params: Params): EagerCollection<K, Accum>;
|
|
266
|
+
/**
|
|
267
|
+
* Composition of `map` and `reduce`.
|
|
268
|
+
*
|
|
269
|
+
* The result of `collection.mapReduce(MapperClass, mapperParams)(ReducerClass, reducerParams)` is equivalent to `collection.map(MapperClass, mapperParams).reduce(ReducerClass, reducerParams)` but more efficient due to avoiding the intermediate collection.
|
|
270
|
+
*
|
|
271
|
+
* Note that this function is _curried_ so that mapper and reducer rest parameters can be provided separately, e.g. as `mapReduce(MyMapper, foo, bar)(MyReducer, baz)`
|
|
272
|
+
*
|
|
273
|
+
* @typeParam K2 - Type of keys of the new collection.
|
|
274
|
+
* @typeParam V2 - Type of values of the new collection.
|
|
275
|
+
* @typeParam MapperParams - Types of additional parameters passed to `mapper`.
|
|
276
|
+
* @param mapper - Constructor of `Mapper` class to transform each entry of this collection.
|
|
277
|
+
* @param mapperParams - Additional parameters to `mapper`.
|
|
278
|
+
*/
|
|
279
|
+
mapReduce<K2 extends Json, V2 extends Json, MapperParams extends DepSafe[]>(mapper: new (...params: MapperParams) => Mapper<K, V, K2, V2>, ...mapperParams: MapperParams):
|
|
280
|
+
/**
|
|
281
|
+
* @typeParam Accum - Type of accumulated values.
|
|
282
|
+
* @typeParam ReducerParams - Types of additional parameters passed to `reducer`
|
|
283
|
+
* @param reducer - Constructor of `Reducer` class to accumulate values of this collection.
|
|
284
|
+
* @param reducerParams - Additional parameters to `reducer`
|
|
285
|
+
* @returns The resulting eager collection.
|
|
286
|
+
*/
|
|
287
|
+
<Accum extends Json, ReducerParams extends DepSafe[]>(reducer: new (...params: ReducerParams) => Reducer<V2, Accum>, ...reducerParams: ReducerParams) => EagerCollection<K2, Accum>;
|
|
288
|
+
/**
|
|
289
|
+
* Create a new eager collection by keeping only the elements whose keys are in the given range.
|
|
290
|
+
*
|
|
291
|
+
* @param start - The least key whose entry will be kept in the result.
|
|
292
|
+
* @param end - The greatest key whose entry will be kept in the result.
|
|
293
|
+
* @returns The restricted eager collection.
|
|
294
|
+
*/
|
|
295
|
+
slice(start: K & DepSafe, end: K & DepSafe): EagerCollection<K, V>;
|
|
296
|
+
/**
|
|
297
|
+
* Create a new eager collection by keeping only the elements whose keys are in at least one of the given ranges.
|
|
298
|
+
*
|
|
299
|
+
* @param ranges - The pairs of lower and upper bounds on keys to keep in the result.
|
|
300
|
+
* @returns The restricted eager collection.
|
|
301
|
+
*/
|
|
302
|
+
slices(...ranges: [K & DepSafe, K & DepSafe][]): EagerCollection<K, V>;
|
|
303
|
+
/**
|
|
304
|
+
* Create a new eager collection by keeping the first entries.
|
|
305
|
+
*
|
|
306
|
+
* @param limit - The number of entries to keep.
|
|
307
|
+
* @returns The restricted eager collection.
|
|
308
|
+
*/
|
|
309
|
+
take(limit: int): EagerCollection<K, V>;
|
|
310
|
+
/**
|
|
311
|
+
* Combine some eager collections into one, associating with each key _all_ values associated with that key in any of the input collections.
|
|
312
|
+
*
|
|
313
|
+
* @param others - Eager collections to merge with this one.
|
|
314
|
+
* @returns The resulting combination of all input key-value pairs.
|
|
315
|
+
*/
|
|
316
|
+
merge(...others: EagerCollection<K, V>[]): EagerCollection<K, V>;
|
|
317
|
+
/**
|
|
318
|
+
* The current number of entries in the collection.
|
|
319
|
+
*
|
|
320
|
+
* @returns The number of entries.
|
|
321
|
+
*/
|
|
322
|
+
size(): number;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Reactive function that is computed _lazily_ and memoized.
|
|
326
|
+
*
|
|
327
|
+
* `Context.createLazyCollection` accepts a constructor function of a top-level class that implements this `LazyCompute` interface.
|
|
328
|
+
* Each implementation of `LazyCompute` provides a `compute` function, which produces values for some `key`, possibly using a `self` reference to get/produce other lazily-computed results.
|
|
329
|
+
*
|
|
330
|
+
* @typeParam K - Type of keys / inputs.
|
|
331
|
+
* @typeParam V - Type of values / outputs.
|
|
332
|
+
*/
|
|
333
|
+
export interface LazyCompute<K extends Json, V extends Json> {
|
|
334
|
+
/**
|
|
335
|
+
* Compute the values of the lazy function for a given `key`.
|
|
336
|
+
*
|
|
337
|
+
* When computing the values for a requested key, the `compute` function is provided with a `LazyCollection` that is tabulating the input-output relation of this function.
|
|
338
|
+
* This collection can be queried in order to look up the values for previously computed keys, or to make a recursive call to `compute` if the requested key has not yet been computed.
|
|
339
|
+
*
|
|
340
|
+
* @param self - The collection tabulating this lazy function.
|
|
341
|
+
* @param key - The requested key / input.
|
|
342
|
+
* @returns The values of the lazy function for `key`.
|
|
343
|
+
*/
|
|
344
|
+
compute(self: LazyCollection<K, V>, key: K): Iterable<V>;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Skip Runtime internal state.
|
|
348
|
+
*/
|
|
349
|
+
export interface Context extends Managed {
|
|
350
|
+
/**
|
|
351
|
+
* Create a lazy reactive collection.
|
|
352
|
+
*
|
|
353
|
+
* @typeParam K - Type of keys / inputs.
|
|
354
|
+
* @typeParam V - Type of values / outputs.
|
|
355
|
+
* @typeParam Params - Types of additional parameters passed to `compute`.
|
|
356
|
+
* @param compute - Constructor of `LazyCompute` class to compute entries of the lazy collection.
|
|
357
|
+
* @param params - Additional parameters to `compute`.
|
|
358
|
+
* @returns The resulting lazy collection.
|
|
359
|
+
*/
|
|
360
|
+
createLazyCollection<K extends Json, V extends Json, Params extends DepSafe[]>(compute: new (...params: Params) => LazyCompute<K, V>, ...params: Params): LazyCollection<K, V>;
|
|
361
|
+
/**
|
|
362
|
+
* Create an eager reactive collection populated from a resource managed by an external service.
|
|
363
|
+
*
|
|
364
|
+
* @typeParam K - Type of keys.
|
|
365
|
+
* @typeParam V - Type of values.
|
|
366
|
+
* @param resource - External resource configuration.
|
|
367
|
+
* @param resource.service - Name of the external service, which must be a key in the `externalServices` field of the `SkipService` to which this `Context` belongs.
|
|
368
|
+
* @param resource.identifier - Identifier of resource managed by the external service.
|
|
369
|
+
* @param resource.params - Parameters to supply to the resource.
|
|
370
|
+
* @returns An eager reactive collection of the external resource.
|
|
371
|
+
*/
|
|
372
|
+
useExternalResource<K extends Json, V extends Json>(resource: {
|
|
373
|
+
service: string;
|
|
374
|
+
identifier: string;
|
|
375
|
+
params?: Json;
|
|
376
|
+
}): EagerCollection<K, V>;
|
|
377
|
+
jsonExtract(value: JsonObject, pattern: string): Json[];
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Association of a key to multiple values.
|
|
381
|
+
*
|
|
382
|
+
* @typeParam K - Type of keys.
|
|
383
|
+
* @typeParam V - Type of values.
|
|
384
|
+
*/
|
|
385
|
+
export type Entry<K extends Json, V extends Json> = [K, V[]];
|
|
386
|
+
/**
|
|
387
|
+
* Opaque type used as a measure of abstract time.
|
|
388
|
+
*/
|
|
389
|
+
export type Watermark = Opaque<string, "watermark">;
|
|
390
|
+
/**
|
|
391
|
+
* Partial update to a collection
|
|
392
|
+
*
|
|
393
|
+
* @typeParam K - Type of keys.
|
|
394
|
+
* @typeParam V - Type of values.
|
|
395
|
+
*/
|
|
396
|
+
export type CollectionUpdate<K extends Json, V extends Json> = {
|
|
397
|
+
/**
|
|
398
|
+
* All updated keys and their new values.
|
|
399
|
+
* An empty array indicates deletion.
|
|
400
|
+
*/
|
|
401
|
+
values: Entry<K, V>[];
|
|
402
|
+
/**
|
|
403
|
+
* A new _watermark_ for the point after these updates.
|
|
404
|
+
*/
|
|
405
|
+
watermark: Watermark;
|
|
406
|
+
/**
|
|
407
|
+
* A flag which is set when this update is the initial chunk of data rather than an update to the preceding state.
|
|
408
|
+
*/
|
|
409
|
+
isInitial?: boolean;
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* Interface to an external service.
|
|
413
|
+
*
|
|
414
|
+
* External services must be carefully managed in reactive Skip services to make sure that dependencies are properly tracked and data from external systems is kept up to date.
|
|
415
|
+
*
|
|
416
|
+
* `Context.useExternalResource` accepts the name of an external service, which must be associated to an instance of this `ExternalService` interface by `SkipService.externalServices`.
|
|
417
|
+
*
|
|
418
|
+
* There are two main implementations of `ExternalService`, depending on whether the external data source is a reactive Skip service or not.
|
|
419
|
+
*
|
|
420
|
+
* If it _is_ a Skip service, then `SkipExternalService` can be used, specifying an entrypoint.
|
|
421
|
+
* The external Skip service will update its resources reactively and those changes will propagate through this service.
|
|
422
|
+
*
|
|
423
|
+
* If it is _not_ a Skip service, then `GenericExternalService` and `Polled` can be used to specify the external source and desired polling frequency.
|
|
424
|
+
*/
|
|
425
|
+
export interface ExternalService {
|
|
426
|
+
/**
|
|
427
|
+
* Subscribe to a resource provided by the external service.
|
|
428
|
+
*
|
|
429
|
+
* @param instance - Instance identifier of the external resource.
|
|
430
|
+
* @param resource - Name of the external resource.
|
|
431
|
+
* @param params - Parameters of the external resource.
|
|
432
|
+
* @param callbacks - Callbacks to react on error/loading/update.
|
|
433
|
+
* @param callbacks.error - Error callback.
|
|
434
|
+
* @param callbacks.loading - Loading callback.
|
|
435
|
+
* @param callbacks.update - Update callback.
|
|
436
|
+
* @returns {void}
|
|
437
|
+
*/
|
|
438
|
+
subscribe(instance: string, resource: string, params: Json, callbacks: {
|
|
439
|
+
update: (updates: Entry<Json, Json>[], isInit: boolean) => void;
|
|
440
|
+
error: (error: Json) => void;
|
|
441
|
+
loading: () => void;
|
|
442
|
+
}): void;
|
|
443
|
+
/**
|
|
444
|
+
* Unsubscribe from a resource provided by the external service.
|
|
445
|
+
*
|
|
446
|
+
* @param instance - Instance identifier of the external resource.
|
|
447
|
+
* @returns {void}
|
|
448
|
+
*/
|
|
449
|
+
unsubscribe(instance: string): void;
|
|
450
|
+
/**
|
|
451
|
+
* Shutdown the external service.
|
|
452
|
+
*
|
|
453
|
+
* @returns {void}
|
|
454
|
+
*/
|
|
455
|
+
shutdown(): void;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Association of names to collections.
|
|
459
|
+
*/
|
|
460
|
+
export type NamedCollections = {
|
|
461
|
+
[name: string]: EagerCollection<Json, Json>;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Resource provided by a `SkipService`.
|
|
465
|
+
*
|
|
466
|
+
* `Resource`s make up the public interface of a `SkipService`, specifying how to respond to reactive requests, either by accessing data from the static computation graph generated in the service's `createGraph` function or extending it with further reactive computations as needed to handle the request.
|
|
467
|
+
*
|
|
468
|
+
* @typeParam Collections - Collections provided to the resource computation by the service's `createGraph`.
|
|
469
|
+
*/
|
|
470
|
+
export interface Resource<Collections extends NamedCollections = NamedCollections> {
|
|
471
|
+
/**
|
|
472
|
+
* Build the reactive compute graph of the reactive resource.
|
|
473
|
+
*
|
|
474
|
+
* @param collections - Collections provided by the service's `createGraph`.
|
|
475
|
+
* @param context - Skip Runtime internal state.
|
|
476
|
+
* @returns An eager collection containing the outputs of this resource for the given parameters, produced from the static reactive compute graph output collections of the service's `createGraph`.
|
|
477
|
+
*/
|
|
478
|
+
instantiate(collections: Collections, context: Context): EagerCollection<Json, Json>;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Initial data for a service's input collections.
|
|
482
|
+
*
|
|
483
|
+
* The initial data to populate a service's input collections is provided as an association from collection names to arrays of entries.
|
|
484
|
+
*
|
|
485
|
+
* @typeParam Inputs - Collections provided to the service's `createGraph`.
|
|
486
|
+
*/
|
|
487
|
+
export type InitialData<Inputs extends NamedCollections> = {
|
|
488
|
+
[Name in keyof Inputs]: Inputs[Name] extends EagerCollection<infer K, infer V> ? Entry<K, V>[] : Entry<Json, Json>[];
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* A Skip reactive service encapsulating a reactive computation.
|
|
492
|
+
*
|
|
493
|
+
* A reactive Skip service is defined by a class implementing this `SkipService` interface.
|
|
494
|
+
*
|
|
495
|
+
* Skip services operate over data organized into _collections_, each of which has a unique string name and associates _keys_ to one or more _values_.
|
|
496
|
+
* The contents of collections are computed from initial data, other collections, or reactive or non-reactive external resources.
|
|
497
|
+
*
|
|
498
|
+
* A Skip service's `Inputs` are collections that start populated with the `initialData`.
|
|
499
|
+
* The input collections is the mechanism by which a Skip service can accept writes.
|
|
500
|
+
* See `runService` for the write requests of the HTTP API, and `SkipServiceBroker` for the write operations of the method-call API.
|
|
501
|
+
*
|
|
502
|
+
* It can be useful to think of the structure of a service's computation as a directed acyclic graph, the _reactive computation graph_, where the vertices are the named collections, and the edges are the functions (`Mapper`s and `Reducer`s) that produce collections from other collections.
|
|
503
|
+
* Part of the graph is structured in a way that is not dependent on the data or requests the service encounters at runtime: it is _static_.
|
|
504
|
+
* The rest of the graph is _dynamic_ in the sense that collections/vertices are added in response to requests and data received at runtime by the service.
|
|
505
|
+
* The static portion of the graph is defined by `createGraph`, which receives the service's input collections.
|
|
506
|
+
* The result of `createGraph` is the boundary of the static reactive computation graph: named collections that are made available to the dynamic reactive computation graph as inputs to the `instantiate` computations of `Resource`s.
|
|
507
|
+
*
|
|
508
|
+
* `Resource`s are the mechanism by which a service's collections are exposed to other services and clients for reading.
|
|
509
|
+
* A `Resource` implementation provides an `instantiate` function which is similar to `createGraph` but receives the boundary collections of the static reactive computation graph and only produces a single collection.
|
|
510
|
+
* The simplest `Resource`s just return one of the collections they receive as an argument, thereby exposing a collection that would otherwise be internal to the service.
|
|
511
|
+
* `Resource`s define the _dynamic_ portion of the reactive computation graph that arises in response to requests and data at runtime, extending the _static_ computation graph.
|
|
512
|
+
*
|
|
513
|
+
* `Resource`s are exposed by a `SkipService` implementation providing `resources` that associates resource names to `Resource` constructors.
|
|
514
|
+
* The interface involves class constructor functions for `Resource`s since they are instantiated at runtime by the Skip framework in response to requests, using parameters provided as part of the request.
|
|
515
|
+
* When a `SkipService` receives a request, the corresponding `Resource` constructor is called with parameters obtained from the request, the resource object's `instantiate` function is called to produce a collection containing the results.
|
|
516
|
+
* Depending on the request, the requestor can read these results synchronously or subscribe to a stream of update events.
|
|
517
|
+
* Resource result collections are maintained up-to-date, with updates being reactively pushed to subscribers.
|
|
518
|
+
* See `runService` for the HTTP API for reading resources, and `SkipServiceBroker` for a method-call API.
|
|
519
|
+
*
|
|
520
|
+
* Some of a Skip service's collections, those of type `EagerCollection`, are eagerly kept up-to-date by the framework.
|
|
521
|
+
* This includes the static portion of the reactive computation graph, so the static portion serves as pre-computed data that can be used by individual requests.
|
|
522
|
+
* The result collections produced by instantiating `Resource`s are also eager and kept up-to-date.
|
|
523
|
+
* Note that this implies that the static portion of the reactive computation graph, as well as the results of resources, are eagerly updated when the service receives a write to an input collection.
|
|
524
|
+
* The computation of a `Resource`'s output collection may use intermediate collections that are either eager or lazy.
|
|
525
|
+
* A lazy collection, of type `LazyCollection`, is one where the entries are only computed on-demand as a result of querying particular keys.
|
|
526
|
+
* Lazy collections memoize computations that are performed as part of computing the result of an update to an input of an eager collection.
|
|
527
|
+
* Lazy collections cannot be directly exposed as resources, but a couple auxiliary eager collections can be used to achieve the same effect.
|
|
528
|
+
*
|
|
529
|
+
* Skip services can also make use of external services to compute their results.
|
|
530
|
+
* Within the bodies of `SkipService.createGraph` or `Resource.instantiate`, an external service can be accessed using `Context.useExternalResource`.
|
|
531
|
+
* `Context.useExternalResource` accepts the name of an external service, which must be associated to an instance of the `ExternalService` interface by the `externalServices`, as well as a resource the external service provides and parameters for it, and returns an eager collection of the contents of the resource provided by the external service.
|
|
532
|
+
* The resulting eager collection can then be incorporated into the reactive computation graph just like any other.
|
|
533
|
+
*
|
|
534
|
+
* @typeParam Inputs - The service's input collections.
|
|
535
|
+
* @typeParam ResourceInputs - Collections provided to the resource computation by the service's `createGraph`.
|
|
536
|
+
*/
|
|
537
|
+
export interface SkipService<Inputs extends NamedCollections = NamedCollections, ResourceInputs extends NamedCollections = NamedCollections> {
|
|
538
|
+
/**
|
|
539
|
+
* Initial data for this service's input collections.
|
|
540
|
+
*
|
|
541
|
+
* @remarks While the initial data is not required to have a `DepSafe` type (only a subtype of `Json` is required); note that any modifications made to any objects passed as `initialData` will *not* be seen by a service once started.
|
|
542
|
+
*/
|
|
543
|
+
initialData?: InitialData<Inputs>;
|
|
544
|
+
/** External services that may be used by this service's reactive computation. */
|
|
545
|
+
externalServices?: {
|
|
546
|
+
[name: string]: ExternalService;
|
|
547
|
+
};
|
|
548
|
+
/** Reactive resources which constitute the public interface of this reactive service. */
|
|
549
|
+
resources: {
|
|
550
|
+
[name: string]: new (params: Json) => Resource<ResourceInputs>;
|
|
551
|
+
};
|
|
552
|
+
/**
|
|
553
|
+
* Build the static reactive computation graph by defining collections to be passed to resources.
|
|
554
|
+
*
|
|
555
|
+
* @param inputCollections - The service's input collections.
|
|
556
|
+
* @param context - Skip Runtime internal state.
|
|
557
|
+
* @returns Reactive collections accessible to the resources.
|
|
558
|
+
*/
|
|
559
|
+
createGraph(inputCollections: Inputs, context: Context): ResourceInputs;
|
|
560
|
+
}
|
|
561
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAA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