@zeit/addons
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    @zeit/addons

    npm install size cicleci codecov

    A set of utilies for ZEIT Addons.
    Vist https://zeit.co/docs/addons for more details.

    Install

    yarn add @zeit/addons
    

    Middleware for Micro / Now v2

    This middleware helps to write UiHook for ZEIT addons easily.

    const {withUiHook} = require('@zeit/addons');
    
    module.exports = withUiHook(async (options) => {
    	const {payload, zeitClient} = options;
    	const {action, clientState} = payload;
    	let metadata = await zeitClient.getMetadata();
    
    	if (action === 'submit') {
    		metadata = clientState;
    		await zeitClient.setMetadata(metadata);
    	}
    
    	if (action === 'reset') {
    		metadata = {};
    		await zeitClient.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
    • zeitClient - initialized API client for ZEIT with some helpers

    Keywords

    none

    Install

    npm i @zeit/addons

    DownloadsWeekly Downloads

    18

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    9.01 kB

    Total Files

    8

    Last publish

    Collaborators

    • nalalami
    • mbrakken
    • wyattjoh
    • pearlbea
    • gt-codes
    • sowsut
    • jennifer_stern
    • kaiyuhsu
    • matthewstanciu
    • hannesborno
    • lubakravche
    • aaronbrown-vercel
    • denizkusef
    • javierbyte
    • kayernyc
    • janory
    • goncy
    • codyogden
    • feedthejim
    • tilly3g
    • wits
    • feugy
    • gbibeaulaviolette
    • megbird
    • dizzyup
    • vin-e
    • edgarcerecerezv
    • livcarman
    • segunadebayo
    • sambecker
    • craigandrews
    • mjakobis
    • kale-stew
    • chloe.tedder
    • pbto
    • daniel.campbell
    • arian-vercel
    • nuta
    • almonk
    • samselikoff
    • dcartertwo
    • baruchadi
    • ejc
    • aaorris
    • doque
    • ryanto
    • nathanhammond
    • snokohn
    • johnphamous
    • tknickman
    • agadzik
    • thomcrowe
    • emeraldsanto
    • ecklf
    • timeyoutakeit
    • cramforce
    • balazs4
    • casey.gowrie
    • samuel.foster
    • swarnavasengupta
    • lydiahallie
    • ethan_arrowood
    • kwonoj
    • kakadiadarpan
    • amanhimself_
    • endangeredmassa
    • nick.tracey
    • reconbot
    • schlez
    • crowterli
    • gsoltis
    • epallerols
    • domysee
    • nwienert
    • arbw
    • stephdietz
    • gudmundur
    • marcgreenstock
    • vvo
    • falcoagustin
    • nabsul
    • bmealey
    • maedahbatool
    • brethudson
    • matt.straka
    • jasongullickson
    • f3d0r
    • gaspar09
    • jtaylor0196
    • pieparker
    • kelly
    • dferber90
    • healeycodes
    • broph123
    • codybrouwers
    • gdborton
    • jeffreyarneson
    • ebb-tide
    • msimulcik
    • domeccleston
    • nutlope
    • hungrybearstudio
    • codetaromiura
    • gkaragkiaouris
    • geovanisouza92
    • dglsparsons
    • lostinpatterns
    • vercel-release-bot
    • southpolesteve
    • matheuss
    • igorklopov
    • nkzawa
    • tootallnate
    • rauchg
    • timneutkens
    • javivelasco
    • iamevilrabbit
    • kdy1
    • quietshu
    • styfle
    • zeit-bot
    • lucleray
    • mglagola
    • andybitz
    • paulogdm
    • anatrajkovska
    • timer
    • arzafran
    • ijjk
    • lfades
    • msweeneydev
    • williamli
    • ragojose
    • guybedford
    • skllcrn
    • janicklas-ralph
    • atcastle
    • spanicker
    • housseindjirdeh
    • gmonaco
    • kikobeats
    • prateekbh
    • jkrems
    • jaredpalmer
    • gielcobben
    • chibicode
    • nazarenooviedo
    • samsisle
    • okbel
    • hankvercel
    • leerobinson
    • elsigh
    • julianbenegas
    • rizbizkits
    • sokra
    • cl3arglass
    • chriswdmr
    • ernestd
    • ismaelrumzan
    • jhoch
    • mitchellwright
    • mrmckeb
    • kuvos
    • creationix
    • huozhi
    • cmvnk
    • ktcarter
    • padmaia
    • delba
    • catsaremlg
    • steventey
    • gsandhu
    • dbredvick