Skip to content

Commit

Permalink
build(dependencies): fix uuid package
Browse files Browse the repository at this point in the history
  • Loading branch information
matrunchyk committed May 21, 2020
1 parent d460c4f commit 10ed2b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-oop",
"version": "0.6.6",
"version": "0.6.7",
"description": "A library based on Model-Repository patterns for Vue components. Usable for GraphQL and REST APIs.",
"keywords": [
"collections",
Expand Down
23 changes: 15 additions & 8 deletions src/models/Model.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import camelCase from 'lodash.camelcase';
import clone from 'lodash.clonedeep';
import uuid from 'uuid';
import {getUrl, performSafeRequestREST, performSafeRequestGraphql, config, getSchemaTypeFields, stripObject} from '../utils';
import { v4 } from 'uuid';
import {
getUrl,
performSafeRequestREST,
performSafeRequestGraphql,
config,
getSchemaTypeFields,
stripObject
} from '../utils';
import Collection from './Collection';
import {KeyValueUnknown, ResolvingRESTOptions} from '../typings';
import { KeyValueUnknown, ResolvingRESTOptions } from '../typings';
import EventEmitter from '../EventEmitter';

export default abstract class Model extends EventEmitter {
public id: string;

public uuid: string = uuid.v4();
public uuid: string = v4();

public loading = false;

Expand Down Expand Up @@ -40,7 +47,7 @@ export default abstract class Model extends EventEmitter {

generateUuid() {
console.warn('Deprecated: UUID is generated automatically. `generateUuid` will be removed in the next versions.');
this.uuid = uuid.v4();
this.uuid = v4();
}

/**
Expand Down Expand Up @@ -141,7 +148,7 @@ export default abstract class Model extends EventEmitter {
// istanbul ignore else
if (config().graphql) {
return this.hydrate(
await this.mutate(mutation, {[camelCase(this.getClassName())]: params}),
await this.mutate(mutation, { [camelCase(this.getClassName())]: params }),
);
}

Expand Down Expand Up @@ -180,8 +187,8 @@ export default abstract class Model extends EventEmitter {
.finally(this.afterMutate.bind(this));
}

const resolvedUrl = await getUrl({method, url: mutationOrUrl, params});
const resolvedMethod = await this.getMethod({method, url: resolvedUrl, params});
const resolvedUrl = await getUrl({ method, url: mutationOrUrl, params });
const resolvedMethod = await this.getMethod({ method, url: resolvedUrl, params });

return this.beforeMutate()
.then(this.performSafeRequestREST.bind(this, resolvedUrl, params, resolvedMethod || method, null))
Expand Down

0 comments on commit 10ed2b5

Please sign in to comment.