Skip to content

linopress-cli/linear ​

The Linear Documents target: the GraphQL client and LinearTarget.

Classes ​

LinearApiError ​

Extends ​

  • Error

Constructors ​

Constructor ​
ts
new LinearApiError(
   message, 
   status, 
   errors?
): LinearApiError;
Parameters ​
ParameterTypeDefault value
messagestringundefined
statusnumberundefined
errors?readonly GraphQLErrorEntry[][]
Returns ​

LinearApiError

Overrides ​

Error.constructor

Properties ​

PropertyType
errorsreadonly GraphQLErrorEntry[]
statusnumber

LinearTarget ​

Linear Documents as a Linopress target, scoped to one team or project.

Implements ​

Constructors ​

Constructor ​
ts
new LinearTarget(options): LinearTarget;
Parameters ​
ParameterType
optionsLinearTargetOptions
Returns ​

LinearTarget

Properties ​

PropertyType
containerContainer

Methods ​

archive() ​
ts
archive(id): Promise<void>;

Moves the doc to Linear's trash, which is recoverable from the UI. Linear rejects documentUpdate with trashed: true ("invalid trashed state"); documentDelete is its trash action, and calling it on an already-trashed doc succeeds.

Parameters ​
ParameterType
idstring
Returns ​

Promise<void>

Implementation of ​

DocumentTarget.archive

create() ​
ts
create(input): Promise<RemoteDoc>;
Parameters ​
ParameterType
inputCreateDocInput
Returns ​

Promise<RemoteDoc>

Implementation of ​

DocumentTarget.create

update() ​
ts
update(id, input): Promise<void>;

Throws DocNotFoundError when the doc is deleted, or trashed/archived outside Linopress.

Parameters ​
ParameterType
idstring
inputUpdateDocInput
Returns ​

Promise<void>

Implementation of ​

DocumentTarget.update

uploadAsset() ​
ts
uploadAsset(asset): Promise<string>;

Uploads a file to Linear's storage: fileUpload returns a signed URL, the bytes go there with a PUT, and docs reference the returned asset URL (visible to workspace members).

Parameters ​
ParameterType
assetAsset
Returns ​

Promise<string>

Implementation of ​

DocumentTarget.uploadAsset

Interfaces ​

GraphQLClientOptions ​

Properties ​

PropertyTypeDescription
apiKeystringPersonal API key (lin_api_…) or OAuth access token.
endpoint?string-
fetch?(input, init?) => Promise<Response>Injectable for tests. Defaults to the global fetch.
maxRetries?numberRetries after a rate-limit rejection (HTTP 429 or RATELIMITED). Default 3.
retryDelayMs?numberFirst backoff delay in ms, doubled per retry; Retry-After wins when present. Default 1000.
timeoutMs?numberPer-request timeout in ms. Default 30000.

GraphQLErrorEntry ​

Properties ​

PropertyType
extensions?Record<string, unknown>
messagestring

LinearTargetOptions ​

Extends ​

Properties ​

PropertyTypeDescription
apiKey?stringEither a key (a client is created) or a ready request function (tests, custom transport).
containerContainer-
endpoint?string-
fetch?(input, init?) => Promise<Response>Injectable for tests. Defaults to the global fetch.
maxRetries?numberRetries after a rate-limit rejection (HTTP 429 or RATELIMITED). Default 3.
request?GraphQLRequest-
retryDelayMs?numberFirst backoff delay in ms, doubled per retry; Retry-After wins when present. Default 1000.
timeoutMs?numberPer-request timeout in ms. Default 30000.

Type Aliases ​

GraphQLRequest ​

ts
type GraphQLRequest = <T>(query, variables?) => Promise<T>;

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
querystring
variables?Record<string, unknown>

Returns ​

Promise<T>

Variables ​

LINEAR_ENDPOINT ​

ts
const LINEAR_ENDPOINT: "https://api.linear.app/graphql" = "https://api.linear.app/graphql";

linearTransforms ​

ts
const linearTransforms: readonly MarkdownTransform[];

The Markdown clean-up Linear needs (see docs/spike-findings.md, "Rendering"): Linear shows <a id> anchors as literal text, and its heading ids are UUIDs, so #slug links are dead. Pass these to plan / apply when the target is a LinearTarget.

Functions ​

createGraphQLClient() ​

ts
function createGraphQLClient(options): GraphQLRequest;

Minimal Linear GraphQL client. We don't use @linear/sdk for document mutations because its published schema lacks parentDocumentId, subDocumentSortOrder and teamId, which the live API accepts (see docs/spike-findings.md, "Live API introspection").

Parameters ​

ParameterType
optionsGraphQLClientOptions

Returns ​

GraphQLRequest

MIT licensed. Not made by or affiliated with Linear.