Public
Edited
Apr 16, 2024
Insert cell
Insert cell
Insert cell
Content = record({ digest: Bytes, size: Integer })
Insert cell
Site = record({ url: Text })
Insert cell
DID = Text
Insert cell
show((_) => Site)
Insert cell
Result = variant({ ok: variable("ok"), error: variable("error") })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
task = (schema) => {
const task = new Task(schema);
return Object.assign((subject, input) => task.invoke(subject, input), {
schema
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
t = memory.allocate({}, { size: 12 })
Insert cell
t.await().ok.size.optional()
Insert cell
http = ({
put: task({
input: {},
output: Result({ ok: record({}), error: record({ message: Text }) })
})
})
Insert cell
Insert cell
Insert cell
blobAdd = rule(
{ self: DID, blob: Content },
Result({ ok: Site, error: record({ message: String }) })
)(function* (input) {
const location = yield* memory.allocate(this, {
space: input.self,
blob: input.blob
});

const put = yield* http.put(this, {
url: location.await().ok.address.url,
headers: location.await().ok.address.headers,
body: input.blob
});

const content = yield* memory.commit(this, {
space: input.self,
blob: input.blob
});

const site = content.await().ok.site;

return { ok: { site } };
})
Insert cell
[...Record.entries(from(blobAdd))]
Insert cell
blobAdd.toJSON()
Insert cell
show(_ => toTree(blobAdd.toJSON()))
Insert cell
show((_) => Result({ ok: { site: Site }, error: record({ message: Text }) }))
Insert cell
show((_) => record({ message: Text }))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Text = new Type({ String: {} })
Insert cell
Insert cell
show(() => from({ message: Text }))
Insert cell
show(() => Text)
Insert cell
Insert cell
import {
id,
from,
Data,
base32,
show,
toTree,
drawBytes,
Record,
infer
} from "@gozala/merkle-references"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more