@knkcs/contenthub-ui 0.4.0 → 0.5.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
@@ -21,6 +21,8 @@ declare interface BlueprintEditingOverride {
21
21
  editingMode: EditingMode | null;
22
22
  /** null follows the workspace's. */
23
23
  editingBlock: boolean | null;
24
+ /** The people beside the admins; null follows the workspace's, [] is the admins alone. */
25
+ forceGroup: string[] | null;
24
26
  /** What applies to the Blueprint's Content: this override over the workspace's. */
25
27
  effective: EditingSettings;
26
28
  }
@@ -83,6 +85,13 @@ declare interface BlueprintSource {
83
85
  /** What a Branch is for: one an editor works on, or a Carry-forward link. */
84
86
  declare type BranchKind = "editorial" | "carry_forward";
85
87
 
88
+ /** Whether a Direct Edit's change carries forward into one later wording (#270). */
89
+ declare interface CarryForwardAnswer {
90
+ /** The later wording: the Release a Carry-forward link carries. */
91
+ releaseId: string;
92
+ carry: boolean;
93
+ }
94
+
86
95
  /** What a Chain on Dated Content, effective on a date, would be and meet (PreviewChain). */
87
96
  declare interface ChainPreview {
88
97
  /** The Release it would fork from; "" in a gap. */
@@ -328,6 +337,8 @@ declare interface ContentAttributes {
328
337
  block?: ContentBlock;
329
338
  /** When it was archived, ISO 8601; absent while it is not Archived. */
330
339
  archiveTime?: string;
340
+ /** Its Editing Block; absent while no open Direct Edit holds one. */
341
+ editingBlock?: EditingBlock;
331
342
  }
332
343
 
333
344
  /**
@@ -625,6 +636,8 @@ declare interface ContenthubClient {
625
636
  blueprintAccessor: string;
626
637
  editingMode: EditingMode | null;
627
638
  editingBlock: boolean | null;
639
+ /** null follows the workspace's; [] is the admins alone. */
640
+ forceGroup: string[] | null;
628
641
  }): Promise<BlueprintEditingOverride>;
629
642
  /** Removes one Blueprint's override, so it follows the workspace's; admin only. */
630
643
  deleteBlueprintEditingOverride(input: {
@@ -889,11 +902,20 @@ declare interface ContenthubClient {
889
902
  * or answers the one the caller has open on it, with `reopened`. Answers
890
903
  * the Direct Edit and the Content as read on its Branch. Rejects with
891
904
  * `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.
905
+ * `DirectEditRefusedError` where another editor's Direct Edit holds its
906
+ * Editing Block (naming them), `ContentBlockedError`, `ContentArchivedError`,
907
+ * and `InvalidInputError` for anything else the service refuses (a day
908
+ * for undated Content among it).
894
909
  */
895
910
  openDirectEdit(input: {
896
911
  contentId: string;
912
+ /**
913
+ * Dated Content only (#270): the day the change takes effect, as
914
+ * YYYY-MM-DD; absent is today. Its Branch forks from the Release In
915
+ * Force that day: on today it corrects that Release, on a later day
916
+ * it is a new wording.
917
+ */
918
+ effectiveOn?: string;
897
919
  /** Makes a retry safe (CONTEXT.md, Idempotency Key). */
898
920
  idempotencyKey?: string;
899
921
  }): Promise<{
@@ -901,17 +923,63 @@ declare interface ContenthubClient {
901
923
  content: Content;
902
924
  reopened: boolean;
903
925
  }>;
926
+ /**
927
+ * What a Direct Edit's Publish of Dated Content would plan (#270): its
928
+ * Release's Validity Period with `validityLastDay` as Publish takes it,
929
+ * the Release it corrects, the date-only Releases contenthub derives and
930
+ * the later wordings Publish asks about. Writes nothing. Rejects with
931
+ * `CoversReleaseError` (`changeSetRequired`) when the period would cover
932
+ * a Release entirely.
933
+ */
934
+ previewDirectEditPublish(input: {
935
+ id: string;
936
+ validityLastDay?: string;
937
+ }): Promise<DirectEditPublishPreview>;
904
938
  /**
905
939
  * 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.
940
+ * editor saw: one Release, In Force from its Publish, carrying
941
+ * `releaseSpec`. Rejects as `publish` does, with `ContentRefusedError`
942
+ * for Release Spec values the Blueprint Release refuses (a required one
943
+ * missing among them), and with `DirectEditRefusedError` for a Change
944
+ * Set that is not a Direct Edit. On Dated Content (#270) it takes the
945
+ * Validity Period's last day and one carry-forward answer per later
946
+ * wording, and rejects with `CoversReleaseError` (`changeSetRequired`)
947
+ * when the period would cover a Release entirely.
909
948
  */
910
949
  publishDirectEdit(input: {
911
950
  id: string;
912
951
  expectedHeadId: string;
952
+ /** The Release's Release Spec values; absent is none. */
953
+ releaseSpec?: Record<string, unknown>;
954
+ /** Dated Content: the period's last day, "" for an open end; absent keeps the default. */
955
+ validityLastDay?: string;
956
+ /** Dated Content: whether the change carries into each later wording. */
957
+ carryForward?: CarryForwardAnswer[];
913
958
  idempotencyKey?: string;
914
959
  }): Promise<PublishOutcome>;
960
+ /**
961
+ * Saves on a Direct Edit's Branch on top of `expectedHeadId`, as
962
+ * `saveRevision` does, and publishes the Revision saved, as
963
+ * `publishDirectEdit` does, in one request (ADR 0022). Refused as a
964
+ * whole, with nothing saved: rejects as either does (`StaleHeadError`,
965
+ * `ContentRefusedError` for the data or the Release Spec values,
966
+ * `PublishRefusedError` with every blocker).
967
+ */
968
+ saveAndPublishDirectEdit(input: {
969
+ id: string;
970
+ expectedHeadId: string;
971
+ data: Record<string, unknown>;
972
+ /** Top-level field accessors; absent saves `data` as the whole Revision. */
973
+ fieldMask?: string[];
974
+ releaseSpec?: Record<string, unknown>;
975
+ /** As `publishDirectEdit`'s. */
976
+ validityLastDay?: string;
977
+ carryForward?: CarryForwardAnswer[];
978
+ idempotencyKey?: string;
979
+ }): Promise<{
980
+ content: Content;
981
+ outcome: PublishOutcome;
982
+ }>;
915
983
  /**
916
984
  * Discards a Direct Edit: its work is dropped, Main and the Releases stay.
917
985
  * Rejects as `discardChangeSet` does, and with `DirectEditRefusedError`
@@ -921,6 +989,23 @@ declare interface ContenthubClient {
921
989
  id: string;
922
990
  idempotencyKey?: string;
923
991
  }): Promise<ChangeSet>;
992
+ /**
993
+ * Forces an Editing Block (ADR 0022): hands the Direct Edit `id` holding
994
+ * it, with its work and its Editing Block, to the caller. Answers it with
995
+ * the caller as its editor, the Content as read on its Branch, and who
996
+ * edited it until now. Rejects with `AccessDeniedError` outside the
997
+ * Force Group, `DirectEditRefusedError` where the caller has a Direct
998
+ * Edit of the Content of their own or it holds no Editing Block any more,
999
+ * and as `discardDirectEdit` does otherwise.
1000
+ */
1001
+ forceDirectEdit(input: {
1002
+ id: string;
1003
+ idempotencyKey?: string;
1004
+ }): Promise<{
1005
+ changeSet: ChangeSet;
1006
+ content: Content;
1007
+ previousEditorId: string;
1008
+ }>;
924
1009
  startEditing(input: {
925
1010
  contentId: string;
926
1011
  changeSetId?: string;
@@ -1081,6 +1166,21 @@ export declare function createStubContenthubClient(options?: StubContenthubClien
1081
1166
 
1082
1167
  export declare function createStubStatusSource(statuses?: ChangeSetStatusInfo[]): StatusSource;
1083
1168
 
1169
+ /**
1170
+ * What a Direct Edit's Publish of Dated Content would plan (#270), for its
1171
+ * Publish dialog: nothing of it is written.
1172
+ */
1173
+ declare interface DirectEditPublishPreview {
1174
+ /** Its Release's Validity Period; an empty last day is an open end. */
1175
+ validityPeriod?: ValidityPeriod;
1176
+ /** The Release it corrects and Supersedes; "" for a new wording. */
1177
+ correctsReleaseId: string;
1178
+ /** The date-only Releases contenthub derives, read-only. */
1179
+ dateOnlyReleases: PlannedRelease[];
1180
+ /** The later wordings Publish asks about, by first day. */
1181
+ laterWordings: LaterWording[];
1182
+ }
1183
+
1084
1184
  /** One edge of one Revision. */
1085
1185
  declare interface Edge {
1086
1186
  sourceContentId: string;
@@ -1099,6 +1199,21 @@ declare interface Edge {
1099
1199
  /** What kind of edge of the Content Graph (ADR 0009). */
1100
1200
  declare type EdgeKind = "reference" | "toc" | "include" | "exclude" | "replace" | "annotate" | "link" | "footnote" | "anchor" | "media" | "blueprint" | "unspecified";
1101
1201
 
1202
+ /**
1203
+ * The Block a Direct Edit sets on its Content (CONTEXT.md, Editing Block):
1204
+ * "being edited by" its editor. It keeps out only other editors' Direct
1205
+ * Edits, ends with its Direct Edit's Publish or Discard, and can't be
1206
+ * lifted. It is independent of `block`: a Content can hold both.
1207
+ */
1208
+ declare interface EditingBlock {
1209
+ /** The Direct Edit's editor, an odon user id. */
1210
+ editorId: string;
1211
+ /** The Direct Edit holding it. */
1212
+ changeSetId: string;
1213
+ /** ISO 8601. */
1214
+ blockTime: string;
1215
+ }
1216
+
1102
1217
  /**
1103
1218
  * Which ways of changing a Blueprint's Content the workspace offers (ADR
1104
1219
  * 0022, CONTEXT.md Editing Mode): Direct Edits only, Change Sets only, or
@@ -1112,6 +1227,12 @@ declare interface EditingSettings {
1112
1227
  editingMode: EditingMode;
1113
1228
  /** Whether opening a Direct Edit sets an Editing Block on its Content. */
1114
1229
  editingBlock: boolean;
1230
+ /**
1231
+ * The Force Group: who may force an Editing Block (ADR 0022). The
1232
+ * workspace's admins always may; these are the people beside them, by
1233
+ * odon user id, sorted. Empty is the admins alone.
1234
+ */
1235
+ forceGroup: string[];
1115
1236
  }
1116
1237
 
1117
1238
  /** The editing settings in effect for one Blueprint, and which its override decides. */
@@ -1119,6 +1240,13 @@ declare interface EffectiveEditingSettings {
1119
1240
  effective: EditingSettings;
1120
1241
  editingModeOverridden: boolean;
1121
1242
  editingBlockOverridden: boolean;
1243
+ forceGroupOverridden: boolean;
1244
+ /**
1245
+ * Whether the caller is in the effective Force Group: an admin, or named
1246
+ * by it. It is how a screen knows to offer Force (#269); the service
1247
+ * asks the same when it is used.
1248
+ */
1249
+ callerInForceGroup: boolean;
1122
1250
  }
1123
1251
 
1124
1252
  /** One field that differs between two Revisions. */
@@ -1147,6 +1275,12 @@ declare interface GapReferrer {
1147
1275
  releaseId: string;
1148
1276
  }
1149
1277
 
1278
+ /** A later wording a Direct Edit's change may carry into (#270). */
1279
+ declare interface LaterWording {
1280
+ releaseId: string;
1281
+ validityPeriod?: ValidityPeriod;
1282
+ }
1283
+
1150
1284
  /** One field a merge resolution must decide, with each side's value. */
1151
1285
  declare interface MergeField {
1152
1286
  /** "/" and the field's accessor, as a Violation spells it. */
@@ -1552,6 +1686,8 @@ export declare interface StubContent {
1552
1686
  assigneeIds?: string[];
1553
1687
  /** Its Block; absent while it is not blocked. */
1554
1688
  block?: ContentBlock;
1689
+ /** Its Editing Block; absent while no open Direct Edit holds one. */
1690
+ editingBlock?: EditingBlock;
1555
1691
  /** When it was archived, ISO 8601; absent while it is not Archived. */
1556
1692
  archiveTime?: string;
1557
1693
  /** Its Main head; absent while it was born in an open Change Set. */
@@ -1629,6 +1765,13 @@ export declare interface StubContenthubClientOptions {
1629
1765
  * derive (moved_head, the dependencies', outstanding_check).
1630
1766
  */
1631
1767
  publishBlockers?: Record<string, PublishBlocker[]>;
1768
+ /**
1769
+ * The Branches behind their base, by id, as a Change Set published past
1770
+ * them leaves them (#268): `validatePublish` and `publish` report
1771
+ * behind_base for each until `updateFromMain` merges it or a resolution
1772
+ * of its Pending Merge does. An aborted merge leaves it behind.
1773
+ */
1774
+ behind?: string[];
1632
1775
  /** The Pending Merges `updateFromMain` leaves, by Change Set id; none by default. */
1633
1776
  pendingMerges?: Record<string, PendingMergeRef[]>;
1634
1777
  /**
@@ -1673,9 +1816,12 @@ export declare interface StubContenthubClientOptions {
1673
1816
  now?: () => string;
1674
1817
  /**
1675
1818
  * The workspace's own editing settings; "Change Sets only" without an
1676
- * Editing Block by default, as for a workspace that never set them.
1819
+ * Editing Block by default, as for a workspace that never set them. A
1820
+ * Force Group left out is the admins alone.
1677
1821
  */
1678
- editingSettings?: EditingSettings;
1822
+ editingSettings?: Omit<EditingSettings, "forceGroup"> & {
1823
+ forceGroup?: string[];
1824
+ };
1679
1825
  /** The per-Blueprint overrides of the editing settings; none by default. */
1680
1826
  editingOverrides?: StubEditingOverride[];
1681
1827
  }
@@ -1693,6 +1839,8 @@ export declare interface StubEditingOverride {
1693
1839
  blueprintAccessor: string;
1694
1840
  editingMode: EditingMode | null;
1695
1841
  editingBlock: boolean | null;
1842
+ /** The people beside the admins; null follows the workspace's. Absent is null. */
1843
+ forceGroup?: string[] | null;
1696
1844
  }
1697
1845
 
1698
1846
  /** One head of a Content: its Revision, data and when it was written. */