@knkcs/contenthub-ui 0.1.0 → 0.2.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
@@ -36,14 +36,22 @@ declare interface BlueprintReleaseInfo {
36
36
  name: string;
37
37
  /** ISO 8601: when it was cut. */
38
38
  releaseTime: string;
39
+ /**
40
+ * Why contenthub refuses to pin it, as `CheckBlueprintRelease` answers;
41
+ * empty or absent when Content can pin it. A Release is offered either
42
+ * way, a refused one disabled with its reasons, so a Blueprint author sees
43
+ * why it can't be used rather than where it went.
44
+ */
45
+ refusals?: RefusalReason[];
39
46
  }
40
47
 
41
48
  /**
42
- * The port a host fills with blueprinthub (ADR 0020): the workspace's
43
- * content Blueprints and their Releases, for New Content and the Library's
44
- * Blueprint filter. contenthub-ui depends on no blueprinthub package. A host
45
- * without blueprinthub leaves the port empty: the Library then names
46
- * Blueprints by id, offers no Blueprint filter and cannot create Content.
49
+ * The workspace's content Blueprints and their Releases, for New Content and
50
+ * the Library's Blueprint filter. contenthub serves them itself
51
+ * (`BlueprintCatalogService`, #238): blueprinthub is its direct dependency,
52
+ * not a port a host fills (ADR 0020 as amended), so every screen builds this
53
+ * from its `ContenthubClient` unless a host passes its own, which only tests
54
+ * need.
47
55
  */
48
56
  declare interface BlueprintSource {
49
57
  /**
@@ -634,6 +642,24 @@ declare interface ContenthubClient {
634
642
  pageSize?: number;
635
643
  pageToken?: string;
636
644
  }): Promise<ContentList>;
645
+ /**
646
+ * A page of the workspace's content Blueprints Content can be made from:
647
+ * not archived, with at least one Release, whose accessor or name holds
648
+ * `query`. contenthub asks blueprinthub as the caller (#238). Rejects
649
+ * with `ServiceUnavailableError` while blueprinthub gives no answer.
650
+ */
651
+ searchBlueprints(input: {
652
+ query: string;
653
+ pageToken?: string;
654
+ signal?: AbortSignal;
655
+ }): Promise<BlueprintPage>;
656
+ /**
657
+ * Every Release of a Blueprint, newest first, each with contenthub's
658
+ * answer: `refusals` is empty when Content can pin it. Empty for a
659
+ * Blueprint the workspace doesn't have. Rejects with
660
+ * `ServiceUnavailableError` while blueprinthub gives no answer.
661
+ */
662
+ listBlueprintReleases(blueprintId: string): Promise<BlueprintReleaseInfo[]>;
637
663
  /**
638
664
  * Creates a Content in an open Change Set, pinning a Blueprint Release,
639
665
  * with empty data: its one Chain has one Branch, opened in the Branch
@@ -1152,6 +1178,16 @@ declare interface ReferrerList {
1152
1178
  nextPageToken: string;
1153
1179
  }
1154
1180
 
1181
+ /** One reason contenthub refused a write, as the rule's owner gave it. */
1182
+ declare interface RefusalReason {
1183
+ /** Whose rule: "fieldkit", "knkeditor", "format" or "contenthub". */
1184
+ source: string;
1185
+ /** The rule's own code, such as fieldkit's "required". */
1186
+ code: string;
1187
+ /** A /-separated location, such as "/title"; "" for the whole. */
1188
+ path: string;
1189
+ }
1190
+
1155
1191
  /** A Release a Publish cut, or would cut. */
1156
1192
  declare interface Release {
1157
1193
  id: string;
@@ -1303,8 +1339,9 @@ export declare function stubBlockReasons(): BlockReason[];
1303
1339
  export declare function stubBlueprintReleases(): BlueprintReleaseInfo[];
1304
1340
 
1305
1341
  /**
1306
- * The workspace's content Blueprints, as the `BlueprintSource` port answers,
1307
- * by name. Commentary has had no Release cut yet.
1342
+ * The workspace's content Blueprints, as a `BlueprintSource` answers, by
1343
+ * name. Commentary has had no Release cut yet, so contenthub's catalog
1344
+ * (the stub client's `searchBlueprints`) leaves it out.
1308
1345
  */
1309
1346
  export declare function stubBlueprints(): BlueprintInfo[];
1310
1347
 
@@ -1397,13 +1434,17 @@ export declare interface StubContenthubClientOptions {
1397
1434
  /** The workspace's Content, every way it can be read; the fixtures' by default. */
1398
1435
  contents?: StubContent[];
1399
1436
  /**
1400
- * The Blueprint Releases contenthub can load, which `createContent`
1401
- * accepts; the fixtures' by default.
1437
+ * The workspace's content Blueprints Content can be made from, as
1438
+ * `searchBlueprints` lists them; the fixtures' by default.
1402
1439
  */
1403
- blueprintReleases?: {
1404
- id: string;
1405
- blueprintId: string;
1406
- }[];
1440
+ blueprints?: BlueprintInfo[];
1441
+ /**
1442
+ * The Blueprint Releases, newest first per Blueprint, as
1443
+ * `listBlueprintReleases` lists them; the fixtures' by default.
1444
+ * `createContent` pins one without `refusals` and refuses the rest, as
1445
+ * contenthub refuses a Release it can't load.
1446
+ */
1447
+ blueprintReleases?: (Pick<BlueprintReleaseInfo, "id" | "blueprintId"> & Partial<BlueprintReleaseInfo>)[];
1407
1448
  /** The Resolved Releases `getContent` answers with, by Blueprint Release id; the fixtures' by default. */
1408
1449
  resolvedReleases?: Record<string, ResolvedBlueprintRelease>;
1409
1450
  /**