@commandable/integration-data 0.0.6 → 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.
Files changed (231) hide show
  1. package/dist/credentials-index.d.ts.map +1 -1
  2. package/dist/credentials-index.js +130 -0
  3. package/dist/credentials-index.js.map +1 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/loader.d.ts +48 -0
  9. package/dist/loader.d.ts.map +1 -1
  10. package/dist/loader.js +46 -4
  11. package/dist/loader.js.map +1 -1
  12. package/integrations/__tests__/liveHarness.ts +16 -3
  13. package/integrations/airtable/.env.test +9 -0
  14. package/integrations/airtable/.env.test.example +11 -0
  15. package/integrations/airtable/README.md +27 -0
  16. package/integrations/airtable/__tests__/get_handlers.test.ts +43 -5
  17. package/integrations/airtable/credentials.json +2 -1
  18. package/integrations/confluence/.env.test +25 -0
  19. package/integrations/confluence/.env.test.example +36 -0
  20. package/integrations/confluence/README.md +28 -0
  21. package/integrations/confluence/__tests__/get_handlers.test.ts +121 -0
  22. package/integrations/confluence/__tests__/usage_parity.test.ts +14 -0
  23. package/integrations/confluence/__tests__/write_handlers.test.ts +131 -0
  24. package/integrations/confluence/credentials.json +39 -0
  25. package/integrations/confluence/credentials_hint.md +4 -0
  26. package/integrations/confluence/credentials_hint_api_token.md +9 -0
  27. package/integrations/confluence/credentials_hint_oauth_token.md +8 -0
  28. package/integrations/confluence/handlers/add_comment.js +19 -0
  29. package/integrations/confluence/handlers/add_label.js +16 -0
  30. package/integrations/confluence/handlers/create_page.js +22 -0
  31. package/integrations/confluence/handlers/delete_page.js +17 -0
  32. package/integrations/confluence/handlers/get_comments.js +33 -0
  33. package/integrations/confluence/handlers/get_page_children.js +30 -0
  34. package/integrations/confluence/handlers/get_space.js +22 -0
  35. package/integrations/confluence/handlers/list_spaces.js +39 -0
  36. package/integrations/confluence/handlers/read_page.js +49 -0
  37. package/integrations/confluence/handlers/search_pages.js +42 -0
  38. package/integrations/confluence/handlers/update_page.js +42 -0
  39. package/integrations/confluence/manifest.json +85 -0
  40. package/integrations/confluence/prompt.md +55 -0
  41. package/integrations/confluence/schemas/add_comment.json +22 -0
  42. package/integrations/confluence/schemas/add_label.json +19 -0
  43. package/integrations/confluence/schemas/create_page.json +33 -0
  44. package/integrations/confluence/schemas/delete_page.json +23 -0
  45. package/integrations/confluence/schemas/empty.json +6 -0
  46. package/integrations/confluence/schemas/get_comments.json +24 -0
  47. package/integrations/confluence/schemas/get_page_children.json +28 -0
  48. package/integrations/confluence/schemas/get_space.json +18 -0
  49. package/integrations/confluence/schemas/list_spaces.json +36 -0
  50. package/integrations/confluence/schemas/read_page.json +28 -0
  51. package/integrations/confluence/schemas/search_pages.json +26 -0
  52. package/integrations/confluence/schemas/update_page.json +31 -0
  53. package/integrations/github/.env.test +16 -0
  54. package/integrations/github/.env.test.example +17 -0
  55. package/integrations/github/README.md +75 -0
  56. package/integrations/github/__tests__/get_handlers.test.ts +5 -5
  57. package/integrations/github/__tests__/write_handlers.test.ts +176 -58
  58. package/integrations/github/credentials.json +4 -2
  59. package/integrations/github/handlers/create_file.js +46 -0
  60. package/integrations/github/handlers/delete_file.js +14 -1
  61. package/integrations/github/handlers/edit_file.js +52 -0
  62. package/integrations/github/handlers/edit_files.js +107 -0
  63. package/integrations/github/manifest.json +74 -47
  64. package/integrations/github/prompt.md +36 -0
  65. package/integrations/github/schemas/create_file.json +13 -0
  66. package/integrations/github/schemas/delete_file.json +2 -2
  67. package/integrations/github/schemas/edit_file.json +26 -0
  68. package/integrations/github/schemas/edit_files.json +39 -0
  69. package/integrations/google-calendar/.env.test.example +11 -0
  70. package/integrations/google-calendar/README.md +41 -0
  71. package/integrations/google-calendar/__tests__/write_and_admin_handlers.test.ts +7 -7
  72. package/integrations/google-calendar/credentials.json +4 -2
  73. package/integrations/google-calendar/credentials_hint.md +1 -1
  74. package/integrations/google-calendar/manifest.json +27 -17
  75. package/integrations/google-docs/README.md +30 -0
  76. package/integrations/google-docs/credentials_hint.md +1 -1
  77. package/integrations/google-drive/README.md +26 -0
  78. package/integrations/google-drive/credentials.json +4 -2
  79. package/integrations/google-gmail/.env.test.example +11 -0
  80. package/integrations/google-gmail/README.md +49 -0
  81. package/integrations/google-gmail/credentials.json +4 -2
  82. package/integrations/google-gmail/handlers/create_draft_email.js +1 -1
  83. package/integrations/google-gmail/handlers/read_email.js +1 -1
  84. package/integrations/google-gmail/handlers/send_email.js +1 -1
  85. package/integrations/google-gmail/manifest.json +36 -25
  86. package/integrations/google-sheet/README.md +27 -0
  87. package/integrations/google-sheet/credentials_hint.md +1 -1
  88. package/integrations/google-slides/README.md +28 -0
  89. package/integrations/google-slides/credentials_hint.md +1 -1
  90. package/integrations/hubspot/.env.test.example +20 -0
  91. package/integrations/hubspot/README.md +48 -0
  92. package/integrations/hubspot/__tests__/get_handlers.test.ts +151 -0
  93. package/integrations/hubspot/__tests__/usage_parity.test.ts +10 -0
  94. package/integrations/hubspot/__tests__/write_handlers.test.ts +244 -0
  95. package/integrations/hubspot/credentials.json +50 -0
  96. package/integrations/hubspot/credentials_hint.md +20 -0
  97. package/integrations/hubspot/credentials_hint_oauth_token.md +16 -0
  98. package/integrations/hubspot/handlers/archive_company.js +13 -0
  99. package/integrations/hubspot/handlers/archive_contact.js +13 -0
  100. package/integrations/hubspot/handlers/archive_deal.js +13 -0
  101. package/integrations/hubspot/handlers/archive_ticket.js +13 -0
  102. package/integrations/hubspot/handlers/create_association.js +18 -0
  103. package/integrations/hubspot/handlers/create_company.js +13 -0
  104. package/integrations/hubspot/handlers/create_contact.js +14 -0
  105. package/integrations/hubspot/handlers/create_deal.js +16 -0
  106. package/integrations/hubspot/handlers/create_note.js +44 -0
  107. package/integrations/hubspot/handlers/create_task.js +48 -0
  108. package/integrations/hubspot/handlers/create_ticket.js +15 -0
  109. package/integrations/hubspot/handlers/get_associations.js +14 -0
  110. package/integrations/hubspot/handlers/get_company.js +18 -0
  111. package/integrations/hubspot/handlers/get_contact.js +18 -0
  112. package/integrations/hubspot/handlers/get_deal.js +18 -0
  113. package/integrations/hubspot/handlers/get_ticket.js +20 -0
  114. package/integrations/hubspot/handlers/list_owners.js +12 -0
  115. package/integrations/hubspot/handlers/list_pipelines.js +5 -0
  116. package/integrations/hubspot/handlers/list_properties.js +11 -0
  117. package/integrations/hubspot/handlers/remove_association.js +22 -0
  118. package/integrations/hubspot/handlers/search_companies.js +43 -0
  119. package/integrations/hubspot/handlers/search_contacts.js +43 -0
  120. package/integrations/hubspot/handlers/search_deals.js +43 -0
  121. package/integrations/hubspot/handlers/search_notes.js +43 -0
  122. package/integrations/hubspot/handlers/search_tasks.js +43 -0
  123. package/integrations/hubspot/handlers/search_tickets.js +43 -0
  124. package/integrations/hubspot/handlers/update_company.js +13 -0
  125. package/integrations/hubspot/handlers/update_contact.js +14 -0
  126. package/integrations/hubspot/handlers/update_deal.js +16 -0
  127. package/integrations/hubspot/handlers/update_task.js +17 -0
  128. package/integrations/hubspot/handlers/update_ticket.js +15 -0
  129. package/integrations/hubspot/manifest.json +230 -0
  130. package/integrations/hubspot/prompt.md +69 -0
  131. package/integrations/hubspot/schemas/archive_company.json +13 -0
  132. package/integrations/hubspot/schemas/archive_contact.json +13 -0
  133. package/integrations/hubspot/schemas/archive_deal.json +9 -0
  134. package/integrations/hubspot/schemas/archive_ticket.json +9 -0
  135. package/integrations/hubspot/schemas/create_association.json +24 -0
  136. package/integrations/hubspot/schemas/create_company.json +14 -0
  137. package/integrations/hubspot/schemas/create_contact.json +15 -0
  138. package/integrations/hubspot/schemas/create_deal.json +20 -0
  139. package/integrations/hubspot/schemas/create_note.json +37 -0
  140. package/integrations/hubspot/schemas/create_task.json +51 -0
  141. package/integrations/hubspot/schemas/create_ticket.json +16 -0
  142. package/integrations/hubspot/schemas/empty.json +6 -0
  143. package/integrations/hubspot/schemas/get_associations.json +30 -0
  144. package/integrations/hubspot/schemas/get_company.json +27 -0
  145. package/integrations/hubspot/schemas/get_contact.json +27 -0
  146. package/integrations/hubspot/schemas/get_deal.json +20 -0
  147. package/integrations/hubspot/schemas/get_ticket.json +20 -0
  148. package/integrations/hubspot/schemas/list_owners.json +25 -0
  149. package/integrations/hubspot/schemas/list_pipelines.json +13 -0
  150. package/integrations/hubspot/schemas/list_properties.json +17 -0
  151. package/integrations/hubspot/schemas/remove_association.json +24 -0
  152. package/integrations/hubspot/schemas/search_companies.json +56 -0
  153. package/integrations/hubspot/schemas/search_contacts.json +56 -0
  154. package/integrations/hubspot/schemas/search_deals.json +43 -0
  155. package/integrations/hubspot/schemas/search_notes.json +43 -0
  156. package/integrations/hubspot/schemas/search_tasks.json +43 -0
  157. package/integrations/hubspot/schemas/search_tickets.json +43 -0
  158. package/integrations/hubspot/schemas/update_company.json +20 -0
  159. package/integrations/hubspot/schemas/update_contact.json +21 -0
  160. package/integrations/hubspot/schemas/update_deal.json +19 -0
  161. package/integrations/hubspot/schemas/update_task.json +31 -0
  162. package/integrations/hubspot/schemas/update_ticket.json +18 -0
  163. package/integrations/jira/.env.test +46 -0
  164. package/integrations/jira/.env.test.example +41 -0
  165. package/integrations/jira/README.md +46 -0
  166. package/integrations/jira/__tests__/get_handlers.test.ts +193 -0
  167. package/integrations/jira/__tests__/usage_parity.test.ts +14 -0
  168. package/integrations/jira/__tests__/write_handlers.test.ts +157 -0
  169. package/integrations/jira/credentials.json +39 -0
  170. package/integrations/jira/credentials_hint.md +4 -0
  171. package/integrations/jira/credentials_hint_api_token.md +6 -0
  172. package/integrations/jira/credentials_hint_oauth_token.md +6 -0
  173. package/integrations/jira/handlers/add_comment.js +9 -0
  174. package/integrations/jira/handlers/assign_issue.js +11 -0
  175. package/integrations/jira/handlers/create_issue.js +37 -0
  176. package/integrations/jira/handlers/create_sprint.js +19 -0
  177. package/integrations/jira/handlers/delete_issue.js +10 -0
  178. package/integrations/jira/handlers/get_backlog_issues.js +13 -0
  179. package/integrations/jira/handlers/get_board.js +6 -0
  180. package/integrations/jira/handlers/get_issue.js +63 -0
  181. package/integrations/jira/handlers/get_issue_comments.js +31 -0
  182. package/integrations/jira/handlers/get_myself.js +14 -0
  183. package/integrations/jira/handlers/get_project.js +28 -0
  184. package/integrations/jira/handlers/get_sprint.js +5 -0
  185. package/integrations/jira/handlers/get_sprint_issues.js +13 -0
  186. package/integrations/jira/handlers/get_transitions.js +23 -0
  187. package/integrations/jira/handlers/list_boards.js +34 -0
  188. package/integrations/jira/handlers/list_projects.js +29 -0
  189. package/integrations/jira/handlers/list_sprints.js +29 -0
  190. package/integrations/jira/handlers/move_issues_to_sprint.js +11 -0
  191. package/integrations/jira/handlers/search_issues.js +43 -0
  192. package/integrations/jira/handlers/search_users.js +21 -0
  193. package/integrations/jira/handlers/transition_issue.js +44 -0
  194. package/integrations/jira/handlers/update_issue.js +40 -0
  195. package/integrations/jira/handlers/update_sprint.js +20 -0
  196. package/integrations/jira/manifest.json +204 -0
  197. package/integrations/jira/prompt.md +80 -0
  198. package/integrations/jira/schemas/add_comment.json +16 -0
  199. package/integrations/jira/schemas/assign_issue.json +16 -0
  200. package/integrations/jira/schemas/create_issue.json +49 -0
  201. package/integrations/jira/schemas/create_sprint.json +29 -0
  202. package/integrations/jira/schemas/delete_issue.json +12 -0
  203. package/integrations/jira/schemas/empty.json +6 -0
  204. package/integrations/jira/schemas/get_backlog_issues.json +33 -0
  205. package/integrations/jira/schemas/get_board.json +13 -0
  206. package/integrations/jira/schemas/get_issue.json +23 -0
  207. package/integrations/jira/schemas/get_issue_comments.json +23 -0
  208. package/integrations/jira/schemas/get_project.json +17 -0
  209. package/integrations/jira/schemas/get_sprint.json +13 -0
  210. package/integrations/jira/schemas/get_sprint_issues.json +33 -0
  211. package/integrations/jira/schemas/get_transitions.json +12 -0
  212. package/integrations/jira/schemas/list_boards.json +27 -0
  213. package/integrations/jira/schemas/list_projects.json +22 -0
  214. package/integrations/jira/schemas/list_sprints.json +29 -0
  215. package/integrations/jira/schemas/move_issues_to_sprint.json +19 -0
  216. package/integrations/jira/schemas/search_issues.json +28 -0
  217. package/integrations/jira/schemas/search_users.json +18 -0
  218. package/integrations/jira/schemas/transition_issue.json +38 -0
  219. package/integrations/jira/schemas/update_issue.json +47 -0
  220. package/integrations/jira/schemas/update_sprint.json +33 -0
  221. package/integrations/new_integration_prompt.md +173 -2
  222. package/integrations/notion/.env.test +10 -0
  223. package/integrations/notion/.env.test.example +13 -0
  224. package/integrations/notion/README.md +42 -0
  225. package/integrations/notion/credentials.json +2 -1
  226. package/integrations/notion/manifest.json +64 -35
  227. package/integrations/trello/.env.test +6 -0
  228. package/integrations/trello/.env.test.example +9 -0
  229. package/integrations/trello/README.md +50 -0
  230. package/integrations/trello/credentials.json +2 -1
  231. package/package.json +7 -3
@@ -0,0 +1,48 @@
1
+ async (input) => {
2
+ const nowMs = Date.now()
3
+
4
+ const props = {
5
+ hs_task_subject: input.subject,
6
+ hs_task_body: input.body,
7
+ hs_task_status: input.status,
8
+ hs_task_priority: input.priority,
9
+ hs_timestamp:
10
+ input.dueTimestamp !== undefined ? String(input.dueTimestamp) : String(nowMs),
11
+ ...(input.properties || {}),
12
+ }
13
+
14
+ if (input.hubspot_owner_id !== undefined) {
15
+ props.hubspot_owner_id = String(input.hubspot_owner_id)
16
+ }
17
+
18
+ const createRes = await integration.fetch(`/crm/v3/objects/tasks`, {
19
+ method: 'POST',
20
+ body: { properties: props },
21
+ })
22
+ const task = await createRes.json()
23
+
24
+ const associationResults = []
25
+ if (Array.isArray(input.associateWith) && input.associateWith.length > 0 && task?.id) {
26
+ for (const a of input.associateWith) {
27
+ const res = await integration.fetch(
28
+ `/crm/v4/objects/tasks/${encodeURIComponent(String(task.id))}/associations/default/${encodeURIComponent(
29
+ a.objectType
30
+ )}/${encodeURIComponent(a.objectId)}`,
31
+ { method: 'PUT' }
32
+ )
33
+ const text = await res.text()
34
+ if (!text) {
35
+ associationResults.push({ ok: res.ok, status: res.status })
36
+ } else {
37
+ try {
38
+ associationResults.push(JSON.parse(text))
39
+ } catch {
40
+ associationResults.push({ ok: res.ok, status: res.status, body: text })
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ return { task, associationResults }
47
+ }
48
+
@@ -0,0 +1,15 @@
1
+ async (input) => {
2
+ const props = { ...(input.properties || {}) }
3
+ if (input.subject !== undefined) props.subject = input.subject
4
+ if (input.content !== undefined) props.content = input.content
5
+ if (input.hs_pipeline !== undefined) props.hs_pipeline = input.hs_pipeline
6
+ if (input.hs_pipeline_stage !== undefined) props.hs_pipeline_stage = input.hs_pipeline_stage
7
+
8
+ const body = { properties: props }
9
+ const res = await integration.fetch(`/crm/v3/objects/tickets`, {
10
+ method: 'POST',
11
+ body,
12
+ })
13
+ return await res.json()
14
+ }
15
+
@@ -0,0 +1,14 @@
1
+ async (input) => {
2
+ const params = new URLSearchParams()
3
+ if (input?.after) params.set('after', String(input.after))
4
+ if (input?.limit) params.set('limit', String(input.limit))
5
+
6
+ const suffix = params.toString() ? `?${params.toString()}` : ''
7
+ const res = await integration.fetch(
8
+ `/crm/v4/objects/${encodeURIComponent(input.fromObjectType)}/${encodeURIComponent(
9
+ input.fromObjectId
10
+ )}/associations/${encodeURIComponent(input.toObjectType)}${suffix}`
11
+ )
12
+ return await res.json()
13
+ }
14
+
@@ -0,0 +1,18 @@
1
+ async (input) => {
2
+ const params = new URLSearchParams()
3
+
4
+ if (Array.isArray(input.properties)) {
5
+ for (const p of input.properties) params.append('properties', p)
6
+ }
7
+
8
+ if (Array.isArray(input.associations)) {
9
+ for (const a of input.associations) params.append('associations', a)
10
+ }
11
+
12
+ if (typeof input.archived === 'boolean') params.set('archived', String(input.archived))
13
+
14
+ const suffix = params.toString() ? `?${params.toString()}` : ''
15
+ const res = await integration.fetch(`/crm/v3/objects/companies/${encodeURIComponent(input.id)}${suffix}`)
16
+ return await res.json()
17
+ }
18
+
@@ -0,0 +1,18 @@
1
+ async (input) => {
2
+ const params = new URLSearchParams()
3
+
4
+ if (Array.isArray(input.properties)) {
5
+ for (const p of input.properties) params.append('properties', p)
6
+ }
7
+
8
+ if (Array.isArray(input.associations)) {
9
+ for (const a of input.associations) params.append('associations', a)
10
+ }
11
+
12
+ if (typeof input.archived === 'boolean') params.set('archived', String(input.archived))
13
+
14
+ const suffix = params.toString() ? `?${params.toString()}` : ''
15
+ const res = await integration.fetch(`/crm/v3/objects/contacts/${encodeURIComponent(input.id)}${suffix}`)
16
+ return await res.json()
17
+ }
18
+
@@ -0,0 +1,18 @@
1
+ async (input) => {
2
+ const params = new URLSearchParams()
3
+
4
+ if (Array.isArray(input.properties)) {
5
+ for (const p of input.properties) params.append('properties', p)
6
+ }
7
+
8
+ if (Array.isArray(input.associations)) {
9
+ for (const a of input.associations) params.append('associations', a)
10
+ }
11
+
12
+ if (typeof input.archived === 'boolean') params.set('archived', String(input.archived))
13
+
14
+ const suffix = params.toString() ? `?${params.toString()}` : ''
15
+ const res = await integration.fetch(`/crm/v3/objects/deals/${encodeURIComponent(input.id)}${suffix}`)
16
+ return await res.json()
17
+ }
18
+
@@ -0,0 +1,20 @@
1
+ async (input) => {
2
+ const params = new URLSearchParams()
3
+
4
+ if (Array.isArray(input.properties)) {
5
+ for (const p of input.properties) params.append('properties', p)
6
+ }
7
+
8
+ if (Array.isArray(input.associations)) {
9
+ for (const a of input.associations) params.append('associations', a)
10
+ }
11
+
12
+ if (typeof input.archived === 'boolean') params.set('archived', String(input.archived))
13
+
14
+ const suffix = params.toString() ? `?${params.toString()}` : ''
15
+ const res = await integration.fetch(
16
+ `/crm/v3/objects/tickets/${encodeURIComponent(input.id)}${suffix}`
17
+ )
18
+ return await res.json()
19
+ }
20
+
@@ -0,0 +1,12 @@
1
+ async (input) => {
2
+ const params = new URLSearchParams()
3
+ if (input?.email) params.set('email', input.email)
4
+ if (input?.after) params.set('after', String(input.after))
5
+ if (input?.limit) params.set('limit', String(input.limit))
6
+ if (typeof input?.archived === 'boolean') params.set('archived', String(input.archived))
7
+
8
+ const suffix = params.toString() ? `?${params.toString()}` : ''
9
+ const res = await integration.fetch(`/crm/v3/owners/${suffix}`)
10
+ return await res.json()
11
+ }
12
+
@@ -0,0 +1,5 @@
1
+ async (input) => {
2
+ const res = await integration.fetch(`/crm/v3/pipelines/${encodeURIComponent(input.objectType)}`)
3
+ return await res.json()
4
+ }
5
+
@@ -0,0 +1,11 @@
1
+ async (input) => {
2
+ const params = new URLSearchParams()
3
+ if (typeof input.archived === 'boolean') params.set('archived', String(input.archived))
4
+
5
+ const suffix = params.toString() ? `?${params.toString()}` : ''
6
+ const res = await integration.fetch(
7
+ `/crm/v3/properties/${encodeURIComponent(input.objectType)}${suffix}`
8
+ )
9
+ return await res.json()
10
+ }
11
+
@@ -0,0 +1,22 @@
1
+ async (input) => {
2
+ const body = {
3
+ inputs: [
4
+ {
5
+ from: { id: String(input.fromObjectId) },
6
+ to: { id: String(input.toObjectId) },
7
+ },
8
+ ],
9
+ }
10
+
11
+ const res = await integration.fetch(
12
+ `/crm/v4/associations/${encodeURIComponent(input.fromObjectType)}/${encodeURIComponent(
13
+ input.toObjectType
14
+ )}/batch/archive`,
15
+ {
16
+ method: 'POST',
17
+ body,
18
+ }
19
+ )
20
+ return await res.json()
21
+ }
22
+
@@ -0,0 +1,43 @@
1
+ async (input) => {
2
+ const filterGroups = []
3
+ if (Array.isArray(input.filters) && input.filters.length > 0) {
4
+ const filters = input.filters.map((f) => {
5
+ const base = {
6
+ propertyName: f.propertyName,
7
+ operator: f.operator,
8
+ }
9
+
10
+ if (f.operator === 'BETWEEN' && typeof f.value === 'string' && f.value.includes(',')) {
11
+ const [low, high] = f.value.split(',', 2).map((s) => s.trim())
12
+ return { ...base, value: low, highValue: high }
13
+ }
14
+
15
+ if (f.operator === 'HAS_PROPERTY' || f.operator === 'NOT_HAS_PROPERTY') {
16
+ return base
17
+ }
18
+
19
+ if (f.value !== undefined) {
20
+ return { ...base, value: f.value }
21
+ }
22
+
23
+ return base
24
+ })
25
+
26
+ filterGroups.push({ filters })
27
+ }
28
+
29
+ const body = {
30
+ query: input.query,
31
+ filterGroups: filterGroups.length ? filterGroups : undefined,
32
+ properties: input.properties,
33
+ limit: input.limit,
34
+ after: input.after,
35
+ }
36
+
37
+ const res = await integration.fetch(`/crm/v3/objects/companies/search`, {
38
+ method: 'POST',
39
+ body,
40
+ })
41
+ return await res.json()
42
+ }
43
+
@@ -0,0 +1,43 @@
1
+ async (input) => {
2
+ const filterGroups = []
3
+ if (Array.isArray(input.filters) && input.filters.length > 0) {
4
+ const filters = input.filters.map((f) => {
5
+ const base = {
6
+ propertyName: f.propertyName,
7
+ operator: f.operator,
8
+ }
9
+
10
+ if (f.operator === 'BETWEEN' && typeof f.value === 'string' && f.value.includes(',')) {
11
+ const [low, high] = f.value.split(',', 2).map((s) => s.trim())
12
+ return { ...base, value: low, highValue: high }
13
+ }
14
+
15
+ if (f.operator === 'HAS_PROPERTY' || f.operator === 'NOT_HAS_PROPERTY') {
16
+ return base
17
+ }
18
+
19
+ if (f.value !== undefined) {
20
+ return { ...base, value: f.value }
21
+ }
22
+
23
+ return base
24
+ })
25
+
26
+ filterGroups.push({ filters })
27
+ }
28
+
29
+ const body = {
30
+ query: input.query,
31
+ filterGroups: filterGroups.length ? filterGroups : undefined,
32
+ properties: input.properties,
33
+ limit: input.limit,
34
+ after: input.after,
35
+ }
36
+
37
+ const res = await integration.fetch(`/crm/v3/objects/contacts/search`, {
38
+ method: 'POST',
39
+ body,
40
+ })
41
+ return await res.json()
42
+ }
43
+
@@ -0,0 +1,43 @@
1
+ async (input) => {
2
+ const filterGroups = []
3
+ if (Array.isArray(input.filters) && input.filters.length > 0) {
4
+ const filters = input.filters.map((f) => {
5
+ const base = {
6
+ propertyName: f.propertyName,
7
+ operator: f.operator,
8
+ }
9
+
10
+ if (f.operator === 'BETWEEN' && typeof f.value === 'string' && f.value.includes(',')) {
11
+ const [low, high] = f.value.split(',', 2).map((s) => s.trim())
12
+ return { ...base, value: low, highValue: high }
13
+ }
14
+
15
+ if (f.operator === 'HAS_PROPERTY' || f.operator === 'NOT_HAS_PROPERTY') {
16
+ return base
17
+ }
18
+
19
+ if (f.value !== undefined) {
20
+ return { ...base, value: f.value }
21
+ }
22
+
23
+ return base
24
+ })
25
+
26
+ filterGroups.push({ filters })
27
+ }
28
+
29
+ const body = {
30
+ query: input.query,
31
+ filterGroups: filterGroups.length ? filterGroups : undefined,
32
+ properties: input.properties,
33
+ limit: input.limit,
34
+ after: input.after,
35
+ }
36
+
37
+ const res = await integration.fetch(`/crm/v3/objects/deals/search`, {
38
+ method: 'POST',
39
+ body,
40
+ })
41
+ return await res.json()
42
+ }
43
+
@@ -0,0 +1,43 @@
1
+ async (input) => {
2
+ const filterGroups = []
3
+ if (Array.isArray(input.filters) && input.filters.length > 0) {
4
+ const filters = input.filters.map((f) => {
5
+ const base = {
6
+ propertyName: f.propertyName,
7
+ operator: f.operator,
8
+ }
9
+
10
+ if (f.operator === 'BETWEEN' && typeof f.value === 'string' && f.value.includes(',')) {
11
+ const [low, high] = f.value.split(',', 2).map((s) => s.trim())
12
+ return { ...base, value: low, highValue: high }
13
+ }
14
+
15
+ if (f.operator === 'HAS_PROPERTY' || f.operator === 'NOT_HAS_PROPERTY') {
16
+ return base
17
+ }
18
+
19
+ if (f.value !== undefined) {
20
+ return { ...base, value: f.value }
21
+ }
22
+
23
+ return base
24
+ })
25
+
26
+ filterGroups.push({ filters })
27
+ }
28
+
29
+ const body = {
30
+ query: input.query,
31
+ filterGroups: filterGroups.length ? filterGroups : undefined,
32
+ properties: input.properties,
33
+ limit: input.limit,
34
+ after: input.after,
35
+ }
36
+
37
+ const res = await integration.fetch(`/crm/v3/objects/notes/search`, {
38
+ method: 'POST',
39
+ body,
40
+ })
41
+ return await res.json()
42
+ }
43
+
@@ -0,0 +1,43 @@
1
+ async (input) => {
2
+ const filterGroups = []
3
+ if (Array.isArray(input.filters) && input.filters.length > 0) {
4
+ const filters = input.filters.map((f) => {
5
+ const base = {
6
+ propertyName: f.propertyName,
7
+ operator: f.operator,
8
+ }
9
+
10
+ if (f.operator === 'BETWEEN' && typeof f.value === 'string' && f.value.includes(',')) {
11
+ const [low, high] = f.value.split(',', 2).map((s) => s.trim())
12
+ return { ...base, value: low, highValue: high }
13
+ }
14
+
15
+ if (f.operator === 'HAS_PROPERTY' || f.operator === 'NOT_HAS_PROPERTY') {
16
+ return base
17
+ }
18
+
19
+ if (f.value !== undefined) {
20
+ return { ...base, value: f.value }
21
+ }
22
+
23
+ return base
24
+ })
25
+
26
+ filterGroups.push({ filters })
27
+ }
28
+
29
+ const body = {
30
+ query: input.query,
31
+ filterGroups: filterGroups.length ? filterGroups : undefined,
32
+ properties: input.properties,
33
+ limit: input.limit,
34
+ after: input.after,
35
+ }
36
+
37
+ const res = await integration.fetch(`/crm/v3/objects/tasks/search`, {
38
+ method: 'POST',
39
+ body,
40
+ })
41
+ return await res.json()
42
+ }
43
+
@@ -0,0 +1,43 @@
1
+ async (input) => {
2
+ const filterGroups = []
3
+ if (Array.isArray(input.filters) && input.filters.length > 0) {
4
+ const filters = input.filters.map((f) => {
5
+ const base = {
6
+ propertyName: f.propertyName,
7
+ operator: f.operator,
8
+ }
9
+
10
+ if (f.operator === 'BETWEEN' && typeof f.value === 'string' && f.value.includes(',')) {
11
+ const [low, high] = f.value.split(',', 2).map((s) => s.trim())
12
+ return { ...base, value: low, highValue: high }
13
+ }
14
+
15
+ if (f.operator === 'HAS_PROPERTY' || f.operator === 'NOT_HAS_PROPERTY') {
16
+ return base
17
+ }
18
+
19
+ if (f.value !== undefined) {
20
+ return { ...base, value: f.value }
21
+ }
22
+
23
+ return base
24
+ })
25
+
26
+ filterGroups.push({ filters })
27
+ }
28
+
29
+ const body = {
30
+ query: input.query,
31
+ filterGroups: filterGroups.length ? filterGroups : undefined,
32
+ properties: input.properties,
33
+ limit: input.limit,
34
+ after: input.after,
35
+ }
36
+
37
+ const res = await integration.fetch(`/crm/v3/objects/tickets/search`, {
38
+ method: 'POST',
39
+ body,
40
+ })
41
+ return await res.json()
42
+ }
43
+
@@ -0,0 +1,13 @@
1
+ async (input) => {
2
+ const props = { ...(input.properties || {}) }
3
+ if (input.name !== undefined) props.name = input.name
4
+ if (input.domain !== undefined) props.domain = input.domain
5
+
6
+ const body = { properties: props }
7
+ const res = await integration.fetch(`/crm/v3/objects/companies/${encodeURIComponent(input.id)}`, {
8
+ method: 'PATCH',
9
+ body,
10
+ })
11
+ return await res.json()
12
+ }
13
+
@@ -0,0 +1,14 @@
1
+ async (input) => {
2
+ const props = { ...(input.properties || {}) }
3
+ if (input.firstname !== undefined) props.firstname = input.firstname
4
+ if (input.lastname !== undefined) props.lastname = input.lastname
5
+ if (input.email !== undefined) props.email = input.email
6
+
7
+ const body = { properties: props }
8
+ const res = await integration.fetch(`/crm/v3/objects/contacts/${encodeURIComponent(input.id)}`, {
9
+ method: 'PATCH',
10
+ body,
11
+ })
12
+ return await res.json()
13
+ }
14
+
@@ -0,0 +1,16 @@
1
+ async (input) => {
2
+ const props = { ...(input.properties || {}) }
3
+ if (input.dealname !== undefined) props.dealname = input.dealname
4
+ if (input.amount !== undefined) props.amount = String(input.amount)
5
+ if (input.pipeline !== undefined) props.pipeline = input.pipeline
6
+ if (input.dealstage !== undefined) props.dealstage = input.dealstage
7
+ if (input.closedate !== undefined) props.closedate = String(input.closedate)
8
+
9
+ const body = { properties: props }
10
+ const res = await integration.fetch(`/crm/v3/objects/deals/${encodeURIComponent(input.id)}`, {
11
+ method: 'PATCH',
12
+ body,
13
+ })
14
+ return await res.json()
15
+ }
16
+
@@ -0,0 +1,17 @@
1
+ async (input) => {
2
+ const props = { ...(input.properties || {}) }
3
+
4
+ if (input.subject !== undefined) props.hs_task_subject = input.subject
5
+ if (input.body !== undefined) props.hs_task_body = input.body
6
+ if (input.status !== undefined) props.hs_task_status = input.status
7
+ if (input.priority !== undefined) props.hs_task_priority = input.priority
8
+ if (input.dueTimestamp !== undefined) props.hs_timestamp = String(input.dueTimestamp)
9
+ if (input.hubspot_owner_id !== undefined) props.hubspot_owner_id = String(input.hubspot_owner_id)
10
+
11
+ const res = await integration.fetch(`/crm/v3/objects/tasks/${encodeURIComponent(input.id)}`, {
12
+ method: 'PATCH',
13
+ body: { properties: props },
14
+ })
15
+ return await res.json()
16
+ }
17
+
@@ -0,0 +1,15 @@
1
+ async (input) => {
2
+ const props = { ...(input.properties || {}) }
3
+ if (input.subject !== undefined) props.subject = input.subject
4
+ if (input.content !== undefined) props.content = input.content
5
+ if (input.hs_pipeline !== undefined) props.hs_pipeline = input.hs_pipeline
6
+ if (input.hs_pipeline_stage !== undefined) props.hs_pipeline_stage = input.hs_pipeline_stage
7
+
8
+ const body = { properties: props }
9
+ const res = await integration.fetch(`/crm/v3/objects/tickets/${encodeURIComponent(input.id)}`, {
10
+ method: 'PATCH',
11
+ body,
12
+ })
13
+ return await res.json()
14
+ }
15
+