@knkcs/contenthub-ui 0.3.1 → 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[];
@@ -375,6 +396,10 @@ declare interface ContenthubClient {
375
396
  assigneeId?: string;
376
397
  /** Only those with a Chain on this Content. */
377
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;
378
403
  /** At most 200; 50 when absent. */
379
404
  pageSize?: number;
380
405
  pageToken?: string;
@@ -457,6 +482,29 @@ declare interface ContenthubClient {
457
482
  id: string;
458
483
  reviewedHeads: Record<string, string>;
459
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>;
460
508
  /**
461
509
  * Merges what Main (and each dependency) gained since into every Chain
462
510
  * of the Change Set. A Branch whose merge has Conflicts, or fails its
@@ -549,6 +597,39 @@ declare interface ContenthubClient {
549
597
  requiredCheckId: string;
550
598
  recorder: RecorderGrant;
551
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>;
552
633
  /** Every Collection of the workspace, by name, then id: a tree by `parentId`. */
553
634
  listCollections(): Promise<Collection[]>;
554
635
  /**
@@ -803,6 +884,43 @@ declare interface ContenthubClient {
803
884
  * `ChangeSetClosedError`, and `InvalidInputError` for anything else the
804
885
  * service refuses (a missing or needless effective date).
805
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>;
806
924
  startEditing(input: {
807
925
  contentId: string;
808
926
  changeSetId?: string;
@@ -981,6 +1099,28 @@ declare interface Edge {
981
1099
  /** What kind of edge of the Content Graph (ADR 0009). */
982
1100
  declare type EdgeKind = "reference" | "toc" | "include" | "exclude" | "replace" | "annotate" | "link" | "footnote" | "anchor" | "media" | "blueprint" | "unspecified";
983
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
+
984
1124
  /** One field that differs between two Revisions. */
985
1125
  declare interface FieldChange {
986
1126
  /** "/" and the field's accessor. */
@@ -1260,6 +1400,11 @@ declare interface RequiredCheckRecorders {
1260
1400
  declare interface ResolvedBlueprintRelease {
1261
1401
  /** The Blueprint's name, as the released Revision holds it; "" if it holds none. */
1262
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;
1263
1408
  /** Whether its Content is Dated: its Releases carry a Validity Period. */
1264
1409
  dated: boolean;
1265
1410
  /** fieldkit's Resolved Spec fields, in Blueprint order. */
@@ -1526,6 +1671,13 @@ export declare interface StubContenthubClientOptions {
1526
1671
  userId?: string;
1527
1672
  /** The time every write stamps; STUB_NOW by default. */
1528
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[];
1529
1681
  }
1530
1682
 
1531
1683
  /**
@@ -1536,6 +1688,13 @@ export declare interface StubContenthubClientOptions {
1536
1688
  */
1537
1689
  export declare function stubContents(): StubContent[];
1538
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
+
1539
1698
  /** One head of a Content: its Revision, data and when it was written. */
1540
1699
  export declare interface StubHead {
1541
1700
  revisionId: string;
@@ -1576,6 +1735,14 @@ export declare function stubResolvedReleases(): Record<string, ResolvedBlueprint
1576
1735
  */
1577
1736
  export declare function stubStatusTransitions(): Record<string, string[]>;
1578
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
+
1579
1746
  /** One Release of a Content's Timeline (CONTEXT.md, Timeline), without its data. */
1580
1747
  declare interface TimelineEntry {
1581
1748
  /** Its place in the Timeline, from 1. */
@@ -1613,4 +1780,10 @@ declare interface ValidityPeriod {
1613
1780
  lastDay: string;
1614
1781
  }
1615
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
+
1616
1789
  export { }