remult 0.25.0 → 0.25.1
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.
|
@@ -88,7 +88,7 @@ class PendingInStatements {
|
|
|
88
88
|
rel;
|
|
89
89
|
key;
|
|
90
90
|
options;
|
|
91
|
-
resolve() {
|
|
91
|
+
async resolve() {
|
|
92
92
|
const values = [...this.values.values()];
|
|
93
93
|
if (values.length == 1) {
|
|
94
94
|
this.rel.find(this.options).then(values[0].resolve, values[0].reject);
|
|
@@ -96,9 +96,19 @@ class PendingInStatements {
|
|
|
96
96
|
}
|
|
97
97
|
var op = { ...this.options };
|
|
98
98
|
op.where = { [this.key]: values.map((v) => v.value) };
|
|
99
|
-
|
|
99
|
+
op.limit = 1000;
|
|
100
|
+
op.page = 1;
|
|
101
|
+
let vals = [];
|
|
102
|
+
try {
|
|
103
|
+
while (true) {
|
|
104
|
+
const val = await this.rel.find(op);
|
|
105
|
+
vals.push(...val);
|
|
106
|
+
if (val.length < op.limit)
|
|
107
|
+
break;
|
|
108
|
+
op.page++;
|
|
109
|
+
}
|
|
100
110
|
for (const value of this.values.values()) {
|
|
101
|
-
value.resolve(
|
|
111
|
+
value.resolve(vals.filter((x) => {
|
|
102
112
|
const ref = getEntityRef(x);
|
|
103
113
|
const field = ref.fields.find(this.key);
|
|
104
114
|
const rel = getRelationInfo(field.metadata.options);
|
|
@@ -108,11 +118,12 @@ class PendingInStatements {
|
|
|
108
118
|
return value.value == val;
|
|
109
119
|
}));
|
|
110
120
|
}
|
|
111
|
-
}
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
112
123
|
for (const value of this.values.values()) {
|
|
113
124
|
value.reject(err);
|
|
114
125
|
}
|
|
115
|
-
}
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
find(where) {
|
|
118
129
|
const val = where[this.key];
|
|
@@ -70,3 +70,4 @@ remult.apiClient.url='localhost:3007/api
|
|
|
70
70
|
//[ ] V3 - all these fields will also appear in the where etc... in the typescript api - but we will not enforce them
|
|
71
71
|
//y2 - consider if field types should include validation in them by default (string,number that it's not NaN etc...) and if so, what message?
|
|
72
72
|
//y2 - should enforce integer - currently we probably round / truncate it
|
|
73
|
+
//p1 - adjust react tutorial to esm
|
package/package.json
CHANGED
|
@@ -144,56 +144,82 @@ var PendingInStatements = /** @class */ (function () {
|
|
|
144
144
|
this.values = new Map();
|
|
145
145
|
}
|
|
146
146
|
PendingInStatements.prototype.resolve = function () {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
147
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
148
|
+
var values, op, vals, val, _loop_1, _a, _b, value, err_1, _c, _d, value;
|
|
149
|
+
var _e, e_4, _f, e_5, _g;
|
|
150
|
+
var _this = this;
|
|
151
|
+
return tslib_1.__generator(this, function (_h) {
|
|
152
|
+
switch (_h.label) {
|
|
153
|
+
case 0:
|
|
154
|
+
values = tslib_1.__spreadArray([], tslib_1.__read(this.values.values()), false);
|
|
155
|
+
if (values.length == 1) {
|
|
156
|
+
this.rel.find(this.options).then(values[0].resolve, values[0].reject);
|
|
157
|
+
return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
op = tslib_1.__assign({}, this.options);
|
|
160
|
+
op.where = (_e = {}, _e[this.key] = values.map(function (v) { return v.value; }), _e);
|
|
161
|
+
op.limit = 1000;
|
|
162
|
+
op.page = 1;
|
|
163
|
+
vals = [];
|
|
164
|
+
_h.label = 1;
|
|
165
|
+
case 1:
|
|
166
|
+
_h.trys.push([1, 5, , 6]);
|
|
167
|
+
_h.label = 2;
|
|
168
|
+
case 2:
|
|
169
|
+
if (!true) return [3 /*break*/, 4];
|
|
170
|
+
return [4 /*yield*/, this.rel.find(op)];
|
|
171
|
+
case 3:
|
|
172
|
+
val = _h.sent();
|
|
173
|
+
vals.push.apply(vals, tslib_1.__spreadArray([], tslib_1.__read(val), false));
|
|
174
|
+
if (val.length < op.limit)
|
|
175
|
+
return [3 /*break*/, 4];
|
|
176
|
+
op.page++;
|
|
177
|
+
return [3 /*break*/, 2];
|
|
178
|
+
case 4:
|
|
179
|
+
_loop_1 = function (value) {
|
|
180
|
+
value.resolve(vals.filter(function (x) {
|
|
181
|
+
var ref = (0, getEntityRef_js_1.getEntityRef)(x);
|
|
182
|
+
var field = ref.fields.find(_this.key);
|
|
183
|
+
var rel = (0, relationInfoMember_js_1.getRelationInfo)(field.metadata.options);
|
|
184
|
+
var val = (rel === null || rel === void 0 ? void 0 : rel.type) === 'reference'
|
|
185
|
+
? field.getId()
|
|
186
|
+
: x[_this.key];
|
|
187
|
+
return value.value == val;
|
|
188
|
+
}));
|
|
189
|
+
};
|
|
190
|
+
try {
|
|
191
|
+
for (_a = tslib_1.__values(this.values.values()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
192
|
+
value = _b.value;
|
|
193
|
+
_loop_1(value);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
197
|
+
finally {
|
|
198
|
+
try {
|
|
199
|
+
if (_b && !_b.done && (_f = _a.return)) _f.call(_a);
|
|
200
|
+
}
|
|
201
|
+
finally { if (e_4) throw e_4.error; }
|
|
202
|
+
}
|
|
203
|
+
return [3 /*break*/, 6];
|
|
204
|
+
case 5:
|
|
205
|
+
err_1 = _h.sent();
|
|
206
|
+
try {
|
|
207
|
+
for (_c = tslib_1.__values(this.values.values()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
208
|
+
value = _d.value;
|
|
209
|
+
value.reject(err_1);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
213
|
+
finally {
|
|
214
|
+
try {
|
|
215
|
+
if (_d && !_d.done && (_g = _c.return)) _g.call(_c);
|
|
216
|
+
}
|
|
217
|
+
finally { if (e_5) throw e_5.error; }
|
|
218
|
+
}
|
|
219
|
+
return [3 /*break*/, 6];
|
|
220
|
+
case 6: return [2 /*return*/];
|
|
194
221
|
}
|
|
195
|
-
|
|
196
|
-
}
|
|
222
|
+
});
|
|
197
223
|
});
|
|
198
224
|
};
|
|
199
225
|
PendingInStatements.prototype.find = function (where) {
|
package/src/remult3/remult3.js
CHANGED
|
@@ -71,3 +71,4 @@ remult.apiClient.url='localhost:3007/api
|
|
|
71
71
|
//[ ] V3 - all these fields will also appear in the where etc... in the typescript api - but we will not enforce them
|
|
72
72
|
//y2 - consider if field types should include validation in them by default (string,number that it's not NaN etc...) and if so, what message?
|
|
73
73
|
//y2 - should enforce integer - currently we probably round / truncate it
|
|
74
|
+
//p1 - adjust react tutorial to esm
|