remult 0.25.5-exp.6 → 0.25.5-exp.7
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/graphql.js +5 -2
- package/esm/src/remult3/remult3.js +10 -0
- package/graphql.js +5 -2
- package/package.json +1 -1
- package/src/remult3/remult3.js +10 -0
package/esm/graphql.js
CHANGED
|
@@ -413,6 +413,9 @@ export function remultGraphql(options) {
|
|
|
413
413
|
const refType = ri.toEntity;
|
|
414
414
|
ref = entities.find((i) => i.entityType === refType);
|
|
415
415
|
}
|
|
416
|
+
if (!ref) {
|
|
417
|
+
throw new Error(`Entity "${ri.toEntity.name}" that is used by the relation "${f.key}" in "${meta.entityType.name}" was not found in the 'entities' array.`);
|
|
418
|
+
}
|
|
416
419
|
notARealField = ri.type === 'toOne' || ri.type === 'toMany';
|
|
417
420
|
const refKey = ref.key;
|
|
418
421
|
switch (ri.type) {
|
|
@@ -448,11 +451,11 @@ export function remultGraphql(options) {
|
|
|
448
451
|
order: 10,
|
|
449
452
|
comment: `List all \`${getMetaType(meta)}\` of \`${refKey}\``,
|
|
450
453
|
});
|
|
451
|
-
currentType.query.resultProcessors.push((r) => {
|
|
454
|
+
currentType.query.resultProcessors.push((r, y) => {
|
|
452
455
|
r[f.key] = async (args, req, gqlInfo) => {
|
|
453
456
|
const remult = await options.getRemultFromRequest(req);
|
|
454
457
|
const myRepo = remult.repo(meta.entityType);
|
|
455
|
-
const item = myRepo.fromJson(
|
|
458
|
+
const item = myRepo.fromJson(y);
|
|
456
459
|
let relRepo = myRepo.relations(item)[f.key];
|
|
457
460
|
return handleRequestWithDataApiContextBasedOnRepo(relRepo, async (dApi, response, setResult, arg1, meta) => {
|
|
458
461
|
return await connectionImplementation(setResult, itemsKey, createResultPromise, dApi, upsertTypes(getMetaType(ref)), arg1, meta, totalCountKey);
|
|
@@ -2,6 +2,16 @@ export {};
|
|
|
2
2
|
//y1 - number default storage in knex is decimal and it by default has 8,2 - meaning only 999,999 - I think it should be way bigger than that. in firefly we do at least 18 - https://discord.com/channels/975754286384418847/1195162533447876658
|
|
3
3
|
//y1 - talk about the parameter issue with backend methods
|
|
4
4
|
//y1 - tried to upgrade vitest, nuxt tests are failing with loading uuid - sounds familiar?
|
|
5
|
+
//p1 - live query with include
|
|
6
|
+
//p1 - relation from order details to order gave a compound id info - and it is not true - same for the relation to product
|
|
7
|
+
//p1 - include admin in remult
|
|
8
|
+
//p1 - new row when there are relations, looks funny (see product)
|
|
9
|
+
//p1 - the + row in the bottom should extend to the full width
|
|
10
|
+
/*y2 -
|
|
11
|
+
@Fields.string<Category>({
|
|
12
|
+
allowApiUpdate: (c) => getEntityRef(c).isNew(),
|
|
13
|
+
})
|
|
14
|
+
Description = ""*/
|
|
5
15
|
//y2 - from the crm-demo(https://crm-demo.up.railway.app/deals), after editing a deal: - _updateEntityBasedOnApi
|
|
6
16
|
//y2 - Backend methods are transactions, it's not intuitive and maybe should be optional / opt in
|
|
7
17
|
//y2 - how to run a transaction as a user
|
package/graphql.js
CHANGED
|
@@ -505,6 +505,9 @@ function remultGraphql(options) {
|
|
|
505
505
|
var refType_1 = ri.toEntity;
|
|
506
506
|
ref = entities.find(function (i) { return i.entityType === refType_1; });
|
|
507
507
|
}
|
|
508
|
+
if (!ref) {
|
|
509
|
+
throw new Error("Entity \"".concat(ri.toEntity.name, "\" that is used by the relation \"").concat(f.key, "\" in \"").concat(meta.entityType.name, "\" was not found in the 'entities' array."));
|
|
510
|
+
}
|
|
508
511
|
notARealField = ri.type === 'toOne' || ri.type === 'toMany';
|
|
509
512
|
var refKey = ref.key;
|
|
510
513
|
switch (ri.type) {
|
|
@@ -557,7 +560,7 @@ function remultGraphql(options) {
|
|
|
557
560
|
order: 10,
|
|
558
561
|
comment: "List all `".concat(getMetaType(meta), "` of `").concat(refKey, "`"),
|
|
559
562
|
});
|
|
560
|
-
currentType.query.resultProcessors.push(function (r) {
|
|
563
|
+
currentType.query.resultProcessors.push(function (r, y) {
|
|
561
564
|
r[f.key] = function (args, req, gqlInfo) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
562
565
|
var remult, myRepo, item, relRepo;
|
|
563
566
|
var _this = this;
|
|
@@ -567,7 +570,7 @@ function remultGraphql(options) {
|
|
|
567
570
|
case 1:
|
|
568
571
|
remult = _a.sent();
|
|
569
572
|
myRepo = remult.repo(meta.entityType);
|
|
570
|
-
item = myRepo.fromJson(
|
|
573
|
+
item = myRepo.fromJson(y);
|
|
571
574
|
relRepo = myRepo.relations(item)[f.key];
|
|
572
575
|
return [2 /*return*/, handleRequestWithDataApiContextBasedOnRepo_1(relRepo, function (dApi, response, setResult, arg1, meta) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
573
576
|
return tslib_1.__generator(this, function (_a) {
|
package/package.json
CHANGED
package/src/remult3/remult3.js
CHANGED
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
//y1 - number default storage in knex is decimal and it by default has 8,2 - meaning only 999,999 - I think it should be way bigger than that. in firefly we do at least 18 - https://discord.com/channels/975754286384418847/1195162533447876658
|
|
4
4
|
//y1 - talk about the parameter issue with backend methods
|
|
5
5
|
//y1 - tried to upgrade vitest, nuxt tests are failing with loading uuid - sounds familiar?
|
|
6
|
+
//p1 - live query with include
|
|
7
|
+
//p1 - relation from order details to order gave a compound id info - and it is not true - same for the relation to product
|
|
8
|
+
//p1 - include admin in remult
|
|
9
|
+
//p1 - new row when there are relations, looks funny (see product)
|
|
10
|
+
//p1 - the + row in the bottom should extend to the full width
|
|
11
|
+
/*y2 -
|
|
12
|
+
@Fields.string<Category>({
|
|
13
|
+
allowApiUpdate: (c) => getEntityRef(c).isNew(),
|
|
14
|
+
})
|
|
15
|
+
Description = ""*/
|
|
6
16
|
//y2 - from the crm-demo(https://crm-demo.up.railway.app/deals), after editing a deal: - _updateEntityBasedOnApi
|
|
7
17
|
//y2 - Backend methods are transactions, it's not intuitive and maybe should be optional / opt in
|
|
8
18
|
//y2 - how to run a transaction as a user
|