remult 0.26.12 → 0.26.14

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.
@@ -1,5 +1,4 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Entity, IdEntity, Fields, remult, Remult, } from '../index.js';
1
+ import { Entity, IdEntity, Fields, remult, Remult, describeClass, } from '../index.js';
3
2
  import { initDataProviderOrJson } from '../server/initDataProviderOrJson.js';
4
3
  import { doTransaction } from '../src/context.js';
5
4
  import { cast, isOfType } from '../src/isOfType.js';
@@ -21,16 +20,12 @@ export async function migrate(options) {
21
20
  const prev = remult.dataProvider;
22
21
  remult.dataProvider = dataProvider;
23
22
  try {
24
- let VersionInfo = class VersionInfo extends IdEntity {
23
+ class VersionInfo extends IdEntity {
25
24
  version = -1;
26
- };
27
- __decorate([
28
- Fields.number(),
29
- __metadata("design:type", Object)
30
- ], VersionInfo.prototype, "version", void 0);
31
- VersionInfo = __decorate([
32
- Entity(migrationTableName)
33
- ], VersionInfo);
25
+ }
26
+ describeClass(VersionInfo, Entity(migrationTableName), {
27
+ version: Fields.integer(),
28
+ });
34
29
  const steps = Object.entries(options.migrations).sort(([a], [b]) => parseInt(a) - parseInt(b));
35
30
  if (dataProvider.ensureSchema) {
36
31
  await dataProvider.ensureSchema([
@@ -16,7 +16,6 @@ export class KnexDataProvider {
16
16
  end() {
17
17
  return this.knex.destroy();
18
18
  }
19
- /* @internal */
20
19
  provideMigrationBuilder(builder) {
21
20
  var sb = new KnexSchemaBuilder(this.knex);
22
21
  return {
@@ -2,8 +2,12 @@ export const flags = {
2
2
  error500RetryCount: 4,
3
3
  };
4
4
  //y1 TODO - discuss next auth withRemult paradox - the gift that keeps on giving - it's doing something crazy there!!
5
+ //p1 - fix chaining of saving and saved in multiple entity options args
5
6
  //p1 - review starter and examples and separate remult * auth from the routes
6
- //p1 - https://github.com/remult/remult/discussions/438
7
+ /*p1 - https://github.com/remult/remult/discussions/438
8
+ - https://github.com/remult/remult/blob/query-argumets/projects/tests/dbs/test-sql-database.spec.ts#L100-L128
9
+ */
10
+ //p1 - min, max, avg, sum
7
11
  //y1 - live query with count #436
8
12
  //y1 TODO - In the esm version of our tutorial - the imports are automatically .ts and not .js in react and not in vue
9
13
  //y1 TODO - consider id to also support keyof (id:['company','index']) - had problem with | (keyof Partial<entityType>)[] & `entity`
@@ -41,15 +41,11 @@ function migrate(options) {
41
41
  _this.version = -1;
42
42
  return _this;
43
43
  }
44
- tslib_1.__decorate([
45
- index_js_1.Fields.number(),
46
- tslib_1.__metadata("design:type", Object)
47
- ], VersionInfo_1.prototype, "version", void 0);
48
- VersionInfo = tslib_1.__decorate([
49
- (0, index_js_1.Entity)(migrationTableName)
50
- ], VersionInfo);
51
44
  return VersionInfo;
52
45
  }(index_js_1.IdEntity));
46
+ (0, index_js_1.describeClass)(VersionInfo_1, (0, index_js_1.Entity)(migrationTableName), {
47
+ version: index_js_1.Fields.integer(),
48
+ });
53
49
  steps_1 = Object.entries(options.migrations).sort(function (_a, _b) {
54
50
  var _c = tslib_1.__read(_a, 1), a = _c[0];
55
51
  var _d = tslib_1.__read(_b, 1), b = _d[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.26.12",
3
+ "version": "0.26.14",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -6,11 +6,12 @@ import type { DataProvider, EntityDataProvider } from '../src/data-interfaces.js
6
6
  import type { EntityFilter, EntityMetadata } from '../src/remult3/remult3.js';
7
7
  import type { RepositoryOverloads } from '../src/remult3/RepositoryImplementation.js';
8
8
  import type { HasWrapIdentifier, SqlCommand, SqlCommandFactory, SqlResult } from '../src/sql-command.js';
9
- import type { CanBuildMigrations } from '../migrations/migration-types.js';
9
+ import type { CanBuildMigrations, MigrationBuilder, MigrationCode } from '../migrations/migration-types.js';
10
10
  export declare class KnexDataProvider implements DataProvider, HasWrapIdentifier, SqlCommandFactory, CanBuildMigrations {
11
11
  knex: Knex;
12
12
  constructor(knex: Knex);
13
13
  end(): Promise<void>;
14
+ provideMigrationBuilder(builder: MigrationCode): MigrationBuilder;
14
15
  createCommand(): SqlCommand;
15
16
  execute(sql: string): Promise<SqlResult>;
16
17
  static getDb(dataProvider?: DataProvider): Knex<any, any[]>;
@@ -21,7 +21,6 @@ var KnexDataProvider = /** @class */ (function () {
21
21
  KnexDataProvider.prototype.end = function () {
22
22
  return this.knex.destroy();
23
23
  };
24
- /* @internal */
25
24
  KnexDataProvider.prototype.provideMigrationBuilder = function (builder) {
26
25
  var sb = new KnexSchemaBuilder(this.knex);
27
26
  return {
@@ -5,8 +5,12 @@ exports.flags = {
5
5
  error500RetryCount: 4,
6
6
  };
7
7
  //y1 TODO - discuss next auth withRemult paradox - the gift that keeps on giving - it's doing something crazy there!!
8
+ //p1 - fix chaining of saving and saved in multiple entity options args
8
9
  //p1 - review starter and examples and separate remult * auth from the routes
9
- //p1 - https://github.com/remult/remult/discussions/438
10
+ /*p1 - https://github.com/remult/remult/discussions/438
11
+ - https://github.com/remult/remult/blob/query-argumets/projects/tests/dbs/test-sql-database.spec.ts#L100-L128
12
+ */
13
+ //p1 - min, max, avg, sum
10
14
  //y1 - live query with count #436
11
15
  //y1 TODO - In the esm version of our tutorial - the imports are automatically .ts and not .js in react and not in vue
12
16
  //y1 TODO - consider id to also support keyof (id:['company','index']) - had problem with | (keyof Partial<entityType>)[] & `entity`
@@ -43,7 +43,7 @@ export declare function createValueValidatorWithArgs<valueType, argsType>(valida
43
43
  };
44
44
  export type ValueValidationMessage<argsType> = string | ((args: argsType) => string);
45
45
  export type ValidationMessage<valueType, argsType> = string | ((entity: any, event: ValidateFieldEvent<any, valueType>, args: argsType) => string);
46
- export type ValidatorWithArgs<valueType, argsType> = (args: argsType, message?: ValidationMessage<valueType, argsType>) => FieldValidator<any, valueType>;
46
+ export type ValidatorWithArgs<valueType, argsType> = (args: argsType, message?: ValidationMessage<valueType, argsType>) => FieldValidator<unknown, valueType>;
47
47
  export declare function createValidatorWithArgs<valueType, argsType>(validate: (entity: any, e: ValidateFieldEvent<any, valueType>, args: argsType) => Promise<boolean | string> | boolean | string, defaultMessage: ValidationMessage<valueType, argsType>): ValidatorWithArgs<valueType, argsType> & {
48
48
  defaultMessage: ValidationMessage<valueType, argsType>;
49
49
  };