electrodb 2.10.0 → 2.10.2
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/.prettierignore +112 -0
- package/.prettierrc +11 -0
- package/README.md +55 -47
- package/index.d.ts +5288 -2409
- package/index.js +24 -12
- package/package.json +19 -11
- package/src/clauses.js +1557 -1310
- package/src/client.js +255 -235
- package/src/entity.js +4512 -3737
- package/src/errors.js +39 -28
- package/src/events.js +26 -16
- package/src/filterOperations.js +120 -122
- package/src/filters.js +99 -101
- package/src/operations.js +326 -263
- package/src/schema.js +1825 -1473
- package/src/service.js +1081 -852
- package/src/set.js +22 -26
- package/src/transaction.js +179 -153
- package/src/types.js +260 -264
- package/src/update.js +94 -90
- package/src/updateOperations.js +179 -160
- package/src/util.js +45 -32
- package/src/validations.js +337 -325
- package/src/where.js +146 -124
- package/tsconfig.json +12 -11
package/src/operations.js
CHANGED
|
@@ -1,313 +1,376 @@
|
|
|
1
|
-
const {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const {
|
|
2
|
+
AttributeTypes,
|
|
3
|
+
ItemOperations,
|
|
4
|
+
AttributeProxySymbol,
|
|
5
|
+
BuilderTypes,
|
|
6
|
+
} = require("./types");
|
|
7
|
+
const { UpdateOperations } = require("./updateOperations");
|
|
8
|
+
const { FilterOperations } = require("./filterOperations");
|
|
4
9
|
const e = require("./errors");
|
|
5
10
|
const u = require("./util");
|
|
6
11
|
|
|
7
12
|
class ExpressionState {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
constructor({ prefix } = {}) {
|
|
14
|
+
this.names = {};
|
|
15
|
+
this.values = {};
|
|
16
|
+
this.paths = {};
|
|
17
|
+
this.counts = {};
|
|
18
|
+
this.impacted = {};
|
|
19
|
+
this.expression = "";
|
|
20
|
+
this.prefix = prefix || "";
|
|
21
|
+
this.refs = {};
|
|
22
|
+
}
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
return `${this.prefix}${this.counts[name]++}`;
|
|
24
|
+
incrementName(name) {
|
|
25
|
+
if (this.counts[name] === undefined) {
|
|
26
|
+
this.counts[name] = 0;
|
|
24
27
|
}
|
|
28
|
+
return `${this.prefix}${this.counts[name]++}`;
|
|
29
|
+
}
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
return { json, expression, prop };
|
|
31
|
+
// todo: make the structure: name, value, paths
|
|
32
|
+
setName(paths, name, value) {
|
|
33
|
+
let json = "";
|
|
34
|
+
let expression = "";
|
|
35
|
+
const prop = `#${name}`;
|
|
36
|
+
if (Object.keys(paths).length === 0) {
|
|
37
|
+
json = `${name}`;
|
|
38
|
+
expression = `${prop}`;
|
|
39
|
+
this.names[prop] = value;
|
|
40
|
+
} else if (isNaN(name)) {
|
|
41
|
+
json = `${paths.json}.${name}`;
|
|
42
|
+
expression = `${paths.expression}.${prop}`;
|
|
43
|
+
this.names[prop] = value;
|
|
44
|
+
} else {
|
|
45
|
+
json = `${paths.json}[${name}]`;
|
|
46
|
+
expression = `${paths.expression}[${name}]`;
|
|
44
47
|
}
|
|
48
|
+
return { json, expression, prop };
|
|
49
|
+
}
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
getNames() {
|
|
52
|
+
return this.names;
|
|
53
|
+
}
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
setValue(name, value) {
|
|
56
|
+
let valueCount = this.incrementName(name);
|
|
57
|
+
let expression = `:${name}${valueCount}`;
|
|
58
|
+
this.values[expression] = value;
|
|
59
|
+
return expression;
|
|
60
|
+
}
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
updateValue(name, value) {
|
|
63
|
+
this.values[name] = value;
|
|
64
|
+
}
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
getValues() {
|
|
67
|
+
return this.values;
|
|
68
|
+
}
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
setPath(path, value) {
|
|
71
|
+
this.paths[path] = value;
|
|
72
|
+
}
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
setExpression(expression) {
|
|
75
|
+
this.expression = expression;
|
|
76
|
+
}
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
getExpression() {
|
|
79
|
+
return this.expression;
|
|
80
|
+
}
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
setImpacted(operation, path, ref) {
|
|
83
|
+
this.impacted[path] = operation;
|
|
84
|
+
this.refs[path] = ref;
|
|
85
|
+
}
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
class AttributeOperationProxy {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
constructor({ builder, attributes = {}, operations = {} }) {
|
|
90
|
+
this.ref = {
|
|
91
|
+
attributes,
|
|
92
|
+
operations,
|
|
93
|
+
};
|
|
94
|
+
this.attributes = AttributeOperationProxy.buildAttributes(
|
|
95
|
+
builder,
|
|
96
|
+
attributes,
|
|
97
|
+
);
|
|
98
|
+
this.operations = AttributeOperationProxy.buildOperations(
|
|
99
|
+
builder,
|
|
100
|
+
operations,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
92
103
|
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
invokeCallback(op, ...params) {
|
|
105
|
+
return op(this.attributes, this.operations, ...params);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
performOperation({ operation, path, value, force = false }) {
|
|
109
|
+
if (value === undefined) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const parts = u.parseJSONPath(path);
|
|
113
|
+
let attribute = this.attributes;
|
|
114
|
+
for (let part of parts) {
|
|
115
|
+
attribute = attribute[part];
|
|
95
116
|
}
|
|
117
|
+
if (attribute) {
|
|
118
|
+
this.operations[operation](attribute, value);
|
|
119
|
+
const { target } = attribute();
|
|
120
|
+
if (target.readOnly && !force) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
`Attribute "${target.path}" is Read-Only and cannot be updated`,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
96
127
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
attribute = attribute[part];
|
|
105
|
-
}
|
|
106
|
-
if (attribute) {
|
|
107
|
-
this.operations[operation](attribute, value);
|
|
108
|
-
const {target} = attribute();
|
|
109
|
-
if (target.readOnly && !force) {
|
|
110
|
-
throw new Error(`Attribute "${target.path}" is Read-Only and cannot be updated`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
128
|
+
fromObject(operation, record) {
|
|
129
|
+
for (let path of Object.keys(record)) {
|
|
130
|
+
this.performOperation({
|
|
131
|
+
operation,
|
|
132
|
+
path,
|
|
133
|
+
value: record[path],
|
|
134
|
+
});
|
|
113
135
|
}
|
|
136
|
+
}
|
|
114
137
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
138
|
+
fromArray(operation, paths) {
|
|
139
|
+
for (let path of paths) {
|
|
140
|
+
const parts = u.parseJSONPath(path);
|
|
141
|
+
let attribute = this.attributes;
|
|
142
|
+
for (let part of parts) {
|
|
143
|
+
attribute = attribute[part];
|
|
144
|
+
}
|
|
145
|
+
if (attribute) {
|
|
146
|
+
this.operations[operation](attribute);
|
|
147
|
+
const { target } = attribute();
|
|
148
|
+
if (target.readOnly) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`Attribute "${target.path}" is Read-Only and cannot be updated`,
|
|
151
|
+
);
|
|
152
|
+
} else if (operation === ItemOperations.remove && target.required) {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`Attribute "${target.path}" is Required and cannot be removed`,
|
|
155
|
+
);
|
|
122
156
|
}
|
|
157
|
+
}
|
|
123
158
|
}
|
|
159
|
+
}
|
|
124
160
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
161
|
+
static buildOperations(builder, operations) {
|
|
162
|
+
let ops = {};
|
|
163
|
+
let seen = new Map();
|
|
164
|
+
for (let operation of Object.keys(operations)) {
|
|
165
|
+
let { template, canNest, rawValue, rawField } = operations[operation];
|
|
166
|
+
Object.defineProperty(ops, operation, {
|
|
167
|
+
get: () => {
|
|
168
|
+
return (property, ...values) => {
|
|
169
|
+
if (property === undefined) {
|
|
170
|
+
throw new e.ElectroError(
|
|
171
|
+
e.ErrorCodes.InvalidWhere,
|
|
172
|
+
`Invalid/Unknown property passed in where clause passed to operation: '${operation}'`,
|
|
173
|
+
);
|
|
131
174
|
}
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
175
|
+
if (property[AttributeProxySymbol]) {
|
|
176
|
+
const { commit, target } = property();
|
|
177
|
+
const fixedValues = values
|
|
178
|
+
.map((value) => target.applyFixings(value))
|
|
179
|
+
.filter((value) => value !== undefined);
|
|
180
|
+
const isFilterBuilder = builder.type === BuilderTypes.filter;
|
|
181
|
+
const takesValueArgument = template.length > 3;
|
|
182
|
+
const isAcceptableValue = fixedValues.every((value) => {
|
|
183
|
+
const seenAttributes = seen.get(value);
|
|
184
|
+
if (seenAttributes) {
|
|
185
|
+
return seenAttributes.every((v) => target.acceptable(v));
|
|
139
186
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
static buildOperations(builder, operations) {
|
|
145
|
-
let ops = {};
|
|
146
|
-
let seen = new Map();
|
|
147
|
-
for (let operation of Object.keys(operations)) {
|
|
148
|
-
let {template, canNest, rawValue, rawField} = operations[operation];
|
|
149
|
-
Object.defineProperty(ops, operation, {
|
|
150
|
-
get: () => {
|
|
151
|
-
return (property, ...values) => {
|
|
152
|
-
if (property === undefined) {
|
|
153
|
-
throw new e.ElectroError(e.ErrorCodes.InvalidWhere, `Invalid/Unknown property passed in where clause passed to operation: '${operation}'`);
|
|
154
|
-
}
|
|
155
|
-
if (property[AttributeProxySymbol]) {
|
|
156
|
-
const {commit, target} = property();
|
|
157
|
-
const fixedValues = values.map((value) => target.applyFixings(value))
|
|
158
|
-
.filter(value => value !== undefined);
|
|
159
|
-
const isFilterBuilder = builder.type === BuilderTypes.filter;
|
|
160
|
-
const takesValueArgument = template.length > 3;
|
|
161
|
-
const isAcceptableValue = fixedValues.every(value => {
|
|
162
|
-
const seenAttributes = seen.get(value);
|
|
163
|
-
if (seenAttributes) {
|
|
164
|
-
return seenAttributes.every(v => target.acceptable(v))
|
|
165
|
-
}
|
|
166
|
-
return target.acceptable(value);
|
|
167
|
-
});
|
|
187
|
+
return target.acceptable(value);
|
|
188
|
+
});
|
|
168
189
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
190
|
+
const shouldCommit =
|
|
191
|
+
// if it is a filterBuilder than we don't care what they pass because the user needs more freedom here
|
|
192
|
+
isFilterBuilder ||
|
|
193
|
+
// if the operation does not take a value argument then not committing here could cause problems.
|
|
194
|
+
// this should be revisited to make more robust, we could hypothetically store the commit in the
|
|
195
|
+
// "seen" map for when the value is used, but that's a lot of new complexity
|
|
196
|
+
!takesValueArgument ||
|
|
197
|
+
// if the operation takes a value, we should determine if that value is acceptable. For
|
|
198
|
+
// example, in the cases of a "set" we check to see if it is empty, or if the value is
|
|
199
|
+
// undefined, we should not commit. The "fixedValues" length check is because the
|
|
200
|
+
// "fixedValues" array has been filtered for undefined, so no length there indicates an
|
|
201
|
+
// undefined value was passed.
|
|
202
|
+
(takesValueArgument &&
|
|
203
|
+
isAcceptableValue &&
|
|
204
|
+
fixedValues.length > 0);
|
|
182
205
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
206
|
+
if (!shouldCommit) {
|
|
207
|
+
return "";
|
|
208
|
+
}
|
|
186
209
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
210
|
+
const paths = commit();
|
|
211
|
+
const attributeValues = [];
|
|
212
|
+
let hasNestedValue = false;
|
|
213
|
+
for (let fixedValue of fixedValues) {
|
|
214
|
+
if (seen.has(fixedValue)) {
|
|
215
|
+
attributeValues.push(fixedValue);
|
|
216
|
+
hasNestedValue = true;
|
|
217
|
+
} else {
|
|
218
|
+
let attributeValueName = builder.setValue(
|
|
219
|
+
target.name,
|
|
220
|
+
fixedValue,
|
|
221
|
+
);
|
|
222
|
+
builder.setPath(paths.json, {
|
|
223
|
+
value: fixedValue,
|
|
224
|
+
name: attributeValueName,
|
|
225
|
+
});
|
|
226
|
+
attributeValues.push(attributeValueName);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
203
229
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
230
|
+
const options = {
|
|
231
|
+
nestedValue: hasNestedValue,
|
|
232
|
+
createValue: (name, value) =>
|
|
233
|
+
builder.setValue(`${target.name}_${name}`, value),
|
|
234
|
+
};
|
|
208
235
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
236
|
+
const formatted = template(
|
|
237
|
+
options,
|
|
238
|
+
target,
|
|
239
|
+
paths.expression,
|
|
240
|
+
...attributeValues,
|
|
241
|
+
);
|
|
242
|
+
builder.setImpacted(operation, paths.json, target);
|
|
243
|
+
if (canNest) {
|
|
244
|
+
seen.set(paths.expression, attributeValues);
|
|
245
|
+
seen.set(formatted, attributeValues);
|
|
246
|
+
}
|
|
215
247
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
248
|
+
if (
|
|
249
|
+
builder.type === BuilderTypes.update &&
|
|
250
|
+
formatted &&
|
|
251
|
+
typeof formatted.operation === "string" &&
|
|
252
|
+
typeof formatted.expression === "string"
|
|
253
|
+
) {
|
|
254
|
+
builder.add(formatted.operation, formatted.expression);
|
|
255
|
+
return formatted.expression;
|
|
256
|
+
}
|
|
220
257
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
258
|
+
return formatted;
|
|
259
|
+
} else if (rawValue) {
|
|
260
|
+
// const {json, expression} = builder.setName({}, property, property);
|
|
261
|
+
let attributeValueName = builder.setValue(property, property);
|
|
262
|
+
builder.setPath(property, {
|
|
263
|
+
value: property,
|
|
264
|
+
name: attributeValueName,
|
|
265
|
+
});
|
|
266
|
+
const formatted = template({}, attributeValueName);
|
|
267
|
+
seen.set(attributeValueName, [property]);
|
|
268
|
+
seen.set(formatted, [property]);
|
|
269
|
+
return formatted;
|
|
270
|
+
} else if (rawField) {
|
|
271
|
+
const { prop, expression } = builder.setName(
|
|
272
|
+
{},
|
|
273
|
+
property,
|
|
274
|
+
property,
|
|
275
|
+
);
|
|
276
|
+
const formatted = template({}, null, prop);
|
|
277
|
+
seen.set(expression, [property]);
|
|
278
|
+
seen.set(formatted, [property]);
|
|
279
|
+
return formatted;
|
|
280
|
+
} else {
|
|
281
|
+
throw new e.ElectroError(
|
|
282
|
+
e.ErrorCodes.InvalidWhere,
|
|
283
|
+
`Invalid Attribute in where clause passed to operation '${operation}'. Use injected attributes only.`,
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
});
|
|
247
289
|
}
|
|
290
|
+
return ops;
|
|
291
|
+
}
|
|
248
292
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
target: attribute,
|
|
272
|
-
commit: () => {
|
|
273
|
-
const paths = commit();
|
|
274
|
-
return builder.setName(paths, prop, field);
|
|
275
|
-
},
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
}
|
|
293
|
+
static pathProxy(build) {
|
|
294
|
+
return new Proxy(() => build(), {
|
|
295
|
+
get: (_, prop, o) => {
|
|
296
|
+
if (prop === AttributeProxySymbol) {
|
|
297
|
+
return true;
|
|
298
|
+
} else {
|
|
299
|
+
return AttributeOperationProxy.pathProxy(() => {
|
|
300
|
+
const { commit, root, target, builder } = build();
|
|
301
|
+
const attribute = target.getChild(prop);
|
|
302
|
+
let field;
|
|
303
|
+
if (attribute === undefined) {
|
|
304
|
+
throw new Error(
|
|
305
|
+
`Invalid attribute "${prop}" at path "${target.path}.${prop}"`,
|
|
306
|
+
);
|
|
307
|
+
} else if (
|
|
308
|
+
attribute === root &&
|
|
309
|
+
attribute.type === AttributeTypes.any
|
|
310
|
+
) {
|
|
311
|
+
// This function is only called if a nested property is called. If this attribute is ultimately the root, don't use the root's field name
|
|
312
|
+
field = prop;
|
|
313
|
+
} else {
|
|
314
|
+
field = attribute.field;
|
|
279
315
|
}
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
316
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
commit: () => builder.setName({}, attribute.name, attribute.field)
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
});
|
|
317
|
+
return {
|
|
318
|
+
root,
|
|
319
|
+
builder,
|
|
320
|
+
target: attribute,
|
|
321
|
+
commit: () => {
|
|
322
|
+
const paths = commit();
|
|
323
|
+
return builder.setName(paths, prop, field);
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
});
|
|
298
327
|
}
|
|
299
|
-
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
static buildAttributes(builder, attributes) {
|
|
333
|
+
let attr = {};
|
|
334
|
+
for (let [name, attribute] of Object.entries(attributes)) {
|
|
335
|
+
Object.defineProperty(attr, name, {
|
|
336
|
+
get: () => {
|
|
337
|
+
return AttributeOperationProxy.pathProxy(() => {
|
|
338
|
+
return {
|
|
339
|
+
root: attribute,
|
|
340
|
+
target: attribute,
|
|
341
|
+
builder,
|
|
342
|
+
commit: () =>
|
|
343
|
+
builder.setName({}, attribute.name, attribute.field),
|
|
344
|
+
};
|
|
345
|
+
});
|
|
346
|
+
},
|
|
347
|
+
});
|
|
300
348
|
}
|
|
349
|
+
return attr;
|
|
350
|
+
}
|
|
301
351
|
}
|
|
302
352
|
|
|
303
|
-
const FilterOperationNames = Object.keys(FilterOperations).reduce(
|
|
353
|
+
const FilterOperationNames = Object.keys(FilterOperations).reduce(
|
|
354
|
+
(ops, name) => {
|
|
304
355
|
ops[name] = name;
|
|
305
356
|
return ops;
|
|
306
|
-
},
|
|
357
|
+
},
|
|
358
|
+
{},
|
|
359
|
+
);
|
|
307
360
|
|
|
308
|
-
const UpdateOperationNames = Object.keys(UpdateOperations).reduce(
|
|
361
|
+
const UpdateOperationNames = Object.keys(UpdateOperations).reduce(
|
|
362
|
+
(ops, name) => {
|
|
309
363
|
ops[name] = name;
|
|
310
364
|
return ops;
|
|
311
|
-
},
|
|
365
|
+
},
|
|
366
|
+
{},
|
|
367
|
+
);
|
|
312
368
|
|
|
313
|
-
module.exports = {
|
|
369
|
+
module.exports = {
|
|
370
|
+
UpdateOperations,
|
|
371
|
+
UpdateOperationNames,
|
|
372
|
+
FilterOperations,
|
|
373
|
+
FilterOperationNames,
|
|
374
|
+
ExpressionState,
|
|
375
|
+
AttributeOperationProxy,
|
|
376
|
+
};
|