@wazootech/worlds-sdk 0.0.0-stage → 0.11.3

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 (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +288 -2
  3. package/THIRD_PARTY_NOTICES.md +279 -0
  4. package/dist/ai-sdk.d.ts +27 -0
  5. package/dist/ai-sdk.js +28 -0
  6. package/dist/build-search-result-id-qxdmXp0V.js +12 -0
  7. package/dist/chunk-and-embed-0crm0xLl.js +75 -0
  8. package/dist/client-BJ45zmXU.d.ts +74 -0
  9. package/dist/client-BWh0UAM0.js +45 -0
  10. package/dist/embedding-service-DebRMVmn.d.ts +15 -0
  11. package/dist/embedding-service.d.ts +3 -0
  12. package/dist/embedding-service.js +19 -0
  13. package/dist/index.d.ts +8 -0
  14. package/dist/index.js +9 -0
  15. package/dist/memory.d.ts +26 -0
  16. package/dist/memory.js +29 -0
  17. package/dist/mod-8Zh1f9vW.d.ts +24 -0
  18. package/dist/mod-BuF_B_xU.d.ts +362 -0
  19. package/dist/mod-CHiiyEER.d.ts +79 -0
  20. package/dist/mod-ClDFMN-C.d.ts +625 -0
  21. package/dist/mod-Dmrdrb03.d.ts +13 -0
  22. package/dist/quad-chunker.d.ts +2 -0
  23. package/dist/quad-chunker.js +1 -0
  24. package/dist/quad-store-BGCOUBxK.js +851 -0
  25. package/dist/quad-store.d.ts +2 -0
  26. package/dist/quad-store.js +3 -0
  27. package/dist/rdf-formats-BkGt5RDB.js +93 -0
  28. package/dist/rdfjs-BNVjLSNL.js +190 -0
  29. package/dist/rdfjs.d.ts +79 -0
  30. package/dist/rdfjs.js +1 -0
  31. package/dist/search-index.d.ts +2 -0
  32. package/dist/search-index.js +219 -0
  33. package/dist/sparql-engine.d.ts +2 -0
  34. package/dist/sparql-engine.js +0 -0
  35. package/dist/testing.d.ts +301 -0
  36. package/dist/testing.js +786 -0
  37. package/dist/tfjs-use.d.ts +42 -0
  38. package/dist/tfjs-use.js +315 -0
  39. package/dist/wazoo.d.ts +86 -0
  40. package/dist/wazoo.js +347 -0
  41. package/package.json +119 -4
@@ -0,0 +1,75 @@
1
+ import { _ as isTextualLiteral, h as hashQuad } from "./quad-store-BGCOUBxK.js";
2
+ // src/client/search-index/quad-chunker/chunk-quads.ts
3
+ /**
4
+ * chunkQuads filters literal payload candidates from a collection of RDF Quads
5
+ * and splits large text nodes into smaller semantic substrings ready for vector insertion.
6
+ *
7
+ * @param quads The source triples gathered from recent mutation streams.
8
+ * @param textSplitter The configuration carrying splitting engines and thresholds.
9
+ * @param preComputedIds Optional pre-hashed canonical IDs avoiding CPU duplication.
10
+ * @returns Aggregated list of storage artifacts preserving parent metadata context.
11
+ */
12
+ async function chunkQuads(quads, textSplitter, preComputedIds) {
13
+ const candidates = quads.filter((quad) => isTextualLiteral(quad.object));
14
+ if (candidates.length === 0) return [];
15
+ let idByQuad;
16
+ if (preComputedIds) {
17
+ idByQuad = /* @__PURE__ */ new Map();
18
+ for (let i = 0; i < quads.length; i++) idByQuad.set(quads[i], preComputedIds[i]);
19
+ } else {
20
+ idByQuad = /* @__PURE__ */ new Map();
21
+ for (const quad of candidates) idByQuad.set(quad, hashQuad(quad));
22
+ }
23
+ const texts = candidates.map((quad) => quad.object.value);
24
+ const metadatas = candidates.map((quad) => ({
25
+ quad_id: idByQuad.get(quad),
26
+ subject: quad.subject.value,
27
+ predicate: quad.predicate.value,
28
+ graph: quad.graph.value
29
+ }));
30
+ return (await textSplitter.createDocuments(texts, metadatas)).map((doc) => ({
31
+ quad_id: String(doc.metadata?.quad_id ?? ""),
32
+ subject: String(doc.metadata?.subject ?? ""),
33
+ predicate: String(doc.metadata?.predicate ?? ""),
34
+ graph: String(doc.metadata?.graph ?? ""),
35
+ value: doc.pageContent
36
+ }));
37
+ }
38
+ // src/client/search-index/quad-chunker/chunk-and-embed.ts
39
+ /**
40
+ * chunkAndEmbedQuads chunks the textual literals of `quads` and embeds them,
41
+ * entirely before the caller opens a write. Chunking and embedding call out to
42
+ * a splitter and an external service, so doing them first means a failure
43
+ * writes nothing. An embedding failure always rejects, so the caller can retry;
44
+ * there is no keyword-only fallback. The embedding call receives the de-duplicated chunk texts, as
45
+ * in `@wazootech/worlds-libsql`, the reference backend.
46
+ */
47
+ async function chunkAndEmbedQuads(quads, quadIds, options) {
48
+ let chunks;
49
+ try {
50
+ chunks = await chunkQuads(quads, options.textSplitter, quadIds);
51
+ } catch (cause) {
52
+ throw new Error("failed to chunk novel textual facts", { cause });
53
+ }
54
+ const rows = chunks.map((chunk) => ({
55
+ chunk,
56
+ ftsValue: options.ftsValueOf?.(chunk) ?? chunk.value
57
+ }));
58
+ if (rows.length === 0 || !options.embeddingService) return { rows };
59
+ try {
60
+ const vectors = await embedUnique(rows, options);
61
+ return { rows: rows.map((row) => ({
62
+ ...row,
63
+ vector: vectors.get(row.ftsValue)
64
+ })) };
65
+ } catch (cause) {
66
+ throw new Error("failed to vectorize literal chunk blocks", { cause });
67
+ }
68
+ }
69
+ async function embedUnique(rows, options) {
70
+ const texts = [...new Set(rows.flatMap(({ chunk, ftsValue }) => [ftsValue, chunk.value]))];
71
+ const vectors = await options.embeddingService.embed(texts);
72
+ for (const vector of vectors) if (options.vectorDimensions !== void 0 && vector.length !== options.vectorDimensions) throw new Error(`embedding length ${vector.length} does not match configured vectorDimensions ${options.vectorDimensions}`);
73
+ return new Map(texts.map((text, i) => [text, vectors[i]]));
74
+ }
75
+ export { chunkQuads as n, chunkAndEmbedQuads as t };
@@ -0,0 +1,74 @@
1
+ import { $ as ImportRequest, X as ExportRequest, Z as ExportResponse, ct as ProvenanceQueryResponse, ot as ProvenanceQueryHandler, st as ProvenanceQueryRequest, tt as QuadStoreInterface } from "./mod-ClDFMN-C.js";
2
+ import { c as SparqlRequest, i as SparqlResponse, s as SparqlEngineInterface } from "./mod-8Zh1f9vW.js";
3
+ import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-BuF_B_xU.js";
4
+ /**
5
+ * WorldsSdkInterface is the public contract for the Worlds SDK.
6
+ */
7
+ interface WorldsSdkInterface {
8
+ /**
9
+ * import imports data into the Worlds API.
10
+ * @param request The import request body.
11
+ * @returns A promise that resolves when import completes.
12
+ */
13
+ import(request: ImportRequest): Promise<void>;
14
+ /**
15
+ * export exports data from the Worlds API.
16
+ * @param request The export request body.
17
+ * @returns A promise that resolves to the export response.
18
+ */
19
+ export(request: ExportRequest): Promise<ExportResponse>;
20
+ /**
21
+ * sparql executes a SPARQL query or update against the RDF store.
22
+ * @param request The SPARQL request body.
23
+ * @returns A promise that resolves to the SPARQL response.
24
+ */
25
+ sparql(request: SparqlRequest): Promise<SparqlResponse>;
26
+ /**
27
+ * search searches the RDF store for the given query.
28
+ * @param request The search request body.
29
+ * @returns A promise that resolves to the search response.
30
+ */
31
+ search(request: SearchRequest): Promise<SearchResponse>;
32
+ /**
33
+ * reindex rebuilds the derived search index from durable quads.
34
+ * On scan topologies, reindex is a documented, safe no-op.
35
+ * @param request optional include/exclude scope and read page size.
36
+ * @returns A promise that resolves to processed quad and chunk row counts.
37
+ */
38
+ reindex(request?: ReindexRequest): Promise<ReindexResponse>;
39
+ /**
40
+ * provenance returns sidecar provenance records and supersedes history for
41
+ * quads matching the RDF pattern. Quads written before provenance recording
42
+ * appear with empty records; queries never fail on missing provenance.
43
+ * @param request The subject/predicate/object pattern to match, and an optional limit.
44
+ * @returns A promise that resolves to per-quad provenance records and history.
45
+ */
46
+ provenance(request: ProvenanceQueryRequest): Promise<ProvenanceQueryResponse>;
47
+ }
48
+ /**
49
+ * WorldsSdkOptions wires quad, SPARQL, and search facades for custom assembly and tests.
50
+ */
51
+ interface WorldsSdkOptions {
52
+ /** quadStore manages the ingestion and extraction of triple/quad data. */
53
+ quadStore?: QuadStoreInterface;
54
+ /** sparqlEngine evaluates declarative queries and updates against the graph. */
55
+ sparqlEngine?: SparqlEngineInterface;
56
+ /** searchIndex enables high-performance keyword search across the graph literals. */
57
+ searchIndex?: SearchIndexInterface;
58
+ /** provenance overrides the provenance query handler; defaults to the quad store when it exposes one. */
59
+ provenance?: ProvenanceQueryHandler;
60
+ }
61
+ /**
62
+ * WorldsSdk synthesizes a Worlds SDK facade from wired quad, SPARQL, and search subsystems.
63
+ */
64
+ declare class WorldsSdk implements WorldsSdkInterface {
65
+ private readonly options;
66
+ constructor(options: WorldsSdkOptions);
67
+ import(request: ImportRequest): Promise<void>;
68
+ export(request: ExportRequest): Promise<ExportResponse>;
69
+ sparql(request: SparqlRequest): Promise<SparqlResponse>;
70
+ search(request: SearchRequest): Promise<SearchResponse>;
71
+ reindex(request?: ReindexRequest): Promise<ReindexResponse>;
72
+ provenance(request: ProvenanceQueryRequest): Promise<ProvenanceQueryResponse>;
73
+ }
74
+ export { WorldsSdkInterface as n, WorldsSdkOptions as r, WorldsSdk as t };
@@ -0,0 +1,45 @@
1
+ // src/client/client.ts
2
+ /**
3
+ * WorldsSdk synthesizes a Worlds SDK facade from wired quad, SPARQL, and search subsystems.
4
+ */
5
+ var WorldsSdk = class {
6
+ options;
7
+ constructor(options) {
8
+ this.options = options;
9
+ }
10
+ import(request) {
11
+ if (!this.options.quadStore) throw new Error("Quad store is not configured.");
12
+ return this.options.quadStore.import(request);
13
+ }
14
+ export(request) {
15
+ if (!this.options.quadStore) throw new Error("Quad store is not configured.");
16
+ return this.options.quadStore.export(request);
17
+ }
18
+ async sparql(request) {
19
+ if (!this.options.sparqlEngine) throw new Error("SPARQL engine is not configured.");
20
+ return await this.options.sparqlEngine.execute(request);
21
+ }
22
+ search(request) {
23
+ if (!this.options.searchIndex) throw new Error("Search index is not configured.");
24
+ return this.options.searchIndex.search(request);
25
+ }
26
+ reindex(request) {
27
+ if (!this.options.searchIndex) throw new Error("Search index is not configured.");
28
+ return this.options.searchIndex.reindex(request);
29
+ }
30
+ async provenance(request) {
31
+ const handler = this.options.provenance ?? asProvenanceHandler(this.options.quadStore);
32
+ if (!handler) throw new Error("Provenance is not configured.");
33
+ const { limit } = request;
34
+ if (limit !== void 0 && !(Number.isSafeInteger(limit) && limit > 0)) throw new RangeError("Provenance limit must be a positive integer.");
35
+ return await handler.provenanceQuery(request);
36
+ }
37
+ };
38
+ /**
39
+ * asProvenanceHandler adapts a quad store that exposes provenanceQuery into a
40
+ * ProvenanceQueryHandler.
41
+ */
42
+ function asProvenanceHandler(quadStore) {
43
+ if (quadStore && "provenanceQuery" in quadStore && typeof quadStore.provenanceQuery === "function") return quadStore;
44
+ }
45
+ export { WorldsSdk as t };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * EmbeddingService defines the abstract projection interface required to map
3
+ * textual inputs into continuous, high-dimensional dense vector representations
4
+ * suitable for nearest-neighbor mathematical search traversal.
5
+ */
6
+ interface EmbeddingService {
7
+ /**
8
+ * embed performs external or local transformation of textual input sequences in batch.
9
+ *
10
+ * @param texts Array of clean input sequences targeted for vectorizing.
11
+ * @returns Vector space projection arrays matching the input array index positioning.
12
+ */
13
+ embed(texts: string[]): Promise<Array<Float32Array | number[]>>;
14
+ }
15
+ export { EmbeddingService as t };
@@ -0,0 +1,3 @@
1
+ import { t as EmbeddingService } from "./embedding-service-DebRMVmn.js";
2
+ import { t as FakeEmbeddingService } from "./mod-Dmrdrb03.js";
3
+ export { EmbeddingService, FakeEmbeddingService };
@@ -0,0 +1,19 @@
1
+ // src/client/search-index/embedding-service/fake-embedding-service.ts
2
+ /**
3
+ * FakeEmbeddingService implements a reliable dummy projection model usable
4
+ * during automated integration tests to avoid live API consumption.
5
+ * It constantly outputs valid fixed-dimension Float32 tensors.
6
+ */
7
+ var FakeEmbeddingService = class {
8
+ /**
9
+ * Construct static deterministic embedding vectors of the required length.
10
+ */
11
+ embed(texts) {
12
+ return Promise.resolve(texts.map(() => {
13
+ const data = Array.from({ length: 32 }, () => 0);
14
+ data[0] = 1;
15
+ return new Float32Array(data);
16
+ }));
17
+ }
18
+ };
19
+ export { FakeEmbeddingService };
@@ -0,0 +1,8 @@
1
+ import { t as EmbeddingService } from "./embedding-service-DebRMVmn.js";
2
+ import { t as FakeEmbeddingService } from "./mod-Dmrdrb03.js";
3
+ import { n as WorldsSdkInterface, r as WorldsSdkOptions, t as WorldsSdk } from "./client-BJ45zmXU.js";
4
+ import { $ as ImportRequest, A as fromRdfjsTerm, B as QuadFilter, C as getFormat, D as fromRdfjsQuad, E as Quad, F as HexastoreIndexDescriptor, G as isImportCommit, H as PatchableStore, I as hashQuad, J as RdfjsStoreLike, K as isReplaceImportCommit, L as hashQuads, M as QuadRowReader, N as quadFromRow, O as toRdfjsQuad, P as HEXASTORE_INDEXES, Q as ImportMode, R as isTextualLiteral, S as exportQuadsResponse, T as parseQuads, U as TransactionContext, V as filterQuads, W as deduplicateBuffers, X as ExportRequest, Y as Patch, Z as ExportResponse, _ as createRdfjsStoreCommitHandler, a as preparePatch, at as ProvenanceListQuery, b as awaitDrainRemoveMatches, c as TransactionalRdfjsStore, ct as ProvenanceQueryResponse, d as RdfjsExportSource, dt as ProvenanceRecordInput, et as ImportSource, f as exportFromRdfjsStore, ft as ProvenanceRecordType, g as TransactionOptions, h as Transaction, i as computeNovelQuads, it as ProvenanceHistory, j as toRdfjsTerm, k as Term, l as TransactionalRdfjsStoreOptions, lt as ProvenanceQueryResult, m as MatchFunction, n as PreparedPatch, nt as InMemoryProvenanceStore, o as selectNovelQuads, ot as ProvenanceQueryHandler, p as importViaTransaction, pt as ProvenanceStore, q as RdfjsEventSource, r as SelectNovelQuadsOptions, rt as ImportProvenance, s as ReadonlyStore, st as ProvenanceQueryRequest, t as NovelQuads, tt as QuadStoreInterface, u as ImportViaTransactionOptions, ut as ProvenanceRecord, v as FORMATS, w as materializeImportQuads, x as collectQuadsFromStream, y as RdfFormat, z as QuadCriteria } from "./mod-ClDFMN-C.js";
5
+ import { a as SparqlSelectResults, c as SparqlRequest, i as SparqlResponse, n as SparqlBinding, o as SparqlValue, r as SparqlConstructResults, s as SparqlEngineInterface, t as SparqlAskResults } from "./mod-8Zh1f9vW.js";
6
+ import { A as DEFAULT_RRF_K, C as ReindexResponse, D as SearchRequest, E as SearchMode, M as normalizeRrfScore, O as SearchResponse, S as ReindexRequest, T as SearchIndexOnImport, _ as extractRdfLocalLabel, a as RebuildSearchIndexResult, b as BuildSearchResultIdOptions, c as PreparedCommit, d as PlanSearchIndexingOptions, f as SearchIndexPlan, g as buildChunkFtsValue, h as DEFAULT_LABEL_PREDICATES, i as RebuildSearchIndexOptions, j as SearchScoreType, k as SearchResult, l as prepareCommit, m as BuildChunkFtsValueOptions, n as RebuildPage, o as rebuildSearchIndex, p as planSearchIndexing, r as RebuildScope, s as PrepareCommitOptions, t as ChunkRebuildDriver, u as DEFAULT_SEARCH_INDEX_ON_IMPORT, v as formatPredicatePhrase, w as SearchIndexInterface, x as buildSearchResultId, y as resolveLabelPredicates } from "./mod-BuF_B_xU.js";
7
+ import { a as ChunkRowPayload, c as chunkQuads, i as chunkAndEmbedQuads, n as ChunkAndEmbedResult, o as Document, r as EmbeddedChunk, s as TextSplitterInterface, t as ChunkAndEmbedOptions } from "./mod-CHiiyEER.js";
8
+ export { BuildChunkFtsValueOptions, BuildSearchResultIdOptions, ChunkAndEmbedOptions, ChunkAndEmbedResult, ChunkRebuildDriver, ChunkRowPayload, DEFAULT_LABEL_PREDICATES, DEFAULT_RRF_K, DEFAULT_SEARCH_INDEX_ON_IMPORT, Document, EmbeddedChunk, EmbeddingService, ExportRequest, ExportResponse, FORMATS, FakeEmbeddingService, HEXASTORE_INDEXES, HexastoreIndexDescriptor, ImportMode, ImportProvenance, ImportRequest, ImportSource, ImportViaTransactionOptions, InMemoryProvenanceStore, MatchFunction, NovelQuads, Patch, PatchableStore, PlanSearchIndexingOptions, PrepareCommitOptions, PreparedCommit, PreparedPatch, ProvenanceHistory, ProvenanceListQuery, ProvenanceQueryHandler, ProvenanceQueryRequest, ProvenanceQueryResponse, ProvenanceQueryResult, ProvenanceRecord, ProvenanceRecordInput, ProvenanceRecordType, ProvenanceStore, Quad, QuadCriteria, QuadFilter, QuadRowReader, QuadStoreInterface, RdfFormat, RdfjsEventSource, RdfjsExportSource, RdfjsStoreLike, ReadonlyStore, RebuildPage, RebuildScope, RebuildSearchIndexOptions, RebuildSearchIndexResult, ReindexRequest, ReindexResponse, SearchIndexInterface, SearchIndexOnImport, SearchIndexPlan, SearchMode, SearchRequest, SearchResponse, SearchResult, SearchScoreType, SelectNovelQuadsOptions, type SparqlAskResults, type SparqlBinding, type SparqlConstructResults, type SparqlEngineInterface, type SparqlRequest, type SparqlResponse, type SparqlSelectResults, type SparqlValue, Term, TextSplitterInterface, Transaction, TransactionContext, TransactionOptions, TransactionalRdfjsStore, TransactionalRdfjsStoreOptions, WorldsSdk, WorldsSdkInterface, WorldsSdkOptions, awaitDrainRemoveMatches, buildChunkFtsValue, buildSearchResultId, chunkAndEmbedQuads, chunkQuads, collectQuadsFromStream, computeNovelQuads, createRdfjsStoreCommitHandler, deduplicateBuffers, exportFromRdfjsStore, exportQuadsResponse, extractRdfLocalLabel, filterQuads, formatPredicatePhrase, fromRdfjsQuad, fromRdfjsTerm, getFormat, hashQuad, hashQuads, importViaTransaction, isImportCommit, isReplaceImportCommit, isTextualLiteral, materializeImportQuads, normalizeRrfScore, parseQuads, planSearchIndexing, prepareCommit, preparePatch, quadFromRow, rebuildSearchIndex, resolveLabelPredicates, selectNovelQuads, toRdfjsQuad, toRdfjsTerm };
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import { t as WorldsSdk } from "./client-BWh0UAM0.js";
2
+ import { S as InMemoryProvenanceStore, _ as isTextualLiteral, a as Transaction, b as isImportCommit, c as importViaTransaction, d as quadFromRow, f as fromRdfjsTerm, g as hashQuads, h as hashQuad, i as TransactionalRdfjsStore, l as fromRdfjsQuad, m as HEXASTORE_INDEXES, n as preparePatch, o as createRdfjsStoreCommitHandler, p as toRdfjsTerm, r as selectNovelQuads, s as exportFromRdfjsStore, t as computeNovelQuads, u as toRdfjsQuad, v as filterQuads, x as isReplaceImportCommit, y as deduplicateBuffers } from "./quad-store-BGCOUBxK.js";
3
+ import { a as getFormat, i as exportQuadsResponse, n as awaitDrainRemoveMatches, o as materializeImportQuads, r as collectQuadsFromStream, s as parseQuads, t as FORMATS } from "./rdf-formats-BkGt5RDB.js";
4
+ import { t as buildSearchResultId } from "./build-search-result-id-qxdmXp0V.js";
5
+ import { DEFAULT_LABEL_PREDICATES, DEFAULT_RRF_K, DEFAULT_SEARCH_INDEX_ON_IMPORT, buildChunkFtsValue, extractRdfLocalLabel, formatPredicatePhrase, normalizeRrfScore, planSearchIndexing, prepareCommit, rebuildSearchIndex, resolveLabelPredicates } from "./search-index.js";
6
+ import { n as chunkQuads, t as chunkAndEmbedQuads } from "./chunk-and-embed-0crm0xLl.js";
7
+ import { FakeEmbeddingService } from "./embedding-service.js";
8
+ import "./quad-chunker.js";
9
+ export { DEFAULT_LABEL_PREDICATES, DEFAULT_RRF_K, DEFAULT_SEARCH_INDEX_ON_IMPORT, FORMATS, FakeEmbeddingService, HEXASTORE_INDEXES, InMemoryProvenanceStore, Transaction, TransactionalRdfjsStore, WorldsSdk, awaitDrainRemoveMatches, buildChunkFtsValue, buildSearchResultId, chunkAndEmbedQuads, chunkQuads, collectQuadsFromStream, computeNovelQuads, createRdfjsStoreCommitHandler, deduplicateBuffers, exportFromRdfjsStore, exportQuadsResponse, extractRdfLocalLabel, filterQuads, formatPredicatePhrase, fromRdfjsQuad, fromRdfjsTerm, getFormat, hashQuad, hashQuads, importViaTransaction, isImportCommit, isReplaceImportCommit, isTextualLiteral, materializeImportQuads, normalizeRrfScore, parseQuads, planSearchIndexing, prepareCommit, preparePatch, quadFromRow, rebuildSearchIndex, resolveLabelPredicates, selectNovelQuads, toRdfjsQuad, toRdfjsTerm };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The @wazootech/worlds-sdk/memory subpath exports the portable in-memory WorldsSdk — the
3
+ * durable-backend family's shared parity reference (wazootech/workspace#74).
4
+ * createMemoryWorldsSdk wires the engine's MemoryStore into the standard WorldsSdk facade
5
+ * (RdfjsQuadStore + RdfjsSearchIndex + WazooSparqlEngine over one shared
6
+ * store), so the @wazootech/worlds-sdk/testing harness and every backend's phase-4
7
+ * parity suite can run against a zero-dependency in-memory reference.
8
+ */
9
+ import { t as WorldsSdk } from "./client-BJ45zmXU.js";
10
+ /**
11
+ * createMemoryWorldsSdk builds a portable in-memory WorldsSdk backed by the Wazoo
12
+ * engine's MemoryStore (the in-memory baseline, per the durable-backend map's
13
+ * consolidation decision, wazootech/workspace#74).
14
+ *
15
+ * It is the shared parity reference and proving ground for the family: the
16
+ * @wazootech/worlds-sdk/testing harness (runParitySuite) and every backend's phase-4
17
+ * parity suite can use it as a zero-dependency, in-memory reference — no
18
+ * libsql checkout or private test double required. It wires the same WorldsSdk
19
+ * facade the durable backends expose (quad store + SPARQL + search over one
20
+ * shared RDF/JS store), so a backend that matches it matches the family.
21
+ *
22
+ * The store is owned by the WorldsSdk: each call returns an independent, fresh
23
+ * topology. Use a factory (`() => createMemoryWorldsSdk()`) where each case needs
24
+ * an isolated world.
25
+ */
26
+ export declare function createMemoryWorldsSdk(): WorldsSdk;
package/dist/memory.js ADDED
@@ -0,0 +1,29 @@
1
+ import { t as WorldsSdk } from "./client-BWh0UAM0.js";
2
+ import { r as RdfjsSearchIndex, t as RdfjsQuadStore } from "./rdfjs-BNVjLSNL.js";
3
+ import { MemoryStore, WazooSparqlEngine } from "@wazootech/sparql-engine";
4
+ // src/memory/create-memory-sdk.ts
5
+ /**
6
+ * createMemoryWorldsSdk builds a portable in-memory WorldsSdk backed by the Wazoo
7
+ * engine's MemoryStore (the in-memory baseline, per the durable-backend map's
8
+ * consolidation decision, wazootech/workspace#74).
9
+ *
10
+ * It is the shared parity reference and proving ground for the family: the
11
+ * @wazootech/worlds-sdk/testing harness (runParitySuite) and every backend's phase-4
12
+ * parity suite can use it as a zero-dependency, in-memory reference — no
13
+ * libsql checkout or private test double required. It wires the same WorldsSdk
14
+ * facade the durable backends expose (quad store + SPARQL + search over one
15
+ * shared RDF/JS store), so a backend that matches it matches the family.
16
+ *
17
+ * The store is owned by the WorldsSdk: each call returns an independent, fresh
18
+ * topology. Use a factory (`() => createMemoryWorldsSdk()`) where each case needs
19
+ * an isolated world.
20
+ */
21
+ function createMemoryWorldsSdk() {
22
+ const store = new MemoryStore();
23
+ return new WorldsSdk({
24
+ quadStore: new RdfjsQuadStore({ store }),
25
+ sparqlEngine: new WazooSparqlEngine({ store }),
26
+ searchIndex: new RdfjsSearchIndex(store)
27
+ });
28
+ }
29
+ export { createMemoryWorldsSdk };
@@ -0,0 +1,24 @@
1
+ import { SparqlAskResults, SparqlBinding, SparqlConstructResults, SparqlRequest as SparqlRequest$1, SparqlResponse, SparqlResponse as SparqlResponse$1, SparqlSelectResults, SparqlValue } from "@wazootech/sparql-engine";
2
+ import { rt as ImportProvenance } from "./mod-ClDFMN-C.js";
3
+ /**
4
+ * SparqlRequest is the engine's request plus what the SDK needs to say about an
5
+ * update.
6
+ */
7
+ interface SparqlRequest extends SparqlRequest$1 {
8
+ /**
9
+ * provenance names who ran a SPARQL update and where its data came from, as
10
+ * on ImportRequest. Queries ignore it, and so does a backend that does not
11
+ * record provenance for updates.
12
+ */
13
+ provenance?: ImportProvenance;
14
+ }
15
+ /**
16
+ * SparqlEngineInterface evaluates SPARQL queries and updates. An engine that
17
+ * only knows the @wazootech/sparql-engine request, such as WazooSparqlEngine,
18
+ * satisfies it and ignores provenance.
19
+ */
20
+ interface SparqlEngineInterface {
21
+ /** execute runs one SPARQL query or update. */
22
+ execute(request: SparqlRequest): Promise<SparqlResponse$1>;
23
+ }
24
+ export { SparqlSelectResults as a, SparqlRequest as c, SparqlResponse as i, SparqlBinding as n, SparqlValue as o, SparqlConstructResults as r, SparqlEngineInterface as s, SparqlAskResults as t };