@skipruntime/core 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/api.d.ts +9 -11
- package/dist/src/api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +9 -11
package/dist/src/api.d.ts
CHANGED
|
@@ -405,7 +405,7 @@ export type NamedCollections = {
|
|
|
405
405
|
/**
|
|
406
406
|
* Resource provided by a `SkipService`.
|
|
407
407
|
*
|
|
408
|
-
* `Resource`s make up the public interface of a `SkipService`, specifying how to respond to reactive requests, either by accessing data from the
|
|
408
|
+
* `Resource`s make up the public interface of a `SkipService`, specifying how to respond to reactive requests, either by accessing data from the shared computation graph generated in the service's `createGraph` function or extending it with further reactive computations as needed to handle the request.
|
|
409
409
|
*
|
|
410
410
|
* @typeParam Collections - Collections provided to the resource computation by the service's `createGraph`.
|
|
411
411
|
*/
|
|
@@ -415,7 +415,7 @@ export interface Resource<Collections extends NamedCollections = NamedCollection
|
|
|
415
415
|
*
|
|
416
416
|
* @param collections - Collections provided by the service's `createGraph`.
|
|
417
417
|
* @param context - Skip Runtime internal state.
|
|
418
|
-
* @returns An eager collection containing the outputs of this resource for the given parameters, produced from the
|
|
418
|
+
* @returns An eager collection containing the outputs of this resource for the given parameters, produced from the shared reactive compute graph output collections of the service's `createGraph`.
|
|
419
419
|
*/
|
|
420
420
|
instantiate(collections: Collections, context: Context): EagerCollection<Json, Json>;
|
|
421
421
|
}
|
|
@@ -442,15 +442,13 @@ export type InitialData<Inputs extends NamedCollections> = {
|
|
|
442
442
|
* See `runService` for the write requests of the HTTP API, and `SkipServiceBroker` for the write operations of the method-call API.
|
|
443
443
|
*
|
|
444
444
|
* 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.
|
|
445
|
-
*
|
|
446
|
-
* The
|
|
447
|
-
* The static portion of the graph is defined by `createGraph`, which receives the service's input collections.
|
|
448
|
-
* 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.
|
|
445
|
+
* The shared portion of the graph is defined by `createGraph`, which receives the service's input collections.
|
|
446
|
+
* The result of `createGraph` is the boundary of the shared reactive computation graph: named collections that are made available to `Resource`s as inputs to the `instantiate` computations.
|
|
449
447
|
*
|
|
450
448
|
* `Resource`s are the mechanism by which a service's collections are exposed to other services and clients for reading.
|
|
451
|
-
* A `Resource` implementation provides an `instantiate` function which is similar to `createGraph` but receives the boundary collections of the
|
|
449
|
+
* A `Resource` implementation provides an `instantiate` function which is similar to `createGraph` but receives the boundary collections of the shared reactive computation graph and only produces a single collection.
|
|
452
450
|
* 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.
|
|
453
|
-
* `Resource`s define
|
|
451
|
+
* `Resource`s define extensions of the reactive computation graph that arises in response to requests and data at runtime, extending the shared computation graph.
|
|
454
452
|
*
|
|
455
453
|
* `Resource`s are exposed by a `SkipService` implementation providing `resources` that associates resource names to `Resource` constructors.
|
|
456
454
|
* 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.
|
|
@@ -460,9 +458,9 @@ export type InitialData<Inputs extends NamedCollections> = {
|
|
|
460
458
|
* See `runService` for the HTTP API for reading resources, and `SkipServiceBroker` for a method-call API.
|
|
461
459
|
*
|
|
462
460
|
* Some of a Skip service's collections, those of type `EagerCollection`, are eagerly kept up-to-date by the framework.
|
|
463
|
-
* This includes the
|
|
461
|
+
* This includes the boundary of the shared portion of the reactive computation graph, so the shared portion serves as pre-computed data that can be used by individual requests.
|
|
464
462
|
* The result collections produced by instantiating `Resource`s are also eager and kept up-to-date.
|
|
465
|
-
* Note that this implies that the
|
|
463
|
+
* Note that this implies that the shared 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.
|
|
466
464
|
* The computation of a `Resource`'s output collection may use intermediate collections that are either eager or lazy.
|
|
467
465
|
* A lazy collection, of type `LazyCollection`, is one where the entries are only computed on-demand as a result of querying particular keys.
|
|
468
466
|
* Lazy collections memoize computations that are performed as part of computing the result of an update to an input of an eager collection.
|
|
@@ -492,7 +490,7 @@ export interface SkipService<Inputs extends NamedCollections = NamedCollections,
|
|
|
492
490
|
[name: string]: new (params: Json) => Resource<ResourceInputs>;
|
|
493
491
|
};
|
|
494
492
|
/**
|
|
495
|
-
* Build the
|
|
493
|
+
* Build the shared reactive computation graph by defining collections to be passed to resources.
|
|
496
494
|
*
|
|
497
495
|
* @param inputCollections - The service's input collections.
|
|
498
496
|
* @param context - Skip Runtime internal state.
|
package/dist/src/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EACV,OAAO,EACP,IAAI,EACJ,UAAU,EACV,OAAO,EACR,MAAM,2BAA2B,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,MAAM,CACrB,EAAE,SAAS,IAAI,EACf,EAAE,SAAS,IAAI,EACf,EAAE,SAAS,IAAI,EACf,EAAE,SAAS,IAAI;IAEf;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,CA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AM,WAAW,CAAC,MAAM,SAAS,gBAAgB,IAAI;KACxD,IAAI,IAAI,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC1E,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GACb,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,WAAW,CAC1B,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,EAClD,cAAc,SAAS,gBAAgB,GAAG,gBAAgB;IAE1D;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAElC,iFAAiF;IACjF,gBAAgB,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAC;IAEvD,yFAAyF;IACzF,SAAS,EAAE;QACT,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,IAAI,KAAK,QAAQ,CAAC,cAAc,CAAC,CAAC;KAChE,CAAC;IAEF;;;;;;OAMG;IACH,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,CAAC;CACzE"}
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -465,7 +465,7 @@ export type NamedCollections = { [name: string]: EagerCollection<Json, Json> };
|
|
|
465
465
|
/**
|
|
466
466
|
* Resource provided by a `SkipService`.
|
|
467
467
|
*
|
|
468
|
-
* `Resource`s make up the public interface of a `SkipService`, specifying how to respond to reactive requests, either by accessing data from the
|
|
468
|
+
* `Resource`s make up the public interface of a `SkipService`, specifying how to respond to reactive requests, either by accessing data from the shared computation graph generated in the service's `createGraph` function or extending it with further reactive computations as needed to handle the request.
|
|
469
469
|
*
|
|
470
470
|
* @typeParam Collections - Collections provided to the resource computation by the service's `createGraph`.
|
|
471
471
|
*/
|
|
@@ -477,7 +477,7 @@ export interface Resource<
|
|
|
477
477
|
*
|
|
478
478
|
* @param collections - Collections provided by the service's `createGraph`.
|
|
479
479
|
* @param context - Skip Runtime internal state.
|
|
480
|
-
* @returns An eager collection containing the outputs of this resource for the given parameters, produced from the
|
|
480
|
+
* @returns An eager collection containing the outputs of this resource for the given parameters, produced from the shared reactive compute graph output collections of the service's `createGraph`.
|
|
481
481
|
*/
|
|
482
482
|
instantiate(
|
|
483
483
|
collections: Collections,
|
|
@@ -511,15 +511,13 @@ export type InitialData<Inputs extends NamedCollections> = {
|
|
|
511
511
|
* See `runService` for the write requests of the HTTP API, and `SkipServiceBroker` for the write operations of the method-call API.
|
|
512
512
|
*
|
|
513
513
|
* 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.
|
|
514
|
-
*
|
|
515
|
-
* The
|
|
516
|
-
* The static portion of the graph is defined by `createGraph`, which receives the service's input collections.
|
|
517
|
-
* 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.
|
|
514
|
+
* The shared portion of the graph is defined by `createGraph`, which receives the service's input collections.
|
|
515
|
+
* The result of `createGraph` is the boundary of the shared reactive computation graph: named collections that are made available to `Resource`s as inputs to the `instantiate` computations.
|
|
518
516
|
*
|
|
519
517
|
* `Resource`s are the mechanism by which a service's collections are exposed to other services and clients for reading.
|
|
520
|
-
* A `Resource` implementation provides an `instantiate` function which is similar to `createGraph` but receives the boundary collections of the
|
|
518
|
+
* A `Resource` implementation provides an `instantiate` function which is similar to `createGraph` but receives the boundary collections of the shared reactive computation graph and only produces a single collection.
|
|
521
519
|
* 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.
|
|
522
|
-
* `Resource`s define
|
|
520
|
+
* `Resource`s define extensions of the reactive computation graph that arises in response to requests and data at runtime, extending the shared computation graph.
|
|
523
521
|
*
|
|
524
522
|
* `Resource`s are exposed by a `SkipService` implementation providing `resources` that associates resource names to `Resource` constructors.
|
|
525
523
|
* 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.
|
|
@@ -529,9 +527,9 @@ export type InitialData<Inputs extends NamedCollections> = {
|
|
|
529
527
|
* See `runService` for the HTTP API for reading resources, and `SkipServiceBroker` for a method-call API.
|
|
530
528
|
*
|
|
531
529
|
* Some of a Skip service's collections, those of type `EagerCollection`, are eagerly kept up-to-date by the framework.
|
|
532
|
-
* This includes the
|
|
530
|
+
* This includes the boundary of the shared portion of the reactive computation graph, so the shared portion serves as pre-computed data that can be used by individual requests.
|
|
533
531
|
* The result collections produced by instantiating `Resource`s are also eager and kept up-to-date.
|
|
534
|
-
* Note that this implies that the
|
|
532
|
+
* Note that this implies that the shared 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.
|
|
535
533
|
* The computation of a `Resource`'s output collection may use intermediate collections that are either eager or lazy.
|
|
536
534
|
* A lazy collection, of type `LazyCollection`, is one where the entries are only computed on-demand as a result of querying particular keys.
|
|
537
535
|
* Lazy collections memoize computations that are performed as part of computing the result of an update to an input of an eager collection.
|
|
@@ -565,7 +563,7 @@ export interface SkipService<
|
|
|
565
563
|
};
|
|
566
564
|
|
|
567
565
|
/**
|
|
568
|
-
* Build the
|
|
566
|
+
* Build the shared reactive computation graph by defining collections to be passed to resources.
|
|
569
567
|
*
|
|
570
568
|
* @param inputCollections - The service's input collections.
|
|
571
569
|
* @param context - Skip Runtime internal state.
|