@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/dist/api.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
export * from "./errors.js";
|
|
7
|
+
export { deepFreeze } from "@skiplang/json";
|
|
8
|
+
/**
|
|
9
|
+
* Specialized `Mapper` which maps values one-to-one.
|
|
10
|
+
*
|
|
11
|
+
* A specialized form of `Mapper` which maps values one-to-one, reusing the input collection's key structure in the output collection.
|
|
12
|
+
* Use this form to map each value associated with a key to an output value for that key.
|
|
13
|
+
* 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.
|
|
14
|
+
*
|
|
15
|
+
* @typeParam K - Type of input and output keys.
|
|
16
|
+
* @typeParam V1 - Type of input values.
|
|
17
|
+
* @typeParam V2 - Type of output values.
|
|
18
|
+
* @hideconstructor
|
|
19
|
+
*/
|
|
20
|
+
export class OneToOneMapper {
|
|
21
|
+
/**
|
|
22
|
+
* @ignore
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
mapEntry(key, values) {
|
|
26
|
+
return values.toArray().map((v) => [key, this.mapValue(v, key)]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Specialized `Mapper` which maps values one-to-many.
|
|
31
|
+
*
|
|
32
|
+
* A specialized form of `Mapper` which maps values one-to-many, reusing the input collection's key structure in the output collection.
|
|
33
|
+
* Use this form to map each value associated with a key to any number of values for that same key.
|
|
34
|
+
* 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.
|
|
35
|
+
*
|
|
36
|
+
* @typeParam K - Type of input and output keys.
|
|
37
|
+
* @typeParam V1 - Type of input values.
|
|
38
|
+
* @typeParam V2 - Type of output values.
|
|
39
|
+
* @hideconstructor
|
|
40
|
+
*/
|
|
41
|
+
export class OneToManyMapper {
|
|
42
|
+
/**
|
|
43
|
+
* @ignore
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
mapEntry(key, values) {
|
|
47
|
+
const res = [];
|
|
48
|
+
for (const v1 of values)
|
|
49
|
+
for (const v2 of this.mapValue(v1, key))
|
|
50
|
+
res.push([key, v2]);
|
|
51
|
+
return res;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Specialized `Mapper` which maps values many-to-one.
|
|
56
|
+
*
|
|
57
|
+
* A specialized form of `Mapper` which maps values many-to-one, reusing the input collection's key structure in the output collection.
|
|
58
|
+
* Use this form to map all the values associated with a key to a single output value for that same key.
|
|
59
|
+
* 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.
|
|
60
|
+
*
|
|
61
|
+
* @typeParam K - Type of input and output keys.
|
|
62
|
+
* @typeParam V1 - Type of input values.
|
|
63
|
+
* @typeParam V2 - Type of output values.
|
|
64
|
+
* @hideconstructor
|
|
65
|
+
*/
|
|
66
|
+
export class ManyToOneMapper {
|
|
67
|
+
/**
|
|
68
|
+
* @ignore
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
mapEntry(key, values) {
|
|
72
|
+
return [[key, this.mapValues(values, key)]];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA8B5C;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,cAAc;IAelC;;;OAGG;IACH,QAAQ,CAAC,GAAM,EAAE,MAAkB;QACjC,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,eAAe;IAenC;;;OAGG;IACH,QAAQ,CAAC,GAAM,EAAE,MAAkB;QACjC,MAAM,GAAG,GAAc,EAAE,CAAC;QAC1B,KAAK,MAAM,EAAE,IAAI,MAAM;YACrB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/D,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,eAAe;IAenC;;;OAGG;IACH,QAAQ,CAAC,GAAM,EAAE,MAAkB;QACjC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/dist/binding.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Pointer, Nullable, Json } from "@skiplang/json";
|
|
2
2
|
import type * as Internal from "./internal.js";
|
|
3
|
-
import { type CollectionUpdate, type ExternalService, type LazyCompute, type Mapper, type Reducer, type Resource, type SkipService } from "
|
|
3
|
+
import { type CollectionUpdate, type ExternalService, type LazyCompute, type Mapper, type Reducer, type Resource, type SkipService } from "./api.js";
|
|
4
4
|
export type Handle<T> = Internal.Opaque<number, {
|
|
5
5
|
handle_for: T;
|
|
6
6
|
}>;
|
package/dist/binding.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE/C,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,
|
|
1
|
+
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,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,QAAQ,CAAC,OAAO,CAAC,CAAC;CAC5E"}
|
package/dist/binding.js
CHANGED
package/dist/binding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAGA,OAAO,EAQN,MAAM,
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAGA,OAAO,EAQN,MAAM,UAAU,CAAC;AAIlB,MAAM,OAAO,eAAe;IAC1B,YAA6B,OAAuC;QAAvC,YAAO,GAAP,OAAO,CAAgC;IAAG,CAAC;IAExE,KAAK,CAAC,UAAgB;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;CACF"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Umbrella type for run-time errors thrown by the Skip runtime.
|
|
3
|
+
* @hideconstructor
|
|
4
|
+
*/
|
|
5
|
+
export declare class SkipError extends Error {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Exception indicating an attempted read/write to a collection that does not exist.
|
|
9
|
+
* @hideconstructor
|
|
10
|
+
*/
|
|
11
|
+
export declare class SkipUnknownCollectionError extends SkipError {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Exception indicating an attempted read/write to a resource that does not exist.
|
|
15
|
+
* @hideconstructor
|
|
16
|
+
*/
|
|
17
|
+
export declare class SkipUnknownResourceError extends SkipError {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Exception indicating a malformed REST query to a Skip service.
|
|
21
|
+
* @hideconstructor
|
|
22
|
+
*/
|
|
23
|
+
export declare class SkipRESTError extends SkipError {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Exception indicating that a fetch returned an HTTP status outside of the 200-299 range.
|
|
27
|
+
* @hideconstructor
|
|
28
|
+
*/
|
|
29
|
+
export declare class SkipFetchError extends SkipError {
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Exception indicating a non-top-level class being used as a mapper/reducer/etc.
|
|
33
|
+
*
|
|
34
|
+
* The Skip runtime requires that these classes be defined at the top-level, so that their names can be used to generate cache keys and the like.
|
|
35
|
+
* @hideconstructor
|
|
36
|
+
*/
|
|
37
|
+
export declare class SkipClassNameError extends SkipError {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Exception indicating a key did not have a unique value.
|
|
41
|
+
*
|
|
42
|
+
* Some collections are used to associate each key to a unique value.
|
|
43
|
+
* When this expectation is not met (a key is associated to either zero or multiple values), operations such as `getUnique` throw `SkipNonUniqueValueError`.
|
|
44
|
+
* @hideconstructor
|
|
45
|
+
*/
|
|
46
|
+
export declare class SkipNonUniqueValueError extends SkipError {
|
|
2
47
|
}
|
|
3
48
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;CAAG;AAEvC;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,SAAS;CAAG;AAE5D;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,SAAS;CAAG;AAE1D;;;GAGG;AACH,qBAAa,aAAc,SAAQ,SAAS;CAAG;AAE/C;;;GAGG;AACH,qBAAa,cAAe,SAAQ,SAAS;CAAG;AAEhD;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AAEpD;;;;;;GAMG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;CAAG"}
|
package/dist/errors.js
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Umbrella type for run-time errors thrown by the Skip runtime.
|
|
3
|
+
* @hideconstructor
|
|
4
|
+
*/
|
|
5
|
+
export class SkipError extends Error {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Exception indicating an attempted read/write to a collection that does not exist.
|
|
9
|
+
* @hideconstructor
|
|
10
|
+
*/
|
|
11
|
+
export class SkipUnknownCollectionError extends SkipError {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Exception indicating an attempted read/write to a resource that does not exist.
|
|
15
|
+
* @hideconstructor
|
|
16
|
+
*/
|
|
17
|
+
export class SkipUnknownResourceError extends SkipError {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Exception indicating a malformed REST query to a Skip service.
|
|
21
|
+
* @hideconstructor
|
|
22
|
+
*/
|
|
23
|
+
export class SkipRESTError extends SkipError {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Exception indicating that a fetch returned an HTTP status outside of the 200-299 range.
|
|
27
|
+
* @hideconstructor
|
|
28
|
+
*/
|
|
29
|
+
export class SkipFetchError extends SkipError {
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Exception indicating a non-top-level class being used as a mapper/reducer/etc.
|
|
33
|
+
*
|
|
34
|
+
* The Skip runtime requires that these classes be defined at the top-level, so that their names can be used to generate cache keys and the like.
|
|
35
|
+
* @hideconstructor
|
|
36
|
+
*/
|
|
37
|
+
export class SkipClassNameError extends SkipError {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Exception indicating a key did not have a unique value.
|
|
41
|
+
*
|
|
42
|
+
* Some collections are used to associate each key to a unique value.
|
|
43
|
+
* When this expectation is not met (a key is associated to either zero or multiple values), operations such as `getUnique` throw `SkipNonUniqueValueError`.
|
|
44
|
+
* @hideconstructor
|
|
45
|
+
*/
|
|
46
|
+
export class SkipNonUniqueValueError extends SkipError {
|
|
2
47
|
}
|
|
3
48
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;CAAG;AAEvC;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,SAAS;CAAG;AAE5D;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,SAAS;CAAG;AAE1D;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;CAAG;AAE/C;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,SAAS;CAAG;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;CAAG;AAEpD;;;;;;GAMG;AACH,MAAM,OAAO,uBAAwB,SAAQ,SAAS;CAAG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,11 +7,12 @@ import type { Opaque } from "@skiplang/std";
|
|
|
7
7
|
import type { Pointer, Nullable, Json, JsonConverter } from "@skiplang/json";
|
|
8
8
|
import { sk_freeze, isSkManaged } from "@skiplang/json";
|
|
9
9
|
import type * as Internal from "./internal.js";
|
|
10
|
-
import { type CollectionUpdate, type Entry, type ExternalService, type LazyCompute, type Mapper, type Reducer, type Resource, type SkipService, type Watermark } from "
|
|
11
|
-
import { UnknownCollectionError } from "./errors.js";
|
|
10
|
+
import { type CollectionUpdate, type Entry, type ExternalService, type LazyCompute, type Mapper, type Reducer, type Resource, type SkipService, type Watermark } from "./api.js";
|
|
12
11
|
import { ResourceBuilder, type Notifier, type Checker, type Handle, type FromBinding } from "./binding.js";
|
|
13
|
-
export {
|
|
12
|
+
export { sk_freeze, isSkManaged };
|
|
14
13
|
export { Sum, Min, Max, Count } from "./utils.js";
|
|
14
|
+
export * from "./api.js";
|
|
15
|
+
export * from "./errors.js";
|
|
15
16
|
export type JSONMapper = Mapper<Json, Json, Json, Json>;
|
|
16
17
|
export type JSONLazyCompute = LazyCompute<Json, Json>;
|
|
17
18
|
declare class Handles {
|
|
@@ -150,8 +151,8 @@ export declare class ToBinding {
|
|
|
150
151
|
SkipRuntime_Reducer__add(skreducer: Handle<Reducer<Json, Json>>, skacc: Nullable<Pointer<Internal.CJSON>>, skvalue: Pointer<Internal.CJSON>): Pointer<Internal.CJSON>;
|
|
151
152
|
SkipRuntime_Reducer__remove(skreducer: Handle<Reducer<Json, Json>>, skacc: Pointer<Internal.CJSON>, skvalue: Pointer<Internal.CJSON>): Nullable<Pointer<Internal.CJSON>>;
|
|
152
153
|
SkipRuntime_deleteReducer(reducer: Handle<Reducer<Json, Json>>): void;
|
|
153
|
-
SkipRuntime_ExternalService__subscribe(sksupplier: Handle<ExternalService>, writerId: string, resource: string, skparams: Pointer<Internal.CJObject>): void;
|
|
154
|
-
SkipRuntime_ExternalService__unsubscribe(sksupplier: Handle<ExternalService>,
|
|
154
|
+
SkipRuntime_ExternalService__subscribe(sksupplier: Handle<ExternalService>, writerId: string, instance: string, resource: string, skparams: Pointer<Internal.CJObject>): void;
|
|
155
|
+
SkipRuntime_ExternalService__unsubscribe(sksupplier: Handle<ExternalService>, instance: string): void;
|
|
155
156
|
SkipRuntime_ExternalService__shutdown(sksupplier: Handle<ExternalService>): void;
|
|
156
157
|
SkipRuntime_deleteExternalService(supplier: Handle<ExternalService>): void;
|
|
157
158
|
SkipRuntime_Checker__check(skchecker: Handle<Checker>, request: string): void;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,E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;IAId,OAAO,CAAC,IAAI;CASb"}
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { sk_freeze, isSkManaged, SkManaged, checkOrCloneParam, } from "@skiplang/json";
|
|
7
7
|
import { sknative } from "@skiplang/std";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import {} from "./api.js";
|
|
9
|
+
import { SkipClassNameError, SkipError, SkipNonUniqueValueError, SkipUnknownCollectionError, } from "./errors.js";
|
|
10
10
|
import { ResourceBuilder, } from "./binding.js";
|
|
11
|
-
export {
|
|
11
|
+
export { sk_freeze, isSkManaged };
|
|
12
12
|
export { Sum, Min, Max, Count } from "./utils.js";
|
|
13
|
+
export * from "./api.js";
|
|
14
|
+
export * from "./errors.js";
|
|
13
15
|
class Handles {
|
|
14
16
|
constructor() {
|
|
15
17
|
this.nextID = 1;
|
|
@@ -74,7 +76,7 @@ class LazyCollectionImpl extends SkManaged {
|
|
|
74
76
|
getUnique(key) {
|
|
75
77
|
const v = this.refs.skjson.importOptJSON(this.refs.binding.SkipRuntime_LazyCollection__getUnique(this.lazyCollection, this.refs.skjson.exportJSON(key)));
|
|
76
78
|
if (v == null)
|
|
77
|
-
throw new
|
|
79
|
+
throw new SkipNonUniqueValueError();
|
|
78
80
|
return v;
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -94,7 +96,7 @@ class EagerCollectionImpl extends SkManaged {
|
|
|
94
96
|
getUnique(key) {
|
|
95
97
|
const v = this.refs.skjson.importOptJSON(this.refs.binding.SkipRuntime_Collection__getUnique(this.collection, this.refs.skjson.exportJSON(key)));
|
|
96
98
|
if (v == null)
|
|
97
|
-
throw new
|
|
99
|
+
throw new SkipNonUniqueValueError();
|
|
98
100
|
return v;
|
|
99
101
|
}
|
|
100
102
|
slice(start, end) {
|
|
@@ -113,7 +115,7 @@ class EagerCollectionImpl extends SkManaged {
|
|
|
113
115
|
const mapperObj = new mapper(...mapperParams);
|
|
114
116
|
Object.freeze(mapperObj);
|
|
115
117
|
if (!mapperObj.constructor.name) {
|
|
116
|
-
throw new
|
|
118
|
+
throw new SkipClassNameError("Mapper classes must be defined at top-level.");
|
|
117
119
|
}
|
|
118
120
|
const skmapper = this.refs.binding.SkipRuntime_createMapper(this.refs.handles.register(mapperObj));
|
|
119
121
|
const mapped = this.refs.binding.SkipRuntime_Collection__map(this.collection, skmapper);
|
|
@@ -128,10 +130,10 @@ class EagerCollectionImpl extends SkManaged {
|
|
|
128
130
|
Object.freeze(mapperObj);
|
|
129
131
|
Object.freeze(reducerObj);
|
|
130
132
|
if (!mapperObj.constructor.name) {
|
|
131
|
-
throw new
|
|
133
|
+
throw new SkipClassNameError("Mapper classes must be defined at top-level.");
|
|
132
134
|
}
|
|
133
135
|
if (!reducerObj.constructor.name) {
|
|
134
|
-
throw new
|
|
136
|
+
throw new SkipClassNameError("Reducer classes must be defined at top-level.");
|
|
135
137
|
}
|
|
136
138
|
const skmapper = this.refs.binding.SkipRuntime_createMapper(this.refs.handles.register(mapperObj));
|
|
137
139
|
if (sknative in reducerObj && typeof reducerObj[sknative] == "string") {
|
|
@@ -148,7 +150,7 @@ class EagerCollectionImpl extends SkManaged {
|
|
|
148
150
|
const reducerObj = new reducer(...reducerParams);
|
|
149
151
|
Object.freeze(reducerObj);
|
|
150
152
|
if (!reducerObj.constructor.name) {
|
|
151
|
-
throw new
|
|
153
|
+
throw new SkipClassNameError("Reducer classes must be defined at top-level.");
|
|
152
154
|
}
|
|
153
155
|
if (sknative in reducerObj && typeof reducerObj[sknative] == "string") {
|
|
154
156
|
return this.derive(this.refs.binding.SkipRuntime_Collection__nativeReduce(this.collection, reducerObj[sknative]));
|
|
@@ -176,30 +178,31 @@ class CollectionWriter {
|
|
|
176
178
|
const update_ = () => {
|
|
177
179
|
return this.refs.binding.SkipRuntime_CollectionWriter__update(this.collection, this.refs.skjson.exportJSON(values), isInit);
|
|
178
180
|
};
|
|
179
|
-
|
|
180
|
-
this.refs.runWithGC(update_)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
181
|
+
const errorHdl = this.refs.needGC()
|
|
182
|
+
? this.refs.runWithGC(update_)
|
|
183
|
+
: update_();
|
|
184
|
+
if (errorHdl)
|
|
185
|
+
throw this.refs.handles.deleteHandle(errorHdl);
|
|
185
186
|
}
|
|
186
187
|
loading() {
|
|
187
188
|
const loading_ = () => {
|
|
188
189
|
return this.refs.binding.SkipRuntime_CollectionWriter__loading(this.collection);
|
|
189
190
|
};
|
|
190
|
-
|
|
191
|
-
this.refs.runWithGC(loading_)
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
const errorHdl = this.refs.needGC()
|
|
192
|
+
? this.refs.runWithGC(loading_)
|
|
193
|
+
: loading_();
|
|
194
|
+
if (errorHdl)
|
|
195
|
+
throw this.refs.handles.deleteHandle(errorHdl);
|
|
194
196
|
}
|
|
195
197
|
error(error) {
|
|
196
198
|
const error_ = () => {
|
|
197
199
|
return this.refs.binding.SkipRuntime_CollectionWriter__error(this.collection, this.refs.skjson.exportJSON(error));
|
|
198
200
|
};
|
|
199
|
-
|
|
200
|
-
this.refs.runWithGC(error_)
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
const errorHdl = this.refs.needGC()
|
|
202
|
+
? this.refs.runWithGC(error_)
|
|
203
|
+
: error_();
|
|
204
|
+
if (errorHdl)
|
|
205
|
+
throw this.refs.handles.deleteHandle(errorHdl);
|
|
203
206
|
}
|
|
204
207
|
}
|
|
205
208
|
class ContextImpl extends SkManaged {
|
|
@@ -213,7 +216,7 @@ class ContextImpl extends SkManaged {
|
|
|
213
216
|
const computeObj = new compute(...mapperParams);
|
|
214
217
|
Object.freeze(computeObj);
|
|
215
218
|
if (!computeObj.constructor.name) {
|
|
216
|
-
throw new
|
|
219
|
+
throw new SkipClassNameError("LazyCompute classes must be defined at top-level.");
|
|
217
220
|
}
|
|
218
221
|
const skcompute = this.refs.binding.SkipRuntime_createLazyCompute(this.refs.handles.register(computeObj));
|
|
219
222
|
const lazyCollection = this.refs.binding.SkipRuntime_Context__createLazyCollection(skcompute);
|
|
@@ -243,12 +246,17 @@ class AllChecker {
|
|
|
243
246
|
this.params = params;
|
|
244
247
|
}
|
|
245
248
|
check(request) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
try {
|
|
250
|
+
const result = this.service.getAll(this.resource, this.params, request);
|
|
251
|
+
if (result.errors.length > 0) {
|
|
252
|
+
this.executor.reject(new Error(JSON.stringify(result.errors)));
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
this.executor.resolve(result.payload);
|
|
256
|
+
}
|
|
249
257
|
}
|
|
250
|
-
|
|
251
|
-
this.executor.
|
|
258
|
+
catch (ex) {
|
|
259
|
+
this.executor.reject(ex);
|
|
252
260
|
}
|
|
253
261
|
}
|
|
254
262
|
}
|
|
@@ -261,12 +269,17 @@ class OneChecker {
|
|
|
261
269
|
this.key = key;
|
|
262
270
|
}
|
|
263
271
|
check(request) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
272
|
+
try {
|
|
273
|
+
const result = this.service.getArray(this.resource, this.key, this.params, request);
|
|
274
|
+
if (result.errors.length > 0) {
|
|
275
|
+
this.executor.reject(new Error(JSON.stringify(result.errors)));
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
this.executor.resolve(result.payload);
|
|
279
|
+
}
|
|
267
280
|
}
|
|
268
|
-
|
|
269
|
-
this.executor.
|
|
281
|
+
catch (ex) {
|
|
282
|
+
this.executor.reject(ex);
|
|
270
283
|
}
|
|
271
284
|
}
|
|
272
285
|
}
|
|
@@ -358,10 +371,10 @@ export class ServiceInstance {
|
|
|
358
371
|
return this.refs.binding.SkipRuntime_Runtime__subscribe(resourceInstanceId, sknotifier, watermark ?? null);
|
|
359
372
|
});
|
|
360
373
|
if (session == -1n) {
|
|
361
|
-
throw new
|
|
374
|
+
throw new SkipUnknownCollectionError(`Unknown resource instance '${resourceInstanceId}'`);
|
|
362
375
|
}
|
|
363
376
|
else if (session < 0n) {
|
|
364
|
-
throw new
|
|
377
|
+
throw new SkipError("Unknown error");
|
|
365
378
|
}
|
|
366
379
|
return session;
|
|
367
380
|
}
|
|
@@ -421,7 +434,7 @@ class ValuesImpl {
|
|
|
421
434
|
getUnique() {
|
|
422
435
|
const value = this.skjson.importOptJSON(this.binding.SkipRuntime_NonEmptyIterator__uniqueValue(this.pointer));
|
|
423
436
|
if (value == null)
|
|
424
|
-
throw new
|
|
437
|
+
throw new SkipNonUniqueValueError();
|
|
425
438
|
return value;
|
|
426
439
|
}
|
|
427
440
|
[Symbol.iterator]() {
|
|
@@ -565,22 +578,20 @@ export class ToBinding {
|
|
|
565
578
|
this.handles.deleteHandle(reducer);
|
|
566
579
|
}
|
|
567
580
|
// ExternalService
|
|
568
|
-
SkipRuntime_ExternalService__subscribe(sksupplier, writerId, resource, skparams) {
|
|
581
|
+
SkipRuntime_ExternalService__subscribe(sksupplier, writerId, instance, resource, skparams) {
|
|
569
582
|
const skjson = this.getJsonConverter();
|
|
570
583
|
const supplier = this.handles.get(sksupplier);
|
|
571
584
|
const writer = new CollectionWriter(writerId, this.refs());
|
|
572
585
|
const params = skjson.importJSON(skparams, true);
|
|
573
|
-
supplier.subscribe(resource, params, {
|
|
586
|
+
supplier.subscribe(instance, resource, params, {
|
|
574
587
|
update: writer.update.bind(writer),
|
|
575
588
|
error: writer.error.bind(writer),
|
|
576
589
|
loading: writer.loading.bind(writer),
|
|
577
590
|
});
|
|
578
591
|
}
|
|
579
|
-
SkipRuntime_ExternalService__unsubscribe(sksupplier,
|
|
580
|
-
const skjson = this.getJsonConverter();
|
|
592
|
+
SkipRuntime_ExternalService__unsubscribe(sksupplier, instance) {
|
|
581
593
|
const supplier = this.handles.get(sksupplier);
|
|
582
|
-
|
|
583
|
-
supplier.unsubscribe(resource, params);
|
|
594
|
+
supplier.unsubscribe(instance);
|
|
584
595
|
}
|
|
585
596
|
SkipRuntime_ExternalService__shutdown(sksupplier) {
|
|
586
597
|
const supplier = this.handles.get(sksupplier);
|