pangea-server 3.3.107 → 3.3.108

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.
@@ -14,10 +14,9 @@ declare global {
14
14
  type ColComputed<T> = CreationOptional<T>;
15
15
  type ModelInstance<BM extends BaseModel> = InferAttributes<BM> & {
16
16
  id: ModelId;
17
- init?: InitModel;
18
17
  };
19
18
  type Where<BM extends BaseModel> = WhereOptions<BM> & Record<symbol, any>;
20
- type InsertParams<BM extends BaseModel> = OptionalIfNullish<IncludeHidden<StripRelations<Omit<InferCreationAttributes<BM>, 'id' | 'init'>>>> & {
19
+ type InsertParams<BM extends BaseModel> = OptionalIfNullish<IncludeHidden<StripRelations<Omit<InferCreationAttributes<BM>, 'id'>>>> & {
21
20
  id?: ModelId;
22
21
  };
23
22
  type UpdateParams<BM extends BaseModel> = Partial<InsertParams<BM>>;
@@ -27,7 +26,6 @@ declare global {
27
26
  type Tx = Transaction;
28
27
  type Db = _Db;
29
28
  }
30
- export type InitModel = (instance: any) => void;
31
29
  export type Models = Record<ModelName, BaseModelCtor>;
32
30
  export type Seeds<M extends Models> = {
33
31
  [T in keyof M]: InsertParams<InstanceType<M[T]>>[];
@@ -318,8 +318,7 @@ function processInstance(model, instance) {
318
318
  }
319
319
  }
320
320
  const jsonInstance = instance.toJSON();
321
- instance.init?.(jsonInstance);
322
- jsonInstance.init = instance.init;
321
+ model.InitInstance(jsonInstance);
323
322
  return jsonInstance;
324
323
  }
325
324
  function processInstances(model, instances) {
@@ -1,6 +1,6 @@
1
1
  import { Model, Column } from 'sequelize-typescript';
2
2
  import type { NonAttribute } from 'sequelize';
3
- import type { InitModel, Index, DefaultValue, GetModelFn } from '../database.types';
3
+ import type { Index, DefaultValue, GetModelFn } from '../database.types';
4
4
  type Column = {
5
5
  allowNull: boolean;
6
6
  defaultValue: DefaultValue | undefined;
@@ -21,7 +21,7 @@ export declare abstract class BaseModel extends Model {
21
21
  private static __Relations?;
22
22
  id: ModelId;
23
23
  version: NonAttribute<number>;
24
- init?: InitModel;
24
+ static InitInstance(_instance: any): void;
25
25
  static get HiddenAttributes(): string[];
26
26
  static get Columns(): Columns;
27
27
  static get ColumnIndexes(): Index[];
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseModel = void 0;
13
13
  const sequelize_typescript_1 = require("sequelize-typescript");
14
14
  class BaseModel extends sequelize_typescript_1.Model {
15
+ static InitInstance(_instance) { }
15
16
  static get HiddenAttributes() {
16
17
  return this.__HiddenAttributes || [];
17
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.107",
4
+ "version": "3.3.108",
5
5
  "files": [
6
6
  "dist"
7
7
  ],