Skip to main content

Function: createLayersDataLinks()

createLayersDataLinks(agent, input): Promise<CreateLayersDataLinksResult>

Defined in: web/lib/atproto/record-creator.ts:2499

Write pub.layers.eprint.dataLink records into the author's PDS.

Parameters​

agent​

Agent

Authenticated ATProto Agent for the repo the records go into

input​

CreateLayersDataLinksInput

The eprint and the datasets to link to it

Returns​

Promise<CreateLayersDataLinksResult>

Which links were written and which were not

Throws​

Error if the agent is not authenticated

Remarks​

A data link needs the eprint's AT-URI, so it cannot be written in the same call as the submission. This runs after the eprint exists, and its failures are reported rather than thrown: an eprint that was created successfully must not be rolled back or orphaned because a secondary link failed. Each record is written independently for the same reason, so one bad link does not take the rest of the batch with it.

The records are Layers' own lexicon written into the author's repository — the author's data, in the author's PDS, which Layers indexes from the firehose. Chive writes nothing to its own store here.

Example​

const eprint = await createEprintRecord(agent, eprintData);
const { created, failed } = await createLayersDataLinks(agent, {
eprintUri: eprint.uri,
dataLinks: [{ dataKind: 'corpus', paperSection: 'Table 3' }],
});