@ainias42/typeorm-helper 0.0.4 → 0.0.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.
Files changed (37) hide show
  1. package/dist/BaseModel.d.ts +1 -1
  2. package/dist/BaseModel.js +14 -7
  3. package/dist/BaseModel.js.map +1 -1
  4. package/dist/DbNamingStrategy.js +6 -2
  5. package/dist/DbNamingStrategy.js.map +1 -1
  6. package/dist/{ServerSubscriber.d.ts → DefaultSubscriber.d.ts} +1 -1
  7. package/dist/{ServerSubscriber.js → DefaultSubscriber.js} +18 -13
  8. package/dist/DefaultSubscriber.js.map +1 -0
  9. package/dist/dataSource/dataSource.js +8 -4
  10. package/dist/dataSource/dataSource.js.map +1 -1
  11. package/dist/dataSource/getRepository.js +6 -3
  12. package/dist/dataSource/getRepository.js.map +1 -1
  13. package/dist/decorators/FileColumn/FileColumn.js +6 -3
  14. package/dist/decorators/FileColumn/FileColumn.js.map +1 -1
  15. package/dist/decorators/FileColumn/FileTransformer.js +2 -1
  16. package/dist/decorators/FileColumn/FileType.js +2 -1
  17. package/dist/decorators/FileColumn/FileWriter.js +17 -11
  18. package/dist/decorators/FileColumn/FileWriter.js.map +1 -1
  19. package/dist/index.d.ts +2 -1
  20. package/dist/index.js +27 -10
  21. package/dist/index.js.map +1 -1
  22. package/dist/migration/getCreateTableColumns.d.ts +5 -2
  23. package/dist/migration/getCreateTableColumns.js +9 -3
  24. package/dist/migration/getCreateTableColumns.js.map +1 -1
  25. package/dist/migration/getCreateTableColumnsV1.d.ts +24 -0
  26. package/dist/migration/getCreateTableColumnsV1.js +31 -0
  27. package/dist/migration/getCreateTableColumnsV1.js.map +1 -0
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +1 -2
  30. package/src/BaseModel.ts +2 -8
  31. package/src/{ServerSubscriber.ts → DefaultSubscriber.ts} +12 -7
  32. package/src/decorators/FileColumn/FileWriter.ts +4 -4
  33. package/src/index.ts +2 -1
  34. package/src/migration/getCreateTableColumns.ts +5 -2
  35. package/src/migration/getCreateTableColumnsV1.ts +27 -0
  36. package/tsconfig.json +2 -1
  37. package/dist/ServerSubscriber.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  export declare class BaseModel {
2
- id?: number;
2
+ id: number;
3
3
  createdAt?: Date;
4
4
  updatedAt?: Date;
5
5
  deletedAt?: Date;
package/dist/BaseModel.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -7,27 +8,33 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
8
  var __metadata = (this && this.__metadata) || function (k, v) {
8
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
10
  };
10
- import { CreateDateColumn, DeleteDateColumn, PrimaryGeneratedColumn, UpdateDateColumn, VersionColumn } from "typeorm";
11
- export class BaseModel {
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BaseModel = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ class BaseModel {
15
+ constructor() {
16
+ this.id = -1;
17
+ }
12
18
  }
19
+ exports.BaseModel = BaseModel;
13
20
  __decorate([
14
- PrimaryGeneratedColumn(),
21
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
15
22
  __metadata("design:type", Number)
16
23
  ], BaseModel.prototype, "id", void 0);
17
24
  __decorate([
18
- CreateDateColumn(),
25
+ (0, typeorm_1.CreateDateColumn)(),
19
26
  __metadata("design:type", Date)
20
27
  ], BaseModel.prototype, "createdAt", void 0);
21
28
  __decorate([
22
- UpdateDateColumn(),
29
+ (0, typeorm_1.UpdateDateColumn)(),
23
30
  __metadata("design:type", Date)
24
31
  ], BaseModel.prototype, "updatedAt", void 0);
25
32
  __decorate([
26
- DeleteDateColumn(),
33
+ (0, typeorm_1.DeleteDateColumn)(),
27
34
  __metadata("design:type", Date)
28
35
  ], BaseModel.prototype, "deletedAt", void 0);
29
36
  __decorate([
30
- VersionColumn(),
37
+ (0, typeorm_1.VersionColumn)(),
31
38
  __metadata("design:type", Number)
32
39
  ], BaseModel.prototype, "version", void 0);
33
40
  //# sourceMappingURL=BaseModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseModel.js","sourceRoot":"","sources":["../src/BaseModel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EAChB,MAAM,SAAS,CAAC;AAEjB,MAAM,OAAO,SAAS;CAerB;AAbG;IADC,sBAAsB,EAAE;;qCACb;AAGZ;IADC,gBAAgB,EAAE;8BACP,IAAI;4CAAC;AAGjB;IADC,gBAAgB,EAAE;8BACP,IAAI;4CAAC;AAGjB;IADC,gBAAgB,EAAE;8BACP,IAAI;4CAAC;AAGjB;IADC,aAAa,EAAE;;0CACC"}
1
+ {"version":3,"file":"BaseModel.js","sourceRoot":"","sources":["../src/BaseModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAsH;AAEtH,MAAa,SAAS;IAAtB;QAEI,OAAE,GAAW,CAAC,CAAC,CAAC;IAapB,CAAC;CAAA;AAfD,8BAeC;AAbG;IADC,IAAA,gCAAsB,GAAE;;qCACT;AAGhB;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;4CAAC;AAGjB;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;4CAAC;AAGjB;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;4CAAC;AAGjB;IADC,IAAA,uBAAa,GAAE;;0CACC"}
@@ -1,5 +1,8 @@
1
- import { DefaultNamingStrategy } from "typeorm";
2
- export class DbNamingStrategy extends DefaultNamingStrategy {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DbNamingStrategy = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ class DbNamingStrategy extends typeorm_1.DefaultNamingStrategy {
3
6
  createKey(prefix, tableOrName, columnNames, suffix) {
4
7
  const clonedColumnNames = [...columnNames];
5
8
  clonedColumnNames.sort();
@@ -34,4 +37,5 @@ export class DbNamingStrategy extends DefaultNamingStrategy {
34
37
  return this.createKey("XCL", tableOrName, [expression]);
35
38
  }
36
39
  }
40
+ exports.DbNamingStrategy = DbNamingStrategy;
37
41
  //# sourceMappingURL=DbNamingStrategy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DbNamingStrategy.js","sourceRoot":"","sources":["../src/DbNamingStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGhD,MAAM,OAAO,gBAAiB,SAAQ,qBAAqB;IAE/C,SAAS,CAAC,MAAc,EAAE,WAA2B,EAAE,WAAqB,EAAE,MAAe;QACjG,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC;QAC3C,iBAAiB,CAAC,IAAI,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACjD,MAAM,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACtD,IAAI,GAAG,GAAG,GAAG,MAAM,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1E,IAAI,MAAM,EAAC,CAAC;YACR,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,SAAS,CAAC,WAA2B,EAAE,WAAqB,EAAE,KAAc;QACxE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,KAA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CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACzF,CAAC;IAED,uBAAuB,CACnB,WAA2B,EAC3B,UAAkB;QAElB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5D,CAAC;CACJ;AA3DD,4CA2DC"}
@@ -1,6 +1,6 @@
1
1
  import { ColumnMetadata } from "typeorm/metadata/ColumnMetadata";
2
2
  import { EntitySubscriberInterface, InsertEvent, ObjectLiteral, UpdateEvent } from "typeorm";
3
- export declare class ServerSubscriber implements EntitySubscriberInterface {
3
+ export declare class DefaultSubscriber implements EntitySubscriberInterface {
4
4
  saveFiles(entity: ObjectLiteral, columns: ColumnMetadata[]): Promise<void>;
5
5
  /**
6
6
  * Called before post insertion.
@@ -1,12 +1,15 @@
1
+ "use strict";
1
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
7
  };
7
- import { EventSubscriber, OptimisticLockVersionMismatchError } from "typeorm";
8
- import { FileWriter } from "./decorators/FileColumn/FileWriter.js";
9
- let ServerSubscriber = class ServerSubscriber {
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DefaultSubscriber = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ const FileWriter_1 = require("./decorators/FileColumn/FileWriter.js");
12
+ let DefaultSubscriber = class DefaultSubscriber {
10
13
  async saveFiles(entity, columns) {
11
14
  const promises = [];
12
15
  for (const column of columns) {
@@ -19,7 +22,7 @@ let ServerSubscriber = class ServerSubscriber {
19
22
  values = [values];
20
23
  single = true;
21
24
  }
22
- promises.push(Promise.all(values.map(value => FileWriter.writeToFile(value.src, transformer.fileOptions.saveDirectory).then(newUrl => {
25
+ promises.push(Promise.all(values.map(value => FileWriter_1.FileWriter.writeToFile(value.src, transformer.fileOptions.saveDirectory).then(newUrl => {
23
26
  return Object.assign(Object.assign({}, value), { src: newUrl });
24
27
  }))).then(newValues => {
25
28
  if (single) {
@@ -39,9 +42,11 @@ let ServerSubscriber = class ServerSubscriber {
39
42
  */
40
43
  async beforeInsert({ entity, metadata: { columns } }) {
41
44
  if (entity) {
42
- // TODO check if this is necessary
43
- // Reflect.set(entity, "updatedAt", new Date());
44
- // Reflect.set(entity, "createdAt", new Date());
45
+ Reflect.set(entity, "updatedAt", new Date());
46
+ Reflect.set(entity, "createdAt", new Date());
47
+ if (Reflect.get(entity, "id") <= 0) {
48
+ Reflect.set(entity, "id", undefined);
49
+ }
45
50
  await this.saveFiles(entity, columns);
46
51
  }
47
52
  }
@@ -58,7 +63,7 @@ let ServerSubscriber = class ServerSubscriber {
58
63
  const versionFromDatabase = event.databaseEntity[event.metadata.versionColumn.propertyName];
59
64
  // they should match otherwise someone has changed it underneath us
60
65
  if (versionFromDatabase !== versionFromUpdate) {
61
- throw new OptimisticLockVersionMismatchError(event.metadata.name, versionFromDatabase, versionFromUpdate);
66
+ throw new typeorm_1.OptimisticLockVersionMismatchError(event.metadata.name, versionFromDatabase, versionFromUpdate);
62
67
  }
63
68
  }
64
69
  if (event.entity) {
@@ -71,8 +76,8 @@ let ServerSubscriber = class ServerSubscriber {
71
76
  }
72
77
  }
73
78
  };
74
- ServerSubscriber = __decorate([
75
- EventSubscriber()
76
- ], ServerSubscriber);
77
- export { ServerSubscriber };
78
- //# sourceMappingURL=ServerSubscriber.js.map
79
+ exports.DefaultSubscriber = DefaultSubscriber;
80
+ exports.DefaultSubscriber = DefaultSubscriber = __decorate([
81
+ (0, typeorm_1.EventSubscriber)()
82
+ ], DefaultSubscriber);
83
+ //# sourceMappingURL=DefaultSubscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultSubscriber.js","sourceRoot":"","sources":["../src/DefaultSubscriber.ts"],"names":[],"mappings":";;;;;;;;;AAEA,qCAOiB;AAGjB,mEAAgE;AAGzD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE1B,KAAK,CAAC,SAAS,CAAC,MAAqB,EAAE,OAAyB;QAC5D,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,MAAM,CAAC,WAA0C,CAAC;YACtE,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,EAAE,CAAC;gBACtB,IAAI,MAAM,GAAsC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;gBACzF,IAAI,MAAM,EAAE,CAAC;oBACT,IAAI,MAAM,GAAG,KAAK,CAAC;oBACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;wBACzB,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;wBAClB,MAAM,GAAG,IAAI,CAAC;oBAClB,CAAC;oBACD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,uBAAU,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;wBACjI,uCAAW,KAAK,KAAE,GAAG,EAAE,MAAM,IAAE;oBACnC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;wBAClB,IAAI,MAAM,EAAE,CAAC;4BACT,OAAO,CAAC,GAAG,C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;YACjD,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YAE5F,mEAAmE;YACnE,IAAI,mBAAmB,KAAK,iBAAiB,EAAE,CAAC;gBAC5C,MAAM,IAAI,4CAAkC,CACxC,KAAK,CAAC,QAAQ,CAAC,IAAI,EACnB,mBAAmB,EACnB,iBAAiB,CACpB,CAAC;YACN,CAAC;QACL,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;QACjC,MAAM,EAAC,MAAM,EAAC,GAAG,KAAK,CAAC;QACvB,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;CAKJ,CAAA;AApFY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,yBAAe,GAAE;GACL,iBAAiB,CAoF7B"}
@@ -1,10 +1,14 @@
1
- import { DataSource } from "typeorm";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initDataSource = initDataSource;
4
+ exports.getDataSource = getDataSource;
5
+ const typeorm_1 = require("typeorm");
2
6
  let dataSource;
3
- export async function initDataSource(options) {
4
- dataSource = new DataSource(options);
7
+ async function initDataSource(options) {
8
+ dataSource = new typeorm_1.DataSource(options);
5
9
  await dataSource.initialize();
6
10
  }
7
- export function getDataSource() {
11
+ function getDataSource() {
8
12
  if (!dataSource || !dataSource.isInitialized) {
9
13
  throw new Error("Data source is not initialized");
10
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dataSource.js","sourceRoot":"","sources":["../../src/dataSource/dataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,IAAI,UAAkC,CAAC;AAEvC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA0B;IAC3D,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,aAAa;IACzB,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
1
+ {"version":3,"file":"dataSource.js","sourceRoot":"","sources":["../../src/dataSource/dataSource.ts"],"names":[],"mappings":";;AAKA,wCAGC;AAED,sCAMC;AAhBD,qCAAqC;AAGrC,IAAI,UAAkC,CAAC;AAEhC,KAAK,UAAU,cAAc,CAAC,OAA0B;IAC3D,UAAU,GAAG,IAAI,oBAAU,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;AAClC,CAAC;AAED,SAAgB,aAAa;IACzB,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
@@ -1,5 +1,8 @@
1
- import { getDataSource } from "../dataSource/dataSource.js";
2
- export function getRepository(entity) {
3
- return getDataSource().getRepository(entity);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRepository = getRepository;
4
+ const dataSource_1 = require("../dataSource/dataSource.js");
5
+ function getRepository(entity) {
6
+ return (0, dataSource_1.getDataSource)().getRepository(entity);
4
7
  }
5
8
  //# sourceMappingURL=getRepository.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRepository.js","sourceRoot":"","sources":["../../src/dataSource/getRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAKxD,MAAM,UAAU,aAAa,CAA+B,MAA4B;IACpF,OAAO,aAAa,EAAE,CAAC,aAAa,CAAS,MAAM,CAAC,CAAC;AACzD,CAAC"}
1
+ {"version":3,"file":"getRepository.js","sourceRoot":"","sources":["../../src/dataSource/getRepository.ts"],"names":[],"mappings":";;AAKA,sCAEC;AAPD,wDAAwD;AAKxD,SAAgB,aAAa,CAA+B,MAA4B;IACpF,OAAO,IAAA,0BAAa,GAAE,CAAC,aAAa,CAAS,MAAM,CAAC,CAAC;AACzD,CAAC"}
@@ -1,7 +1,10 @@
1
- import { getMetadataArgsStorage } from "typeorm";
2
- export function FileColumn(options) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileColumn = FileColumn;
4
+ const typeorm_1 = require("typeorm");
5
+ function FileColumn(options) {
3
6
  return function decorator(object, propertyName) {
4
- getMetadataArgsStorage().columns.push({
7
+ (0, typeorm_1.getMetadataArgsStorage)().columns.push({
5
8
  target: object.constructor,
6
9
  propertyName,
7
10
  mode: "regular",
@@ -1 +1 @@
1
- {"version":3,"file":"FileColumn.js","sourceRoot":"","sources":["../../../src/decorators/FileColumn/FileColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,UAAU,UAAU,CAAC,OAAsD;IAC7E,OAAO,SAAS,SAAS,CAAC,MAAW,EAAE,YAAoB;QACvD,sBAAsB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;YAClC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY;YACZ,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,IAAI;gBACd,WAAW,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AAI,MAAM,EAAE,CAAC;gCACT,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;4BACrB,CAAC;wBACL,CAAC;wBACD,OAAO,MAAM,CAAC;oBAClB,CAAC;oBACD,IAAI,EAAE,CAAC,MAAyC,EAAE,EAAE;wBAChD,IAAI,MAAM,EAAE,CAAC;4BACT,IAAI,MAAM,GAAG,KAAK,CAAC;4BACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gCACzB,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;gCAClB,MAAM,GAAG,IAAI,CAAC;4BAClB,CAAC;4BACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gCACzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;oCACjC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC;gCAC/C,CAAC;4BACL,CAAC;4BACD,IAAI,MAAM,EAAE,CAAC;gCACT,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;4BACrB,CAAC;wBACL,CAAC;wBACD,OAAO,MAAM,CAAC;oBAClB,CAAC;iBACJ;aACJ;SACkB,CAAC,CAAC;IAC7B,CAAC,CAAC;AACN,CAAC"}
@@ -1,2 +1,3 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  //# sourceMappingURL=FileTransformer.js.map
@@ -1,2 +1,3 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  //# sourceMappingURL=FileType.js.map
@@ -1,7 +1,13 @@
1
- import { PassThrough, Readable } from 'stream';
2
- import { createHash, randomBytes } from 'crypto';
3
- import { createWriteStream, existsSync, mkdirSync } from 'fs';
4
- export const FileWriter = {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FileWriter = void 0;
7
+ const stream_1 = require("stream");
8
+ const fs_1 = require("fs");
9
+ const crypto_1 = __importDefault(require("crypto"));
10
+ exports.FileWriter = {
5
11
  async writeToFile(src, saveDirectory) {
6
12
  const base64SearchText = ';base64,';
7
13
  const indexBase64SearchText = src.indexOf(base64SearchText);
@@ -13,17 +19,17 @@ export const FileWriter = {
13
19
  const fileType = src.slice('data:'.length, indexSlash);
14
20
  const fileEnding = src.slice(indexSlash + 1, indexBase64SearchText);
15
21
  const data = src.slice(Math.max(0, indexBase64SearchText + base64SearchText.length));
16
- const seed = randomBytes(20);
22
+ const seed = crypto_1.default.randomBytes(20);
17
23
  const now = new Date();
18
24
  // Month is 0-based. Add 1 to get 1-12
19
- const name = `${now.getUTCFullYear()}-${now.getUTCMonth() + 1}-${now.getUTCDate()}-${fileType}-${createHash('sha1').update(seed).digest('hex')}.${fileEnding}`;
25
+ const name = `${now.getUTCFullYear()}-${now.getUTCMonth() + 1}-${now.getUTCDate()}-${fileType}-${crypto_1.default.createHash('sha1').update(seed).digest('hex')}.${fileEnding}`;
20
26
  const dataBuffer = Buffer.from(data, 'base64');
21
- const inputStream = new Readable();
22
- const dataStream = new PassThrough();
23
- if (!existsSync(saveDirectory)) {
24
- mkdirSync(saveDirectory, { recursive: true });
27
+ const inputStream = new stream_1.Readable();
28
+ const dataStream = new stream_1.PassThrough();
29
+ if (!(0, fs_1.existsSync)(saveDirectory)) {
30
+ (0, fs_1.mkdirSync)(saveDirectory, { recursive: true });
25
31
  }
26
- const writeStream = createWriteStream(saveDirectory + name);
32
+ const writeStream = (0, fs_1.createWriteStream)(saveDirectory + name);
27
33
  inputStream.pipe(dataStream);
28
34
  inputStream.push(dataBuffer);
29
35
  // eslint-disable-next-line unicorn/no-array-push-push
@@ -1 +1 @@
1
- {"version":3,"file":"FileWriter.js","sourceRoot":"","sources":["../../../src/decorators/FileColumn/FileWri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B,IAAA,cAAS,EAAC,aAAa,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,WAAW,GAAG,IAAA,sBAAiB,EAAC,aAAa,GAAG,IAAI,CAAC,CAAC;QAC5D,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE7B,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7B,sDAAsD;QACtD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvB,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/E,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7B,MAAM,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export * from './BaseModel.js';
2
2
  export * from './DbNamingStrategy.js';
3
- export * from './ServerSubscriber.js';
3
+ export * from './DefaultSubscriber.js';
4
4
  export * from './dataSource/dataSource.js';
5
5
  export * from './dataSource/getRepository.js';
6
6
  export * from './migration/getCreateTableColumns.js';
7
+ export * from './migration/getCreateTableColumnsV1.js';
7
8
  export * from './decorators/FileColumn/FileColumn.js';
8
9
  export * from './decorators/FileColumn/FileTransformer.js';
9
10
  export * from './decorators/FileColumn/FileType.js';
package/dist/index.js CHANGED
@@ -1,11 +1,28 @@
1
- export * from './BaseModel.js';
2
- export * from './DbNamingStrategy.js';
3
- export * from './ServerSubscriber.js';
4
- export * from './dataSource/dataSource.js';
5
- export * from './dataSource/getRepository.js';
6
- export * from './migration/getCreateTableColumns.js';
7
- export * from './decorators/FileColumn/FileColumn.js';
8
- export * from './decorators/FileColumn/FileTransformer.js';
9
- export * from './decorators/FileColumn/FileType.js';
10
- export * from './decorators/FileColumn/FileWriter.js';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BaseModel.js"), exports);
18
+ __exportStar(require("./DbNamingStrategy.js"), exports);
19
+ __exportStar(require("./DefaultSubscriber.js"), exports);
20
+ __exportStar(require("./dataSource/dataSource.js"), exports);
21
+ __exportStar(require("./dataSource/getRepository.js"), exports);
22
+ __exportStar(require("./migration/getCreateTableColumns.js"), exports);
23
+ __exportStar(require("./migration/getCreateTableColumnsV1.js"), exports);
24
+ __exportStar(require("./decorators/FileColumn/FileColumn.js"), exports);
25
+ __exportStar(require("./decorators/FileColumn/FileTransformer.js"), exports);
26
+ __exportStar(require("./decorators/FileColumn/FileType.js"), exports);
27
+ __exportStar(require("./decorators/FileColumn/FileWriter.js"), exports);
11
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,qDAAmC;AACnC,sDAAoC;AACpC,0DAAwC;AACxC,6DAA2C;AAC3C,oEAAkD;AAClD,sEAAoD;AACpD,qEAAmD;AACnD,0EAAwD;AACxD,mEAAiD;AACjD,qEAAmD"}
@@ -7,12 +7,15 @@ export declare function getCreateTableColumns(): readonly [{
7
7
  readonly isNullable: false;
8
8
  }, {
9
9
  readonly name: "createdAt";
10
- readonly type: "datetime";
10
+ readonly type: "datetime(6)";
11
11
  readonly isNullable: false;
12
+ readonly default: "CURRENT_TIMESTAMP(6)";
12
13
  }, {
13
14
  readonly name: "updatedAt";
14
- readonly type: "datetime";
15
+ readonly type: "datetime(6)";
15
16
  readonly isNullable: false;
17
+ readonly default: "CURRENT_TIMESTAMP(6)";
18
+ readonly onUpdate: "CURRENT_TIMESTAMP(6)";
16
19
  }, {
17
20
  readonly name: "deletedAt";
18
21
  readonly type: "datetime(6)";
@@ -1,5 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCreateTableColumns = getCreateTableColumns;
1
4
  // Do not change the columns here. It is needed for migration, aka creation of the database
2
- export function getCreateTableColumns() {
5
+ function getCreateTableColumns() {
3
6
  return [{
4
7
  name: 'id',
5
8
  type: 'int',
@@ -9,12 +12,15 @@ export function getCreateTableColumns() {
9
12
  isNullable: false,
10
13
  }, {
11
14
  name: 'createdAt',
12
- type: 'datetime',
15
+ type: 'datetime(6)',
13
16
  isNullable: false,
17
+ default: "CURRENT_TIMESTAMP(6)",
14
18
  }, {
15
19
  name: 'updatedAt',
16
- type: 'datetime',
20
+ type: 'datetime(6)',
17
21
  isNullable: false,
22
+ default: "CURRENT_TIMESTAMP(6)",
23
+ onUpdate: "CURRENT_TIMESTAMP(6)",
18
24
  }, {
19
25
  name: 'deletedAt',
20
26
  type: 'datetime(6)',
@@ -1 +1 @@
1
- {"version":3,"file":"getCreateTableColumns.js","sourceRoot":"","sources":["../../src/migration/getCreateTableColumns.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,UAAU,qBAAqB;IACjC,OAAO,CAAC;YACJ,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,IAAI;YACjB,kBAAkB,EAAE,WAAW;YAC/B,UAAU,EAAE,KAAK;SACpB,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,KAAK;SACpB,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,KAAK;SACpB,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,IAAI;SACnB,EAAE;YACC,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,KAAK;SACpB,CAAU,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"getCreateTableColumns.js","sourceRoot":"","sources":["../../src/migration/getCreateTableColumns.ts"],"names":[],"mappings":";;AACA,sDA4BC;AA7BD,2FAA2F;AAC3F,SAAgB,qBAAqB;IACjC,OAAO,CAAC;YACJ,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,IAAI;YACjB,kBAAkB,EAAE,WAAW;YAC/B,UAAU,EAAE,KAAK;SACpB,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,sBAAsB;SAClC,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,sBAAsB;YAC/B,QAAQ,EAAE,sBAAsB;SACnC,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,IAAI;SACnB,EAAE;YACC,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,KAAK;SACpB,CAAU,CAAC;AAChB,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare function getCreateTableColumnsV1(): readonly [{
2
+ readonly name: "id";
3
+ readonly type: "int";
4
+ readonly isPrimary: true;
5
+ readonly isGenerated: true;
6
+ readonly generationStrategy: "increment";
7
+ readonly isNullable: false;
8
+ }, {
9
+ readonly name: "createdAt";
10
+ readonly type: "datetime";
11
+ readonly isNullable: false;
12
+ }, {
13
+ readonly name: "updatedAt";
14
+ readonly type: "datetime";
15
+ readonly isNullable: false;
16
+ }, {
17
+ readonly name: "deletedAt";
18
+ readonly type: "datetime(6)";
19
+ readonly isNullable: true;
20
+ }, {
21
+ readonly name: "version";
22
+ readonly type: "int";
23
+ readonly isNullable: false;
24
+ }];
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCreateTableColumnsV1 = getCreateTableColumnsV1;
4
+ // Do not change the columns here. It is needed for migration, aka creation of the database
5
+ function getCreateTableColumnsV1() {
6
+ return [{
7
+ name: 'id',
8
+ type: 'int',
9
+ isPrimary: true,
10
+ isGenerated: true,
11
+ generationStrategy: 'increment',
12
+ isNullable: false,
13
+ }, {
14
+ name: 'createdAt',
15
+ type: 'datetime',
16
+ isNullable: false,
17
+ }, {
18
+ name: 'updatedAt',
19
+ type: 'datetime',
20
+ isNullable: false,
21
+ }, {
22
+ name: 'deletedAt',
23
+ type: 'datetime(6)',
24
+ isNullable: true,
25
+ }, {
26
+ name: 'version',
27
+ type: 'int',
28
+ isNullable: false,
29
+ }];
30
+ }
31
+ //# sourceMappingURL=getCreateTableColumnsV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCreateTableColumnsV1.js","sourceRoot":"","sources":["../../src/migration/getCreateTableColumnsV1.ts"],"names":[],"mappings":";;AACA,0DAyBC;AA1BD,2FAA2F;AAC3F,SAAgB,uBAAuB;IACnC,OAAO,CAAC;YACJ,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,IAAI;YACjB,kBAAkB,EAAE,WAAW;YAC/B,UAAU,EAAE,KAAK;SACpB,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,KAAK;SACpB,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,KAAK;SACpB,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,IAAI;SACnB,EAAE;YACC,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,KAAK;SACpB,CAAU,CAAC;AAChB,CAAC"}