runline 0.32.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 +22 -34
- package/dist/plugins/_shared/shiftCredentials.js +83 -0
- package/dist/plugins/_shared/shiftUpload.js +1 -1
- 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/collections.js +201 -0
- package/dist/plugins/shiftBwm/src/index.js +35 -0
- package/dist/plugins/shiftBwm/src/records.js +180 -0
- package/dist/plugins/shiftBwm/src/shared.js +168 -0
- package/dist/plugins/shiftBwm/src/vendor/client.js +227 -0
- package/dist/plugins/shiftBwm/src/vendor/contracts.js +59 -0
- package/dist/plugins/shiftBwm/src/vendor/models.js +525 -0
- 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 -3
- package/dist/plugins/shiftOcr/src/credentials.js +8 -0
- package/dist/plugins/shiftOcr/src/index.js +5 -2
- 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 +3 -2
- 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 +3 -2
- package/dist/plugins/_shared/authedFetch.js +0 -33
- package/dist/plugins/_shared/tokenRefresh.js +0 -41
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { AuthError } from "runline";
|
|
3
|
+
import { credentialRequest, pathSegment } from "../../_shared/credentials.js";
|
|
4
|
+
import { arr, num, numOrNull, obj, pick } from "../../_shared/provider.js";
|
|
5
|
+
import { appHeaders, gettCredential } from "./credentials.js";
|
|
6
|
+
export { APP_VERSION } from "./credentials.js";
|
|
5
7
|
export { arr, num, numOrNull, obj, pick };
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* terms of `http`/`authed` and never reaches the network itself.
|
|
9
|
+
* The Gett consumer surface: one host, one bearer, one refresh grant, all
|
|
10
|
+
* signed through the declared credential. Everything above this file works
|
|
11
|
+
* in terms of `authed` and never reaches the network itself.
|
|
11
12
|
*/
|
|
12
|
-
const HOST = "b2cgateway.gett.com";
|
|
13
|
-
const UA = "Gett/android/10.48.187";
|
|
14
|
-
export const APP_VERSION = "10.48.187";
|
|
15
13
|
/** Dizengoff Sq, TLV — a location that always has supply, used when none is given. */
|
|
16
14
|
export const DEF_LAT = 32.0779;
|
|
17
15
|
export const DEF_LON = 34.7743;
|
|
18
|
-
const MAX_RESPONSE_BYTES = 4 * 1024 * 1024;
|
|
19
16
|
const DEFAULT_TOKEN_TTL_MS = 3_600_000;
|
|
20
17
|
export const cfgOf = (ctx) => (ctx.connection.config || {});
|
|
21
18
|
/**
|
|
@@ -24,7 +21,7 @@ export const cfgOf = (ctx) => (ctx.connection.config || {});
|
|
|
24
21
|
* Gett signals refusal inside the body on some endpoints (`rc`) and in a status
|
|
25
22
|
* string on others, and answers 200 either way. An explicit `rc` decides; failing
|
|
26
23
|
* that an explicit status decides; a body carrying neither is an acceptance,
|
|
27
|
-
* because
|
|
24
|
+
* because every non-2xx has already been rejected. Erring the other way would
|
|
28
25
|
* report a booked ride as unbooked, and the caller would order a second car.
|
|
29
26
|
*/
|
|
30
27
|
export function accepted(body) {
|
|
@@ -53,10 +50,11 @@ export function normPhone(input) {
|
|
|
53
50
|
return `972${digits.slice(1)}`;
|
|
54
51
|
return `972${digits}`;
|
|
55
52
|
}
|
|
56
|
-
|
|
53
|
+
/** A configured or caller-supplied value as one path segment; surrounding whitespace is not part of it. */
|
|
54
|
+
export const seg = (value) => pathSegment(String(value ?? "").trim());
|
|
57
55
|
// ---------- HTTP ----------
|
|
58
56
|
/** Carries the status for control flow without putting a provider body in the message. */
|
|
59
|
-
class GettError extends Error {
|
|
57
|
+
export class GettError extends Error {
|
|
60
58
|
status;
|
|
61
59
|
constructor(status, endpoint) {
|
|
62
60
|
super(`gett: request failed (HTTP ${status}) on ${endpoint}`);
|
|
@@ -65,33 +63,12 @@ class GettError extends Error {
|
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
/** The account's phone is in nearly every path; it never belongs in an error. */
|
|
68
|
-
function endpointOf(path) {
|
|
66
|
+
export function endpointOf(path) {
|
|
69
67
|
return path.split("?")[0].replace(/\/phone\/[^/]+/, "/phone/{phone}");
|
|
70
68
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const payload = body == null ? null : JSON.stringify(body);
|
|
75
|
-
const headers = {
|
|
76
|
-
accept: "application/json",
|
|
77
|
-
"user-agent": UA,
|
|
78
|
-
"app-platform": "android",
|
|
79
|
-
"app-version": APP_VERSION,
|
|
80
|
-
"x-device-id": cfg.deviceId || "",
|
|
81
|
-
"x-client-device-unique-id": cfg.clientDeviceUniqueId || "",
|
|
82
|
-
"x-country-code": "IL",
|
|
83
|
-
};
|
|
84
|
-
if (token)
|
|
85
|
-
headers.authorization = `Bearer ${token}`;
|
|
86
|
-
if (payload)
|
|
87
|
-
headers["content-type"] = "application/json; charset=UTF-8";
|
|
88
|
-
const endpoint = endpointOf(path);
|
|
89
|
-
const res = await authedFetch(`https://${HOST}${path}`, {
|
|
90
|
-
method,
|
|
91
|
-
headers,
|
|
92
|
-
body: payload,
|
|
93
|
-
});
|
|
94
|
-
const text = await readBounded(res, MAX_RESPONSE_BYTES, `gett: response exceeded the size limit on ${endpoint}`);
|
|
69
|
+
/** A 2xx body as an object; anything that is not JSON reads as empty. */
|
|
70
|
+
export async function bodyOf(res, path) {
|
|
71
|
+
const text = await res.text();
|
|
95
72
|
let parsed = null;
|
|
96
73
|
try {
|
|
97
74
|
parsed = text ? JSON.parse(text) : null;
|
|
@@ -102,7 +79,7 @@ export async function http(ctx, path, opts = {}) {
|
|
|
102
79
|
// The body can hold tokens, the OTP, or the account holder's details; the
|
|
103
80
|
// status and the redacted endpoint are what a caller can act on.
|
|
104
81
|
if (!res.ok)
|
|
105
|
-
throw new GettError(res.status,
|
|
82
|
+
throw new GettError(res.status, endpointOf(path));
|
|
106
83
|
return obj(parsed);
|
|
107
84
|
}
|
|
108
85
|
/**
|
|
@@ -123,58 +100,38 @@ export async function ensureDevice(ctx) {
|
|
|
123
100
|
if (Object.keys(patch).length)
|
|
124
101
|
await ctx.updateConnection(patch);
|
|
125
102
|
}
|
|
126
|
-
// ---------- credentials ----------
|
|
127
103
|
export function expiresAt(expiresIn) {
|
|
128
104
|
const seconds = numOrNull(expiresIn);
|
|
129
105
|
return Date.now() + (seconds ? seconds * 1000 : DEFAULT_TOKEN_TTL_MS);
|
|
130
106
|
}
|
|
131
107
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* `?lc=en` is REQUIRED on every /auth/token call: the app sends it and the server
|
|
135
|
-
* 400s with an empty body without it. Access-token TTL is irrelevant to the grant
|
|
136
|
-
* (a bearer expired by days still refreshes), so a genuine 400 here means the
|
|
137
|
-
* refresh token itself is dead and a fresh owner login is required.
|
|
138
|
-
*
|
|
139
|
-
* Called only from inside an update owner, and always with an explicit token, so
|
|
140
|
-
* it can never re-enter the connection store.
|
|
108
|
+
* What a failed renewal means to the owner: no stored login, or a refresh
|
|
109
|
+
* token Gett no longer honours — both mended by the owner login.
|
|
141
110
|
*/
|
|
142
|
-
|
|
111
|
+
function sessionError(error) {
|
|
112
|
+
if (!(error instanceof AuthError))
|
|
113
|
+
return error;
|
|
114
|
+
if (error.code === "invalid_credentials")
|
|
115
|
+
return new Error("gett: not connected — run account.requestCode({ phone }) -> account.verifyCode({ code }) -> account.verifyCard({ card })");
|
|
116
|
+
if (error.code === "reconnect_required" ||
|
|
117
|
+
(error.code === "provider_rejected" && error.status === 400))
|
|
118
|
+
return new Error("gett: session expired (refresh rejected) — re-run the owner login: account.requestCode -> account.verifyCode -> account.verifyCard");
|
|
119
|
+
return error;
|
|
120
|
+
}
|
|
121
|
+
/** A call on the gateway, signed with the session's access token and renewed on demand. */
|
|
122
|
+
export async function authed(ctx, path, opts = {}) {
|
|
123
|
+
let res;
|
|
143
124
|
try {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
125
|
+
res = await credentialRequest(ctx, gettCredential, {
|
|
126
|
+
target: "api",
|
|
127
|
+
path: path.replace(/^\//, ""),
|
|
128
|
+
method: opts.method ?? "GET",
|
|
129
|
+
headers: appHeaders(ctx.connection.config),
|
|
130
|
+
...(opts.body == null ? {} : { json: opts.body }),
|
|
148
131
|
});
|
|
149
132
|
}
|
|
150
|
-
catch (
|
|
151
|
-
|
|
152
|
-
throw new Error("gett: session expired (refresh rejected) — re-run the owner login: account.requestCode -> account.verifyCode -> account.verifyCard");
|
|
153
|
-
}
|
|
154
|
-
throw e;
|
|
133
|
+
catch (error) {
|
|
134
|
+
throw sessionError(error);
|
|
155
135
|
}
|
|
156
|
-
|
|
157
|
-
export async function accessToken(ctx, force = false) {
|
|
158
|
-
const cfg = cfgOf(ctx);
|
|
159
|
-
if (!cfg.refreshToken)
|
|
160
|
-
throw new Error("gett: not connected — run account.requestCode({ phone }) -> account.verifyCode({ code }) -> account.verifyCard({ card })");
|
|
161
|
-
if (!cfg.phone)
|
|
162
|
-
throw new Error("gett: no phone configured");
|
|
163
|
-
// Renewal runs under the store's update ownership, so parallel actions
|
|
164
|
-
// coalesce onto one grant instead of clobbering each other's rotated token.
|
|
165
|
-
return coordinatedAccessToken(ctx, async (current) => {
|
|
166
|
-
const resp = await refreshGrant(ctx, current);
|
|
167
|
-
const issued = pick(resp.access_token);
|
|
168
|
-
if (!issued)
|
|
169
|
-
throw new Error("gett: token refresh returned no access_token");
|
|
170
|
-
const rotated = pick(resp.refresh_token);
|
|
171
|
-
return {
|
|
172
|
-
accessToken: issued,
|
|
173
|
-
accessTokenExpiresAt: expiresAt(resp.expires_in),
|
|
174
|
-
...(rotated ? { refreshToken: rotated } : {}),
|
|
175
|
-
};
|
|
176
|
-
}, force);
|
|
177
|
-
}
|
|
178
|
-
export async function authed(ctx, path, opts = {}) {
|
|
179
|
-
return http(ctx, path, { ...opts, token: await accessToken(ctx) });
|
|
136
|
+
return bodyOf(res, path);
|
|
180
137
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { httpsBase, staticCredential } from "../../_shared/credentials.js";
|
|
2
|
+
/**
|
|
3
|
+
* An Admin API key (`<id>:<hex secret>`), from which the transport signs a
|
|
4
|
+
* fresh five-minute JWT for every request, sent as `Authorization: Ghost
|
|
5
|
+
* <token>` to the site's unversioned Admin API base. The site URL is
|
|
6
|
+
* public config and must be HTTPS.
|
|
7
|
+
*/
|
|
8
|
+
export const ghostCredential = staticCredential({
|
|
9
|
+
id: "ghost",
|
|
10
|
+
auth: {
|
|
11
|
+
kind: "static",
|
|
12
|
+
parts: ["adminKey"],
|
|
13
|
+
placements: [
|
|
14
|
+
{
|
|
15
|
+
in: "jwt",
|
|
16
|
+
part: "adminKey",
|
|
17
|
+
name: "Authorization",
|
|
18
|
+
prefix: "Ghost ",
|
|
19
|
+
audience: "/admin/",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
local: { adminKey: "adminApiKey" },
|
|
24
|
+
targets: (config) => ({
|
|
25
|
+
admin: {
|
|
26
|
+
baseUrl: httpsBase(config.url, "ghost/api/admin/"),
|
|
27
|
+
methods: ["GET", "POST", "PUT", "DELETE"],
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
probe: {
|
|
31
|
+
target: "admin",
|
|
32
|
+
path: "site/",
|
|
33
|
+
method: "GET",
|
|
34
|
+
acceptedStatuses: [200],
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -1,60 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const enc = new TextEncoder();
|
|
9
|
-
const keyData = new Uint8Array((secret.match(/.{2}/g) ?? []).map((b) => parseInt(b, 16)));
|
|
10
|
-
const cryptoKey = await crypto.subtle.importKey("raw", keyData, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
11
|
-
const sig = await crypto.subtle.sign("HMAC", cryptoKey, enc.encode(`${header}.${payload}`));
|
|
12
|
-
const sigStr = btoa(String.fromCharCode(...new Uint8Array(sig)))
|
|
13
|
-
.replace(/\+/g, "-")
|
|
14
|
-
.replace(/\//g, "_")
|
|
15
|
-
.replace(/=/g, "");
|
|
16
|
-
const token = `${header}.${payload}.${sigStr}`;
|
|
17
|
-
const base = url.replace(/\/$/, "");
|
|
18
|
-
const fullUrl = new URL(`${base}/ghost/api/v2/admin${endpoint}`);
|
|
19
|
-
if (qs) {
|
|
20
|
-
for (const [k, v] of Object.entries(qs)) {
|
|
21
|
-
if (v !== undefined && v !== null)
|
|
22
|
-
fullUrl.searchParams.set(k, String(v));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const opts = {
|
|
1
|
+
import { credentialJson, pathSegment } from "../../_shared/credentials.js";
|
|
2
|
+
import { ghostCredential } from "./credentials.js";
|
|
3
|
+
/** A Ghost Admin API call; GET and DELETE carry no body. */
|
|
4
|
+
function req(ctx, method, path, body, query) {
|
|
5
|
+
return credentialJson(ctx, ghostCredential, "ghost", {
|
|
6
|
+
target: "admin",
|
|
7
|
+
path,
|
|
26
8
|
method,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
if (body &&
|
|
33
|
-
Object.keys(body).length > 0 &&
|
|
34
|
-
method !== "GET" &&
|
|
35
|
-
method !== "DELETE") {
|
|
36
|
-
opts.body = JSON.stringify(body);
|
|
37
|
-
}
|
|
38
|
-
const res = await fetch(fullUrl.toString(), opts);
|
|
39
|
-
if (!res.ok)
|
|
40
|
-
throw new Error(`Ghost API error ${res.status}: ${await res.text()}`);
|
|
41
|
-
if (res.status === 204)
|
|
42
|
-
return { success: true };
|
|
43
|
-
return res.json();
|
|
44
|
-
}
|
|
45
|
-
function getConn(ctx) {
|
|
46
|
-
return {
|
|
47
|
-
url: ctx.connection.config.url.replace(/\/$/, ""),
|
|
48
|
-
adminApiKey: ctx.connection.config.adminApiKey,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function req(ctx, method, endpoint, body, qs) {
|
|
52
|
-
const { url, adminApiKey } = getConn(ctx);
|
|
53
|
-
return apiRequest(url, adminApiKey, method, endpoint, body, qs);
|
|
9
|
+
query,
|
|
10
|
+
...(body && method !== "GET" && method !== "DELETE" ? { json: body } : {}),
|
|
11
|
+
});
|
|
54
12
|
}
|
|
55
13
|
export default function ghost(rl) {
|
|
56
14
|
rl.setName("ghost");
|
|
57
15
|
rl.setVersion("0.1.0");
|
|
16
|
+
rl.setCredential(ghostCredential);
|
|
58
17
|
rl.setConnectionSchema({
|
|
59
18
|
url: {
|
|
60
19
|
type: "string",
|
|
@@ -133,7 +92,7 @@ export default function ghost(rl) {
|
|
|
133
92
|
post.featured = featured;
|
|
134
93
|
if (slug)
|
|
135
94
|
post.slug = slug;
|
|
136
|
-
const data = (await req(ctx, "POST", "
|
|
95
|
+
const data = (await req(ctx, "POST", "posts/", { posts: [post] }, qs));
|
|
137
96
|
return data.posts?.[0];
|
|
138
97
|
},
|
|
139
98
|
});
|
|
@@ -156,9 +115,9 @@ export default function ghost(rl) {
|
|
|
156
115
|
qs.formats = formats;
|
|
157
116
|
let endpoint;
|
|
158
117
|
if (slug)
|
|
159
|
-
endpoint =
|
|
118
|
+
endpoint = `posts/slug/${pathSegment(slug)}/`;
|
|
160
119
|
else if (id)
|
|
161
|
-
endpoint =
|
|
120
|
+
endpoint = `posts/${pathSegment(id)}/`;
|
|
162
121
|
else
|
|
163
122
|
throw new Error("Provide either id or slug");
|
|
164
123
|
const data = (await req(ctx, "GET", endpoint, undefined, qs));
|
|
@@ -204,7 +163,7 @@ export default function ghost(rl) {
|
|
|
204
163
|
qs.formats = formats;
|
|
205
164
|
if (order)
|
|
206
165
|
qs.order = order;
|
|
207
|
-
const data = (await req(ctx, "GET", "
|
|
166
|
+
const data = (await req(ctx, "GET", "posts/", undefined, qs));
|
|
208
167
|
return data.posts;
|
|
209
168
|
},
|
|
210
169
|
});
|
|
@@ -241,7 +200,7 @@ export default function ghost(rl) {
|
|
|
241
200
|
async execute(input, ctx) {
|
|
242
201
|
const { postId, title, html, lexical, status, publishedAt, tags, featured, slug, } = input;
|
|
243
202
|
// Need updated_at for optimistic locking
|
|
244
|
-
const existing = (await req(ctx, "GET",
|
|
203
|
+
const existing = (await req(ctx, "GET", `posts/${pathSegment(postId)}/`, undefined, {
|
|
245
204
|
fields: "id,updated_at",
|
|
246
205
|
}));
|
|
247
206
|
const currentPost = existing.posts[0];
|
|
@@ -267,7 +226,7 @@ export default function ghost(rl) {
|
|
|
267
226
|
post.featured = featured;
|
|
268
227
|
if (slug)
|
|
269
228
|
post.slug = slug;
|
|
270
|
-
const data = (await req(ctx, "PUT",
|
|
229
|
+
const data = (await req(ctx, "PUT", `posts/${pathSegment(postId)}/`, { posts: [post] }, qs));
|
|
271
230
|
return data.posts?.[0];
|
|
272
231
|
},
|
|
273
232
|
});
|
|
@@ -278,7 +237,7 @@ export default function ghost(rl) {
|
|
|
278
237
|
postId: { type: "string", required: true, description: "Post ID" },
|
|
279
238
|
},
|
|
280
239
|
async execute(input, ctx) {
|
|
281
|
-
await req(ctx, "DELETE",
|
|
240
|
+
await req(ctx, "DELETE", `posts/${pathSegment(input.postId)}/`);
|
|
282
241
|
return { success: true };
|
|
283
242
|
},
|
|
284
243
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { httpsBase, staticCredential } from "../../_shared/credentials.js";
|
|
2
|
+
export const GITHUB_API_VERSION = "2022-11-28";
|
|
3
|
+
/**
|
|
4
|
+
* A personal access token, sent as a bearer to the configured API origin —
|
|
5
|
+
* github.com by default, a GitHub Enterprise host when baseUrl says so.
|
|
6
|
+
*/
|
|
7
|
+
export const githubCredential = staticCredential({
|
|
8
|
+
id: "github",
|
|
9
|
+
auth: { kind: "bearer" },
|
|
10
|
+
local: { secret: "token" },
|
|
11
|
+
targets: (config) => ({
|
|
12
|
+
api: {
|
|
13
|
+
baseUrl: httpsBase(config.baseUrl ?? "https://api.github.com", ""),
|
|
14
|
+
methods: ["GET", "POST", "PUT", "PATCH", "DELETE"],
|
|
15
|
+
allowedHeaders: ["X-GitHub-Api-Version"],
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
});
|