@zackbart/connecta 0.34.1 → 0.35.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 (429) hide show
  1. package/CHANGELOG.md +363 -0
  2. package/README.md +62 -106
  3. package/SECURITY.md +3 -2
  4. package/bin/connecta.mjs +41 -16
  5. package/bin/version.mjs +1 -1
  6. package/dist/access-tokens.d.ts +2 -1
  7. package/dist/access-tokens.js +66 -30
  8. package/dist/activity.d.ts +1 -1
  9. package/dist/activity.js +2 -0
  10. package/dist/agent-config.d.ts +23 -0
  11. package/dist/agent-config.js +59 -0
  12. package/dist/agent-description.js +16 -0
  13. package/dist/agent-identity.js +4 -4
  14. package/dist/agent-observation.js +39 -0
  15. package/dist/auth/clerk-sdk/client.d.ts +2 -0
  16. package/dist/auth/clerk-sdk/generated.js +554 -563
  17. package/dist/auth/clerk-transport.js +70 -3
  18. package/dist/auth/clerk.d.ts +13 -0
  19. package/dist/auth/clerk.js +653 -246
  20. package/dist/auth/cloudflare-access.js +46 -42
  21. package/dist/auth/downstream-client-metadata.js +2 -2
  22. package/dist/auth/downstream-oauth.js +2051 -1160
  23. package/dist/auth/downstream-revocation.js +88 -88
  24. package/dist/auth/native-call.js +20 -0
  25. package/dist/auth/native.js +184 -0
  26. package/dist/auth/oauth-start-reset.js +11 -5
  27. package/dist/auth/oauth-token-response.js +121 -102
  28. package/dist/auth/oauth-v2-migration.js +97 -78
  29. package/dist/auth/renewable-grant.js +10 -0
  30. package/dist/auth/static-oauth.js +663 -271
  31. package/dist/auth/vercel-agent.js +266 -0
  32. package/dist/auth-admission.js +204 -0
  33. package/dist/auth-elicitation.js +350 -241
  34. package/dist/authorization-handoff.js +164 -90
  35. package/dist/call-admission-context.js +3 -10
  36. package/dist/call-admission.js +2 -0
  37. package/dist/call-classification.js +9 -0
  38. package/dist/call-recovery.js +32 -13
  39. package/dist/canonical-json.js +8 -0
  40. package/dist/catalog-cache.js +369 -213
  41. package/dist/catalog-service.js +659 -530
  42. package/dist/catalog.js +5 -1
  43. package/dist/concurrency.js +0 -25
  44. package/dist/config-defaults.d.ts +1 -0
  45. package/dist/config-defaults.js +1 -0
  46. package/dist/config-schema.d.ts +3 -1
  47. package/dist/config-schema.js +13 -3
  48. package/dist/config.d.ts +40 -6
  49. package/dist/config.js +40 -26
  50. package/dist/connector-caller.d.ts +4 -0
  51. package/dist/connector-caller.js +17 -4
  52. package/dist/connectors/api-connector.d.ts +12 -7
  53. package/dist/connectors/api-connector.js +142 -56
  54. package/dist/connectors/guarded-fetch.d.ts +51 -17
  55. package/dist/connectors/guarded-fetch.js +215 -121
  56. package/dist/connectors/negotiation-cache.js +20 -10
  57. package/dist/connectors/remote-mcp.d.ts +10 -30
  58. package/dist/connectors/remote-mcp.js +955 -563
  59. package/dist/d1.js +10 -243
  60. package/dist/derived-context.js +5 -0
  61. package/dist/describe-config.d.ts +3 -1
  62. package/dist/describe-config.js +2 -0
  63. package/dist/downstream-input.js +347 -260
  64. package/dist/errors.d.ts +87 -6
  65. package/dist/errors.js +114 -4
  66. package/dist/execute.js +87 -50
  67. package/dist/executor-admission.js +3 -0
  68. package/dist/executors/quickjs.js +163 -112
  69. package/dist/guarded-transport.js +50 -0
  70. package/dist/guest-runtime.js +1 -1
  71. package/dist/http/client.js +439 -0
  72. package/dist/http/errors.js +558 -0
  73. package/dist/http/fields.js +49 -0
  74. package/dist/http/hatch-paging.js +318 -0
  75. package/dist/http/hatch.js +1279 -0
  76. package/dist/http/json-schema.js +267 -0
  77. package/dist/http/node-transport.js +241 -0
  78. package/dist/http/oauth.js +162 -0
  79. package/dist/http/paging.js +228 -0
  80. package/dist/http/provider.js +221 -0
  81. package/dist/http/safety.js +82 -0
  82. package/dist/http/services.js +79 -0
  83. package/dist/http/tools.js +383 -0
  84. package/dist/http/vendor-index.js +138 -0
  85. package/dist/http/vendor.js +448 -0
  86. package/dist/http/write-request.js +66 -0
  87. package/dist/http-policy.d.ts +11 -0
  88. package/dist/http-policy.js +45 -0
  89. package/dist/inbound-credential.js +1 -1
  90. package/dist/index.d.ts +2 -2
  91. package/dist/index.js +4 -0
  92. package/dist/invocation-auth.js +30 -19
  93. package/dist/invocation.js +218 -85
  94. package/dist/mcp-result.js +0 -4
  95. package/dist/membership.d.ts +4 -0
  96. package/dist/meta-output.js +1 -1
  97. package/dist/meta-tools.js +531 -406
  98. package/dist/native-recovery.js +52 -0
  99. package/dist/native-tools.js +382 -0
  100. package/dist/node.d.ts +4 -3
  101. package/dist/node.js +45 -8
  102. package/dist/oauth-handoff.js +177 -104
  103. package/dist/oauth-partition.js +6 -20
  104. package/dist/oauth-sealing.js +6 -7
  105. package/dist/operation-vocabulary.js +101 -0
  106. package/dist/operator-record.d.ts +2 -2
  107. package/dist/operator-record.js +17 -4
  108. package/dist/operator-ui/agents.d.ts +5 -4
  109. package/dist/operator-ui/agents.js +17 -7
  110. package/dist/operator-ui/config-summary.js +5 -4
  111. package/dist/operator-ui/connection-map.js +7 -5
  112. package/dist/operator-ui/contract.d.ts +7 -3
  113. package/dist/operator-ui/endpoints.js +4 -13
  114. package/dist/operator-ui/fix-prompts.d.ts +1 -1
  115. package/dist/operator-ui/fix-prompts.js +0 -8
  116. package/dist/operator-ui/generated.js +3 -3
  117. package/dist/operator-ui/model.d.ts +2 -3
  118. package/dist/operator-ui/overview.js +5 -2
  119. package/dist/operator-ui/setup-commands.js +0 -4
  120. package/dist/operator-ui/view.d.ts +2 -25
  121. package/dist/operator-ui/view.js +2 -76
  122. package/dist/program-writes.js +47 -26
  123. package/dist/provider-call-facts.d.ts +115 -0
  124. package/dist/provider-call-facts.js +182 -0
  125. package/dist/provider-call.d.ts +112 -0
  126. package/dist/provider-call.js +271 -0
  127. package/dist/provider.d.ts +65 -31
  128. package/dist/provider.js +116 -39
  129. package/dist/providers/_shared/google/hatch.js +91 -0
  130. package/dist/providers/_shared/google/kit.js +537 -0
  131. package/dist/providers/_shared/google/result-size.js +15 -2
  132. package/dist/providers/_shared/google/service-account.d.ts +2 -1
  133. package/dist/providers/_shared/google/service-account.js +8 -4
  134. package/dist/providers/_shared/google/workspace.d.ts +6 -210
  135. package/dist/providers/_shared/google/workspace.js +6 -425
  136. package/dist/providers/_shared/rest/compact-index.js +86 -0
  137. package/dist/providers/_shared/rest/dispatch.js +3 -23
  138. package/dist/providers/_shared/rest/kit.js +546 -0
  139. package/dist/providers/_shared/rest/operation-index.js +230 -14
  140. package/dist/providers/_shared/rest/response-media.js +11 -0
  141. package/dist/providers/_shared/rest/tools.js +101 -78
  142. package/dist/providers/_shared/rest/value-safety.js +353 -195
  143. package/dist/providers/_shared/sensitive-fields.js +27 -0
  144. package/dist/providers/breeze/api.js +584 -0
  145. package/dist/providers/breeze/index.d.ts +1 -3
  146. package/dist/providers/breeze/index.js +67 -1420
  147. package/dist/providers/breeze/openapi.generated.js +60 -0
  148. package/dist/providers/breeze/skill.generated.js +2 -6
  149. package/dist/providers/breeze/tools.js +696 -0
  150. package/dist/providers/ccb/api.js +496 -0
  151. package/dist/providers/ccb/index.d.ts +15 -37
  152. package/dist/providers/ccb/index.js +77 -1702
  153. package/dist/providers/ccb/lib/constants.d.ts +34 -0
  154. package/dist/providers/ccb/lib/constants.js +74 -0
  155. package/dist/providers/ccb/lib/guide.js +9 -0
  156. package/dist/providers/ccb/lib/verdicts.js +387 -0
  157. package/dist/providers/ccb/openapi.generated.js +397 -0
  158. package/dist/providers/ccb/safety.js +295 -0
  159. package/dist/providers/ccb/skill.generated.js +2 -6
  160. package/dist/providers/ccb/tools.js +853 -0
  161. package/dist/providers/cloudflare/api.js +1066 -0
  162. package/dist/providers/cloudflare/index.d.ts +5 -22
  163. package/dist/providers/cloudflare/index.js +79 -197
  164. package/dist/providers/cloudflare/lib/config.d.ts +16 -0
  165. package/dist/providers/cloudflare/lib/config.js +2 -0
  166. package/dist/providers/cloudflare/lib/discovery.js +29 -0
  167. package/dist/providers/cloudflare/{graphql.js → lib/graphql.js} +1 -1
  168. package/dist/providers/cloudflare/lib/hatch.js +103 -0
  169. package/dist/providers/cloudflare/lib/path-bounds.js +28 -0
  170. package/dist/providers/cloudflare/lib/response-media.js +75 -0
  171. package/dist/providers/cloudflare/openapi.generated.js +4 -3
  172. package/dist/providers/cloudflare/{value-safety.js → safety.js} +487 -0
  173. package/dist/providers/cloudflare/skill.generated.js +2 -10
  174. package/dist/providers/cloudflare/tools.js +360 -0
  175. package/dist/providers/docs/api.js +51 -0
  176. package/dist/providers/docs/index.d.ts +1 -12
  177. package/dist/providers/docs/index.js +53 -1165
  178. package/dist/providers/docs/lib/constants.d.ts +18 -0
  179. package/dist/providers/docs/lib/constants.js +18 -0
  180. package/dist/providers/docs/lib/discovery.js +26 -0
  181. package/dist/providers/docs/lib/requests.js +48 -0
  182. package/dist/providers/docs/lib/schemas.js +168 -0
  183. package/dist/providers/docs/openapi.generated.js +16 -0
  184. package/dist/providers/docs/safety.js +54 -0
  185. package/dist/providers/docs/skill.generated.js +2 -6
  186. package/dist/providers/docs/tools.js +802 -0
  187. package/dist/providers/drive/api.js +177 -0
  188. package/dist/providers/drive/index.d.ts +1 -12
  189. package/dist/providers/drive/index.js +38 -1448
  190. package/dist/providers/drive/lib/constants.d.ts +6 -0
  191. package/dist/providers/drive/lib/constants.js +6 -0
  192. package/dist/providers/drive/lib/contracts.js +532 -0
  193. package/dist/providers/drive/lib/hatch.js +197 -0
  194. package/dist/providers/drive/openapi.generated.js +77 -0
  195. package/dist/providers/drive/safety.js +90 -0
  196. package/dist/providers/drive/skill.generated.js +2 -6
  197. package/dist/providers/drive/tools.js +1290 -0
  198. package/dist/providers/forms/api.js +71 -0
  199. package/dist/providers/forms/index.d.ts +1 -12
  200. package/dist/providers/forms/index.js +49 -1145
  201. package/dist/providers/forms/lib/constants.d.ts +14 -0
  202. package/dist/providers/forms/lib/constants.js +19 -0
  203. package/dist/providers/forms/lib/hatch.js +72 -0
  204. package/dist/providers/forms/openapi.generated.js +23 -0
  205. package/dist/providers/forms/safety.js +34 -0
  206. package/dist/providers/forms/skill.generated.js +2 -8
  207. package/dist/providers/forms/tools.js +1024 -0
  208. package/dist/providers/github/api.js +150 -0
  209. package/dist/providers/github/index.d.ts +4 -5
  210. package/dist/providers/github/index.js +30 -87
  211. package/dist/providers/github/{auth.d.ts → lib/auth.d.ts} +5 -3
  212. package/dist/providers/github/{auth.js → lib/auth.js} +40 -43
  213. package/dist/providers/github/lib/discovery.js +132 -0
  214. package/dist/providers/github/lib/operations.js +58 -0
  215. package/dist/providers/github/{scope.d.ts → lib/scope.d.ts} +2 -0
  216. package/dist/providers/github/{scope.js → lib/scope.js} +25 -1
  217. package/dist/providers/github/openapi.generated.js +1216 -0
  218. package/dist/providers/github/safety.js +216 -0
  219. package/dist/providers/github/skill.generated.js +2 -5
  220. package/dist/providers/github/tools.js +506 -0
  221. package/dist/providers/gmail/api.js +114 -0
  222. package/dist/providers/gmail/index.d.ts +1 -12
  223. package/dist/providers/gmail/index.js +73 -1621
  224. package/dist/providers/gmail/lib/constants.d.ts +13 -0
  225. package/dist/providers/gmail/lib/constants.js +16 -0
  226. package/dist/providers/gmail/lib/index.js +173 -0
  227. package/dist/providers/gmail/lib/schemas.js +176 -0
  228. package/dist/providers/gmail/lib/threading.js +120 -0
  229. package/dist/providers/gmail/openapi.generated.js +92 -0
  230. package/dist/providers/gmail/safety.js +21 -0
  231. package/dist/providers/gmail/skill.generated.js +2 -6
  232. package/dist/providers/gmail/tools.js +1435 -0
  233. package/dist/providers/overflow/api.js +1008 -0
  234. package/dist/providers/overflow/index.d.ts +1 -17
  235. package/dist/providers/overflow/index.js +60 -1488
  236. package/dist/providers/overflow/skill.generated.js +2 -5
  237. package/dist/providers/overflow/tools.js +873 -0
  238. package/dist/providers/planning-center/api.js +467 -0
  239. package/dist/providers/planning-center/index.d.ts +4 -35
  240. package/dist/providers/planning-center/index.js +69 -2445
  241. package/dist/providers/planning-center/lib/constants.d.ts +58 -0
  242. package/dist/providers/planning-center/lib/constants.js +83 -0
  243. package/dist/providers/planning-center/lib/discovery.js +40 -0
  244. package/dist/providers/planning-center/lib/guide.js +39 -0
  245. package/dist/providers/planning-center/lib/json-api.js +83 -0
  246. package/dist/providers/planning-center/lib/verdicts.js +1758 -0
  247. package/dist/providers/planning-center/openapi.generated.js +1764 -0
  248. package/dist/providers/planning-center/safety.js +188 -0
  249. package/dist/providers/planning-center/skill.generated.js +2 -27
  250. package/dist/providers/planning-center/tools.js +1010 -0
  251. package/dist/providers/sheets/api.js +133 -0
  252. package/dist/providers/sheets/index.d.ts +4 -16
  253. package/dist/providers/sheets/index.js +61 -1172
  254. package/dist/providers/sheets/lib/constants.d.ts +14 -0
  255. package/dist/providers/sheets/lib/constants.js +14 -0
  256. package/dist/providers/sheets/lib/hatch.js +163 -0
  257. package/dist/providers/sheets/lib/requests.js +105 -0
  258. package/dist/providers/sheets/lib/schemas.js +138 -0
  259. package/dist/providers/sheets/openapi.generated.js +30 -0
  260. package/dist/providers/sheets/safety.js +27 -0
  261. package/dist/providers/sheets/skill.generated.js +2 -7
  262. package/dist/providers/sheets/tools.js +734 -0
  263. package/dist/providers/slides/api.js +147 -0
  264. package/dist/providers/slides/index.d.ts +2 -10
  265. package/dist/providers/slides/index.js +48 -2555
  266. package/dist/providers/slides/lib/constants.d.ts +11 -0
  267. package/dist/providers/slides/lib/constants.js +11 -0
  268. package/dist/providers/slides/lib/requests.js +60 -0
  269. package/dist/providers/slides/lib/schemas.js +565 -0
  270. package/dist/providers/slides/openapi.generated.js +18 -0
  271. package/dist/providers/slides/skill.generated.js +2 -6
  272. package/dist/providers/slides/tools.js +1968 -0
  273. package/dist/providers/stripe/api.js +401 -0
  274. package/dist/providers/stripe/index.d.ts +5 -27
  275. package/dist/providers/stripe/index.js +74 -210
  276. package/dist/providers/stripe/lib/config.d.ts +4 -0
  277. package/dist/providers/stripe/lib/config.js +2 -0
  278. package/dist/providers/stripe/openapi.generated.js +4 -3
  279. package/dist/providers/stripe/{value-safety.js → safety.js} +5 -5
  280. package/dist/providers/stripe/skill.generated.js +2 -11
  281. package/dist/providers/stripe/tools.js +77 -0
  282. package/dist/providers/tithely/api.js +531 -0
  283. package/dist/providers/tithely/index.d.ts +17 -0
  284. package/dist/providers/tithely/index.js +86 -965
  285. package/dist/providers/tithely/skill.generated.js +2 -5
  286. package/dist/providers/tithely/tools.js +426 -0
  287. package/dist/providers/vercel/api.js +551 -0
  288. package/dist/providers/vercel/index.d.ts +9 -25
  289. package/dist/providers/vercel/index.js +66 -260
  290. package/dist/providers/vercel/lib/config.d.ts +2 -0
  291. package/dist/providers/vercel/lib/config.js +2 -0
  292. package/dist/providers/vercel/lib/index.js +117 -0
  293. package/dist/providers/vercel/lib/logs.js +100 -0
  294. package/dist/providers/vercel/lib/pin.js +270 -0
  295. package/dist/providers/vercel/openapi.generated.js +10 -5
  296. package/dist/providers/vercel/{value-safety.js → safety.js} +247 -38
  297. package/dist/providers/vercel/skill.generated.js +2 -7
  298. package/dist/providers/vercel/tools.js +642 -0
  299. package/dist/redaction-identity.js +47 -0
  300. package/dist/redaction-marker.js +125 -0
  301. package/dist/registry.d.ts +21 -15
  302. package/dist/registry.js +409 -376
  303. package/dist/routes/access-tokens.js +1 -1
  304. package/dist/routes/actor-labels.js +1 -1
  305. package/dist/routes/connect.js +1 -1
  306. package/dist/routes/dispatch.js +103 -0
  307. package/dist/routes/mcp.js +170 -79
  308. package/dist/routes/oauth.js +3 -1
  309. package/dist/routes/operator.js +2 -2
  310. package/dist/routes/shared.d.ts +5 -4
  311. package/dist/routes/shared.js +244 -177
  312. package/dist/routes/skills.js +10 -8
  313. package/dist/routes/ui-config.js +27 -3
  314. package/dist/routes/ui-data.js +21 -20
  315. package/dist/routes/ui.js +1 -1
  316. package/dist/runtime/call-admission.js +0 -26
  317. package/dist/runtime/call-entry.js +30 -0
  318. package/dist/runtime/call.js +556 -0
  319. package/dist/runtime/connector-scope.js +7 -0
  320. package/dist/runtime/credential-probe.js +34 -0
  321. package/dist/runtime/executor.js +40 -0
  322. package/dist/runtime/native-storage.js +63 -0
  323. package/dist/runtime/registry.js +27 -0
  324. package/dist/runtime/request-scope.js +72 -0
  325. package/dist/runtime/run.js +15 -7
  326. package/dist/runtime/shared-read.js +34 -5
  327. package/dist/runtime/storage.js +34 -21
  328. package/dist/sent-secrets.d.ts +194 -37
  329. package/dist/sent-secrets.js +1743 -340
  330. package/dist/server.js +5 -56
  331. package/dist/skills.js +322 -222
  332. package/dist/sqlite.js +15 -14
  333. package/dist/storage/d1-copy.js +255 -0
  334. package/dist/storage/d1-driver.js +15 -0
  335. package/dist/storage/keys.js +28 -0
  336. package/dist/storage/sql-driver.js +88 -0
  337. package/dist/storage/sql-native.js +544 -0
  338. package/dist/storage/sql-schema.d.ts +6 -0
  339. package/dist/storage/sql-schema.js +15 -0
  340. package/dist/storage/sql.d.ts +14 -20
  341. package/dist/storage/sql.js +29 -535
  342. package/dist/timeout.js +0 -26
  343. package/dist/tool-safety.js +20 -10
  344. package/dist/types.d.ts +7 -109
  345. package/dist/upward.js +3 -0
  346. package/dist/usage-guide.js +3 -1
  347. package/dist/validate.d.ts +4 -2
  348. package/dist/validate.js +86 -9
  349. package/dist/version.d.ts +1 -1
  350. package/dist/version.js +1 -1
  351. package/dist/worker.js +312 -292
  352. package/dist/workspace-subject.js +5 -1
  353. package/dist/write-outcome.js +454 -34
  354. package/documentation/README.md +27 -7
  355. package/documentation/architecture.md +2547 -226
  356. package/documentation/auth.md +821 -98
  357. package/documentation/code-mode.md +49 -16
  358. package/documentation/deploying.md +164 -20
  359. package/documentation/hosted-mcp-migration.md +460 -0
  360. package/documentation/integrating.md +129 -144
  361. package/documentation/meta-tools.md +409 -32
  362. package/documentation/operating.md +27 -3
  363. package/documentation/operator-tests.md +3 -0
  364. package/documentation/operator-ui.md +68 -45
  365. package/documentation/provider-auth-migration.md +16 -63
  366. package/documentation/provider-migration-0.29.md +10 -5
  367. package/documentation/provider-migration-0.35.md +975 -0
  368. package/documentation/providers.md +965 -0
  369. package/examples/worker/AGENTS.md +23 -9
  370. package/examples/worker/README.md +254 -135
  371. package/examples/worker/alchemy.run.ts +116 -0
  372. package/examples/worker/gitignore +10 -0
  373. package/examples/worker/src/connecta.config.ts +23 -21
  374. package/examples/worker/wrangler.jsonc +14 -5
  375. package/guides/connecting-agents.md +157 -0
  376. package/guides/how-it-works.md +156 -0
  377. package/guides/safety-and-trust.md +153 -0
  378. package/package.json +27 -46
  379. package/templates/node/.env.example +3 -0
  380. package/templates/node/README.md +22 -2
  381. package/templates/node/docker-compose.yml +1 -0
  382. package/templates/node/package.json +3 -2
  383. package/templates/node/src/connecta.config.ts +8 -0
  384. package/dist/catalog-drift.d.ts +0 -138
  385. package/dist/catalog-drift.js +0 -578
  386. package/dist/providers/_shared/request-token.js +0 -83
  387. package/dist/providers/_shared/rest/operation-index.d.ts +0 -133
  388. package/dist/providers/_shared/rest/tools.d.ts +0 -141
  389. package/dist/providers/_shared/rest/value-safety.d.ts +0 -201
  390. package/dist/providers/basecamp/index.d.ts +0 -45
  391. package/dist/providers/basecamp/index.js +0 -997
  392. package/dist/providers/basecamp/skill.generated.js +0 -9
  393. package/dist/providers/cloudflare/rest.d.ts +0 -37
  394. package/dist/providers/cloudflare/rest.js +0 -1097
  395. package/dist/providers/github/hosted.js +0 -218
  396. package/dist/providers/github/rest.js +0 -321
  397. package/dist/providers/infisical/index.d.ts +0 -7
  398. package/dist/providers/infisical/index.js +0 -713
  399. package/dist/providers/infisical/skill.generated.js +0 -8
  400. package/dist/providers/intercom/index.d.ts +0 -24
  401. package/dist/providers/intercom/index.js +0 -121
  402. package/dist/providers/intercom/skill.generated.js +0 -8
  403. package/dist/providers/linear/index.d.ts +0 -55
  404. package/dist/providers/linear/index.js +0 -537
  405. package/dist/providers/linear/skill.generated.js +0 -8
  406. package/dist/providers/mixpanel/index.d.ts +0 -59
  407. package/dist/providers/mixpanel/index.js +0 -472
  408. package/dist/providers/mixpanel/operations.js +0 -20
  409. package/dist/providers/mixpanel/rest.js +0 -603
  410. package/dist/providers/mixpanel/skill.generated.js +0 -10
  411. package/dist/providers/mixpanel/value-safety.js +0 -16
  412. package/dist/providers/notion/index.d.ts +0 -67
  413. package/dist/providers/notion/index.js +0 -368
  414. package/dist/providers/notion/openapi.generated.js +0 -75
  415. package/dist/providers/notion/rest.d.ts +0 -24
  416. package/dist/providers/notion/rest.js +0 -1226
  417. package/dist/providers/notion/skill.generated.js +0 -11
  418. package/dist/providers/notion/value-safety.js +0 -56
  419. package/dist/providers/revenuecat/index.d.ts +0 -51
  420. package/dist/providers/revenuecat/index.js +0 -697
  421. package/dist/providers/revenuecat/skill.generated.js +0 -11
  422. package/dist/providers/stripe/rest.d.ts +0 -14
  423. package/dist/providers/stripe/rest.js +0 -402
  424. package/dist/providers/vercel/rest.d.ts +0 -20
  425. package/dist/providers/vercel/rest.js +0 -1020
  426. package/dist/providers/wispr-flow/index.d.ts +0 -14
  427. package/dist/providers/wispr-flow/index.js +0 -117
  428. package/dist/providers/wispr-flow/skill.generated.js +0 -8
  429. /package/dist/providers/github/{key.js → lib/key.js} +0 -0
@@ -0,0 +1,1008 @@
1
+ // Overflow v3: reviewed vendor declarations, derived operation index and paging contracts.
2
+ // Public input: staging OpenAPI 3.0; exact retrieval and known upstream drift are in evidence/review.md.
3
+ import { Effect, Schema } from "effect";
4
+ import { ConnectorCallError } from "../../errors.js";
5
+ import { Refusal, UnreadableBody } from "../../http/errors.js";
6
+ import { Integer, isMinChars, isMaxChars } from "../../http/json-schema.js";
7
+ import { Credentials } from "../../http/services.js";
8
+ import { get, post, patch, del, Summary, vendor } from "../../http/vendor.js";
9
+ import { vendorIndex } from "../../http/vendor-index.js";
10
+ export const DEFAULT_PAGE_SIZE = 25;
11
+ export const MAX_PAGE_SIZE = 100;
12
+ export const OVERFLOW_MAX_RESPONSE_BYTES = 4 * 1024 * 1024;
13
+ const RATE_LIMIT_WINDOW_MS = 60_000;
14
+ // Success properties are optional metadata for discovery and fields admission, not runtime response decoders.
15
+ const response = (names, nested = {}) => Schema.Struct({
16
+ ...Object.fromEntries(names
17
+ .split(" ")
18
+ .filter(Boolean)
19
+ .map((name) => [name, Schema.optionalKey(Schema.Unknown)])),
20
+ ...Object.fromEntries(Object.entries(nested).map(([name, schema]) => [name, Schema.optionalKey(schema)])),
21
+ });
22
+ const ResponseRecord1 = response("quantity tickers", { "tickers": Schema.Array(Schema.Unknown) });
23
+ const ResponseRecord2 = response("quantity token");
24
+ const ResponseRecord3 = response("type last4 logoUrl");
25
+ const ResponseRecord4 = response("id name");
26
+ const ResponseRecord5 = response("city country line1 line2 state timezone zip");
27
+ const ResponseRecord6 = response("id createdAt updatedAt firstName lastName email phone address activeRecurringCount latestContributionDate locationIds totalContributionsCount", { "address": ResponseRecord5, "locationIds": Schema.Array(Schema.Unknown) });
28
+ const ResponseRecord7 = response("id createdAt updatedAt type amount donorCoveredFees contributionDate contributionReceivedAt liquidationInitiatedAt receivedTokensAt status stocks crypto subscriptionId frequency paymentMethod depositId campaign subcampaign dedication donorNotes anonymous locationId donor givingLinkId pledgeId metadata", {
29
+ "stocks": ResponseRecord1,
30
+ "crypto": ResponseRecord2,
31
+ "paymentMethod": ResponseRecord3,
32
+ "campaign": ResponseRecord4,
33
+ "subcampaign": ResponseRecord4,
34
+ "donor": ResponseRecord6,
35
+ });
36
+ const ResponseRecord8 = response("data", { "data": ResponseRecord7 });
37
+ const ResponseRecord9 = response("data totalCount", { "data": Schema.Array(ResponseRecord7) });
38
+ const ResponseRecord10 = response("type grossValueInCents grossFeeValueInCents referenceId description");
39
+ const ResponseRecord11 = response("id status type amountInCents arrivalAt startingBalanceInCents endingBalanceInCents bankName bankLast4 statementDescriptor paymentMethodType name reconciledAt createdAt updatedAt lineItems", { "paymentMethodType": Schema.Array(Schema.Unknown), "lineItems": Schema.Array(ResponseRecord10) });
40
+ const ResponseRecord12 = response("data totalCount", { "data": Schema.Array(ResponseRecord11) });
41
+ const ResponseRecord13 = response("data", { "data": ResponseRecord11 });
42
+ const ResponseRecord14 = response("count feesInCents grossInCents totalInCents");
43
+ const ResponseRecord15 = response("contributions refunds chargebacks adjustments", {
44
+ "contributions": ResponseRecord14,
45
+ "refunds": ResponseRecord14,
46
+ "chargebacks": ResponseRecord14,
47
+ "adjustments": ResponseRecord14,
48
+ });
49
+ const ResponseRecord16 = response("data", { "data": ResponseRecord15 });
50
+ const ResponseRecord17 = response("id contributionId status reason amountInCents netValueInCents feeValueInCents processorRefundId depositId createdAt updatedAt");
51
+ const ResponseRecord18 = response("data totalCount", { "data": Schema.Array(ResponseRecord17) });
52
+ const ResponseRecord19 = response("data", { "data": ResponseRecord17 });
53
+ const ResponseRecord20 = response("id contributionId status type amountInCents netValueInCents feeValueInCents processorChargebackId reason depositId createdAt updatedAt");
54
+ const ResponseRecord21 = response("data totalCount", { "data": Schema.Array(ResponseRecord20) });
55
+ const ResponseRecord22 = response("data", { "data": ResponseRecord20 });
56
+ const ResponseRecord23 = response("id name description destinationUrl enabledEvents status createdAt updatedAt", {
57
+ "enabledEvents": Schema.Array(Schema.Unknown),
58
+ });
59
+ const ResponseRecord24 = response("data totalCount", { "data": Schema.Array(ResponseRecord23) });
60
+ const ResponseRecord25 = response("data", { "data": ResponseRecord23 });
61
+ const ResponseRecord26 = response("url body");
62
+ const ResponseRecord27 = response("code body durationMs errorMessage");
63
+ const ResponseRecord28 = response("id eventId webhookEventName subscriptionId status attemptNumber deliverySource originatedAt attemptedAt request response", { "request": ResponseRecord26, "response": ResponseRecord27 });
64
+ const ResponseRecord29 = response("hasNextPage nextCursor");
65
+ const ResponseRecord30 = response("data pageInfo", {
66
+ "data": Schema.Array(ResponseRecord28),
67
+ "pageInfo": ResponseRecord29,
68
+ });
69
+ const ResponseRecord31 = response("data totalCount", { "data": Schema.Array(ResponseRecord6) });
70
+ const ResponseRecord32 = response("data");
71
+ const ResponseRecord33 = response("data", { "data": ResponseRecord6 });
72
+ const ResponseRecord34 = response("id holderName type last4 expiration");
73
+ const ResponseRecord35 = response("id donorId createdAt updatedAt startDate status amount donorCoveredFees anonymous frequency nextPaymentDate paymentMethod campaign subcampaign metadata locationId", { "paymentMethod": ResponseRecord34, "campaign": ResponseRecord4, "subcampaign": ResponseRecord4 });
74
+ const ResponseRecord36 = response("data", { "data": ResponseRecord35 });
75
+ const ResponseRecord37 = response("data totalCount", { "data": Schema.Array(ResponseRecord35) });
76
+ const ResponseRecord38 = response("id holderName last4 type expirationDate isExpired updatedAt");
77
+ const ResponseRecord39 = response("data", { "data": Schema.Array(ResponseRecord38) });
78
+ const ResponseRecord40 = response("id archivedAt createdAt updatedAt name isSubcampaign startDate endDate status displayOrder hideFromDonors isActive locationIds parentCampaigns subcampaigns applyToAllCampaigns totalContributionCount totalContributionValue uniqueDonorCount", {
79
+ "locationIds": Schema.Array(Schema.Unknown),
80
+ "parentCampaigns": Schema.Array(ResponseRecord4),
81
+ "subcampaigns": Schema.Array(ResponseRecord4),
82
+ });
83
+ const ResponseRecord41 = response("data totalCount", { "data": Schema.Array(ResponseRecord40) });
84
+ const ResponseRecord42 = response("data", { "data": ResponseRecord40 });
85
+ const ResponseRecord43 = response("id createdAt updatedAt archivedAt name hideFromDonors isDefaultLocation");
86
+ const ResponseRecord44 = response("data totalCount", { "data": Schema.Array(ResponseRecord43) });
87
+ const ResponseRecord45 = response("data", { "data": ResponseRecord43 });
88
+ const ResponseRecord46 = response("month year");
89
+ const ResponseRecord47 = response("brand last4 expiration fundingSource", { "expiration": ResponseRecord46 });
90
+ const ResponseRecord48 = response("donorId contributionId paymentMethodId paymentMethod subscriptionId", {
91
+ "paymentMethod": ResponseRecord47,
92
+ });
93
+ const ResponseRecord49 = response("id name type url textNumber textContent createdAt updatedAt archivedAt");
94
+ const ResponseRecord50 = response("data totalCount", { "data": Schema.Array(ResponseRecord49) });
95
+ const ResponseRecord51 = response("data", { "data": ResponseRecord49 });
96
+ const ResponseRecord52 = response("id name type");
97
+ const ResponseRecord53 = response("id serialNumber deviceType groupId group currentDestination createdAt updatedAt archivedAt", { "group": ResponseRecord4, "currentDestination": ResponseRecord52 });
98
+ const ResponseRecord54 = response("data totalCount", { "data": Schema.Array(ResponseRecord53) });
99
+ const ResponseRecord55 = response("data", { "data": ResponseRecord53 });
100
+ const ResponseRecord56 = response("id serialNumber");
101
+ const ResponseRecord57 = response("id createdAt deviceId groupId destinationId device group destination", {
102
+ "device": ResponseRecord56,
103
+ "group": ResponseRecord4,
104
+ "destination": ResponseRecord52,
105
+ });
106
+ const ResponseRecord58 = response("data totalCount", { "data": Schema.Array(ResponseRecord57) });
107
+ const ResponseRecord59 = response("id name type url textNumber textContent");
108
+ const ResponseRecord60 = response("id name destinationId destination deviceIds createdAt updatedAt archivedAt", {
109
+ "destination": ResponseRecord59,
110
+ "deviceIds": Schema.Array(Schema.Unknown),
111
+ });
112
+ const ResponseRecord61 = response("data totalCount", { "data": Schema.Array(ResponseRecord60) });
113
+ const ResponseRecord62 = response("data", { "data": ResponseRecord60 });
114
+ const GetContributionResponse = ResponseRecord8;
115
+ const GetContributionsResponse = ResponseRecord9;
116
+ const ChargeCashPaymentMethodResponse = ResponseRecord8;
117
+ const GetDepositsResponse = ResponseRecord12;
118
+ const GetDepositResponse = ResponseRecord13;
119
+ const GetDepositSummaryResponse = ResponseRecord16;
120
+ const GetRefundsResponse = ResponseRecord18;
121
+ const GetRefundResponse = ResponseRecord19;
122
+ const GetChargebacksResponse = ResponseRecord21;
123
+ const GetChargebackResponse = ResponseRecord22;
124
+ const GetWebhooksResponse = ResponseRecord24;
125
+ const GetWebhookResponse = ResponseRecord25;
126
+ const GetWebhookEventLogsResponse = ResponseRecord30;
127
+ const GetDonorsResponse = ResponseRecord31;
128
+ const CreateDonorProfileResponse = ResponseRecord32;
129
+ const GetDonorResponse = ResponseRecord33;
130
+ const CreateSubscriptionResponse = ResponseRecord36;
131
+ const GetSubscriptionsResponse = ResponseRecord37;
132
+ const GetSubscriptionResponse = ResponseRecord36;
133
+ const GetPaymentMethodsResponse = ResponseRecord39;
134
+ const GetCampaignsResponse = ResponseRecord41;
135
+ const GetCampaignByIdResponse = ResponseRecord42;
136
+ const GetLocationsResponse = ResponseRecord44;
137
+ const GetLocationByIdResponse = ResponseRecord45;
138
+ const AuthorizePaymentResponse = ResponseRecord48;
139
+ const GetTapDestinationsResponse = ResponseRecord50;
140
+ const GetTapDestinationByIdResponse = ResponseRecord51;
141
+ const GetTapDevicesResponse = ResponseRecord54;
142
+ const GetTapDeviceByIdResponse = ResponseRecord55;
143
+ const GetTapEventsResponse = ResponseRecord58;
144
+ const GetTapGroupsResponse = ResponseRecord61;
145
+ const GetTapGroupByIdResponse = ResponseRecord62;
146
+ const ChargeCashPaymentMethodParams = Schema.Struct({
147
+ "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the donor" })),
148
+ "paymentMethodId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the payment method to charge" })),
149
+ "amount": Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Schema.annotateKey({ description: "The amount to charge to the payment method" })),
150
+ "campaignId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The ID of the campaign" })),
151
+ "subcampaignId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The ID of the subcampaign" })),
152
+ "anonymous": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Indicates if the donation is anonymous" })),
153
+ "donorNotes": Schema.optionalKey(Schema.String.check(isMinChars(1), isMaxChars(500))).pipe(Schema.annotateKey({ description: "Notes from the donor" })),
154
+ });
155
+ const CreateDonorProfileParams = Schema.Struct({
156
+ "email": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The email address of the donor" })),
157
+ "firstName": Schema.String.pipe(Schema.annotateKey({ description: "The first name of the donor" })),
158
+ "lastName": Schema.String.pipe(Schema.annotateKey({ description: "The last name of the donor" })),
159
+ "mailingAddress": Schema.optionalKey(Schema.Struct({
160
+ "city": Schema.String.check(isMinChars(1)),
161
+ "country": Schema.optionalKey(Schema.String),
162
+ "line1": Schema.String.check(isMinChars(1)),
163
+ "line2": Schema.optionalKey(Schema.String),
164
+ "state": Schema.String.check(isMinChars(1)),
165
+ "timezone": Schema.optionalKey(Schema.String),
166
+ "zip": Schema.String.check(Schema.isPattern(new RegExp("^\\d{5}(-\\d{4})?$", "u"))),
167
+ })).pipe(Schema.annotateKey({ description: "The mailing address of the donor" })),
168
+ "phone": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The phone number of the donor" })),
169
+ });
170
+ const UpdateDonorProfileParams = Schema.Struct({
171
+ "email": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The email address of the donor" })),
172
+ "firstName": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The first name of the donor" })),
173
+ "lastName": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The last name of the donor" })),
174
+ "phone": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The phone number of the donor" })),
175
+ });
176
+ const CreateSubscriptionRequest = Schema.Struct({
177
+ "paymentMethodId": Schema.String.pipe(Schema.annotateKey({ description: "Id of the payment method." })),
178
+ "amount": Schema.Finite.check(Schema.isGreaterThan(0)).pipe(Schema.annotateKey({ description: "Subscription amount in dollars." })),
179
+ "frequency": Schema.Literals(["two-weeks", "1st-15th", "month", "one-time", "quarter", "week", "year"]).pipe(Schema.annotateKey({ description: "Recurring frequency for the subscription." })),
180
+ "startDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "ISO 8601 date string when the subscription should start." })),
181
+ "timezone": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Timezone for the subscription start date. Defaults to UTC if not provided." })),
182
+ "anonymous": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether the donor wants the contribution to be anonymous." })),
183
+ "campaignId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Id of the campaign to allocate funds to" })),
184
+ "subcampaignId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Id of the subcampaign for more specific allocation." })),
185
+ "donorNotes": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Notes from the donor." })),
186
+ });
187
+ const UpdateSubscriptionRequest = Schema.Struct({
188
+ "paymentMethodId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Id of the payment method." })),
189
+ "amount": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThan(0))).pipe(Schema.annotateKey({ description: "Subscription amount in dollars." })),
190
+ "startDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "ISO 8601 date string when the subscription should start." })),
191
+ "timezone": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Timezone for the subscription start date. Defaults to UTC if not provided." })),
192
+ "anonymous": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether the donor wants the contribution to be anonymous." })),
193
+ "campaignId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Id of the campaign to allocate funds to" })),
194
+ "subcampaignId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Id of the subcampaign for more specific allocation." })),
195
+ "donorNotes": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Notes from the donor." })),
196
+ "frequency": Schema.optionalKey(Schema.Literals(["biweekly", "monthly", "quarterly", "weekly", "yearly"])),
197
+ });
198
+ const DeleteSubscriptionRequest = Schema.Struct({
199
+ "cancellationReason": Schema.optionalKey(Schema.String.check(isMinChars(1), isMaxChars(150))).pipe(Schema.annotateKey({ description: "The reason for cancelling the subscription." })),
200
+ });
201
+ const CardPaymentMethod = Schema.Struct({
202
+ "paymentMethodType": Schema.Literal("Card"),
203
+ "defaultForDonor": Schema.Boolean,
204
+ "encryptedCardNumber": Schema.String,
205
+ "encryptedExpiryMonth": Schema.String,
206
+ "encryptedExpiryYear": Schema.String,
207
+ "encryptedSecurityCode": Schema.optionalKey(Schema.String),
208
+ });
209
+ const BankPaymentMethod = Schema.Struct({
210
+ "paymentMethodType": Schema.Literal("Bank"),
211
+ "bankAccountType": Schema.Literals(["checking", "savings"]),
212
+ "bankName": Schema.optionalKey(Schema.String),
213
+ "defaultForDonor": Schema.Boolean,
214
+ "encryptedBankAccountNumber": Schema.String.check(isMinChars(1), Schema.isPattern(new RegExp("^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$", "u"))),
215
+ "encryptedBankRoutingNumber": Schema.String.check(isMinChars(1), Schema.isPattern(new RegExp("^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$", "u"))),
216
+ });
217
+ const PlaidBankPaymentMethod = Schema.Struct({
218
+ "paymentMethodType": Schema.Literal("PlaidBank"),
219
+ "publicToken": Schema.String,
220
+ "accountId": Schema.String,
221
+ "defaultForDonor": Schema.Boolean,
222
+ });
223
+ const WalletPaymentMethod = Schema.Struct({
224
+ "paymentMethodType": Schema.Literal("Wallet"),
225
+ "walletAccountType": Schema.Literals(["applepay", "googlepay"]).pipe(Schema.annotateKey({ description: "Wallet type for the payment. Only `applepay` and `googlepay` are accepted." })),
226
+ "walletToken": Schema.String,
227
+ });
228
+ const StoredPaymentMethod = Schema.Struct({
229
+ "paymentMethodType": Schema.Literal("StoredPaymentMethod"),
230
+ "paymentMethodId": Schema.String,
231
+ });
232
+ const AuthorizePaymentRequest = Schema.Struct({
233
+ "amountInCents": Integer.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.annotateKey({
234
+ description: "Charge amount in cents. Use `0` for tokenize-only flows (e.g. saving a payment method without an immediate charge).",
235
+ })),
236
+ "anonymous": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether the donation should be anonymous." })),
237
+ "billingAddress": Schema.optionalKey(Schema.Struct({
238
+ "city": Schema.optionalKey(Schema.NullOr(Schema.String)),
239
+ "country": Schema.optionalKey(Schema.NullOr(Schema.String)),
240
+ "line1": Schema.optionalKey(Schema.NullOr(Schema.String)),
241
+ "line2": Schema.optionalKey(Schema.NullOr(Schema.String)),
242
+ "state": Schema.optionalKey(Schema.NullOr(Schema.String)),
243
+ "zip": Schema.optionalKey(Schema.NullOr(Schema.String)),
244
+ })).pipe(Schema.annotateKey({ description: "Billing address for the payment." })),
245
+ "browserInfo": Schema.optionalKey(Schema.Struct({
246
+ "acceptHeader": Schema.optionalKey(Schema.String),
247
+ "colorDepth": Schema.optionalKey(Schema.Finite),
248
+ "javaEnabled": Schema.optionalKey(Schema.Boolean),
249
+ "language": Schema.optionalKey(Schema.String),
250
+ "screenHeight": Schema.optionalKey(Schema.Finite),
251
+ "screenWidth": Schema.optionalKey(Schema.Finite),
252
+ "timeZoneOffset": Schema.optionalKey(Schema.Finite),
253
+ "userAgent": Schema.optionalKey(Schema.String),
254
+ })).pipe(Schema.annotateKey({ description: "Browser information collected by the Adyen SDK." })),
255
+ "coveredFees": Schema.optionalKey(Schema.Struct({
256
+ "coveredFeeValue": Schema.Finite,
257
+ "coveredFlatFeeValue": Schema.optionalKey(Schema.Finite),
258
+ "coveredPercentageFeeString": Schema.optionalKey(Schema.String),
259
+ })).pipe(Schema.annotateKey({ description: "Fee coverage details when the donor opts to cover fees." })),
260
+ "dedication": Schema.optionalKey(Schema.Struct({
261
+ "recipientEmail": Schema.optionalKey(Schema.String),
262
+ "recipientName": Schema.optionalKey(Schema.String),
263
+ "type": Schema.optionalKey(Schema.Literals(["In honor of", "In memory of"])),
264
+ })).pipe(Schema.annotateKey({ description: "Dedication details for the donation." })),
265
+ "deductible": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({
266
+ description: "Whether the donation is tax-deductible. Defaults to the campaign setting when not provided, or `true` for nonprofit donations without a campaign. Ignored for tokenize-only ($0) flows since no contribution is created.",
267
+ })),
268
+ "email": Schema.String.pipe(Schema.annotateKey({ description: "Donor email address." })),
269
+ "firstName": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Donor's first name." })),
270
+ "fundId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Fund to allocate the donation to." })),
271
+ "lastName": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Donor's last name." })),
272
+ "locationId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Location associated with the donation." })),
273
+ "metadata": Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)).pipe(Schema.annotateKey({ description: "Arbitrary key-value metadata." })),
274
+ "notes": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Donor notes for the donation." })),
275
+ "paymentMethod": Schema.Union([
276
+ CardPaymentMethod,
277
+ BankPaymentMethod,
278
+ PlaidBankPaymentMethod,
279
+ WalletPaymentMethod,
280
+ StoredPaymentMethod,
281
+ ]).pipe(Schema.annotateKey({ description: "Payment method details." })),
282
+ "phone": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Donor phone number." })),
283
+ "processingChannel": Schema.Literals(["Ecommerce", "MailOrderTelephoneOrder", "ContinuedAuthorization"]).pipe(Schema.annotateKey({
284
+ description: "Determines shopper interaction type. Maps 1-to-1 to Adyen shopperInteraction.",
285
+ })),
286
+ "recurring": Schema.optionalKey(Schema.Struct({
287
+ "cycles": Schema.optionalKey(Schema.Finite),
288
+ "frequency": Schema.Literals(["biweekly", "1st-15th", "monthly", "weekly"]),
289
+ "startDate": Schema.String,
290
+ })).pipe(Schema.annotateKey({ description: "Recurring schedule options. Omit for one-time charges." })),
291
+ "riskData": Schema.optionalKey(Schema.Struct({ "clientData": Schema.optionalKey(Schema.String) })).pipe(Schema.annotateKey({ description: "Risk data collected by the Adyen SDK." })),
292
+ "shopperIp": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({
293
+ description: "End shopper IP address, IPv4 or IPv6. Highly recommended for fraud checks. Forward the shopper address from your checkout. Omit this field when you do not have it. This is the shopper, not your server.",
294
+ })),
295
+ "subFundId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Sub-fund to allocate the donation to." })),
296
+ });
297
+ export const getContributions = get("getContributions", "/contributions", {
298
+ query: {
299
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of contributions to return." })),
300
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the contributions to return." })),
301
+ "minimumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum updated date of the contributions to return." })),
302
+ "maximumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum updated date of the contributions to return." })),
303
+ "minimumInitiatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum date the contributions were initiated to return." })),
304
+ "maximumInitiatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum date the contributions were initiated to return." })),
305
+ "statusBucket[]": Schema.optionalKey(Schema.Array(Schema.Literals(["CANCELED", "CONFIRMED", "PENDING", "FAILED"]))).pipe(Schema.annotateKey({
306
+ description: "Filter contributions by status buckets. Array values use repeated bracketed query keys.",
307
+ })),
308
+ "campaignId": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u")))).pipe(Schema.annotateKey({ description: "Filter by campaign id." })),
309
+ "subcampaignId": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u")))).pipe(Schema.annotateKey({ description: "Filter by subcampaign id." })),
310
+ "locationIds[]": Schema.optionalKey(Schema.Array(Schema.String)).pipe(Schema.annotateKey({ description: "Filter by location ids. Array values use repeated bracketed query keys." })),
311
+ "givingLinkId": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u")))).pipe(Schema.annotateKey({ description: "Filter by giving link id." })),
312
+ "pledgeId": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u")))).pipe(Schema.annotateKey({ description: "Filter by pledge id." })),
313
+ "depositId": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u")))).pipe(Schema.annotateKey({ description: "Filter by deposit id." })),
314
+ },
315
+ success: GetContributionsResponse,
316
+ }).annotate(Summary, "List contributions (gifts), filtered by campaign, campus, status and dates");
317
+ export const chargeCashPaymentMethod = post("chargeCashPaymentMethod", "/contributions", {
318
+ payload: ChargeCashPaymentMethodParams,
319
+ success: ChargeCashPaymentMethodResponse,
320
+ }).annotate(Summary, "Charge a donor's saved card, bank or wallet payment method for a cash gift");
321
+ export const getContributionById = get("getContributionById", "/contributions/:contributionId", {
322
+ params: { "contributionId": Schema.String.pipe(Schema.annotateKey({ description: "contribution id." })) },
323
+ success: GetContributionResponse,
324
+ }).annotate(Summary, "Retrieve one contribution (gift) and its donor, campaign and settlement status");
325
+ export const initiateRefund = post("initiateRefund", "/contributions/:contributionId/initiate-refund", {
326
+ params: {
327
+ "contributionId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the contribution to refund." })),
328
+ },
329
+ success: Schema.String,
330
+ }).annotate(Summary, "Issue a refund for an eligible cash gift (contribution or donation) under $1,000, including duplicate gifts");
331
+ export const getDeposits = get("getDeposits", "/deposits", {
332
+ query: {
333
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of deposits to return." })),
334
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the deposits to return." })),
335
+ "createdAt": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Filter deposits created on this date." })),
336
+ "startDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Filter deposits whose arrival date is on or after this date." })),
337
+ "endDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Filter deposits whose arrival date is on or before this date." })),
338
+ "ids[]": Schema.optionalKey(Schema.Array(Schema.String)).pipe(Schema.annotateKey({ description: "Filter by deposit ids. Array values use repeated bracketed query keys." })),
339
+ "sortBy": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Field to sort deposits by. Defaults to arrival date." })),
340
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "Sort direction. Defaults to descending." })),
341
+ "search": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Free-text search across deposit fields." })),
342
+ "reconciled": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Filter by reconciliation status." })),
343
+ "minimumEstimatedValueInCents": Schema.optionalKey(Schema.Union([Schema.String, Schema.Finite])).pipe(Schema.annotateKey({
344
+ description: "Filter deposits with net amount greater than or equal to this value, in cents.",
345
+ })),
346
+ "maximumEstimatedValueInCents": Schema.optionalKey(Schema.Union([Schema.String, Schema.Finite])).pipe(Schema.annotateKey({
347
+ description: "Filter deposits with net amount less than or equal to this value, in cents.",
348
+ })),
349
+ "paymentMethod[]": Schema.optionalKey(Schema.Array(Schema.String)).pipe(Schema.annotateKey({
350
+ description: "Filter by payment method types. Array values use repeated bracketed query keys.",
351
+ })),
352
+ "types[]": Schema.optionalKey(Schema.Array(Schema.String)).pipe(Schema.annotateKey({ description: "Filter by deposit types. Array values use repeated bracketed query keys." })),
353
+ },
354
+ success: GetDepositsResponse,
355
+ }).annotate(Summary, "List deposits (bank payouts) and reconciliation status");
356
+ export const getDepositById = get("getDepositById", "/deposits/:depositId", {
357
+ params: { "depositId": Schema.String.pipe(Schema.annotateKey({ description: "deposit id." })) },
358
+ success: GetDepositResponse,
359
+ }).annotate(Summary, "Retrieve a bank payout and its contribution, refund and chargeback line items");
360
+ export const getDepositSummary = get("getDepositSummary", "/deposits/:depositId/summary", {
361
+ params: { "depositId": Schema.String.pipe(Schema.annotateKey({ description: "deposit id." })) },
362
+ success: GetDepositSummaryResponse,
363
+ }).annotate(Summary, "Read a payout's gross, fees and net totals in cents by kind");
364
+ export const getRefunds = get("getRefunds", "/refunds", {
365
+ query: {
366
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of refunds to return." })),
367
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the refunds to return." })),
368
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "Sort direction by refund created date. Defaults to descending." })),
369
+ "contributionId": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u")))).pipe(Schema.annotateKey({ description: "Filter by contribution id." })),
370
+ "minimumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum updated date of the refunds to return." })),
371
+ "maximumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum updated date of the refunds to return." })),
372
+ },
373
+ success: GetRefundsResponse,
374
+ }).annotate(Summary, "List refunds with contribution and deposit joins and cent amounts");
375
+ export const getRefundById = get("getRefundById", "/refunds/:refundId", {
376
+ params: { "refundId": Schema.String.pipe(Schema.annotateKey({ description: "refund id." })) },
377
+ success: GetRefundResponse,
378
+ }).annotate(Summary, "Retrieve one refund and its contribution, status and cent amounts");
379
+ export const getChargebacks = get("getChargebacks", "/chargebacks", {
380
+ query: {
381
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of chargebacks to return." })),
382
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the chargebacks to return." })),
383
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "Sort direction by chargeback created date. Defaults to descending." })),
384
+ "contributionId": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u")))).pipe(Schema.annotateKey({ description: "Filter by contribution id." })),
385
+ "minimumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum updated date of the chargebacks to return." })),
386
+ "maximumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum updated date of the chargebacks to return." })),
387
+ },
388
+ success: GetChargebacksResponse,
389
+ }).annotate(Summary, "List card disputes and ACH returns (chargebacks)");
390
+ export const getChargebackById = get("getChargebackById", "/chargebacks/:chargebackId", {
391
+ params: { "chargebackId": Schema.String.pipe(Schema.annotateKey({ description: "chargeback id." })) },
392
+ success: GetChargebackResponse,
393
+ }).annotate(Summary, "Retrieve one chargeback (card dispute or ACH return)");
394
+ export const getWebhooks = get("getWebhooks", "/webhooks", {
395
+ query: {
396
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of webhook subscriptions to return." })),
397
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of webhook subscriptions to return." })),
398
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({
399
+ description: "Sort direction by webhook subscription created date. Defaults to descending.",
400
+ })),
401
+ "status": Schema.optionalKey(Schema.Literals(["enabled", "disabled"])).pipe(Schema.annotateKey({ description: "Filter by webhook subscription status." })),
402
+ },
403
+ success: GetWebhooksResponse,
404
+ }).annotate(Summary, "List webhook subscriptions, destinations and enabled event names");
405
+ export const getWebhookById = get("getWebhookById", "/webhooks/:webhookId", {
406
+ params: { "webhookId": Schema.String.pipe(Schema.annotateKey({ description: "webhook id." })) },
407
+ success: GetWebhookResponse,
408
+ }).annotate(Summary, "Retrieve one webhook subscription and its delivery destination");
409
+ export const getWebhookEventLogs = get("getWebhookEventLogs", "/webhooks/:webhookId/event-logs", {
410
+ params: { "webhookId": Schema.String.pipe(Schema.annotateKey({ description: "webhook id." })) },
411
+ query: {
412
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(50))).pipe(Schema.annotateKey({ description: "The number of webhook event logs to return." })),
413
+ "cursor": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Cursor for loading the next page of webhook event logs." })),
414
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "Sort direction by webhook event log attempt order. Defaults to descending." })),
415
+ "status": Schema.optionalKey(Schema.Literals(["delivered", "failed", "pending"])).pipe(Schema.annotateKey({ description: "Filter by webhook delivery status." })),
416
+ "webhookEventName": Schema.optionalKey(Schema.Literals([
417
+ "*",
418
+ "contribution.approved",
419
+ "contribution.declined",
420
+ "contribution.paid_out",
421
+ "contribution.processing",
422
+ "contribution.chargeback_lost",
423
+ "contribution.chargeback_pending",
424
+ "contribution.chargeback_won",
425
+ "contribution.refund_approved",
426
+ "contribution.refund_canceled",
427
+ "contribution.refund_failed",
428
+ "contribution.refund_requested",
429
+ "contribution.refund_requires_action",
430
+ "contribution.refunded",
431
+ "contribution.voided",
432
+ "donor.archived",
433
+ "donor.created",
434
+ "donor.merged",
435
+ "donor.updated",
436
+ "deposit.paid_out",
437
+ "recurring_gift.active",
438
+ "recurring_gift.cycle_failed",
439
+ "recurring_gift.failed",
440
+ "recurring_gift.inactive",
441
+ "recurring_gift.paused",
442
+ "recurring_gift.updated",
443
+ ])).pipe(Schema.annotateKey({ description: "Filter by webhook event name." })),
444
+ },
445
+ success: GetWebhookEventLogsResponse,
446
+ }).annotate(Summary, "List webhook delivery attempts, response codes and failures");
447
+ export const getDonorProfiles = get("getDonorProfiles", "/donors", {
448
+ query: {
449
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of donors to return" })),
450
+ "locationIds[]": Schema.optionalKey(Schema.Array(Schema.String)).pipe(Schema.annotateKey({
451
+ description: "Filter donors by location IDs Array values use repeated bracketed query keys.",
452
+ })),
453
+ "maximumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum updated date of the donors to return." })),
454
+ "minimumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum updated date of the donors to return." })),
455
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the donors to return" })),
456
+ "sortBy": Schema.optionalKey(Schema.Literals([
457
+ "createdAt",
458
+ "updatedAt",
459
+ "firstName",
460
+ "lastName",
461
+ "email",
462
+ "phone",
463
+ "id",
464
+ "totalContributionsCount",
465
+ ])).pipe(Schema.annotateKey({ description: "The field to sort the donors by." })),
466
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the donors by." })),
467
+ },
468
+ success: GetDonorsResponse,
469
+ }).annotate(Summary, "List donor profiles, contact information and giving counts");
470
+ export const createDonorProfile = post("createDonorProfile", "/donors", {
471
+ payload: CreateDonorProfileParams,
472
+ success: CreateDonorProfileResponse,
473
+ }).annotate(Summary, "Create a donor profile for a nonprofit");
474
+ export const getDonorProfile = get("getDonorProfile", "/donors/:donorId", {
475
+ params: { "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the donor to fetch." })) },
476
+ success: GetDonorResponse,
477
+ }).annotate(Summary, "Retrieve a donor profile, phone, address and giving counts");
478
+ export const updateDonorProfile = patch("updateDonorProfile", "/donors/:donorId", {
479
+ params: { "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the donor to update." })) },
480
+ payload: UpdateDonorProfileParams,
481
+ success: Schema.Unknown,
482
+ }).annotate(Summary, "Update (edit) a donor's name, email or phone");
483
+ export const createSubscription = post("createSubscription", "/subscriptions/:donorId", {
484
+ params: {
485
+ "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the donor to create the subscription for." })),
486
+ },
487
+ payload: CreateSubscriptionRequest,
488
+ success: CreateSubscriptionResponse,
489
+ }).annotate(Summary, "Create a recurring gift (subscription), with amount in dollars");
490
+ export const getSubscriptionsByDonorProfile = get("getSubscriptionsByDonorProfile", "/subscriptions/:donorId", {
491
+ params: {
492
+ "donorId": Schema.String.pipe(Schema.annotateKey({
493
+ description: "Donor id from a profile; the public schema incorrectly references an empty entity for this path scalar.",
494
+ })),
495
+ },
496
+ query: {
497
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of subscriptions to return." })),
498
+ "maximumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum updated date of the subscriptions to return." })),
499
+ "minimumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum updated date of the subscriptions to return." })),
500
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the subscriptions to return." })),
501
+ "status[]": Schema.optionalKey(Schema.Array(Schema.Literals(["active", "failed", "inactive", "paused", "pending", "recreated"]))).pipe(Schema.annotateKey({
502
+ description: "The status of the subscriptions to return. Array values use repeated bracketed query keys.",
503
+ })),
504
+ "locationIds[]": Schema.optionalKey(Schema.Array(Schema.String)).pipe(Schema.annotateKey({
505
+ description: "Filter subscriptions by location Ids. Array values use repeated bracketed query keys.",
506
+ })),
507
+ "sortBy": Schema.optionalKey(Schema.Literals(["amount", "createdAt", "frequency", "nextContributionAt"])).pipe(Schema.annotateKey({ description: "The field to sort the subscriptions by." })),
508
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the subscriptions by." })),
509
+ },
510
+ success: GetSubscriptionsResponse,
511
+ }).annotate(Summary, "List one donor's recurring gifts (subscriptions)");
512
+ export const getSubscriptions = get("getSubscriptions", "/subscriptions", {
513
+ query: {
514
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of subscriptions to return." })),
515
+ "maximumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum updated date of the subscriptions to return." })),
516
+ "minimumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum updated date of the subscriptions to return." })),
517
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the subscriptions to return." })),
518
+ "status[]": Schema.optionalKey(Schema.Array(Schema.Literals(["active", "failed", "inactive", "paused", "pending", "recreated"]))).pipe(Schema.annotateKey({
519
+ description: "The status of the subscriptions to return. Array values use repeated bracketed query keys.",
520
+ })),
521
+ "locationIds[]": Schema.optionalKey(Schema.Array(Schema.String)).pipe(Schema.annotateKey({
522
+ description: "Filter subscriptions by location Ids. Array values use repeated bracketed query keys.",
523
+ })),
524
+ "sortBy": Schema.optionalKey(Schema.Literals(["amount", "createdAt", "frequency", "nextContributionAt"])).pipe(Schema.annotateKey({ description: "The field to sort the subscriptions by." })),
525
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the subscriptions by." })),
526
+ },
527
+ success: GetSubscriptionsResponse,
528
+ }).annotate(Summary, "List recurring gifts (subscriptions) across donors");
529
+ export const getSubscriptionById = get("getSubscriptionById", "/subscriptions/:donorId/:subscriptionId", {
530
+ params: {
531
+ "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the donor to get the subscription for." })),
532
+ "subscriptionId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the subscription to get." })),
533
+ },
534
+ success: GetSubscriptionResponse,
535
+ }).annotate(Summary, "Retrieve one donor's recurring gift and payment schedule");
536
+ export const updateSubscriptionById = patch("updateSubscriptionById", "/subscriptions/:donorId/:subscriptionId", {
537
+ params: {
538
+ "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the donor to update the subscription for." })),
539
+ "subscriptionId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the subscription to update." })),
540
+ },
541
+ payload: UpdateSubscriptionRequest,
542
+ success: Schema.Unknown,
543
+ }).annotate(Summary, "Update a recurring gift, payment method, schedule or dollar amount");
544
+ export const cancelSubscription = del("cancelSubscription", "/subscriptions/:donorId/:subscriptionId", {
545
+ params: {
546
+ "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the donor to cancel the subscription for." })),
547
+ "subscriptionId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the subscription to cancel." })),
548
+ },
549
+ payload: DeleteSubscriptionRequest,
550
+ success: Schema.Unknown,
551
+ }).annotate(Summary, "Cancel (stop) a recurring gift or donation (subscription); past gifts stay charged");
552
+ export const getPaymentMethods = get("getPaymentMethods", "/payment-methods/:donorId", {
553
+ params: {
554
+ "donorId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the donor to get payment methods for." })),
555
+ },
556
+ query: {
557
+ "maximumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The maximum updated date of the payment methods to return. YYYY-MM-DD" })),
558
+ "minimumUpdatedDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The minimum updated date of the payment methods to return. YYYY-MM-DD" })),
559
+ "showExpired": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether to return expired payment methods or not." })),
560
+ },
561
+ success: GetPaymentMethodsResponse,
562
+ }).annotate(Summary, "List a donor's saved card, bank or wallet payment method metadata");
563
+ export const getCampaigns = get("getCampaigns", "/campaigns", {
564
+ query: {
565
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of campaigns to return." })),
566
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the campaigns to return." })),
567
+ "includeArchived": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether to include campaigns that have been archived." })),
568
+ "sortBy": Schema.optionalKey(Schema.Literals([
569
+ "endDate",
570
+ "name",
571
+ "startDate",
572
+ "displayOrder",
573
+ "totalContributionCount",
574
+ "totalContributionValue",
575
+ "uniqueDonorCount",
576
+ ])).pipe(Schema.annotateKey({ description: "The field to sort the campaigns by." })),
577
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the campaigns by." })),
578
+ "isSubcampaign": Schema.optionalKey(Schema.Literals(["true", "false"])).pipe(Schema.annotateKey({
579
+ description: "Whether to return subcampaigns or campaigns. If true, returns subcampaigns, otherwise returns campaigns",
580
+ })),
581
+ "parentCampaignId": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "The id of the parent campaign to return subcampaigns for." })),
582
+ "excludeInactive": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether to exclude campaigns that have ended." })),
583
+ "search": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Search by campaign name." })),
584
+ },
585
+ success: GetCampaignsResponse,
586
+ }).annotate(Summary, "List campaigns and subcampaigns, with parent and giving relationships");
587
+ export const getCampaignById = get("getCampaignById", "/campaigns/:campaignId", {
588
+ params: {
589
+ "campaignId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the campaign/subcampaign to get." })),
590
+ },
591
+ success: GetCampaignByIdResponse,
592
+ }).annotate(Summary, "Retrieve a campaign or subcampaign");
593
+ export const getLocations = get("getLocations", "/locations", {
594
+ query: {
595
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of locations to return." })),
596
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the locations to return." })),
597
+ "includeArchived": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether to include locations that have been archived." })),
598
+ "sortBy": Schema.optionalKey(Schema.Literals(["name", "createdAt", "displayOrder"])).pipe(Schema.annotateKey({ description: "The field to sort the locations by." })),
599
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the locations by." })),
600
+ },
601
+ success: GetLocationsResponse,
602
+ }).annotate(Summary, "List nonprofit locations (campuses)");
603
+ export const getLocationById = get("getLocationById", "/locations/:locationId", {
604
+ params: { "locationId": Schema.String.pipe(Schema.annotateKey({ description: "The Id of the location to get." })) },
605
+ success: GetLocationByIdResponse,
606
+ }).annotate(Summary, "Retrieve a nonprofit location (campus)");
607
+ export const authorizePayment = post("authorizePayment", "/payments/authorize", {
608
+ payload: AuthorizePaymentRequest,
609
+ success: AuthorizePaymentResponse,
610
+ }).annotate(Summary, "Authorize a payment, or save a payment method with zero amountInCents");
611
+ export const getDestinations = get("getDestinations", "/tap/destinations", {
612
+ query: {
613
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of tap destinations to return." })),
614
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the tap destinations to return." })),
615
+ "search": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Search tap destinations by name." })),
616
+ "destinationType": Schema.optionalKey(Schema.Literals(["web", "sms"])).pipe(Schema.annotateKey({ description: "Filter tap destinations by type." })),
617
+ "includeArchived": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether to include tap destinations that have been archived." })),
618
+ "sortBy": Schema.optionalKey(Schema.Literals(["name", "createdAt"])).pipe(Schema.annotateKey({ description: "The field to sort the tap destinations by." })),
619
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the tap destinations by." })),
620
+ },
621
+ success: GetTapDestinationsResponse,
622
+ }).annotate(Summary, "List Tap-to-give destinations and configured URLs or messages");
623
+ export const getDestinationById = get("getDestinationById", "/tap/destinations/:destinationId", {
624
+ params: {
625
+ "destinationId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the tap destination." })),
626
+ },
627
+ success: GetTapDestinationByIdResponse,
628
+ }).annotate(Summary, "Retrieve a Tap-to-give destination URL or message");
629
+ export const getDevices = get("getDevices", "/tap/devices", {
630
+ query: {
631
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of tap devices to return." })),
632
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the tap devices to return." })),
633
+ "search": Schema.optionalKey(Schema.String.check(Schema.isPattern(new RegExp("^\\d+$", "u")))).pipe(Schema.annotateKey({ description: "Search by exact serial number. Must be a numeric value." })),
634
+ "groupId": Schema.optionalKey(Schema.Union([
635
+ Schema.Literal("unassigned"),
636
+ Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-fA-F]{24}$", "u"))),
637
+ ])).pipe(Schema.annotateKey({
638
+ description: 'Filter tap devices by group Id. Use "unassigned" to get devices not assigned to any group.',
639
+ })),
640
+ "deviceType": Schema.optionalKey(Schema.Literals([
641
+ "Lanyard",
642
+ "Stand",
643
+ "Bracelet",
644
+ "Wristband",
645
+ "Plates/Disc/Magnet/Label",
646
+ "Flex",
647
+ "Plate Square",
648
+ "Arm Rest Rectangle",
649
+ "Plates",
650
+ "Disc",
651
+ "Magnet",
652
+ "Label",
653
+ ])).pipe(Schema.annotateKey({ description: "Filter tap devices by device type." })),
654
+ "includeArchived": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether to include tap devices that have been archived." })),
655
+ "sortBy": Schema.optionalKey(Schema.Literals(["serialNumber", "createdAt"])).pipe(Schema.annotateKey({ description: "The field to sort the tap devices by." })),
656
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the tap devices by." })),
657
+ },
658
+ success: GetTapDevicesResponse,
659
+ }).annotate(Summary, "List Tap-to-give devices, groups and current destinations");
660
+ export const getDeviceById = get("getDeviceById", "/tap/devices/:deviceId", {
661
+ params: { "deviceId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the tap device." })) },
662
+ success: GetTapDeviceByIdResponse,
663
+ }).annotate(Summary, "Retrieve a Tap-to-give device and its current destination");
664
+ export const getEvents = get("getEvents", "/tap/events", {
665
+ query: {
666
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of tap events to return." })),
667
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the tap events to return." })),
668
+ "groupIds[]": Schema.optionalKey(Schema.Array(Schema.String).check(Schema.isMinLength(1))).pipe(Schema.annotateKey({
669
+ description: "Filter tap events by group IDs. Array values use repeated bracketed query keys.",
670
+ })),
671
+ "destinationIds[]": Schema.optionalKey(Schema.Array(Schema.String).check(Schema.isMinLength(1))).pipe(Schema.annotateKey({
672
+ description: "Filter tap events by destination IDs. Array values use repeated bracketed query keys.",
673
+ })),
674
+ "deviceIds[]": Schema.optionalKey(Schema.Array(Schema.String).check(Schema.isMinLength(1))).pipe(Schema.annotateKey({
675
+ description: "Filter tap events by device IDs. Array values use repeated bracketed query keys.",
676
+ })),
677
+ "startDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Filter tap events on or after this date (ISO 8601)." })),
678
+ "endDate": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Filter tap events on or before this date (ISO 8601)." })),
679
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({
680
+ description: "The direction to sort the tap events by. Events are always sorted by time of occurrence.",
681
+ })),
682
+ },
683
+ success: GetTapEventsResponse,
684
+ }).annotate(Summary, "List Tap-to-give engagement events (taps, not donations)");
685
+ export const getGroups = get("getGroups", "/tap/groups", {
686
+ query: {
687
+ "limit": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))).pipe(Schema.annotateKey({ description: "The number of tap groups to return." })),
688
+ "page": Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(1))).pipe(Schema.annotateKey({ description: "The page number of the tap groups to return." })),
689
+ "search": Schema.optionalKey(Schema.String).pipe(Schema.annotateKey({ description: "Search tap groups by name." })),
690
+ "includeArchived": Schema.optionalKey(Schema.Boolean).pipe(Schema.annotateKey({ description: "Whether to include tap groups that have been archived." })),
691
+ "sortBy": Schema.optionalKey(Schema.Literals(["name", "createdAt"])).pipe(Schema.annotateKey({ description: "The field to sort the tap groups by." })),
692
+ "sortDirection": Schema.optionalKey(Schema.Literals(["ASC", "DESC"])).pipe(Schema.annotateKey({ description: "The direction to sort the tap groups by." })),
693
+ },
694
+ success: GetTapGroupsResponse,
695
+ }).annotate(Summary, "List Tap-to-give device groups");
696
+ export const getGroupById = get("getGroupById", "/tap/groups/:groupId", {
697
+ params: { "groupId": Schema.String.pipe(Schema.annotateKey({ description: "The ID of the tap group." })) },
698
+ success: GetTapGroupByIdResponse,
699
+ }).annotate(Summary, "Retrieve a Tap-to-give group and its devices and destination");
700
+ export const health = get("health", "/health", {
701
+ success: Schema.String,
702
+ }).annotate(Summary, "Read the API health text (not an authenticated credential check)");
703
+ export const OverflowApi = {
704
+ ...vendor({ name: "Overflow", manifestBase: "/api/v3" }, getContributions, chargeCashPaymentMethod, getContributionById, initiateRefund, getDeposits, getDepositById, getDepositSummary, getRefunds, getRefundById, getChargebacks, getChargebackById, getWebhooks, getWebhookById, getWebhookEventLogs, getDonorProfiles, createDonorProfile, getDonorProfile, updateDonorProfile, createSubscription, getSubscriptionsByDonorProfile, getSubscriptions, getSubscriptionById, updateSubscriptionById, cancelSubscription, getPaymentMethods, getCampaigns, getCampaignById, getLocations, getLocationById, authorizePayment, getDestinations, getDestinationById, getDevices, getDeviceById, getEvents, getGroups, getGroupById, health),
705
+ textBodies: {
706
+ review: "Overflow errors can be JSON or text; GET /health declares text and refund initiation accepts a JSON or plain-text string acknowledgement, or an empty 2xx acknowledgement.",
707
+ forResponse: (status, operation, contentType = "") => status < 200 || status > 299
708
+ ? "json-or-text"
709
+ : operation.method === "GET" && operation.template === "/health"
710
+ ? "text"
711
+ : isRefund(operation) && contentType.split(";", 1)[0].trim().toLowerCase() === "text/plain"
712
+ ? "json-or-text"
713
+ : undefined,
714
+ },
715
+ };
716
+ // Drift keeps /api/v3; the same operations' runtime index uses paths relative to that confined base.
717
+ export const OVERFLOW_INDEX = vendorIndex({ api: OverflowApi.api }, { prefix: "overflow", title: "Overflow", revision: "v3" });
718
+ export const OVERFLOW_VERDICTS = {
719
+ "GET /contributions": "read",
720
+ "POST /contributions": "destructive",
721
+ "GET /contributions/{contributionId}": "read",
722
+ "POST /contributions/{contributionId}/initiate-refund": "destructive",
723
+ "GET /deposits": "read",
724
+ "GET /deposits/{depositId}": "read",
725
+ "GET /deposits/{depositId}/summary": "read",
726
+ "GET /refunds": "read",
727
+ "GET /refunds/{refundId}": "read",
728
+ "GET /chargebacks": "read",
729
+ "GET /chargebacks/{chargebackId}": "read",
730
+ "GET /webhooks": "read",
731
+ "GET /webhooks/{webhookId}": "read",
732
+ "GET /webhooks/{webhookId}/event-logs": "read",
733
+ "GET /donors": "read",
734
+ "POST /donors": "write",
735
+ "GET /donors/{donorId}": "read",
736
+ "PATCH /donors/{donorId}": "write",
737
+ "POST /subscriptions/{donorId}": "destructive",
738
+ "GET /subscriptions/{donorId}": "read",
739
+ "GET /subscriptions": "read",
740
+ "GET /subscriptions/{donorId}/{subscriptionId}": "read",
741
+ "PATCH /subscriptions/{donorId}/{subscriptionId}": "destructive",
742
+ "DELETE /subscriptions/{donorId}/{subscriptionId}": "destructive",
743
+ "GET /payment-methods/{donorId}": "read",
744
+ "GET /campaigns": "read",
745
+ "GET /campaigns/{campaignId}": "read",
746
+ "GET /locations": "read",
747
+ "GET /locations/{locationId}": "read",
748
+ "POST /payments/authorize": "destructive",
749
+ "GET /tap/destinations": "read",
750
+ "GET /tap/destinations/{destinationId}": "read",
751
+ "GET /tap/devices": "read",
752
+ "GET /tap/devices/{deviceId}": "read",
753
+ "GET /tap/events": "read",
754
+ "GET /tap/groups": "read",
755
+ "GET /tap/groups/{groupId}": "read",
756
+ "GET /health": "read",
757
+ };
758
+ export const OVERFLOW_NAMED = {
759
+ "GET /contributions": "list_contributions",
760
+ "GET /contributions/{contributionId}": "get_contribution",
761
+ "GET /deposits": "list_deposits",
762
+ "GET /deposits/{depositId}": "get_deposit",
763
+ "GET /deposits/{depositId}/summary": "get_deposit_summary",
764
+ "GET /refunds": "list_refunds",
765
+ "GET /chargebacks": "list_chargebacks",
766
+ "GET /donors": "list_donors",
767
+ "GET /donors/{donorId}": "get_donor",
768
+ "GET /subscriptions": "list_subscriptions",
769
+ "GET /subscriptions/{donorId}": "list_subscriptions",
770
+ "GET /payment-methods/{donorId}": "list_payment_methods",
771
+ "GET /campaigns": "list_campaigns",
772
+ "GET /locations": "list_locations",
773
+ };
774
+ /** Strict request bounds supplement the compact index, which intentionally omits numeric constraints. */
775
+ export const admit = (url) => {
776
+ for (const name of ["page", "limit"]) {
777
+ const values = url.searchParams.getAll(name);
778
+ const maximum = name === "page" ? Number.MAX_SAFE_INTEGER : url.pathname.endsWith("/event-logs") ? 50 : MAX_PAGE_SIZE;
779
+ if (values.length > 1 ||
780
+ values.some((value) => !/^[1-9][0-9]*$/.test(value) || !Number.isSafeInteger(Number(value)) || Number(value) > maximum))
781
+ return Effect.fail(new Refusal({
782
+ error: new ConnectorCallError("invalid_args", `Overflow ${name} must be a positive whole number at most ${maximum}.`),
783
+ }));
784
+ }
785
+ return Effect.void;
786
+ };
787
+ export function listRows(body) {
788
+ const rows = asRecord(body)["data"];
789
+ if (!Array.isArray(rows))
790
+ throw new ConnectorCallError("connector_call_failed", "Overflow returned a list without a data array.", {
791
+ retryable: false,
792
+ });
793
+ return rows;
794
+ }
795
+ export function exactTotal(body) {
796
+ const total = asRecord(body)["totalCount"];
797
+ if (total === undefined)
798
+ return undefined;
799
+ if (!Number.isSafeInteger(total) || total < 0)
800
+ throw new ConnectorCallError("connector_call_failed", "Overflow returned an invalid totalCount.", {
801
+ retryable: false,
802
+ });
803
+ return total;
804
+ }
805
+ function pageNumber(value) {
806
+ const page = Number(value);
807
+ if (!/^[1-9][0-9]*$/.test(String(value)) || !Number.isSafeInteger(page))
808
+ throw new ConnectorCallError("invalid_args", "This Overflow cursor contains no valid page number.");
809
+ return page;
810
+ }
811
+ export const overflowPage = {
812
+ param: "page",
813
+ in: "query",
814
+ decode: pageNumber,
815
+ next(body, call) {
816
+ const rows = listRows(body), total = exactTotal(body);
817
+ const current = pageNumber((call.query["page"] ?? 1)), size = pageNumber((call.query["limit"] ?? DEFAULT_PAGE_SIZE));
818
+ const more = total === undefined ? rows.length >= size : current * size < total;
819
+ if (more && (rows.length === 0 || !Number.isSafeInteger(current + 1)))
820
+ throw new ConnectorCallError("connector_call_failed", "Overflow returned paging metadata that cannot advance.", {
821
+ retryable: false,
822
+ });
823
+ return more ? current + 1 : null;
824
+ },
825
+ };
826
+ export const overflowEventPage = {
827
+ param: "cursor",
828
+ in: "query",
829
+ decode(cursor) {
830
+ if (typeof cursor !== "string" || !cursor)
831
+ throw new ConnectorCallError("invalid_args", "This Overflow cursor contains no delivery cursor.");
832
+ return cursor;
833
+ },
834
+ next(body) {
835
+ listRows(body);
836
+ const info = asRecord(asRecord(body)["pageInfo"]);
837
+ if (info["hasNextPage"] === false)
838
+ return null;
839
+ if (info["hasNextPage"] !== true || typeof info["nextCursor"] !== "string" || !info["nextCursor"])
840
+ throw new ConnectorCallError("connector_call_failed", "Overflow returned invalid delivery paging metadata.", {
841
+ retryable: false,
842
+ });
843
+ return info["nextCursor"];
844
+ },
845
+ };
846
+ export const OVERFLOW_PAGES = {
847
+ "GET /contributions": overflowPage,
848
+ "GET /deposits": overflowPage,
849
+ "GET /refunds": overflowPage,
850
+ "GET /chargebacks": overflowPage,
851
+ "GET /webhooks": overflowPage,
852
+ "GET /donors": overflowPage,
853
+ "GET /subscriptions/{donorId}": overflowPage,
854
+ "GET /subscriptions": overflowPage,
855
+ "GET /campaigns": overflowPage,
856
+ "GET /locations": overflowPage,
857
+ "GET /tap/destinations": overflowPage,
858
+ "GET /tap/devices": overflowPage,
859
+ "GET /tap/events": overflowPage,
860
+ "GET /tap/groups": overflowPage,
861
+ "GET /webhooks/{webhookId}/event-logs": overflowEventPage,
862
+ };
863
+ export const API_KEY_CREDENTIAL = {
864
+ label: "Overflow API credentials",
865
+ description: "The client id and API key Overflow issued for this environment (Overflow dashboard, or Overflow's developer team). Staging and production credentials are separate and not interchangeable. Server-side only: connecta sends them to Overflow's API and nowhere else.",
866
+ fields: [
867
+ {
868
+ name: "clientId",
869
+ label: "Client ID",
870
+ description: "Overflow's public client identifier, sent as x-client-id.",
871
+ placeholder: "c77c8d57-7e1c-4a7e-ad46-e756e5f8dabd",
872
+ inputType: "text",
873
+ },
874
+ {
875
+ name: "apiKey",
876
+ label: "API key",
877
+ description: "The secret key paired with that client id, sent as x-api-key.",
878
+ placeholder: "Paste Overflow API key",
879
+ inputType: "password",
880
+ },
881
+ ],
882
+ };
883
+ function detailFor(payload, status) {
884
+ const root = asRecord(payload);
885
+ const message = root["message"];
886
+ const candidate = typeof message === "string"
887
+ ? message
888
+ : Array.isArray(message)
889
+ ? message.filter((line) => typeof line === "string" && !!line.trim()).join("; ")
890
+ : typeof root["error"] === "string"
891
+ ? root["error"]
892
+ : typeof payload === "string"
893
+ ? payload
894
+ : "";
895
+ const text = candidate.trim();
896
+ if (!text || text.length > 500 || /<[^>]+>/.test(text))
897
+ return `Overflow returned HTTP ${status}.`;
898
+ return `${new RegExp(`\\bHTTP\\s+${status}\\b`, "i").test(text) ? "Overflow" : `Overflow returned HTTP ${status}`}: ${text}${/[.!?]$/.test(text) ? "" : "."}`;
899
+ }
900
+ /** Candidate keys are resolved afresh for each operation, never cached in a connection. */
901
+ export const authenticate = Effect.gen(function* () {
902
+ const values = yield* (yield* Credentials).values.pipe(Effect.mapError((error) => new Refusal({ error })));
903
+ const clientId = values?.["clientId"]?.trim();
904
+ const apiKey = values?.["apiKey"]?.trim();
905
+ if (!clientId || !apiKey)
906
+ return yield* Effect.fail(new Refusal({
907
+ error: new ConnectorCallError("auth_required", "No Overflow client id and API key are configured for this connector. Call authorize_connector for recovery options; an operator adds both fields in this connection in the operator UI."),
908
+ }));
909
+ return { "x-client-id": clientId, "x-api-key": apiKey };
910
+ });
911
+ const authWords = (status, method) => (detail) => `${detail} The client id and API key may be wrong, revoked, or issued for the other environment (staging and production credentials are not interchangeable); an operator must check them and ask the account administrator to grant resource access if they are valid.${method !== "GET" && status === 403 ? " Overflow also answers 403 when a donor profile owned by a donor account cannot be edited through the API; if reads succeed with this credential, that refusal is the cause and no credential change will fix it." : ""}`;
912
+ /** NestJS errors have no reviewed machine-readable facts; meaning comes from status alone. */
913
+ export const errors = {
914
+ numericFacts: {
915
+ retryAfterMs: {
916
+ header: "retry-after",
917
+ format: "retry-after",
918
+ review: "HTTP Retry-After delay for failure recovery.",
919
+ },
920
+ resetAfterMs: {
921
+ header: "x-ratelimit-reset",
922
+ format: "seconds",
923
+ review: "Overflow reset is seconds remaining in the window, never an epoch.",
924
+ },
925
+ },
926
+ provider: "Overflow",
927
+ facts: () => ({}),
928
+ detail: ({ body, status }) => detailFor(body, status),
929
+ unreadable: "Overflow returned a non-JSON body for a successful read.",
930
+ unreadableWrite: "Overflow returned a non-JSON body for a successful write. Whether it took effect is unknown; check the target before repeating it.",
931
+ meanings: { unknownId: "not_found", provesAbsence: true, conflicts: [] },
932
+ statuses: {
933
+ 429: ({ numbers, retryAfterMs }) => ({
934
+ code: "rate_limited",
935
+ retryAfterMs: retryAfterMs ?? numbers["resetAfterMs"] ?? RATE_LIMIT_WINDOW_MS,
936
+ words: (detail) => `${detail} Overflow allows 120 requests per minute per API client in a fixed 60-second window, shared by every integration using this client id.`,
937
+ }),
938
+ 401: ({ operation }) => ({ code: "auth_required", words: authWords(401, operation.method) }),
939
+ 403: ({ operation }) => ({ code: "provider_permission_denied", words: authWords(403, operation.method) }),
940
+ 404: () => ({
941
+ code: "not_found",
942
+ words: (detail) => `${detail} Overflow found no such resource for this nonprofit. Re-resolve its id; hatch paths are relative to /api/v3.`,
943
+ }),
944
+ // Preserve Overflow's reset-header delay source while the kit owns 5xx classification/wording.
945
+ serverError: ({ numbers, retryAfterMs }) => ({
946
+ code: "unavailable",
947
+ retryAfterMs: retryAfterMs ?? numbers["resetAfterMs"],
948
+ }),
949
+ },
950
+ };
951
+ function isRefund(operation) {
952
+ return operation.method === "POST" && operation.template === "/contributions/{contributionId}/initiate-refund";
953
+ }
954
+ /** Health text, JSON/plain-text refund acknowledgements and empty write acknowledgements are reviewed. */
955
+ export const result = (body, answer) => {
956
+ if (isRefund(answer.operation)) {
957
+ if (answer.bodyFormat === "empty")
958
+ return Effect.succeed(body);
959
+ const type = (answer.headers.get("content-type") ?? "").split(";", 1)[0].trim().toLowerCase();
960
+ if (typeof body !== "string" ||
961
+ !((type === "application/json" && answer.bodyFormat === "json") ||
962
+ (type === "text/plain" && (answer.bodyFormat === "text" || answer.bodyFormat === "json"))))
963
+ return Effect.fail(new UnreadableBody(type === "text/html" && !(answer.bodyFormat === "json" && body !== null && typeof body === "object")
964
+ ? { unexpectedText: true }
965
+ : {}));
966
+ }
967
+ return answer.bodyFormat === "text" &&
968
+ !(answer.operation.method === "GET" && answer.operation.template === "/health") &&
969
+ !isRefund(answer.operation)
970
+ ? Effect.fail(new UnreadableBody())
971
+ : Effect.succeed(body);
972
+ };
973
+ /** Remove webhook signing secrets from bare, wrapped and list replies, never just a named projection. */
974
+ const WEBHOOK_SECRETS = /secret|signing|hmac/i;
975
+ function withoutWebhookSecrets(value) {
976
+ if (Array.isArray(value))
977
+ return value.map(withoutWebhookSecrets);
978
+ if (!value || typeof value !== "object")
979
+ return value;
980
+ return Object.fromEntries(Object.entries(value)
981
+ .filter(([name]) => !WEBHOOK_SECRETS.test(name))
982
+ .map(([name, child]) => [name, withoutWebhookSecrets(child)]));
983
+ }
984
+ export const safety = {
985
+ sensitiveFields: { names: [], choice: "drop" },
986
+ reviewed: {
987
+ resolve: (method, path) => ({ method, template: OVERFLOW_INDEX.resolve(method, path).op.path }),
988
+ redact: (body, operation) => (operation.template.startsWith("/webhooks") ? withoutWebhookSecrets(body) : body),
989
+ withholdsErrors: (operation) => operation.template.startsWith("/webhooks"),
990
+ },
991
+ };
992
+ /** /health is unauthenticated; one location is the cheapest authenticated identity hint. */
993
+ export const probe = {
994
+ operation: getLocations,
995
+ request: { query: { limit: 1, sortBy: "displayOrder" } },
996
+ describe: (reply, options) => {
997
+ const payload = asRecord(reply);
998
+ const first = asRecord(Array.isArray(payload["data"]) ? payload["data"][0] : undefined);
999
+ const total = payload["totalCount"];
1000
+ const where = typeof first["name"] === "string"
1001
+ ? ` The nonprofit's first location is "${first["name"]}"${typeof total === "number" ? ` of ${total}` : ""}.`
1002
+ : "";
1003
+ return `Overflow ${options.environment} accepted the client id and API key.${where}`;
1004
+ },
1005
+ };
1006
+ function asRecord(value) {
1007
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1008
+ }