mcp-databnf 1.1.1 → 2.1.0

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.
@@ -18,10 +18,10 @@ interface Config {
18
18
  logLevel: LogLevel;
19
19
  }
20
20
  interface Logger {
21
- debug(message: string): void;
22
- info(message: string): void;
23
- warn(message: string): void;
24
- error(message: string): void;
21
+ debug: (message: string) => void;
22
+ info: (message: string) => void;
23
+ warn: (message: string) => void;
24
+ error: (message: string) => void;
25
25
  }
26
26
 
27
27
  /** The shapes the access layer produces. Nothing here knows about MCP. */
@@ -244,17 +244,6 @@ interface Page<T> {
244
244
  indexWindowFull?: boolean | null;
245
245
  }
246
246
 
247
- /** How a piece of caller text became the terms the index was given. */
248
- interface SearchReading {
249
- /** The words the text was cut into, each one quoted into the query. */
250
- words: string[];
251
- /** The terms the index requires, after it splits inside a word. */
252
- terms: string[];
253
- /** The characters that marked nothing and were removed before the cutting. */
254
- invisible: string[];
255
- /** The visible characters that reached no term. */
256
- setAside: string[];
257
- }
258
247
  type EntityKind = "ark" | "temp-work";
259
248
  interface EntityId {
260
249
  kind: EntityKind;
@@ -265,6 +254,16 @@ interface EntityId {
265
254
  /** The page a person can open. */
266
255
  pageUrl: string;
267
256
  }
257
+ /**
258
+ * Read an identifier a caller wrote, in any of the forms they see.
259
+ *
260
+ * Rows carry `http://data.bnf.fr/ark:/12148/cb119219976#about`, prose carries
261
+ * `cb119219976`, and a browser carries `https://data.bnf.fr/ark:/12148/cb119219976`.
262
+ * All three name one record. Anything else is refused rather than guessed at,
263
+ * because an identifier built from a guess sends the next call to a record that
264
+ * does not exist and the answer reads as an absence.
265
+ */
266
+ declare function parseEntityId(input: string): EntityId;
268
267
 
269
268
  /**
270
269
  * The one place that talks to data.bnf.fr.
@@ -318,7 +317,6 @@ declare class BnfClient {
318
317
  /** The deadline one query is given, which callers report rather than guess. */
319
318
  get timeoutMs(): number;
320
319
  /** The one address this client sends anything to. */
321
- get endpoint(): string;
322
320
  /**
323
321
  * `cacheKey` is stated rather than taken from the query, because two reads of
324
322
  * one query can produce different values: a list cut to five rows is not the
@@ -328,24 +326,7 @@ declare class BnfClient {
328
326
  private read;
329
327
  private fetchAndParse;
330
328
  /** Read an identifier a caller wrote, refusing anything this dataset cannot address. */
331
- identify(input: string): EntityId;
332
329
  /** The words a search will actually look for, which a tool reports back. */
333
- words(input: string): string[];
334
- /**
335
- * The terms the index requires, which is what a row's presence rests on.
336
- *
337
- * The index splits inside a word at an apostrophe and at a hyphen, so a word
338
- * a caller wrote as one can reach it as two, each required on its own.
339
- */
340
- indexTerms(words: readonly string[]): string[];
341
- /**
342
- * How a piece of caller text became the terms the search was run with.
343
- *
344
- * A tool reports the reading back, so the same reading has to be the one the
345
- * query was built from: the words, the terms the index makes of them, and
346
- * the characters that reached neither.
347
- */
348
- searchReading(input: string): SearchReading;
349
330
  searchAuthors(name: string, limit: number, offset: number): Promise<Read<Page<AuthorSummary>>>;
350
331
  getAuthor(id: EntityId): Promise<Read<AuthorDetail>>;
351
332
  /**
@@ -375,4 +356,4 @@ declare class BnfClient {
375
356
  types(id: EntityId): Promise<Read<string[]>>;
376
357
  }
377
358
 
378
- export { BnfClient, type ClientOptions, type Read };
359
+ export { BnfClient, type ClientOptions, type EntityId, type EntityKind, type Read, parseEntityId };