@seed-hypermedia/client 0.0.90 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/auto-link.mjs +3 -3
  2. package/dist/blocks-to-markdown.mjs +2 -2
  3. package/dist/capability.mjs +2 -2
  4. package/dist/{chunk-T7WF36LU.mjs → chunk-7RJYOV4D.mjs} +1 -1
  5. package/dist/{chunk-ZNV6NTUU.mjs → chunk-BRMAKS6Z.mjs} +1 -1
  6. package/dist/{chunk-XXUI3VKA.mjs → chunk-EB45YSE7.mjs} +1 -1
  7. package/dist/{chunk-Z72PGJKG.mjs → chunk-HEATDM6O.mjs} +1 -1
  8. package/dist/{chunk-W7AGZEC2.mjs → chunk-IB26JMU5.mjs} +1 -1
  9. package/dist/{chunk-4HP5N4I7.mjs → chunk-IJOMB2VD.mjs} +3 -3
  10. package/dist/{chunk-HNQDRHGQ.mjs → chunk-IO44LDKK.mjs} +2 -2
  11. package/dist/{chunk-Z2S7TL5U.mjs → chunk-J6LPZ3QP.mjs} +1 -1
  12. package/dist/{chunk-RRXP7SCF.mjs → chunk-J6N6AF3R.mjs} +1 -1
  13. package/dist/{chunk-UTZ42CJC.mjs → chunk-JOFKLKIC.mjs} +1 -1
  14. package/dist/chunk-JSNDXUPG.mjs +407 -0
  15. package/dist/{chunk-JODNNMBZ.mjs → chunk-M6GKXROC.mjs} +2 -2
  16. package/dist/{chunk-VNZHLLJE.mjs → chunk-MK35Y35R.mjs} +148 -2
  17. package/dist/{chunk-XB6E7EVC.mjs → chunk-QVRJGK77.mjs} +1 -1
  18. package/dist/chunk-RWKSRJA3.mjs +230 -0
  19. package/dist/chunk-VWSAFDOL.mjs +110 -0
  20. package/dist/{chunk-UFLGAJWJ.mjs → chunk-WY7T2TES.mjs} +3 -3
  21. package/dist/chunk-ZWKMAGDU.mjs +10 -0
  22. package/dist/client.mjs +2 -2
  23. package/dist/comment.mjs +2 -2
  24. package/dist/dag-json.d.ts +52 -0
  25. package/dist/dag-json.mjs +23 -0
  26. package/dist/document-state.mjs +2 -2
  27. package/dist/editorblock-to-hmblock.mjs +2 -2
  28. package/dist/explore-query.d.ts +112 -0
  29. package/dist/explore-query.mjs +455 -0
  30. package/dist/hm-resolver.mjs +2 -2
  31. package/dist/hm-types.d.ts +2953 -0
  32. package/dist/hm-types.mjs +33 -1
  33. package/dist/hmblock-to-editorblock.mjs +2 -2
  34. package/dist/index.mjs +27 -27
  35. package/dist/markdown-to-blocks.mjs +1 -1
  36. package/dist/pdf-to-blocks.mjs +3 -3
  37. package/dist/resource-read.mjs +4 -4
  38. package/dist/schema-engine.d.ts +127 -0
  39. package/dist/schema-engine.mjs +83 -0
  40. package/dist/schema-registry.generated.d.ts +8 -0
  41. package/dist/schema-registry.generated.mjs +11 -0
  42. package/dist/schema-resolve.d.ts +135 -0
  43. package/dist/schema-resolve.mjs +45 -0
  44. package/dist/schema-subtypes.d.ts +36 -0
  45. package/dist/schema-subtypes.mjs +94 -0
  46. package/dist/schema-types.generated.d.ts +1598 -0
  47. package/dist/schema-types.generated.mjs +0 -0
  48. package/dist/signed-blob.d.ts +63 -0
  49. package/dist/signed-blob.mjs +123 -0
  50. package/dist/tei-to-blocks.mjs +2 -2
  51. package/dist/unicode.mjs +1 -1
  52. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ import {
2
+ bareCid,
3
+ blobSchemaRef,
4
+ checkDocumentSchema,
5
+ checkSchemaDefinition,
6
+ classifyRef,
7
+ documentMetadataSchema,
8
+ documentUrlOf,
9
+ effectiveSchemaRef,
10
+ externalSchemaRefs,
11
+ fetchSchemaBlob,
12
+ hydrateSchemaRegistry,
13
+ isFixedLiteral,
14
+ isPlainMap,
15
+ loadSchemaRef,
16
+ metadataSchemaOf,
17
+ resolveSchemaRef,
18
+ schemaDefinitionCid,
19
+ withoutSchemaLink
20
+ } from "./chunk-RWKSRJA3.mjs";
21
+ import "./chunk-JSNDXUPG.mjs";
22
+ import "./chunk-ZWKMAGDU.mjs";
23
+ import "./chunk-VWSAFDOL.mjs";
24
+ import "./chunk-MK35Y35R.mjs";
25
+ import "./chunk-7P6ASYW6.mjs";
26
+ export {
27
+ bareCid,
28
+ blobSchemaRef,
29
+ checkDocumentSchema,
30
+ checkSchemaDefinition,
31
+ classifyRef,
32
+ documentMetadataSchema,
33
+ documentUrlOf,
34
+ effectiveSchemaRef,
35
+ externalSchemaRefs,
36
+ fetchSchemaBlob,
37
+ hydrateSchemaRegistry,
38
+ isFixedLiteral,
39
+ isPlainMap,
40
+ loadSchemaRef,
41
+ metadataSchemaOf,
42
+ resolveSchemaRef,
43
+ schemaDefinitionCid,
44
+ withoutSchemaLink
45
+ };
@@ -0,0 +1,36 @@
1
+ import { type HypermediaSchema } from './schema-engine';
2
+ /**
3
+ * One key per schema, whatever spelling names it: a library name (`hm://hyper.media/x`, a legacy
4
+ * authority, or its published CID), a raw blob CID, or a canonical document URL (any version,
5
+ * gateway or `hm://` form). Null for a value that names no schema.
6
+ */
7
+ export declare function schemaRefKey(ref: string | null | undefined): string | null;
8
+ /**
9
+ * The schema this schema extends or includes: its `type` when that names another schema rather
10
+ * than a kind. A union, a literal or a kind-grounded node has no parent.
11
+ */
12
+ export declare function extensionParentRef(schema: HypermediaSchema | undefined): string | null;
13
+ /** A schema the closure may include: every spelling that names it, and what it extends. */
14
+ export type SchemaCandidate = {
15
+ /** Every reference string that names this schema (document URL, `ipfs://` CID, library URL). */
16
+ refs: string[];
17
+ /** The reference this schema extends or includes, if any. */
18
+ parent: string | null;
19
+ };
20
+ /** The bundled library as candidates: each schema under its library URL and published CID. */
21
+ export declare function libraryCandidates(): SchemaCandidate[];
22
+ export type SubtypeClosure = {
23
+ /** Normalized keys (`schemaRefKey`) of every schema in the closure. */
24
+ keys: Set<string>;
25
+ /** Every spelling of every schema in the closure — what a stored `attributesSchema` may equal. */
26
+ refs: string[];
27
+ };
28
+ /**
29
+ * The target plus every candidate whose extension chain reaches it, with every spelling of each
30
+ * collected. Candidates that merely re-spell a member (the target's own document and blob, say)
31
+ * contribute their spellings too. Cycles and unresolvable parents are harmless: the loop only ever
32
+ * adds, and stops when a pass adds nothing.
33
+ */
34
+ export declare function closeOverSubtypes(target: string, candidates: SchemaCandidate[]): SubtypeClosure;
35
+ /** Whether a document's effective attributes schema reference lies in the closure. */
36
+ export declare function inClosure(closure: SubtypeClosure | undefined, ref: string | null | undefined): boolean;
@@ -0,0 +1,94 @@
1
+ import {
2
+ classifyRef
3
+ } from "./chunk-RWKSRJA3.mjs";
4
+ import {
5
+ kindOf,
6
+ nameForCid,
7
+ nameToUrl,
8
+ schemaCid
9
+ } from "./chunk-JSNDXUPG.mjs";
10
+ import {
11
+ HM_SCHEMAS
12
+ } from "./chunk-ZWKMAGDU.mjs";
13
+ import "./chunk-VWSAFDOL.mjs";
14
+ import {
15
+ unpackHmId
16
+ } from "./chunk-MK35Y35R.mjs";
17
+ import "./chunk-7P6ASYW6.mjs";
18
+
19
+ // src/schema-subtypes.ts
20
+ function schemaRefKey(ref) {
21
+ var _a;
22
+ const cls = classifyRef(ref);
23
+ switch (cls.kind) {
24
+ case "none":
25
+ return null;
26
+ case "hm-bundled":
27
+ return `lib:${cls.name}`;
28
+ case "cid": {
29
+ const name = nameForCid(cls.cid);
30
+ return name ? `lib:${name}` : `cid:${cls.cid}`;
31
+ }
32
+ case "hm-doc": {
33
+ const id = unpackHmId(cls.url);
34
+ return id ? `hm://${id.uid}${((_a = id.path) == null ? void 0 : _a.length) ? `/${id.path.join("/")}` : ""}` : cls.url;
35
+ }
36
+ }
37
+ }
38
+ function extensionParentRef(schema) {
39
+ if (!schema || typeof schema !== "object" || Array.isArray(schema)) return null;
40
+ const type = schema.type;
41
+ if (typeof type !== "string" || !type) return null;
42
+ return kindOf(type) === type ? type : null;
43
+ }
44
+ function libraryCandidates() {
45
+ return Object.entries(HM_SCHEMAS).map(([name, schema]) => {
46
+ const cid = schemaCid(name);
47
+ const url = nameToUrl(name);
48
+ return {
49
+ refs: [...url ? [url] : [], ...cid ? [`ipfs://${cid}`] : []],
50
+ parent: extensionParentRef(schema)
51
+ };
52
+ });
53
+ }
54
+ function closeOverSubtypes(target, candidates) {
55
+ const targetKey = schemaRefKey(target);
56
+ const keys = /* @__PURE__ */ new Set();
57
+ const refs = [];
58
+ const add = (ref, key) => {
59
+ keys.add(key);
60
+ if (!refs.includes(ref)) refs.push(ref);
61
+ };
62
+ if (!targetKey) return { keys, refs };
63
+ add(target, targetKey);
64
+ const keyed = candidates.map((candidate) => ({
65
+ refs: candidate.refs.map((ref) => [ref, schemaRefKey(ref)]).filter((pair) => !!pair[1]),
66
+ parentKey: candidate.parent ? schemaRefKey(candidate.parent) : null
67
+ })).filter((candidate) => candidate.refs.length > 0);
68
+ let grew = true;
69
+ while (grew) {
70
+ grew = false;
71
+ for (const candidate of keyed) {
72
+ const known = candidate.refs.some(([, key]) => keys.has(key));
73
+ const inherits = !!candidate.parentKey && keys.has(candidate.parentKey);
74
+ if (!known && !inherits) continue;
75
+ for (const [ref, key] of candidate.refs) {
76
+ if (keys.has(key) && refs.includes(ref)) continue;
77
+ add(ref, key);
78
+ grew = true;
79
+ }
80
+ }
81
+ }
82
+ return { keys, refs };
83
+ }
84
+ function inClosure(closure, ref) {
85
+ const key = schemaRefKey(ref);
86
+ return !!closure && !!key && closure.keys.has(key);
87
+ }
88
+ export {
89
+ closeOverSubtypes,
90
+ extensionParentRef,
91
+ inClosure,
92
+ libraryCandidates,
93
+ schemaRefKey
94
+ };