runline 0.33.0 → 0.34.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/dist/auth/oauth2.d.ts +7 -1
- package/dist/auth/oauth2.js +10 -0
- package/dist/auth/token.d.ts +1 -0
- package/dist/auth/token.js +19 -1
- package/dist/auth/types.d.ts +22 -1
- package/dist/core/engine.d.ts +7 -0
- package/dist/core/engine.js +9 -0
- package/dist/credentials/policy.d.ts +53 -1
- package/dist/credentials/policy.js +146 -6
- package/dist/credentials/registry.d.ts +9 -0
- package/dist/credentials/registry.js +179 -22
- package/dist/credentials/transport.d.ts +48 -2
- package/dist/credentials/transport.js +248 -70
- package/dist/credentials/types.d.ts +167 -10
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/plugin/api.d.ts +7 -0
- package/dist/plugin/api.js +7 -0
- package/dist/plugin/types.d.ts +12 -0
- package/dist/plugins/_shared/credentialAdapter.js +79 -15
- package/dist/plugins/_shared/credentials.js +389 -0
- package/dist/plugins/_shared/googleAuth.js +9 -40
- package/dist/plugins/_shared/googleCredentials.js +28 -7
- package/dist/plugins/_shared/microsoftAuth.js +13 -44
- package/dist/plugins/_shared/microsoftCredentials.js +30 -8
- package/dist/plugins/_shared/provider.js +2 -14
- package/dist/plugins/_shared/shiftCloud.js +19 -55
- package/dist/plugins/_shared/shiftCredentials.js +83 -0
- package/dist/plugins/actionNetwork/src/credentials.js +14 -0
- package/dist/plugins/actionNetwork/src/index.js +39 -50
- package/dist/plugins/activeCampaign/src/credentials.js +22 -0
- package/dist/plugins/activeCampaign/src/index.js +61 -132
- package/dist/plugins/adalo/src/credentials.js +16 -0
- package/dist/plugins/adalo/src/index.js +19 -43
- package/dist/plugins/affinity/src/credentials.js +19 -0
- package/dist/plugins/affinity/src/index.js +29 -54
- package/dist/plugins/agileCrm/src/credentials.js +16 -0
- package/dist/plugins/agileCrm/src/index.js +46 -112
- package/dist/plugins/airtable/src/credentials.js +19 -0
- package/dist/plugins/airtable/src/index.js +37 -50
- package/dist/plugins/airtop/src/credentials.js +20 -0
- package/dist/plugins/airtop/src/index.js +51 -75
- package/dist/plugins/apiTemplateIo/src/credentials.js +19 -0
- package/dist/plugins/apiTemplateIo/src/index.js +14 -31
- package/dist/plugins/asana/src/credentials.js +19 -0
- package/dist/plugins/asana/src/index.js +51 -72
- package/dist/plugins/autopilot/src/credentials.js +19 -0
- package/dist/plugins/autopilot/src/index.js +38 -45
- package/dist/plugins/bambooHr/src/credentials.js +16 -0
- package/dist/plugins/bambooHr/src/index.js +41 -67
- package/dist/plugins/bannerbear/src/credentials.js +19 -0
- package/dist/plugins/bannerbear/src/index.js +15 -27
- package/dist/plugins/baserow/src/credentials.js +17 -0
- package/dist/plugins/baserow/src/index.js +23 -49
- package/dist/plugins/beeminder/src/credentials.js +19 -0
- package/dist/plugins/beeminder/src/index.js +32 -54
- package/dist/plugins/bitly/src/credentials.js +19 -0
- package/dist/plugins/bitly/src/index.js +12 -26
- package/dist/plugins/bitwarden/src/credentials.js +62 -0
- package/dist/plugins/bitwarden/src/index.js +34 -80
- package/dist/plugins/box/src/credentials.js +19 -0
- package/dist/plugins/box/src/index.js +24 -49
- package/dist/plugins/brandfetch/src/credentials.js +13 -0
- package/dist/plugins/brandfetch/src/index.js +12 -17
- package/dist/plugins/brevo/src/credentials.js +19 -0
- package/dist/plugins/brevo/src/index.js +30 -51
- package/dist/plugins/bubble/src/credentials.js +28 -0
- package/dist/plugins/bubble/src/index.js +29 -65
- package/dist/plugins/chargebee/src/credentials.js +16 -0
- package/dist/plugins/chargebee/src/index.js +15 -45
- package/dist/plugins/circleci/src/credentials.js +19 -0
- package/dist/plugins/circleci/src/index.js +19 -39
- package/dist/plugins/ciscoWebex/src/credentials.js +19 -0
- package/dist/plugins/ciscoWebex/src/index.js +43 -61
- package/dist/plugins/clearbit/src/credentials.js +22 -0
- package/dist/plugins/clearbit/src/index.js +11 -21
- package/dist/plugins/clickup/src/credentials.js +19 -0
- package/dist/plugins/clickup/src/index.js +85 -117
- package/dist/plugins/clockify/src/credentials.js +19 -0
- package/dist/plugins/clockify/src/index.js +46 -61
- package/dist/plugins/cloudflare/src/credentials.js +19 -0
- package/dist/plugins/cloudflare/src/index.js +19 -34
- package/dist/plugins/cockpit/src/credentials.js +17 -0
- package/dist/plugins/cockpit/src/index.js +18 -31
- package/dist/plugins/coda/src/credentials.js +19 -0
- package/dist/plugins/coda/src/index.js +33 -50
- package/dist/plugins/coingecko/src/credentials.js +20 -0
- package/dist/plugins/coingecko/src/index.js +24 -34
- package/dist/plugins/contentful/src/credentials.js +26 -0
- package/dist/plugins/contentful/src/index.js +19 -40
- package/dist/plugins/convertkit/src/credentials.js +26 -0
- package/dist/plugins/convertkit/src/index.js +27 -45
- package/dist/plugins/copper/src/credentials.js +17 -0
- package/dist/plugins/copper/src/index.js +25 -47
- package/dist/plugins/cortex/src/credentials.js +28 -0
- package/dist/plugins/cortex/src/index.js +26 -49
- package/dist/plugins/currents/src/credentials.js +19 -0
- package/dist/plugins/currents/src/index.js +46 -59
- package/dist/plugins/customerIo/src/credentials.js +52 -0
- package/dist/plugins/customerIo/src/index.js +30 -58
- package/dist/plugins/databricks/src/credentials.js +13 -0
- package/dist/plugins/databricks/src/index.js +51 -103
- package/dist/plugins/deepl/src/credentials.js +19 -0
- package/dist/plugins/deepl/src/index.js +13 -39
- package/dist/plugins/demio/src/credentials.js +26 -0
- package/dist/plugins/demio/src/index.js +17 -41
- package/dist/plugins/dhl/src/credentials.js +13 -0
- package/dist/plugins/dhl/src/index.js +8 -19
- package/dist/plugins/discord/src/credentials.js +19 -0
- package/dist/plugins/discord/src/index.js +30 -58
- package/dist/plugins/discourse/src/credentials.js +18 -0
- package/dist/plugins/discourse/src/index.js +36 -53
- package/dist/plugins/disqus/src/credentials.js +13 -0
- package/dist/plugins/disqus/src/index.js +14 -32
- package/dist/plugins/drift/src/credentials.js +13 -0
- package/dist/plugins/drift/src/index.js +16 -26
- package/dist/plugins/dropbox/src/credentials.js +13 -0
- package/dist/plugins/dropbox/src/index.js +23 -30
- package/dist/plugins/dropcontact/src/credentials.js +13 -0
- package/dist/plugins/dropcontact/src/index.js +13 -18
- package/dist/plugins/egoi/src/credentials.js +19 -0
- package/dist/plugins/egoi/src/index.js +23 -38
- package/dist/plugins/elasticsearch/src/credentials.js +18 -0
- package/dist/plugins/elasticsearch/src/index.js +27 -48
- package/dist/plugins/elevenlabs/src/credentials.js +30 -0
- package/dist/plugins/elevenlabs/src/index.js +4 -1
- package/dist/plugins/elevenlabs/src/schemas.js +2 -1
- package/dist/plugins/elevenlabs/src/shared.js +74 -35
- package/dist/plugins/elevenlabs/src/workflows.js +2 -2
- package/dist/plugins/emelia/src/credentials.js +14 -0
- package/dist/plugins/emelia/src/index.js +19 -23
- package/dist/plugins/erpnext/src/credentials.js +27 -0
- package/dist/plugins/erpnext/src/index.js +21 -42
- package/dist/plugins/facebookGraph/src/credentials.js +20 -0
- package/dist/plugins/facebookGraph/src/index.js +39 -37
- package/dist/plugins/fal/src/credentials.js +14 -0
- package/dist/plugins/fal/src/index.js +4 -2
- package/dist/plugins/fal/src/shared.js +58 -63
- package/dist/plugins/freshdesk/src/credentials.js +20 -0
- package/dist/plugins/freshdesk/src/index.js +25 -46
- package/dist/plugins/freshservice/src/credentials.js +16 -0
- package/dist/plugins/freshservice/src/index.js +37 -58
- package/dist/plugins/freshworksCrm/src/credentials.js +16 -0
- package/dist/plugins/freshworksCrm/src/index.js +20 -39
- package/dist/plugins/getresponse/src/credentials.js +22 -0
- package/dist/plugins/getresponse/src/index.js +20 -32
- package/dist/plugins/gett/src/credentials.js +64 -0
- package/dist/plugins/gett/src/index.js +11 -6
- package/dist/plugins/gett/src/login.js +24 -0
- package/dist/plugins/gett/src/session.js +15 -38
- package/dist/plugins/gett/src/shared.js +41 -84
- package/dist/plugins/ghost/src/credentials.js +36 -0
- package/dist/plugins/ghost/src/index.js +18 -59
- package/dist/plugins/github/src/credentials.js +18 -0
- package/dist/plugins/github/src/index.js +55 -78
- package/dist/plugins/gitlab/src/credentials.js +24 -0
- package/dist/plugins/gitlab/src/index.js +29 -48
- package/dist/plugins/gmail/src/index.js +26 -24
- package/dist/plugins/gong/src/credentials.js +16 -0
- package/dist/plugins/gong/src/index.js +16 -32
- package/dist/plugins/googleAppsScript/src/index.js +108 -42
- package/dist/plugins/googleCalendar/src/index.js +15 -13
- package/dist/plugins/googleContacts/src/index.js +12 -9
- package/dist/plugins/googleDocs/src/index.js +2 -0
- package/dist/plugins/googleDocs/src/shared.js +2 -1
- package/dist/plugins/googleDrive/src/index.js +50 -53
- package/dist/plugins/googleImage/src/credentials.js +14 -0
- package/dist/plugins/googleImage/src/index.js +14 -25
- package/dist/plugins/googleSheets/src/index.js +26 -27
- package/dist/plugins/googleSlides/src/index.js +6 -4
- package/dist/plugins/googleTasks/src/index.js +13 -11
- package/dist/plugins/gotify/src/credentials.js +32 -0
- package/dist/plugins/gotify/src/index.js +14 -36
- package/dist/plugins/gotowebinar/src/credentials.js +13 -0
- package/dist/plugins/gotowebinar/src/index.js +52 -69
- package/dist/plugins/grafana/src/credentials.js +16 -0
- package/dist/plugins/grafana/src/index.js +34 -53
- package/dist/plugins/graphql/src/credentials.js +42 -0
- package/dist/plugins/graphql/src/index.js +21 -46
- package/dist/plugins/grist/src/credentials.js +30 -0
- package/dist/plugins/grist/src/index.js +14 -43
- package/dist/plugins/halopsa/src/credentials.js +56 -0
- package/dist/plugins/halopsa/src/index.js +20 -47
- package/dist/plugins/harvest/src/credentials.js +20 -0
- package/dist/plugins/harvest/src/index.js +24 -43
- package/dist/plugins/helpscout/src/credentials.js +13 -0
- package/dist/plugins/helpscout/src/index.js +26 -38
- package/dist/plugins/highlevel/src/credentials.js +19 -0
- package/dist/plugins/highlevel/src/index.js +34 -63
- package/dist/plugins/homeAssistant/src/credentials.js +27 -0
- package/dist/plugins/homeAssistant/src/index.js +34 -52
- package/dist/plugins/hubspot/src/credentials.js +16 -0
- package/dist/plugins/hubspot/src/index.js +29 -41
- package/dist/plugins/humanticAi/src/credentials.js +13 -0
- package/dist/plugins/humanticAi/src/index.js +15 -22
- package/dist/plugins/hunter/src/credentials.js +13 -0
- package/dist/plugins/hunter/src/index.js +18 -17
- package/dist/plugins/intercom/src/credentials.js +19 -0
- package/dist/plugins/intercom/src/index.js +25 -38
- package/dist/plugins/iterable/src/credentials.js +17 -0
- package/dist/plugins/iterable/src/index.js +26 -40
- package/dist/plugins/jenkins/src/credentials.js +16 -0
- package/dist/plugins/jenkins/src/index.js +22 -36
- package/dist/plugins/jira/src/credentials.js +16 -0
- package/dist/plugins/jira/src/index.js +35 -61
- package/dist/plugins/keap/src/credentials.js +19 -0
- package/dist/plugins/keap/src/index.js +43 -71
- package/dist/plugins/kobotoolbox/src/credentials.js +13 -0
- package/dist/plugins/kobotoolbox/src/index.js +46 -84
- package/dist/plugins/lemlist/src/credentials.js +19 -0
- package/dist/plugins/lemlist/src/index.js +35 -47
- package/dist/plugins/linear/src/attachments.js +7 -7
- package/dist/plugins/linear/src/comments.js +7 -7
- package/dist/plugins/linear/src/credentials.js +17 -0
- package/dist/plugins/linear/src/cycles.js +5 -5
- package/dist/plugins/linear/src/index.js +2 -0
- package/dist/plugins/linear/src/initiatives.js +6 -6
- package/dist/plugins/linear/src/issues.js +14 -14
- package/dist/plugins/linear/src/labels.js +6 -6
- package/dist/plugins/linear/src/organization.js +2 -2
- package/dist/plugins/linear/src/projects.js +12 -12
- package/dist/plugins/linear/src/shared.js +34 -32
- package/dist/plugins/linear/src/states.js +3 -3
- package/dist/plugins/linear/src/teams.js +4 -4
- package/dist/plugins/linear/src/users.js +3 -3
- package/dist/plugins/linear/src/views.js +5 -5
- package/dist/plugins/linear/src/webhooks.js +5 -5
- package/dist/plugins/lingvanex/src/credentials.js +13 -0
- package/dist/plugins/lingvanex/src/index.js +7 -9
- package/dist/plugins/linkedin/src/credentials.js +17 -0
- package/dist/plugins/linkedin/src/index.js +13 -17
- package/dist/plugins/lonescale/src/credentials.js +13 -0
- package/dist/plugins/lonescale/src/index.js +16 -26
- package/dist/plugins/magento/src/credentials.js +16 -0
- package/dist/plugins/magento/src/index.js +67 -84
- package/dist/plugins/mailcheck/src/credentials.js +17 -0
- package/dist/plugins/mailcheck/src/index.js +7 -9
- package/dist/plugins/mailchimp/src/credentials.js +32 -0
- package/dist/plugins/mailchimp/src/index.js +36 -44
- package/dist/plugins/mailerlite/src/credentials.js +13 -0
- package/dist/plugins/mailerlite/src/index.js +19 -32
- package/dist/plugins/mailgun/src/credentials.js +21 -0
- package/dist/plugins/mailgun/src/index.js +15 -21
- package/dist/plugins/mailjet/src/credentials.js +38 -0
- package/dist/plugins/mailjet/src/index.js +60 -115
- package/dist/plugins/mandrill/src/credentials.js +17 -0
- package/dist/plugins/mandrill/src/index.js +11 -12
- package/dist/plugins/marketstack/src/credentials.js +16 -0
- package/dist/plugins/marketstack/src/index.js +18 -28
- package/dist/plugins/matrix/src/credentials.js +19 -0
- package/dist/plugins/matrix/src/index.js +23 -52
- package/dist/plugins/mattermost/src/credentials.js +19 -0
- package/dist/plugins/mattermost/src/index.js +41 -73
- package/dist/plugins/mautic/src/credentials.js +16 -0
- package/dist/plugins/mautic/src/index.js +46 -62
- package/dist/plugins/medium/src/credentials.js +20 -0
- package/dist/plugins/medium/src/index.js +18 -23
- package/dist/plugins/messagebird/src/credentials.js +22 -0
- package/dist/plugins/messagebird/src/index.js +13 -18
- package/dist/plugins/metabase/src/credentials.js +19 -0
- package/dist/plugins/metabase/src/index.js +24 -40
- package/dist/plugins/microsoftCalendar/src/index.js +48 -12
- package/dist/plugins/microsoftFiles/src/index.js +90 -25
- package/dist/plugins/microsoftMail/src/index.js +62 -15
- package/dist/plugins/misp/src/credentials.js +16 -0
- package/dist/plugins/misp/src/index.js +60 -71
- package/dist/plugins/mocean/src/credentials.js +17 -0
- package/dist/plugins/mocean/src/index.js +11 -23
- package/dist/plugins/monday/src/credentials.js +14 -0
- package/dist/plugins/monday/src/index.js +31 -44
- package/dist/plugins/monicaCrm/src/credentials.js +19 -0
- package/dist/plugins/monicaCrm/src/index.js +25 -42
- package/dist/plugins/msg91/src/credentials.js +10 -0
- package/dist/plugins/msg91/src/index.js +15 -11
- package/dist/plugins/nasa/src/credentials.js +22 -0
- package/dist/plugins/nasa/src/index.js +24 -28
- package/dist/plugins/netlify/src/credentials.js +19 -0
- package/dist/plugins/netlify/src/index.js +27 -51
- package/dist/plugins/netscalerAdc/src/credentials.js +18 -0
- package/dist/plugins/netscalerAdc/src/index.js +16 -31
- package/dist/plugins/nextcloud/src/credentials.js +27 -0
- package/dist/plugins/nextcloud/src/index.js +55 -109
- package/dist/plugins/nocodb/src/credentials.js +16 -0
- package/dist/plugins/nocodb/src/index.js +19 -37
- package/dist/plugins/notion/src/credentials.js +21 -0
- package/dist/plugins/notion/src/index.js +25 -38
- package/dist/plugins/npm/src/credentials.js +19 -0
- package/dist/plugins/npm/src/index.js +22 -32
- package/dist/plugins/odoo/src/credentials.js +21 -0
- package/dist/plugins/odoo/src/index.js +53 -69
- package/dist/plugins/okta/src/credentials.js +23 -0
- package/dist/plugins/okta/src/index.js +30 -35
- package/dist/plugins/oneSimpleApi/src/credentials.js +16 -0
- package/dist/plugins/oneSimpleApi/src/index.js +19 -24
- package/dist/plugins/onfleet/src/credentials.js +23 -0
- package/dist/plugins/onfleet/src/index.js +42 -53
- package/dist/plugins/openai/src/credentials.js +13 -0
- package/dist/plugins/openai/src/index.js +15 -23
- package/dist/plugins/openweathermap/src/credentials.js +16 -0
- package/dist/plugins/openweathermap/src/index.js +22 -22
- package/dist/plugins/oura/src/credentials.js +19 -0
- package/dist/plugins/oura/src/index.js +13 -18
- package/dist/plugins/paddle/src/credentials.js +27 -0
- package/dist/plugins/paddle/src/index.js +20 -36
- package/dist/plugins/pagerduty/src/credentials.js +24 -0
- package/dist/plugins/pagerduty/src/index.js +30 -39
- package/dist/plugins/parallel/src/credentials.js +18 -0
- package/dist/plugins/parallel/src/index.js +16 -22
- package/dist/plugins/paypal/src/credentials.js +44 -0
- package/dist/plugins/paypal/src/index.js +14 -40
- package/dist/plugins/peekalink/src/credentials.js +16 -0
- package/dist/plugins/peekalink/src/index.js +10 -11
- package/dist/plugins/phantombuster/src/credentials.js +19 -0
- package/dist/plugins/phantombuster/src/index.js +19 -32
- package/dist/plugins/philipsHue/src/credentials.js +17 -0
- package/dist/plugins/philipsHue/src/index.js +15 -27
- package/dist/plugins/pipedrive/src/credentials.js +26 -0
- package/dist/plugins/pipedrive/src/index.js +43 -73
- package/dist/plugins/plaud/src/index.js +2 -1
- package/dist/plugins/plaud/src/shared.js +23 -19
- package/dist/plugins/plivo/src/credentials.js +20 -0
- package/dist/plugins/plivo/src/index.js +13 -19
- package/dist/plugins/posthog/src/credentials.js +18 -0
- package/dist/plugins/posthog/src/index.js +14 -20
- package/dist/plugins/profitwell/src/credentials.js +22 -0
- package/dist/plugins/profitwell/src/index.js +10 -17
- package/dist/plugins/pushbullet/src/credentials.js +19 -0
- package/dist/plugins/pushbullet/src/index.js +19 -27
- package/dist/plugins/pushcut/src/credentials.js +19 -0
- package/dist/plugins/pushcut/src/index.js +7 -8
- package/dist/plugins/pushover/src/credentials.js +14 -0
- package/dist/plugins/pushover/src/index.js +7 -12
- package/dist/plugins/quickbase/src/credentials.js +15 -0
- package/dist/plugins/quickbase/src/index.js +24 -34
- package/dist/plugins/quickbooks/src/credentials.js +22 -0
- package/dist/plugins/quickbooks/src/index.js +17 -46
- package/dist/plugins/raindrop/src/credentials.js +19 -0
- package/dist/plugins/raindrop/src/index.js +30 -32
- package/dist/plugins/recraft/src/credentials.js +13 -0
- package/dist/plugins/recraft/src/index.js +38 -27
- package/dist/plugins/reddit/src/credentials.js +26 -0
- package/dist/plugins/reddit/src/index.js +30 -34
- package/dist/plugins/replicate/src/credentials.js +23 -0
- package/dist/plugins/replicate/src/index.js +17 -27
- package/dist/plugins/rocketchat/src/credentials.js +17 -0
- package/dist/plugins/rocketchat/src/index.js +8 -19
- package/dist/plugins/rundeck/src/credentials.js +16 -0
- package/dist/plugins/rundeck/src/index.js +12 -28
- package/dist/plugins/salesforce/src/credentials.js +73 -0
- package/dist/plugins/salesforce/src/index.js +6 -0
- package/dist/plugins/salesforce/src/metadata.js +3 -16
- package/dist/plugins/salesforce/src/shared.js +25 -100
- package/dist/plugins/salesforce/src/sobjects.js +10 -9
- package/dist/plugins/salesmate/src/credentials.js +17 -0
- package/dist/plugins/salesmate/src/index.js +20 -37
- package/dist/plugins/securityScorecard/src/credentials.js +22 -0
- package/dist/plugins/securityScorecard/src/index.js +24 -37
- package/dist/plugins/segment/src/credentials.js +16 -0
- package/dist/plugins/segment/src/index.js +12 -16
- package/dist/plugins/sendgrid/src/credentials.js +13 -0
- package/dist/plugins/sendgrid/src/index.js +31 -35
- package/dist/plugins/sendy/src/credentials.js +18 -0
- package/dist/plugins/sendy/src/index.js +18 -24
- package/dist/plugins/sentry/src/credentials.js +16 -0
- package/dist/plugins/sentry/src/index.js +30 -98
- package/dist/plugins/servicenow/src/credentials.js +13 -0
- package/dist/plugins/servicenow/src/index.js +22 -41
- package/dist/plugins/shiftAtlas/src/graph.js +2 -2
- package/dist/plugins/shiftAtlas/src/index.js +2 -0
- package/dist/plugins/shiftAtlas/src/shared.js +3 -1
- package/dist/plugins/shiftBwm/src/index.js +4 -2
- package/dist/plugins/shiftBwm/src/shared.js +41 -16
- package/dist/plugins/shiftCrm/src/access.js +2 -2
- package/dist/plugins/shiftCrm/src/accounts.js +3 -3
- package/dist/plugins/shiftCrm/src/activities.js +3 -3
- package/dist/plugins/shiftCrm/src/credentials.js +6 -0
- package/dist/plugins/shiftCrm/src/index.js +2 -0
- package/dist/plugins/shiftCrm/src/opportunities.js +3 -3
- package/dist/plugins/shiftCrm/src/people.js +3 -3
- package/dist/plugins/shiftCrm/src/records.js +2 -2
- package/dist/plugins/shiftCrm/src/shared.js +2 -1
- package/dist/plugins/shiftCrm/src/tasks.js +3 -3
- package/dist/plugins/shiftObjects/src/credentials.js +2 -0
- package/dist/plugins/shiftObjects/src/index.js +2 -0
- package/dist/plugins/shiftObjects/src/objects.js +3 -2
- package/dist/plugins/shiftOcr/src/credentials.js +8 -0
- package/dist/plugins/shiftOcr/src/index.js +6 -5
- package/dist/plugins/shiftPages/src/index.js +2 -0
- package/dist/plugins/shiftPages/src/pages.js +5 -3
- package/dist/plugins/shiftPages/src/shared.js +3 -1
- package/dist/plugins/shiftTranscription/src/index.js +2 -0
- package/dist/plugins/shiftTranscription/src/shared.js +11 -1
- package/dist/plugins/shiftTranscription/src/transcription.js +4 -4
- package/dist/plugins/shiftWork/src/index.js +2 -0
- package/dist/plugins/shiftWork/src/issue-views.js +5 -5
- package/dist/plugins/shiftWork/src/issues.js +11 -7
- package/dist/plugins/shiftWork/src/projects.js +3 -3
- package/dist/plugins/shiftWork/src/shared.js +3 -1
- package/dist/plugins/shopify/src/credentials.js +16 -0
- package/dist/plugins/shopify/src/index.js +32 -59
- package/dist/plugins/signl4/src/credentials.js +17 -0
- package/dist/plugins/signl4/src/index.js +28 -29
- package/dist/plugins/slack/src/credentials.js +19 -0
- package/dist/plugins/slack/src/index.js +51 -60
- package/dist/plugins/sms77/src/credentials.js +17 -0
- package/dist/plugins/sms77/src/index.js +11 -16
- package/dist/plugins/splunk/src/credentials.js +19 -0
- package/dist/plugins/splunk/src/index.js +32 -74
- package/dist/plugins/spotify/src/credentials.js +19 -0
- package/dist/plugins/spotify/src/index.js +40 -55
- package/dist/plugins/stackby/src/credentials.js +13 -0
- package/dist/plugins/stackby/src/index.js +14 -23
- package/dist/plugins/steel/src/auth.js +27 -0
- package/dist/plugins/steel/src/browser.js +4 -3
- package/dist/plugins/steel/src/captchas.js +4 -3
- package/dist/plugins/steel/src/extensions.js +3 -2
- package/dist/plugins/steel/src/files.js +9 -10
- package/dist/plugins/steel/src/index.js +2 -0
- package/dist/plugins/steel/src/page/tools.js +3 -3
- package/dist/plugins/steel/src/profiles.js +4 -3
- package/dist/plugins/steel/src/sessions.js +13 -13
- package/dist/plugins/steel/src/shared.js +21 -51
- package/dist/plugins/storyblok/src/credentials.js +37 -0
- package/dist/plugins/storyblok/src/index.js +22 -66
- package/dist/plugins/strapi/src/credentials.js +71 -0
- package/dist/plugins/strapi/src/index.js +36 -70
- package/dist/plugins/strava/src/credentials.js +19 -0
- package/dist/plugins/strava/src/index.js +16 -33
- package/dist/plugins/stripe/src/credentials.js +19 -0
- package/dist/plugins/stripe/src/index.js +44 -58
- package/dist/plugins/supabase/src/credentials.js +30 -0
- package/dist/plugins/supabase/src/index.js +18 -40
- package/dist/plugins/syncromsp/src/credentials.js +16 -0
- package/dist/plugins/syncromsp/src/index.js +37 -70
- package/dist/plugins/tapfiliate/src/credentials.js +13 -0
- package/dist/plugins/tapfiliate/src/index.js +21 -31
- package/dist/plugins/telegram/src/credentials.js +20 -0
- package/dist/plugins/telegram/src/index.js +31 -39
- package/dist/plugins/thehive/src/credentials.js +14 -0
- package/dist/plugins/thehive/src/index.js +33 -50
- package/dist/plugins/thehiveProject/src/credentials.js +16 -0
- package/dist/plugins/thehiveProject/src/index.js +53 -122
- package/dist/plugins/todoist/src/credentials.js +26 -0
- package/dist/plugins/todoist/src/index.js +49 -79
- package/dist/plugins/together/src/credentials.js +16 -0
- package/dist/plugins/together/src/index.js +30 -32
- package/dist/plugins/travisci/src/credentials.js +24 -0
- package/dist/plugins/travisci/src/index.js +16 -30
- package/dist/plugins/trello/src/credentials.js +29 -0
- package/dist/plugins/trello/src/index.js +49 -64
- package/dist/plugins/twake/src/credentials.js +16 -0
- package/dist/plugins/twake/src/index.js +8 -10
- package/dist/plugins/twilio/src/credentials.js +23 -0
- package/dist/plugins/twilio/src/index.js +12 -26
- package/dist/plugins/twist/src/credentials.js +13 -0
- package/dist/plugins/twist/src/index.js +32 -44
- package/dist/plugins/twitter/src/credentials.js +16 -0
- package/dist/plugins/twitter/src/index.js +25 -37
- package/dist/plugins/typesafe/src/credentials.js +28 -0
- package/dist/plugins/typesafe/src/index.js +3 -1
- package/dist/plugins/typesafe/src/shared.js +23 -35
- package/dist/plugins/unleashedSoftware/src/credentials.js +21 -0
- package/dist/plugins/unleashedSoftware/src/index.js +13 -37
- package/dist/plugins/uplead/src/credentials.js +16 -0
- package/dist/plugins/uplead/src/index.js +11 -16
- package/dist/plugins/uproc/src/credentials.js +14 -0
- package/dist/plugins/uproc/src/index.js +7 -10
- package/dist/plugins/uptimerobot/src/credentials.js +14 -0
- package/dist/plugins/uptimerobot/src/index.js +28 -39
- package/dist/plugins/urlscanio/src/credentials.js +13 -0
- package/dist/plugins/urlscanio/src/index.js +13 -22
- package/dist/plugins/vercel/src/credentials.js +19 -0
- package/dist/plugins/vercel/src/deployments.js +27 -11
- package/dist/plugins/vercel/src/env.js +31 -12
- package/dist/plugins/vercel/src/index.js +2 -0
- package/dist/plugins/vercel/src/projects.js +6 -3
- package/dist/plugins/vercel/src/shared.js +32 -37
- package/dist/plugins/vero/src/credentials.js +17 -0
- package/dist/plugins/vero/src/index.js +18 -21
- package/dist/plugins/vonage/src/credentials.js +17 -0
- package/dist/plugins/vonage/src/index.js +14 -18
- package/dist/plugins/wekan/src/credentials.js +16 -0
- package/dist/plugins/wekan/src/index.js +33 -46
- package/dist/plugins/wolt/src/account.js +6 -0
- package/dist/plugins/wolt/src/catalog.js +2 -2
- package/dist/plugins/wolt/src/credentials.js +64 -0
- package/dist/plugins/wolt/src/index.js +8 -3
- package/dist/plugins/wolt/src/orders.js +2 -2
- package/dist/plugins/wolt/src/public.js +91 -0
- package/dist/plugins/wolt/src/shared.js +49 -158
- package/dist/plugins/woocommerce/src/credentials.js +16 -0
- package/dist/plugins/woocommerce/src/index.js +19 -37
- package/dist/plugins/wordpress/src/credentials.js +16 -0
- package/dist/plugins/wordpress/src/index.js +23 -42
- package/dist/plugins/xai/src/credentials.js +13 -0
- package/dist/plugins/xai/src/index.js +31 -30
- package/dist/plugins/xero/src/credentials.js +17 -0
- package/dist/plugins/xero/src/index.js +19 -36
- package/dist/plugins/yourls/src/credentials.js +17 -0
- package/dist/plugins/yourls/src/index.js +13 -23
- package/dist/plugins/zammad/src/credentials.js +15 -0
- package/dist/plugins/zammad/src/index.js +27 -47
- package/dist/plugins/zendesk/src/credentials.js +26 -0
- package/dist/plugins/zendesk/src/index.js +29 -48
- package/dist/plugins/zoho/src/credentials.js +17 -0
- package/dist/plugins/zoho/src/index.js +18 -38
- package/dist/plugins/zoom/src/credentials.js +19 -0
- package/dist/plugins/zoom/src/index.js +15 -30
- package/dist/plugins/zulip/src/credentials.js +16 -0
- package/dist/plugins/zulip/src/index.js +36 -42
- package/dist/sdk.d.ts +8 -0
- package/dist/sdk.js +3 -0
- package/package.json +1 -1
- package/dist/plugins/_shared/authedFetch.js +0 -33
- package/dist/plugins/_shared/tokenRefresh.js +0 -41
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
import { AuthError, downloadResource, } from "runline";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
const config = ctx.connection.config;
|
|
7
|
-
const method = googleMethod(config);
|
|
8
|
-
const runtime = credentialRuntime(ctx, googleCredentialType(scopes, pluginName), method, (current) => {
|
|
9
|
-
const cfg = current;
|
|
10
|
-
return [
|
|
11
|
-
pluginName,
|
|
12
|
-
scopes,
|
|
13
|
-
googleMethod(cfg),
|
|
14
|
-
...(method === "serviceAccount"
|
|
15
|
-
? [googleIdentity(cfg)]
|
|
16
|
-
: [cfg.clientId, cfg.clientSecret]),
|
|
17
|
-
];
|
|
18
|
-
});
|
|
19
|
-
if (method === "serviceAccount")
|
|
20
|
-
runtime.binding.jwtIdentity = googleIdentity(config);
|
|
21
|
-
return runtime;
|
|
22
|
-
}
|
|
23
|
-
/** Trusted-runtime token compatibility only; resource consumers use googleResponse. */
|
|
24
|
-
export async function googleAccessToken(ctx, pluginName, scopes) {
|
|
25
|
-
const { binding, transport } = googleRuntime(ctx, pluginName, scopes);
|
|
26
|
-
return transport.accessToken(binding);
|
|
27
|
-
}
|
|
2
|
+
import { credentialBroker } from "./credentialAdapter.js";
|
|
3
|
+
import { jsonAnswer, requestFailed } from "./credentials.js";
|
|
4
|
+
import { googleCredential, googleResources } from "./googleCredentials.js";
|
|
5
|
+
export { googleCredential } from "./googleCredentials.js";
|
|
28
6
|
/** Translate builtin absolute URLs at one boundary; validate the raw path before URL normalization. */
|
|
29
7
|
export async function googleResponse(ctx, plugin, scopes, url, init = {}, query) {
|
|
30
8
|
const resources = googleResources(plugin);
|
|
@@ -45,8 +23,7 @@ export async function googleResponse(ctx, plugin, scopes, url, init = {}, query)
|
|
|
45
23
|
}
|
|
46
24
|
path = `${separator < 0 ? path : path.slice(0, separator)}?${params}`;
|
|
47
25
|
}
|
|
48
|
-
|
|
49
|
-
return transport.request(binding, {
|
|
26
|
+
return credentialBroker(ctx, googleCredential(plugin, scopes)).request({
|
|
50
27
|
target,
|
|
51
28
|
path,
|
|
52
29
|
method: (init.method ?? "GET"),
|
|
@@ -54,6 +31,7 @@ export async function googleResponse(ctx, plugin, scopes, url, init = {}, query)
|
|
|
54
31
|
body: init.body,
|
|
55
32
|
});
|
|
56
33
|
}
|
|
34
|
+
/** A Google JSON request that must succeed; its answer is read by `jsonAnswer`. */
|
|
57
35
|
export async function googleJsonRequest(ctx, plugin, scopes, method, url, body, query) {
|
|
58
36
|
const response = await googleResponse(ctx, plugin, scopes, url, {
|
|
59
37
|
method,
|
|
@@ -64,20 +42,11 @@ export async function googleJsonRequest(ctx, plugin, scopes, method, url, body,
|
|
|
64
42
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
65
43
|
}, query);
|
|
66
44
|
if (!response.ok)
|
|
67
|
-
throw
|
|
68
|
-
|
|
69
|
-
return { success: true };
|
|
70
|
-
const text = await response.text();
|
|
71
|
-
try {
|
|
72
|
-
return text ? JSON.parse(text) : { success: true };
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
throw new AuthError("invalid_response");
|
|
76
|
-
}
|
|
45
|
+
throw requestFailed(plugin, response.status);
|
|
46
|
+
return jsonAnswer(response);
|
|
77
47
|
}
|
|
78
48
|
export async function googleProbe(ctx, plugin, scopes) {
|
|
79
|
-
|
|
80
|
-
return transport.probe(binding);
|
|
49
|
+
return credentialBroker(ctx, googleCredential(plugin, scopes)).probe();
|
|
81
50
|
}
|
|
82
51
|
/** Only Google-issued thumbnail hosts; never attach credentials to signed URLs. */
|
|
83
52
|
export async function googleDownload(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AuthError,
|
|
2
|
-
import
|
|
1
|
+
import { AuthError, } from "runline";
|
|
2
|
+
import { grantSchema } from "./credentials.js";
|
|
3
3
|
/** Only legacy storage infers a method; host bindings always select it explicitly. */
|
|
4
4
|
export function googleMethod(cfg) {
|
|
5
5
|
if (cfg.authMethod !== undefined) {
|
|
@@ -112,19 +112,40 @@ export function googleResources(plugin) {
|
|
|
112
112
|
: {}),
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* A Google plugin's credential declaration: its own targets and the scopes
|
|
117
|
+
* it signs service-account requests for, the method its config selects,
|
|
118
|
+
* and — for a service account — the JWT identity, subject included.
|
|
119
|
+
*/
|
|
120
|
+
export function googleCredential(plugin, scopes) {
|
|
121
|
+
return (config) => {
|
|
122
|
+
const cfg = config;
|
|
123
|
+
const method = googleMethod(cfg);
|
|
124
|
+
return {
|
|
125
|
+
type: googleCredentialType(scopes, plugin),
|
|
126
|
+
method,
|
|
127
|
+
application: {
|
|
128
|
+
clientId: cfg.clientId,
|
|
129
|
+
clientSecret: cfg.clientSecret,
|
|
130
|
+
},
|
|
131
|
+
...(method === "serviceAccount"
|
|
132
|
+
? { jwtIdentity: googleIdentity(cfg) }
|
|
133
|
+
: {}),
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}
|
|
115
137
|
/** Fixed vendor endpoints; a JSON credential's token_uri can never select egress. */
|
|
116
138
|
export function googleCredentialType(scopes, plugin) {
|
|
117
139
|
const url = "https://oauth2.googleapis.com/token";
|
|
118
|
-
const schema = t.Object({ grant: t.Optional(OAuthGrantSchema) }, { additionalProperties: false });
|
|
119
140
|
const { targets, probe } = googleResources(plugin);
|
|
120
141
|
return {
|
|
121
142
|
id: "google.oauth",
|
|
122
143
|
methods: {
|
|
123
144
|
delegated: {
|
|
124
|
-
schema,
|
|
145
|
+
schema: grantSchema,
|
|
125
146
|
authentication: {
|
|
126
147
|
kind: "oauth2",
|
|
127
|
-
|
|
148
|
+
field: "grant",
|
|
128
149
|
renewal: "refresh",
|
|
129
150
|
definition: {
|
|
130
151
|
id: "google.oauth",
|
|
@@ -138,10 +159,10 @@ export function googleCredentialType(scopes, plugin) {
|
|
|
138
159
|
...(scopes.length
|
|
139
160
|
? {
|
|
140
161
|
serviceAccount: {
|
|
141
|
-
schema,
|
|
162
|
+
schema: grantSchema,
|
|
142
163
|
authentication: {
|
|
143
164
|
kind: "oauth2",
|
|
144
|
-
|
|
165
|
+
field: "grant",
|
|
145
166
|
renewal: "jwtBearer",
|
|
146
167
|
scopes,
|
|
147
168
|
definition: {
|
|
@@ -1,45 +1,18 @@
|
|
|
1
1
|
import { AuthError, downloadResource, } from "runline";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
return microsoftMethod(cfg) === "appOnly";
|
|
7
|
-
}
|
|
2
|
+
import { credentialBroker } from "./credentialAdapter.js";
|
|
3
|
+
import { jsonAnswer, requestFailed } from "./credentials.js";
|
|
4
|
+
import { microsoftCredential, microsoftUserBase, } from "./microsoftCredentials.js";
|
|
5
|
+
export { microsoftCredential, microsoftDriveBase, } from "./microsoftCredentials.js";
|
|
8
6
|
export function userBase(ctx) {
|
|
9
7
|
return microsoftUserBase(ctx.connection.config);
|
|
10
8
|
}
|
|
11
|
-
function runtime(ctx, plugin, scopes) {
|
|
12
|
-
const cfg = ctx.connection.config;
|
|
13
|
-
const method = microsoftMethod(cfg);
|
|
14
|
-
if (method === "appOnly" &&
|
|
15
|
-
(!cfg.tenantId ||
|
|
16
|
-
["common", "organizations", "consumers"].includes(cfg.tenantId)))
|
|
17
|
-
throw new AuthError("invalid_credentials");
|
|
18
|
-
return credentialRuntime(ctx, microsoftCredentialType(cfg, plugin, scopes), method, (current) => {
|
|
19
|
-
const c = current;
|
|
20
|
-
return [
|
|
21
|
-
microsoftMethod(c),
|
|
22
|
-
c.tenantId,
|
|
23
|
-
c.clientId,
|
|
24
|
-
c.clientSecret,
|
|
25
|
-
scopes,
|
|
26
|
-
];
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/** Compatibility token access uses the same grant runtime as resource requests. */
|
|
30
|
-
export async function microsoftAccessToken(ctx, plugin, scopes) {
|
|
31
|
-
const { binding, transport } = runtime(ctx, plugin, scopes);
|
|
32
|
-
return transport.accessToken(binding);
|
|
33
|
-
}
|
|
34
9
|
export async function microsoftProbe(ctx, plugin, scopes) {
|
|
35
|
-
|
|
36
|
-
return transport.probe(binding);
|
|
10
|
+
return credentialBroker(ctx, microsoftCredential(plugin, scopes)).probe();
|
|
37
11
|
}
|
|
38
12
|
export async function graphResponse(ctx, plugin, scopes, method, path, body, contentType) {
|
|
39
13
|
if (!path.startsWith("/") || path.startsWith("//"))
|
|
40
14
|
throw new AuthError("request_not_allowed");
|
|
41
|
-
|
|
42
|
-
return transport.request(binding, {
|
|
15
|
+
return credentialBroker(ctx, microsoftCredential(plugin, scopes)).request({
|
|
43
16
|
target: "graph",
|
|
44
17
|
path: path.slice(1),
|
|
45
18
|
method: method,
|
|
@@ -50,20 +23,16 @@ export async function graphResponse(ctx, plugin, scopes, method, path, body, con
|
|
|
50
23
|
body,
|
|
51
24
|
});
|
|
52
25
|
}
|
|
53
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* A Graph JSON request that must succeed; its answer is read by
|
|
28
|
+
* `jsonAnswer`. JSON and binary requests share the same destination,
|
|
29
|
+
* renewal and replay policy through `graphResponse`.
|
|
30
|
+
*/
|
|
54
31
|
export async function graphRequest(ctx, plugin, scopes, method, path, body) {
|
|
55
32
|
const res = await graphResponse(ctx, plugin, scopes, method, path, body === undefined ? undefined : JSON.stringify(body), body === undefined ? undefined : "application/json");
|
|
56
33
|
if (!res.ok)
|
|
57
|
-
throw
|
|
58
|
-
|
|
59
|
-
return { success: true };
|
|
60
|
-
const text = await res.text();
|
|
61
|
-
try {
|
|
62
|
-
return text ? JSON.parse(text) : { success: true };
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
throw new Error(`${plugin}: invalid Graph response`);
|
|
66
|
-
}
|
|
34
|
+
throw requestFailed(plugin, res.status);
|
|
35
|
+
return jsonAnswer(res);
|
|
67
36
|
}
|
|
68
37
|
/** Graph-issued signed download URLs carry their own authority, never a bearer header. */
|
|
69
38
|
export async function microsoftDownload(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AuthError,
|
|
2
|
-
import
|
|
1
|
+
import { AuthError, } from "runline";
|
|
2
|
+
import { grantSchema, pathSegment } from "./credentials.js";
|
|
3
3
|
/** Compatibility inference is confined to legacy configs without an explicit method. */
|
|
4
4
|
export function microsoftMethod(cfg) {
|
|
5
5
|
if (cfg.authMethod !== undefined) {
|
|
@@ -16,15 +16,38 @@ export function microsoftUserBase(cfg) {
|
|
|
16
16
|
return "/me";
|
|
17
17
|
if (!cfg.userUpn)
|
|
18
18
|
throw new AuthError("invalid_credentials");
|
|
19
|
-
return `/users/${
|
|
19
|
+
return `/users/${pathSegment(cfg.userUpn)}`;
|
|
20
20
|
}
|
|
21
21
|
export function microsoftDriveBase(cfg) {
|
|
22
22
|
if (cfg.driveId)
|
|
23
|
-
return `/drives/${
|
|
23
|
+
return `/drives/${pathSegment(cfg.driveId)}`;
|
|
24
24
|
if (cfg.siteId)
|
|
25
|
-
return `/sites/${
|
|
25
|
+
return `/sites/${pathSegment(cfg.siteId)}/drive`;
|
|
26
26
|
return `${microsoftUserBase(cfg)}/drive`;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A Microsoft plugin's credential declaration. App-only signs for one
|
|
30
|
+
* tenant's directory, so a multi-tenant authority is refused here, where
|
|
31
|
+
* every signer reads it.
|
|
32
|
+
*/
|
|
33
|
+
export function microsoftCredential(plugin, scopes) {
|
|
34
|
+
return (config) => {
|
|
35
|
+
const cfg = config;
|
|
36
|
+
const method = microsoftMethod(cfg);
|
|
37
|
+
if (method === "appOnly" &&
|
|
38
|
+
(!cfg.tenantId ||
|
|
39
|
+
["common", "organizations", "consumers"].includes(cfg.tenantId)))
|
|
40
|
+
throw new AuthError("invalid_credentials");
|
|
41
|
+
return {
|
|
42
|
+
type: microsoftCredentialType(cfg, plugin, scopes),
|
|
43
|
+
method,
|
|
44
|
+
application: {
|
|
45
|
+
clientId: cfg.clientId,
|
|
46
|
+
clientSecret: cfg.clientSecret,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}
|
|
28
51
|
/** Scope-appropriate probes never require User.Read merely to check mail/calendar/files. */
|
|
29
52
|
export function microsoftCredentialType(cfg, plugin, scopes) {
|
|
30
53
|
const tenant = cfg.tenantId || "common";
|
|
@@ -34,7 +57,6 @@ export function microsoftCredentialType(cfg, plugin, scopes) {
|
|
|
34
57
|
url: `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`,
|
|
35
58
|
clientAuthentication: "client_secret_post",
|
|
36
59
|
};
|
|
37
|
-
const schema = t.Object({ grant: t.Optional(OAuthGrantSchema) }, { additionalProperties: false });
|
|
38
60
|
const methods = Object.fromEntries(["delegated", "appOnly"].map((method) => {
|
|
39
61
|
let probe;
|
|
40
62
|
const selected = { ...cfg, authMethod: method };
|
|
@@ -59,10 +81,10 @@ export function microsoftCredentialType(cfg, plugin, scopes) {
|
|
|
59
81
|
return [
|
|
60
82
|
method,
|
|
61
83
|
{
|
|
62
|
-
schema,
|
|
84
|
+
schema: grantSchema,
|
|
63
85
|
authentication: {
|
|
64
86
|
kind: "oauth2",
|
|
65
|
-
|
|
87
|
+
field: "grant",
|
|
66
88
|
renewal: method === "delegated"
|
|
67
89
|
? "refresh"
|
|
68
90
|
: "clientCredentials",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provider helpers: total readers for unshaped JSON,
|
|
3
|
-
*
|
|
2
|
+
* Provider helpers: total readers for unshaped JSON, and bounded text or
|
|
3
|
+
* binary body reads.
|
|
4
4
|
*
|
|
5
5
|
* The readers are total by design. These payloads are deep and change without
|
|
6
6
|
* notice, so a missing or wrongly-typed field yields the empty value for its
|
|
@@ -34,18 +34,6 @@ export function numOrNull(value) {
|
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
export const num = (value, fallback) => numOrNull(value) ?? fallback;
|
|
37
|
-
/**
|
|
38
|
-
* One path segment, escaped. Caller-supplied ids reach a URL carrying a bearer
|
|
39
|
-
* token, so a segment that could climb out of its position is refused outright
|
|
40
|
-
* rather than encoded and hoped about.
|
|
41
|
-
*/
|
|
42
|
-
export function seg(value, what, plugin) {
|
|
43
|
-
const raw = String(value ?? "").trim();
|
|
44
|
-
if (!raw || raw === "." || raw === ".." || /[/\\?#]/.test(raw)) {
|
|
45
|
-
throw new Error(`${plugin}: invalid ${what}`);
|
|
46
|
-
}
|
|
47
|
-
return encodeURIComponent(raw);
|
|
48
|
-
}
|
|
49
37
|
/**
|
|
50
38
|
* Read a response body with a ceiling, so a hostile or broken endpoint cannot
|
|
51
39
|
* make the process hold an unbounded string.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "typebox";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { errorIdentifier, failureMessage } from "./credentials.js";
|
|
3
|
+
export { pathSegment } from "./credentials.js";
|
|
4
4
|
export const STRICT_OBJECT = { additionalProperties: false };
|
|
5
5
|
export const STRICT_UPDATE_OBJECT = {
|
|
6
6
|
additionalProperties: false,
|
|
@@ -29,61 +29,25 @@ export const SHIFT_API_URL = "https://cloud.shift-labs.ai";
|
|
|
29
29
|
export function baseUrl() {
|
|
30
30
|
return `${SHIFT_API_URL}/`;
|
|
31
31
|
}
|
|
32
|
-
/** Default deadline; endpoints that hold the request open pass their own. */
|
|
33
|
-
export const SHIFT_REQUEST_TIMEOUT_MS = 60_000;
|
|
34
|
-
const MAX_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
35
32
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* whole exchange including the body, in place of any caller signal; the
|
|
39
|
-
* text body is read with a ceiling and returned buffered, so JSON and text
|
|
40
|
-
* callers consume it as usual.
|
|
33
|
+
* A failed response, read as a Shift error envelope when it is one: the
|
|
34
|
+
* service's `code` (else its `type`) and the offending `param`.
|
|
41
35
|
*/
|
|
42
|
-
export async function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
export function apiKey(ctx) {
|
|
55
|
-
const key = ctx.connection.config.apiKey;
|
|
56
|
-
if (typeof key !== "string" || !key) {
|
|
57
|
-
throw new Error("Shift Labs apiKey is required");
|
|
58
|
-
}
|
|
59
|
-
return key;
|
|
60
|
-
}
|
|
61
|
-
export async function request(ctx, path, init = {}, timeoutMs = SHIFT_REQUEST_TIMEOUT_MS) {
|
|
62
|
-
const headers = new Headers(init.headers);
|
|
63
|
-
headers.set("authorization", `Bearer ${apiKey(ctx)}`);
|
|
64
|
-
if (init.body && !headers.has("content-type")) {
|
|
65
|
-
headers.set("content-type", "application/json");
|
|
36
|
+
export async function shiftError(plugin, response) {
|
|
37
|
+
let code;
|
|
38
|
+
let param;
|
|
39
|
+
try {
|
|
40
|
+
const error = (await response.json()).error;
|
|
41
|
+
if (typeof error === "string")
|
|
42
|
+
code = errorIdentifier(error);
|
|
43
|
+
else if (error && typeof error === "object") {
|
|
44
|
+
const shaped = error;
|
|
45
|
+
code = errorIdentifier(shaped.code) ?? errorIdentifier(shaped.type);
|
|
46
|
+
param = errorIdentifier(shaped.param);
|
|
47
|
+
}
|
|
66
48
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
throw new Error(`Shift Labs API error ${response.status}: ${await response.text()}`);
|
|
49
|
+
catch {
|
|
50
|
+
// Not an error envelope: the status alone.
|
|
70
51
|
}
|
|
71
|
-
|
|
72
|
-
return undefined;
|
|
73
|
-
return (await response.json());
|
|
74
|
-
}
|
|
75
|
-
export function pathSegment(value) {
|
|
76
|
-
return encodeURIComponent(value);
|
|
77
|
-
}
|
|
78
|
-
export function listParams(input) {
|
|
79
|
-
const params = new URLSearchParams();
|
|
80
|
-
for (const [key, value] of Object.entries((input ?? {}))) {
|
|
81
|
-
if (value !== undefined)
|
|
82
|
-
params.set(key, String(value));
|
|
83
|
-
}
|
|
84
|
-
return params;
|
|
85
|
-
}
|
|
86
|
-
export function withQuery(path, params) {
|
|
87
|
-
const query = params.toString();
|
|
88
|
-
return query ? `${path}?${query}` : path;
|
|
52
|
+
return new Error(failureMessage(plugin, response.status, { code, param }));
|
|
89
53
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AuthError, } from "runline";
|
|
2
|
+
import { credentialRequest, staticCredential } from "./credentials.js";
|
|
3
|
+
import { SHIFT_API_URL, shiftError } from "./shiftCloud.js";
|
|
4
|
+
/**
|
|
5
|
+
* The Shift family (shiftAtlas, shiftBwm, shiftCrm, shiftObjects,
|
|
6
|
+
* shiftPages, shiftWork) signs with one Shift API key, as a bearer, beneath
|
|
7
|
+
* the cloud API's /v1 surface. Each plugin may name its own probe: not every
|
|
8
|
+
* key reaches every service. Plugins whose service holds requests open
|
|
9
|
+
* (shiftOcr, shiftTranscription) declare the target's own deadline.
|
|
10
|
+
*/
|
|
11
|
+
export function shiftCredential(options = {}) {
|
|
12
|
+
const { probe, timeoutMs, maxResponseBytes } = options;
|
|
13
|
+
return staticCredential({
|
|
14
|
+
id: "shift",
|
|
15
|
+
auth: { kind: "bearer" },
|
|
16
|
+
local: { secret: "apiKey" },
|
|
17
|
+
targets: {
|
|
18
|
+
api: {
|
|
19
|
+
baseUrl: `${SHIFT_API_URL}/v1/`,
|
|
20
|
+
methods: ["GET", "POST", "PATCH", "PUT", "DELETE"],
|
|
21
|
+
allowedHeaders: ["Idempotency-Key"],
|
|
22
|
+
...(timeoutMs !== undefined ? { timeoutMs } : {}),
|
|
23
|
+
...(maxResponseBytes !== undefined ? { maxResponseBytes } : {}),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
...(probe
|
|
27
|
+
? {
|
|
28
|
+
probe: {
|
|
29
|
+
target: "api",
|
|
30
|
+
path: probe,
|
|
31
|
+
method: "GET",
|
|
32
|
+
acceptedStatuses: [200],
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
: {}),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** An absolute /v1/... route as a path beneath the Shift target. */
|
|
39
|
+
export function shiftPath(route) {
|
|
40
|
+
if (!route.startsWith("/v1/"))
|
|
41
|
+
throw new AuthError("request_not_allowed");
|
|
42
|
+
return route.slice("/v1/".length);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A Shift plugin's credential and its request function, bound together so
|
|
46
|
+
* a plugin cannot sign with one declaration and declare another.
|
|
47
|
+
*/
|
|
48
|
+
export function shiftClient(plugin, options) {
|
|
49
|
+
const credential = shiftCredential(options);
|
|
50
|
+
return {
|
|
51
|
+
credential,
|
|
52
|
+
request: (ctx, route, init) => shiftRequest(ctx, credential, plugin, route, init),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One Shift API call through the declared credential. A body is JSON text;
|
|
57
|
+
* an empty answer, as the Shift API contract has it, is no value. `T` is the
|
|
58
|
+
* caller's statement of the answer's shape, unchecked.
|
|
59
|
+
*/
|
|
60
|
+
export async function shiftRequest(ctx, declaration, plugin, route, init = {}) {
|
|
61
|
+
const response = await credentialRequest(ctx, declaration, {
|
|
62
|
+
target: "api",
|
|
63
|
+
path: shiftPath(route),
|
|
64
|
+
method: (init.method ?? "GET"),
|
|
65
|
+
query: init.query,
|
|
66
|
+
...(init.body !== undefined
|
|
67
|
+
? { body: init.body, headers: { "Content-Type": "application/json" } }
|
|
68
|
+
: {}),
|
|
69
|
+
});
|
|
70
|
+
if (!response.ok)
|
|
71
|
+
throw await shiftError(plugin, response);
|
|
72
|
+
if (response.status === 204)
|
|
73
|
+
return undefined;
|
|
74
|
+
const text = await response.text();
|
|
75
|
+
if (!text)
|
|
76
|
+
return undefined;
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(text);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
throw new AuthError("invalid_response");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { staticCredential } from "../../_shared/credentials.js";
|
|
2
|
+
/** An OSDI API token, sent as the OSDI-API-Token header to Action Network's
|
|
3
|
+
* one API origin. */
|
|
4
|
+
export const actionNetworkCredential = staticCredential({
|
|
5
|
+
id: "actionNetwork",
|
|
6
|
+
auth: { kind: "apiKey", header: "OSDI-API-Token" },
|
|
7
|
+
local: { secret: "apiKey" },
|
|
8
|
+
targets: {
|
|
9
|
+
api: {
|
|
10
|
+
baseUrl: "https://actionnetwork.org/api/v2/",
|
|
11
|
+
methods: ["GET", "POST", "PUT", "DELETE"],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|