How to use the @esri/solution-common.createItemWithData function in @esri/solution-common

To help you get started, we’ve selected a few @esri/solution-common 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 / packages / deployer / src / deployer.ts View on Github external
folderResponse.folder.id +
                        ")"
                    );
                    console.log(
                      "totalEstimatedCost, progressPercentStep",
                      totalEstimatedCost.toString(),
                      progressPercentStep.toFixed(2).toString()
                    );
                    progressCallback((percentDone += 2 * progressPercentStep)); // for data fetch and folder creation

                    const updateItemInfo = {
                      ...item,
                      type: "Solution",
                      typeKeywords: ["Solution"]
                    };
                    common
                      .createItemWithData(
                        updateItemInfo,
                        {},
                        destinationAuthentication,
                        templateDictionary.folderId
                      )
                      .then(
                        updateResponse => {
                          const oldID: string = sourceId;
                          const newID: string = updateResponse.id;
                          console.log("Solution " + newID + " created");
                          templateDictionary.solutionItemId = newID;
                          item.id = newID;
                          item.thumbnailUrl = _checkedReplaceAll(
                            item.thumbnailUrl,
                            oldID,
github Esri / solution.js / packages / simple-types / src / simple-types.ts View on Github external
// Create the item, then update its URL with its new id

    // some fieldnames are used as keys for objects
    // when we templatize field references for web applications we first stringify the components of the
    // web application that could contain field references and then serach for them with a regular expression.
    // We also need to stringify the web application when de-templatizing so it will find all of these occurrences as well.
    if (template.type === "Web Mapping Application" && template.data) {
      newItemTemplate = JSON.parse(
        common.replaceInTemplate(
          JSON.stringify(newItemTemplate),
          templateDictionary
        )
      );
    }
    common
      .createItemWithData(
        newItemTemplate.item,
        newItemTemplate.data,
        destinationAuthentication,
        templateDictionary.folderId
      )
      .then(
        createResponse => {
          progressTickCallback();
          // Add the new item to the settings
          newItemTemplate.itemId = createResponse.id;
          templateDictionary[template.itemId] = {
            itemId: createResponse.id
          };

          // Set the appItemId manually to get around cases where the path was incorrectly set
github Esri / solution.js / packages / simple-types / src / webmappingapplication.ts View on Github external
return new Promise(resolve => {
    // If this is a Web AppBuilder application, we will create a Code Attachment for downloading
    if (
      common.hasAnyKeyword(originalTemplate, [
        "WAB2D",
        "WAB3D",
        "Web AppBuilder"
      ])
    ) {
      common
        .createItemWithData(
          {
            tags: originalTemplate.item.tags,
            title: originalTemplate.item.title,
            type: "Code Attachment",
            typeKeywords: ["Code", "Javascript", "Web Mapping Application"],
            relationshipType: "WMA2Code",
            originItemId: newlyCreatedItem.itemId,
            url:
              common.replaceInTemplate(
                common.PLACEHOLDER_SERVER_NAME,
                templateDictionary
              ) +
              "/sharing/rest/content/items/" +
              newlyCreatedItem.itemId +
              "/package"
github Esri / solution.js / packages / creator / src / creator.ts View on Github external
tags: options?.tags ?? [],
      typeKeywords: ["Solution", "Template"]
    };
    if (Array.isArray(options?.additionalTypeKeywords)) {
      solutionItem.typeKeywords = solutionItem.typeKeywords.concat(
        options!.additionalTypeKeywords
      );
    }

    const solutionData: common.ISolutionItemData = {
      metadata: {},
      templates: []
    };

    // Create new solution item
    common
      .createItemWithData(
        solutionItem,
        solutionData,
        authentication,
        undefined // use top-level folder
      )
      .then(
        updateResponse => {
          // Thumbnail must be added manually
          if (solutionItem.thumbnailUrl) {
            // thumbnailUrl += "?token=" + authentication.token();
            common
              .addThumbnailFromUrl(
                solutionItem.thumbnailUrl,
                updateResponse.id,
                authentication