@atelic-action/artifact 7.0.1 → 7.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atelic-action/artifact",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "description": "The composed documents the Atelic practice hands or sends a business (the read, the monthly page, the note, the discovery sheet, the first call sheet, and the sealed document), built from the pieces in @atelic-action/ui",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -446,19 +446,28 @@ function Speed({ block }: { block: ReadSpeed }) {
446
446
  );
447
447
  }
448
448
 
449
- /** A string or runs of text and links, the shape JSON content arrives in; a node of elements is anything else. */
450
- export function isRuns(value: unknown): value is ArtifactParagraph {
451
- if (typeof value === "string") return true;
449
+ /**
450
+ * One run of a paragraph: a string, a link `{ text, href }`, or a search query
451
+ * `{ query, href? }`. The query run is ui's from 7.1.0 and is read here by its
452
+ * shape alone, so the ui range this package peers on does not have to move.
453
+ */
454
+ function isRun(run: unknown): boolean {
455
+ if (typeof run === "string") return true;
456
+ if (typeof run !== "object" || run === null) return false;
457
+ if ("text" in run && "href" in run) return true;
452
458
  return (
453
- Array.isArray(value) &&
454
- value.every(
455
- (run) =>
456
- typeof run === "string" ||
457
- (typeof run === "object" && run !== null && "text" in run && "href" in run),
458
- )
459
+ "query" in run &&
460
+ typeof run.query === "string" &&
461
+ (!("href" in run) || run.href === undefined || typeof run.href === "string")
459
462
  );
460
463
  }
461
464
 
465
+ /** A string or runs of text, links, and queries, the shape JSON content arrives in; a node of elements is anything else. */
466
+ export function isRuns(value: unknown): value is ArtifactParagraph {
467
+ if (typeof value === "string") return true;
468
+ return Array.isArray(value) && value.every(isRun);
469
+ }
470
+
462
471
  /** A finding's body as a node, whichever way the content wrote it. */
463
472
  function bodyNode(body: ReactNode | ArtifactParagraph | undefined): ReactNode {
464
473
  if (body === undefined || body === null) return undefined;