remult 0.12.8 → 0.12.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.12.8",
3
+ "version": "0.12.9",
4
4
  "description": "remult core lib",
5
5
  "homepage": "https://remult.dev/",
6
6
  "repository": {
package/readme.md CHANGED
@@ -3,12 +3,18 @@
3
3
  <img src="https://github.com/remult/remult/raw/master/docs/.vuepress/public/logo.png" width="140" height="140">
4
4
  </a>
5
5
  <h1>Remult</h1>
6
+ <a href="https://circleci.com/gh/remult/remult/tree/master">
7
+ <img alt="CircleCI" src="https://circleci.com/gh/remult/remult/tree/master.svg?style=svg">
8
+ </a>
6
9
  <a href="https://raw.githubusercontent.com/remult/remult/master/LICENSE">
7
10
  <img alt="GitHub license" src="https://img.shields.io/badge/license-MIT-blue.svg">
8
11
  </a>
9
- <a href="https://badge.fury.io/js/remult">
12
+ <a href="https://www.npmjs.com/package/remult">
10
13
  <img alt="npm version" src="https://badge.fury.io/js/remult.svg">
11
14
  </a>
15
+ <a href="https://www.npmjs.com/package/remult">
16
+ <img alt="npm downloads" src="https://img.shields.io/npm/dm/remult">
17
+ </a>
12
18
  </div>
13
19
 
14
20
  ## What is Remult?
@@ -616,6 +616,7 @@ function getEntityKey(entity) {
616
616
  exports.getEntityKey = getEntityKey;
617
617
  exports.columnsOfType = new Map();
618
618
  function createOldEntity(entity, remult) {
619
+ var _this = this;
619
620
  var r = exports.columnsOfType.get(entity);
620
621
  if (!r)
621
622
  exports.columnsOfType.set(entity, r = []);
@@ -634,12 +635,21 @@ function createOldEntity(entity, remult) {
634
635
  info = tslib_1.__assign(tslib_1.__assign({}, baseSettings_1), info);
635
636
  var functions = ["saving", "saved", "deleting", "deleted", "validation"];
636
637
  var _loop_2 = function (key_1) {
637
- if (baseSettings_1[key_1]) {
638
+ if (baseSettings_1[key_1] && baseSettings_1[key_1] !== info[key_1]) {
638
639
  var x_1 = info[key_1];
639
- info[key_1] = function (a, b) {
640
- x_1(a, b);
641
- baseSettings_1[key_1](a, b);
642
- };
640
+ info[key_1] = function (a, b) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
641
+ return tslib_1.__generator(this, function (_a) {
642
+ switch (_a.label) {
643
+ case 0: return [4 /*yield*/, x_1(a, b)];
644
+ case 1:
645
+ _a.sent();
646
+ return [4 /*yield*/, baseSettings_1[key_1](a, b)];
647
+ case 2:
648
+ _a.sent();
649
+ return [2 /*return*/];
650
+ }
651
+ });
652
+ }); };
643
653
  }
644
654
  };
645
655
  try {
@@ -50,7 +50,7 @@ export declare type Fields<entityType> = {
50
50
  toArray(): FieldRef<entityType, any>[];
51
51
  };
52
52
  export declare type FieldsMetadata<entityType> = {
53
- [Properties in keyof OmitEB<entityType>]: FieldMetadata;
53
+ [Properties in keyof OmitEB<entityType>]: FieldMetadata<entityType[Properties]>;
54
54
  } & {
55
55
  find(fieldMetadataOrKey: FieldMetadata | string): FieldMetadata;
56
56
  [Symbol.iterator]: () => IterableIterator<FieldMetadata>;
@@ -86,3 +86,25 @@ describe("custom id column", function () {
86
86
  });
87
87
  });
88
88
  });
89
+ //typing game
90
+ // var z = <Z>(y: Z) => {
91
+ // }
92
+ // z<number>(1);
93
+ // function myBackendMethod<T>(types: T, values: values<T>) {
94
+ // }
95
+ // type values<T> = {
96
+ // [Property in keyof T]: T[Property] extends new (...args: any[]) => infer R ? R : any;
97
+ // };
98
+ // const a1 = AccountManager;
99
+ // const a = {
100
+ // a: String.prototype,
101
+ // b: AccountManager.prototype
102
+ // };
103
+ // var zzz: AccountManager = undefined!;
104
+ // myBackendMethod({
105
+ // a: String,
106
+ // b: AccountManager
107
+ // }, {
108
+ // b: new AccountManager(),
109
+ // a: "asdf"
110
+ // })