@rawdash/connector-netlify 0.19.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/README.md +102 -0
- package/dist/index.d.ts +223 -0
- package/dist/index.js +577 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!-- This file is generated from connector metadata by scripts/generate-connector-docs.ts. Do not edit by hand. -->
|
|
2
|
+
|
|
3
|
+
# @rawdash/connector-netlify
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@rawdash/connector-netlify)
|
|
6
|
+
[](https://github.com/rawdash/rawdash/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
Sync Netlify sites and deploys - including build state, branch, commit ref, and deploy duration - across your team.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @rawdash/connector-netlify
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Authentication
|
|
17
|
+
|
|
18
|
+
A Netlify personal access token is required. The token must belong to an account with read access to the sites you want to sync.
|
|
19
|
+
|
|
20
|
+
1. Open Netlify -> User Settings -> Applications -> Personal access tokens.
|
|
21
|
+
2. Click "New access token", give it a name, and copy the token value.
|
|
22
|
+
3. Store it as a secret and reference it from the connector config as `apiToken: secret("NETLIFY_API_TOKEN")`.
|
|
23
|
+
4. Optionally set `siteIds` to a list of site IDs to limit the sync scope.
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
| Field | Type | Required | Description |
|
|
28
|
+
| --------------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `apiToken` | secret | Yes | Netlify personal access token. Create one at Netlify -> User Settings -> Applications -> Personal access tokens. |
|
|
30
|
+
| `siteIds` | array | No | Restrict the sync to specific Netlify site IDs (the UUID-style id from the site Admin panel). Omit to sync every site the token can see. |
|
|
31
|
+
| `resources` | array | No | Which Netlify resources to sync. Omit to sync all of them. 'deploy_events' rides the 'deploys' phase - enabling it without 'deploys' still fetches deploys but skips writing deploy entities. |
|
|
32
|
+
| `deploysLookbackDays` | number | No | Cap the deploy backfill window to this many days. If unset, the connector fetches every deploy the API returns (newest-first). Netlify has no server-side date filter on the deploys endpoint, so the cutoff is applied client-side and short-circuits pagination once a page is entirely older than the cutoff. |
|
|
33
|
+
|
|
34
|
+
## Resources
|
|
35
|
+
|
|
36
|
+
- **`netlify_site`** _(entity)_ - Netlify sites with name, primary URL, owning account, linked git repo, and create/update timestamps.
|
|
37
|
+
- Endpoint: `GET /api/v1/sites`
|
|
38
|
+
- **`netlify_deploy`** _(entity)_ - Deploys with build state, branch, commit ref, deploy context (production/branch-deploy/deploy-preview), and build duration.
|
|
39
|
+
- Endpoint: `GET /api/v1/sites/{site_id}/deploys`
|
|
40
|
+
- deployTimeMs comes from the API `deploy_time` field (seconds) when present, otherwise null. gitRef prefers `commit_ref`, falling back to `branch`.
|
|
41
|
+
- **`netlify_deploy_event`** _(event)_ - Each deploy emitted as a time-bounded event spanning creation to publish, carrying the same attributes as the deploy entity.
|
|
42
|
+
- Endpoint: `GET /api/v1/sites/{site_id}/deploys`
|
|
43
|
+
|
|
44
|
+
## Example
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import {
|
|
48
|
+
defineConfig,
|
|
49
|
+
defineDashboard,
|
|
50
|
+
defineMetric,
|
|
51
|
+
secret,
|
|
52
|
+
} from '@rawdash/core';
|
|
53
|
+
|
|
54
|
+
const netlify = {
|
|
55
|
+
name: 'netlify',
|
|
56
|
+
connectorId: 'netlify',
|
|
57
|
+
config: {
|
|
58
|
+
apiToken: secret('NETLIFY_API_TOKEN'),
|
|
59
|
+
deploysLookbackDays: 30,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default defineConfig({
|
|
64
|
+
connectors: [netlify],
|
|
65
|
+
dashboards: {
|
|
66
|
+
infrastructure: defineDashboard({
|
|
67
|
+
widgets: {
|
|
68
|
+
deploys: {
|
|
69
|
+
kind: 'stat',
|
|
70
|
+
title: 'Deploys',
|
|
71
|
+
metric: defineMetric({
|
|
72
|
+
connector: netlify,
|
|
73
|
+
shape: 'event',
|
|
74
|
+
name: 'netlify_deploy_event',
|
|
75
|
+
fn: 'count',
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Rate limits
|
|
85
|
+
|
|
86
|
+
Netlify returns standard `X-RateLimit-Remaining` / `X-RateLimit-Reset` headers (reset is a Unix timestamp in seconds); list pagination uses the Link header (page size 100).
|
|
87
|
+
|
|
88
|
+
## Limitations
|
|
89
|
+
|
|
90
|
+
- Netlify has no server-side date filter on the deploys endpoint - the connector paginates newest-first and applies `deploysLookbackDays` (if set) as a client-side cutoff that short-circuits pagination once a full page is older than the cutoff.
|
|
91
|
+
- Enabling `deploy_events` without `deploys` still runs the deploys query but skips writing deploy entities.
|
|
92
|
+
- Netlify Analytics (paid add-on), function invocation logs, and DNS/domain APIs are out of scope.
|
|
93
|
+
|
|
94
|
+
## Links
|
|
95
|
+
|
|
96
|
+
- [Rawdash docs](https://rawdash.dev/docs/connectors/)
|
|
97
|
+
- [Netlify API docs](https://open-api.netlify.com/)
|
|
98
|
+
- [GitHub](https://github.com/rawdash/rawdash)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
Apache-2.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { BaseConnector, ConnectorContext, SyncOptions, StorageHandle, SyncResult, ConnectorDoc } from '@rawdash/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const configFields: z.ZodObject<{
|
|
5
|
+
apiToken: z.ZodObject<{
|
|
6
|
+
$secret: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
siteIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
10
|
+
sites: "sites";
|
|
11
|
+
deploys: "deploys";
|
|
12
|
+
deploy_events: "deploy_events";
|
|
13
|
+
}>>>;
|
|
14
|
+
deploysLookbackDays: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
type NetlifyResource = 'sites' | 'deploys' | 'deploy_events';
|
|
17
|
+
interface NetlifySettings {
|
|
18
|
+
siteIds?: readonly string[];
|
|
19
|
+
resources?: readonly NetlifyResource[];
|
|
20
|
+
deploysLookbackDays?: number;
|
|
21
|
+
}
|
|
22
|
+
declare const netlifyCredentials: {
|
|
23
|
+
apiToken: {
|
|
24
|
+
description: string;
|
|
25
|
+
auth: "required";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type NetlifyCredentials = typeof netlifyCredentials;
|
|
29
|
+
declare const doc: ConnectorDoc;
|
|
30
|
+
declare const netlifyResources: {
|
|
31
|
+
readonly netlify_site: {
|
|
32
|
+
readonly shape: "entity";
|
|
33
|
+
readonly description: "Netlify sites with name, primary URL, owning account, linked git repo, and create/update timestamps.";
|
|
34
|
+
readonly endpoint: "GET /api/v1/sites";
|
|
35
|
+
readonly responses: {
|
|
36
|
+
readonly sites: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
site_id: z.ZodOptional<z.ZodString>;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
url: z.ZodString;
|
|
41
|
+
admin_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
|
+
account_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
account_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
+
build_settings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
45
|
+
repo_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
repo_branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
cmd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
}, z.core.$strip>>>;
|
|
49
|
+
created_at: z.ZodISODateTime;
|
|
50
|
+
updated_at: z.ZodISODateTime;
|
|
51
|
+
published_deploy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
state: z.ZodString;
|
|
54
|
+
}, z.core.$strip>>>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly netlify_deploy: {
|
|
59
|
+
readonly shape: "entity";
|
|
60
|
+
readonly description: "Deploys with build state, branch, commit ref, deploy context (production/branch-deploy/deploy-preview), and build duration.";
|
|
61
|
+
readonly endpoint: "GET /api/v1/sites/{site_id}/deploys";
|
|
62
|
+
readonly notes: "deployTimeMs comes from the API `deploy_time` field (seconds) when present, otherwise null. gitRef prefers `commit_ref`, falling back to `branch`.";
|
|
63
|
+
readonly responses: {
|
|
64
|
+
readonly deploys: z.ZodArray<z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
site_id: z.ZodString;
|
|
67
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
deploy_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
state: z.ZodString;
|
|
71
|
+
branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
context: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
commit_ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
commit_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
committer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
created_at: z.ZodISODateTime;
|
|
78
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
79
|
+
published_at: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
80
|
+
deploy_time: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
81
|
+
error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
}, z.core.$strip>>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
readonly netlify_deploy_event: {
|
|
86
|
+
readonly shape: "event";
|
|
87
|
+
readonly description: "Each deploy emitted as a time-bounded event spanning creation to publish, carrying the same attributes as the deploy entity.";
|
|
88
|
+
readonly endpoint: "GET /api/v1/sites/{site_id}/deploys";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
declare const id = "netlify";
|
|
92
|
+
declare class NetlifyConnector extends BaseConnector<NetlifySettings, NetlifyCredentials> {
|
|
93
|
+
static readonly id = "netlify";
|
|
94
|
+
static readonly resources: {
|
|
95
|
+
readonly netlify_site: {
|
|
96
|
+
readonly shape: "entity";
|
|
97
|
+
readonly description: "Netlify sites with name, primary URL, owning account, linked git repo, and create/update timestamps.";
|
|
98
|
+
readonly endpoint: "GET /api/v1/sites";
|
|
99
|
+
readonly responses: {
|
|
100
|
+
readonly sites: z.ZodArray<z.ZodObject<{
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
site_id: z.ZodOptional<z.ZodString>;
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
url: z.ZodString;
|
|
105
|
+
admin_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
account_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
|
+
account_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
+
build_settings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
109
|
+
repo_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
110
|
+
repo_branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
111
|
+
cmd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
}, z.core.$strip>>>;
|
|
113
|
+
created_at: z.ZodISODateTime;
|
|
114
|
+
updated_at: z.ZodISODateTime;
|
|
115
|
+
published_deploy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
state: z.ZodString;
|
|
118
|
+
}, z.core.$strip>>>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
readonly netlify_deploy: {
|
|
123
|
+
readonly shape: "entity";
|
|
124
|
+
readonly description: "Deploys with build state, branch, commit ref, deploy context (production/branch-deploy/deploy-preview), and build duration.";
|
|
125
|
+
readonly endpoint: "GET /api/v1/sites/{site_id}/deploys";
|
|
126
|
+
readonly notes: "deployTimeMs comes from the API `deploy_time` field (seconds) when present, otherwise null. gitRef prefers `commit_ref`, falling back to `branch`.";
|
|
127
|
+
readonly responses: {
|
|
128
|
+
readonly deploys: z.ZodArray<z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
site_id: z.ZodString;
|
|
131
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
133
|
+
deploy_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
+
state: z.ZodString;
|
|
135
|
+
branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
+
context: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
commit_ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
138
|
+
commit_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
139
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
140
|
+
committer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
created_at: z.ZodISODateTime;
|
|
142
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
143
|
+
published_at: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
144
|
+
deploy_time: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
145
|
+
error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
}, z.core.$strip>>;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
readonly netlify_deploy_event: {
|
|
150
|
+
readonly shape: "event";
|
|
151
|
+
readonly description: "Each deploy emitted as a time-bounded event spanning creation to publish, carrying the same attributes as the deploy entity.";
|
|
152
|
+
readonly endpoint: "GET /api/v1/sites/{site_id}/deploys";
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
static readonly schemas: object & {
|
|
156
|
+
readonly sites: z.ZodArray<z.ZodObject<{
|
|
157
|
+
id: z.ZodString;
|
|
158
|
+
site_id: z.ZodOptional<z.ZodString>;
|
|
159
|
+
name: z.ZodString;
|
|
160
|
+
url: z.ZodString;
|
|
161
|
+
admin_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
162
|
+
account_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
163
|
+
account_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
164
|
+
build_settings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
165
|
+
repo_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
166
|
+
repo_branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
167
|
+
cmd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
168
|
+
}, z.core.$strip>>>;
|
|
169
|
+
created_at: z.ZodISODateTime;
|
|
170
|
+
updated_at: z.ZodISODateTime;
|
|
171
|
+
published_deploy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
172
|
+
id: z.ZodString;
|
|
173
|
+
state: z.ZodString;
|
|
174
|
+
}, z.core.$strip>>>;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
} & {
|
|
177
|
+
readonly deploys: z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
site_id: z.ZodString;
|
|
180
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
deploy_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
|
+
state: z.ZodString;
|
|
184
|
+
branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
185
|
+
context: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
+
commit_ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
commit_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
committer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
190
|
+
created_at: z.ZodISODateTime;
|
|
191
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
192
|
+
published_at: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
193
|
+
deploy_time: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
194
|
+
error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
195
|
+
}, z.core.$strip>>;
|
|
196
|
+
} & Readonly<Record<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
197
|
+
static create(input: unknown, ctx?: ConnectorContext): NetlifyConnector;
|
|
198
|
+
readonly id = "netlify";
|
|
199
|
+
readonly credentials: {
|
|
200
|
+
apiToken: {
|
|
201
|
+
description: string;
|
|
202
|
+
auth: "required";
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
private discoveredSiteIds;
|
|
206
|
+
private buildHeaders;
|
|
207
|
+
private fetch;
|
|
208
|
+
private activePhases;
|
|
209
|
+
private sanitizeUrl;
|
|
210
|
+
private resolveCursor;
|
|
211
|
+
private buildInitialSitesUrl;
|
|
212
|
+
private fetchSitesPage;
|
|
213
|
+
private resolveSiteIds;
|
|
214
|
+
private buildInitialDeploysUrl;
|
|
215
|
+
private deployUpdatedMs;
|
|
216
|
+
private computeDeploysCutoffMs;
|
|
217
|
+
private fetchDeploysPage;
|
|
218
|
+
private writeSites;
|
|
219
|
+
private writeDeploysBatch;
|
|
220
|
+
sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { NetlifyConnector, type NetlifyResource, type NetlifySettings, configFields, NetlifyConnector as default, doc, id, netlifyResources as resources };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,577 @@
|
|
|
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 parseEpoch(value, unit) {
|
|
46
|
+
if (value === null || value === void 0) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
if (unit === "iso") {
|
|
50
|
+
if (typeof value !== "string") {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const ms = new Date(value).getTime();
|
|
54
|
+
return Number.isFinite(ms) ? ms : null;
|
|
55
|
+
}
|
|
56
|
+
if (typeof value === "string" && value.trim() === "") {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
60
|
+
if (!Number.isFinite(n)) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const result = unit === "s" ? n * 1e3 : n;
|
|
64
|
+
return Number.isFinite(result) ? result : null;
|
|
65
|
+
}
|
|
66
|
+
function parseLinkHeader(header) {
|
|
67
|
+
if (!header) {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
const result = {};
|
|
71
|
+
for (const part of header.split(",")) {
|
|
72
|
+
const match = part.match(/<([^>]+)>\s*;\s*rel="([^"]+)"/);
|
|
73
|
+
if (match) {
|
|
74
|
+
result[match[2]] = match[1];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/netlify.ts
|
|
81
|
+
import {
|
|
82
|
+
BaseConnector,
|
|
83
|
+
defineConfigFields,
|
|
84
|
+
defineConnectorDoc,
|
|
85
|
+
defineResources,
|
|
86
|
+
makeChunkedCursorGuard,
|
|
87
|
+
paginateChunked,
|
|
88
|
+
schemasFromResources,
|
|
89
|
+
selectActivePhases
|
|
90
|
+
} from "@rawdash/core";
|
|
91
|
+
import { z } from "zod";
|
|
92
|
+
var configFields = defineConfigFields(
|
|
93
|
+
z.object({
|
|
94
|
+
apiToken: z.object({ $secret: z.string() }).meta({
|
|
95
|
+
label: "API Token",
|
|
96
|
+
description: "Netlify personal access token. Create one at Netlify -> User Settings -> Applications -> Personal access tokens.",
|
|
97
|
+
placeholder: "nfp_...",
|
|
98
|
+
secret: true
|
|
99
|
+
}),
|
|
100
|
+
siteIds: z.array(z.string().min(1)).nonempty().optional().meta({
|
|
101
|
+
label: "Site IDs (optional)",
|
|
102
|
+
description: "Restrict the sync to specific Netlify site IDs (the UUID-style id from the site Admin panel). Omit to sync every site the token can see."
|
|
103
|
+
}),
|
|
104
|
+
resources: z.array(z.enum(["sites", "deploys", "deploy_events"])).nonempty().optional().meta({
|
|
105
|
+
label: "Resources",
|
|
106
|
+
description: "Which Netlify resources to sync. Omit to sync all of them. 'deploy_events' rides the 'deploys' phase - enabling it without 'deploys' still fetches deploys but skips writing deploy entities."
|
|
107
|
+
}),
|
|
108
|
+
deploysLookbackDays: z.number().int().positive().max(365).optional().meta({
|
|
109
|
+
label: "Deploys lookback (days)",
|
|
110
|
+
description: "Cap the deploy backfill window to this many days. If unset, the connector fetches every deploy the API returns (newest-first). Netlify has no server-side date filter on the deploys endpoint, so the cutoff is applied client-side and short-circuits pagination once a page is entirely older than the cutoff.",
|
|
111
|
+
placeholder: "30"
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
);
|
|
115
|
+
var netlifyCredentials = {
|
|
116
|
+
apiToken: {
|
|
117
|
+
description: "Netlify personal access token",
|
|
118
|
+
auth: "required"
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var doc = defineConnectorDoc({
|
|
122
|
+
displayName: "Netlify",
|
|
123
|
+
category: "infrastructure",
|
|
124
|
+
brandColor: "#00C7B7",
|
|
125
|
+
tagline: "Sync Netlify sites and deploys - including build state, branch, commit ref, and deploy duration - across your team.",
|
|
126
|
+
vendor: {
|
|
127
|
+
name: "Netlify",
|
|
128
|
+
apiDocs: "https://open-api.netlify.com/",
|
|
129
|
+
website: "https://www.netlify.com"
|
|
130
|
+
},
|
|
131
|
+
auth: {
|
|
132
|
+
summary: "A Netlify personal access token is required. The token must belong to an account with read access to the sites you want to sync.",
|
|
133
|
+
setup: [
|
|
134
|
+
"Open Netlify -> User Settings -> Applications -> Personal access tokens.",
|
|
135
|
+
'Click "New access token", give it a name, and copy the token value.',
|
|
136
|
+
'Store it as a secret and reference it from the connector config as `apiToken: secret("NETLIFY_API_TOKEN")`.',
|
|
137
|
+
"Optionally set `siteIds` to a list of site IDs to limit the sync scope."
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
rateLimit: "Netlify returns standard `X-RateLimit-Remaining` / `X-RateLimit-Reset` headers (reset is a Unix timestamp in seconds); list pagination uses the Link header (page size 100).",
|
|
141
|
+
limitations: [
|
|
142
|
+
"Netlify has no server-side date filter on the deploys endpoint - the connector paginates newest-first and applies `deploysLookbackDays` (if set) as a client-side cutoff that short-circuits pagination once a full page is older than the cutoff.",
|
|
143
|
+
"Enabling `deploy_events` without `deploys` still runs the deploys query but skips writing deploy entities.",
|
|
144
|
+
"Netlify Analytics (paid add-on), function invocation logs, and DNS/domain APIs are out of scope."
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
var netlifyRateLimit = standardRateLimitPolicy({
|
|
148
|
+
remainingHeader: "x-ratelimit-remaining",
|
|
149
|
+
resetHeader: "x-ratelimit-reset",
|
|
150
|
+
resetUnit: "s"
|
|
151
|
+
});
|
|
152
|
+
var PHASE_ORDER = ["sites", "deploys"];
|
|
153
|
+
var isNetlifySyncCursor = makeChunkedCursorGuard(PHASE_ORDER);
|
|
154
|
+
function decodeDeploysPage(page) {
|
|
155
|
+
if (page === null) {
|
|
156
|
+
return { idx: 0, url: null };
|
|
157
|
+
}
|
|
158
|
+
const sep = page.indexOf("|");
|
|
159
|
+
if (sep === -1) {
|
|
160
|
+
return { idx: 0, url: null };
|
|
161
|
+
}
|
|
162
|
+
const idxRaw = Number.parseInt(page.slice(0, sep), 10);
|
|
163
|
+
const url = page.slice(sep + 1);
|
|
164
|
+
return {
|
|
165
|
+
idx: Number.isFinite(idxRaw) && idxRaw >= 0 ? idxRaw : 0,
|
|
166
|
+
url: url === "" ? null : url
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function encodeDeploysPage(idx, url) {
|
|
170
|
+
return `${idx}|${url ?? ""}`;
|
|
171
|
+
}
|
|
172
|
+
var siteSchema = z.object({
|
|
173
|
+
id: z.string().min(1),
|
|
174
|
+
site_id: z.string().min(1).optional(),
|
|
175
|
+
name: z.string().min(1),
|
|
176
|
+
url: z.string(),
|
|
177
|
+
admin_url: z.string().nullable().optional(),
|
|
178
|
+
account_id: z.string().nullable().optional(),
|
|
179
|
+
account_name: z.string().nullable().optional(),
|
|
180
|
+
build_settings: z.object({
|
|
181
|
+
repo_url: z.string().nullable().optional(),
|
|
182
|
+
repo_branch: z.string().nullable().optional(),
|
|
183
|
+
cmd: z.string().nullable().optional()
|
|
184
|
+
}).nullable().optional(),
|
|
185
|
+
created_at: z.iso.datetime(),
|
|
186
|
+
updated_at: z.iso.datetime(),
|
|
187
|
+
published_deploy: z.object({ id: z.string().min(1), state: z.string().min(1) }).nullable().optional()
|
|
188
|
+
});
|
|
189
|
+
var sitesResponseSchema = z.array(siteSchema);
|
|
190
|
+
var deploySchema = z.object({
|
|
191
|
+
id: z.string().min(1),
|
|
192
|
+
site_id: z.string().min(1),
|
|
193
|
+
name: z.string().nullable().optional(),
|
|
194
|
+
url: z.string().nullable().optional(),
|
|
195
|
+
deploy_url: z.string().nullable().optional(),
|
|
196
|
+
state: z.string().min(1),
|
|
197
|
+
branch: z.string().nullable().optional(),
|
|
198
|
+
context: z.string().nullable().optional(),
|
|
199
|
+
commit_ref: z.string().nullable().optional(),
|
|
200
|
+
commit_url: z.string().nullable().optional(),
|
|
201
|
+
title: z.string().nullable().optional(),
|
|
202
|
+
committer: z.string().nullable().optional(),
|
|
203
|
+
created_at: z.iso.datetime(),
|
|
204
|
+
updated_at: z.iso.datetime().nullable().optional(),
|
|
205
|
+
published_at: z.iso.datetime().nullable().optional(),
|
|
206
|
+
deploy_time: z.number().nullable().optional(),
|
|
207
|
+
error_message: z.string().nullable().optional()
|
|
208
|
+
});
|
|
209
|
+
var deploysResponseSchema = z.array(deploySchema);
|
|
210
|
+
var netlifyResources = defineResources({
|
|
211
|
+
netlify_site: {
|
|
212
|
+
shape: "entity",
|
|
213
|
+
description: "Netlify sites with name, primary URL, owning account, linked git repo, and create/update timestamps.",
|
|
214
|
+
endpoint: "GET /api/v1/sites",
|
|
215
|
+
responses: { sites: sitesResponseSchema }
|
|
216
|
+
},
|
|
217
|
+
netlify_deploy: {
|
|
218
|
+
shape: "entity",
|
|
219
|
+
description: "Deploys with build state, branch, commit ref, deploy context (production/branch-deploy/deploy-preview), and build duration.",
|
|
220
|
+
endpoint: "GET /api/v1/sites/{site_id}/deploys",
|
|
221
|
+
notes: "deployTimeMs comes from the API `deploy_time` field (seconds) when present, otherwise null. gitRef prefers `commit_ref`, falling back to `branch`.",
|
|
222
|
+
responses: { deploys: deploysResponseSchema }
|
|
223
|
+
},
|
|
224
|
+
netlify_deploy_event: {
|
|
225
|
+
shape: "event",
|
|
226
|
+
description: "Each deploy emitted as a time-bounded event spanning creation to publish, carrying the same attributes as the deploy entity.",
|
|
227
|
+
endpoint: "GET /api/v1/sites/{site_id}/deploys"
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
var NETLIFY_API_HOST = "api.netlify.com";
|
|
231
|
+
var NETLIFY_API_BASE = `https://${NETLIFY_API_HOST}/api/v1`;
|
|
232
|
+
var PAGE_SIZE = 100;
|
|
233
|
+
var MS_PER_DAY = 24 * 60 * 60 * 1e3;
|
|
234
|
+
var id = "netlify";
|
|
235
|
+
var NetlifyConnector = class _NetlifyConnector extends BaseConnector {
|
|
236
|
+
static id = id;
|
|
237
|
+
static resources = netlifyResources;
|
|
238
|
+
static schemas = schemasFromResources(netlifyResources);
|
|
239
|
+
static create(input, ctx) {
|
|
240
|
+
const parsed = configFields.parse(input);
|
|
241
|
+
return new _NetlifyConnector(
|
|
242
|
+
{
|
|
243
|
+
siteIds: parsed.siteIds,
|
|
244
|
+
resources: parsed.resources,
|
|
245
|
+
deploysLookbackDays: parsed.deploysLookbackDays
|
|
246
|
+
},
|
|
247
|
+
{ apiToken: parsed.apiToken },
|
|
248
|
+
ctx
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
id = id;
|
|
252
|
+
credentials = netlifyCredentials;
|
|
253
|
+
discoveredSiteIds = null;
|
|
254
|
+
buildHeaders() {
|
|
255
|
+
return {
|
|
256
|
+
Authorization: `Bearer ${this.creds.apiToken}`,
|
|
257
|
+
Accept: "application/json",
|
|
258
|
+
"User-Agent": connectorUserAgent("netlify")
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
fetch(url, resource, signal) {
|
|
262
|
+
return this.get(url, {
|
|
263
|
+
resource,
|
|
264
|
+
headers: this.buildHeaders(),
|
|
265
|
+
signal,
|
|
266
|
+
rateLimit: netlifyRateLimit
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
// -------------------------------------------------------------------------
|
|
270
|
+
// Resource enablement
|
|
271
|
+
// -------------------------------------------------------------------------
|
|
272
|
+
activePhases() {
|
|
273
|
+
return selectActivePhases(
|
|
274
|
+
(r) => r === "sites" ? "sites" : "deploys",
|
|
275
|
+
PHASE_ORDER,
|
|
276
|
+
this.settings.resources
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
// -------------------------------------------------------------------------
|
|
280
|
+
// URL sanitization
|
|
281
|
+
// -------------------------------------------------------------------------
|
|
282
|
+
sanitizeUrl(url, expectedPath) {
|
|
283
|
+
if (!url) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
const u = new URL(url);
|
|
288
|
+
if (u.protocol !== "https:" || u.host !== NETLIFY_API_HOST) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
if (u.pathname !== expectedPath) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
return u.toString();
|
|
295
|
+
} catch {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
resolveCursor(cursor) {
|
|
300
|
+
if (!isNetlifySyncCursor(cursor)) {
|
|
301
|
+
return void 0;
|
|
302
|
+
}
|
|
303
|
+
return { phase: cursor.phase, page: cursor.page };
|
|
304
|
+
}
|
|
305
|
+
// -------------------------------------------------------------------------
|
|
306
|
+
// Sites: discovery + paginated fetch
|
|
307
|
+
// -------------------------------------------------------------------------
|
|
308
|
+
buildInitialSitesUrl() {
|
|
309
|
+
const u = new URL(`${NETLIFY_API_BASE}/sites`);
|
|
310
|
+
u.searchParams.set("per_page", String(PAGE_SIZE));
|
|
311
|
+
return u.toString();
|
|
312
|
+
}
|
|
313
|
+
async fetchSitesPage(page, signal) {
|
|
314
|
+
const url = this.sanitizeUrl(page, "/api/v1/sites") ?? this.buildInitialSitesUrl();
|
|
315
|
+
const res = await this.fetch(url, "sites", signal);
|
|
316
|
+
const rawNext = parseLinkHeader(res.headers.get("link"))["next"] ?? null;
|
|
317
|
+
const next = this.sanitizeUrl(rawNext, "/api/v1/sites");
|
|
318
|
+
return { items: res.body, next };
|
|
319
|
+
}
|
|
320
|
+
// -------------------------------------------------------------------------
|
|
321
|
+
// Site ID resolution for the deploys phase. If the user supplied siteIds,
|
|
322
|
+
// use those directly; otherwise discover sites from the sites endpoint.
|
|
323
|
+
// -------------------------------------------------------------------------
|
|
324
|
+
async resolveSiteIds(signal) {
|
|
325
|
+
if (this.settings.siteIds && this.settings.siteIds.length > 0) {
|
|
326
|
+
return [...new Set(this.settings.siteIds)];
|
|
327
|
+
}
|
|
328
|
+
if (this.discoveredSiteIds !== null) {
|
|
329
|
+
return this.discoveredSiteIds;
|
|
330
|
+
}
|
|
331
|
+
const out = /* @__PURE__ */ new Set();
|
|
332
|
+
let url = this.buildInitialSitesUrl();
|
|
333
|
+
while (url !== null) {
|
|
334
|
+
const res = await this.fetch(
|
|
335
|
+
url,
|
|
336
|
+
"sites_discovery",
|
|
337
|
+
signal
|
|
338
|
+
);
|
|
339
|
+
for (const site of res.body) {
|
|
340
|
+
out.add(site.id);
|
|
341
|
+
}
|
|
342
|
+
const rawNext = parseLinkHeader(res.headers.get("link"))["next"] ?? null;
|
|
343
|
+
url = this.sanitizeUrl(rawNext, "/api/v1/sites");
|
|
344
|
+
}
|
|
345
|
+
this.discoveredSiteIds = [...out];
|
|
346
|
+
return this.discoveredSiteIds;
|
|
347
|
+
}
|
|
348
|
+
// -------------------------------------------------------------------------
|
|
349
|
+
// Deploys: paginated per-site fetch
|
|
350
|
+
// -------------------------------------------------------------------------
|
|
351
|
+
buildInitialDeploysUrl(siteId) {
|
|
352
|
+
const u = new URL(`${NETLIFY_API_BASE}/sites/${siteId}/deploys`);
|
|
353
|
+
u.searchParams.set("per_page", String(PAGE_SIZE));
|
|
354
|
+
return u.toString();
|
|
355
|
+
}
|
|
356
|
+
deployUpdatedMs(deploy) {
|
|
357
|
+
const ms = parseEpoch(
|
|
358
|
+
deploy.published_at ?? deploy.updated_at ?? deploy.created_at,
|
|
359
|
+
"iso"
|
|
360
|
+
);
|
|
361
|
+
if (ms !== null) {
|
|
362
|
+
return ms;
|
|
363
|
+
}
|
|
364
|
+
return parseEpoch(deploy.created_at, "iso") ?? 0;
|
|
365
|
+
}
|
|
366
|
+
computeDeploysCutoffMs(options) {
|
|
367
|
+
if (options.since) {
|
|
368
|
+
const ms = parseEpoch(options.since, "iso");
|
|
369
|
+
if (ms !== null) {
|
|
370
|
+
return ms;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (options.mode === "full" && this.settings.deploysLookbackDays !== void 0) {
|
|
374
|
+
return Date.now() - this.settings.deploysLookbackDays * MS_PER_DAY;
|
|
375
|
+
}
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
async fetchDeploysPage(options, page, signal) {
|
|
379
|
+
const siteIds = await this.resolveSiteIds(signal);
|
|
380
|
+
if (siteIds.length === 0) {
|
|
381
|
+
return { items: [], next: null };
|
|
382
|
+
}
|
|
383
|
+
const { idx, url: rawPageUrl } = decodeDeploysPage(page);
|
|
384
|
+
if (idx >= siteIds.length) {
|
|
385
|
+
return { items: [], next: null };
|
|
386
|
+
}
|
|
387
|
+
const siteId = siteIds[idx];
|
|
388
|
+
const expectedPath = `/api/v1/sites/${siteId}/deploys`;
|
|
389
|
+
const fetchUrl = this.sanitizeUrl(rawPageUrl, expectedPath) ?? this.buildInitialDeploysUrl(siteId);
|
|
390
|
+
const res = await this.fetch(fetchUrl, "deploys", signal);
|
|
391
|
+
const rawNext = parseLinkHeader(res.headers.get("link"))["next"] ?? null;
|
|
392
|
+
const safeNext = this.sanitizeUrl(rawNext, expectedPath);
|
|
393
|
+
const rows = res.body;
|
|
394
|
+
const cutoff = this.computeDeploysCutoffMs(options);
|
|
395
|
+
let filtered;
|
|
396
|
+
let cutoffReached;
|
|
397
|
+
if (cutoff !== null) {
|
|
398
|
+
filtered = rows.filter((row) => this.deployUpdatedMs(row) >= cutoff);
|
|
399
|
+
const last = rows.at(-1);
|
|
400
|
+
cutoffReached = last !== void 0 && this.deployUpdatedMs(last) < cutoff;
|
|
401
|
+
} else {
|
|
402
|
+
filtered = rows;
|
|
403
|
+
cutoffReached = false;
|
|
404
|
+
}
|
|
405
|
+
const nextWithinSite = cutoffReached ? null : safeNext;
|
|
406
|
+
const batch = { siteId, items: filtered };
|
|
407
|
+
if (nextWithinSite !== null) {
|
|
408
|
+
return { items: [batch], next: encodeDeploysPage(idx, nextWithinSite) };
|
|
409
|
+
}
|
|
410
|
+
const nextIdx = idx + 1;
|
|
411
|
+
const next = nextIdx < siteIds.length ? encodeDeploysPage(nextIdx, null) : null;
|
|
412
|
+
return { items: [batch], next };
|
|
413
|
+
}
|
|
414
|
+
// -------------------------------------------------------------------------
|
|
415
|
+
// Writers
|
|
416
|
+
// -------------------------------------------------------------------------
|
|
417
|
+
async writeSites(storage, items) {
|
|
418
|
+
const sites = items;
|
|
419
|
+
const allowedSiteIds = this.settings.siteIds && this.settings.siteIds.length > 0 ? new Set(this.settings.siteIds) : null;
|
|
420
|
+
for (const s of sites) {
|
|
421
|
+
if (allowedSiteIds && !allowedSiteIds.has(s.id)) {
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
const createdMs = parseEpoch(s.created_at, "iso");
|
|
425
|
+
const updatedMs = parseEpoch(s.updated_at, "iso");
|
|
426
|
+
if (createdMs === null || updatedMs === null) {
|
|
427
|
+
this.logger?.warn?.("skipping site with unparseable timestamps", {
|
|
428
|
+
resource: "sites",
|
|
429
|
+
id: s.id
|
|
430
|
+
});
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
await storage.entity({
|
|
434
|
+
type: "netlify_site",
|
|
435
|
+
id: s.id,
|
|
436
|
+
attributes: {
|
|
437
|
+
name: s.name,
|
|
438
|
+
url: s.url,
|
|
439
|
+
adminUrl: s.admin_url ?? null,
|
|
440
|
+
accountId: s.account_id ?? null,
|
|
441
|
+
accountName: s.account_name ?? null,
|
|
442
|
+
repoUrl: s.build_settings?.repo_url ?? null,
|
|
443
|
+
repoBranch: s.build_settings?.repo_branch ?? null,
|
|
444
|
+
publishedDeployId: s.published_deploy?.id ?? null,
|
|
445
|
+
publishedDeployState: s.published_deploy?.state ?? null,
|
|
446
|
+
createdAt: createdMs,
|
|
447
|
+
updatedAt: updatedMs
|
|
448
|
+
},
|
|
449
|
+
updated_at: updatedMs
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
async writeDeploysBatch(storage, items) {
|
|
454
|
+
const writeEntities = this.isResourceEnabled("deploys");
|
|
455
|
+
const writeEvents = this.isResourceEnabled("deploy_events");
|
|
456
|
+
if (!writeEntities && !writeEvents) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const batches = items;
|
|
460
|
+
for (const batch of batches) {
|
|
461
|
+
for (const d of batch.items) {
|
|
462
|
+
const createdMs = parseEpoch(d.created_at, "iso");
|
|
463
|
+
if (createdMs === null) {
|
|
464
|
+
this.logger?.warn?.(
|
|
465
|
+
"skipping deploy with unparseable created timestamp",
|
|
466
|
+
{
|
|
467
|
+
resource: "deploys",
|
|
468
|
+
id: d.id
|
|
469
|
+
}
|
|
470
|
+
);
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
const updatedMs = parseEpoch(d.updated_at, "iso");
|
|
474
|
+
const publishedMs = parseEpoch(d.published_at, "iso");
|
|
475
|
+
const deployTimeMs = d.deploy_time !== null && d.deploy_time !== void 0 ? Math.round(d.deploy_time * 1e3) : null;
|
|
476
|
+
const gitRef = d.commit_ref ?? d.branch ?? null;
|
|
477
|
+
const baseAttributes = {
|
|
478
|
+
deployId: d.id,
|
|
479
|
+
siteId: batch.siteId,
|
|
480
|
+
name: d.name ?? null,
|
|
481
|
+
url: d.url ?? d.deploy_url ?? null,
|
|
482
|
+
state: d.state,
|
|
483
|
+
branch: d.branch ?? null,
|
|
484
|
+
context: d.context ?? null,
|
|
485
|
+
gitRef,
|
|
486
|
+
commitUrl: d.commit_url ?? null,
|
|
487
|
+
title: d.title ?? null,
|
|
488
|
+
committer: d.committer ?? null,
|
|
489
|
+
errorMessage: d.error_message ?? null,
|
|
490
|
+
createdAt: createdMs,
|
|
491
|
+
updatedAt: updatedMs,
|
|
492
|
+
publishedAt: publishedMs,
|
|
493
|
+
deployTimeMs
|
|
494
|
+
};
|
|
495
|
+
if (writeEntities) {
|
|
496
|
+
await storage.entity({
|
|
497
|
+
type: "netlify_deploy",
|
|
498
|
+
id: d.id,
|
|
499
|
+
attributes: baseAttributes,
|
|
500
|
+
updated_at: publishedMs ?? updatedMs ?? createdMs
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
if (writeEvents) {
|
|
504
|
+
await storage.event({
|
|
505
|
+
name: "netlify_deploy_event",
|
|
506
|
+
start_ts: createdMs,
|
|
507
|
+
end_ts: publishedMs,
|
|
508
|
+
attributes: baseAttributes
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
// -------------------------------------------------------------------------
|
|
515
|
+
// sync
|
|
516
|
+
// -------------------------------------------------------------------------
|
|
517
|
+
async sync(options, storage, signal) {
|
|
518
|
+
this.discoveredSiteIds = null;
|
|
519
|
+
const cursor = this.resolveCursor(options.cursor);
|
|
520
|
+
const isFull = options.mode === "full";
|
|
521
|
+
const phases = this.activePhases();
|
|
522
|
+
return paginateChunked({
|
|
523
|
+
phases,
|
|
524
|
+
cursor,
|
|
525
|
+
signal,
|
|
526
|
+
logger: this.logger,
|
|
527
|
+
fetchPage: async (phase, page, sig) => {
|
|
528
|
+
switch (phase) {
|
|
529
|
+
case "sites":
|
|
530
|
+
return this.fetchSitesPage(page, sig);
|
|
531
|
+
case "deploys":
|
|
532
|
+
return this.fetchDeploysPage(options, page, sig);
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
writeBatch: async (phase, items, page) => {
|
|
536
|
+
if (isFull && page === null) {
|
|
537
|
+
switch (phase) {
|
|
538
|
+
case "sites":
|
|
539
|
+
if (this.isResourceEnabled("sites")) {
|
|
540
|
+
await storage.entities([], { types: ["netlify_site"] });
|
|
541
|
+
}
|
|
542
|
+
break;
|
|
543
|
+
case "deploys":
|
|
544
|
+
if (this.isResourceEnabled("deploys")) {
|
|
545
|
+
await storage.entities([], { types: ["netlify_deploy"] });
|
|
546
|
+
}
|
|
547
|
+
if (this.isResourceEnabled("deploy_events")) {
|
|
548
|
+
await storage.events([], { names: ["netlify_deploy_event"] });
|
|
549
|
+
}
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
switch (phase) {
|
|
554
|
+
case "sites":
|
|
555
|
+
if (!this.isResourceEnabled("sites")) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
return this.writeSites(storage, items);
|
|
559
|
+
case "deploys":
|
|
560
|
+
return this.writeDeploysBatch(storage, items);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
// src/index.ts
|
|
568
|
+
var index_default = NetlifyConnector;
|
|
569
|
+
export {
|
|
570
|
+
NetlifyConnector,
|
|
571
|
+
configFields,
|
|
572
|
+
index_default as default,
|
|
573
|
+
doc,
|
|
574
|
+
id,
|
|
575
|
+
netlifyResources as resources
|
|
576
|
+
};
|
|
577
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../connector-shared/src/errors.ts","../../../connector-shared/src/retry.ts","../../../connector-shared/src/version.ts","../../../connector-shared/src/request.ts","../../../connector-shared/src/rate-limit.ts","../../../connector-shared/src/map-concurrent.ts","../../../connector-shared/src/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/netlify.ts","../src/index.ts"],"sourcesContent":["import type { HttpResponse } from './types';\n\nexport type HttpErrorKind =\n | 'transient'\n | 'rate_limit'\n | 'auth'\n | 'upstream_bug'\n | 'client_bug';\n\nexport abstract class HttpClientError extends Error {\n abstract readonly kind: HttpErrorKind;\n readonly response?: HttpResponse;\n\n constructor(message: string, response?: HttpResponse) {\n super(message);\n this.name = new.target.name;\n this.response = response;\n }\n}\n\nexport class TransientError extends HttpClientError {\n readonly kind = 'transient' as const;\n}\n\nexport class RateLimitError extends HttpClientError {\n readonly kind = 'rate_limit' as const;\n readonly retryAfter?: Date;\n\n constructor(message: string, response?: HttpResponse, retryAfter?: Date) {\n super(message, response);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class AuthError extends HttpClientError {\n readonly kind = 'auth' as const;\n}\n\nexport class UpstreamBugError extends HttpClientError {\n readonly kind = 'upstream_bug' as const;\n}\n\nexport class ClientBugError extends HttpClientError {\n readonly kind = 'client_bug' as const;\n}\n\nexport function classifyStatus(status: number): HttpErrorKind {\n if (status === 429) {\n return 'rate_limit';\n }\n if (status === 401 || status === 403) {\n return 'auth';\n }\n if (status === 408) {\n return 'transient';\n }\n if (status >= 500) {\n return 'upstream_bug';\n }\n if (status >= 400) {\n return 'client_bug';\n }\n return 'client_bug';\n}\n\nexport function errorForStatus(\n message: string,\n response: HttpResponse,\n retryAfter?: Date,\n): HttpClientError {\n const kind = classifyStatus(response.status);\n switch (kind) {\n case 'rate_limit':\n return new RateLimitError(message, response, retryAfter);\n case 'auth':\n return new AuthError(message, response);\n case 'transient':\n return new TransientError(message, response);\n case 'upstream_bug':\n return new UpstreamBugError(message, response);\n case 'client_bug':\n return new ClientBugError(message, response);\n }\n}\n","import { HttpClientError, RateLimitError, TransientError } from './errors';\n\nexport interface RetryPolicy {\n maxAttempts?: number;\n initialDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (status: number | null, err?: Error) => boolean;\n}\n\nexport const defaultRetryOn = (status: number | null, err?: Error): boolean => {\n if (err instanceof RateLimitError) {\n return true;\n }\n if (err instanceof TransientError) {\n return true;\n }\n if (status === null) {\n return err instanceof Error && !(err instanceof HttpClientError);\n }\n if (status === 408 || status === 429) {\n return true;\n }\n if (status >= 500) {\n return true;\n }\n return false;\n};\n\nexport function backoffDelayMs(\n attempt: number,\n policy: Required<Pick<RetryPolicy, 'initialDelayMs' | 'maxDelayMs'>>,\n): number {\n const base = policy.initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, policy.maxDelayMs);\n}\n\nexport function parseRetryAfter(\n headerValue: string | null,\n now: Date = new Date(),\n): Date | undefined {\n if (!headerValue) {\n return undefined;\n }\n const trimmed = headerValue.trim();\n if (/^\\d+$/.test(trimmed)) {\n return new Date(now.getTime() + Number(trimmed) * 1000);\n }\n const parsed = Date.parse(trimmed);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n return new Date(parsed);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) {\n return Promise.reject(signal.reason ?? new Error('Aborted'));\n }\n return new Promise<void>((resolve, reject) => {\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal!.reason ?? new Error('Aborted'));\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","export const HTTP_CLIENT_VERSION = '0.0.0';\n\nexport const DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n\nexport function connectorUserAgent(connectorId: string): string {\n return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n}\n","import {\n AuthError,\n ClientBugError,\n HttpClientError,\n RateLimitError,\n TransientError,\n UpstreamBugError,\n errorForStatus,\n} from './errors';\nimport { defaultRetryOn, parseRetryAfter, sleep } from './retry';\nimport type { FetchLike, HttpMethod, HttpRequest, HttpResponse } from './types';\nimport { DEFAULT_USER_AGENT } from './version';\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_INITIAL_DELAY_MS = 1000;\nconst DEFAULT_MAX_DELAY_MS = 60_000;\nconst OBSERVER_TIMEOUT_MS = 250;\n\nexport interface RequestObservation {\n url: string;\n method: HttpMethod;\n status: number;\n resource: string;\n requestId: string;\n body: unknown;\n}\n\nexport type RequestObserver = (\n event: RequestObservation,\n) => void | Promise<void>;\n\nexport interface RequestOptions {\n fetch?: FetchLike;\n observer?: RequestObserver;\n resource: string;\n requestId?: string;\n}\n\nasync function notifyObserver(\n observer: RequestObserver,\n event: RequestObservation,\n): Promise<void> {\n let result: void | Promise<void>;\n try {\n result = observer(event);\n } catch (err) {\n console.warn('[connector-shared] request observer threw:', err);\n return;\n }\n if (!(result instanceof Promise)) {\n return;\n }\n const guarded = result.catch((err) => {\n console.warn('[connector-shared] request observer rejected:', err);\n });\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, OBSERVER_TIMEOUT_MS);\n });\n try {\n await Promise.race([guarded, timeout]);\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n}\n\nfunction newRequestId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction mergeHeaders(\n defaults: Record<string, string>,\n overrides: Record<string, string> | undefined,\n): Record<string, string> {\n const merged: Record<string, string> = {};\n for (const [k, v] of Object.entries(defaults)) {\n merged[k.toLowerCase()] = v;\n }\n if (overrides) {\n for (const [k, v] of Object.entries(overrides)) {\n merged[k.toLowerCase()] = v;\n }\n }\n return merged;\n}\n\nfunction linkTimeoutSignal(\n parent: AbortSignal | undefined,\n timeoutMs: number,\n): { signal: AbortSignal; cancel: () => void } {\n const controller = new AbortController();\n const onParentAbort = () => {\n controller.abort(parent?.reason);\n };\n if (parent) {\n if (parent.aborted) {\n controller.abort(parent.reason);\n } else {\n parent.addEventListener('abort', onParentAbort, { once: true });\n }\n }\n const timer = setTimeout(() => {\n controller.abort(new Error(`Request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n return {\n signal: controller.signal,\n cancel: () => {\n clearTimeout(timer);\n if (parent) {\n parent.removeEventListener('abort', onParentAbort);\n }\n },\n };\n}\n\nasync function readBody(res: Response, parseJson: boolean): Promise<unknown> {\n if (res.status === 204 || res.status === 205) {\n return null;\n }\n const contentType = res.headers.get('content-type') ?? '';\n if (parseJson && contentType.includes('application/json')) {\n const text = await res.text();\n if (text.length === 0) {\n return null;\n }\n return JSON.parse(text);\n }\n return res.text();\n}\n\nexport async function request<T = unknown>(\n req: HttpRequest,\n options: RequestOptions,\n): Promise<HttpResponse<T>> {\n const fetchImpl: FetchLike = options.fetch ?? (globalThis.fetch as FetchLike);\n const retry = req.retry ?? {};\n const maxAttempts = retry.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n const initialDelayMs = retry.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n const maxDelayMs = retry.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n const retryOn = retry.retryOn ?? defaultRetryOn;\n const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const parseJson = req.parseJson ?? true;\n\n const headers = mergeHeaders(\n {\n 'User-Agent': DEFAULT_USER_AGENT,\n Accept: 'application/json',\n },\n req.headers,\n );\n\n let lastErr: Error | undefined;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n req.signal?.throwIfAborted();\n\n const { signal, cancel } = linkTimeoutSignal(req.signal, timeoutMs);\n let res: Response;\n try {\n res = await fetchImpl(req.url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body as RequestInit['body'],\n signal,\n });\n } catch (err) {\n cancel();\n if (req.signal?.aborted) {\n throw req.signal.reason ?? err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n lastErr = error;\n if (attempt < maxAttempts - 1 && retryOn(null, error)) {\n const delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n await sleep(delay, req.signal);\n continue;\n }\n throw new TransientError(error.message);\n }\n cancel();\n\n const body = await readBody(res, parseJson);\n const httpResponse: HttpResponse<T> = {\n status: res.status,\n headers: res.headers,\n body: body as T,\n };\n if (req.rateLimit) {\n const state = req.rateLimit.parse(res.headers);\n if (state) {\n httpResponse.rateLimitState = state;\n }\n }\n\n if (options.observer) {\n await notifyObserver(options.observer, {\n url: req.url,\n method: req.method ?? 'GET',\n status: res.status,\n resource: options.resource,\n requestId: options.requestId ?? newRequestId(),\n body,\n });\n }\n\n if (res.ok) {\n return httpResponse;\n }\n\n const retryAfter = parseRetryAfter(res.headers.get('retry-after'));\n const message = `HTTP ${res.status} ${res.statusText} for ${req.method ?? 'GET'} ${req.url}`;\n const err = errorForStatus(message, httpResponse, retryAfter);\n\n if (\n attempt < maxAttempts - 1 &&\n retryOn(res.status, err) &&\n !(err instanceof AuthError) &&\n !(err instanceof ClientBugError)\n ) {\n lastErr = err;\n let delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n if (err instanceof RateLimitError && retryAfter) {\n const wait = retryAfter.getTime() - Date.now();\n if (wait > 0) {\n delay = Math.min(wait, maxDelayMs);\n }\n }\n await sleep(delay, req.signal);\n continue;\n }\n\n throw err;\n }\n\n throw lastErr ?? new UpstreamBugError('Exhausted retry attempts');\n}\n\nfunction computeDelay(\n attempt: number,\n initialDelayMs: number,\n maxDelayMs: number,\n): number {\n const base = initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, maxDelayMs);\n}\n\nexport { HttpClientError };\n","export interface RateLimitState {\n remaining: number;\n resetAt: Date;\n}\n\nexport interface RateLimitPolicy {\n parse(headers: Headers): RateLimitState | null;\n}\n\nexport interface StandardRateLimitPolicyConfig {\n remainingHeader: string;\n resetHeader: string;\n resetUnit: 's' | 'ms';\n resetFallbackMs?: number;\n}\n\nexport function standardRateLimitPolicy(\n config: StandardRateLimitPolicyConfig,\n): RateLimitPolicy {\n const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;\n const multiplier = resetUnit === 's' ? 1000 : 1;\n return {\n parse(h) {\n const remainingRaw = h.get(remainingHeader);\n if (remainingRaw === null || remainingRaw.trim() === '') {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n const resetRaw = h.get(resetHeader);\n if (resetRaw === null) {\n if (resetFallbackMs === undefined) {\n return null;\n }\n return {\n remaining,\n resetAt: new Date(Date.now() + resetFallbackMs),\n };\n }\n if (resetRaw.trim() === '') {\n return null;\n }\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n const resetMs = reset * multiplier;\n if (!Number.isFinite(resetMs)) {\n return null;\n }\n return { remaining, resetAt: new Date(resetMs) };\n },\n };\n}\n","export async function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n if (items.length === 0) {\n return results;\n }\n const normalized = Number.isFinite(concurrency) ? Math.floor(concurrency) : 1;\n const limit = Math.max(1, Math.min(normalized, items.length));\n let next = 0;\n let failed = false;\n\n async function worker(): Promise<void> {\n while (!failed) {\n const i = next++;\n if (i >= items.length) {\n return;\n }\n try {\n results[i] = await fn(items[i]!, i);\n } catch (err) {\n failed = true;\n throw err;\n }\n }\n }\n\n const workers: Promise<void>[] = [];\n for (let w = 0; w < limit; w++) {\n workers.push(worker());\n }\n await Promise.all(workers);\n return results;\n}\n","export interface SanitizeAllowedUrlOptions {\n url: string | null;\n host: string;\n pathname: string;\n protocol?: 'https:' | 'http:';\n}\n\nexport function sanitizeAllowedUrl(\n options: SanitizeAllowedUrlOptions,\n): string | null {\n const { url, host, pathname, protocol = 'https:' } = options;\n if (url === null) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n}\n","export type EpochUnit = 'ms' | 's' | 'iso';\n\nexport function parseEpoch(\n value: number | string | null | undefined,\n unit: EpochUnit,\n): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (unit === 'iso') {\n if (typeof value !== 'string') {\n return null;\n }\n const ms = new Date(value).getTime();\n return Number.isFinite(ms) ? ms : null;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return null;\n }\n const n = typeof value === 'number' ? value : Number(value);\n if (!Number.isFinite(n)) {\n return null;\n }\n const result = unit === 's' ? n * 1000 : n;\n return Number.isFinite(result) ? result : null;\n}\n","import { request } from './request';\nimport type { HttpRequest } from './types';\n\nexport function parseLinkHeader(header: string | null): Record<string, string> {\n if (!header) {\n return {};\n }\n const result: Record<string, string> = {};\n for (const part of header.split(',')) {\n const match = part.match(/<([^>]+)>\\s*;\\s*rel=\"([^\"]+)\"/);\n if (match) {\n result[match[2]!] = match[1]!;\n }\n }\n return result;\n}\n\nexport async function* paginateLink<T>(\n initial: HttpRequest,\n parse: (body: unknown) => T[],\n options: { resource: string },\n): AsyncIterable<T> {\n let next: string | null = initial.url;\n while (next) {\n const res: Awaited<ReturnType<typeof request>> = await request(\n {\n ...initial,\n url: next,\n },\n { resource: options.resource },\n );\n for (const item of parse(res.body)) {\n yield item;\n }\n const links = parseLinkHeader(res.headers.get('link'));\n next = links['next'] ?? null;\n }\n}\n\nexport async function* paginateCursor<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; nextCursor: string | null },\n buildNext: (req: HttpRequest, cursor: string) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let req: HttpRequest = initial;\n while (true) {\n const res = await request(req, { resource: options.resource });\n const { items, nextCursor } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!nextCursor) {\n return;\n }\n req = buildNext(req, nextCursor);\n }\n}\n\nexport async function* paginatePage<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; hasMore: boolean },\n buildPage: (req: HttpRequest, page: number) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let page = 1;\n while (true) {\n const req = page === 1 ? initial : buildPage(initial, page);\n const res = await request(req, { resource: options.resource });\n const { items, hasMore } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!hasMore || items.length === 0) {\n return;\n }\n page++;\n }\n}\n","export type LogFields = Record<string, unknown>;\n\nexport interface ConnectorLogger {\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n}\n\nexport interface ConnectorLoggerOptions {\n scope: string;\n}\n\nconst MAX_VALUE_LEN = 120;\n\nfunction truncate(s: string, max = MAX_VALUE_LEN): string {\n if (s.length <= max) {\n return s;\n }\n return `${s.slice(0, max - 1)}…`;\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return '';\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'string') {\n const t = truncate(value);\n if (/[\\s\"=]/.test(t)) {\n return JSON.stringify(t);\n }\n return t;\n }\n if (typeof value === 'bigint') {\n return value.toString();\n }\n let json: string | undefined;\n try {\n json = JSON.stringify(value);\n } catch {\n json = undefined;\n }\n return truncate(json ?? String(value));\n}\n\nexport function formatLogFields(fields?: LogFields): string {\n if (!fields) {\n return '';\n }\n const parts: string[] = [];\n for (const [k, v] of Object.entries(fields)) {\n if (v === undefined) {\n continue;\n }\n parts.push(`${k}=${formatValue(v)}`);\n }\n return parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\nexport function formatLogLine(\n scope: string,\n event: string,\n fields?: LogFields,\n): string {\n return `[${scope}] ${event}${formatLogFields(fields)}`;\n}\n\nexport function createDefaultConnectorLogger(\n opts: ConnectorLoggerOptions,\n): ConnectorLogger {\n return {\n info(event, fields) {\n console.info(formatLogLine(opts.scope, event, fields));\n },\n warn(event, fields) {\n console.warn(formatLogLine(opts.scope, event, fields));\n },\n };\n}\n\nconst NOOP_LOGGER: ConnectorLogger = {\n info() {},\n warn() {},\n};\n\nexport function noopConnectorLogger(): ConnectorLogger {\n return NOOP_LOGGER;\n}\n","import {\n type HttpResponse,\n connectorUserAgent,\n parseEpoch,\n parseLinkHeader,\n standardRateLimitPolicy,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type ConnectorDoc,\n type CredentialsSchema,\n type FetchPageResult,\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 'Netlify personal access token. Create one at Netlify -> User Settings -> Applications -> Personal access tokens.',\n placeholder: 'nfp_...',\n secret: true,\n }),\n siteIds: z.array(z.string().min(1)).nonempty().optional().meta({\n label: 'Site IDs (optional)',\n description:\n 'Restrict the sync to specific Netlify site IDs (the UUID-style id from the site Admin panel). Omit to sync every site the token can see.',\n }),\n resources: z\n .array(z.enum(['sites', 'deploys', 'deploy_events']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n \"Which Netlify resources to sync. Omit to sync all of them. 'deploy_events' rides the 'deploys' phase - enabling it without 'deploys' still fetches deploys but skips writing deploy entities.\",\n }),\n deploysLookbackDays: z.number().int().positive().max(365).optional().meta({\n label: 'Deploys lookback (days)',\n description:\n 'Cap the deploy backfill window to this many days. If unset, the connector fetches every deploy the API returns (newest-first). Netlify has no server-side date filter on the deploys endpoint, so the cutoff is applied client-side and short-circuits pagination once a page is entirely older than the cutoff.',\n placeholder: '30',\n }),\n }),\n);\n\nexport type NetlifyResource = 'sites' | 'deploys' | 'deploy_events';\n\nexport interface NetlifySettings {\n siteIds?: readonly string[];\n resources?: readonly NetlifyResource[];\n deploysLookbackDays?: number;\n}\n\nconst netlifyCredentials = {\n apiToken: {\n description: 'Netlify personal access token',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype NetlifyCredentials = typeof netlifyCredentials;\n\n// ---------------------------------------------------------------------------\n// Connector documentation metadata\n// ---------------------------------------------------------------------------\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Netlify',\n category: 'infrastructure',\n brandColor: '#00C7B7',\n tagline:\n 'Sync Netlify sites and deploys - including build state, branch, commit ref, and deploy duration - across your team.',\n vendor: {\n name: 'Netlify',\n apiDocs: 'https://open-api.netlify.com/',\n website: 'https://www.netlify.com',\n },\n auth: {\n summary:\n 'A Netlify personal access token is required. The token must belong to an account with read access to the sites you want to sync.',\n setup: [\n 'Open Netlify -> User Settings -> Applications -> Personal access tokens.',\n 'Click \"New access token\", give it a name, and copy the token value.',\n 'Store it as a secret and reference it from the connector config as `apiToken: secret(\"NETLIFY_API_TOKEN\")`.',\n 'Optionally set `siteIds` to a list of site IDs to limit the sync scope.',\n ],\n },\n rateLimit:\n 'Netlify returns standard `X-RateLimit-Remaining` / `X-RateLimit-Reset` headers (reset is a Unix timestamp in seconds); list pagination uses the Link header (page size 100).',\n limitations: [\n 'Netlify has no server-side date filter on the deploys endpoint - the connector paginates newest-first and applies `deploysLookbackDays` (if set) as a client-side cutoff that short-circuits pagination once a full page is older than the cutoff.',\n 'Enabling `deploy_events` without `deploys` still runs the deploys query but skips writing deploy entities.',\n 'Netlify Analytics (paid add-on), function invocation logs, and DNS/domain APIs are out of scope.',\n ],\n});\n\n// ---------------------------------------------------------------------------\n// Rate-limit policy\n// ---------------------------------------------------------------------------\n\nconst netlifyRateLimit = 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 = ['sites', 'deploys'] as const;\n\ntype NetlifyPhase = (typeof PHASE_ORDER)[number];\n\ntype NetlifySyncCursor = ChunkedSyncCursor<NetlifyPhase, string>;\n\nconst isNetlifySyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\n// Deploys page cursor encoding: `<siteIdx>|<pageUrl?>`.\n// - null page -> start at siteIdx=0 with no URL yet\n// - \"<idx>|\" -> start of site at idx, build initial URL\n// - \"<idx>|<url>\" -> continuing pagination for site at idx\nfunction decodeDeploysPage(page: string | null): {\n idx: number;\n url: string | null;\n} {\n if (page === null) {\n return { idx: 0, url: null };\n }\n const sep = page.indexOf('|');\n if (sep === -1) {\n return { idx: 0, url: null };\n }\n const idxRaw = Number.parseInt(page.slice(0, sep), 10);\n const url = page.slice(sep + 1);\n return {\n idx: Number.isFinite(idxRaw) && idxRaw >= 0 ? idxRaw : 0,\n url: url === '' ? null : url,\n };\n}\n\nfunction encodeDeploysPage(idx: number, url: string | null): string {\n return `${idx}|${url ?? ''}`;\n}\n\n// ---------------------------------------------------------------------------\n// Netlify API types\n// ---------------------------------------------------------------------------\n\ninterface NetlifySite {\n id: string;\n site_id?: string;\n name: string;\n url: string;\n admin_url?: string | null;\n account_id?: string | null;\n account_name?: string | null;\n build_settings?: {\n repo_url?: string | null;\n repo_branch?: string | null;\n cmd?: string | null;\n } | null;\n created_at: string;\n updated_at: string;\n published_deploy?: { id: string; state: string } | null;\n}\n\ninterface NetlifyDeploy {\n id: string;\n site_id: string;\n name?: string | null;\n url?: string | null;\n deploy_url?: string | null;\n state: string;\n branch?: string | null;\n context?: string | null;\n commit_ref?: string | null;\n commit_url?: string | null;\n title?: string | null;\n committer?: string | null;\n created_at: string;\n updated_at?: string | null;\n published_at?: string | null;\n deploy_time?: number | null;\n error_message?: string | null;\n}\n\n// ---------------------------------------------------------------------------\n// Zod response schemas\n// ---------------------------------------------------------------------------\n\nconst siteSchema = z.object({\n id: z.string().min(1),\n site_id: z.string().min(1).optional(),\n name: z.string().min(1),\n url: z.string(),\n admin_url: z.string().nullable().optional(),\n account_id: z.string().nullable().optional(),\n account_name: z.string().nullable().optional(),\n build_settings: z\n .object({\n repo_url: z.string().nullable().optional(),\n repo_branch: z.string().nullable().optional(),\n cmd: z.string().nullable().optional(),\n })\n .nullable()\n .optional(),\n created_at: z.iso.datetime(),\n updated_at: z.iso.datetime(),\n published_deploy: z\n .object({ id: z.string().min(1), state: z.string().min(1) })\n .nullable()\n .optional(),\n});\n\nconst sitesResponseSchema = z.array(siteSchema);\n\nconst deploySchema = z.object({\n id: z.string().min(1),\n site_id: z.string().min(1),\n name: z.string().nullable().optional(),\n url: z.string().nullable().optional(),\n deploy_url: z.string().nullable().optional(),\n state: z.string().min(1),\n branch: z.string().nullable().optional(),\n context: z.string().nullable().optional(),\n commit_ref: z.string().nullable().optional(),\n commit_url: z.string().nullable().optional(),\n title: z.string().nullable().optional(),\n committer: z.string().nullable().optional(),\n created_at: z.iso.datetime(),\n updated_at: z.iso.datetime().nullable().optional(),\n published_at: z.iso.datetime().nullable().optional(),\n deploy_time: z.number().nullable().optional(),\n error_message: z.string().nullable().optional(),\n});\n\nconst deploysResponseSchema = z.array(deploySchema);\n\nexport const netlifyResources = defineResources({\n netlify_site: {\n shape: 'entity',\n description:\n 'Netlify sites with name, primary URL, owning account, linked git repo, and create/update timestamps.',\n endpoint: 'GET /api/v1/sites',\n responses: { sites: sitesResponseSchema },\n },\n netlify_deploy: {\n shape: 'entity',\n description:\n 'Deploys with build state, branch, commit ref, deploy context (production/branch-deploy/deploy-preview), and build duration.',\n endpoint: 'GET /api/v1/sites/{site_id}/deploys',\n notes:\n 'deployTimeMs comes from the API `deploy_time` field (seconds) when present, otherwise null. gitRef prefers `commit_ref`, falling back to `branch`.',\n responses: { deploys: deploysResponseSchema },\n },\n netlify_deploy_event: {\n shape: 'event',\n description:\n 'Each deploy emitted as a time-bounded event spanning creation to publish, carrying the same attributes as the deploy entity.',\n endpoint: 'GET /api/v1/sites/{site_id}/deploys',\n },\n});\n\n// ---------------------------------------------------------------------------\n// NetlifyConnector\n// ---------------------------------------------------------------------------\n\nconst NETLIFY_API_HOST = 'api.netlify.com';\nconst NETLIFY_API_BASE = `https://${NETLIFY_API_HOST}/api/v1`;\nconst PAGE_SIZE = 100;\nconst MS_PER_DAY = 24 * 60 * 60 * 1000;\n\nexport const id = 'netlify';\n\ninterface SiteDeploysBatch {\n siteId: string;\n items: NetlifyDeploy[];\n}\n\nexport class NetlifyConnector extends BaseConnector<\n NetlifySettings,\n NetlifyCredentials\n> {\n static readonly id = id;\n\n static readonly resources = netlifyResources;\n\n static readonly schemas = schemasFromResources(netlifyResources);\n\n static create(input: unknown, ctx?: ConnectorContext): NetlifyConnector {\n const parsed = configFields.parse(input);\n return new NetlifyConnector(\n {\n siteIds: parsed.siteIds,\n resources: parsed.resources,\n deploysLookbackDays: parsed.deploysLookbackDays,\n },\n { apiToken: parsed.apiToken },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = netlifyCredentials;\n\n private discoveredSiteIds: string[] | null = null;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.creds.apiToken}`,\n Accept: 'application/json',\n 'User-Agent': connectorUserAgent('netlify'),\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: netlifyRateLimit,\n });\n }\n\n // -------------------------------------------------------------------------\n // Resource enablement\n // -------------------------------------------------------------------------\n\n private activePhases(): NetlifyPhase[] {\n return selectActivePhases<NetlifyResource, NetlifyPhase>(\n (r) => (r === 'sites' ? 'sites' : 'deploys'),\n PHASE_ORDER,\n this.settings.resources,\n );\n }\n\n // -------------------------------------------------------------------------\n // URL sanitization\n // -------------------------------------------------------------------------\n\n private sanitizeUrl(url: string | null, expectedPath: string): string | null {\n if (!url) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== 'https:' || u.host !== NETLIFY_API_HOST) {\n return null;\n }\n if (u.pathname !== expectedPath) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n }\n\n private resolveCursor(cursor: unknown): NetlifySyncCursor | undefined {\n if (!isNetlifySyncCursor(cursor)) {\n return undefined;\n }\n return { phase: cursor.phase, page: cursor.page };\n }\n\n // -------------------------------------------------------------------------\n // Sites: discovery + paginated fetch\n // -------------------------------------------------------------------------\n\n private buildInitialSitesUrl(): string {\n const u = new URL(`${NETLIFY_API_BASE}/sites`);\n u.searchParams.set('per_page', String(PAGE_SIZE));\n return u.toString();\n }\n\n private async fetchSitesPage(\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<FetchPageResult<string>> {\n const url =\n this.sanitizeUrl(page, '/api/v1/sites') ?? this.buildInitialSitesUrl();\n const res = await this.fetch<NetlifySite[]>(url, 'sites', signal);\n const rawNext = parseLinkHeader(res.headers.get('link'))['next'] ?? null;\n const next = this.sanitizeUrl(rawNext, '/api/v1/sites');\n return { items: res.body, next };\n }\n\n // -------------------------------------------------------------------------\n // Site ID resolution for the deploys phase. If the user supplied siteIds,\n // use those directly; otherwise discover sites from the sites endpoint.\n // -------------------------------------------------------------------------\n\n private async resolveSiteIds(\n signal: AbortSignal | undefined,\n ): Promise<string[]> {\n if (this.settings.siteIds && this.settings.siteIds.length > 0) {\n return [...new Set(this.settings.siteIds)];\n }\n if (this.discoveredSiteIds !== null) {\n return this.discoveredSiteIds;\n }\n const out = new Set<string>();\n let url: string | null = this.buildInitialSitesUrl();\n while (url !== null) {\n const res = await this.fetch<NetlifySite[]>(\n url,\n 'sites_discovery',\n signal,\n );\n for (const site of res.body) {\n out.add(site.id);\n }\n const rawNext = parseLinkHeader(res.headers.get('link'))['next'] ?? null;\n url = this.sanitizeUrl(rawNext, '/api/v1/sites');\n }\n this.discoveredSiteIds = [...out];\n return this.discoveredSiteIds;\n }\n\n // -------------------------------------------------------------------------\n // Deploys: paginated per-site fetch\n // -------------------------------------------------------------------------\n\n private buildInitialDeploysUrl(siteId: string): string {\n const u = new URL(`${NETLIFY_API_BASE}/sites/${siteId}/deploys`);\n u.searchParams.set('per_page', String(PAGE_SIZE));\n return u.toString();\n }\n\n private deployUpdatedMs(deploy: NetlifyDeploy): number {\n const ms = parseEpoch(\n deploy.published_at ?? deploy.updated_at ?? deploy.created_at,\n 'iso',\n );\n if (ms !== null) {\n return ms;\n }\n return parseEpoch(deploy.created_at, 'iso') ?? 0;\n }\n\n private computeDeploysCutoffMs(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 if (\n options.mode === 'full' &&\n this.settings.deploysLookbackDays !== undefined\n ) {\n return Date.now() - this.settings.deploysLookbackDays * MS_PER_DAY;\n }\n return null;\n }\n\n private async fetchDeploysPage(\n options: SyncOptions,\n page: string | null,\n signal: AbortSignal | undefined,\n ): Promise<FetchPageResult<string>> {\n const siteIds = await this.resolveSiteIds(signal);\n if (siteIds.length === 0) {\n return { items: [], next: null };\n }\n const { idx, url: rawPageUrl } = decodeDeploysPage(page);\n if (idx >= siteIds.length) {\n return { items: [], next: null };\n }\n const siteId = siteIds[idx]!;\n const expectedPath = `/api/v1/sites/${siteId}/deploys`;\n const fetchUrl =\n this.sanitizeUrl(rawPageUrl, expectedPath) ??\n this.buildInitialDeploysUrl(siteId);\n const res = await this.fetch<NetlifyDeploy[]>(fetchUrl, 'deploys', signal);\n const rawNext = parseLinkHeader(res.headers.get('link'))['next'] ?? null;\n const safeNext = this.sanitizeUrl(rawNext, expectedPath);\n const rows = res.body;\n\n const cutoff = this.computeDeploysCutoffMs(options);\n let filtered: NetlifyDeploy[];\n let cutoffReached: boolean;\n if (cutoff !== null) {\n filtered = rows.filter((row) => this.deployUpdatedMs(row) >= cutoff);\n const last = rows.at(-1);\n cutoffReached = last !== undefined && this.deployUpdatedMs(last) < cutoff;\n } else {\n filtered = rows;\n cutoffReached = false;\n }\n\n const nextWithinSite = cutoffReached ? null : safeNext;\n const batch: SiteDeploysBatch = { siteId, items: filtered };\n if (nextWithinSite !== null) {\n return { items: [batch], next: encodeDeploysPage(idx, nextWithinSite) };\n }\n const nextIdx = idx + 1;\n const next =\n nextIdx < siteIds.length ? encodeDeploysPage(nextIdx, null) : null;\n return { items: [batch], next };\n }\n\n // -------------------------------------------------------------------------\n // Writers\n // -------------------------------------------------------------------------\n\n private async writeSites(\n storage: StorageHandle,\n items: unknown[],\n ): Promise<void> {\n const sites = items as NetlifySite[];\n const allowedSiteIds =\n this.settings.siteIds && this.settings.siteIds.length > 0\n ? new Set(this.settings.siteIds)\n : null;\n for (const s of sites) {\n if (allowedSiteIds && !allowedSiteIds.has(s.id)) {\n continue;\n }\n const createdMs = parseEpoch(s.created_at, 'iso');\n const updatedMs = parseEpoch(s.updated_at, 'iso');\n if (createdMs === null || updatedMs === null) {\n this.logger?.warn?.('skipping site with unparseable timestamps', {\n resource: 'sites',\n id: s.id,\n });\n continue;\n }\n await storage.entity({\n type: 'netlify_site',\n id: s.id,\n attributes: {\n name: s.name,\n url: s.url,\n adminUrl: s.admin_url ?? null,\n accountId: s.account_id ?? null,\n accountName: s.account_name ?? null,\n repoUrl: s.build_settings?.repo_url ?? null,\n repoBranch: s.build_settings?.repo_branch ?? null,\n publishedDeployId: s.published_deploy?.id ?? null,\n publishedDeployState: s.published_deploy?.state ?? null,\n createdAt: createdMs,\n updatedAt: updatedMs,\n },\n updated_at: updatedMs,\n });\n }\n }\n\n private async writeDeploysBatch(\n storage: StorageHandle,\n items: unknown[],\n ): Promise<void> {\n const writeEntities = this.isResourceEnabled('deploys');\n const writeEvents = this.isResourceEnabled('deploy_events');\n if (!writeEntities && !writeEvents) {\n return;\n }\n const batches = items as SiteDeploysBatch[];\n for (const batch of batches) {\n for (const d of batch.items) {\n const createdMs = parseEpoch(d.created_at, 'iso');\n if (createdMs === null) {\n this.logger?.warn?.(\n 'skipping deploy with unparseable created timestamp',\n {\n resource: 'deploys',\n id: d.id,\n },\n );\n continue;\n }\n const updatedMs = parseEpoch(d.updated_at, 'iso');\n const publishedMs = parseEpoch(d.published_at, 'iso');\n const deployTimeMs =\n d.deploy_time !== null && d.deploy_time !== undefined\n ? Math.round(d.deploy_time * 1000)\n : null;\n const gitRef = d.commit_ref ?? d.branch ?? null;\n const baseAttributes: Record<string, JSONValue> = {\n deployId: d.id,\n siteId: batch.siteId,\n name: d.name ?? null,\n url: d.url ?? d.deploy_url ?? null,\n state: d.state,\n branch: d.branch ?? null,\n context: d.context ?? null,\n gitRef,\n commitUrl: d.commit_url ?? null,\n title: d.title ?? null,\n committer: d.committer ?? null,\n errorMessage: d.error_message ?? null,\n createdAt: createdMs,\n updatedAt: updatedMs,\n publishedAt: publishedMs,\n deployTimeMs,\n };\n\n if (writeEntities) {\n await storage.entity({\n type: 'netlify_deploy',\n id: d.id,\n attributes: baseAttributes,\n updated_at: publishedMs ?? updatedMs ?? createdMs,\n });\n }\n if (writeEvents) {\n await storage.event({\n name: 'netlify_deploy_event',\n start_ts: createdMs,\n end_ts: publishedMs,\n attributes: baseAttributes,\n });\n }\n }\n }\n }\n\n // -------------------------------------------------------------------------\n // sync\n // -------------------------------------------------------------------------\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n this.discoveredSiteIds = null;\n const cursor = this.resolveCursor(options.cursor);\n const isFull = options.mode === 'full';\n const phases = this.activePhases();\n\n return paginateChunked<NetlifyPhase, string>({\n phases,\n cursor,\n signal,\n logger: this.logger,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'sites':\n return this.fetchSitesPage(page, sig);\n case 'deploys':\n return this.fetchDeploysPage(options, page, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'sites':\n if (this.isResourceEnabled('sites')) {\n await storage.entities([], { types: ['netlify_site'] });\n }\n break;\n case 'deploys':\n if (this.isResourceEnabled('deploys')) {\n await storage.entities([], { types: ['netlify_deploy'] });\n }\n if (this.isResourceEnabled('deploy_events')) {\n await storage.events([], { names: ['netlify_deploy_event'] });\n }\n break;\n }\n }\n switch (phase) {\n case 'sites':\n if (!this.isResourceEnabled('sites')) {\n return;\n }\n return this.writeSites(storage, items);\n case 'deploys':\n return this.writeDeploysBatch(storage, items);\n }\n },\n });\n }\n}\n","import { NetlifyConnector } from './netlify';\n\nexport {\n configFields,\n doc,\n NetlifyConnector,\n netlifyResources as resources,\n id,\n} from './netlify';\nexport type { NetlifyResource, NetlifySettings } from './netlify';\nexport default NetlifyConnector;\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,OAA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ACjrBA,IAAO,gBAAQ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rawdash/connector-netlify",
|
|
3
|
+
"version": "0.19.0",
|
|
4
|
+
"description": "Rawdash connector for Netlify - sites, deploys, deploy events",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/rawdash/rawdash.git",
|
|
11
|
+
"directory": "packages/connectors/netlify"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"@rawdash/source": "./src/index.ts",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"lint": "eslint src",
|
|
29
|
+
"test": "vitest run"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@rawdash/core": "workspace:*",
|
|
33
|
+
"zod": "^4.4.3"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@rawdash/connector-shared": "workspace:*",
|
|
37
|
+
"@rawdash/connector-test-utils": "workspace:*",
|
|
38
|
+
"fast-check": "^4.8.0",
|
|
39
|
+
"tsup": "^8.0.0",
|
|
40
|
+
"typescript": "^5.7.2",
|
|
41
|
+
"vitest": "^4.1.4"
|
|
42
|
+
}
|
|
43
|
+
}
|