@seed-hypermedia/client 0.0.89 → 0.0.91
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/auto-link.mjs +3 -3
- package/dist/blocks-to-markdown.mjs +2 -2
- package/dist/capability.mjs +2 -2
- package/dist/{chunk-GIO2JLKT.mjs → chunk-2X45222K.mjs} +34 -1
- package/dist/{chunk-7QKG43UV.mjs → chunk-5H44WPFO.mjs} +1 -1
- package/dist/{chunk-IW5GLPEG.mjs → chunk-5ZHBEPRC.mjs} +1 -1
- package/dist/{chunk-BMPK76B2.mjs → chunk-6FBJVBS6.mjs} +3 -3
- package/dist/{chunk-J45O2Y7E.mjs → chunk-EBGUVS7T.mjs} +2 -2
- package/dist/{chunk-ZVJGJE2L.mjs → chunk-GOKN5MFV.mjs} +1 -1
- package/dist/{chunk-I273FRIR.mjs → chunk-HMTFZNX7.mjs} +1 -1
- package/dist/{chunk-OOSTK7CM.mjs → chunk-IS7QPOMQ.mjs} +3 -3
- package/dist/chunk-JSNDXUPG.mjs +407 -0
- package/dist/{chunk-GN76IN3M.mjs → chunk-LZOORGGJ.mjs} +1 -1
- package/dist/{chunk-STKAE4YB.mjs → chunk-OIL62HNH.mjs} +1 -1
- package/dist/{chunk-7OWFPOHI.mjs → chunk-P5R4E4AU.mjs} +1 -1
- package/dist/{chunk-XB6E7EVC.mjs → chunk-QVRJGK77.mjs} +1 -1
- package/dist/{chunk-W3MTG26Q.mjs → chunk-RPXAWYOC.mjs} +4 -1
- package/dist/chunk-TZMLZHCZ.mjs +230 -0
- package/dist/{chunk-DVJ3XGXS.mjs → chunk-UQL3R7WC.mjs} +1 -1
- package/dist/chunk-VWSAFDOL.mjs +110 -0
- package/dist/chunk-ZWKMAGDU.mjs +10 -0
- package/dist/client.mjs +2 -2
- package/dist/comment.mjs +2 -2
- package/dist/dag-json.d.ts +52 -0
- package/dist/dag-json.mjs +23 -0
- package/dist/document-state.mjs +2 -2
- package/dist/editorblock-to-hmblock.mjs +2 -2
- package/dist/hm-resolver.mjs +2 -2
- package/dist/hm-types.d.ts +2031 -49
- package/dist/hm-types.mjs +9 -1
- package/dist/hmblock-to-editorblock.mjs +2 -2
- package/dist/index.mjs +27 -27
- package/dist/markdown-to-blocks.mjs +1 -1
- package/dist/pdf-to-blocks.mjs +3 -3
- package/dist/resource-read.mjs +4 -4
- package/dist/schema-engine.d.ts +127 -0
- package/dist/schema-engine.mjs +83 -0
- package/dist/schema-registry.generated.d.ts +8 -0
- package/dist/schema-registry.generated.mjs +11 -0
- package/dist/schema-resolve.d.ts +135 -0
- package/dist/schema-resolve.mjs +45 -0
- package/dist/schema-subtypes.d.ts +36 -0
- package/dist/schema-subtypes.mjs +94 -0
- package/dist/schema-types.generated.d.ts +1598 -0
- package/dist/schema-types.generated.mjs +0 -0
- package/dist/signed-blob.d.ts +63 -0
- package/dist/signed-blob.mjs +123 -0
- package/dist/tei-to-blocks.mjs +2 -2
- package/dist/unicode.mjs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1598 @@
|
|
|
1
|
+
/** A dag-json IPLD link: { '/': <cid> }. */
|
|
2
|
+
export type HMLink = {
|
|
3
|
+
'/': string;
|
|
4
|
+
};
|
|
5
|
+
/** Binary data: decoded bytes, or the dag-json envelope form. */
|
|
6
|
+
export type HMBytes = Uint8Array | {
|
|
7
|
+
'/': {
|
|
8
|
+
bytes: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Account
|
|
13
|
+
* A reference to an account, held as the bare `hm://<principal>` URL, with `format: hm-profile` so editors offer an account search and accept a pasted principal.
|
|
14
|
+
* A reference to an account (a space) as its bare `hm://<principal>` URL — rendered as a searchable account pill; a pasted principal is normalised to the URL.
|
|
15
|
+
* Schema: hm://hyper.media/account
|
|
16
|
+
*/
|
|
17
|
+
export type HMAccount = string;
|
|
18
|
+
/**
|
|
19
|
+
* Blob
|
|
20
|
+
* The signed envelope every Hypermedia blob extends, with a type tag, the signer's public key, an Ed25519 signature over the canonical CBOR with the signature zeroed, and a millisecond timestamp.
|
|
21
|
+
* The signed envelope every Hypermedia blob extends: a type tag, the signer's key, a signature and a millisecond timestamp.
|
|
22
|
+
* Schema: hm://hyper.media/blob
|
|
23
|
+
*/
|
|
24
|
+
export type HMBlob = {
|
|
25
|
+
/** Blob type tag the network dispatches on to pick a decoder and rules, such as `Change` or `Ref`. */
|
|
26
|
+
type: string;
|
|
27
|
+
/** Public key of the account or device that signed the blob. */
|
|
28
|
+
signer: HMPrincipal;
|
|
29
|
+
/** Signature over the canonical DAG-CBOR of the blob with `sig` set to 64 zero bytes. */
|
|
30
|
+
sig: HMSignature;
|
|
31
|
+
/** When the signer says the blob was made, in Unix milliseconds; not checked against real time. */
|
|
32
|
+
ts: HMTimestamp;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Any Blob
|
|
36
|
+
* Any Hypermedia CBOR blob: the discriminated union of the six blob types, tagged on the type field.
|
|
37
|
+
* Any Hypermedia CBOR blob — the union of the six blob types, selected by the `type` tag.
|
|
38
|
+
* Schema: hm://hyper.media/blob/any
|
|
39
|
+
*/
|
|
40
|
+
export type HMBlobAny = HMChange<HMBlock> | HMRef | HMProfile | HMComment | HMCapability | HMContact;
|
|
41
|
+
/**
|
|
42
|
+
* Block
|
|
43
|
+
* The open wire block: id and type plus text, link, annotations and any attributes, so a document with a block type you do not know still parses.
|
|
44
|
+
* The open wire block: `id` and `type` plus text, link, annotations and any attributes, so unknown block types still parse.
|
|
45
|
+
* Schema: hm://hyper.media/block
|
|
46
|
+
*/
|
|
47
|
+
export type HMBlock = {
|
|
48
|
+
/** The block's permanent identity inside its document; clients generate an 8-character random id. */
|
|
49
|
+
id: string;
|
|
50
|
+
/** Output only: CID of the last Change that replaced this block, filled in by the daemon when serving. */
|
|
51
|
+
revision?: string;
|
|
52
|
+
/** The block type, such as `Paragraph` or `Image`; any string is accepted. */
|
|
53
|
+
type: string;
|
|
54
|
+
/** The block's plain text, for types that have text; formatting lives in `annotations`. */
|
|
55
|
+
text?: string;
|
|
56
|
+
/** The block's one link: an `hm://`, `ipfs://`, `https://` or `nostr:` URL depending on the type. */
|
|
57
|
+
link?: HMUrl;
|
|
58
|
+
/** Inline formatting, links and mentions over code-point ranges of `text`. */
|
|
59
|
+
annotations?: HMBlockAnnotation[];
|
|
60
|
+
/** Type-specific attributes, nested here by the Seed API and SDK; on the wire they sit at the block's top level. */
|
|
61
|
+
attributes?: {
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
};
|
|
64
|
+
} & {
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Annotation
|
|
69
|
+
* An inline layer over a block's text: a type, one or more code-point ranges, an optional link and inline attributes, used for formatting, links and mentions.
|
|
70
|
+
* An inline layer over a block's text, used for formatting, links and mentions.
|
|
71
|
+
* Schema: hm://hyper.media/block/annotation
|
|
72
|
+
*/
|
|
73
|
+
export type HMBlockAnnotation = {
|
|
74
|
+
/** Annotation kind, such as `Bold`, `Italic`, `Link`, `Embed` or `TextColor`. */
|
|
75
|
+
type?: string;
|
|
76
|
+
/** Target URL for `Link` and `Embed` annotations — an `hm://` or web URL. */
|
|
77
|
+
link?: HMUrl;
|
|
78
|
+
/** Start offset of each covered range, in Unicode code points; parallel to `ends`. */
|
|
79
|
+
starts?: number[];
|
|
80
|
+
/** End offset (exclusive) of each covered range, in Unicode code points; parallel to `starts`. */
|
|
81
|
+
ends?: number[];
|
|
82
|
+
} & {
|
|
83
|
+
[key: string]: HMValue;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Block (Base)
|
|
87
|
+
* The three fields every concrete block type shares: the required id and type, and the daemon-filled revision.
|
|
88
|
+
* The fields every concrete block type shares: `id`, `type` and the daemon-filled `revision`.
|
|
89
|
+
* Schema: hm://hyper.media/block/base
|
|
90
|
+
*/
|
|
91
|
+
export type HMBlockBase = {
|
|
92
|
+
/** The block's permanent identity inside its document. */
|
|
93
|
+
id: string;
|
|
94
|
+
/** Output only: CID of the last Change that modified this block. */
|
|
95
|
+
revision?: string;
|
|
96
|
+
/** Name of the block type, such as `Paragraph` or `Image`. */
|
|
97
|
+
type: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Button Block
|
|
101
|
+
* A call-to-action button: a label, a required link and a horizontal alignment.
|
|
102
|
+
* A call-to-action button block with a label, a required link and an alignment.
|
|
103
|
+
* Schema: hm://hyper.media/block/button
|
|
104
|
+
*/
|
|
105
|
+
export type HMBlockButton = HMBlockBase & {
|
|
106
|
+
type?: 'Button';
|
|
107
|
+
/** Label shown on the button. */
|
|
108
|
+
text?: string;
|
|
109
|
+
/** Where the button goes — an `hm://` or web URL. */
|
|
110
|
+
link: HMUrl;
|
|
111
|
+
/** Button settings and parent-layout attributes. */
|
|
112
|
+
attributes?: {
|
|
113
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
114
|
+
childrenType?: HMBlockChildrenType;
|
|
115
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
116
|
+
columnCount?: number;
|
|
117
|
+
/** Alternative label for the button. */
|
|
118
|
+
name?: string;
|
|
119
|
+
/** Horizontal position of the button in its column. */
|
|
120
|
+
alignment?: HMBlockButtonAlignment;
|
|
121
|
+
} & {
|
|
122
|
+
[key: string]: unknown;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Button Alignment
|
|
127
|
+
* The horizontal alignment of a Button block: flex-start, center or flex-end.
|
|
128
|
+
* Horizontal position of a Button block in its column: `flex-start`, `center` or `flex-end`.
|
|
129
|
+
* Schema: hm://hyper.media/block/button-alignment
|
|
130
|
+
*/
|
|
131
|
+
export type HMBlockButtonAlignment = 'flex-start' | 'center' | 'flex-end';
|
|
132
|
+
/**
|
|
133
|
+
* Children Type
|
|
134
|
+
* How a block lays out its children: Group (the default), Ordered, Unordered, Blockquote or Grid.
|
|
135
|
+
* How a block lays out its children: `Group` (default), `Ordered`, `Unordered`, `Blockquote` or `Grid`.
|
|
136
|
+
* Schema: hm://hyper.media/block/children-type
|
|
137
|
+
*/
|
|
138
|
+
export type HMBlockChildrenType = 'Group' | 'Ordered' | 'Unordered' | 'Blockquote' | 'Grid';
|
|
139
|
+
/**
|
|
140
|
+
* Code Block
|
|
141
|
+
* A block of verbatim text, optionally tagged with a programming language for highlighting.
|
|
142
|
+
* A block of verbatim text, optionally tagged with a language for syntax highlighting.
|
|
143
|
+
* Schema: hm://hyper.media/block/code
|
|
144
|
+
*/
|
|
145
|
+
export type HMBlockCode = HMBlockBase & {
|
|
146
|
+
type?: 'Code';
|
|
147
|
+
/** The code, kept exactly as written. */
|
|
148
|
+
text?: string;
|
|
149
|
+
/** Code settings and parent-layout attributes. */
|
|
150
|
+
attributes?: {
|
|
151
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
152
|
+
childrenType?: HMBlockChildrenType;
|
|
153
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
154
|
+
columnCount?: number;
|
|
155
|
+
/** Programming language used for syntax highlighting. */
|
|
156
|
+
language?: string;
|
|
157
|
+
} & {
|
|
158
|
+
[key: string]: unknown;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Comment Block
|
|
163
|
+
* A block inside a comment body: the open block plus a recursive list of child comment blocks.
|
|
164
|
+
* One block of a comment body — an open block with its child comment blocks carried inline.
|
|
165
|
+
* Schema: hm://hyper.media/block/comment
|
|
166
|
+
*/
|
|
167
|
+
export type HMBlockComment = HMBlock & {
|
|
168
|
+
/** Nested comment blocks under this one, in order. */
|
|
169
|
+
children?: HMBlockComment[];
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Core Block
|
|
173
|
+
* The strict union of the fifteen built-in block types; extend it with your own types by making a larger union that includes it.
|
|
174
|
+
* The union of the fifteen built-in block types; extend it with a larger union for custom blocks.
|
|
175
|
+
* Schema: hm://hyper.media/block/core
|
|
176
|
+
*/
|
|
177
|
+
export type HMBlockCore = HMBlockParagraph | HMBlockHeading | HMBlockCode | HMBlockMath | HMBlockImage | HMBlockVideo | HMBlockFile | HMBlockButton | HMBlockEmbed | HMBlockWebEmbed | HMBlockNostr | HMBlockTable | HMBlockTableRow | HMBlockTableColumn | HMBlockQuery;
|
|
178
|
+
/**
|
|
179
|
+
* Embed Block
|
|
180
|
+
* An embed of another Hypermedia document, block or text range by hm:// link, rendered as content, a card, its comments or a link.
|
|
181
|
+
* An embed of another Hypermedia document, block or text range, shown in place by `hm://` link.
|
|
182
|
+
* Schema: hm://hyper.media/block/embed
|
|
183
|
+
*/
|
|
184
|
+
export type HMBlockEmbed = HMBlockBase & {
|
|
185
|
+
type?: 'Embed';
|
|
186
|
+
/** The embedded resource — an `hm://` URL, optionally pinned to a version, block or text range. */
|
|
187
|
+
link: HMUrl;
|
|
188
|
+
/** Embed settings and parent-layout attributes. */
|
|
189
|
+
attributes?: {
|
|
190
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
191
|
+
childrenType?: HMBlockChildrenType;
|
|
192
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
193
|
+
columnCount?: number;
|
|
194
|
+
/** How the target renders: its content, a card, its comments or a plain link. */
|
|
195
|
+
view?: HMBlockEmbedView;
|
|
196
|
+
} & {
|
|
197
|
+
[key: string]: unknown;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Embed View
|
|
202
|
+
* How an Embed block renders its target: the content itself, a card, its discussion, or a plain link.
|
|
203
|
+
* How an Embed block renders its target: `Content`, `Card`, `Comments` or `Link`.
|
|
204
|
+
* Schema: hm://hyper.media/block/embed-view
|
|
205
|
+
*/
|
|
206
|
+
export type HMBlockEmbedView = 'Content' | 'Card' | 'Comments' | 'Link';
|
|
207
|
+
/**
|
|
208
|
+
* File Block
|
|
209
|
+
* An attachment of any kind, referenced by an ipfs:// link, with its file name and size.
|
|
210
|
+
* An attachment of any kind, referenced by an `ipfs://` link, with its file name and size.
|
|
211
|
+
* Schema: hm://hyper.media/block/file
|
|
212
|
+
*/
|
|
213
|
+
export type HMBlockFile = HMBlockBase & {
|
|
214
|
+
type?: 'File';
|
|
215
|
+
/** The attached file — an `ipfs://<cid>` URL. */
|
|
216
|
+
link: HMUrl;
|
|
217
|
+
/** File details and parent-layout attributes. */
|
|
218
|
+
attributes?: {
|
|
219
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
220
|
+
childrenType?: HMBlockChildrenType;
|
|
221
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
222
|
+
columnCount?: number;
|
|
223
|
+
/** File size in bytes. */
|
|
224
|
+
size?: number;
|
|
225
|
+
/** File name shown to readers. */
|
|
226
|
+
name?: string;
|
|
227
|
+
} & {
|
|
228
|
+
[key: string]: unknown;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Heading Block
|
|
233
|
+
* A section heading whose children are the section; the heading level comes from nesting, not from an attribute.
|
|
234
|
+
* A section heading whose children are the section; its level comes from nesting depth.
|
|
235
|
+
* Schema: hm://hyper.media/block/heading
|
|
236
|
+
*/
|
|
237
|
+
export type HMBlockHeading = HMBlockBase & {
|
|
238
|
+
type?: 'Heading';
|
|
239
|
+
/** The heading text, without markup. */
|
|
240
|
+
text?: string;
|
|
241
|
+
/** Inline formatting, links and mentions over `text`. */
|
|
242
|
+
annotations?: HMBlockAnnotation[];
|
|
243
|
+
/** Parent-layout attributes for the section under the heading. */
|
|
244
|
+
attributes?: {
|
|
245
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
246
|
+
childrenType?: HMBlockChildrenType;
|
|
247
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
248
|
+
columnCount?: number;
|
|
249
|
+
} & {
|
|
250
|
+
[key: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Image Block
|
|
255
|
+
* An image referenced by an ipfs:// link, with a caption in the text field and an optional display width.
|
|
256
|
+
* An image referenced by an `ipfs://` link, with an optional caption and display width.
|
|
257
|
+
* Schema: hm://hyper.media/block/image
|
|
258
|
+
*/
|
|
259
|
+
export type HMBlockImage = HMBlockBase & {
|
|
260
|
+
type?: 'Image';
|
|
261
|
+
/** Caption shown with the image. */
|
|
262
|
+
text?: string;
|
|
263
|
+
/** Inline formatting, links and mentions over the caption. */
|
|
264
|
+
annotations?: HMBlockAnnotation[];
|
|
265
|
+
/** The image file, normally an `ipfs://<cid>` URL. */
|
|
266
|
+
link: HMUrl;
|
|
267
|
+
/** Image settings and parent-layout attributes. */
|
|
268
|
+
attributes?: {
|
|
269
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
270
|
+
childrenType?: HMBlockChildrenType;
|
|
271
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
272
|
+
columnCount?: number;
|
|
273
|
+
/** Display width in pixels. */
|
|
274
|
+
width?: number;
|
|
275
|
+
/** Original file name of the image. */
|
|
276
|
+
name?: string;
|
|
277
|
+
} & {
|
|
278
|
+
[key: string]: unknown;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Math Block
|
|
283
|
+
* A block of LaTeX math, stored as text and rendered with KaTeX.
|
|
284
|
+
* A block of LaTeX math, stored as text and rendered with KaTeX.
|
|
285
|
+
* Schema: hm://hyper.media/block/math
|
|
286
|
+
*/
|
|
287
|
+
export type HMBlockMath = HMBlockBase & {
|
|
288
|
+
type?: 'Math';
|
|
289
|
+
/** The LaTeX source. */
|
|
290
|
+
text?: string;
|
|
291
|
+
/** Parent-layout attributes. */
|
|
292
|
+
attributes?: {
|
|
293
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
294
|
+
childrenType?: HMBlockChildrenType;
|
|
295
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
296
|
+
columnCount?: number;
|
|
297
|
+
} & {
|
|
298
|
+
[key: string]: unknown;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Block Node
|
|
303
|
+
* One node of a content tree: a block plus its ordered child nodes, recursively, which is how documents and comments nest content.
|
|
304
|
+
* One node of a document content tree: a block plus its ordered child nodes, recursively.
|
|
305
|
+
* Schema: hm://hyper.media/block/node
|
|
306
|
+
*/
|
|
307
|
+
export type HMBlockNode = {
|
|
308
|
+
/** The block at this node. */
|
|
309
|
+
block: HMBlock;
|
|
310
|
+
/** Child nodes in display order; omitted on a leaf. */
|
|
311
|
+
children?: HMBlockNode[];
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Nostr Block
|
|
315
|
+
* An embed of a Nostr event by nostr: URL.
|
|
316
|
+
* An embed of a Nostr event by `nostr:` URL.
|
|
317
|
+
* Schema: hm://hyper.media/block/nostr
|
|
318
|
+
*/
|
|
319
|
+
export type HMBlockNostr = HMBlockBase & {
|
|
320
|
+
type?: 'Nostr';
|
|
321
|
+
/** The embedded event — a `nostr:` URL. */
|
|
322
|
+
link: HMUrl;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Paragraph Block
|
|
326
|
+
* The default block: a paragraph of text with inline annotations; inside a table row it is a cell and carries the column id.
|
|
327
|
+
* The default block: a paragraph of rich text, which also serves as a table cell.
|
|
328
|
+
* Schema: hm://hyper.media/block/paragraph
|
|
329
|
+
*/
|
|
330
|
+
export type HMBlockParagraph = HMBlockBase & {
|
|
331
|
+
type?: 'Paragraph';
|
|
332
|
+
/** The paragraph text, without markup. */
|
|
333
|
+
text?: string;
|
|
334
|
+
/** Inline formatting, links and mentions over `text`. */
|
|
335
|
+
annotations?: HMBlockAnnotation[];
|
|
336
|
+
/** Parent-layout attributes and the table column id. */
|
|
337
|
+
attributes?: {
|
|
338
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
339
|
+
childrenType?: HMBlockChildrenType;
|
|
340
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
341
|
+
columnCount?: number;
|
|
342
|
+
/** Id of the TableColumn block this cell belongs to; set only on cells inside a TableRow. */
|
|
343
|
+
columnId?: string;
|
|
344
|
+
} & {
|
|
345
|
+
[key: string]: unknown;
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Query Block
|
|
350
|
+
* A block that embeds a live query: the matching documents render in place as cards, a list or a table.
|
|
351
|
+
* A block that runs a live query and renders the matching documents as cards, a list or a table.
|
|
352
|
+
* Schema: hm://hyper.media/block/query
|
|
353
|
+
*/
|
|
354
|
+
export type HMBlockQuery = HMBlockBase & {
|
|
355
|
+
type?: 'Query';
|
|
356
|
+
/** The stored query and how its results are shown. */
|
|
357
|
+
attributes: {
|
|
358
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
359
|
+
childrenType?: HMBlockChildrenType;
|
|
360
|
+
/** Number of card columns in the `Card` style (default 3). */
|
|
361
|
+
columnCount?: number;
|
|
362
|
+
/** How results are shown: `Card`, `List` or `Table`. */
|
|
363
|
+
style?: HMQueryStyle;
|
|
364
|
+
/** The query to run: spaces and paths to include, sort and limit. */
|
|
365
|
+
query: HMQuery;
|
|
366
|
+
/** Show the first result as a banner. */
|
|
367
|
+
banner?: boolean;
|
|
368
|
+
/** Column settings for the `Table` style. */
|
|
369
|
+
table?: HMQueryTableConfig;
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Table Block
|
|
374
|
+
* The container of a table: its children are TableColumn markers followed by TableRow blocks whose Paragraph cells carry a columnId.
|
|
375
|
+
* The container of a table: TableColumn markers followed by TableRow blocks.
|
|
376
|
+
* Schema: hm://hyper.media/block/table
|
|
377
|
+
*/
|
|
378
|
+
export type HMBlockTable = HMBlockBase & {
|
|
379
|
+
type?: 'Table';
|
|
380
|
+
/** Parent-layout attributes. */
|
|
381
|
+
attributes?: {
|
|
382
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
383
|
+
childrenType?: HMBlockChildrenType;
|
|
384
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
385
|
+
columnCount?: number;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Table Column Block
|
|
390
|
+
* One column of a Table block: a childless marker whose id cells reference and whose sibling order is the display order.
|
|
391
|
+
* One column of a Table block: a childless marker that cells reference by id.
|
|
392
|
+
* Schema: hm://hyper.media/block/table-column
|
|
393
|
+
*/
|
|
394
|
+
export type HMBlockTableColumn = HMBlockBase & {
|
|
395
|
+
type?: 'TableColumn';
|
|
396
|
+
/** Column settings and parent-layout attributes. */
|
|
397
|
+
attributes?: {
|
|
398
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
399
|
+
childrenType?: HMBlockChildrenType;
|
|
400
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
401
|
+
columnCount?: number;
|
|
402
|
+
/** Column width in pixels. · minimum: 0 */
|
|
403
|
+
width?: number;
|
|
404
|
+
/** Marks a header column; honored only on the first column. */
|
|
405
|
+
isHeader?: boolean;
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Table Row Block
|
|
410
|
+
* One row of a Table block: its children are Paragraph cells, each naming its column with a columnId attribute.
|
|
411
|
+
* One row of a Table block, whose children are Paragraph cells naming their column.
|
|
412
|
+
* Schema: hm://hyper.media/block/table-row
|
|
413
|
+
*/
|
|
414
|
+
export type HMBlockTableRow = HMBlockBase & {
|
|
415
|
+
type?: 'TableRow';
|
|
416
|
+
/** Row settings and parent-layout attributes. */
|
|
417
|
+
attributes?: {
|
|
418
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
419
|
+
childrenType?: HMBlockChildrenType;
|
|
420
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
421
|
+
columnCount?: number;
|
|
422
|
+
/** Marks the header row; honored only on the first row. */
|
|
423
|
+
isHeader?: boolean;
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* Video Block
|
|
428
|
+
* A video referenced by an ipfs:// file or a supported web video URL, with playback attributes.
|
|
429
|
+
* A video from an `ipfs://` file or a supported web video URL, with playback settings.
|
|
430
|
+
* Schema: hm://hyper.media/block/video
|
|
431
|
+
*/
|
|
432
|
+
export type HMBlockVideo = HMBlockBase & {
|
|
433
|
+
type?: 'Video';
|
|
434
|
+
/** The video — an `ipfs://<cid>` file or a web video URL such as a YouTube link. */
|
|
435
|
+
link: HMUrl;
|
|
436
|
+
/** Playback settings and parent-layout attributes. */
|
|
437
|
+
attributes?: {
|
|
438
|
+
/** How this block lays out its children — a children type such as `Unordered` or `Grid`. */
|
|
439
|
+
childrenType?: HMBlockChildrenType;
|
|
440
|
+
/** Number of columns the children occupy when `childrenType` is `Grid`. */
|
|
441
|
+
columnCount?: number;
|
|
442
|
+
/** Display width in pixels. */
|
|
443
|
+
width?: number;
|
|
444
|
+
/** Original file name of the video. */
|
|
445
|
+
name?: string;
|
|
446
|
+
/** Start playing automatically. */
|
|
447
|
+
autoplay?: boolean;
|
|
448
|
+
/** Restart playback when the video ends. */
|
|
449
|
+
loop?: boolean;
|
|
450
|
+
/** Play without sound. */
|
|
451
|
+
muted?: boolean;
|
|
452
|
+
} & {
|
|
453
|
+
[key: string]: unknown;
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* Web Embed Block
|
|
458
|
+
* An embed of an external web page or post by https:// URL.
|
|
459
|
+
* An embed of an external web page or post by `https://` URL.
|
|
460
|
+
* Schema: hm://hyper.media/block/web-embed
|
|
461
|
+
*/
|
|
462
|
+
export type HMBlockWebEmbed = HMBlockBase & {
|
|
463
|
+
type?: 'WebEmbed';
|
|
464
|
+
/** The embedded page or post — an `http(s)://` URL. */
|
|
465
|
+
link: HMUrl;
|
|
466
|
+
};
|
|
467
|
+
/**
|
|
468
|
+
* Capability
|
|
469
|
+
* A signed grant from a space owner to another key: a role (WRITER or AGENT), an optional path scope, and nothing that expires or revokes it.
|
|
470
|
+
* A signed grant from a space owner to another key: a `WRITER` or `AGENT` role, optionally scoped to a path.
|
|
471
|
+
* Schema: hm://hyper.media/capability
|
|
472
|
+
*/
|
|
473
|
+
export type HMCapability = HMBlob & {
|
|
474
|
+
type?: 'Capability';
|
|
475
|
+
/** The key that receives the grant. */
|
|
476
|
+
delegate: HMPrincipal;
|
|
477
|
+
/** Only on short-lived, unstored capabilities that prove account ownership to a peer or HTTP server; never on stored grants. */
|
|
478
|
+
audience?: HMPrincipal;
|
|
479
|
+
/** Path the grant is scoped to, recursive by segment (`/team` covers `/team/notes`); empty for the whole space. */
|
|
480
|
+
path?: string;
|
|
481
|
+
/** What the delegate may do: `WRITER` publishes under `path`, `AGENT` acts as the issuer (path must be empty). */
|
|
482
|
+
role?: HMRole;
|
|
483
|
+
/** Public, immutable note describing the grant, at most 512 bytes. */
|
|
484
|
+
label?: string;
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Change
|
|
488
|
+
* A signed delta on a document that links the changes it depends on into a causal graph and carries the operations that mutate the document's content and metadata.
|
|
489
|
+
* A signed delta on a document that links the Changes it depends on and carries the operations that edit its content and metadata.
|
|
490
|
+
* Schema: hm://hyper.media/change
|
|
491
|
+
*/
|
|
492
|
+
export type HMChange<Block = HMBlock> = HMBlob & {
|
|
493
|
+
type?: 'Change';
|
|
494
|
+
/** CID of the document's first Change, which is its identity; omitted on the genesis Change itself. */
|
|
495
|
+
genesis?: HMCid;
|
|
496
|
+
/** CIDs of the head Changes the author built on, sorted by CID; omitted on the genesis Change. */
|
|
497
|
+
deps?: HMCid[];
|
|
498
|
+
/** One more than the deepest dependency's depth; omitted on the genesis Change. */
|
|
499
|
+
depth?: number;
|
|
500
|
+
/** The operations this Change applies to the document's content and metadata. */
|
|
501
|
+
body?: HMChangeBody<Block>;
|
|
502
|
+
};
|
|
503
|
+
/**
|
|
504
|
+
* Change Body
|
|
505
|
+
* The operations payload of a Change, an ordered list of ops plus an advisory count of the logical operations they represent.
|
|
506
|
+
* The operations payload of a Change: an ordered list of ops the daemon applies in turn.
|
|
507
|
+
* Schema: hm://hyper.media/change/body
|
|
508
|
+
*/
|
|
509
|
+
export type HMChangeBody<Block = HMBlock> = {
|
|
510
|
+
/** Advisory count of logical operations, which can exceed the list length for run-length ops. */
|
|
511
|
+
opCount?: number;
|
|
512
|
+
/** Operations applied in order when the document is replayed. */
|
|
513
|
+
ops?: HMChangeOp<Block>[];
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* Operation
|
|
517
|
+
* One step inside a Change body, a map tagged by type that sets metadata, replaces a block, moves blocks, or deletes blocks, and the page explains how each op mutates the document.
|
|
518
|
+
* One operation inside a Change body, tagged by `type`: set metadata, replace, move or delete blocks.
|
|
519
|
+
* Schema: hm://hyper.media/change/op
|
|
520
|
+
*/
|
|
521
|
+
export type HMChangeOp<Block = HMBlock> = HMChangeOpSetAttributes | HMChangeOpMoveBlocks | HMChangeOpReplaceBlock<Block> | HMChangeOpDeleteBlocks | HMChangeOpSetKey;
|
|
522
|
+
/**
|
|
523
|
+
* DeleteBlocks Op
|
|
524
|
+
* The operation that removes blocks from the visible tree by moving them to the trash parent, from which a later move can restore them.
|
|
525
|
+
* The operation that removes blocks by moving them, with their children, to the trash parent.
|
|
526
|
+
* Schema: hm://hyper.media/change/op/delete-blocks
|
|
527
|
+
*/
|
|
528
|
+
export type HMChangeOpDeleteBlocks = {
|
|
529
|
+
type: 'DeleteBlocks';
|
|
530
|
+
/** Ids of the blocks to delete. */
|
|
531
|
+
blocks: string[];
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* MoveBlocks Op
|
|
535
|
+
* The operation that places a contiguous run of blocks under a parent after a reference position, using RGA op ids so concurrent moves converge and the latest move of a block wins.
|
|
536
|
+
* The operation that places a contiguous run of sibling blocks under a parent after a reference position.
|
|
537
|
+
* Schema: hm://hyper.media/change/op/move-blocks
|
|
538
|
+
*/
|
|
539
|
+
export type HMChangeOpMoveBlocks = {
|
|
540
|
+
type: 'MoveBlocks';
|
|
541
|
+
/** Id of the block the run goes under; empty means the document root. */
|
|
542
|
+
parent?: string;
|
|
543
|
+
/** Ids of the sibling blocks to place, in order. */
|
|
544
|
+
blocks: string[];
|
|
545
|
+
/** Op id to insert after: `[ts, idx, actor]`, or `[idx]` for an earlier op in this Change; empty means the start. */
|
|
546
|
+
ref?: number[];
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* ReplaceBlock Op
|
|
550
|
+
* The operation that sets the full state of one block, its id, type, text, link, annotations and attributes, where the newest replacement by op id wins.
|
|
551
|
+
* The operation that sets the full state of one block; the newest replacement by op id wins.
|
|
552
|
+
* Schema: hm://hyper.media/change/op/replace-block
|
|
553
|
+
*/
|
|
554
|
+
export type HMChangeOpReplaceBlock<Block = HMBlock> = {
|
|
555
|
+
type: 'ReplaceBlock';
|
|
556
|
+
/** The complete new state of the block, with attributes inlined at the top level. */
|
|
557
|
+
block: Block;
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* SetAttributes Op
|
|
561
|
+
* The operation that sets document metadata by key path, where each path is a last-writer-wins register and a nested write prunes older values above and below it.
|
|
562
|
+
* The operation that sets document metadata by key path, each path a last-writer-wins register.
|
|
563
|
+
* Schema: hm://hyper.media/change/op/set-attributes
|
|
564
|
+
*/
|
|
565
|
+
export type HMChangeOpSetAttributes = {
|
|
566
|
+
type: 'SetAttributes';
|
|
567
|
+
/** Reserved for per-block attributes; must be empty today. */
|
|
568
|
+
block?: string;
|
|
569
|
+
/** Key paths and the values to write; a `null` value deletes the key. */
|
|
570
|
+
attrs?: HMKeyValue[];
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* SetKey Op
|
|
574
|
+
* The deprecated flat form of SetAttributes that sets a single top-level metadata key, still accepted so old Changes replay.
|
|
575
|
+
* Deprecated flat form of SetAttributes that sets one top-level metadata key, kept so old Changes replay.
|
|
576
|
+
* Schema: hm://hyper.media/change/op/set-key
|
|
577
|
+
*/
|
|
578
|
+
export type HMChangeOpSetKey = {
|
|
579
|
+
type: 'SetKey';
|
|
580
|
+
/** Top-level metadata key to set. */
|
|
581
|
+
key?: string;
|
|
582
|
+
/** Scalar value to store: a string, boolean, integer or `null`. */
|
|
583
|
+
value?: HMValue;
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* CID
|
|
587
|
+
* A content identifier, the self-describing hash that names a blob by its bytes, written in Hypermedia as CIDv1 with the dag-cbor codec and either a SHA-256 or a BLAKE2b-256 multihash.
|
|
588
|
+
* A content identifier: a CIDv1 link that names a blob by the hash of its bytes.
|
|
589
|
+
* Schema: hm://hyper.media/cid
|
|
590
|
+
*/
|
|
591
|
+
export type HMCid = HMLink;
|
|
592
|
+
/**
|
|
593
|
+
* Comment
|
|
594
|
+
* A signed comment on a document version, threaded through threadRoot and replyParent, with a body that is a tree of comment blocks.
|
|
595
|
+
* A signed comment on a document version, threaded through `threadRoot` and `replyParent`, with a body of comment blocks.
|
|
596
|
+
* Schema: hm://hyper.media/comment
|
|
597
|
+
*/
|
|
598
|
+
export type HMComment = HMBlob & {
|
|
599
|
+
type?: 'Comment';
|
|
600
|
+
/** TSID of the comment being replaced; present only on an edit or a tombstone. */
|
|
601
|
+
id?: string;
|
|
602
|
+
/** Deprecated and ignored; some old comment blobs still carry it. */
|
|
603
|
+
capability?: HMCid;
|
|
604
|
+
/** Space of the commented document; omitted when it equals the signer. */
|
|
605
|
+
space?: HMPrincipal;
|
|
606
|
+
/** Path of the commented document within `space`. */
|
|
607
|
+
path?: string;
|
|
608
|
+
/** CIDs of the document heads the author was looking at; empty means the document at this path. */
|
|
609
|
+
version?: HMCid[];
|
|
610
|
+
/** CID of the first comment of the thread; present on every reply. */
|
|
611
|
+
threadRoot?: HMCid;
|
|
612
|
+
/** CID of the comment this one replies to; omitted when it equals `threadRoot`. */
|
|
613
|
+
replyParent?: HMCid;
|
|
614
|
+
/** The comment's content as a list of comment blocks; an empty body is a tombstone. */
|
|
615
|
+
body: HMBlockComment[];
|
|
616
|
+
/** Empty for a public comment or `Private`, usually copied from the target document. */
|
|
617
|
+
visibility?: HMVisibility;
|
|
618
|
+
};
|
|
619
|
+
/**
|
|
620
|
+
* Contact
|
|
621
|
+
* A public address-book entry: one account's name for another account, with flags that say whether it joined that account's site or follows its profile.
|
|
622
|
+
* A public address-book entry: one account's name for another, with flags for joining its site or following its profile.
|
|
623
|
+
* Schema: hm://hyper.media/contact
|
|
624
|
+
*/
|
|
625
|
+
export type HMContact = HMBlob & {
|
|
626
|
+
type?: 'Contact';
|
|
627
|
+
/** TSID of the contact record being replaced; present only on updates and tombstones. */
|
|
628
|
+
id?: string;
|
|
629
|
+
/** Account the contact is written for, set only when a delegated key signs on its behalf. */
|
|
630
|
+
account?: HMPrincipal;
|
|
631
|
+
/** The account being described; an empty subject makes the blob a tombstone. */
|
|
632
|
+
subject?: HMPrincipal;
|
|
633
|
+
/** The signer's name for the subject account, up to 256 bytes. */
|
|
634
|
+
name?: string;
|
|
635
|
+
/** Flags saying whether the signer joined the subject's site or follows its profile. */
|
|
636
|
+
subscribe?: HMContactSubscribe;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Contact Subscription
|
|
640
|
+
* The two follow flags on a contact: site means the account joined the subject's site, profile means it follows the subject as a person.
|
|
641
|
+
* The follow flags on a contact: whether the signer joined the subject's site and follows its profile.
|
|
642
|
+
* Schema: hm://hyper.media/contact/subscribe
|
|
643
|
+
*/
|
|
644
|
+
export type HMContactSubscribe = {
|
|
645
|
+
/** The signing account joined the subject's site and appears among its members. */
|
|
646
|
+
site?: boolean;
|
|
647
|
+
/** The signing account follows the subject's profile. */
|
|
648
|
+
profile?: boolean;
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* Date
|
|
652
|
+
* A calendar date held as an ISO 8601 `YYYY-MM-DD` string, with `format: date` so editors show a date picker and validators can check the shape.
|
|
653
|
+
* A calendar date as an ISO 8601 `YYYY-MM-DD` string — rendered as a date picker.
|
|
654
|
+
* Schema: hm://hyper.media/date
|
|
655
|
+
*/
|
|
656
|
+
export type HMDate = string;
|
|
657
|
+
/**
|
|
658
|
+
* Date-Time
|
|
659
|
+
* An instant held as an RFC 3339 string such as `2026-08-26T14:30:00Z`, with `format: date-time` so editors show a date-and-time picker.
|
|
660
|
+
* An instant as an RFC 3339 string such as `2026-08-26T14:30:00Z` — rendered as a date-and-time picker.
|
|
661
|
+
* Schema: hm://hyper.media/date-time
|
|
662
|
+
*/
|
|
663
|
+
export type HMDateTime = string;
|
|
664
|
+
/**
|
|
665
|
+
* Document
|
|
666
|
+
* The read model of a Hypermedia document, the metadata and block tree that result from replaying its Changes, and the base every typed document's attributes are folded into.
|
|
667
|
+
* The read model of a Hypermedia document: the metadata and block tree that result from replaying its Changes.
|
|
668
|
+
* Schema: hm://hyper.media/document
|
|
669
|
+
*/
|
|
670
|
+
export type HMDocument = {
|
|
671
|
+
/** The document's attributes, merged last-writer-wins from every SetAttributes op. */
|
|
672
|
+
metadata?: HMMetadata;
|
|
673
|
+
/** The tree of content block nodes built from the document's move tree and block registers. */
|
|
674
|
+
content?: HMBlockNode[];
|
|
675
|
+
};
|
|
676
|
+
/**
|
|
677
|
+
* Example: Address
|
|
678
|
+
* A postal address: street and city (required) plus an optional postal code.
|
|
679
|
+
* A postal address: street and city (required) plus an optional postal code.
|
|
680
|
+
* Schema: hm://hyper.media/example/address
|
|
681
|
+
*/
|
|
682
|
+
export type HMExampleAddress = {
|
|
683
|
+
/** Street address line, including the house number. */
|
|
684
|
+
street: string;
|
|
685
|
+
/** City or town name. */
|
|
686
|
+
city: string;
|
|
687
|
+
/** Postal or ZIP code, if any. */
|
|
688
|
+
postalCode?: string;
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Example: Admin
|
|
692
|
+
* An employee, extended with a map of boolean permission flags.
|
|
693
|
+
* An employee extended with a map of boolean permission flags — a two-level extension chain.
|
|
694
|
+
* Schema: hm://hyper.media/example/admin
|
|
695
|
+
*/
|
|
696
|
+
export type HMExampleAdmin = HMExampleEmployee & {
|
|
697
|
+
/** The permissions this admin holds, as flags. A set of flags is a map rather than a list because a document's attributes hold scalars and nested maps, so this type describes a document as well as a blob. */
|
|
698
|
+
permissions: {
|
|
699
|
+
[key: string]: boolean;
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* Example: App Block (Extended Core)
|
|
704
|
+
* How a third party extends the block model: a strict union of Hypermedia’s core blocks plus the app’s own Poll block, rejecting block types it does not know.
|
|
705
|
+
* A strict union of Hypermedia's core blocks plus the app's own Poll block, showing how a third party extends the block model.
|
|
706
|
+
* Schema: hm://hyper.media/example/app-block
|
|
707
|
+
*/
|
|
708
|
+
export type HMExampleAppBlock = HMBlockCore | HMExamplePollBlock;
|
|
709
|
+
/**
|
|
710
|
+
* Example: Article
|
|
711
|
+
* A published article: status, author, tags, a bytes body, cover image, comments, and metadata.
|
|
712
|
+
* A published article that combines the other examples: status, author, tags, body, cover image, comments and metadata.
|
|
713
|
+
* Schema: hm://hyper.media/example/article
|
|
714
|
+
*/
|
|
715
|
+
export type HMExampleArticle = {
|
|
716
|
+
/** Headline of the article. */
|
|
717
|
+
title: string;
|
|
718
|
+
/** URL-friendly short name for the article. */
|
|
719
|
+
slug: string;
|
|
720
|
+
/** Publication status: `draft`, `published` or `archived`. */
|
|
721
|
+
status: HMExampleStatus;
|
|
722
|
+
/** The person who wrote the article. */
|
|
723
|
+
author: HMLink;
|
|
724
|
+
/** Topic tags for the article. */
|
|
725
|
+
tags?: HMExampleTags;
|
|
726
|
+
/** The article's content as raw bytes. */
|
|
727
|
+
body?: HMBytes;
|
|
728
|
+
/** Number of words in the body. */
|
|
729
|
+
wordCount?: number;
|
|
730
|
+
/** Whether the article is featured. */
|
|
731
|
+
featured?: boolean;
|
|
732
|
+
/** Cover image, a link to a Blob. */
|
|
733
|
+
cover?: HMLink;
|
|
734
|
+
/** Links to the comments on the article. */
|
|
735
|
+
comments?: HMLink[];
|
|
736
|
+
/** Open string metadata for anything the other fields do not cover. */
|
|
737
|
+
meta?: HMExampleMetadata;
|
|
738
|
+
};
|
|
739
|
+
/**
|
|
740
|
+
* Example: Blob
|
|
741
|
+
* A binary payload tagged with a MIME type and optional size.
|
|
742
|
+
* A binary payload tagged with a MIME type and an optional size.
|
|
743
|
+
* Schema: hm://hyper.media/example/blob
|
|
744
|
+
*/
|
|
745
|
+
export type HMExampleBlob = {
|
|
746
|
+
/** MIME type of the payload, such as `image/png`. */
|
|
747
|
+
mime: string;
|
|
748
|
+
/** Payload size in bytes. */
|
|
749
|
+
size?: number;
|
|
750
|
+
/** The binary payload. */
|
|
751
|
+
data: HMBytes;
|
|
752
|
+
};
|
|
753
|
+
/**
|
|
754
|
+
* Character
|
|
755
|
+
* A world-builder page type for a character, whose attributes require a birth date and a role and link to a home place, a faction, a portrait, and a stats object.
|
|
756
|
+
* A World Builder page type for a character, with a birth date, role, and links to a home place, faction, portrait and stats.
|
|
757
|
+
* Schema: hm://hyper.media/example/character-doc
|
|
758
|
+
*/
|
|
759
|
+
export type HMExampleCharacterDoc = {
|
|
760
|
+
/** Birth date (ISO 8601 `YYYY-MM-DD`) — rendered as a date picker. */
|
|
761
|
+
born: HMDate;
|
|
762
|
+
/** Death date, if any. */
|
|
763
|
+
died?: HMDate;
|
|
764
|
+
/** Narrative role. */
|
|
765
|
+
role: 'hero' | 'villain' | 'ally' | 'neutral';
|
|
766
|
+
/** The place this character calls home — a page conforming to the Place type. */
|
|
767
|
+
home?: HMHmUrl;
|
|
768
|
+
/** The faction this character belongs to. */
|
|
769
|
+
faction?: HMHmUrl;
|
|
770
|
+
/** A portrait image file on IPFS. */
|
|
771
|
+
portrait?: HMIpfsUrl;
|
|
772
|
+
/** An `ipfs://` object that must conform to Character stats (a required target schema). */
|
|
773
|
+
stats?: HMIpfsUrl;
|
|
774
|
+
/** An `ipfs://` object with no declared schema — free-form data. */
|
|
775
|
+
notes?: HMIpfsUrl;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Example: Comment
|
|
779
|
+
* A comment with an author and replies, which are themselves comments.
|
|
780
|
+
* A comment with an author and replies that are themselves comments, showing a self-referencing type.
|
|
781
|
+
* Schema: hm://hyper.media/example/comment
|
|
782
|
+
*/
|
|
783
|
+
export type HMExampleComment = {
|
|
784
|
+
/** The comment's text. */
|
|
785
|
+
text: string;
|
|
786
|
+
/** The person who wrote the comment. */
|
|
787
|
+
author?: HMLink;
|
|
788
|
+
/** Links to replies, which are themselves comments. */
|
|
789
|
+
replies?: HMLink[];
|
|
790
|
+
};
|
|
791
|
+
/**
|
|
792
|
+
* Example: Constrained Record
|
|
793
|
+
* A record that shows the value constraints: string length and pattern, numeric bounds, and list size.
|
|
794
|
+
* A record that shows value constraints: string length and pattern, numeric bounds, and list size.
|
|
795
|
+
* Schema: hm://hyper.media/example/constrained
|
|
796
|
+
*/
|
|
797
|
+
export type HMExampleConstrained = {
|
|
798
|
+
/** Login name: 3–12 characters of lowercase letters, digits and `_`. · minLength: 3 · maxLength: 12 · pattern: "^[a-z0-9_]+$" */
|
|
799
|
+
username: string;
|
|
800
|
+
/** Score from 0 to 100. · minimum: 0 · maximum: 100 */
|
|
801
|
+
score: number;
|
|
802
|
+
/** One to three string tags. */
|
|
803
|
+
tags?: string[];
|
|
804
|
+
};
|
|
805
|
+
/**
|
|
806
|
+
* Example: Counts
|
|
807
|
+
* A map from string keys to integers: Map<Integer>.
|
|
808
|
+
* A map from string keys to integers: `Map<Integer>`.
|
|
809
|
+
* Schema: hm://hyper.media/example/counts
|
|
810
|
+
*/
|
|
811
|
+
export type HMExampleCounts = {
|
|
812
|
+
[key: string]: number;
|
|
813
|
+
};
|
|
814
|
+
/**
|
|
815
|
+
* Example: Document
|
|
816
|
+
* A document with a title, an author, a body, and a link to a previous document.
|
|
817
|
+
* A document with a title, author, body and a link to a previous document, showing a self-referencing type.
|
|
818
|
+
* Schema: hm://hyper.media/example/document
|
|
819
|
+
*/
|
|
820
|
+
export type HMExampleDocument = {
|
|
821
|
+
/** Title of the document. */
|
|
822
|
+
title: string;
|
|
823
|
+
/** The person who wrote the document. */
|
|
824
|
+
author?: HMLink;
|
|
825
|
+
/** The document's content as raw bytes. */
|
|
826
|
+
body?: HMBytes;
|
|
827
|
+
/** The previous document, a link to another Document. */
|
|
828
|
+
previous?: HMLink;
|
|
829
|
+
};
|
|
830
|
+
/**
|
|
831
|
+
* Example: Employee
|
|
832
|
+
* A person, extended with an employee id and department.
|
|
833
|
+
* A person extended with an employee id and department.
|
|
834
|
+
* Schema: hm://hyper.media/example/employee
|
|
835
|
+
*/
|
|
836
|
+
export type HMExampleEmployee = HMExamplePerson & {
|
|
837
|
+
/** The employee's id within the organization. */
|
|
838
|
+
employeeId: string;
|
|
839
|
+
/** The department the employee works in. */
|
|
840
|
+
department?: string;
|
|
841
|
+
};
|
|
842
|
+
/**
|
|
843
|
+
* Example: Filesystem Entry
|
|
844
|
+
* Either a folder or a file, as a union.
|
|
845
|
+
* A filesystem entry: a union of folder and file.
|
|
846
|
+
* Schema: hm://hyper.media/example/entry
|
|
847
|
+
*/
|
|
848
|
+
export type HMExampleEntry = HMExampleFolder | HMExampleFile;
|
|
849
|
+
/**
|
|
850
|
+
* Event
|
|
851
|
+
* A world-builder page type for something that happened, whose attributes require a date and link the event to a place and a protagonist character.
|
|
852
|
+
* A World Builder page type for something that happened, with a date and links to a place, a protagonist and a faction.
|
|
853
|
+
* Schema: hm://hyper.media/example/event-doc
|
|
854
|
+
*/
|
|
855
|
+
export type HMExampleEventDoc = {
|
|
856
|
+
/** When it happened (or began). */
|
|
857
|
+
date: HMDate;
|
|
858
|
+
/** When it ended, for a span. */
|
|
859
|
+
ends?: HMDate;
|
|
860
|
+
/** Where it happened. */
|
|
861
|
+
location?: HMHmUrl;
|
|
862
|
+
/** The central character. */
|
|
863
|
+
protagonist?: HMHmUrl;
|
|
864
|
+
/** The faction chiefly involved. */
|
|
865
|
+
faction?: HMHmUrl;
|
|
866
|
+
/** How the event ended: `victory`, `defeat`, `stalemate` or `unknown`. */
|
|
867
|
+
outcome?: 'victory' | 'defeat' | 'stalemate' | 'unknown';
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* Faction
|
|
871
|
+
* A world-builder page type for a faction, order, house, or guild, whose attributes require a founding date and link to its seat, its leader, and a banner.
|
|
872
|
+
* A World Builder page type for a faction, order, house or guild, with a founding date and links to its seat, leader and banner.
|
|
873
|
+
* Schema: hm://hyper.media/example/faction-doc
|
|
874
|
+
*/
|
|
875
|
+
export type HMExampleFactionDoc = {
|
|
876
|
+
/** Founding date. */
|
|
877
|
+
founded: HMDate;
|
|
878
|
+
/** Dissolution date, if any. */
|
|
879
|
+
dissolved?: HMDate;
|
|
880
|
+
/** Where the faction is based. */
|
|
881
|
+
seat?: HMHmUrl;
|
|
882
|
+
/** Who leads it. */
|
|
883
|
+
leader?: HMHmUrl;
|
|
884
|
+
/** A banner or crest image file on IPFS. */
|
|
885
|
+
banner?: HMIpfsUrl;
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* Example: File
|
|
889
|
+
* A file with a name and a link to its parent folder.
|
|
890
|
+
* A file with a name and a link to its parent folder, showing mutually referencing types.
|
|
891
|
+
* Schema: hm://hyper.media/example/file
|
|
892
|
+
*/
|
|
893
|
+
export type HMExampleFile = {
|
|
894
|
+
/** File name. */
|
|
895
|
+
name: string;
|
|
896
|
+
/** The folder that contains this file. */
|
|
897
|
+
parent?: HMLink;
|
|
898
|
+
};
|
|
899
|
+
/**
|
|
900
|
+
* Example: Folder
|
|
901
|
+
* A folder with a name and links to its files and subfolders.
|
|
902
|
+
* A folder with a name and links to its files and subfolders, showing mutually referencing types.
|
|
903
|
+
* Schema: hm://hyper.media/example/folder
|
|
904
|
+
*/
|
|
905
|
+
export type HMExampleFolder = {
|
|
906
|
+
/** Folder name. */
|
|
907
|
+
name: string;
|
|
908
|
+
/** Links to the files directly in this folder. */
|
|
909
|
+
files?: HMLink[];
|
|
910
|
+
/** Links to the folders directly inside this folder. */
|
|
911
|
+
subfolders?: HMLink[];
|
|
912
|
+
};
|
|
913
|
+
/**
|
|
914
|
+
* Example: Geo Point
|
|
915
|
+
* A latitude and longitude coordinate with an optional altitude.
|
|
916
|
+
* A latitude and longitude coordinate with an optional altitude.
|
|
917
|
+
* Schema: hm://hyper.media/example/geo
|
|
918
|
+
*/
|
|
919
|
+
export type HMExampleGeo = {
|
|
920
|
+
/** Latitude in degrees. */
|
|
921
|
+
lat: number;
|
|
922
|
+
/** Longitude in degrees. */
|
|
923
|
+
lng: number;
|
|
924
|
+
/** Altitude, as a whole number. */
|
|
925
|
+
altitude?: number;
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* Example: JSON Value
|
|
929
|
+
* A recursive JSON value: null, boolean, number, string, list, or map.
|
|
930
|
+
* A recursive JSON value: null, boolean, integer, float, string, or a list or map of JSON values.
|
|
931
|
+
* Schema: hm://hyper.media/example/json
|
|
932
|
+
*/
|
|
933
|
+
export type HMExampleJson = null | boolean | number | string | HMExampleJson[] | {
|
|
934
|
+
[key: string]: HMExampleJson;
|
|
935
|
+
};
|
|
936
|
+
/**
|
|
937
|
+
* Example: Matrix
|
|
938
|
+
* A list of lists of integers: List<List<Integer>>.
|
|
939
|
+
* A list of lists of integers: `List<List<Integer>>`.
|
|
940
|
+
* Schema: hm://hyper.media/example/matrix
|
|
941
|
+
*/
|
|
942
|
+
export type HMExampleMatrix = number[][];
|
|
943
|
+
/**
|
|
944
|
+
* Example: Metadata
|
|
945
|
+
* Arbitrary string-to-string metadata: Map<String>.
|
|
946
|
+
* Arbitrary string-to-string metadata: `Map<String>`.
|
|
947
|
+
* Schema: hm://hyper.media/example/metadata
|
|
948
|
+
*/
|
|
949
|
+
export type HMExampleMetadata = {
|
|
950
|
+
[key: string]: string;
|
|
951
|
+
};
|
|
952
|
+
/**
|
|
953
|
+
* Example: MyApp Change
|
|
954
|
+
* A Change instantiated with the app’s block type, so its ReplaceBlock ops are validated strictly against core blocks plus Poll instead of the open default.
|
|
955
|
+
* A Change bound to the app's block type (`Change<example/app-block>`), so ReplaceBlock ops accept only core blocks and Poll.
|
|
956
|
+
* Schema: hm://hyper.media/example/myapp-change
|
|
957
|
+
*/
|
|
958
|
+
export type HMExampleMyappChange = HMChange<HMExampleAppBlock>;
|
|
959
|
+
/**
|
|
960
|
+
* Example: Person
|
|
961
|
+
* A person with a name, age, active flag, home address, and nicknames.
|
|
962
|
+
* A person with a name, age, active flag, home address and nicknames.
|
|
963
|
+
* Schema: hm://hyper.media/example/person
|
|
964
|
+
*/
|
|
965
|
+
export type HMExamplePerson = {
|
|
966
|
+
/** The person's name. */
|
|
967
|
+
name: string;
|
|
968
|
+
/** Age in years. */
|
|
969
|
+
age?: number;
|
|
970
|
+
/** Whether the person is currently active. */
|
|
971
|
+
active?: boolean;
|
|
972
|
+
/** Home postal address. */
|
|
973
|
+
home?: HMExampleAddress;
|
|
974
|
+
/** Other names the person goes by. */
|
|
975
|
+
nicknames?: string[];
|
|
976
|
+
};
|
|
977
|
+
/**
|
|
978
|
+
* Example: Person Document
|
|
979
|
+
* A document type for a person: an attributes schema requiring a surname with an optional given name, bound per page or to every child of a folder.
|
|
980
|
+
* A document type for a person that requires a surname and allows a given name, bound per page or to a folder's children.
|
|
981
|
+
* Schema: hm://hyper.media/example/person-doc
|
|
982
|
+
*/
|
|
983
|
+
export type HMExamplePersonDoc = {
|
|
984
|
+
/** The person's family name. */
|
|
985
|
+
surname: string;
|
|
986
|
+
/** The person's given (first) name. */
|
|
987
|
+
givenName?: string;
|
|
988
|
+
};
|
|
989
|
+
/**
|
|
990
|
+
* Place
|
|
991
|
+
* A world-builder page type for a place, whose attributes require a kind and may add a founding date, a parent region, and a coordinates object.
|
|
992
|
+
* A World Builder page type for a place, with a kind and optional founding date, parent region, ruler, coordinates and map.
|
|
993
|
+
* Schema: hm://hyper.media/example/place-doc
|
|
994
|
+
*/
|
|
995
|
+
export type HMExamplePlaceDoc = {
|
|
996
|
+
/** What sort of place this is, such as `city`, `ruin` or `realm`. */
|
|
997
|
+
kind: 'city' | 'town' | 'village' | 'fortress' | 'ruin' | 'wilderness' | 'realm';
|
|
998
|
+
/** Founding date. */
|
|
999
|
+
founded?: HMDate;
|
|
1000
|
+
/** The larger place this one lies within. */
|
|
1001
|
+
region?: HMHmUrl;
|
|
1002
|
+
/** The faction that holds this place. */
|
|
1003
|
+
ruler?: HMHmUrl;
|
|
1004
|
+
/** An `ipfs://` object conforming to Geo point. */
|
|
1005
|
+
coordinates?: HMIpfsUrl;
|
|
1006
|
+
/** A map image file on IPFS. */
|
|
1007
|
+
map?: HMIpfsUrl;
|
|
1008
|
+
};
|
|
1009
|
+
/**
|
|
1010
|
+
* Example: Poll Block (Custom)
|
|
1011
|
+
* An example third-party block type: a poll with a question and options. It extends the shared block base, exactly like a core block.
|
|
1012
|
+
* An example third-party block type: a poll with a question and options, extending the shared block base like a core block.
|
|
1013
|
+
* Schema: hm://hyper.media/example/poll-block
|
|
1014
|
+
*/
|
|
1015
|
+
export type HMExamplePollBlock = HMBlockBase & {
|
|
1016
|
+
type?: 'Poll';
|
|
1017
|
+
/** The question the poll asks. */
|
|
1018
|
+
question: string;
|
|
1019
|
+
/** The answer choices, in display order. */
|
|
1020
|
+
options: string[];
|
|
1021
|
+
/** Block attributes: layout keys plus poll settings such as `multiple`; other keys are allowed. */
|
|
1022
|
+
attributes?: {
|
|
1023
|
+
/** How the block's children are laid out, such as `Ordered` or `Grid`. */
|
|
1024
|
+
childrenType?: HMBlockChildrenType;
|
|
1025
|
+
/** Number of columns when `childrenType` is `Grid`. */
|
|
1026
|
+
columnCount?: number;
|
|
1027
|
+
/** Whether a voter may choose more than one option. */
|
|
1028
|
+
multiple?: boolean;
|
|
1029
|
+
} & {
|
|
1030
|
+
[key: string]: unknown;
|
|
1031
|
+
};
|
|
1032
|
+
};
|
|
1033
|
+
/**
|
|
1034
|
+
* Example: Registry
|
|
1035
|
+
* A map from ids to person links: Map<Link<Person>>.
|
|
1036
|
+
* A map from ids to person links: `Map<Link<Person>>`.
|
|
1037
|
+
* Schema: hm://hyper.media/example/registry
|
|
1038
|
+
*/
|
|
1039
|
+
export type HMExampleRegistry = {
|
|
1040
|
+
[key: string]: HMLink;
|
|
1041
|
+
};
|
|
1042
|
+
/**
|
|
1043
|
+
* Character Stats
|
|
1044
|
+
* A character’s stats object, stored as its own DAG-CBOR blob linked by `ipfs://` so it can hold the integers and enums document metadata cannot.
|
|
1045
|
+
* A character's stats object, stored as its own DAG-CBOR blob so it can hold the integers and enums document metadata cannot.
|
|
1046
|
+
* Schema: hm://hyper.media/example/stats
|
|
1047
|
+
*/
|
|
1048
|
+
export type HMExampleStats = {
|
|
1049
|
+
/** 1–10 · minimum: 1 · maximum: 10 */
|
|
1050
|
+
strength: number;
|
|
1051
|
+
/** 1–10 · minimum: 1 · maximum: 10 */
|
|
1052
|
+
intellect: number;
|
|
1053
|
+
/** 1–10 · minimum: 1 · maximum: 10 */
|
|
1054
|
+
charisma: number;
|
|
1055
|
+
/** Moral alignment: `lawful`, `neutral` or `chaotic`. */
|
|
1056
|
+
alignment?: 'lawful' | 'neutral' | 'chaotic';
|
|
1057
|
+
/** Free-form descriptors. */
|
|
1058
|
+
traits?: string[];
|
|
1059
|
+
};
|
|
1060
|
+
/**
|
|
1061
|
+
* Example: Status
|
|
1062
|
+
* A publication status: draft, published, or archived.
|
|
1063
|
+
* A publication status: `draft`, `published` or `archived`.
|
|
1064
|
+
* Schema: hm://hyper.media/example/status
|
|
1065
|
+
*/
|
|
1066
|
+
export type HMExampleStatus = 'draft' | 'published' | 'archived';
|
|
1067
|
+
/**
|
|
1068
|
+
* Example: Tags
|
|
1069
|
+
* A list of string tags: List<String>.
|
|
1070
|
+
* A list of string tags: `List<String>`.
|
|
1071
|
+
* Schema: hm://hyper.media/example/tags
|
|
1072
|
+
*/
|
|
1073
|
+
export type HMExampleTags = string[];
|
|
1074
|
+
/**
|
|
1075
|
+
* Example: Tree
|
|
1076
|
+
* A node holding an integer value and links to child nodes.
|
|
1077
|
+
* A tree node holding an integer value and links to child nodes, showing a self-referencing type.
|
|
1078
|
+
* Schema: hm://hyper.media/example/tree
|
|
1079
|
+
*/
|
|
1080
|
+
export type HMExampleTree = {
|
|
1081
|
+
/** The integer stored at this node. */
|
|
1082
|
+
value: number;
|
|
1083
|
+
/** Links to this node's child trees. */
|
|
1084
|
+
children?: HMLink[];
|
|
1085
|
+
};
|
|
1086
|
+
/**
|
|
1087
|
+
* Example: Value
|
|
1088
|
+
* A primitive value: string, integer, boolean, or null.
|
|
1089
|
+
* A primitive value: string, integer, boolean or null.
|
|
1090
|
+
* Schema: hm://hyper.media/example/value
|
|
1091
|
+
*/
|
|
1092
|
+
export type HMExampleValue = string | number | boolean | null;
|
|
1093
|
+
/**
|
|
1094
|
+
* World
|
|
1095
|
+
* A world-builder page type for the root of a fictional world, whose children hold the type definitions and the folders of characters, places, factions, and events.
|
|
1096
|
+
* A World Builder page type for the root of a fictional world, naming its genre and the date the chronicle begins.
|
|
1097
|
+
* Schema: hm://hyper.media/example/world-doc
|
|
1098
|
+
*/
|
|
1099
|
+
export type HMExampleWorldDoc = {
|
|
1100
|
+
/** The world's genre, such as `fantasy` or `science-fiction`. */
|
|
1101
|
+
genre: 'fantasy' | 'science-fiction' | 'historical' | 'contemporary' | 'mythic';
|
|
1102
|
+
/** The in-world date the chronicle begins. */
|
|
1103
|
+
epoch?: HMDate;
|
|
1104
|
+
/** A one-line pitch for the world. */
|
|
1105
|
+
tagline?: string;
|
|
1106
|
+
};
|
|
1107
|
+
/**
|
|
1108
|
+
* Resource URL
|
|
1109
|
+
* A reference to a Hypermedia document held as an `hm://` URL string, which editors render as a searchable pill showing the target’s title.
|
|
1110
|
+
* A reference to a Hypermedia document as an `hm://` URL string — rendered as a searchable pill showing the target's title.
|
|
1111
|
+
* Schema: hm://hyper.media/hm-url
|
|
1112
|
+
*/
|
|
1113
|
+
export type HMHmUrl = string;
|
|
1114
|
+
/**
|
|
1115
|
+
* IPFS URL
|
|
1116
|
+
* A reference to a content-addressed object held as an `ipfs://<cid>` string, which editors render as a file pill you can open, upload to, or paste into.
|
|
1117
|
+
* A string that is an `ipfs://` URL naming content by its CID — a file, or a DAG-CBOR object such as a schema.
|
|
1118
|
+
* Schema: hm://hyper.media/ipfs-url
|
|
1119
|
+
*/
|
|
1120
|
+
export type HMIpfsUrl = string;
|
|
1121
|
+
/**
|
|
1122
|
+
* Key/Value
|
|
1123
|
+
* One attribute assignment in a SetAttributes op: a key path (a list of segments) and a scalar value.
|
|
1124
|
+
* One attribute assignment in a SetAttributes op: a key path and the scalar value to set there.
|
|
1125
|
+
* Schema: hm://hyper.media/key-value
|
|
1126
|
+
*/
|
|
1127
|
+
export type HMKeyValue = {
|
|
1128
|
+
/** Path of key segments to set, such as `["theme", "headerLayout"]` for a nested key. */
|
|
1129
|
+
key?: string[];
|
|
1130
|
+
/** Scalar value to store at `key`; `null` deletes the key. */
|
|
1131
|
+
value?: HMValue;
|
|
1132
|
+
};
|
|
1133
|
+
/**
|
|
1134
|
+
* Document Metadata
|
|
1135
|
+
* The attributes of a document, merged from its Changes: the keys Seed understands, the three schema-binding keys, and any custom keys a typed document adds.
|
|
1136
|
+
* The attributes of a document, merged from its Changes: the keys Seed understands, the schema-binding keys, and any custom keys.
|
|
1137
|
+
* Schema: hm://hyper.media/metadata
|
|
1138
|
+
*/
|
|
1139
|
+
export type HMMetadata = {
|
|
1140
|
+
/** The document or space title. */
|
|
1141
|
+
name?: string;
|
|
1142
|
+
/** A short description shown in previews and cards. */
|
|
1143
|
+
summary?: string;
|
|
1144
|
+
/** A square document or space image, as an `ipfs://` URL. */
|
|
1145
|
+
icon?: HMIpfsUrl;
|
|
1146
|
+
/** Deprecated image field kept for old documents; use `icon` or `cover`. */
|
|
1147
|
+
thumbnail?: HMIpfsUrl;
|
|
1148
|
+
/** A wide cover image shown in headers and cards, as an `ipfs://` URL. */
|
|
1149
|
+
cover?: HMIpfsUrl;
|
|
1150
|
+
/** The web address a space is published at; set on the home document when a site is registered. */
|
|
1151
|
+
siteUrl?: HMUrl;
|
|
1152
|
+
/** The agents server this space advertises to its readers (an http(s) origin); clients connect to it beside their own servers. */
|
|
1153
|
+
agentServerUrl?: HMUrl;
|
|
1154
|
+
/** Agents this space publishes to its readers: `{[agentId]: order}`, each id an agent on `agentServerUrl`; a removed agent leaves a null behind. */
|
|
1155
|
+
spaceAgents?: {
|
|
1156
|
+
[key: string]: HMValue;
|
|
1157
|
+
};
|
|
1158
|
+
/** The attributes schema THIS document conforms to: the hm:// URL of a schema document (or ipfs://<cid> of a schema blob) whose struct describes the document's attributes. */
|
|
1159
|
+
attributesSchema?: HMHmUrl;
|
|
1160
|
+
/** The attributes schema this document's direct CHILDREN conform to (hm:// URL or ipfs://<cid>). A child may declare its own `attributesSchema` instead. */
|
|
1161
|
+
childAttributesSchema?: HMHmUrl;
|
|
1162
|
+
/** This document DEFINES a schema: ipfs://<cid> of the schema blob it describes. Its target is the meta-schema, so an editor creates and validates the blob as a Hypermedia schema (the struct form, rooted at Struct by default). Other documents reference this document's URL as their `attributesSchema`/`childAttributesSchema`. */
|
|
1163
|
+
schemaDefinition?: HMIpfsUrl;
|
|
1164
|
+
/** Legacy space header layout: `Seed/Experimental/Newspaper` or empty. */
|
|
1165
|
+
layout?: 'Seed/Experimental/Newspaper' | '';
|
|
1166
|
+
/** Space header logo image. */
|
|
1167
|
+
seedExperimentalLogo?: HMIpfsUrl;
|
|
1168
|
+
/** Legacy ordering of a space home listing. */
|
|
1169
|
+
seedExperimentalHomeOrder?: 'UpdatedFirst' | 'CreatedFirst';
|
|
1170
|
+
/** Publication date shown to readers when it differs from the change history. */
|
|
1171
|
+
displayPublishTime?: string;
|
|
1172
|
+
/** Author byline shown to readers. */
|
|
1173
|
+
displayAuthor?: string;
|
|
1174
|
+
/** Whether to show the document outline. */
|
|
1175
|
+
showOutline?: boolean;
|
|
1176
|
+
/** Whether to show the document's activity and tools. */
|
|
1177
|
+
showActivity?: boolean;
|
|
1178
|
+
/** Width of the content column: `S`, `M` or `L`. */
|
|
1179
|
+
contentWidth?: 'S' | 'M' | 'L';
|
|
1180
|
+
/** Layout of the document's root-level blocks, a block children type. */
|
|
1181
|
+
childrenType?: string;
|
|
1182
|
+
/** Visual settings for a space. */
|
|
1183
|
+
theme?: {
|
|
1184
|
+
/** Space header layout: `Center` or empty for the default. */
|
|
1185
|
+
headerLayout?: 'Center' | '';
|
|
1186
|
+
};
|
|
1187
|
+
/** Comma-separated categories kept from an external import (e.g. WordPress). */
|
|
1188
|
+
importCategories?: string;
|
|
1189
|
+
/** Comma-separated tags kept from an external import (e.g. WordPress). */
|
|
1190
|
+
importTags?: string;
|
|
1191
|
+
} & {
|
|
1192
|
+
[key: string]: HMValue;
|
|
1193
|
+
};
|
|
1194
|
+
/**
|
|
1195
|
+
* Navigation item
|
|
1196
|
+
* One entry of a site's navigation menu: a Link block with display text and a link, stored as a child of the detached navigation block.
|
|
1197
|
+
* One entry of a site's navigation menu, stored as a `Link` child of the detached `navigation` block.
|
|
1198
|
+
* Schema: hm://hyper.media/metadata/navigation-item
|
|
1199
|
+
*/
|
|
1200
|
+
export type HMMetadataNavigationItem = {
|
|
1201
|
+
type: 'Link';
|
|
1202
|
+
/** Block id of this menu entry. */
|
|
1203
|
+
id: string;
|
|
1204
|
+
/** Label shown in the menu. */
|
|
1205
|
+
text: string;
|
|
1206
|
+
/** Where the entry goes — an `hm://` or web URL. */
|
|
1207
|
+
link: HMUrl;
|
|
1208
|
+
};
|
|
1209
|
+
/**
|
|
1210
|
+
* None
|
|
1211
|
+
* The bottom type, which accepts no values and is defined as an empty union.
|
|
1212
|
+
* Schema: hm://hyper.media/none
|
|
1213
|
+
*/
|
|
1214
|
+
export type HMNone = never;
|
|
1215
|
+
/**
|
|
1216
|
+
* Principal
|
|
1217
|
+
* A public key that identifies an account or space, stored in blobs as the raw bytes of a multicodec prefix plus the key and shown to people as a base58 string starting with z6Mk.
|
|
1218
|
+
* A public key that identifies an account or space, stored as multicodec-prefixed key bytes and shown as a `z6Mk…` string.
|
|
1219
|
+
* Schema: hm://hyper.media/principal
|
|
1220
|
+
*/
|
|
1221
|
+
export type HMPrincipal = HMBytes;
|
|
1222
|
+
/**
|
|
1223
|
+
* Profile
|
|
1224
|
+
* A snapshot blob giving an account its display name, avatar and description, or an alias that redirects one key to another; readers merge every profile for an account field by field.
|
|
1225
|
+
* A snapshot blob giving an account its display name, avatar and description, or an alias redirecting one key to another.
|
|
1226
|
+
* Schema: hm://hyper.media/profile
|
|
1227
|
+
*/
|
|
1228
|
+
export type HMProfile = HMBlob & {
|
|
1229
|
+
type?: 'Profile';
|
|
1230
|
+
/** Account this key really belongs to; a profile with `alias` carries no other field. */
|
|
1231
|
+
alias?: HMPrincipal;
|
|
1232
|
+
/** The account's display name. */
|
|
1233
|
+
name?: string;
|
|
1234
|
+
/** The account's picture, as an `ipfs://` link to an image. */
|
|
1235
|
+
avatar?: string;
|
|
1236
|
+
/** A short description of the account. */
|
|
1237
|
+
description?: string;
|
|
1238
|
+
/** Account the profile is for, set only when a delegated key signs on its behalf. */
|
|
1239
|
+
account?: HMPrincipal;
|
|
1240
|
+
};
|
|
1241
|
+
/**
|
|
1242
|
+
* Query
|
|
1243
|
+
* A live document query: which spaces and paths to include, how to sort, and an optional limit; the payload of a Query block and of the Query request.
|
|
1244
|
+
* A live document query: which spaces and paths to include, how to sort, and an optional limit.
|
|
1245
|
+
* Schema: hm://hyper.media/query
|
|
1246
|
+
*/
|
|
1247
|
+
export type HMQuery = {
|
|
1248
|
+
/** Spaces and path prefixes whose documents the query returns, each with a `Children` or `AllDescendants` mode. */
|
|
1249
|
+
includes: HMQueryInclusion[];
|
|
1250
|
+
/** Sort terms for the results; the daemon applies the first. */
|
|
1251
|
+
sort?: HMQuerySort[];
|
|
1252
|
+
/** Maximum number of results to return. · minimum: 0 */
|
|
1253
|
+
limit?: number;
|
|
1254
|
+
};
|
|
1255
|
+
/**
|
|
1256
|
+
* Query Inclusion
|
|
1257
|
+
* One source a query pulls documents from: a space, an optional path prefix inside it, and whether to list direct children or all descendants.
|
|
1258
|
+
* One source a query pulls documents from: a space, an optional path, and a depth mode.
|
|
1259
|
+
* Schema: hm://hyper.media/query/inclusion
|
|
1260
|
+
*/
|
|
1261
|
+
export type HMQueryInclusion = {
|
|
1262
|
+
/** Account id whose documents to list. */
|
|
1263
|
+
space: string;
|
|
1264
|
+
/** Optional path prefix inside the space, such as a folder. */
|
|
1265
|
+
path?: string;
|
|
1266
|
+
/** `Children` lists direct children of the path; `AllDescendants` lists everything below it. */
|
|
1267
|
+
mode: 'Children' | 'AllDescendants';
|
|
1268
|
+
};
|
|
1269
|
+
/**
|
|
1270
|
+
* Query Sort
|
|
1271
|
+
* One sort term for query results, optionally reversed; the app writes lowercase terms and normalizes the older capitalized spellings on read.
|
|
1272
|
+
* One sort term for query results, optionally reversed.
|
|
1273
|
+
* Schema: hm://hyper.media/query/sort
|
|
1274
|
+
*/
|
|
1275
|
+
export type HMQuerySort = {
|
|
1276
|
+
/** Sort in descending order. */
|
|
1277
|
+
reverse?: boolean;
|
|
1278
|
+
/** What to sort by: path, title, or a create, update, display or activity time. */
|
|
1279
|
+
term: 'Path' | 'Title' | 'CreateTime' | 'UpdateTime' | 'DisplayTime' | 'ActivityTime';
|
|
1280
|
+
};
|
|
1281
|
+
/**
|
|
1282
|
+
* Query Style
|
|
1283
|
+
* How a Query block presents its results: a card grid, a compact list, or a table.
|
|
1284
|
+
* How a Query block presents its results: `Card`, `List` or `Table`.
|
|
1285
|
+
* Schema: hm://hyper.media/query/style
|
|
1286
|
+
*/
|
|
1287
|
+
export type HMQueryStyle = 'Card' | 'List' | 'Table';
|
|
1288
|
+
/**
|
|
1289
|
+
* Query Table Config
|
|
1290
|
+
* The persisted settings of a Query block's table view: which columns are visible and how wide they are.
|
|
1291
|
+
* The saved table-view settings of a Query block: which columns show and how wide they are.
|
|
1292
|
+
* Schema: hm://hyper.media/query/table-config
|
|
1293
|
+
*/
|
|
1294
|
+
export type HMQueryTableConfig = {
|
|
1295
|
+
/** Column settings in display order. */
|
|
1296
|
+
columns: {
|
|
1297
|
+
/** Built-in column name (such as title or authors) or a custom metadata attribute key. */
|
|
1298
|
+
id: string;
|
|
1299
|
+
/** Whether the column is shown. */
|
|
1300
|
+
visible: boolean;
|
|
1301
|
+
/** Column width in pixels. · minimum: 0 */
|
|
1302
|
+
width?: number;
|
|
1303
|
+
}[];
|
|
1304
|
+
};
|
|
1305
|
+
/**
|
|
1306
|
+
* Ref
|
|
1307
|
+
* A signed claim, like a Git ref, that a path in a space points at the current head Changes of a document, or that the path is deleted or redirects elsewhere.
|
|
1308
|
+
* A signed claim that a path in a space points at a document's current head Changes, or that it is deleted or redirects elsewhere.
|
|
1309
|
+
* Schema: hm://hyper.media/ref
|
|
1310
|
+
*/
|
|
1311
|
+
export type HMRef = HMBlob & {
|
|
1312
|
+
type?: 'Ref';
|
|
1313
|
+
/** Space the path belongs to; omitted when the signer is the space owner. */
|
|
1314
|
+
space?: HMPrincipal;
|
|
1315
|
+
/** Document path within the space, starting with `/`; empty for the home document. */
|
|
1316
|
+
path?: string;
|
|
1317
|
+
/** CID of the genesis Change of the document at this address. */
|
|
1318
|
+
genesisBlob?: HMCid;
|
|
1319
|
+
/** Informational CID of the capability authorizing the signer; the daemon ignores it. */
|
|
1320
|
+
capability?: HMCid;
|
|
1321
|
+
/** CIDs of the document's current head Changes; empty for a tombstone or redirect. */
|
|
1322
|
+
heads: HMCid[];
|
|
1323
|
+
/** Where readers are sent instead, making this Ref a redirect. */
|
|
1324
|
+
redirect?: HMRefRedirectTarget;
|
|
1325
|
+
/** Orders the lives of an address: the highest generation wins; clients use the current time in ms for a new document. */
|
|
1326
|
+
generation?: number;
|
|
1327
|
+
/** Empty for public or `Private`; a private Ref must have a single-segment path. */
|
|
1328
|
+
visibility?: HMVisibility;
|
|
1329
|
+
};
|
|
1330
|
+
/**
|
|
1331
|
+
* Redirect Target
|
|
1332
|
+
* The destination carried by a redirect Ref, a space and path to send readers to, with a republish flag that keeps the content showing under the old address.
|
|
1333
|
+
* The destination of a redirect Ref: the space and path readers are sent to.
|
|
1334
|
+
* Schema: hm://hyper.media/ref/redirect-target
|
|
1335
|
+
*/
|
|
1336
|
+
export type HMRefRedirectTarget = {
|
|
1337
|
+
/** Destination space; omitted when the redirect stays within the same space. */
|
|
1338
|
+
space?: HMPrincipal;
|
|
1339
|
+
/** Destination document path. */
|
|
1340
|
+
path?: string;
|
|
1341
|
+
/** Keep the old address listed, showing the target's content, instead of treating it as moved. */
|
|
1342
|
+
republish?: boolean;
|
|
1343
|
+
};
|
|
1344
|
+
/**
|
|
1345
|
+
* Role
|
|
1346
|
+
* The kind of capability being granted: WRITER may publish under a path, AGENT may act as the issuing account; no other role exists in data.
|
|
1347
|
+
* The kind of authority a capability grants: `WRITER` may publish under a path, `AGENT` may act as the issuing account.
|
|
1348
|
+
* Schema: hm://hyper.media/role
|
|
1349
|
+
*/
|
|
1350
|
+
export type HMRole = 'WRITER' | 'AGENT';
|
|
1351
|
+
/**
|
|
1352
|
+
* Schema
|
|
1353
|
+
* The meta-schema, which is the union of every shape a schema can take and a valid instance of itself, with a guide to schemas in the Seed app and an index of the reference pages.
|
|
1354
|
+
* The meta-schema: the union of every shape a schema can take, itself a valid instance of this type.
|
|
1355
|
+
* Schema: hm://hyper.media/schema
|
|
1356
|
+
*/
|
|
1357
|
+
export type HMSchema = HMSchemaStructSchema | HMSchemaMapSchema | HMSchemaListSchema | HMSchemaScalarSchema | HMSchemaLinkSchema | HMSchemaIncludeSchema | HMSchemaAnyof | HMSchemaVarSchema | HMSchemaLiteralSchema | string | number | boolean | null;
|
|
1358
|
+
/**
|
|
1359
|
+
* Union schema
|
|
1360
|
+
* The variant for a union, which accepts a value that matches any one of the schemas listed under anyOf.
|
|
1361
|
+
* A union schema: a value is valid if it matches any one of the schemas listed under `anyOf`.
|
|
1362
|
+
* Schema: hm://hyper.media/schema/anyof
|
|
1363
|
+
*/
|
|
1364
|
+
export type HMSchemaAnyof = {
|
|
1365
|
+
/** The alternative schemas; a value must match at least one. When every arm is a literal, editors show a dropdown. */
|
|
1366
|
+
anyOf: HMSchema[];
|
|
1367
|
+
/** What the union is for, when it is written inline; a published schema is described by its page. */
|
|
1368
|
+
description?: string;
|
|
1369
|
+
/** Type parameters that make this schema generic, each with its default schema. */
|
|
1370
|
+
params?: {
|
|
1371
|
+
[key: string]: HMSchema;
|
|
1372
|
+
};
|
|
1373
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1374
|
+
name?: string;
|
|
1375
|
+
};
|
|
1376
|
+
/**
|
|
1377
|
+
* Reference Schema
|
|
1378
|
+
* The variant for a reference, which is a bare include or, when it carries refinements, an extension.
|
|
1379
|
+
* A schema that names another schema by URL: a bare include becomes that schema, and added refinements make it an extension.
|
|
1380
|
+
* Schema: hm://hyper.media/schema/include-schema
|
|
1381
|
+
*/
|
|
1382
|
+
export type HMSchemaIncludeSchema = {
|
|
1383
|
+
/** The schema this one names: a schema document's URL (`hm://…` or `ipfs://<cid>`). Naming one of the nine kinds grounds a schema instead (see the kind-rooted variants), so a kind URL does not belong here. The other keys refine what is named. · pattern: "^(?!hm://hyper\\.media/(?:schema/|hypermedia-)?(?:null|boolean|integer|float|string|bytes|list|map|struct|link)$)(?:hm|ipfs)://.+$" */
|
|
1384
|
+
type: string;
|
|
1385
|
+
/** Fields the extension adds to (or overrides in) the base struct, as properties. */
|
|
1386
|
+
properties?: {
|
|
1387
|
+
[key: string]: HMSchemaProperty;
|
|
1388
|
+
};
|
|
1389
|
+
/** Overrides the named schema's `values`: the schema extra keys (open struct) or map values must match. */
|
|
1390
|
+
values?: HMSchema;
|
|
1391
|
+
/** Overrides the named schema's `items`: the schema every list element must match. */
|
|
1392
|
+
items?: HMSchema;
|
|
1393
|
+
/** For a reference-valued string (`format: hm-url` or `format: ipfs-url`): the schema the referenced document or object is expected to conform to — an `hm://` schema-document URL or `ipfs://<cid>`. Advisory: an editor pre-seeds and validates the target against it; a validator does not dereference the reference. */
|
|
1394
|
+
target?: string;
|
|
1395
|
+
/** What the reference is for, when it is written inline; a published schema is described by its page. */
|
|
1396
|
+
description?: string;
|
|
1397
|
+
/** Type parameters that make this schema generic, each with its default schema. */
|
|
1398
|
+
params?: {
|
|
1399
|
+
[key: string]: HMSchema;
|
|
1400
|
+
};
|
|
1401
|
+
/** Applies a generic: binds the named schema's type parameters by name, falling back to their defaults when unbound. */
|
|
1402
|
+
args?: {
|
|
1403
|
+
[key: string]: HMSchema;
|
|
1404
|
+
};
|
|
1405
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1406
|
+
name?: string;
|
|
1407
|
+
};
|
|
1408
|
+
/**
|
|
1409
|
+
* Link schema
|
|
1410
|
+
* The variant for a link (a CID), which can name the type it expects to point at.
|
|
1411
|
+
* A schema for a link: a CID pointing at a separate block, optionally typed by `target`.
|
|
1412
|
+
* Schema: hm://hyper.media/schema/link-schema
|
|
1413
|
+
*/
|
|
1414
|
+
export type HMSchemaLinkSchema = {
|
|
1415
|
+
type: 'hm://hyper.media/link';
|
|
1416
|
+
/** The schema the linked block is expected to conform to. Advisory: a validator does not dereference the link. */
|
|
1417
|
+
target?: string;
|
|
1418
|
+
/** What the link is for, when it is written inline; a published schema is described by its page. */
|
|
1419
|
+
description?: string;
|
|
1420
|
+
/** Type parameters that make this schema generic, each with its default schema. */
|
|
1421
|
+
params?: {
|
|
1422
|
+
[key: string]: HMSchema;
|
|
1423
|
+
};
|
|
1424
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1425
|
+
name?: string;
|
|
1426
|
+
};
|
|
1427
|
+
/**
|
|
1428
|
+
* List schema
|
|
1429
|
+
* The variant for a list value, where items types the elements.
|
|
1430
|
+
* A schema for a list, whose elements match `items` and whose length can be bounded.
|
|
1431
|
+
* Schema: hm://hyper.media/schema/list-schema
|
|
1432
|
+
*/
|
|
1433
|
+
export type HMSchemaListSchema = {
|
|
1434
|
+
type: 'hm://hyper.media/list';
|
|
1435
|
+
/** The schema every element of the list must match. Absent means elements of any kind. */
|
|
1436
|
+
items?: HMSchema;
|
|
1437
|
+
/** Minimum number of elements the list must have. */
|
|
1438
|
+
minItems?: number;
|
|
1439
|
+
/** Maximum number of elements the list may have. */
|
|
1440
|
+
maxItems?: number;
|
|
1441
|
+
/** What the list is for, when it is written inline; a published schema is described by its page. */
|
|
1442
|
+
description?: string;
|
|
1443
|
+
/** Type parameters that make this schema generic, each with its default schema. */
|
|
1444
|
+
params?: {
|
|
1445
|
+
[key: string]: HMSchema;
|
|
1446
|
+
};
|
|
1447
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1448
|
+
name?: string;
|
|
1449
|
+
};
|
|
1450
|
+
/**
|
|
1451
|
+
* Literal Schema
|
|
1452
|
+
* The variant for a literal, which is a schema that accepts exactly one value and can describe what that value means.
|
|
1453
|
+
* The long form of a literal: a schema that accepts exactly one string, integer, boolean or null value, with a description.
|
|
1454
|
+
* Schema: hm://hyper.media/schema/literal-schema
|
|
1455
|
+
*/
|
|
1456
|
+
export type HMSchemaLiteralSchema = {
|
|
1457
|
+
/** The one value this schema accepts: a string, integer, boolean, or null. */
|
|
1458
|
+
value: HMValue;
|
|
1459
|
+
/** What this value means, for people and for the editors that offer it. */
|
|
1460
|
+
description?: string;
|
|
1461
|
+
};
|
|
1462
|
+
/**
|
|
1463
|
+
* Map schema
|
|
1464
|
+
* The variant for a map whose keys are arbitrary and whose values all match the one schema under values, while known fields belong in a struct schema.
|
|
1465
|
+
* A schema for a map with arbitrary keys whose values all match one schema.
|
|
1466
|
+
* Schema: hm://hyper.media/schema/map-schema
|
|
1467
|
+
*/
|
|
1468
|
+
export type HMSchemaMapSchema = {
|
|
1469
|
+
type: 'hm://hyper.media/map';
|
|
1470
|
+
/** The schema every value of the map must match. */
|
|
1471
|
+
values?: HMSchema;
|
|
1472
|
+
/** What the map is for, when it is written inline; a published schema is described by its page. */
|
|
1473
|
+
description?: string;
|
|
1474
|
+
/** Type parameters that make this schema generic, each with its default schema. */
|
|
1475
|
+
params?: {
|
|
1476
|
+
[key: string]: HMSchema;
|
|
1477
|
+
};
|
|
1478
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1479
|
+
name?: string;
|
|
1480
|
+
};
|
|
1481
|
+
/**
|
|
1482
|
+
* Property
|
|
1483
|
+
* One field of a struct, holding its value schema, whether a value must include it, and a description of what it is for.
|
|
1484
|
+
* One field of a struct: the schema its value must match, whether it is required, and what it is for.
|
|
1485
|
+
* Schema: hm://hyper.media/schema/property
|
|
1486
|
+
*/
|
|
1487
|
+
export type HMSchemaProperty = {
|
|
1488
|
+
/** The schema the field's value must match. */
|
|
1489
|
+
value: HMSchema;
|
|
1490
|
+
/** A value of the struct must include this field. Absent means optional. */
|
|
1491
|
+
required?: boolean;
|
|
1492
|
+
/** What the field is for, for people and for the editors that show it. */
|
|
1493
|
+
description?: string;
|
|
1494
|
+
};
|
|
1495
|
+
/**
|
|
1496
|
+
* Scalar schema
|
|
1497
|
+
* The variant for a null, boolean, integer, float, string or bytes value, optionally narrowed by value constraints.
|
|
1498
|
+
* A schema for a null, boolean, integer, float, string or bytes value, optionally narrowed by value constraints.
|
|
1499
|
+
* Schema: hm://hyper.media/schema/scalar-schema
|
|
1500
|
+
*/
|
|
1501
|
+
export type HMSchemaScalarSchema = {
|
|
1502
|
+
/** The scalar kind the value must be: `null`, `boolean`, `integer`, `float`, `string` or `bytes`. */
|
|
1503
|
+
type: 'hm://hyper.media/null' | 'hm://hyper.media/boolean' | 'hm://hyper.media/integer' | 'hm://hyper.media/float' | 'hm://hyper.media/string' | 'hm://hyper.media/bytes';
|
|
1504
|
+
/** Minimum length of a string value, counted in code points. */
|
|
1505
|
+
minLength?: number;
|
|
1506
|
+
/** Maximum length of a string value, counted in code points. */
|
|
1507
|
+
maxLength?: number;
|
|
1508
|
+
/** An unanchored ECMAScript regular expression a string value must match; an uncompilable pattern is ignored. */
|
|
1509
|
+
pattern?: string;
|
|
1510
|
+
/** A semantic hint for editors/renderers — the value is still a plain string. Known: `hm-url` (a Hypermedia document reference), `hm-profile` (an account reference), `ipfs-url` (an ipfs://<cid> reference to a file or DAG-CBOR object), `url` (a URL of any scheme), `date` (an ISO 8601 `YYYY-MM-DD` calendar date), `date-time` (an RFC 3339 instant). */
|
|
1511
|
+
format?: string;
|
|
1512
|
+
/** For a reference-valued string (`format: hm-url` or `format: ipfs-url`): the schema the referenced document or object is expected to conform to — an `hm://` schema-document URL or `ipfs://<cid>`. Advisory: an editor pre-seeds and validates the target against it; a validator does not dereference the reference. */
|
|
1513
|
+
target?: string;
|
|
1514
|
+
/** The smallest number an integer or float value may be (inclusive). */
|
|
1515
|
+
minimum?: number;
|
|
1516
|
+
/** The largest number an integer or float value may be (inclusive). */
|
|
1517
|
+
maximum?: number;
|
|
1518
|
+
/** What the value is for, when it is written inline; a published schema is described by its page. */
|
|
1519
|
+
description?: string;
|
|
1520
|
+
/** Type parameters that make this schema generic, each with its default schema. */
|
|
1521
|
+
params?: {
|
|
1522
|
+
[key: string]: HMSchema;
|
|
1523
|
+
};
|
|
1524
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1525
|
+
name?: string;
|
|
1526
|
+
};
|
|
1527
|
+
/**
|
|
1528
|
+
* Struct schema
|
|
1529
|
+
* The variant for a struct, with known fields under properties and optionally extra keys of one type under values.
|
|
1530
|
+
* A schema for a struct, with known fields under `properties` and optionally extra keys of one type under `values`.
|
|
1531
|
+
* Schema: hm://hyper.media/schema/struct-schema
|
|
1532
|
+
*/
|
|
1533
|
+
export type HMSchemaStructSchema = {
|
|
1534
|
+
type: 'hm://hyper.media/struct';
|
|
1535
|
+
/** The fields by name: each a property with its value schema, whether it is required, and a description. */
|
|
1536
|
+
properties?: {
|
|
1537
|
+
[key: string]: HMSchemaProperty;
|
|
1538
|
+
};
|
|
1539
|
+
/** Opens the struct: keys other than the named fields are allowed and their values must match this schema. */
|
|
1540
|
+
values?: HMSchema;
|
|
1541
|
+
/** What the struct is for, when it is written inline; a published schema is described by its page. */
|
|
1542
|
+
description?: string;
|
|
1543
|
+
/** Type parameters of a generic struct, each with its default schema. */
|
|
1544
|
+
params?: {
|
|
1545
|
+
[key: string]: HMSchema;
|
|
1546
|
+
};
|
|
1547
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1548
|
+
name?: string;
|
|
1549
|
+
};
|
|
1550
|
+
/**
|
|
1551
|
+
* Variable Schema
|
|
1552
|
+
* A type-variable reference, written { "var": "<name>" }, that matches whatever a generic's parameter is bound to.
|
|
1553
|
+
* A type-variable reference inside a generic, matching whatever schema the named parameter is bound to.
|
|
1554
|
+
* Schema: hm://hyper.media/schema/var-schema
|
|
1555
|
+
*/
|
|
1556
|
+
export type HMSchemaVarSchema = {
|
|
1557
|
+
/** The name of the type parameter, declared in an enclosing `params`, whose bound schema this node stands for. */
|
|
1558
|
+
var: string;
|
|
1559
|
+
/** What the type variable stands for, when it is written inline. */
|
|
1560
|
+
description?: string;
|
|
1561
|
+
/** Legacy: a name some published schemas still carry. New schemas are named by their page. */
|
|
1562
|
+
name?: string;
|
|
1563
|
+
};
|
|
1564
|
+
/**
|
|
1565
|
+
* Signature
|
|
1566
|
+
* The 64 raw bytes of an Ed25519 or P-256 signature over a blob's canonical CBOR encoding taken with this very field set to zeros.
|
|
1567
|
+
* The 64 raw bytes of an Ed25519 or P-256 signature over a blob's canonical CBOR, taken with this field zeroed.
|
|
1568
|
+
* Schema: hm://hyper.media/signature
|
|
1569
|
+
*/
|
|
1570
|
+
export type HMSignature = HMBytes;
|
|
1571
|
+
/**
|
|
1572
|
+
* Timestamp
|
|
1573
|
+
* A point in time as an integer of Unix milliseconds, issued by a causal clock when a blob is signed and never checked against wall-clock time on arrival.
|
|
1574
|
+
* A point in time as an integer of Unix milliseconds, claimed by the signer and not checked against wall-clock time.
|
|
1575
|
+
* Schema: hm://hyper.media/timestamp
|
|
1576
|
+
*/
|
|
1577
|
+
export type HMTimestamp = number;
|
|
1578
|
+
/**
|
|
1579
|
+
* URL
|
|
1580
|
+
* A string holding a URL of any scheme, which `format: url` tells an editor to render as a link and to validate as one.
|
|
1581
|
+
* A string holding a URL of any scheme — rendered as a link and validated as one.
|
|
1582
|
+
* Schema: hm://hyper.media/url
|
|
1583
|
+
*/
|
|
1584
|
+
export type HMUrl = string;
|
|
1585
|
+
/**
|
|
1586
|
+
* Value
|
|
1587
|
+
* A metadata or attribute value: a string, an integer, a boolean, or null.
|
|
1588
|
+
* A scalar metadata or attribute value: a string, an integer, a boolean, or null.
|
|
1589
|
+
* Schema: hm://hyper.media/value
|
|
1590
|
+
*/
|
|
1591
|
+
export type HMValue = string | number | boolean | null;
|
|
1592
|
+
/**
|
|
1593
|
+
* Visibility
|
|
1594
|
+
* The visibility of a Ref or Comment, empty for public and "Private" for private, from which every Change and file it links inherits its own visibility.
|
|
1595
|
+
* Who may see a Ref or Comment: empty for public, `Private` for the space owner, its writers and its site only.
|
|
1596
|
+
* Schema: hm://hyper.media/visibility
|
|
1597
|
+
*/
|
|
1598
|
+
export type HMVisibility = '' | 'Private';
|