How to use the @esri/arcgis-rest-request.warn function in @esri/arcgis-rest-request

To help you get started, we’ve selected a few @esri/arcgis-rest-request 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 / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
private addModifier(modifier: string) {
    if (this.currentModifer) {
      warn(
        // prettier-ignore
        `You have called \`${this.currentModifer}()\` after \`${modifier}()\`. Your current query was not modified.`
      );
      return this;
    }

    this.commit();

    if (this.q === "") {
      warn(
        `You have called \`${modifier}()\` without calling another method to modify your query first. Try calling \`match()\` first.`
      );
      return this;
    }

    this.currentModifer = modifier;
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
private addModifier(modifier: string) {
    if (this.currentModifer) {
      warn(
        // prettier-ignore
        `You have called \`${this.currentModifer}()\` after \`${modifier}()\`. Your current query was not modified.`
      );
      return this;
    }

    this.commit();

    if (this.q === "") {
      warn(
        `You have called \`${modifier}()\` without calling another method to modify your query first. Try calling \`match()\` first.`
      );
      return this;
    }

    this.currentModifer = modifier;
    this.q += ` ${modifier.toUpperCase()} `;
    return this;
  }
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
public in(this: SearchQueryBuilder, field?: string) {
    const fn = `\`in(${field ? `"${field}"` : ""})\``;

    if (!this.hasRange && !this.hasTerms) {
      warn(
        // prettier-ignore
        `${fn} was called with no call to \`match(...)\` or \`from(...)\`/\`to(...)\`. Your query was not modified.`
      );
      return this;
    }

    if (field && field !== "*") {
      this.q += `${field}: `;
    }

    return this.commit();
  }
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
public to(this: SearchQueryBuilder, term: any) {
    if (this.hasTerms) {
      warn(
        // prettier-ignore
        `\`to(...)\` is not allowed after \`match(...)\` try using \`.from(...).to(...).in(...)\`. Your query was not modified.`
      );
      return this;
    }
    this.rangeStack[1] = term;
    return this;
  }
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
public from(this: SearchQueryBuilder, term: number | string | Date) {
    if (this.hasTerms) {
      warn(
        // prettier-ignore
        `\`from(...)\` is not allowed after \`match(...)\` try using \`.from(...).to(...).in(...)\`. Your query was not modified.`
      );
      return this;
    }
    this.rangeStack[0] = term;
    return this;
  }
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
private cleanup() {
    // end a group if we have started one
    if (this.openGroups > 0) {
      warn(
        // prettier-ignore
        `Automatically closing ${this.openGroups} group(s). You can use \`endGroup(...)\` to remove this warning.`
      );

      while (this.openGroups > 0) {
        this.q += ")";
        this.openGroups--;
      }
    }

    const oldQ = this.q;
    this.q = oldQ.replace(/( AND ?| NOT ?| OR ?)*$/, "");

    if (oldQ !== this.q) {
      warn(
        `\`startGroup(...)\` was called without calling \`endGroup(...)\` first. Your query was not modified.`
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
warn(
        // prettier-ignore
        `Automatically closing ${this.openGroups} group(s). You can use \`endGroup(...)\` to remove this warning.`
      );

      while (this.openGroups > 0) {
        this.q += ")";
        this.openGroups--;
      }
    }

    const oldQ = this.q;
    this.q = oldQ.replace(/( AND ?| NOT ?| OR ?)*$/, "");

    if (oldQ !== this.q) {
      warn(
        `\`startGroup(...)\` was called without calling \`endGroup(...)\` first. Your query was not modified.`
      );
    }

    // clear empty groups
    this.q = this.q.replace(/(\(\))*/, "");
  }
}
github Esri / arcgis-rest-js / packages / arcgis-rest-portal / src / util / SearchQueryBuilder.ts View on Github external
public endGroup(this: SearchQueryBuilder) {
    if (this.openGroups <= 0) {
      warn(
        `\`endGroup(...)\` was called without calling \`startGroup(...)\` first. Your query was not modified.`
      );
      return this;
    }
    this.openGroups--;
    this.q += ")";
    return this.commit();
  }
github Esri / arcgis-rest-js / packages / arcgis-rest-geocoder / src / geocoder.ts View on Github external
export function serviceInfo(
  requestOptions?: IEndpointRequestOptions
): Promise {
  warn(
    "serviceInfo() will be deprecated in the next major release. please use getGeocoderServiceInfo() instead."
  );
  return getGeocodeService(requestOptions);
}