remult 0.27.23-next.3 → 0.27.23-next.5

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.
@@ -1140,7 +1140,7 @@ class rowHelperBase {
1140
1140
  let ei = getEntitySettings(col.valueType, false);
1141
1141
  let refImpl = this.fields.find(col.key);
1142
1142
  refImpl._subscribers = new SubscribableImp();
1143
- if (ei && this.remult) {
1143
+ if ((ei && this.remult) || getRelationFieldInfo(col)) {
1144
1144
  }
1145
1145
  else {
1146
1146
  let val = this.instance[col.key];
@@ -17,8 +17,32 @@ const wnn = [
17
17
  export const flags = {
18
18
  error500RetryCount: 4,
19
19
  };
20
- //p1 - make error info an actual error, important for exception handling, and also for auth.js errors that were mistic
21
- //p1 - add validators min,max,between(range)
20
+ /*p1 - issues in https://stackblitz.com/edit/demo-allow-delete-based-on-other-entity:
21
+ - don't like the ensure schema
22
+ - seems like this didn't work well in their version of sqlite:
23
+ ```
24
+ @Entity<TaskUser>('TaskUsers', {
25
+ id: ['taskId', 'userId'],
26
+ })
27
+ ```
28
+ - This could be better
29
+ ```
30
+ sqlExpression: async () => {
31
+ if (!remult.authenticated()) return 'false';
32
+ return (
33
+ '1=' +
34
+ (await sqlRelations(Task).taskUsers.$count({
35
+ userId: [remult.user?.id],
36
+ canDelete: true,
37
+ }))
38
+ );
39
+ },
40
+ ```
41
+
42
+ -
43
+ */
44
+ //p1 - deleteAll({title:undefined}) should throw an error - not return 0 (with direct call to db)
45
+ //p1 - remult-create, move db question ahead of auth - everyone needs a database, not everyone need auth
22
46
  //p1 - allow experimental route registration on remult server, with at least get route, and support redirect, read header and set header - (and the existing get html etc...)
23
47
  //p2 - add parameter all to deleteMany, and updateMany
24
48
  //p2 filter.apply ApiPreFilter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.27.23-next.3",
3
+ "version": "0.27.23-next.5",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -100,7 +100,7 @@ export declare class Relations {
100
100
  * customer?: Customer;
101
101
  * ```
102
102
  */
103
- static toOne<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, options?: (FieldOptions<entityType, toEntityType> & Pick<RelationOptions<entityType, toEntityType, any, any>, 'defaultIncluded'>) | RelationOptions<entityType, toEntityType, entityType> | keyof entityType): (target: any, context: string | ClassFieldDecoratorContextStub<any, toEntityType>, c?: any) => void;
103
+ static toOne<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, options?: (FieldOptions<entityType, toEntityType> & Pick<RelationOptions<entityType, toEntityType, any, any>, 'defaultIncluded'>) | RelationOptions<entityType, toEntityType, entityType> | keyof entityType): (target: any, context: ClassFieldDecoratorContextStub<entityType, toEntityType | undefined> | string, c?: any) => void;
104
104
  /**
105
105
  * Define a toMany relation between entities, indicating a one-to-many relationship.
106
106
  * This method allows you to establish a relationship where one entity can have multiple related entities.
@@ -1873,7 +1873,7 @@ var rowHelperBase = /** @class */ (function () {
1873
1873
  var ei = (0, getEntityRef_js_1.getEntitySettings)(col.valueType, false);
1874
1874
  var refImpl = this_3.fields.find(col.key);
1875
1875
  refImpl._subscribers = new SubscribableImp();
1876
- if (ei && this_3.remult) {
1876
+ if ((ei && this_3.remult) || (0, relationInfoMember_js_1.getRelationFieldInfo)(col)) {
1877
1877
  }
1878
1878
  else {
1879
1879
  var val_2 = this_3.instance[col.key];
@@ -20,8 +20,32 @@ var wnn = [
20
20
  exports.flags = {
21
21
  error500RetryCount: 4,
22
22
  };
23
- //p1 - make error info an actual error, important for exception handling, and also for auth.js errors that were mistic
24
- //p1 - add validators min,max,between(range)
23
+ /*p1 - issues in https://stackblitz.com/edit/demo-allow-delete-based-on-other-entity:
24
+ - don't like the ensure schema
25
+ - seems like this didn't work well in their version of sqlite:
26
+ ```
27
+ @Entity<TaskUser>('TaskUsers', {
28
+ id: ['taskId', 'userId'],
29
+ })
30
+ ```
31
+ - This could be better
32
+ ```
33
+ sqlExpression: async () => {
34
+ if (!remult.authenticated()) return 'false';
35
+ return (
36
+ '1=' +
37
+ (await sqlRelations(Task).taskUsers.$count({
38
+ userId: [remult.user?.id],
39
+ canDelete: true,
40
+ }))
41
+ );
42
+ },
43
+ ```
44
+
45
+ -
46
+ */
47
+ //p1 - deleteAll({title:undefined}) should throw an error - not return 0 (with direct call to db)
48
+ //p1 - remult-create, move db question ahead of auth - everyone needs a database, not everyone need auth
25
49
  //p1 - allow experimental route registration on remult server, with at least get route, and support redirect, read header and set header - (and the existing get html etc...)
26
50
  //p2 - add parameter all to deleteMany, and updateMany
27
51
  //p2 filter.apply ApiPreFilter