Skip to content

Commit a16193c

Browse files
committed
build
1 parent a1b7de0 commit a16193c

37 files changed

+80652
-6
lines changed

dist/actions/action.d.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Arguments, Data, DispatchFunction } from "../support/interfaces";
2+
import Model from "../orm/model";
3+
import RootState from "@vuex-orm/core/lib/modules/contracts/RootState";
4+
/**
5+
* Base class for all Vuex actions. Contains some utility and convenience methods.
6+
*/
7+
export default class Action {
8+
/**
9+
* Sends a mutation.
10+
*
11+
* @param {string} name Name of the mutation like 'createUser'
12+
* @param {Data | undefined} variables Variables to send with the mutation
13+
* @param {Function} dispatch Vuex Dispatch method for the model
14+
* @param {Model} model The model this mutation affects.
15+
* @param {boolean} multiple Tells if we're requesting a single record or multiple.
16+
* @returns {Promise<any>}
17+
*/
18+
protected static mutation(name: string, variables: Data | undefined, dispatch: DispatchFunction, model: Model): Promise<any>;
19+
/**
20+
* Convenience method to get the model from the state.
21+
* @param {RootState} state Vuex state
22+
* @returns {Model}
23+
*/
24+
static getModelFromState(state: RootState): Model;
25+
/**
26+
* Makes sure args is a hash.
27+
*
28+
* @param {Arguments|undefined} args
29+
* @param {any} id When not undefined, it's added to the args
30+
* @returns {Arguments}
31+
*/
32+
static prepareArgs(args?: Arguments, id?: any): Arguments;
33+
/**
34+
* Adds the record itself to the args and sends it through transformOutgoingData. Key is named by the singular name
35+
* of the model.
36+
*
37+
* @param {Arguments} args
38+
* @param {Model} model
39+
* @param {Data} data
40+
* @returns {Arguments}
41+
*/
42+
static addRecordToArgs(args: Arguments, model: Model, data: Data): Arguments;
43+
/**
44+
* Transforms each field of the args which contains a model.
45+
* @param {Arguments} args
46+
* @returns {Arguments}
47+
*/
48+
protected static transformArgs(args: Arguments): Arguments;
49+
}

dist/actions/destroy.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { ActionParams } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* Destroy action for sending a delete mutation. Will be used for record.$destroy().
5+
*/
6+
export default class Destroy extends Action {
7+
/**
8+
* @param {State} state The Vuex state
9+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
10+
* @param {string} id ID of the record to delete
11+
* @returns {Promise<any>} true
12+
*/
13+
static call({ state, dispatch }: ActionParams, { id, args }: ActionParams): Promise<boolean>;
14+
}

dist/actions/fetch.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { ActionParams, Data } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* Fetch action for sending a query. Will be used for Model.fetch().
5+
*/
6+
export default class Fetch extends Action {
7+
/**
8+
* @param {any} state The Vuex state
9+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
10+
* @param {ActionParams} params Optional params to send with the query
11+
* @returns {Promise<Data>} The fetched records as hash
12+
*/
13+
static call({ state, dispatch }: ActionParams, params?: ActionParams): Promise<Data>;
14+
}

dist/actions/index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Action from './action';
2+
import Destroy from './destroy';
3+
import Fetch from './fetch';
4+
import Mutate from './mutate';
5+
import Persist from './persist';
6+
import Push from './push';
7+
export { Action, Destroy, Fetch, Mutate, Persist, Push };

dist/actions/mutate.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { ActionParams, Data } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* Mutate action for sending a custom mutation. Will be used for Model.mutate() and record.$mutate().
5+
*/
6+
export default class Mutate extends Action {
7+
/**
8+
* @param {any} state The Vuex state
9+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
10+
* @param {string} name Name of the query
11+
* @param {boolean} multiple Fetch one or multiple?
12+
* @param {Arguments} args Arguments for the mutation. Must contain a 'mutation' field.
13+
* @returns {Promise<Data>} The new record if any
14+
*/
15+
static call({ state, dispatch }: ActionParams, { args, name }: ActionParams): Promise<Data>;
16+
}

dist/actions/persist.d.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ActionParams, Data } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* Persist action for sending a create mutation. Will be used for record.$persist().
5+
*/
6+
export default class Persist extends Action {
7+
/**
8+
* @param {any} state The Vuex state
9+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
10+
* @param {string} id ID of the record to persist
11+
* @returns {Promise<Data>} The saved record
12+
*/
13+
static call({ state, dispatch }: ActionParams, { id, args }: ActionParams): Promise<Data>;
14+
/**
15+
* It's very likely that the server generated different ID for this record.
16+
* In this case Action.mutation has inserted a new record instead of updating the existing one.
17+
*
18+
* @param {Model} model
19+
* @param {Data} record
20+
* @returns {Promise<void>}
21+
*/
22+
private static deleteObsoleteRecord;
23+
}

dist/actions/push.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { ActionParams, Data } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* Push action for sending a update mutation. Will be used for record.$push().
5+
*/
6+
export default class Push extends Action {
7+
/**
8+
* @param {any} state The Vuex state
9+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
10+
* @param {Arguments} data New data to save
11+
* @param {Arguments} args Additional arguments
12+
* @returns {Promise<Data>} The updated record
13+
*/
14+
static call({ state, dispatch }: ActionParams, { data, args }: ActionParams): Promise<Data>;
15+
}

dist/actions/query.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { ActionParams, Data } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* Query action for sending a custom query. Will be used for Model.customQuery() and record.$customQuery.
5+
*/
6+
export default class Query extends Action {
7+
/**
8+
* @param {any} state The Vuex state
9+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
10+
* @param {string} name Name of the query
11+
* @param {boolean} multiple Fetch one or multiple?
12+
* @param {object} filter Filter object (arguments)
13+
* @param {boolean} bypassCache Whether to bypass the cache
14+
* @returns {Promise<Data>} The fetched records as hash
15+
*/
16+
static call({ state, dispatch }: ActionParams, { name, filter, bypassCache }: ActionParams): Promise<Data>;
17+
}

dist/actions/simple-mutation.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { ActionParams } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* SimpleMutation action for sending a model unrelated simple mutation.
5+
*/
6+
export default class SimpleMutation extends Action {
7+
/**
8+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
9+
* @param {string} query The query to send
10+
* @param {Arguments} variables
11+
* @returns {Promise<any>} The result
12+
*/
13+
static call({ dispatch }: ActionParams, { query, variables }: ActionParams): Promise<any>;
14+
}

dist/actions/simple-query.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { ActionParams } from "../support/interfaces";
2+
import Action from "./action";
3+
/**
4+
* SimpleQuery action for sending a model unrelated simple query.
5+
*/
6+
export default class SimpleQuery extends Action {
7+
/**
8+
* @param {DispatchFunction} dispatch Vuex Dispatch method for the model
9+
* @param {string} query The query to send
10+
* @param {Arguments} variables
11+
* @param {boolean} bypassCache Whether to bypass the cache
12+
* @returns {Promise<any>} The result
13+
*/
14+
static call({ dispatch }: ActionParams, { query, bypassCache, variables }: ActionParams): Promise<any>;
15+
}

0 commit comments

Comments
 (0)