npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@litviachenko/aio-lib-templates

v1.3.2

Published

A library to communicate with Adobe App Builder Template Registry.

Downloads

8

Readme

Adobe App Builder Templates Library

This is a helper library that is to be used in the Adobe I/O CLI and SDKs to communicate with Adobe App Builder Template Registry through its REST APIs.

Installing

$ npm install @adobe/aio-lib-templates

Usage

Search Adobe App Builder templates

Search Adobe App Builder templates in Adobe App Builder Template Registry and paginate through results.

const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init();
    // an optional Search Criteria object
    // without Search Criteria the following code will paginate through all Adobe App Builder templates
    const searchCriteria = {
        [sdk.SEARCH_CRITERIA_CATEGORIES]: ['action', 'ui'],
        [sdk.SEARCH_CRITERIA_STATUSES]: [sdk.TEMPLATE_STATUS_APPROVED],
        [sdk.SEARCH_CRITERIA_ADOBE_RECOMMENDED]: true
    };
    // an optional OrderBy Criteria object
    const orderByCriteria = {
        [sdk.ORDER_BY_CRITERIA_NAMES]: sdk.ORDER_BY_CRITERIA_SORT_DESC
    };
    for await (const templates of templateRegistryClient.getTemplates(searchCriteria, orderByCriteria)) {
        for (const template of templates) {
            console.log(template);
        }
    }
}
Supported Search Criteria properties

| Key | Value | SDK Constant | Description | | ------------------ | -------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | names | list of strings | SEARCH_CRITERIA_NAMES | Filter by template names. | | categories | list of strings | SEARCH_CRITERIA_CATEGORIES | Filter by template categories. | | statuses | list of strings | SEARCH_CRITERIA_STATUSES | Filter by template statuses (TEMPLATE_STATUS_IN_VERIFICATION, TEMPLATE_STATUS_APPROVED, TEMPLATE_STATUS_REJECTED). | | apis | list of strings | SEARCH_CRITERIA_APIS | Filter by template APIs. Supports EMPTY and ANY filters. | | extensions | list of strings | SEARCH_CRITERIA_EXTENSIONS | Filter by template extension points. Supports EMPTY and ANY filters. | | events | EMPTY and ANY filters only | SEARCH_CRITERIA_EVENTS | Filter by template events. For now supports EMPTY and ANY filters only. | | runtime | boolean | SEARCH_CRITERIA_RUNTIME | Is Adobe I/O Runtime required or not? Supports EMPTY and ANY filters. | | adobeRecommended | boolean | SEARCH_CRITERIA_ADOBE_RECOMMENDED | Indicates templates featured by Adobe. |

EMPTY and ANY filters

| Filter Type | Value | SDK Constant | Description | | ------------ | --------------------- | --------------------------- | ----------------------------------------------------- | | EMPTY (NONE) | '', an empty string | SEARCH_CRITERIA_FILTER_NONE | Returns all templates that don't have a property set. | | ANY | *, an asterisk symbol | SEARCH_CRITERIA_FILTER_ANY | Returns all templates that have a property set. |

Supported OrderBy Criteria properties

| Key | Value | SDK Constant | Description | | ------------------ | ------------------- | ----------------------------------- | ------------------------------------- | | names | string, desc or asc | ORDER_BY_CRITERIA_NAMES | Sort by template names. | | statuses | string, desc or asc | ORDER_BY_CRITERIA_STATUSES | Sort by template statuses. | | adobeRecommended | string, desc or asc | ORDER_BY_CRITERIA_ADOBE_RECOMMENDED | Sort by the "Adobe Recommended" flag. | | publishDate | string, desc or asc | ORDER_BY_CRITERIA_PUBLISH_DATE | Sort by a publish date. |

Get a template from Adobe App Builder Template Registry

Get a template from Adobe App Builder Template Registry.

const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init();
    const templateName = '@author/app-builder-template';
    try {
        const template = await templateRegistryClient.getTemplate(templateName);
        console.log(template);
    } catch (error) {
        console.log(error.toString());
    }
}

Add a new template to Adobe App Builder Template Registry

Add a new template to Adobe App Builder Template Registry.

const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init({
        'auth': {
            'token': '<IMS_ACCESS_TOKEN>'
        }
    });
    const templateName = '@author/app-builder-template';
    const githubRepoUrl = 'https://github.com/author/app-builder-template';
    try {
        const template = await templateRegistryClient.addTemplate(templateName, githubRepoUrl);
        console.log(`A new template "${template.name}" has been successfully added to Adobe App Builder Template Registry.`);
        console.log(`Its status is ${sdk.TEMPLATE_STATUS_IN_VERIFICATION}. Please use the "${template.reviewLink}" link to check the verification status.`);
    } catch (error) {
        console.log(error.toString());
    }
}

Delete a template from Adobe App Builder Template Registry

Delete a template from Adobe App Builder Template Registry.

const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init({
        'auth': {
            'token': '<IMS_ACCESS_TOKEN>'
        }
    });
    const templateName = '@author/app-builder-template';
    try {
        await templateRegistryClient.deleteTemplate(templateName);
        console.log(`"${templateName}" has been successfully deleted from Adobe App Builder Template Registry.`);
    } catch (error) {
        console.log(error.toString());
    }
}

Explore

goto API

Contributing

Contributions are welcome! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.