How to use the @nestjsx/util.isStringFull function in @nestjsx/util

To help you get started, we’ve selected a few @nestjsx/util 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 nestjsx / crud / packages / crud-request / src / request-query.parser.ts View on Github external
private joinParser(data: string): QueryJoin {
    const param = data.split(this._options.delim);
    const join: QueryJoin = {
      field: param[0],
      select: isStringFull(param[1]) ? param[1].split(this._options.delimStr) : undefined,
    };
    validateJoin(join);

    return join;
  }
github nestjsx / crud / packages / crud-request / lib / request-query.parser.js View on Github external
joinParser(data) {
        const param = data.split(this._options.delim);
        const join = {
            field: param[0],
            select: util_1.isStringFull(param[1]) ? param[1].split(this._options.delimStr) : undefined,
        };
        request_query_validator_1.validateJoin(join);
        return join;
    }
    sortParser(data) {
github nestjsx / crud / packages / crud-request / src / request-query.validator.ts View on Github external
export function validateSort(sort: QuerySort): void {
  if (!isObject(sort) || !isStringFull(sort.field)) {
    throw new RequestQueryException('Invalid sort field. String expected');
  }
  if (
    !isEqual(sort.order, sortOrdersList[0]) &&
    !isEqual(sort.order, sortOrdersList[1])
  ) {
    throw new RequestQueryException(`Invalid sort order. ${sortOrdersListStr} expected`);
  }
}
github nestjsx / crud / packages / crud-request / lib / request-query.validator.js View on Github external
function validateSort(sort) {
    if (!util_1.isObject(sort) || !util_1.isStringFull(sort.field)) {
        throw new exceptions_1.RequestQueryException('Invalid sort field. String expected');
    }
    if (!util_1.isEqual(sort.order, exports.sortOrdersList[0]) &&
        !util_1.isEqual(sort.order, exports.sortOrdersList[1])) {
        throw new exceptions_1.RequestQueryException(`Invalid sort order. ${sortOrdersListStr} expected`);
    }
}
exports.validateSort = validateSort;
github nestjsx / crud / packages / crud-request / lib / request-query.parser.js View on Github external
getParamValues(value, parser) {
        if (util_1.isStringFull(value)) {
            return [parser.call(this, value)];
        }
        if (util_1.isArrayFull(value)) {
            return value.map((val) => parser(val));
        }
        return [];
    }
    parseQueryParam(type, parser) {
github nestjsx / crud / packages / crud-request / src / request-query.parser.ts View on Github external
private getParamValues(value: string | string[], parser: Function): string[] {
    if (isStringFull(value)) {
      return [parser.call(this, value)];
    }

    if (isArrayFull(value)) {
      return (value as string[]).map((val) => parser(val));
    }

    return [];
  }
github nestjsx / crud / packages / crud-request / src / request-query.validator.ts View on Github external
export function validateCondition(
  val: QueryFilter,
  cond: 'filter' | 'or' | 'search',
): void {
  if (!isObject(val) || !isStringFull(val.field)) {
    throw new RequestQueryException(
      `Invalid field type in ${cond} condition. String expected`,
    );
  }
  validateComparisonOperator(val.operator);
}
github nestjsx / crud / packages / crud-request / src / request-query.validator.ts View on Github external
export function validateJoin(join: QueryJoin): void {
  if (!isObject(join) || !isStringFull(join.field)) {
    throw new RequestQueryException('Invalid join field. String expected');
  }
  if (!isUndefined(join.select) && !isArrayStrings(join.select)) {
    throw new RequestQueryException('Invalid join select. Array of strings expected');
  }
}
github nestjsx / crud / packages / crud-request / lib / request-query.validator.js View on Github external
function validateJoin(join) {
    if (!util_1.isObject(join) || !util_1.isStringFull(join.field)) {
        throw new exceptions_1.RequestQueryException('Invalid join field. String expected');
    }
    if (!util_1.isUndefined(join.select) && !util_1.isArrayStrings(join.select)) {
        throw new exceptions_1.RequestQueryException('Invalid join select. Array of strings expected');
    }
}
exports.validateJoin = validateJoin;