@scrthq/runlog 0.0.24 → 0.0.28
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 +23 -23
- package/dist/runlog.js +17 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# @scrthq/runlog
|
|
2
|
-
|
|
3
|
-
The command line for [Runlog](https://github.com/SCRT-HQ/runlog) packs:
|
|
4
|
-
validate, lint, bundle and test a rule pack; make a signing key, sign a
|
|
5
|
-
release, and issue sealed copies to buyers.
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npx @scrthq/runlog validate my-game.yaml --strict
|
|
9
|
-
npx @scrthq/runlog test my-game.yaml
|
|
10
|
-
npx @scrthq/runlog keygen -o my-key.json
|
|
11
|
-
npx @scrthq/runlog sign my-game.yaml --key my-key.json --as "Your Name"
|
|
12
|
-
npx @scrthq/runlog issue my-game.yaml --to "Buyer" --ref order-1 --key my-key.json --seal
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
`npx @scrthq/runlog help` lists everything.
|
|
16
|
-
|
|
17
|
-
The same package is a library for a seller's own backend: `seal`, `open`,
|
|
18
|
-
`readHeader`, `isSealed` and `generateLicenseKey`, with no dependencies.
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
import { seal, generateLicenseKey } from "@scrthq/runlog";
|
|
22
|
-
``` The authoring guide, the format
|
|
23
|
-
reference and the selling notes live in the repository's `docs/`.
|
|
1
|
+
# @scrthq/runlog
|
|
2
|
+
|
|
3
|
+
The command line for [Runlog](https://github.com/SCRT-HQ/runlog) packs:
|
|
4
|
+
validate, lint, bundle and test a rule pack; make a signing key, sign a
|
|
5
|
+
release, and issue sealed copies to buyers.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @scrthq/runlog validate my-game.yaml --strict
|
|
9
|
+
npx @scrthq/runlog test my-game.yaml
|
|
10
|
+
npx @scrthq/runlog keygen -o my-key.json
|
|
11
|
+
npx @scrthq/runlog sign my-game.yaml --key my-key.json --as "Your Name"
|
|
12
|
+
npx @scrthq/runlog issue my-game.yaml --to "Buyer" --ref order-1 --key my-key.json --seal
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`npx @scrthq/runlog help` lists everything.
|
|
16
|
+
|
|
17
|
+
The same package is a library for a seller's own backend: `seal`, `open`,
|
|
18
|
+
`readHeader`, `isSealed` and `generateLicenseKey`, with no dependencies.
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { seal, generateLicenseKey } from "@scrthq/runlog";
|
|
22
|
+
``` The authoring guide, the format
|
|
23
|
+
reference and the selling notes live in the repository's `docs/`.
|
package/dist/runlog.js
CHANGED
|
@@ -27880,6 +27880,19 @@ async function verifyPack(document) {
|
|
|
27880
27880
|
}
|
|
27881
27881
|
}
|
|
27882
27882
|
|
|
27883
|
+
// packages/engine/src/log.ts
|
|
27884
|
+
function voidedIds(events) {
|
|
27885
|
+
const out = /* @__PURE__ */ new Set();
|
|
27886
|
+
for (const e of events) {
|
|
27887
|
+
if (e.t === "Undone") for (const id of e.ids) out.add(id);
|
|
27888
|
+
}
|
|
27889
|
+
return out;
|
|
27890
|
+
}
|
|
27891
|
+
function effectiveEvents(events) {
|
|
27892
|
+
const gone = voidedIds(events);
|
|
27893
|
+
return events.filter((e) => e.t !== "Undone" && (e.id === void 0 || !gone.has(e.id)));
|
|
27894
|
+
}
|
|
27895
|
+
|
|
27883
27896
|
// packages/engine/src/reduce.ts
|
|
27884
27897
|
function initialState(pack, e) {
|
|
27885
27898
|
const counters = {};
|
|
@@ -27962,7 +27975,8 @@ function subjectById(state, id) {
|
|
|
27962
27975
|
function currentSubject(state) {
|
|
27963
27976
|
return state.subjects.find((s) => s.unit === state.unit && !s.finalized);
|
|
27964
27977
|
}
|
|
27965
|
-
function reduce(pack,
|
|
27978
|
+
function reduce(pack, log) {
|
|
27979
|
+
const events = effectiveEvents(log);
|
|
27966
27980
|
const first = events[0];
|
|
27967
27981
|
if (!first || first.t !== "RunStarted") {
|
|
27968
27982
|
throw new Error("an event log must begin with RunStarted");
|
|
@@ -28112,6 +28126,8 @@ function reduce(pack, events) {
|
|
|
28112
28126
|
state.status = "ended";
|
|
28113
28127
|
state.ending = event.ending;
|
|
28114
28128
|
break;
|
|
28129
|
+
case "Undone":
|
|
28130
|
+
break;
|
|
28115
28131
|
}
|
|
28116
28132
|
applyCounters(pack, state, event, resetThisUnit);
|
|
28117
28133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrthq/runlog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "Validate, lint, bundle and test Runlog rule packs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
|
-
"runlog": "
|
|
20
|
+
"runlog": "dist/runlog.js"
|
|
21
21
|
},
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|