linopress-cli/linear
The Linear Documents target: the GraphQL client and LinearTarget.
Classes
LinearApiError
Extends
Error
Constructors
Constructor
new LinearApiError(
message,
status,
errors?
): LinearApiError;Parameters
| Parameter | Type | Default value |
|---|---|---|
message | string | undefined |
status | number | undefined |
errors? | readonly GraphQLErrorEntry[] | [] |
Returns
Overrides
Error.constructor
Properties
| Property | Type |
|---|---|
errors | readonly GraphQLErrorEntry[] |
status | number |
LinearTarget
Linear Documents as a Linopress target, scoped to one team or project.
Implements
Constructors
Constructor
new LinearTarget(options): LinearTarget;Parameters
| Parameter | Type |
|---|---|
options | LinearTargetOptions |
Returns
Properties
| Property | Type |
|---|---|
container | Container |
Methods
archive()
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
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<void>
Implementation of
create()
create(input): Promise<RemoteDoc>;Parameters
| Parameter | Type |
|---|---|
input | CreateDocInput |
Returns
Promise<RemoteDoc>
Implementation of
update()
update(id, input): Promise<void>;Throws DocNotFoundError when the doc is deleted, or trashed/archived outside Linopress.
Parameters
| Parameter | Type |
|---|---|
id | string |
input | UpdateDocInput |
Returns
Promise<void>
Implementation of
uploadAsset()
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
| Parameter | Type |
|---|---|
asset | Asset |
Returns
Promise<string>
Implementation of
Interfaces
GraphQLClientOptions
Properties
GraphQLErrorEntry
Properties
| Property | Type |
|---|---|
extensions? | Record<string, unknown> |
message | string |
LinearTargetOptions
Extends
Omit<GraphQLClientOptions,"apiKey">
Properties
| Property | Type | Description |
|---|---|---|
apiKey? | string | Either a key (a client is created) or a ready request function (tests, custom transport). |
container | Container | - |
endpoint? | string | - |
fetch? | (input, init?) => Promise<Response> | Injectable for tests. Defaults to the global fetch. |
maxRetries? | number | Retries after a rate-limit rejection (HTTP 429 or RATELIMITED). Default 3. |
request? | GraphQLRequest | - |
retryDelayMs? | number | First backoff delay in ms, doubled per retry; Retry-After wins when present. Default 1000. |
timeoutMs? | number | Per-request timeout in ms. Default 30000. |
Type Aliases
GraphQLRequest
type GraphQLRequest = <T>(query, variables?) => Promise<T>;Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
query | string |
variables? | Record<string, unknown> |
Returns
Promise<T>
Variables
LINEAR_ENDPOINT
const LINEAR_ENDPOINT: "https://api.linear.app/graphql" = "https://api.linear.app/graphql";linearTransforms
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()
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
| Parameter | Type |
|---|---|
options | GraphQLClientOptions |