remult 0.26.8 → 0.26.10
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/esm/src/remult3/remult3.js +2 -8
- package/esm/src/sort.js +8 -21
- package/package.json +1 -1
- package/src/remult3/remult3.js +2 -8
- package/src/sort.js +28 -41
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//p1 - remove controller and instance backend methods from the regular backend method article
|
|
3
|
-
//p1 - describe entity
|
|
4
|
-
//p1 - fix includeInApi documentation - figure out why we can't see the see?
|
|
5
2
|
//y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
|
|
6
3
|
//y1 - In the esm version of our tutorial - the imports are automatically .ts and not .js in react and not in vue
|
|
7
|
-
//y1 - talk about insert with relations
|
|
8
4
|
//y1 - consider id to also support keyof (id:['company','index']) - had problem with | (keyof Partial<entityType>)[] & `entity`
|
|
9
|
-
//
|
|
5
|
+
//y2 - readonly key: keyof MembersOnly<entityType> & string
|
|
10
6
|
//y1 - talk about insert / update / delete with relations
|
|
11
7
|
/*
|
|
12
8
|
repo(Order).insert({},{
|
|
@@ -22,14 +18,12 @@ export {};
|
|
|
22
18
|
count:x.count()
|
|
23
19
|
}))
|
|
24
20
|
*/
|
|
25
|
-
//p1 - add documentation for bun sqlite
|
|
26
21
|
//p1 - consider upsert (where,set)
|
|
27
22
|
//p1 - wait a second to close stream
|
|
28
23
|
//p1 - prepare the createEntity discussion
|
|
29
|
-
//p1 - write active record article
|
|
30
24
|
//p1 - return error on connection error
|
|
31
|
-
//p1 - consider including the admin in the tutorial - and maybe even in the demo when we setup the api
|
|
32
25
|
//p1 - reconsider key typing to be keyof & string
|
|
26
|
+
//p1 - article on displayValue including it's definition for entities that is used in relations
|
|
33
27
|
//p2 -fix remult admin not to load the html into memory until used
|
|
34
28
|
//y2 - JY suggestion of having generate as part of the ensure schema - not sure
|
|
35
29
|
//y2 - currently for string fields we default for 255 in knex (which is their default) why not just use text (varchar max) - and only use exact length when one is provided?
|
package/esm/src/sort.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CompoundIdField } from './CompoundIdField.js';
|
|
2
1
|
import { getRelationFieldInfo } from './remult3/relationInfoMember.js';
|
|
3
2
|
/**
|
|
4
3
|
* The `Sort` class is used to describe sorting criteria for queries. It is mainly used internally,
|
|
@@ -140,17 +139,12 @@ export class Sort {
|
|
|
140
139
|
entityMetadata.options.defaultOrderBy)
|
|
141
140
|
orderBy = Sort.translateOrderByToSort(entityMetadata, entityMetadata.options.defaultOrderBy);
|
|
142
141
|
if (!orderBy)
|
|
143
|
-
orderBy = new Sort(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
orderBy.Segments.push({ field: field });
|
|
148
|
-
}
|
|
142
|
+
orderBy = new Sort();
|
|
143
|
+
for (const field of entityMetadata.idMetadata.fields) {
|
|
144
|
+
if (!orderBy.Segments.find((x) => x.field == field)) {
|
|
145
|
+
orderBy.Segments.push({ field: field });
|
|
149
146
|
}
|
|
150
147
|
}
|
|
151
|
-
else if (!orderBy.Segments.find((x) => x.field == entityMetadata.idMetadata.field)) {
|
|
152
|
-
orderBy.Segments.push({ field: entityMetadata.idMetadata.field });
|
|
153
|
-
}
|
|
154
148
|
return orderBy;
|
|
155
149
|
}
|
|
156
150
|
/**
|
|
@@ -166,21 +160,14 @@ export class Sort {
|
|
|
166
160
|
if (!orderBy || Object.keys(orderBy).length === 0)
|
|
167
161
|
orderBy = entityMetadata.options.defaultOrderBy;
|
|
168
162
|
if (!orderBy)
|
|
169
|
-
orderBy = {
|
|
170
|
-
[entityMetadata.idMetadata.field.key]: 'asc',
|
|
171
|
-
};
|
|
163
|
+
orderBy = {};
|
|
172
164
|
else
|
|
173
165
|
orderBy = { ...orderBy };
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
orderBy[field.key] = 'asc';
|
|
178
|
-
}
|
|
166
|
+
for (const field of entityMetadata.idMetadata.fields) {
|
|
167
|
+
if (!orderBy[field.key]) {
|
|
168
|
+
orderBy[field.key] = 'asc';
|
|
179
169
|
}
|
|
180
170
|
}
|
|
181
|
-
else if (!orderBy[entityMetadata.idMetadata.field.key]) {
|
|
182
|
-
orderBy[entityMetadata.idMetadata.field.key] = 'asc';
|
|
183
|
-
}
|
|
184
171
|
return orderBy;
|
|
185
172
|
}
|
|
186
173
|
}
|
package/package.json
CHANGED
package/src/remult3/remult3.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//p1 - remove controller and instance backend methods from the regular backend method article
|
|
4
|
-
//p1 - describe entity
|
|
5
|
-
//p1 - fix includeInApi documentation - figure out why we can't see the see?
|
|
6
3
|
//y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
|
|
7
4
|
//y1 - In the esm version of our tutorial - the imports are automatically .ts and not .js in react and not in vue
|
|
8
|
-
//y1 - talk about insert with relations
|
|
9
5
|
//y1 - consider id to also support keyof (id:['company','index']) - had problem with | (keyof Partial<entityType>)[] & `entity`
|
|
10
|
-
//
|
|
6
|
+
//y2 - readonly key: keyof MembersOnly<entityType> & string
|
|
11
7
|
//y1 - talk about insert / update / delete with relations
|
|
12
8
|
/*
|
|
13
9
|
repo(Order).insert({},{
|
|
@@ -23,14 +19,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
19
|
count:x.count()
|
|
24
20
|
}))
|
|
25
21
|
*/
|
|
26
|
-
//p1 - add documentation for bun sqlite
|
|
27
22
|
//p1 - consider upsert (where,set)
|
|
28
23
|
//p1 - wait a second to close stream
|
|
29
24
|
//p1 - prepare the createEntity discussion
|
|
30
|
-
//p1 - write active record article
|
|
31
25
|
//p1 - return error on connection error
|
|
32
|
-
//p1 - consider including the admin in the tutorial - and maybe even in the demo when we setup the api
|
|
33
26
|
//p1 - reconsider key typing to be keyof & string
|
|
27
|
+
//p1 - article on displayValue including it's definition for entities that is used in relations
|
|
34
28
|
//p2 -fix remult admin not to load the html into memory until used
|
|
35
29
|
//y2 - JY suggestion of having generate as part of the ensure schema - not sure
|
|
36
30
|
//y2 - currently for string fields we default for 255 in knex (which is their default) why not just use text (varchar max) - and only use exact length when one is provided?
|
package/src/sort.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Sort = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var CompoundIdField_js_1 = require("./CompoundIdField.js");
|
|
6
5
|
var relationInfoMember_js_1 = require("./remult3/relationInfoMember.js");
|
|
7
6
|
/**
|
|
8
7
|
* The `Sort` class is used to describe sorting criteria for queries. It is mainly used internally,
|
|
@@ -169,29 +168,24 @@ var Sort = /** @class */ (function () {
|
|
|
169
168
|
entityMetadata.options.defaultOrderBy)
|
|
170
169
|
orderBy = Sort.translateOrderByToSort(entityMetadata, entityMetadata.options.defaultOrderBy);
|
|
171
170
|
if (!orderBy)
|
|
172
|
-
orderBy = new Sort(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
orderBy.Segments.push({ field: field });
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
try {
|
|
180
|
-
for (var _b = tslib_1.__values(entityMetadata.idMetadata.field.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
181
|
-
var field = _c.value;
|
|
182
|
-
_loop_2(field);
|
|
183
|
-
}
|
|
171
|
+
orderBy = new Sort();
|
|
172
|
+
var _loop_2 = function (field) {
|
|
173
|
+
if (!orderBy.Segments.find(function (x) { return x.field == field; })) {
|
|
174
|
+
orderBy.Segments.push({ field: field });
|
|
184
175
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
finally { if (e_3) throw e_3.error; }
|
|
176
|
+
};
|
|
177
|
+
try {
|
|
178
|
+
for (var _b = tslib_1.__values(entityMetadata.idMetadata.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
179
|
+
var field = _c.value;
|
|
180
|
+
_loop_2(field);
|
|
191
181
|
}
|
|
192
182
|
}
|
|
193
|
-
|
|
194
|
-
|
|
183
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
184
|
+
finally {
|
|
185
|
+
try {
|
|
186
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
187
|
+
}
|
|
188
|
+
finally { if (e_3) throw e_3.error; }
|
|
195
189
|
}
|
|
196
190
|
return orderBy;
|
|
197
191
|
};
|
|
@@ -205,34 +199,27 @@ var Sort = /** @class */ (function () {
|
|
|
205
199
|
* @returns {EntityOrderBy<T>} An `EntityOrderBy` representing the unique order by criteria.
|
|
206
200
|
*/
|
|
207
201
|
Sort.createUniqueEntityOrderBy = function (entityMetadata, orderBy) {
|
|
208
|
-
var
|
|
202
|
+
var e_4, _a;
|
|
209
203
|
if (!orderBy || Object.keys(orderBy).length === 0)
|
|
210
204
|
orderBy = entityMetadata.options.defaultOrderBy;
|
|
211
205
|
if (!orderBy)
|
|
212
|
-
orderBy =
|
|
213
|
-
_a[entityMetadata.idMetadata.field.key] = 'asc',
|
|
214
|
-
_a);
|
|
206
|
+
orderBy = {};
|
|
215
207
|
else
|
|
216
208
|
orderBy = tslib_1.__assign({}, orderBy);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
orderBy[field.key] = 'asc';
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
227
|
-
finally {
|
|
228
|
-
try {
|
|
229
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
209
|
+
try {
|
|
210
|
+
for (var _b = tslib_1.__values(entityMetadata.idMetadata.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
211
|
+
var field = _c.value;
|
|
212
|
+
if (!orderBy[field.key]) {
|
|
213
|
+
orderBy[field.key] = 'asc';
|
|
230
214
|
}
|
|
231
|
-
finally { if (e_4) throw e_4.error; }
|
|
232
215
|
}
|
|
233
216
|
}
|
|
234
|
-
|
|
235
|
-
|
|
217
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
218
|
+
finally {
|
|
219
|
+
try {
|
|
220
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
221
|
+
}
|
|
222
|
+
finally { if (e_4) throw e_4.error; }
|
|
236
223
|
}
|
|
237
224
|
return orderBy;
|
|
238
225
|
};
|