@knkcs/contenthub-ui 0.3.0 → 0.4.0

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
@@ -14,6 +14,17 @@ declare interface BlockReason {
14
14
  updateTime: string;
15
15
  }
16
16
 
17
+ /** One Blueprint's override of the workspace's editing settings. */
18
+ declare interface BlueprintEditingOverride {
19
+ blueprintAccessor: string;
20
+ /** null follows the workspace's. */
21
+ editingMode: EditingMode | null;
22
+ /** null follows the workspace's. */
23
+ editingBlock: boolean | null;
24
+ /** What applies to the Blueprint's Content: this override over the workspace's. */
25
+ effective: EditingSettings;
26
+ }
27
+
17
28
  /** A content Blueprint, as the `BlueprintSource` port names it. */
18
29
  declare interface BlueprintInfo {
19
30
  id: string;
@@ -116,6 +127,10 @@ declare interface ChangeSet {
116
127
  * planned. Empty in a list.
117
128
  */
118
129
  plannedReleases: PlannedRelease[];
130
+ /** A Direct Edit, or one editors build; absent reads as "change_set". */
131
+ kind?: ChangeSetKind;
132
+ /** A Direct Edit's editor, an odon user id; absent or "" for any other kind. */
133
+ editorId?: string;
119
134
  }
120
135
 
121
136
  /** One Branch of a Chain, with the head a save on it names. */
@@ -151,6 +166,12 @@ declare interface ChangeSetChain {
151
166
  branches: ChangeSetBranch[];
152
167
  }
153
168
 
169
+ /**
170
+ * What kind of Change Set one is (ADR 0022): a Direct Edit, opened from one
171
+ * Content for one editor, or one editors build Chain by Chain.
172
+ */
173
+ declare type ChangeSetKind = "change_set" | "direct_edit";
174
+
154
175
  /** One page of `listChangeSets`. */
155
176
  declare interface ChangeSetList {
156
177
  changeSets: ChangeSet[];
@@ -182,6 +203,11 @@ declare interface ChangeSetStatusInfo {
182
203
  name: string;
183
204
  /** Its colour as statushub holds it (a CSS colour); absent for none. */
184
205
  color?: string;
206
+ /**
207
+ * statushub's default for the catalogue: what a Change Set without a
208
+ * status reads as (ADR 0014 D9). At most one status has it.
209
+ */
210
+ isDefault?: boolean;
185
211
  }
186
212
 
187
213
  /** What `updateChangeSet` changes of a Change Set. */
@@ -370,6 +396,10 @@ declare interface ContenthubClient {
370
396
  assigneeId?: string;
371
397
  /** Only those with a Chain on this Content. */
372
398
  contentId?: string;
399
+ /** Only those of this kind: the index asks for "change_set", hiding Direct Edits. */
400
+ kind?: ChangeSetKind;
401
+ /** Only the Direct Edits of this odon user. */
402
+ editorId?: string;
373
403
  /** At most 200; 50 when absent. */
374
404
  pageSize?: number;
375
405
  pageToken?: string;
@@ -452,6 +482,29 @@ declare interface ContenthubClient {
452
482
  id: string;
453
483
  reviewedHeads: Record<string, string>;
454
484
  }): Promise<PublishOutcome>;
485
+ /**
486
+ * Change validity (ADR 0022): corrects only a published Release's
487
+ * Validity Period, in one request and without a Direct Edit. It opens a
488
+ * Change Set, plans the date-only Release re-pinning the Release's
489
+ * Revision and superseding it, and publishes it with the proposals for
490
+ * the neighbouring Releases; the outcome is that Publish's. Refused as a
491
+ * whole, it leaves no Change Set behind: rejects with
492
+ * `EditingModeRefusedError` where the Content's Blueprint is "Change Sets
493
+ * only", `CoversReleaseError` (`changeSetRequired`) when the period would
494
+ * cover another Release entirely, `PublishRefusedError` with every
495
+ * blocker (an outstanding Required Check among them),
496
+ * `AccessDeniedError` for a caller who may not publish,
497
+ * `ContentBlockedError` and `InvalidInputError` for what else the service
498
+ * refuses.
499
+ */
500
+ changeValidity(input: {
501
+ releaseId: string;
502
+ validityPeriod: ValidityPeriod;
503
+ /** The Change Set's name; the service names it after the Content when absent. */
504
+ changeSetName?: string;
505
+ /** Makes a retry safe (CONTEXT.md, Idempotency Key). */
506
+ idempotencyKey?: string;
507
+ }): Promise<PublishOutcome>;
455
508
  /**
456
509
  * Merges what Main (and each dependency) gained since into every Chain
457
510
  * of the Change Set. A Branch whose merge has Conflicts, or fails its
@@ -544,6 +597,39 @@ declare interface ContenthubClient {
544
597
  requiredCheckId: string;
545
598
  recorder: RecorderGrant;
546
599
  }): Promise<void>;
600
+ /**
601
+ * How the workspace's Content may be changed (ADR 0022): its own Editing
602
+ * Mode and Editing Block, and every per-Blueprint override with the
603
+ * values it makes effective. A workspace that never set them reads as
604
+ * "Change Sets only" without an Editing Block.
605
+ */
606
+ getEditingSettings(): Promise<WorkspaceEditingSettings>;
607
+ /**
608
+ * The editing settings in effect for the Content of the Blueprint with
609
+ * `blueprintAccessor`: its override over the workspace's, field by
610
+ * field. A host's Blueprint page reads it.
611
+ */
612
+ getEffectiveEditingSettings(blueprintAccessor: string): Promise<EffectiveEditingSettings>;
613
+ /**
614
+ * Replaces the workspace's own editing settings; admin only. It takes
615
+ * effect at once. Rejects with `AccessDeniedError` for a non-admin and
616
+ * `InvalidInputError` for what the service refuses.
617
+ */
618
+ setEditingSettings(settings: EditingSettings): Promise<EditingSettings>;
619
+ /**
620
+ * Replaces one Blueprint's override; admin only. A null field follows the
621
+ * workspace's, and at least one must be set. Rejects as
622
+ * `setEditingSettings` does.
623
+ */
624
+ setBlueprintEditingOverride(input: {
625
+ blueprintAccessor: string;
626
+ editingMode: EditingMode | null;
627
+ editingBlock: boolean | null;
628
+ }): Promise<BlueprintEditingOverride>;
629
+ /** Removes one Blueprint's override, so it follows the workspace's; admin only. */
630
+ deleteBlueprintEditingOverride(input: {
631
+ blueprintAccessor: string;
632
+ }): Promise<void>;
547
633
  /** Every Collection of the workspace, by name, then id: a tree by `parentId`. */
548
634
  listCollections(): Promise<Collection[]>;
549
635
  /**
@@ -714,12 +800,15 @@ declare interface ContenthubClient {
714
800
  }): Promise<Content>;
715
801
  /**
716
802
  * 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.
803
+ * inside `changeSetId`, at the head of its Chain's last Branch, or of
804
+ * `branchId`, a Branch of that Chain, when given (#252). Content born in
805
+ * an open Change Set exists only there, so read anywhere else it is a
806
+ * NotFound ConnectError, as is a Branch outside the Chain.
719
807
  */
720
808
  getContent(input: {
721
809
  id: string;
722
810
  changeSetId?: string;
811
+ branchId?: string;
723
812
  }): Promise<ContentDetail>;
724
813
  /** Its Timeline, with the Planned Releases of open Change Sets beside it. */
725
814
  getTimeline(contentId: string): Promise<ContentTimeline>;
@@ -795,6 +884,43 @@ declare interface ContenthubClient {
795
884
  * `ChangeSetClosedError`, and `InvalidInputError` for anything else the
796
885
  * service refuses (a missing or needless effective date).
797
886
  */
887
+ /**
888
+ * Opens a Direct Edit of a published Content for the caller (ADR 0022),
889
+ * or answers the one the caller has open on it, with `reopened`. Answers
890
+ * the Direct Edit and the Content as read on its Branch. Rejects with
891
+ * `EditingModeRefusedError` where the Editing Mode is "Change Sets only",
892
+ * `DirectEditRefusedError` where the Content is Dated, `ContentBlockedError`, `ContentArchivedError`,
893
+ * and `InvalidInputError` for anything else the service refuses.
894
+ */
895
+ openDirectEdit(input: {
896
+ contentId: string;
897
+ /** Makes a retry safe (CONTEXT.md, Idempotency Key). */
898
+ idempotencyKey?: string;
899
+ }): Promise<{
900
+ changeSet: ChangeSet;
901
+ content: Content;
902
+ reopened: boolean;
903
+ }>;
904
+ /**
905
+ * Publishes a Direct Edit at `expectedHeadId`, the head of its Branch the
906
+ * editor saw: one Release, In Force from its Publish. Rejects as
907
+ * `publish` does, and with `DirectEditRefusedError` for a Change Set that
908
+ * is not a Direct Edit.
909
+ */
910
+ publishDirectEdit(input: {
911
+ id: string;
912
+ expectedHeadId: string;
913
+ idempotencyKey?: string;
914
+ }): Promise<PublishOutcome>;
915
+ /**
916
+ * Discards a Direct Edit: its work is dropped, Main and the Releases stay.
917
+ * Rejects as `discardChangeSet` does, and with `DirectEditRefusedError`
918
+ * for a Change Set that is not a Direct Edit.
919
+ */
920
+ discardDirectEdit(input: {
921
+ id: string;
922
+ idempotencyKey?: string;
923
+ }): Promise<ChangeSet>;
798
924
  startEditing(input: {
799
925
  contentId: string;
800
926
  changeSetId?: string;
@@ -973,6 +1099,28 @@ declare interface Edge {
973
1099
  /** What kind of edge of the Content Graph (ADR 0009). */
974
1100
  declare type EdgeKind = "reference" | "toc" | "include" | "exclude" | "replace" | "annotate" | "link" | "footnote" | "anchor" | "media" | "blueprint" | "unspecified";
975
1101
 
1102
+ /**
1103
+ * Which ways of changing a Blueprint's Content the workspace offers (ADR
1104
+ * 0022, CONTEXT.md Editing Mode): Direct Edits only, Change Sets only, or
1105
+ * both. Only "change_sets" is a rule: contenthub refuses a Direct Edit on
1106
+ * such Content.
1107
+ */
1108
+ declare type EditingMode = "direct_edits" | "change_sets" | "both";
1109
+
1110
+ /** The workspace's editing settings, or the ones in effect for a Blueprint. */
1111
+ declare interface EditingSettings {
1112
+ editingMode: EditingMode;
1113
+ /** Whether opening a Direct Edit sets an Editing Block on its Content. */
1114
+ editingBlock: boolean;
1115
+ }
1116
+
1117
+ /** The editing settings in effect for one Blueprint, and which its override decides. */
1118
+ declare interface EffectiveEditingSettings {
1119
+ effective: EditingSettings;
1120
+ editingModeOverridden: boolean;
1121
+ editingBlockOverridden: boolean;
1122
+ }
1123
+
976
1124
  /** One field that differs between two Revisions. */
977
1125
  declare interface FieldChange {
978
1126
  /** "/" and the field's accessor. */
@@ -1252,6 +1400,11 @@ declare interface RequiredCheckRecorders {
1252
1400
  declare interface ResolvedBlueprintRelease {
1253
1401
  /** The Blueprint's name, as the released Revision holds it; "" if it holds none. */
1254
1402
  displayName: string;
1403
+ /**
1404
+ * The Blueprint's accessor, which its editing settings are keyed by;
1405
+ * "" or absent when the Resolved Release names none.
1406
+ */
1407
+ accessor?: string;
1255
1408
  /** Whether its Content is Dated: its Releases carry a Validity Period. */
1256
1409
  dated: boolean;
1257
1410
  /** fieldkit's Resolved Spec fields, in Blueprint order. */
@@ -1321,7 +1474,8 @@ declare interface RevisionList {
1321
1474
  * The port a host fills with statushub (ADR 0020): the workspace's Change Set
1322
1475
  * statuses, for their display names and colours. contenthub-ui depends on no
1323
1476
  * statushub package. A host without statushub leaves the port empty, and the
1324
- * screens then show the bare slug and offer no status picker.
1477
+ * screens then show the bare slug and offer no status picker. The status
1478
+ * marked `isDefault` names a Change Set that has none yet (ADR 0014 D9).
1325
1479
  */
1326
1480
  declare interface StatusSource {
1327
1481
  /** Every status of the workspace's `contenthub/change_set` catalogue, in its order. */
@@ -1517,6 +1671,13 @@ export declare interface StubContenthubClientOptions {
1517
1671
  userId?: string;
1518
1672
  /** The time every write stamps; STUB_NOW by default. */
1519
1673
  now?: () => string;
1674
+ /**
1675
+ * The workspace's own editing settings; "Change Sets only" without an
1676
+ * Editing Block by default, as for a workspace that never set them.
1677
+ */
1678
+ editingSettings?: EditingSettings;
1679
+ /** The per-Blueprint overrides of the editing settings; none by default. */
1680
+ editingOverrides?: StubEditingOverride[];
1520
1681
  }
1521
1682
 
1522
1683
  /**
@@ -1527,6 +1688,13 @@ export declare interface StubContenthubClientOptions {
1527
1688
  */
1528
1689
  export declare function stubContents(): StubContent[];
1529
1690
 
1691
+ /** One stored override: a null field follows the workspace's. */
1692
+ export declare interface StubEditingOverride {
1693
+ blueprintAccessor: string;
1694
+ editingMode: EditingMode | null;
1695
+ editingBlock: boolean | null;
1696
+ }
1697
+
1530
1698
  /** One head of a Content: its Revision, data and when it was written. */
1531
1699
  export declare interface StubHead {
1532
1700
  revisionId: string;
@@ -1567,6 +1735,14 @@ export declare function stubResolvedReleases(): Record<string, ResolvedBlueprint
1567
1735
  */
1568
1736
  export declare function stubStatusTransitions(): Record<string, string[]>;
1569
1737
 
1738
+ /**
1739
+ * An editorial note, undated and published, whose Blueprint `note` is what a
1740
+ * Direct Edit edits (ADR 0022, #264): Dated Content takes none yet. Not among
1741
+ * `stubContents()`, so the Library's fixtures stay as they are; pass it in
1742
+ * with `contents`, and set the stub's `editingSettings` to offer Edit.
1743
+ */
1744
+ export declare function stubUndatedContent(): StubContent;
1745
+
1570
1746
  /** One Release of a Content's Timeline (CONTEXT.md, Timeline), without its data. */
1571
1747
  declare interface TimelineEntry {
1572
1748
  /** Its place in the Timeline, from 1. */
@@ -1604,4 +1780,10 @@ declare interface ValidityPeriod {
1604
1780
  lastDay: string;
1605
1781
  }
1606
1782
 
1783
+ /** The workspace's editing settings and every per-Blueprint override, by accessor. */
1784
+ declare interface WorkspaceEditingSettings {
1785
+ workspace: EditingSettings;
1786
+ overrides: BlueprintEditingOverride[];
1787
+ }
1788
+
1607
1789
  export { }