Skip to content

Commit be25c30

Browse files
committed
Formatting
1 parent e5e8a2b commit be25c30

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

src/queryBuilder.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {parse} from "graphql/language/parser";
2-
import Logger from "./logger";
3-
import Model from "./model";
4-
import {print} from "graphql/language/printer";
5-
import {Arguments, Data, Field} from "./interfaces";
6-
import {downcaseFirstLetter, upcaseFirstLetter} from "./utils";
7-
import gql from "graphql-tag";
1+
import { parse } from 'graphql/language/parser';
2+
import Logger from './logger';
3+
import Model from './model';
4+
import { print } from 'graphql/language/printer';
5+
import { Arguments, Data, Field } from './interfaces';
6+
import { downcaseFirstLetter, upcaseFirstLetter } from './utils';
7+
import gql from 'graphql-tag';
88

99
const inflection = require('inflection');
1010

@@ -31,7 +31,6 @@ export default class QueryBuilder {
3131
return print(parse(query));
3232
}
3333

34-
3534
/**
3635
* Generates the arguments string for a graphql query based on a given map.
3736
*
@@ -51,7 +50,7 @@ export default class QueryBuilder {
5150
* @param {boolean} allowIdFields If true, ID fields will be included in the arguments list
5251
* @returns {String}
5352
*/
54-
private buildArguments(args?: Arguments, signature: boolean = false, allowIdFields: boolean = true): string {
53+
private buildArguments (args?: Arguments, signature: boolean = false, allowIdFields: boolean = true): string {
5554
if (args === null) return '';
5655

5756
let returnValue: string = '';
@@ -92,8 +91,6 @@ export default class QueryBuilder {
9291
return returnValue;
9392
}
9493

95-
96-
9794
/**
9895
* Builds a field for the GraphQL query and a specific model
9996
*
@@ -137,14 +134,13 @@ export default class QueryBuilder {
137134
}
138135
}
139136

140-
141137
/**
142138
*
143139
* @param {Model} model
144140
* @param {Model} rootModel
145141
* @returns {Array<String>}
146142
*/
147-
private buildRelationsQuery (model: (null|Model), rootModel?: Model) {
143+
private buildRelationsQuery (model: (null | Model), rootModel?: Model) {
148144
if (model === null) return '';
149145

150146
const relationQueries: Array<string> = [];
@@ -159,9 +155,7 @@ export default class QueryBuilder {
159155
return relationQueries;
160156
}
161157

162-
163-
164-
public buildQuery(type: string, name?: string, args?: Arguments, model?: (Model|null|string), fields?: string, addModelToArgs:boolean = false, multiple?: boolean) {
158+
public buildQuery (type: string, name?: string, args?: Arguments, model?: (Model | null | string), fields?: string, addModelToArgs: boolean = false, multiple?: boolean) {
165159
model = model ? this.getModel(model) : null;
166160

167161
if (!args) args = {};
@@ -172,16 +166,14 @@ export default class QueryBuilder {
172166
if (!name && model) name = (multiple ? model.pluralName : model.singularName);
173167
if (!name) throw new Error("Can't determine name for the query! Please provide either name or model");
174168

175-
176-
const query:string =
169+
const query: string =
177170
`${type} ${upcaseFirstLetter(name)}${this.buildArguments(args, true)} {\n` +
178171
` ${model ? this.buildField(model, multiple, args, model, name, true) : fields}\n` +
179172
`}`;
180173

181174
return gql(query);
182175
}
183176

184-
185177
/**
186178
* Transforms outgoing data. Use for variables param.
187179
*

src/vuex-orm-apollo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { InMemoryCache } from 'apollo-cache-inmemory';
55
import { Data, ActionParams, Arguments, ORMModel, DispatchFunction } from './interfaces';
66
import Logger from './logger';
77
import QueryBuilder from './queryBuilder';
8-
import {upcaseFirstLetter} from "./utils";
8+
import { upcaseFirstLetter } from './utils';
99

1010
const inflection = require('inflection');
1111

@@ -148,7 +148,7 @@ export default class VuexORMApollo {
148148
* @returns {Promise<Data | {}>}
149149
*/
150150
private async customMutation ({ state, dispatch }: ActionParams, args: Arguments) {
151-
const name:string = args['mutation'];
151+
const name: string = args['mutation'];
152152
delete args['mutation'];
153153

154154
const model = this.getModel(state.$name);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
describe('VuexORMApollo', () => {
2+
3+
});

0 commit comments

Comments
 (0)