@marktoflow/integrations 2.0.0-alpha.14 → 2.0.0-alpha.15
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/dist/adapters/claude-agent-hooks.d.ts +176 -0
- package/dist/adapters/claude-agent-types.d.ts +34 -34
- package/dist/adapters/codex-types.d.ts +20 -20
- package/dist/adapters/github-copilot-types.d.ts +16 -16
- package/dist/adapters/ollama-types.d.ts +128 -128
- package/dist/services/github.d.ts +3 -0
- package/dist/services/gmail-trigger.d.ts +92 -0
- package/dist/services/gmail.d.ts +116 -0
- package/dist/services/google-calendar.d.ts +220 -0
- package/dist/services/google-docs.d.ts +197 -0
- package/dist/services/google-drive.d.ts +149 -0
- package/dist/services/google-sheets.d.ts +165 -0
- package/dist/services/http.d.ts +120 -0
- package/dist/services/hubspot.d.ts +315 -0
- package/dist/services/hubspot.d.ts.map +1 -0
- package/dist/services/hubspot.js +246 -0
- package/dist/services/hubspot.js.map +1 -0
- package/dist/services/jira.d.ts +3 -0
- package/dist/services/linear.d.ts +163 -0
- package/dist/services/mysql.d.ts +91 -0
- package/dist/services/outlook-trigger.d.ts +121 -0
- package/dist/services/outlook.d.ts +237 -0
- package/dist/services/postgres.d.ts +83 -0
- package/dist/services/salesforce.d.ts +269 -0
- package/dist/services/salesforce.d.ts.map +1 -0
- package/dist/services/salesforce.js +286 -0
- package/dist/services/salesforce.js.map +1 -0
- package/dist/services/slack-socket.d.ts +18 -0
- package/dist/services/slack.d.ts +3 -0
- package/dist/services/whatsapp.d.ts +311 -0
- package/package.json +5 -2
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HubSpot Integration
|
|
3
|
+
*
|
|
4
|
+
* Marketing and CRM platform integration via HubSpot API.
|
|
5
|
+
* API Docs: https://developers.hubspot.com/docs/api/overview
|
|
6
|
+
* SDK: https://github.com/HubSpot/hubspot-api-nodejs
|
|
7
|
+
*/
|
|
8
|
+
import { Client } from '@hubspot/api-client';
|
|
9
|
+
/**
|
|
10
|
+
* HubSpot client wrapper for workflow integration
|
|
11
|
+
*/
|
|
12
|
+
export class HubSpotClientWrapper {
|
|
13
|
+
client;
|
|
14
|
+
constructor(client) {
|
|
15
|
+
this.client = client;
|
|
16
|
+
}
|
|
17
|
+
// ==================== Contacts ====================
|
|
18
|
+
/**
|
|
19
|
+
* Create a contact
|
|
20
|
+
*/
|
|
21
|
+
async createContact(contact) {
|
|
22
|
+
const response = await this.client.crm.contacts.basicApi.create({
|
|
23
|
+
properties: contact.properties,
|
|
24
|
+
associations: [],
|
|
25
|
+
});
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get a contact by ID
|
|
30
|
+
*/
|
|
31
|
+
async getContact(contactId, properties) {
|
|
32
|
+
const response = await this.client.crm.contacts.basicApi.getById(contactId, properties);
|
|
33
|
+
return response;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Update a contact
|
|
37
|
+
*/
|
|
38
|
+
async updateContact(contactId, properties) {
|
|
39
|
+
const response = await this.client.crm.contacts.basicApi.update(contactId, { properties });
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Delete a contact
|
|
44
|
+
*/
|
|
45
|
+
async deleteContact(contactId) {
|
|
46
|
+
await this.client.crm.contacts.basicApi.archive(contactId);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Search contacts
|
|
50
|
+
*/
|
|
51
|
+
async searchContacts(options) {
|
|
52
|
+
const response = await this.client.crm.contacts.searchApi.doSearch(options);
|
|
53
|
+
return response;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* List contacts
|
|
57
|
+
*/
|
|
58
|
+
async listContacts(options) {
|
|
59
|
+
const response = await this.client.crm.contacts.basicApi.getPage(options?.limit, options?.after, options?.properties);
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
// ==================== Companies ====================
|
|
63
|
+
/**
|
|
64
|
+
* Create a company
|
|
65
|
+
*/
|
|
66
|
+
async createCompany(company) {
|
|
67
|
+
const response = await this.client.crm.companies.basicApi.create({
|
|
68
|
+
properties: company.properties,
|
|
69
|
+
associations: [],
|
|
70
|
+
});
|
|
71
|
+
return response;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get a company by ID
|
|
75
|
+
*/
|
|
76
|
+
async getCompany(companyId, properties) {
|
|
77
|
+
const response = await this.client.crm.companies.basicApi.getById(companyId, properties);
|
|
78
|
+
return response;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Update a company
|
|
82
|
+
*/
|
|
83
|
+
async updateCompany(companyId, properties) {
|
|
84
|
+
const response = await this.client.crm.companies.basicApi.update(companyId, { properties });
|
|
85
|
+
return response;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Delete a company
|
|
89
|
+
*/
|
|
90
|
+
async deleteCompany(companyId) {
|
|
91
|
+
await this.client.crm.companies.basicApi.archive(companyId);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Search companies
|
|
95
|
+
*/
|
|
96
|
+
async searchCompanies(options) {
|
|
97
|
+
const response = await this.client.crm.companies.searchApi.doSearch(options);
|
|
98
|
+
return response;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* List companies
|
|
102
|
+
*/
|
|
103
|
+
async listCompanies(options) {
|
|
104
|
+
const response = await this.client.crm.companies.basicApi.getPage(options?.limit, options?.after, options?.properties);
|
|
105
|
+
return response;
|
|
106
|
+
}
|
|
107
|
+
// ==================== Deals ====================
|
|
108
|
+
/**
|
|
109
|
+
* Create a deal
|
|
110
|
+
*/
|
|
111
|
+
async createDeal(deal) {
|
|
112
|
+
const response = await this.client.crm.deals.basicApi.create({
|
|
113
|
+
properties: deal.properties,
|
|
114
|
+
associations: [],
|
|
115
|
+
});
|
|
116
|
+
return response;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get a deal by ID
|
|
120
|
+
*/
|
|
121
|
+
async getDeal(dealId, properties) {
|
|
122
|
+
const response = await this.client.crm.deals.basicApi.getById(dealId, properties);
|
|
123
|
+
return response;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Update a deal
|
|
127
|
+
*/
|
|
128
|
+
async updateDeal(dealId, properties) {
|
|
129
|
+
const response = await this.client.crm.deals.basicApi.update(dealId, { properties });
|
|
130
|
+
return response;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Delete a deal
|
|
134
|
+
*/
|
|
135
|
+
async deleteDeal(dealId) {
|
|
136
|
+
await this.client.crm.deals.basicApi.archive(dealId);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Search deals
|
|
140
|
+
*/
|
|
141
|
+
async searchDeals(options) {
|
|
142
|
+
const response = await this.client.crm.deals.searchApi.doSearch(options);
|
|
143
|
+
return response;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* List deals
|
|
147
|
+
*/
|
|
148
|
+
async listDeals(options) {
|
|
149
|
+
const response = await this.client.crm.deals.basicApi.getPage(options?.limit, options?.after, options?.properties);
|
|
150
|
+
return response;
|
|
151
|
+
}
|
|
152
|
+
// ==================== Tickets ====================
|
|
153
|
+
/**
|
|
154
|
+
* Create a ticket
|
|
155
|
+
*/
|
|
156
|
+
async createTicket(ticket) {
|
|
157
|
+
const response = await this.client.crm.tickets.basicApi.create({
|
|
158
|
+
properties: ticket.properties,
|
|
159
|
+
associations: [],
|
|
160
|
+
});
|
|
161
|
+
return response;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get a ticket by ID
|
|
165
|
+
*/
|
|
166
|
+
async getTicket(ticketId, properties) {
|
|
167
|
+
const response = await this.client.crm.tickets.basicApi.getById(ticketId, properties);
|
|
168
|
+
return response;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Update a ticket
|
|
172
|
+
*/
|
|
173
|
+
async updateTicket(ticketId, properties) {
|
|
174
|
+
const response = await this.client.crm.tickets.basicApi.update(ticketId, { properties });
|
|
175
|
+
return response;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Delete a ticket
|
|
179
|
+
*/
|
|
180
|
+
async deleteTicket(ticketId) {
|
|
181
|
+
await this.client.crm.tickets.basicApi.archive(ticketId);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Search tickets
|
|
185
|
+
*/
|
|
186
|
+
async searchTickets(options) {
|
|
187
|
+
const response = await this.client.crm.tickets.searchApi.doSearch(options);
|
|
188
|
+
return response;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* List tickets
|
|
192
|
+
*/
|
|
193
|
+
async listTickets(options) {
|
|
194
|
+
const response = await this.client.crm.tickets.basicApi.getPage(options?.limit, options?.after, options?.properties);
|
|
195
|
+
return response;
|
|
196
|
+
}
|
|
197
|
+
// ==================== Associations ====================
|
|
198
|
+
/**
|
|
199
|
+
* Associate two records
|
|
200
|
+
*/
|
|
201
|
+
async createAssociation(fromObjectType, fromObjectId, toObjectType, toObjectId, associationType) {
|
|
202
|
+
await this.client.crm.associations.v4.basicApi.create(fromObjectType, fromObjectId, toObjectType, toObjectId, [{ associationCategory: 'HUBSPOT_DEFINED', associationTypeId: parseInt(associationType) }]);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get associations for a record
|
|
206
|
+
*/
|
|
207
|
+
async getAssociations(fromObjectType, fromObjectId, toObjectType) {
|
|
208
|
+
const response = await this.client.crm.associations.v4.basicApi.getPage(fromObjectType, fromObjectId, toObjectType);
|
|
209
|
+
return response;
|
|
210
|
+
}
|
|
211
|
+
// ==================== Properties ====================
|
|
212
|
+
/**
|
|
213
|
+
* Get properties for an object type
|
|
214
|
+
*/
|
|
215
|
+
async getProperties(objectType) {
|
|
216
|
+
const response = await this.client.crm.properties.coreApi.getAll(objectType);
|
|
217
|
+
return response.results;
|
|
218
|
+
}
|
|
219
|
+
// ==================== Owners ====================
|
|
220
|
+
/**
|
|
221
|
+
* List owners
|
|
222
|
+
*/
|
|
223
|
+
async listOwners(options) {
|
|
224
|
+
const response = await this.client.crm.owners.ownersApi.getPage(options?.limit, options?.after);
|
|
225
|
+
return response;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export const HubSpotInitializer = {
|
|
229
|
+
async initialize(_module, config) {
|
|
230
|
+
const accessToken = config.auth?.['access_token'];
|
|
231
|
+
const apiKey = config.auth?.['api_key'];
|
|
232
|
+
if (!accessToken && !apiKey) {
|
|
233
|
+
throw new Error('HubSpot SDK requires either auth.access_token or auth.api_key');
|
|
234
|
+
}
|
|
235
|
+
const client = new Client({
|
|
236
|
+
accessToken: accessToken || apiKey,
|
|
237
|
+
});
|
|
238
|
+
const wrapper = new HubSpotClientWrapper(client);
|
|
239
|
+
return {
|
|
240
|
+
client: wrapper,
|
|
241
|
+
actions: wrapper,
|
|
242
|
+
rawClient: client, // Expose raw client for advanced use
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
//# sourceMappingURL=hubspot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hubspot.js","sourceRoot":"","sources":["../../src/services/hubspot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAyF7C;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACX;IAApB,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEtC,qDAAqD;IAErD;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC9D,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,YAAY,EAAE,EAAE;SACjB,CAAC,CAAC;QACH,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AU,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC7E,OAAO,QAAQ,CAAC,OAAkF,CAAC;IACrG,CAAC;IAED,mDAAmD;IAEnD;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAA4C;QAI3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAC7D,OAAO,EAAE,KAAK,EACd,OAAO,EAAE,KAAK,CACf,CAAC;QACF,OAAO,QAGN,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,KAAK,CAAC,UAAU,CAAC,OAAgB,EAAE,MAAkB;QACnD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,cAAc,CAAuB,CAAC;QACxE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,SAAS,CAAuB,CAAC;QAE9D,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACnF,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;YACxB,WAAW,EAAE,WAAW,IAAI,MAAM;SACnC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACjD,OAAO;YACL,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,MAAM,EAAE,qCAAqC;SACzD,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linear Integration
|
|
3
|
+
*
|
|
4
|
+
* Modern issue tracking for development teams.
|
|
5
|
+
* API Docs: https://developers.linear.app/docs/graphql/working-with-the-graphql-api
|
|
6
|
+
*/
|
|
7
|
+
import { SDKInitializer } from '@marktoflow/core';
|
|
8
|
+
export interface LinearIssue {
|
|
9
|
+
id: string;
|
|
10
|
+
identifier: string;
|
|
11
|
+
title: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
priority: number;
|
|
14
|
+
priorityLabel: string;
|
|
15
|
+
state: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
assignee?: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
email: string;
|
|
24
|
+
};
|
|
25
|
+
team: {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
key: string;
|
|
29
|
+
};
|
|
30
|
+
project?: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
labels: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
color: string;
|
|
38
|
+
}[];
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
url: string;
|
|
42
|
+
}
|
|
43
|
+
export interface LinearProject {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
state: string;
|
|
48
|
+
progress: number;
|
|
49
|
+
targetDate?: string;
|
|
50
|
+
teams: {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
}[];
|
|
54
|
+
}
|
|
55
|
+
export interface LinearTeam {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
key: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
issueCount: number;
|
|
61
|
+
}
|
|
62
|
+
export interface CreateIssueOptions {
|
|
63
|
+
teamId: string;
|
|
64
|
+
title: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
priority?: number;
|
|
67
|
+
assigneeId?: string;
|
|
68
|
+
labelIds?: string[];
|
|
69
|
+
projectId?: string;
|
|
70
|
+
stateId?: string;
|
|
71
|
+
estimate?: number;
|
|
72
|
+
dueDate?: string;
|
|
73
|
+
parentId?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface UpdateIssueOptions {
|
|
76
|
+
title?: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
priority?: number;
|
|
79
|
+
assigneeId?: string;
|
|
80
|
+
labelIds?: string[];
|
|
81
|
+
projectId?: string;
|
|
82
|
+
stateId?: string;
|
|
83
|
+
estimate?: number;
|
|
84
|
+
dueDate?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface SearchIssuesOptions {
|
|
87
|
+
query?: string;
|
|
88
|
+
teamId?: string;
|
|
89
|
+
assigneeId?: string;
|
|
90
|
+
stateId?: string;
|
|
91
|
+
labelIds?: string[];
|
|
92
|
+
projectId?: string;
|
|
93
|
+
priority?: number;
|
|
94
|
+
first?: number;
|
|
95
|
+
after?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Linear GraphQL client for workflow integration
|
|
99
|
+
*/
|
|
100
|
+
export declare class LinearClient {
|
|
101
|
+
private apiKey;
|
|
102
|
+
constructor(apiKey: string);
|
|
103
|
+
private query;
|
|
104
|
+
/**
|
|
105
|
+
* Get the current user
|
|
106
|
+
*/
|
|
107
|
+
getViewer(): Promise<{
|
|
108
|
+
id: string;
|
|
109
|
+
name: string;
|
|
110
|
+
email: string;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* List teams
|
|
114
|
+
*/
|
|
115
|
+
listTeams(): Promise<LinearTeam[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Get an issue by ID or identifier
|
|
118
|
+
*/
|
|
119
|
+
getIssue(idOrIdentifier: string): Promise<LinearIssue>;
|
|
120
|
+
/**
|
|
121
|
+
* Create an issue
|
|
122
|
+
*/
|
|
123
|
+
createIssue(options: CreateIssueOptions): Promise<LinearIssue>;
|
|
124
|
+
/**
|
|
125
|
+
* Update an issue
|
|
126
|
+
*/
|
|
127
|
+
updateIssue(issueId: string, options: UpdateIssueOptions): Promise<LinearIssue>;
|
|
128
|
+
/**
|
|
129
|
+
* Search issues
|
|
130
|
+
*/
|
|
131
|
+
searchIssues(options?: SearchIssuesOptions): Promise<{
|
|
132
|
+
issues: LinearIssue[];
|
|
133
|
+
hasMore: boolean;
|
|
134
|
+
endCursor?: string;
|
|
135
|
+
}>;
|
|
136
|
+
/**
|
|
137
|
+
* List projects
|
|
138
|
+
*/
|
|
139
|
+
listProjects(teamId?: string): Promise<LinearProject[]>;
|
|
140
|
+
/**
|
|
141
|
+
* Get workflow states for a team
|
|
142
|
+
*/
|
|
143
|
+
getWorkflowStates(teamId: string): Promise<{
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
type: string;
|
|
147
|
+
position: number;
|
|
148
|
+
}[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Add a comment to an issue
|
|
151
|
+
*/
|
|
152
|
+
addComment(issueId: string, body: string): Promise<{
|
|
153
|
+
id: string;
|
|
154
|
+
body: string;
|
|
155
|
+
createdAt: string;
|
|
156
|
+
}>;
|
|
157
|
+
/**
|
|
158
|
+
* Archive an issue
|
|
159
|
+
*/
|
|
160
|
+
archiveIssue(issueId: string): Promise<void>;
|
|
161
|
+
}
|
|
162
|
+
export declare const LinearInitializer: SDKInitializer;
|
|
163
|
+
//# sourceMappingURL=linear.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MySQL Integration
|
|
3
|
+
*
|
|
4
|
+
* Popular open-source relational database.
|
|
5
|
+
* API: Using mysql2 driver
|
|
6
|
+
*/
|
|
7
|
+
import { SDKInitializer } from '@marktoflow/core';
|
|
8
|
+
export interface MySQLConfig {
|
|
9
|
+
host: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
database: string;
|
|
12
|
+
user: string;
|
|
13
|
+
password: string;
|
|
14
|
+
ssl?: boolean | {
|
|
15
|
+
rejectUnauthorized?: boolean;
|
|
16
|
+
};
|
|
17
|
+
connectTimeout?: number;
|
|
18
|
+
connectionLimit?: number;
|
|
19
|
+
waitForConnections?: boolean;
|
|
20
|
+
queueLimit?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface QueryResult<T = unknown> {
|
|
23
|
+
rows: T[];
|
|
24
|
+
fields: {
|
|
25
|
+
name: string;
|
|
26
|
+
type: string;
|
|
27
|
+
}[];
|
|
28
|
+
affectedRows?: number;
|
|
29
|
+
insertId?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface MySQLTransaction {
|
|
32
|
+
query<T = unknown>(sql: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
33
|
+
commit(): Promise<void>;
|
|
34
|
+
rollback(): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* MySQL client wrapper for workflow integration
|
|
38
|
+
* Note: This is a lightweight wrapper. The actual mysql2 module will be dynamically imported.
|
|
39
|
+
*/
|
|
40
|
+
export declare class MySQLClient {
|
|
41
|
+
private pool;
|
|
42
|
+
private config;
|
|
43
|
+
constructor(config: MySQLConfig);
|
|
44
|
+
/**
|
|
45
|
+
* Initialize the connection pool
|
|
46
|
+
*/
|
|
47
|
+
connect(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Execute a SQL query
|
|
50
|
+
*/
|
|
51
|
+
query<T = unknown>(sql: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
52
|
+
/**
|
|
53
|
+
* Select data from a table
|
|
54
|
+
*/
|
|
55
|
+
select<T = Record<string, unknown>>(table: string, options?: {
|
|
56
|
+
columns?: string[];
|
|
57
|
+
where?: Record<string, unknown>;
|
|
58
|
+
orderBy?: string;
|
|
59
|
+
limit?: number;
|
|
60
|
+
offset?: number;
|
|
61
|
+
}): Promise<T[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Insert data into a table
|
|
64
|
+
*/
|
|
65
|
+
insert<T = Record<string, unknown>>(table: string, data: Record<string, unknown> | Record<string, unknown>[]): Promise<{
|
|
66
|
+
insertId: number;
|
|
67
|
+
affectedRows: number;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Update data in a table
|
|
71
|
+
*/
|
|
72
|
+
update<T = Record<string, unknown>>(table: string, data: Record<string, unknown>, where: Record<string, unknown>): Promise<{
|
|
73
|
+
affectedRows: number;
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Delete data from a table
|
|
77
|
+
*/
|
|
78
|
+
delete<T = Record<string, unknown>>(table: string, where: Record<string, unknown>): Promise<{
|
|
79
|
+
affectedRows: number;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Begin a transaction
|
|
83
|
+
*/
|
|
84
|
+
transaction<T>(callback: (trx: MySQLTransaction) => Promise<T>): Promise<T>;
|
|
85
|
+
/**
|
|
86
|
+
* Close the connection pool
|
|
87
|
+
*/
|
|
88
|
+
close(): Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
export declare const MySQLInitializer: SDKInitializer;
|
|
91
|
+
//# sourceMappingURL=mysql.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { TriggerType } from '@marktoflow/core';
|
|
2
|
+
export interface OutlookTriggerConfig {
|
|
3
|
+
token: string;
|
|
4
|
+
notificationUrl: string;
|
|
5
|
+
changeTypes?: ('created' | 'updated' | 'deleted')[];
|
|
6
|
+
resource?: string;
|
|
7
|
+
expirationMinutes?: number;
|
|
8
|
+
clientState?: string;
|
|
9
|
+
triggers: Array<{
|
|
10
|
+
id: string;
|
|
11
|
+
event: 'email_received' | 'email_updated' | 'email_deleted';
|
|
12
|
+
handler: (payload: OutlookTriggerPayload) => Promise<void>;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface OutlookTriggerPayload {
|
|
16
|
+
type: TriggerType;
|
|
17
|
+
event: 'email_received' | 'email_updated' | 'email_deleted';
|
|
18
|
+
subscriptionId: string;
|
|
19
|
+
changeType: string;
|
|
20
|
+
resource: string;
|
|
21
|
+
resourceData?: {
|
|
22
|
+
id: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
clientState?: string;
|
|
26
|
+
tenantId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GraphSubscription {
|
|
29
|
+
id: string;
|
|
30
|
+
resource: string;
|
|
31
|
+
changeType: string;
|
|
32
|
+
notificationUrl: string;
|
|
33
|
+
expirationDateTime: string;
|
|
34
|
+
clientState?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface GraphNotification {
|
|
37
|
+
value: Array<{
|
|
38
|
+
subscriptionId: string;
|
|
39
|
+
subscriptionExpirationDateTime: string;
|
|
40
|
+
changeType: string;
|
|
41
|
+
resource: string;
|
|
42
|
+
resourceData?: {
|
|
43
|
+
'@odata.type': string;
|
|
44
|
+
'@odata.id': string;
|
|
45
|
+
'@odata.etag': string;
|
|
46
|
+
id: string;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
clientState?: string;
|
|
50
|
+
tenantId?: string;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
export interface GraphValidationRequest extends Record<string, unknown> {
|
|
54
|
+
validationToken: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Outlook trigger handler for Microsoft Graph webhook subscriptions.
|
|
58
|
+
*
|
|
59
|
+
* Setup requirements:
|
|
60
|
+
* 1. Register an Azure AD application with Mail.Read permissions
|
|
61
|
+
* 2. Set up a publicly accessible webhook endpoint
|
|
62
|
+
* 3. Call subscribe() to start receiving notifications
|
|
63
|
+
* 4. Handle subscription renewal before expiration (max ~3 days)
|
|
64
|
+
*/
|
|
65
|
+
export declare class OutlookTrigger {
|
|
66
|
+
private config;
|
|
67
|
+
private client;
|
|
68
|
+
private subscription?;
|
|
69
|
+
constructor(config: OutlookTriggerConfig);
|
|
70
|
+
/**
|
|
71
|
+
* Create a subscription to receive mail notifications.
|
|
72
|
+
*/
|
|
73
|
+
subscribe(): Promise<GraphSubscription>;
|
|
74
|
+
/**
|
|
75
|
+
* Renew an existing subscription.
|
|
76
|
+
*/
|
|
77
|
+
renew(expirationMinutes?: number): Promise<GraphSubscription>;
|
|
78
|
+
/**
|
|
79
|
+
* Delete the subscription (stop receiving notifications).
|
|
80
|
+
*/
|
|
81
|
+
unsubscribe(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Get the current subscription status.
|
|
84
|
+
*/
|
|
85
|
+
getSubscription(): GraphSubscription | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Check if subscription is still active (not expired).
|
|
88
|
+
*/
|
|
89
|
+
isSubscriptionActive(): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Handle an incoming Graph notification.
|
|
92
|
+
* Call this from your webhook endpoint after validation.
|
|
93
|
+
*/
|
|
94
|
+
handleNotification(notification: GraphNotification): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Check if a request is a validation request from Graph.
|
|
97
|
+
*/
|
|
98
|
+
static isValidationRequest(query: Record<string, unknown>): query is GraphValidationRequest;
|
|
99
|
+
/**
|
|
100
|
+
* Validate the notification body structure.
|
|
101
|
+
*/
|
|
102
|
+
static validateNotification(body: unknown): body is GraphNotification;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Express/Fastify-compatible middleware for handling Outlook Graph webhooks.
|
|
106
|
+
*
|
|
107
|
+
* Handles both:
|
|
108
|
+
* - Subscription validation (GET with validationToken)
|
|
109
|
+
* - Notification processing (POST with notification payload)
|
|
110
|
+
*/
|
|
111
|
+
export declare function createOutlookWebhookHandler(trigger: OutlookTrigger): (req: {
|
|
112
|
+
method: string;
|
|
113
|
+
query: Record<string, unknown>;
|
|
114
|
+
body: unknown;
|
|
115
|
+
}, res: {
|
|
116
|
+
status: (code: number) => {
|
|
117
|
+
send: (body?: string) => void;
|
|
118
|
+
};
|
|
119
|
+
contentType: (type: string) => void;
|
|
120
|
+
}) => Promise<void>;
|
|
121
|
+
//# sourceMappingURL=outlook-trigger.d.ts.map
|