pangea-server 3.3.99 → 3.3.101

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.
@@ -11,7 +11,7 @@ declare global {
11
11
  type ColHidden<T> = T & {
12
12
  __brand: 'hidden';
13
13
  };
14
- type ColVirtual<T> = CreationOptional<T>;
14
+ type ColComputed<T> = CreationOptional<T>;
15
15
  type ModelInstance<BM extends BaseModel> = InferAttributes<BM> & {
16
16
  id: ModelId;
17
17
  };
@@ -47,12 +47,6 @@ export type ColGeneralOptions = {
47
47
  unique?: boolean;
48
48
  hideByDefault?: boolean;
49
49
  };
50
- export type ColVirtualGet = (this: any) => unknown;
51
- export type ColVirtualSet = (this: any, val: any) => void;
52
- export type ColVirtualOptions = {
53
- get?: ColVirtualGet;
54
- set?: ColVirtualSet;
55
- };
56
50
  export type GetModelFn = () => BaseModelCtor;
57
51
  export type OptionalIfNullish<T> = {
58
52
  [K in keyof T as null extends T[K] ? never : undefined extends T[K] ? never : K]: T[K];
@@ -1,10 +1,12 @@
1
1
  import type { ModelValidateOptions } from 'sequelize';
2
- import type { ColumnType, ColGeneralOptions, ColVirtualOptions } from '../../../database/database.types';
2
+ import type { ColumnType, ColGeneralOptions } from '../../../database/database.types';
3
3
  type ForeignKeyAction = 'RESTRICT' | 'CASCADE' | 'SET NULL';
4
- type ColumnOptions = ColGeneralOptions & ColVirtualOptions & {
4
+ type ColumnOptions = ColGeneralOptions & {
5
5
  validate?: ModelValidateOptions;
6
6
  onUpdate?: ForeignKeyAction;
7
7
  onDelete?: ForeignKeyAction;
8
+ get?: (this: any) => unknown;
9
+ set?: (this: any, val: any) => void;
8
10
  };
9
11
  export declare function Column(type: ColumnType, options?: ColumnOptions): (target: any, propertyName: string) => void;
10
12
  export {};
@@ -36,14 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Column = Column;
37
37
  const seq = __importStar(require("sequelize-typescript"));
38
38
  function Column(type, options = {}) {
39
- const { nullable = false, defaultValue, index, unique = false, hideByDefault, get, set, ...restOptions } = options;
39
+ const { nullable = false, defaultValue, index, unique = false, hideByDefault, ...restOptions } = options;
40
40
  return function (target, propertyName) {
41
41
  seq.Column({
42
42
  type: typeof type === 'string' ? seq.DataType[type] : type,
43
43
  allowNull: nullable,
44
44
  defaultValue,
45
- ...(get && { get }),
46
- ...(set && { set }),
47
45
  ...restOptions,
48
46
  })(target, propertyName);
49
47
  const model = target.constructor;
@@ -1,4 +1,3 @@
1
- import type { ColGeneralOptions, ColVirtualGet, ColVirtualOptions, GetModelFn } from '../../../database/database.types';
1
+ import type { ColGeneralOptions, GetModelFn } from '../../../database/database.types';
2
2
  export declare function ColBool(options?: ColGeneralOptions): (target: any, propertyName: string) => void;
3
3
  export declare function ColForeignKey(getModelFn: GetModelFn, options?: Omit<ColGeneralOptions, 'index'>): (target: any, propertyName: string) => void;
4
- export declare function ColVirtual(options?: ColVirtualOptions | ColVirtualGet): Function;
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ColBool = ColBool;
37
37
  exports.ColForeignKey = ColForeignKey;
38
- exports.ColVirtual = ColVirtual;
39
38
  const seq = __importStar(require("sequelize-typescript"));
40
39
  const column_1 = require("./column");
41
40
  function ColBool(options) {
@@ -47,17 +46,3 @@ function ColForeignKey(getModelFn, options) {
47
46
  seq.ForeignKey(getModelFn)(target, propertyName);
48
47
  };
49
48
  }
50
- function ColVirtual(options) {
51
- let get;
52
- let set;
53
- if (options) {
54
- if (typeof options === 'function') {
55
- get = options;
56
- }
57
- else {
58
- get = options.get;
59
- set = options.set;
60
- }
61
- }
62
- return seq.Column({ type: seq.DataType.VIRTUAL, ...(get && { get }), ...(set && { set }) });
63
- }
@@ -16,6 +16,5 @@ export declare const col: {
16
16
  StrArray: typeof json.ColStrArray;
17
17
  Bool: typeof general.ColBool;
18
18
  ForeignKey: typeof general.ColForeignKey;
19
- Virtual: typeof general.ColVirtual;
20
19
  };
21
20
  export * as rel from './relations';
@@ -53,6 +53,5 @@ exports.col = {
53
53
  StrArray: json.ColStrArray,
54
54
  Bool: general.ColBool,
55
55
  ForeignKey: general.ColForeignKey,
56
- Virtual: general.ColVirtual,
57
56
  };
58
57
  exports.rel = __importStar(require("./relations"));
@@ -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?: NonAttribute<() => string>;
24
+ init?: NonAttribute<() => void>;
25
25
  static get HiddenAttributes(): string[];
26
26
  static get Columns(): Columns;
27
27
  static get ColumnIndexes(): Index[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.99",
4
+ "version": "3.3.101",
5
5
  "files": [
6
6
  "dist"
7
7
  ],