@forestadmin/agent 1.0.0-beta.3 → 1.0.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +688 -0
- package/dist/agent/forestadmin-http-driver.d.ts +5 -27
- package/dist/agent/forestadmin-http-driver.js +17 -47
- package/dist/agent/routes/access/api-chart.d.ts +16 -0
- package/dist/agent/routes/access/api-chart.js +45 -0
- package/dist/agent/routes/access/chart.js +47 -23
- package/dist/agent/routes/access/count-related.js +4 -2
- package/dist/agent/routes/access/count.js +4 -2
- package/dist/agent/routes/access/csv-related.js +3 -3
- package/dist/agent/routes/access/csv.js +4 -3
- package/dist/agent/routes/access/get.js +3 -2
- package/dist/agent/routes/access/list-related.js +2 -3
- package/dist/agent/routes/access/list.js +2 -3
- package/dist/agent/routes/base-route.d.ts +0 -1
- package/dist/agent/routes/base-route.js +1 -4
- package/dist/agent/routes/index.js +8 -1
- package/dist/agent/routes/modification/action.d.ts +0 -1
- package/dist/agent/routes/modification/action.js +11 -11
- package/dist/agent/routes/modification/associate-related.d.ts +3 -3
- package/dist/agent/routes/modification/associate-related.js +13 -11
- package/dist/agent/routes/modification/create.js +14 -12
- package/dist/agent/routes/modification/delete.js +3 -2
- package/dist/agent/routes/modification/dissociate-delete-related.js +19 -18
- package/dist/agent/routes/modification/update-relation.js +19 -13
- package/dist/agent/routes/modification/update.js +5 -3
- package/dist/agent/routes/system/logger.js +4 -5
- package/dist/agent/utils/condition-tree-parser.d.ts +11 -0
- package/dist/agent/utils/condition-tree-parser.js +53 -0
- package/dist/agent/utils/context-filter-factory.js +1 -2
- package/dist/agent/utils/csv-generator.d.ts +2 -2
- package/dist/agent/utils/csv-generator.js +3 -3
- package/dist/agent/utils/forest-http-api.d.ts +1 -0
- package/dist/agent/utils/forest-http-api.js +58 -50
- package/dist/agent/utils/forest-schema/generator-actions.js +2 -2
- package/dist/agent/utils/forest-schema/generator-collection.js +8 -3
- package/dist/agent/utils/forest-schema/generator-fields.d.ts +1 -0
- package/dist/agent/utils/forest-schema/generator-fields.js +30 -9
- package/dist/agent/utils/forest-schema/types.d.ts +9 -3
- package/dist/agent/utils/forest-schema/types.js +1 -1
- package/dist/agent/utils/query-string.d.ts +2 -2
- package/dist/agent/utils/query-string.js +8 -4
- package/dist/builder/agent.d.ts +58 -39
- package/dist/builder/agent.js +195 -52
- package/dist/builder/collection.d.ts +102 -48
- package/dist/builder/collection.js +135 -55
- package/dist/builder/decorators-stack.d.ts +22 -0
- package/dist/builder/decorators-stack.js +37 -0
- package/dist/builder/types.d.ts +5 -2
- package/dist/builder/utils/options-validator.d.ts +13 -0
- package/dist/builder/utils/options-validator.js +103 -0
- package/dist/builder/utils/typing-generator.d.ts +10 -0
- package/dist/builder/utils/typing-generator.js +98 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +13 -5
- package/dist/types.d.ts +4 -8
- package/dist/types.js +1 -9
- package/package.json +15 -5
- package/dist/agent/utils/http-driver-options.d.ts +0 -13
- package/dist/agent/utils/http-driver-options.js +0 -86
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ActionDefinition, Operator,
|
|
1
|
+
import { ActionDefinition, Operator, OperatorDefinition, PlainSortClause, SegmentDefinition, TCollectionName, TColumnName, TFieldName, TSchema, WriteDefinition } from '@forestadmin/datasource-toolkit';
|
|
2
2
|
import { FieldDefinition } from './types';
|
|
3
|
-
import
|
|
4
|
-
export default class CollectionBuilder {
|
|
5
|
-
private agentBuilder;
|
|
3
|
+
import DecoratorsStack from './decorators-stack';
|
|
4
|
+
export default class CollectionBuilder<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> {
|
|
6
5
|
private readonly name;
|
|
7
|
-
|
|
6
|
+
private readonly stack;
|
|
7
|
+
constructor(stack: DecoratorsStack, name: string);
|
|
8
8
|
/**
|
|
9
9
|
* Import a field from a many to one or one to one relation.
|
|
10
10
|
*
|
|
@@ -14,41 +14,41 @@ export default class CollectionBuilder {
|
|
|
14
14
|
* .importField('authorName', { path: 'author:fullName' })
|
|
15
15
|
*/
|
|
16
16
|
importField(name: string, options: {
|
|
17
|
-
path:
|
|
17
|
+
path: TFieldName<S, N>;
|
|
18
18
|
beforeRelations?: boolean;
|
|
19
19
|
}): this;
|
|
20
20
|
/**
|
|
21
21
|
* Allow to rename a field of a given collection.
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
22
|
+
* @param oldName the current name of the field in a given collection
|
|
23
|
+
* @param newName the new name of the field
|
|
24
24
|
* @example
|
|
25
25
|
* .renameField('theCurrentNameOfTheField', 'theNewNameOfTheField');
|
|
26
26
|
*/
|
|
27
|
-
renameField(oldName:
|
|
27
|
+
renameField(oldName: TColumnName<S, N>, newName: string): this;
|
|
28
28
|
/**
|
|
29
29
|
* Remove field by setting its visibility to false.
|
|
30
|
-
* @param
|
|
30
|
+
* @param names the fields to remove
|
|
31
31
|
* @example
|
|
32
32
|
* .removeField('aFieldToRemove', 'anOtherFieldToRemove');
|
|
33
33
|
*/
|
|
34
|
-
removeField(...names:
|
|
34
|
+
removeField(...names: TColumnName<S, N>[]): this;
|
|
35
35
|
/**
|
|
36
36
|
* Add a new action on the collection.
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
37
|
+
* @param name the name of the action
|
|
38
|
+
* @param definition the definition of the action
|
|
39
39
|
* @example
|
|
40
40
|
* .addAction('is live', {
|
|
41
41
|
* scope: 'Single',
|
|
42
|
-
* execute: async (context,
|
|
43
|
-
* return
|
|
42
|
+
* execute: async (context, resultBuilder) => {
|
|
43
|
+
* return resultBuilder.success(`Is live!`);
|
|
44
44
|
* },
|
|
45
45
|
* })
|
|
46
46
|
*/
|
|
47
|
-
addAction(name: string, definition: ActionDefinition): this;
|
|
47
|
+
addAction(name: string, definition: ActionDefinition<S, N>): this;
|
|
48
48
|
/**
|
|
49
49
|
* Add a new field on the collection.
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
50
|
+
* @param name the name of the field
|
|
51
|
+
* @param definition The definition of the field
|
|
52
52
|
* @example
|
|
53
53
|
* .addField('fullName', {
|
|
54
54
|
* columnType: 'String',
|
|
@@ -56,44 +56,86 @@ export default class CollectionBuilder {
|
|
|
56
56
|
* getValues: (records) => records.map(record => `${record.lastName} ${record.firstName}`),
|
|
57
57
|
* });
|
|
58
58
|
*/
|
|
59
|
-
addField(name: string, definition: FieldDefinition): this;
|
|
59
|
+
addField(name: string, definition: FieldDefinition<S, N>): this;
|
|
60
60
|
/**
|
|
61
|
-
* Add a relation
|
|
61
|
+
* Add a many to one relation to the collection
|
|
62
62
|
* @param name name of the new relation
|
|
63
|
-
* @param
|
|
63
|
+
* @param foreignCollection name of the targeted collection
|
|
64
|
+
* @param options extra information about the relation
|
|
64
65
|
* @example
|
|
65
|
-
* .
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
* books.addManyToOne('myAuthor', 'persons', { foreignKey: 'author_id' })
|
|
67
|
+
*/
|
|
68
|
+
addManyToOne<T extends TCollectionName<S>>(name: string, foreignCollection: T, options: {
|
|
69
|
+
foreignKey: TColumnName<S, N>;
|
|
70
|
+
foreignKeyTarget?: TColumnName<S, T>;
|
|
71
|
+
}): this;
|
|
72
|
+
/**
|
|
73
|
+
* Add a one to many relation to the collection
|
|
74
|
+
* @param name name of the new relation
|
|
75
|
+
* @param foreignCollection name of the targeted collection
|
|
76
|
+
* @param options extra information about the relation
|
|
77
|
+
* @example
|
|
78
|
+
* persons.addOneToMany('writtenBooks', 'books', { originKey: 'author_id' })
|
|
79
|
+
*/
|
|
80
|
+
addOneToMany<T extends TCollectionName<S>>(name: string, foreignCollection: T, options: {
|
|
81
|
+
originKey: TColumnName<S, T>;
|
|
82
|
+
originKeyTarget?: TColumnName<S, N>;
|
|
83
|
+
}): this;
|
|
84
|
+
/**
|
|
85
|
+
* Add a one to one relation to the collection
|
|
86
|
+
* @param name name of the new relation
|
|
87
|
+
* @param foreignCollection name of the targeted collection
|
|
88
|
+
* @param options extra information about the relation
|
|
89
|
+
* @example
|
|
90
|
+
* persons.addOneToOne('bestFriend', 'persons', { originKey: 'best_friend_id' })
|
|
91
|
+
*/
|
|
92
|
+
addOneToOne<T extends TCollectionName<S>>(name: string, foreignCollection: T, options: {
|
|
93
|
+
originKey: TColumnName<S, T>;
|
|
94
|
+
originKeyTarget?: TColumnName<S, N>;
|
|
95
|
+
}): this;
|
|
96
|
+
/**
|
|
97
|
+
* Add a many to many relation to the collection
|
|
98
|
+
* @param name name of the new relation
|
|
99
|
+
* @param foreignCollection name of the targeted collection
|
|
100
|
+
* @param throughCollection name of the intermediary collection
|
|
101
|
+
* @param options extra information about the relation
|
|
102
|
+
* @example
|
|
103
|
+
* dvds.addManyToMany('rentalsOfThisDvd', 'rentals', 'dvd_rentals', {
|
|
104
|
+
* originKey: 'dvd_id',
|
|
105
|
+
* foreignKey: 'rental_id'
|
|
106
|
+
* })
|
|
70
107
|
*/
|
|
71
|
-
|
|
108
|
+
addManyToMany<Foreign extends TCollectionName<S>, Through extends TCollectionName<S>>(name: string, foreignCollection: Foreign, throughCollection: Through, options: {
|
|
109
|
+
originKey: TColumnName<S, Through>;
|
|
110
|
+
foreignKey: TColumnName<S, Through>;
|
|
111
|
+
originKeyTarget?: TColumnName<S, N>;
|
|
112
|
+
foreignKeyTarget?: TColumnName<S, Foreign>;
|
|
113
|
+
}): this;
|
|
72
114
|
/**
|
|
73
115
|
* Add a new segment on the collection.
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
116
|
+
* @param name the name of the segment
|
|
117
|
+
* @param definition a function used to generate a condition tree
|
|
76
118
|
* or a condition tree
|
|
77
119
|
* @example
|
|
78
120
|
* .addSegment(
|
|
79
121
|
* 'Wrote more than 2 books',
|
|
80
|
-
*
|
|
122
|
+
* {field: 'booksCount', operator: 'GreaterThan', value: 2}
|
|
81
123
|
* );
|
|
82
124
|
*/
|
|
83
|
-
addSegment(name: string, definition: SegmentDefinition): this;
|
|
125
|
+
addSegment(name: string, definition: SegmentDefinition<S, N>): this;
|
|
84
126
|
/**
|
|
85
127
|
* Enable sorting on a specific field using emulation.
|
|
86
128
|
* As for all the emulation method, the field sorting will be done in-memory.
|
|
87
|
-
* @param
|
|
129
|
+
* @param name the name of the field to enable emulation on
|
|
88
130
|
* @example
|
|
89
131
|
* .emulateFieldSorting('fullName');
|
|
90
132
|
*/
|
|
91
|
-
emulateFieldSorting(name:
|
|
133
|
+
emulateFieldSorting(name: TColumnName<S, N>): this;
|
|
92
134
|
/**
|
|
93
135
|
* Replace an implementation for the sorting.
|
|
94
136
|
* The field sorting will be done by the datasource.
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
137
|
+
* @param name the name of the field to enable sort
|
|
138
|
+
* @param equivalentSort the sort equivalent
|
|
97
139
|
* @example
|
|
98
140
|
* .replaceFieldSorting(
|
|
99
141
|
* 'fullName',
|
|
@@ -103,7 +145,7 @@ export default class CollectionBuilder {
|
|
|
103
145
|
* ]
|
|
104
146
|
* )
|
|
105
147
|
*/
|
|
106
|
-
replaceFieldSorting(name:
|
|
148
|
+
replaceFieldSorting(name: TColumnName<S, N>, equivalentSort: PlainSortClause<S, N>[]): this;
|
|
107
149
|
/**
|
|
108
150
|
* Enable filtering on a specific field using emulation.
|
|
109
151
|
* As for all the emulation method, the field filtering will be done in-memory.
|
|
@@ -111,38 +153,50 @@ export default class CollectionBuilder {
|
|
|
111
153
|
* @example
|
|
112
154
|
* .emulateFieldFiltering('aField');
|
|
113
155
|
*/
|
|
114
|
-
emulateFieldFiltering(name:
|
|
156
|
+
emulateFieldFiltering(name: TColumnName<S, N>): this;
|
|
115
157
|
/**
|
|
116
158
|
* Enable filtering on a specific field with a specific operator using emulation.
|
|
117
159
|
* As for all the emulation method, the field filtering will be done in-memory.
|
|
118
|
-
* @param
|
|
119
|
-
* @param
|
|
160
|
+
* @param name the name of the field to enable emulation on
|
|
161
|
+
* @param operator the operator to emulate
|
|
120
162
|
* @example
|
|
121
163
|
* .emulateFieldOperator('aField', 'In');
|
|
122
164
|
*/
|
|
123
|
-
emulateFieldOperator(name:
|
|
165
|
+
emulateFieldOperator(name: TColumnName<S, N>, operator: Operator): this;
|
|
124
166
|
/**
|
|
125
167
|
* Replace an implementation for a specific operator on a specific field.
|
|
126
168
|
* The operator replacement will be done by the datasource.
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @param
|
|
169
|
+
* @param name the name of the field to filter on
|
|
170
|
+
* @param operator the operator to replace
|
|
171
|
+
* @param replacer the proposed implementation
|
|
130
172
|
* @example
|
|
131
173
|
* .replaceFieldOperator('booksCount', 'Equal', ({ value }) => new ConditionTreeNot(
|
|
132
174
|
* new ConditionTreeLeaf('booksCount', 'Equal', value),
|
|
133
175
|
* ));
|
|
134
176
|
*/
|
|
135
|
-
replaceFieldOperator(name:
|
|
177
|
+
replaceFieldOperator<C extends TColumnName<S, N>>(name: C, operator: Operator, replacer: OperatorDefinition<S, N, C>): this;
|
|
136
178
|
/**
|
|
137
179
|
* Replace the write behavior of a field.
|
|
138
|
-
* @param
|
|
139
|
-
* @param
|
|
180
|
+
* @param name the name of the field
|
|
181
|
+
* @param definition the function or a value to represent the write behavior
|
|
140
182
|
* @example
|
|
141
|
-
* .replaceFieldWriting('fullName',
|
|
183
|
+
* .replaceFieldWriting('fullName', fullName => {
|
|
142
184
|
* const [firstName, lastName] = fullName.split(' ');
|
|
143
185
|
* return { firstName, lastName };
|
|
144
186
|
* });
|
|
145
187
|
*/
|
|
146
|
-
replaceFieldWriting(name:
|
|
188
|
+
replaceFieldWriting<C extends TColumnName<S, N>>(name: C, definition: WriteDefinition<S, N, C>): this;
|
|
189
|
+
/**
|
|
190
|
+
* Add a relation between two collections.
|
|
191
|
+
* @param name name of the new relation
|
|
192
|
+
* @param definition definition of the new relation
|
|
193
|
+
* @example
|
|
194
|
+
* .addRelation('author', {
|
|
195
|
+
* type: 'ManyToOne',
|
|
196
|
+
* foreignCollection: 'persons',
|
|
197
|
+
* foreignKey: 'authorId'
|
|
198
|
+
* });
|
|
199
|
+
*/
|
|
200
|
+
private addRelation;
|
|
147
201
|
}
|
|
148
202
|
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const datasource_toolkit_1 = require("@forestadmin/datasource-toolkit");
|
|
7
7
|
const filterable_1 = __importDefault(require("../agent/utils/forest-schema/filterable"));
|
|
8
8
|
class CollectionBuilder {
|
|
9
|
-
constructor(
|
|
10
|
-
this.agentBuilder = agentBuilder;
|
|
9
|
+
constructor(stack, name) {
|
|
11
10
|
this.name = name;
|
|
11
|
+
this.stack = stack;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Import a field from a many to one or one to one relation.
|
|
@@ -19,7 +19,7 @@ class CollectionBuilder {
|
|
|
19
19
|
* .importField('authorName', { path: 'author:fullName' })
|
|
20
20
|
*/
|
|
21
21
|
importField(name, options) {
|
|
22
|
-
const collection = this.
|
|
22
|
+
const collection = this.stack.lateComputed.getCollection(this.name);
|
|
23
23
|
const schema = datasource_toolkit_1.CollectionUtils.getFieldSchema(collection, options.path);
|
|
24
24
|
this.addField(name, {
|
|
25
25
|
beforeRelations: options.beforeRelations,
|
|
@@ -30,57 +30,62 @@ class CollectionBuilder {
|
|
|
30
30
|
enumValues: schema.enumValues,
|
|
31
31
|
});
|
|
32
32
|
for (const operator of schema.filterOperators) {
|
|
33
|
-
const handler =
|
|
33
|
+
const handler = value => ({ field: options.path, operator, value });
|
|
34
34
|
this.replaceFieldOperator(name, operator, handler);
|
|
35
35
|
}
|
|
36
36
|
if (schema.isSortable) {
|
|
37
|
-
this.replaceFieldSorting(name, [
|
|
37
|
+
this.replaceFieldSorting(name, [
|
|
38
|
+
{ field: options.path, ascending: true },
|
|
39
|
+
]);
|
|
38
40
|
}
|
|
39
41
|
return this;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
44
|
* Allow to rename a field of a given collection.
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
+
* @param oldName the current name of the field in a given collection
|
|
46
|
+
* @param newName the new name of the field
|
|
45
47
|
* @example
|
|
46
48
|
* .renameField('theCurrentNameOfTheField', 'theNewNameOfTheField');
|
|
47
49
|
*/
|
|
48
50
|
renameField(oldName, newName) {
|
|
49
|
-
this.
|
|
51
|
+
this.stack.rename.getCollection(this.name).renameField(oldName, newName);
|
|
50
52
|
return this;
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
55
|
* Remove field by setting its visibility to false.
|
|
54
|
-
* @param
|
|
56
|
+
* @param names the fields to remove
|
|
55
57
|
* @example
|
|
56
58
|
* .removeField('aFieldToRemove', 'anOtherFieldToRemove');
|
|
57
59
|
*/
|
|
58
60
|
removeField(...names) {
|
|
59
|
-
const collection = this.
|
|
61
|
+
const collection = this.stack.publication.getCollection(this.name);
|
|
60
62
|
for (const name of names)
|
|
61
63
|
collection.changeFieldVisibility(name, false);
|
|
62
64
|
return this;
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
67
|
* Add a new action on the collection.
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
+
* @param name the name of the action
|
|
69
|
+
* @param definition the definition of the action
|
|
68
70
|
* @example
|
|
69
71
|
* .addAction('is live', {
|
|
70
72
|
* scope: 'Single',
|
|
71
|
-
* execute: async (context,
|
|
72
|
-
* return
|
|
73
|
+
* execute: async (context, resultBuilder) => {
|
|
74
|
+
* return resultBuilder.success(`Is live!`);
|
|
73
75
|
* },
|
|
74
76
|
* })
|
|
75
77
|
*/
|
|
76
78
|
addAction(name, definition) {
|
|
77
|
-
this.
|
|
79
|
+
this.stack.action
|
|
80
|
+
.getCollection(this.name)
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
+
.addAction(name, definition);
|
|
78
83
|
return this;
|
|
79
84
|
}
|
|
80
85
|
/**
|
|
81
86
|
* Add a new field on the collection.
|
|
82
|
-
* @param
|
|
83
|
-
* @param
|
|
87
|
+
* @param name the name of the field
|
|
88
|
+
* @param definition The definition of the field
|
|
84
89
|
* @example
|
|
85
90
|
* .addField('fullName', {
|
|
86
91
|
* columnType: 'String',
|
|
@@ -91,57 +96,117 @@ class CollectionBuilder {
|
|
|
91
96
|
addField(name, definition) {
|
|
92
97
|
const { beforeRelations, ...computedDefinition } = definition;
|
|
93
98
|
const collection = definition.beforeRelations
|
|
94
|
-
? this.
|
|
95
|
-
: this.
|
|
99
|
+
? this.stack.earlyComputed.getCollection(this.name)
|
|
100
|
+
: this.stack.lateComputed.getCollection(this.name);
|
|
96
101
|
collection.registerComputed(name, computedDefinition);
|
|
97
102
|
return this;
|
|
98
103
|
}
|
|
99
104
|
/**
|
|
100
|
-
* Add a relation
|
|
105
|
+
* Add a many to one relation to the collection
|
|
101
106
|
* @param name name of the new relation
|
|
102
|
-
* @param
|
|
107
|
+
* @param foreignCollection name of the targeted collection
|
|
108
|
+
* @param options extra information about the relation
|
|
103
109
|
* @example
|
|
104
|
-
* .
|
|
105
|
-
* type: 'ManyToOne',
|
|
106
|
-
* foreignCollection: 'persons',
|
|
107
|
-
* foreignKey: 'authorId'
|
|
108
|
-
* });
|
|
110
|
+
* books.addManyToOne('myAuthor', 'persons', { foreignKey: 'author_id' })
|
|
109
111
|
*/
|
|
110
|
-
|
|
111
|
-
this.
|
|
112
|
+
addManyToOne(name, foreignCollection, options) {
|
|
113
|
+
this.addRelation(name, {
|
|
114
|
+
type: 'ManyToOne',
|
|
115
|
+
foreignCollection,
|
|
116
|
+
foreignKey: options.foreignKey,
|
|
117
|
+
foreignKeyTarget: options.foreignKeyTarget,
|
|
118
|
+
});
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Add a one to many relation to the collection
|
|
123
|
+
* @param name name of the new relation
|
|
124
|
+
* @param foreignCollection name of the targeted collection
|
|
125
|
+
* @param options extra information about the relation
|
|
126
|
+
* @example
|
|
127
|
+
* persons.addOneToMany('writtenBooks', 'books', { originKey: 'author_id' })
|
|
128
|
+
*/
|
|
129
|
+
addOneToMany(name, foreignCollection, options) {
|
|
130
|
+
this.addRelation(name, {
|
|
131
|
+
type: 'OneToMany',
|
|
132
|
+
foreignCollection,
|
|
133
|
+
originKey: options.originKey,
|
|
134
|
+
originKeyTarget: options.originKeyTarget,
|
|
135
|
+
});
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Add a one to one relation to the collection
|
|
140
|
+
* @param name name of the new relation
|
|
141
|
+
* @param foreignCollection name of the targeted collection
|
|
142
|
+
* @param options extra information about the relation
|
|
143
|
+
* @example
|
|
144
|
+
* persons.addOneToOne('bestFriend', 'persons', { originKey: 'best_friend_id' })
|
|
145
|
+
*/
|
|
146
|
+
addOneToOne(name, foreignCollection, options) {
|
|
147
|
+
this.addRelation(name, {
|
|
148
|
+
type: 'OneToOne',
|
|
149
|
+
foreignCollection,
|
|
150
|
+
originKey: options.originKey,
|
|
151
|
+
originKeyTarget: options.originKeyTarget,
|
|
152
|
+
});
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Add a many to many relation to the collection
|
|
157
|
+
* @param name name of the new relation
|
|
158
|
+
* @param foreignCollection name of the targeted collection
|
|
159
|
+
* @param throughCollection name of the intermediary collection
|
|
160
|
+
* @param options extra information about the relation
|
|
161
|
+
* @example
|
|
162
|
+
* dvds.addManyToMany('rentalsOfThisDvd', 'rentals', 'dvd_rentals', {
|
|
163
|
+
* originKey: 'dvd_id',
|
|
164
|
+
* foreignKey: 'rental_id'
|
|
165
|
+
* })
|
|
166
|
+
*/
|
|
167
|
+
addManyToMany(name, foreignCollection, throughCollection, options) {
|
|
168
|
+
this.addRelation(name, {
|
|
169
|
+
type: 'ManyToMany',
|
|
170
|
+
foreignCollection,
|
|
171
|
+
throughCollection,
|
|
172
|
+
originKey: options.originKey,
|
|
173
|
+
originKeyTarget: options.originKeyTarget,
|
|
174
|
+
foreignKey: options.foreignKey,
|
|
175
|
+
foreignKeyTarget: options.foreignKeyTarget,
|
|
176
|
+
});
|
|
112
177
|
return this;
|
|
113
178
|
}
|
|
114
179
|
/**
|
|
115
180
|
* Add a new segment on the collection.
|
|
116
|
-
* @param
|
|
117
|
-
* @param
|
|
181
|
+
* @param name the name of the segment
|
|
182
|
+
* @param definition a function used to generate a condition tree
|
|
118
183
|
* or a condition tree
|
|
119
184
|
* @example
|
|
120
185
|
* .addSegment(
|
|
121
186
|
* 'Wrote more than 2 books',
|
|
122
|
-
*
|
|
187
|
+
* {field: 'booksCount', operator: 'GreaterThan', value: 2}
|
|
123
188
|
* );
|
|
124
189
|
*/
|
|
125
190
|
addSegment(name, definition) {
|
|
126
|
-
this.
|
|
191
|
+
this.stack.segment.getCollection(this.name).addSegment(name, definition);
|
|
127
192
|
return this;
|
|
128
193
|
}
|
|
129
194
|
/**
|
|
130
195
|
* Enable sorting on a specific field using emulation.
|
|
131
196
|
* As for all the emulation method, the field sorting will be done in-memory.
|
|
132
|
-
* @param
|
|
197
|
+
* @param name the name of the field to enable emulation on
|
|
133
198
|
* @example
|
|
134
199
|
* .emulateFieldSorting('fullName');
|
|
135
200
|
*/
|
|
136
201
|
emulateFieldSorting(name) {
|
|
137
|
-
this.
|
|
202
|
+
this.stack.sortEmulate.getCollection(this.name).emulateFieldSorting(name);
|
|
138
203
|
return this;
|
|
139
204
|
}
|
|
140
205
|
/**
|
|
141
206
|
* Replace an implementation for the sorting.
|
|
142
207
|
* The field sorting will be done by the datasource.
|
|
143
|
-
* @param
|
|
144
|
-
* @param
|
|
208
|
+
* @param name the name of the field to enable sort
|
|
209
|
+
* @param equivalentSort the sort equivalent
|
|
145
210
|
* @example
|
|
146
211
|
* .replaceFieldSorting(
|
|
147
212
|
* 'fullName',
|
|
@@ -152,7 +217,7 @@ class CollectionBuilder {
|
|
|
152
217
|
* )
|
|
153
218
|
*/
|
|
154
219
|
replaceFieldSorting(name, equivalentSort) {
|
|
155
|
-
this.
|
|
220
|
+
this.stack.sortEmulate
|
|
156
221
|
.getCollection(this.name)
|
|
157
222
|
.replaceFieldSorting(name, equivalentSort);
|
|
158
223
|
return this;
|
|
@@ -165,10 +230,10 @@ class CollectionBuilder {
|
|
|
165
230
|
* .emulateFieldFiltering('aField');
|
|
166
231
|
*/
|
|
167
232
|
emulateFieldFiltering(name) {
|
|
168
|
-
const collection = this.
|
|
233
|
+
const collection = this.stack.lateOpEmulate.getCollection(this.name);
|
|
169
234
|
const field = collection.schema.fields[name];
|
|
170
235
|
for (const operator of filterable_1.default.getRequiredOperators(field.columnType)) {
|
|
171
|
-
if (!field.filterOperators
|
|
236
|
+
if (!field.filterOperators?.has(operator)) {
|
|
172
237
|
this.emulateFieldOperator(name, operator);
|
|
173
238
|
}
|
|
174
239
|
}
|
|
@@ -177,50 +242,65 @@ class CollectionBuilder {
|
|
|
177
242
|
/**
|
|
178
243
|
* Enable filtering on a specific field with a specific operator using emulation.
|
|
179
244
|
* As for all the emulation method, the field filtering will be done in-memory.
|
|
180
|
-
* @param
|
|
181
|
-
* @param
|
|
245
|
+
* @param name the name of the field to enable emulation on
|
|
246
|
+
* @param operator the operator to emulate
|
|
182
247
|
* @example
|
|
183
248
|
* .emulateFieldOperator('aField', 'In');
|
|
184
249
|
*/
|
|
185
250
|
emulateFieldOperator(name, operator) {
|
|
186
|
-
const collection = this.
|
|
187
|
-
? this.
|
|
188
|
-
: this.
|
|
251
|
+
const collection = this.stack.earlyOpEmulate.getCollection(this.name).schema.fields[name]
|
|
252
|
+
? this.stack.earlyOpEmulate.getCollection(this.name)
|
|
253
|
+
: this.stack.lateOpEmulate.getCollection(this.name);
|
|
189
254
|
collection.emulateFieldOperator(name, operator);
|
|
190
255
|
return this;
|
|
191
256
|
}
|
|
192
257
|
/**
|
|
193
258
|
* Replace an implementation for a specific operator on a specific field.
|
|
194
259
|
* The operator replacement will be done by the datasource.
|
|
195
|
-
* @param
|
|
196
|
-
* @param
|
|
197
|
-
* @param
|
|
260
|
+
* @param name the name of the field to filter on
|
|
261
|
+
* @param operator the operator to replace
|
|
262
|
+
* @param replacer the proposed implementation
|
|
198
263
|
* @example
|
|
199
264
|
* .replaceFieldOperator('booksCount', 'Equal', ({ value }) => new ConditionTreeNot(
|
|
200
265
|
* new ConditionTreeLeaf('booksCount', 'Equal', value),
|
|
201
266
|
* ));
|
|
202
267
|
*/
|
|
203
268
|
replaceFieldOperator(name, operator, replacer) {
|
|
204
|
-
const collection = this.
|
|
205
|
-
? this.
|
|
206
|
-
: this.
|
|
269
|
+
const collection = this.stack.earlyOpEmulate.getCollection(this.name).schema.fields[name]
|
|
270
|
+
? this.stack.earlyOpEmulate.getCollection(this.name)
|
|
271
|
+
: this.stack.lateOpEmulate.getCollection(this.name);
|
|
207
272
|
collection.replaceFieldOperator(name, operator, replacer);
|
|
208
273
|
return this;
|
|
209
274
|
}
|
|
210
275
|
/**
|
|
211
276
|
* Replace the write behavior of a field.
|
|
212
|
-
* @param
|
|
213
|
-
* @param
|
|
277
|
+
* @param name the name of the field
|
|
278
|
+
* @param definition the function or a value to represent the write behavior
|
|
214
279
|
* @example
|
|
215
|
-
* .replaceFieldWriting('fullName',
|
|
280
|
+
* .replaceFieldWriting('fullName', fullName => {
|
|
216
281
|
* const [firstName, lastName] = fullName.split(' ');
|
|
217
282
|
* return { firstName, lastName };
|
|
218
283
|
* });
|
|
219
284
|
*/
|
|
220
285
|
replaceFieldWriting(name, definition) {
|
|
221
|
-
this.
|
|
286
|
+
this.stack.write.getCollection(this.name).replaceFieldWriting(name, definition);
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Add a relation between two collections.
|
|
291
|
+
* @param name name of the new relation
|
|
292
|
+
* @param definition definition of the new relation
|
|
293
|
+
* @example
|
|
294
|
+
* .addRelation('author', {
|
|
295
|
+
* type: 'ManyToOne',
|
|
296
|
+
* foreignCollection: 'persons',
|
|
297
|
+
* foreignKey: 'authorId'
|
|
298
|
+
* });
|
|
299
|
+
*/
|
|
300
|
+
addRelation(name, definition) {
|
|
301
|
+
this.stack.relation.getCollection(this.name).addRelation(name, definition);
|
|
222
302
|
return this;
|
|
223
303
|
}
|
|
224
304
|
}
|
|
225
305
|
exports.default = CollectionBuilder;
|
|
226
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
306
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9idWlsZGVyL2NvbGxlY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSx3RUFleUM7QUFHekMseUZBQThFO0FBRTlFLE1BQXFCLGlCQUFpQjtJQU9wQyxZQUFZLEtBQXNCLEVBQUUsSUFBWTtRQUM5QyxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQztRQUNqQixJQUFJLENBQUMsS0FBSyxHQUFHLEtBQUssQ0FBQztJQUNyQixDQUFDO0lBRUQ7Ozs7Ozs7T0FPRztJQUNILFdBQVcsQ0FBQyxJQUFZLEVBQUUsT0FBOEQ7UUFDdEYsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNwRSxNQUFNLE1BQU0sR0FBRyxvQ0FBZSxDQUFDLGNBQWMsQ0FBQyxVQUFVLEVBQUUsT0FBTyxDQUFDLElBQUksQ0FBaUIsQ0FBQztRQUV4RixJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRTtZQUNsQixlQUFlLEVBQUUsT0FBTyxDQUFDLGVBQWU7WUFDeEMsVUFBVSxFQUFFLE1BQU0sQ0FBQyxVQUFVO1lBQzdCLFlBQVksRUFBRSxNQUFNLENBQUMsWUFBWTtZQUNqQyx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FDO0lBRUQ7Ozs7Ozs7Ozs7T0FVRztJQUNLLFdBQVcsQ0FBQyxJQUFZLEVBQUUsVUFBOEI7UUFDOUQsSUFBSSxDQUFDLEtBQUssQ0FBQyxRQUFRLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxXQUFXLENBQUMsSUFBSSxFQUFFLFVBQVUsQ0FBQyxDQUFDO1FBRTNFLE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztDQUNGO0FBdlhELG9DQXVYQyJ9
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ActionCollectionDecorator, ChartDataSourceDecorator, ComputedCollectionDecorator, DataSource, DataSourceDecorator, EmptyCollectionDecorator, OperatorsEmulateCollectionDecorator, OperatorsReplaceCollectionDecorator, PublicationCollectionDecorator, RelationCollectionDecorator, RenameCollectionDecorator, SearchCollectionDecorator, SegmentCollectionDecorator, SortEmulateCollectionDecorator, WriteCollectionDecorator } from '@forestadmin/datasource-toolkit';
|
|
2
|
+
export default class DecoratorsStack {
|
|
3
|
+
action: DataSourceDecorator<ActionCollectionDecorator>;
|
|
4
|
+
chart: ChartDataSourceDecorator;
|
|
5
|
+
earlyComputed: DataSourceDecorator<ComputedCollectionDecorator>;
|
|
6
|
+
earlyOpEmulate: DataSourceDecorator<OperatorsEmulateCollectionDecorator>;
|
|
7
|
+
earlyOpReplace: DataSourceDecorator<OperatorsReplaceCollectionDecorator>;
|
|
8
|
+
empty: DataSourceDecorator<EmptyCollectionDecorator>;
|
|
9
|
+
relation: DataSourceDecorator<RelationCollectionDecorator>;
|
|
10
|
+
lateComputed: DataSourceDecorator<ComputedCollectionDecorator>;
|
|
11
|
+
lateOpEmulate: DataSourceDecorator<OperatorsEmulateCollectionDecorator>;
|
|
12
|
+
lateOpReplace: DataSourceDecorator<OperatorsReplaceCollectionDecorator>;
|
|
13
|
+
publication: DataSourceDecorator<PublicationCollectionDecorator>;
|
|
14
|
+
rename: DataSourceDecorator<RenameCollectionDecorator>;
|
|
15
|
+
search: DataSourceDecorator<SearchCollectionDecorator>;
|
|
16
|
+
segment: DataSourceDecorator<SegmentCollectionDecorator>;
|
|
17
|
+
sortEmulate: DataSourceDecorator<SortEmulateCollectionDecorator>;
|
|
18
|
+
write: DataSourceDecorator<WriteCollectionDecorator>;
|
|
19
|
+
dataSource: DataSource;
|
|
20
|
+
constructor(dataSource: DataSource);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=decorators-stack.d.ts.map
|