@rawdash/connector-monday 0.1.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 +100 -0
- package/dist/index.d.ts +230 -0
- package/dist/index.js +621 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<!-- This file is generated from connector metadata by scripts/generate-connector-docs.ts. Do not edit by hand. -->
|
|
2
|
+
|
|
3
|
+
# @rawdash/connector-monday
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@rawdash/connector-monday)
|
|
6
|
+
[](https://github.com/rawdash/rawdash/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
Sync boards, items, and item activity events from a monday.com account.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @rawdash/connector-monday
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Authentication
|
|
17
|
+
|
|
18
|
+
A monday.com API token is required. It authenticates every GraphQL request and scopes the sync to the boards the token can access.
|
|
19
|
+
|
|
20
|
+
1. Open monday.com and click your avatar -> Developers.
|
|
21
|
+
2. Go to My access tokens and copy your personal API token.
|
|
22
|
+
3. Store it as a secret and reference it from the connector config as `apiToken: secret("MONDAY_API_TOKEN")`.
|
|
23
|
+
|
|
24
|
+
## Configuration
|
|
25
|
+
|
|
26
|
+
| Field | Type | Required | Description |
|
|
27
|
+
| ----------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| `apiToken` | secret | Yes | monday.com API token. Create one at monday.com -> Profile (avatar) -> Developers -> My access tokens. |
|
|
29
|
+
| `boardIds` | array | No | Restrict the sync to specific board IDs. Omit to discover and sync every board the token can see. |
|
|
30
|
+
| `resources` | array | No | Which resources to sync. Omit to sync all resources. The `item_events` phase reads each board activity log. |
|
|
31
|
+
|
|
32
|
+
## Resources
|
|
33
|
+
|
|
34
|
+
- **`monday_board`** _(entity)_ - Boards with their name, state, kind, workspace, and item count.
|
|
35
|
+
- Endpoint: `GraphQL query: boards { ... }`
|
|
36
|
+
- **`monday_item`** _(entity)_ - Board items with their name, state, group, board, column values, and lifecycle timestamps.
|
|
37
|
+
- Endpoint: `GraphQL query: boards { items_page { items { ... } } }`
|
|
38
|
+
- **`monday_item_activity`** _(event)_ - Item activity events derived from each board activity log (creates, updates, status changes), keyed by the originating user.
|
|
39
|
+
- Endpoint: `GraphQL query: boards { activity_logs { ... } }`
|
|
40
|
+
- Derived from each board activity log. Activity logs are filtered server-side by date in incremental mode (the from argument) and these append-only events accumulate across syncs. A full sync clears and rewrites the event stream.
|
|
41
|
+
|
|
42
|
+
## Example
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import {
|
|
46
|
+
defineConfig,
|
|
47
|
+
defineDashboard,
|
|
48
|
+
defineMetric,
|
|
49
|
+
secret,
|
|
50
|
+
} from '@rawdash/core';
|
|
51
|
+
|
|
52
|
+
const monday = {
|
|
53
|
+
name: 'monday',
|
|
54
|
+
connectorId: 'monday',
|
|
55
|
+
config: {
|
|
56
|
+
apiToken: secret('MONDAY_API_TOKEN'),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
connectors: [monday],
|
|
62
|
+
dashboards: {
|
|
63
|
+
delivery: defineDashboard({
|
|
64
|
+
widgets: {
|
|
65
|
+
active_items: {
|
|
66
|
+
kind: 'stat',
|
|
67
|
+
title: 'Active items',
|
|
68
|
+
metric: defineMetric({
|
|
69
|
+
connector: monday,
|
|
70
|
+
shape: 'entity',
|
|
71
|
+
entityType: 'monday_item',
|
|
72
|
+
fn: 'count',
|
|
73
|
+
filter: [{ field: 'state', op: 'eq', value: 'active' }],
|
|
74
|
+
}),
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Rate limits
|
|
83
|
+
|
|
84
|
+
monday.com meters requests by a per-minute complexity budget rather than a fixed request count; the connector walks one board at a time and pages items at most 100 at a time to keep each query within budget.
|
|
85
|
+
|
|
86
|
+
## Limitations
|
|
87
|
+
|
|
88
|
+
- API token auth only (OAuth not yet supported).
|
|
89
|
+
- items_page has no server-side updated-at filter, so incremental item syncs page each board and drop unchanged rows client-side; item activity events are filtered server-side by date.
|
|
90
|
+
- Webhooks, updates/replies, and sub-items are out of scope.
|
|
91
|
+
|
|
92
|
+
## Links
|
|
93
|
+
|
|
94
|
+
- [Rawdash docs](https://rawdash.dev/docs/connectors)
|
|
95
|
+
- [monday.com API docs](https://developer.monday.com/api-reference/)
|
|
96
|
+
- [GitHub](https://github.com/rawdash/rawdash)
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
Apache-2.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
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
|
+
boardIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
10
|
+
items: "items";
|
|
11
|
+
boards: "boards";
|
|
12
|
+
item_events: "item_events";
|
|
13
|
+
}>>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const doc: ConnectorDoc;
|
|
16
|
+
interface MondaySettings {
|
|
17
|
+
boardIds?: readonly string[];
|
|
18
|
+
resources?: readonly MondayResource[];
|
|
19
|
+
}
|
|
20
|
+
declare const mondayCredentials: {
|
|
21
|
+
apiToken: {
|
|
22
|
+
description: string;
|
|
23
|
+
auth: "required";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type MondayCredentials = typeof mondayCredentials;
|
|
27
|
+
declare const PHASE_ORDER: readonly ["boards", "items", "item_events"];
|
|
28
|
+
type MondayPhase = (typeof PHASE_ORDER)[number];
|
|
29
|
+
type MondayResource = MondayPhase;
|
|
30
|
+
declare const mondayResources: {
|
|
31
|
+
readonly monday_board: {
|
|
32
|
+
readonly shape: "entity";
|
|
33
|
+
readonly filterable: [];
|
|
34
|
+
readonly description: "Boards with their name, state, kind, workspace, and item count.";
|
|
35
|
+
readonly endpoint: "GraphQL query: boards { ... }";
|
|
36
|
+
readonly responses: {
|
|
37
|
+
readonly boards: z.ZodArray<z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
state: z.ZodString;
|
|
41
|
+
board_kind: z.ZodNullable<z.ZodString>;
|
|
42
|
+
description: z.ZodNullable<z.ZodString>;
|
|
43
|
+
workspace_id: z.ZodNullable<z.ZodString>;
|
|
44
|
+
items_count: z.ZodNullable<z.ZodNumber>;
|
|
45
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly monday_item: {
|
|
50
|
+
readonly shape: "entity";
|
|
51
|
+
readonly filterable: [];
|
|
52
|
+
readonly description: "Board items with their name, state, group, board, column values, and lifecycle timestamps.";
|
|
53
|
+
readonly endpoint: "GraphQL query: boards { items_page { items { ... } } }";
|
|
54
|
+
readonly responses: {
|
|
55
|
+
readonly items: z.ZodArray<z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
state: z.ZodNullable<z.ZodString>;
|
|
59
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
60
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
61
|
+
group: z.ZodNullable<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
title: z.ZodString;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
board: z.ZodNullable<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
column_values: z.ZodArray<z.ZodObject<{
|
|
69
|
+
id: z.ZodString;
|
|
70
|
+
text: z.ZodNullable<z.ZodString>;
|
|
71
|
+
value: z.ZodNullable<z.ZodString>;
|
|
72
|
+
type: z.ZodNullable<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly monday_item_activity: {
|
|
78
|
+
readonly shape: "event";
|
|
79
|
+
readonly filterable: [];
|
|
80
|
+
readonly description: "Item activity events derived from each board activity log (creates, updates, status changes), keyed by the originating user.";
|
|
81
|
+
readonly endpoint: "GraphQL query: boards { activity_logs { ... } }";
|
|
82
|
+
readonly notes: "Derived from each board activity log. Activity logs are filtered server-side by date in incremental mode (the from argument) and these append-only events accumulate across syncs. A full sync clears and rewrites the event stream.";
|
|
83
|
+
readonly responses: {
|
|
84
|
+
readonly activity_logs: z.ZodArray<z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
event: z.ZodString;
|
|
87
|
+
entity: z.ZodNullable<z.ZodString>;
|
|
88
|
+
data: z.ZodNullable<z.ZodString>;
|
|
89
|
+
user_id: z.ZodNullable<z.ZodString>;
|
|
90
|
+
account_id: z.ZodNullable<z.ZodString>;
|
|
91
|
+
created_at: z.ZodString;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
declare const id = "monday";
|
|
97
|
+
declare class MondayConnector extends BaseConnector<MondaySettings, MondayCredentials> {
|
|
98
|
+
static readonly id = "monday";
|
|
99
|
+
static readonly resources: {
|
|
100
|
+
readonly monday_board: {
|
|
101
|
+
readonly shape: "entity";
|
|
102
|
+
readonly filterable: [];
|
|
103
|
+
readonly description: "Boards with their name, state, kind, workspace, and item count.";
|
|
104
|
+
readonly endpoint: "GraphQL query: boards { ... }";
|
|
105
|
+
readonly responses: {
|
|
106
|
+
readonly boards: z.ZodArray<z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
state: z.ZodString;
|
|
110
|
+
board_kind: z.ZodNullable<z.ZodString>;
|
|
111
|
+
description: z.ZodNullable<z.ZodString>;
|
|
112
|
+
workspace_id: z.ZodNullable<z.ZodString>;
|
|
113
|
+
items_count: z.ZodNullable<z.ZodNumber>;
|
|
114
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly monday_item: {
|
|
119
|
+
readonly shape: "entity";
|
|
120
|
+
readonly filterable: [];
|
|
121
|
+
readonly description: "Board items with their name, state, group, board, column values, and lifecycle timestamps.";
|
|
122
|
+
readonly endpoint: "GraphQL query: boards { items_page { items { ... } } }";
|
|
123
|
+
readonly responses: {
|
|
124
|
+
readonly items: z.ZodArray<z.ZodObject<{
|
|
125
|
+
id: z.ZodString;
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
state: z.ZodNullable<z.ZodString>;
|
|
128
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
129
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
130
|
+
group: z.ZodNullable<z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
title: z.ZodString;
|
|
133
|
+
}, z.core.$strip>>;
|
|
134
|
+
board: z.ZodNullable<z.ZodObject<{
|
|
135
|
+
id: z.ZodString;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
column_values: z.ZodArray<z.ZodObject<{
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
text: z.ZodNullable<z.ZodString>;
|
|
140
|
+
value: z.ZodNullable<z.ZodString>;
|
|
141
|
+
type: z.ZodNullable<z.ZodString>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
readonly monday_item_activity: {
|
|
147
|
+
readonly shape: "event";
|
|
148
|
+
readonly filterable: [];
|
|
149
|
+
readonly description: "Item activity events derived from each board activity log (creates, updates, status changes), keyed by the originating user.";
|
|
150
|
+
readonly endpoint: "GraphQL query: boards { activity_logs { ... } }";
|
|
151
|
+
readonly notes: "Derived from each board activity log. Activity logs are filtered server-side by date in incremental mode (the from argument) and these append-only events accumulate across syncs. A full sync clears and rewrites the event stream.";
|
|
152
|
+
readonly responses: {
|
|
153
|
+
readonly activity_logs: z.ZodArray<z.ZodObject<{
|
|
154
|
+
id: z.ZodString;
|
|
155
|
+
event: z.ZodString;
|
|
156
|
+
entity: z.ZodNullable<z.ZodString>;
|
|
157
|
+
data: z.ZodNullable<z.ZodString>;
|
|
158
|
+
user_id: z.ZodNullable<z.ZodString>;
|
|
159
|
+
account_id: z.ZodNullable<z.ZodString>;
|
|
160
|
+
created_at: z.ZodString;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
static readonly schemas: {
|
|
166
|
+
readonly boards: z.ZodArray<z.ZodObject<{
|
|
167
|
+
id: z.ZodString;
|
|
168
|
+
name: z.ZodString;
|
|
169
|
+
state: z.ZodString;
|
|
170
|
+
board_kind: z.ZodNullable<z.ZodString>;
|
|
171
|
+
description: z.ZodNullable<z.ZodString>;
|
|
172
|
+
workspace_id: z.ZodNullable<z.ZodString>;
|
|
173
|
+
items_count: z.ZodNullable<z.ZodNumber>;
|
|
174
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
} & {
|
|
177
|
+
readonly items: z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
state: z.ZodNullable<z.ZodString>;
|
|
181
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
182
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
183
|
+
group: z.ZodNullable<z.ZodObject<{
|
|
184
|
+
id: z.ZodString;
|
|
185
|
+
title: z.ZodString;
|
|
186
|
+
}, z.core.$strip>>;
|
|
187
|
+
board: z.ZodNullable<z.ZodObject<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
}, z.core.$strip>>;
|
|
190
|
+
column_values: z.ZodArray<z.ZodObject<{
|
|
191
|
+
id: z.ZodString;
|
|
192
|
+
text: z.ZodNullable<z.ZodString>;
|
|
193
|
+
value: z.ZodNullable<z.ZodString>;
|
|
194
|
+
type: z.ZodNullable<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>>;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
} & {
|
|
198
|
+
readonly activity_logs: z.ZodArray<z.ZodObject<{
|
|
199
|
+
id: z.ZodString;
|
|
200
|
+
event: z.ZodString;
|
|
201
|
+
entity: z.ZodNullable<z.ZodString>;
|
|
202
|
+
data: z.ZodNullable<z.ZodString>;
|
|
203
|
+
user_id: z.ZodNullable<z.ZodString>;
|
|
204
|
+
account_id: z.ZodNullable<z.ZodString>;
|
|
205
|
+
created_at: z.ZodString;
|
|
206
|
+
}, z.core.$strip>>;
|
|
207
|
+
} & Readonly<Record<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
208
|
+
static create(input: unknown, ctx?: ConnectorContext): MondayConnector;
|
|
209
|
+
readonly id = "monday";
|
|
210
|
+
readonly credentials: {
|
|
211
|
+
apiToken: {
|
|
212
|
+
description: string;
|
|
213
|
+
auth: "required";
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
private buildHeaders;
|
|
217
|
+
private graphql;
|
|
218
|
+
private fromFilter;
|
|
219
|
+
private advanceBoard;
|
|
220
|
+
private advanceBoardLogs;
|
|
221
|
+
private fetchBoardsPage;
|
|
222
|
+
private fetchItemsPage;
|
|
223
|
+
private fetchItemEventsPage;
|
|
224
|
+
private writeBoards;
|
|
225
|
+
private writeItems;
|
|
226
|
+
private writeItemEvents;
|
|
227
|
+
sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export { MondayConnector, type MondayResource, type MondaySettings, configFields, MondayConnector as default, doc, id, mondayResources as resources };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,621 @@
|
|
|
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 parseEpoch(value, unit) {
|
|
8
|
+
if (value === null || value === void 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (unit === "iso") {
|
|
12
|
+
if (typeof value !== "string") {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const ms = new Date(value).getTime();
|
|
16
|
+
return Number.isFinite(ms) ? ms : null;
|
|
17
|
+
}
|
|
18
|
+
if (typeof value === "string" && value.trim() === "") {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
22
|
+
if (!Number.isFinite(n)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const result = unit === "s" ? n * 1e3 : n;
|
|
26
|
+
return Number.isFinite(result) ? result : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/monday.ts
|
|
30
|
+
import {
|
|
31
|
+
BaseConnector,
|
|
32
|
+
defineConfigFields,
|
|
33
|
+
defineConnectorDoc,
|
|
34
|
+
defineResources,
|
|
35
|
+
makeChunkedCursorGuard,
|
|
36
|
+
paginateChunked,
|
|
37
|
+
schemasFromResources,
|
|
38
|
+
selectActivePhases
|
|
39
|
+
} from "@rawdash/core";
|
|
40
|
+
import { z } from "zod";
|
|
41
|
+
var configFields = defineConfigFields(
|
|
42
|
+
z.object({
|
|
43
|
+
apiToken: z.object({ $secret: z.string() }).meta({
|
|
44
|
+
label: "API Token",
|
|
45
|
+
description: "monday.com API token. Create one at monday.com -> Profile (avatar) -> Developers -> My access tokens.",
|
|
46
|
+
placeholder: "eyJhbGciOi...",
|
|
47
|
+
secret: true
|
|
48
|
+
}),
|
|
49
|
+
boardIds: z.array(z.string().min(1)).nonempty().optional().meta({
|
|
50
|
+
label: "Board IDs (optional)",
|
|
51
|
+
description: "Restrict the sync to specific board IDs. Omit to discover and sync every board the token can see."
|
|
52
|
+
}),
|
|
53
|
+
resources: z.array(z.enum(["boards", "items", "item_events"])).nonempty().optional().meta({
|
|
54
|
+
label: "Resources",
|
|
55
|
+
description: "Which resources to sync. Omit to sync all resources. The `item_events` phase reads each board activity log."
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
var doc = defineConnectorDoc({
|
|
60
|
+
displayName: "monday.com",
|
|
61
|
+
category: "product",
|
|
62
|
+
brandColor: "#FF3D57",
|
|
63
|
+
tagline: "Sync boards, items, and item activity events from a monday.com account.",
|
|
64
|
+
vendor: {
|
|
65
|
+
name: "monday.com",
|
|
66
|
+
domain: "monday.com",
|
|
67
|
+
apiDocs: "https://developer.monday.com/api-reference/",
|
|
68
|
+
website: "https://monday.com"
|
|
69
|
+
},
|
|
70
|
+
auth: {
|
|
71
|
+
summary: "A monday.com API token is required. It authenticates every GraphQL request and scopes the sync to the boards the token can access.",
|
|
72
|
+
setup: [
|
|
73
|
+
"Open monday.com and click your avatar -> Developers.",
|
|
74
|
+
"Go to My access tokens and copy your personal API token.",
|
|
75
|
+
'Store it as a secret and reference it from the connector config as `apiToken: secret("MONDAY_API_TOKEN")`.'
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
rateLimit: "monday.com meters requests by a per-minute complexity budget rather than a fixed request count; the connector walks one board at a time and pages items at most 100 at a time to keep each query within budget.",
|
|
79
|
+
limitations: [
|
|
80
|
+
"API token auth only (OAuth not yet supported).",
|
|
81
|
+
"items_page has no server-side updated-at filter, so incremental item syncs page each board and drop unchanged rows client-side; item activity events are filtered server-side by date.",
|
|
82
|
+
"Webhooks, updates/replies, and sub-items are out of scope."
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
var mondayCredentials = {
|
|
86
|
+
apiToken: {
|
|
87
|
+
description: "monday.com API token",
|
|
88
|
+
auth: "required"
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var PHASE_ORDER = ["boards", "items", "item_events"];
|
|
92
|
+
var isMondaySyncCursor = makeChunkedCursorGuard(PHASE_ORDER);
|
|
93
|
+
var BOARD_FIELDS = "id name state board_kind description workspace_id items_count updated_at";
|
|
94
|
+
var ITEM_FIELDS = "id name state created_at updated_at group { id title } board { id } column_values { id text value type }";
|
|
95
|
+
var ACTIVITY_FIELDS = "id event entity data user_id account_id created_at";
|
|
96
|
+
var BOARDS_QUERY = `
|
|
97
|
+
query Boards($limit: Int!, $page: Int!) {
|
|
98
|
+
boards(limit: $limit, page: $page) { ${BOARD_FIELDS} }
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
var BOARDS_BY_IDS_QUERY = `
|
|
102
|
+
query BoardsByIds($ids: [ID!], $limit: Int!) {
|
|
103
|
+
boards(ids: $ids, limit: $limit) { ${BOARD_FIELDS} }
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
var DISCOVER_BOARD_ITEMS_QUERY = `
|
|
107
|
+
query BoardItemsByPage($page: Int!, $itemLimit: Int!) {
|
|
108
|
+
boards(limit: 1, page: $page) {
|
|
109
|
+
id
|
|
110
|
+
items_page(limit: $itemLimit) { cursor items { ${ITEM_FIELDS} } }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
var SCOPED_BOARD_ITEMS_QUERY = `
|
|
115
|
+
query BoardItemsById($ids: [ID!], $itemLimit: Int!) {
|
|
116
|
+
boards(ids: $ids) {
|
|
117
|
+
id
|
|
118
|
+
items_page(limit: $itemLimit) { cursor items { ${ITEM_FIELDS} } }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
var NEXT_ITEMS_QUERY = `
|
|
123
|
+
query NextItems($cursor: String!, $itemLimit: Int!) {
|
|
124
|
+
next_items_page(cursor: $cursor, limit: $itemLimit) {
|
|
125
|
+
cursor
|
|
126
|
+
items { ${ITEM_FIELDS} }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
var DISCOVER_BOARD_LOGS_QUERY = `
|
|
131
|
+
query BoardLogsByPage(
|
|
132
|
+
$page: Int!
|
|
133
|
+
$logLimit: Int!
|
|
134
|
+
$logPage: Int!
|
|
135
|
+
$from: ISO8601DateTime
|
|
136
|
+
) {
|
|
137
|
+
boards(limit: 1, page: $page) {
|
|
138
|
+
id
|
|
139
|
+
activity_logs(limit: $logLimit, page: $logPage, from: $from) { ${ACTIVITY_FIELDS} }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
var SCOPED_BOARD_LOGS_QUERY = `
|
|
144
|
+
query BoardLogsById(
|
|
145
|
+
$ids: [ID!]
|
|
146
|
+
$logLimit: Int!
|
|
147
|
+
$logPage: Int!
|
|
148
|
+
$from: ISO8601DateTime
|
|
149
|
+
) {
|
|
150
|
+
boards(ids: $ids) {
|
|
151
|
+
id
|
|
152
|
+
activity_logs(limit: $logLimit, page: $logPage, from: $from) { ${ACTIVITY_FIELDS} }
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
156
|
+
var DEFAULT_BOARD_PAGE_SIZE = 50;
|
|
157
|
+
var MAX_BOARD_PAGE_SIZE = 500;
|
|
158
|
+
var DEFAULT_ITEM_PAGE_SIZE = 100;
|
|
159
|
+
var MAX_ITEM_PAGE_SIZE = 500;
|
|
160
|
+
var DEFAULT_LOG_PAGE_SIZE = 100;
|
|
161
|
+
var MAX_LOG_PAGE_SIZE = 1e4;
|
|
162
|
+
var CHUNK_BUDGET_MS = 25e3;
|
|
163
|
+
var ENDPOINT = "https://api.monday.com/v2";
|
|
164
|
+
var API_VERSION = "2024-10";
|
|
165
|
+
function clampPageSize(requested, fallback, max) {
|
|
166
|
+
const n = requested ?? fallback;
|
|
167
|
+
if (!Number.isFinite(n) || n < 1) {
|
|
168
|
+
return 1;
|
|
169
|
+
}
|
|
170
|
+
return Math.min(Math.floor(n), max);
|
|
171
|
+
}
|
|
172
|
+
function encodeItemsPage(b, c) {
|
|
173
|
+
return JSON.stringify({ b, c });
|
|
174
|
+
}
|
|
175
|
+
function decodeItemsPage(page) {
|
|
176
|
+
if (!page) {
|
|
177
|
+
return { b: 0, c: null };
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
const v = JSON.parse(page);
|
|
181
|
+
if (typeof v.b === "number" && v.b >= 0) {
|
|
182
|
+
return { b: v.b, c: typeof v.c === "string" ? v.c : null };
|
|
183
|
+
}
|
|
184
|
+
} catch (err) {
|
|
185
|
+
console.warn(`monday: failed to decode items cursor: ${String(err)}`);
|
|
186
|
+
}
|
|
187
|
+
return { b: 0, c: null };
|
|
188
|
+
}
|
|
189
|
+
function encodeLogsPage(b, p) {
|
|
190
|
+
return JSON.stringify({ b, p });
|
|
191
|
+
}
|
|
192
|
+
function decodeLogsPage(page) {
|
|
193
|
+
if (!page) {
|
|
194
|
+
return { b: 0, p: 1 };
|
|
195
|
+
}
|
|
196
|
+
try {
|
|
197
|
+
const v = JSON.parse(page);
|
|
198
|
+
if (typeof v.b === "number" && v.b >= 0 && typeof v.p === "number") {
|
|
199
|
+
return { b: v.b, p: Math.max(1, v.p) };
|
|
200
|
+
}
|
|
201
|
+
} catch (err) {
|
|
202
|
+
console.warn(`monday: failed to decode logs cursor: ${String(err)}`);
|
|
203
|
+
}
|
|
204
|
+
return { b: 0, p: 1 };
|
|
205
|
+
}
|
|
206
|
+
function parseActivityTs(raw) {
|
|
207
|
+
const digits = raw.trim();
|
|
208
|
+
if (/^\d+$/.test(digits)) {
|
|
209
|
+
const ms = Number(digits.slice(0, 13));
|
|
210
|
+
return Number.isFinite(ms) ? ms : null;
|
|
211
|
+
}
|
|
212
|
+
return parseEpoch(raw, "iso");
|
|
213
|
+
}
|
|
214
|
+
function extractItemId(data) {
|
|
215
|
+
if (!data) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
const parsed = JSON.parse(data);
|
|
220
|
+
const candidate = parsed.pulse_id ?? parsed.item_id ?? parsed.pulseId;
|
|
221
|
+
if (typeof candidate === "number" || typeof candidate === "string") {
|
|
222
|
+
return String(candidate);
|
|
223
|
+
}
|
|
224
|
+
} catch (err) {
|
|
225
|
+
console.warn(
|
|
226
|
+
`monday: failed to parse activity data payload: ${String(err)}`
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
var idString = z.string().min(1);
|
|
232
|
+
var boardSchema = z.object({
|
|
233
|
+
id: idString,
|
|
234
|
+
name: z.string(),
|
|
235
|
+
state: z.string(),
|
|
236
|
+
board_kind: z.string().nullable(),
|
|
237
|
+
description: z.string().nullable(),
|
|
238
|
+
workspace_id: z.string().nullable(),
|
|
239
|
+
items_count: z.number().nullable(),
|
|
240
|
+
updated_at: z.string().nullable()
|
|
241
|
+
});
|
|
242
|
+
var columnValueSchema = z.object({
|
|
243
|
+
id: z.string(),
|
|
244
|
+
text: z.string().nullable(),
|
|
245
|
+
value: z.string().nullable(),
|
|
246
|
+
type: z.string().nullable()
|
|
247
|
+
});
|
|
248
|
+
var itemSchema = z.object({
|
|
249
|
+
id: idString,
|
|
250
|
+
name: z.string(),
|
|
251
|
+
state: z.string().nullable(),
|
|
252
|
+
created_at: z.string().nullable(),
|
|
253
|
+
updated_at: z.string().nullable(),
|
|
254
|
+
group: z.object({ id: z.string(), title: z.string() }).nullable(),
|
|
255
|
+
board: z.object({ id: idString }).nullable(),
|
|
256
|
+
column_values: z.array(columnValueSchema)
|
|
257
|
+
});
|
|
258
|
+
var activityLogSchema = z.object({
|
|
259
|
+
id: idString,
|
|
260
|
+
event: z.string(),
|
|
261
|
+
entity: z.string().nullable(),
|
|
262
|
+
data: z.string().nullable(),
|
|
263
|
+
user_id: z.string().nullable(),
|
|
264
|
+
account_id: z.string().nullable(),
|
|
265
|
+
created_at: z.string()
|
|
266
|
+
});
|
|
267
|
+
var mondayResources = defineResources({
|
|
268
|
+
monday_board: {
|
|
269
|
+
shape: "entity",
|
|
270
|
+
filterable: [],
|
|
271
|
+
description: "Boards with their name, state, kind, workspace, and item count.",
|
|
272
|
+
endpoint: "GraphQL query: boards { ... }",
|
|
273
|
+
responses: { boards: z.array(boardSchema) }
|
|
274
|
+
},
|
|
275
|
+
monday_item: {
|
|
276
|
+
shape: "entity",
|
|
277
|
+
filterable: [],
|
|
278
|
+
description: "Board items with their name, state, group, board, column values, and lifecycle timestamps.",
|
|
279
|
+
endpoint: "GraphQL query: boards { items_page { items { ... } } }",
|
|
280
|
+
responses: { items: z.array(itemSchema) }
|
|
281
|
+
},
|
|
282
|
+
monday_item_activity: {
|
|
283
|
+
shape: "event",
|
|
284
|
+
filterable: [],
|
|
285
|
+
description: "Item activity events derived from each board activity log (creates, updates, status changes), keyed by the originating user.",
|
|
286
|
+
endpoint: "GraphQL query: boards { activity_logs { ... } }",
|
|
287
|
+
notes: "Derived from each board activity log. Activity logs are filtered server-side by date in incremental mode (the from argument) and these append-only events accumulate across syncs. A full sync clears and rewrites the event stream.",
|
|
288
|
+
responses: { activity_logs: z.array(activityLogSchema) }
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
var id = "monday";
|
|
292
|
+
var MondayConnector = class _MondayConnector extends BaseConnector {
|
|
293
|
+
static id = id;
|
|
294
|
+
static resources = mondayResources;
|
|
295
|
+
static schemas = schemasFromResources(mondayResources);
|
|
296
|
+
static create(input, ctx) {
|
|
297
|
+
const parsed = configFields.parse(input);
|
|
298
|
+
return new _MondayConnector(
|
|
299
|
+
{
|
|
300
|
+
boardIds: parsed.boardIds,
|
|
301
|
+
resources: parsed.resources
|
|
302
|
+
},
|
|
303
|
+
{ apiToken: parsed.apiToken },
|
|
304
|
+
ctx
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
id = id;
|
|
308
|
+
credentials = mondayCredentials;
|
|
309
|
+
buildHeaders() {
|
|
310
|
+
return {
|
|
311
|
+
Authorization: this.creds.apiToken,
|
|
312
|
+
"Content-Type": "application/json",
|
|
313
|
+
"API-Version": API_VERSION,
|
|
314
|
+
"User-Agent": connectorUserAgent("monday")
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
async graphql(query, variables, resource, signal) {
|
|
318
|
+
const res = await this.post(ENDPOINT, {
|
|
319
|
+
resource,
|
|
320
|
+
headers: this.buildHeaders(),
|
|
321
|
+
body: JSON.stringify({ query, variables }),
|
|
322
|
+
signal
|
|
323
|
+
});
|
|
324
|
+
if (res.body.errors && res.body.errors.length > 0) {
|
|
325
|
+
const messages = res.body.errors.map((e) => e.message).join("; ");
|
|
326
|
+
throw new Error(`monday.com GraphQL error: ${messages}`);
|
|
327
|
+
}
|
|
328
|
+
if (!res.body.data) {
|
|
329
|
+
throw new Error(
|
|
330
|
+
`monday.com GraphQL response missing data for resource '${resource}'`
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
return res;
|
|
334
|
+
}
|
|
335
|
+
fromFilter(options) {
|
|
336
|
+
return options.mode === "latest" && options.since ? options.since : null;
|
|
337
|
+
}
|
|
338
|
+
advanceBoard(b) {
|
|
339
|
+
const ids = this.settings.boardIds;
|
|
340
|
+
if (ids && ids.length > 0) {
|
|
341
|
+
return b + 1 < ids.length ? encodeItemsPage(b + 1, null) : null;
|
|
342
|
+
}
|
|
343
|
+
return encodeItemsPage(b + 1, null);
|
|
344
|
+
}
|
|
345
|
+
advanceBoardLogs(b) {
|
|
346
|
+
const ids = this.settings.boardIds;
|
|
347
|
+
if (ids && ids.length > 0) {
|
|
348
|
+
return b + 1 < ids.length ? encodeLogsPage(b + 1, 1) : null;
|
|
349
|
+
}
|
|
350
|
+
return encodeLogsPage(b + 1, 1);
|
|
351
|
+
}
|
|
352
|
+
async fetchBoardsPage(page, options, signal) {
|
|
353
|
+
const ids = this.settings.boardIds;
|
|
354
|
+
if (ids && ids.length > 0) {
|
|
355
|
+
const res2 = await this.graphql(
|
|
356
|
+
BOARDS_BY_IDS_QUERY,
|
|
357
|
+
{ ids: [...ids], limit: ids.length },
|
|
358
|
+
"boards",
|
|
359
|
+
signal
|
|
360
|
+
);
|
|
361
|
+
return { items: res2.body.data.boards, next: null };
|
|
362
|
+
}
|
|
363
|
+
const p = page ? Number(page) : 1;
|
|
364
|
+
const limit = clampPageSize(
|
|
365
|
+
options.pageSize,
|
|
366
|
+
DEFAULT_BOARD_PAGE_SIZE,
|
|
367
|
+
MAX_BOARD_PAGE_SIZE
|
|
368
|
+
);
|
|
369
|
+
const res = await this.graphql(
|
|
370
|
+
BOARDS_QUERY,
|
|
371
|
+
{ limit, page: p },
|
|
372
|
+
"boards",
|
|
373
|
+
signal
|
|
374
|
+
);
|
|
375
|
+
const boards = res.body.data.boards;
|
|
376
|
+
return {
|
|
377
|
+
items: boards,
|
|
378
|
+
next: boards.length === limit ? String(p + 1) : null
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
async fetchItemsPage(page, options, signal) {
|
|
382
|
+
const { b, c } = decodeItemsPage(page);
|
|
383
|
+
const itemLimit = clampPageSize(
|
|
384
|
+
options.pageSize,
|
|
385
|
+
DEFAULT_ITEM_PAGE_SIZE,
|
|
386
|
+
MAX_ITEM_PAGE_SIZE
|
|
387
|
+
);
|
|
388
|
+
if (c !== null) {
|
|
389
|
+
const res = await this.graphql(
|
|
390
|
+
NEXT_ITEMS_QUERY,
|
|
391
|
+
{ cursor: c, itemLimit },
|
|
392
|
+
"items",
|
|
393
|
+
signal
|
|
394
|
+
);
|
|
395
|
+
const pageData = res.body.data.next_items_page;
|
|
396
|
+
return {
|
|
397
|
+
items: pageData.items,
|
|
398
|
+
next: pageData.cursor ? encodeItemsPage(b, pageData.cursor) : this.advanceBoard(b)
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
const ids = this.settings.boardIds;
|
|
402
|
+
let boards;
|
|
403
|
+
if (ids && ids.length > 0) {
|
|
404
|
+
if (b >= ids.length) {
|
|
405
|
+
return { items: [], next: null };
|
|
406
|
+
}
|
|
407
|
+
const res = await this.graphql(
|
|
408
|
+
SCOPED_BOARD_ITEMS_QUERY,
|
|
409
|
+
{ ids: [ids[b]], itemLimit },
|
|
410
|
+
"items",
|
|
411
|
+
signal
|
|
412
|
+
);
|
|
413
|
+
boards = res.body.data.boards;
|
|
414
|
+
} else {
|
|
415
|
+
const res = await this.graphql(
|
|
416
|
+
DISCOVER_BOARD_ITEMS_QUERY,
|
|
417
|
+
{ page: b + 1, itemLimit },
|
|
418
|
+
"items",
|
|
419
|
+
signal
|
|
420
|
+
);
|
|
421
|
+
boards = res.body.data.boards;
|
|
422
|
+
}
|
|
423
|
+
if (boards.length === 0) {
|
|
424
|
+
return {
|
|
425
|
+
items: [],
|
|
426
|
+
next: ids && ids.length > 0 ? this.advanceBoard(b) : null
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
const itemsPage = boards[0].items_page;
|
|
430
|
+
return {
|
|
431
|
+
items: itemsPage.items,
|
|
432
|
+
next: itemsPage.cursor ? encodeItemsPage(b, itemsPage.cursor) : this.advanceBoard(b)
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
async fetchItemEventsPage(page, options, signal) {
|
|
436
|
+
const { b, p } = decodeLogsPage(page);
|
|
437
|
+
const logLimit = clampPageSize(
|
|
438
|
+
options.pageSize,
|
|
439
|
+
DEFAULT_LOG_PAGE_SIZE,
|
|
440
|
+
MAX_LOG_PAGE_SIZE
|
|
441
|
+
);
|
|
442
|
+
const from = this.fromFilter(options);
|
|
443
|
+
const ids = this.settings.boardIds;
|
|
444
|
+
let boards;
|
|
445
|
+
if (ids && ids.length > 0) {
|
|
446
|
+
if (b >= ids.length) {
|
|
447
|
+
return { items: [], next: null };
|
|
448
|
+
}
|
|
449
|
+
const res = await this.graphql(
|
|
450
|
+
SCOPED_BOARD_LOGS_QUERY,
|
|
451
|
+
{ ids: [ids[b]], logLimit, logPage: p, from },
|
|
452
|
+
"activity_logs",
|
|
453
|
+
signal
|
|
454
|
+
);
|
|
455
|
+
boards = res.body.data.boards;
|
|
456
|
+
} else {
|
|
457
|
+
const res = await this.graphql(
|
|
458
|
+
DISCOVER_BOARD_LOGS_QUERY,
|
|
459
|
+
{ page: b + 1, logLimit, logPage: p, from },
|
|
460
|
+
"activity_logs",
|
|
461
|
+
signal
|
|
462
|
+
);
|
|
463
|
+
boards = res.body.data.boards;
|
|
464
|
+
}
|
|
465
|
+
if (boards.length === 0) {
|
|
466
|
+
return {
|
|
467
|
+
items: [],
|
|
468
|
+
next: ids && ids.length > 0 ? this.advanceBoardLogs(b) : null
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
const board = boards[0];
|
|
472
|
+
const logs = board.activity_logs ?? [];
|
|
473
|
+
const enriched = logs.map((log) => ({
|
|
474
|
+
...log,
|
|
475
|
+
boardId: board.id
|
|
476
|
+
}));
|
|
477
|
+
return {
|
|
478
|
+
items: enriched,
|
|
479
|
+
next: logs.length === logLimit ? encodeLogsPage(b, p + 1) : this.advanceBoardLogs(b)
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
async writeBoards(storage, boards) {
|
|
483
|
+
for (const board of boards) {
|
|
484
|
+
const updatedMs = board.updated_at ? parseEpoch(board.updated_at, "iso") : null;
|
|
485
|
+
await storage.entity({
|
|
486
|
+
type: "monday_board",
|
|
487
|
+
id: board.id,
|
|
488
|
+
attributes: {
|
|
489
|
+
name: board.name,
|
|
490
|
+
state: board.state,
|
|
491
|
+
boardKind: board.board_kind,
|
|
492
|
+
description: board.description,
|
|
493
|
+
workspaceId: board.workspace_id,
|
|
494
|
+
itemsCount: board.items_count
|
|
495
|
+
},
|
|
496
|
+
updated_at: updatedMs ?? 0
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
async writeItems(storage, items, sinceMs) {
|
|
501
|
+
for (const item of items) {
|
|
502
|
+
const createdMs = item.created_at ? parseEpoch(item.created_at, "iso") : null;
|
|
503
|
+
const updatedMs = item.updated_at ? parseEpoch(item.updated_at, "iso") : null;
|
|
504
|
+
if (sinceMs !== null && updatedMs !== null && updatedMs <= sinceMs) {
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
const columnValues = item.column_values.map((cv) => ({
|
|
508
|
+
id: cv.id,
|
|
509
|
+
text: cv.text,
|
|
510
|
+
value: cv.value,
|
|
511
|
+
type: cv.type
|
|
512
|
+
}));
|
|
513
|
+
await storage.entity({
|
|
514
|
+
type: "monday_item",
|
|
515
|
+
id: item.id,
|
|
516
|
+
attributes: {
|
|
517
|
+
name: item.name,
|
|
518
|
+
state: item.state,
|
|
519
|
+
boardId: item.board?.id ?? null,
|
|
520
|
+
groupId: item.group?.id ?? null,
|
|
521
|
+
groupTitle: item.group?.title ?? null,
|
|
522
|
+
columnValues,
|
|
523
|
+
createdAt: createdMs
|
|
524
|
+
},
|
|
525
|
+
updated_at: updatedMs ?? createdMs ?? 0
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
async writeItemEvents(storage, logs, sinceMs) {
|
|
530
|
+
for (const log of logs) {
|
|
531
|
+
const ts = parseActivityTs(log.created_at);
|
|
532
|
+
if (ts === null) {
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
if (sinceMs !== null && ts <= sinceMs) {
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
await storage.event({
|
|
539
|
+
name: "monday_item_activity",
|
|
540
|
+
start_ts: ts,
|
|
541
|
+
end_ts: null,
|
|
542
|
+
attributes: {
|
|
543
|
+
activityId: log.id,
|
|
544
|
+
event: log.event,
|
|
545
|
+
entity: log.entity,
|
|
546
|
+
boardId: log.boardId,
|
|
547
|
+
itemId: extractItemId(log.data),
|
|
548
|
+
userId: log.user_id,
|
|
549
|
+
accountId: log.account_id
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
async sync(options, storage, signal) {
|
|
555
|
+
const cursor = isMondaySyncCursor(options.cursor) ? options.cursor : void 0;
|
|
556
|
+
const isFull = options.mode === "full";
|
|
557
|
+
const sinceMs = options.mode === "latest" && options.since ? new Date(options.since).getTime() : null;
|
|
558
|
+
const phases = selectActivePhases(
|
|
559
|
+
(r) => r,
|
|
560
|
+
PHASE_ORDER,
|
|
561
|
+
this.settings.resources
|
|
562
|
+
);
|
|
563
|
+
return paginateChunked({
|
|
564
|
+
phases,
|
|
565
|
+
cursor,
|
|
566
|
+
signal,
|
|
567
|
+
logger: this.logger,
|
|
568
|
+
pipeline: true,
|
|
569
|
+
maxChunkMs: CHUNK_BUDGET_MS,
|
|
570
|
+
fetchPage: async (phase, page, sig) => {
|
|
571
|
+
switch (phase) {
|
|
572
|
+
case "boards":
|
|
573
|
+
return this.fetchBoardsPage(page, options, sig);
|
|
574
|
+
case "items":
|
|
575
|
+
return this.fetchItemsPage(page, options, sig);
|
|
576
|
+
case "item_events":
|
|
577
|
+
return this.fetchItemEventsPage(page, options, sig);
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
writeBatch: async (phase, items, page) => {
|
|
581
|
+
if (isFull && page === null) {
|
|
582
|
+
switch (phase) {
|
|
583
|
+
case "boards":
|
|
584
|
+
await storage.entities([], { types: ["monday_board"] });
|
|
585
|
+
break;
|
|
586
|
+
case "items":
|
|
587
|
+
await storage.entities([], { types: ["monday_item"] });
|
|
588
|
+
break;
|
|
589
|
+
case "item_events":
|
|
590
|
+
await storage.events([], { names: ["monday_item_activity"] });
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
switch (phase) {
|
|
595
|
+
case "boards":
|
|
596
|
+
return this.writeBoards(storage, items);
|
|
597
|
+
case "items":
|
|
598
|
+
return this.writeItems(storage, items, sinceMs);
|
|
599
|
+
case "item_events":
|
|
600
|
+
return this.writeItemEvents(
|
|
601
|
+
storage,
|
|
602
|
+
items,
|
|
603
|
+
sinceMs
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
// src/index.ts
|
|
612
|
+
var index_default = MondayConnector;
|
|
613
|
+
export {
|
|
614
|
+
MondayConnector,
|
|
615
|
+
configFields,
|
|
616
|
+
index_default as default,
|
|
617
|
+
doc,
|
|
618
|
+
id,
|
|
619
|
+
mondayResources as resources
|
|
620
|
+
};
|
|
621
|
+
//# 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/monday.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 { connectorUserAgent, parseEpoch } from '@rawdash/connector-shared';\nimport type { HttpResponse } from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ConnectorContext,\n type ConnectorDoc,\n type CredentialsSchema,\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 type { JSONValue } from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n apiToken: z.object({ $secret: z.string() }).meta({\n label: 'API Token',\n description:\n 'monday.com API token. Create one at monday.com -> Profile (avatar) -> Developers -> My access tokens.',\n placeholder: 'eyJhbGciOi...',\n secret: true,\n }),\n boardIds: z.array(z.string().min(1)).nonempty().optional().meta({\n label: 'Board IDs (optional)',\n description:\n 'Restrict the sync to specific board IDs. Omit to discover and sync every board the token can see.',\n }),\n resources: z\n .array(z.enum(['boards', 'items', 'item_events']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n 'Which resources to sync. Omit to sync all resources. The `item_events` phase reads each board activity log.',\n }),\n }),\n);\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'monday.com',\n category: 'product',\n brandColor: '#FF3D57',\n tagline:\n 'Sync boards, items, and item activity events from a monday.com account.',\n vendor: {\n name: 'monday.com',\n domain: 'monday.com',\n apiDocs: 'https://developer.monday.com/api-reference/',\n website: 'https://monday.com',\n },\n auth: {\n summary:\n 'A monday.com API token is required. It authenticates every GraphQL request and scopes the sync to the boards the token can access.',\n setup: [\n 'Open monday.com and click your avatar -> Developers.',\n 'Go to My access tokens and copy your personal API token.',\n 'Store it as a secret and reference it from the connector config as `apiToken: secret(\"MONDAY_API_TOKEN\")`.',\n ],\n },\n rateLimit:\n 'monday.com meters requests by a per-minute complexity budget rather than a fixed request count; the connector walks one board at a time and pages items at most 100 at a time to keep each query within budget.',\n limitations: [\n 'API token auth only (OAuth not yet supported).',\n 'items_page has no server-side updated-at filter, so incremental item syncs page each board and drop unchanged rows client-side; item activity events are filtered server-side by date.',\n 'Webhooks, updates/replies, and sub-items are out of scope.',\n ],\n});\n\nexport interface MondaySettings {\n boardIds?: readonly string[];\n resources?: readonly MondayResource[];\n}\n\nconst mondayCredentials = {\n apiToken: {\n description: 'monday.com API token',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype MondayCredentials = typeof mondayCredentials;\n\nconst PHASE_ORDER = ['boards', 'items', 'item_events'] as const;\n\ntype MondayPhase = (typeof PHASE_ORDER)[number];\n\nexport type MondayResource = MondayPhase;\n\nconst isMondaySyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\ninterface MondayBoard {\n id: string;\n name: string;\n state: string;\n board_kind: string | null;\n description: string | null;\n workspace_id: string | null;\n items_count: number | null;\n updated_at: string | null;\n}\n\ninterface MondayColumnValue {\n id: string;\n text: string | null;\n value: string | null;\n type: string | null;\n}\n\ninterface MondayItem {\n id: string;\n name: string;\n state: string | null;\n created_at: string | null;\n updated_at: string | null;\n group: { id: string; title: string } | null;\n board: { id: string } | null;\n column_values: MondayColumnValue[];\n}\n\ninterface MondayItemsPage {\n cursor: string | null;\n items: MondayItem[];\n}\n\ninterface MondayActivityLog {\n id: string;\n event: string;\n entity: string | null;\n data: string | null;\n user_id: string | null;\n account_id: string | null;\n created_at: string;\n}\n\ninterface EnrichedActivityLog extends MondayActivityLog {\n boardId: string | null;\n}\n\ninterface GraphQLError {\n message: string;\n extensions?: { code?: string };\n}\n\ninterface GraphQLResponse<T> {\n data?: T;\n errors?: GraphQLError[];\n}\n\nconst BOARD_FIELDS =\n 'id name state board_kind description workspace_id items_count updated_at';\nconst ITEM_FIELDS =\n 'id name state created_at updated_at group { id title } board { id } column_values { id text value type }';\nconst ACTIVITY_FIELDS = 'id event entity data user_id account_id created_at';\n\nconst BOARDS_QUERY = `\n query Boards($limit: Int!, $page: Int!) {\n boards(limit: $limit, page: $page) { ${BOARD_FIELDS} }\n }\n`;\n\nconst BOARDS_BY_IDS_QUERY = `\n query BoardsByIds($ids: [ID!], $limit: Int!) {\n boards(ids: $ids, limit: $limit) { ${BOARD_FIELDS} }\n }\n`;\n\nconst DISCOVER_BOARD_ITEMS_QUERY = `\n query BoardItemsByPage($page: Int!, $itemLimit: Int!) {\n boards(limit: 1, page: $page) {\n id\n items_page(limit: $itemLimit) { cursor items { ${ITEM_FIELDS} } }\n }\n }\n`;\n\nconst SCOPED_BOARD_ITEMS_QUERY = `\n query BoardItemsById($ids: [ID!], $itemLimit: Int!) {\n boards(ids: $ids) {\n id\n items_page(limit: $itemLimit) { cursor items { ${ITEM_FIELDS} } }\n }\n }\n`;\n\nconst NEXT_ITEMS_QUERY = `\n query NextItems($cursor: String!, $itemLimit: Int!) {\n next_items_page(cursor: $cursor, limit: $itemLimit) {\n cursor\n items { ${ITEM_FIELDS} }\n }\n }\n`;\n\nconst DISCOVER_BOARD_LOGS_QUERY = `\n query BoardLogsByPage(\n $page: Int!\n $logLimit: Int!\n $logPage: Int!\n $from: ISO8601DateTime\n ) {\n boards(limit: 1, page: $page) {\n id\n activity_logs(limit: $logLimit, page: $logPage, from: $from) { ${ACTIVITY_FIELDS} }\n }\n }\n`;\n\nconst SCOPED_BOARD_LOGS_QUERY = `\n query BoardLogsById(\n $ids: [ID!]\n $logLimit: Int!\n $logPage: Int!\n $from: ISO8601DateTime\n ) {\n boards(ids: $ids) {\n id\n activity_logs(limit: $logLimit, page: $logPage, from: $from) { ${ACTIVITY_FIELDS} }\n }\n }\n`;\n\nconst DEFAULT_BOARD_PAGE_SIZE = 50;\nconst MAX_BOARD_PAGE_SIZE = 500;\nconst DEFAULT_ITEM_PAGE_SIZE = 100;\nconst MAX_ITEM_PAGE_SIZE = 500;\nconst DEFAULT_LOG_PAGE_SIZE = 100;\nconst MAX_LOG_PAGE_SIZE = 10_000;\nconst CHUNK_BUDGET_MS = 25_000;\nconst ENDPOINT = 'https://api.monday.com/v2';\nconst API_VERSION = '2024-10';\n\nfunction clampPageSize(\n requested: number | undefined,\n fallback: number,\n max: number,\n): number {\n const n = requested ?? fallback;\n if (!Number.isFinite(n) || n < 1) {\n return 1;\n }\n return Math.min(Math.floor(n), max);\n}\n\ninterface ItemsPageCursor {\n b: number;\n c: string | null;\n}\n\nfunction encodeItemsPage(b: number, c: string | null): string {\n return JSON.stringify({ b, c });\n}\n\nfunction decodeItemsPage(page: string | null): ItemsPageCursor {\n if (!page) {\n return { b: 0, c: null };\n }\n try {\n const v = JSON.parse(page) as { b?: unknown; c?: unknown };\n if (typeof v.b === 'number' && v.b >= 0) {\n return { b: v.b, c: typeof v.c === 'string' ? v.c : null };\n }\n } catch (err) {\n console.warn(`monday: failed to decode items cursor: ${String(err)}`);\n }\n return { b: 0, c: null };\n}\n\ninterface LogsPageCursor {\n b: number;\n p: number;\n}\n\nfunction encodeLogsPage(b: number, p: number): string {\n return JSON.stringify({ b, p });\n}\n\nfunction decodeLogsPage(page: string | null): LogsPageCursor {\n if (!page) {\n return { b: 0, p: 1 };\n }\n try {\n const v = JSON.parse(page) as { b?: unknown; p?: unknown };\n if (typeof v.b === 'number' && v.b >= 0 && typeof v.p === 'number') {\n return { b: v.b, p: Math.max(1, v.p) };\n }\n } catch (err) {\n console.warn(`monday: failed to decode logs cursor: ${String(err)}`);\n }\n return { b: 0, p: 1 };\n}\n\nfunction parseActivityTs(raw: string): number | null {\n const digits = raw.trim();\n if (/^\\d+$/.test(digits)) {\n const ms = Number(digits.slice(0, 13));\n return Number.isFinite(ms) ? ms : null;\n }\n return parseEpoch(raw, 'iso');\n}\n\nfunction extractItemId(data: string | null): string | null {\n if (!data) {\n return null;\n }\n try {\n const parsed = JSON.parse(data) as Record<string, unknown>;\n const candidate = parsed.pulse_id ?? parsed.item_id ?? parsed.pulseId;\n if (typeof candidate === 'number' || typeof candidate === 'string') {\n return String(candidate);\n }\n } catch (err) {\n console.warn(\n `monday: failed to parse activity data payload: ${String(err)}`,\n );\n }\n return null;\n}\n\nconst idString = z.string().min(1);\n\nconst boardSchema = z.object({\n id: idString,\n name: z.string(),\n state: z.string(),\n board_kind: z.string().nullable(),\n description: z.string().nullable(),\n workspace_id: z.string().nullable(),\n items_count: z.number().nullable(),\n updated_at: z.string().nullable(),\n});\n\nconst columnValueSchema = z.object({\n id: z.string(),\n text: z.string().nullable(),\n value: z.string().nullable(),\n type: z.string().nullable(),\n});\n\nconst itemSchema = z.object({\n id: idString,\n name: z.string(),\n state: z.string().nullable(),\n created_at: z.string().nullable(),\n updated_at: z.string().nullable(),\n group: z.object({ id: z.string(), title: z.string() }).nullable(),\n board: z.object({ id: idString }).nullable(),\n column_values: z.array(columnValueSchema),\n});\n\nconst activityLogSchema = z.object({\n id: idString,\n event: z.string(),\n entity: z.string().nullable(),\n data: z.string().nullable(),\n user_id: z.string().nullable(),\n account_id: z.string().nullable(),\n created_at: z.string(),\n});\n\nexport const mondayResources = defineResources({\n monday_board: {\n shape: 'entity',\n filterable: [],\n description:\n 'Boards with their name, state, kind, workspace, and item count.',\n endpoint: 'GraphQL query: boards { ... }',\n responses: { boards: z.array(boardSchema) },\n },\n monday_item: {\n shape: 'entity',\n filterable: [],\n description:\n 'Board items with their name, state, group, board, column values, and lifecycle timestamps.',\n endpoint: 'GraphQL query: boards { items_page { items { ... } } }',\n responses: { items: z.array(itemSchema) },\n },\n monday_item_activity: {\n shape: 'event',\n filterable: [],\n description:\n 'Item activity events derived from each board activity log (creates, updates, status changes), keyed by the originating user.',\n endpoint: 'GraphQL query: boards { activity_logs { ... } }',\n notes:\n 'Derived from each board activity log. Activity logs are filtered server-side by date in incremental mode (the from argument) and these append-only events accumulate across syncs. A full sync clears and rewrites the event stream.',\n responses: { activity_logs: z.array(activityLogSchema) },\n },\n});\n\nexport const id = 'monday';\n\nexport class MondayConnector extends BaseConnector<\n MondaySettings,\n MondayCredentials\n> {\n static readonly id = id;\n\n static readonly resources = mondayResources;\n\n static readonly schemas = schemasFromResources(mondayResources);\n\n static create(input: unknown, ctx?: ConnectorContext): MondayConnector {\n const parsed = configFields.parse(input);\n return new MondayConnector(\n {\n boardIds: parsed.boardIds,\n resources: parsed.resources,\n },\n { apiToken: parsed.apiToken },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = mondayCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n Authorization: this.creds.apiToken,\n 'Content-Type': 'application/json',\n 'API-Version': API_VERSION,\n 'User-Agent': connectorUserAgent('monday'),\n };\n }\n\n private async graphql<T>(\n query: string,\n variables: Record<string, unknown>,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<GraphQLResponse<T>>> {\n const res = await this.post<GraphQLResponse<T>>(ENDPOINT, {\n resource,\n headers: this.buildHeaders(),\n body: JSON.stringify({ query, variables }),\n signal,\n });\n if (res.body.errors && res.body.errors.length > 0) {\n const messages = res.body.errors.map((e) => e.message).join('; ');\n throw new Error(`monday.com GraphQL error: ${messages}`);\n }\n if (!res.body.data) {\n throw new Error(\n `monday.com GraphQL response missing data for resource '${resource}'`,\n );\n }\n return res;\n }\n\n private fromFilter(options: SyncOptions): string | null {\n return options.mode === 'latest' && options.since ? options.since : null;\n }\n\n private advanceBoard(b: number): string | null {\n const ids = this.settings.boardIds;\n if (ids && ids.length > 0) {\n return b + 1 < ids.length ? encodeItemsPage(b + 1, null) : null;\n }\n return encodeItemsPage(b + 1, null);\n }\n\n private advanceBoardLogs(b: number): string | null {\n const ids = this.settings.boardIds;\n if (ids && ids.length > 0) {\n return b + 1 < ids.length ? encodeLogsPage(b + 1, 1) : null;\n }\n return encodeLogsPage(b + 1, 1);\n }\n\n private async fetchBoardsPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: MondayBoard[]; next: string | null }> {\n const ids = this.settings.boardIds;\n if (ids && ids.length > 0) {\n const res = await this.graphql<{ boards: MondayBoard[] }>(\n BOARDS_BY_IDS_QUERY,\n { ids: [...ids], limit: ids.length },\n 'boards',\n signal,\n );\n return { items: res.body.data!.boards, next: null };\n }\n const p = page ? Number(page) : 1;\n const limit = clampPageSize(\n options.pageSize,\n DEFAULT_BOARD_PAGE_SIZE,\n MAX_BOARD_PAGE_SIZE,\n );\n const res = await this.graphql<{ boards: MondayBoard[] }>(\n BOARDS_QUERY,\n { limit, page: p },\n 'boards',\n signal,\n );\n const boards = res.body.data!.boards;\n return {\n items: boards,\n next: boards.length === limit ? String(p + 1) : null,\n };\n }\n\n private async fetchItemsPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: MondayItem[]; next: string | null }> {\n const { b, c } = decodeItemsPage(page);\n const itemLimit = clampPageSize(\n options.pageSize,\n DEFAULT_ITEM_PAGE_SIZE,\n MAX_ITEM_PAGE_SIZE,\n );\n\n if (c !== null) {\n const res = await this.graphql<{ next_items_page: MondayItemsPage }>(\n NEXT_ITEMS_QUERY,\n { cursor: c, itemLimit },\n 'items',\n signal,\n );\n const pageData = res.body.data!.next_items_page;\n return {\n items: pageData.items,\n next: pageData.cursor\n ? encodeItemsPage(b, pageData.cursor)\n : this.advanceBoard(b),\n };\n }\n\n const ids = this.settings.boardIds;\n let boards: Array<{ id: string; items_page: MondayItemsPage }>;\n if (ids && ids.length > 0) {\n if (b >= ids.length) {\n return { items: [], next: null };\n }\n const res = await this.graphql<{\n boards: Array<{ id: string; items_page: MondayItemsPage }>;\n }>(\n SCOPED_BOARD_ITEMS_QUERY,\n { ids: [ids[b]], itemLimit },\n 'items',\n signal,\n );\n boards = res.body.data!.boards;\n } else {\n const res = await this.graphql<{\n boards: Array<{ id: string; items_page: MondayItemsPage }>;\n }>(\n DISCOVER_BOARD_ITEMS_QUERY,\n { page: b + 1, itemLimit },\n 'items',\n signal,\n );\n boards = res.body.data!.boards;\n }\n\n if (boards.length === 0) {\n return {\n items: [],\n next: ids && ids.length > 0 ? this.advanceBoard(b) : null,\n };\n }\n const itemsPage = boards[0]!.items_page;\n return {\n items: itemsPage.items,\n next: itemsPage.cursor\n ? encodeItemsPage(b, itemsPage.cursor)\n : this.advanceBoard(b),\n };\n }\n\n private async fetchItemEventsPage(\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<{ items: EnrichedActivityLog[]; next: string | null }> {\n const { b, p } = decodeLogsPage(page);\n const logLimit = clampPageSize(\n options.pageSize,\n DEFAULT_LOG_PAGE_SIZE,\n MAX_LOG_PAGE_SIZE,\n );\n const from = this.fromFilter(options);\n const ids = this.settings.boardIds;\n\n let boards: Array<{ id: string; activity_logs: MondayActivityLog[] }>;\n if (ids && ids.length > 0) {\n if (b >= ids.length) {\n return { items: [], next: null };\n }\n const res = await this.graphql<{\n boards: Array<{ id: string; activity_logs: MondayActivityLog[] }>;\n }>(\n SCOPED_BOARD_LOGS_QUERY,\n { ids: [ids[b]], logLimit, logPage: p, from },\n 'activity_logs',\n signal,\n );\n boards = res.body.data!.boards;\n } else {\n const res = await this.graphql<{\n boards: Array<{ id: string; activity_logs: MondayActivityLog[] }>;\n }>(\n DISCOVER_BOARD_LOGS_QUERY,\n { page: b + 1, logLimit, logPage: p, from },\n 'activity_logs',\n signal,\n );\n boards = res.body.data!.boards;\n }\n\n if (boards.length === 0) {\n return {\n items: [],\n next: ids && ids.length > 0 ? this.advanceBoardLogs(b) : null,\n };\n }\n const board = boards[0]!;\n const logs = board.activity_logs ?? [];\n const enriched: EnrichedActivityLog[] = logs.map((log) => ({\n ...log,\n boardId: board.id,\n }));\n return {\n items: enriched,\n next:\n logs.length === logLimit\n ? encodeLogsPage(b, p + 1)\n : this.advanceBoardLogs(b),\n };\n }\n\n private async writeBoards(\n storage: StorageHandle,\n boards: MondayBoard[],\n ): Promise<void> {\n for (const board of boards) {\n const updatedMs = board.updated_at\n ? parseEpoch(board.updated_at, 'iso')\n : null;\n await storage.entity({\n type: 'monday_board',\n id: board.id,\n attributes: {\n name: board.name,\n state: board.state,\n boardKind: board.board_kind,\n description: board.description,\n workspaceId: board.workspace_id,\n itemsCount: board.items_count,\n },\n updated_at: updatedMs ?? 0,\n });\n }\n }\n\n private async writeItems(\n storage: StorageHandle,\n items: MondayItem[],\n sinceMs: number | null,\n ): Promise<void> {\n for (const item of items) {\n const createdMs = item.created_at\n ? parseEpoch(item.created_at, 'iso')\n : null;\n const updatedMs = item.updated_at\n ? parseEpoch(item.updated_at, 'iso')\n : null;\n if (sinceMs !== null && updatedMs !== null && updatedMs <= sinceMs) {\n continue;\n }\n const columnValues: JSONValue = item.column_values.map((cv) => ({\n id: cv.id,\n text: cv.text,\n value: cv.value,\n type: cv.type,\n }));\n await storage.entity({\n type: 'monday_item',\n id: item.id,\n attributes: {\n name: item.name,\n state: item.state,\n boardId: item.board?.id ?? null,\n groupId: item.group?.id ?? null,\n groupTitle: item.group?.title ?? null,\n columnValues,\n createdAt: createdMs,\n },\n updated_at: updatedMs ?? createdMs ?? 0,\n });\n }\n }\n\n private async writeItemEvents(\n storage: StorageHandle,\n logs: EnrichedActivityLog[],\n sinceMs: number | null,\n ): Promise<void> {\n for (const log of logs) {\n const ts = parseActivityTs(log.created_at);\n if (ts === null) {\n continue;\n }\n if (sinceMs !== null && ts <= sinceMs) {\n continue;\n }\n await storage.event({\n name: 'monday_item_activity',\n start_ts: ts,\n end_ts: null,\n attributes: {\n activityId: log.id,\n event: log.event,\n entity: log.entity,\n boardId: log.boardId,\n itemId: extractItemId(log.data),\n userId: log.user_id,\n accountId: log.account_id,\n },\n });\n }\n }\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = isMondaySyncCursor(options.cursor)\n ? options.cursor\n : undefined;\n const isFull = options.mode === 'full';\n const sinceMs =\n options.mode === 'latest' && options.since\n ? new Date(options.since).getTime()\n : null;\n\n const phases = selectActivePhases<MondayResource, MondayPhase>(\n (r) => r,\n PHASE_ORDER,\n this.settings.resources,\n );\n\n return paginateChunked<MondayPhase, string>({\n phases,\n cursor,\n signal,\n logger: this.logger,\n pipeline: true,\n maxChunkMs: CHUNK_BUDGET_MS,\n fetchPage: async (phase, page, sig) => {\n switch (phase) {\n case 'boards':\n return this.fetchBoardsPage(page, options, sig);\n case 'items':\n return this.fetchItemsPage(page, options, sig);\n case 'item_events':\n return this.fetchItemEventsPage(page, options, sig);\n }\n },\n writeBatch: async (phase, items, page) => {\n if (isFull && page === null) {\n switch (phase) {\n case 'boards':\n await storage.entities([], { types: ['monday_board'] });\n break;\n case 'items':\n await storage.entities([], { types: ['monday_item'] });\n break;\n case 'item_events':\n await storage.events([], { names: ['monday_item_activity'] });\n break;\n }\n }\n switch (phase) {\n case 'boards':\n return this.writeBoards(storage, items as MondayBoard[]);\n case 'items':\n return this.writeItems(storage, items as MondayItem[], sinceMs);\n case 'item_events':\n return this.writeItemEvents(\n storage,\n items as EnrichedActivityLog[],\n sinceMs,\n );\n }\n },\n });\n }\n}\n","import { MondayConnector } from './monday';\n\nexport {\n configFields,\n doc,\n id,\n MondayConnector,\n mondayResources as resources,\n} from './monday';\nexport type { MondaySettings, MondayResource } from './monday';\nexport default MondayConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,mBAAmB;AAChE;AKJO,SAAS,WACd,OACA,MACe;AACf,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,WAAO;EACT;AACA,MAAI,SAAS,OAAO;AAClB,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO;IACT;AACA,UAAM,KAAK,IAAI,KAAK,KAAK,EAAE,QAAQ;AACnC,WAAO,OAAO,SAAS,EAAE,IAAI,KAAK;EACpC;AACA,MAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,IAAI;AACpD,WAAO;EACT;AACA,QAAM,IAAI,OAAO,UAAU,WAAW,QAAQ,OAAO,KAAK;AAC1D,MAAI,CAAC,OAAO,SAAS,CAAC,GAAG;AACvB,WAAO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AAsB;AAAA,UACzD,KAAK;AACH,mBAAO,KAAK,WAAW,SAAS,OAAuB,OAAO;AAAA,UAChE,KAAK;AACH,mBAAO,KAAK;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,QACJ;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;ACtxBA,IAAO,gBAAQ;","names":["res"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rawdash/connector-monday",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Rawdash connector for monday.com — boards, items, and item activity 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/monday"
|
|
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
|
+
}
|