Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@biblioteksentralen/bmdb-search-client
Advanced tools
Client for searching Bibliotekenes metadatabrønn (BMDB)
TypeScript client for searching Bibliotekenes metadatabrønn (BMDB).
import { createBmdbSearchClient } from "@biblioteksentralen/bmdb-search-client";
const bmdb = createBmdbSearchClient({
clientIdentifier: "My little library app (drift@elvesund.no)",
});
const { data, error } = await bmdb.searchWorks({
query: "jo nesbø",
});
if (error) {
console.error(error);
} else {
console.log(`Fetched ${data.results.length} results:`);
for (const result of data.results) {
console.log(`- ${result.work.title.mainTitle}`);
}
}
The package includes a fetcher function that can be used to create a generic SWR hook that returns fully typed responses.
import useSWR, { SWRConfiguration } from "swr";
import { BmdbSearchErrorResponse, DefaultBmdbSearchClient, bmdbFetcher } from "@biblioteksentralen/bmdb-search-client";
const clientIdentifier = "My little library search demo";
const catalogueId = "tonsberg";
export function useBmdb<TOperation extends keyof DefaultBmdbSearchClient>(
operation: TOperation,
params: Parameters<DefaultBmdbSearchClient[TOperation]>[0],
swrOptions: SWRConfiguration = {},
) {
type TData = Awaited<ReturnType<BmdbSearchClient[TOperation]>>["data"];
return useSWR<TData, BmdbSearchErrorResponse>(
{ operation, params, clientIdentifier, catalogueId },
bmdbFetcher,
swrOptions,
);
}
The API does not require authentication, but clients should identify themselves using a descriptive
name and a contact address in the clientIdentifier
string. We will only contact you about usage of the API.
Clients are initialized with a global scope by default. Construct the client with a catalogueId
to
scope it to a specific library catalogue. The special value "global"
can be used for setting the
global scope. Note that catalogue scoping only guarantees that results are found in the given
library catalogue, not that the library have active holdings. If all holdings have been weeded, the
catalogue record may still be present.
import { createBmdbSearchClient } from "@biblioteksentralen/bmdb-search-client";
const client = createBmdbSearchClient({
catalogueId: "tonsberg",
...otherOptions,
});
The client connects to the production environment by default, but it can be constructed to use the staging environment instead:
const client = createBmdbSearchClient({
host: "https://search.data-staging.bs.no",
...otherOptions,
});
BMDB has two API contexts:
plas
: Context based on the Public Library API Specification (PLAS)
cordata
: Context based on the Cordata❦ model
plas
.The default BMDB client constructed with createBmdbSearchClient()
contains methods to access operations
from both contexts and returns responses from the default context. If a non-default response format
is neede, a client for the specific context can be constructed with createCordataBmdbSearchClient()
or
createPlasBmdbSearchClient()
. Example:
import { createCordataBmdbSearchClient, createPlasBmdbSearchClient } from "@biblioteksentralen/bmdb-search-client";
const clientIdentifier = "My little library client demo";
const plasClient = createPlasBmdbSearchClient({ clientIdentifier });
const plasResponse = await plasClient.searchWorks({ query: "Jo Nesbø" });
const plasFirstWorkResult = plasResponse.data?.results[0]?.work;
const cordataClient = createCordataBmdbSearchClient({ clientIdentifier });
const cordataResponse = await cordataClient.searchWorks({ query: "Jo Nesbø" });
const cordataFirstWorkResult = cordataResponse.data?.results[0]?.work;
console.log(`First PLAS result: ${plasFirstWorkResult?.identifier}`);
console.log(`First Cordata result: ${cordataFirstWorkResult?.id}`);
FAQs
Client for searching Bibliotekenes metadatabrønn (BMDB)
The npm package @biblioteksentralen/bmdb-search-client receives a total of 84 weekly downloads. As such, @biblioteksentralen/bmdb-search-client popularity was classified as not popular.
We found that @biblioteksentralen/bmdb-search-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.