Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contentful/app-action-utils

Package Overview
Dependencies
Maintainers
156
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/app-action-utils

Utilities for intearcting with Hosted App Actions

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.2K
decreased by-57.75%
Maintainers
156
Weekly downloads
 
Created
Source

Utils package for Hosted App Actions

This repo is a growing collection of utils for interacting with App Actions

Compatibiltiy

Requires an Node.js LTS version, at least 16.13. Odd-numbered and not-yet LTS major versions are not supported.

Installation

npm install --save @contentful/app-action-utils
# or
yarn add @contentful/app-action-utils

Available features

Right now it only supports calling the app action and retrieving the result. This consist of:

  • Calling app actions
  • Getting an app action result
  • Polling, retrying and parsing of the details call

Requirements

When passing the plain client generated from contentful-management, it has to have org, space and environment set as defaults. If not you can pass in the spaceId and environmentId to each of the methods.

Usage

Calling an app action and getting the result

To call an app action and get the result callAppAction can be used like this

import { createClient } from 'contentful-management'


const api = createClient({
    accessToken: '<token>'
}, {
    type: 'plain'
})

const parameters: AppActionCategoryParams<'<appActionCategory>'> = {} // The parameters the app action expects, when the generic is correct it's fully typed.
const abortController = new AbortController()
const additionalParameters = {
    spaceId: '<spaceId>',
    environmentId: '<environmentId>'
}

const appActionResult = await callAppAction({
    api,
    appActionId: '<appActionId>',
    appDefinitionId: '<appDefinitionId>',
    timeout: 10000, // Not required and 10000 is the default
    abortSignal: abortController.signal // Not required
    retryInterval: 1000 // Not required, 1000 is the default,
    additionalParameters // Not required if the client has the defaults set
})

Getting the result of a previous call

const appActionResult = await callAppActionResult({
    api,
    appActionId: '<appActionId>',
    callId: '<callId>',
    spaceId: '<spaceId>', // Not required if the client has set it as a default
    environmentId: '<environmentId>', // Not required if the client has set it as a default
    timeout: 10000, // Not required and 10000 is the default
    abortSignal: abortController.signal // Not required
    retryInterval: 1000 // Not required, 1000 is the default,
})

FAQs

Package last updated on 20 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc