remult 0.26.15 → 0.26.16

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.
@@ -7,16 +7,23 @@ export interface EntityUIInfo {
7
7
  fields: FieldUIInfo[];
8
8
  ids: Record<string, true>;
9
9
  relations: EntityRelationToManyInfo[];
10
+ color?: string;
10
11
  }
11
12
  export interface EntityRelationToManyInfo extends RelationFields {
12
13
  entityKey: string;
13
14
  where?: any;
14
15
  }
16
+ export type FieldUIInfoType = 'json' | 'string' | 'number' | 'date' | 'boolean';
15
17
  export interface FieldUIInfo {
16
18
  key: string;
19
+ readOnly: boolean;
20
+ values: {
21
+ id: string | number;
22
+ caption: string;
23
+ }[];
17
24
  valFieldKey: string;
18
25
  caption: string;
19
- type: 'json' | 'string' | 'number' | 'boolean';
26
+ type: FieldUIInfoType;
20
27
  relationToOne?: FieldRelationToOneInfo;
21
28
  }
22
29
  export interface FieldRelationToOneInfo extends RelationFields {
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
5
5
  var relationInfoMember_js_1 = require("../src/remult3/relationInfoMember.js");
6
6
  var filter_interfaces_js_1 = require("../src/filter/filter-interfaces.js");
7
7
  var get_remult_admin_html_js_1 = require("./get-remult-admin-html.js");
8
+ var RepositoryImplementation_js_1 = require("../src/remult3/RepositoryImplementation.js");
8
9
  function remultAdminHtml(options) {
9
10
  var optionsFromServer = tslib_1.__assign({}, options);
10
11
  //@ts-ignore
@@ -70,6 +71,8 @@ function buildEntityInfo(options) {
70
71
  }
71
72
  fields.push({
72
73
  key: x.key,
74
+ readOnly: x.dbReadOnly || !x.apiUpdateAllowed(),
75
+ values: (0, RepositoryImplementation_js_1.getValueList)(x),
73
76
  valFieldKey: valFieldKey,
74
77
  caption: x.caption,
75
78
  relationToOne: relation,
@@ -79,7 +82,9 @@ function buildEntityInfo(options) {
79
82
  ? 'number'
80
83
  : x.valueType === Boolean
81
84
  ? 'boolean'
82
- : 'string',
85
+ : x.valueType === Date
86
+ ? 'date'
87
+ : 'string',
83
88
  });
84
89
  };
85
90
  try {
@@ -155,6 +155,18 @@ var Fields = /** @class */ (function () {
155
155
  },
156
156
  }], tslib_1.__read(options), false));
157
157
  };
158
+ // static id<entityType = any>(
159
+ // options?: FieldOptions<entityType, string> & { idFactory?: () => string },
160
+ // ): ClassFieldDecorator<entityType, string | undefined> {
161
+ // let buildId = options?.idFactory ?? createId
162
+ // return Field(() => String, {
163
+ // allowApiUpdate: false,
164
+ // defaultValue: () => buildId(),
165
+ // saving: (_, r) => {
166
+ // if (!r.value) r.value = buildId()
167
+ // },
168
+ // })
169
+ // }
158
170
  /**
159
171
  * Defines a field that can hold a value from a specified set of string literals.
160
172
  * @param {() => readonly valueType[]} optionalValues - A function that returns an array of allowed string literals.
@@ -20,11 +20,11 @@ export interface RelationFieldInfo {
20
20
  type: 'reference' | 'toOne' | 'toMany';
21
21
  options: RelationOptions<any, any, any>;
22
22
  toEntity: any;
23
- toRepo: Repository<any>;
23
+ toRepo: Repository<unknown>;
24
24
  getFields(): RelationFields;
25
25
  }
26
26
  export interface RelationFields {
27
27
  fields: Record<string, string>;
28
28
  compoundIdField: string | undefined;
29
29
  }
30
- export declare function verifyFieldRelationInfo(repo: Repository<any>, remult: Remult, dp: DataProvider): void;
30
+ export declare function verifyFieldRelationInfo(repo: Repository<unknown>, remult: Remult, dp: DataProvider): void;
@@ -4,6 +4,14 @@ exports.flags = void 0;
4
4
  exports.flags = {
5
5
  error500RetryCount: 4,
6
6
  };
7
+ //p1 - add luid - it's cool for order by.
8
+ //p1 - replace uuid with crypto.randomUUID and allow custom fallback
9
+ //p1 - add nanoid
10
+ //p1 - add id and use luid by default, but allow changes with Fields.id.defaultIdProvider
11
+ //p1 - explain the benefits of changing the default provider for testing in docs.
12
+ //p1 - fix app custom filters example for multiple filters.
13
+ //p1 - add not!!!!
14
+ //p1 - add LifecycleEvent to documentation
7
15
  //y1 - Talk about the case where we had one to many, without a field - just a filter - for example, event,event participants, users - and a field that shows all users that are not participants
8
16
  //p1 - Fix hagai and starter project to latest ts
9
17
  //y1 TODO - discuss next auth withRemult paradox - the gift that keeps on giving - it's doing something crazy there!!
@@ -40,7 +48,7 @@ const result = await repo.batch(x=>({
40
48
  //p1 - return error on connection error
41
49
  //p1 - article on displayValue including it's definition for entities that is used in relations
42
50
  //p1 - article auth.js with express - played with it, requires type="module" and a few more configurations - https://github.com/noam-honig/express-auth
43
- //p2 -fix remult admin not to load the html into memory until used
51
+ //p2 - fix remult admin not to load the html into memory until used
44
52
  //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?
45
53
  //p2 - create foreign key constraints in user code - https://codesandbox.io/p/devbox/fk-validator-tdshcs
46
54
  //p2 - admin url1 - pocketbase use /_ for the admin //{allowed?:Allowed,url?:string} also checkout the admin* as it should probably be something else and didn't work in hono
@@ -77,22 +85,6 @@ const result = await repo.batch(x=>({
77
85
  Description = ""*/
78
86
  //y2 - get backend methods to work when specifying types for date, and entities as poco's
79
87
  //y2 - constraints (@JY)
80
- /*p2 remult admin
81
- - when making a change and canceling - the changed value still appears
82
- - Small thing, I get SvelteKitError: Not found: /vite.svg
83
- - understand the to many relation for the admin, based on the to one
84
- - relation from order details to order gave a compound id info - and it is not true - same for the relation to product
85
- - new row when there are relations, looks funny (see product)
86
- - the + row in the bottom should extend to the full width
87
- - need a way to extract the fields from the relation - for generating relation based sql
88
- - allow conditional admin - like allowed
89
- - remult-admin doesn't handle primary key that has compound column
90
- - remult-admin didn't show a update for a table with a uniqua that is numeric
91
- - for literal fields, allow selection from list
92
- - for many to one fields - allow search field selection by developer
93
- - for toOne relations, show the "one" row and allow its edit.
94
- */
95
- //remult
96
88
  //p1 - when a tasks table exists in a different schema - we get many errors
97
89
  //p1 - live query with include
98
90
  //p1 - adjust angular tutorial starter kit for latest angular (as is in tutorial)