@vercel/integration-utils
    TypeScript icon, indicating that this package has built-in type declarations

    0.6.5-canary.0 • Public • Published

    @vercel/integration-utils

    npm install size cicleci codecov

    A set of utilies for Vercel Integrations.
    Vist https://vercel.com/docs/integrations for more details.

    Install

    yarn add @vercel/integrations
    

    Middleware for Micro / Vercel

    This middleware helps to write UiHook for Vercel integrations easily.

    const {withUiHook} = require('@vercel/integration-utils');
     
    module.exports = withUiHook(async (options) => {
        const {payload, vercelClient} = options;
        const {action, clientState} = payload;
        let metadata = await vercelClient.getMetadata();
     
        if (action === 'submit') {
            metadata = clientState;
            await vercelClient.setMetadata(metadata);
        }
     
        if (action === 'reset') {
            metadata = {};
            await vercelClient.setMetadata(metadata);
        }
     
        return `
            <Page>
                <Container>
                    <Input label="Secret Id" name="secretId" value="${metadata.secretId || ''}"/>
                    <Input label="Secret Key" name="secretKey" type="password" value="${metadata.secretKey || ''}" />
                </Container>
                <Container>
                    <Button action="submit">Submit</Button>
                    <Button action="reset">Reset</Button>
                </Container>
            </Page>
        `;
    });
     

    This middleware calls the handler with an object containing following entities:

    • payload - the information related uiHook
    • vercelClient - initialized API client for Vercel with some helpers

    Keywords

    none

    Install

    npm i @vercel/integration-utils

    DownloadsWeekly Downloads

    9

    Version

    0.6.5-canary.0

    License

    MIT

    Unpacked Size

    20.1 kB

    Total Files

    12

    Last publish

    Collaborators

    • crowterli
    • gsoltis
    • schlez
    • epallerols
    • domysee
    • nwienert
    • arbw
    • gudmundur
    • marcgreenstock
    • stephdietz
    • vvo
    • falcoagustin
    • nabsul
    • bmealey
    • brethudson
    • maedahbatool
    • matt.straka
    • jasongullickson
    • f3d0r
    • gaspar09
    • jtaylor0196
    • pieparker
    • kelly
    • dferber90
    • healeycodes
    • broph123
    • codybrouwers
    • ebb-tide
    • gdborton
    • msimulcik
    • jeffreyarneson
    • jaredpalmer
    • kikobeats
    • domeccleston
    • nutlope
    • hungrybearstudio
    • codetaromiura
    • mattcleg
    • gkaragkiaouris
    • geovanisouza92
    • dglsparsons
    • lostinpatterns
    • pralhad-vercel
    • vercel-release-bot
    • williamli
    • southpolesteve
    • goncy
    • chibicode
    • ijjk
    • andybitz
    • iamevilrabbit
    • joecohens
    • tootallnate
    • styfle
    • zeit-bot
    • quietshu
    • hankvercel
    • mglagola
    • javivelasco
    • igorklopov
    • paco
    • dav-is
    • timer
    • lucleray
    • leerobinson
    • matheuss
    • nkzawa
    • anatrajkovska
    • timneutkens
    • elsigh
    • cl3arglass
    • samsisle
    • chriswdmr
    • rizbizkits
    • ernestd
    • ismaelrumzan
    • jhoch
    • mrmckeb
    • kuvos
    • creationix
    • rauchg
    • huozhi
    • aadityajshah
    • cmvnk
    • lfades
    • paulogdm
    • ktcarter
    • okbel
    • padmaia
    • msweeneydev
    • delba
    • catsaremlg
    • steventey
    • sokra
    • gsandhu
    • dbredvick
    • kdy1