Qualify recurring occurrence completion with portable graph transactions
This commit is contained in:
@@ -89,6 +89,11 @@ void negative;
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { asyncObjectPlan } = await import("./async-fixture.js");
|
const { asyncObjectPlan } = await import("./async-fixture.js");
|
||||||
|
const { recurringTaskPlan } = await import("./recurring-fixture.js");
|
||||||
|
const recurringPlan = await recurringTaskPlan();
|
||||||
|
await mkdir("dist/portable-reader/recurring", { recursive: true });
|
||||||
|
await writeFile("dist/portable-reader/recurring/plan.json", JSON.stringify(recurringPlan));
|
||||||
|
await writeFile("dist/portable-reader/recurring/kernel.json", JSON.stringify(compileKernelProgram(recurringPlan)));
|
||||||
const { generateRemoteTypeScriptBindings } = await import("../src/bindings/portable.js");
|
const { generateRemoteTypeScriptBindings } = await import("../src/bindings/portable.js");
|
||||||
const asyncPlan = await asyncObjectPlan();
|
const asyncPlan = await asyncObjectPlan();
|
||||||
await mkdir("dist/portable-reader/async", { recursive: true });
|
await mkdir("dist/portable-reader/async", { recursive: true });
|
||||||
|
|||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
interface Task id "recurring:task-data" revision "recurring:task-data@1" {
|
||||||
|
queryable value occurrence id "recurring:occurrence" : uint64 {
|
||||||
|
get id "recurring:occurrence:get" execution snapshot targets [browser, server];
|
||||||
|
}
|
||||||
|
queryable value due id "recurring:due" : int64 {
|
||||||
|
get id "recurring:due:get" execution snapshot targets [browser, server];
|
||||||
|
}
|
||||||
|
queryable value title id "recurring:title" : string {
|
||||||
|
get id "recurring:title:get" execution snapshot targets [browser, server];
|
||||||
|
set id "recurring:title:set" execution transaction targets [browser, server];
|
||||||
|
}
|
||||||
|
operation complete id "recurring:complete" : uint64 -> unit {
|
||||||
|
call id "recurring:complete:call" execution transaction targets [browser, server];
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
external atom TaskObject id "recurring:task";
|
||||||
|
package TaskRuntime id "recurring:runtime" revision "recurring:runtime@1" {
|
||||||
|
operation complete id "recurring:runtime:complete" : uint64 -> unit
|
||||||
|
mode call execution transaction targets [browser, server] receiver atom TaskObject requires {
|
||||||
|
state occurrence id "recurring:port:occurrence" : uint64 [read, write];
|
||||||
|
state due id "recurring:port:due" : int64 [read, write];
|
||||||
|
};
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
workspace RecurringTask id "workspace:recurring" revision "workspace:recurring@1" commit "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" {
|
||||||
|
import interface Task;
|
||||||
|
import package TaskRuntime;
|
||||||
|
atom TaskObject id "recurring:task";
|
||||||
|
conform TaskObject as Task id "recurring:task:owner" {
|
||||||
|
private state Occurrence id "recurring:state:occurrence" on TaskObject : uint64 policy register default 0;
|
||||||
|
private state Due id "recurring:state:due" on TaskObject : int64 policy register;
|
||||||
|
private state Title id "recurring:state:title" on TaskObject : string policy register;
|
||||||
|
initialize { due to state Due; title to state Title; };
|
||||||
|
bind occurrence.get to state Occurrence.read;
|
||||||
|
bind due.get to state Due.read;
|
||||||
|
bind title.get to state Title.read;
|
||||||
|
bind title.set to state Title.write;
|
||||||
|
bind complete.call to package TaskRuntime.complete with {
|
||||||
|
occurrence to state Occurrence;
|
||||||
|
due to state Due;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { readFile } from "node:fs/promises";
|
||||||
|
import { compileCapabilityResourceSource, compileCapabilitySource } from "../src/capability-language/parser.js";
|
||||||
|
import { compileExecutionPlan } from "../src/execution-world/plan.js";
|
||||||
|
|
||||||
|
export async function recurringTaskPlan() {
|
||||||
|
const read = (name: string) => readFile(`test/fixtures/recurring-task/${name}.qx`, "utf8");
|
||||||
|
const source = { repository: "https://example.test/recurring.git", commit: "a".repeat(40) };
|
||||||
|
const task = compileCapabilityResourceSource(await read("Task"), { source });
|
||||||
|
assert.ok(task.ok && task.resource.kind === "interface", JSON.stringify(task.diagnostics));
|
||||||
|
const runtime = compileCapabilityResourceSource(await read("TaskRuntime"), { source });
|
||||||
|
assert.ok(runtime.ok && runtime.resource.kind === "package", JSON.stringify(runtime.diagnostics));
|
||||||
|
const result = compileCapabilitySource(await read("workspace"), "workspace.qx", {
|
||||||
|
interfaces: new Map([["Task", task.resource.revision]]),
|
||||||
|
packages: new Map([["TaskRuntime", runtime.resource.revision]]),
|
||||||
|
});
|
||||||
|
assert.ok(result.ok, JSON.stringify(result.diagnostics));
|
||||||
|
return compileExecutionPlan(result.workspace);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user