Skip to content

Commit 9a61f21

Browse files
committed
Renaming to Vuex-ORM-GraphQL
1 parent 91261fb commit 9a61f21

23 files changed

+102
-283
lines changed

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
# vuex-orm-apollo
1+
# vuex-orm-graphql
22

3-
[![Travis CI](https://travis-ci.org/vuex-orm/vuex-orm-apollo.svg?branch=master)](https://travis-ci.org/vuex-orm/vuex-orm-apollo)
3+
[![Travis CI](https://travis-ci.org/vuex-orm/vuex-orm-graphql.svg?branch=master)](https://travis-ci.org/vuex-orm/vuex-orm-graphql)
44
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
5-
[![License](https://img.shields.io/npm/l/@vuex-orm/vuex-orm-apollo.svg)](https://github.com/vuex-orm/vuex-orm-apollo/blob/master/LICENSE.md)
5+
[![License](https://img.shields.io/npm/l/@vuex-orm/vuex-orm-graphql.svg)](https://github.com/vuex-orm/vuex-orm-graphql/blob/master/LICENSE.md)
66

7-
This [Vuex-ORM](https://github.com/vuex-orm/vuex-orm) plugin uses the
8-
[apollo-client](https://www.apollographql.com/client/) to let you sync your Vuex state with
9-
a [GraphQL API](http://graphql.org/)
10-
11-
12-
## Documentation
13-
14-
https://vuex-orm.github.io/vuex-orm-apollo/
7+
**Documentation:** https://vuex-orm.github.io/vuex-orm-graphql/
158

169

1710
## Contribution
1811

1912
To test this plugin in your existing project, you can use `yarn link` functionality. Run `yarn link` in your local
20-
vuex-orm-apollo directory and run `yarn link @vuex-orm/plugin-apollo` in your project dir.
13+
vuex-orm-graphql directory and run `yarn link @vuex-orm/plugin-graphql` in your project dir.
2114

22-
Remember to run `yarn build` in your vuex-orm-apollo directory and then again `yarn link` in your project after you have
15+
Remember to run `yarn build` in your vuex-orm-graphql directory and then again `yarn link` in your project after you have
2316
made changes to the plugin code. You probably have also to restart your webpack server.
2417

2518

@@ -71,4 +64,4 @@ Deploys the documentation.
7164

7265
## License
7366

74-
Vuex ORM Apollo is open-sourced software licensed under the [MIT license](https://github.com/phortx/vuex-orm-apollo/blob/master/LICENSE.md).
67+
Vuex ORM GraphQL is open-sourced software licensed under the [MIT license](https://github.com/phortx/vuex-orm-graphql/blob/master/LICENSE.md).

dist/vuex-orm-apollo.esm.js

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,12 +3518,11 @@ var Logger = /** @class */ (function () {
35183518
* Fancy Vuex-ORM-Apollo prefix for all log messages.
35193519
* @type {string[]}
35203520
*/
3521-
this.PREFIX = process.env.NODE_ENV === 'test' ? ['[Vuex-ORM-Apollo]'] :
3522-
[
3523-
'%c Vuex-ORM: Apollo Plugin %c',
3524-
'background: #35495e; padding: 1px 0; border-radius: 3px; color: #eee;',
3525-
'background: transparent;'
3526-
];
3521+
this.PREFIX = [
3522+
'%c Vuex-ORM: GraphQL Plugin %c',
3523+
'background: #35495e; padding: 1px 0; border-radius: 3px; color: #eee;',
3524+
'background: transparent;'
3525+
];
35273526
this.enabled = enabled;
35283527
this.log('Logging is enabled.');
35293528
}
@@ -3538,21 +3537,11 @@ var Logger = /** @class */ (function () {
35383537
messages[_i] = arguments[_i];
35393538
}
35403539
if (this.enabled) {
3541-
if (process.env.NODE_ENV === 'test') {
3542-
if (console.group) {
3543-
console.group.apply(console, this.PREFIX.concat(messages));
3544-
}
3545-
else {
3546-
console.log.apply(console, this.PREFIX.concat(messages));
3547-
}
3540+
if (console.groupCollapsed) {
3541+
console.groupCollapsed.apply(console, this.PREFIX.concat(messages));
35483542
}
35493543
else {
3550-
if (console.groupCollapsed) {
3551-
console.groupCollapsed.apply(console, this.PREFIX.concat(messages));
3552-
}
3553-
else {
3554-
console.log.apply(console, this.PREFIX.concat(messages));
3555-
}
3544+
console.log.apply(console, this.PREFIX.concat(messages));
35563545
}
35573546
}
35583547
};
@@ -9785,7 +9774,7 @@ var Context = /** @class */ (function () {
97859774
this.debugMode = Boolean(options.debug);
97869775
this.logger = new Logger(this.debugMode);
97879776
if (!options.database) {
9788-
throw new Error('database param is required to initialize vuex-orm-apollo!');
9777+
throw new Error('database param is required to initialize vuex-orm-graphql!');
97899778
}
97909779
}
97919780
/**
@@ -10123,8 +10112,8 @@ var Store = /** @class */ (function () {
1012310112
*/
1012410113
Store.insertData = function (data, dispatch) {
1012510114
return __awaiter$1(this, void 0, void 0, function () {
10126-
var _this = this;
1012710115
var insertedData;
10116+
var _this = this;
1012810117
return __generator$1(this, function (_a) {
1012910118
switch (_a.label) {
1013010119
case 0:
@@ -11070,21 +11059,21 @@ var __generator$11 = (undefined && undefined.__generator) || function (thisArg,
1107011059
/**
1107111060
* Main class of the plugin. Setups the internal context, Vuex actions and model methods
1107211061
*/
11073-
var VuexORMApollo = /** @class */ (function () {
11062+
var VuexORMGraphQL = /** @class */ (function () {
1107411063
/**
1107511064
* @constructor
1107611065
* @param {Components} components The Vuex-ORM Components collection
1107711066
* @param {Options} options The options passed to VuexORM.install
1107811067
*/
11079-
function VuexORMApollo(components, options) {
11068+
function VuexORMGraphQL(components, options) {
1108011069
Context.setup(components, options);
11081-
VuexORMApollo.setupActions();
11082-
VuexORMApollo.setupModelMethods();
11070+
VuexORMGraphQL.setupActions();
11071+
VuexORMGraphQL.setupModelMethods();
1108311072
}
1108411073
/**
1108511074
* This method will setup following Vuex actions: fetch, persist, push, destroy, mutate
1108611075
*/
11087-
VuexORMApollo.setupActions = function () {
11076+
VuexORMGraphQL.setupActions = function () {
1108811077
var context = Context.getInstance();
1108911078
context.components.rootActions.simpleQuery = SimpleQuery.call.bind(SimpleQuery);
1109011079
context.components.rootActions.simpleMutation = SimpleMutation.call.bind(SimpleMutation);
@@ -11099,7 +11088,7 @@ var VuexORMApollo = /** @class */ (function () {
1109911088
* This method will setup following model methods: Model.fetch, Model.mutate, Model.customQuery, record.$mutate,
1110011089
* record.$persist, record.$push, record.$destroy and record.$deleteAndDestroy, record.$customQuery
1110111090
*/
11102-
VuexORMApollo.setupModelMethods = function () {
11091+
VuexORMGraphQL.setupModelMethods = function () {
1110311092
var context = Context.getInstance();
1110411093
// Register static model convenience methods
1110511094
context.components.Model.fetch = function (filter, bypassCache) {
@@ -11187,29 +11176,29 @@ var VuexORMApollo = /** @class */ (function () {
1118711176
});
1118811177
};
1118911178
};
11190-
return VuexORMApollo;
11179+
return VuexORMGraphQL;
1119111180
}());
1119211181

1119311182
/**
1119411183
* Plugin class. This just provides a static install method for Vuex-ORM and stores the instance of the model
1119511184
* within this.instance.
1119611185
*/
11197-
var VuexORMApolloPlugin = /** @class */ (function () {
11198-
function VuexORMApolloPlugin() {
11186+
var VuexORMGraphQLPlugin = /** @class */ (function () {
11187+
function VuexORMGraphQLPlugin() {
1119911188
}
1120011189
/**
11201-
* This is called, when VuexORM.install(VuexOrmApollo, options) is called.
11190+
* This is called, when VuexORM.install(VuexOrmGraphQL, options) is called.
1120211191
*
1120311192
* @param {Components} components The Vuex-ORM Components collection
1120411193
* @param {Options} options The options passed to VuexORM.install
11205-
* @returns {VuexORMApollo}
11194+
* @returns {VuexORMGraphQL}
1120611195
*/
11207-
VuexORMApolloPlugin.install = function (components, options) {
11208-
var plugin = new VuexORMApolloPlugin();
11209-
plugin.instance = new VuexORMApollo(components, options);
11196+
VuexORMGraphQLPlugin.install = function (components, options) {
11197+
var plugin = new VuexORMGraphQLPlugin();
11198+
plugin.instance = new VuexORMGraphQL(components, options);
1121011199
return plugin.instance;
1121111200
};
11212-
return VuexORMApolloPlugin;
11201+
return VuexORMGraphQLPlugin;
1121311202
}());
1121411203

11215-
export default VuexORMApolloPlugin;
11204+
export default VuexORMGraphQLPlugin;

docs/guide/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ You should have basic knowledge of [Vue](https://vuejs.org/), [Vuex](https://vue
2424

2525
## Actions
2626

27-
While using Vuex-ORM with the Apollo plugin you have to distinct between two types of Vuex actions:
27+
While using Vuex-ORM with the GraphQL plugin you have to distinct between two types of Vuex actions:
2828

2929
- Vuex-ORM actions: Retrieve data from or save data to Vuex (`Vue Component <--> Vuex Store`)
3030
- Persistence actions: Load data from or persist data to the GraphQL API (`Vuex Store <--> GraphQL Server`)
@@ -90,11 +90,11 @@ After [installing](/guide/setup) this plugin you can load data in your component
9090
```
9191

9292
::: tip
93-
Vuex-ORM-Apollo works with the [Apollo Dev Tools](https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm)!
93+
Vuex-ORM-GraphQL works with the [Apollo Dev Tools](https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm)!
9494
:::
9595

9696

9797
## License
9898

99-
Vuex ORM Apollo is open-sourced software licensed under the
100-
[MIT license](https://github.com/phortx/vuex-orm-apollo/blob/master/LICENSE.md).
99+
Vuex-ORM-GraphQL is open-sourced software licensed under the
100+
[MIT license](https://github.com/phortx/vuex-orm-graphql/blob/master/LICENSE.md).

docs/guide/custom-queries/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
[[toc]]
44

55
With custom mutations and custom queries we distinguish between model related and model unrelated (simple) custom
6-
quries/mutations. The difference is that model related queries/mutations always are tied to a model, so Vuex-ORM-Apollo
6+
quries/mutations. The difference is that model related queries/mutations always are tied to a model, so Vuex-ORM-GraphQL
77
expected that the query/mutation type is the same as the model. A model related custom mutation `upvotePost` is expected
88
to be of type `Post`. To make this even clearer, all model related queries and mutations are called on a specific Model
99
or a record of this model.
1010

11-
A simple query or simple mutation is not tied to a model. And so Vuex-ORM-Apollo doesn't expect the result to be of a
11+
A simple query or simple mutation is not tied to a model. And so Vuex-ORM-GraphQL doesn't expect the result to be of a
1212
specific type. Also the return value is not automatically inserted in the Vuex store.
1313

1414

@@ -41,7 +41,7 @@ of the record into the arguments list. The plugin automatically determines if th
4141
record is requests by looking in the arguments hash if there is a `id` field and respectively setups the query.
4242

4343
A model related custom query is always tied to the model, so the plugin expects the return value of the custom query
44-
is of the model type. In this example that means, that Vuex-ORM-Apollo expects that the `example` query is of type `Post`.
44+
is of the model type. In this example that means, that Vuex-ORM-GraphQL expects that the `example` query is of type `Post`.
4545

4646
This generates the following query:
4747

@@ -139,7 +139,7 @@ of the record into the arguments list. The plugin automatically determines if th
139139
record is requests by looking in the arguments hash if there is a `id` field and respectively setups the query.
140140

141141
A model related custom mutation is always tied to the model, so the plugin expects the return value of the custom query
142-
is of the model type. In this example that means, that Vuex-ORM-Apollo expects that the `upvotePost` mutation is of type
142+
is of the model type. In this example that means, that Vuex-ORM-GraphQL expects that the `upvotePost` mutation is of type
143143
`Post`.
144144

145145
This generates the following query:
@@ -220,7 +220,7 @@ Following fields are allowed:
220220

221221
## Multiple or single record
222222

223-
Vuex-ORM-Apollo tries to determine automatically if a single record or a connection (multiple records) is returned by
223+
Vuex-ORM-GraphQL tries to determine automatically if a single record or a connection (multiple records) is returned by
224224
a query/mutation via checking if a `id` field is set in the filter/args/variables. But sometimes you have a
225225
query/mutation without ID but it still returns a single record or vice versa. For this case you can manually set the
226226
`multiple` field to tell the plugin how the result is shaped:

docs/guide/fetch/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ recommend the usage of async/await.
187187

188188
## Caching
189189

190-
Apollo-Client caches same queries. To bypass caching set the second param of the `fetch` action to `true`
190+
The plugin caches same queries. To bypass caching set the second param of the `fetch` action to `true`
191191
when using the convenience method or add `bypassCache: true` to the arguments of the `dispatch()` call
192192

193193
```javascript

docs/guide/relationships/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[[toc]]
44

5-
This chapter describes how the Apollo-Plugin interacts with relationships. All relationships work out of the box.
5+
This chapter describes how the GraphQL-Plugin interacts with relationships. All relationships work out of the box.
66
We take the examples from the [Vuex-ORM documentation for definition relationships](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html)
77
and show what GraphQL queries will be generated.
88

docs/guide/setup/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55

66
## Installation
77

8-
Installation of the Apollo plugin is easy. First add the package to your dependencies:
8+
Installation of the GraphQL plugin is easy. First add the package to your dependencies:
99

1010
```bash
11-
$ yarn add @vuex-orm/plugin-apollo
11+
$ yarn add @vuex-orm/plugin-graphql
1212
```
1313

1414
or
1515

1616
```bash
17-
$ npm install --save @vuex-orm/plugin-apollo
17+
$ npm install --save @vuex-orm/plugin-graphql
1818
```
1919

2020

2121
After that we setup the plugin. Add this after [registering your models to the database](https://vuex-orm.github.io/vuex-orm/prologue/getting-started.html#register-models-and-modules-to-the-vuex-store):
2222

2323
```javascript
24-
import VuexORMApollo from '@vuex-orm/plugin-apollo';
25-
VuexORM.use(VuexORMApollo, { database });
24+
import VuexORMGraphQL from '@vuex-orm/plugin-graphql';
25+
VuexORM.use(VuexORMGraphQL, { database });
2626
```
2727

2828
## Possible options

docs/guide/virtual-fields/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class Product extends Model {
2626
}
2727
```
2828

29-
With this model definition, the apollo plugin will produce the following GraphQL Query when `fetch` is called:
29+
With this model definition, the GraphQL plugin will produce the following GraphQL Query when `fetch` is called:
3030

3131
```graphql
3232
query Posts() {

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "@vuex-orm/plugin-apollo",
3-
"version": "1.0.0-rc.3",
4-
"description": "Vuex-ORM Plugin to sync the data against a GraphQL API via Apollo.",
5-
"main": "dist/vuex-orm-apollo.common.js",
6-
"module": "dist/vuex-orm-apollo.esm.js",
7-
"unpkg": "dist/vuex-orm-apollo.js",
2+
"name": "@vuex-orm/plugin-graphql",
3+
"version": "1.0.0-rc.4",
4+
"description": "Vuex-ORM Plugin to sync the data against a GraphQL API.",
5+
"main": "dist/vuex-orm-graphql.common.js",
6+
"module": "dist/vuex-orm-graphql.esm.js",
7+
"unpkg": "dist/vuex-orm-graphql.js",
88
"typings": "lib/index.d.ts",
99
"files": [
1010
"dist",
@@ -17,7 +17,7 @@
1717
"build:docs": "vuepress build docs",
1818
"clean": "rm -rf dist && rm -rf lib && rm -rf dist && rm -rf coverage && rm -rf .nyc_output && rm -rf .tmp",
1919
"lint": "tslint 'src/**/*.ts' -c tslint.json -p . --fix",
20-
"test": "NODE_ENV=test mocha-webpack --webpack-config test/webpack.config.js --require test/bootstrap.js 'test/**/*.spec.js'",
20+
"test": "mocha-webpack --webpack-config test/webpack.config.js --require test/bootstrap.js 'test/**/*.spec.js'",
2121
"test:watch": "mocha-webpack --webpack-config test/webpack.config.js --watch --require test/bootstrap.js 'test/**/*.spec.js'",
2222
"test:coverage": "mocha-webpack --webpack-config test/webpack.config.js --require test/bootstrap.js 'src/**/*.js' 'test/**/*.spec.js'",
2323
"coverage": "NODE_ENV=coverage nyc --reporter=lcov --reporter=text npm run test:coverage",
@@ -27,7 +27,7 @@
2727
},
2828
"repository": {
2929
"type": "git",
30-
"url": "git+https://github.com/vuex-orm/vuex-orm-apollo.git"
30+
"url": "git+https://github.com/vuex-orm/vuex-orm-graphql.git"
3131
},
3232
"keywords": [
3333
"vue",
@@ -41,7 +41,7 @@
4141
"author": "Benjamin Klein",
4242
"license": "MIT",
4343
"bugs": {
44-
"url": "https://github.com/vuex-orm/vuex-orm-apollo/issues"
44+
"url": "https://github.com/vuex-orm/vuex-orm-graphql/issues"
4545
},
4646
"dependencies": {
4747
"@types/graphql": "^0.12.3",

src/common/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class Context {
5151
public readonly debugMode: boolean = false;
5252

5353
/**
54-
* Our nice Vuex-ORM-Apollo logger
54+
* Our nice Vuex-ORM-GraphQL logger
5555
* @type {Logger}
5656
*/
5757
public readonly logger: Logger;
@@ -77,7 +77,7 @@ export default class Context {
7777
this.logger = new Logger(this.debugMode);
7878

7979
if (!options.database) {
80-
throw new Error('database param is required to initialize vuex-orm-apollo!');
80+
throw new Error('database param is required to initialize vuex-orm-graphql!');
8181
}
8282
}
8383

0 commit comments

Comments
 (0)