@relyio/sdk 0.12.0 → 0.14.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/dist/{chunk-3DRDHXLY.js → chunk-5UMY6CS4.js} +435 -23
  3. package/dist/{chunk-FRJEUAAF.js → chunk-DBBZVZOS.js} +968 -2670
  4. package/dist/{chunk-DXCVO6M5.cjs → chunk-GUPV2M3X.cjs} +969 -2680
  5. package/dist/{chunk-POEEDYFM.js → chunk-PCFTJLEP.js} +543 -260
  6. package/dist/{chunk-FI5VIF4M.cjs → chunk-RSHMA4KT.cjs} +442 -22
  7. package/dist/{chunk-3MSFWXQL.cjs → chunk-X4KSS7PP.cjs} +542 -260
  8. package/dist/client/index.cjs +3 -3
  9. package/dist/client/index.d.cts +4 -5
  10. package/dist/client/index.d.ts +4 -5
  11. package/dist/client/index.js +1 -1
  12. package/dist/{include-paths-CL4gHv6I.d.cts → define-content-type-BUZeWtpk.d.cts} +4458 -1312
  13. package/dist/{include-paths-CrJNTsMl.d.ts → define-content-type-DOrZb_a_.d.ts} +4458 -1312
  14. package/dist/define-schema-5aHmsA8j.d.ts +699 -0
  15. package/dist/define-schema-nCfZeboB.d.cts +699 -0
  16. package/dist/index-B97ZDj44.d.ts +507 -0
  17. package/dist/index-C-pcllqY.d.cts +507 -0
  18. package/dist/index-DOhFQbv7.d.ts +3065 -0
  19. package/dist/index-DgVV5Nj7.d.cts +3065 -0
  20. package/dist/index.cjs +114 -147
  21. package/dist/index.d.cts +49 -87
  22. package/dist/index.d.ts +49 -87
  23. package/dist/index.js +5 -29
  24. package/dist/markdown/index.cjs +13750 -0
  25. package/dist/markdown/index.d.cts +111 -0
  26. package/dist/markdown/index.d.ts +111 -0
  27. package/dist/markdown/index.js +13742 -0
  28. package/dist/rich-text/index.cjs +26 -6
  29. package/dist/rich-text/index.d.cts +3 -148
  30. package/dist/rich-text/index.d.ts +3 -148
  31. package/dist/rich-text/index.js +1 -1
  32. package/dist/rich-text.d-BWc-5gX1.d.cts +326 -0
  33. package/dist/rich-text.d-BWc-5gX1.d.ts +326 -0
  34. package/dist/schema/index.cjs +33 -37
  35. package/dist/schema/index.d.cts +37 -191
  36. package/dist/schema/index.d.ts +37 -191
  37. package/dist/schema/index.js +1 -1
  38. package/dist/types/index.d.cts +2 -3
  39. package/dist/types/index.d.ts +2 -3
  40. package/package.json +14 -3
  41. package/dist/define-schema-DgctHlI2.d.cts +0 -1034
  42. package/dist/define-schema-mrEZbY1h.d.ts +0 -1034
  43. package/dist/index-B9RfZVF1.d.ts +0 -861
  44. package/dist/index-BrvEg6-A.d.cts +0 -3729
  45. package/dist/index-Pw0onkJe.d.ts +0 -3729
  46. package/dist/index-b-AkfTUv.d.cts +0 -861
  47. package/dist/rich-text.d-rKmpgdGd.d.cts +0 -200
  48. package/dist/rich-text.d-rKmpgdGd.d.ts +0 -200
@@ -0,0 +1,111 @@
1
+ import { R as RichTextFieldBlockType, a as RichTextFieldBlock, b as RichTextValue, c as RichTextShapeValue, d as RichTextEntryLinkMark, A as AnyRichTextEntryLink } from '../rich-text.d-BWc-5gX1.cjs';
2
+
3
+ /**
4
+ * RelyIO Markdown — or any CommonMark with GitHub's tables, task lists and strikethrough — as the
5
+ * rich-text tree (REL-1809): the one parser behind the SDK's import, the Studio's paste and the
6
+ * built-in agents' writes.
7
+ *
8
+ * Markdown is read by micromark with the GFM and directive extensions, and the mdast tree it builds
9
+ * is walked into the tree. Nothing is dropped without a word: what the tree cannot hold — HTML, an
10
+ * image, a footnote, a link's title, a list mixing tasks and plain items, a label on a declared node
11
+ * — is **unplaced**, named with its line, its column and its source. {@link richTextFromMarkdown}
12
+ * refuses Markdown holding any; {@link readRichTextMarkdown} returns them beside the tree it read
13
+ * with each one's nearest reading in place — the source text itself, where nothing nearer exists —
14
+ * which is what a paste keeps.
15
+ *
16
+ * The parser reads no schema: a directive of a name the tree does not use is a declared node of
17
+ * that `_type`, and whether the field declares it is the write's to say, as for any tree.
18
+ */
19
+
20
+ /** The tree a Markdown document reads as: its declared nodes of any `_type`, its links to entries. */
21
+ type MarkdownTree = RichTextValue<RichTextShapeValue, RichTextShapeValue, RichTextEntryLinkMark>;
22
+ /** Something the tree cannot hold, where it stands in the Markdown and what it says there. */
23
+ interface UnplacedMarkdown {
24
+ /** What it is, as a reader would say it: `HTML`, `an image`, `a link's title`. */
25
+ readonly construct: string;
26
+ /** 1-based. */
27
+ readonly line: number;
28
+ /** 1-based. */
29
+ readonly column: number;
30
+ /** Its Markdown, as written. */
31
+ readonly source: string;
32
+ }
33
+ interface RichTextMarkdownReadOptions {
34
+ /**
35
+ * Makes each node's key, given the keys taken so far: a first-party caller passes
36
+ * `@relyio/schema`'s `mintItemKey`. The default makes keys of the same form.
37
+ */
38
+ readonly mint?: (taken: ReadonlySet<string>) => string;
39
+ /**
40
+ * Whether an entry link may name an entry a create batch has not made yet by its alias, written
41
+ * as the batch writes one anywhere — `{ "$alias": "jane" }` — in the directive's JSON form:
42
+ * `:entryLink[Jane]{to:='{"$alias":"jane"}'}` (REL-2112). The link keeps that object as its `to`
43
+ * for the batch to replace with the entry's uid before anything is written; nothing else takes a
44
+ * tree holding one. Off by default: an import or a paste names entries by uid.
45
+ */
46
+ readonly entryLinkAliases?: boolean;
47
+ }
48
+ /** A reading: the tree, and what it could not place — each in the tree as its nearest reading. */
49
+ interface RichTextMarkdownRead<V> {
50
+ readonly value: V;
51
+ readonly unplaced: readonly UnplacedMarkdown[];
52
+ }
53
+ /** Markdown holding what the tree cannot, refused: each unplaced construct, named. */
54
+ declare class RichTextMarkdownImportError extends Error {
55
+ readonly unplaced: readonly UnplacedMarkdown[];
56
+ constructor(unplaced: readonly UnplacedMarkdown[]);
57
+ }
58
+ /**
59
+ * Markdown as the rich-text tree, every node keyed.
60
+ *
61
+ * @throws {RichTextMarkdownImportError} when the Markdown holds anything the tree cannot, naming
62
+ * each — nothing is dropped.
63
+ */
64
+ declare function richTextFromMarkdown(markdown: string, options?: RichTextMarkdownReadOptions): MarkdownTree;
65
+ /** Markdown as the rich-text tree, and what it could not place, each in the tree as its nearest reading. */
66
+ declare function readRichTextMarkdown(markdown: string, options?: RichTextMarkdownReadOptions): RichTextMarkdownRead<MarkdownTree>;
67
+ /**
68
+ * Markdown holding exactly one `table` or `code` field's value (REL-1806): a table — GitHub's or
69
+ * `:::table` — or a code group, `:::codeGroup` or one fenced block, which is a group of one tab.
70
+ *
71
+ * @throws {RichTextMarkdownImportError} when it holds anything else, or anything the tree cannot.
72
+ */
73
+ declare function richTextFieldBlockFromMarkdown<T extends RichTextFieldBlockType>(markdown: string, type: T, options?: RichTextMarkdownReadOptions): RichTextFieldBlock<T>;
74
+ /** {@link richTextFieldBlockFromMarkdown}'s reading, `null` when the Markdown is not exactly one. */
75
+ declare function readRichTextFieldBlockMarkdown<T extends RichTextFieldBlockType>(markdown: string, type: T, options?: RichTextMarkdownReadOptions): RichTextMarkdownRead<RichTextFieldBlock<T> | null>;
76
+
77
+ /**
78
+ * The rich-text tree as RelyIO Markdown (REL-1809): the form that reads back as the same tree, keys
79
+ * aside. CommonMark, GitHub's tables, task lists and strikethrough, and directives for what neither
80
+ * has — the syntax is `devtools/docs/guide/schema/field-types/rich-text-markdown.md`'s.
81
+ *
82
+ * The tree is turned into an mdast tree and written by `mdast-util-to-markdown` with the GFM and
83
+ * directive extensions: its escaping is written as the inverse of the micromark parser this
84
+ * package reads with, so a character that would read back as syntax is escaped by the same grammar
85
+ * that would have read it. Three handlers are this package's own, each for a place the library would
86
+ * lose something: a run's line ending (written as a reference, so it is not a soft break), a line
87
+ * break where a line ending cannot stand (`:lineBreak{}`), and a code block's attributes.
88
+ *
89
+ * What the tree holds that RelyIO Markdown cannot name is refused, naming where — never dropped: a
90
+ * declared node whose `_type` is no directive name, a mark this version does not know.
91
+ */
92
+
93
+ /** A tree, with whatever its field declares: what {@link richTextToRelyIOMarkdown} writes. */
94
+ type RichTextMarkdownValue = RichTextValue<RichTextShapeValue, RichTextShapeValue, AnyRichTextEntryLink> | RichTextFieldBlock;
95
+ /** A value RelyIO Markdown cannot say, named by where it stands in the tree. */
96
+ declare class RichTextMarkdownExportError extends Error {
97
+ readonly at: string;
98
+ readonly problem: string;
99
+ constructor(at: string, problem: string);
100
+ }
101
+ /**
102
+ * A rich-text tree — or a `table` or `code` field's value, the one built-in it is — as RelyIO
103
+ * Markdown, ending in a newline; `''` for an empty tree. `richTextFromMarkdown` reads it back as the
104
+ * same tree, keys aside. A read whose include paths expanded an entry link or a declared node's
105
+ * reference is written with the entry's id, as the value is stored.
106
+ *
107
+ * @throws {RichTextMarkdownExportError} naming a node RelyIO Markdown cannot say.
108
+ */
109
+ declare function richTextToRelyIOMarkdown(value: RichTextMarkdownValue): string;
110
+
111
+ export { type MarkdownTree, RichTextMarkdownExportError, RichTextMarkdownImportError, type RichTextMarkdownRead, type RichTextMarkdownReadOptions, type RichTextMarkdownValue, type UnplacedMarkdown, readRichTextFieldBlockMarkdown, readRichTextMarkdown, richTextFieldBlockFromMarkdown, richTextFromMarkdown, richTextToRelyIOMarkdown };
@@ -0,0 +1,111 @@
1
+ import { R as RichTextFieldBlockType, a as RichTextFieldBlock, b as RichTextValue, c as RichTextShapeValue, d as RichTextEntryLinkMark, A as AnyRichTextEntryLink } from '../rich-text.d-BWc-5gX1.js';
2
+
3
+ /**
4
+ * RelyIO Markdown — or any CommonMark with GitHub's tables, task lists and strikethrough — as the
5
+ * rich-text tree (REL-1809): the one parser behind the SDK's import, the Studio's paste and the
6
+ * built-in agents' writes.
7
+ *
8
+ * Markdown is read by micromark with the GFM and directive extensions, and the mdast tree it builds
9
+ * is walked into the tree. Nothing is dropped without a word: what the tree cannot hold — HTML, an
10
+ * image, a footnote, a link's title, a list mixing tasks and plain items, a label on a declared node
11
+ * — is **unplaced**, named with its line, its column and its source. {@link richTextFromMarkdown}
12
+ * refuses Markdown holding any; {@link readRichTextMarkdown} returns them beside the tree it read
13
+ * with each one's nearest reading in place — the source text itself, where nothing nearer exists —
14
+ * which is what a paste keeps.
15
+ *
16
+ * The parser reads no schema: a directive of a name the tree does not use is a declared node of
17
+ * that `_type`, and whether the field declares it is the write's to say, as for any tree.
18
+ */
19
+
20
+ /** The tree a Markdown document reads as: its declared nodes of any `_type`, its links to entries. */
21
+ type MarkdownTree = RichTextValue<RichTextShapeValue, RichTextShapeValue, RichTextEntryLinkMark>;
22
+ /** Something the tree cannot hold, where it stands in the Markdown and what it says there. */
23
+ interface UnplacedMarkdown {
24
+ /** What it is, as a reader would say it: `HTML`, `an image`, `a link's title`. */
25
+ readonly construct: string;
26
+ /** 1-based. */
27
+ readonly line: number;
28
+ /** 1-based. */
29
+ readonly column: number;
30
+ /** Its Markdown, as written. */
31
+ readonly source: string;
32
+ }
33
+ interface RichTextMarkdownReadOptions {
34
+ /**
35
+ * Makes each node's key, given the keys taken so far: a first-party caller passes
36
+ * `@relyio/schema`'s `mintItemKey`. The default makes keys of the same form.
37
+ */
38
+ readonly mint?: (taken: ReadonlySet<string>) => string;
39
+ /**
40
+ * Whether an entry link may name an entry a create batch has not made yet by its alias, written
41
+ * as the batch writes one anywhere — `{ "$alias": "jane" }` — in the directive's JSON form:
42
+ * `:entryLink[Jane]{to:='{"$alias":"jane"}'}` (REL-2112). The link keeps that object as its `to`
43
+ * for the batch to replace with the entry's uid before anything is written; nothing else takes a
44
+ * tree holding one. Off by default: an import or a paste names entries by uid.
45
+ */
46
+ readonly entryLinkAliases?: boolean;
47
+ }
48
+ /** A reading: the tree, and what it could not place — each in the tree as its nearest reading. */
49
+ interface RichTextMarkdownRead<V> {
50
+ readonly value: V;
51
+ readonly unplaced: readonly UnplacedMarkdown[];
52
+ }
53
+ /** Markdown holding what the tree cannot, refused: each unplaced construct, named. */
54
+ declare class RichTextMarkdownImportError extends Error {
55
+ readonly unplaced: readonly UnplacedMarkdown[];
56
+ constructor(unplaced: readonly UnplacedMarkdown[]);
57
+ }
58
+ /**
59
+ * Markdown as the rich-text tree, every node keyed.
60
+ *
61
+ * @throws {RichTextMarkdownImportError} when the Markdown holds anything the tree cannot, naming
62
+ * each — nothing is dropped.
63
+ */
64
+ declare function richTextFromMarkdown(markdown: string, options?: RichTextMarkdownReadOptions): MarkdownTree;
65
+ /** Markdown as the rich-text tree, and what it could not place, each in the tree as its nearest reading. */
66
+ declare function readRichTextMarkdown(markdown: string, options?: RichTextMarkdownReadOptions): RichTextMarkdownRead<MarkdownTree>;
67
+ /**
68
+ * Markdown holding exactly one `table` or `code` field's value (REL-1806): a table — GitHub's or
69
+ * `:::table` — or a code group, `:::codeGroup` or one fenced block, which is a group of one tab.
70
+ *
71
+ * @throws {RichTextMarkdownImportError} when it holds anything else, or anything the tree cannot.
72
+ */
73
+ declare function richTextFieldBlockFromMarkdown<T extends RichTextFieldBlockType>(markdown: string, type: T, options?: RichTextMarkdownReadOptions): RichTextFieldBlock<T>;
74
+ /** {@link richTextFieldBlockFromMarkdown}'s reading, `null` when the Markdown is not exactly one. */
75
+ declare function readRichTextFieldBlockMarkdown<T extends RichTextFieldBlockType>(markdown: string, type: T, options?: RichTextMarkdownReadOptions): RichTextMarkdownRead<RichTextFieldBlock<T> | null>;
76
+
77
+ /**
78
+ * The rich-text tree as RelyIO Markdown (REL-1809): the form that reads back as the same tree, keys
79
+ * aside. CommonMark, GitHub's tables, task lists and strikethrough, and directives for what neither
80
+ * has — the syntax is `devtools/docs/guide/schema/field-types/rich-text-markdown.md`'s.
81
+ *
82
+ * The tree is turned into an mdast tree and written by `mdast-util-to-markdown` with the GFM and
83
+ * directive extensions: its escaping is written as the inverse of the micromark parser this
84
+ * package reads with, so a character that would read back as syntax is escaped by the same grammar
85
+ * that would have read it. Three handlers are this package's own, each for a place the library would
86
+ * lose something: a run's line ending (written as a reference, so it is not a soft break), a line
87
+ * break where a line ending cannot stand (`:lineBreak{}`), and a code block's attributes.
88
+ *
89
+ * What the tree holds that RelyIO Markdown cannot name is refused, naming where — never dropped: a
90
+ * declared node whose `_type` is no directive name, a mark this version does not know.
91
+ */
92
+
93
+ /** A tree, with whatever its field declares: what {@link richTextToRelyIOMarkdown} writes. */
94
+ type RichTextMarkdownValue = RichTextValue<RichTextShapeValue, RichTextShapeValue, AnyRichTextEntryLink> | RichTextFieldBlock;
95
+ /** A value RelyIO Markdown cannot say, named by where it stands in the tree. */
96
+ declare class RichTextMarkdownExportError extends Error {
97
+ readonly at: string;
98
+ readonly problem: string;
99
+ constructor(at: string, problem: string);
100
+ }
101
+ /**
102
+ * A rich-text tree — or a `table` or `code` field's value, the one built-in it is — as RelyIO
103
+ * Markdown, ending in a newline; `''` for an empty tree. `richTextFromMarkdown` reads it back as the
104
+ * same tree, keys aside. A read whose include paths expanded an entry link or a declared node's
105
+ * reference is written with the entry's id, as the value is stored.
106
+ *
107
+ * @throws {RichTextMarkdownExportError} naming a node RelyIO Markdown cannot say.
108
+ */
109
+ declare function richTextToRelyIOMarkdown(value: RichTextMarkdownValue): string;
110
+
111
+ export { type MarkdownTree, RichTextMarkdownExportError, RichTextMarkdownImportError, type RichTextMarkdownRead, type RichTextMarkdownReadOptions, type RichTextMarkdownValue, type UnplacedMarkdown, readRichTextFieldBlockMarkdown, readRichTextMarkdown, richTextFieldBlockFromMarkdown, richTextFromMarkdown, richTextToRelyIOMarkdown };