@oomol-lab/open-connector 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/assets/open-connector/catalog/apps/airtable.json +134 -0
- package/assets/open-connector/catalog/apps/aisa.json +916 -76
- package/assets/open-connector/catalog/apps/cal.json +24 -6
- package/assets/open-connector/catalog/apps/discordbot.json +2 -2
- package/assets/open-connector/catalog/apps/enormail.json +411 -0
- package/assets/open-connector/catalog/apps/feishu_app_bot.json +158 -0
- package/assets/open-connector/catalog/apps/github.json +275 -0
- package/assets/open-connector/catalog/apps/gitlab.json +125 -0
- package/assets/open-connector/catalog/apps/gmail.json +151 -0
- package/assets/open-connector/catalog/apps/googlecalendar.json +206 -0
- package/assets/open-connector/catalog/apps/googledrive.json +479 -0
- package/assets/open-connector/catalog/apps/googlesheets.json +144 -0
- package/assets/open-connector/catalog/apps/hithink_finance.json +6 -3
- package/assets/open-connector/catalog/apps/indexed.json +1115 -0
- package/assets/open-connector/catalog/apps/linear.json +116 -0
- package/assets/open-connector/catalog/apps/notion.json +142 -0
- package/assets/open-connector/catalog/apps/one_drive.json +185 -0
- package/assets/open-connector/catalog/apps/outlook.json +182 -0
- package/assets/open-connector/catalog/apps/shopify.json +282 -0
- package/assets/open-connector/catalog/apps/slack.json +182 -0
- package/assets/open-connector/catalog/apps/spotify.json +46 -43
- package/assets/open-connector/catalog/apps/stripe.json +96 -0
- package/assets/open-connector/catalog/apps/telegram.json +138 -0
- package/assets/open-connector/catalog/apps/weixin_store.json +543 -2
- package/assets/open-connector/catalog/apps/woocommerce.json +127 -0
- package/assets/open-connector/catalog/apps/zendesk.json +152 -0
- package/assets/open-connector/catalog/apps/zerotier.json +9 -9
- package/assets/open-connector/catalog/apps-index.json +1 -1
- package/assets/open-connector/migrations/0014_saas_project.sql +55 -0
- package/assets/open-connector/migrations/0015_saas_cleanup_runtime.sql +8 -0
- package/assets/open-connector/migrations/0016_trigger_policy.sql +1 -0
- package/assets/open-connector/migrations/0017_trigger_subscriptions.sql +17 -0
- package/assets/open-connector/migrations/postgresql/0014_saas_project.sql +55 -0
- package/assets/open-connector/migrations/postgresql/0015_saas_cleanup_runtime.sql +8 -0
- package/assets/open-connector/migrations/postgresql/0016_trigger_policy.sql +1 -0
- package/assets/open-connector/migrations/postgresql/0017_trigger_subscriptions.sql +17 -0
- package/package.json +2 -2
- package/src/connection-service.d.ts +40 -7
- package/src/connection-service.js +60 -18
- package/src/core/action-policy.d.ts +8 -1
- package/src/core/action-policy.js +51 -0
- package/src/core/cast.d.ts +3 -0
- package/src/core/cast.js +4 -1
- package/src/core/guarded-fetch.d.ts +5 -0
- package/src/core/guarded-fetch.js +13 -4
- package/src/core/remote-http.d.ts +33 -0
- package/src/core/remote-http.js +104 -0
- package/src/core/request.d.ts +1 -0
- package/src/core/request.js +7 -0
- package/src/core/types.d.ts +4 -0
- package/src/marketplace/marketplace-service.d.ts +0 -1
- package/src/marketplace/marketplace-service.js +80 -92
- package/src/mcp.js +19 -5
- package/src/oauth/oauth-flow-service.d.ts +8 -1
- package/src/oauth/oauth-flow-service.js +10 -4
- package/src/providers/action-contracts.generated.d.ts +4 -2
- package/src/providers/airtable/executors.d.ts +3 -0
- package/src/providers/airtable/executors.js +2 -0
- package/src/providers/airtable/trigger-on-record-changed.d.ts +2 -0
- package/src/providers/airtable/trigger-on-record-changed.definition.d.ts +4 -0
- package/src/providers/airtable/trigger-on-record-changed.definition.js +54 -0
- package/src/providers/airtable/trigger-on-record-changed.js +235 -0
- package/src/providers/aisa/executors.js +196 -22
- package/src/providers/cal/actions.js +5 -1
- package/src/providers/enormail/executors.d.ts +4 -0
- package/src/providers/enormail/executors.js +97 -0
- package/src/providers/feishu_app_bot/executors.d.ts +3 -0
- package/src/providers/feishu_app_bot/executors.js +2 -0
- package/src/providers/feishu_app_bot/trigger-config.d.ts +1 -0
- package/src/providers/feishu_app_bot/trigger-config.js +10 -0
- package/src/providers/feishu_app_bot/trigger-on-event.d.ts +2 -0
- package/src/providers/feishu_app_bot/trigger-on-event.definition.d.ts +4 -0
- package/src/providers/feishu_app_bot/trigger-on-event.definition.js +63 -0
- package/src/providers/feishu_app_bot/trigger-on-event.js +29 -0
- package/src/providers/feishu_app_bot/trigger-subscriptions.d.ts +5 -0
- package/src/providers/feishu_app_bot/trigger-subscriptions.js +70 -0
- package/src/providers/github/executors.d.ts +3 -0
- package/src/providers/github/executors.js +6 -0
- package/src/providers/github/trigger-on-repo-event.d.ts +2 -0
- package/src/providers/github/trigger-on-repo-event.definition.d.ts +4 -0
- package/src/providers/github/trigger-on-repo-event.definition.js +94 -0
- package/src/providers/github/trigger-on-repo-event.js +168 -0
- package/src/providers/github/trigger-watch-pull-request.d.ts +2 -0
- package/src/providers/github/trigger-watch-pull-request.definition.d.ts +4 -0
- package/src/providers/github/trigger-watch-pull-request.definition.js +49 -0
- package/src/providers/github/trigger-watch-pull-request.js +106 -0
- package/src/providers/gitlab/executors.d.ts +3 -0
- package/src/providers/gitlab/executors.js +2 -0
- package/src/providers/gitlab/trigger-on-project-event.d.ts +2 -0
- package/src/providers/gitlab/trigger-on-project-event.definition.d.ts +5 -0
- package/src/providers/gitlab/trigger-on-project-event.definition.js +63 -0
- package/src/providers/gitlab/trigger-on-project-event.js +186 -0
- package/src/providers/gmail/executors.d.ts +3 -0
- package/src/providers/gmail/executors.js +2 -0
- package/src/providers/gmail/trigger-on-message-received.d.ts +2 -0
- package/src/providers/gmail/trigger-on-message-received.definition.d.ts +4 -0
- package/src/providers/gmail/trigger-on-message-received.definition.js +74 -0
- package/src/providers/gmail/trigger-on-message-received.js +232 -0
- package/src/providers/googlecalendar/executors.d.ts +3 -0
- package/src/providers/googlecalendar/executors.js +2 -0
- package/src/providers/googlecalendar/trigger-on-event-changed.d.ts +2 -0
- package/src/providers/googlecalendar/trigger-on-event-changed.definition.d.ts +4 -0
- package/src/providers/googlecalendar/trigger-on-event-changed.definition.js +74 -0
- package/src/providers/googlecalendar/trigger-on-event-changed.js +233 -0
- package/src/providers/googledrive/executors.d.ts +3 -0
- package/src/providers/googledrive/executors.js +7 -0
- package/src/providers/googledrive/trigger-changes.d.ts +12 -0
- package/src/providers/googledrive/trigger-changes.definition.d.ts +7 -0
- package/src/providers/googledrive/trigger-changes.definition.js +101 -0
- package/src/providers/googledrive/trigger-changes.js +452 -0
- package/src/providers/googledrive/trigger-on-file-change.d.ts +2 -0
- package/src/providers/googledrive/trigger-on-file-change.definition.d.ts +4 -0
- package/src/providers/googledrive/trigger-on-file-change.definition.js +77 -0
- package/src/providers/googledrive/trigger-on-file-change.js +258 -0
- package/src/providers/googlesheets/executors.d.ts +3 -0
- package/src/providers/googlesheets/executors.js +2 -0
- package/src/providers/googlesheets/trigger-on-row-added.d.ts +2 -0
- package/src/providers/googlesheets/trigger-on-row-added.definition.d.ts +4 -0
- package/src/providers/googlesheets/trigger-on-row-added.definition.js +54 -0
- package/src/providers/googlesheets/trigger-on-row-added.js +234 -0
- package/src/providers/hithink_finance/runtime.js +1 -1
- package/src/providers/indexed/executors.d.ts +4 -0
- package/src/providers/indexed/executors.js +16 -0
- package/src/providers/indexed/runtime.d.ts +26 -0
- package/src/providers/indexed/runtime.js +129 -0
- package/src/providers/linear/executors.d.ts +3 -0
- package/src/providers/linear/executors.js +2 -0
- package/src/providers/linear/trigger-on-issue-changed.d.ts +2 -0
- package/src/providers/linear/trigger-on-issue-changed.definition.d.ts +5 -0
- package/src/providers/linear/trigger-on-issue-changed.definition.js +43 -0
- package/src/providers/linear/trigger-on-issue-changed.js +215 -0
- package/src/providers/notion/executors.d.ts +3 -0
- package/src/providers/notion/executors.js +2 -0
- package/src/providers/notion/trigger-on-database-page-event.d.ts +2 -0
- package/src/providers/notion/trigger-on-database-page-event.definition.d.ts +4 -0
- package/src/providers/notion/trigger-on-database-page-event.definition.js +63 -0
- package/src/providers/notion/trigger-on-database-page-event.js +293 -0
- package/src/providers/one_drive/executors.d.ts +3 -0
- package/src/providers/one_drive/executors.js +2 -0
- package/src/providers/one_drive/trigger-on-item-changed.d.ts +2 -0
- package/src/providers/one_drive/trigger-on-item-changed.definition.d.ts +4 -0
- package/src/providers/one_drive/trigger-on-item-changed.definition.js +63 -0
- package/src/providers/one_drive/trigger-on-item-changed.js +214 -0
- package/src/providers/outlook/executors.d.ts +3 -0
- package/src/providers/outlook/executors.js +2 -0
- package/src/providers/outlook/trigger-on-message-received.d.ts +2 -0
- package/src/providers/outlook/trigger-on-message-received.definition.d.ts +4 -0
- package/src/providers/outlook/trigger-on-message-received.definition.js +93 -0
- package/src/providers/outlook/trigger-on-message-received.js +226 -0
- package/src/providers/outlook_calendar/executors.js +6 -0
- package/src/providers/provider-loader.d.ts +5 -0
- package/src/providers/provider-loader.js +4 -0
- package/src/providers/registry.generated.js +2 -0
- package/src/providers/shopify/executors.d.ts +3 -0
- package/src/providers/shopify/executors.js +2 -0
- package/src/providers/shopify/trigger-on-shop-event.d.ts +2 -0
- package/src/providers/shopify/trigger-on-shop-event.definition.d.ts +4 -0
- package/src/providers/shopify/trigger-on-shop-event.definition.js +214 -0
- package/src/providers/shopify/trigger-on-shop-event.js +165 -0
- package/src/providers/slack/executors.d.ts +3 -0
- package/src/providers/slack/executors.js +2 -0
- package/src/providers/slack/trigger-on-message-posted.d.ts +2 -0
- package/src/providers/slack/trigger-on-message-posted.definition.d.ts +4 -0
- package/src/providers/slack/trigger-on-message-posted.definition.js +80 -0
- package/src/providers/slack/trigger-on-message-posted.js +176 -0
- package/src/providers/spotify/runtime.js +15 -4
- package/src/providers/stripe/executors.d.ts +3 -0
- package/src/providers/stripe/executors.js +2 -0
- package/src/providers/stripe/trigger-on-event.d.ts +2 -0
- package/src/providers/stripe/trigger-on-event.definition.d.ts +4 -0
- package/src/providers/stripe/trigger-on-event.definition.js +43 -0
- package/src/providers/stripe/trigger-on-event.js +212 -0
- package/src/providers/telegram/executors.d.ts +3 -0
- package/src/providers/telegram/executors.js +2 -0
- package/src/providers/telegram/trigger-on-update.d.ts +2 -0
- package/src/providers/telegram/trigger-on-update.definition.d.ts +5 -0
- package/src/providers/telegram/trigger-on-update.definition.js +78 -0
- package/src/providers/telegram/trigger-on-update.js +141 -0
- package/src/providers/weixin_store/access-token.d.ts +2 -1
- package/src/providers/weixin_store/access-token.js +15 -4
- package/src/providers/weixin_store/executors.js +97 -12
- package/src/providers/woocommerce/executors.d.ts +3 -0
- package/src/providers/woocommerce/executors.js +2 -0
- package/src/providers/woocommerce/trigger-on-store-event.d.ts +2 -0
- package/src/providers/woocommerce/trigger-on-store-event.definition.d.ts +4 -0
- package/src/providers/woocommerce/trigger-on-store-event.definition.js +55 -0
- package/src/providers/woocommerce/trigger-on-store-event.js +179 -0
- package/src/providers/zendesk/executors.d.ts +3 -0
- package/src/providers/zendesk/executors.js +2 -0
- package/src/providers/zendesk/trigger-on-event.d.ts +2 -0
- package/src/providers/zendesk/trigger-on-event.definition.d.ts +5 -0
- package/src/providers/zendesk/trigger-on-event.definition.js +101 -0
- package/src/providers/zendesk/trigger-on-event.js +188 -0
- package/src/saas/saas-cleanup-service.d.ts +26 -0
- package/src/saas/saas-cleanup-service.js +124 -0
- package/src/saas/saas-client.d.ts +86 -0
- package/src/saas/saas-client.js +369 -0
- package/src/saas/saas-execution-service.d.ts +15 -0
- package/src/saas/saas-execution-service.js +21 -0
- package/src/saas/saas-oauth-service.d.ts +25 -0
- package/src/saas/saas-oauth-service.js +197 -0
- package/src/saas/saas-project-service.d.ts +61 -0
- package/src/saas/saas-project-service.js +211 -0
- package/src/server/actions/action-idempotency.d.ts +1 -0
- package/src/server/actions/action-idempotency.js +1 -0
- package/src/server/actions/action-runner.d.ts +7 -0
- package/src/server/actions/action-runner.js +43 -7
- package/src/server/actions/run-log-summary.js +9 -0
- package/src/server/api/auth.d.ts +1 -0
- package/src/server/api/auth.js +13 -2
- package/src/server/api/cache-policy.js +4 -1
- package/src/server/api/connection-input.d.ts +7 -1
- package/src/server/api/connection-input.js +7 -1
- package/src/server/api/connection-routes.d.ts +3 -1
- package/src/server/api/connection-routes.js +21 -3
- package/src/server/api/http-utils.d.ts +4 -3
- package/src/server/api/oauth-completion-page.d.ts +124 -0
- package/src/server/api/oauth-completion-page.js +113 -18
- package/src/server/api/openapi.js +112 -14
- package/src/server/api/policy-input.js +6 -0
- package/src/server/api/runtime-api.d.ts +10 -2
- package/src/server/api/runtime-api.js +17 -4
- package/src/server/api/saas-completion-page.d.ts +2 -0
- package/src/server/api/saas-completion-page.js +103 -0
- package/src/server/connect-app.d.ts +5 -0
- package/src/server/connect-app.js +50 -0
- package/src/server/connect-server.d.ts +12 -0
- package/src/server/connect-server.js +147 -13
- package/src/server/connector-runtime.d.ts +3 -1
- package/src/server/connector-runtime.js +5 -2
- package/src/server/files/transit-files.js +16 -7
- package/src/server/proxy/proxy-runner.d.ts +5 -1
- package/src/server/proxy/proxy-runner.js +72 -26
- package/src/server/storage/connection-request-store.d.ts +41 -1
- package/src/server/storage/connection-request-store.js +245 -20
- package/src/server/storage/connection-store.d.ts +16 -0
- package/src/server/storage/connection-store.js +119 -0
- package/src/server/storage/node-runtime-database.js +3 -3
- package/src/server/storage/{postgres-migrations.d.ts → postgres/migrations.d.ts} +2 -2
- package/src/server/storage/{postgres-migrations.js → postgres/migrations.js} +1 -1
- package/src/server/storage/postgres/runtime-store.d.ts +43 -0
- package/src/server/storage/{postgres-runtime-store.js → postgres/runtime-store.js} +59 -94
- package/src/server/storage/runtime-database.d.ts +4 -0
- package/src/server/storage/runtime-sql.d.ts +1 -1
- package/src/server/storage/runtime-sql.js +2 -1
- package/src/server/storage/runtime-store.d.ts +1 -0
- package/src/server/storage/runtime-token-service.d.ts +2 -0
- package/src/server/storage/runtime-token-service.js +3 -0
- package/src/server/storage/saas-project-store.d.ts +77 -0
- package/src/server/storage/saas-project-store.js +273 -0
- package/src/server/storage/{sqlite-runtime-store.d.ts → sqlite/runtime-store.d.ts} +21 -25
- package/src/server/storage/{sqlite-runtime-store.js → sqlite/runtime-store.js} +100 -115
- package/src/server/storage/trigger-store.d.ts +16 -0
- package/src/server/storage/trigger-store.js +96 -0
- package/src/triggers/common/config.d.ts +2 -0
- package/src/triggers/common/config.js +17 -0
- package/src/triggers/common/configOptions.d.ts +13 -0
- package/src/triggers/common/configOptions.js +1 -0
- package/src/triggers/common/encoding.d.ts +3 -0
- package/src/triggers/common/encoding.js +19 -0
- package/src/triggers/common/integration.d.ts +115 -0
- package/src/triggers/common/integration.js +31 -0
- package/src/triggers/common/json.d.ts +6 -0
- package/src/triggers/common/json.js +91 -0
- package/src/triggers/common/poll.d.ts +41 -0
- package/src/triggers/common/poll.js +15 -0
- package/src/triggers/common/proxy.d.ts +14 -0
- package/src/triggers/common/proxy.js +1 -0
- package/src/triggers/common/types.d.ts +42 -0
- package/src/triggers/common/types.js +1 -0
- package/src/triggers/maintenance.d.ts +40 -0
- package/src/triggers/maintenance.js +120 -0
- package/src/triggers/metadata.d.ts +8 -0
- package/src/triggers/metadata.js +1 -0
- package/src/triggers/request.d.ts +33 -0
- package/src/triggers/request.js +52 -0
- package/src/triggers/resources.d.ts +12 -0
- package/src/triggers/resources.js +121 -0
- package/src/triggers/signature.d.ts +4 -0
- package/src/triggers/signature.js +48 -0
- package/src/triggers/store.d.ts +29 -0
- package/src/triggers/store.js +1 -0
- package/src/triggers/subscriptions.d.ts +22 -0
- package/src/triggers/subscriptions.js +220 -0
- package/src/triggers/trigger-runner.d.ts +34 -0
- package/src/triggers/trigger-runner.js +169 -0
- package/src/server/storage/postgres-runtime-store.d.ts +0 -39
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { optionalRecord, optionalString } from "../../core/cast.js";
|
|
2
|
-
import { defineApiKeyProviderExecutors, defineProviderProxy, providerInputError, ProviderRequestError,
|
|
2
|
+
import { defineApiKeyProviderExecutors, defineProviderProxy, providerInputError, ProviderRequestError, runProviderRequest, } from "../provider-runtime.js";
|
|
3
3
|
const service = "aisa";
|
|
4
4
|
const aisaApiOrigin = "https://api.aisa.one";
|
|
5
5
|
function dataForSeoRoute(path, body) {
|
|
@@ -215,9 +215,10 @@ const aisaActionRoutes = {
|
|
|
215
215
|
query: { woeid: "woeid", count: "count" },
|
|
216
216
|
},
|
|
217
217
|
enrich_apollo_person: {
|
|
218
|
-
path: "/apis/
|
|
218
|
+
path: "/apis/v1/apollo/people/match",
|
|
219
219
|
method: "POST",
|
|
220
|
-
query: {
|
|
220
|
+
query: {},
|
|
221
|
+
body: {
|
|
221
222
|
firstName: "first_name",
|
|
222
223
|
lastName: "last_name",
|
|
223
224
|
name: "name",
|
|
@@ -230,7 +231,7 @@ const aisaActionRoutes = {
|
|
|
230
231
|
},
|
|
231
232
|
},
|
|
232
233
|
enrich_apollo_people: {
|
|
233
|
-
path: "/apis/
|
|
234
|
+
path: "/apis/v1/apollo/people/bulk_match",
|
|
234
235
|
method: "POST",
|
|
235
236
|
query: {},
|
|
236
237
|
body: { people: "details" },
|
|
@@ -238,16 +239,16 @@ const aisaActionRoutes = {
|
|
|
238
239
|
bodyKeyAliases: { personId: "id" },
|
|
239
240
|
},
|
|
240
241
|
enrich_apollo_organization: {
|
|
241
|
-
path: "/apis/
|
|
242
|
+
path: "/apis/v1/apollo/organizations/enrich",
|
|
242
243
|
query: { domain: "domain" },
|
|
243
244
|
},
|
|
244
245
|
enrich_apollo_organizations: {
|
|
245
|
-
path: "/apis/
|
|
246
|
+
path: "/apis/v1/apollo/organizations/bulk_enrich",
|
|
246
247
|
method: "POST",
|
|
247
248
|
query: { domains: "domains[]" },
|
|
248
249
|
},
|
|
249
250
|
search_apollo_people: {
|
|
250
|
-
path: "/apis/
|
|
251
|
+
path: "/apis/v1/apollo/mixed_people/api_search",
|
|
251
252
|
method: "POST",
|
|
252
253
|
query: {
|
|
253
254
|
titles: "person_titles[]",
|
|
@@ -264,7 +265,7 @@ const aisaActionRoutes = {
|
|
|
264
265
|
},
|
|
265
266
|
},
|
|
266
267
|
search_apollo_organizations: {
|
|
267
|
-
path: "/apis/
|
|
268
|
+
path: "/apis/v1/apollo/mixed_companies/search",
|
|
268
269
|
method: "POST",
|
|
269
270
|
query: {
|
|
270
271
|
domains: "q_organization_domains_list[]",
|
|
@@ -278,17 +279,17 @@ const aisaActionRoutes = {
|
|
|
278
279
|
},
|
|
279
280
|
},
|
|
280
281
|
get_apollo_organization: {
|
|
281
|
-
path: "/apis/
|
|
282
|
+
path: "/apis/v1/apollo/organizations/{organizationId}",
|
|
282
283
|
pathParams: { organizationId: "organizationId" },
|
|
283
284
|
query: {},
|
|
284
285
|
},
|
|
285
286
|
get_apollo_job_postings: {
|
|
286
|
-
path: "/apis/
|
|
287
|
+
path: "/apis/v1/apollo/organizations/{organizationId}/job_postings",
|
|
287
288
|
pathParams: { organizationId: "organizationId" },
|
|
288
289
|
query: { page: "page", perPage: "per_page" },
|
|
289
290
|
},
|
|
290
291
|
search_apollo_company_news: {
|
|
291
|
-
path: "/apis/
|
|
292
|
+
path: "/apis/v1/apollo/news_articles/search",
|
|
292
293
|
method: "POST",
|
|
293
294
|
query: {
|
|
294
295
|
organizationIds: "organization_ids[]",
|
|
@@ -510,46 +511,105 @@ const aisaActionRoutes = {
|
|
|
510
511
|
query: {},
|
|
511
512
|
body: { profileUrl: "profile_url" },
|
|
512
513
|
},
|
|
514
|
+
get_semrush_domain_overview: {
|
|
515
|
+
path: "/apis/v1/semrush/domain-overview",
|
|
516
|
+
query: { domain: "domain", database: "database" },
|
|
517
|
+
response: {
|
|
518
|
+
type: "semicolon",
|
|
519
|
+
header: "optional",
|
|
520
|
+
columns: ["Database", "Domain", "Rank", "OrganicKeywords", "OrganicTraffic", "OrganicCost", "AdwordsKeywords"],
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
get_semrush_organic_results: {
|
|
524
|
+
path: "/apis/v1/semrush/keyword-organic-results",
|
|
525
|
+
query: { phrase: "phrase", database: "database" },
|
|
526
|
+
response: { type: "semicolon", header: "required" },
|
|
527
|
+
},
|
|
528
|
+
get_semrush_domain_organic_keywords: {
|
|
529
|
+
path: "/apis/v1/semrush/domain-organic-keywords",
|
|
530
|
+
query: { domain: "domain", database: "database" },
|
|
531
|
+
response: { type: "semicolon", header: "required" },
|
|
532
|
+
},
|
|
533
|
+
get_semrush_organic_competitors: {
|
|
534
|
+
path: "/apis/v1/semrush/domain-organic-competitors",
|
|
535
|
+
query: { domain: "domain", database: "database" },
|
|
536
|
+
response: { type: "semicolon", header: "required" },
|
|
537
|
+
},
|
|
538
|
+
get_semrush_url_organic_keywords: {
|
|
539
|
+
path: "/apis/v1/semrush/url-organic-keywords",
|
|
540
|
+
query: { url: "url", database: "database" },
|
|
541
|
+
response: { type: "semicolon", header: "required" },
|
|
542
|
+
},
|
|
543
|
+
get_semrush_backlink_anchors: {
|
|
544
|
+
path: "/apis/v1/semrush/backlink-anchors",
|
|
545
|
+
query: { target: "target", targetType: "target_type" },
|
|
546
|
+
response: { type: "semicolon", header: "required" },
|
|
547
|
+
},
|
|
548
|
+
get_semrush_indexed_pages: {
|
|
549
|
+
path: "/apis/v1/semrush/indexed-pages",
|
|
550
|
+
query: { target: "target", targetType: "target_type" },
|
|
551
|
+
response: { type: "semicolon", header: "required" },
|
|
552
|
+
},
|
|
513
553
|
get_semrush_keyword_overview: {
|
|
514
554
|
path: "/apis/v1/semrush/keyword-overview",
|
|
515
555
|
query: { phrase: "phrase", database: "database" },
|
|
556
|
+
response: {
|
|
557
|
+
type: "semicolon",
|
|
558
|
+
header: "optional",
|
|
559
|
+
columns: ["Keyword", "SearchVolume", "CPC", "Competition", "NumberOfResults"],
|
|
560
|
+
},
|
|
561
|
+
omitQueryDefaults: { database: "us" },
|
|
516
562
|
},
|
|
517
563
|
get_semrush_keyword_difficulty: {
|
|
518
564
|
path: "/apis/v1/semrush/keyword-difficulty",
|
|
519
565
|
query: { phrases: "phrase", database: "database" },
|
|
520
566
|
joined: { phrases: ";" },
|
|
567
|
+
response: { type: "semicolon", header: "required" },
|
|
521
568
|
},
|
|
522
569
|
get_semrush_broad_match_keywords: {
|
|
523
570
|
path: "/apis/v1/semrush/broad-match-keywords",
|
|
524
571
|
query: { phrase: "phrase", database: "database" },
|
|
572
|
+
response: { type: "semicolon", header: "required" },
|
|
525
573
|
},
|
|
526
574
|
get_semrush_question_keywords: {
|
|
527
575
|
path: "/apis/v1/semrush/question-keywords",
|
|
528
576
|
query: { phrase: "phrase", database: "database" },
|
|
577
|
+
response: { type: "semicolon", header: "required" },
|
|
529
578
|
},
|
|
530
579
|
get_semrush_domain_rank_history: {
|
|
531
580
|
path: "/apis/v1/semrush/domain-rank-history",
|
|
532
581
|
query: { domain: "domain", database: "database" },
|
|
582
|
+
response: { type: "semicolon", header: "required" },
|
|
533
583
|
},
|
|
534
584
|
compare_semrush_domains: {
|
|
535
585
|
path: "/apis/v1/semrush/domain-vs-domain",
|
|
536
586
|
query: { comparison: "domains", database: "database" },
|
|
587
|
+
response: { type: "semicolon", header: "required" },
|
|
537
588
|
},
|
|
538
589
|
get_semrush_backlinks_overview: {
|
|
539
590
|
path: "/apis/v1/semrush/backlinks-overview",
|
|
540
591
|
query: { target: "target" },
|
|
592
|
+
response: {
|
|
593
|
+
type: "semicolon",
|
|
594
|
+
header: "optional",
|
|
595
|
+
columns: ["ascore", "total_backlinks", "referring_domains", "referring_urls", "referring_ips"],
|
|
596
|
+
headerAliases: [["ascore", "total", "domains_num", "urls_num", "ips_num"]],
|
|
597
|
+
},
|
|
541
598
|
},
|
|
542
599
|
get_semrush_backlinks: {
|
|
543
600
|
path: "/apis/v1/semrush/backlinks",
|
|
544
601
|
query: { target: "target", targetType: "target_type" },
|
|
602
|
+
response: { type: "semicolon", header: "required" },
|
|
545
603
|
},
|
|
546
604
|
get_semrush_referring_domains: {
|
|
547
605
|
path: "/apis/v1/semrush/referring-domains",
|
|
548
606
|
query: { target: "target", targetType: "target_type" },
|
|
607
|
+
response: { type: "semicolon", header: "required" },
|
|
549
608
|
},
|
|
550
609
|
get_semrush_backlink_competitors: {
|
|
551
610
|
path: "/apis/v1/semrush/backlink-competitors",
|
|
552
611
|
query: { target: "target", targetType: "target_type" },
|
|
612
|
+
response: { type: "semicolon", header: "required" },
|
|
553
613
|
},
|
|
554
614
|
get_stock_price_snapshot: {
|
|
555
615
|
path: "/apis/v1/financial/prices/snapshot",
|
|
@@ -756,14 +816,14 @@ function camelToSnakeCase(value) {
|
|
|
756
816
|
}
|
|
757
817
|
return output;
|
|
758
818
|
}
|
|
759
|
-
function buildAisaQuery(input, mapping, commaSeparated, joined, fixed) {
|
|
819
|
+
function buildAisaQuery(input, mapping, commaSeparated, joined, fixed, omitDefaults) {
|
|
760
820
|
const query = new URLSearchParams();
|
|
761
821
|
for (const [name, value] of Object.entries(fixed)) {
|
|
762
822
|
query.set(name, value);
|
|
763
823
|
}
|
|
764
824
|
for (const [inputName, queryName] of Object.entries(mapping)) {
|
|
765
825
|
const value = input[inputName];
|
|
766
|
-
if (value == null) {
|
|
826
|
+
if (value == null || value === omitDefaults[inputName]) {
|
|
767
827
|
continue;
|
|
768
828
|
}
|
|
769
829
|
const queryNames = typeof queryName === "string" ? [queryName] : queryName;
|
|
@@ -796,7 +856,7 @@ function buildAisaQuery(input, mapping, commaSeparated, joined, fixed) {
|
|
|
796
856
|
}
|
|
797
857
|
const handlers = Object.fromEntries(Object.entries(aisaActionRoutes).map(([name, route]) => [
|
|
798
858
|
name,
|
|
799
|
-
(input, context) =>
|
|
859
|
+
(input, context) => requestAisa(buildAisaPath(route.path, input, route.pathParams), buildAisaQuery(input, route.query, route.commaSeparated ?? [], route.joined ?? {}, route.fixedQuery ?? {}, route.omitQueryDefaults ?? {}), context, route.method ?? "GET", buildAisaBody(input, route), "execute", route.response),
|
|
800
860
|
]));
|
|
801
861
|
export const executors = defineApiKeyProviderExecutors(service, handlers, {
|
|
802
862
|
skipDnsValidation: true,
|
|
@@ -805,11 +865,15 @@ export const proxy = defineProviderProxy({
|
|
|
805
865
|
service,
|
|
806
866
|
baseUrl: aisaApiOrigin,
|
|
807
867
|
auth: { type: "bearer" },
|
|
868
|
+
customizeRequest({ headers }) {
|
|
869
|
+
if (!headers.has("accept"))
|
|
870
|
+
headers.set("accept", "application/json, text/plain;q=0.9, */*;q=0.8");
|
|
871
|
+
},
|
|
808
872
|
skipDnsValidation: true,
|
|
809
873
|
});
|
|
810
874
|
export const credentialValidators = {
|
|
811
875
|
async apiKey(input, { fetcher, signal }) {
|
|
812
|
-
const payload = optionalRecord(await
|
|
876
|
+
const payload = optionalRecord(await requestAisa("/v1/credits/balance", new URLSearchParams(), { apiKey: input.apiKey, fetcher, signal }, "GET", undefined, "validate"));
|
|
813
877
|
if (!payload)
|
|
814
878
|
throw new ProviderRequestError(502, "AIsa balance response must be an object");
|
|
815
879
|
return {
|
|
@@ -819,11 +883,14 @@ export const credentialValidators = {
|
|
|
819
883
|
};
|
|
820
884
|
},
|
|
821
885
|
};
|
|
822
|
-
async function
|
|
886
|
+
async function requestAisa(path, query, context, method, body, phase = "execute", responseFormat) {
|
|
823
887
|
return runProviderRequest({ signal: context.signal, label: "AIsa" }, async (signal) => {
|
|
824
888
|
const url = new URL(path, aisaApiOrigin);
|
|
825
889
|
url.search = query.toString();
|
|
826
|
-
const headers = new Headers({
|
|
890
|
+
const headers = new Headers({
|
|
891
|
+
accept: responseFormat ? "text/plain, application/json;q=0.9" : "application/json",
|
|
892
|
+
authorization: `Bearer ${context.apiKey}`,
|
|
893
|
+
});
|
|
827
894
|
if (body !== undefined)
|
|
828
895
|
headers.set("content-type", "application/json");
|
|
829
896
|
const response = await context.fetcher(url, {
|
|
@@ -832,19 +899,126 @@ async function requestAisaJson(path, query, context, method, body, phase = "exec
|
|
|
832
899
|
signal,
|
|
833
900
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
834
901
|
});
|
|
835
|
-
const payload = await
|
|
836
|
-
emptyBody: null,
|
|
837
|
-
invalidJsonMessage: "AIsa returned invalid JSON",
|
|
838
|
-
});
|
|
902
|
+
const payload = await readAisaPayload(response, responseFormat);
|
|
839
903
|
if (!response.ok)
|
|
840
904
|
throw createAisaError(response, payload, phase);
|
|
841
905
|
return payload;
|
|
842
906
|
});
|
|
843
907
|
}
|
|
908
|
+
async function readAisaPayload(response, responseFormat) {
|
|
909
|
+
const text = await response.text();
|
|
910
|
+
if (text.trim() === "") {
|
|
911
|
+
return response.ok && responseFormat?.type === "semicolon" ? createSemicolonOutput(text, responseFormat) : null;
|
|
912
|
+
}
|
|
913
|
+
if (response.ok && responseFormat?.type === "semicolon") {
|
|
914
|
+
return createSemicolonOutput(text, responseFormat);
|
|
915
|
+
}
|
|
916
|
+
try {
|
|
917
|
+
return JSON.parse(text);
|
|
918
|
+
}
|
|
919
|
+
catch {
|
|
920
|
+
if (!response.ok) {
|
|
921
|
+
return text;
|
|
922
|
+
}
|
|
923
|
+
throw new ProviderRequestError(502, "AIsa returned invalid JSON");
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
function createSemicolonOutput(rawText, responseFormat) {
|
|
927
|
+
const records = isEmptySemrushReport(rawText) ? [] : parseSemicolonRecords(rawText);
|
|
928
|
+
const columns = responseFormat.header === "required" ? (records.shift() ?? []) : [...(responseFormat.columns ?? [])];
|
|
929
|
+
const acceptedHeaders = [columns, ...(responseFormat.headerAliases ?? [])];
|
|
930
|
+
if (responseFormat.header === "optional" &&
|
|
931
|
+
records[0] &&
|
|
932
|
+
acceptedHeaders.some((header) => columnsMatch(records[0], header))) {
|
|
933
|
+
records.shift();
|
|
934
|
+
}
|
|
935
|
+
return { rawText, columns, rows: records };
|
|
936
|
+
}
|
|
937
|
+
function isEmptySemrushReport(rawText) {
|
|
938
|
+
const message = rawText.trim();
|
|
939
|
+
if (!message.startsWith("ERROR ")) {
|
|
940
|
+
return false;
|
|
941
|
+
}
|
|
942
|
+
const separatorIndex = message.indexOf(" :: ");
|
|
943
|
+
const code = separatorIndex === -1 ? undefined : message.slice(6, separatorIndex).trim();
|
|
944
|
+
// Semrush code 50 means no matching data.
|
|
945
|
+
if (code === "50")
|
|
946
|
+
return true;
|
|
947
|
+
const detail = separatorIndex === -1 ? message : message.slice(separatorIndex + 4).trim();
|
|
948
|
+
throw new ProviderRequestError(502, code ? `Semrush error ${code}: ${detail}` : `Semrush error: ${detail}`);
|
|
949
|
+
}
|
|
950
|
+
function columnsMatch(values, columns) {
|
|
951
|
+
return (values.length === columns.length &&
|
|
952
|
+
values.every((value, index) => normalizeColumnName(value) === normalizeColumnName(columns[index])));
|
|
953
|
+
}
|
|
954
|
+
function normalizeColumnName(value) {
|
|
955
|
+
let output = "";
|
|
956
|
+
for (const character of value.toLowerCase()) {
|
|
957
|
+
const code = character.charCodeAt(0);
|
|
958
|
+
if ((code >= 48 && code <= 57) || (code >= 97 && code <= 122)) {
|
|
959
|
+
output += character;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
return output;
|
|
963
|
+
}
|
|
964
|
+
function parseSemicolonRecords(text) {
|
|
965
|
+
const records = [];
|
|
966
|
+
let record = [];
|
|
967
|
+
let field = "";
|
|
968
|
+
let quoted = false;
|
|
969
|
+
const commitField = () => {
|
|
970
|
+
record.push(field);
|
|
971
|
+
field = "";
|
|
972
|
+
};
|
|
973
|
+
const commitRecord = () => {
|
|
974
|
+
commitField();
|
|
975
|
+
records.push(record);
|
|
976
|
+
record = [];
|
|
977
|
+
};
|
|
978
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
979
|
+
const character = text[index];
|
|
980
|
+
if (quoted) {
|
|
981
|
+
if (character !== '"') {
|
|
982
|
+
field += character;
|
|
983
|
+
continue;
|
|
984
|
+
}
|
|
985
|
+
if (text[index + 1] === '"') {
|
|
986
|
+
field += '"';
|
|
987
|
+
index += 1;
|
|
988
|
+
continue;
|
|
989
|
+
}
|
|
990
|
+
quoted = false;
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
if (character === '"' && field === "") {
|
|
994
|
+
quoted = true;
|
|
995
|
+
}
|
|
996
|
+
else if (character === ";") {
|
|
997
|
+
commitField();
|
|
998
|
+
}
|
|
999
|
+
else if (character === "\n") {
|
|
1000
|
+
commitRecord();
|
|
1001
|
+
}
|
|
1002
|
+
else if (character !== "\r") {
|
|
1003
|
+
field += character;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
commitRecord();
|
|
1007
|
+
while (records.length > 0 && records.at(-1)?.every((value) => value === "")) {
|
|
1008
|
+
records.pop();
|
|
1009
|
+
}
|
|
1010
|
+
if (records[0]?.[0]?.charCodeAt(0) === 0xfeff) {
|
|
1011
|
+
records[0][0] = records[0][0].slice(1);
|
|
1012
|
+
}
|
|
1013
|
+
return records;
|
|
1014
|
+
}
|
|
844
1015
|
function createAisaError(response, payload, phase) {
|
|
845
|
-
const
|
|
1016
|
+
const errorValue = optionalRecord(payload)?.error;
|
|
1017
|
+
const error = optionalRecord(errorValue);
|
|
846
1018
|
const code = optionalString(error?.code);
|
|
847
1019
|
const message = optionalString(error?.message) ??
|
|
1020
|
+
optionalString(errorValue) ??
|
|
1021
|
+
optionalString(payload) ??
|
|
848
1022
|
optionalString(optionalRecord(payload)?.message) ??
|
|
849
1023
|
`AIsa request failed with status ${response.status}`;
|
|
850
1024
|
if (response.status === 429)
|
|
@@ -270,7 +270,11 @@ const createBookingInputSchema = s.object("Input payload for creating a Cal.com
|
|
|
270
270
|
guests: s.stringArray("Additional guest email addresses."),
|
|
271
271
|
meetingUrl: s.string("The meeting URL to attach to the booking."),
|
|
272
272
|
location: rawObject("The location payload for the booking."),
|
|
273
|
-
metadata:
|
|
273
|
+
metadata: s.optional({
|
|
274
|
+
...s.record("Additional booking metadata: at most 50 keys, each up to 40 characters, with string values up to 500 characters.", s.string("A metadata value, up to 500 characters.", { maxLength: 500 })),
|
|
275
|
+
maxProperties: 50,
|
|
276
|
+
propertyNames: s.string("A metadata key, up to 40 characters.", { maxLength: 40 }),
|
|
277
|
+
}),
|
|
274
278
|
lengthInMinutes: s.positiveInteger("The requested booking duration in minutes."),
|
|
275
279
|
routing: rawObject("Routing metadata for round-robin or collective bookings."),
|
|
276
280
|
emailVerificationCode: s.string("The email verification code for protected bookings."),
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CredentialValidators, ProviderExecutors, ProviderProxyExecutor } from "../../core/types.ts";
|
|
2
|
+
export declare const executors: ProviderExecutors;
|
|
3
|
+
export declare const credentialValidators: CredentialValidators;
|
|
4
|
+
export declare const proxy: ProviderProxyExecutor;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { optionalRecord, optionalString } from "../../core/cast.js";
|
|
2
|
+
import { encodePathSegment } from "../../core/request.js";
|
|
3
|
+
import { basicAuthorizationHeader, defineApiKeyProviderExecutors, defineProviderProxy, providerResponseError, ProviderRequestError, providerUserAgent, requiredInputString, requiredResponseRecord, runProviderRequest, } from "../provider-runtime.js";
|
|
4
|
+
const baseUrl = "https://api.enormail.eu/api/1.0";
|
|
5
|
+
async function request(endpoint, query, context) {
|
|
6
|
+
const url = new URL(`${baseUrl}/${endpoint}.json`);
|
|
7
|
+
for (const [key, value] of Object.entries(query)) {
|
|
8
|
+
if (value != null)
|
|
9
|
+
url.searchParams.set(key, String(value));
|
|
10
|
+
}
|
|
11
|
+
return runProviderRequest({ label: "Enormail", signal: context.signal }, async (signal) => {
|
|
12
|
+
const response = await context.fetcher(url, {
|
|
13
|
+
signal,
|
|
14
|
+
headers: {
|
|
15
|
+
authorization: basicAuthorizationHeader(`${context.apiKey}:`),
|
|
16
|
+
accept: "application/json",
|
|
17
|
+
"user-agent": providerUserAgent,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const text = await response.text();
|
|
21
|
+
let payload;
|
|
22
|
+
try {
|
|
23
|
+
payload = JSON.parse(text);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw new ProviderRequestError(response.ok ? 502 : response.status, `Enormail returned invalid JSON (HTTP ${response.status})`, undefined, response.status === 429 ? "rate_limited" : "provider_error");
|
|
27
|
+
}
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
const error = optionalRecord(payload);
|
|
30
|
+
const message = optionalString(error?.message) ?? optionalString(error?.Message) ?? optionalString(error?.error);
|
|
31
|
+
throw new ProviderRequestError(response.status, `Enormail HTTP ${response.status}${message ? `: ${message}` : ""}`, { providerCode: error?.code }, response.status === 429 ? "rate_limited" : "provider_error");
|
|
32
|
+
}
|
|
33
|
+
return payload;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function resourceId(value, fieldName) {
|
|
37
|
+
const id = requiredInputString(value, fieldName);
|
|
38
|
+
if (id === "." || id === "..")
|
|
39
|
+
throw new ProviderRequestError(400, "Invalid Enormail resource ID");
|
|
40
|
+
return encodePathSegment(id);
|
|
41
|
+
}
|
|
42
|
+
export const executors = defineApiKeyProviderExecutors("enormail", {
|
|
43
|
+
async get_account(_input, context) {
|
|
44
|
+
return requiredResponseRecord(await request("account", {}, context), "Enormail account");
|
|
45
|
+
},
|
|
46
|
+
async list_senders(_input, context) {
|
|
47
|
+
const senders = await request("account/senders", {}, context);
|
|
48
|
+
if (!Array.isArray(senders))
|
|
49
|
+
throw providerResponseError("Enormail returned an invalid collection");
|
|
50
|
+
return { senders };
|
|
51
|
+
},
|
|
52
|
+
async list_lists(input, context) {
|
|
53
|
+
const lists = await request("lists", { page: input.page }, context);
|
|
54
|
+
if (!Array.isArray(lists))
|
|
55
|
+
throw providerResponseError("Enormail returned an invalid collection");
|
|
56
|
+
return { lists };
|
|
57
|
+
},
|
|
58
|
+
async get_list(input, context) {
|
|
59
|
+
return requiredResponseRecord(await request(`lists/${resourceId(input.listid, "listid")}`, {}, context), "Enormail response");
|
|
60
|
+
},
|
|
61
|
+
async list_contacts(input, context) {
|
|
62
|
+
return requiredResponseRecord(await request(`contacts/${resourceId(input.listid, "listid")}/${input.state}`, { page: input.page }, context), "Enormail response");
|
|
63
|
+
},
|
|
64
|
+
async get_contact(input, context) {
|
|
65
|
+
return requiredResponseRecord(await request(`contacts/${resourceId(input.listid, "listid")}`, { email: input.email }, context), "Enormail response");
|
|
66
|
+
},
|
|
67
|
+
async list_mailings(input, context) {
|
|
68
|
+
return requiredResponseRecord(await request(`mailings/${input.state}`, { page: input.page }, context), "Enormail response");
|
|
69
|
+
},
|
|
70
|
+
async get_mailing_stats(input, context) {
|
|
71
|
+
return requiredResponseRecord(await request(`mailings/${resourceId(input.mailingid, "mailingid")}/stats`, {}, context), "Enormail response");
|
|
72
|
+
},
|
|
73
|
+
}, { skipDnsValidation: true });
|
|
74
|
+
export const credentialValidators = {
|
|
75
|
+
async apiKey(input, { fetcher, signal }) {
|
|
76
|
+
const account = requiredResponseRecord(await request("account", {}, { apiKey: input.apiKey, fetcher, signal }), "Enormail account");
|
|
77
|
+
const name = [optionalString(account.firstname), optionalString(account.lastname)].filter(Boolean).join(" ").trim();
|
|
78
|
+
return {
|
|
79
|
+
profile: {
|
|
80
|
+
accountId: optionalString(account.id),
|
|
81
|
+
displayName: name || optionalString(account.email) || "Enormail Account",
|
|
82
|
+
},
|
|
83
|
+
grantedScopes: [],
|
|
84
|
+
metadata: { accountId: optionalString(account.id), apiBaseUrl: baseUrl },
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export const proxy = defineProviderProxy({
|
|
89
|
+
service: "enormail",
|
|
90
|
+
baseUrl,
|
|
91
|
+
auth: { type: "api_key_basic", suffix: ":" },
|
|
92
|
+
skipDnsValidation: true,
|
|
93
|
+
customizeRequest({ headers }) {
|
|
94
|
+
if (!headers.has("accept"))
|
|
95
|
+
headers.set("accept", "application/json");
|
|
96
|
+
},
|
|
97
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { CredentialValidators, ProviderExecutors, ProviderProxyExecutor, TransitFileWriter } from "../../core/types.ts";
|
|
2
|
+
import type { IntegrationDefinition } from "../../triggers/common/integration.ts";
|
|
3
|
+
import type { PollDefinition } from "../../triggers/common/poll.ts";
|
|
2
4
|
import type { ProviderActionHandlerSubset } from "../provider-runtime.ts";
|
|
3
5
|
interface FeishuAppBotCredential {
|
|
4
6
|
appId: string;
|
|
@@ -16,4 +18,5 @@ export declare const feishuAppBotActionHandlers: ProviderActionHandlerSubset<"fe
|
|
|
16
18
|
export declare const executors: ProviderExecutors;
|
|
17
19
|
export declare const proxy: ProviderProxyExecutor;
|
|
18
20
|
export declare const credentialValidators: CredentialValidators;
|
|
21
|
+
export declare const triggers: readonly (IntegrationDefinition | PollDefinition)[];
|
|
19
22
|
export {};
|
|
@@ -27,6 +27,7 @@ import { createFeishuWhiteboardActionHandlers } from "../feishu/shared/whiteboar
|
|
|
27
27
|
import { createFeishuWikiActionHandlers } from "../feishu/shared/wiki-runtime.js";
|
|
28
28
|
import { createProviderProxyUrl, defineProviderExecutors, getProviderActionHandler, mapProviderActionHandlers, normalizeProviderProxyHeaders, providerFetch, ProviderRequestError, providerUserAgent, readProviderProxyErrorMessage, readProviderProxyResponse, requireCustomCredential, requiredInputString, toProviderProxyError, } from "../provider-runtime.js";
|
|
29
29
|
import { feishuAppBotActions, feishuAppBotProviderScopes } from "./actions.js";
|
|
30
|
+
import { feishuEvents } from "./trigger-on-event.js";
|
|
30
31
|
const service = "feishu_app_bot";
|
|
31
32
|
const feishuOpenBaseUrl = "https://open.feishu.cn/open-apis";
|
|
32
33
|
const feishuRequestTimeoutMs = 30_000;
|
|
@@ -1047,3 +1048,4 @@ function createFeishuRequestSignal(parent) {
|
|
|
1047
1048
|
function isAbortError(error) {
|
|
1048
1049
|
return error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError");
|
|
1049
1050
|
}
|
|
1051
|
+
export const triggers = [...feishuEvents];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function feishuResourceKind(events: readonly string[]): "document" | "calendar" | "approval" | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function feishuResourceKind(events) {
|
|
2
|
+
if (events.length == 0)
|
|
3
|
+
return;
|
|
4
|
+
if (events.every((event) => event.startsWith("drive.file.")))
|
|
5
|
+
return "document";
|
|
6
|
+
if (events.every((event) => event == "calendar.calendar.event.changed_v4"))
|
|
7
|
+
return "calendar";
|
|
8
|
+
if (events.every((event) => ["approval_instance", "approval_task", "approval_cc", "approval"].includes(event)))
|
|
9
|
+
return "approval";
|
|
10
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsonSchema as s } from "../../core/json-schema.js";
|
|
2
|
+
export const additionalSnapshot0 = {
|
|
3
|
+
key: "feishu_app_bot.on_event",
|
|
4
|
+
provider: "feishu_app_bot",
|
|
5
|
+
name: "on_event",
|
|
6
|
+
displayName: "Application Event",
|
|
7
|
+
description: "Receives selected Feishu application events through a shared event source.",
|
|
8
|
+
definitionVersion: 2,
|
|
9
|
+
type: "integration",
|
|
10
|
+
endpoint: {
|
|
11
|
+
methods: ["POST"],
|
|
12
|
+
body: { formats: ["json"], allowArray: false, allowEmpty: false },
|
|
13
|
+
successStatus: 200,
|
|
14
|
+
},
|
|
15
|
+
configInputs: [
|
|
16
|
+
{
|
|
17
|
+
handle: "sourceId",
|
|
18
|
+
jsonSchema: { ...s.string({ pattern: "^source_[0-9a-f]{32}$" }), title: "Event source" },
|
|
19
|
+
nullable: false,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
handle: "eventTypes",
|
|
23
|
+
jsonSchema: {
|
|
24
|
+
...s.array(s.string({ pattern: "^[a-z][a-z0-9_.]{0,127}$" }), {
|
|
25
|
+
minItems: 1,
|
|
26
|
+
maxItems: 200,
|
|
27
|
+
uniqueItems: true,
|
|
28
|
+
}),
|
|
29
|
+
title: "Event types",
|
|
30
|
+
},
|
|
31
|
+
nullable: false,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
handle: "chatIds",
|
|
35
|
+
jsonSchema: {
|
|
36
|
+
...s.array(s.string({ minLength: 1, maxLength: 256 }), { maxItems: 100, uniqueItems: true }),
|
|
37
|
+
title: "Chat IDs",
|
|
38
|
+
},
|
|
39
|
+
nullable: true,
|
|
40
|
+
description: "Leave empty to receive events from all chats available to the source.",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
handle: "resource",
|
|
44
|
+
jsonSchema: {
|
|
45
|
+
...s.object({
|
|
46
|
+
kind: s.stringEnum(["document", "calendar", "approval"]),
|
|
47
|
+
id: s.string({ minLength: 1, maxLength: 256 }),
|
|
48
|
+
documentType: s.stringEnum(["doc", "docx", "sheet", "bitable", "file", "folder"]),
|
|
49
|
+
}, { additionalProperties: false, required: ["kind", "id"] }),
|
|
50
|
+
title: "Resource subscription",
|
|
51
|
+
},
|
|
52
|
+
nullable: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
outputs: [
|
|
56
|
+
{ handle: "event", jsonSchema: s.string(), nullable: false },
|
|
57
|
+
{ handle: "deliveryId", jsonSchema: s.string(), nullable: false },
|
|
58
|
+
{ handle: "appId", jsonSchema: s.string(), nullable: false },
|
|
59
|
+
{ handle: "tenantKey", jsonSchema: s.string(), nullable: false },
|
|
60
|
+
{ handle: "occurredAt", jsonSchema: s.string(), nullable: true },
|
|
61
|
+
{ handle: "body", jsonSchema: { type: "object" }, nullable: false },
|
|
62
|
+
],
|
|
63
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PermanentIntegrationError } from "../../triggers/common/integration.js";
|
|
2
|
+
import { isJsonObject } from "../../triggers/common/json.js";
|
|
3
|
+
import { additionalSnapshot0 } from "./trigger-on-event.definition.js";
|
|
4
|
+
import { feishuSubscriptions, feishuResponse } from "./trigger-subscriptions.js";
|
|
5
|
+
export const feishuEvents = [
|
|
6
|
+
{
|
|
7
|
+
eventSource: "feishu",
|
|
8
|
+
resources: { subscriptions: (config) => feishuSubscriptions(config, "feishu_app_bot"), response: feishuResponse },
|
|
9
|
+
snapshot: additionalSnapshot0,
|
|
10
|
+
receive(context) {
|
|
11
|
+
if (context.eventSourceId !== context.config.sourceId)
|
|
12
|
+
return { outcome: "respond", status: 404, body: "", contentType: "text/plain" };
|
|
13
|
+
const payload = context.payload;
|
|
14
|
+
if (!isJsonObject(payload) ||
|
|
15
|
+
typeof payload.deliveryId !== "string" ||
|
|
16
|
+
payload.deliveryId.length === 0 ||
|
|
17
|
+
typeof payload.event !== "string" ||
|
|
18
|
+
typeof payload.appId !== "string" ||
|
|
19
|
+
typeof payload.tenantKey !== "string" ||
|
|
20
|
+
(payload.occurredAt != null && typeof payload.occurredAt !== "string") ||
|
|
21
|
+
!isJsonObject(payload.body))
|
|
22
|
+
throw new PermanentIntegrationError("Invalid Feishu shared event payload.");
|
|
23
|
+
return { outcome: "event", dedupeKey: payload.deliveryId, outputs: payload };
|
|
24
|
+
},
|
|
25
|
+
async reconcile() {
|
|
26
|
+
throw new PermanentIntegrationError("This deployment does not support shared Feishu event sources.");
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ResourceSubscription } from "../../triggers/common/integration.ts";
|
|
2
|
+
import type { ConnectorProxyResult } from "../../triggers/common/proxy.ts";
|
|
3
|
+
import type { JsonValue } from "../../triggers/common/types.ts";
|
|
4
|
+
export declare function feishuSubscriptions(config: Readonly<Record<string, JsonValue>>, provider: string): readonly ResourceSubscription[];
|
|
5
|
+
export declare function feishuResponse(result: ConnectorProxyResult): Readonly<Record<string, JsonValue>>;
|