@skipruntime/core 0.0.2 → 0.0.4

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/utils.js CHANGED
@@ -1,40 +1,47 @@
1
- import { ManyToOneMapper } from "@skipruntime/api";
1
+ var _a, _b, _c, _d;
2
+ import { sknative } from "@skiplang/std";
3
+ /**
4
+ * `Reducer` to maintain the sum of input values.
5
+ *
6
+ * A `Reducer` that maintains the sum of values as they are added and removed from a collection.
7
+ */
2
8
  export class Sum {
3
9
  constructor() {
4
- this.default = 0;
5
- }
6
- add(acc, value) {
7
- return acc + value;
8
- }
9
- remove(acc, value) {
10
- return acc - value;
10
+ this[_a] = "sum";
11
11
  }
12
12
  }
13
+ _a = sknative;
14
+ /**
15
+ * `Reducer` to maintain the minimum of input values.
16
+ *
17
+ * A `Reducer` that maintains the minimum of values as they are added and removed from a collection.
18
+ */
13
19
  export class Min {
14
20
  constructor() {
15
- this.default = null;
16
- }
17
- add(acc, value) {
18
- return acc === null ? value : Math.min(acc, value);
19
- }
20
- remove(acc, value) {
21
- return value > acc ? acc : null;
21
+ this[_b] = "min";
22
22
  }
23
23
  }
24
+ _b = sknative;
25
+ /**
26
+ * `Reducer` to maintain the maximum of input values.
27
+ *
28
+ * A `Reducer` that maintains the maximum of values as they are added and removed from a collection.
29
+ */
24
30
  export class Max {
25
31
  constructor() {
26
- this.default = null;
27
- }
28
- add(acc, value) {
29
- return acc === null ? value : Math.max(acc, value);
30
- }
31
- remove(acc, value) {
32
- return value < acc ? acc : null;
32
+ this[_c] = "max";
33
33
  }
34
34
  }
35
- export class CountMapper extends ManyToOneMapper {
36
- mapValues(values) {
37
- return values.toArray().length;
35
+ _c = sknative;
36
+ /**
37
+ * `Reducer` to maintain the count of input values.
38
+ *
39
+ * A `Reducer` that maintains the number of values as they are added and removed from a collection.
40
+ */
41
+ export class Count {
42
+ constructor() {
43
+ this[_d] = "count";
38
44
  }
39
45
  }
46
+ _d = sknative;
40
47
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,MAAM,OAAO,GAAG;IAAhB;QACE,YAAO,GAAG,CAAC,CAAC;IASd,CAAC;IAPC,GAAG,CAAC,GAAW,EAAE,KAAa;QAC5B,OAAO,GAAG,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,KAAa;QAC/B,OAAO,GAAG,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED,MAAM,OAAO,GAAG;IAAhB;QACE,YAAO,GAAG,IAAI,CAAC;IASjB,CAAC;IAPC,GAAG,CAAC,GAAqB,EAAE,KAAa;QACtC,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,KAAa;QAC/B,OAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,GAAG;IAAhB;QACE,YAAO,GAAG,IAAI,CAAC;IASjB,CAAC;IAPC,GAAG,CAAC,GAAqB,EAAE,KAAa;QACtC,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,KAAa;QAC/B,OAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,WAGX,SAAQ,eAA6B;IACrC,SAAS,CAAC,MAA2B;QACnC,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC;IACjC,CAAC;CACF"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AACA,OAAO,EAAmB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG1D;;;;GAIG;AACH,MAAM,OAAO,GAAG;IAAhB;QACE,QAAU,GAAG,KAAK,CAAC;IAOrB,CAAC;CAAA;KAPE,QAAQ;AASX;;;;GAIG;AACH,MAAM,OAAO,GAAG;IAAhB;QACE,QAAU,GAAG,KAAK,CAAC;IAOrB,CAAC;CAAA;KAPE,QAAQ;AASX;;;;GAIG;AACH,MAAM,OAAO,GAAG;IAAhB;QACE,QAAU,GAAG,KAAK,CAAC;IAOrB,CAAC;CAAA;KAPE,QAAQ;AASX;;;;GAIG;AACH,MAAM,OAAO,KAAK;IAAlB;QACE,QAAU,GAAG,OAAO,CAAC;IAOvB,CAAC;CAAA;KAPE,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skipruntime/core",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -13,6 +13,6 @@
13
13
  "lint": "eslint"
14
14
  },
15
15
  "dependencies": {
16
- "@skipruntime/api": "^0.0.4"
16
+ "@skipruntime/api": "^0.0.5"
17
17
  }
18
18
  }
package/src/binding.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResourceBuilder = void 0;
4
+ var ResourceBuilder = /** @class */ (function () {
5
+ function ResourceBuilder(builder) {
6
+ this.builder = builder;
7
+ }
8
+ ResourceBuilder.prototype.build = function (parameters) {
9
+ var builder = this.builder;
10
+ return new builder(parameters);
11
+ };
12
+ return ResourceBuilder;
13
+ }());
14
+ exports.ResourceBuilder = ResourceBuilder;
package/src/binding.ts CHANGED
@@ -14,13 +14,9 @@ import {
14
14
  export type Handle<T> = Internal.Opaque<number, { handle_for: T }>;
15
15
 
16
16
  export class ResourceBuilder {
17
- constructor(
18
- private readonly builder: new (params: {
19
- [param: string]: string;
20
- }) => Resource,
21
- ) {}
17
+ constructor(private readonly builder: new (params: Json) => Resource) {}
22
18
 
23
- build(parameters: { [param: string]: string }): Resource {
19
+ build(parameters: Json): Resource {
24
20
  const builder = this.builder;
25
21
  return new builder(parameters);
26
22
  }
@@ -146,11 +142,20 @@ export interface FromBinding {
146
142
  mapper: Pointer<Internal.Mapper>,
147
143
  reducer: Pointer<Internal.Reducer>,
148
144
  ): string;
145
+ SkipRuntime_Collection__nativeMapReduce(
146
+ collection: string,
147
+ mapper: Pointer<Internal.Mapper>,
148
+ reducer: string,
149
+ ): string;
149
150
 
150
151
  SkipRuntime_Collection__reduce(
151
152
  collection: string,
152
153
  reducer: Pointer<Internal.Reducer>,
153
154
  ): string;
155
+ SkipRuntime_Collection__nativeReduce(
156
+ collection: string,
157
+ reducer: string,
158
+ ): string;
154
159
 
155
160
  SkipRuntime_Collection__slice(
156
161
  collection: string,
package/src/errors.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.UnknownCollectionError = void 0;
19
+ var UnknownCollectionError = /** @class */ (function (_super) {
20
+ __extends(UnknownCollectionError, _super);
21
+ function UnknownCollectionError() {
22
+ return _super !== null && _super.apply(this, arguments) || this;
23
+ }
24
+ return UnknownCollectionError;
25
+ }(Error));
26
+ exports.UnknownCollectionError = UnknownCollectionError;