Skip to content

Commit dc52da1

Browse files
committed
docs: add docs
1 parent c74e65e commit dc52da1

File tree

19 files changed

+1826
-0
lines changed

19 files changed

+1826
-0
lines changed

docs/.vuepress/config.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const sidebars = {
2+
guide: [
3+
{
4+
title: 'Prologue',
5+
collapsable: false,
6+
children: [
7+
['/guide/prologue/what-is-vuex-orm', 'What is Vuex ORM?'],
8+
['/guide/prologue/sponsors', 'Sponsors'],
9+
['/guide/prologue/installation', 'Installation'],
10+
['/guide/prologue/getting-started', 'Getting Started']
11+
]
12+
},
13+
{
14+
title: 'Model',
15+
collapsable: false,
16+
children: [
17+
['/guide/model/getting-started', 'Getting Started']
18+
]
19+
},
20+
{
21+
title: 'Relationships',
22+
collapsable: false,
23+
children: [
24+
['/guide/relationships/getting-started', 'Getting Started']
25+
]
26+
},
27+
{
28+
title: 'Repository',
29+
collapsable: false,
30+
children: [
31+
['/guide/repository/getting-started', 'Getting Started']
32+
]
33+
},
34+
{
35+
title: 'Query',
36+
collapsable: false,
37+
children: [
38+
['/guide/query/getting-started', 'Getting Started']
39+
]
40+
},
41+
{
42+
title: 'Degging Deeper',
43+
collapsable: false,
44+
children: [
45+
['/guide/digging-deeper/plugins', 'Plugins']
46+
]
47+
}
48+
]
49+
}
50+
51+
module.exports = {
52+
title: 'Vuex ORM Next',
53+
description: 'The Vuex plugin to enable Object-Relational Mapping (ORM) access to the Vuex Store.',
54+
55+
base: '/',
56+
57+
themeConfig: {
58+
repo: 'vuex-orm/vuex-orm-next',
59+
docsDir: 'docs',
60+
sidebarDepth: 2,
61+
62+
nav: [
63+
{
64+
text: 'Guide',
65+
link: '/guide/prologue/what-is-vuex-orm'
66+
},
67+
{
68+
text: 'Release Notes',
69+
link: 'https://github.com/vuex-orm/vuex-orm-next/releases'
70+
}
71+
],
72+
73+
sidebar: {
74+
'/guide/': sidebars.guide,
75+
'/': sidebars.guide
76+
}
77+
}
78+
}

docs/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
next.vuex-orm.org

docs/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Vuex ORM Next
2+
3+
---
4+
5+
:fire: **This is the next iteration of Vuex ORM. It's in active development state, though we are hoping this is going to be the foundation of the version 1.0.0 release. Any feedbacks are welcome!**
6+
7+
---
8+
9+
Vuex ORM is a plugin for [Vuex](https://github.com/vuejs/vuex) to enable Object-Relational Mapping access to the Vuex Store. Vuex ORM lets you create "normalized" data schema within Vuex Store with relationships such as "Has One" and "Belongs To Many" like any other usual ORM library. It also provides fluent API to get, search and update Store state.
10+
11+
Vuex ORM is heavily inspired by Redux recipe of ["Normalizing State Shape"](https://redux.js.org/recipes/structuring-reducers/normalizing-state-shape) and ["Updating Normalized Data"](https://redux.js.org/recipes/structuring-reducers/updating-normalized-data). Learn more about the concept and motivation of Vuex ORM at [What is Vuex ORM?](/guide/prologue/what-is-vuex-orm.md).
12+
13+
## Sponsors
14+
15+
Vuex ORM is sponsored by awesome folks. Big love to all of them from the whole Vuex ORM community :two_hearts:
16+
17+
#### Super Love Sponsors
18+
19+
<br>
20+
21+
<a href="https://github.com/petertoth">
22+
<img src="https://avatars2.githubusercontent.com/u/3661783?s=460&v=4" alt="Peter Tóth" width="88" style="border-radius: 8px;">
23+
</a>
24+
<a href="https://github.com/phaust">
25+
<img src="https://avatars1.githubusercontent.com/u/2367770?s=460&v=4" alt="Mario Kolli" width="88" style="border-radius: 8px;">
26+
</a>
27+
<a href="https://github.com/cannikan">
28+
<img src="https://avatars2.githubusercontent.com/u/21893904?s=460&v=4" alt="Cannikan" width="88" style="border-radius: 8px;">
29+
</a>
30+
<a href="https://github.com/somazx">
31+
<img src="https://avatars0.githubusercontent.com/u/7306?s=460&v=4" alt="Andy Koch" width="88" style="border-radius: 8px;">
32+
</a>
33+
<a href="https://github.com/dylancopeland">
34+
<img src="https://avatars1.githubusercontent.com/u/99355?s=460&v=4" alt="Dylan Copeland" width="88" style="border-radius: 8px;">
35+
</a>
36+
37+
#### Big Love Sponsors
38+
39+
<br>
40+
41+
<a href="https://github.com/geraldbiggs">
42+
<img src="https://avatars1.githubusercontent.com/u/3213608?s=460&v=4" alt="geraldbiggs" width="64" style="border-radius: 8px;">
43+
</a>
44+
<a href="https://github.com/cuebit">
45+
<img src="https://avatars0.githubusercontent.com/u/1493221?s=460&v=4" alt="Cue" width="64" style="border-radius: 8px;">
46+
</a>
47+
48+
#### A Love Sponsors
49+
50+
<br>
51+
52+
<a href="https://github.com/georgechaduneli">
53+
<img src="https://avatars1.githubusercontent.com/u/9340753?s=460&v=4" alt="George Chaduneli" width="48" style="border-radius: 8px;">
54+
</a>
55+
<a href="https://github.com/bpuig">
56+
<img src="https://avatars3.githubusercontent.com/u/22938625?s=460&v=4" alt="bpuig" width="48" style="border-radius: 8px;">
57+
</a>
58+
<a href="https://github.com/robokozo">
59+
<img src="https://avatars2.githubusercontent.com/u/1719221?s=400&u=b5739798ee9a3d713f5ca3bd3d6a086c13d229a3&v=4" alt="John" width="48" style="border-radius: 8px;">
60+
</a>
61+
62+
## Table of Contents
63+
64+
Coming soon...
65+
66+
## Questions & Discussions
67+
68+
Join us on our [Slack Channel](https://join.slack.com/t/vuex-orm/shared_invite/enQtNDQ0NjE3NTgyOTY2LTc1YTI2N2FjMGRlNGNmMzBkMGZlMmYxOTgzYzkzZDM2OTQ3OGExZDRkN2FmMGQ1MGJlOWM1NjU0MmRiN2VhYzQ) for any questions and discussions.
69+
70+
Although there is the Slack Channel, do not hesitate to open an [issue](https://github.com/vuex-orm/vuex-orm/issues) for any question you might have. We're always more than happy to hear any feedback, and we don't care what kind of form they are.
71+
72+
## Examples
73+
74+
Coming soon...
75+
76+
## Plugins
77+
78+
Coming soon...

docs/api/container/container.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
sidebarDepth: 2
3+
---
4+
5+
# Container
6+
7+
The Container holds the Vuex Store instance. The only purpose of the Container is to hold store instance so that it can be used throughout the library. It is tightly coupled with the [Database](/api/database/database) instance.
8+
9+
## Static Properties
10+
11+
### `store`
12+
13+
- **Type**: `Vuex.Store`
14+
15+
The store instance that Vuex ORM is being installed.
16+
17+
## Static Methods
18+
19+
### register
20+
21+
- **Type**: `(store: Vuex.Store) => void`
22+
23+
Register a store instance to the Container.
24+
25+
```js
26+
Container.register(new Vuex.Store())
27+
```
28+
29+
This method is called during the Vuex plugin installation.

docs/api/database/database.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
sidebarDepth: 2
3+
---
4+
5+
# Database
6+
7+
The Database holds all models and modules registered to Vuex ORM. It is also responsible for generating the database relational schema from the registered models. This schema is used to "Normalize" data before persisting to the Vuex Store.
8+
9+
In Vuex ORM, models may have relations with other models. To resolve those relations, models require some form of tracking in order to communicate with one another.
10+
11+
The Database is designed to track all registered models, build relational schema from those models, and register the database to the Vuex Store instance (contained in [Container](/api/container/container)).
12+
13+
The database instance can be accessed through the store instance, or [Container](/api/container/container).
14+
15+
```js
16+
// Through the store instance.
17+
this.$store.$db()
18+
19+
// Through the Container object.
20+
import { Container } from '@vuex-orm/core'
21+
22+
Container.store.$db()
23+
```
24+
25+
26+
## Instance Properties
27+
28+
### `store`
29+
30+
- **Type**: `Vuex.Store`
31+
32+
The Vuex Store instance.
33+
34+
### `namespace`
35+
36+
- **Type**: `string = 'entities'`
37+
38+
The namespace of the Vuex Store module where all entities are registered under.
39+
40+
The default namespace is `entities` and can be configured during setup.
41+
42+
- **See also**: [Changing the Namespace](/guide/model/database-registration.md#changing-the-namespace)
43+
44+
### `entities`
45+
46+
- **Type**: `Array<Object>`
47+
48+
The collection of entities registered to the Vuex Store. It contains references to the models and corresponding modules.
49+
50+
### `schema`
51+
52+
- **Type**: `Object`
53+
54+
The database schema definition. This schema is used when normalizing data before persisting it to the Vuex Store.
55+
56+
57+
## Instance Methods
58+
59+
### `register`
60+
61+
- **Type**: `(model: Model, module: Object) => void`
62+
63+
Register a model and a Vuex module to the Database.
64+
65+
```js
66+
const database = new Database()
67+
68+
// With a Vuex module.
69+
database.register(User, users)
70+
71+
// Without a Vuex module.
72+
database.register(User)
73+
```
74+
75+
### `start`
76+
77+
- **Type**: `(store: Vuex.Store, namespace: string) => void`
78+
79+
Generate Vuex Module and Normalizr schema tree from the registered models. This method is invoked when adding Vuex ORM to Vuex as a plugin.
80+
81+
### `model`
82+
83+
- **Type**: `(model: Model | string): Model`
84+
85+
Get the model by entity from the entities list. If a model is passed as the argument, then the model [entity](/api/model/model.md#entity) will be used.
86+
87+
Throws an error if the model is not found.
88+
89+
```js
90+
const user = database.model('users')
91+
92+
// User
93+
```
94+
95+
### `models`
96+
97+
- **Type**: `() => Object`
98+
99+
Get all models from the entities list. The result will be a plain object with key being the entity name for the model.
100+
101+
```js
102+
const models = database.model()
103+
104+
// { users: User, posts: Post }
105+
```
106+
107+
### `baseModel`
108+
109+
- **Type**: `(model: Model | string) => Model`
110+
111+
Get the base model by entity from the entities list. If a model is passed as the argument, then the model [baseEntity](/api/model/model.md#baseentity) will be used.
112+
113+
The `baseModel` is only relevant when the model is inheriting another model to achieve Single Table Inheritance.
114+
115+
Throws an error if the model is not found.
116+
117+
### `module`
118+
119+
- **Type**: `(name: string) => Vuex.Module`
120+
121+
Get the module by entity from the entities list.
122+
123+
Throws an error if the model is not found.
124+
125+
### `modules`
126+
127+
- **Type**: `() => Object`
128+
129+
Get all modules from the entities list. The result will be a plain object with key being the entity name for the module.

0 commit comments

Comments
 (0)