@superbee/core 0.2.0-pre.43 → 0.2.0-pre.44

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.
@@ -0,0 +1,38 @@
1
+ import type { ConceptId, Link, Version } from "./types.js";
2
+ /** Derived index generation. Advance when parsing or grouping changes the stored occurrences. */
3
+ export declare const RELATIONSHIP_PARSER_VERSION = "links/v2";
4
+ export interface RelationshipPosition {
5
+ direction: "incoming" | "outgoing";
6
+ documentId: ConceptId;
7
+ labelKey: Version;
8
+ }
9
+ /** A label may be bounded for presentation. Use labelKey from the full authored label to seek. */
10
+ export type IndexedRelationshipPage = {
11
+ status: "uninstalled" | "pending" | "not_found";
12
+ } | {
13
+ status: "ready";
14
+ rows: (RelationshipPosition & {
15
+ label: string;
16
+ title: string | null;
17
+ })[];
18
+ more: boolean;
19
+ };
20
+ /**
21
+ * Page the relationships of a document in an already selected bundle. Exclude self-links and
22
+ * absent endpoints. Return one row per direction, neighbor and full label, ordered by
23
+ * compareRelationshipPositions, starting strictly after the supplied position. The adapter
24
+ * reports missing or incomplete index state before returning any partial rows.
25
+ */
26
+ export type RelationshipPageReader = (documentId: ConceptId, limit: number, after?: RelationshipPosition) => Promise<IndexedRelationshipPage>;
27
+ /** Match UTF-8 binary ordering for canonical document IDs, including supplementary characters. */
28
+ export declare function compareRelationshipPositions(a: RelationshipPosition, b: RelationshipPosition): number;
29
+ interface RelationshipOccurrenceGroup {
30
+ target: ConceptId;
31
+ label: string;
32
+ labelKey: Version;
33
+ occurrences: [ordinal: number, href: string][];
34
+ }
35
+ /** Group one document's local parser output while keeping each authored occurrence for a graph read. */
36
+ export declare function groupRelationshipOccurrences(links: readonly Pick<Link, "to" | "text" | "href">[]): RelationshipOccurrenceGroup[];
37
+ export {};
38
+ //# sourceMappingURL=relationships.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../src/relationships.ts"],"names":[],"mappings":"AAE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1,23 @@
1
+ import { compareCodePoints } from "./code-point-order.js";
2
+ import { compareCodeUnits } from "./code-unit-order.js";
3
+ import { versionOfBytes } from "./versioning.js";
4
+ /** Derived index generation. Advance when parsing or grouping changes the stored occurrences. */
5
+ export const RELATIONSHIP_PARSER_VERSION = "links/v2";
6
+ /** Match UTF-8 binary ordering for canonical document IDs, including supplementary characters. */
7
+ export function compareRelationshipPositions(a, b) {
8
+ return compareCodeUnits(a.direction, b.direction) ||
9
+ compareCodePoints(a.documentId, b.documentId) ||
10
+ compareCodeUnits(a.labelKey, b.labelKey);
11
+ }
12
+ /** Group one document's local parser output while keeping each authored occurrence for a graph read. */
13
+ export function groupRelationshipOccurrences(links) {
14
+ const groups = new Map();
15
+ for (const [ordinal, { to, text, href }] of links.entries()) {
16
+ const key = JSON.stringify([to, text]);
17
+ const group = groups.get(key) ?? { target: to, label: text, labelKey: versionOfBytes(text), occurrences: [] };
18
+ groups.set(key, group);
19
+ group.occurrences.push([ordinal, href]);
20
+ }
21
+ return [...groups.values()];
22
+ }
23
+ //# sourceMappingURL=relationships.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationships.js","sourceRoot":"","sources":["../src/relationships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,iGAAiG;AACjG,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC;AAyBtD,kGAAkG;AAClG,MAAM,UAAU,4BAA4B,CAAC,CAAuB,EAAE,CAAuB;IAC3F,OAAO,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;QAC/C,iBAAiB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC;QAC7C,gBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC;AASD,wGAAwG;AACxG,MAAM,UAAU,4BAA4B,CAC1C,KAAoD;IAEpD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuC,CAAC;IAC9D,KAAK,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QAC9G,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC"}
@@ -14,7 +14,7 @@ export interface RestJsonCursor {
14
14
  }
15
15
  export declare const restJsonProfile: SourceProfile<ConnectorSource, RestJsonCursor>;
16
16
  /** Contract-1 composition helpers for explicitly trusted standalone source plugins. */
17
- export declare const SOURCE_PLUGIN_CORE_VERSION = "0.2.0-pre.43";
17
+ export declare const SOURCE_PLUGIN_CORE_VERSION = "0.2.0-pre.44";
18
18
  export interface SourcePluginHelpers {
19
19
  readonly restJsonProfile: typeof restJsonProfile;
20
20
  readonly nextLinkTarget: typeof nextLinkTarget;
@@ -196,7 +196,7 @@ export const restJsonProfile = Object.freeze({
196
196
  },
197
197
  });
198
198
  /** Contract-1 composition helpers for explicitly trusted standalone source plugins. */
199
- export const SOURCE_PLUGIN_CORE_VERSION = "0.2.0-pre.43";
199
+ export const SOURCE_PLUGIN_CORE_VERSION = "0.2.0-pre.44";
200
200
  export { nextLinkTarget };
201
201
  export const SOURCE_PROFILES = Object.freeze([restJsonProfile].map(profile => Object.freeze({ id: profile.id, version: profile.version, kind: profile.kind })));
202
202
  /** Inert lookup. Extensions are explicit caller imports, never discovered or executed here. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superbee/core",
3
- "version": "0.2.0-pre.43",
3
+ "version": "0.2.0-pre.44",
4
4
  "type": "module",
5
5
  "description": "OKF store engine \u2014 bundle I/O, cross-links, derived backlinks, freshness, and versioned writes.",
6
6
  "license": "Apache-2.0",
@@ -99,6 +99,10 @@
99
99
  "types": "./dist/links.d.ts",
100
100
  "default": "./dist/links.js"
101
101
  },
102
+ "./relationships": {
103
+ "types": "./dist/relationships.d.ts",
104
+ "default": "./dist/relationships.js"
105
+ },
102
106
  "./link-findings": {
103
107
  "types": "./dist/link-findings.d.ts",
104
108
  "default": "./dist/link-findings.js"