How to use the @nestjsx/util.isObjectFull 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 / src / crud / crud-routes.factory.ts View on Github external
private mergeOptions() {
    // merge auth config
    const authOptions = R.getCrudAuthOptions(this.target);
    this.options.auth = isObjectFull(authOptions) ? authOptions : {};
    this.options.auth.property =
      this.options.auth.property || CrudConfigService.config.auth.property;

    // merge query config
    const query = isObjectFull(this.options.query) ? this.options.query : {};
    this.options.query = { ...CrudConfigService.config.query, ...query };

    // merge routes config
    const routes = isObjectFull(this.options.routes) ? this.options.routes : {};
    this.options.routes = deepmerge(CrudConfigService.config.routes, routes, {
      arrayMerge: (a, b, c) => b,
    });

    // set params
    this.options.params = isObjectFull(this.options.params)
      ? this.options.params
      : isObjectFull(CrudConfigService.config.params)
      ? CrudConfigService.config.params
      : {};
    const hasPrimary = this.getPrimaryParam();
    if (!hasPrimary) {
      this.options.params['id'] = {
        field: 'id',
        type: 'number',
        primary: true,
github nestjsx / crud / packages / crud / src / crud / crud-routes.factory.ts View on Github external
this.options.auth = isObjectFull(authOptions) ? authOptions : {};
    this.options.auth.property =
      this.options.auth.property || CrudConfigService.config.auth.property;

    // merge query config
    const query = isObjectFull(this.options.query) ? this.options.query : {};
    this.options.query = { ...CrudConfigService.config.query, ...query };

    // merge routes config
    const routes = isObjectFull(this.options.routes) ? this.options.routes : {};
    this.options.routes = deepmerge(CrudConfigService.config.routes, routes, {
      arrayMerge: (a, b, c) => b,
    });

    // set params
    this.options.params = isObjectFull(this.options.params)
      ? this.options.params
      : isObjectFull(CrudConfigService.config.params)
      ? CrudConfigService.config.params
      : {};
    const hasPrimary = this.getPrimaryParam();
    if (!hasPrimary) {
      this.options.params['id'] = {
        field: 'id',
        type: 'number',
        primary: true,
      };
    }

    // set dto
    if (!isObjectFull(this.options.dto)) {
      this.options.dto = {};
github nestjsx / crud / packages / crud / src / crud / crud-routes.factory.ts View on Github external
const hasPrimary = this.getPrimaryParam();
    if (!hasPrimary) {
      this.options.params['id'] = {
        field: 'id',
        type: 'number',
        primary: true,
      };
    }

    // set dto
    if (!isObjectFull(this.options.dto)) {
      this.options.dto = {};
    }

    // set serialize
    const serialize = isObjectFull(this.options.serialize) ? this.options.serialize : {};
    this.options.serialize = { ...CrudConfigService.config.serialize, ...serialize };
    this.options.serialize.get = isFalse(this.options.serialize.get)
      ? false
      : this.options.serialize.get || this.modelType;
    this.options.serialize.getMany = isFalse(this.options.serialize.getMany)
      ? false
      : this.options.serialize.getMany
      ? this.options.serialize.getMany
      : isFalse(this.options.serialize.get)
      ? /* istanbul ignore next */ false
      : SerializeHelper.createGetManyDto(this.options.serialize.get, this.modelName);
    this.options.serialize.create = isFalse(this.options.serialize.create)
      ? false
      : this.options.serialize.create || this.modelType;
    this.options.serialize.update = isFalse(this.options.serialize.update)
      ? false
github nestjsx / crud / packages / crud / src / crud / crud-routes.factory.ts View on Github external
this.options.params = isObjectFull(this.options.params)
      ? this.options.params
      : isObjectFull(CrudConfigService.config.params)
      ? CrudConfigService.config.params
      : {};
    const hasPrimary = this.getPrimaryParam();
    if (!hasPrimary) {
      this.options.params['id'] = {
        field: 'id',
        type: 'number',
        primary: true,
      };
    }

    // set dto
    if (!isObjectFull(this.options.dto)) {
      this.options.dto = {};
    }

    // set serialize
    const serialize = isObjectFull(this.options.serialize) ? this.options.serialize : {};
    this.options.serialize = { ...CrudConfigService.config.serialize, ...serialize };
    this.options.serialize.get = isFalse(this.options.serialize.get)
      ? false
      : this.options.serialize.get || this.modelType;
    this.options.serialize.getMany = isFalse(this.options.serialize.getMany)
      ? false
      : this.options.serialize.getMany
      ? this.options.serialize.getMany
      : isFalse(this.options.serialize.get)
      ? /* istanbul ignore next */ false
      : SerializeHelper.createGetManyDto(this.options.serialize.get, this.modelName);
github nestjsx / crud / packages / crud / src / crud / crud-routes.factory.ts View on Github external
private mergeOptions() {
    // merge auth config
    const authOptions = R.getCrudAuthOptions(this.target);
    this.options.auth = isObjectFull(authOptions) ? authOptions : {};
    this.options.auth.property =
      this.options.auth.property || CrudConfigService.config.auth.property;

    // merge query config
    const query = isObjectFull(this.options.query) ? this.options.query : {};
    this.options.query = { ...CrudConfigService.config.query, ...query };

    // merge routes config
    const routes = isObjectFull(this.options.routes) ? this.options.routes : {};
    this.options.routes = deepmerge(CrudConfigService.config.routes, routes, {
      arrayMerge: (a, b, c) => b,
    });

    // set params
    this.options.params = isObjectFull(this.options.params)
      ? this.options.params
github nestjsx / crud / packages / crud / lib / module / crud-config.service.js View on Github external
static load(config = {}) {
        if (util_1.isObjectFull(config.queryParser)) {
            crud_request_1.RequestQueryBuilder.setOptions(config.queryParser);
        }
        const query = util_1.isObjectFull(config.query) ? config.query : {};
        const routes = util_1.isObjectFull(config.routes) ? config.routes : {};
        const params = util_1.isObjectFull(config.params) ? config.params : {};
        CrudConfigService.config = deepmerge(CrudConfigService.config, { query, routes, params }, { arrayMerge: (a, b, c) => b });
    }
}
github nestjsx / crud / packages / crud / src / module / crud-config.service.ts View on Github external
static load(config: CrudGlobalConfig = {}) {
    if (isObjectFull(config.queryParser)) {
      RequestQueryBuilder.setOptions(config.queryParser);
    }

    const auth = isObjectFull(config.auth) ? config.auth : {};
    const query = isObjectFull(config.query) ? config.query : {};
    const routes = isObjectFull(config.routes) ? config.routes : {};
    const params = isObjectFull(config.params) ? config.params : {};
    const serialize = isObjectFull(config.serialize) ? config.serialize : {};

    CrudConfigService.config = deepmerge(
      CrudConfigService.config,
      { auth, query, routes, params, serialize },
      { arrayMerge: (a, b, c) => b },
    );
  }
}
github nestjsx / crud / packages / crud / lib / crud / crud-routes.factory.js View on Github external
mergeOptions() {
        const query = util_1.isObjectFull(this.options.query) ? this.options.query : {};
        this.options.query = Object.assign({}, module_1.CrudConfigService.config.query, query);
        const routes = util_1.isObjectFull(this.options.routes) ? this.options.routes : {};
        this.options.routes = deepmerge(module_1.CrudConfigService.config.routes, routes, {
            arrayMerge: (a, b, c) => b,
        });
        const params = util_1.isObjectFull(this.options.params) ? this.options.params : {};
        this.options.params = Object.assign({}, module_1.CrudConfigService.config.params, params);
        reflection_helper_1.R.setCrudOptions(this.options, this.target);
    }
    getRoutesSchema() {
github nestjsx / crud / packages / crud / src / module / crud-config.service.ts View on Github external
static load(config: CrudGlobalConfig = {}) {
    if (isObjectFull(config.queryParser)) {
      RequestQueryBuilder.setOptions(config.queryParser);
    }

    const auth = isObjectFull(config.auth) ? config.auth : {};
    const query = isObjectFull(config.query) ? config.query : {};
    const routes = isObjectFull(config.routes) ? config.routes : {};
    const params = isObjectFull(config.params) ? config.params : {};
    const serialize = isObjectFull(config.serialize) ? config.serialize : {};

    CrudConfigService.config = deepmerge(
      CrudConfigService.config,
      { auth, query, routes, params, serialize },
      { arrayMerge: (a, b, c) => b },
    );
  }
}