@synergy-server/core 0.0.2 → 0.0.3

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.
@@ -2,7 +2,7 @@ import { PassportStatic } from 'passport';
2
2
  import { Request, Response } from 'express';
3
3
  declare const _default: {
4
4
  initializePassport(passport: PassportStatic): void;
5
- isAuthenticated(req: Request, res: Response, done: Function): Response<any, Record<string, any>>;
6
- isSuperAdmin(req: Request, res: Response, done: Function): Response<any, Record<string, any>>;
5
+ isAuthenticated(req: Request, res: Response, done: Function): Response<any, Record<string, any>> | undefined;
6
+ isSuperAdmin(req: Request, res: Response, done: Function): Response<any, Record<string, any>> | undefined;
7
7
  };
8
8
  export default _default;
@@ -18,7 +18,7 @@ interface TranslateData {
18
18
  declare const _default: {
19
19
  prepareIncludes(object: ModelStatic<Model<any, any>>, params: {
20
20
  [key: string]: any;
21
- }, attributes?: string[], filters?: Record<string, unknown>, order?: any[], extraAttributes?: string[]): IncludeOptions[] | {
21
+ }, attributes?: string[], filters?: Record<string, any> | null, order?: any[] | null, extraAttributes?: string[]): IncludeOptions[] | {
22
22
  all: true;
23
23
  };
24
24
  setAuthor(objectData: Record<string, unknown>, req: Request): Promise<void>;
@@ -1,61 +1,26 @@
1
1
  import { StatusCodes } from 'http-status-codes';
2
2
  import { NextFunction, Request, Response } from 'express';
3
3
  import { AppObject } from '@/src/types';
4
+ interface ControllerResult<T> {
5
+ status: number;
6
+ responseData: T;
7
+ }
4
8
  declare const _default: {
5
- findAllItems(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<{
6
- status: StatusCodes;
7
- responseData: Record<string, any>[];
8
- } | {
9
- status: StatusCodes;
10
- responseData: {
11
- message: any;
12
- };
13
- }>;
14
- findItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<any>;
15
- findOne(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<{
16
- status: StatusCodes;
17
- responseData: {
18
- message: string;
19
- };
20
- }>;
21
- findPredefinedItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<any>;
22
- createItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>, afterCreate?: Function | undefined): Promise<{
23
- status: StatusCodes;
24
- responseData: any;
25
- }>;
26
- updateItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>, afterUpdate?: any): Promise<{
27
- status: StatusCodes;
28
- responseData: any;
29
- }>;
30
- confirmItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<{
31
- status: StatusCodes;
32
- data: any;
33
- message: string;
34
- responseData?: undefined;
35
- } | {
36
- status: StatusCodes;
37
- responseData: {
38
- message: any;
39
- };
40
- data?: undefined;
41
- message?: undefined;
42
- }>;
9
+ findAllItems(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<ControllerResult<any>>;
10
+ findItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<ControllerResult<any>>;
11
+ findOne(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<ControllerResult<any>>;
12
+ findPredefinedItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<ControllerResult<any>>;
13
+ createItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>, afterCreate?: Function | undefined): Promise<ControllerResult<any>>;
14
+ updateItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>, afterUpdate?: Function | undefined): Promise<ControllerResult<any>>;
15
+ confirmItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<ControllerResult<any>>;
43
16
  undoConfirmItem(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>): Promise<{
44
17
  status: StatusCodes;
45
18
  responseData: {
46
19
  message: any;
47
20
  };
48
21
  }>;
49
- deleteItem(req: Request, res: Response, next: NextFunction, object: AppObject, params: Record<string, any>, afterDelete: any): Promise<{
50
- status: StatusCodes;
51
- responseData: {
52
- message: any;
53
- };
54
- }>;
55
- changeItemDeletionMark(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>, afterUpdate?: any): Promise<{
56
- status: StatusCodes;
57
- responseData: any;
58
- }>;
22
+ deleteItem(req: Request, res: Response, next: NextFunction, object: AppObject, params: Record<string, any> | undefined, afterDelete: Function | undefined): Promise<ControllerResult<any>>;
23
+ changeItemDeletionMark(req: Request, res: Response, next: NextFunction, object: AppObject, params?: Record<string, any>, afterUpdate?: Function | undefined): Promise<ControllerResult<any>>;
59
24
  calculateRegisterTotals(req: Request, res: Response, next: NextFunction, object: AppObject): Promise<{
60
25
  status: StatusCodes;
61
26
  responseData: {
@@ -18,6 +18,6 @@ declare const _default: {
18
18
  };
19
19
  }>;
20
20
  exportProcessor(req: Request, res: Response, next: NextFunction, object: AppObject): Promise<any>;
21
- importProcessor(req: Request, res: Response, next: NextFunction, object: AppObject): Promise<Response<any, Record<string, any>>>;
21
+ importProcessor(req: Request, res: Response, next: NextFunction, object: AppObject): Promise<Response<any, Record<string, any>> | undefined>;
22
22
  };
23
23
  export default _default;
@@ -2,6 +2,6 @@ import { ModelStatic, Model, Transaction } from 'sequelize';
2
2
  import { AppObject } from '@/src/types';
3
3
  declare const _default: {
4
4
  setNumber(object: AppObject, objectData: Record<string, any>, t: Transaction): Promise<void>;
5
- nextNumber(object: ModelStatic<Model<any, any>>, prefix: string, numberPeriod: any, t: Transaction): Promise<number>;
5
+ nextNumber(object: ModelStatic<Model<any, any>>, prefix: string, numberPeriod: undefined, t: Transaction): Promise<number>;
6
6
  };
7
7
  export default _default;
@@ -1,6 +1,50 @@
1
1
  import { StatusCodes } from 'http-status-codes';
2
2
  import { NextFunction, Request, Response } from 'express';
3
3
  import { AppObject } from '@/src/types';
4
+ interface Field {
5
+ id: string;
6
+ dbName: string;
7
+ type: string;
8
+ isTablePart?: boolean;
9
+ virtual?: boolean;
10
+ index?: boolean;
11
+ primaryKey?: boolean;
12
+ unique?: boolean;
13
+ notNull?: boolean;
14
+ defaultValue?: string | number | null;
15
+ autoIncrement?: boolean;
16
+ typeOptions?: {
17
+ length?: number;
18
+ precision?: number;
19
+ scale?: number;
20
+ };
21
+ multiType?: boolean;
22
+ ref?: string;
23
+ fields: Field[];
24
+ }
25
+ interface CreateTableAction {
26
+ action: 'createTable';
27
+ newTable: Field;
28
+ }
29
+ interface ChangeTableAction {
30
+ action: 'changeTable';
31
+ oldTable: Field;
32
+ newTable: Field;
33
+ }
34
+ interface DropTableAction {
35
+ action: 'dropTable';
36
+ oldTable: Field;
37
+ }
38
+ type TablePartAction = CreateTableAction | ChangeTableAction | DropTableAction;
39
+ interface MigrationAction {
40
+ action: 'addField' | 'dropField' | 'renameField' | 'changeField' | 'addIndex' | 'removeIndex';
41
+ fieldName?: string;
42
+ oldName?: string;
43
+ newName?: string;
44
+ field?: Field;
45
+ oldField?: Field;
46
+ newField?: Field;
47
+ }
4
48
  declare const _default: {
5
49
  executeMigrations(req: Request, res: Response, next: NextFunction, object: AppObject): Promise<{
6
50
  status: StatusCodes;
@@ -8,7 +52,7 @@ declare const _default: {
8
52
  message: string;
9
53
  };
10
54
  }>;
11
- prepareFieldsDifs(oldFields: Record<string, any>[], newFields: Record<string, any>[], tableParts: Record<string, any>[]): any[];
55
+ prepareFieldsDifs(oldFields: Field[], newFields: Field[], tableParts: TablePartAction[]): MigrationAction[];
12
56
  createTable(appObject: AppObject): Promise<boolean>;
13
57
  updateTable(tableData: Record<string, any>): Promise<boolean>;
14
58
  };
@@ -1,6 +1,6 @@
1
1
  import xl from 'exceljs';
2
2
  import { Request, Response } from 'express';
3
3
  declare const _default: {
4
- generateExcel(req: Request, res?: Response): Promise<xl.Workbook>;
4
+ generateExcel(req: Request, res?: Response | null): Promise<xl.Workbook>;
5
5
  };
6
6
  export default _default;
@@ -9,7 +9,7 @@ interface Params {
9
9
  serverModule?: string;
10
10
  }
11
11
  declare const _default: {
12
- updateInitialData(object: ModelStatic<Model<any, any>>, filename: string, params?: Params): Promise<void>;
12
+ updateInitialData(object: ModelStatic<Model<any, any>>, filename: string, params: Params): Promise<void>;
13
13
  updatePredefinedInitialData(object: AppObject): Promise<void>;
14
14
  };
15
15
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { Request } from 'express';
2
2
  declare const _default: {
3
- getUserExecutorRoles(executorId: string): Promise<any[]>;
3
+ getUserExecutorRoles(executorId: string): Promise<import("sequelize").Model<any, any>[]>;
4
4
  getVendorsAndCustomersFilter(counterparies: string[]): Promise<string[]>;
5
5
  getCustomerFilter(req: Request): Promise<{
6
6
  fullAccess: boolean;
@@ -8,7 +8,7 @@ declare const _default: {
8
8
  }>;
9
9
  getForwarderFilter(req: Request): Promise<{
10
10
  fullAccess: boolean;
11
- forwarder: string;
11
+ forwarder: string | undefined;
12
12
  }>;
13
13
  getRoleGroups(req: Request): Promise<string[]>;
14
14
  };
@@ -1,28 +1,28 @@
1
1
  declare const _default: {
2
2
  development: {
3
- username: string;
4
- password: string;
5
- database: string;
6
- host: string;
7
- port: string;
3
+ username: string | undefined;
4
+ password: string | undefined;
5
+ database: string | undefined;
6
+ host: string | undefined;
7
+ port: string | undefined;
8
8
  dialect: string;
9
9
  migrationStorageTableName: string;
10
10
  };
11
11
  test: {
12
- username: string;
13
- password: string;
14
- database: string;
15
- host: string;
16
- port: string;
12
+ username: string | undefined;
13
+ password: string | undefined;
14
+ database: string | undefined;
15
+ host: string | undefined;
16
+ port: string | undefined;
17
17
  dialect: string;
18
18
  migrationStorageTableName: string;
19
19
  };
20
20
  production: {
21
- username: string;
22
- password: string;
23
- database: string;
24
- host: string;
25
- port: string;
21
+ username: string | undefined;
22
+ password: string | undefined;
23
+ database: string | undefined;
24
+ host: string | undefined;
25
+ port: string | undefined;
26
26
  dialect: string;
27
27
  migrationStorageTableName: string;
28
28
  };