@knkcs/contenthub-ui 0.3.0 → 0.3.1

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/dist/testing.d.ts CHANGED
@@ -182,6 +182,11 @@ declare interface ChangeSetStatusInfo {
182
182
  name: string;
183
183
  /** Its colour as statushub holds it (a CSS colour); absent for none. */
184
184
  color?: string;
185
+ /**
186
+ * statushub's default for the catalogue: what a Change Set without a
187
+ * status reads as (ADR 0014 D9). At most one status has it.
188
+ */
189
+ isDefault?: boolean;
185
190
  }
186
191
 
187
192
  /** What `updateChangeSet` changes of a Change Set. */
@@ -714,12 +719,15 @@ declare interface ContenthubClient {
714
719
  }): Promise<Content>;
715
720
  /**
716
721
  * One Content with its Blueprint Release and attributes: on Main, or
717
- * inside `changeSetId`. Content born in an open Change Set exists only
718
- * there, so read anywhere else it is a NotFound ConnectError.
722
+ * inside `changeSetId`, at the head of its Chain's last Branch, or of
723
+ * `branchId`, a Branch of that Chain, when given (#252). Content born in
724
+ * an open Change Set exists only there, so read anywhere else it is a
725
+ * NotFound ConnectError, as is a Branch outside the Chain.
719
726
  */
720
727
  getContent(input: {
721
728
  id: string;
722
729
  changeSetId?: string;
730
+ branchId?: string;
723
731
  }): Promise<ContentDetail>;
724
732
  /** Its Timeline, with the Planned Releases of open Change Sets beside it. */
725
733
  getTimeline(contentId: string): Promise<ContentTimeline>;
@@ -1321,7 +1329,8 @@ declare interface RevisionList {
1321
1329
  * The port a host fills with statushub (ADR 0020): the workspace's Change Set
1322
1330
  * statuses, for their display names and colours. contenthub-ui depends on no
1323
1331
  * statushub package. A host without statushub leaves the port empty, and the
1324
- * screens then show the bare slug and offer no status picker.
1332
+ * screens then show the bare slug and offer no status picker. The status
1333
+ * marked `isDefault` names a Change Set that has none yet (ADR 0014 D9).
1325
1334
  */
1326
1335
  declare interface StatusSource {
1327
1336
  /** Every status of the workspace's `contenthub/change_set` catalogue, in its order. */
package/dist/testing.js CHANGED
@@ -36,7 +36,8 @@ function E() {
36
36
  {
37
37
  slug: "in_progress",
38
38
  name: "In Bearbeitung",
39
- color: "steelblue"
39
+ color: "steelblue",
40
+ isDefault: !0
40
41
  },
41
42
  {
42
43
  slug: "in_review",
@@ -1389,17 +1390,31 @@ function M(v = {}) {
1389
1390
  content: structuredClone(i)
1390
1391
  }), i;
1391
1392
  },
1392
- async getContent({ id: e, changeSetId: t }) {
1393
- let n = U(e), [r] = $(n, t ? {
1393
+ async getContent({ id: e, changeSetId: t, branchId: n }) {
1394
+ let r = U(e), i = t ? {
1394
1395
  kind: "change_set",
1395
1396
  changeSetId: t
1396
- } : { kind: "main" }, "");
1397
- if (!r) throw k("Content", e);
1398
- let i = P[n.blueprintReleaseId];
1397
+ } : { kind: "main" };
1398
+ if (n && !t) throw new a("branch_id names a Branch of a Change Set: give its change_set_id too");
1399
+ let [o] = $(r, i, "");
1400
+ if (!o) throw k("Content", e);
1401
+ if (n && n !== o.branchId) {
1402
+ let i = w.find((e) => e.id === t)?.chains.find((t) => t.contentId === e)?.branches.find((e) => e.id === n);
1403
+ if (!i) throw k("Branch", n);
1404
+ let a = K(r).find((e) => e.id === i.headRevisionId), s = a?.data ?? (r.main?.revisionId === i.headRevisionId ? r.main.data : {});
1405
+ o = {
1406
+ ...o,
1407
+ revisionId: i.headRevisionId,
1408
+ data: structuredClone(s),
1409
+ branchId: n,
1410
+ revisionCreateTime: a?.createTime ?? o.revisionCreateTime
1411
+ };
1412
+ }
1413
+ let s = P[r.blueprintReleaseId];
1399
1414
  return {
1400
- content: r,
1401
- blueprintRelease: i ? structuredClone(i) : void 0,
1402
- attributes: W(n)
1415
+ content: o,
1416
+ blueprintRelease: s ? structuredClone(s) : void 0,
1417
+ attributes: W(r)
1403
1418
  };
1404
1419
  },
1405
1420
  async getTimeline(e) {