@seed-hypermedia/client 0.0.118 → 0.0.119
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 +65 -0
- package/dist/apps.mjs +171 -0
- package/dist/auth.mjs +3 -3
- package/dist/auto-link.mjs +3 -3
- package/dist/blobs.mjs +2 -2
- package/dist/blocks-to-markdown.mjs +3 -3
- package/dist/capability.mjs +4 -4
- package/dist/{chunk-JKEM44N2.mjs → chunk-37I7X7G7.mjs} +1 -1
- package/dist/{chunk-4M5R2VFY.mjs → chunk-BFXGJBSN.mjs} +1 -1
- package/dist/{chunk-HXLXTWF3.mjs → chunk-F37OTY5W.mjs} +1 -1
- package/dist/{chunk-2JSUDZLE.mjs → chunk-G6DV3BU4.mjs} +1 -1
- package/dist/{chunk-HNNTGZHW.mjs → chunk-IC3KRDNX.mjs} +2 -2
- package/dist/{chunk-JKSJEGHK.mjs → chunk-J2QF2I3H.mjs} +1 -1
- package/dist/{chunk-24TTS3ME.mjs → chunk-JLSJJMOD.mjs} +2 -2
- package/dist/{chunk-RY2LVH3Z.mjs → chunk-JMP3HYRE.mjs} +3 -3
- package/dist/{chunk-MM6UBHZ3.mjs → chunk-KTOBQK6C.mjs} +17 -2
- package/dist/{chunk-JF67NGZ3.mjs → chunk-MY2L74E7.mjs} +2 -2
- package/dist/{chunk-3ZHRLKFZ.mjs → chunk-P5EQ4NJ7.mjs} +1 -1
- package/dist/{chunk-3DKBM2GC.mjs → chunk-PON3NHRS.mjs} +1 -1
- package/dist/{chunk-RZD7WFAP.mjs → chunk-PTCL6IO7.mjs} +1 -1
- package/dist/{chunk-SBSEYR26.mjs → chunk-PUKRJHZR.mjs} +1 -1
- package/dist/{chunk-24T2PNWV.mjs → chunk-RJ77FJD2.mjs} +1 -1
- package/dist/{chunk-4UVOQIGJ.mjs → chunk-XJ4BKTVL.mjs} +1 -1
- package/dist/client.mjs +2 -2
- package/dist/comment.mjs +2 -2
- package/dist/document-state.d.ts +4 -4
- 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/hmauth.mjs +3 -3
- package/dist/hmblock-to-editorblock.mjs +2 -2
- package/dist/index.mjs +15 -15
- 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/dist/vault-local.mjs +3 -3
- package/dist/vault-merge.mjs +3 -3
- package/dist/vault.mjs +3 -3
- package/package.json +1 -1
- package/dist/{chunk-NBCHK76Q.mjs → chunk-GBSWXJGU.mjs} +3 -3
package/dist/apps.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apps and tools: documents typed `hm://hyper.media/app` and `hm://hyper.media/tool`.
|
|
3
|
+
*
|
|
4
|
+
* An app lists its children (tools and custom HTML pages) as card embeds in its content, and every
|
|
5
|
+
* child lives one path segment under the app. The embeds are the source of truth for which children
|
|
6
|
+
* belong to the app and in what order. Agents, the CLI and the apps' own UI all go through the
|
|
7
|
+
* helpers here, so the "every child is embedded" rule is enforced in one place.
|
|
8
|
+
*/
|
|
9
|
+
import { type DocumentOperation } from './change';
|
|
10
|
+
import type { SeedClient } from './client';
|
|
11
|
+
import type { CollectedBlob } from './file-to-ipfs';
|
|
12
|
+
import { type HMBlockNode, type UnpackedHypermediaId } from './hm-types';
|
|
13
|
+
import type { AnySigner } from './signer';
|
|
14
|
+
export declare const HM_APP_TYPE = "hm://hyper.media/app";
|
|
15
|
+
export declare const HM_TOOL_TYPE = "hm://hyper.media/tool";
|
|
16
|
+
export declare const HM_PAGE_TYPE = "hm://hyper.media/page";
|
|
17
|
+
/** The file a tool's code folder must contain: `export default async function (input) {…}`. */
|
|
18
|
+
export declare const TOOL_ENTRY_FILE = "index.ts";
|
|
19
|
+
/** Starting code for a tool created without any. */
|
|
20
|
+
export declare const TOOL_CODE_TEMPLATE = "export default async function (input) {\n return {}\n}\n";
|
|
21
|
+
/** The kinds of children an app endorses. */
|
|
22
|
+
export type AppChildKind = 'tool' | 'page';
|
|
23
|
+
/** Which app child a document type is, or null for any other type. */
|
|
24
|
+
export declare function appChildKind(type: unknown): AppChildKind | null;
|
|
25
|
+
/** One child an app lists: the embed block that lists it and the child's versionless id. */
|
|
26
|
+
export type AppEmbeddedChild = {
|
|
27
|
+
blockId: string;
|
|
28
|
+
id: UnpackedHypermediaId;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The children an app lists, in content order: its top-level embeds. Only embeds whose target sits
|
|
32
|
+
* directly under the app count, so an app cannot claim someone else's documents as its tools.
|
|
33
|
+
*/
|
|
34
|
+
export declare function appEmbeddedChildren(appId: UnpackedHypermediaId, content: HMBlockNode[] | undefined): AppEmbeddedChild[];
|
|
35
|
+
/** Whether `childId` is exactly one path segment under `appId`, in the same space. */
|
|
36
|
+
export declare function isAppChildId(appId: UnpackedHypermediaId, childId: UnpackedHypermediaId): boolean;
|
|
37
|
+
/** The id of the document one path segment above `id`, or null for a space home. */
|
|
38
|
+
export declare function parentDocumentId(id: UnpackedHypermediaId): UnpackedHypermediaId | null;
|
|
39
|
+
/**
|
|
40
|
+
* The ops that make an app list exactly `children`, in that order. Existing embeds of those
|
|
41
|
+
* children keep their blocks (and ids); other app-child embeds are removed; anything else in the
|
|
42
|
+
* content stays where it is, after the listed children.
|
|
43
|
+
*/
|
|
44
|
+
export declare function appChildrenOps(appId: UnpackedHypermediaId, content: HMBlockNode[] | undefined, children: UnpackedHypermediaId[]): DocumentOperation[];
|
|
45
|
+
/** Ops that append `child` to an app's list, or none when it is already listed. */
|
|
46
|
+
export declare function addAppChildOps(appId: UnpackedHypermediaId, content: HMBlockNode[] | undefined, child: UnpackedHypermediaId): DocumentOperation[];
|
|
47
|
+
/** Ops that drop `child` from an app's list, or none when it is not listed. */
|
|
48
|
+
export declare function removeAppChildOps(appId: UnpackedHypermediaId, content: HMBlockNode[] | undefined, child: UnpackedHypermediaId): DocumentOperation[];
|
|
49
|
+
/**
|
|
50
|
+
* Signs one change with `ops` on top of the document's current heads, plus the Version Ref that
|
|
51
|
+
* makes it the latest version. Returns the blobs to publish (`extraBlobs`, such as a tool's code
|
|
52
|
+
* folder, come last). `capability` is the writer capability when the signer writes into another
|
|
53
|
+
* account's space.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createDocumentUpdateBlobs({ client, signer, id, ops, capability, extraBlobs, }: {
|
|
56
|
+
client: Pick<SeedClient, 'request'>;
|
|
57
|
+
signer: AnySigner;
|
|
58
|
+
id: UnpackedHypermediaId;
|
|
59
|
+
ops: DocumentOperation[];
|
|
60
|
+
capability?: string;
|
|
61
|
+
extraBlobs?: CollectedBlob[];
|
|
62
|
+
}): Promise<{
|
|
63
|
+
blobs: CollectedBlob[];
|
|
64
|
+
targetId: UnpackedHypermediaId;
|
|
65
|
+
}>;
|
package/dist/apps.mjs
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createChange,
|
|
3
|
+
createChangeOps
|
|
4
|
+
} from "./chunk-O5MHN2EO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
createVersionRef
|
|
7
|
+
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
|
+
import {
|
|
9
|
+
resolveEditableDocument
|
|
10
|
+
} from "./chunk-37I7X7G7.mjs";
|
|
11
|
+
import {
|
|
12
|
+
computeReplaceOps,
|
|
13
|
+
createBlocksMap,
|
|
14
|
+
hmBlockNodeToBlockNode,
|
|
15
|
+
toAPIBlockNode
|
|
16
|
+
} from "./chunk-3KLY2B27.mjs";
|
|
17
|
+
import "./chunk-LVAHHQIK.mjs";
|
|
18
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
19
|
+
import {
|
|
20
|
+
hmIdPathToEntityQueryPath,
|
|
21
|
+
packHmId,
|
|
22
|
+
unpackHmId
|
|
23
|
+
} from "./chunk-KTOBQK6C.mjs";
|
|
24
|
+
import "./chunk-AHQWDCHV.mjs";
|
|
25
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
26
|
+
|
|
27
|
+
// src/apps.ts
|
|
28
|
+
import { CID } from "multiformats/cid";
|
|
29
|
+
var HM_APP_TYPE = "hm://hyper.media/app";
|
|
30
|
+
var HM_TOOL_TYPE = "hm://hyper.media/tool";
|
|
31
|
+
var HM_PAGE_TYPE = "hm://hyper.media/page";
|
|
32
|
+
var TOOL_ENTRY_FILE = "index.ts";
|
|
33
|
+
var TOOL_CODE_TEMPLATE = `export default async function (input) {
|
|
34
|
+
return {}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
function appChildKind(type) {
|
|
38
|
+
if (type === HM_TOOL_TYPE) return "tool";
|
|
39
|
+
if (type === HM_PAGE_TYPE) return "page";
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
function appEmbeddedChildren(appId, content) {
|
|
43
|
+
const children = [];
|
|
44
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45
|
+
for (const node of content ?? []) {
|
|
46
|
+
const block = node.block;
|
|
47
|
+
if (block.type !== "Embed" || !block.link || !block.id) continue;
|
|
48
|
+
const id = unpackHmId(block.link);
|
|
49
|
+
if (!id || !isAppChildId(appId, id)) continue;
|
|
50
|
+
const key = packHmId(versionless(id));
|
|
51
|
+
if (seen.has(key)) continue;
|
|
52
|
+
seen.add(key);
|
|
53
|
+
children.push({ blockId: block.id, id: versionless(id) });
|
|
54
|
+
}
|
|
55
|
+
return children;
|
|
56
|
+
}
|
|
57
|
+
function isAppChildId(appId, childId) {
|
|
58
|
+
const appPath = appId.path ?? [];
|
|
59
|
+
const childPath = childId.path ?? [];
|
|
60
|
+
return childId.uid === appId.uid && childPath.length === appPath.length + 1 && appPath.every((segment, index) => childPath[index] === segment);
|
|
61
|
+
}
|
|
62
|
+
function parentDocumentId(id) {
|
|
63
|
+
const path = id.path ?? [];
|
|
64
|
+
if (!path.length) return null;
|
|
65
|
+
const parentPath = path.slice(0, -1);
|
|
66
|
+
return versionless({ ...id, path: parentPath.length ? parentPath : null });
|
|
67
|
+
}
|
|
68
|
+
function appChildrenOps(appId, content, children) {
|
|
69
|
+
const oldNodes = (content ?? []).map((node) => toAPIBlockNode(node));
|
|
70
|
+
const existing = new Map(appEmbeddedChildren(appId, content).map((child) => [packHmId(child.id), child.blockId]));
|
|
71
|
+
const childBlockIds = new Set(existing.values());
|
|
72
|
+
const listed = children.map((child) => {
|
|
73
|
+
const id = versionless(child);
|
|
74
|
+
const blockId = existing.get(packHmId(id)) ?? newBlockId();
|
|
75
|
+
return {
|
|
76
|
+
block: {
|
|
77
|
+
type: "Embed",
|
|
78
|
+
id: blockId,
|
|
79
|
+
text: "",
|
|
80
|
+
annotations: [],
|
|
81
|
+
link: packHmId(id),
|
|
82
|
+
attributes: { view: "Card" }
|
|
83
|
+
},
|
|
84
|
+
children: []
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
const rest = (content ?? []).filter((node) => !childBlockIds.has(node.block.id ?? "")).map((node) => hmBlockNodeToBlockNode(node));
|
|
88
|
+
return computeReplaceOps(createBlocksMap(oldNodes), [...listed, ...rest]);
|
|
89
|
+
}
|
|
90
|
+
function addAppChildOps(appId, content, child) {
|
|
91
|
+
const listed = appEmbeddedChildren(appId, content).map((entry) => entry.id);
|
|
92
|
+
if (listed.some((id) => packHmId(id) === packHmId(versionless(child)))) return [];
|
|
93
|
+
return appChildrenOps(appId, content, [...listed, child]);
|
|
94
|
+
}
|
|
95
|
+
function removeAppChildOps(appId, content, child) {
|
|
96
|
+
const listed = appEmbeddedChildren(appId, content).map((entry) => entry.id);
|
|
97
|
+
const remaining = listed.filter((id) => packHmId(id) !== packHmId(versionless(child)));
|
|
98
|
+
if (remaining.length === listed.length) return [];
|
|
99
|
+
return appChildrenOps(appId, content, remaining);
|
|
100
|
+
}
|
|
101
|
+
async function createDocumentUpdateBlobs({
|
|
102
|
+
client,
|
|
103
|
+
signer,
|
|
104
|
+
id,
|
|
105
|
+
ops,
|
|
106
|
+
capability,
|
|
107
|
+
extraBlobs = []
|
|
108
|
+
}) {
|
|
109
|
+
if (!ops.length) throw new Error("No document changes to publish");
|
|
110
|
+
const base = await resolveEditableDocument(client, id);
|
|
111
|
+
const state = base.state;
|
|
112
|
+
const { unsignedBytes, ts } = createChangeOps({
|
|
113
|
+
ops,
|
|
114
|
+
genesisCid: CID.parse(state.genesis),
|
|
115
|
+
deps: state.heads.map((head) => CID.parse(head)),
|
|
116
|
+
depth: state.headDepth + 1
|
|
117
|
+
});
|
|
118
|
+
const change = await createChange(unsignedBytes, signer);
|
|
119
|
+
const ref = await createVersionRef(
|
|
120
|
+
{
|
|
121
|
+
space: base.targetId.uid,
|
|
122
|
+
path: hmIdPathToEntityQueryPath(base.targetId.path),
|
|
123
|
+
genesis: state.genesis,
|
|
124
|
+
version: change.cid.toString(),
|
|
125
|
+
generation: Number(ts),
|
|
126
|
+
capability
|
|
127
|
+
},
|
|
128
|
+
signer
|
|
129
|
+
);
|
|
130
|
+
return {
|
|
131
|
+
blobs: [
|
|
132
|
+
{ cid: change.cid.toString(), data: new Uint8Array(change.bytes) },
|
|
133
|
+
...ref.blobs.map((blob) => ({ cid: blob.cid, data: blob.data })),
|
|
134
|
+
...extraBlobs
|
|
135
|
+
],
|
|
136
|
+
targetId: base.targetId
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function versionless(id) {
|
|
140
|
+
var _a;
|
|
141
|
+
const path = ((_a = id.path) == null ? void 0 : _a.length) ? id.path : null;
|
|
142
|
+
return {
|
|
143
|
+
...id,
|
|
144
|
+
id: packHmId({ ...id, path, version: null, blockRef: null, blockRange: null, latest: true }),
|
|
145
|
+
path,
|
|
146
|
+
version: null,
|
|
147
|
+
blockRef: null,
|
|
148
|
+
blockRange: null,
|
|
149
|
+
latest: true
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function newBlockId() {
|
|
153
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
154
|
+
const bytes = crypto.getRandomValues(new Uint8Array(8));
|
|
155
|
+
return Array.from(bytes, (byte) => alphabet[byte & 63]).join("");
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
HM_APP_TYPE,
|
|
159
|
+
HM_PAGE_TYPE,
|
|
160
|
+
HM_TOOL_TYPE,
|
|
161
|
+
TOOL_CODE_TEMPLATE,
|
|
162
|
+
TOOL_ENTRY_FILE,
|
|
163
|
+
addAppChildOps,
|
|
164
|
+
appChildKind,
|
|
165
|
+
appChildrenOps,
|
|
166
|
+
appEmbeddedChildren,
|
|
167
|
+
createDocumentUpdateBlobs,
|
|
168
|
+
isAppChildId,
|
|
169
|
+
parentDocumentId,
|
|
170
|
+
removeAppChildOps
|
|
171
|
+
};
|
package/dist/auth.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
parseEmailPrevalidation,
|
|
15
15
|
validateClientId,
|
|
16
16
|
validateRedirectUri
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XJ4BKTVL.mjs";
|
|
18
18
|
import {
|
|
19
19
|
decode,
|
|
20
20
|
encode
|
|
@@ -26,11 +26,11 @@ import {
|
|
|
26
26
|
principalFromString,
|
|
27
27
|
principalToString,
|
|
28
28
|
verify
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-DR3HJ6BV.mjs";
|
|
29
|
+
} from "./chunk-GBSWXJGU.mjs";
|
|
31
30
|
import {
|
|
32
31
|
decode as decode2
|
|
33
32
|
} from "./chunk-3TPCJCVO.mjs";
|
|
33
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
34
34
|
import "./chunk-7P6ASYW6.mjs";
|
|
35
35
|
|
|
36
36
|
// src/auth.ts
|
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-IC3KRDNX.mjs";
|
|
8
8
|
import "./chunk-O5MHN2EO.mjs";
|
|
9
9
|
import "./chunk-PJ2RFT5A.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-37I7X7G7.mjs";
|
|
11
11
|
import "./chunk-LVAHHQIK.mjs";
|
|
12
12
|
import "./chunk-DR3HJ6BV.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-KTOBQK6C.mjs";
|
|
14
14
|
import "./chunk-AHQWDCHV.mjs";
|
|
15
15
|
import "./chunk-7P6ASYW6.mjs";
|
|
16
16
|
export {
|
package/dist/blobs.mjs
CHANGED
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
principalToString,
|
|
23
23
|
sign,
|
|
24
24
|
verify
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-DR3HJ6BV.mjs";
|
|
25
|
+
} from "./chunk-GBSWXJGU.mjs";
|
|
27
26
|
import "./chunk-3TPCJCVO.mjs";
|
|
27
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
28
28
|
import "./chunk-7P6ASYW6.mjs";
|
|
29
29
|
export {
|
|
30
30
|
ED25519_PRINCIPAL_SIZE,
|
|
@@ -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-JLSJJMOD.mjs";
|
|
11
|
+
import "./chunk-P5EQ4NJ7.mjs";
|
|
12
|
+
import "./chunk-KTOBQK6C.mjs";
|
|
13
13
|
import "./chunk-AHQWDCHV.mjs";
|
|
14
14
|
import "./chunk-7P6ASYW6.mjs";
|
|
15
15
|
export {
|
package/dist/capability.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapability,
|
|
3
3
|
resolveCapability
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MY2L74E7.mjs";
|
|
5
5
|
import "./chunk-LVAHHQIK.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-GBSWXJGU.mjs";
|
|
7
|
+
import "./chunk-3TPCJCVO.mjs";
|
|
7
8
|
import "./chunk-DR3HJ6BV.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-KTOBQK6C.mjs";
|
|
9
10
|
import "./chunk-AHQWDCHV.mjs";
|
|
10
|
-
import "./chunk-3TPCJCVO.mjs";
|
|
11
11
|
import "./chunk-7P6ASYW6.mjs";
|
|
12
12
|
export {
|
|
13
13
|
createCapability,
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDocumentState
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-37I7X7G7.mjs";
|
|
11
11
|
import {
|
|
12
12
|
entityQueryPathToHmIdPath,
|
|
13
13
|
packHmId,
|
|
14
14
|
unpackHmId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KTOBQK6C.mjs";
|
|
16
16
|
|
|
17
17
|
// src/auto-link.ts
|
|
18
18
|
import { CID } from "multiformats/cid";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P5EQ4NJ7.mjs";
|
|
4
4
|
import {
|
|
5
5
|
normalizeQuerySort,
|
|
6
6
|
unpackHmId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KTOBQK6C.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-PUKRJHZR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
extractCommentIdFromUrl,
|
|
6
6
|
hmDomainUrlToWebUrl,
|
|
7
7
|
resolveId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P5EQ4NJ7.mjs";
|
|
9
9
|
import {
|
|
10
10
|
unpackHmId
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KTOBQK6C.mjs";
|
|
12
12
|
|
|
13
13
|
// src/resource-read.ts
|
|
14
14
|
async function resolveIdWithClient(rawId, options = {}) {
|
|
@@ -294,12 +294,21 @@ var HMDocumentMetadataSchema = z.object({
|
|
|
294
294
|
* found by querying its documents for this type; nothing else registers an agent with a space.
|
|
295
295
|
*/
|
|
296
296
|
agentServerUrl: z.string().optional(),
|
|
297
|
-
/**
|
|
297
|
+
/**
|
|
298
|
+
* Resource type: hm://hyper.media/page (custom HTML page), hm://hyper.media/app (an app, whose
|
|
299
|
+
* card embeds list its tools and pages) or hm://hyper.media/tool (an app's tool).
|
|
300
|
+
*/
|
|
298
301
|
type: z.string().optional(),
|
|
299
302
|
/** UnixFS folder whose index.html runs as an isolated custom HTML page. */
|
|
300
303
|
html: z.string().optional(),
|
|
301
|
-
/** Published HM struct schema describing
|
|
304
|
+
/** Published HM struct schema describing a page's URL input or a tool's input. */
|
|
302
305
|
inputSchema: z.string().optional(),
|
|
306
|
+
/** Published HM struct schema describing what a tool returns. */
|
|
307
|
+
outputSchema: z.string().optional(),
|
|
308
|
+
/** UnixFS folder whose index.ts default-exports a tool's async function. */
|
|
309
|
+
code: z.string().optional(),
|
|
310
|
+
/** hm:// URL of the app's own page that its Home tab shows. */
|
|
311
|
+
homePage: z.string().optional(),
|
|
303
312
|
layout: z.union([z.literal("Seed/Experimental/Newspaper"), z.literal("")]).optional(),
|
|
304
313
|
displayPublishTime: z.string().optional(),
|
|
305
314
|
displayAuthor: z.string().optional(),
|
|
@@ -339,6 +348,12 @@ var DOCUMENT_ATTRIBUTE_DESCRIPTIONS = {
|
|
|
339
348
|
cover: "Wide cover image shown in headers and cards.",
|
|
340
349
|
siteUrl: "Published website URL for a space.",
|
|
341
350
|
agentServerUrl: "Agents server that hosts the agent this document mounts.",
|
|
351
|
+
type: "Resource type, such as a custom HTML page, an app or a tool.",
|
|
352
|
+
html: "UnixFS folder holding a custom HTML page.",
|
|
353
|
+
inputSchema: "Schema of the input a page or tool takes.",
|
|
354
|
+
outputSchema: "Schema of what a tool returns.",
|
|
355
|
+
code: "UnixFS folder holding a tool\u2019s code, entry point index.ts.",
|
|
356
|
+
homePage: "The app page its Home tab shows.",
|
|
342
357
|
layout: "Legacy space header layout setting.",
|
|
343
358
|
displayPublishTime: "Publication date shown to readers.",
|
|
344
359
|
displayAuthor: "Author byline shown to readers.",
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-LVAHHQIK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createCapability
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GBSWXJGU.mjs";
|
|
7
7
|
import {
|
|
8
8
|
entityQueryPathToHmIdPath,
|
|
9
9
|
packBaseId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KTOBQK6C.mjs";
|
|
11
11
|
|
|
12
12
|
// src/capability.ts
|
|
13
13
|
import { base58btc } from "multiformats/bases/base58";
|
package/dist/client.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient,
|
|
3
3
|
deserializeQueryString
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PUKRJHZR.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-KTOBQK6C.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-J2QF2I3H.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-KTOBQK6C.mjs";
|
|
12
12
|
import "./chunk-AHQWDCHV.mjs";
|
|
13
13
|
import "./chunk-7P6ASYW6.mjs";
|
|
14
14
|
export {
|
package/dist/document-state.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type DocumentState = {
|
|
|
21
21
|
/**
|
|
22
22
|
* Resolves the current document state including head depth.
|
|
23
23
|
*/
|
|
24
|
-
export declare function resolveDocumentState(client: SeedClient, targetId: string): Promise<DocumentState>;
|
|
24
|
+
export declare function resolveDocumentState(client: Pick<SeedClient, 'request'>, targetId: string): Promise<DocumentState>;
|
|
25
25
|
/** A document address resolved through redirects to the document it currently presents. */
|
|
26
26
|
export type FollowedDocument = {
|
|
27
27
|
/** The address that was resolved — where a new Ref should be published to affect this path. */
|
|
@@ -80,7 +80,7 @@ export type FollowedResource = {
|
|
|
80
80
|
* address: the content belongs to `targetId`, and a write to `id` behaves differently from a write
|
|
81
81
|
* to `targetId` (see {@link describeRedirect}). Callers surface `redirects` to the user or agent.
|
|
82
82
|
*/
|
|
83
|
-
export declare function followRedirects(client: SeedClient, id: UnpackedHypermediaId): Promise<FollowedResource>;
|
|
83
|
+
export declare function followRedirects(client: Pick<SeedClient, 'request'>, id: UnpackedHypermediaId): Promise<FollowedResource>;
|
|
84
84
|
/**
|
|
85
85
|
* One plain sentence explaining a followed redirect and what a write to either address does —
|
|
86
86
|
* shared by the CLI and the agents read tool so every surface tells the same story.
|
|
@@ -94,7 +94,7 @@ export declare function describeRedirect(followed: Pick<FollowedResource, 'id' |
|
|
|
94
94
|
* `type: 'redirect'`. Operations on such a path (edit, fork, move, delete) act on the redirect
|
|
95
95
|
* target's document, so this follows the chain (bounded, cycle-safe) to that document.
|
|
96
96
|
*/
|
|
97
|
-
export declare function followToDocument(client: SeedClient, id: UnpackedHypermediaId): Promise<FollowedDocument>;
|
|
97
|
+
export declare function followToDocument(client: Pick<SeedClient, 'request'>, id: UnpackedHypermediaId): Promise<FollowedDocument>;
|
|
98
98
|
/**
|
|
99
99
|
* Resolves an address to the state needed to edit the document there, following redirects.
|
|
100
100
|
*
|
|
@@ -102,4 +102,4 @@ export declare function followToDocument(client: SeedClient, id: UnpackedHyperme
|
|
|
102
102
|
* path has no changes of its own — `ListChanges` returns nothing for it) and publish a Version
|
|
103
103
|
* Ref at the source path with a fresh generation, which supersedes the redirect Ref.
|
|
104
104
|
*/
|
|
105
|
-
export declare function resolveEditableDocument(client: SeedClient, id: UnpackedHypermediaId): Promise<EditableDocumentBase>;
|
|
105
|
+
export declare function resolveEditableDocument(client: Pick<SeedClient, 'request'>, id: UnpackedHypermediaId): Promise<EditableDocumentBase>;
|
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-37I7X7G7.mjs";
|
|
8
|
+
import "./chunk-KTOBQK6C.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-F37OTY5W.mjs";
|
|
5
5
|
import "./chunk-JKKS35IS.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-KTOBQK6C.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-P5EQ4NJ7.mjs";
|
|
7
|
+
import "./chunk-KTOBQK6C.mjs";
|
|
8
8
|
import "./chunk-AHQWDCHV.mjs";
|
|
9
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
10
10
|
export {
|