remult 0.26.23-next.0 → 0.26.23-next.2

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.
@@ -285,8 +285,8 @@ export class Filter {
285
285
  this.__applyToConsumer(r);
286
286
  return r.result;
287
287
  }
288
- //@internal
289
288
  static async translateCustomWhere(r, entity, remult) {
289
+ // Used in hagai
290
290
  let f = new customTranslator(async (filterKey, custom) => {
291
291
  let r = [];
292
292
  for (const key in entity.entityType) {
@@ -6,6 +6,7 @@ import { Validators, createValueValidator, getEnumValues, } from '../validators.
6
6
  import { relationInfoMemberInOptions } from './relationInfoMember.js';
7
7
  import { remultStatic } from '../remult-static.js';
8
8
  import { addValidator } from './addValidator.js';
9
+ import { isOfType } from '../isOfType.js';
9
10
  const validateNumber = createValueValidator((x) => {
10
11
  return !isNaN(x) && isFinite(x);
11
12
  });
@@ -98,7 +99,7 @@ export class Fields {
98
99
  },
99
100
  }, ...options);
100
101
  }
101
- // static id<entityType = any>(
102
+ // static id<entityType = unknown>(
102
103
  // options?: FieldOptions<entityType, string> & { idFactory?: () => string },
103
104
  // ): ClassFieldDecorator<entityType, string | undefined> {
104
105
  // let buildId = options?.idFactory ?? createId
@@ -267,18 +268,24 @@ export class Relations {
267
268
  */
268
269
  export function Field(valueType, ...options) {
269
270
  // import ANT!!!! if you call this in another decorator, make sure to set It's return type correctly with the | undefined
270
- return (target, context) => {
271
+ return (target, context, c) => {
271
272
  const key = typeof context === 'string' ? context : context.name.toString();
272
273
  let factory = (remult) => {
273
274
  let r = buildOptions(options, remult);
274
275
  if (r.required) {
275
276
  r.validate = addValidator(r.validate, Validators.required, true);
276
277
  }
277
- if (r.maxLength) {
278
- r.validate = addValidator(r.validate, Validators.maxLength(r.maxLength));
278
+ if (isOfType(r, 'maxLength')) {
279
+ let z = r;
280
+ if (z.maxLength) {
281
+ z.validate = addValidator(z.validate, Validators.maxLength(z.maxLength));
282
+ }
279
283
  }
280
- if (r.minLength) {
281
- r.validate = addValidator(r.validate, Validators.minLength(r.minLength));
284
+ if (isOfType(r, 'minLength')) {
285
+ let z = r;
286
+ if (z.minLength) {
287
+ z.validate = addValidator(z.validate, Validators.minLength(z.minLength));
288
+ }
282
289
  }
283
290
  if (!r.valueType && valueType) {
284
291
  r.valueType = valueType();
@@ -1161,15 +1161,16 @@ class rowHelperBase {
1161
1161
  }
1162
1162
  export class rowHelperImplementation extends rowHelperBase {
1163
1163
  info;
1164
- repository;
1164
+ repo;
1165
1165
  edp;
1166
1166
  _isNew;
1167
- constructor(info, instance, repository, edp, remult, _isNew) {
1167
+ constructor(info, instance, repo, edp, remult, _isNew) {
1168
1168
  super(info.fieldsMetadata, instance, remult, _isNew);
1169
1169
  this.info = info;
1170
- this.repository = repository;
1170
+ this.repo = repo;
1171
1171
  this.edp = edp;
1172
1172
  this._isNew = _isNew;
1173
+ this.repository = repo;
1173
1174
  this.metadata = info;
1174
1175
  if (_isNew) {
1175
1176
  for (const col of info.fieldsMetadata) {
@@ -1183,17 +1184,18 @@ export class rowHelperImplementation extends rowHelperBase {
1183
1184
  }
1184
1185
  }
1185
1186
  }
1186
- if (this.info.options.entityRefInit)
1187
- this.info.options.entityRefInit(this, instance);
1187
+ if (this.info.entityInfo.entityRefInit)
1188
+ this.info.entityInfo.entityRefInit(this, instance);
1188
1189
  if (Remult.entityRefInit)
1189
1190
  Remult.entityRefInit(this, instance);
1190
1191
  }
1192
+ repository;
1191
1193
  clone() {
1192
1194
  const data = this.toApiJson(true, true);
1193
- return this.repository.fromJson(data, this.isNew());
1195
+ return this.repo.fromJson(data, this.isNew());
1194
1196
  }
1195
1197
  get relations() {
1196
- return this.repository.relations(this.instance);
1198
+ return this.repo.relations(this.instance);
1197
1199
  }
1198
1200
  get apiUpdateAllowed() {
1199
1201
  return this.remult.isAllowedForInstance(this.instance, this.metadata.options.allowApiUpdate);
@@ -1233,7 +1235,7 @@ export class rowHelperImplementation extends rowHelperBase {
1233
1235
  .find({ where: await this.getIdFilter() })
1234
1236
  .then(async (newData) => {
1235
1237
  if (newData.length === 0)
1236
- throw this.repository._notFoundError(this.id);
1238
+ throw this.repo._notFoundError(this.id);
1237
1239
  await this.loadDataFrom(newData[0]);
1238
1240
  this.saveOriginalData();
1239
1241
  });
@@ -1276,7 +1278,7 @@ export class rowHelperImplementation extends rowHelperBase {
1276
1278
  await this.__validateEntity();
1277
1279
  let doNotSave = false;
1278
1280
  let e = this.buildLifeCycleEvent(() => (doNotSave = true));
1279
- if (!this.repository._dataProvider.isProxy) {
1281
+ if (!this.repo._dataProvider.isProxy) {
1280
1282
  for (const col of this.fields) {
1281
1283
  if (col.metadata.options.saving)
1282
1284
  await col.metadata.options.saving(this.instance, col, e);
@@ -1338,15 +1340,15 @@ export class rowHelperImplementation extends rowHelperBase {
1338
1340
  if (updatedRow)
1339
1341
  await this.loadDataFrom(updatedRow);
1340
1342
  e.id = this.getId();
1341
- if (!this.repository._dataProvider.isProxy) {
1343
+ if (!this.repo._dataProvider.isProxy) {
1342
1344
  if (this.info.entityInfo.saved)
1343
1345
  await this.info.entityInfo.saved(this.instance, e);
1344
- if (this.repository.listeners)
1345
- for (const listener of this.repository.listeners) {
1346
+ if (this.repo.listeners)
1347
+ for (const listener of this.repo.listeners) {
1346
1348
  await listener.saved?.(this.instance, isNew);
1347
1349
  }
1348
1350
  }
1349
- await this.repository._remult.liveQueryPublisher.itemChanged(this.repository.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: false }]);
1351
+ await this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: false }]);
1350
1352
  this.saveOriginalData();
1351
1353
  this._isNew = false;
1352
1354
  return this.instance;
@@ -1389,20 +1391,20 @@ export class rowHelperImplementation extends rowHelperBase {
1389
1391
  fields: self.fields,
1390
1392
  id: self.getId(),
1391
1393
  originalId: self.getOriginalId(),
1392
- metadata: self.repository.metadata,
1393
- repository: self.repository,
1394
+ metadata: self.repo.metadata,
1395
+ repository: self.repo,
1394
1396
  preventDefault: () => preventDefault(),
1395
- relations: self.repository.relations(self.instance),
1397
+ relations: self.repo.relations(self.instance),
1396
1398
  };
1397
1399
  }
1398
1400
  async getIdFilter() {
1399
- return await this.repository._translateWhereToFilter(this.repository.metadata.idMetadata.getIdFilter(this.id));
1401
+ return await this.repo._translateWhereToFilter(this.repo.metadata.idMetadata.getIdFilter(this.id));
1400
1402
  }
1401
1403
  async delete() {
1402
1404
  this.__clearErrorsAndReportChanged();
1403
1405
  let doDelete = true;
1404
1406
  let e = this.buildLifeCycleEvent(() => (doDelete = false));
1405
- if (!this.repository._dataProvider.isProxy) {
1407
+ if (!this.repo._dataProvider.isProxy) {
1406
1408
  if (this.info.entityInfo.deleting)
1407
1409
  await this.info.entityInfo.deleting(this.instance, e);
1408
1410
  }
@@ -1410,15 +1412,15 @@ export class rowHelperImplementation extends rowHelperBase {
1410
1412
  try {
1411
1413
  if (doDelete)
1412
1414
  await this.edp.delete(this.id);
1413
- if (!this.repository._dataProvider.isProxy) {
1415
+ if (!this.repo._dataProvider.isProxy) {
1414
1416
  if (this.info.entityInfo.deleted)
1415
1417
  await this.info.entityInfo.deleted(this.instance, e);
1416
1418
  }
1417
- if (this.repository.listeners)
1418
- for (const listener of this.repository.listeners) {
1419
+ if (this.repo.listeners)
1420
+ for (const listener of this.repo.listeners) {
1419
1421
  await listener.deleted?.(this.instance);
1420
1422
  }
1421
- await this.repository._remult.liveQueryPublisher.itemChanged(this.repository.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: true }]);
1423
+ await this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: true }]);
1422
1424
  this._wasDeleted = true;
1423
1425
  }
1424
1426
  catch (err) {
@@ -1456,7 +1458,7 @@ export class rowHelperImplementation extends rowHelperBase {
1456
1458
  for (const col of this.info.fieldsMetadata) {
1457
1459
  if (col.options.serverExpression) {
1458
1460
  this.instance[col.key] =
1459
- await col.options.serverExpression(this.instance);
1461
+ (await col.options.serverExpression(this.instance));
1460
1462
  }
1461
1463
  }
1462
1464
  }
@@ -1485,8 +1487,8 @@ export class rowHelperImplementation extends rowHelperBase {
1485
1487
  let e = this.buildLifeCycleEvent(() => { });
1486
1488
  await this.info.entityInfo.validation(this.instance, e);
1487
1489
  }
1488
- if (this.repository.listeners)
1489
- for (const listener of this.repository.listeners) {
1490
+ if (this.repo.listeners)
1491
+ for (const listener of this.repo.listeners) {
1490
1492
  await listener.validating?.(this.instance);
1491
1493
  }
1492
1494
  }
@@ -1581,15 +1583,21 @@ export class FieldRefImplementation {
1581
1583
  let lu = this.rowBase.lookups.get(this.metadata.key);
1582
1584
  return this.rawOriginalValue() === null;
1583
1585
  }
1586
+ get key() {
1587
+ return this.metadata.key;
1588
+ }
1589
+ get repo() {
1590
+ return this.helper?.repository;
1591
+ }
1584
1592
  async load() {
1585
1593
  let lu = this.rowBase.lookups.get(this.metadata.key);
1586
1594
  let rel = getRelationFieldInfo(this.metadata);
1587
1595
  if (rel && this.helper) {
1588
1596
  if (rel.type === 'toMany') {
1589
- return (this.container[this.metadata.key] = await this.helper.repository.relations(this.container)[this.metadata.key].find());
1597
+ return (this.container[this.metadata.key] = await this.repo.relations(this.container)[this.key].find());
1590
1598
  }
1591
1599
  else {
1592
- let val = await this.helper.repository
1600
+ let val = await this.repo
1593
1601
  .relations(this.container)[this.metadata.key].findOne();
1594
1602
  if (val)
1595
1603
  this.container[this.metadata.key] = val;
@@ -1865,11 +1873,11 @@ class EntityFullInfo {
1865
1873
  else
1866
1874
  crud = this.options.allowApiCrud;
1867
1875
  if (this.options.allowApiDelete === undefined)
1868
- this.options.allowApiDelete = crud;
1876
+ this.entityInfo.allowApiDelete = crud;
1869
1877
  if (this.options.allowApiInsert === undefined)
1870
- this.options.allowApiInsert = crud;
1878
+ this.entityInfo.allowApiInsert = crud;
1871
1879
  if (this.options.allowApiUpdate === undefined)
1872
- this.options.allowApiUpdate = crud;
1880
+ this.entityInfo.allowApiUpdate = crud;
1873
1881
  if (this.options.allowApiRead === undefined)
1874
1882
  this.options.allowApiRead = this.options.allowApiCrud;
1875
1883
  }
@@ -2003,7 +2011,7 @@ class EntityFullInfo {
2003
2011
  caption;
2004
2012
  }
2005
2013
  export function FieldType(...options) {
2006
- return (target) => {
2014
+ return (target, context) => {
2007
2015
  if (!options) {
2008
2016
  options = [];
2009
2017
  }
@@ -2016,7 +2024,7 @@ export function isAutoIncrement(f) {
2016
2024
  return f.options?.valueConverter?.fieldTypeInDb === 'autoincrement';
2017
2025
  }
2018
2026
  export function ValueListFieldType(...options) {
2019
- return (type) => {
2027
+ return (type, context) => {
2020
2028
  FieldType((o) => {
2021
2029
  ;
2022
2030
  (o.valueConverter = ValueListInfo.get(type)),
@@ -1,16 +1,16 @@
1
1
  export const flags = {
2
2
  error500RetryCount: 4,
3
3
  };
4
- /*y1 - typing discussion:
5
- * all fields required in fields
6
- * key as key of entity
7
- * continue with?
8
- * should and / or accept also undefined members? the code supports it, not sure if the api should
9
- * Sql server expression supports undefined as a response
4
+ /*p1
5
+ * field, fieldType ,ValueListFieldType, - return optional parameter for decorators
6
+ * options to remultExpress tc... should be mandatory
7
+ * return value converter to previous typing
8
+ * add breaking change notification about findOne and findFirst and findId
10
9
  */
11
10
  //p1 - fix query docs to also explain how it can be used for infinite scroll and pagination.
12
11
  //y1 - 'test expression columns without aliases'
13
12
  //y1 - ts issue with fields - when a field is optional, it's $ is also optional and thats a problem
13
+ //p1 - vite 5.3 supports ts5 decorators - check and adapt.
14
14
  //p1 - see if I can fix the no alias problem in selects
15
15
  //p1 - add luid - it's cool for order by.
16
16
  //p1 - replace uuid with crypto.randomUUID and allow custom fallback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.26.23-next.0",
3
+ "version": "0.26.23-next.2",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -11,7 +11,7 @@ export declare class PostgresSchemaBuilder {
11
11
  private schemaAndName;
12
12
  private schemaOnly;
13
13
  verifyStructureOfAllEntities(remult?: Remult): Promise<void>;
14
- ensureSchema(entities: EntityMetadata<any>[]): Promise<void>;
14
+ ensureSchema(entities: EntityMetadata[]): Promise<void>;
15
15
  createIfNotExist(entity: EntityMetadata): Promise<void>;
16
16
  addColumnIfNotExist<T extends EntityMetadata>(entity: T, c: (e: T) => FieldMetadata): Promise<void>;
17
17
  verifyAllColumns<T extends EntityMetadata>(entity: T): Promise<void>;
@@ -29,7 +29,7 @@ export declare class KnexSchemaBuilder {
29
29
  verifyStructureOfAllEntities(remult?: Remult): Promise<void>;
30
30
  ensureSchema(entities: EntityMetadata<any>[]): Promise<void>;
31
31
  createIfNotExist(entity: EntityMetadata): Promise<void>;
32
- createTableKnexCommand(entity: EntityMetadata<any>, e: EntityDbNamesBase): Knex.SchemaBuilder;
32
+ createTableKnexCommand(entity: EntityMetadata, e: EntityDbNamesBase): Knex.SchemaBuilder;
33
33
  addColumnIfNotExist(entity: EntityMetadata, c: (e: EntityMetadata) => FieldMetadata): Promise<void>;
34
34
  createColumnKnexCommand(e: EntityDbNamesBase, col: FieldMetadata<any, any>, colName: string): Knex.SchemaBuilder;
35
35
  verifyAllColumns<T extends EntityMetadata>(entity: T): Promise<void>;
package/remult-next.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { GetServerSideProps, NextApiHandler, NextApiRequest, PreviewData } from 'next';
2
2
  import type { ParsedUrlQuery } from 'querystring';
3
3
  import type { RemultServerCore, RemultServerOptions } from './server/index.js';
4
- export declare function remultNext(options?: RemultServerOptions<NextApiRequest>): RemultNextServer;
4
+ export declare function remultNext(options: RemultServerOptions<NextApiRequest>): RemultNextServer;
5
5
  export type RemultNextServer = RemultServerCore<NextApiRequest> & NextApiHandler & {
6
6
  getServerSideProps<P extends {
7
7
  [key: string]: any;
@@ -1,6 +1,6 @@
1
1
  import type { Handle, RequestEvent, RequestHandler } from '@sveltejs/kit';
2
2
  import type { RemultServerCore, RemultServerOptions, RemultServer } from './server/index.js';
3
- export declare function remultSveltekit(options?: RemultServerOptions<RequestEvent>): RemultSveltekitServer;
3
+ export declare function remultSveltekit(options: RemultServerOptions<RequestEvent>): RemultSveltekitServer;
4
4
  export type RemultSveltekitServer = RemultServerCore<RequestEvent> & Handle & {
5
5
  withRemult: RemultServer<RequestEvent>['withRemultAsync'];
6
6
  GET: RequestHandler;
package/server/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export { SseSubscriptionServer } from '../SseSubscriptionServer.js';
3
3
  export { DataProviderLiveQueryStorage } from '../live-query/data-provider-live-query-storage.js';
4
4
  export { JsonEntityFileStorage, JsonFileDataProvider, } from './JsonEntityFileStorage.js';
5
5
  export { GenericRequestHandler, GenericRequestInfo, GenericResponse, GenericRouter, InitRequestOptions, QueueStorage, RemultServer, RemultServerCore, RemultServerOptions, SpecificRoute, queuedJobInfo, } from './remult-api-server.js';
6
- export declare function createRemultServer<RequestType>(options: RemultServerOptions<RequestType> | undefined, serverCoreOptions?: ServerCoreOptions<RequestType>): RemultServer<RequestType>;
6
+ export declare function createRemultServer<RequestType>(options: RemultServerOptions<RequestType>, serverCoreOptions?: ServerCoreOptions<RequestType>): RemultServer<RequestType>;
@@ -92,7 +92,7 @@ export interface InitRequestOptions {
92
92
  liveQueryStorage: LiveQueryStorage;
93
93
  readonly remult: Remult;
94
94
  }
95
- export declare function createRemultServerCore<RequestType>(options: RemultServerOptions<RequestType> | undefined, serverCoreOptions: ServerCoreOptions<RequestType>): RemultServer<RequestType>;
95
+ export declare function createRemultServerCore<RequestType>(options: RemultServerOptions<RequestType>, serverCoreOptions: ServerCoreOptions<RequestType>): RemultServer<RequestType>;
96
96
  export type GenericRequestHandler<RequestType> = (req: RequestType, res: GenericResponse, next: VoidFunction) => void;
97
97
  export interface ServerHandleResponse {
98
98
  data?: any;
@@ -11,7 +11,7 @@ export declare class CompoundIdField implements FieldMetadata<string> {
11
11
  fromInput(inputValue: string, inputType?: string): string;
12
12
  getDbName(): Promise<string>;
13
13
  getId(instance: any): string;
14
- options: FieldOptions<any, any>;
14
+ options: FieldOptions;
15
15
  get valueConverter(): Required<ValueConverter<string>>;
16
16
  target: ClassType<any>;
17
17
  readonly: boolean;
@@ -1,7 +1,7 @@
1
1
  import type { ClassType } from '../classType.js';
2
2
  import type { AllowedForInstance } from './context.js';
3
3
  import type { EntityMetadata, FieldRef, LifecycleEvent, ValidateFieldEvent } from './remult3/remult3.js';
4
- export interface FieldOptions<entityType = any, valueType = any> {
4
+ export interface FieldOptions<entityType = unknown, valueType = unknown> {
5
5
  /** A human readable name for the field. Can be used to achieve a consistent caption for a field throughout the app
6
6
  * @example
7
7
  * <input placeholder={taskRepo.metadata.fields.title.caption}/>
@@ -119,14 +119,14 @@ export interface FieldOptions<entityType = any, valueType = any> {
119
119
  key?: string;
120
120
  }
121
121
  /**Metadata for a `Field`, this metadata can be used in the user interface to provide a richer UI experience */
122
- export interface FieldMetadata<valueType = any, entityType = any> {
122
+ export interface FieldMetadata<valueType = unknown, entityType = unknown> {
123
123
  /** The field's member name in an object.
124
124
  * @example
125
125
  * const taskRepo = remult.repo(Task);
126
126
  * console.log(taskRepo.metadata.fields.title.key);
127
127
  * // result: title
128
128
  */
129
- readonly key: string;
129
+ readonly key: entityType extends object ? keyof entityType & string : string;
130
130
  /** A human readable caption for the field. Can be used to achieve a consistent caption for a field throughout the app
131
131
  * @example
132
132
  * <input placeholder={taskRepo.metadata.fields.title.caption}/>
@@ -211,7 +211,7 @@ export interface FieldMetadata<valueType = any, entityType = any> {
211
211
  * input.value = repo.fields.birthDate.toInput(person) // will return '1976-06-16'
212
212
  * @see {@link ValueConverter#toInput} for configuration details
213
213
  */
214
- toInput(value: valueType | null | undefined, inputType?: string): string;
214
+ toInput(value: valueType, inputType?: string): string;
215
215
  /** Adapts the value for usage with html input
216
216
  * @example
217
217
  * @Fields.dateOnly()
@@ -239,7 +239,7 @@ export interface ValueConverter<valueType> {
239
239
  * @example
240
240
  * fromJson: val => new Date(val)
241
241
  */
242
- fromJson?(val: any): valueType | null | undefined;
242
+ fromJson?(val: any): valueType;
243
243
  /**
244
244
  * Converts a value of valueType to a JSON DTO. This method is typically used when sending data
245
245
  * to a REST API or serializing an object to a JSON payload.
@@ -250,7 +250,7 @@ export interface ValueConverter<valueType> {
250
250
  * @example
251
251
  * toJson: val => val?.toISOString()
252
252
  */
253
- toJson?(val: valueType | null | undefined): any;
253
+ toJson?(val: valueType): any;
254
254
  /**
255
255
  * Converts a value from the database format to the valueType.
256
256
  *
@@ -260,7 +260,7 @@ export interface ValueConverter<valueType> {
260
260
  * @example
261
261
  * fromDb: val => new Date(val)
262
262
  */
263
- fromDb?(val: any): valueType | null | undefined;
263
+ fromDb?(val: any): valueType;
264
264
  /**
265
265
  * Converts a value of valueType to the database format.
266
266
  *
@@ -270,7 +270,7 @@ export interface ValueConverter<valueType> {
270
270
  * @example
271
271
  * toDb: val => val?.toISOString()
272
272
  */
273
- toDb?(val: valueType | null | undefined): any;
273
+ toDb?(val: valueType): any;
274
274
  /**
275
275
  * Converts a value of valueType to a string suitable for an HTML input element.
276
276
  *
@@ -281,7 +281,7 @@ export interface ValueConverter<valueType> {
281
281
  * @example
282
282
  * toInput: (val, inputType) => val?.toISOString().substring(0, 10)
283
283
  */
284
- toInput?(val: valueType | null | undefined, inputType?: string): string;
284
+ toInput?(val: valueType, inputType?: string): string;
285
285
  /**
286
286
  * Converts a string from an HTML input element to the valueType.
287
287
  *
@@ -292,7 +292,7 @@ export interface ValueConverter<valueType> {
292
292
  * @example
293
293
  * fromInput: (val, inputType) => new Date(val)
294
294
  */
295
- fromInput?(val: string, inputType?: string): valueType | null | undefined;
295
+ fromInput?(val: string, inputType?: string): valueType;
296
296
  /**
297
297
  * Returns a displayable string representation of a value of valueType.
298
298
  *
@@ -302,7 +302,7 @@ export interface ValueConverter<valueType> {
302
302
  * @example
303
303
  * displayValue: val => val?.toLocaleDateString()
304
304
  */
305
- displayValue?(val: valueType | null | undefined): string;
305
+ displayValue?(val: valueType): string;
306
306
  /**
307
307
  * Specifies the storage type used in the database for this field. This can be used to explicitly define the data type and precision of the field in the database.
308
308
  *
@@ -324,7 +324,7 @@ export interface ValueConverter<valueType> {
324
324
  */
325
325
  readonly inputType?: string;
326
326
  }
327
- export declare type FieldValidator<entityType = any, valueType = any> = (entity: entityType, event: ValidateFieldEvent<entityType, valueType>) => boolean | string | void | undefined | Promise<boolean | string | void | undefined>;
327
+ export declare type FieldValidator<entityType = unknown, valueType = unknown> = (entity: entityType, event: ValidateFieldEvent<entityType, valueType>) => boolean | string | void | undefined | Promise<boolean | string | void | undefined>;
328
328
  export declare type ValueOrExpression<valueType> = valueType | (() => valueType);
329
329
  export declare function valueOrExpressionToValue<valueType>(f: ValueOrExpression<valueType>): valueType;
330
330
  export interface ValueListItem {
package/src/data-api.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { Remult } from './context.js';
2
2
  import type { ErrorInfo } from './data-interfaces.js';
3
3
  import type { EntityMetadata, FindOptions, Repository } from './remult3/remult3.js';
4
4
  import type { rowHelperImplementation } from './remult3/RepositoryImplementation.js';
5
- export declare class DataApi<T = any> {
5
+ export declare class DataApi<T = unknown> {
6
6
  private repository;
7
7
  private remult;
8
8
  constructor(repository: Repository<T>, remult: Remult);
@@ -45,4 +45,4 @@ export interface DataApiRequest {
45
45
  get(key: string): any;
46
46
  }
47
47
  export declare function determineSort(sortUrlParm: string, dirUrlParam: string): any;
48
- export declare function serializeError(data: ErrorInfo): ErrorInfo<any>;
48
+ export declare function serializeError(data: ErrorInfo): ErrorInfo<unknown>;
@@ -35,7 +35,7 @@ export interface RestDataProviderHttpProvider {
35
35
  get(url: string): Promise<any>;
36
36
  }
37
37
  export declare function extractSort(sort: any): Sort;
38
- export interface ErrorInfo<entityType = any> {
38
+ export interface ErrorInfo<entityType = unknown> {
39
39
  message?: string;
40
40
  modelState?: {
41
41
  [Properties in keyof Partial<MembersOnly<entityType>>]?: string;
@@ -37,7 +37,7 @@ export declare class SqlDatabase implements DataProvider, HasWrapIdentifier, Can
37
37
  * Wraps an identifier with the database's identifier syntax.
38
38
  */
39
39
  wrapIdentifier: (name: string) => string;
40
- ensureSchema(entities: EntityMetadata<any>[]): Promise<void>;
40
+ ensureSchema(entities: EntityMetadata[]): Promise<void>;
41
41
  /**
42
42
  * Gets the entity data provider.
43
43
  * @param entity - The entity metadata.
@@ -10,9 +10,9 @@ export declare class WebSqlDataProvider implements SqlImplementation, __RowsOfDa
10
10
  end(): Promise<void>;
11
11
  getLimitSqlSyntax(limit: number, offset: number): string;
12
12
  entityIsUsedForTheFirstTime(entity: EntityMetadata): Promise<void>;
13
- ensureSchema(entities: EntityMetadata<any>[]): Promise<void>;
13
+ ensureSchema(entities: EntityMetadata[]): Promise<void>;
14
14
  dropTable(entity: EntityMetadata): Promise<void>;
15
- createTable(entity: EntityMetadata<any>): Promise<void>;
15
+ createTable(entity: EntityMetadata): Promise<void>;
16
16
  createCommand(): SqlCommand;
17
17
  transaction(action: (dataProvider: SqlImplementation) => Promise<void>): Promise<void>;
18
18
  private addColumnSqlSyntax;
package/src/entity.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { Allowed, AllowedForInstance } from './context.js';
2
2
  import type { FieldMetadata } from './column-interfaces.js';
3
3
  import type { EntityFilter, EntityIdFields, EntityMetadata, EntityOrderBy, EntityRef, FieldsMetadata, LifecycleEvent } from './remult3/remult3.js';
4
4
  import type { FilterPreciseValues } from './filter/filter-interfaces.js';
5
- export interface EntityOptions<entityType = any> {
5
+ export interface EntityOptions<entityType = unknown> {
6
6
  /**A human readable name for the entity */
7
7
  caption?: string;
8
8
  /**
@@ -68,7 +68,7 @@ export declare class CustomSqlFilterBuilder implements SqlCommandWithParameters,
68
68
  }
69
69
  export declare function isDbReadonly<entityType>(field: FieldMetadata, dbNames: EntityDbNames<entityType>): boolean | "" | undefined;
70
70
  export declare function shouldNotCreateField<entityType>(field: FieldMetadata, dbNames: EntityDbNames<entityType>): boolean;
71
- export declare function shouldCreateEntity(entity: EntityMetadata<unknown>, e: EntityDbNamesBase): boolean;
71
+ export declare function shouldCreateEntity(entity: EntityMetadata, e: EntityDbNamesBase): boolean;
72
72
  export declare type EntityDbNamesBase = {
73
73
  $entityName: string;
74
74
  $dbNameOf(field: FieldMetadata<any> | string): string;
@@ -182,6 +182,7 @@ export declare class Filter {
182
182
  */
183
183
  static resolve<entityType>(filter: EntityFilter<entityType> | (() => EntityFilter<entityType> | Promise<EntityFilter<entityType>>)): Promise<EntityFilter<entityType>>;
184
184
  toJson(): any;
185
+ static translateCustomWhere<T>(r: Filter, entity: EntityMetadata<T>, remult: Remult): Promise<Filter>;
185
186
  }
186
187
  export interface FilterConsumer {
187
188
  or(orElements: Filter[]): void;
@@ -349,7 +349,6 @@ var Filter = /** @class */ (function () {
349
349
  this.__applyToConsumer(r);
350
350
  return r.result;
351
351
  };
352
- //@internal
353
352
  Filter.translateCustomWhere = function (r, entity, remult) {
354
353
  return tslib_1.__awaiter(this, void 0, void 0, function () {
355
354
  var f;
@@ -6,22 +6,22 @@ export declare class Fields {
6
6
  /**
7
7
  * Stored as a JSON.stringify - to store as json use Fields.json
8
8
  */
9
- static object<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
10
- static json<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
11
- static dateOnly<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
12
- static date<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
13
- static integer<entityType = any>(...options: (FieldOptions<entityType, number> | ((options: FieldOptions<entityType, number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
14
- static autoIncrement<entityType = any>(...options: (FieldOptions<entityType, number> | ((options: FieldOptions<entityType, number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
15
- static number<entityType = any>(...options: (FieldOptions<entityType, number> | ((options: FieldOptions<entityType, number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
16
- static createdAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
17
- static updatedAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
18
- static uuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, string | undefined>;
9
+ static object<entityType = unknown, valueType = unknown>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
10
+ static json<entityType = unknown, valueType = unknown>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
11
+ static dateOnly<entityType = unknown>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
12
+ static date<entityType = unknown>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
13
+ static integer<entityType = unknown>(...options: (FieldOptions<entityType, number> | ((options: FieldOptions<entityType, number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
14
+ static autoIncrement<entityType = unknown>(...options: (FieldOptions<entityType, number> | ((options: FieldOptions<entityType, number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
15
+ static number<entityType = unknown>(...options: (FieldOptions<entityType, number> | ((options: FieldOptions<entityType, number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
16
+ static createdAt<entityType = unknown>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
17
+ static updatedAt<entityType = unknown>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
18
+ static uuid<entityType = unknown>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, string | undefined>;
19
19
  /**
20
20
  * A CUID (Collision Resistant Unique Identifier) field.
21
21
  * This id value is determined on the backend on insert, and can't be updated through the API.
22
22
  * The CUID is generated using the `@paralleldrive/cuid2` npm package.
23
23
  */
24
- static cuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, string | undefined>;
24
+ static cuid<entityType = unknown>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, string | undefined>;
25
25
  /**
26
26
  * Defines a field that can hold a value from a specified set of string literals.
27
27
  * @param {() => readonly valueType[]} optionalValues - A function that returns an array of allowed string literals.
@@ -51,10 +51,10 @@ export declare class Fields {
51
51
  *
52
52
  * // This approach allows easy management and updates of the allowed values for the `status` field.
53
53
  */
54
- static literal<entityType = any, valueType extends string = any>(optionalValues: () => readonly valueType[], ...options: (StringFieldOptions<entityType, valueType> | ((options: StringFieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
55
- static enum<entityType = any, theEnum = object>(enumType: () => theEnum, ...options: (FieldOptions<entityType, theEnum[keyof theEnum]> | ((options: FieldOptions<entityType, theEnum[keyof theEnum]>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, theEnum[keyof theEnum] | undefined>;
56
- static string<entityType = any, valueType = string>(...options: (StringFieldOptions<entityType, valueType> | ((options: StringFieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
57
- static boolean<entityType = any>(...options: (FieldOptions<entityType, boolean> | ((options: FieldOptions<entityType, boolean>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, boolean | undefined>;
54
+ static literal<entityType = unknown, valueType extends string = string>(optionalValues: () => readonly valueType[], ...options: (StringFieldOptions<entityType, valueType> | ((options: StringFieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
55
+ static enum<entityType = unknown, theEnum = object>(enumType: () => theEnum, ...options: (FieldOptions<entityType, theEnum[keyof theEnum]> | ((options: FieldOptions<entityType, theEnum[keyof theEnum]>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, theEnum[keyof theEnum] | undefined>;
56
+ static string<entityType = unknown, valueType = string>(...options: (StringFieldOptions<entityType, valueType> | ((options: StringFieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
57
+ static boolean<entityType = unknown>(...options: (FieldOptions<entityType, boolean> | ((options: FieldOptions<entityType, boolean>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, boolean | undefined>;
58
58
  }
59
59
  export declare class Relations {
60
60
  /**
@@ -162,8 +162,8 @@ export declare class Relations {
162
162
  * @Fields.string((options,remult) => options.includeInApi = true)
163
163
  * title='';
164
164
  */
165
- export declare function Field<entityType = any, valueType = any>(valueType: (() => valueType extends number ? Number : valueType extends string ? String : valueType extends boolean ? Boolean : ClassType<valueType>) | undefined, ...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: ClassFieldDecoratorContextStub<entityType, valueType | undefined> | string) => void;
166
- export interface StringFieldOptions<entityType = any, valueType = string> extends FieldOptions<entityType, valueType> {
165
+ export declare function Field<entityType = unknown, valueType = unknown>(valueType: (() => valueType extends number ? Number : valueType extends string ? String : valueType extends boolean ? Boolean : ClassType<valueType>) | undefined, ...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: ClassFieldDecoratorContextStub<entityType, valueType | undefined> | string, c?: any) => void;
166
+ export interface StringFieldOptions<entityType = unknown, valueType = string> extends FieldOptions<entityType, valueType> {
167
167
  maxLength?: number;
168
168
  minLength?: number;
169
169
  }
@@ -12,6 +12,7 @@ var validators_js_1 = require("../validators.js");
12
12
  var relationInfoMember_js_1 = require("./relationInfoMember.js");
13
13
  var remult_static_js_1 = require("../remult-static.js");
14
14
  var addValidator_js_1 = require("./addValidator.js");
15
+ var isOfType_js_1 = require("../isOfType.js");
15
16
  var validateNumber = (0, validators_js_1.createValueValidator)(function (x) {
16
17
  return !isNaN(x) && isFinite(x);
17
18
  });
@@ -157,7 +158,7 @@ var Fields = /** @class */ (function () {
157
158
  },
158
159
  }], tslib_1.__read(options), false));
159
160
  };
160
- // static id<entityType = any>(
161
+ // static id<entityType = unknown>(
161
162
  // options?: FieldOptions<entityType, string> & { idFactory?: () => string },
162
163
  // ): ClassFieldDecorator<entityType, string | undefined> {
163
164
  // let buildId = options?.idFactory ?? createId
@@ -351,18 +352,24 @@ function Field(valueType) {
351
352
  for (var _i = 1; _i < arguments.length; _i++) {
352
353
  options[_i - 1] = arguments[_i];
353
354
  }
354
- return function (target, context) {
355
+ return function (target, context, c) {
355
356
  var key = typeof context === 'string' ? context : context.name.toString();
356
357
  var factory = function (remult) {
357
358
  var r = (0, RepositoryImplementation_js_1.buildOptions)(options, remult);
358
359
  if (r.required) {
359
360
  r.validate = (0, addValidator_js_1.addValidator)(r.validate, validators_js_1.Validators.required, true);
360
361
  }
361
- if (r.maxLength) {
362
- r.validate = (0, addValidator_js_1.addValidator)(r.validate, validators_js_1.Validators.maxLength(r.maxLength));
362
+ if ((0, isOfType_js_1.isOfType)(r, 'maxLength')) {
363
+ var z = r;
364
+ if (z.maxLength) {
365
+ z.validate = (0, addValidator_js_1.addValidator)(z.validate, validators_js_1.Validators.maxLength(z.maxLength));
366
+ }
363
367
  }
364
- if (r.minLength) {
365
- r.validate = (0, addValidator_js_1.addValidator)(r.validate, validators_js_1.Validators.minLength(r.minLength));
368
+ if ((0, isOfType_js_1.isOfType)(r, 'minLength')) {
369
+ var z = r;
370
+ if (z.minLength) {
371
+ z.validate = (0, addValidator_js_1.addValidator)(z.validate, validators_js_1.Validators.minLength(z.minLength));
372
+ }
366
373
  }
367
374
  if (!r.valueType && valueType) {
368
375
  r.valueType = valueType();
@@ -103,7 +103,7 @@ declare abstract class rowHelperBase<T> {
103
103
  [key: string]: string | undefined;
104
104
  };
105
105
  protected __assertValidity(): void;
106
- buildErrorInfoObject(): ErrorInfo<any>;
106
+ buildErrorInfoObject(): ErrorInfo<unknown>;
107
107
  abstract get fields(): FieldsRef<T>;
108
108
  catchSaveErrors(err: any): any;
109
109
  __clearErrorsAndReportChanged(): void;
@@ -113,7 +113,7 @@ declare abstract class rowHelperBase<T> {
113
113
  originalValues: any;
114
114
  saveOriginalData(): void;
115
115
  saveMoreOriginalData(): void;
116
- validate(): Promise<ErrorInfo<any> | undefined>;
116
+ validate(): Promise<ErrorInfo<unknown> | undefined>;
117
117
  __validateEntity(): Promise<void>;
118
118
  __performColumnAndEntityValidations(): Promise<void>;
119
119
  toApiJson(includeRelatedEntities?: boolean, notJustApi?: boolean): any;
@@ -121,10 +121,11 @@ declare abstract class rowHelperBase<T> {
121
121
  }
122
122
  export declare class rowHelperImplementation<T> extends rowHelperBase<T> implements EntityRef<T> {
123
123
  private info;
124
- repository: RepositoryImplementation<T>;
124
+ private repo;
125
125
  private edp;
126
126
  private _isNew;
127
- constructor(info: EntityFullInfo<T>, instance: T, repository: RepositoryImplementation<T>, edp: EntityDataProvider, remult: Remult, _isNew: boolean);
127
+ constructor(info: EntityFullInfo<T>, instance: T, repo: RepositoryImplementation<T>, edp: EntityDataProvider, remult: Remult, _isNew: boolean);
128
+ repository: Repository<unknown>;
128
129
  clone(): T;
129
130
  get relations(): RepositoryRelations<T>;
130
131
  get apiUpdateAllowed(): boolean;
@@ -157,22 +158,24 @@ export declare class rowHelperImplementation<T> extends rowHelperBase<T> impleme
157
158
  }
158
159
  export declare function getFields<fieldsContainerType>(container: fieldsContainerType, remult?: Remult): FieldsRef<fieldsContainerType>;
159
160
  export declare function getControllerRef<fieldsContainerType>(container: fieldsContainerType, remultArg?: Remult): ControllerRef<fieldsContainerType>;
160
- export declare class controllerRefImpl<T = any> extends rowHelperBase<T> implements ControllerRef<T> {
161
+ export declare class controllerRefImpl<T = unknown> extends rowHelperBase<T> implements ControllerRef<T> {
161
162
  constructor(columnsInfo: FieldMetadata[], instance: any, remult: Remult);
162
163
  __performColumnAndEntityValidations(): Promise<void>;
163
164
  fields: FieldsRef<T>;
164
165
  }
165
166
  export declare class FieldRefImplementation<entityType, valueType> implements FieldRef<entityType, valueType> {
166
167
  private settings;
167
- metadata: FieldMetadata;
168
+ metadata: FieldMetadata<valueType, entityType>;
168
169
  container: any;
169
170
  private helper;
170
171
  private rowBase;
171
- constructor(settings: FieldOptions, metadata: FieldMetadata, container: any, helper: EntityRef<entityType> | undefined, rowBase: rowHelperBase<entityType>);
172
+ constructor(settings: FieldOptions, metadata: FieldMetadata<valueType, entityType>, container: any, helper: EntityRef<entityType> | undefined, rowBase: rowHelperBase<entityType>);
172
173
  _subscribers?: SubscribableImp;
173
174
  subscribe(listener: RefSubscriber): Unsubscribe;
174
175
  valueIsNull(): boolean;
175
176
  originalValueIsNull(): boolean;
177
+ get key(): keyof entityType;
178
+ get repo(): Repository<entityType>;
176
179
  load(): Promise<valueType>;
177
180
  target?: ClassType<any>;
178
181
  reportObserved(): void;
@@ -230,14 +233,14 @@ export declare class columnDefsImpl implements FieldMetadata {
230
233
  private settings;
231
234
  private entityDefs;
232
235
  private remult;
233
- constructor(settings: FieldOptions, entityDefs: EntityFullInfo<any>, remult: Remult);
236
+ constructor(settings: FieldOptions<unknown, unknown>, entityDefs: EntityFullInfo<any>, remult: Remult);
234
237
  apiUpdateAllowed(item?: any): boolean;
235
238
  displayValue(item: any): string;
236
239
  includedInApi(item?: any): boolean;
237
240
  toInput(value: any, inputType?: string): string;
238
241
  fromInput(inputValue: string, inputType?: string): any;
239
242
  getDbName(): Promise<string>;
240
- options: FieldOptions<any, any>;
243
+ options: FieldOptions<unknown, unknown>;
241
244
  target: ClassType<any>;
242
245
  readonly: boolean;
243
246
  valueConverter: Required<ValueConverter<any>>;
@@ -255,9 +258,9 @@ declare class EntityFullInfo<T> implements EntityMetadata<T> {
255
258
  private remult;
256
259
  readonly entityType: ClassType<T>;
257
260
  readonly key: string;
258
- options: EntityOptions<T>;
261
+ options: EntityOptions<unknown>;
259
262
  fieldsMetadata: FieldMetadata[];
260
- constructor(columnsInfo: FieldOptions[], entityInfo: EntityOptions<T>, remult: Remult, entityType: ClassType<T>, key: string);
263
+ constructor(columnsInfo: FieldOptions<unknown, unknown>[], entityInfo: EntityOptions<T>, remult: Remult, entityType: ClassType<T>, key: string);
261
264
  apiUpdateAllowed(item: T): boolean;
262
265
  get apiReadAllowed(): boolean;
263
266
  apiDeleteAllowed(item: T): boolean;
@@ -269,9 +272,9 @@ declare class EntityFullInfo<T> implements EntityMetadata<T> {
269
272
  dbName: string;
270
273
  caption: string;
271
274
  }
272
- export declare function FieldType<valueType = any>(...options: (FieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (target: any) => any;
275
+ export declare function FieldType<valueType = unknown>(...options: (FieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (target: any, context?: any) => any;
273
276
  export declare function isAutoIncrement(f: FieldMetadata): boolean;
274
- export declare function ValueListFieldType<valueType extends ValueListItem = any>(...options: (ValueListFieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (type: ClassType<valueType>) => void;
277
+ export declare function ValueListFieldType<valueType extends ValueListItem = ValueListItem>(...options: (ValueListFieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (type: ClassType<valueType>, context?: any) => void;
275
278
  export interface ValueListFieldOptions<entityType, valueType> extends FieldOptions<entityType, valueType> {
276
279
  getValues?: () => valueType[];
277
280
  }
@@ -284,12 +287,12 @@ export declare class ValueListInfo<T extends ValueListItem> implements ValueConv
284
287
  private constructor();
285
288
  getValues(): T[];
286
289
  byId(key: any): T | undefined;
287
- fromJson(val: any): T | undefined;
290
+ fromJson(val: any): T;
288
291
  toJson(val: T): any;
289
- fromDb(val: any): T | undefined;
292
+ fromDb(val: any): T;
290
293
  toDb(val: T): any;
291
294
  toInput(val: T, inputType: string): string;
292
- fromInput(val: string, inputType: string): T | undefined | null;
295
+ fromInput(val: string, inputType: string): T;
293
296
  displayValue?(val: T): string;
294
297
  fieldTypeInDb?: string;
295
298
  inputType?: string;
@@ -299,8 +302,8 @@ export declare function getValueList<T>(field: FieldMetadata<T>): T[];
299
302
  export declare function getValueList<T>(type: ClassType<T>): T[];
300
303
  export declare const storableMember: unique symbol;
301
304
  export declare const fieldOptionalValuesFunctionKey: unique symbol;
302
- export declare function buildOptions<entityType = any, valueType = any>(options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[], remult: Remult): FieldOptions<entityType, valueType>;
303
- export declare function decorateColumnSettings<valueType>(settings: FieldOptions<any, valueType>, remult: Remult): FieldOptions<any, valueType>;
305
+ export declare function buildOptions<entityType = unknown, valueType = unknown>(options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[], remult: Remult): FieldOptions<entityType, valueType>;
306
+ export declare function decorateColumnSettings<valueType>(settings: FieldOptions<unknown, valueType>, remult: Remult): FieldOptions<unknown, valueType>;
304
307
  export declare class EntityBase {
305
308
  get _(): EntityRefForEntityBase<this>;
306
309
  save(): Promise<this>;
@@ -1925,15 +1925,16 @@ var rowHelperBase = /** @class */ (function () {
1925
1925
  }());
1926
1926
  var rowHelperImplementation = /** @class */ (function (_super) {
1927
1927
  tslib_1.__extends(rowHelperImplementation, _super);
1928
- function rowHelperImplementation(info, instance, repository, edp, remult, _isNew) {
1928
+ function rowHelperImplementation(info, instance, repo, edp, remult, _isNew) {
1929
1929
  var e_30, _a;
1930
1930
  var _this = _super.call(this, info.fieldsMetadata, instance, remult, _isNew) || this;
1931
1931
  _this.info = info;
1932
- _this.repository = repository;
1932
+ _this.repo = repo;
1933
1933
  _this.edp = edp;
1934
1934
  _this._isNew = _isNew;
1935
1935
  _this._wasDeleted = false;
1936
1936
  _this._saving = false;
1937
+ _this.repository = repo;
1937
1938
  _this.metadata = info;
1938
1939
  if (_isNew) {
1939
1940
  try {
@@ -1957,19 +1958,19 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1957
1958
  finally { if (e_30) throw e_30.error; }
1958
1959
  }
1959
1960
  }
1960
- if (_this.info.options.entityRefInit)
1961
- _this.info.options.entityRefInit(_this, instance);
1961
+ if (_this.info.entityInfo.entityRefInit)
1962
+ _this.info.entityInfo.entityRefInit(_this, instance);
1962
1963
  if (context_js_1.Remult.entityRefInit)
1963
1964
  context_js_1.Remult.entityRefInit(_this, instance);
1964
1965
  return _this;
1965
1966
  }
1966
1967
  rowHelperImplementation.prototype.clone = function () {
1967
1968
  var data = this.toApiJson(true, true);
1968
- return this.repository.fromJson(data, this.isNew());
1969
+ return this.repo.fromJson(data, this.isNew());
1969
1970
  };
1970
1971
  Object.defineProperty(rowHelperImplementation.prototype, "relations", {
1971
1972
  get: function () {
1972
- return this.repository.relations(this.instance);
1973
+ return this.repo.relations(this.instance);
1973
1974
  },
1974
1975
  enumerable: false,
1975
1976
  configurable: true
@@ -2037,7 +2038,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2037
2038
  switch (_a.label) {
2038
2039
  case 0:
2039
2040
  if (newData.length === 0)
2040
- throw this.repository._notFoundError(this.id);
2041
+ throw this.repo._notFoundError(this.id);
2041
2042
  return [4 /*yield*/, this.loadDataFrom(newData[0])];
2042
2043
  case 1:
2043
2044
  _a.sent();
@@ -2117,7 +2118,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2117
2118
  case 2:
2118
2119
  doNotSave_1 = false;
2119
2120
  e = this.buildLifeCycleEvent(function () { return (doNotSave_1 = true); });
2120
- if (!!this.repository._dataProvider.isProxy) return [3 /*break*/, 12];
2121
+ if (!!this.repo._dataProvider.isProxy) return [3 /*break*/, 12];
2121
2122
  _t.label = 3;
2122
2123
  case 3:
2123
2124
  _t.trys.push([3, 8, 9, 10]);
@@ -2232,18 +2233,18 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2232
2233
  _t.label = 26;
2233
2234
  case 26:
2234
2235
  e.id = this.getId();
2235
- if (!!this.repository._dataProvider.isProxy) return [3 /*break*/, 36];
2236
+ if (!!this.repo._dataProvider.isProxy) return [3 /*break*/, 36];
2236
2237
  if (!this.info.entityInfo.saved) return [3 /*break*/, 28];
2237
2238
  return [4 /*yield*/, this.info.entityInfo.saved(this.instance, e)];
2238
2239
  case 27:
2239
2240
  _t.sent();
2240
2241
  _t.label = 28;
2241
2242
  case 28:
2242
- if (!this.repository.listeners) return [3 /*break*/, 36];
2243
+ if (!this.repo.listeners) return [3 /*break*/, 36];
2243
2244
  _t.label = 29;
2244
2245
  case 29:
2245
2246
  _t.trys.push([29, 34, 35, 36]);
2246
- _j = tslib_1.__values(this.repository.listeners), _k = _j.next();
2247
+ _j = tslib_1.__values(this.repo.listeners), _k = _j.next();
2247
2248
  _t.label = 30;
2248
2249
  case 30:
2249
2250
  if (!!_k.done) return [3 /*break*/, 33];
@@ -2266,7 +2267,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2266
2267
  }
2267
2268
  finally { if (e_33) throw e_33.error; }
2268
2269
  return [7 /*endfinally*/];
2269
- case 36: return [4 /*yield*/, this.repository._remult.liveQueryPublisher.itemChanged(this.repository.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: false }])];
2270
+ case 36: return [4 /*yield*/, this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: false }])];
2270
2271
  case 37:
2271
2272
  _t.sent();
2272
2273
  this.saveOriginalData();
@@ -2344,17 +2345,17 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2344
2345
  fields: self.fields,
2345
2346
  id: self.getId(),
2346
2347
  originalId: self.getOriginalId(),
2347
- metadata: self.repository.metadata,
2348
- repository: self.repository,
2348
+ metadata: self.repo.metadata,
2349
+ repository: self.repo,
2349
2350
  preventDefault: function () { return preventDefault(); },
2350
- relations: self.repository.relations(self.instance),
2351
+ relations: self.repo.relations(self.instance),
2351
2352
  };
2352
2353
  };
2353
2354
  rowHelperImplementation.prototype.getIdFilter = function () {
2354
2355
  return tslib_1.__awaiter(this, void 0, void 0, function () {
2355
2356
  return tslib_1.__generator(this, function (_a) {
2356
2357
  switch (_a.label) {
2357
- case 0: return [4 /*yield*/, this.repository._translateWhereToFilter(this.repository.metadata.idMetadata.getIdFilter(this.id))];
2358
+ case 0: return [4 /*yield*/, this.repo._translateWhereToFilter(this.repo.metadata.idMetadata.getIdFilter(this.id))];
2358
2359
  case 1: return [2 /*return*/, _a.sent()];
2359
2360
  }
2360
2361
  });
@@ -2371,7 +2372,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2371
2372
  this.__clearErrorsAndReportChanged();
2372
2373
  doDelete = true;
2373
2374
  e = this.buildLifeCycleEvent(function () { return (doDelete = false); });
2374
- if (!!this.repository._dataProvider.isProxy) return [3 /*break*/, 2];
2375
+ if (!!this.repo._dataProvider.isProxy) return [3 /*break*/, 2];
2375
2376
  if (!this.info.entityInfo.deleting) return [3 /*break*/, 2];
2376
2377
  return [4 /*yield*/, this.info.entityInfo.deleting(this.instance, e)];
2377
2378
  case 1:
@@ -2388,18 +2389,18 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2388
2389
  _e.sent();
2389
2390
  _e.label = 5;
2390
2391
  case 5:
2391
- if (!!this.repository._dataProvider.isProxy) return [3 /*break*/, 7];
2392
+ if (!!this.repo._dataProvider.isProxy) return [3 /*break*/, 7];
2392
2393
  if (!this.info.entityInfo.deleted) return [3 /*break*/, 7];
2393
2394
  return [4 /*yield*/, this.info.entityInfo.deleted(this.instance, e)];
2394
2395
  case 6:
2395
2396
  _e.sent();
2396
2397
  _e.label = 7;
2397
2398
  case 7:
2398
- if (!this.repository.listeners) return [3 /*break*/, 15];
2399
+ if (!this.repo.listeners) return [3 /*break*/, 15];
2399
2400
  _e.label = 8;
2400
2401
  case 8:
2401
2402
  _e.trys.push([8, 13, 14, 15]);
2402
- _a = tslib_1.__values(this.repository.listeners), _b = _a.next();
2403
+ _a = tslib_1.__values(this.repo.listeners), _b = _a.next();
2403
2404
  _e.label = 9;
2404
2405
  case 9:
2405
2406
  if (!!_b.done) return [3 /*break*/, 12];
@@ -2422,7 +2423,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2422
2423
  }
2423
2424
  finally { if (e_36) throw e_36.error; }
2424
2425
  return [7 /*endfinally*/];
2425
- case 15: return [4 /*yield*/, this.repository._remult.liveQueryPublisher.itemChanged(this.repository.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: true }])];
2426
+ case 15: return [4 /*yield*/, this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: true }])];
2426
2427
  case 16:
2427
2428
  _e.sent();
2428
2429
  this._wasDeleted = true;
@@ -2518,7 +2519,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2518
2519
  return [4 /*yield*/, col.options.serverExpression(this.instance)];
2519
2520
  case 3:
2520
2521
  _c[_d] =
2521
- _f.sent();
2522
+ (_f.sent());
2522
2523
  _f.label = 4;
2523
2524
  case 4:
2524
2525
  _b = _a.next();
@@ -2608,11 +2609,11 @@ var rowHelperImplementation = /** @class */ (function (_super) {
2608
2609
  _h.sent();
2609
2610
  _h.label = 9;
2610
2611
  case 9:
2611
- if (!this.repository.listeners) return [3 /*break*/, 17];
2612
+ if (!this.repo.listeners) return [3 /*break*/, 17];
2612
2613
  _h.label = 10;
2613
2614
  case 10:
2614
2615
  _h.trys.push([10, 15, 16, 17]);
2615
- _c = tslib_1.__values(this.repository.listeners), _d = _c.next();
2616
+ _c = tslib_1.__values(this.repo.listeners), _d = _c.next();
2616
2617
  _h.label = 11;
2617
2618
  case 11:
2618
2619
  if (!!_d.done) return [3 /*break*/, 14];
@@ -2776,6 +2777,21 @@ var FieldRefImplementation = /** @class */ (function () {
2776
2777
  var lu = this.rowBase.lookups.get(this.metadata.key);
2777
2778
  return this.rawOriginalValue() === null;
2778
2779
  };
2780
+ Object.defineProperty(FieldRefImplementation.prototype, "key", {
2781
+ get: function () {
2782
+ return this.metadata.key;
2783
+ },
2784
+ enumerable: false,
2785
+ configurable: true
2786
+ });
2787
+ Object.defineProperty(FieldRefImplementation.prototype, "repo", {
2788
+ get: function () {
2789
+ var _a;
2790
+ return (_a = this.helper) === null || _a === void 0 ? void 0 : _a.repository;
2791
+ },
2792
+ enumerable: false,
2793
+ configurable: true
2794
+ });
2779
2795
  FieldRefImplementation.prototype.load = function () {
2780
2796
  return tslib_1.__awaiter(this, void 0, void 0, function () {
2781
2797
  var lu, rel, _a, _b, val;
@@ -2788,9 +2804,9 @@ var FieldRefImplementation = /** @class */ (function () {
2788
2804
  if (!(rel.type === 'toMany')) return [3 /*break*/, 2];
2789
2805
  _a = this.container;
2790
2806
  _b = this.metadata.key;
2791
- return [4 /*yield*/, this.helper.repository.relations(this.container)[this.metadata.key].find()];
2807
+ return [4 /*yield*/, this.repo.relations(this.container)[this.key].find()];
2792
2808
  case 1: return [2 /*return*/, (_a[_b] = _c.sent())];
2793
- case 2: return [4 /*yield*/, this.helper.repository
2809
+ case 2: return [4 /*yield*/, this.repo
2794
2810
  .relations(this.container)[this.metadata.key].findOne()];
2795
2811
  case 3:
2796
2812
  val = _c.sent();
@@ -3207,11 +3223,11 @@ var EntityFullInfo = /** @class */ (function () {
3207
3223
  else
3208
3224
  crud = this.options.allowApiCrud;
3209
3225
  if (this.options.allowApiDelete === undefined)
3210
- this.options.allowApiDelete = crud;
3226
+ this.entityInfo.allowApiDelete = crud;
3211
3227
  if (this.options.allowApiInsert === undefined)
3212
- this.options.allowApiInsert = crud;
3228
+ this.entityInfo.allowApiInsert = crud;
3213
3229
  if (this.options.allowApiUpdate === undefined)
3214
- this.options.allowApiUpdate = crud;
3230
+ this.entityInfo.allowApiUpdate = crud;
3215
3231
  if (this.options.allowApiRead === undefined)
3216
3232
  this.options.allowApiRead = this.options.allowApiCrud;
3217
3233
  }
@@ -3312,7 +3328,7 @@ function FieldType() {
3312
3328
  for (var _i = 0; _i < arguments.length; _i++) {
3313
3329
  options[_i] = arguments[_i];
3314
3330
  }
3315
- return function (target) {
3331
+ return function (target, context) {
3316
3332
  if (!options) {
3317
3333
  options = [];
3318
3334
  }
@@ -3330,7 +3346,7 @@ function ValueListFieldType() {
3330
3346
  for (var _i = 0; _i < arguments.length; _i++) {
3331
3347
  options[_i] = arguments[_i];
3332
3348
  }
3333
- return function (type) {
3349
+ return function (type, context) {
3334
3350
  FieldType.apply(void 0, tslib_1.__spreadArray([function (o) {
3335
3351
  ;
3336
3352
  (o.valueConverter = ValueListInfo.get(type)),
@@ -1,2 +1,2 @@
1
1
  import type { FieldOptions } from '../column-interfaces.js';
2
- export declare function addValidator(validators: FieldOptions['validate'], newValidator: FieldOptions['validate'], atStart?: boolean): import("../column-interfaces.js").FieldValidator<any, any> | import("../column-interfaces.js").FieldValidator<any, any>[] | undefined;
2
+ export declare function addValidator<entityType, valueType>(validators: FieldOptions<entityType, valueType>['validate'], newValidator: FieldOptions<entityType, valueType>['validate'], atStart?: boolean): import("../column-interfaces.js").FieldValidator<entityType, valueType> | import("../column-interfaces.js").FieldValidator<entityType, valueType>[] | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { ClassType } from '../../classType.js';
2
2
  import type { EntityOptions } from '../entity.js';
3
3
  import { type BackendMethodOptions } from '../server-action.js';
4
- type Descriptor<T = any> = (a: T, b: string, c?: any) => void;
4
+ type Descriptor<T = unknown> = (a: T, b: string, c?: any) => void;
5
5
  type FieldsDescriptor<T> = T extends new (...args: any[]) => infer R ? {
6
6
  [K in keyof R]?: Descriptor;
7
7
  } : never;
@@ -2,5 +2,5 @@ import type { FieldOptions } from '../column-interfaces.js';
2
2
  import type { Remult } from '../context.js';
3
3
  export interface columnInfo {
4
4
  key: string;
5
- settings: (remult: Remult) => FieldOptions;
5
+ settings: (remult: Remult) => FieldOptions<unknown, unknown>;
6
6
  }
@@ -15,10 +15,10 @@ export interface RelationInfo {
15
15
  toType: () => any;
16
16
  type: RelationFieldInfo['type'];
17
17
  }
18
- export declare function getRelationFieldInfo(field: FieldMetadata<unknown, unknown>): RelationFieldInfo | undefined;
18
+ export declare function getRelationFieldInfo(field: FieldMetadata): RelationFieldInfo | undefined;
19
19
  export interface RelationFieldInfo {
20
20
  type: 'reference' | 'toOne' | 'toMany';
21
- options: RelationOptions<any, any, any>;
21
+ options: RelationOptions<unknown, unknown, unknown>;
22
22
  toEntity: any;
23
23
  toRepo: Repository<unknown>;
24
24
  getFields(): RelationFields;
@@ -18,8 +18,8 @@ export interface EntityRefBase<entityType> extends Subscribable {
18
18
  error: string | undefined;
19
19
  getId(): idType<entityType>;
20
20
  getOriginalId(): idType<entityType>;
21
- repository: Repository<entityType>;
22
- metadata: EntityMetadata<entityType>;
21
+ repository: Repository<unknown>;
22
+ metadata: EntityMetadata<unknown>;
23
23
  toApiJson(): any;
24
24
  validate(): Promise<ErrorInfo<entityType> | undefined>;
25
25
  readonly apiUpdateAllowed: boolean;
@@ -36,7 +36,7 @@ export interface EntityRefForEntityBase<entityType> extends EntityRefBase<entity
36
36
  fields: FieldsRefForEntityBase<entityType>;
37
37
  relations: RepositoryRelationsForEntityBase<entityType>;
38
38
  }
39
- export interface ValidateFieldEvent<entityType = any, valueType = any> {
39
+ export interface ValidateFieldEvent<entityType = unknown, valueType = unknown> {
40
40
  error?: string;
41
41
  value: valueType;
42
42
  originalValue: valueType;
@@ -119,19 +119,19 @@ export type FieldsRefBase<entityType> = {
119
119
  toArray(): FieldRef<entityType, any>[];
120
120
  };
121
121
  export type FieldsMetadata<entityType> = {
122
- [Properties in keyof MembersOnly<entityType>]: FieldMetadata<entityType[Properties], entityType>;
122
+ [Properties in keyof MembersOnly<entityType>]-?: FieldMetadata<entityType[Properties], entityType>;
123
123
  } & {
124
- find(fieldMetadataOrKey: FieldMetadata | string): FieldMetadata<any, entityType>;
124
+ find(fieldMetadataOrKey: FieldMetadata | string): FieldMetadata<unknown, entityType>;
125
125
  [Symbol.iterator]: () => IterableIterator<FieldMetadata<any, entityType>>;
126
126
  toArray(): FieldMetadata<any, entityType>[];
127
127
  };
128
128
  export type FieldsRef<entityType> = FieldsRefBase<entityType> & {
129
- [Properties in keyof MembersOnly<entityType>]: NonNullable<entityType[Properties]> extends {
129
+ [Properties in keyof MembersOnly<entityType>]-?: NonNullable<entityType[Properties]> extends {
130
130
  id?: number | string;
131
131
  } ? IdFieldRef<entityType, entityType[Properties]> : FieldRef<entityType, entityType[Properties]>;
132
132
  };
133
133
  export type FieldsRefForEntityBase<entityType> = FieldsRefBase<entityType> & {
134
- [Properties in keyof Omit<entityType, keyof EntityBase>]: NonNullable<entityType[Properties]> extends {
134
+ [Properties in keyof Omit<entityType, keyof EntityBase>]-?: NonNullable<entityType[Properties]> extends {
135
135
  id?: number | string;
136
136
  } ? IdFieldRef<entityType, entityType[Properties]> : FieldRef<entityType, entityType[Properties]>;
137
137
  };
@@ -152,7 +152,7 @@ export interface IdFieldRef<entityType, valueType> extends FieldRef<entityType,
152
152
  id?: string;
153
153
  } ? string : string | number;
154
154
  }
155
- export interface FieldRef<entityType = any, valueType = any> extends Subscribable {
155
+ export interface FieldRef<entityType = unknown, valueType = unknown> extends Subscribable {
156
156
  error: string | undefined;
157
157
  displayValue: string;
158
158
  value: valueType;
@@ -170,7 +170,7 @@ export interface FieldRef<entityType = any, valueType = any> extends Subscribabl
170
170
  originalValueIsNull(): boolean;
171
171
  validate(): Promise<boolean>;
172
172
  }
173
- export interface IdMetadata<entityType = any> {
173
+ export interface IdMetadata<entityType = unknown> {
174
174
  /** Extracts the id value of an entity item. Useful in cases where the id column is not called id
175
175
  * @example
176
176
  * repo.metadata.idMetadata.getId(task)
@@ -183,7 +183,7 @@ export interface IdMetadata<entityType = any> {
183
183
  createIdInFilter(items: Partial<MembersOnly<entityType>>[]): EntityFilter<entityType>;
184
184
  }
185
185
  /** Metadata for an `Entity`, this metadata can be used in the user interface to provide a richer UI experience */
186
- export interface EntityMetadata<entityType = any> {
186
+ export interface EntityMetadata<entityType = unknown> {
187
187
  /** The Entity's key also used as it's url */
188
188
  readonly key: string;
189
189
  /** Metadata for the Entity's fields */
@@ -4,16 +4,16 @@ exports.flags = void 0;
4
4
  exports.flags = {
5
5
  error500RetryCount: 4,
6
6
  };
7
- /*y1 - typing discussion:
8
- * all fields required in fields
9
- * key as key of entity
10
- * continue with?
11
- * should and / or accept also undefined members? the code supports it, not sure if the api should
12
- * Sql server expression supports undefined as a response
7
+ /*p1
8
+ * field, fieldType ,ValueListFieldType, - return optional parameter for decorators
9
+ * options to remultExpress tc... should be mandatory
10
+ * return value converter to previous typing
11
+ * add breaking change notification about findOne and findFirst and findId
13
12
  */
14
13
  //p1 - fix query docs to also explain how it can be used for infinite scroll and pagination.
15
14
  //y1 - 'test expression columns without aliases'
16
15
  //y1 - ts issue with fields - when a field is optional, it's $ is also optional and thats a problem
16
+ //p1 - vite 5.3 supports ts5 decorators - check and adapt.
17
17
  //p1 - see if I can fix the no alias problem in selects
18
18
  //p1 - add luid - it's cool for order by.
19
19
  //p1 - replace uuid with crypto.randomUUID and allow custom fallback
@@ -54,7 +54,7 @@ export interface ClassMethodDecoratorContextStub<This = unknown, Value extends (
54
54
  };
55
55
  }
56
56
  /** Indicates that the decorated methods runs on the backend. See: [Backend Methods](https://remult.dev/docs/backendMethods.html) */
57
- export declare function BackendMethod<type = any>(options: BackendMethodOptions<type>): (target: any, context: ClassMethodDecoratorContextStub<type> | string, descriptor?: any) => any;
57
+ export declare function BackendMethod<type = unknown>(options: BackendMethodOptions<type>): (target: any, context: ClassMethodDecoratorContextStub<type> | string, descriptor?: any) => any;
58
58
  export interface jobWasQueuedResult {
59
59
  queuedJobId?: string;
60
60
  }