@rawdash/connector-vercel 0.15.0 → 0.16.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 ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,114 +1,80 @@
1
+ <!-- This file is generated from connector metadata by scripts/generate-connector-docs.ts. Do not edit by hand. -->
2
+
1
3
  # @rawdash/connector-vercel
2
4
 
3
- Rawdash connector for [Vercel](https://vercel.com) — syncs projects, deployments, and deployment state-transition events into the six-shape storage model. Pairs with `@rawdash/connector-github` for "is this deploy healthy" widgets.
5
+ [![npm version](https://img.shields.io/npm/v/@rawdash/connector-vercel)](https://www.npmjs.com/package/@rawdash/connector-vercel)
6
+ [![license](https://img.shields.io/npm/l/@rawdash/connector-vercel)](https://github.com/rawdash/rawdash/blob/main/LICENSE)
7
+
8
+ Sync Vercel projects and deployments - including build state, target, git ref, and build duration - across your team.
4
9
 
5
- ## Auth setup
10
+ ## Install
11
+
12
+ ```sh
13
+ npm install @rawdash/connector-vercel
14
+ ```
6
15
 
7
- The connector authenticates with a Vercel access token. Two flavours work:
16
+ ## Authentication
8
17
 
9
- - **Personal access token** (recommended for single-user installs): Vercel **Account Settings Tokens Create**. Scope it to the team you want to sync, or leave it user-scoped.
10
- - **Team access token**: Vercel → **Team Settings → Security → Tokens → Create**. You must set `teamId` in the config for the token to read team resources.
18
+ A Vercel access token is required. Use a team token (with the team ID) to sync a team scope, or a personal token for the token owner scope.
11
19
 
12
- The token only needs read permissions for projects and deployments. No webhook configuration is required.
20
+ 1. Open Vercel Account Settings Tokens.
21
+ 2. Create an access token with read access to the projects and deployments you want to sync.
22
+ 3. Store it as a secret and reference it from the connector config as `apiToken: secret("VERCEL_TOKEN")`.
23
+ 4. If the token is a team token, set `teamId` to the team slug or `team_...` id.
13
24
 
14
25
  ## Configuration
15
26
 
27
+ | Field | Type | Required | Description |
28
+ | ------------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29
+ | `apiToken` | secret | Yes | Vercel access token (Personal or Team). Create one at Vercel → Account Settings → Tokens. |
30
+ | `teamId` | string | No | Vercel team ID (slug or `team_...`). Omit to use the token owner scope. Required if the token is a team token. |
31
+ | `projects` | array | No | Restrict deployment sync to specific Vercel project IDs (e.g. `prj_...`). Omit to sync every project the token can see. |
32
+ | `resources` | array | No | Which Vercel resources to sync. Omit to sync all of them. 'deployment_events' depends on 'deployments' being fetched - enabling it without 'deployments' still runs the deployments query, but skips writing deployment entities. |
33
+ | `deploymentsLookbackDays` | number | No | How many days back to fetch deployments on a full sync. Defaults to 30. Vercel returns deployments newest-first; this caps the backfill window. |
34
+
35
+ ## Resources
36
+
37
+ - **`vercel_project`** _(entity)_ - Vercel projects with name, framework, owning account, and create/update timestamps.
38
+ - Endpoint: `GET /v9/projects`
39
+ - **`vercel_deployment`** _(entity)_ - Deployments with build state, target environment, git ref/sha, creator, and build duration.
40
+ - Endpoint: `GET /v6/deployments`
41
+ - buildDurationMs is ready minus buildingAt when both are present, otherwise null. gitRef prefers meta.githubCommitRef, falling back to gitlabCommitRef, bitbucketCommitRef, then meta.branch.
42
+ - **`vercel_deployment_event`** _(event)_ - Each deployment emitted as a time-bounded event spanning creation to ready, carrying the same attributes as the deployment entity.
43
+ - Endpoint: `GET /v6/deployments`
44
+
45
+ ## Example
46
+
16
47
  ```ts
17
- import { secret } from '@rawdash/core';
48
+ import {
49
+ defineConfig,
50
+ defineDashboard,
51
+ defineMetric,
52
+ secret,
53
+ } from '@rawdash/core';
18
54
 
19
55
  const vercel = {
20
56
  name: 'vercel',
21
57
  connectorId: 'vercel',
22
58
  config: {
23
- apiToken: secret('VERCEL_API_TOKEN'),
24
- // teamId: 'team_abc123', // optional — needed for team tokens
25
- // projects: ['prj_one', 'prj_two'], // optional — restrict deployments to specific projects
26
- // resources: ['projects', 'deployments'], // optional — defaults to all three
27
- // deploymentsLookbackDays: 30, // optional — backfill window for full sync (default 30)
59
+ apiToken: secret('VERCEL_TOKEN'),
60
+ teamId: 'team_abc123',
61
+ deploymentsLookbackDays: 30,
28
62
  },
29
63
  };
30
- ```
31
-
32
- Register the connector class when mounting the engine:
33
-
34
- ```ts
35
- import { VercelConnector } from '@rawdash/connector-vercel';
36
- import { mountEngine } from '@rawdash/hono';
37
-
38
- mountEngine(config, { connectorRegistry: { vercel: VercelConnector } });
39
- ```
40
-
41
- ### Choosing resources
42
-
43
- The connector exposes three resources, written across two internal sync phases:
44
-
45
- | Resource | Phase | What gets written |
46
- | ------------------- | ----------- | -------------------------------------------------------------------------------------------------------- |
47
- | `projects` | projects | `vercel_project` entities, one per Vercel project |
48
- | `deployments` | deployments | `vercel_deployment` entities, one per deployment, with build duration and git ref attributes |
49
- | `deployment_events` | deployments | `vercel_deployment_event` events, one per deployment with `start_ts=createdAt`, `end_ts=ready` (or null) |
50
-
51
- `deployment_events` shares the `deployments` phase because each event is derived from the same payload as its parent deployment entity. Enabling `deployment_events` without `deployments` still runs the deployments query (so the events have data to emit) but skips writing the deployment entities themselves.
52
-
53
- ### Example dashboard
54
-
55
- ```ts
56
- import { defineConfig, defineDashboard, defineMetric } from '@rawdash/core';
57
64
 
58
65
  export default defineConfig({
59
66
  connectors: [vercel],
60
67
  dashboards: {
61
- deploys: defineDashboard({
68
+ infrastructure: defineDashboard({
62
69
  widgets: {
63
- deploys_today: {
64
- kind: 'stat',
65
- title: 'Deploys today',
66
- metric: defineMetric({
67
- connector: vercel,
68
- shape: 'event',
69
- name: 'vercel_deployment_event',
70
- field: 'start_ts',
71
- fn: 'count',
72
- window: '24h',
73
- }),
74
- },
75
- deploy_failure_rate_7d: {
70
+ deployments: {
76
71
  kind: 'stat',
77
- title: 'Failure rate (7d)',
72
+ title: 'Deployments',
78
73
  metric: defineMetric({
79
74
  connector: vercel,
80
75
  shape: 'event',
81
76
  name: 'vercel_deployment_event',
82
- field: 'start_ts',
83
77
  fn: 'count',
84
- window: '7d',
85
- filter: [{ field: 'state', op: 'eq', value: 'ERROR' }],
86
- }),
87
- },
88
- deploys_by_project: {
89
- kind: 'distribution',
90
- title: 'Deploys by project',
91
- metric: defineMetric({
92
- connector: vercel,
93
- shape: 'event',
94
- name: 'vercel_deployment_event',
95
- fn: 'count',
96
- window: '7d',
97
- groupBy: { field: 'projectId' },
98
- }),
99
- },
100
- deploys_per_day: {
101
- kind: 'timeseries',
102
- title: 'Daily deploys',
103
- window: '14d',
104
- metric: defineMetric({
105
- connector: vercel,
106
- shape: 'event',
107
- name: 'vercel_deployment_event',
108
- field: 'start_ts',
109
- fn: 'count',
110
- window: '14d',
111
- groupBy: { field: 'start_ts', granularity: 'day' },
112
78
  }),
113
79
  },
114
80
  },
@@ -117,69 +83,22 @@ export default defineConfig({
117
83
  });
118
84
  ```
119
85
 
120
- ## Data model
86
+ ## Rate limits
121
87
 
122
- | Storage shape | Entity/event type | Key attributes |
123
- | ------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
124
- | entity | `vercel_project` | name, framework, accountId, createdAt, updatedAt |
125
- | entity | `vercel_deployment` | deploymentId, name, url, state, target, projectId, creatorUid, creatorUsername, source, gitRef, gitSha, createdAt, buildingAt, readyAt, buildDurationMs |
126
- | event | `vercel_deployment_event` | same attribute set as `vercel_deployment`. `start_ts = createdAt`, `end_ts = ready` (or `null` for in-flight builds). |
88
+ Vercel returns X-RateLimit-Remaining / X-RateLimit-Reset headers (Unix seconds).
127
89
 
128
- Timestamps are stored as Unix epoch milliseconds. `buildDurationMs` is computed as `ready - buildingAt` when both are present, otherwise `null`. The `gitRef` attribute prefers `meta.githubCommitRef`, falling back to `gitlabCommitRef`, `bitbucketCommitRef`, then `meta.branch`.
90
+ ## Limitations
129
91
 
130
- ## Schemas
131
-
132
- `VercelConnector.schemas` declares the Zod schema for each resource's raw API response. Used by the cloud shape-drift pipeline to populate `connector_baselines`, and by the package's property tests.
133
-
134
- | Resource | Represents |
135
- | ------------- | -------------------------- |
136
- | `projects` | `GET /v9/projects` page |
137
- | `deployments` | `GET /v6/deployments` page |
138
-
139
- ## Sync behaviour
140
-
141
- - **Backfill** (`mode: 'full'`): paginates `/v9/projects` and `/v6/deployments` via Vercel's `pagination.next` cursor (page size 100), passing the returned millisecond timestamp back as the `until` query param. Project and deployment entity scopes (plus the `vercel_deployment_event` event scope) are cleared at the start of their phase so deletions in Vercel converge. Deployments are bounded by `deploymentsLookbackDays` (default 30) — the connector sets `since` on the first page to cap the backfill window.
142
- - **Incremental** (`mode: 'latest'`): applies `since={ms}` to the deployments endpoint so only deployments newer than the last sync are pulled. Projects are still refreshed on every sync since the list is small.
143
- - **Rate limits**: Vercel sends `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix seconds) — the connector reports the parsed state back to the host so the engine can budget future requests. 429 responses are surfaced as `RateLimitError` by the shared HTTP client.
144
- - **Resumable**: every paginated phase yields a `{ phase, page }` cursor (`ChunkedSyncCursor<TPhase, TPage>`) where `page` is the sanitized pagination URL. Pagination URLs are validated on the way in — only `https://api.vercel.com/v9/projects` and `https://api.vercel.com/v6/deployments` are accepted — to prevent a malicious or corrupted cursor from steering a follow-up request elsewhere.
145
-
146
- ## Errors
147
-
148
- `@rawdash/connector-shared` maps Vercel's HTTP responses to typed errors automatically:
149
-
150
- - `401` / `403` → `AuthError` — host stops syncing until the token is replaced.
151
- - `429` → `RateLimitError` — host backs off and reschedules.
152
- - `5xx` → `TransientError` — host retries on the next tick.
153
-
154
- ## Out of scope (post-v0.1)
155
-
156
- - **Web Vitals / Speed Insights** — Vercel does not expose aggregated p75 metrics via the public REST API; the dashboard surface and Insights API require a different access pattern (per-page-view event ingest). Tracking as a follow-up.
157
- - **Edge function logs** — high volume, low signal for a dashboard widget. Use the Vercel log drain integration instead.
158
- - **DNS / Domain APIs** — not dashboard-shaped.
159
-
160
- ## Registering in the MCP server
161
-
162
- ```ts
163
- import { VercelConnector, configFields } from '@rawdash/connector-vercel';
164
-
165
- createMcpServer({
166
- // ...
167
- connectorFactories: [
168
- {
169
- id: 'vercel',
170
- configFields,
171
- create: VercelConnector.create,
172
- },
173
- ],
174
- });
175
- ```
92
+ - Deployments are fetched newest-first within the configured lookback window (`deploymentsLookbackDays`, default 30 days); older deployments are not backfilled.
93
+ - Enabling `deployment_events` without `deployments` still runs the deployments query but skips writing deployment entities.
94
+ - Web Vitals / Speed Insights, edge function logs, and DNS/domain APIs are out of scope.
176
95
 
177
- ## Property tests
96
+ ## Links
178
97
 
179
- Resources in this connector have fast-check property tests under `src/property.test.ts` that:
98
+ - [Rawdash docs](https://rawdash.dev/docs/connectors/)
99
+ - [Vercel API docs](https://vercel.com/docs/rest-api)
100
+ - [GitHub](https://github.com/rawdash/rawdash)
180
101
 
181
- 1. Generate synthetic API payloads from a Zod schema mirroring Vercel's response shape.
182
- 2. Pipe them through `connector.sync()` against an `InMemoryStorage` instance.
183
- 3. Assert universal invariants — non-empty entity ids, finite event timestamps, no `undefined` reaching storage, no thrown errors on any valid input — plus per-resource counts.
102
+ ## License
184
103
 
185
- The helper lives in `@rawdash/connector-test-utils`. When adding a new resource, add a Zod schema for its payload and a test wired up via `runPropertySyncTest`.
104
+ Apache-2.0
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseConnector, ConnectorContext, SyncOptions, StorageHandle, SyncResult } from '@rawdash/core';
1
+ import { BaseConnector, ConnectorContext, SyncOptions, StorageHandle, SyncResult, ConnectorDoc } from '@rawdash/core';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const configFields: z.ZodObject<{
@@ -28,9 +28,79 @@ declare const vercelCredentials: {
28
28
  };
29
29
  };
30
30
  type VercelCredentials = typeof vercelCredentials;
31
+ declare const doc: ConnectorDoc;
31
32
  declare class VercelConnector extends BaseConnector<VercelSettings, VercelCredentials> {
32
33
  static readonly id = "vercel";
33
- static readonly schemas: {
34
+ static readonly resources: {
35
+ readonly vercel_project: {
36
+ readonly shape: "entity";
37
+ readonly description: "Vercel projects with name, framework, owning account, and create/update timestamps.";
38
+ readonly endpoint: "GET /v9/projects";
39
+ readonly responses: {
40
+ readonly projects: z.ZodObject<{
41
+ projects: z.ZodArray<z.ZodObject<{
42
+ id: z.ZodString;
43
+ name: z.ZodString;
44
+ framework: z.ZodNullable<z.ZodString>;
45
+ createdAt: z.ZodNumber;
46
+ updatedAt: z.ZodNumber;
47
+ }, z.core.$strip>>;
48
+ pagination: z.ZodObject<{
49
+ count: z.ZodNumber;
50
+ next: z.ZodNullable<z.ZodNumber>;
51
+ }, z.core.$strip>;
52
+ }, z.core.$strip>;
53
+ };
54
+ };
55
+ readonly vercel_deployment: {
56
+ readonly shape: "entity";
57
+ readonly description: "Deployments with build state, target environment, git ref/sha, creator, and build duration.";
58
+ readonly endpoint: "GET /v6/deployments";
59
+ readonly notes: "buildDurationMs is ready minus buildingAt when both are present, otherwise null. gitRef prefers meta.githubCommitRef, falling back to gitlabCommitRef, bitbucketCommitRef, then meta.branch.";
60
+ readonly responses: {
61
+ readonly deployments: z.ZodObject<{
62
+ deployments: z.ZodArray<z.ZodObject<{
63
+ uid: z.ZodString;
64
+ name: z.ZodString;
65
+ url: z.ZodString;
66
+ created: z.ZodNumber;
67
+ state: z.ZodEnum<{
68
+ BUILDING: "BUILDING";
69
+ ERROR: "ERROR";
70
+ INITIALIZING: "INITIALIZING";
71
+ QUEUED: "QUEUED";
72
+ READY: "READY";
73
+ CANCELED: "CANCELED";
74
+ }>;
75
+ target: z.ZodNullable<z.ZodEnum<{
76
+ production: "production";
77
+ staging: "staging";
78
+ preview: "preview";
79
+ }>>;
80
+ creator: z.ZodObject<{
81
+ uid: z.ZodString;
82
+ username: z.ZodNullable<z.ZodString>;
83
+ }, z.core.$strip>;
84
+ buildingAt: z.ZodNullable<z.ZodNumber>;
85
+ ready: z.ZodNullable<z.ZodNumber>;
86
+ source: z.ZodNullable<z.ZodString>;
87
+ meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>>;
88
+ projectId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ }, z.core.$strip>>;
90
+ pagination: z.ZodObject<{
91
+ count: z.ZodNumber;
92
+ next: z.ZodNullable<z.ZodNumber>;
93
+ }, z.core.$strip>;
94
+ }, z.core.$strip>;
95
+ };
96
+ };
97
+ readonly vercel_deployment_event: {
98
+ readonly shape: "event";
99
+ readonly description: "Each deployment emitted as a time-bounded event spanning creation to ready, carrying the same attributes as the deployment entity.";
100
+ readonly endpoint: "GET /v6/deployments";
101
+ };
102
+ };
103
+ static readonly schemas: object & {
34
104
  readonly projects: z.ZodObject<{
35
105
  projects: z.ZodArray<z.ZodObject<{
36
106
  id: z.ZodString;
@@ -44,6 +114,7 @@ declare class VercelConnector extends BaseConnector<VercelSettings, VercelCreden
44
114
  next: z.ZodNullable<z.ZodNumber>;
45
115
  }, z.core.$strip>;
46
116
  }, z.core.$strip>;
117
+ } & {
47
118
  readonly deployments: z.ZodObject<{
48
119
  deployments: z.ZodArray<z.ZodObject<{
49
120
  uid: z.ZodString;
@@ -78,7 +149,7 @@ declare class VercelConnector extends BaseConnector<VercelSettings, VercelCreden
78
149
  next: z.ZodNullable<z.ZodNumber>;
79
150
  }, z.core.$strip>;
80
151
  }, z.core.$strip>;
81
- };
152
+ } & Readonly<Record<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
82
153
  static create(input: unknown, ctx?: ConnectorContext): VercelConnector;
83
154
  readonly id = "vercel";
84
155
  readonly credentials: {
@@ -89,7 +160,6 @@ declare class VercelConnector extends BaseConnector<VercelSettings, VercelCreden
89
160
  };
90
161
  private buildHeaders;
91
162
  private fetch;
92
- private isResourceEnabled;
93
163
  private activePhases;
94
164
  private allowedPagePath;
95
165
  private sanitizePageUrl;
@@ -106,4 +176,4 @@ declare class VercelConnector extends BaseConnector<VercelSettings, VercelCreden
106
176
  sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
107
177
  }
108
178
 
109
- export { VercelConnector, type VercelResource, type VercelSettings, configFields, VercelConnector as default };
179
+ export { VercelConnector, type VercelResource, type VercelSettings, configFields, VercelConnector as default, doc };
package/dist/index.js CHANGED
@@ -1,8 +1,94 @@
1
+ // ../../connector-shared/dist/index.js
2
+ var HTTP_CLIENT_VERSION = "0.0.0";
3
+ var DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;
4
+ function connectorUserAgent(connectorId) {
5
+ return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;
6
+ }
7
+ function standardRateLimitPolicy(config) {
8
+ const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;
9
+ const multiplier = resetUnit === "s" ? 1e3 : 1;
10
+ return {
11
+ parse(h) {
12
+ const remainingRaw = h.get(remainingHeader);
13
+ if (remainingRaw === null || remainingRaw.trim() === "") {
14
+ return null;
15
+ }
16
+ const remaining = Number(remainingRaw);
17
+ if (!Number.isFinite(remaining)) {
18
+ return null;
19
+ }
20
+ const resetRaw = h.get(resetHeader);
21
+ if (resetRaw === null) {
22
+ if (resetFallbackMs === void 0) {
23
+ return null;
24
+ }
25
+ return {
26
+ remaining,
27
+ resetAt: new Date(Date.now() + resetFallbackMs)
28
+ };
29
+ }
30
+ if (resetRaw.trim() === "") {
31
+ return null;
32
+ }
33
+ const reset = Number(resetRaw);
34
+ if (!Number.isFinite(reset) || reset < 0) {
35
+ return null;
36
+ }
37
+ const resetMs = reset * multiplier;
38
+ if (!Number.isFinite(resetMs)) {
39
+ return null;
40
+ }
41
+ return { remaining, resetAt: new Date(resetMs) };
42
+ }
43
+ };
44
+ }
45
+ function sanitizeAllowedUrl(options) {
46
+ const { url, host, pathname, protocol = "https:" } = options;
47
+ if (url === null) {
48
+ return null;
49
+ }
50
+ try {
51
+ const u = new URL(url);
52
+ if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {
53
+ return null;
54
+ }
55
+ return u.toString();
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+ function parseEpoch(value, unit) {
61
+ if (value === null || value === void 0) {
62
+ return null;
63
+ }
64
+ if (unit === "iso") {
65
+ if (typeof value !== "string") {
66
+ return null;
67
+ }
68
+ const ms = new Date(value).getTime();
69
+ return Number.isFinite(ms) ? ms : null;
70
+ }
71
+ if (typeof value === "string" && value.trim() === "") {
72
+ return null;
73
+ }
74
+ const n = typeof value === "number" ? value : Number(value);
75
+ if (!Number.isFinite(n)) {
76
+ return null;
77
+ }
78
+ const result = unit === "s" ? n * 1e3 : n;
79
+ return Number.isFinite(result) ? result : null;
80
+ }
81
+
1
82
  // src/vercel.ts
2
83
  import {
3
84
  BaseConnector,
4
85
  defineConfigFields,
5
- paginateChunked
86
+ defineConnectorDoc,
87
+ defineResources,
88
+ makeChunkedCursorGuard,
89
+ paginateChunked,
90
+ schemasFromResources,
91
+ selectActivePhases
6
92
  } from "@rawdash/core";
7
93
  import { z } from "zod";
8
94
  var configFields = defineConfigFields(
@@ -24,7 +110,7 @@ var configFields = defineConfigFields(
24
110
  }),
25
111
  resources: z.array(z.enum(["projects", "deployments", "deployment_events"])).nonempty().optional().meta({
26
112
  label: "Resources",
27
- description: "Which Vercel resources to sync. Omit to sync all of them. 'deployment_events' depends on 'deployments' being fetched \u2014 enabling it without 'deployments' still runs the deployments query, but skips writing deployment entities."
113
+ description: "Which Vercel resources to sync. Omit to sync all of them. 'deployment_events' depends on 'deployments' being fetched - enabling it without 'deployments' still runs the deployments query, but skips writing deployment entities."
28
114
  }),
29
115
  deploymentsLookbackDays: z.number().int().positive().max(365).optional().meta({
30
116
  label: "Deployments lookback (days)",
@@ -39,38 +125,39 @@ var vercelCredentials = {
39
125
  auth: "required"
40
126
  }
41
127
  };
42
- var vercelRateLimit = {
43
- parse(h) {
44
- const remainingRaw = h.get("x-ratelimit-remaining");
45
- const resetRaw = h.get("x-ratelimit-reset");
46
- if (remainingRaw === null || resetRaw === null) {
47
- return null;
48
- }
49
- const remaining = Number(remainingRaw);
50
- const reset = Number(resetRaw);
51
- if (!Number.isFinite(remaining) || !Number.isFinite(reset) || reset < 0) {
52
- return null;
53
- }
54
- return { remaining, resetAt: new Date(reset * 1e3) };
55
- }
56
- };
128
+ var doc = defineConnectorDoc({
129
+ displayName: "Vercel",
130
+ category: "infrastructure",
131
+ brandColor: "#000000",
132
+ tagline: "Sync Vercel projects and deployments - including build state, target, git ref, and build duration - across your team.",
133
+ vendor: {
134
+ name: "Vercel",
135
+ apiDocs: "https://vercel.com/docs/rest-api",
136
+ website: "https://vercel.com"
137
+ },
138
+ auth: {
139
+ summary: "A Vercel access token is required. Use a team token (with the team ID) to sync a team scope, or a personal token for the token owner scope.",
140
+ setup: [
141
+ "Open Vercel \u2192 Account Settings \u2192 Tokens.",
142
+ "Create an access token with read access to the projects and deployments you want to sync.",
143
+ 'Store it as a secret and reference it from the connector config as `apiToken: secret("VERCEL_TOKEN")`.',
144
+ "If the token is a team token, set `teamId` to the team slug or `team_...` id."
145
+ ]
146
+ },
147
+ rateLimit: "Vercel returns X-RateLimit-Remaining / X-RateLimit-Reset headers (Unix seconds).",
148
+ limitations: [
149
+ "Deployments are fetched newest-first within the configured lookback window (`deploymentsLookbackDays`, default 30 days); older deployments are not backfilled.",
150
+ "Enabling `deployment_events` without `deployments` still runs the deployments query but skips writing deployment entities.",
151
+ "Web Vitals / Speed Insights, edge function logs, and DNS/domain APIs are out of scope."
152
+ ]
153
+ });
154
+ var vercelRateLimit = standardRateLimitPolicy({
155
+ remainingHeader: "x-ratelimit-remaining",
156
+ resetHeader: "x-ratelimit-reset",
157
+ resetUnit: "s"
158
+ });
57
159
  var PHASE_ORDER = ["projects", "deployments"];
58
- function isVercelSyncCursor(value) {
59
- if (typeof value !== "object" || value === null) {
60
- return false;
61
- }
62
- const v = value;
63
- if (typeof v.phase !== "string") {
64
- return false;
65
- }
66
- if (!PHASE_ORDER.includes(v.phase)) {
67
- return false;
68
- }
69
- if (v.page !== null && typeof v.page !== "string") {
70
- return false;
71
- }
72
- return true;
73
- }
160
+ var isVercelSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);
74
161
  var idString = z.string().min(1);
75
162
  var nonNegInt = z.number().int().nonnegative();
76
163
  var paginationSchema = z.object({
@@ -118,6 +205,26 @@ var deploymentsResponseSchema = z.object({
118
205
  deployments: z.array(deploymentSchema),
119
206
  pagination: paginationSchema
120
207
  });
208
+ var vercelResources = defineResources({
209
+ vercel_project: {
210
+ shape: "entity",
211
+ description: "Vercel projects with name, framework, owning account, and create/update timestamps.",
212
+ endpoint: "GET /v9/projects",
213
+ responses: { projects: projectsResponseSchema }
214
+ },
215
+ vercel_deployment: {
216
+ shape: "entity",
217
+ description: "Deployments with build state, target environment, git ref/sha, creator, and build duration.",
218
+ endpoint: "GET /v6/deployments",
219
+ notes: "buildDurationMs is ready minus buildingAt when both are present, otherwise null. gitRef prefers meta.githubCommitRef, falling back to gitlabCommitRef, bitbucketCommitRef, then meta.branch.",
220
+ responses: { deployments: deploymentsResponseSchema }
221
+ },
222
+ vercel_deployment_event: {
223
+ shape: "event",
224
+ description: "Each deployment emitted as a time-bounded event spanning creation to ready, carrying the same attributes as the deployment entity.",
225
+ endpoint: "GET /v6/deployments"
226
+ }
227
+ });
121
228
  var VERCEL_API_HOST = "api.vercel.com";
122
229
  var VERCEL_API_BASE = `https://${VERCEL_API_HOST}`;
123
230
  var PROJECTS_PAGE_SIZE = 100;
@@ -126,10 +233,8 @@ var DEFAULT_LOOKBACK_DAYS = 30;
126
233
  var MS_PER_DAY = 24 * 60 * 60 * 1e3;
127
234
  var VercelConnector = class _VercelConnector extends BaseConnector {
128
235
  static id = "vercel";
129
- static schemas = {
130
- projects: projectsResponseSchema,
131
- deployments: deploymentsResponseSchema
132
- };
236
+ static resources = vercelResources;
237
+ static schemas = schemasFromResources(vercelResources);
133
238
  static create(input, ctx) {
134
239
  const parsed = configFields.parse(input);
135
240
  return new _VercelConnector(
@@ -148,7 +253,7 @@ var VercelConnector = class _VercelConnector extends BaseConnector {
148
253
  buildHeaders() {
149
254
  return {
150
255
  Authorization: `Bearer ${this.creds.apiToken}`,
151
- "User-Agent": "rawdash/connector-vercel (+https://rawdash.dev)"
256
+ "User-Agent": connectorUserAgent("vercel")
152
257
  };
153
258
  }
154
259
  fetch(url, resource, signal) {
@@ -162,22 +267,12 @@ var VercelConnector = class _VercelConnector extends BaseConnector {
162
267
  // -------------------------------------------------------------------------
163
268
  // Resource enablement
164
269
  // -------------------------------------------------------------------------
165
- isResourceEnabled(resource) {
166
- const enabled = this.settings.resources;
167
- if (!enabled || enabled.length === 0) {
168
- return true;
169
- }
170
- return enabled.includes(resource);
171
- }
172
270
  activePhases() {
173
- const phases = [];
174
- if (this.isResourceEnabled("projects")) {
175
- phases.push("projects");
176
- }
177
- if (this.isResourceEnabled("deployments") || this.isResourceEnabled("deployment_events")) {
178
- phases.push("deployments");
179
- }
180
- return phases;
271
+ return selectActivePhases(
272
+ (r) => r === "projects" ? "projects" : "deployments",
273
+ PHASE_ORDER,
274
+ this.settings.resources
275
+ );
181
276
  }
182
277
  // -------------------------------------------------------------------------
183
278
  // URL building + sanitization
@@ -191,19 +286,11 @@ var VercelConnector = class _VercelConnector extends BaseConnector {
191
286
  }
192
287
  }
193
288
  sanitizePageUrl(phase, pageUrl) {
194
- if (pageUrl === null) {
195
- return null;
196
- }
197
- const allowedPath = this.allowedPagePath(phase);
198
- try {
199
- const u = new URL(pageUrl);
200
- if (u.protocol !== "https:" || u.host !== VERCEL_API_HOST || u.pathname !== allowedPath) {
201
- return null;
202
- }
203
- return u.toString();
204
- } catch {
205
- return null;
206
- }
289
+ return sanitizeAllowedUrl({
290
+ url: pageUrl,
291
+ host: VERCEL_API_HOST,
292
+ pathname: this.allowedPagePath(phase)
293
+ });
207
294
  }
208
295
  resolveCursor(cursor) {
209
296
  if (!isVercelSyncCursor(cursor)) {
@@ -240,9 +327,9 @@ var VercelConnector = class _VercelConnector extends BaseConnector {
240
327
  return u.toString();
241
328
  }
242
329
  computeDeploymentsSinceMs(options) {
243
- if (options.mode === "latest" && options.since) {
244
- const ms = new Date(options.since).getTime();
245
- if (Number.isFinite(ms)) {
330
+ if (options.since) {
331
+ const ms = parseEpoch(options.since, "iso");
332
+ if (ms !== null) {
246
333
  return ms;
247
334
  }
248
335
  }
@@ -288,8 +375,8 @@ var VercelConnector = class _VercelConnector extends BaseConnector {
288
375
  // -------------------------------------------------------------------------
289
376
  async writeProjects(storage, projects) {
290
377
  for (const p of projects) {
291
- const createdMs = Number.isFinite(p.createdAt) ? p.createdAt : null;
292
- const updatedMs = Number.isFinite(p.updatedAt) ? p.updatedAt : null;
378
+ const createdMs = parseEpoch(p.createdAt, "ms");
379
+ const updatedMs = parseEpoch(p.updatedAt, "ms");
293
380
  if (createdMs === null || updatedMs === null) {
294
381
  console.warn(
295
382
  `[connector-vercel] skipping project ${p.id} with unparseable timestamps`
@@ -314,15 +401,15 @@ var VercelConnector = class _VercelConnector extends BaseConnector {
314
401
  const writeEntities = this.isResourceEnabled("deployments");
315
402
  const writeEvents = this.isResourceEnabled("deployment_events");
316
403
  for (const d of deployments) {
317
- const createdMs = Number.isFinite(d.created) ? d.created : null;
404
+ const createdMs = parseEpoch(d.created, "ms");
318
405
  if (createdMs === null) {
319
406
  console.warn(
320
407
  `[connector-vercel] skipping deployment ${d.uid} with unparseable created timestamp`
321
408
  );
322
409
  continue;
323
410
  }
324
- const buildingMs = d.buildingAt !== null && d.buildingAt !== void 0 && Number.isFinite(d.buildingAt) ? d.buildingAt : null;
325
- const readyMs = d.ready !== null && d.ready !== void 0 && Number.isFinite(d.ready) ? d.ready : null;
411
+ const buildingMs = parseEpoch(d.buildingAt, "ms");
412
+ const readyMs = parseEpoch(d.ready, "ms");
326
413
  const buildDurationMs = readyMs !== null && buildingMs !== null && readyMs >= buildingMs ? readyMs - buildingMs : null;
327
414
  const gitRef = d.meta?.githubCommitRef ?? d.meta?.gitlabCommitRef ?? d.meta?.bitbucketCommitRef ?? d.meta?.branch ?? null;
328
415
  const gitSha = d.meta?.githubCommitSha ?? null;
@@ -375,6 +462,7 @@ var VercelConnector = class _VercelConnector extends BaseConnector {
375
462
  phases,
376
463
  cursor,
377
464
  signal,
465
+ logger: this.logger,
378
466
  fetchPage: async (phase, page, sig) => {
379
467
  switch (phase) {
380
468
  case "projects":
@@ -422,6 +510,7 @@ var index_default = VercelConnector;
422
510
  export {
423
511
  VercelConnector,
424
512
  configFields,
425
- index_default as default
513
+ index_default as default,
514
+ doc
426
515
  };
427
516
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vercel.ts","../src/index.ts"],"sourcesContent":["import {\n type HttpResponse,\n type RateLimitPolicy,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type CredentialsSchema,\n type JSONValue,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n paginateChunked,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\n// ---------------------------------------------------------------------------\n// configFields\n// ---------------------------------------------------------------------------\n\nexport const configFields = defineConfigFields(\n z.object({\n apiToken: z.object({ $secret: z.string() }).meta({\n label: 'API Token',\n description:\n 'Vercel access token (Personal or Team). Create one at Vercel → Account Settings → Tokens.',\n placeholder: 'vercel_token',\n secret: true,\n }),\n teamId: z.string().min(1).optional().meta({\n label: 'Team ID (optional)',\n description:\n 'Vercel team ID (slug or `team_...`). Omit to use the token owner scope. Required if the token is a team token.',\n placeholder: 'team_abc123',\n }),\n projects: z.array(z.string().min(1)).nonempty().optional().meta({\n label: 'Projects (optional)',\n description:\n 'Restrict deployment sync to specific Vercel project IDs (e.g. `prj_...`). Omit to sync every project the token can see.',\n }),\n resources: z\n .array(z.enum(['projects', 'deployments', 'deployment_events']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Vercel resources to sync. Omit to sync all of them. 'deployment_events' depends on 'deployments' being fetched — enabling it without 'deployments' still runs the deployments query, but skips writing deployment entities.\",\n }),\n deploymentsLookbackDays: z\n .number()\n .int()\n .positive()\n .max(365)\n .optional()\n .meta({\n label: 'Deployments lookback (days)',\n description:\n 'How many days back to fetch deployments on a full sync. Defaults to 30. Vercel returns deployments newest-first; this caps the backfill window.',\n placeholder: '30',\n }),\n }),\n);\n\nexport type VercelResource = 'projects' | 'deployments' | 'deployment_events';\n\nexport interface VercelSettings {\n teamId?: string;\n projects?: readonly string[];\n resources?: readonly VercelResource[];\n deploymentsLookbackDays?: number;\n}\n\nconst vercelCredentials = {\n apiToken: {\n description: 'Vercel access token',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype VercelCredentials = typeof vercelCredentials;\n\n// ---------------------------------------------------------------------------\n// Rate-limit policy — Vercel sends standard `X-RateLimit-*` headers, reset is\n// a Unix timestamp in seconds.\n// ---------------------------------------------------------------------------\n\nconst vercelRateLimit: RateLimitPolicy = {\n parse(h) {\n const remainingRaw = h.get('x-ratelimit-remaining');\n const resetRaw = h.get('x-ratelimit-reset');\n if (remainingRaw === null || resetRaw === null) {\n return null;\n }\n const remaining = Number(remainingRaw);\n const reset = Number(resetRaw);\n if (!Number.isFinite(remaining) || !Number.isFinite(reset) || reset < 0) {\n return null;\n }\n return { remaining, resetAt: new Date(reset * 1000) };\n },\n};\n\n// ---------------------------------------------------------------------------\n// Sync phases + cursor\n// ---------------------------------------------------------------------------\n\nconst PHASE_ORDER = ['projects', 'deployments'] as const;\n\ntype VercelPhase = (typeof PHASE_ORDER)[number];\n\ntype VercelSyncCursor = ChunkedSyncCursor<VercelPhase, string>;\n\nfunction isVercelSyncCursor(value: unknown): value is VercelSyncCursor {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const v = value as { phase?: unknown; page?: unknown };\n if (typeof v.phase !== 'string') {\n return false;\n }\n if (!(PHASE_ORDER as readonly string[]).includes(v.phase)) {\n return false;\n }\n if (v.page !== null && typeof v.page !== 'string') {\n return false;\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Vercel API types\n// ---------------------------------------------------------------------------\n\ninterface VercelProject {\n id: string;\n name: string;\n accountId?: string;\n framework: string | null;\n createdAt: number;\n updatedAt: number;\n}\n\ninterface VercelProjectsResponse {\n projects: VercelProject[];\n pagination: VercelPagination;\n}\n\ninterface VercelPagination {\n count: number;\n next: number | null;\n prev?: number | null;\n}\n\ninterface VercelDeploymentCreator {\n uid: string;\n username?: string | null;\n email?: string | null;\n}\n\ninterface VercelDeploymentMeta {\n githubCommitRef?: string;\n githubCommitSha?: string;\n githubCommitMessage?: string;\n gitlabCommitRef?: string;\n bitbucketCommitRef?: string;\n branch?: string;\n}\n\ninterface VercelDeployment {\n uid: string;\n name: string;\n url: string;\n created: number;\n createdAt?: number;\n state:\n | 'BUILDING'\n | 'ERROR'\n | 'INITIALIZING'\n | 'QUEUED'\n | 'READY'\n | 'CANCELED';\n target: 'production' | 'staging' | 'preview' | null;\n inspectorUrl?: string | null;\n creator: VercelDeploymentCreator;\n buildingAt?: number | null;\n ready?: number | null;\n source?: 'cli' | 'git' | 'import' | 'api-trigger-git-deploy' | string | null;\n meta?: VercelDeploymentMeta | null;\n projectId?: string;\n}\n\ninterface VercelDeploymentsResponse {\n deployments: VercelDeployment[];\n pagination: VercelPagination;\n}\n\n// ---------------------------------------------------------------------------\n// Schemas — describe the per-resource API response shape consumed by request()\n// ---------------------------------------------------------------------------\n\nconst idString = z.string().min(1);\nconst nonNegInt = z.number().int().nonnegative();\n\nconst paginationSchema = z.object({\n count: nonNegInt,\n next: nonNegInt.nullable(),\n});\n\nconst projectSchema = z.object({\n id: idString,\n name: z.string().min(1),\n framework: z.string().nullable(),\n createdAt: nonNegInt,\n updatedAt: nonNegInt,\n});\n\nconst projectsResponseSchema = z.object({\n projects: z.array(projectSchema),\n pagination: paginationSchema,\n});\n\nconst deploymentStateSchema = z.enum([\n 'BUILDING',\n 'ERROR',\n 'INITIALIZING',\n 'QUEUED',\n 'READY',\n 'CANCELED',\n]);\n\nconst deploymentTargetSchema = z\n .enum(['production', 'staging', 'preview'])\n .nullable();\n\nconst deploymentSchema = z.object({\n uid: idString,\n name: z.string(),\n url: z.string(),\n created: nonNegInt,\n state: deploymentStateSchema,\n target: deploymentTargetSchema,\n creator: z.object({\n uid: idString,\n username: z.string().nullable(),\n }),\n buildingAt: nonNegInt.nullable(),\n ready: nonNegInt.nullable(),\n source: z.string().nullable(),\n meta: z.record(z.string(), z.string().nullable()).nullable().optional(),\n projectId: z.string().nullable().optional(),\n});\n\nconst deploymentsResponseSchema = z.object({\n deployments: z.array(deploymentSchema),\n pagination: paginationSchema,\n});\n\n// ---------------------------------------------------------------------------\n// VercelConnector\n// ---------------------------------------------------------------------------\n\nconst VERCEL_API_HOST = 'api.vercel.com';\nconst VERCEL_API_BASE = `https://${VERCEL_API_HOST}`;\nconst PROJECTS_PAGE_SIZE = 100;\nconst DEPLOYMENTS_PAGE_SIZE = 100;\nconst DEFAULT_LOOKBACK_DAYS = 30;\nconst MS_PER_DAY = 24 * 60 * 60 * 1000;\n\nexport class VercelConnector extends BaseConnector<\n VercelSettings,\n VercelCredentials\n> {\n static readonly id = 'vercel';\n\n static readonly schemas = {\n projects: projectsResponseSchema,\n deployments: deploymentsResponseSchema,\n } as const;\n\n static create(input: unknown, ctx?: ConnectorContext): VercelConnector {\n const parsed = configFields.parse(input);\n return new VercelConnector(\n {\n teamId: parsed.teamId,\n projects: parsed.projects,\n resources: parsed.resources,\n deploymentsLookbackDays: parsed.deploymentsLookbackDays,\n },\n { apiToken: parsed.apiToken },\n ctx,\n );\n }\n\n readonly id = 'vercel';\n override readonly credentials = vercelCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.creds.apiToken}`,\n 'User-Agent': 'rawdash/connector-vercel (+https://rawdash.dev)',\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 rateLimit: vercelRateLimit,\n });\n }\n\n // -------------------------------------------------------------------------\n // Resource enablement\n // -------------------------------------------------------------------------\n\n private isResourceEnabled(resource: VercelResource): boolean {\n const enabled = this.settings.resources;\n if (!enabled || enabled.length === 0) {\n return true;\n }\n return enabled.includes(resource);\n }\n\n private activePhases(): VercelPhase[] {\n const phases: VercelPhase[] = [];\n if (this.isResourceEnabled('projects')) {\n phases.push('projects');\n }\n if (\n this.isResourceEnabled('deployments') ||\n this.isResourceEnabled('deployment_events')\n ) {\n phases.push('deployments');\n }\n return phases;\n }\n\n // -------------------------------------------------------------------------\n // URL building + sanitization\n // -------------------------------------------------------------------------\n\n private allowedPagePath(phase: VercelPhase): string {\n switch (phase) {\n case 'projects':\n return '/v9/projects';\n case 'deployments':\n return '/v6/deployments';\n }\n }\n\n private sanitizePageUrl(\n phase: VercelPhase,\n pageUrl: string | null,\n ): string | null {\n if (pageUrl === null) {\n return null;\n }\n const allowedPath = this.allowedPagePath(phase);\n try {\n const u = new URL(pageUrl);\n if (\n u.protocol !== 'https:' ||\n u.host !== VERCEL_API_HOST ||\n u.pathname !== allowedPath\n ) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n }\n\n private resolveCursor(cursor: unknown): VercelSyncCursor | undefined {\n if (!isVercelSyncCursor(cursor)) {\n return undefined;\n }\n return {\n phase: cursor.phase,\n page: this.sanitizePageUrl(cursor.phase, cursor.page),\n };\n }\n\n private withTeamId(u: URL): URL {\n if (this.settings.teamId !== undefined) {\n u.searchParams.set('teamId', this.settings.teamId);\n }\n return u;\n }\n\n private buildInitialProjectsUrl(): string {\n const u = new URL(`${VERCEL_API_BASE}/v9/projects`);\n u.searchParams.set('limit', String(PROJECTS_PAGE_SIZE));\n this.withTeamId(u);\n return u.toString();\n }\n\n private buildInitialDeploymentsUrl(options: SyncOptions): string {\n const u = new URL(`${VERCEL_API_BASE}/v6/deployments`);\n u.searchParams.set('limit', String(DEPLOYMENTS_PAGE_SIZE));\n for (const project of this.settings.projects ?? []) {\n u.searchParams.append('projectId', project);\n }\n const sinceMs = this.computeDeploymentsSinceMs(options);\n if (sinceMs !== null) {\n u.searchParams.set('since', String(sinceMs));\n }\n this.withTeamId(u);\n return u.toString();\n }\n\n private computeDeploymentsSinceMs(options: SyncOptions): number | null {\n if (options.mode === 'latest' && options.since) {\n const ms = new Date(options.since).getTime();\n if (Number.isFinite(ms)) {\n return ms;\n }\n }\n const days = this.settings.deploymentsLookbackDays ?? DEFAULT_LOOKBACK_DAYS;\n return Date.now() - days * MS_PER_DAY;\n }\n\n // -------------------------------------------------------------------------\n // Fetchers\n // -------------------------------------------------------------------------\n\n private buildNextPageUrl(\n phase: VercelPhase,\n currentUrl: string,\n until: number,\n ): string {\n const u = new URL(currentUrl);\n u.searchParams.set('until', String(until));\n return u.toString();\n }\n\n private async fetchProjectsPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<{ items: VercelProject[]; next: string | null }> {\n const url = page ?? this.buildInitialProjectsUrl();\n const res = await this.fetch<VercelProjectsResponse>(\n url,\n 'projects',\n signal,\n );\n const next =\n res.body.pagination.next !== null &&\n res.body.pagination.next !== undefined\n ? this.sanitizePageUrl(\n 'projects',\n this.buildNextPageUrl('projects', url, res.body.pagination.next),\n )\n : null;\n return { items: res.body.projects, next };\n }\n\n private async fetchDeploymentsPage(\n page: string | null,\n options: SyncOptions,\n signal: AbortSignal | undefined,\n ): Promise<{ items: VercelDeployment[]; next: string | null }> {\n const url = page ?? this.buildInitialDeploymentsUrl(options);\n const res = await this.fetch<VercelDeploymentsResponse>(\n url,\n 'deployments',\n signal,\n );\n const next =\n res.body.pagination.next !== null &&\n res.body.pagination.next !== undefined\n ? this.sanitizePageUrl(\n 'deployments',\n this.buildNextPageUrl('deployments', url, res.body.pagination.next),\n )\n : null;\n return { items: res.body.deployments, next };\n }\n\n // -------------------------------------------------------------------------\n // Writers\n // -------------------------------------------------------------------------\n\n private async writeProjects(\n storage: StorageHandle,\n projects: VercelProject[],\n ): Promise<void> {\n for (const p of projects) {\n const createdMs = Number.isFinite(p.createdAt) ? p.createdAt : null;\n const updatedMs = Number.isFinite(p.updatedAt) ? p.updatedAt : null;\n if (createdMs === null || updatedMs === null) {\n console.warn(\n `[connector-vercel] skipping project ${p.id} with unparseable timestamps`,\n );\n continue;\n }\n await storage.entity({\n type: 'vercel_project',\n id: p.id,\n attributes: {\n name: p.name,\n framework: p.framework,\n accountId: p.accountId ?? null,\n createdAt: createdMs,\n updatedAt: updatedMs,\n },\n updated_at: updatedMs,\n });\n }\n }\n\n private async writeDeployments(\n storage: StorageHandle,\n deployments: VercelDeployment[],\n ): Promise<void> {\n const writeEntities = this.isResourceEnabled('deployments');\n const writeEvents = this.isResourceEnabled('deployment_events');\n\n for (const d of deployments) {\n const createdMs = Number.isFinite(d.created) ? d.created : null;\n if (createdMs === null) {\n console.warn(\n `[connector-vercel] skipping deployment ${d.uid} with unparseable created timestamp`,\n );\n continue;\n }\n const buildingMs =\n d.buildingAt !== null &&\n d.buildingAt !== undefined &&\n Number.isFinite(d.buildingAt)\n ? d.buildingAt\n : null;\n const readyMs =\n d.ready !== null && d.ready !== undefined && Number.isFinite(d.ready)\n ? d.ready\n : null;\n const buildDurationMs =\n readyMs !== null && buildingMs !== null && readyMs >= buildingMs\n ? readyMs - buildingMs\n : null;\n const gitRef =\n d.meta?.githubCommitRef ??\n d.meta?.gitlabCommitRef ??\n d.meta?.bitbucketCommitRef ??\n d.meta?.branch ??\n null;\n const gitSha = d.meta?.githubCommitSha ?? null;\n const projectId = d.projectId ?? null;\n const target = d.target ?? null;\n const creatorUsername = d.creator.username ?? null;\n const baseAttributes: Record<string, JSONValue> = {\n deploymentId: d.uid,\n name: d.name,\n url: d.url,\n state: d.state,\n target,\n projectId,\n creatorUid: d.creator.uid,\n creatorUsername,\n source: d.source ?? null,\n gitRef,\n gitSha,\n createdAt: createdMs,\n buildingAt: buildingMs,\n readyAt: readyMs,\n buildDurationMs,\n };\n\n if (writeEntities) {\n await storage.entity({\n type: 'vercel_deployment',\n id: d.uid,\n attributes: baseAttributes,\n updated_at: readyMs ?? buildingMs ?? createdMs,\n });\n }\n\n if (writeEvents) {\n await storage.event({\n name: 'vercel_deployment_event',\n start_ts: createdMs,\n end_ts: readyMs,\n attributes: baseAttributes,\n });\n }\n }\n }\n\n // -------------------------------------------------------------------------\n // sync\n // -------------------------------------------------------------------------\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = this.resolveCursor(options.cursor);\n const isFull = options.mode === 'full';\n const phases = this.activePhases();\n\n return paginateChunked<VercelPhase, 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 'deployments':\n return this.fetchDeploymentsPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'projects':\n if (this.isResourceEnabled('projects')) {\n await storage.entities([], { types: ['vercel_project'] });\n }\n break;\n case 'deployments':\n if (this.isResourceEnabled('deployments')) {\n await storage.entities([], { types: ['vercel_deployment'] });\n }\n if (this.isResourceEnabled('deployment_events')) {\n await storage.events([], {\n names: ['vercel_deployment_event'],\n });\n }\n break;\n }\n }\n switch (phase) {\n case 'projects':\n if (!this.isResourceEnabled('projects')) {\n return;\n }\n return this.writeProjects(storage, items as VercelProject[]);\n case 'deployments':\n return this.writeDeployments(storage, items as VercelDeployment[]);\n }\n },\n });\n }\n}\n","import { VercelConnector } from './vercel';\n\nexport { configFields, VercelConnector } from './vercel';\nexport type { VercelResource, VercelSettings } from './vercel';\nexport default VercelConnector;\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EAQA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAMX,IAAM,eAAe;AAAA,EAC1B,EAAE,OAAO;A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AO,CAAC,yBAAyB;AAAA,gBACnC,CAAC;AAAA,cACH;AACA;AAAA,UACJ;AAAA,QACF;AACA,gBAAQ,OAAO;AAAA,UACb,KAAK;AACH,gBAAI,CAAC,KAAK,kBAAkB,UAAU,GAAG;AACvC;AAAA,YACF;AACA,mBAAO,KAAK,cAAc,SAAS,KAAwB;AAAA,UAC7D,KAAK;AACH,mBAAO,KAAK,iBAAiB,SAAS,KAA2B;AAAA,QACrE;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;ACzoBA,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/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/vercel.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 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 sanitizeAllowedUrl,\n standardRateLimitPolicy,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type ConnectorDoc,\n type CredentialsSchema,\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\n// ---------------------------------------------------------------------------\n// configFields\n// ---------------------------------------------------------------------------\n\nexport const configFields = defineConfigFields(\n z.object({\n apiToken: z.object({ $secret: z.string() }).meta({\n label: 'API Token',\n description:\n 'Vercel access token (Personal or Team). Create one at Vercel → Account Settings → Tokens.',\n placeholder: 'vercel_token',\n secret: true,\n }),\n teamId: z.string().min(1).optional().meta({\n label: 'Team ID (optional)',\n description:\n 'Vercel team ID (slug or `team_...`). Omit to use the token owner scope. Required if the token is a team token.',\n placeholder: 'team_abc123',\n }),\n projects: z.array(z.string().min(1)).nonempty().optional().meta({\n label: 'Projects (optional)',\n description:\n 'Restrict deployment sync to specific Vercel project IDs (e.g. `prj_...`). Omit to sync every project the token can see.',\n }),\n resources: z\n .array(z.enum(['projects', 'deployments', 'deployment_events']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Vercel resources to sync. Omit to sync all of them. 'deployment_events' depends on 'deployments' being fetched - enabling it without 'deployments' still runs the deployments query, but skips writing deployment entities.\",\n }),\n deploymentsLookbackDays: z\n .number()\n .int()\n .positive()\n .max(365)\n .optional()\n .meta({\n label: 'Deployments lookback (days)',\n description:\n 'How many days back to fetch deployments on a full sync. Defaults to 30. Vercel returns deployments newest-first; this caps the backfill window.',\n placeholder: '30',\n }),\n }),\n);\n\nexport type VercelResource = 'projects' | 'deployments' | 'deployment_events';\n\nexport interface VercelSettings {\n teamId?: string;\n projects?: readonly string[];\n resources?: readonly VercelResource[];\n deploymentsLookbackDays?: number;\n}\n\nconst vercelCredentials = {\n apiToken: {\n description: 'Vercel access token',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype VercelCredentials = typeof vercelCredentials;\n\n// ---------------------------------------------------------------------------\n// Connector documentation metadata\n// ---------------------------------------------------------------------------\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Vercel',\n category: 'infrastructure',\n brandColor: '#000000',\n tagline:\n 'Sync Vercel projects and deployments - including build state, target, git ref, and build duration - across your team.',\n vendor: {\n name: 'Vercel',\n apiDocs: 'https://vercel.com/docs/rest-api',\n website: 'https://vercel.com',\n },\n auth: {\n summary:\n 'A Vercel access token is required. Use a team token (with the team ID) to sync a team scope, or a personal token for the token owner scope.',\n setup: [\n 'Open Vercel → Account Settings → Tokens.',\n 'Create an access token with read access to the projects and deployments you want to sync.',\n 'Store it as a secret and reference it from the connector config as `apiToken: secret(\"VERCEL_TOKEN\")`.',\n 'If the token is a team token, set `teamId` to the team slug or `team_...` id.',\n ],\n },\n rateLimit:\n 'Vercel returns X-RateLimit-Remaining / X-RateLimit-Reset headers (Unix seconds).',\n limitations: [\n 'Deployments are fetched newest-first within the configured lookback window (`deploymentsLookbackDays`, default 30 days); older deployments are not backfilled.',\n 'Enabling `deployment_events` without `deployments` still runs the deployments query but skips writing deployment entities.',\n 'Web Vitals / Speed Insights, edge function logs, and DNS/domain APIs are out of scope.',\n ],\n});\n\n// ---------------------------------------------------------------------------\n// Rate-limit policy — Vercel sends standard `X-RateLimit-*` headers, reset is\n// a Unix timestamp in seconds.\n// ---------------------------------------------------------------------------\n\nconst vercelRateLimit = standardRateLimitPolicy({\n remainingHeader: 'x-ratelimit-remaining',\n resetHeader: 'x-ratelimit-reset',\n resetUnit: 's',\n});\n\n// ---------------------------------------------------------------------------\n// Sync phases + cursor\n// ---------------------------------------------------------------------------\n\nconst PHASE_ORDER = ['projects', 'deployments'] as const;\n\ntype VercelPhase = (typeof PHASE_ORDER)[number];\n\ntype VercelSyncCursor = ChunkedSyncCursor<VercelPhase, string>;\n\nconst isVercelSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\n// ---------------------------------------------------------------------------\n// Vercel API types\n// ---------------------------------------------------------------------------\n\ninterface VercelProject {\n id: string;\n name: string;\n accountId?: string;\n framework: string | null;\n createdAt: number;\n updatedAt: number;\n}\n\ninterface VercelProjectsResponse {\n projects: VercelProject[];\n pagination: VercelPagination;\n}\n\ninterface VercelPagination {\n count: number;\n next: number | null;\n prev?: number | null;\n}\n\ninterface VercelDeploymentCreator {\n uid: string;\n username?: string | null;\n email?: string | null;\n}\n\ntype VercelDeploymentMeta = {\n githubCommitRef?: string | null;\n githubCommitSha?: string | null;\n githubCommitMessage?: string | null;\n gitlabCommitRef?: string | null;\n bitbucketCommitRef?: string | null;\n branch?: string | null;\n} & Record<string, string | null | undefined>;\n\ninterface VercelDeployment {\n uid: string;\n name: string;\n url: string;\n created: number;\n createdAt?: number;\n state:\n | 'BUILDING'\n | 'ERROR'\n | 'INITIALIZING'\n | 'QUEUED'\n | 'READY'\n | 'CANCELED';\n target: 'production' | 'staging' | 'preview' | null;\n inspectorUrl?: string | null;\n creator: VercelDeploymentCreator;\n buildingAt?: number | null;\n ready?: number | null;\n source?: 'cli' | 'git' | 'import' | 'api-trigger-git-deploy' | string | null;\n meta?: VercelDeploymentMeta | null;\n projectId?: string | null;\n}\n\ninterface VercelDeploymentsResponse {\n deployments: VercelDeployment[];\n pagination: VercelPagination;\n}\n\n// ---------------------------------------------------------------------------\n// Schemas — describe the per-resource API response shape consumed by request()\n// ---------------------------------------------------------------------------\n\nconst idString = z.string().min(1);\nconst nonNegInt = z.number().int().nonnegative();\n\nconst paginationSchema = z.object({\n count: nonNegInt,\n next: nonNegInt.nullable(),\n});\n\nconst projectSchema = z.object({\n id: idString,\n name: z.string().min(1),\n framework: z.string().nullable(),\n createdAt: nonNegInt,\n updatedAt: nonNegInt,\n});\n\nconst projectsResponseSchema = z.object({\n projects: z.array(projectSchema),\n pagination: paginationSchema,\n});\n\nconst deploymentStateSchema = z.enum([\n 'BUILDING',\n 'ERROR',\n 'INITIALIZING',\n 'QUEUED',\n 'READY',\n 'CANCELED',\n]);\n\nconst deploymentTargetSchema = z\n .enum(['production', 'staging', 'preview'])\n .nullable();\n\nconst deploymentSchema = z.object({\n uid: idString,\n name: z.string(),\n url: z.string(),\n created: nonNegInt,\n state: deploymentStateSchema,\n target: deploymentTargetSchema,\n creator: z.object({\n uid: idString,\n username: z.string().nullable(),\n }),\n buildingAt: nonNegInt.nullable(),\n ready: nonNegInt.nullable(),\n source: z.string().nullable(),\n meta: z.record(z.string(), z.string().nullable()).nullable().optional(),\n projectId: z.string().nullable().optional(),\n});\n\nconst deploymentsResponseSchema = z.object({\n deployments: z.array(deploymentSchema),\n pagination: paginationSchema,\n});\n\nconst vercelResources = defineResources({\n vercel_project: {\n shape: 'entity',\n description:\n 'Vercel projects with name, framework, owning account, and create/update timestamps.',\n endpoint: 'GET /v9/projects',\n responses: { projects: projectsResponseSchema },\n },\n vercel_deployment: {\n shape: 'entity',\n description:\n 'Deployments with build state, target environment, git ref/sha, creator, and build duration.',\n endpoint: 'GET /v6/deployments',\n notes:\n 'buildDurationMs is ready minus buildingAt when both are present, otherwise null. gitRef prefers meta.githubCommitRef, falling back to gitlabCommitRef, bitbucketCommitRef, then meta.branch.',\n responses: { deployments: deploymentsResponseSchema },\n },\n vercel_deployment_event: {\n shape: 'event',\n description:\n 'Each deployment emitted as a time-bounded event spanning creation to ready, carrying the same attributes as the deployment entity.',\n endpoint: 'GET /v6/deployments',\n },\n});\n\n// ---------------------------------------------------------------------------\n// VercelConnector\n// ---------------------------------------------------------------------------\n\nconst VERCEL_API_HOST = 'api.vercel.com';\nconst VERCEL_API_BASE = `https://${VERCEL_API_HOST}`;\nconst PROJECTS_PAGE_SIZE = 100;\nconst DEPLOYMENTS_PAGE_SIZE = 100;\nconst DEFAULT_LOOKBACK_DAYS = 30;\nconst MS_PER_DAY = 24 * 60 * 60 * 1000;\n\nexport class VercelConnector extends BaseConnector<\n VercelSettings,\n VercelCredentials\n> {\n static readonly id = 'vercel';\n\n static readonly resources = vercelResources;\n\n static readonly schemas = schemasFromResources(vercelResources);\n\n static create(input: unknown, ctx?: ConnectorContext): VercelConnector {\n const parsed = configFields.parse(input);\n return new VercelConnector(\n {\n teamId: parsed.teamId,\n projects: parsed.projects,\n resources: parsed.resources,\n deploymentsLookbackDays: parsed.deploymentsLookbackDays,\n },\n { apiToken: parsed.apiToken },\n ctx,\n );\n }\n\n readonly id = 'vercel';\n override readonly credentials = vercelCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.creds.apiToken}`,\n 'User-Agent': connectorUserAgent('vercel'),\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 rateLimit: vercelRateLimit,\n });\n }\n\n // -------------------------------------------------------------------------\n // Resource enablement\n // -------------------------------------------------------------------------\n\n private activePhases(): VercelPhase[] {\n return selectActivePhases<VercelResource, VercelPhase>(\n (r) => (r === 'projects' ? 'projects' : 'deployments'),\n PHASE_ORDER,\n this.settings.resources,\n );\n }\n\n // -------------------------------------------------------------------------\n // URL building + sanitization\n // -------------------------------------------------------------------------\n\n private allowedPagePath(phase: VercelPhase): string {\n switch (phase) {\n case 'projects':\n return '/v9/projects';\n case 'deployments':\n return '/v6/deployments';\n }\n }\n\n private sanitizePageUrl(\n phase: VercelPhase,\n pageUrl: string | null,\n ): string | null {\n return sanitizeAllowedUrl({\n url: pageUrl,\n host: VERCEL_API_HOST,\n pathname: this.allowedPagePath(phase),\n });\n }\n\n private resolveCursor(cursor: unknown): VercelSyncCursor | undefined {\n if (!isVercelSyncCursor(cursor)) {\n return undefined;\n }\n return {\n phase: cursor.phase,\n page: this.sanitizePageUrl(cursor.phase, cursor.page),\n };\n }\n\n private withTeamId(u: URL): URL {\n if (this.settings.teamId !== undefined) {\n u.searchParams.set('teamId', this.settings.teamId);\n }\n return u;\n }\n\n private buildInitialProjectsUrl(): string {\n const u = new URL(`${VERCEL_API_BASE}/v9/projects`);\n u.searchParams.set('limit', String(PROJECTS_PAGE_SIZE));\n this.withTeamId(u);\n return u.toString();\n }\n\n private buildInitialDeploymentsUrl(options: SyncOptions): string {\n const u = new URL(`${VERCEL_API_BASE}/v6/deployments`);\n u.searchParams.set('limit', String(DEPLOYMENTS_PAGE_SIZE));\n for (const project of this.settings.projects ?? []) {\n u.searchParams.append('projectId', project);\n }\n const sinceMs = this.computeDeploymentsSinceMs(options);\n if (sinceMs !== null) {\n u.searchParams.set('since', String(sinceMs));\n }\n this.withTeamId(u);\n return u.toString();\n }\n\n private computeDeploymentsSinceMs(options: SyncOptions): number | null {\n if (options.since) {\n const ms = parseEpoch(options.since, 'iso');\n if (ms !== null) {\n return ms;\n }\n }\n const days = this.settings.deploymentsLookbackDays ?? DEFAULT_LOOKBACK_DAYS;\n return Date.now() - days * MS_PER_DAY;\n }\n\n // -------------------------------------------------------------------------\n // Fetchers\n // -------------------------------------------------------------------------\n\n private buildNextPageUrl(\n phase: VercelPhase,\n currentUrl: string,\n until: number,\n ): string {\n const u = new URL(currentUrl);\n u.searchParams.set('until', String(until));\n return u.toString();\n }\n\n private async fetchProjectsPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<{ items: VercelProject[]; next: string | null }> {\n const url = page ?? this.buildInitialProjectsUrl();\n const res = await this.fetch<VercelProjectsResponse>(\n url,\n 'projects',\n signal,\n );\n const next =\n res.body.pagination.next !== null &&\n res.body.pagination.next !== undefined\n ? this.sanitizePageUrl(\n 'projects',\n this.buildNextPageUrl('projects', url, res.body.pagination.next),\n )\n : null;\n return { items: res.body.projects, next };\n }\n\n private async fetchDeploymentsPage(\n page: string | null,\n options: SyncOptions,\n signal: AbortSignal | undefined,\n ): Promise<{ items: VercelDeployment[]; next: string | null }> {\n const url = page ?? this.buildInitialDeploymentsUrl(options);\n const res = await this.fetch<VercelDeploymentsResponse>(\n url,\n 'deployments',\n signal,\n );\n const next =\n res.body.pagination.next !== null &&\n res.body.pagination.next !== undefined\n ? this.sanitizePageUrl(\n 'deployments',\n this.buildNextPageUrl('deployments', url, res.body.pagination.next),\n )\n : null;\n return { items: res.body.deployments, next };\n }\n\n // -------------------------------------------------------------------------\n // Writers\n // -------------------------------------------------------------------------\n\n private async writeProjects(\n storage: StorageHandle,\n projects: VercelProject[],\n ): Promise<void> {\n for (const p of projects) {\n const createdMs = parseEpoch(p.createdAt, 'ms');\n const updatedMs = parseEpoch(p.updatedAt, 'ms');\n if (createdMs === null || updatedMs === null) {\n console.warn(\n `[connector-vercel] skipping project ${p.id} with unparseable timestamps`,\n );\n continue;\n }\n await storage.entity({\n type: 'vercel_project',\n id: p.id,\n attributes: {\n name: p.name,\n framework: p.framework,\n accountId: p.accountId ?? null,\n createdAt: createdMs,\n updatedAt: updatedMs,\n },\n updated_at: updatedMs,\n });\n }\n }\n\n private async writeDeployments(\n storage: StorageHandle,\n deployments: VercelDeployment[],\n ): Promise<void> {\n const writeEntities = this.isResourceEnabled('deployments');\n const writeEvents = this.isResourceEnabled('deployment_events');\n\n for (const d of deployments) {\n const createdMs = parseEpoch(d.created, 'ms');\n if (createdMs === null) {\n console.warn(\n `[connector-vercel] skipping deployment ${d.uid} with unparseable created timestamp`,\n );\n continue;\n }\n const buildingMs = parseEpoch(d.buildingAt, 'ms');\n const readyMs = parseEpoch(d.ready, 'ms');\n const buildDurationMs =\n readyMs !== null && buildingMs !== null && readyMs >= buildingMs\n ? readyMs - buildingMs\n : null;\n const gitRef =\n d.meta?.githubCommitRef ??\n d.meta?.gitlabCommitRef ??\n d.meta?.bitbucketCommitRef ??\n d.meta?.branch ??\n null;\n const gitSha = d.meta?.githubCommitSha ?? null;\n const projectId = d.projectId ?? null;\n const target = d.target ?? null;\n const creatorUsername = d.creator.username ?? null;\n const baseAttributes: Record<string, JSONValue> = {\n deploymentId: d.uid,\n name: d.name,\n url: d.url,\n state: d.state,\n target,\n projectId,\n creatorUid: d.creator.uid,\n creatorUsername,\n source: d.source ?? null,\n gitRef,\n gitSha,\n createdAt: createdMs,\n buildingAt: buildingMs,\n readyAt: readyMs,\n buildDurationMs,\n };\n\n if (writeEntities) {\n await storage.entity({\n type: 'vercel_deployment',\n id: d.uid,\n attributes: baseAttributes,\n updated_at: readyMs ?? buildingMs ?? createdMs,\n });\n }\n\n if (writeEvents) {\n await storage.event({\n name: 'vercel_deployment_event',\n start_ts: createdMs,\n end_ts: readyMs,\n attributes: baseAttributes,\n });\n }\n }\n }\n\n // -------------------------------------------------------------------------\n // sync\n // -------------------------------------------------------------------------\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = this.resolveCursor(options.cursor);\n const isFull = options.mode === 'full';\n const phases = this.activePhases();\n\n return paginateChunked<VercelPhase, string>({\n phases,\n cursor,\n signal,\n logger: this.logger,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'projects':\n return this.fetchProjectsPage(page, sig);\n case 'deployments':\n return this.fetchDeploymentsPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'projects':\n if (this.isResourceEnabled('projects')) {\n await storage.entities([], { types: ['vercel_project'] });\n }\n break;\n case 'deployments':\n if (this.isResourceEnabled('deployments')) {\n await storage.entities([], { types: ['vercel_deployment'] });\n }\n if (this.isResourceEnabled('deployment_events')) {\n await storage.events([], {\n names: ['vercel_deployment_event'],\n });\n }\n break;\n }\n }\n switch (phase) {\n case 'projects':\n if (!this.isResourceEnabled('projects')) {\n return;\n }\n return this.writeProjects(storage, items as VercelProject[]);\n case 'deployments':\n return this.writeDeployments(storage, items as VercelDeployment[]);\n }\n },\n });\n }\n}\n","import { VercelConnector } from './vercel';\n\nexport { configFields, doc, VercelConnector } from './vercel';\nexport type { VercelResource, VercelSettings } from './vercel';\nexport default VercelConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,mBAAmB;AAChE;AEUO,SAAS,wBACd,QACiB;AACjB,QAAM,EAAE,iBAAiB,aAAa,WAAW,gBAAgB,IAAI;AACrE,QAAM,aAAa,cAAc,MAAM,MAAO;AAC9C,SAAO;IACL,MAAM,GAAG;AACP,YAAM,eAAe,EAAE,IAAI,eAAe;AAC1C,UAAI,iBAAiB,QAAQ,aAAa,KAAK,MAAM,IAAI;AACvD,eAAO;MACT;AACA,YAAM,YAAY,OAAO,YAAY;AACrC,UAAI,CAAC,OAAO,SAAS,SAAS,GAAG;AAC/B,eAAO;MACT;AACA,YAAM,WAAW,EAAE,IAAI,WAAW;AAClC,UAAI,aAAa,MAAM;AACrB,YAAI,oBAAoB,QAAW;AACjC,iBAAO;QACT;AACA,eAAO;UACL;UACA,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,eAAe;QAChD;MACF;AACA,UAAI,SAAS,KAAK,MAAM,IAAI;AAC1B,eAAO;MACT;AACA,YAAM,QAAQ,OAAO,QAAQ;AAC7B,UAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG;AACxC,eAAO;MACT;AACA,YAAM,UAAU,QAAQ;AACxB,UAAI,CAAC,OAAO,SAAS,OAAO,GAAG;AAC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AG;AAAA,UACzC,KAAK;AACH,mBAAO,KAAK,qBAAqB,MAAM,SAAS,GAAG;AAAA,QACvD;AAAA,MACF;AAAA,MACA,YAAY,OAAO,OAAO,OAAO,SAAS;AACxC,YAAI,UAAU,SAAS,MAAM;AAC3B,kBAAQ,OAAO;AAAA,YACb,KAAK;AACH,kBAAI,KAAK,kBAAkB,UAAU,GAAG;AACtC,sBAAM,QAAQ,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC;AAAA,cAC1D;AACA;AAAA,YACF,KAAK;AACH,kBAAI,KAAK,kBAAkB,aAAa,GAAG;AACzC,sBAAM,QAAQ,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,mBAAmB,EAAE,CAAC;AAAA,cAC7D;AACA,kBAAI,KAAK,kBAAkB,mBAAmB,GAAG;AAC/C,sBAAM,QAAQ,OAAO,CAAC,GAAG;AAAA,kBACvB,OAAO,CAAC,yBAAyB;AAAA,gBACnC,CAAC;AAAA,cACH;AACA;AAAA,UACJ;AAAA,QACF;AACA,gBAAQ,OAAO;AAAA,UACb,KAAK;AACH,gBAAI,CAAC,KAAK,kBAAkB,UAAU,GAAG;AACvC;AAAA,YACF;AACA,mBAAO,KAAK,cAAc,SAAS,KAAwB;AAAA,UAC7D,KAAK;AACH,mBAAO,KAAK,iBAAiB,SAAS,KAA2B;AAAA,QACrE;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;AClpBA,IAAO,gBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rawdash/connector-vercel",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Rawdash connector for Vercel — projects, deployments, deploy state transitions",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -21,22 +21,22 @@
21
21
  "import": "./dist/index.js"
22
22
  }
23
23
  },
24
- "scripts": {
25
- "build": "tsup",
26
- "typecheck": "tsc --noEmit",
27
- "lint": "eslint src",
28
- "test": "vitest run"
29
- },
30
24
  "dependencies": {
31
- "@rawdash/core": "workspace:*",
32
- "zod": "^4.4.3"
25
+ "zod": "^4.4.3",
26
+ "@rawdash/core": "0.16.0"
33
27
  },
34
28
  "devDependencies": {
35
- "@rawdash/connector-shared": "workspace:*",
36
- "@rawdash/connector-test-utils": "workspace:*",
37
29
  "fast-check": "^4.8.0",
38
30
  "tsup": "^8.0.0",
39
31
  "typescript": "^5.7.2",
40
- "vitest": "^4.1.4"
32
+ "vitest": "^4.1.4",
33
+ "@rawdash/connector-shared": "0.3.0",
34
+ "@rawdash/connector-test-utils": "0.0.3"
35
+ },
36
+ "scripts": {
37
+ "build": "tsup",
38
+ "typecheck": "tsc --noEmit",
39
+ "lint": "eslint src",
40
+ "test": "vitest run"
41
41
  }
42
- }
42
+ }