@ixo/topic-protocol 1.0.0-rc.4 → 1.0.0-rc.6
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 +10 -1
- package/dist/profiles/releases/1.0.0-rc.4.json +8915 -0
- package/dist/schemas/v2/capsule.schema.json +29 -0
- package/dist/schemas/v2/common.schema.json +68 -0
- package/dist/schemas/v2/operation.schema.json +308 -0
- package/dist/schemas/v2/projection.schema.json +205 -0
- package/dist/schemas/v2/record.schema.json +56 -0
- package/dist/schemas/v2/topic.schema.json +84 -0
- package/dist/src/shapes/availability.d.ts +1 -0
- package/dist/src/shapes/availability.js +3 -1
- package/dist/src/shapes/availability.js.map +1 -1
- package/dist/src/shapes/canonical.js +3 -2
- package/dist/src/shapes/canonical.js.map +1 -1
- package/dist/src/shapes/commands.js +1 -1
- package/dist/src/shapes/commands.js.map +1 -1
- package/dist/src/shapes/progress.js +14 -1
- package/dist/src/shapes/progress.js.map +1 -1
- package/dist/src/shapes/recipes.js +31 -1
- package/dist/src/shapes/recipes.js.map +1 -1
- package/dist/src/shapes/releases.d.ts +1 -1
- package/dist/src/shapes/releases.js +4 -1
- package/dist/src/shapes/releases.js.map +1 -1
- package/dist/src/shapes/resolver.js +7 -1
- package/dist/src/shapes/resolver.js.map +1 -1
- package/dist/src/v2/canonical.d.ts +3 -0
- package/dist/src/v2/canonical.js +25 -0
- package/dist/src/v2/canonical.js.map +1 -0
- package/dist/src/v2/capsule.d.ts +10 -0
- package/dist/src/v2/capsule.js +46 -0
- package/dist/src/v2/capsule.js.map +1 -0
- package/dist/src/v2/compat.d.ts +14 -0
- package/dist/src/v2/compat.js +96 -0
- package/dist/src/v2/compat.js.map +1 -0
- package/dist/src/v2/ids.d.ts +3 -0
- package/dist/src/v2/ids.js +11 -0
- package/dist/src/v2/ids.js.map +1 -0
- package/dist/src/v2/index.d.ts +9 -0
- package/dist/src/v2/index.js +9 -0
- package/dist/src/v2/index.js.map +1 -0
- package/dist/src/v2/matrix.d.ts +46 -0
- package/dist/src/v2/matrix.js +151 -0
- package/dist/src/v2/matrix.js.map +1 -0
- package/dist/src/v2/project.d.ts +14 -0
- package/dist/src/v2/project.js +268 -0
- package/dist/src/v2/project.js.map +1 -0
- package/dist/src/v2/types.d.ts +195 -0
- package/dist/src/v2/types.js +19 -0
- package/dist/src/v2/types.js.map +1 -0
- package/dist/src/v2/validate.d.ts +650 -0
- package/dist/src/v2/validate.js +45 -0
- package/dist/src/v2/validate.js.map +1 -0
- package/package.json +7 -1
- package/profiles/releases/1.0.0-rc.4.json +8915 -0
- package/recipes/agent-delivery.json +85 -1
- package/recipes/blueprint-design.json +85 -1
- package/recipes/registry.json +10 -10
- package/recipes/research-brief.json +85 -1
- package/recipes/software-build.json +85 -1
- package/recipes/verified-work-payment.json +85 -1
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { TopicProtocolError } from "../errors.js";
|
|
2
|
+
import { compareText } from "../shared/compare.js";
|
|
3
|
+
import { canonicalJsonV2, sha256V2 } from "./canonical.js";
|
|
4
|
+
import { TOPIC_KINDS_V2 } from "./types.js";
|
|
5
|
+
function initialDraft(manifest) {
|
|
6
|
+
return {
|
|
7
|
+
title: manifest.title,
|
|
8
|
+
status: "open",
|
|
9
|
+
owner: manifest.owner,
|
|
10
|
+
due: manifest.due,
|
|
11
|
+
intent: manifest.intent,
|
|
12
|
+
outcome: manifest.outcome,
|
|
13
|
+
blocked: undefined,
|
|
14
|
+
flow: undefined,
|
|
15
|
+
links: [],
|
|
16
|
+
files: [],
|
|
17
|
+
relations: [],
|
|
18
|
+
records: [],
|
|
19
|
+
superseded: new Set(),
|
|
20
|
+
updatedBy: manifest.createdBy,
|
|
21
|
+
updatedAt: manifest.createdAt,
|
|
22
|
+
rejected: [],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function entryId(entry) {
|
|
26
|
+
return entry.value.id;
|
|
27
|
+
}
|
|
28
|
+
function instant(value) {
|
|
29
|
+
const parsed = Date.parse(value);
|
|
30
|
+
return Number.isNaN(parsed) ? Number.POSITIVE_INFINITY : parsed;
|
|
31
|
+
}
|
|
32
|
+
/** Orders by normalised instant, then identifier in byte order, then canonical content so equal keys never depend on arrival order. */
|
|
33
|
+
function compareEntries(left, right) {
|
|
34
|
+
return instant(left.value.createdAt) - instant(right.value.createdAt)
|
|
35
|
+
|| compareText(entryId(left), entryId(right))
|
|
36
|
+
|| compareText(canonicalJsonV2(left.value), canonicalJsonV2(right.value));
|
|
37
|
+
}
|
|
38
|
+
/** Identifiers that appear with more than one distinct payload. Every entry carrying such an identifier is rejected. */
|
|
39
|
+
function conflictingIds(entries) {
|
|
40
|
+
const payloads = new Map();
|
|
41
|
+
const conflicts = new Set();
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const id = entryId(entry);
|
|
44
|
+
const payload = canonicalJsonV2(entry.value);
|
|
45
|
+
const known = payloads.get(id);
|
|
46
|
+
if (known === undefined)
|
|
47
|
+
payloads.set(id, payload);
|
|
48
|
+
else if (known !== payload)
|
|
49
|
+
conflicts.add(id);
|
|
50
|
+
}
|
|
51
|
+
return conflicts;
|
|
52
|
+
}
|
|
53
|
+
function orderedEntries(input) {
|
|
54
|
+
const entries = [
|
|
55
|
+
...input.operations.map((value) => ({ kind: "operation", value })),
|
|
56
|
+
...input.records.map((value) => ({ kind: "record", value })),
|
|
57
|
+
];
|
|
58
|
+
return entries.sort(compareEntries);
|
|
59
|
+
}
|
|
60
|
+
function sameRef(left, right) {
|
|
61
|
+
return left.type === right.type && left.id === right.id;
|
|
62
|
+
}
|
|
63
|
+
function sameFile(file, resource, fileId) {
|
|
64
|
+
return file.resource === resource && file.fileId === fileId;
|
|
65
|
+
}
|
|
66
|
+
function sameRelation(entry, target) {
|
|
67
|
+
return entry.relation === target.relation && entry.topicId === target.targetTopicId;
|
|
68
|
+
}
|
|
69
|
+
function applyUpdate(draft, fields) {
|
|
70
|
+
if (fields.title !== undefined)
|
|
71
|
+
draft.title = fields.title;
|
|
72
|
+
if (fields.owner !== undefined)
|
|
73
|
+
draft.owner = fields.owner ?? undefined;
|
|
74
|
+
if (fields.due !== undefined)
|
|
75
|
+
draft.due = fields.due ?? undefined;
|
|
76
|
+
if (fields.intent !== undefined)
|
|
77
|
+
draft.intent = fields.intent ?? undefined;
|
|
78
|
+
if (fields.outcome !== undefined)
|
|
79
|
+
draft.outcome = fields.outcome ?? undefined;
|
|
80
|
+
}
|
|
81
|
+
function applyStatus(draft, status) {
|
|
82
|
+
draft.status = status;
|
|
83
|
+
if (status === "done" || status === "dropped")
|
|
84
|
+
draft.blocked = undefined;
|
|
85
|
+
}
|
|
86
|
+
function applyGraph(draft, operation) {
|
|
87
|
+
switch (operation.type) {
|
|
88
|
+
case "link":
|
|
89
|
+
if (!draft.links.some((ref) => sameRef(ref, operation.ref)))
|
|
90
|
+
draft.links.push(operation.ref);
|
|
91
|
+
return;
|
|
92
|
+
case "unlink":
|
|
93
|
+
draft.links = draft.links.filter((ref) => !sameRef(ref, operation.ref));
|
|
94
|
+
return;
|
|
95
|
+
case "attach":
|
|
96
|
+
draft.files = [
|
|
97
|
+
...draft.files.filter((file) => !sameFile(file, operation.file.resource, operation.file.fileId)),
|
|
98
|
+
operation.file,
|
|
99
|
+
];
|
|
100
|
+
return;
|
|
101
|
+
case "detach":
|
|
102
|
+
draft.files = draft.files.filter((file) => !sameFile(file, operation.resource, operation.fileId));
|
|
103
|
+
return;
|
|
104
|
+
case "relate":
|
|
105
|
+
if (!draft.relations.some((item) => sameRelation(item, operation))) {
|
|
106
|
+
draft.relations.push({ relation: operation.relation, topicId: operation.targetTopicId, by: operation.actor, at: operation.createdAt });
|
|
107
|
+
}
|
|
108
|
+
return;
|
|
109
|
+
case "unrelate":
|
|
110
|
+
draft.relations = draft.relations.filter((item) => !sameRelation(item, operation));
|
|
111
|
+
return;
|
|
112
|
+
default:
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function applyOperation(draft, operation) {
|
|
117
|
+
switch (operation.type) {
|
|
118
|
+
case "update":
|
|
119
|
+
applyUpdate(draft, operation.fields);
|
|
120
|
+
return;
|
|
121
|
+
case "set-status":
|
|
122
|
+
applyStatus(draft, operation.status);
|
|
123
|
+
return;
|
|
124
|
+
case "block":
|
|
125
|
+
draft.blocked = {
|
|
126
|
+
reason: operation.reason,
|
|
127
|
+
...(operation.on === undefined ? {} : { on: operation.on }),
|
|
128
|
+
by: operation.actor,
|
|
129
|
+
since: operation.createdAt,
|
|
130
|
+
};
|
|
131
|
+
return;
|
|
132
|
+
case "unblock":
|
|
133
|
+
draft.blocked = undefined;
|
|
134
|
+
return;
|
|
135
|
+
case "bind-flow":
|
|
136
|
+
draft.flow = { flowUri: operation.flowUri, by: operation.actor, at: operation.createdAt };
|
|
137
|
+
return;
|
|
138
|
+
case "unbind-flow":
|
|
139
|
+
draft.flow = undefined;
|
|
140
|
+
return;
|
|
141
|
+
default:
|
|
142
|
+
applyGraph(draft, operation);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function applyRecord(draft, record) {
|
|
146
|
+
if (record.supersedes !== undefined) {
|
|
147
|
+
const target = draft.records.find((item) => item.id === record.supersedes && item.type === record.type);
|
|
148
|
+
if (target === undefined)
|
|
149
|
+
return "unknown-supersedes";
|
|
150
|
+
draft.superseded.add(target.id);
|
|
151
|
+
}
|
|
152
|
+
draft.records.push(record);
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
function admissionFor(entries, topicId, authorize) {
|
|
156
|
+
const verdicts = new Map();
|
|
157
|
+
for (const entry of entries) {
|
|
158
|
+
if (entry.value.topicId !== topicId)
|
|
159
|
+
verdicts.set(entry, "topic-mismatch");
|
|
160
|
+
else if (!authorize(entry))
|
|
161
|
+
verdicts.set(entry, "unauthorized");
|
|
162
|
+
}
|
|
163
|
+
const admissible = entries.filter((entry) => !verdicts.has(entry));
|
|
164
|
+
return { verdicts, conflicts: conflictingIds(admissible), seen: new Set() };
|
|
165
|
+
}
|
|
166
|
+
function rejectionFor(draft, entry, admission) {
|
|
167
|
+
const verdict = admission.verdicts.get(entry);
|
|
168
|
+
if (verdict !== undefined)
|
|
169
|
+
return verdict;
|
|
170
|
+
const id = entryId(entry);
|
|
171
|
+
if (admission.conflicts.has(id))
|
|
172
|
+
return "conflict";
|
|
173
|
+
if (admission.seen.has(id))
|
|
174
|
+
return "duplicate";
|
|
175
|
+
const reason = entry.kind === "record" ? applyRecord(draft, entry.value) : undefined;
|
|
176
|
+
if (reason === undefined)
|
|
177
|
+
admission.seen.add(id);
|
|
178
|
+
return reason;
|
|
179
|
+
}
|
|
180
|
+
function applyEntry(draft, entry, reason) {
|
|
181
|
+
if (reason !== undefined) {
|
|
182
|
+
draft.rejected.push({ id: entryId(entry), reason });
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (entry.kind === "operation")
|
|
186
|
+
applyOperation(draft, entry.value);
|
|
187
|
+
draft.updatedBy = entry.kind === "operation" ? entry.value.actor : entry.value.author;
|
|
188
|
+
draft.updatedAt = entry.value.createdAt;
|
|
189
|
+
}
|
|
190
|
+
function currentRecords(draft) {
|
|
191
|
+
const live = draft.records.filter((record) => !draft.superseded.has(record.id));
|
|
192
|
+
return {
|
|
193
|
+
decisions: live.filter((record) => record.type === "decision"),
|
|
194
|
+
outcomes: live.filter((record) => record.type === "outcome"),
|
|
195
|
+
artifacts: live.filter((record) => record.type === "artifact"),
|
|
196
|
+
receipts: live.filter((record) => record.type === "receipt"),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function isBaseKind(value) {
|
|
200
|
+
return TOPIC_KINDS_V2.includes(value);
|
|
201
|
+
}
|
|
202
|
+
export function baseKindOf(manifest) {
|
|
203
|
+
if (isBaseKind(manifest.kind))
|
|
204
|
+
return manifest.kind;
|
|
205
|
+
return manifest.baseKind ?? "task";
|
|
206
|
+
}
|
|
207
|
+
function optional(key, value) {
|
|
208
|
+
return value === undefined ? {} : { [key]: value };
|
|
209
|
+
}
|
|
210
|
+
function finish(input, draft) {
|
|
211
|
+
const { manifest } = input;
|
|
212
|
+
const state = {
|
|
213
|
+
version: 2,
|
|
214
|
+
id: manifest.id,
|
|
215
|
+
anchor: input.anchor,
|
|
216
|
+
title: draft.title,
|
|
217
|
+
kind: manifest.kind,
|
|
218
|
+
baseKind: baseKindOf(manifest),
|
|
219
|
+
status: draft.status,
|
|
220
|
+
...optional("owner", draft.owner),
|
|
221
|
+
...optional("due", draft.due),
|
|
222
|
+
...optional("intent", draft.intent),
|
|
223
|
+
...optional("outcome", draft.outcome),
|
|
224
|
+
...optional("blocked", draft.blocked),
|
|
225
|
+
createdBy: manifest.createdBy,
|
|
226
|
+
createdAt: manifest.createdAt,
|
|
227
|
+
updatedBy: draft.updatedBy,
|
|
228
|
+
updatedAt: draft.updatedAt,
|
|
229
|
+
links: draft.links,
|
|
230
|
+
files: draft.files,
|
|
231
|
+
relations: draft.relations,
|
|
232
|
+
...optional("flow", draft.flow),
|
|
233
|
+
records: currentRecords(draft),
|
|
234
|
+
};
|
|
235
|
+
return { ...state, etag: sha256V2(state), rejected: draft.rejected };
|
|
236
|
+
}
|
|
237
|
+
/** Recomputes the concurrency token from a projection; equal to `projection.etag` when the projection is untouched. */
|
|
238
|
+
export function topicEtagV2(projection) {
|
|
239
|
+
const { etag, rejected, ...state } = projection;
|
|
240
|
+
void etag;
|
|
241
|
+
void rejected;
|
|
242
|
+
return sha256V2(state);
|
|
243
|
+
}
|
|
244
|
+
function requireAuthorize(input) {
|
|
245
|
+
const candidate = input.authorize;
|
|
246
|
+
if (typeof candidate === "function")
|
|
247
|
+
return candidate;
|
|
248
|
+
throw new TopicProtocolError("AUTHORIZATION_FAILED", "Protocol 2.0 projection requires an explicit authorize policy");
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The only projector in Protocol 2.0. Folds a manifest, its operations, and
|
|
252
|
+
* its records into one deterministic projection. Ordering is by the createdAt
|
|
253
|
+
* instant, then identifier in byte order; later writes win per field. An
|
|
254
|
+
* identifier that appears with two different admissible payloads is a conflict
|
|
255
|
+
* and every admissible entry carrying it is rejected, whatever the arrival
|
|
256
|
+
* order. Entries that fail the topic or authorization check are rejected on
|
|
257
|
+
* their own and cannot create a conflict for anyone else.
|
|
258
|
+
*/
|
|
259
|
+
export function projectTopicV2(input) {
|
|
260
|
+
const authorize = requireAuthorize(input);
|
|
261
|
+
const draft = initialDraft(input.manifest);
|
|
262
|
+
const entries = orderedEntries(input);
|
|
263
|
+
const admission = admissionFor(entries, input.manifest.id, authorize);
|
|
264
|
+
for (const entry of entries)
|
|
265
|
+
applyEntry(draft, entry, rejectionFor(draft, entry, admission));
|
|
266
|
+
return finish(input, draft);
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../src/v2/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAsB3D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAqB5C,SAAS,YAAY,CAAC,QAAyB;IAC7C,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,IAAI,GAAG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G,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACtE,KAAK,MAAM,KAAK,IAAI,OAAO;QAAE,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7F,OAAO,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
export declare const TOPIC_KINDS_V2: readonly ["discussion", "question", "task", "project"];
|
|
2
|
+
export declare const TOPIC_STATUSES_V2: readonly ["open", "active", "waiting", "done", "dropped"];
|
|
3
|
+
export declare const TOPIC_RECORD_TYPES_V2: readonly ["decision", "outcome", "artifact", "receipt"];
|
|
4
|
+
export declare const TOPIC_RELATIONS_V2: readonly ["branches_from", "merged_into", "redirects_to", "references"];
|
|
5
|
+
export declare const TOPIC_OPERATION_TYPES_V2: readonly ["update", "set-status", "block", "unblock", "link", "unlink", "attach", "detach", "relate", "unrelate", "bind-flow", "unbind-flow"];
|
|
6
|
+
export type TopicBaseKindV2 = (typeof TOPIC_KINDS_V2)[number];
|
|
7
|
+
export type TopicStatusV2 = (typeof TOPIC_STATUSES_V2)[number];
|
|
8
|
+
export type TopicRecordTypeV2 = (typeof TOPIC_RECORD_TYPES_V2)[number];
|
|
9
|
+
export type TopicRelationV2 = (typeof TOPIC_RELATIONS_V2)[number];
|
|
10
|
+
export type TopicOperationTypeV2 = (typeof TOPIC_OPERATION_TYPES_V2)[number];
|
|
11
|
+
export interface TopicRefV2 {
|
|
12
|
+
readonly type: string;
|
|
13
|
+
readonly id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TopicFileV2 {
|
|
16
|
+
readonly provider: "ixo.vfs";
|
|
17
|
+
readonly resource: string;
|
|
18
|
+
readonly fileId: string;
|
|
19
|
+
readonly version: number;
|
|
20
|
+
readonly cid: string;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly mimeType?: string;
|
|
23
|
+
readonly size?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface TopicAnchorV2 {
|
|
26
|
+
readonly roomId: string;
|
|
27
|
+
readonly rootEventId: string;
|
|
28
|
+
}
|
|
29
|
+
export interface TopicBlockV2 {
|
|
30
|
+
readonly reason: string;
|
|
31
|
+
readonly on?: string;
|
|
32
|
+
readonly by: string;
|
|
33
|
+
readonly since: string;
|
|
34
|
+
}
|
|
35
|
+
/** Optional descriptive fields shared by the manifest and the projection. */
|
|
36
|
+
export interface TopicOptionalFieldsV2 {
|
|
37
|
+
readonly owner?: string;
|
|
38
|
+
readonly due?: string;
|
|
39
|
+
readonly intent?: string;
|
|
40
|
+
readonly outcome?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Immutable root content. A new Topic is `open`; status lives in operations. */
|
|
43
|
+
export interface TopicManifestV2 extends TopicOptionalFieldsV2 {
|
|
44
|
+
readonly version: 2;
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly title: string;
|
|
47
|
+
readonly kind: string;
|
|
48
|
+
readonly baseKind?: TopicBaseKindV2;
|
|
49
|
+
readonly createdBy: string;
|
|
50
|
+
readonly createdAt: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TopicUpdateFieldsV2 {
|
|
53
|
+
readonly title?: string;
|
|
54
|
+
readonly owner?: string | null;
|
|
55
|
+
readonly due?: string | null;
|
|
56
|
+
readonly intent?: string | null;
|
|
57
|
+
readonly outcome?: string | null;
|
|
58
|
+
}
|
|
59
|
+
interface OperationBaseV2 {
|
|
60
|
+
readonly version: 2;
|
|
61
|
+
readonly id: string;
|
|
62
|
+
readonly topicId: string;
|
|
63
|
+
readonly actor: string;
|
|
64
|
+
readonly createdAt: string;
|
|
65
|
+
}
|
|
66
|
+
export type TopicOperationV2 = OperationBaseV2 & ({
|
|
67
|
+
readonly type: "update";
|
|
68
|
+
readonly fields: TopicUpdateFieldsV2;
|
|
69
|
+
} | {
|
|
70
|
+
readonly type: "set-status";
|
|
71
|
+
readonly status: TopicStatusV2;
|
|
72
|
+
readonly reason?: string;
|
|
73
|
+
} | {
|
|
74
|
+
readonly type: "block";
|
|
75
|
+
readonly reason: string;
|
|
76
|
+
readonly on?: string;
|
|
77
|
+
} | {
|
|
78
|
+
readonly type: "unblock";
|
|
79
|
+
} | {
|
|
80
|
+
readonly type: "link";
|
|
81
|
+
readonly ref: TopicRefV2;
|
|
82
|
+
} | {
|
|
83
|
+
readonly type: "unlink";
|
|
84
|
+
readonly ref: TopicRefV2;
|
|
85
|
+
} | {
|
|
86
|
+
readonly type: "attach";
|
|
87
|
+
readonly file: TopicFileV2;
|
|
88
|
+
} | {
|
|
89
|
+
readonly type: "detach";
|
|
90
|
+
readonly resource: string;
|
|
91
|
+
readonly fileId: string;
|
|
92
|
+
} | {
|
|
93
|
+
readonly type: "relate";
|
|
94
|
+
readonly relation: TopicRelationV2;
|
|
95
|
+
readonly targetTopicId: string;
|
|
96
|
+
} | {
|
|
97
|
+
readonly type: "unrelate";
|
|
98
|
+
readonly relation: TopicRelationV2;
|
|
99
|
+
readonly targetTopicId: string;
|
|
100
|
+
} | {
|
|
101
|
+
readonly type: "bind-flow";
|
|
102
|
+
readonly flowUri: string;
|
|
103
|
+
} | {
|
|
104
|
+
readonly type: "unbind-flow";
|
|
105
|
+
});
|
|
106
|
+
export interface TopicRecordV2 {
|
|
107
|
+
readonly version: 2;
|
|
108
|
+
readonly id: string;
|
|
109
|
+
readonly topicId: string;
|
|
110
|
+
readonly type: TopicRecordTypeV2;
|
|
111
|
+
readonly text: string;
|
|
112
|
+
readonly author: string;
|
|
113
|
+
readonly createdAt: string;
|
|
114
|
+
readonly refs?: readonly TopicRefV2[];
|
|
115
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
116
|
+
readonly supersedes?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface TopicRelationEntryV2 {
|
|
119
|
+
readonly relation: TopicRelationV2;
|
|
120
|
+
readonly topicId: string;
|
|
121
|
+
readonly by: string;
|
|
122
|
+
readonly at: string;
|
|
123
|
+
}
|
|
124
|
+
export interface TopicFlowV2 {
|
|
125
|
+
readonly flowUri: string;
|
|
126
|
+
readonly by: string;
|
|
127
|
+
readonly at: string;
|
|
128
|
+
}
|
|
129
|
+
export interface TopicRecordsV2 {
|
|
130
|
+
readonly decisions: readonly TopicRecordV2[];
|
|
131
|
+
readonly outcomes: readonly TopicRecordV2[];
|
|
132
|
+
readonly artifacts: readonly TopicRecordV2[];
|
|
133
|
+
readonly receipts: readonly TopicRecordV2[];
|
|
134
|
+
}
|
|
135
|
+
export type RejectedReasonV2 = "conflict" | "duplicate" | "topic-mismatch" | "unauthorized" | "unknown-supersedes";
|
|
136
|
+
export interface RejectedEntryV2 {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly reason: RejectedReasonV2;
|
|
139
|
+
}
|
|
140
|
+
export interface TopicProjectionV2 extends TopicOptionalFieldsV2 {
|
|
141
|
+
readonly version: 2;
|
|
142
|
+
readonly id: string;
|
|
143
|
+
readonly anchor: TopicAnchorV2;
|
|
144
|
+
readonly title: string;
|
|
145
|
+
readonly kind: string;
|
|
146
|
+
readonly baseKind: TopicBaseKindV2;
|
|
147
|
+
readonly status: TopicStatusV2;
|
|
148
|
+
readonly blocked?: TopicBlockV2;
|
|
149
|
+
readonly createdBy: string;
|
|
150
|
+
readonly createdAt: string;
|
|
151
|
+
readonly updatedBy: string;
|
|
152
|
+
readonly updatedAt: string;
|
|
153
|
+
readonly links: readonly TopicRefV2[];
|
|
154
|
+
readonly files: readonly TopicFileV2[];
|
|
155
|
+
readonly relations: readonly TopicRelationEntryV2[];
|
|
156
|
+
readonly flow?: TopicFlowV2;
|
|
157
|
+
readonly records: TopicRecordsV2;
|
|
158
|
+
/** SHA-256 of the canonical projected state (everything except `etag` and `rejected`). Changes whenever any projected field changes; use as the optimistic-concurrency token. */
|
|
159
|
+
readonly etag: string;
|
|
160
|
+
readonly rejected: readonly RejectedEntryV2[];
|
|
161
|
+
}
|
|
162
|
+
export type TopicEntryV2 = {
|
|
163
|
+
readonly kind: "operation";
|
|
164
|
+
readonly value: TopicOperationV2;
|
|
165
|
+
} | {
|
|
166
|
+
readonly kind: "record";
|
|
167
|
+
readonly value: TopicRecordV2;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Returns whether the actor may apply the entry. The host supplies this from
|
|
171
|
+
* whatever it can actually verify: Matrix sender identity and room power level
|
|
172
|
+
* at minimum, a role policy or UCAN check when one exists. It is required; a
|
|
173
|
+
* projection without a policy is refused rather than defaulting to allow.
|
|
174
|
+
*/
|
|
175
|
+
export type TopicAuthorizeV2 = (entry: TopicEntryV2) => boolean;
|
|
176
|
+
export interface TopicProjectionInputV2 {
|
|
177
|
+
readonly manifest: TopicManifestV2;
|
|
178
|
+
readonly anchor: TopicAnchorV2;
|
|
179
|
+
readonly operations: readonly TopicOperationV2[];
|
|
180
|
+
readonly records: readonly TopicRecordV2[];
|
|
181
|
+
readonly authorize: TopicAuthorizeV2;
|
|
182
|
+
}
|
|
183
|
+
export interface TopicMessageV2 {
|
|
184
|
+
readonly eventId: string;
|
|
185
|
+
readonly sender: string;
|
|
186
|
+
readonly body: string;
|
|
187
|
+
readonly at: string;
|
|
188
|
+
}
|
|
189
|
+
export interface TopicCapsuleV2 {
|
|
190
|
+
readonly version: 2;
|
|
191
|
+
readonly topic: TopicProjectionV2;
|
|
192
|
+
readonly messages: readonly TopicMessageV2[];
|
|
193
|
+
readonly hint: string;
|
|
194
|
+
}
|
|
195
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const TOPIC_KINDS_V2 = ["discussion", "question", "task", "project"];
|
|
2
|
+
export const TOPIC_STATUSES_V2 = ["open", "active", "waiting", "done", "dropped"];
|
|
3
|
+
export const TOPIC_RECORD_TYPES_V2 = ["decision", "outcome", "artifact", "receipt"];
|
|
4
|
+
export const TOPIC_RELATIONS_V2 = ["branches_from", "merged_into", "redirects_to", "references"];
|
|
5
|
+
export const TOPIC_OPERATION_TYPES_V2 = [
|
|
6
|
+
"update",
|
|
7
|
+
"set-status",
|
|
8
|
+
"block",
|
|
9
|
+
"unblock",
|
|
10
|
+
"link",
|
|
11
|
+
"unlink",
|
|
12
|
+
"attach",
|
|
13
|
+
"detach",
|
|
14
|
+
"relate",
|
|
15
|
+
"unrelate",
|
|
16
|
+
"bind-flow",
|
|
17
|
+
"unbind-flow",
|
|
18
|
+
];
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/v2/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AACrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAC3F,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,CAAU,CAAC;AAC1G,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,WAAW;IACX,aAAa;CACL,CAAC"}
|