Rename CoValue -> CoValueContent
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { JsonAtom, JsonObject, JsonValue } from "./jsonValue";
|
||||
import { MultiLog, MultiLogID, TransactionID } from "./multilog";
|
||||
|
||||
export type CoValueID<T extends CoValue> = MultiLogID & {
|
||||
export type CoValueID<T extends CoValueContent> = MultiLogID & {
|
||||
readonly __type: T;
|
||||
};
|
||||
|
||||
export type CoValue =
|
||||
export type CoValueContent =
|
||||
| CoMap<{[key: string]: JsonValue}, JsonValue>
|
||||
| CoList<JsonValue, JsonValue>
|
||||
| MultiStream<JsonValue, JsonValue>
|
||||
@@ -230,7 +230,7 @@ export class Static<T extends JsonValue> {
|
||||
}
|
||||
}
|
||||
|
||||
export function expectMap(content: CoValue): CoMap<{ [key: string]: string }, {}> {
|
||||
export function expectMap(content: CoValueContent): CoMap<{ [key: string]: string }, {}> {
|
||||
if (content.type !== "comap") {
|
||||
throw new Error("Expected map");
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { CoValue } from "./coValue";
|
||||
import { CoValueContent } from "./coValue";
|
||||
import { JsonValue } from "./jsonValue";
|
||||
import { MultiLog } from "./multilog";
|
||||
import { LocalNode } from "./node";
|
||||
|
||||
type Value = JsonValue | CoValue;
|
||||
type Value = JsonValue | CoValueContent;
|
||||
|
||||
export {
|
||||
JsonValue,
|
||||
CoValue,
|
||||
CoValueContent as CoValue,
|
||||
Value,
|
||||
LocalNode,
|
||||
MultiLog
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CoValueID, CoValue } from "./coValue";
|
||||
import { CoValueID, CoValueContent } from "./coValue";
|
||||
|
||||
export type JsonAtom = string | number | boolean | null;
|
||||
export type JsonValue = JsonAtom | JsonArray | JsonObject | CoValueID<CoValue>;
|
||||
export type JsonValue = JsonAtom | JsonArray | JsonObject | CoValueID<CoValueContent>;
|
||||
export type JsonArray = JsonValue[];
|
||||
export type JsonObject = { [key: string]: JsonValue; };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { randomBytes } from "@noble/hashes/utils";
|
||||
import { CoList, CoMap, CoValue, Static, MultiStream } from "./coValue";
|
||||
import { CoList, CoMap, CoValueContent, Static, MultiStream } from "./coValue";
|
||||
import {
|
||||
Encrypted,
|
||||
Hash,
|
||||
@@ -36,7 +36,7 @@ import { MultiLogKnownState, NewContentMessage } from "./sync";
|
||||
export type MultiLogID = `coval_${string}`;
|
||||
|
||||
export type MultiLogHeader = {
|
||||
type: CoValue["type"];
|
||||
type: CoValueContent["type"];
|
||||
ruleset: RulesetDef;
|
||||
meta: JsonValue;
|
||||
};
|
||||
@@ -94,7 +94,7 @@ export class MultiLog {
|
||||
node: LocalNode;
|
||||
header: MultiLogHeader;
|
||||
sessions: { [key: SessionID]: SessionLog };
|
||||
content?: CoValue;
|
||||
content?: CoValueContent;
|
||||
|
||||
constructor(header: MultiLogHeader, node: LocalNode) {
|
||||
this.id = multilogIDforHeader(header);
|
||||
@@ -260,7 +260,7 @@ export class MultiLog {
|
||||
);
|
||||
}
|
||||
|
||||
getCurrentContent(): CoValue {
|
||||
getCurrentContent(): CoValueContent {
|
||||
if (this.content) {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CoMap, CoValue, MapOpPayload } from "./coValue";
|
||||
import { CoMap, CoValueContent, MapOpPayload } from "./coValue";
|
||||
import { JsonValue } from "./jsonValue";
|
||||
import {
|
||||
Encrypted,
|
||||
@@ -215,7 +215,7 @@ export type TeamContent = { [key: AgentID]: Role } & {
|
||||
};
|
||||
};
|
||||
|
||||
export function expectTeamContent(content: CoValue): CoMap<TeamContent, {}> {
|
||||
export function expectTeamContent(content: CoValueContent): CoMap<TeamContent, {}> {
|
||||
if (content.type !== "comap") {
|
||||
throw new Error("Expected map");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user