How to use adlib - 10 common examples

To help you get started, we’ve selected a few adlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / solution.js / src / solution.ts View on Github external
() => {
        // Prepare template
        let itemTemplate = mClassifier.initItemTemplateFromJSON(findTemplateInList(itemTemplates, itemId));

        // Interpolate it
        itemTemplate.dependencies = itemTemplate.dependencies ?
          mCommon.templatize(itemTemplate.dependencies) as string[] : [];
        itemTemplate = adlib.adlib(itemTemplate, settings);

        // Deploy it
        itemTemplate.fcns.createItemFromTemplate(itemTemplate, settings, requestOptions, progressCallback)
        .then(
          itemClone => resolve(itemClone),
          (e) => reject(mCommon.fail(e))
        )
      },
      (e) => reject(mCommon.fail(e))
github Esri / solution.js / src / itemTypes / webmap.ts View on Github external
createResponse => {
        if (createResponse.success) {
          // Add the new item to the settings
          settings[itemTemplate.itemId] = {
            id: createResponse.id
          };
          itemTemplate.itemId = itemTemplate.item.id = createResponse.id;
          itemTemplate = adlib.adlib(itemTemplate, settings);

          // Update the app URL
          progressCallback && progressCallback({
            processId: itemTemplate.key,
            status: "updating URL"
          });
          mCommon.updateItemURL(itemTemplate.itemId, itemTemplate.item.url, requestOptions)
          .then(
            () => {
              mCommon.finalCallback(itemTemplate.key, true, progressCallback);
              resolve(itemTemplate);
            },
            (e) => {
              mCommon.finalCallback(itemTemplate.key, false, progressCallback);
              reject(mCommon.fail(e));
            }
github Esri / solution.js / src / itemTypes / generic.ts View on Github external
createResponse => {
        if (createResponse.success) {
          // Add the new item to the settings
          settings[itemTemplate.itemId] = {
            id: createResponse.id
          };
          itemTemplate.itemId = itemTemplate.item.id = createResponse.id;
          itemTemplate = adlib.adlib(itemTemplate, settings);

          mCommon.finalCallback(itemTemplate.key, true, progressCallback);
          resolve(itemTemplate);
        } else {
          mCommon.finalCallback(itemTemplate.key, false, progressCallback);
          reject(mCommon.fail());
        }
      },
      (e) => {
github Esri / solution.js / src / itemTypes / dashboard.ts View on Github external
createResponse => {
        if (createResponse.success) {
          // Add the new item to the settings
          settings[itemTemplate.itemId] = {
            id: createResponse.id
          };
          itemTemplate.itemId = itemTemplate.item.id = createResponse.id;
          itemTemplate = adlib.adlib(itemTemplate, settings);

          // Update the app URL
          progressCallback && progressCallback({
            processId: itemTemplate.key,
            status: "updating URL"
          });
          mCommon.updateItemURL(itemTemplate.itemId, itemTemplate.item.url, requestOptions)
          .then(
            () => {
              mCommon.finalCallback(itemTemplate.key, true, progressCallback);
              resolve(itemTemplate);
            },
            (e) => {
              mCommon.finalCallback(itemTemplate.key, false, progressCallback);
              reject(mCommon.fail(e));
            }
github Esri / solution.js / src / itemTypes / group.ts View on Github external
createResponse => {
        if (createResponse.success) {
          // Add the new item to the settings
          settings[itemTemplate.itemId] = {
            id: createResponse.group.id
          };
          itemTemplate.itemId = createResponse.group.id;
          itemTemplate = adlib.adlib(itemTemplate, settings);

          // Add the group's items to it
          addGroupMembers(itemTemplate, requestOptions, progressCallback)
          .then(
            () => {
              mCommon.finalCallback(itemTemplate.key, true, progressCallback);
              resolve(itemTemplate);
            },
            (e) => {
              mCommon.finalCallback(itemTemplate.key, false, progressCallback);
              reject(mCommon.fail(e));
            }
                );
        } else {
          mCommon.finalCallback(itemTemplate.key, false, progressCallback);
          reject(mCommon.fail());
github Esri / solution.js / src / itemTypes / featureservice.ts View on Github external
createResponse => {
        // Add the new item to the settings list
        settings[itemTemplate.itemId] = {
          id: createResponse.serviceItemId,
          url: createResponse.serviceurl
        };
        itemTemplate.itemId = itemTemplate.item.id = createResponse.serviceItemId;
        itemTemplate = adlib.adlib(itemTemplate, settings);
        itemTemplate.item.url = createResponse.serviceurl;

        // Update item using a unique name because createFeatureService doesn't provide a way to specify
        // snippet, description, etc.
        const updateOptions:items.IItemUpdateRequestOptions = {
          item: {
            id: itemTemplate.itemId,
            title: itemTemplate.item.title,
            snippet: itemTemplate.item.snippet,
            description: itemTemplate.item.description,
            accessInfo: itemTemplate.item.accessInfo,
            licenseInfo: itemTemplate.item.licenseInfo,
            text: itemTemplate.data
          },
          ...requestOptions
        };
github Esri / solution.js / src / itemTypes / webmappingapplication.ts View on Github external
createResponse => {
        if (createResponse.success) {
          // Add the new item to the settings
          settings[itemTemplate.itemId] = {
            id: createResponse.id
          };
          itemTemplate.itemId = itemTemplate.item.id = createResponse.id;
          itemTemplate = adlib.adlib(itemTemplate, settings);

          // Update the app URL
          progressCallback && progressCallback({
            processId: itemTemplate.key,
            status: "updating URL"
          });
          mCommon.updateItemURL(itemTemplate.itemId, itemTemplate.item.url, requestOptions)
          .then(
            () => {
              mCommon.finalCallback(itemTemplate.key, true, progressCallback);
              resolve(itemTemplate);
            },
            () => {
              mCommon.finalCallback(itemTemplate.key, false, progressCallback);
              reject({ success: false });
            }
github DefinitelyTyped / DefinitelyTyped / types / adlib / adlib-tests.ts View on Github external
const transformsList: adlib.TransformsList = {
    firstXform: transform1
};

const template = {
    value: '{{ instance.color }}'
};

const settings = {
    instance: {
        color: 'red'
    }
};

const interpolated = adlib.adlib(template, settings, transformsList);

const list: string[] = adlib.listDependencies(template);
github DefinitelyTyped / DefinitelyTyped / types / adlib / adlib-tests.ts View on Github external
firstXform: transform1
};

const template = {
    value: '{{ instance.color }}'
};

const settings = {
    instance: {
        color: 'red'
    }
};

const interpolated = adlib.adlib(template, settings, transformsList);

const list: string[] = adlib.listDependencies(template);
github Esri / solution.js / packages / common / src / templatization.ts View on Github external
export function replaceInTemplate(template: any, replacements: any): any {
  return adlib.adlib(template, replacements, TRANSFORMS);
}

adlib

Templating for deep JSON object graphs

Apache-2.0
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis

Popular adlib functions