@rawdash/connector-linear 0.12.0 → 0.14.0
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.
- package/LICENSE +202 -0
- package/README.md +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +14 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -145,3 +145,13 @@ createMcpServer({
|
|
|
145
145
|
],
|
|
146
146
|
});
|
|
147
147
|
```
|
|
148
|
+
|
|
149
|
+
## Property tests
|
|
150
|
+
|
|
151
|
+
Resources in this connector have fast-check property tests under `src/property.test.ts` that:
|
|
152
|
+
|
|
153
|
+
1. Generate N≥50 synthetic API payloads from a Zod schema mirroring the upstream API response.
|
|
154
|
+
2. Pipe them through `connector.sync()` against an `InMemoryStorage` instance.
|
|
155
|
+
3. Assert universal invariants — non-empty entity ids, finite event timestamps, no `undefined` leaking into storage, no thrown errors on any valid input — plus per-resource counts.
|
|
156
|
+
|
|
157
|
+
The helper lives in `@rawdash/connector-test-utils`. When adding a new resource, add a Zod schema for its payload and a test wired up via `runPropertySyncTest`.
|
package/dist/index.d.ts
CHANGED
|
@@ -56,4 +56,4 @@ declare class LinearConnector extends BaseConnector<LinearSettings, LinearCreden
|
|
|
56
56
|
sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export { LinearConnector, type LinearResource, type LinearSettings, configFields };
|
|
59
|
+
export { LinearConnector, type LinearResource, type LinearSettings, configFields, LinearConnector as default };
|
package/dist/index.js
CHANGED
|
@@ -463,8 +463,12 @@ var LinearConnector = class _LinearConnector extends BaseConnector {
|
|
|
463
463
|
});
|
|
464
464
|
}
|
|
465
465
|
};
|
|
466
|
+
|
|
467
|
+
// src/index.ts
|
|
468
|
+
var index_default = LinearConnector;
|
|
466
469
|
export {
|
|
467
470
|
LinearConnector,
|
|
468
|
-
configFields
|
|
471
|
+
configFields,
|
|
472
|
+
index_default as default
|
|
469
473
|
};
|
|
470
474
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../connector-shared/src/errors.ts","../../../connector-shared/src/retry.ts","../../../connector-shared/src/version.ts","../../../connector-shared/src/request.ts","../../../connector-shared/src/rate-limit.ts","../../../connector-shared/src/pagination.ts","../src/linear.ts"],"sourcesContent":["import type { HttpResponse } from './types';\n\nexport type HttpErrorKind =\n | 'transient'\n | 'rate_limit'\n | 'auth'\n | 'upstream_bug'\n | 'client_bug';\n\nexport abstract class HttpClientError extends Error {\n abstract readonly kind: HttpErrorKind;\n readonly response?: HttpResponse;\n\n constructor(message: string, response?: HttpResponse) {\n super(message);\n this.name = new.target.name;\n this.response = response;\n }\n}\n\nexport class TransientError extends HttpClientError {\n readonly kind = 'transient' as const;\n}\n\nexport class RateLimitError extends HttpClientError {\n readonly kind = 'rate_limit' as const;\n readonly retryAfter?: Date;\n\n constructor(message: string, response?: HttpResponse, retryAfter?: Date) {\n super(message, response);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class AuthError extends HttpClientError {\n readonly kind = 'auth' as const;\n}\n\nexport class UpstreamBugError extends HttpClientError {\n readonly kind = 'upstream_bug' as const;\n}\n\nexport class ClientBugError extends HttpClientError {\n readonly kind = 'client_bug' as const;\n}\n\nexport function classifyStatus(status: number): HttpErrorKind {\n if (status === 429) {\n return 'rate_limit';\n }\n if (status === 401 || status === 403) {\n return 'auth';\n }\n if (status === 408) {\n return 'transient';\n }\n if (status >= 500) {\n return 'upstream_bug';\n }\n if (status >= 400) {\n return 'client_bug';\n }\n return 'client_bug';\n}\n\nexport function errorForStatus(\n message: string,\n response: HttpResponse,\n retryAfter?: Date,\n): HttpClientError {\n const kind = classifyStatus(response.status);\n switch (kind) {\n case 'rate_limit':\n return new RateLimitError(message, response, retryAfter);\n case 'auth':\n return new AuthError(message, response);\n case 'transient':\n return new TransientError(message, response);\n case 'upstream_bug':\n return new UpstreamBugError(message, response);\n case 'client_bug':\n return new ClientBugError(message, response);\n }\n}\n","import { HttpClientError, RateLimitError, TransientError } from './errors';\n\nexport interface RetryPolicy {\n maxAttempts?: number;\n initialDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (status: number | null, err?: Error) => boolean;\n}\n\nexport const defaultRetryOn = (status: number | null, err?: Error): boolean => {\n if (err instanceof RateLimitError) {\n return true;\n }\n if (err instanceof TransientError) {\n return true;\n }\n if (status === null) {\n return err instanceof Error && !(err instanceof HttpClientError);\n }\n if (status === 408 || status === 429) {\n return true;\n }\n if (status >= 500) {\n return true;\n }\n return false;\n};\n\nexport function backoffDelayMs(\n attempt: number,\n policy: Required<Pick<RetryPolicy, 'initialDelayMs' | 'maxDelayMs'>>,\n): number {\n const base = policy.initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, policy.maxDelayMs);\n}\n\nexport function parseRetryAfter(\n headerValue: string | null,\n now: Date = new Date(),\n): Date | undefined {\n if (!headerValue) {\n return undefined;\n }\n const trimmed = headerValue.trim();\n if (/^\\d+$/.test(trimmed)) {\n return new Date(now.getTime() + Number(trimmed) * 1000);\n }\n const parsed = Date.parse(trimmed);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n return new Date(parsed);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) {\n return Promise.reject(signal.reason ?? new Error('Aborted'));\n }\n return new Promise<void>((resolve, reject) => {\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal!.reason ?? new Error('Aborted'));\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","export const HTTP_CLIENT_VERSION = '0.0.0';\n\nexport const DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n","import {\n AuthError,\n ClientBugError,\n HttpClientError,\n RateLimitError,\n TransientError,\n UpstreamBugError,\n errorForStatus,\n} from './errors';\nimport { defaultRetryOn, parseRetryAfter, sleep } from './retry';\nimport type { FetchLike, HttpMethod, HttpRequest, HttpResponse } from './types';\nimport { DEFAULT_USER_AGENT } from './version';\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_INITIAL_DELAY_MS = 1000;\nconst DEFAULT_MAX_DELAY_MS = 60_000;\nconst OBSERVER_TIMEOUT_MS = 250;\n\nexport interface RequestObservation {\n url: string;\n method: HttpMethod;\n status: number;\n resource: string;\n requestId: string;\n body: unknown;\n}\n\nexport type RequestObserver = (\n event: RequestObservation,\n) => void | Promise<void>;\n\nexport interface RequestOptions {\n fetch?: FetchLike;\n observer?: RequestObserver;\n resource: string;\n requestId?: string;\n}\n\nasync function notifyObserver(\n observer: RequestObserver,\n event: RequestObservation,\n): Promise<void> {\n let result: void | Promise<void>;\n try {\n result = observer(event);\n } catch (err) {\n console.warn('[connector-shared] request observer threw:', err);\n return;\n }\n if (!(result instanceof Promise)) {\n return;\n }\n const guarded = result.catch((err) => {\n console.warn('[connector-shared] request observer rejected:', err);\n });\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, OBSERVER_TIMEOUT_MS);\n });\n try {\n await Promise.race([guarded, timeout]);\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n}\n\nfunction newRequestId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction mergeHeaders(\n defaults: Record<string, string>,\n overrides: Record<string, string> | undefined,\n): Record<string, string> {\n const merged: Record<string, string> = {};\n for (const [k, v] of Object.entries(defaults)) {\n merged[k.toLowerCase()] = v;\n }\n if (overrides) {\n for (const [k, v] of Object.entries(overrides)) {\n merged[k.toLowerCase()] = v;\n }\n }\n return merged;\n}\n\nfunction linkTimeoutSignal(\n parent: AbortSignal | undefined,\n timeoutMs: number,\n): { signal: AbortSignal; cancel: () => void } {\n const controller = new AbortController();\n const onParentAbort = () => {\n controller.abort(parent?.reason);\n };\n if (parent) {\n if (parent.aborted) {\n controller.abort(parent.reason);\n } else {\n parent.addEventListener('abort', onParentAbort, { once: true });\n }\n }\n const timer = setTimeout(() => {\n controller.abort(new Error(`Request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n return {\n signal: controller.signal,\n cancel: () => {\n clearTimeout(timer);\n if (parent) {\n parent.removeEventListener('abort', onParentAbort);\n }\n },\n };\n}\n\nasync function readBody(res: Response, parseJson: boolean): Promise<unknown> {\n if (res.status === 204 || res.status === 205) {\n return null;\n }\n const contentType = res.headers.get('content-type') ?? '';\n if (parseJson && contentType.includes('application/json')) {\n const text = await res.text();\n if (text.length === 0) {\n return null;\n }\n return JSON.parse(text);\n }\n return res.text();\n}\n\nexport async function request<T = unknown>(\n req: HttpRequest,\n options: RequestOptions,\n): Promise<HttpResponse<T>> {\n const fetchImpl: FetchLike = options.fetch ?? (globalThis.fetch as FetchLike);\n const retry = req.retry ?? {};\n const maxAttempts = retry.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n const initialDelayMs = retry.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n const maxDelayMs = retry.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n const retryOn = retry.retryOn ?? defaultRetryOn;\n const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const parseJson = req.parseJson ?? true;\n\n const headers = mergeHeaders(\n {\n 'User-Agent': DEFAULT_USER_AGENT,\n Accept: 'application/json',\n },\n req.headers,\n );\n\n let lastErr: Error | undefined;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n req.signal?.throwIfAborted();\n\n const { signal, cancel } = linkTimeoutSignal(req.signal, timeoutMs);\n let res: Response;\n try {\n res = await fetchImpl(req.url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body as RequestInit['body'],\n signal,\n });\n } catch (err) {\n cancel();\n if (req.signal?.aborted) {\n throw req.signal.reason ?? err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n lastErr = error;\n if (attempt < maxAttempts - 1 && retryOn(null, error)) {\n const delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n await sleep(delay, req.signal);\n continue;\n }\n throw new TransientError(error.message);\n }\n cancel();\n\n const body = await readBody(res, parseJson);\n const httpResponse: HttpResponse<T> = {\n status: res.status,\n headers: res.headers,\n body: body as T,\n };\n if (req.rateLimit) {\n const state = req.rateLimit.parse(res.headers);\n if (state) {\n httpResponse.rateLimitState = state;\n }\n }\n\n if (options.observer) {\n await notifyObserver(options.observer, {\n url: req.url,\n method: req.method ?? 'GET',\n status: res.status,\n resource: options.resource,\n requestId: options.requestId ?? newRequestId(),\n body,\n });\n }\n\n if (res.ok) {\n return httpResponse;\n }\n\n const retryAfter = parseRetryAfter(res.headers.get('retry-after'));\n const message = `HTTP ${res.status} ${res.statusText} for ${req.method ?? 'GET'} ${req.url}`;\n const err = errorForStatus(message, httpResponse, retryAfter);\n\n if (\n attempt < maxAttempts - 1 &&\n retryOn(res.status, err) &&\n !(err instanceof AuthError) &&\n !(err instanceof ClientBugError)\n ) {\n lastErr = err;\n let delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n if (err instanceof RateLimitError && retryAfter) {\n const wait = retryAfter.getTime() - Date.now();\n if (wait > 0) {\n delay = Math.min(wait, maxDelayMs);\n }\n }\n await sleep(delay, req.signal);\n continue;\n }\n\n throw err;\n }\n\n throw lastErr ?? new UpstreamBugError('Exhausted retry attempts');\n}\n\nfunction computeDelay(\n attempt: number,\n initialDelayMs: number,\n maxDelayMs: number,\n): number {\n const base = initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, maxDelayMs);\n}\n\nexport { HttpClientError };\n","export interface RateLimitState {\n remaining: number;\n resetAt: Date;\n}\n\nexport interface RateLimitPolicy {\n parse(headers: Headers): RateLimitState | null;\n}\n\nexport const githubRateLimit: RateLimitPolicy = {\n parse(h) {\n const remainingRaw = h.get('x-ratelimit-remaining');\n const resetRaw = h.get('x-ratelimit-reset');\n if (remainingRaw === null || resetRaw === null) {\n return null;\n }\n const remaining = Number(remainingRaw);\n const reset = Number(resetRaw);\n if (!Number.isFinite(remaining) || !Number.isFinite(reset) || reset < 0) {\n return null;\n }\n return { remaining, resetAt: new Date(reset * 1000) };\n },\n};\n\nexport const sentryRateLimit: RateLimitPolicy = {\n parse(h) {\n const concurrent = h.get('x-sentry-rate-limit-remaining');\n const reset = h.get('x-sentry-rate-limit-reset');\n if (concurrent === null || reset === null) {\n return null;\n }\n const remaining = Number(concurrent);\n const resetSec = Number(reset);\n if (\n !Number.isFinite(remaining) ||\n !Number.isFinite(resetSec) ||\n resetSec < 0\n ) {\n return null;\n }\n return { remaining, resetAt: new Date(resetSec * 1000) };\n },\n};\n\nexport const linearRateLimit: RateLimitPolicy = {\n parse(h) {\n const remainingRaw = h.get('x-ratelimit-requests-remaining');\n const resetRaw = h.get('x-ratelimit-requests-reset');\n if (remainingRaw === null) {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n let resetAt: Date;\n if (resetRaw !== null) {\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n resetAt = new Date(reset);\n } else {\n resetAt = new Date(Date.now() + 60_000);\n }\n return { remaining, resetAt };\n },\n};\n","import { request } from './request';\nimport type { HttpRequest } from './types';\n\nexport function parseLinkHeader(header: string | null): Record<string, string> {\n if (!header) {\n return {};\n }\n const result: Record<string, string> = {};\n for (const part of header.split(',')) {\n const match = part.match(/<([^>]+)>\\s*;\\s*rel=\"([^\"]+)\"/);\n if (match) {\n result[match[2]!] = match[1]!;\n }\n }\n return result;\n}\n\nexport async function* paginateLink<T>(\n initial: HttpRequest,\n parse: (body: unknown) => T[],\n options: { resource: string },\n): AsyncIterable<T> {\n let next: string | null = initial.url;\n while (next) {\n const res: Awaited<ReturnType<typeof request>> = await request(\n {\n ...initial,\n url: next,\n },\n { resource: options.resource },\n );\n for (const item of parse(res.body)) {\n yield item;\n }\n const links = parseLinkHeader(res.headers.get('link'));\n next = links['next'] ?? null;\n }\n}\n\nexport async function* paginateCursor<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; nextCursor: string | null },\n buildNext: (req: HttpRequest, cursor: string) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let req: HttpRequest = initial;\n while (true) {\n const res = await request(req, { resource: options.resource });\n const { items, nextCursor } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!nextCursor) {\n return;\n }\n req = buildNext(req, nextCursor);\n }\n}\n\nexport async function* paginatePage<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; hasMore: boolean },\n buildPage: (req: HttpRequest, page: number) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let page = 1;\n while (true) {\n const req = page === 1 ? initial : buildPage(initial, page);\n const res = await request(req, { resource: options.resource });\n const { items, hasMore } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!hasMore || items.length === 0) {\n return;\n }\n page++;\n }\n}\n","import { type HttpResponse, linearRateLimit } from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type CredentialsSchema,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n paginateChunked,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n apiKey: z.object({ $secret: z.string() }).meta({\n label: 'API Key',\n description:\n 'Linear Personal API Key. Create one at Linear → Settings → API → Personal API keys.',\n placeholder: 'lin_api_...',\n secret: true,\n }),\n teamIds: z.array(z.string().min(1)).nonempty().optional().meta({\n label: 'Team IDs (optional)',\n description:\n 'Restrict the sync to specific Linear team IDs. Omit to sync all teams the API key can see.',\n }),\n resources: z\n .array(z.enum(['teams', 'users', 'cycles', 'issues']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Linear resources to sync. Omit to sync all resources. The `issues` phase also emits state-transition events derived from each issue's history.\",\n }),\n historyPerIssue: z.number().int().positive().max(50).optional().meta({\n label: 'History entries per issue',\n description:\n 'How many history entries to pull per issue (newest first). State transitions inside this window become events. Defaults to 25.',\n placeholder: '25',\n }),\n }),\n);\n\nexport interface LinearSettings {\n teamIds?: readonly string[];\n resources?: readonly LinearResource[];\n historyPerIssue?: number;\n}\n\nconst linearCredentials = {\n apiKey: {\n description: 'Linear Personal API Key',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype LinearCredentials = typeof linearCredentials;\n\nconst PHASE_ORDER = ['teams', 'users', 'cycles', 'issues'] as const;\n\ntype LinearPhase = (typeof PHASE_ORDER)[number];\n\nexport type LinearResource = LinearPhase;\n\ntype LinearSyncCursor = ChunkedSyncCursor<LinearPhase, string>;\n\nfunction isLinearSyncCursor(value: unknown): value is LinearSyncCursor {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const v = value as { phase?: unknown; page?: unknown };\n if (typeof v.phase !== 'string') {\n return false;\n }\n if (!(PHASE_ORDER as readonly string[]).includes(v.phase)) {\n return false;\n }\n if (v.page !== null && typeof v.page !== 'string') {\n return false;\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Linear GraphQL types\n// ---------------------------------------------------------------------------\n\ninterface PageInfo {\n hasNextPage: boolean;\n endCursor: string | null;\n}\n\ninterface Connection<T> {\n nodes: T[];\n pageInfo: PageInfo;\n}\n\ninterface LinearTeam {\n id: string;\n name: string;\n key: string;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface LinearUser {\n id: string;\n name: string;\n email: string | null;\n displayName: string;\n active: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface LinearCycle {\n id: string;\n number: number;\n name: string | null;\n startsAt: string;\n endsAt: string;\n completedAt: string | null;\n progress: number | null;\n scopeHistory: number[] | null;\n completedScopeHistory: number[] | null;\n team: { id: string } | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface LinearIssueHistory {\n id: string;\n createdAt: string;\n actor: { id: string } | null;\n fromState: { id: string; name: string } | null;\n toState: { id: string; name: string } | null;\n fromAssignee: { id: string } | null;\n toAssignee: { id: string } | null;\n}\n\ninterface LinearIssue {\n id: string;\n identifier: string;\n title: string;\n priority: number;\n estimate: number | null;\n state: { id: string; name: string; type: string } | null;\n assignee: { id: string } | null;\n team: { id: string } | null;\n project: { id: string } | null;\n cycle: { id: string } | null;\n labels: { nodes: Array<{ id: string; name: string }> };\n createdAt: string;\n updatedAt: string;\n completedAt: string | null;\n canceledAt: string | null;\n startedAt: string | null;\n history: Connection<LinearIssueHistory>;\n}\n\ninterface GraphQLError {\n message: string;\n extensions?: { code?: string; type?: string };\n}\n\ninterface GraphQLResponse<T> {\n data?: T;\n errors?: GraphQLError[];\n}\n\n// ---------------------------------------------------------------------------\n// GraphQL documents\n// ---------------------------------------------------------------------------\n\nconst TEAMS_QUERY = `\n query Teams($after: String, $first: Int!, $filter: TeamFilter) {\n teams(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes { id name key createdAt updatedAt }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nconst USERS_QUERY = `\n query Users($after: String, $first: Int!, $filter: UserFilter) {\n users(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes { id name email displayName active createdAt updatedAt }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nconst CYCLES_QUERY = `\n query Cycles($after: String, $first: Int!, $filter: CycleFilter) {\n cycles(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes {\n id number name startsAt endsAt completedAt progress\n scopeHistory completedScopeHistory\n team { id }\n createdAt updatedAt\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nconst ISSUES_QUERY = `\n query Issues(\n $after: String\n $first: Int!\n $filter: IssueFilter\n $historyFirst: Int!\n ) {\n issues(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes {\n id identifier title priority estimate\n state { id name type }\n assignee { id }\n team { id }\n project { id }\n cycle { id }\n labels { nodes { id name } }\n createdAt updatedAt completedAt canceledAt startedAt\n history(first: $historyFirst) {\n nodes {\n id createdAt\n actor { id }\n fromState { id name }\n toState { id name }\n fromAssignee { id }\n toAssignee { id }\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// LinearConnector\n// ---------------------------------------------------------------------------\n\nconst PAGE_SIZE = 50;\nconst DEFAULT_HISTORY_PER_ISSUE = 25;\nconst ENDPOINT = 'https://api.linear.app/graphql';\n\nexport class LinearConnector extends BaseConnector<\n LinearSettings,\n LinearCredentials\n> {\n static readonly id = 'linear';\n\n static create(input: unknown, ctx?: ConnectorContext): LinearConnector {\n const parsed = configFields.parse(input);\n return new LinearConnector(\n {\n teamIds: parsed.teamIds,\n resources: parsed.resources,\n historyPerIssue: parsed.historyPerIssue,\n },\n { apiKey: parsed.apiKey },\n ctx,\n );\n }\n\n readonly id = 'linear';\n override readonly credentials = linearCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: this.creds.apiKey,\n 'Content-Type': 'application/json',\n 'User-Agent': 'rawdash/connector-linear (+https://rawdash.dev)',\n };\n }\n\n private async graphql<T>(\n query: string,\n variables: Record<string, unknown>,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<GraphQLResponse<T>>> {\n const res = await this.post<GraphQLResponse<T>>(ENDPOINT, {\n resource,\n headers: this.buildHeaders(),\n body: JSON.stringify({ query, variables }),\n signal,\n rateLimit: linearRateLimit,\n });\n if (res.body.errors && res.body.errors.length > 0) {\n const messages = res.body.errors.map((e) => e.message).join('; ');\n throw new Error(`Linear GraphQL error: ${messages}`);\n }\n if (!res.body.data) {\n throw new Error(\n `Linear GraphQL response missing data for resource '${resource}'`,\n );\n }\n return res;\n }\n\n private sinceFilter(\n options: SyncOptions,\n ): Record<string, unknown> | undefined {\n if (options.mode !== 'latest' || !options.since) {\n return undefined;\n }\n return { updatedAt: { gt: options.since } };\n }\n\n private teamFilter(): Record<string, unknown> | undefined {\n const ids = this.settings.teamIds;\n if (!ids || ids.length === 0) {\n return undefined;\n }\n return { id: { in: [...ids] } };\n }\n\n private issueTeamFilter(): Record<string, unknown> | undefined {\n const ids = this.settings.teamIds;\n if (!ids || ids.length === 0) {\n return undefined;\n }\n return { team: { id: { in: [...ids] } } };\n }\n\n private mergeFilters(\n ...filters: Array<Record<string, unknown> | undefined>\n ): Record<string, unknown> | undefined {\n const merged: Record<string, unknown> = {};\n let any = false;\n for (const f of filters) {\n if (f) {\n Object.assign(merged, f);\n any = true;\n }\n }\n return any ? merged : undefined;\n }\n\n // ---------------------------------------------------------------------------\n // Fetchers\n // ---------------------------------------------------------------------------\n\n private async fetchTeamsPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearTeam[]; next: string | null }> {\n const filter = this.mergeFilters(\n this.teamFilter(),\n this.sinceFilter(options),\n );\n const res = await this.graphql<{ teams: Connection<LinearTeam> }>(\n TEAMS_QUERY,\n { after: page ?? null, first: PAGE_SIZE, filter },\n 'teams',\n signal,\n );\n const conn = res.body.data!.teams;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n private async fetchUsersPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearUser[]; next: string | null }> {\n const res = await this.graphql<{ users: Connection<LinearUser> }>(\n USERS_QUERY,\n {\n after: page ?? null,\n first: PAGE_SIZE,\n filter: this.sinceFilter(options),\n },\n 'users',\n signal,\n );\n const conn = res.body.data!.users;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n private async fetchCyclesPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearCycle[]; next: string | null }> {\n const teamIds = this.settings.teamIds;\n const teamFilter =\n teamIds && teamIds.length > 0\n ? { team: { id: { in: [...teamIds] } } }\n : undefined;\n const filter = this.mergeFilters(teamFilter, this.sinceFilter(options));\n const res = await this.graphql<{ cycles: Connection<LinearCycle> }>(\n CYCLES_QUERY,\n { after: page ?? null, first: PAGE_SIZE, filter },\n 'cycles',\n signal,\n );\n const conn = res.body.data!.cycles;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n private async fetchIssuesPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearIssue[]; next: string | null }> {\n const filter = this.mergeFilters(\n this.issueTeamFilter(),\n this.sinceFilter(options),\n );\n const historyFirst =\n this.settings.historyPerIssue ?? DEFAULT_HISTORY_PER_ISSUE;\n const res = await this.graphql<{ issues: Connection<LinearIssue> }>(\n ISSUES_QUERY,\n { after: page ?? null, first: PAGE_SIZE, filter, historyFirst },\n 'issues',\n signal,\n );\n const conn = res.body.data!.issues;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n // ---------------------------------------------------------------------------\n // Writers\n // ---------------------------------------------------------------------------\n\n private async writeTeams(\n storage: StorageHandle,\n teams: LinearTeam[],\n ): Promise<void> {\n for (const t of teams) {\n await storage.entity({\n type: 'linear_team',\n id: t.id,\n attributes: {\n name: t.name,\n key: t.key,\n createdAt: new Date(t.createdAt).getTime(),\n },\n updated_at: new Date(t.updatedAt).getTime(),\n });\n }\n }\n\n private async writeUsers(\n storage: StorageHandle,\n users: LinearUser[],\n ): Promise<void> {\n for (const u of users) {\n await storage.entity({\n type: 'linear_user',\n id: u.id,\n attributes: {\n name: u.name,\n email: u.email,\n displayName: u.displayName,\n active: u.active,\n createdAt: new Date(u.createdAt).getTime(),\n },\n updated_at: new Date(u.updatedAt).getTime(),\n });\n }\n }\n\n private async writeCycles(\n storage: StorageHandle,\n cycles: LinearCycle[],\n ): Promise<void> {\n for (const c of cycles) {\n const startsMs = new Date(c.startsAt).getTime();\n const endsMs = new Date(c.endsAt).getTime();\n const scopeFinal =\n c.scopeHistory && c.scopeHistory.length > 0\n ? (c.scopeHistory.at(-1) ?? null)\n : null;\n const completedFinal =\n c.completedScopeHistory && c.completedScopeHistory.length > 0\n ? (c.completedScopeHistory.at(-1) ?? null)\n : null;\n await storage.entity({\n type: 'linear_cycle',\n id: c.id,\n attributes: {\n number: c.number,\n name: c.name,\n teamId: c.team?.id ?? null,\n startsAt: startsMs,\n endsAt: endsMs,\n completedAt: c.completedAt ? new Date(c.completedAt).getTime() : null,\n progress: c.progress,\n scope: scopeFinal,\n completedScope: completedFinal,\n },\n updated_at: new Date(c.updatedAt).getTime(),\n });\n }\n }\n\n private async writeIssues(\n storage: StorageHandle,\n issues: LinearIssue[],\n historySinceMs: number | null,\n ): Promise<void> {\n for (const i of issues) {\n await storage.entity({\n type: 'linear_issue',\n id: i.id,\n attributes: {\n identifier: i.identifier,\n title: i.title,\n stateId: i.state?.id ?? null,\n stateName: i.state?.name ?? null,\n stateType: i.state?.type ?? null,\n priority: i.priority,\n assigneeId: i.assignee?.id ?? null,\n teamId: i.team?.id ?? null,\n projectId: i.project?.id ?? null,\n cycleId: i.cycle?.id ?? null,\n labels: i.labels.nodes.map((l) => l.name),\n estimate: i.estimate,\n createdAt: new Date(i.createdAt).getTime(),\n completedAt: i.completedAt ? new Date(i.completedAt).getTime() : null,\n canceledAt: i.canceledAt ? new Date(i.canceledAt).getTime() : null,\n startedAt: i.startedAt ? new Date(i.startedAt).getTime() : null,\n },\n updated_at: new Date(i.updatedAt).getTime(),\n });\n\n for (const h of i.history.nodes) {\n if (!h.toState || !h.fromState) {\n continue;\n }\n if (h.toState.id === h.fromState.id) {\n continue;\n }\n const eventTs = new Date(h.createdAt).getTime();\n if (historySinceMs !== null && eventTs <= historySinceMs) {\n continue;\n }\n await storage.event({\n name: 'linear_issue_state_change',\n start_ts: eventTs,\n end_ts: null,\n attributes: {\n historyId: h.id,\n issueId: i.id,\n issueIdentifier: i.identifier,\n teamId: i.team?.id ?? null,\n actorId: h.actor?.id ?? null,\n fromStateId: h.fromState.id,\n fromStateName: h.fromState.name,\n toStateId: h.toState.id,\n toStateName: h.toState.name,\n },\n });\n }\n }\n }\n\n // ---------------------------------------------------------------------------\n // sync\n // ---------------------------------------------------------------------------\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = isLinearSyncCursor(options.cursor)\n ? options.cursor\n : undefined;\n const isFull = options.mode === 'full';\n const historySinceMs =\n options.mode === 'latest' && options.since\n ? new Date(options.since).getTime()\n : null;\n\n const enabled = this.settings.resources;\n const phases =\n enabled && enabled.length > 0\n ? PHASE_ORDER.filter((p) => enabled.includes(p))\n : PHASE_ORDER;\n\n return paginateChunked<LinearPhase, string>({\n phases,\n cursor,\n signal,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'teams':\n return this.fetchTeamsPage(page, options, sig);\n case 'users':\n return this.fetchUsersPage(page, options, sig);\n case 'cycles':\n return this.fetchCyclesPage(page, options, sig);\n case 'issues':\n return this.fetchIssuesPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'teams':\n await storage.entities([], { types: ['linear_team'] });\n break;\n case 'users':\n await storage.entities([], { types: ['linear_user'] });\n break;\n case 'cycles':\n await storage.entities([], { types: ['linear_cycle'] });\n break;\n case 'issues':\n await storage.entities([], { types: ['linear_issue'] });\n await storage.events([], {\n names: ['linear_issue_state_change'],\n });\n break;\n }\n }\n switch (phase) {\n case 'teams':\n return this.writeTeams(storage, items as LinearTeam[]);\n case 'users':\n return this.writeUsers(storage, items as LinearUser[]);\n case 'cycles':\n return this.writeCycles(storage, items as LinearCycle[]);\n case 'issues':\n return this.writeIssues(\n storage,\n items as LinearIssue[],\n historySinceMs,\n );\n }\n },\n });\n }\n}\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AE2CnE,IAAM,kBAAmC;EAC9C,MAAM,GAAG;AACP,UAAM,eAAe,EAAE,IAAI,gCAAgC;AAC3D,UAAM,WAAW,EAAE,IAAI,4BAA4B;AACnD,QAAI,iBAAiB,MAAM;AACzB,aAAO;IACT;AACA,UAAM,YAAY,OAAO,YAAY;AACrC,QAAI,CAAC,OAAO,SAAS,SAAS,GAAG;AAC/B,aAAO;IACT;AACA,QAAI;AACJ,QAAI,aAAa,MAAM;AACrB,YAAM,QAAQ,OAAO,QAAQ;AAC7B,UAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG;AACxC,eAAO;MACT;AACA,gBAAU,IAAI,KAAK,KAAK;IAC1B,OAAO;AACL,gBAAU,IAAI,KAAK,KAAK,IAAI,IAAI,GAAM;IACxC;AACA,WAAO,EAAE,WAAW,QAAQ;EAC9B;AACF;;;AEnEA;AAAA,EACE;AAAA,EAOA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAEX,IAAM,eAAe;AAAA,EAC1B,EAAE,OAAO;AAAA,IACP,QAAQ,EAAE,OAAO,EAAE,S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O,KAAK,WAAW,SAAS,KAAqB;AAAA,UACvD,KAAK;AACH,mBAAO,KAAK,YAAY,SAAS,KAAsB;AAAA,UACzD,KAAK;AACH,mBAAO,KAAK;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,QACJ;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../connector-shared/src/errors.ts","../../../connector-shared/src/retry.ts","../../../connector-shared/src/version.ts","../../../connector-shared/src/request.ts","../../../connector-shared/src/rate-limit.ts","../../../connector-shared/src/pagination.ts","../src/linear.ts","../src/index.ts"],"sourcesContent":["import type { HttpResponse } from './types';\n\nexport type HttpErrorKind =\n | 'transient'\n | 'rate_limit'\n | 'auth'\n | 'upstream_bug'\n | 'client_bug';\n\nexport abstract class HttpClientError extends Error {\n abstract readonly kind: HttpErrorKind;\n readonly response?: HttpResponse;\n\n constructor(message: string, response?: HttpResponse) {\n super(message);\n this.name = new.target.name;\n this.response = response;\n }\n}\n\nexport class TransientError extends HttpClientError {\n readonly kind = 'transient' as const;\n}\n\nexport class RateLimitError extends HttpClientError {\n readonly kind = 'rate_limit' as const;\n readonly retryAfter?: Date;\n\n constructor(message: string, response?: HttpResponse, retryAfter?: Date) {\n super(message, response);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class AuthError extends HttpClientError {\n readonly kind = 'auth' as const;\n}\n\nexport class UpstreamBugError extends HttpClientError {\n readonly kind = 'upstream_bug' as const;\n}\n\nexport class ClientBugError extends HttpClientError {\n readonly kind = 'client_bug' as const;\n}\n\nexport function classifyStatus(status: number): HttpErrorKind {\n if (status === 429) {\n return 'rate_limit';\n }\n if (status === 401 || status === 403) {\n return 'auth';\n }\n if (status === 408) {\n return 'transient';\n }\n if (status >= 500) {\n return 'upstream_bug';\n }\n if (status >= 400) {\n return 'client_bug';\n }\n return 'client_bug';\n}\n\nexport function errorForStatus(\n message: string,\n response: HttpResponse,\n retryAfter?: Date,\n): HttpClientError {\n const kind = classifyStatus(response.status);\n switch (kind) {\n case 'rate_limit':\n return new RateLimitError(message, response, retryAfter);\n case 'auth':\n return new AuthError(message, response);\n case 'transient':\n return new TransientError(message, response);\n case 'upstream_bug':\n return new UpstreamBugError(message, response);\n case 'client_bug':\n return new ClientBugError(message, response);\n }\n}\n","import { HttpClientError, RateLimitError, TransientError } from './errors';\n\nexport interface RetryPolicy {\n maxAttempts?: number;\n initialDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (status: number | null, err?: Error) => boolean;\n}\n\nexport const defaultRetryOn = (status: number | null, err?: Error): boolean => {\n if (err instanceof RateLimitError) {\n return true;\n }\n if (err instanceof TransientError) {\n return true;\n }\n if (status === null) {\n return err instanceof Error && !(err instanceof HttpClientError);\n }\n if (status === 408 || status === 429) {\n return true;\n }\n if (status >= 500) {\n return true;\n }\n return false;\n};\n\nexport function backoffDelayMs(\n attempt: number,\n policy: Required<Pick<RetryPolicy, 'initialDelayMs' | 'maxDelayMs'>>,\n): number {\n const base = policy.initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, policy.maxDelayMs);\n}\n\nexport function parseRetryAfter(\n headerValue: string | null,\n now: Date = new Date(),\n): Date | undefined {\n if (!headerValue) {\n return undefined;\n }\n const trimmed = headerValue.trim();\n if (/^\\d+$/.test(trimmed)) {\n return new Date(now.getTime() + Number(trimmed) * 1000);\n }\n const parsed = Date.parse(trimmed);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n return new Date(parsed);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) {\n return Promise.reject(signal.reason ?? new Error('Aborted'));\n }\n return new Promise<void>((resolve, reject) => {\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal!.reason ?? new Error('Aborted'));\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","export const HTTP_CLIENT_VERSION = '0.0.0';\n\nexport const DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n","import {\n AuthError,\n ClientBugError,\n HttpClientError,\n RateLimitError,\n TransientError,\n UpstreamBugError,\n errorForStatus,\n} from './errors';\nimport { defaultRetryOn, parseRetryAfter, sleep } from './retry';\nimport type { FetchLike, HttpMethod, HttpRequest, HttpResponse } from './types';\nimport { DEFAULT_USER_AGENT } from './version';\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_INITIAL_DELAY_MS = 1000;\nconst DEFAULT_MAX_DELAY_MS = 60_000;\nconst OBSERVER_TIMEOUT_MS = 250;\n\nexport interface RequestObservation {\n url: string;\n method: HttpMethod;\n status: number;\n resource: string;\n requestId: string;\n body: unknown;\n}\n\nexport type RequestObserver = (\n event: RequestObservation,\n) => void | Promise<void>;\n\nexport interface RequestOptions {\n fetch?: FetchLike;\n observer?: RequestObserver;\n resource: string;\n requestId?: string;\n}\n\nasync function notifyObserver(\n observer: RequestObserver,\n event: RequestObservation,\n): Promise<void> {\n let result: void | Promise<void>;\n try {\n result = observer(event);\n } catch (err) {\n console.warn('[connector-shared] request observer threw:', err);\n return;\n }\n if (!(result instanceof Promise)) {\n return;\n }\n const guarded = result.catch((err) => {\n console.warn('[connector-shared] request observer rejected:', err);\n });\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, OBSERVER_TIMEOUT_MS);\n });\n try {\n await Promise.race([guarded, timeout]);\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n}\n\nfunction newRequestId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction mergeHeaders(\n defaults: Record<string, string>,\n overrides: Record<string, string> | undefined,\n): Record<string, string> {\n const merged: Record<string, string> = {};\n for (const [k, v] of Object.entries(defaults)) {\n merged[k.toLowerCase()] = v;\n }\n if (overrides) {\n for (const [k, v] of Object.entries(overrides)) {\n merged[k.toLowerCase()] = v;\n }\n }\n return merged;\n}\n\nfunction linkTimeoutSignal(\n parent: AbortSignal | undefined,\n timeoutMs: number,\n): { signal: AbortSignal; cancel: () => void } {\n const controller = new AbortController();\n const onParentAbort = () => {\n controller.abort(parent?.reason);\n };\n if (parent) {\n if (parent.aborted) {\n controller.abort(parent.reason);\n } else {\n parent.addEventListener('abort', onParentAbort, { once: true });\n }\n }\n const timer = setTimeout(() => {\n controller.abort(new Error(`Request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n return {\n signal: controller.signal,\n cancel: () => {\n clearTimeout(timer);\n if (parent) {\n parent.removeEventListener('abort', onParentAbort);\n }\n },\n };\n}\n\nasync function readBody(res: Response, parseJson: boolean): Promise<unknown> {\n if (res.status === 204 || res.status === 205) {\n return null;\n }\n const contentType = res.headers.get('content-type') ?? '';\n if (parseJson && contentType.includes('application/json')) {\n const text = await res.text();\n if (text.length === 0) {\n return null;\n }\n return JSON.parse(text);\n }\n return res.text();\n}\n\nexport async function request<T = unknown>(\n req: HttpRequest,\n options: RequestOptions,\n): Promise<HttpResponse<T>> {\n const fetchImpl: FetchLike = options.fetch ?? (globalThis.fetch as FetchLike);\n const retry = req.retry ?? {};\n const maxAttempts = retry.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n const initialDelayMs = retry.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n const maxDelayMs = retry.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n const retryOn = retry.retryOn ?? defaultRetryOn;\n const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const parseJson = req.parseJson ?? true;\n\n const headers = mergeHeaders(\n {\n 'User-Agent': DEFAULT_USER_AGENT,\n Accept: 'application/json',\n },\n req.headers,\n );\n\n let lastErr: Error | undefined;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n req.signal?.throwIfAborted();\n\n const { signal, cancel } = linkTimeoutSignal(req.signal, timeoutMs);\n let res: Response;\n try {\n res = await fetchImpl(req.url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body as RequestInit['body'],\n signal,\n });\n } catch (err) {\n cancel();\n if (req.signal?.aborted) {\n throw req.signal.reason ?? err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n lastErr = error;\n if (attempt < maxAttempts - 1 && retryOn(null, error)) {\n const delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n await sleep(delay, req.signal);\n continue;\n }\n throw new TransientError(error.message);\n }\n cancel();\n\n const body = await readBody(res, parseJson);\n const httpResponse: HttpResponse<T> = {\n status: res.status,\n headers: res.headers,\n body: body as T,\n };\n if (req.rateLimit) {\n const state = req.rateLimit.parse(res.headers);\n if (state) {\n httpResponse.rateLimitState = state;\n }\n }\n\n if (options.observer) {\n await notifyObserver(options.observer, {\n url: req.url,\n method: req.method ?? 'GET',\n status: res.status,\n resource: options.resource,\n requestId: options.requestId ?? newRequestId(),\n body,\n });\n }\n\n if (res.ok) {\n return httpResponse;\n }\n\n const retryAfter = parseRetryAfter(res.headers.get('retry-after'));\n const message = `HTTP ${res.status} ${res.statusText} for ${req.method ?? 'GET'} ${req.url}`;\n const err = errorForStatus(message, httpResponse, retryAfter);\n\n if (\n attempt < maxAttempts - 1 &&\n retryOn(res.status, err) &&\n !(err instanceof AuthError) &&\n !(err instanceof ClientBugError)\n ) {\n lastErr = err;\n let delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n if (err instanceof RateLimitError && retryAfter) {\n const wait = retryAfter.getTime() - Date.now();\n if (wait > 0) {\n delay = Math.min(wait, maxDelayMs);\n }\n }\n await sleep(delay, req.signal);\n continue;\n }\n\n throw err;\n }\n\n throw lastErr ?? new UpstreamBugError('Exhausted retry attempts');\n}\n\nfunction computeDelay(\n attempt: number,\n initialDelayMs: number,\n maxDelayMs: number,\n): number {\n const base = initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, maxDelayMs);\n}\n\nexport { HttpClientError };\n","export interface RateLimitState {\n remaining: number;\n resetAt: Date;\n}\n\nexport interface RateLimitPolicy {\n parse(headers: Headers): RateLimitState | null;\n}\n\nexport const githubRateLimit: RateLimitPolicy = {\n parse(h) {\n const remainingRaw = h.get('x-ratelimit-remaining');\n const resetRaw = h.get('x-ratelimit-reset');\n if (remainingRaw === null || resetRaw === null) {\n return null;\n }\n const remaining = Number(remainingRaw);\n const reset = Number(resetRaw);\n if (!Number.isFinite(remaining) || !Number.isFinite(reset) || reset < 0) {\n return null;\n }\n return { remaining, resetAt: new Date(reset * 1000) };\n },\n};\n\nexport const sentryRateLimit: RateLimitPolicy = {\n parse(h) {\n const concurrent = h.get('x-sentry-rate-limit-remaining');\n const reset = h.get('x-sentry-rate-limit-reset');\n if (concurrent === null || reset === null) {\n return null;\n }\n const remaining = Number(concurrent);\n const resetSec = Number(reset);\n if (\n !Number.isFinite(remaining) ||\n !Number.isFinite(resetSec) ||\n resetSec < 0\n ) {\n return null;\n }\n return { remaining, resetAt: new Date(resetSec * 1000) };\n },\n};\n\nexport const linearRateLimit: RateLimitPolicy = {\n parse(h) {\n const remainingRaw = h.get('x-ratelimit-requests-remaining');\n const resetRaw = h.get('x-ratelimit-requests-reset');\n if (remainingRaw === null) {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n let resetAt: Date;\n if (resetRaw !== null) {\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n resetAt = new Date(reset);\n } else {\n resetAt = new Date(Date.now() + 60_000);\n }\n return { remaining, resetAt };\n },\n};\n","import { request } from './request';\nimport type { HttpRequest } from './types';\n\nexport function parseLinkHeader(header: string | null): Record<string, string> {\n if (!header) {\n return {};\n }\n const result: Record<string, string> = {};\n for (const part of header.split(',')) {\n const match = part.match(/<([^>]+)>\\s*;\\s*rel=\"([^\"]+)\"/);\n if (match) {\n result[match[2]!] = match[1]!;\n }\n }\n return result;\n}\n\nexport async function* paginateLink<T>(\n initial: HttpRequest,\n parse: (body: unknown) => T[],\n options: { resource: string },\n): AsyncIterable<T> {\n let next: string | null = initial.url;\n while (next) {\n const res: Awaited<ReturnType<typeof request>> = await request(\n {\n ...initial,\n url: next,\n },\n { resource: options.resource },\n );\n for (const item of parse(res.body)) {\n yield item;\n }\n const links = parseLinkHeader(res.headers.get('link'));\n next = links['next'] ?? null;\n }\n}\n\nexport async function* paginateCursor<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; nextCursor: string | null },\n buildNext: (req: HttpRequest, cursor: string) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let req: HttpRequest = initial;\n while (true) {\n const res = await request(req, { resource: options.resource });\n const { items, nextCursor } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!nextCursor) {\n return;\n }\n req = buildNext(req, nextCursor);\n }\n}\n\nexport async function* paginatePage<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; hasMore: boolean },\n buildPage: (req: HttpRequest, page: number) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let page = 1;\n while (true) {\n const req = page === 1 ? initial : buildPage(initial, page);\n const res = await request(req, { resource: options.resource });\n const { items, hasMore } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!hasMore || items.length === 0) {\n return;\n }\n page++;\n }\n}\n","import { type HttpResponse, linearRateLimit } from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type CredentialsSchema,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n paginateChunked,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n apiKey: z.object({ $secret: z.string() }).meta({\n label: 'API Key',\n description:\n 'Linear Personal API Key. Create one at Linear → Settings → API → Personal API keys.',\n placeholder: 'lin_api_...',\n secret: true,\n }),\n teamIds: z.array(z.string().min(1)).nonempty().optional().meta({\n label: 'Team IDs (optional)',\n description:\n 'Restrict the sync to specific Linear team IDs. Omit to sync all teams the API key can see.',\n }),\n resources: z\n .array(z.enum(['teams', 'users', 'cycles', 'issues']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Linear resources to sync. Omit to sync all resources. The `issues` phase also emits state-transition events derived from each issue's history.\",\n }),\n historyPerIssue: z.number().int().positive().max(50).optional().meta({\n label: 'History entries per issue',\n description:\n 'How many history entries to pull per issue (newest first). State transitions inside this window become events. Defaults to 25.',\n placeholder: '25',\n }),\n }),\n);\n\nexport interface LinearSettings {\n teamIds?: readonly string[];\n resources?: readonly LinearResource[];\n historyPerIssue?: number;\n}\n\nconst linearCredentials = {\n apiKey: {\n description: 'Linear Personal API Key',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype LinearCredentials = typeof linearCredentials;\n\nconst PHASE_ORDER = ['teams', 'users', 'cycles', 'issues'] as const;\n\ntype LinearPhase = (typeof PHASE_ORDER)[number];\n\nexport type LinearResource = LinearPhase;\n\ntype LinearSyncCursor = ChunkedSyncCursor<LinearPhase, string>;\n\nfunction isLinearSyncCursor(value: unknown): value is LinearSyncCursor {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const v = value as { phase?: unknown; page?: unknown };\n if (typeof v.phase !== 'string') {\n return false;\n }\n if (!(PHASE_ORDER as readonly string[]).includes(v.phase)) {\n return false;\n }\n if (v.page !== null && typeof v.page !== 'string') {\n return false;\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Linear GraphQL types\n// ---------------------------------------------------------------------------\n\ninterface PageInfo {\n hasNextPage: boolean;\n endCursor: string | null;\n}\n\ninterface Connection<T> {\n nodes: T[];\n pageInfo: PageInfo;\n}\n\ninterface LinearTeam {\n id: string;\n name: string;\n key: string;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface LinearUser {\n id: string;\n name: string;\n email: string | null;\n displayName: string;\n active: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface LinearCycle {\n id: string;\n number: number;\n name: string | null;\n startsAt: string;\n endsAt: string;\n completedAt: string | null;\n progress: number | null;\n scopeHistory: number[] | null;\n completedScopeHistory: number[] | null;\n team: { id: string } | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface LinearIssueHistory {\n id: string;\n createdAt: string;\n actor: { id: string } | null;\n fromState: { id: string; name: string } | null;\n toState: { id: string; name: string } | null;\n fromAssignee: { id: string } | null;\n toAssignee: { id: string } | null;\n}\n\ninterface LinearIssue {\n id: string;\n identifier: string;\n title: string;\n priority: number;\n estimate: number | null;\n state: { id: string; name: string; type: string } | null;\n assignee: { id: string } | null;\n team: { id: string } | null;\n project: { id: string } | null;\n cycle: { id: string } | null;\n labels: { nodes: Array<{ id: string; name: string }> };\n createdAt: string;\n updatedAt: string;\n completedAt: string | null;\n canceledAt: string | null;\n startedAt: string | null;\n history: Connection<LinearIssueHistory>;\n}\n\ninterface GraphQLError {\n message: string;\n extensions?: { code?: string; type?: string };\n}\n\ninterface GraphQLResponse<T> {\n data?: T;\n errors?: GraphQLError[];\n}\n\n// ---------------------------------------------------------------------------\n// GraphQL documents\n// ---------------------------------------------------------------------------\n\nconst TEAMS_QUERY = `\n query Teams($after: String, $first: Int!, $filter: TeamFilter) {\n teams(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes { id name key createdAt updatedAt }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nconst USERS_QUERY = `\n query Users($after: String, $first: Int!, $filter: UserFilter) {\n users(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes { id name email displayName active createdAt updatedAt }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nconst CYCLES_QUERY = `\n query Cycles($after: String, $first: Int!, $filter: CycleFilter) {\n cycles(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes {\n id number name startsAt endsAt completedAt progress\n scopeHistory completedScopeHistory\n team { id }\n createdAt updatedAt\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nconst ISSUES_QUERY = `\n query Issues(\n $after: String\n $first: Int!\n $filter: IssueFilter\n $historyFirst: Int!\n ) {\n issues(after: $after, first: $first, filter: $filter, orderBy: updatedAt) {\n nodes {\n id identifier title priority estimate\n state { id name type }\n assignee { id }\n team { id }\n project { id }\n cycle { id }\n labels { nodes { id name } }\n createdAt updatedAt completedAt canceledAt startedAt\n history(first: $historyFirst) {\n nodes {\n id createdAt\n actor { id }\n fromState { id name }\n toState { id name }\n fromAssignee { id }\n toAssignee { id }\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// LinearConnector\n// ---------------------------------------------------------------------------\n\nconst PAGE_SIZE = 50;\nconst DEFAULT_HISTORY_PER_ISSUE = 25;\nconst ENDPOINT = 'https://api.linear.app/graphql';\n\nexport class LinearConnector extends BaseConnector<\n LinearSettings,\n LinearCredentials\n> {\n static readonly id = 'linear';\n\n static create(input: unknown, ctx?: ConnectorContext): LinearConnector {\n const parsed = configFields.parse(input);\n return new LinearConnector(\n {\n teamIds: parsed.teamIds,\n resources: parsed.resources,\n historyPerIssue: parsed.historyPerIssue,\n },\n { apiKey: parsed.apiKey },\n ctx,\n );\n }\n\n readonly id = 'linear';\n override readonly credentials = linearCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: this.creds.apiKey,\n 'Content-Type': 'application/json',\n 'User-Agent': 'rawdash/connector-linear (+https://rawdash.dev)',\n };\n }\n\n private async graphql<T>(\n query: string,\n variables: Record<string, unknown>,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<GraphQLResponse<T>>> {\n const res = await this.post<GraphQLResponse<T>>(ENDPOINT, {\n resource,\n headers: this.buildHeaders(),\n body: JSON.stringify({ query, variables }),\n signal,\n rateLimit: linearRateLimit,\n });\n if (res.body.errors && res.body.errors.length > 0) {\n const messages = res.body.errors.map((e) => e.message).join('; ');\n throw new Error(`Linear GraphQL error: ${messages}`);\n }\n if (!res.body.data) {\n throw new Error(\n `Linear GraphQL response missing data for resource '${resource}'`,\n );\n }\n return res;\n }\n\n private sinceFilter(\n options: SyncOptions,\n ): Record<string, unknown> | undefined {\n if (options.mode !== 'latest' || !options.since) {\n return undefined;\n }\n return { updatedAt: { gt: options.since } };\n }\n\n private teamFilter(): Record<string, unknown> | undefined {\n const ids = this.settings.teamIds;\n if (!ids || ids.length === 0) {\n return undefined;\n }\n return { id: { in: [...ids] } };\n }\n\n private issueTeamFilter(): Record<string, unknown> | undefined {\n const ids = this.settings.teamIds;\n if (!ids || ids.length === 0) {\n return undefined;\n }\n return { team: { id: { in: [...ids] } } };\n }\n\n private mergeFilters(\n ...filters: Array<Record<string, unknown> | undefined>\n ): Record<string, unknown> | undefined {\n const merged: Record<string, unknown> = {};\n let any = false;\n for (const f of filters) {\n if (f) {\n Object.assign(merged, f);\n any = true;\n }\n }\n return any ? merged : undefined;\n }\n\n // ---------------------------------------------------------------------------\n // Fetchers\n // ---------------------------------------------------------------------------\n\n private async fetchTeamsPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearTeam[]; next: string | null }> {\n const filter = this.mergeFilters(\n this.teamFilter(),\n this.sinceFilter(options),\n );\n const res = await this.graphql<{ teams: Connection<LinearTeam> }>(\n TEAMS_QUERY,\n { after: page ?? null, first: PAGE_SIZE, filter },\n 'teams',\n signal,\n );\n const conn = res.body.data!.teams;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n private async fetchUsersPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearUser[]; next: string | null }> {\n const res = await this.graphql<{ users: Connection<LinearUser> }>(\n USERS_QUERY,\n {\n after: page ?? null,\n first: PAGE_SIZE,\n filter: this.sinceFilter(options),\n },\n 'users',\n signal,\n );\n const conn = res.body.data!.users;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n private async fetchCyclesPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearCycle[]; next: string | null }> {\n const teamIds = this.settings.teamIds;\n const teamFilter =\n teamIds && teamIds.length > 0\n ? { team: { id: { in: [...teamIds] } } }\n : undefined;\n const filter = this.mergeFilters(teamFilter, this.sinceFilter(options));\n const res = await this.graphql<{ cycles: Connection<LinearCycle> }>(\n CYCLES_QUERY,\n { after: page ?? null, first: PAGE_SIZE, filter },\n 'cycles',\n signal,\n );\n const conn = res.body.data!.cycles;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n private async fetchIssuesPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: LinearIssue[]; next: string | null }> {\n const filter = this.mergeFilters(\n this.issueTeamFilter(),\n this.sinceFilter(options),\n );\n const historyFirst =\n this.settings.historyPerIssue ?? DEFAULT_HISTORY_PER_ISSUE;\n const res = await this.graphql<{ issues: Connection<LinearIssue> }>(\n ISSUES_QUERY,\n { after: page ?? null, first: PAGE_SIZE, filter, historyFirst },\n 'issues',\n signal,\n );\n const conn = res.body.data!.issues;\n return {\n items: conn.nodes,\n next: conn.pageInfo.hasNextPage ? conn.pageInfo.endCursor : null,\n };\n }\n\n // ---------------------------------------------------------------------------\n // Writers\n // ---------------------------------------------------------------------------\n\n private async writeTeams(\n storage: StorageHandle,\n teams: LinearTeam[],\n ): Promise<void> {\n for (const t of teams) {\n await storage.entity({\n type: 'linear_team',\n id: t.id,\n attributes: {\n name: t.name,\n key: t.key,\n createdAt: new Date(t.createdAt).getTime(),\n },\n updated_at: new Date(t.updatedAt).getTime(),\n });\n }\n }\n\n private async writeUsers(\n storage: StorageHandle,\n users: LinearUser[],\n ): Promise<void> {\n for (const u of users) {\n await storage.entity({\n type: 'linear_user',\n id: u.id,\n attributes: {\n name: u.name,\n email: u.email,\n displayName: u.displayName,\n active: u.active,\n createdAt: new Date(u.createdAt).getTime(),\n },\n updated_at: new Date(u.updatedAt).getTime(),\n });\n }\n }\n\n private async writeCycles(\n storage: StorageHandle,\n cycles: LinearCycle[],\n ): Promise<void> {\n for (const c of cycles) {\n const startsMs = new Date(c.startsAt).getTime();\n const endsMs = new Date(c.endsAt).getTime();\n const scopeFinal =\n c.scopeHistory && c.scopeHistory.length > 0\n ? (c.scopeHistory.at(-1) ?? null)\n : null;\n const completedFinal =\n c.completedScopeHistory && c.completedScopeHistory.length > 0\n ? (c.completedScopeHistory.at(-1) ?? null)\n : null;\n await storage.entity({\n type: 'linear_cycle',\n id: c.id,\n attributes: {\n number: c.number,\n name: c.name,\n teamId: c.team?.id ?? null,\n startsAt: startsMs,\n endsAt: endsMs,\n completedAt: c.completedAt ? new Date(c.completedAt).getTime() : null,\n progress: c.progress,\n scope: scopeFinal,\n completedScope: completedFinal,\n },\n updated_at: new Date(c.updatedAt).getTime(),\n });\n }\n }\n\n private async writeIssues(\n storage: StorageHandle,\n issues: LinearIssue[],\n historySinceMs: number | null,\n ): Promise<void> {\n for (const i of issues) {\n await storage.entity({\n type: 'linear_issue',\n id: i.id,\n attributes: {\n identifier: i.identifier,\n title: i.title,\n stateId: i.state?.id ?? null,\n stateName: i.state?.name ?? null,\n stateType: i.state?.type ?? null,\n priority: i.priority,\n assigneeId: i.assignee?.id ?? null,\n teamId: i.team?.id ?? null,\n projectId: i.project?.id ?? null,\n cycleId: i.cycle?.id ?? null,\n labels: i.labels.nodes.map((l) => l.name),\n estimate: i.estimate,\n createdAt: new Date(i.createdAt).getTime(),\n completedAt: i.completedAt ? new Date(i.completedAt).getTime() : null,\n canceledAt: i.canceledAt ? new Date(i.canceledAt).getTime() : null,\n startedAt: i.startedAt ? new Date(i.startedAt).getTime() : null,\n },\n updated_at: new Date(i.updatedAt).getTime(),\n });\n\n for (const h of i.history.nodes) {\n if (!h.toState || !h.fromState) {\n continue;\n }\n if (h.toState.id === h.fromState.id) {\n continue;\n }\n const eventTs = new Date(h.createdAt).getTime();\n if (historySinceMs !== null && eventTs <= historySinceMs) {\n continue;\n }\n await storage.event({\n name: 'linear_issue_state_change',\n start_ts: eventTs,\n end_ts: null,\n attributes: {\n historyId: h.id,\n issueId: i.id,\n issueIdentifier: i.identifier,\n teamId: i.team?.id ?? null,\n actorId: h.actor?.id ?? null,\n fromStateId: h.fromState.id,\n fromStateName: h.fromState.name,\n toStateId: h.toState.id,\n toStateName: h.toState.name,\n },\n });\n }\n }\n }\n\n // ---------------------------------------------------------------------------\n // sync\n // ---------------------------------------------------------------------------\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = isLinearSyncCursor(options.cursor)\n ? options.cursor\n : undefined;\n const isFull = options.mode === 'full';\n const historySinceMs =\n options.mode === 'latest' && options.since\n ? new Date(options.since).getTime()\n : null;\n\n const enabled = this.settings.resources;\n const phases =\n enabled && enabled.length > 0\n ? PHASE_ORDER.filter((p) => enabled.includes(p))\n : PHASE_ORDER;\n\n return paginateChunked<LinearPhase, string>({\n phases,\n cursor,\n signal,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'teams':\n return this.fetchTeamsPage(page, options, sig);\n case 'users':\n return this.fetchUsersPage(page, options, sig);\n case 'cycles':\n return this.fetchCyclesPage(page, options, sig);\n case 'issues':\n return this.fetchIssuesPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'teams':\n await storage.entities([], { types: ['linear_team'] });\n break;\n case 'users':\n await storage.entities([], { types: ['linear_user'] });\n break;\n case 'cycles':\n await storage.entities([], { types: ['linear_cycle'] });\n break;\n case 'issues':\n await storage.entities([], { types: ['linear_issue'] });\n await storage.events([], {\n names: ['linear_issue_state_change'],\n });\n break;\n }\n }\n switch (phase) {\n case 'teams':\n return this.writeTeams(storage, items as LinearTeam[]);\n case 'users':\n return this.writeUsers(storage, items as LinearUser[]);\n case 'cycles':\n return this.writeCycles(storage, items as LinearCycle[]);\n case 'issues':\n return this.writeIssues(\n storage,\n items as LinearIssue[],\n historySinceMs,\n );\n }\n },\n });\n }\n}\n","import { LinearConnector } from './linear';\n\nexport { configFields, LinearConnector } from './linear';\nexport type { LinearSettings, LinearResource } from './linear';\nexport default LinearConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AE2CnE,IAAM,kBAAmC;EAC9C,MAAM,GAAG;AACP,UAAM,eAAe,EAAE,IAAI,gCAAgC;AAC3D,UAAM,WAAW,EAAE,IAAI,4BAA4B;AACnD,QAAI,iBAAiB,MAAM;AACzB,aAAO;IACT;AACA,UAAM,YAAY,OAAO,YAAY;AACrC,QAAI,CAAC,OAAO,SAAS,SAAS,GAAG;AAC/B,aAAO;IACT;AACA,QAAI;AACJ,QAAI,aAAa,MAAM;AACrB,YAAM,QAAQ,OAAO,QAAQ;AAC7B,UAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG;AACxC,eAAO;MACT;AACA,gBAAU,IAAI,KAAK,KAAK;IAC1B,OAAO;AACL,gBAAU,IAAI,KAAK,KAAK,IAAI,IAAI,GAAM;IACxC;AACA,WAAO,EAAE,WAAW,QAAQ;EAC9B;AACF;;;AEnEA;AAAA,EACE;AAAA,EAOA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAEX,IAAM,eAAe;AAAA,EAC1B,EAAE,OAAO;AAAA,IACP,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK;AAAA,MAC7C,OAAO;AAAA,MACP,aACE;AAAA,MACF,aAAa;AAAA,MACb,QAAQ;AAAA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AK;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,QACJ;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;AC3oBA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rawdash/connector-linear",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Rawdash connector for Linear — issues, cycles, teams, and users",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -21,20 +21,22 @@
|
|
|
21
21
|
"import": "./dist/index.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsup",
|
|
26
|
-
"typecheck": "tsc --noEmit",
|
|
27
|
-
"lint": "eslint src",
|
|
28
|
-
"test": "vitest run"
|
|
29
|
-
},
|
|
30
24
|
"dependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
25
|
+
"zod": "^4.4.3",
|
|
26
|
+
"@rawdash/core": "0.14.0"
|
|
33
27
|
},
|
|
34
28
|
"devDependencies": {
|
|
35
|
-
"
|
|
29
|
+
"fast-check": "^4.8.0",
|
|
36
30
|
"tsup": "^8.0.0",
|
|
37
31
|
"typescript": "^5.7.2",
|
|
38
|
-
"vitest": "^4.1.4"
|
|
32
|
+
"vitest": "^4.1.4",
|
|
33
|
+
"@rawdash/connector-shared": "0.2.0",
|
|
34
|
+
"@rawdash/connector-test-utils": "0.0.1"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"lint": "eslint src",
|
|
40
|
+
"test": "vitest run"
|
|
39
41
|
}
|
|
40
|
-
}
|
|
42
|
+
}
|