@squidcloud/linear-client 1.0.425

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.
@@ -0,0 +1,161 @@
1
+ import { IntegrationId } from '../../../../internal-common/src/public-types/communication.public-types';
2
+ /**
3
+ * Linear API Types - Shared between backend and client
4
+ */
5
+ export type LinearPriority = 0 | 1 | 2 | 3 | 4;
6
+ export declare const PRIORITY_LABELS: Record<LinearPriority, string>;
7
+ export interface LinearTeam {
8
+ id: string;
9
+ name: string;
10
+ key: string;
11
+ description?: string;
12
+ }
13
+ export interface LinearUser {
14
+ id: string;
15
+ name: string;
16
+ displayName: string;
17
+ email: string;
18
+ }
19
+ export interface LinearWorkflowState {
20
+ id: string;
21
+ name: string;
22
+ type: 'backlog' | 'unstarted' | 'started' | 'completed' | 'canceled';
23
+ color: string;
24
+ }
25
+ export interface LinearComment {
26
+ id: string;
27
+ body: string;
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ user?: LinearUser;
31
+ }
32
+ export interface LinearIssue {
33
+ id: string;
34
+ identifier: string;
35
+ title: string;
36
+ description?: string;
37
+ priority: LinearPriority;
38
+ url: string;
39
+ createdAt: string;
40
+ updatedAt: string;
41
+ state?: LinearWorkflowState;
42
+ team?: LinearTeam;
43
+ assignee?: LinearUser;
44
+ }
45
+ export type LinearWebhookAction = 'create' | 'update' | 'remove';
46
+ export type LinearWebhookType = 'Issue' | 'Comment' | 'Project' | 'Cycle' | 'IssueLabel';
47
+ export interface LinearWebhookPayload {
48
+ action: LinearWebhookAction;
49
+ type: LinearWebhookType;
50
+ createdAt: string;
51
+ data: Record<string, unknown>;
52
+ url?: string;
53
+ organizationId: string;
54
+ webhookId: string;
55
+ webhookTimestamp: number;
56
+ }
57
+ export interface LinearIssueWebhookData {
58
+ id: string;
59
+ identifier: string;
60
+ title: string;
61
+ description?: string;
62
+ priority: number;
63
+ teamId: string;
64
+ stateId: string;
65
+ assigneeId?: string;
66
+ creatorId?: string;
67
+ createdAt: string;
68
+ updatedAt: string;
69
+ }
70
+ export interface LinearCommentWebhookData {
71
+ id: string;
72
+ body: string;
73
+ issueId: string;
74
+ userId: string;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ }
78
+ /** Request to search Linear issues */
79
+ export interface SearchLinearIssuesRequest {
80
+ /** The ID of the Linear integration */
81
+ integrationId: IntegrationId;
82
+ /** The search query to find issues */
83
+ query: string;
84
+ /** Optional comma-separated list of team names or keys to filter by */
85
+ teamNames?: string;
86
+ /** Maximum number of issues to return (default: 50) */
87
+ limit?: number;
88
+ }
89
+ /** Request to get details of a Linear issue */
90
+ export interface GetLinearIssueRequest {
91
+ /** The ID of the Linear integration */
92
+ integrationId: IntegrationId;
93
+ /** The Linear issue ID or identifier (e.g., "ENG-123") */
94
+ issueId: string;
95
+ }
96
+ /** Request to update a Linear issue */
97
+ export interface UpdateLinearIssueRequest {
98
+ /** The ID of the Linear integration */
99
+ integrationId: IntegrationId;
100
+ /** The Linear issue ID or identifier (e.g., "ENG-123") */
101
+ issueId: string;
102
+ /** New title for the issue */
103
+ title?: string;
104
+ /** New description for the issue */
105
+ description?: string;
106
+ /** New priority level: 0=No priority, 1=Urgent, 2=High, 3=Medium, 4=Low */
107
+ priority?: LinearPriority;
108
+ /** Email of the user to assign the issue to */
109
+ assigneeEmail?: string;
110
+ }
111
+ /** Request to add a comment to a Linear issue */
112
+ export interface AddLinearCommentRequest {
113
+ /** The ID of the Linear integration */
114
+ integrationId: IntegrationId;
115
+ /** The Linear issue ID or identifier (e.g., "ENG-123") */
116
+ issueId: string;
117
+ /** The comment text (supports markdown) */
118
+ body: string;
119
+ }
120
+ /** Request to create a Linear issue */
121
+ export interface CreateLinearIssueRequest {
122
+ /** The ID of the Linear integration */
123
+ integrationId: IntegrationId;
124
+ /** The title of the issue */
125
+ title: string;
126
+ /** The description of the issue (supports markdown) */
127
+ description?: string;
128
+ /** The name or key of the team to create the issue in */
129
+ teamName: string;
130
+ /** Priority level: 0=No priority, 1=Urgent, 2=High, 3=Medium, 4=Low */
131
+ priority?: LinearPriority;
132
+ /** Email of the user to assign the issue to */
133
+ assigneeEmail?: string;
134
+ }
135
+ /** Response from Linear issue operations */
136
+ export interface LinearIssueResponse {
137
+ /** Issue identifier (e.g., "ENG-123") */
138
+ identifier: string;
139
+ /** Issue title */
140
+ title: string;
141
+ /** Issue URL */
142
+ url: string;
143
+ }
144
+ /** Response from listing teams */
145
+ export interface LinearTeamResponse {
146
+ /** Team key (e.g., "ENG") */
147
+ key: string;
148
+ /** Team name */
149
+ name: string;
150
+ /** Team description */
151
+ description?: string;
152
+ }
153
+ /** Request to extract and validate Linear webhook data */
154
+ export interface ExtractLinearWebhookRequest {
155
+ /** The ID of the Linear integration */
156
+ integrationId: IntegrationId;
157
+ /** The raw body of the webhook request as a string */
158
+ rawBody: string;
159
+ /** The headers from the webhook request */
160
+ headers: Record<string, string | undefined>;
161
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../../common/src/linear-types';
2
+ export * from './linear-client';
@@ -0,0 +1,77 @@
1
+ import { Squid } from '@squidcloud/client';
2
+ import { CreateLinearIssueRequest, LinearIssueResponse, LinearTeamResponse, LinearWebhookPayload, SearchLinearIssuesRequest, UpdateLinearIssueRequest } from '../../common/src/linear-types';
3
+ /**
4
+ * Client for interacting with the Linear connector.
5
+ *
6
+ * Provides methods to search, create, update issues, add comments,
7
+ * and extract webhook data from Linear webhooks.
8
+ */
9
+ export declare class SquidLinearClient {
10
+ private readonly squid;
11
+ private readonly integrationId;
12
+ /**
13
+ * Creates a new Linear client instance.
14
+ *
15
+ * @param squid - Squid client instance. Provide an instance that includes the Squid API key.
16
+ * @param integrationId - The ID of the Linear integration in the Squid console.
17
+ */
18
+ constructor(squid: Squid, integrationId: string);
19
+ /**
20
+ * Search for Linear issues by text query.
21
+ *
22
+ * Returns issues matching the search term in title, description, or identifier.
23
+ *
24
+ * @param request - Search parameters.
25
+ * @returns Formatted string with matching issues.
26
+ */
27
+ searchIssues(request: Omit<SearchLinearIssuesRequest, 'integrationId'>): Promise<string>;
28
+ /**
29
+ * Get detailed information about a specific Linear issue.
30
+ *
31
+ * @param issueId - The Linear issue ID or identifier (e.g., "ENG-123").
32
+ * @returns Formatted string with issue details including comments.
33
+ */
34
+ getIssue(issueId: string): Promise<string>;
35
+ /**
36
+ * Update an existing Linear issue.
37
+ *
38
+ * @param request - Update parameters including issue ID and fields to update.
39
+ * @returns The updated issue information.
40
+ */
41
+ updateIssue(request: Omit<UpdateLinearIssueRequest, 'integrationId'>): Promise<LinearIssueResponse>;
42
+ /**
43
+ * Add a comment to a Linear issue.
44
+ *
45
+ * @param issueId - The Linear issue ID or identifier (e.g., "ENG-123").
46
+ * @param body - The comment text (supports markdown).
47
+ * @returns The created comment ID.
48
+ */
49
+ addComment(issueId: string, body: string): Promise<{
50
+ commentId: string;
51
+ }>;
52
+ /**
53
+ * Create a new Linear issue.
54
+ *
55
+ * @param request - Create parameters including title, team, and optional fields.
56
+ * @returns The created issue information.
57
+ */
58
+ createIssue(request: Omit<CreateLinearIssueRequest, 'integrationId'>): Promise<LinearIssueResponse>;
59
+ /**
60
+ * List available Linear teams.
61
+ *
62
+ * @returns Array of teams with their key, name, and description.
63
+ */
64
+ listTeams(): Promise<Array<LinearTeamResponse>>;
65
+ /**
66
+ * Extract and validate Linear webhook data.
67
+ *
68
+ * Validates the webhook signature using the configured webhook secret
69
+ * and parses the webhook payload.
70
+ *
71
+ * @param rawBody - The raw body of the webhook request as a string.
72
+ * @param headers - The headers from the webhook request.
73
+ * @returns The validated and parsed Linear webhook payload.
74
+ * @throws Error if the webhook signature is invalid or missing when a secret is configured.
75
+ */
76
+ extractWebhookData(rawBody: string, headers: Record<string, string | undefined>): Promise<LinearWebhookPayload>;
77
+ }
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{PRIORITY_LABELS:()=>n,SquidLinearClient:()=>i});const n={0:"No priority",1:"Urgent",2:"High",3:"Medium",4:"Low"};class i{constructor(e,t){this.squid=e,this.integrationId=t}async searchIssues(e){const t={...e,integrationId:this.integrationId};return this.squid.executeFunction("searchLinearIssuesExecutable",t)}async getIssue(e){const t={integrationId:this.integrationId,issueId:e};return this.squid.executeFunction("getLinearIssueExecutable",t)}async updateIssue(e){const t={...e,integrationId:this.integrationId};return this.squid.executeFunction("updateLinearIssueExecutable",t)}async addComment(e,t){const n={integrationId:this.integrationId,issueId:e,body:t};return this.squid.executeFunction("addLinearCommentExecutable",n)}async createIssue(e){const t={...e,integrationId:this.integrationId};return this.squid.executeFunction("createLinearIssueExecutable",t)}async listTeams(){return this.squid.executeFunction("listLinearTeamsExecutable",{integrationId:this.integrationId})}async extractWebhookData(e,t){const n={integrationId:this.integrationId,rawBody:e,headers:t};return this.squid.executeFunction("extractLinearWebhookData",n)}}var s=exports;for(var r in t)s[r]=t[r];t.__esModule&&Object.defineProperty(s,"__esModule",{value:!0})})();
@@ -0,0 +1,30 @@
1
+ /** A type alias for an application id. */
2
+ export type AppId = string;
3
+ /** A tuple of environment identifiers like 'dev' or 'prod'. */
4
+ export declare const ENVIRONMENT_IDS: readonly ["dev", "prod"];
5
+ /** A type representing valid environment identifiers derived from ENVIRONMENT_IDS. */
6
+ export type EnvironmentId = (typeof ENVIRONMENT_IDS)[number];
7
+ /** A type alias for a squid developer identifier. */
8
+ export type SquidDeveloperId = string;
9
+ /** A type alias for an integration id. */
10
+ export type IntegrationId = string;
11
+ /** A type alias for a client identifier. */
12
+ export type ClientId = string;
13
+ /** A type alias for a squid document identifier. */
14
+ export type SquidDocId = string;
15
+ /** A type alias for a client request identifier. */
16
+ export type ClientRequestId = string;
17
+ /** ID of AI agent. Also known as AI profile id. */
18
+ export type AiAgentId = string;
19
+ /** App-level ID of AI Knowledge Base */
20
+ export type AiKnowledgeBaseId = string;
21
+ /**
22
+ * The built-in agent id. Cannot be customized.
23
+ * @category AI
24
+ */
25
+ export declare const BUILT_IN_AGENT_ID = "built_in_agent";
26
+ /**
27
+ * A type alias for an AI context identifier.
28
+ * @category AI
29
+ */
30
+ export type AiContextId = string;
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@squidcloud/linear-client",
3
+ "version": "1.0.425",
4
+ "description": "Squid Linear Client - SDK for interacting with the Linear connector",
5
+ "main": "dist/index.js",
6
+ "types": "dist/linear-client/src/index.d.ts",
7
+ "scripts": {
8
+ "prebuild": "del-cli dist",
9
+ "build": "webpack --mode=production",
10
+ "lint": "eslint",
11
+ "publish:public": "npm run build && npm publish --access public"
12
+ },
13
+ "files": [
14
+ "dist/**/*"
15
+ ],
16
+ "keywords": [
17
+ "squid",
18
+ "linear",
19
+ "issue-tracking",
20
+ "connector"
21
+ ],
22
+ "author": "",
23
+ "license": "ISC",
24
+ "dependencies": {
25
+ "assertic": "^1.3.0",
26
+ "@squidcloud/client": "^1.0.425"
27
+ },
28
+ "engines": {
29
+ "node": ">=20.0.0"
30
+ }
31
+ }