@seed-hypermedia/client 0.0.120 → 0.0.122
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/apps.d.ts +8 -0
- package/dist/apps.mjs +16 -3
- package/dist/auto-link.mjs +3 -3
- package/dist/blocks-to-markdown.mjs +3 -3
- package/dist/capability.mjs +2 -2
- package/dist/{chunk-7JPEO4TT.mjs → chunk-6GHZWVT6.mjs} +1 -1
- package/dist/{chunk-GJ6YS46E.mjs → chunk-7DPSFFKD.mjs} +1 -1
- package/dist/{chunk-AUSRVZFD.mjs → chunk-7NQUJO5X.mjs} +1 -1
- package/dist/{chunk-QPEJDS7J.mjs → chunk-CBCMOIFJ.mjs} +2 -2
- package/dist/{chunk-I4V4HM2N.mjs → chunk-EDCDFQJC.mjs} +1 -1
- package/dist/{chunk-VKUYLOTP.mjs → chunk-LOAOGLQF.mjs} +10 -1
- package/dist/{chunk-HMNKYPBH.mjs → chunk-LZYLDVJR.mjs} +2 -2
- package/dist/{chunk-2PE27W5B.mjs → chunk-O3QWSQ3Y.mjs} +1 -1
- package/dist/{chunk-ZRMEB4UQ.mjs → chunk-OUBG6JFC.mjs} +3 -3
- package/dist/{chunk-GWTLB7T3.mjs → chunk-QH6OHO4E.mjs} +1 -1
- package/dist/{chunk-UFGIG6N3.mjs → chunk-QIZO45NU.mjs} +1 -1
- package/dist/{chunk-VDVSVU2L.mjs → chunk-QTPHQIZJ.mjs} +1 -1
- package/dist/{chunk-MKFVGDC7.mjs → chunk-UCISXEJ7.mjs} +1 -1
- package/dist/{chunk-RJNFOKDJ.mjs → chunk-XMDF4NIR.mjs} +1 -1
- package/dist/client.mjs +2 -2
- package/dist/comment.mjs +2 -2
- 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 +198 -0
- package/dist/hm-types.mjs +1 -1
- package/dist/hmblock-to-editorblock.mjs +2 -2
- package/dist/index.mjs +13 -13
- package/dist/pdf-to-blocks.mjs +3 -3
- package/dist/resource-read.mjs +4 -4
- package/dist/schema-resolve.mjs +2 -2
- package/dist/schema-subtypes.mjs +2 -2
- package/dist/tei-to-blocks.mjs +2 -2
- package/dist/unicode.mjs +1 -1
- package/package.json +1 -1
package/dist/apps.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ import type { AnySigner } from './signer';
|
|
|
14
14
|
export declare const HM_APP_TYPE = "hm://hyper.media/app";
|
|
15
15
|
export declare const HM_TOOL_TYPE = "hm://hyper.media/tool";
|
|
16
16
|
export declare const HM_PAGE_TYPE = "hm://hyper.media/page";
|
|
17
|
+
export declare const HM_AGENT_TYPE = "hm://hyper.media/agent";
|
|
18
|
+
/**
|
|
19
|
+
* Documents that host tools and pages: apps and agents (the two are converging into one concept).
|
|
20
|
+
* Both list their children as card embeds and run their tools the same way.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isToolHostType(type: unknown): boolean;
|
|
17
23
|
/** The file a tool's code folder must contain: `export default async function (input) {…}`. */
|
|
18
24
|
export declare const TOOL_ENTRY_FILE = "index.ts";
|
|
19
25
|
/** Starting code for a tool created without any. */
|
|
@@ -42,6 +48,8 @@ export declare function parentDocumentId(id: UnpackedHypermediaId): UnpackedHype
|
|
|
42
48
|
* content stays where it is, after the listed children.
|
|
43
49
|
*/
|
|
44
50
|
export declare function appChildrenOps(appId: UnpackedHypermediaId, content: HMBlockNode[] | undefined, children: UnpackedHypermediaId[]): DocumentOperation[];
|
|
51
|
+
/** Ops that turn a document body from `before` into `after` (block ids kept where they match). */
|
|
52
|
+
export declare function replaceContentOps(before: HMBlockNode[] | undefined, after: HMBlockNode[]): DocumentOperation[];
|
|
45
53
|
/** Ops that append `child` to an app's list, or none when it is already listed. */
|
|
46
54
|
export declare function addAppChildOps(appId: UnpackedHypermediaId, content: HMBlockNode[] | undefined, child: UnpackedHypermediaId): DocumentOperation[];
|
|
47
55
|
/** Ops that drop `child` from an app's list, or none when it is not listed. */
|
package/dist/apps.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveEditableDocument
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QTPHQIZJ.mjs";
|
|
11
11
|
import {
|
|
12
12
|
computeReplaceOps,
|
|
13
13
|
createBlocksMap,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
hmIdPathToEntityQueryPath,
|
|
21
21
|
packHmId,
|
|
22
22
|
unpackHmId
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LOAOGLQF.mjs";
|
|
24
24
|
import "./chunk-AHQWDCHV.mjs";
|
|
25
25
|
import "./chunk-7P6ASYW6.mjs";
|
|
26
26
|
|
|
@@ -29,6 +29,10 @@ import { CID } from "multiformats/cid";
|
|
|
29
29
|
var HM_APP_TYPE = "hm://hyper.media/app";
|
|
30
30
|
var HM_TOOL_TYPE = "hm://hyper.media/tool";
|
|
31
31
|
var HM_PAGE_TYPE = "hm://hyper.media/page";
|
|
32
|
+
var HM_AGENT_TYPE = "hm://hyper.media/agent";
|
|
33
|
+
function isToolHostType(type) {
|
|
34
|
+
return type === HM_APP_TYPE || type === HM_AGENT_TYPE;
|
|
35
|
+
}
|
|
32
36
|
var TOOL_ENTRY_FILE = "index.ts";
|
|
33
37
|
var TOOL_CODE_TEMPLATE = `export default async function (input) {
|
|
34
38
|
return {}
|
|
@@ -87,6 +91,12 @@ function appChildrenOps(appId, content, children) {
|
|
|
87
91
|
const rest = (content ?? []).filter((node) => !childBlockIds.has(node.block.id ?? "")).map((node) => hmBlockNodeToBlockNode(node));
|
|
88
92
|
return computeReplaceOps(createBlocksMap(oldNodes), [...listed, ...rest]);
|
|
89
93
|
}
|
|
94
|
+
function replaceContentOps(before, after) {
|
|
95
|
+
return computeReplaceOps(
|
|
96
|
+
createBlocksMap((before ?? []).map((node) => toAPIBlockNode(node))),
|
|
97
|
+
after.map((node) => hmBlockNodeToBlockNode(node))
|
|
98
|
+
);
|
|
99
|
+
}
|
|
90
100
|
function addAppChildOps(appId, content, child) {
|
|
91
101
|
const listed = appEmbeddedChildren(appId, content).map((entry) => entry.id);
|
|
92
102
|
if (listed.some((id) => packHmId(id) === packHmId(versionless(child)))) return [];
|
|
@@ -155,6 +165,7 @@ function newBlockId() {
|
|
|
155
165
|
return Array.from(bytes, (byte) => alphabet[byte & 63]).join("");
|
|
156
166
|
}
|
|
157
167
|
export {
|
|
168
|
+
HM_AGENT_TYPE,
|
|
158
169
|
HM_APP_TYPE,
|
|
159
170
|
HM_PAGE_TYPE,
|
|
160
171
|
HM_TOOL_TYPE,
|
|
@@ -166,6 +177,8 @@ export {
|
|
|
166
177
|
appEmbeddedChildren,
|
|
167
178
|
createDocumentUpdateBlobs,
|
|
168
179
|
isAppChildId,
|
|
180
|
+
isToolHostType,
|
|
169
181
|
parentDocumentId,
|
|
170
|
-
removeAppChildOps
|
|
182
|
+
removeAppChildOps,
|
|
183
|
+
replaceContentOps
|
|
171
184
|
};
|
package/dist/auto-link.mjs
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
documentContainsLinkToChild,
|
|
5
5
|
documentHasSelfQuery,
|
|
6
6
|
shouldAutoLinkParent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CBCMOIFJ.mjs";
|
|
8
8
|
import "./chunk-O5MHN2EO.mjs";
|
|
9
9
|
import "./chunk-PJ2RFT5A.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-QTPHQIZJ.mjs";
|
|
11
11
|
import "./chunk-LVAHHQIK.mjs";
|
|
12
12
|
import "./chunk-DR3HJ6BV.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
14
14
|
import "./chunk-AHQWDCHV.mjs";
|
|
15
15
|
import "./chunk-7P6ASYW6.mjs";
|
|
16
16
|
export {
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
emitFrontmatter,
|
|
8
8
|
parseDraftFilename,
|
|
9
9
|
slugify
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-LZYLDVJR.mjs";
|
|
11
|
+
import "./chunk-XMDF4NIR.mjs";
|
|
12
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
13
13
|
import "./chunk-AHQWDCHV.mjs";
|
|
14
14
|
import "./chunk-7P6ASYW6.mjs";
|
|
15
15
|
export {
|
package/dist/capability.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapability,
|
|
3
3
|
resolveCapability
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QH6OHO4E.mjs";
|
|
5
5
|
import "./chunk-LVAHHQIK.mjs";
|
|
6
6
|
import "./chunk-GBSWXJGU.mjs";
|
|
7
7
|
import "./chunk-3TPCJCVO.mjs";
|
|
8
8
|
import "./chunk-DR3HJ6BV.mjs";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
10
10
|
import "./chunk-AHQWDCHV.mjs";
|
|
11
11
|
import "./chunk-7P6ASYW6.mjs";
|
|
12
12
|
export {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDocumentState
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QTPHQIZJ.mjs";
|
|
11
11
|
import {
|
|
12
12
|
entityQueryPathToHmIdPath,
|
|
13
13
|
packHmId,
|
|
14
14
|
unpackHmId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LOAOGLQF.mjs";
|
|
16
16
|
|
|
17
17
|
// src/auto-link.ts
|
|
18
18
|
import { CID } from "multiformats/cid";
|
|
@@ -310,6 +310,12 @@ var HMDocumentMetadataSchema = z.object({
|
|
|
310
310
|
code: z.string().optional(),
|
|
311
311
|
/** hm:// URL of the app's own page that its Home tab shows. */
|
|
312
312
|
homePage: z.string().optional(),
|
|
313
|
+
/** Published HM struct schema of an app's public config (readable by anyone who can read the app). */
|
|
314
|
+
publicConfigSchema: z.string().optional(),
|
|
315
|
+
/** Published HM struct schema of an app's private config, which the server running the app keeps. */
|
|
316
|
+
privateConfigSchema: z.string().optional(),
|
|
317
|
+
/** An app's public config values, shaped by its publicConfigSchema. */
|
|
318
|
+
publicConfig: z.record(z.string(), z.unknown()).optional(),
|
|
313
319
|
layout: z.union([z.literal("Seed/Experimental/Newspaper"), z.literal("")]).optional(),
|
|
314
320
|
displayPublishTime: z.string().optional(),
|
|
315
321
|
displayAuthor: z.string().optional(),
|
|
@@ -348,7 +354,7 @@ var DOCUMENT_ATTRIBUTE_DESCRIPTIONS = {
|
|
|
348
354
|
thumbnail: "Deprecated image field kept for older documents.",
|
|
349
355
|
cover: "Wide cover image shown in headers and cards.",
|
|
350
356
|
siteUrl: "Published website URL for a space.",
|
|
351
|
-
appEnvironmentUrl: "App environment a space is bound to, on its home document
|
|
357
|
+
appEnvironmentUrl: "App environment a space is bound to, on its home document (read before agentServerUrl), or the one an app document was created for.",
|
|
352
358
|
agentServerUrl: "App environment that hosts the agent this document mounts.",
|
|
353
359
|
type: "Resource type, such as a custom HTML page, an app or a tool.",
|
|
354
360
|
html: "UnixFS folder holding a custom HTML page.",
|
|
@@ -356,6 +362,9 @@ var DOCUMENT_ATTRIBUTE_DESCRIPTIONS = {
|
|
|
356
362
|
outputSchema: "Schema of what a tool returns.",
|
|
357
363
|
code: "UnixFS folder holding a tool\u2019s code, entry point index.ts.",
|
|
358
364
|
homePage: "The app page its Home tab shows.",
|
|
365
|
+
publicConfigSchema: "Schema of an app\u2019s public config.",
|
|
366
|
+
privateConfigSchema: "Schema of an app\u2019s private config, kept by the server running it.",
|
|
367
|
+
publicConfig: "An app\u2019s public config values.",
|
|
359
368
|
layout: "Legacy space header layout setting.",
|
|
360
369
|
displayPublishTime: "Publication date shown to readers.",
|
|
361
370
|
displayAuthor: "Author byline shown to readers.",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XMDF4NIR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
normalizeQuerySort,
|
|
6
6
|
unpackHmId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LOAOGLQF.mjs";
|
|
8
8
|
|
|
9
9
|
// src/blocks-to-markdown.ts
|
|
10
10
|
import { stringify as stringifyYaml } from "yaml";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EDCDFQJC.mjs";
|
|
4
4
|
import {
|
|
5
5
|
extractCommentIdFromUrl,
|
|
6
6
|
hmDomainUrlToWebUrl,
|
|
7
7
|
resolveId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XMDF4NIR.mjs";
|
|
9
9
|
import {
|
|
10
10
|
unpackHmId
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LOAOGLQF.mjs";
|
|
12
12
|
|
|
13
13
|
// src/resource-read.ts
|
|
14
14
|
async function resolveIdWithClient(rawId, options = {}) {
|
package/dist/client.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient,
|
|
3
3
|
deserializeQueryString
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EDCDFQJC.mjs";
|
|
5
5
|
import "./chunk-CBELM7KX.mjs";
|
|
6
6
|
import "./chunk-O5MHN2EO.mjs";
|
|
7
7
|
import "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import "./chunk-LVAHHQIK.mjs";
|
|
9
9
|
import "./chunk-DR3HJ6BV.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
11
11
|
import "./chunk-AHQWDCHV.mjs";
|
|
12
12
|
import "./chunk-7P6ASYW6.mjs";
|
|
13
13
|
export {
|
package/dist/comment.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
deleteComment,
|
|
5
5
|
trimTrailingEmptyBlocks,
|
|
6
6
|
updateComment
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-O3QWSQ3Y.mjs";
|
|
8
8
|
import "./chunk-JKKS35IS.mjs";
|
|
9
9
|
import "./chunk-LVAHHQIK.mjs";
|
|
10
10
|
import "./chunk-DR3HJ6BV.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
12
12
|
import "./chunk-AHQWDCHV.mjs";
|
|
13
13
|
import "./chunk-7P6ASYW6.mjs";
|
|
14
14
|
export {
|
package/dist/document-state.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
followToDocument,
|
|
5
5
|
resolveDocumentState,
|
|
6
6
|
resolveEditableDocument
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-QTPHQIZJ.mjs";
|
|
8
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
9
9
|
import "./chunk-AHQWDCHV.mjs";
|
|
10
10
|
import "./chunk-7P6ASYW6.mjs";
|
|
11
11
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
editorBlockToHMBlock,
|
|
3
3
|
editorBlocksToHMBlockNodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UCISXEJ7.mjs";
|
|
5
5
|
import "./chunk-JKKS35IS.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
7
7
|
import "./chunk-AHQWDCHV.mjs";
|
|
8
8
|
import "./chunk-7P6ASYW6.mjs";
|
|
9
9
|
export {
|
package/dist/hm-resolver.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
hmDomainUrlToWebUrl,
|
|
4
4
|
resolveHypermediaUrl,
|
|
5
5
|
resolveId
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-XMDF4NIR.mjs";
|
|
7
|
+
import "./chunk-LOAOGLQF.mjs";
|
|
8
8
|
import "./chunk-AHQWDCHV.mjs";
|
|
9
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
10
10
|
export {
|