@rawdash/connector-asana 0.27.0 → 0.28.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/dist/index.d.ts +1 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
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/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -225,6 +225,7 @@ var AsanaConnector = class _AsanaConnector extends BaseConnector {
|
|
|
225
225
|
}
|
|
226
226
|
id = id;
|
|
227
227
|
credentials = asanaCredentials;
|
|
228
|
+
taskSeen = /* @__PURE__ */ new Set();
|
|
228
229
|
buildHeaders() {
|
|
229
230
|
return {
|
|
230
231
|
Authorization: `Bearer ${this.creds.apiToken}`,
|
|
@@ -277,8 +278,7 @@ var AsanaConnector = class _AsanaConnector extends BaseConnector {
|
|
|
277
278
|
"/projects",
|
|
278
279
|
{
|
|
279
280
|
workspace: this.settings.workspaceGid,
|
|
280
|
-
opt_fields: PROJECT_FIELDS
|
|
281
|
-
archived: "false"
|
|
281
|
+
opt_fields: PROJECT_FIELDS
|
|
282
282
|
},
|
|
283
283
|
page,
|
|
284
284
|
PROJECTS_PAGE_SIZE,
|
|
@@ -360,7 +360,6 @@ var AsanaConnector = class _AsanaConnector extends BaseConnector {
|
|
|
360
360
|
projectGids = projectsPage.items.map((p) => p.gid);
|
|
361
361
|
next = projectsPage.next;
|
|
362
362
|
}
|
|
363
|
-
const seen = /* @__PURE__ */ new Set();
|
|
364
363
|
const items = [];
|
|
365
364
|
for (const projectGid of projectGids) {
|
|
366
365
|
const tasks = await this.fetchTasksForProject(
|
|
@@ -369,10 +368,10 @@ var AsanaConnector = class _AsanaConnector extends BaseConnector {
|
|
|
369
368
|
signal
|
|
370
369
|
);
|
|
371
370
|
for (const task of tasks) {
|
|
372
|
-
if (
|
|
371
|
+
if (this.taskSeen.has(task.gid)) {
|
|
373
372
|
continue;
|
|
374
373
|
}
|
|
375
|
-
|
|
374
|
+
this.taskSeen.add(task.gid);
|
|
376
375
|
const stories = wantEvents ? await this.fetchStoriesForTask(task.gid, signal) : [];
|
|
377
376
|
items.push({ task, projectGid, stories });
|
|
378
377
|
}
|
|
@@ -468,6 +467,9 @@ var AsanaConnector = class _AsanaConnector extends BaseConnector {
|
|
|
468
467
|
}
|
|
469
468
|
async sync(options, storage, signal) {
|
|
470
469
|
const cursor = isAsanaSyncCursor(options.cursor) ? options.cursor : void 0;
|
|
470
|
+
if (!cursor) {
|
|
471
|
+
this.taskSeen.clear();
|
|
472
|
+
}
|
|
471
473
|
const isFull = options.mode === "full";
|
|
472
474
|
const sinceMs = options.since ? parseEpoch(options.since, "iso") : null;
|
|
473
475
|
const phases = this.activePhases();
|
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/map-concurrent.ts","../../../connector-shared/src/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/asana.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\nexport function connectorUserAgent(connectorId: string): string {\n return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n}\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 interface StandardRateLimitPolicyConfig {\n remainingHeader: string;\n resetHeader: string;\n resetUnit: 's' | 'ms';\n resetFallbackMs?: number;\n}\n\nexport function standardRateLimitPolicy(\n config: StandardRateLimitPolicyConfig,\n): RateLimitPolicy {\n const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;\n const multiplier = resetUnit === 's' ? 1000 : 1;\n return {\n parse(h) {\n const remainingRaw = h.get(remainingHeader);\n if (remainingRaw === null || remainingRaw.trim() === '') {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n const resetRaw = h.get(resetHeader);\n if (resetRaw === null) {\n if (resetFallbackMs === undefined) {\n return null;\n }\n return {\n remaining,\n resetAt: new Date(Date.now() + resetFallbackMs),\n };\n }\n if (resetRaw.trim() === '') {\n return null;\n }\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n const resetMs = reset * multiplier;\n if (!Number.isFinite(resetMs)) {\n return null;\n }\n return { remaining, resetAt: new Date(resetMs) };\n },\n };\n}\n","export async function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n if (items.length === 0) {\n return results;\n }\n const normalized = Number.isFinite(concurrency) ? Math.floor(concurrency) : 1;\n const limit = Math.max(1, Math.min(normalized, items.length));\n let next = 0;\n let failed = false;\n\n async function worker(): Promise<void> {\n while (!failed) {\n const i = next++;\n if (i >= items.length) {\n return;\n }\n try {\n results[i] = await fn(items[i]!, i);\n } catch (err) {\n failed = true;\n throw err;\n }\n }\n }\n\n const workers: Promise<void>[] = [];\n for (let w = 0; w < limit; w++) {\n workers.push(worker());\n }\n await Promise.all(workers);\n return results;\n}\n","export interface SanitizeAllowedUrlOptions {\n url: string | null;\n host: string;\n pathname: string;\n protocol?: 'https:' | 'http:';\n}\n\nexport function sanitizeAllowedUrl(\n options: SanitizeAllowedUrlOptions,\n): string | null {\n const { url, host, pathname, protocol = 'https:' } = options;\n if (url === null) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n}\n","export type EpochUnit = 'ms' | 's' | 'iso';\n\nexport function parseEpoch(\n value: number | string | null | undefined,\n unit: EpochUnit,\n): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (unit === 'iso') {\n if (typeof value !== 'string') {\n return null;\n }\n const ms = new Date(value).getTime();\n return Number.isFinite(ms) ? ms : null;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return null;\n }\n const n = typeof value === 'number' ? value : Number(value);\n if (!Number.isFinite(n)) {\n return null;\n }\n const result = unit === 's' ? n * 1000 : n;\n return Number.isFinite(result) ? result : null;\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","export type LogFields = Record<string, unknown>;\n\nexport interface ConnectorLogger {\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n}\n\nexport interface ConnectorLoggerOptions {\n scope: string;\n}\n\nconst MAX_VALUE_LEN = 120;\n\nfunction truncate(s: string, max = MAX_VALUE_LEN): string {\n if (s.length <= max) {\n return s;\n }\n return `${s.slice(0, max - 1)}…`;\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return '';\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'string') {\n const t = truncate(value);\n if (/[\\s\"=]/.test(t)) {\n return JSON.stringify(t);\n }\n return t;\n }\n if (typeof value === 'bigint') {\n return value.toString();\n }\n let json: string | undefined;\n try {\n json = JSON.stringify(value);\n } catch {\n json = undefined;\n }\n return truncate(json ?? String(value));\n}\n\nexport function formatLogFields(fields?: LogFields): string {\n if (!fields) {\n return '';\n }\n const parts: string[] = [];\n for (const [k, v] of Object.entries(fields)) {\n if (v === undefined) {\n continue;\n }\n parts.push(`${k}=${formatValue(v)}`);\n }\n return parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\nexport function formatLogLine(\n scope: string,\n event: string,\n fields?: LogFields,\n): string {\n return `[${scope}] ${event}${formatLogFields(fields)}`;\n}\n\nexport function createDefaultConnectorLogger(\n opts: ConnectorLoggerOptions,\n): ConnectorLogger {\n return {\n info(event, fields) {\n console.info(formatLogLine(opts.scope, event, fields));\n },\n warn(event, fields) {\n console.warn(formatLogLine(opts.scope, event, fields));\n },\n };\n}\n\nconst NOOP_LOGGER: ConnectorLogger = {\n info() {},\n warn() {},\n};\n\nexport function noopConnectorLogger(): ConnectorLogger {\n return NOOP_LOGGER;\n}\n","import {\n type HttpResponse,\n connectorUserAgent,\n parseEpoch,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ConnectorContext,\n type ConnectorDoc,\n type CredentialsSchema,\n type FetchSpec,\n type FilterClause,\n type JSONValue,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n defineConnectorDoc,\n defineResources,\n makeChunkedCursorGuard,\n paginateChunked,\n schemasFromResources,\n selectActivePhases,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n apiToken: z.object({ $secret: z.string() }).meta({\n label: 'Personal access token',\n description:\n 'Asana personal access token. Create one at app.asana.com → Settings → Apps → Developer apps → Personal access tokens.',\n placeholder: '2/1201234567890/...',\n secret: true,\n }),\n workspaceGid: z\n .string()\n .min(1)\n .regex(/^\\d+$/, 'Workspace GID is the numeric id of the workspace.')\n .meta({\n label: 'Workspace GID',\n description:\n 'Numeric GID of the workspace to sync. Find it at app.asana.com/api/1.0/workspaces.',\n placeholder: '1201234567890',\n }),\n projectGids: z.array(z.string().regex(/^\\d+$/)).nonempty().optional().meta({\n label: 'Project GIDs (optional)',\n description:\n 'Restrict the task sync to specific project GIDs. Omit to sync tasks from every project in the workspace.',\n }),\n resources: z\n .array(z.enum(['projects', 'users', 'tasks', 'task_events']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Asana resources to sync. Omit to sync all of them. 'task_events' shares the tasks scan - enabling it without 'tasks' still walks tasks (and fetches their stories) but skips writing task entities.\",\n }),\n }),\n);\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Asana',\n category: 'product',\n brandColor: '#F06A6A',\n tagline:\n 'Sync projects, users, tasks, and task state-change events from an Asana workspace.',\n vendor: {\n name: 'Asana',\n domain: 'asana.com',\n apiDocs: 'https://developers.asana.com/reference/rest-api-reference',\n website: 'https://asana.com',\n },\n auth: {\n summary:\n 'Authenticates with a personal access token sent as a Bearer credential. The token inherits the permissions of the account that created it.',\n setup: [\n 'Open app.asana.com -> Settings -> Apps -> Developer apps.',\n 'Under Personal access tokens, create a new token and copy its value.',\n 'Store the token as a secret and reference it from the connector config as `apiToken: secret(\"ASANA_API_TOKEN\")`, alongside the numeric workspaceGid.',\n 'Find your workspace GID at https://app.asana.com/api/1.0/workspaces while authenticated.',\n ],\n },\n rateLimit:\n 'Asana enforces per-token rate limits (150 req/min on free plans, 1500 on paid); 429 responses with Retry-After are honored.',\n limitations: [\n 'Task state-change events are derived from each task story; only system stories (not comments) are written.',\n 'A task in multiple projects is stored once, attributed to the first project it is scanned under.',\n 'Workspace-wide task search requires a paid plan, so tasks are walked project-by-project; omit projectGids to scan every project.',\n ],\n});\n\nexport type AsanaResource = 'projects' | 'users' | 'tasks' | 'task_events';\n\nexport interface AsanaSettings {\n workspaceGid: string;\n projectGids?: readonly string[];\n resources?: readonly AsanaResource[];\n}\n\nconst asanaCredentials = {\n apiToken: {\n description: 'Asana personal access token',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype AsanaCredentials = typeof asanaCredentials;\n\nconst PHASE_ORDER = ['projects', 'users', 'tasks'] as const;\n\ntype AsanaPhase = (typeof PHASE_ORDER)[number];\n\nconst isAsanaSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\ninterface AsanaGidRef {\n gid: string;\n}\n\ninterface AsanaProject {\n gid: string;\n name: string;\n archived?: boolean | null;\n created_at?: string | null;\n modified_at?: string | null;\n owner?: AsanaGidRef | null;\n team?: { name?: string | null } | null;\n}\n\ninterface AsanaUser {\n gid: string;\n name?: string | null;\n email?: string | null;\n}\n\ninterface AsanaTask {\n gid: string;\n name?: string | null;\n completed?: boolean | null;\n completed_at?: string | null;\n created_at?: string | null;\n modified_at?: string | null;\n due_on?: string | null;\n assignee?: AsanaGidRef | null;\n}\n\ninterface AsanaStory {\n gid: string;\n type?: string | null;\n resource_subtype?: string | null;\n created_at: string;\n created_by?: AsanaGidRef | null;\n text?: string | null;\n}\n\ninterface AsanaTaskWithContext {\n task: AsanaTask;\n projectGid: string;\n stories: AsanaStory[];\n}\n\ninterface AsanaPage<T> {\n data: T[];\n next_page?: { offset: string } | null;\n}\n\nconst gid = z.string().min(1);\n\nconst nextPageSchema = z.object({ offset: z.string() }).nullable().optional();\n\nconst projectsResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n name: z.string(),\n archived: z.boolean().nullable().optional(),\n created_at: z.iso.datetime().nullable().optional(),\n modified_at: z.iso.datetime().nullable().optional(),\n owner: z.object({ gid }).nullable().optional(),\n team: z\n .object({ name: z.string().nullable().optional() })\n .nullable()\n .optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nconst usersResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n name: z.string().nullable().optional(),\n email: z.string().nullable().optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nconst tasksResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n name: z.string().nullable().optional(),\n completed: z.boolean().nullable().optional(),\n completed_at: z.iso.datetime().nullable().optional(),\n created_at: z.iso.datetime().nullable().optional(),\n modified_at: z.iso.datetime().nullable().optional(),\n due_on: z.string().nullable().optional(),\n assignee: z.object({ gid }).nullable().optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nconst storiesResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n type: z.string().nullable().optional(),\n resource_subtype: z.string().nullable().optional(),\n created_at: z.iso.datetime(),\n created_by: z.object({ gid }).nullable().optional(),\n text: z.string().nullable().optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nexport const asanaResources = defineResources({\n asana_project: {\n shape: 'entity',\n filterable: [{ field: 'archived', ops: ['eq'] }],\n description:\n 'Projects in the workspace with name, archived state, owner, team, and timestamps.',\n endpoint: 'GET /projects',\n responses: { projects: projectsResponseSchema },\n },\n asana_user: {\n shape: 'entity',\n filterable: [],\n description: 'Users in the workspace with display name and email.',\n endpoint: 'GET /users',\n responses: { users: usersResponseSchema },\n },\n asana_task: {\n shape: 'entity',\n filterable: [\n { field: 'completed', ops: ['eq'] },\n { field: 'projectGid', ops: ['eq'] },\n { field: 'assigneeId', ops: ['eq'] },\n ],\n description:\n 'Tasks with completion state, assignee, due date, owning project, and timestamps.',\n endpoint: 'GET /tasks?project={projectGid}',\n notes:\n 'Tasks are walked project-by-project; a task in multiple projects is attributed to the first project scanned.',\n responses: { tasks: tasksResponseSchema },\n },\n asana_task_event: {\n shape: 'event',\n filterable: [],\n description:\n 'Task state-change events derived from system stories (completed, assigned, due-date changes, etc.).',\n endpoint: 'GET /tasks/{taskGid}/stories',\n notes:\n 'Only system stories are written; comments are skipped. start_ts is the story time, end_ts is null. Timestamps are Unix epoch milliseconds.',\n responses: { stories: storiesResponseSchema },\n },\n});\n\nconst API_BASE = 'https://app.asana.com/api/1.0';\nconst PROJECTS_PAGE_SIZE = 50;\nconst USERS_PAGE_SIZE = 100;\nconst TASKS_PAGE_SIZE = 100;\nconst STORIES_PAGE_SIZE = 100;\n\nconst PROJECT_FIELDS =\n 'name,archived,created_at,modified_at,owner.gid,team.name';\nconst USER_FIELDS = 'name,email';\nconst TASK_FIELDS =\n 'name,completed,completed_at,created_at,modified_at,due_on,assignee.gid';\nconst STORY_FIELDS = 'type,resource_subtype,created_at,created_by.gid,text';\n\nfunction pushableEq(\n filter: FilterClause[] | undefined,\n field: string,\n): string | null {\n if (!filter) {\n return null;\n }\n for (const clause of filter) {\n if (\n 'field' in clause &&\n clause.field === field &&\n clause.op === 'eq' &&\n typeof clause.value === 'string'\n ) {\n return clause.value;\n }\n }\n return null;\n}\n\nexport const id = 'asana';\n\nexport class AsanaConnector extends BaseConnector<\n AsanaSettings,\n AsanaCredentials\n> {\n static readonly id = id;\n\n static readonly resources = asanaResources;\n\n static readonly schemas = schemasFromResources(asanaResources);\n\n static create(input: unknown, ctx?: ConnectorContext): AsanaConnector {\n const parsed = configFields.parse(input);\n return new AsanaConnector(\n {\n workspaceGid: parsed.workspaceGid,\n projectGids: parsed.projectGids,\n resources: parsed.resources,\n },\n { apiToken: parsed.apiToken },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = asanaCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.creds.apiToken}`,\n Accept: 'application/json',\n 'User-Agent': connectorUserAgent('asana'),\n };\n }\n\n private fetch<T>(\n url: string,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<T>> {\n return this.get<T>(url, {\n resource,\n headers: this.buildHeaders(),\n signal,\n });\n }\n\n private activePhases(): AsanaPhase[] {\n return selectActivePhases<AsanaResource, AsanaPhase>(\n (r) => {\n switch (r) {\n case 'projects':\n return 'projects';\n case 'users':\n return 'users';\n case 'tasks':\n case 'task_events':\n return 'tasks';\n }\n },\n PHASE_ORDER,\n this.settings.resources,\n );\n }\n\n private singleSpec(\n options: SyncOptions,\n resource: string,\n ): FetchSpec | undefined {\n const specs = options.fetchSpecs?.[resource];\n return specs && specs.length === 1 ? specs[0] : undefined;\n }\n\n private async fetchCollection<T>(\n path: string,\n params: Record<string, string>,\n offset: string | null,\n pageSize: number,\n resource: string,\n signal: AbortSignal | undefined,\n ): Promise<{ items: T[]; next: string | null }> {\n const u = new URL(`${API_BASE}${path}`);\n for (const [k, v] of Object.entries(params)) {\n u.searchParams.set(k, v);\n }\n u.searchParams.set('limit', String(pageSize));\n if (offset !== null) {\n u.searchParams.set('offset', offset);\n }\n const res = await this.fetch<AsanaPage<T>>(u.toString(), resource, signal);\n return { items: res.body.data, next: res.body.next_page?.offset ?? null };\n }\n\n private fetchProjectsPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<{ items: AsanaProject[]; next: string | null }> {\n return this.fetchCollection<AsanaProject>(\n '/projects',\n {\n workspace: this.settings.workspaceGid,\n opt_fields: PROJECT_FIELDS,\n archived: 'false',\n },\n page,\n PROJECTS_PAGE_SIZE,\n 'projects',\n signal,\n );\n }\n\n private fetchUsersPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<{ items: AsanaUser[]; next: string | null }> {\n return this.fetchCollection<AsanaUser>(\n '/users',\n { workspace: this.settings.workspaceGid, opt_fields: USER_FIELDS },\n page,\n USERS_PAGE_SIZE,\n 'users',\n signal,\n );\n }\n\n private async fetchTasksForProject(\n projectGid: string,\n options: SyncOptions,\n signal: AbortSignal | undefined,\n ): Promise<AsanaTask[]> {\n const wantEvents = this.isResourceEnabled('task_events');\n const completed = pushableEq(\n this.singleSpec(options, 'asana_task')?.filter,\n 'completed',\n );\n const params: Record<string, string> = {\n project: projectGid,\n opt_fields: TASK_FIELDS,\n };\n if (options.mode === 'latest' && options.since && !wantEvents) {\n params['modified_since'] = options.since;\n }\n if (completed !== null) {\n params['completed_since'] = completed === 'false' ? 'now' : '1970-01-01';\n }\n const out: AsanaTask[] = [];\n let offset: string | null = null;\n do {\n signal?.throwIfAborted();\n const page: { items: AsanaTask[]; next: string | null } =\n await this.fetchCollection<AsanaTask>(\n '/tasks',\n params,\n offset,\n TASKS_PAGE_SIZE,\n 'tasks',\n signal,\n );\n out.push(...page.items);\n offset = page.next;\n } while (offset !== null);\n return out;\n }\n\n private async fetchStoriesForTask(\n taskGid: string,\n signal: AbortSignal | undefined,\n ): Promise<AsanaStory[]> {\n const out: AsanaStory[] = [];\n let offset: string | null = null;\n do {\n signal?.throwIfAborted();\n const page: { items: AsanaStory[]; next: string | null } =\n await this.fetchCollection<AsanaStory>(\n `/tasks/${taskGid}/stories`,\n { opt_fields: STORY_FIELDS },\n offset,\n STORIES_PAGE_SIZE,\n 'task_events',\n signal,\n );\n out.push(...page.items);\n offset = page.next;\n } while (offset !== null);\n return out;\n }\n\n private async fetchTasksPage(\n page: string | null,\n options: SyncOptions,\n signal: AbortSignal | undefined,\n ): Promise<{ items: AsanaTaskWithContext[]; next: string | null }> {\n const wantEvents = this.isResourceEnabled('task_events');\n const fixed = this.settings.projectGids;\n\n let projectGids: string[];\n let next: string | null;\n if (fixed && fixed.length > 0) {\n projectGids = [...fixed];\n next = null;\n } else {\n const projectsPage = await this.fetchProjectsPage(page, signal);\n projectGids = projectsPage.items.map((p) => p.gid);\n next = projectsPage.next;\n }\n\n const seen = new Set<string>();\n const items: AsanaTaskWithContext[] = [];\n for (const projectGid of projectGids) {\n const tasks = await this.fetchTasksForProject(\n projectGid,\n options,\n signal,\n );\n for (const task of tasks) {\n if (seen.has(task.gid)) {\n continue;\n }\n seen.add(task.gid);\n const stories = wantEvents\n ? await this.fetchStoriesForTask(task.gid, signal)\n : [];\n items.push({ task, projectGid, stories });\n }\n }\n return { items, next };\n }\n\n private async writeProjects(\n storage: StorageHandle,\n projects: AsanaProject[],\n ): Promise<void> {\n const now = Date.now();\n for (const p of projects) {\n await storage.entity({\n type: 'asana_project',\n id: p.gid,\n attributes: {\n name: p.name,\n archived: p.archived ?? false,\n ownerId: p.owner?.gid ?? null,\n teamName: p.team?.name ?? null,\n createdAt: parseEpoch(p.created_at ?? null, 'iso'),\n },\n updated_at: parseEpoch(p.modified_at ?? null, 'iso') ?? now,\n });\n }\n }\n\n private async writeUsers(\n storage: StorageHandle,\n users: AsanaUser[],\n ): Promise<void> {\n const now = Date.now();\n for (const u of users) {\n if (!u.gid) {\n continue;\n }\n await storage.entity({\n type: 'asana_user',\n id: u.gid,\n attributes: {\n name: u.name ?? null,\n email: u.email ?? null,\n },\n updated_at: now,\n });\n }\n }\n\n private async writeTasks(\n storage: StorageHandle,\n items: AsanaTaskWithContext[],\n sinceMs: number | null,\n ): Promise<void> {\n const writeEntities = this.isResourceEnabled('tasks');\n const writeEvents = this.isResourceEnabled('task_events');\n const now = Date.now();\n\n for (const { task, projectGid, stories } of items) {\n const createdMs = parseEpoch(task.created_at ?? null, 'iso');\n const modifiedMs = parseEpoch(task.modified_at ?? null, 'iso');\n\n if (writeEntities) {\n await storage.entity({\n type: 'asana_task',\n id: task.gid,\n attributes: {\n name: task.name ?? null,\n completed: task.completed ?? false,\n assigneeId: task.assignee?.gid ?? null,\n projectGid,\n dueOn: task.due_on ?? null,\n createdAt: createdMs,\n completedAt: parseEpoch(task.completed_at ?? null, 'iso'),\n },\n updated_at: modifiedMs ?? now,\n });\n }\n\n if (writeEvents) {\n for (const story of stories) {\n if (story.type !== 'system') {\n continue;\n }\n const ts = parseEpoch(story.created_at, 'iso');\n if (ts === null) {\n continue;\n }\n if (sinceMs !== null && ts <= sinceMs) {\n continue;\n }\n const attributes: Record<string, JSONValue> = {\n storyGid: story.gid,\n taskGid: task.gid,\n projectGid,\n resourceSubtype: story.resource_subtype ?? null,\n authorId: story.created_by?.gid ?? null,\n text: story.text ?? null,\n };\n await storage.event({\n name: 'asana_task_event',\n start_ts: ts,\n end_ts: null,\n attributes,\n });\n }\n }\n }\n }\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = isAsanaSyncCursor(options.cursor)\n ? options.cursor\n : undefined;\n const isFull = options.mode === 'full';\n const sinceMs = options.since ? parseEpoch(options.since, 'iso') : null;\n const phases = this.activePhases();\n\n return paginateChunked<AsanaPhase, string>({\n phases,\n cursor,\n signal,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'projects':\n return this.fetchProjectsPage(page, sig);\n case 'users':\n return this.fetchUsersPage(page, sig);\n case 'tasks':\n return this.fetchTasksPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'projects':\n await storage.entities([], { types: ['asana_project'] });\n break;\n case 'users':\n await storage.entities([], { types: ['asana_user'] });\n break;\n case 'tasks':\n if (this.isResourceEnabled('tasks')) {\n await storage.entities([], { types: ['asana_task'] });\n }\n if (this.isResourceEnabled('task_events')) {\n await storage.events([], { names: ['asana_task_event'] });\n }\n break;\n }\n }\n switch (phase) {\n case 'projects':\n return this.writeProjects(storage, items as AsanaProject[]);\n case 'users':\n return this.writeUsers(storage, items as AsanaUser[]);\n case 'tasks':\n return this.writeTasks(\n storage,\n items as AsanaTaskWithContext[],\n sinceMs,\n );\n }\n },\n });\n }\n}\n","import { AsanaConnector } from './asana';\n\nexport {\n configFields,\n doc,\n AsanaConnector,\n asanaResources as resources,\n id,\n} from './asana';\nexport type { AsanaSettings, AsanaResource } from './asana';\nexport default AsanaConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,mBAAmB;AAChE;AKJO,SAAS,WACd,OACA,MACe;AACf,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,WAAO;EACT;AACA,MAAI,SAAS,OAAO;AAClB,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO;IACT;AACA,UAAM,KAAK,IAAI,KAAK,KAAK,EAAE,QAAQ;AACnC,WAAO,OAAO,SAAS,EAAE,IAAI,KAAK;EACpC;AACA,MAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,IAAI;AACpD,WAAO;EACT;AACA,QAAM,IAAI,OAAO,UAAU,WAAW,QAAQ,OAAO,KAAK;AAC1D,MAAI,CAAC,OAAO,SAAS,CAAC,GAAG;AACvB,WAAO;EACT;AACA,QAAM,SAAS,SAAS,MAAM,IAAI,MAAO;AACzC,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;;;AGpBA;AAAA,EACE;AAAA,EAUA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAEX,IAAM,eAAe;AAAA,EAC1B,EAAE,OAAO;AAAA,IACP,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK;AAAA,MAC/C,OAAO;AAAA,MACP,aACE;AAAA,MACF,aAAa;AAAA,MACb,QAAQ;AAAA,IACV,CAAC;AAAA,IACD,cAAc,EACX,OAAO,EACP,IAAI,CAAC,EACL,MAAM,SAAS,mDAAmD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G;AACzC,sBAAM,QAAQ,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,kBAAkB,EAAE,CAAC;AAAA,cAC1D;AACA;AAAA,UACJ;AAAA,QACF;AACA,gBAAQ,OAAO;AAAA,UACb,KAAK;AACH,mBAAO,KAAK,cAAc,SAAS,KAAuB;AAAA,UAC5D,KAAK;AACH,mBAAO,KAAK,WAAW,SAAS,KAAoB;AAAA,UACtD,KAAK;AACH,mBAAO,KAAK;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,QACJ;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;AC/qBA,IAAO,gBAAQ;","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/map-concurrent.ts","../../../connector-shared/src/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/asana.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\nexport function connectorUserAgent(connectorId: string): string {\n return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n}\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 interface StandardRateLimitPolicyConfig {\n remainingHeader: string;\n resetHeader: string;\n resetUnit: 's' | 'ms';\n resetFallbackMs?: number;\n}\n\nexport function standardRateLimitPolicy(\n config: StandardRateLimitPolicyConfig,\n): RateLimitPolicy {\n const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;\n const multiplier = resetUnit === 's' ? 1000 : 1;\n return {\n parse(h) {\n const remainingRaw = h.get(remainingHeader);\n if (remainingRaw === null || remainingRaw.trim() === '') {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n const resetRaw = h.get(resetHeader);\n if (resetRaw === null) {\n if (resetFallbackMs === undefined) {\n return null;\n }\n return {\n remaining,\n resetAt: new Date(Date.now() + resetFallbackMs),\n };\n }\n if (resetRaw.trim() === '') {\n return null;\n }\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n const resetMs = reset * multiplier;\n if (!Number.isFinite(resetMs)) {\n return null;\n }\n return { remaining, resetAt: new Date(resetMs) };\n },\n };\n}\n","export async function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n if (items.length === 0) {\n return results;\n }\n const normalized = Number.isFinite(concurrency) ? Math.floor(concurrency) : 1;\n const limit = Math.max(1, Math.min(normalized, items.length));\n let next = 0;\n let failed = false;\n\n async function worker(): Promise<void> {\n while (!failed) {\n const i = next++;\n if (i >= items.length) {\n return;\n }\n try {\n results[i] = await fn(items[i]!, i);\n } catch (err) {\n failed = true;\n throw err;\n }\n }\n }\n\n const workers: Promise<void>[] = [];\n for (let w = 0; w < limit; w++) {\n workers.push(worker());\n }\n await Promise.all(workers);\n return results;\n}\n","export interface SanitizeAllowedUrlOptions {\n url: string | null;\n host: string;\n pathname: string;\n protocol?: 'https:' | 'http:';\n}\n\nexport function sanitizeAllowedUrl(\n options: SanitizeAllowedUrlOptions,\n): string | null {\n const { url, host, pathname, protocol = 'https:' } = options;\n if (url === null) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n}\n","export type EpochUnit = 'ms' | 's' | 'iso';\n\nexport function parseEpoch(\n value: number | string | null | undefined,\n unit: EpochUnit,\n): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (unit === 'iso') {\n if (typeof value !== 'string') {\n return null;\n }\n const ms = new Date(value).getTime();\n return Number.isFinite(ms) ? ms : null;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return null;\n }\n const n = typeof value === 'number' ? value : Number(value);\n if (!Number.isFinite(n)) {\n return null;\n }\n const result = unit === 's' ? n * 1000 : n;\n return Number.isFinite(result) ? result : null;\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","export type LogFields = Record<string, unknown>;\n\nexport interface ConnectorLogger {\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n}\n\nexport interface ConnectorLoggerOptions {\n scope: string;\n}\n\nconst MAX_VALUE_LEN = 120;\n\nfunction truncate(s: string, max = MAX_VALUE_LEN): string {\n if (s.length <= max) {\n return s;\n }\n return `${s.slice(0, max - 1)}…`;\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return '';\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'string') {\n const t = truncate(value);\n if (/[\\s\"=]/.test(t)) {\n return JSON.stringify(t);\n }\n return t;\n }\n if (typeof value === 'bigint') {\n return value.toString();\n }\n let json: string | undefined;\n try {\n json = JSON.stringify(value);\n } catch {\n json = undefined;\n }\n return truncate(json ?? String(value));\n}\n\nexport function formatLogFields(fields?: LogFields): string {\n if (!fields) {\n return '';\n }\n const parts: string[] = [];\n for (const [k, v] of Object.entries(fields)) {\n if (v === undefined) {\n continue;\n }\n parts.push(`${k}=${formatValue(v)}`);\n }\n return parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\nexport function formatLogLine(\n scope: string,\n event: string,\n fields?: LogFields,\n): string {\n return `[${scope}] ${event}${formatLogFields(fields)}`;\n}\n\nexport function createDefaultConnectorLogger(\n opts: ConnectorLoggerOptions,\n): ConnectorLogger {\n return {\n info(event, fields) {\n console.info(formatLogLine(opts.scope, event, fields));\n },\n warn(event, fields) {\n console.warn(formatLogLine(opts.scope, event, fields));\n },\n };\n}\n\nconst NOOP_LOGGER: ConnectorLogger = {\n info() {},\n warn() {},\n};\n\nexport function noopConnectorLogger(): ConnectorLogger {\n return NOOP_LOGGER;\n}\n","import {\n type HttpResponse,\n connectorUserAgent,\n parseEpoch,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ConnectorContext,\n type ConnectorDoc,\n type CredentialsSchema,\n type FetchSpec,\n type FilterClause,\n type JSONValue,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n defineConnectorDoc,\n defineResources,\n makeChunkedCursorGuard,\n paginateChunked,\n schemasFromResources,\n selectActivePhases,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n apiToken: z.object({ $secret: z.string() }).meta({\n label: 'Personal access token',\n description:\n 'Asana personal access token. Create one at app.asana.com → Settings → Apps → Developer apps → Personal access tokens.',\n placeholder: '2/1201234567890/...',\n secret: true,\n }),\n workspaceGid: z\n .string()\n .min(1)\n .regex(/^\\d+$/, 'Workspace GID is the numeric id of the workspace.')\n .meta({\n label: 'Workspace GID',\n description:\n 'Numeric GID of the workspace to sync. Find it at app.asana.com/api/1.0/workspaces.',\n placeholder: '1201234567890',\n }),\n projectGids: z.array(z.string().regex(/^\\d+$/)).nonempty().optional().meta({\n label: 'Project GIDs (optional)',\n description:\n 'Restrict the task sync to specific project GIDs. Omit to sync tasks from every project in the workspace.',\n }),\n resources: z\n .array(z.enum(['projects', 'users', 'tasks', 'task_events']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Asana resources to sync. Omit to sync all of them. 'task_events' shares the tasks scan - enabling it without 'tasks' still walks tasks (and fetches their stories) but skips writing task entities.\",\n }),\n }),\n);\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Asana',\n category: 'product',\n brandColor: '#F06A6A',\n tagline:\n 'Sync projects, users, tasks, and task state-change events from an Asana workspace.',\n vendor: {\n name: 'Asana',\n domain: 'asana.com',\n apiDocs: 'https://developers.asana.com/reference/rest-api-reference',\n website: 'https://asana.com',\n },\n auth: {\n summary:\n 'Authenticates with a personal access token sent as a Bearer credential. The token inherits the permissions of the account that created it.',\n setup: [\n 'Open app.asana.com -> Settings -> Apps -> Developer apps.',\n 'Under Personal access tokens, create a new token and copy its value.',\n 'Store the token as a secret and reference it from the connector config as `apiToken: secret(\"ASANA_API_TOKEN\")`, alongside the numeric workspaceGid.',\n 'Find your workspace GID at https://app.asana.com/api/1.0/workspaces while authenticated.',\n ],\n },\n rateLimit:\n 'Asana enforces per-token rate limits (150 req/min on free plans, 1500 on paid); 429 responses with Retry-After are honored.',\n limitations: [\n 'Task state-change events are derived from each task story; only system stories (not comments) are written.',\n 'A task in multiple projects is stored once, attributed to the first project it is scanned under.',\n 'Workspace-wide task search requires a paid plan, so tasks are walked project-by-project; omit projectGids to scan every project.',\n ],\n});\n\nexport type AsanaResource = 'projects' | 'users' | 'tasks' | 'task_events';\n\nexport interface AsanaSettings {\n workspaceGid: string;\n projectGids?: readonly string[];\n resources?: readonly AsanaResource[];\n}\n\nconst asanaCredentials = {\n apiToken: {\n description: 'Asana personal access token',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype AsanaCredentials = typeof asanaCredentials;\n\nconst PHASE_ORDER = ['projects', 'users', 'tasks'] as const;\n\ntype AsanaPhase = (typeof PHASE_ORDER)[number];\n\nconst isAsanaSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\ninterface AsanaGidRef {\n gid: string;\n}\n\ninterface AsanaProject {\n gid: string;\n name: string;\n archived?: boolean | null;\n created_at?: string | null;\n modified_at?: string | null;\n owner?: AsanaGidRef | null;\n team?: { name?: string | null } | null;\n}\n\ninterface AsanaUser {\n gid: string;\n name?: string | null;\n email?: string | null;\n}\n\ninterface AsanaTask {\n gid: string;\n name?: string | null;\n completed?: boolean | null;\n completed_at?: string | null;\n created_at?: string | null;\n modified_at?: string | null;\n due_on?: string | null;\n assignee?: AsanaGidRef | null;\n}\n\ninterface AsanaStory {\n gid: string;\n type?: string | null;\n resource_subtype?: string | null;\n created_at: string;\n created_by?: AsanaGidRef | null;\n text?: string | null;\n}\n\ninterface AsanaTaskWithContext {\n task: AsanaTask;\n projectGid: string;\n stories: AsanaStory[];\n}\n\ninterface AsanaPage<T> {\n data: T[];\n next_page?: { offset: string } | null;\n}\n\nconst gid = z.string().min(1);\n\nconst nextPageSchema = z.object({ offset: z.string() }).nullable().optional();\n\nconst projectsResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n name: z.string(),\n archived: z.boolean().nullable().optional(),\n created_at: z.iso.datetime().nullable().optional(),\n modified_at: z.iso.datetime().nullable().optional(),\n owner: z.object({ gid }).nullable().optional(),\n team: z\n .object({ name: z.string().nullable().optional() })\n .nullable()\n .optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nconst usersResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n name: z.string().nullable().optional(),\n email: z.string().nullable().optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nconst tasksResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n name: z.string().nullable().optional(),\n completed: z.boolean().nullable().optional(),\n completed_at: z.iso.datetime().nullable().optional(),\n created_at: z.iso.datetime().nullable().optional(),\n modified_at: z.iso.datetime().nullable().optional(),\n due_on: z.string().nullable().optional(),\n assignee: z.object({ gid }).nullable().optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nconst storiesResponseSchema = z.object({\n data: z.array(\n z.object({\n gid,\n type: z.string().nullable().optional(),\n resource_subtype: z.string().nullable().optional(),\n created_at: z.iso.datetime(),\n created_by: z.object({ gid }).nullable().optional(),\n text: z.string().nullable().optional(),\n }),\n ),\n next_page: nextPageSchema,\n});\n\nexport const asanaResources = defineResources({\n asana_project: {\n shape: 'entity',\n filterable: [{ field: 'archived', ops: ['eq'] }],\n description:\n 'Projects in the workspace with name, archived state, owner, team, and timestamps.',\n endpoint: 'GET /projects',\n responses: { projects: projectsResponseSchema },\n },\n asana_user: {\n shape: 'entity',\n filterable: [],\n description: 'Users in the workspace with display name and email.',\n endpoint: 'GET /users',\n responses: { users: usersResponseSchema },\n },\n asana_task: {\n shape: 'entity',\n filterable: [\n { field: 'completed', ops: ['eq'] },\n { field: 'projectGid', ops: ['eq'] },\n { field: 'assigneeId', ops: ['eq'] },\n ],\n description:\n 'Tasks with completion state, assignee, due date, owning project, and timestamps.',\n endpoint: 'GET /tasks?project={projectGid}',\n notes:\n 'Tasks are walked project-by-project; a task in multiple projects is attributed to the first project scanned.',\n responses: { tasks: tasksResponseSchema },\n },\n asana_task_event: {\n shape: 'event',\n filterable: [],\n description:\n 'Task state-change events derived from system stories (completed, assigned, due-date changes, etc.).',\n endpoint: 'GET /tasks/{taskGid}/stories',\n notes:\n 'Only system stories are written; comments are skipped. start_ts is the story time, end_ts is null. Timestamps are Unix epoch milliseconds.',\n responses: { stories: storiesResponseSchema },\n },\n});\n\nconst API_BASE = 'https://app.asana.com/api/1.0';\nconst PROJECTS_PAGE_SIZE = 50;\nconst USERS_PAGE_SIZE = 100;\nconst TASKS_PAGE_SIZE = 100;\nconst STORIES_PAGE_SIZE = 100;\n\nconst PROJECT_FIELDS =\n 'name,archived,created_at,modified_at,owner.gid,team.name';\nconst USER_FIELDS = 'name,email';\nconst TASK_FIELDS =\n 'name,completed,completed_at,created_at,modified_at,due_on,assignee.gid';\nconst STORY_FIELDS = 'type,resource_subtype,created_at,created_by.gid,text';\n\nfunction pushableEq(\n filter: FilterClause[] | undefined,\n field: string,\n): string | null {\n if (!filter) {\n return null;\n }\n for (const clause of filter) {\n if (\n 'field' in clause &&\n clause.field === field &&\n clause.op === 'eq' &&\n typeof clause.value === 'string'\n ) {\n return clause.value;\n }\n }\n return null;\n}\n\nexport const id = 'asana';\n\nexport class AsanaConnector extends BaseConnector<\n AsanaSettings,\n AsanaCredentials\n> {\n static readonly id = id;\n\n static readonly resources = asanaResources;\n\n static readonly schemas = schemasFromResources(asanaResources);\n\n static create(input: unknown, ctx?: ConnectorContext): AsanaConnector {\n const parsed = configFields.parse(input);\n return new AsanaConnector(\n {\n workspaceGid: parsed.workspaceGid,\n projectGids: parsed.projectGids,\n resources: parsed.resources,\n },\n { apiToken: parsed.apiToken },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = asanaCredentials;\n\n private taskSeen = new Set<string>();\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.creds.apiToken}`,\n Accept: 'application/json',\n 'User-Agent': connectorUserAgent('asana'),\n };\n }\n\n private fetch<T>(\n url: string,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<T>> {\n return this.get<T>(url, {\n resource,\n headers: this.buildHeaders(),\n signal,\n });\n }\n\n private activePhases(): AsanaPhase[] {\n return selectActivePhases<AsanaResource, AsanaPhase>(\n (r) => {\n switch (r) {\n case 'projects':\n return 'projects';\n case 'users':\n return 'users';\n case 'tasks':\n case 'task_events':\n return 'tasks';\n }\n },\n PHASE_ORDER,\n this.settings.resources,\n );\n }\n\n private singleSpec(\n options: SyncOptions,\n resource: string,\n ): FetchSpec | undefined {\n const specs = options.fetchSpecs?.[resource];\n return specs && specs.length === 1 ? specs[0] : undefined;\n }\n\n private async fetchCollection<T>(\n path: string,\n params: Record<string, string>,\n offset: string | null,\n pageSize: number,\n resource: string,\n signal: AbortSignal | undefined,\n ): Promise<{ items: T[]; next: string | null }> {\n const u = new URL(`${API_BASE}${path}`);\n for (const [k, v] of Object.entries(params)) {\n u.searchParams.set(k, v);\n }\n u.searchParams.set('limit', String(pageSize));\n if (offset !== null) {\n u.searchParams.set('offset', offset);\n }\n const res = await this.fetch<AsanaPage<T>>(u.toString(), resource, signal);\n return { items: res.body.data, next: res.body.next_page?.offset ?? null };\n }\n\n private fetchProjectsPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<{ items: AsanaProject[]; next: string | null }> {\n return this.fetchCollection<AsanaProject>(\n '/projects',\n {\n workspace: this.settings.workspaceGid,\n opt_fields: PROJECT_FIELDS,\n },\n page,\n PROJECTS_PAGE_SIZE,\n 'projects',\n signal,\n );\n }\n\n private fetchUsersPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<{ items: AsanaUser[]; next: string | null }> {\n return this.fetchCollection<AsanaUser>(\n '/users',\n { workspace: this.settings.workspaceGid, opt_fields: USER_FIELDS },\n page,\n USERS_PAGE_SIZE,\n 'users',\n signal,\n );\n }\n\n private async fetchTasksForProject(\n projectGid: string,\n options: SyncOptions,\n signal: AbortSignal | undefined,\n ): Promise<AsanaTask[]> {\n const wantEvents = this.isResourceEnabled('task_events');\n const completed = pushableEq(\n this.singleSpec(options, 'asana_task')?.filter,\n 'completed',\n );\n const params: Record<string, string> = {\n project: projectGid,\n opt_fields: TASK_FIELDS,\n };\n if (options.mode === 'latest' && options.since && !wantEvents) {\n params['modified_since'] = options.since;\n }\n if (completed !== null) {\n params['completed_since'] = completed === 'false' ? 'now' : '1970-01-01';\n }\n const out: AsanaTask[] = [];\n let offset: string | null = null;\n do {\n signal?.throwIfAborted();\n const page: { items: AsanaTask[]; next: string | null } =\n await this.fetchCollection<AsanaTask>(\n '/tasks',\n params,\n offset,\n TASKS_PAGE_SIZE,\n 'tasks',\n signal,\n );\n out.push(...page.items);\n offset = page.next;\n } while (offset !== null);\n return out;\n }\n\n private async fetchStoriesForTask(\n taskGid: string,\n signal: AbortSignal | undefined,\n ): Promise<AsanaStory[]> {\n const out: AsanaStory[] = [];\n let offset: string | null = null;\n do {\n signal?.throwIfAborted();\n const page: { items: AsanaStory[]; next: string | null } =\n await this.fetchCollection<AsanaStory>(\n `/tasks/${taskGid}/stories`,\n { opt_fields: STORY_FIELDS },\n offset,\n STORIES_PAGE_SIZE,\n 'task_events',\n signal,\n );\n out.push(...page.items);\n offset = page.next;\n } while (offset !== null);\n return out;\n }\n\n private async fetchTasksPage(\n page: string | null,\n options: SyncOptions,\n signal: AbortSignal | undefined,\n ): Promise<{ items: AsanaTaskWithContext[]; next: string | null }> {\n const wantEvents = this.isResourceEnabled('task_events');\n const fixed = this.settings.projectGids;\n\n let projectGids: string[];\n let next: string | null;\n if (fixed && fixed.length > 0) {\n projectGids = [...fixed];\n next = null;\n } else {\n const projectsPage = await this.fetchProjectsPage(page, signal);\n projectGids = projectsPage.items.map((p) => p.gid);\n next = projectsPage.next;\n }\n\n const items: AsanaTaskWithContext[] = [];\n for (const projectGid of projectGids) {\n const tasks = await this.fetchTasksForProject(\n projectGid,\n options,\n signal,\n );\n for (const task of tasks) {\n if (this.taskSeen.has(task.gid)) {\n continue;\n }\n this.taskSeen.add(task.gid);\n const stories = wantEvents\n ? await this.fetchStoriesForTask(task.gid, signal)\n : [];\n items.push({ task, projectGid, stories });\n }\n }\n return { items, next };\n }\n\n private async writeProjects(\n storage: StorageHandle,\n projects: AsanaProject[],\n ): Promise<void> {\n const now = Date.now();\n for (const p of projects) {\n await storage.entity({\n type: 'asana_project',\n id: p.gid,\n attributes: {\n name: p.name,\n archived: p.archived ?? false,\n ownerId: p.owner?.gid ?? null,\n teamName: p.team?.name ?? null,\n createdAt: parseEpoch(p.created_at ?? null, 'iso'),\n },\n updated_at: parseEpoch(p.modified_at ?? null, 'iso') ?? now,\n });\n }\n }\n\n private async writeUsers(\n storage: StorageHandle,\n users: AsanaUser[],\n ): Promise<void> {\n const now = Date.now();\n for (const u of users) {\n if (!u.gid) {\n continue;\n }\n await storage.entity({\n type: 'asana_user',\n id: u.gid,\n attributes: {\n name: u.name ?? null,\n email: u.email ?? null,\n },\n updated_at: now,\n });\n }\n }\n\n private async writeTasks(\n storage: StorageHandle,\n items: AsanaTaskWithContext[],\n sinceMs: number | null,\n ): Promise<void> {\n const writeEntities = this.isResourceEnabled('tasks');\n const writeEvents = this.isResourceEnabled('task_events');\n const now = Date.now();\n\n for (const { task, projectGid, stories } of items) {\n const createdMs = parseEpoch(task.created_at ?? null, 'iso');\n const modifiedMs = parseEpoch(task.modified_at ?? null, 'iso');\n\n if (writeEntities) {\n await storage.entity({\n type: 'asana_task',\n id: task.gid,\n attributes: {\n name: task.name ?? null,\n completed: task.completed ?? false,\n assigneeId: task.assignee?.gid ?? null,\n projectGid,\n dueOn: task.due_on ?? null,\n createdAt: createdMs,\n completedAt: parseEpoch(task.completed_at ?? null, 'iso'),\n },\n updated_at: modifiedMs ?? now,\n });\n }\n\n if (writeEvents) {\n for (const story of stories) {\n if (story.type !== 'system') {\n continue;\n }\n const ts = parseEpoch(story.created_at, 'iso');\n if (ts === null) {\n continue;\n }\n if (sinceMs !== null && ts <= sinceMs) {\n continue;\n }\n const attributes: Record<string, JSONValue> = {\n storyGid: story.gid,\n taskGid: task.gid,\n projectGid,\n resourceSubtype: story.resource_subtype ?? null,\n authorId: story.created_by?.gid ?? null,\n text: story.text ?? null,\n };\n await storage.event({\n name: 'asana_task_event',\n start_ts: ts,\n end_ts: null,\n attributes,\n });\n }\n }\n }\n }\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = isAsanaSyncCursor(options.cursor)\n ? options.cursor\n : undefined;\n if (!cursor) {\n this.taskSeen.clear();\n }\n const isFull = options.mode === 'full';\n const sinceMs = options.since ? parseEpoch(options.since, 'iso') : null;\n const phases = this.activePhases();\n\n return paginateChunked<AsanaPhase, string>({\n phases,\n cursor,\n signal,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'projects':\n return this.fetchProjectsPage(page, sig);\n case 'users':\n return this.fetchUsersPage(page, sig);\n case 'tasks':\n return this.fetchTasksPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'projects':\n await storage.entities([], { types: ['asana_project'] });\n break;\n case 'users':\n await storage.entities([], { types: ['asana_user'] });\n break;\n case 'tasks':\n if (this.isResourceEnabled('tasks')) {\n await storage.entities([], { types: ['asana_task'] });\n }\n if (this.isResourceEnabled('task_events')) {\n await storage.events([], { names: ['asana_task_event'] });\n }\n break;\n }\n }\n switch (phase) {\n case 'projects':\n return this.writeProjects(storage, items as AsanaProject[]);\n case 'users':\n return this.writeUsers(storage, items as AsanaUser[]);\n case 'tasks':\n return this.writeTasks(\n storage,\n items as AsanaTaskWithContext[],\n sinceMs,\n );\n }\n },\n });\n }\n}\n","import { AsanaConnector } from './asana';\n\nexport {\n configFields,\n doc,\n AsanaConnector,\n asanaResources as resources,\n id,\n} from './asana';\nexport type { AsanaSettings, AsanaResource } from './asana';\nexport default AsanaConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,mBAAmB;AAChE;AKJO,SAAS,WACd,OACA,MACe;AACf,MAAI,UAAU,QAAQ,UAAU,QA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ACA;AAAA,YACF;AAAA,QACJ;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;AClrBA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rawdash/connector-asana",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Rawdash connector for Asana — syncs projects, users, tasks, and task state-change events from a workspace into the six-shape storage model",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -22,22 +22,22 @@
|
|
|
22
22
|
"import": "./dist/index.js"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsup",
|
|
27
|
-
"typecheck": "tsc --noEmit",
|
|
28
|
-
"lint": "eslint src",
|
|
29
|
-
"test": "vitest run"
|
|
30
|
-
},
|
|
31
25
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
26
|
+
"zod": "^4.4.3",
|
|
27
|
+
"@rawdash/core": "0.28.0"
|
|
34
28
|
},
|
|
35
29
|
"devDependencies": {
|
|
36
|
-
"@rawdash/connector-shared": "workspace:*",
|
|
37
|
-
"@rawdash/connector-test-utils": "workspace:*",
|
|
38
30
|
"fast-check": "^4.8.0",
|
|
39
31
|
"tsup": "^8.0.0",
|
|
40
32
|
"typescript": "^5.7.2",
|
|
41
|
-
"vitest": "^4.1.4"
|
|
33
|
+
"vitest": "^4.1.4",
|
|
34
|
+
"@rawdash/connector-shared": "0.3.1",
|
|
35
|
+
"@rawdash/connector-test-utils": "0.0.10"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"lint": "eslint src",
|
|
41
|
+
"test": "vitest run"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|