remult 0.25.3 → 0.25.5-exp.0

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 CHANGED
@@ -6,7 +6,7 @@ const andImplementation = false;
6
6
  let _removeComments = false;
7
7
  export function remultGraphql(options) {
8
8
  if (!options.getRemultFromRequest) {
9
- options.getRemultFromRequest = () => remult;
9
+ options.getRemultFromRequest = async () => remult;
10
10
  }
11
11
  const { removeComments } = {
12
12
  removeComments: false,
@@ -153,7 +153,7 @@ export function remultGraphql(options) {
153
153
  };
154
154
  const handleRequestWithDataApiContext = (work) => {
155
155
  return createResultPromise(async (response, setResult, arg1, req) => {
156
- const remult = options.getRemultFromRequest(req);
156
+ const remult = await options.getRemultFromRequest(req);
157
157
  const repo = remult.repo(meta.entityType);
158
158
  const dApi = new DataApi(repo, remult);
159
159
  await work(dApi, response, setResult, arg1, meta);
@@ -205,68 +205,7 @@ export function remultGraphql(options) {
205
205
  }, setResult, arg1, req);
206
206
  });
207
207
  };
208
- const queryArgsConnection = [
209
- {
210
- key: 'limit',
211
- value: 'Int',
212
- comment: `
213
- For **page by page** pagination.
214
- Limit the number of result.
215
- _Side note: \`Math.ceil(totalCount / limit)\` to determine how many pages there are._`,
216
- },
217
- {
218
- key: 'page',
219
- value: 'Int',
220
- comment: `
221
- For **page by page** pagination.
222
- Select a dedicated page.`,
223
- },
224
- {
225
- key: 'offset',
226
- value: 'Int',
227
- comment: `
228
- For **page by page** pagination.
229
- Set the offset needed.
230
- _Side node: if \`page\` arg is set, \`offset\` will be ignored._`,
231
- },
232
- {
233
- key: 'orderBy',
234
- value: `${key}OrderBy`,
235
- comment: `Remult sorting options`,
236
- },
237
- {
238
- key: 'where',
239
- value: `${key}Where`,
240
- comment: `Remult filtering options`,
241
- },
242
- ];
243
- if (v2ConnectionAndPagination) {
244
- queryArgsConnection.push({
245
- key: 'first',
246
- value: 'Int',
247
- comment: `
248
- For **forward cursor** pagination
249
- Takes the \`first\`: \`n\` elements from the list.`,
250
- }, {
251
- key: 'after',
252
- value: 'String',
253
- comment: `
254
- For **forward cursor** pagination
255
- \`after\` this \`cursor\`.`,
256
- }, {
257
- key: 'last',
258
- value: 'Int',
259
- comment: `
260
- For **backward cursor** pagination
261
- Takes the \`last\`: \`n\` elements from the list.`,
262
- }, {
263
- key: 'before',
264
- value: 'String',
265
- comment: `
266
- For **backward cursor** pagination
267
- \`before\` this \`cursor\`.`,
268
- });
269
- }
208
+ const queryArgsConnection = getQueryArgsConnection(key);
270
209
  const getSingleEntityKey = toCamelCase(getMetaType(meta));
271
210
  root_query.fields.push({
272
211
  key: getSingleEntityKey,
@@ -458,9 +397,6 @@ _Side node: if \`page\` arg is set, \`offset\` will be ignored._`,
458
397
  for (const f of meta.fields) {
459
398
  const ri = getRelationInfo(f.options);
460
399
  // let's not consider toMany relations for now
461
- if (ri?.type === 'toMany') {
462
- break;
463
- }
464
400
  if (f.options.includeInApi === false)
465
401
  continue;
466
402
  let type = 'String';
@@ -478,11 +414,66 @@ _Side node: if \`page\` arg is set, \`offset\` will be ignored._`,
478
414
  }
479
415
  break;
480
416
  }
481
- const ref = entities.find((i) => i.entityType === f.valueType);
482
417
  currentType.query.resultProcessors.push((r) => {
483
418
  r[nodeIdKey] = () => getMetaType(meta) + ':' + meta.idMetadata.getId(r);
484
419
  });
485
- if (ref !== undefined) {
420
+ let ref = entities.find((i) => i.entityType === f.valueType);
421
+ let notARealField = false;
422
+ if (ri) {
423
+ {
424
+ const refType = ri.toType();
425
+ ref = entities.find((i) => i.entityType === refType);
426
+ }
427
+ notARealField = ri.type === 'toOne' || ri.type === 'toMany';
428
+ const refKey = ref.key;
429
+ switch (ri.type) {
430
+ case 'reference':
431
+ case 'toOne':
432
+ currentType.fields.push({
433
+ key: f.key,
434
+ value: `${getMetaType(ref)}${f.allowNull ? '' : '!'}`,
435
+ comment: f.caption,
436
+ });
437
+ currentType.query.resultProcessors.push((r) => {
438
+ const val = r[ri.type == 'reference' ? f.key : f.options.field]; //p1 - fix
439
+ if (val === null || val === undefined)
440
+ return null;
441
+ r[f.key] = async (args, req, gqlInfo) => {
442
+ const queryResult = await (await root[refKey]({
443
+ ...args.where,
444
+ where: { id: { eq: val } },
445
+ options: { limit: 1 },
446
+ }, req, gqlInfo)).items();
447
+ if (queryResult.length > 0)
448
+ return queryResult[0];
449
+ return null;
450
+ };
451
+ });
452
+ break;
453
+ case 'toMany':
454
+ // will do: Category.tasks (actually: Category.tasksOfcategory & tasksOfcategory2)
455
+ currentType.fields.push({
456
+ key: f.key,
457
+ args: getQueryArgsConnection(refKey),
458
+ value: `${getMetaType(ref)}Connection`,
459
+ order: 10,
460
+ comment: `List all \`${getMetaType(meta)}\` of \`${refKey}\``,
461
+ });
462
+ currentType.query.resultProcessors.push((r) => {
463
+ const val = r.id;
464
+ r[f.key] = async (args, req, gqlInfo) => {
465
+ return await root[ref.key]({
466
+ where: {
467
+ ...args.where,
468
+ [f.options.field /*//p1 to fix*/]: { eq: val },
469
+ },
470
+ options: { ...args.limit, ...args.page, ...args.orderBy },
471
+ }, req, gqlInfo);
472
+ };
473
+ });
474
+ }
475
+ }
476
+ else if (ref !== undefined) {
486
477
  // will do: Task.category
487
478
  currentType.fields.push({
488
479
  key: f.key,
@@ -538,10 +529,10 @@ _Side node: if \`page\` arg is set, \`offset\` will be ignored._`,
538
529
  // helper
539
530
  const it_is_not_at_ref = ref === undefined;
540
531
  // where
541
- if (it_is_not_at_ref && !f.isServerExpression) {
532
+ if (it_is_not_at_ref && !f.isServerExpression && !notARealField) {
542
533
  whereTypeFields.push(`${f.key}: Where${type}${f.allowNull ? 'Nullable' : ''}`);
543
534
  }
544
- const includeInUpdateOrInsert = f.options.allowApiUpdate !== false;
535
+ const includeInUpdateOrInsert = f.options.allowApiUpdate !== false && !notARealField;
545
536
  const updateType = it_is_not_at_ref ? type : 'ID';
546
537
  if (includeInUpdateOrInsert) {
547
538
  // create
@@ -687,6 +678,71 @@ _Side node: if \`page\` arg is set, \`offset\` will be ignored._`,
687
678
  `,
688
679
  };
689
680
  }
681
+ function getQueryArgsConnection(key) {
682
+ const queryArgsConnection = [
683
+ {
684
+ key: 'limit',
685
+ value: 'Int',
686
+ comment: `
687
+ For **page by page** pagination.
688
+ Limit the number of result.
689
+ _Side note: \`Math.ceil(totalCount / limit)\` to determine how many pages there are._`,
690
+ },
691
+ {
692
+ key: 'page',
693
+ value: 'Int',
694
+ comment: `
695
+ For **page by page** pagination.
696
+ Select a dedicated page.`,
697
+ },
698
+ {
699
+ key: 'offset',
700
+ value: 'Int',
701
+ comment: `
702
+ For **page by page** pagination.
703
+ Set the offset needed.
704
+ _Side node: if \`page\` arg is set, \`offset\` will be ignored._`,
705
+ },
706
+ {
707
+ key: 'orderBy',
708
+ value: `${key}OrderBy`,
709
+ comment: `Remult sorting options`,
710
+ },
711
+ {
712
+ key: 'where',
713
+ value: `${key}Where`,
714
+ comment: `Remult filtering options`,
715
+ },
716
+ ];
717
+ if (v2ConnectionAndPagination) {
718
+ queryArgsConnection.push({
719
+ key: 'first',
720
+ value: 'Int',
721
+ comment: `
722
+ For **forward cursor** pagination
723
+ Takes the \`first\`: \`n\` elements from the list.`,
724
+ }, {
725
+ key: 'after',
726
+ value: 'String',
727
+ comment: `
728
+ For **forward cursor** pagination
729
+ \`after\` this \`cursor\`.`,
730
+ }, {
731
+ key: 'last',
732
+ value: 'Int',
733
+ comment: `
734
+ For **backward cursor** pagination
735
+ Takes the \`last\`: \`n\` elements from the list.`,
736
+ }, {
737
+ key: 'before',
738
+ value: 'String',
739
+ comment: `
740
+ For **backward cursor** pagination
741
+ \`before\` this \`cursor\`.`,
742
+ });
743
+ }
744
+ return queryArgsConnection;
745
+ }
690
746
  // For cursor pagination (v2)
691
747
  // function checkPaginationArgs(args: any) {
692
748
  // let paginationPage = !!args.limit ? 1 : 0
@@ -1639,7 +1639,7 @@ export class FieldRefImplementation {
1639
1639
  set error(value) {
1640
1640
  self.error = value;
1641
1641
  },
1642
- isNew: self.rowBase.isNewRow,
1642
+ isNew: this.entityRef?.isNew(),
1643
1643
  load: () => self.load(),
1644
1644
  metadata: self.metadata,
1645
1645
  originalValue: self.originalValue,
@@ -17,6 +17,7 @@ export {};
17
17
  //p2 - allow find options preprocessor for api calls, to use for authorization
18
18
  //p1 - write doc about controlling updates of rows...
19
19
  //p1 - need a way to extract the fields from the relation - for generating relation based sql
20
+ //p1 - when doing this, work on graphql relation with fields not just field
20
21
  //p1 - add docs for apply changes
21
22
  //p1 - when subscribe is forbidden - the query still runs after the renew process
22
23
  //p1 - 'update tasks set where id = $1
@@ -43,6 +44,10 @@ remult.apiClient.url='localhost:3007/api
43
44
 
44
45
 
45
46
  */
47
+ //p1 - investigate angular starter kit init request error
48
+ //p1 - fix angular starter kit await set password
49
+ //p1- fix angular starter kit with value list in uitoolsservice
50
+ //p1 - fix angular starter kit to latest version as well
46
51
  //p1 -check if checouknt doesn't respect allow read (I think)
47
52
  //p1 - fix multiple instances of remult: the defaultRemult and async local hook - and columnsOfType - all can be tests with a vite project loading `remult-admin`
48
53
  //p1 - crm demo graphql error
package/graphql.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Remult } from './index.js';
3
3
  export declare function remultGraphql(options: {
4
4
  removeComments?: boolean;
5
5
  entities: ClassType<any>[];
6
- getRemultFromRequest?: (req: any) => Remult;
6
+ getRemultFromRequest?: (req: any) => Promise<Remult>;
7
7
  }): {
8
8
  resolvers: {
9
9
  Query: Record<string, unknown>;
package/graphql.js CHANGED
@@ -13,7 +13,9 @@ function remultGraphql(options) {
13
13
  var _this = this;
14
14
  var _f, _g;
15
15
  if (!options.getRemultFromRequest) {
16
- options.getRemultFromRequest = function () { return index_js_1.remult; };
16
+ options.getRemultFromRequest = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
17
+ return [2 /*return*/, index_js_1.remult];
18
+ }); }); };
17
19
  }
18
20
  var removeComments = tslib_1.__assign({ removeComments: false }, options).removeComments;
19
21
  if (removeComments) {
@@ -206,12 +208,13 @@ function remultGraphql(options) {
206
208
  var remult, repo, dApi;
207
209
  return tslib_1.__generator(this, function (_a) {
208
210
  switch (_a.label) {
209
- case 0:
210
- remult = options.getRemultFromRequest(req);
211
+ case 0: return [4 /*yield*/, options.getRemultFromRequest(req)];
212
+ case 1:
213
+ remult = _a.sent();
211
214
  repo = remult.repo(meta.entityType);
212
215
  dApi = new data_api_js_1.DataApi(repo, remult);
213
216
  return [4 /*yield*/, work(dApi, response, setResult, arg1, meta)];
214
- case 1:
217
+ case 2:
215
218
  _a.sent();
216
219
  return [2 /*return*/];
217
220
  }
@@ -259,52 +262,7 @@ function remultGraphql(options) {
259
262
  });
260
263
  }); });
261
264
  };
262
- var queryArgsConnection = [
263
- {
264
- key: 'limit',
265
- value: 'Int',
266
- comment: "\nFor **page by page** pagination.\nLimit the number of result. \n_Side note: `Math.ceil(totalCount / limit)` to determine how many pages there are._",
267
- },
268
- {
269
- key: 'page',
270
- value: 'Int',
271
- comment: "\nFor **page by page** pagination.\nSelect a dedicated page.",
272
- },
273
- {
274
- key: 'offset',
275
- value: 'Int',
276
- comment: "\nFor **page by page** pagination.\nSet the offset needed.\n_Side node: if `page` arg is set, `offset` will be ignored._",
277
- },
278
- {
279
- key: 'orderBy',
280
- value: "".concat(key, "OrderBy"),
281
- comment: "Remult sorting options",
282
- },
283
- {
284
- key: 'where',
285
- value: "".concat(key, "Where"),
286
- comment: "Remult filtering options",
287
- },
288
- ];
289
- if (v2ConnectionAndPagination) {
290
- queryArgsConnection.push({
291
- key: 'first',
292
- value: 'Int',
293
- comment: "\n For **forward cursor** pagination\n Takes the `first`: `n` elements from the list.",
294
- }, {
295
- key: 'after',
296
- value: 'String',
297
- comment: "\n For **forward cursor** pagination\n `after` this `cursor`.",
298
- }, {
299
- key: 'last',
300
- value: 'Int',
301
- comment: "\n For **backward cursor** pagination\n Takes the `last`: `n` elements from the list.",
302
- }, {
303
- key: 'before',
304
- value: 'String',
305
- comment: "\n For **backward cursor** pagination\n `before` this `cursor`.",
306
- });
307
- }
265
+ var queryArgsConnection = getQueryArgsConnection(key);
308
266
  var getSingleEntityKey_1 = toCamelCase(getMetaType(meta));
309
267
  root_query.fields.push({
310
268
  key: getSingleEntityKey_1,
@@ -530,9 +488,6 @@ function remultGraphql(options) {
530
488
  var _loop_2 = function (f) {
531
489
  var ri = (0, internals_js_1.getRelationInfo)(f.options);
532
490
  // let's not consider toMany relations for now
533
- if ((ri === null || ri === void 0 ? void 0 : ri.type) === 'toMany') {
534
- return "break";
535
- }
536
491
  if (f.options.includeInApi === false)
537
492
  return "continue";
538
493
  var type = 'String';
@@ -550,20 +505,82 @@ function remultGraphql(options) {
550
505
  }
551
506
  break;
552
507
  }
553
- var ref = entities.find(function (i) { return i.entityType === f.valueType; });
554
508
  currentType.query.resultProcessors.push(function (r) {
555
509
  r[nodeIdKey] = function () {
556
510
  return getMetaType(meta) + ':' + meta.idMetadata.getId(r);
557
511
  };
558
512
  });
559
- if (ref !== undefined) {
513
+ var ref = entities.find(function (i) { return i.entityType === f.valueType; });
514
+ var notARealField = false;
515
+ if (ri) {
516
+ {
517
+ var refType_1 = ri.toType();
518
+ ref = entities.find(function (i) { return i.entityType === refType_1; });
519
+ }
520
+ notARealField = ri.type === 'toOne' || ri.type === 'toMany';
521
+ var refKey_1 = ref.key;
522
+ switch (ri.type) {
523
+ case 'reference':
524
+ case 'toOne':
525
+ currentType.fields.push({
526
+ key: f.key,
527
+ value: "".concat(getMetaType(ref)).concat(f.allowNull ? '' : '!'),
528
+ comment: f.caption,
529
+ });
530
+ currentType.query.resultProcessors.push(function (r) {
531
+ var val = r[ri.type == 'reference' ? f.key : f.options.field]; //p1 - fix
532
+ if (val === null || val === undefined)
533
+ return null;
534
+ r[f.key] = function (args, req, gqlInfo) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
535
+ var queryResult;
536
+ return tslib_1.__generator(this, function (_a) {
537
+ switch (_a.label) {
538
+ case 0: return [4 /*yield*/, root[refKey_1](tslib_1.__assign(tslib_1.__assign({}, args.where), { where: { id: { eq: val } }, options: { limit: 1 } }), req, gqlInfo)];
539
+ case 1: return [4 /*yield*/, (_a.sent()).items()];
540
+ case 2:
541
+ queryResult = _a.sent();
542
+ if (queryResult.length > 0)
543
+ return [2 /*return*/, queryResult[0]];
544
+ return [2 /*return*/, null];
545
+ }
546
+ });
547
+ }); };
548
+ });
549
+ break;
550
+ case 'toMany':
551
+ // will do: Category.tasks (actually: Category.tasksOfcategory & tasksOfcategory2)
552
+ currentType.fields.push({
553
+ key: f.key,
554
+ args: getQueryArgsConnection(refKey_1),
555
+ value: "".concat(getMetaType(ref), "Connection"),
556
+ order: 10,
557
+ comment: "List all `".concat(getMetaType(meta), "` of `").concat(refKey_1, "`"),
558
+ });
559
+ currentType.query.resultProcessors.push(function (r) {
560
+ var val = r.id;
561
+ r[f.key] = function (args, req, gqlInfo) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
562
+ var _a;
563
+ return tslib_1.__generator(this, function (_b) {
564
+ switch (_b.label) {
565
+ case 0: return [4 /*yield*/, root[ref.key]({
566
+ where: tslib_1.__assign(tslib_1.__assign({}, args.where), (_a = {}, _a[f.options.field /*//p1 to fix*/] = { eq: val }, _a)),
567
+ options: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, args.limit), args.page), args.orderBy),
568
+ }, req, gqlInfo)];
569
+ case 1: return [2 /*return*/, _b.sent()];
570
+ }
571
+ });
572
+ }); };
573
+ });
574
+ }
575
+ }
576
+ else if (ref !== undefined) {
560
577
  // will do: Task.category
561
578
  currentType.fields.push({
562
579
  key: f.key,
563
580
  value: "".concat(getMetaType(ref)).concat(f.allowNull ? '' : '!'),
564
581
  comment: f.caption,
565
582
  });
566
- var refKey_1 = ref.key;
583
+ var refKey_2 = ref.key;
567
584
  currentType.query.resultProcessors.push(function (r) {
568
585
  var val = r[f.key];
569
586
  if (val === null || val === undefined)
@@ -572,7 +589,7 @@ function remultGraphql(options) {
572
589
  var queryResult;
573
590
  return tslib_1.__generator(this, function (_a) {
574
591
  switch (_a.label) {
575
- case 0: return [4 /*yield*/, root[refKey_1](tslib_1.__assign(tslib_1.__assign({}, args.where), { where: { id: { eq: val } }, options: { limit: 1 } }), req, gqlInfo)];
592
+ case 0: return [4 /*yield*/, root[refKey_2](tslib_1.__assign(tslib_1.__assign({}, args.where), { where: { id: { eq: val } }, options: { limit: 1 } }), req, gqlInfo)];
576
593
  case 1: return [4 /*yield*/, (_a.sent()).items()];
577
594
  case 2:
578
595
  queryResult = _a.sent();
@@ -591,7 +608,7 @@ function remultGraphql(options) {
591
608
  args: queryArgsConnection,
592
609
  value: connectionKey,
593
610
  order: 10,
594
- comment: "List all `".concat(getMetaType(meta), "` of `").concat(refKey_1, "`"),
611
+ comment: "List all `".concat(getMetaType(meta), "` of `").concat(refKey_2, "`"),
595
612
  });
596
613
  refT.query.resultProcessors.push(function (r) {
597
614
  var val = r.id;
@@ -622,10 +639,10 @@ function remultGraphql(options) {
622
639
  // helper
623
640
  var it_is_not_at_ref = ref === undefined;
624
641
  // where
625
- if (it_is_not_at_ref && !f.isServerExpression) {
642
+ if (it_is_not_at_ref && !f.isServerExpression && !notARealField) {
626
643
  whereTypeFields.push("".concat(f.key, ": Where").concat(type).concat(f.allowNull ? 'Nullable' : ''));
627
644
  }
628
- var includeInUpdateOrInsert = f.options.allowApiUpdate !== false;
645
+ var includeInUpdateOrInsert = f.options.allowApiUpdate !== false && !notARealField;
629
646
  var updateType = it_is_not_at_ref ? type : 'ID';
630
647
  if (includeInUpdateOrInsert) {
631
648
  // create
@@ -645,9 +662,7 @@ function remultGraphql(options) {
645
662
  try {
646
663
  for (var _s = (e_6 = void 0, tslib_1.__values(meta.fields)), _t = _s.next(); !_t.done; _t = _s.next()) {
647
664
  var f = _t.value;
648
- var state_1 = _loop_2(f);
649
- if (state_1 === "break")
650
- break;
665
+ _loop_2(f);
651
666
  }
652
667
  }
653
668
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
@@ -808,6 +823,55 @@ function remultGraphql(options) {
808
823
  };
809
824
  }
810
825
  exports.remultGraphql = remultGraphql;
826
+ function getQueryArgsConnection(key) {
827
+ var queryArgsConnection = [
828
+ {
829
+ key: 'limit',
830
+ value: 'Int',
831
+ comment: "\nFor **page by page** pagination.\nLimit the number of result. \n_Side note: `Math.ceil(totalCount / limit)` to determine how many pages there are._",
832
+ },
833
+ {
834
+ key: 'page',
835
+ value: 'Int',
836
+ comment: "\nFor **page by page** pagination.\nSelect a dedicated page.",
837
+ },
838
+ {
839
+ key: 'offset',
840
+ value: 'Int',
841
+ comment: "\nFor **page by page** pagination.\nSet the offset needed.\n_Side node: if `page` arg is set, `offset` will be ignored._",
842
+ },
843
+ {
844
+ key: 'orderBy',
845
+ value: "".concat(key, "OrderBy"),
846
+ comment: "Remult sorting options",
847
+ },
848
+ {
849
+ key: 'where',
850
+ value: "".concat(key, "Where"),
851
+ comment: "Remult filtering options",
852
+ },
853
+ ];
854
+ if (v2ConnectionAndPagination) {
855
+ queryArgsConnection.push({
856
+ key: 'first',
857
+ value: 'Int',
858
+ comment: "\n For **forward cursor** pagination\n Takes the `first`: `n` elements from the list.",
859
+ }, {
860
+ key: 'after',
861
+ value: 'String',
862
+ comment: "\n For **forward cursor** pagination\n `after` this `cursor`.",
863
+ }, {
864
+ key: 'last',
865
+ value: 'Int',
866
+ comment: "\n For **backward cursor** pagination\n Takes the `last`: `n` elements from the list.",
867
+ }, {
868
+ key: 'before',
869
+ value: 'String',
870
+ comment: "\n For **backward cursor** pagination\n `before` this `cursor`.",
871
+ });
872
+ }
873
+ return queryArgsConnection;
874
+ }
811
875
  // For cursor pagination (v2)
812
876
  // function checkPaginationArgs(args: any) {
813
877
  // let paginationPage = !!args.limit ? 1 : 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.25.3",
3
+ "version": "0.25.5-exp.0",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -2679,14 +2679,15 @@ var FieldRefImplementation = /** @class */ (function () {
2679
2679
  return (JSON.stringify(this.metadata.valueConverter.toJson(this.rowBase.originalValues[this.metadata.key])) != JSON.stringify(this.metadata.valueConverter.toJson(val)));
2680
2680
  };
2681
2681
  FieldRefImplementation.prototype.__performValidation = function () {
2682
+ var _a;
2682
2683
  return tslib_1.__awaiter(this, void 0, void 0, function () {
2683
- var processValidation, self_1, event_1, _a, _b, v, _c, e_41_1, _d, error_1;
2684
- var e_41, _e;
2684
+ var processValidation, self_1, event_1, _b, _c, v, _d, e_41_1, _e, error_1;
2685
+ var e_41, _f;
2685
2686
  var _this = this;
2686
- return tslib_1.__generator(this, function (_f) {
2687
- switch (_f.label) {
2687
+ return tslib_1.__generator(this, function (_g) {
2688
+ switch (_g.label) {
2688
2689
  case 0:
2689
- _f.trys.push([0, 12, , 13]);
2690
+ _g.trys.push([0, 12, , 13]);
2690
2691
  processValidation = function (result) {
2691
2692
  if (result !== true && result !== undefined && !_this.error) {
2692
2693
  if (typeof result === 'string' && result.length > 0)
@@ -2705,7 +2706,7 @@ var FieldRefImplementation = /** @class */ (function () {
2705
2706
  set error(value) {
2706
2707
  self_1.error = value;
2707
2708
  },
2708
- isNew: self_1.rowBase.isNewRow,
2709
+ isNew: (_a = this.entityRef) === null || _a === void 0 ? void 0 : _a.isNew(),
2709
2710
  load: function () { return self_1.load(); },
2710
2711
  metadata: self_1.metadata,
2711
2712
  originalValue: self_1.originalValue,
@@ -2716,44 +2717,44 @@ var FieldRefImplementation = /** @class */ (function () {
2716
2717
  isBackend: function () { var _a, _b, _c; return !((_c = (_b = (_a = self_1.rowBase) === null || _a === void 0 ? void 0 : _a.remult) === null || _b === void 0 ? void 0 : _b.dataProvider) === null || _c === void 0 ? void 0 : _c.isProxy); },
2717
2718
  };
2718
2719
  if (!Array.isArray(this.settings.validate)) return [3 /*break*/, 9];
2719
- _f.label = 1;
2720
+ _g.label = 1;
2720
2721
  case 1:
2721
- _f.trys.push([1, 6, 7, 8]);
2722
- _a = tslib_1.__values(this.settings.validate), _b = _a.next();
2723
- _f.label = 2;
2722
+ _g.trys.push([1, 6, 7, 8]);
2723
+ _b = tslib_1.__values(this.settings.validate), _c = _b.next();
2724
+ _g.label = 2;
2724
2725
  case 2:
2725
- if (!!_b.done) return [3 /*break*/, 5];
2726
- v = _b.value;
2727
- _c = processValidation;
2726
+ if (!!_c.done) return [3 /*break*/, 5];
2727
+ v = _c.value;
2728
+ _d = processValidation;
2728
2729
  return [4 /*yield*/, v(this.container, event_1)];
2729
2730
  case 3:
2730
- _c.apply(void 0, [_f.sent()]);
2731
- _f.label = 4;
2731
+ _d.apply(void 0, [_g.sent()]);
2732
+ _g.label = 4;
2732
2733
  case 4:
2733
- _b = _a.next();
2734
+ _c = _b.next();
2734
2735
  return [3 /*break*/, 2];
2735
2736
  case 5: return [3 /*break*/, 8];
2736
2737
  case 6:
2737
- e_41_1 = _f.sent();
2738
+ e_41_1 = _g.sent();
2738
2739
  e_41 = { error: e_41_1 };
2739
2740
  return [3 /*break*/, 8];
2740
2741
  case 7:
2741
2742
  try {
2742
- if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
2743
+ if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
2743
2744
  }
2744
2745
  finally { if (e_41) throw e_41.error; }
2745
2746
  return [7 /*endfinally*/];
2746
2747
  case 8: return [3 /*break*/, 11];
2747
2748
  case 9:
2748
2749
  if (!(typeof this.settings.validate === 'function')) return [3 /*break*/, 11];
2749
- _d = processValidation;
2750
+ _e = processValidation;
2750
2751
  return [4 /*yield*/, this.settings.validate(this.container, event_1)];
2751
2752
  case 10:
2752
- _d.apply(void 0, [_f.sent()]);
2753
- _f.label = 11;
2753
+ _e.apply(void 0, [_g.sent()]);
2754
+ _g.label = 11;
2754
2755
  case 11: return [3 /*break*/, 13];
2755
2756
  case 12:
2756
- error_1 = _f.sent();
2757
+ error_1 = _g.sent();
2757
2758
  if (typeof error_1 === 'string')
2758
2759
  this.error = error_1;
2759
2760
  else
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  //p2 - allow find options preprocessor for api calls, to use for authorization
19
19
  //p1 - write doc about controlling updates of rows...
20
20
  //p1 - need a way to extract the fields from the relation - for generating relation based sql
21
+ //p1 - when doing this, work on graphql relation with fields not just field
21
22
  //p1 - add docs for apply changes
22
23
  //p1 - when subscribe is forbidden - the query still runs after the renew process
23
24
  //p1 - 'update tasks set where id = $1
@@ -44,6 +45,10 @@ remult.apiClient.url='localhost:3007/api
44
45
 
45
46
 
46
47
  */
48
+ //p1 - investigate angular starter kit init request error
49
+ //p1 - fix angular starter kit await set password
50
+ //p1- fix angular starter kit with value list in uitoolsservice
51
+ //p1 - fix angular starter kit to latest version as well
47
52
  //p1 -check if checouknt doesn't respect allow read (I think)
48
53
  //p1 - fix multiple instances of remult: the defaultRemult and async local hook - and columnsOfType - all can be tests with a vite project loading `remult-admin`
49
54
  //p1 - crm demo graphql error