@minimaltech/node-infra 0.5.9-24 → 0.5.9-25
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/dist/base/controllers/common.d.ts +2 -2
- package/dist/base/controllers/crud.controller.d.ts +10 -9
- package/dist/base/controllers/crud.controller.js +3 -3
- package/dist/base/controllers/relational.controller.d.ts +6 -6
- package/dist/base/controllers/relational.controller.js +1 -1
- package/dist/base/controllers/service-crud.controller.d.ts +5 -5
- package/dist/base/controllers/service-crud.controller.js +1 -1
- package/dist/base/models/base.model.d.ts +154 -29
- package/dist/base/models/base.model.js +64 -22
- package/dist/base/repositories/base.repository.d.ts +10 -7
- package/dist/base/repositories/base.repository.js +18 -0
- package/dist/base/repositories/searchable-tz-crud.repository.d.ts +4 -4
- package/dist/base/repositories/tz-crud.repository.d.ts +2 -2
- package/dist/base/services/base-crud.service.d.ts +2 -2
- package/dist/common/types.d.ts +5 -5
- package/dist/components/authenticate/models/oauth2-client.model.d.ts +2 -2
- package/dist/components/authenticate/models/oauth2-client.model.js +2 -2
- package/dist/components/authenticate/models/oauth2-scope.model.d.ts +2 -2
- package/dist/components/authenticate/models/oauth2-scope.model.js +2 -2
- package/dist/components/authenticate/models/oauth2-token.model.d.ts +2 -2
- package/dist/components/authenticate/models/oauth2-token.model.js +2 -2
- package/dist/components/authenticate/oauth2-handlers/base.d.ts +2 -2
- package/dist/components/authorize/models/defs.js +6 -6
- package/dist/components/authorize/repositories/authorize.repository.d.ts +2 -2
- package/dist/components/migration/models/migration.model.d.ts +2 -2
- package/dist/components/migration/models/migration.model.js +2 -2
- package/dist/interceptors/content-range.interceptor.d.ts +4 -4
- package/dist/mixins/duplicatable.mixin.d.ts +2 -3
- package/dist/mixins/duplicatable.mixin.js +2 -2
- package/dist/mixins/id.mixin.d.ts +39 -0
- package/dist/mixins/id.mixin.js +58 -0
- package/dist/mixins/index.d.ts +1 -0
- package/dist/mixins/index.js +1 -0
- package/dist/mixins/tz.mixin.d.ts +10 -1
- package/dist/mixins/tz.mixin.js +6 -5
- package/dist/mixins/user-audit.mixin.d.ts +2 -2
- package/dist/utilities/model.utility.d.ts +2 -2
- package/dist/utilities/query.utility.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Filter } from '@loopback/repository';
|
|
2
2
|
import { IController } from '../../common';
|
|
3
3
|
import { ApplicationLogger } from '../../helpers';
|
|
4
|
-
import {
|
|
5
|
-
export declare const applyLimit: <E extends
|
|
4
|
+
import { BaseEntity } from '../models';
|
|
5
|
+
export declare const applyLimit: <E extends BaseEntity>(filter?: Filter<E>) => Filter<E>;
|
|
6
6
|
export declare class BaseController implements IController {
|
|
7
7
|
logger: ApplicationLogger;
|
|
8
8
|
defaultLimit: number;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Getter } from '@loopback/core';
|
|
2
|
-
import { CrudRestControllerOptions } from '@loopback/rest-crud';
|
|
3
2
|
import { Count, Filter, FilterExcludingWhere, Where } from '@loopback/repository';
|
|
4
3
|
import { SchemaRef } from '@loopback/rest';
|
|
5
|
-
import {
|
|
4
|
+
import { CrudRestControllerOptions } from '@loopback/rest-crud';
|
|
6
5
|
import { EntityRelationType, IdType } from '../../common/types';
|
|
7
6
|
import { IJWTTokenPayload } from '../../components/authenticate/common/types';
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { BaseEntity } from '../models';
|
|
8
|
+
import { DefaultCrudRepository } from '../repositories';
|
|
9
|
+
export interface ICrudControllerOptions<E extends BaseEntity> {
|
|
10
|
+
entity: typeof BaseEntity & {
|
|
10
11
|
prototype: E;
|
|
11
12
|
};
|
|
12
13
|
repository: {
|
|
@@ -30,9 +31,9 @@ export interface ICrudControllerOptions<E extends BaseIdEntity> {
|
|
|
30
31
|
};
|
|
31
32
|
doInjectCurrentUser?: boolean;
|
|
32
33
|
}
|
|
33
|
-
export declare const defineCrudController: <E extends
|
|
34
|
-
new (repository:
|
|
35
|
-
repository:
|
|
34
|
+
export declare const defineCrudController: <E extends BaseEntity>(opts: ICrudControllerOptions<E>) => {
|
|
35
|
+
new (repository: DefaultCrudRepository<E, EntityRelationType>): {
|
|
36
|
+
repository: DefaultCrudRepository<E, EntityRelationType>;
|
|
36
37
|
defaultLimit: number;
|
|
37
38
|
find(filter?: Filter<E>): Promise<(E & EntityRelationType)[]>;
|
|
38
39
|
findById(id: IdType, filter?: FilterExcludingWhere<E>): Promise<E & EntityRelationType>;
|
|
@@ -40,7 +41,7 @@ export declare const defineCrudController: <E extends BaseTzEntity>(opts: ICrudC
|
|
|
40
41
|
count(where?: Where<E>): Promise<Count>;
|
|
41
42
|
};
|
|
42
43
|
} | {
|
|
43
|
-
new (repository:
|
|
44
|
+
new (repository: DefaultCrudRepository<E, EntityRelationType>, getCurrentUser?: Getter<IJWTTokenPayload>): {
|
|
44
45
|
getCurrentUser?: Getter<IJWTTokenPayload>;
|
|
45
46
|
_getContextUser(): Promise<{
|
|
46
47
|
userId: IdType;
|
|
@@ -57,7 +58,7 @@ export declare const defineCrudController: <E extends BaseTzEntity>(opts: ICrudC
|
|
|
57
58
|
deleteById(id: IdType): Promise<{
|
|
58
59
|
id: IdType;
|
|
59
60
|
}>;
|
|
60
|
-
repository:
|
|
61
|
+
repository: DefaultCrudRepository<E, EntityRelationType>;
|
|
61
62
|
defaultLimit: number;
|
|
62
63
|
find(filter?: Filter<E>): Promise<(E & EntityRelationType)[]>;
|
|
63
64
|
findById(id: IdType, filter?: FilterExcludingWhere<E>): Promise<E & EntityRelationType>;
|
|
@@ -26,9 +26,9 @@ const core_1 = require("@loopback/core");
|
|
|
26
26
|
const repository_1 = require("@loopback/repository");
|
|
27
27
|
const rest_1 = require("@loopback/rest");
|
|
28
28
|
const common_1 = require("../../common");
|
|
29
|
-
const common_2 = require("./common");
|
|
30
|
-
const security_1 = require("@loopback/security");
|
|
31
29
|
const model_utility_1 = require("../../utilities/model.utility");
|
|
30
|
+
const security_1 = require("@loopback/security");
|
|
31
|
+
const common_2 = require("./common");
|
|
32
32
|
// --------------------------------------------------------------------------------------------------------------
|
|
33
33
|
const defineCrudController = (opts) => {
|
|
34
34
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -246,7 +246,7 @@ const defineCrudController = (opts) => {
|
|
|
246
246
|
'application/json': {
|
|
247
247
|
schema: (_e = schemaOptions === null || schemaOptions === void 0 ? void 0 : schemaOptions.createRequestBody) !== null && _e !== void 0 ? _e : (0, rest_1.getModelSchemaRef)(entityOptions, {
|
|
248
248
|
title: `New ${entityOptions.name} payload`,
|
|
249
|
-
exclude: ['id', 'createdAt', 'modifiedAt'],
|
|
249
|
+
// exclude: ['id', 'createdAt', 'modifiedAt'],
|
|
250
250
|
}),
|
|
251
251
|
},
|
|
252
252
|
},
|
|
@@ -2,7 +2,7 @@ import { ControllerClass } from '@loopback/core';
|
|
|
2
2
|
import { SchemaObject } from '@loopback/rest';
|
|
3
3
|
import { NullableType, TRelationType } from '../../common/types';
|
|
4
4
|
import { Class } from '@loopback/service-proxy';
|
|
5
|
-
import {
|
|
5
|
+
import { TBaseTzEntity } from '../models';
|
|
6
6
|
import { BaseController } from './common';
|
|
7
7
|
export interface IRelationCrudControllerOptions {
|
|
8
8
|
association: {
|
|
@@ -31,9 +31,9 @@ export interface IRelationCrudControllerOptions {
|
|
|
31
31
|
endPoint?: string;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
export declare const defineRelationViewController: <S extends
|
|
35
|
-
T extends
|
|
36
|
-
TE extends
|
|
34
|
+
export declare const defineRelationViewController: <S extends TBaseTzEntity, // Source Entity Type
|
|
35
|
+
T extends TBaseTzEntity, // Target Entity Type
|
|
36
|
+
TE extends TBaseTzEntity = any>(opts: {
|
|
37
37
|
baseClass?: Class<BaseController>;
|
|
38
38
|
entities: {
|
|
39
39
|
source: string;
|
|
@@ -47,7 +47,7 @@ TE extends BaseTzEntity = any>(opts: {
|
|
|
47
47
|
endPoint?: string;
|
|
48
48
|
schema?: SchemaObject;
|
|
49
49
|
}) => ControllerClass;
|
|
50
|
-
export declare const defineAssociateController: <S extends
|
|
50
|
+
export declare const defineAssociateController: <S extends TBaseTzEntity, T extends TBaseTzEntity, R extends TBaseTzEntity | NullableType>(opts: {
|
|
51
51
|
baseClass: ReturnType<typeof defineRelationViewController>;
|
|
52
52
|
relation: {
|
|
53
53
|
name: string;
|
|
@@ -57,4 +57,4 @@ export declare const defineAssociateController: <S extends BaseTzEntity, T exten
|
|
|
57
57
|
endPoint?: string;
|
|
58
58
|
schema?: SchemaObject;
|
|
59
59
|
}) => ControllerClass;
|
|
60
|
-
export declare const defineRelationCrudController: <S extends
|
|
60
|
+
export declare const defineRelationCrudController: <S extends TBaseTzEntity, T extends TBaseTzEntity, R extends TBaseTzEntity | NullableType>(controllerOptions: IRelationCrudControllerOptions) => ControllerClass;
|
|
@@ -31,8 +31,8 @@ const rest_1 = require("@loopback/rest");
|
|
|
31
31
|
const get_1 = __importDefault(require("lodash/get"));
|
|
32
32
|
const common_1 = require("../../common");
|
|
33
33
|
const utilities_1 = require("../../utilities");
|
|
34
|
-
const common_2 = require("./common");
|
|
35
34
|
const security_1 = require("@loopback/security");
|
|
35
|
+
const common_2 = require("./common");
|
|
36
36
|
// --------------------------------------------------------------------------------------------------------------
|
|
37
37
|
const defineRelationViewController = (opts) => {
|
|
38
38
|
const { baseClass, entities, relation, defaultLimit = common_1.App.DEFAULT_QUERY_LIMIT, endPoint = '', schema, } = opts;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Getter } from '@loopback/core';
|
|
2
2
|
import { Count, Filter, FilterExcludingWhere, Where } from '@loopback/repository';
|
|
3
|
-
import {
|
|
3
|
+
import { RequestContext, SchemaRef } from '@loopback/rest';
|
|
4
4
|
import { CrudRestControllerOptions } from '@loopback/rest-crud';
|
|
5
5
|
import { EntityRelationType, ICrudService, IdType } from '../../common/types';
|
|
6
6
|
import { IJWTTokenPayload } from '../../components/authenticate/common/types';
|
|
7
|
-
import {
|
|
8
|
-
export interface IServiceCrudControllerOptions<E extends
|
|
9
|
-
entity: typeof
|
|
7
|
+
import { BaseEntity, TBaseTzEntity } from '../models';
|
|
8
|
+
export interface IServiceCrudControllerOptions<E extends BaseEntity> {
|
|
9
|
+
entity: typeof BaseEntity & {
|
|
10
10
|
prototype: E;
|
|
11
11
|
};
|
|
12
12
|
service: {
|
|
@@ -32,7 +32,7 @@ export interface IServiceCrudControllerOptions<E extends BaseIdEntity> {
|
|
|
32
32
|
doInjectCurrentUser?: boolean;
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
export declare const defineServiceCrudController: <E extends
|
|
35
|
+
export declare const defineServiceCrudController: <E extends TBaseTzEntity>(opts: IServiceCrudControllerOptions<E>) => {
|
|
36
36
|
new (requestContext: RequestContext, service: ICrudService<E>, getCurrentUser?: Getter<IJWTTokenPayload>): {
|
|
37
37
|
requestContext: RequestContext;
|
|
38
38
|
service: ICrudService<E>;
|
|
@@ -17,9 +17,9 @@ const core_1 = require("@loopback/core");
|
|
|
17
17
|
const repository_1 = require("@loopback/repository");
|
|
18
18
|
const rest_1 = require("@loopback/rest");
|
|
19
19
|
const common_1 = require("../../common");
|
|
20
|
+
const model_utility_1 = require("../../utilities/model.utility");
|
|
20
21
|
const security_1 = require("@loopback/security");
|
|
21
22
|
const common_2 = require("./common");
|
|
22
|
-
const model_utility_1 = require("../../utilities/model.utility");
|
|
23
23
|
// --------------------------------------------------------------------------------------------------------------
|
|
24
24
|
const defineServiceCrudController = (opts) => {
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Entity } from '@loopback/repository';
|
|
2
2
|
export declare class BaseEntity extends Entity {
|
|
3
3
|
}
|
|
4
|
-
export declare class
|
|
5
|
-
|
|
4
|
+
export declare class BaseKVEntity<T = any> extends BaseEntity {
|
|
5
|
+
payload: T;
|
|
6
6
|
}
|
|
7
7
|
export declare class BaseNumberIdEntity extends BaseEntity {
|
|
8
8
|
id: number;
|
|
@@ -10,10 +10,10 @@ export declare class BaseNumberIdEntity extends BaseEntity {
|
|
|
10
10
|
export declare class BaseStringIdEntity extends BaseEntity {
|
|
11
11
|
id: string;
|
|
12
12
|
}
|
|
13
|
-
export declare class
|
|
14
|
-
payload: any;
|
|
13
|
+
export declare class BaseIdEntity extends BaseNumberIdEntity {
|
|
15
14
|
}
|
|
16
|
-
|
|
15
|
+
export type TBaseIdEntity = BaseNumberIdEntity | BaseStringIdEntity;
|
|
16
|
+
declare const BaseNumberTzEntity_base: {
|
|
17
17
|
new (...args: any[]): {
|
|
18
18
|
createdAt: Date;
|
|
19
19
|
modifiedAt: Date;
|
|
@@ -22,10 +22,25 @@ declare const BaseTzEntity_base: {
|
|
|
22
22
|
toJSON: () => Object;
|
|
23
23
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
24
24
|
};
|
|
25
|
-
} & typeof
|
|
26
|
-
export declare class
|
|
25
|
+
} & typeof BaseNumberIdEntity;
|
|
26
|
+
export declare class BaseNumberTzEntity extends BaseNumberTzEntity_base {
|
|
27
|
+
}
|
|
28
|
+
declare const BaseStringTzEntity_base: {
|
|
29
|
+
new (...args: any[]): {
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
modifiedAt: Date;
|
|
32
|
+
getId: () => any;
|
|
33
|
+
getIdObject: () => Object;
|
|
34
|
+
toJSON: () => Object;
|
|
35
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
36
|
+
};
|
|
37
|
+
} & typeof BaseStringIdEntity;
|
|
38
|
+
export declare class BaseStringTzEntity extends BaseStringTzEntity_base {
|
|
39
|
+
}
|
|
40
|
+
export declare class BaseTzEntity extends BaseNumberTzEntity {
|
|
27
41
|
}
|
|
28
|
-
|
|
42
|
+
export type TBaseTzEntity = BaseNumberTzEntity | BaseStringTzEntity;
|
|
43
|
+
declare const BaseNumberUserAuditTzEntity_base: {
|
|
29
44
|
new (...args: any[]): {
|
|
30
45
|
createdBy: import("../..").IdType;
|
|
31
46
|
modifiedBy: import("../..").IdType;
|
|
@@ -34,7 +49,7 @@ declare const BaseUserAuditTzEntity_base: {
|
|
|
34
49
|
toJSON: () => Object;
|
|
35
50
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
36
51
|
};
|
|
37
|
-
} & typeof
|
|
52
|
+
} & typeof BaseNumberTzEntity;
|
|
38
53
|
/**
|
|
39
54
|
* Basic UserAuditMixed class with createdBy and modifiedBy
|
|
40
55
|
*
|
|
@@ -42,9 +57,39 @@ declare const BaseUserAuditTzEntity_base: {
|
|
|
42
57
|
*
|
|
43
58
|
* In case you need to include User, directly extends {@link UserAuditMixin}
|
|
44
59
|
*/
|
|
45
|
-
export declare class
|
|
60
|
+
export declare class BaseNumberUserAuditTzEntity extends BaseNumberUserAuditTzEntity_base {
|
|
61
|
+
}
|
|
62
|
+
declare const BaseStringUserAuditTzEntity_base: {
|
|
63
|
+
new (...args: any[]): {
|
|
64
|
+
createdBy: import("../..").IdType;
|
|
65
|
+
modifiedBy: import("../..").IdType;
|
|
66
|
+
getId: () => any;
|
|
67
|
+
getIdObject: () => Object;
|
|
68
|
+
toJSON: () => Object;
|
|
69
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
70
|
+
};
|
|
71
|
+
} & typeof BaseStringTzEntity;
|
|
72
|
+
export declare class BaseStringUserAuditTzEntity extends BaseStringUserAuditTzEntity_base {
|
|
73
|
+
}
|
|
74
|
+
export declare class BaseUserAuditTzEntity extends BaseNumberUserAuditTzEntity {
|
|
75
|
+
}
|
|
76
|
+
export type TBaseUserAuditTzEntity = BaseNumberUserAuditTzEntity | BaseStringUserAuditTzEntity;
|
|
77
|
+
declare const BaseNumberDataTypeTzEntity_base: {
|
|
78
|
+
new (...args: any[]): {
|
|
79
|
+
tValue?: string;
|
|
80
|
+
nValue?: number;
|
|
81
|
+
jValue?: any;
|
|
82
|
+
bValue?: Array<number>;
|
|
83
|
+
dataType?: string;
|
|
84
|
+
getId: () => any;
|
|
85
|
+
getIdObject: () => Object;
|
|
86
|
+
toJSON: () => Object;
|
|
87
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
88
|
+
};
|
|
89
|
+
} & typeof BaseNumberTzEntity;
|
|
90
|
+
export declare class BaseNumberDataTypeTzEntity extends BaseNumberDataTypeTzEntity_base {
|
|
46
91
|
}
|
|
47
|
-
declare const
|
|
92
|
+
declare const BaseStringDataTypeTzEntity_base: {
|
|
48
93
|
new (...args: any[]): {
|
|
49
94
|
tValue?: string;
|
|
50
95
|
nValue?: number;
|
|
@@ -56,10 +101,13 @@ declare const BaseDataTypeTzEntity_base: {
|
|
|
56
101
|
toJSON: () => Object;
|
|
57
102
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
58
103
|
};
|
|
59
|
-
} & typeof
|
|
60
|
-
export declare class
|
|
104
|
+
} & typeof BaseStringTzEntity;
|
|
105
|
+
export declare class BaseStringDataTypeTzEntity extends BaseStringDataTypeTzEntity_base {
|
|
61
106
|
}
|
|
62
|
-
declare
|
|
107
|
+
export declare class BaseDataTypeTzEntity extends BaseNumberDataTypeTzEntity {
|
|
108
|
+
}
|
|
109
|
+
export type TBaseDataTypeTzEntity = BaseNumberDataTypeTzEntity | BaseStringDataTypeTzEntity;
|
|
110
|
+
declare const BaseNumberTextSearchTzEntity_base: {
|
|
63
111
|
new (...args: any[]): {
|
|
64
112
|
textSearch?: string;
|
|
65
113
|
getId: () => any;
|
|
@@ -67,10 +115,24 @@ declare const BaseTextSearchTzEntity_base: {
|
|
|
67
115
|
toJSON: () => Object;
|
|
68
116
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
69
117
|
};
|
|
70
|
-
} & typeof
|
|
71
|
-
export declare class
|
|
118
|
+
} & typeof BaseNumberTzEntity;
|
|
119
|
+
export declare class BaseNumberTextSearchTzEntity extends BaseNumberTextSearchTzEntity_base {
|
|
72
120
|
}
|
|
73
|
-
declare const
|
|
121
|
+
declare const BaseStringTextSearchTzEntity_base: {
|
|
122
|
+
new (...args: any[]): {
|
|
123
|
+
textSearch?: string;
|
|
124
|
+
getId: () => any;
|
|
125
|
+
getIdObject: () => Object;
|
|
126
|
+
toJSON: () => Object;
|
|
127
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
128
|
+
};
|
|
129
|
+
} & typeof BaseStringTzEntity;
|
|
130
|
+
export declare class BaseStringTextSearchTzEntity extends BaseStringTextSearchTzEntity_base {
|
|
131
|
+
}
|
|
132
|
+
export declare class BaseTextSearchTzEntity extends BaseNumberTextSearchTzEntity {
|
|
133
|
+
}
|
|
134
|
+
export type TBaseTextSearchTzEntity = BaseNumberTextSearchTzEntity | BaseStringTextSearchTzEntity;
|
|
135
|
+
declare const BaseNumberObjectSearchTzEntity_base: {
|
|
74
136
|
new (...args: any[]): {
|
|
75
137
|
objectSearch?: import("../..").AnyObject | undefined;
|
|
76
138
|
getId: () => any;
|
|
@@ -78,10 +140,24 @@ declare const BaseObjectSearchTzEntity_base: {
|
|
|
78
140
|
toJSON: () => Object;
|
|
79
141
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
80
142
|
};
|
|
81
|
-
} & typeof
|
|
82
|
-
export declare class
|
|
143
|
+
} & typeof BaseNumberTzEntity;
|
|
144
|
+
export declare class BaseNumberObjectSearchTzEntity extends BaseNumberObjectSearchTzEntity_base {
|
|
83
145
|
}
|
|
84
|
-
declare const
|
|
146
|
+
declare const BaseStringObjectSearchTzEntity_base: {
|
|
147
|
+
new (...args: any[]): {
|
|
148
|
+
objectSearch?: import("../..").AnyObject | undefined;
|
|
149
|
+
getId: () => any;
|
|
150
|
+
getIdObject: () => Object;
|
|
151
|
+
toJSON: () => Object;
|
|
152
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
153
|
+
};
|
|
154
|
+
} & typeof BaseStringTzEntity;
|
|
155
|
+
export declare class BaseStringObjectSearchTzEntity extends BaseStringObjectSearchTzEntity_base {
|
|
156
|
+
}
|
|
157
|
+
export declare class BaseObjectSearchTzEntity extends BaseNumberObjectSearchTzEntity {
|
|
158
|
+
}
|
|
159
|
+
export type TBaseObjectSearchTzEntity = BaseNumberObjectSearchTzEntity | BaseStringObjectSearchTzEntity;
|
|
160
|
+
declare const BaseNumberSearchableTzEntity_base: {
|
|
85
161
|
new (...args: any[]): {
|
|
86
162
|
objectSearch?: import("../..").AnyObject | undefined;
|
|
87
163
|
getId: () => any;
|
|
@@ -97,10 +173,32 @@ declare const BaseSearchableTzEntity_base: {
|
|
|
97
173
|
toJSON: () => Object;
|
|
98
174
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
99
175
|
};
|
|
100
|
-
} & typeof
|
|
101
|
-
export declare class
|
|
176
|
+
} & typeof BaseNumberTzEntity;
|
|
177
|
+
export declare class BaseNumberSearchableTzEntity extends BaseNumberSearchableTzEntity_base {
|
|
102
178
|
}
|
|
103
|
-
declare const
|
|
179
|
+
declare const BaseStringSearchableTzEntity_base: {
|
|
180
|
+
new (...args: any[]): {
|
|
181
|
+
objectSearch?: import("../..").AnyObject | undefined;
|
|
182
|
+
getId: () => any;
|
|
183
|
+
getIdObject: () => Object;
|
|
184
|
+
toJSON: () => Object;
|
|
185
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
186
|
+
};
|
|
187
|
+
} & {
|
|
188
|
+
new (...args: any[]): {
|
|
189
|
+
textSearch?: string;
|
|
190
|
+
getId: () => any;
|
|
191
|
+
getIdObject: () => Object;
|
|
192
|
+
toJSON: () => Object;
|
|
193
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
194
|
+
};
|
|
195
|
+
} & typeof BaseStringTzEntity;
|
|
196
|
+
export declare class BaseStringSearchableTzEntity extends BaseStringSearchableTzEntity_base {
|
|
197
|
+
}
|
|
198
|
+
export declare class BaseSearchableTzEntity extends BaseNumberSearchableTzEntity {
|
|
199
|
+
}
|
|
200
|
+
export type TBaseSearchableTzEntity = BaseNumberSearchableTzEntity | BaseStringSearchableTzEntity;
|
|
201
|
+
declare const BaseNumberSoftDeleteTzEntity_base: {
|
|
104
202
|
new (...args: any[]): {
|
|
105
203
|
isDeleted?: boolean;
|
|
106
204
|
getId: () => any;
|
|
@@ -108,21 +206,48 @@ declare const BaseSoftDeleteTzEntity_base: {
|
|
|
108
206
|
toJSON: () => Object;
|
|
109
207
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
110
208
|
};
|
|
111
|
-
} & typeof
|
|
112
|
-
export declare class
|
|
209
|
+
} & typeof BaseNumberTzEntity;
|
|
210
|
+
export declare class BaseNumberSoftDeleteTzEntity extends BaseNumberSoftDeleteTzEntity_base {
|
|
113
211
|
}
|
|
114
|
-
declare const
|
|
212
|
+
declare const BaseStringSoftDeleteTzEntity_base: {
|
|
213
|
+
new (...args: any[]): {
|
|
214
|
+
isDeleted?: boolean;
|
|
215
|
+
getId: () => any;
|
|
216
|
+
getIdObject: () => Object;
|
|
217
|
+
toJSON: () => Object;
|
|
218
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
219
|
+
};
|
|
220
|
+
} & typeof BaseStringTzEntity;
|
|
221
|
+
export declare class BaseStringSoftDeleteTzEntity extends BaseStringSoftDeleteTzEntity_base {
|
|
222
|
+
}
|
|
223
|
+
export declare class BaseSoftDeleteTzEntity extends BaseNumberSoftDeleteTzEntity {
|
|
224
|
+
}
|
|
225
|
+
export type TBaseSoftDeleteTzEntity = BaseNumberSoftDeleteTzEntity | BaseStringSoftDeleteTzEntity;
|
|
226
|
+
declare const BaseNumberDuplicatableTzEntity_base: {
|
|
227
|
+
new (...args: any[]): {
|
|
228
|
+
sourceId?: import("../..").IdType;
|
|
229
|
+
getId: () => any;
|
|
230
|
+
getIdObject: () => Object;
|
|
231
|
+
toJSON: () => Object;
|
|
232
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
233
|
+
};
|
|
234
|
+
} & typeof BaseNumberTzEntity;
|
|
235
|
+
export declare class BaseNumberDuplicatableTzEntity extends BaseNumberDuplicatableTzEntity_base {
|
|
236
|
+
}
|
|
237
|
+
declare const BaseStringDuplicatableTzEntity_base: {
|
|
115
238
|
new (...args: any[]): {
|
|
116
239
|
sourceId?: import("../..").IdType;
|
|
117
|
-
id: number;
|
|
118
240
|
getId: () => any;
|
|
119
241
|
getIdObject: () => Object;
|
|
120
242
|
toJSON: () => Object;
|
|
121
243
|
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
122
244
|
};
|
|
123
|
-
} & typeof
|
|
124
|
-
export declare class
|
|
245
|
+
} & typeof BaseNumberTzEntity;
|
|
246
|
+
export declare class BaseStringDuplicatableTzEntity extends BaseStringDuplicatableTzEntity_base {
|
|
247
|
+
}
|
|
248
|
+
export declare class BaseDuplicatableTzEntity extends BaseNumberDuplicatableTzEntity {
|
|
125
249
|
}
|
|
250
|
+
export type TBaseDuplicatableTzEntity = BaseNumberDuplicatableTzEntity | BaseStringDuplicatableTzEntity;
|
|
126
251
|
export declare class BaseBigIdEntity extends BaseEntity {
|
|
127
252
|
id: number;
|
|
128
253
|
}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BaseVectorEntity = exports.BaseBigIdTzEntity = exports.BaseBigIdEntity = exports.BaseDuplicatableTzEntity = exports.BaseSoftDeleteTzEntity = exports.BaseSearchableTzEntity = exports.BaseObjectSearchTzEntity = exports.BaseTextSearchTzEntity = exports.BaseDataTypeTzEntity = exports.BaseUserAuditTzEntity = exports.BaseTzEntity = exports.
|
|
12
|
+
exports.BaseVectorEntity = exports.BaseBigIdTzEntity = exports.BaseBigIdEntity = exports.BaseDuplicatableTzEntity = exports.BaseStringDuplicatableTzEntity = exports.BaseNumberDuplicatableTzEntity = exports.BaseSoftDeleteTzEntity = exports.BaseStringSoftDeleteTzEntity = exports.BaseNumberSoftDeleteTzEntity = exports.BaseSearchableTzEntity = exports.BaseStringSearchableTzEntity = exports.BaseNumberSearchableTzEntity = exports.BaseObjectSearchTzEntity = exports.BaseStringObjectSearchTzEntity = exports.BaseNumberObjectSearchTzEntity = exports.BaseTextSearchTzEntity = exports.BaseStringTextSearchTzEntity = exports.BaseNumberTextSearchTzEntity = exports.BaseDataTypeTzEntity = exports.BaseStringDataTypeTzEntity = exports.BaseNumberDataTypeTzEntity = exports.BaseUserAuditTzEntity = exports.BaseStringUserAuditTzEntity = exports.BaseNumberUserAuditTzEntity = exports.BaseTzEntity = exports.BaseStringTzEntity = exports.BaseNumberTzEntity = exports.BaseIdEntity = exports.BaseStringIdEntity = exports.BaseNumberIdEntity = exports.BaseKVEntity = exports.BaseEntity = void 0;
|
|
13
13
|
const mixins_1 = require("../../mixins");
|
|
14
14
|
const repository_1 = require("@loopback/repository");
|
|
15
15
|
// ---------------------------------------------------------------------
|
|
@@ -17,13 +17,13 @@ class BaseEntity extends repository_1.Entity {
|
|
|
17
17
|
}
|
|
18
18
|
exports.BaseEntity = BaseEntity;
|
|
19
19
|
// ---------------------------------------------------------------------
|
|
20
|
-
class
|
|
20
|
+
class BaseKVEntity extends BaseEntity {
|
|
21
21
|
}
|
|
22
|
-
exports.
|
|
22
|
+
exports.BaseKVEntity = BaseKVEntity;
|
|
23
23
|
__decorate([
|
|
24
|
-
(0, repository_1.property)({ type: '
|
|
25
|
-
__metadata("design:type",
|
|
26
|
-
],
|
|
24
|
+
(0, repository_1.property)({ type: 'object' }),
|
|
25
|
+
__metadata("design:type", Object)
|
|
26
|
+
], BaseKVEntity.prototype, "payload", void 0);
|
|
27
27
|
// ---------------------------------------------------------------------
|
|
28
28
|
class BaseNumberIdEntity extends BaseEntity {
|
|
29
29
|
}
|
|
@@ -32,7 +32,6 @@ __decorate([
|
|
|
32
32
|
(0, repository_1.property)({ type: 'number', id: true, generated: true }),
|
|
33
33
|
__metadata("design:type", Number)
|
|
34
34
|
], BaseNumberIdEntity.prototype, "id", void 0);
|
|
35
|
-
// ---------------------------------------------------------------------
|
|
36
35
|
class BaseStringIdEntity extends BaseEntity {
|
|
37
36
|
}
|
|
38
37
|
exports.BaseStringIdEntity = BaseStringIdEntity;
|
|
@@ -40,16 +39,17 @@ __decorate([
|
|
|
40
39
|
(0, repository_1.property)({ type: 'string', id: true }),
|
|
41
40
|
__metadata("design:type", String)
|
|
42
41
|
], BaseStringIdEntity.prototype, "id", void 0);
|
|
43
|
-
|
|
44
|
-
class BaseKVEntity extends BaseEntity {
|
|
42
|
+
class BaseIdEntity extends BaseNumberIdEntity {
|
|
45
43
|
}
|
|
46
|
-
exports.
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, repository_1.property)({ type: 'object' }),
|
|
49
|
-
__metadata("design:type", Object)
|
|
50
|
-
], BaseKVEntity.prototype, "payload", void 0);
|
|
44
|
+
exports.BaseIdEntity = BaseIdEntity;
|
|
51
45
|
// ---------------------------------------------------------------------
|
|
52
|
-
class
|
|
46
|
+
class BaseNumberTzEntity extends (0, mixins_1.TzMixin)(BaseNumberIdEntity) {
|
|
47
|
+
}
|
|
48
|
+
exports.BaseNumberTzEntity = BaseNumberTzEntity;
|
|
49
|
+
class BaseStringTzEntity extends (0, mixins_1.TzMixin)(BaseStringIdEntity) {
|
|
50
|
+
}
|
|
51
|
+
exports.BaseStringTzEntity = BaseStringTzEntity;
|
|
52
|
+
class BaseTzEntity extends BaseNumberTzEntity {
|
|
53
53
|
}
|
|
54
54
|
exports.BaseTzEntity = BaseTzEntity;
|
|
55
55
|
// ---------------------------------------------------------------------
|
|
@@ -60,31 +60,73 @@ exports.BaseTzEntity = BaseTzEntity;
|
|
|
60
60
|
*
|
|
61
61
|
* In case you need to include User, directly extends {@link UserAuditMixin}
|
|
62
62
|
*/
|
|
63
|
-
class
|
|
63
|
+
class BaseNumberUserAuditTzEntity extends (0, mixins_1.UserAuditMixin)(BaseNumberTzEntity) {
|
|
64
|
+
}
|
|
65
|
+
exports.BaseNumberUserAuditTzEntity = BaseNumberUserAuditTzEntity;
|
|
66
|
+
class BaseStringUserAuditTzEntity extends (0, mixins_1.UserAuditMixin)(BaseStringTzEntity) {
|
|
67
|
+
}
|
|
68
|
+
exports.BaseStringUserAuditTzEntity = BaseStringUserAuditTzEntity;
|
|
69
|
+
class BaseUserAuditTzEntity extends BaseNumberUserAuditTzEntity {
|
|
64
70
|
}
|
|
65
71
|
exports.BaseUserAuditTzEntity = BaseUserAuditTzEntity;
|
|
66
72
|
// ---------------------------------------------------------------------
|
|
67
|
-
class
|
|
73
|
+
class BaseNumberDataTypeTzEntity extends (0, mixins_1.DataTypeMixin)(BaseNumberTzEntity) {
|
|
74
|
+
}
|
|
75
|
+
exports.BaseNumberDataTypeTzEntity = BaseNumberDataTypeTzEntity;
|
|
76
|
+
class BaseStringDataTypeTzEntity extends (0, mixins_1.DataTypeMixin)(BaseStringTzEntity) {
|
|
77
|
+
}
|
|
78
|
+
exports.BaseStringDataTypeTzEntity = BaseStringDataTypeTzEntity;
|
|
79
|
+
class BaseDataTypeTzEntity extends BaseNumberDataTypeTzEntity {
|
|
68
80
|
}
|
|
69
81
|
exports.BaseDataTypeTzEntity = BaseDataTypeTzEntity;
|
|
70
82
|
// ---------------------------------------------------------------------
|
|
71
|
-
class
|
|
83
|
+
class BaseNumberTextSearchTzEntity extends (0, mixins_1.TextSearchMixin)(BaseNumberTzEntity) {
|
|
84
|
+
}
|
|
85
|
+
exports.BaseNumberTextSearchTzEntity = BaseNumberTextSearchTzEntity;
|
|
86
|
+
class BaseStringTextSearchTzEntity extends (0, mixins_1.TextSearchMixin)(BaseStringTzEntity) {
|
|
87
|
+
}
|
|
88
|
+
exports.BaseStringTextSearchTzEntity = BaseStringTextSearchTzEntity;
|
|
89
|
+
class BaseTextSearchTzEntity extends BaseNumberTextSearchTzEntity {
|
|
72
90
|
}
|
|
73
91
|
exports.BaseTextSearchTzEntity = BaseTextSearchTzEntity;
|
|
74
92
|
// ---------------------------------------------------------------------
|
|
75
|
-
class
|
|
93
|
+
class BaseNumberObjectSearchTzEntity extends (0, mixins_1.ObjectSearchMixin)(BaseNumberTzEntity) {
|
|
94
|
+
}
|
|
95
|
+
exports.BaseNumberObjectSearchTzEntity = BaseNumberObjectSearchTzEntity;
|
|
96
|
+
class BaseStringObjectSearchTzEntity extends (0, mixins_1.ObjectSearchMixin)(BaseStringTzEntity) {
|
|
97
|
+
}
|
|
98
|
+
exports.BaseStringObjectSearchTzEntity = BaseStringObjectSearchTzEntity;
|
|
99
|
+
class BaseObjectSearchTzEntity extends BaseNumberObjectSearchTzEntity {
|
|
76
100
|
}
|
|
77
101
|
exports.BaseObjectSearchTzEntity = BaseObjectSearchTzEntity;
|
|
78
102
|
// ---------------------------------------------------------------------
|
|
79
|
-
class
|
|
103
|
+
class BaseNumberSearchableTzEntity extends (0, mixins_1.ObjectSearchMixin)((0, mixins_1.TextSearchMixin)(BaseNumberTzEntity)) {
|
|
104
|
+
}
|
|
105
|
+
exports.BaseNumberSearchableTzEntity = BaseNumberSearchableTzEntity;
|
|
106
|
+
class BaseStringSearchableTzEntity extends (0, mixins_1.ObjectSearchMixin)((0, mixins_1.TextSearchMixin)(BaseStringTzEntity)) {
|
|
107
|
+
}
|
|
108
|
+
exports.BaseStringSearchableTzEntity = BaseStringSearchableTzEntity;
|
|
109
|
+
class BaseSearchableTzEntity extends BaseNumberSearchableTzEntity {
|
|
80
110
|
}
|
|
81
111
|
exports.BaseSearchableTzEntity = BaseSearchableTzEntity;
|
|
82
112
|
// ---------------------------------------------------------------------
|
|
83
|
-
class
|
|
113
|
+
class BaseNumberSoftDeleteTzEntity extends (0, mixins_1.SoftDeleteModelMixin)(BaseNumberTzEntity) {
|
|
114
|
+
}
|
|
115
|
+
exports.BaseNumberSoftDeleteTzEntity = BaseNumberSoftDeleteTzEntity;
|
|
116
|
+
class BaseStringSoftDeleteTzEntity extends (0, mixins_1.SoftDeleteModelMixin)(BaseStringTzEntity) {
|
|
117
|
+
}
|
|
118
|
+
exports.BaseStringSoftDeleteTzEntity = BaseStringSoftDeleteTzEntity;
|
|
119
|
+
class BaseSoftDeleteTzEntity extends BaseNumberSoftDeleteTzEntity {
|
|
84
120
|
}
|
|
85
121
|
exports.BaseSoftDeleteTzEntity = BaseSoftDeleteTzEntity;
|
|
86
122
|
// ---------------------------------------------------------------------
|
|
87
|
-
class
|
|
123
|
+
class BaseNumberDuplicatableTzEntity extends (0, mixins_1.DuplicatableMixin)(BaseNumberTzEntity) {
|
|
124
|
+
}
|
|
125
|
+
exports.BaseNumberDuplicatableTzEntity = BaseNumberDuplicatableTzEntity;
|
|
126
|
+
class BaseStringDuplicatableTzEntity extends (0, mixins_1.DuplicatableMixin)(BaseNumberTzEntity) {
|
|
127
|
+
}
|
|
128
|
+
exports.BaseStringDuplicatableTzEntity = BaseStringDuplicatableTzEntity;
|
|
129
|
+
class BaseDuplicatableTzEntity extends BaseNumberDuplicatableTzEntity {
|
|
88
130
|
}
|
|
89
131
|
exports.BaseDuplicatableTzEntity = BaseDuplicatableTzEntity;
|
|
90
132
|
// ---------------------------------------------------------------------
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EntityClassType, EntityRelationType, IdType, ITzRepository, TDBAction } from '../../common/types';
|
|
2
2
|
import { ApplicationLogger } from '../../helpers';
|
|
3
3
|
import { DefaultCrudRepository as _DefaultCrudRepository, AnyObject, WhereBuilder as BaseWhereBuilder, Command, Count, DataObject, DefaultKeyValueRepository, EntityCrudRepository, Getter, HasManyRepositoryFactory, IsolationLevel, juggler, NamedParameters, PositionalParameters, Transaction, TransactionalEntityRepository, Where } from '@loopback/repository';
|
|
4
|
-
import { BaseEntity, BaseKVEntity,
|
|
4
|
+
import { BaseEntity, BaseKVEntity, TBaseTzEntity } from './../models';
|
|
5
5
|
export declare class WhereBuilder<E extends object = AnyObject> extends BaseWhereBuilder {
|
|
6
6
|
constructor(opts?: Where<E>);
|
|
7
7
|
newInstance(opts?: Where<E>): WhereBuilder<E>;
|
|
8
8
|
clone(): WhereBuilder;
|
|
9
9
|
}
|
|
10
|
-
export declare class DefaultCrudRepository<E extends BaseEntity, ID, Relations extends object = {}> extends _DefaultCrudRepository<E, ID, Relations> {
|
|
10
|
+
export declare abstract class DefaultCrudRepository<E extends BaseEntity, ID, Relations extends object = {}> extends _DefaultCrudRepository<E, ID, Relations> {
|
|
11
11
|
/**
|
|
12
12
|
* @experimental
|
|
13
13
|
*/
|
|
@@ -16,8 +16,12 @@ export declare class DefaultCrudRepository<E extends BaseEntity, ID, Relations e
|
|
|
16
16
|
principalType: string;
|
|
17
17
|
targetRepositoryGetter: Getter<EntityCrudRepository<Target, TargetId>>;
|
|
18
18
|
}): HasManyRepositoryFactory<Target, ForeignKeyType>;
|
|
19
|
+
abstract existsWith(where?: Where<E>, options?: TDBAction): Promise<boolean>;
|
|
20
|
+
abstract createWithReturn(data: DataObject<E>, options?: TDBAction): Promise<E>;
|
|
21
|
+
abstract updateWithReturn(id: IdType, data: DataObject<E>, options?: TDBAction): Promise<E>;
|
|
22
|
+
abstract upsertWith(data: DataObject<E>, where: Where<E>, options?: TDBAction): Promise<E | null>;
|
|
19
23
|
}
|
|
20
|
-
export declare abstract class AbstractTzRepository<E extends
|
|
24
|
+
export declare abstract class AbstractTzRepository<E extends TBaseTzEntity, R extends EntityRelationType = EntityRelationType> extends DefaultCrudRepository<E, IdType, R> implements ITzRepository<E>, TransactionalEntityRepository<E, IdType, R> {
|
|
21
25
|
protected logger: ApplicationLogger;
|
|
22
26
|
constructor(entityClass: EntityClassType<E>, dataSource: juggler.DataSource, scope?: string);
|
|
23
27
|
beginTransaction(options?: IsolationLevel | AnyObject): Promise<Transaction>;
|
|
@@ -37,10 +41,6 @@ export declare abstract class AbstractTzRepository<E extends BaseTzEntity, R ext
|
|
|
37
41
|
newInstance: boolean;
|
|
38
42
|
authorId: IdType;
|
|
39
43
|
}): DataObject<E>;
|
|
40
|
-
abstract existsWith(where?: Where<E>, options?: TDBAction): Promise<boolean>;
|
|
41
|
-
abstract createWithReturn(data: DataObject<E>, options?: TDBAction): Promise<E>;
|
|
42
|
-
abstract updateWithReturn(id: IdType, data: DataObject<E>, options?: TDBAction): Promise<E>;
|
|
43
|
-
abstract upsertWith(data: DataObject<E>, where: Where<E>, options?: TDBAction): Promise<E | null>;
|
|
44
44
|
}
|
|
45
45
|
export declare abstract class AbstractKVRepository<E extends BaseKVEntity> extends DefaultKeyValueRepository<E> {
|
|
46
46
|
constructor(entityClass: EntityClassType<E>, dataSource: juggler.DataSource);
|
|
@@ -61,4 +61,7 @@ export declare abstract class ViewRepository<E extends BaseEntity, R extends Ent
|
|
|
61
61
|
replaceById(_id: IdType, _data: DataObject<E>, _options?: TDBAction): Promise<void>;
|
|
62
62
|
deleteAll(_where?: Where<E>, _options?: TDBAction): Promise<Count>;
|
|
63
63
|
deleteById(_id: IdType, _options?: TDBAction): Promise<void>;
|
|
64
|
+
createWithReturn(_data: DataObject<E>, _options?: TDBAction): Promise<E>;
|
|
65
|
+
updateWithReturn(_id: IdType, _data: DataObject<E>, _options?: TDBAction): Promise<E>;
|
|
66
|
+
upsertWith(_data: DataObject<E>, _where: Where<E>, _options?: TDBAction): Promise<E | null>;
|
|
64
67
|
}
|
|
@@ -173,5 +173,23 @@ class ViewRepository extends DefaultCrudRepository {
|
|
|
173
173
|
message: 'Cannot manipulate entity with view repository!',
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
+
createWithReturn(_data, _options) {
|
|
177
|
+
throw (0, utilities_1.getError)({
|
|
178
|
+
statusCode: 500,
|
|
179
|
+
message: 'Cannot manipulate entity with view repository!',
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
updateWithReturn(_id, _data, _options) {
|
|
183
|
+
throw (0, utilities_1.getError)({
|
|
184
|
+
statusCode: 500,
|
|
185
|
+
message: 'Cannot manipulate entity with view repository!',
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
upsertWith(_data, _where, _options) {
|
|
189
|
+
throw (0, utilities_1.getError)({
|
|
190
|
+
statusCode: 500,
|
|
191
|
+
message: 'Cannot manipulate entity with view repository!',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
176
194
|
}
|
|
177
195
|
exports.ViewRepository = ViewRepository;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyObject, EntityClassType, EntityRelationType, IdType, TDBAction, TRelationType } from '../../common/types';
|
|
2
2
|
import { DataObject, Getter, Inclusion, juggler, Where } from '@loopback/repository';
|
|
3
|
-
import { BaseObjectSearchTzEntity, BaseSearchableTzEntity, BaseTextSearchTzEntity,
|
|
3
|
+
import { BaseObjectSearchTzEntity, BaseSearchableTzEntity, BaseTextSearchTzEntity, TBaseTzEntity } from './../models';
|
|
4
4
|
import { TzCrudRepository } from './tz-crud.repository';
|
|
5
5
|
export declare abstract class SearchableTzCrudRepository<E extends BaseTextSearchTzEntity | BaseObjectSearchTzEntity | BaseSearchableTzEntity, R extends EntityRelationType = EntityRelationType> extends TzCrudRepository<E, R> {
|
|
6
6
|
protected readonly searchableInclusions: Inclusion[];
|
|
@@ -17,14 +17,14 @@ export declare abstract class SearchableTzCrudRepository<E extends BaseTextSearc
|
|
|
17
17
|
data?: DataObject<E>;
|
|
18
18
|
entity: E & R;
|
|
19
19
|
}): object;
|
|
20
|
-
abstract onInclusionChanged<RM extends
|
|
20
|
+
abstract onInclusionChanged<RM extends TBaseTzEntity>(opts: {
|
|
21
21
|
relation: string;
|
|
22
22
|
relationRepository: TzCrudRepository<RM>;
|
|
23
23
|
entities: RM[];
|
|
24
24
|
options?: AnyObject;
|
|
25
25
|
}): Promise<void>;
|
|
26
|
-
protected registerOnInclusionChanged<RM extends
|
|
27
|
-
protected handleInclusionChanged<RM extends
|
|
26
|
+
protected registerOnInclusionChanged<RM extends TBaseTzEntity>(relation: string, relationRepositoryGetter: Getter<TzCrudRepository<RM>>): Promise<void>;
|
|
27
|
+
protected handleInclusionChanged<RM extends TBaseTzEntity>(opts: {
|
|
28
28
|
relationName: string;
|
|
29
29
|
relationType: TRelationType;
|
|
30
30
|
entities: RM[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EntityClassType, EntityRelationType, IdType, TDBAction } from '../../common/types';
|
|
2
2
|
import { Count, DataObject, juggler, Where } from '@loopback/repository';
|
|
3
|
-
import { BaseTzEntity } from './../models';
|
|
4
3
|
import { AbstractTzRepository } from './base.repository';
|
|
5
|
-
|
|
4
|
+
import { TBaseTzEntity } from '../models';
|
|
5
|
+
export declare abstract class TzCrudRepository<E extends TBaseTzEntity, R extends EntityRelationType = EntityRelationType> extends AbstractTzRepository<E, R> {
|
|
6
6
|
constructor(entityClass: EntityClassType<E>, dataSource: juggler.DataSource, scope?: string);
|
|
7
7
|
existsWith(where?: Where<E>, options?: TDBAction): Promise<boolean>;
|
|
8
8
|
create(data: DataObject<E>, options?: TDBAction & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EntityRelationType, ICrudMethodOptions, ICrudService, IdType } from '../../common';
|
|
2
2
|
import { Count, Filter, Where } from '@loopback/repository';
|
|
3
|
+
import { TBaseTzEntity } from '../models';
|
|
3
4
|
import { AbstractTzRepository } from '../repositories';
|
|
4
|
-
import { BaseTzEntity } from './../models';
|
|
5
5
|
import { BaseService } from './base.service';
|
|
6
|
-
export declare abstract class BaseCrudService<E extends
|
|
6
|
+
export declare abstract class BaseCrudService<E extends TBaseTzEntity> extends BaseService implements ICrudService<E> {
|
|
7
7
|
repository: AbstractTzRepository<E, EntityRelationType>;
|
|
8
8
|
constructor(opts: {
|
|
9
9
|
scope: string;
|
package/dist/common/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BaseEntity, TBaseIdEntity, TBaseTzEntity } from '../base/models';
|
|
2
|
+
import { AbstractTzRepository } from '../base/repositories';
|
|
3
3
|
import { Binding, BindingFromClassOptions, BindingKey, Constructor, ControllerClass } from '@loopback/core';
|
|
4
4
|
import { Count, DataObject, Entity, Filter, JugglerDataSource, Options, Repository, Transaction, Where } from '@loopback/repository';
|
|
5
5
|
import { RequestContext, SequenceHandler } from '@loopback/rest';
|
|
@@ -115,7 +115,7 @@ export interface IRepository {
|
|
|
115
115
|
export type TDBAction = Options & {
|
|
116
116
|
transaction?: Transaction;
|
|
117
117
|
};
|
|
118
|
-
export interface IPersistableRepository<E extends
|
|
118
|
+
export interface IPersistableRepository<E extends TBaseIdEntity> extends IRepository {
|
|
119
119
|
findOne(filter?: Filter<E>, options?: TDBAction): Promise<E | null>;
|
|
120
120
|
existsWith(where?: Where<any>, options?: TDBAction): Promise<boolean>;
|
|
121
121
|
create(data: DataObject<E>, options?: TDBAction): Promise<E>;
|
|
@@ -127,7 +127,7 @@ export interface IPersistableRepository<E extends BaseIdEntity> extends IReposit
|
|
|
127
127
|
upsertWith(data: DataObject<E>, where: Where<any>, options?: TDBAction): Promise<E | null>;
|
|
128
128
|
replaceById(id: IdType, data: DataObject<E>, options?: TDBAction): Promise<void>;
|
|
129
129
|
}
|
|
130
|
-
export interface ITzRepository<E extends
|
|
130
|
+
export interface ITzRepository<E extends TBaseTzEntity> extends IPersistableRepository<E> {
|
|
131
131
|
mixTimestamp(entity: DataObject<E>, options?: {
|
|
132
132
|
newInstance: boolean;
|
|
133
133
|
}): DataObject<E>;
|
|
@@ -151,7 +151,7 @@ export interface ICrudMethodOptions {
|
|
|
151
151
|
requestContext: RequestContext;
|
|
152
152
|
[extra: symbol | string]: any;
|
|
153
153
|
}
|
|
154
|
-
export interface ICrudService<E extends
|
|
154
|
+
export interface ICrudService<E extends TBaseTzEntity> extends IService {
|
|
155
155
|
repository: AbstractTzRepository<E, EntityRelationType>;
|
|
156
156
|
find(filter: Filter<E>, options: ICrudMethodOptions): Promise<Array<E & EntityRelationType>>;
|
|
157
157
|
findById(id: IdType, filter: Filter<E>, options: ICrudMethodOptions): Promise<E & EntityRelationType>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseNumberTzEntity } from '../../../base';
|
|
2
2
|
import { NumberIdType } from '../../../common';
|
|
3
|
-
export declare class OAuth2Client extends
|
|
3
|
+
export declare class OAuth2Client extends BaseNumberTzEntity {
|
|
4
4
|
identifier: string;
|
|
5
5
|
clientId: string;
|
|
6
6
|
name: string;
|
|
@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OAuth2Client = void 0;
|
|
13
|
-
const
|
|
13
|
+
const base_1 = require("../../../base");
|
|
14
14
|
const repository_1 = require("@loopback/repository");
|
|
15
|
-
let OAuth2Client = class OAuth2Client extends
|
|
15
|
+
let OAuth2Client = class OAuth2Client extends base_1.BaseNumberTzEntity {
|
|
16
16
|
constructor(data) {
|
|
17
17
|
super(data);
|
|
18
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class OAuth2Scope extends
|
|
1
|
+
import { BaseNumberTzEntity } from '../../../base';
|
|
2
|
+
export declare class OAuth2Scope extends BaseNumberTzEntity {
|
|
3
3
|
identifier: string;
|
|
4
4
|
name: string;
|
|
5
5
|
description: string;
|
|
@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OAuth2Scope = void 0;
|
|
13
|
-
const
|
|
13
|
+
const base_1 = require("../../../base");
|
|
14
14
|
const repository_1 = require("@loopback/repository");
|
|
15
|
-
let OAuth2Scope = class OAuth2Scope extends
|
|
15
|
+
let OAuth2Scope = class OAuth2Scope extends base_1.BaseNumberTzEntity {
|
|
16
16
|
constructor(data) {
|
|
17
17
|
super(data);
|
|
18
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseNumberTzEntity } from '../../../base';
|
|
2
2
|
import { AnyObject, IdType } from '../../../common';
|
|
3
|
-
export declare class OAuth2Token extends
|
|
3
|
+
export declare class OAuth2Token extends BaseNumberTzEntity {
|
|
4
4
|
token: string;
|
|
5
5
|
type: string;
|
|
6
6
|
status: string;
|
|
@@ -10,11 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OAuth2Token = void 0;
|
|
13
|
-
const
|
|
13
|
+
const base_1 = require("../../../base");
|
|
14
14
|
const common_1 = require("../../../common");
|
|
15
15
|
const repository_1 = require("@loopback/repository");
|
|
16
16
|
const oauth2_client_model_1 = require("./oauth2-client.model");
|
|
17
|
-
let OAuth2Token = class OAuth2Token extends
|
|
17
|
+
let OAuth2Token = class OAuth2Token extends base_1.BaseNumberTzEntity {
|
|
18
18
|
constructor(data) {
|
|
19
19
|
super(data);
|
|
20
20
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseTzEntity } from '../../../base/models';
|
|
2
1
|
import { AnyObject, TInjectionGetter } from '../../../common';
|
|
3
2
|
import { ApplicationLogger } from '../../../helpers';
|
|
4
3
|
import { BaseModel, Client, Falsey, RequestAuthenticationModel, Token, User } from '@node-oauth/oauth2-server';
|
|
5
4
|
import { OAuth2Client, OAuth2Token } from '../models';
|
|
5
|
+
import { TBaseTzEntity } from '../../../base/models';
|
|
6
6
|
export interface IOAuth2AuthenticationHandler extends BaseModel, RequestAuthenticationModel {
|
|
7
7
|
}
|
|
8
8
|
export declare abstract class AbstractOAuth2AuthenticationHandler implements IOAuth2AuthenticationHandler {
|
|
@@ -30,7 +30,7 @@ export declare abstract class AbstractOAuth2AuthenticationHandler implements IOA
|
|
|
30
30
|
}): Promise<{
|
|
31
31
|
token: OAuth2Token;
|
|
32
32
|
client: OAuth2Client;
|
|
33
|
-
user:
|
|
33
|
+
user: TBaseTzEntity;
|
|
34
34
|
}>;
|
|
35
35
|
getAccessToken(accessToken: string): Promise<Token | Falsey>;
|
|
36
36
|
verifyScope(token: Token, scopes: string[]): Promise<boolean>;
|
|
@@ -10,13 +10,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.defineUserRole = exports.definePermissionMapping = exports.definePermission = exports.defineRole = exports.defineUser = void 0;
|
|
13
|
-
const
|
|
13
|
+
const base_1 = require("../../../base");
|
|
14
14
|
const common_1 = require("../../../common");
|
|
15
15
|
const mixins_1 = require("../../../mixins");
|
|
16
16
|
const repository_1 = require("@loopback/repository");
|
|
17
17
|
// -----------------------------------------------------------------------
|
|
18
18
|
const defineUser = () => {
|
|
19
|
-
class User extends
|
|
19
|
+
class User extends base_1.BaseNumberTzEntity {
|
|
20
20
|
constructor(data) {
|
|
21
21
|
super(data);
|
|
22
22
|
}
|
|
@@ -83,7 +83,7 @@ const defineUser = () => {
|
|
|
83
83
|
exports.defineUser = defineUser;
|
|
84
84
|
// -----------------------------------------------------------------------
|
|
85
85
|
const defineRole = () => {
|
|
86
|
-
class Role extends
|
|
86
|
+
class Role extends base_1.BaseNumberTzEntity {
|
|
87
87
|
constructor(data) {
|
|
88
88
|
super(data);
|
|
89
89
|
}
|
|
@@ -126,7 +126,7 @@ const defineRole = () => {
|
|
|
126
126
|
exports.defineRole = defineRole;
|
|
127
127
|
// -----------------------------------------------------------------------
|
|
128
128
|
const definePermission = () => {
|
|
129
|
-
class Permission extends
|
|
129
|
+
class Permission extends base_1.BaseNumberTzEntity {
|
|
130
130
|
constructor(data) {
|
|
131
131
|
super(data);
|
|
132
132
|
}
|
|
@@ -190,7 +190,7 @@ const definePermission = () => {
|
|
|
190
190
|
exports.definePermission = definePermission;
|
|
191
191
|
// -----------------------------------------------------------------------
|
|
192
192
|
const definePermissionMapping = () => {
|
|
193
|
-
class PermissionMapping extends
|
|
193
|
+
class PermissionMapping extends base_1.BaseNumberTzEntity {
|
|
194
194
|
constructor(data) {
|
|
195
195
|
super(data);
|
|
196
196
|
}
|
|
@@ -225,7 +225,7 @@ const definePermissionMapping = () => {
|
|
|
225
225
|
exports.definePermissionMapping = definePermissionMapping;
|
|
226
226
|
// -----------------------------------------------------------------------
|
|
227
227
|
const defineUserRole = () => {
|
|
228
|
-
class UserRole extends (0, mixins_1.PrincipalMixin)(
|
|
228
|
+
class UserRole extends (0, mixins_1.PrincipalMixin)(base_1.BaseNumberTzEntity, 'Role', 'number') {
|
|
229
229
|
constructor(data) {
|
|
230
230
|
super(data);
|
|
231
231
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BaseDataSource } from '../../../base/datasources';
|
|
2
|
-
import {
|
|
2
|
+
import { TBaseTzEntity } from '../../../base/models';
|
|
3
3
|
import { TzCrudRepository, ViewRepository } from '../../../base/repositories';
|
|
4
4
|
import { EntityClassType, IdType } from '../../../common';
|
|
5
5
|
import { Getter } from '@loopback/core';
|
|
6
6
|
import { HasManyThroughRepositoryFactory } from '@loopback/repository';
|
|
7
7
|
import { Permission, PermissionMapping, Role, UserRole, ViewAuthorizePolicy } from '../models';
|
|
8
|
-
export declare abstract class AbstractAuthorizeRepository<T extends
|
|
8
|
+
export declare abstract class AbstractAuthorizeRepository<T extends TBaseTzEntity> extends TzCrudRepository<T> {
|
|
9
9
|
constructor(entityClass: EntityClassType<T>, dataSource: BaseDataSource);
|
|
10
10
|
abstract bindingRelations(): void;
|
|
11
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class Migration extends
|
|
1
|
+
import { BaseNumberTzEntity } from '../../../base';
|
|
2
|
+
export declare class Migration extends BaseNumberTzEntity {
|
|
3
3
|
name: string;
|
|
4
4
|
status: string;
|
|
5
5
|
constructor(data?: Partial<Migration>);
|
|
@@ -10,10 +10,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Migration = void 0;
|
|
13
|
-
const
|
|
13
|
+
const base_1 = require("../../../base");
|
|
14
14
|
const common_1 = require("../../../common");
|
|
15
15
|
const repository_1 = require("@loopback/repository");
|
|
16
|
-
let Migration = class Migration extends
|
|
16
|
+
let Migration = class Migration extends base_1.BaseNumberTzEntity {
|
|
17
17
|
constructor(data) {
|
|
18
18
|
super(data);
|
|
19
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TBaseIdEntity } from '../base';
|
|
2
2
|
import { IController } from '../common';
|
|
3
3
|
import { Interceptor, InvocationContext, InvocationResult, Provider, ValueOrPromise } from '@loopback/core';
|
|
4
4
|
import { Response } from '@loopback/rest';
|
|
@@ -12,15 +12,15 @@ export declare class ContentRangeInterceptor implements Provider<Interceptor> {
|
|
|
12
12
|
}): 'single-entity' | 'relation-entity' | undefined;
|
|
13
13
|
handleSingleEntity(opts: {
|
|
14
14
|
context: InvocationContext;
|
|
15
|
-
result: Array<
|
|
15
|
+
result: Array<TBaseIdEntity>;
|
|
16
16
|
}): Promise<void>;
|
|
17
17
|
handleRelationalEntity(opts: {
|
|
18
18
|
context: InvocationContext;
|
|
19
|
-
result: Array<
|
|
19
|
+
result: Array<TBaseIdEntity>;
|
|
20
20
|
}): Promise<never[] | undefined>;
|
|
21
21
|
enrichResponseContentRange(opts: {
|
|
22
22
|
context: InvocationContext;
|
|
23
|
-
result: Array<
|
|
23
|
+
result: Array<TBaseIdEntity>;
|
|
24
24
|
}): Promise<void>;
|
|
25
25
|
intercept(context: InvocationContext, next: () => ValueOrPromise<InvocationResult>): Promise<any>;
|
|
26
26
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseEntity } from '../base/models';
|
|
2
2
|
import { IdType } from '../common';
|
|
3
3
|
import { MixinTarget } from '@loopback/core';
|
|
4
|
-
export declare const DuplicatableMixin: <E extends MixinTarget<
|
|
4
|
+
export declare const DuplicatableMixin: <E extends MixinTarget<BaseEntity>>(superClass: E) => {
|
|
5
5
|
new (...args: any[]): {
|
|
6
6
|
sourceId?: IdType;
|
|
7
|
-
id: number;
|
|
8
7
|
getId: () => any;
|
|
9
8
|
getIdObject: () => Object;
|
|
10
9
|
toJSON: () => Object;
|
|
@@ -10,11 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DuplicatableMixin = void 0;
|
|
13
|
-
const
|
|
13
|
+
const models_1 = require("../base/models");
|
|
14
14
|
const model_utility_1 = require("../utilities/model.utility");
|
|
15
15
|
const repository_1 = require("@loopback/repository");
|
|
16
16
|
const DuplicatableMixin = (superClass) => {
|
|
17
|
-
const sourceIdType = (0, model_utility_1.getIdType)(
|
|
17
|
+
const sourceIdType = (0, model_utility_1.getIdType)(models_1.BaseNumberIdEntity);
|
|
18
18
|
let Mixed = class Mixed extends superClass {
|
|
19
19
|
};
|
|
20
20
|
__decorate([
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MixinTarget } from '@loopback/core';
|
|
2
|
+
import { Entity } from '@loopback/repository';
|
|
3
|
+
export declare const NumberIdMixin: <E extends MixinTarget<Entity>>(superClass: E) => {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
id: number;
|
|
6
|
+
getId: () => any;
|
|
7
|
+
getIdObject: () => Object;
|
|
8
|
+
toJSON: () => Object;
|
|
9
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
10
|
+
};
|
|
11
|
+
} & E;
|
|
12
|
+
export declare const StringIdMixin: <E extends MixinTarget<Entity>>(superClass: E) => {
|
|
13
|
+
new (...args: any[]): {
|
|
14
|
+
id?: string;
|
|
15
|
+
getId: () => any;
|
|
16
|
+
getIdObject: () => Object;
|
|
17
|
+
toJSON: () => Object;
|
|
18
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
19
|
+
};
|
|
20
|
+
} & E;
|
|
21
|
+
export declare const IdMixin: <E extends MixinTarget<Entity>>(superClass: E, opts: {
|
|
22
|
+
idType: "string" | "number";
|
|
23
|
+
}) => ({
|
|
24
|
+
new (...args: any[]): {
|
|
25
|
+
id?: string;
|
|
26
|
+
getId: () => any;
|
|
27
|
+
getIdObject: () => Object;
|
|
28
|
+
toJSON: () => Object;
|
|
29
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
30
|
+
};
|
|
31
|
+
} & E) | ({
|
|
32
|
+
new (...args: any[]): {
|
|
33
|
+
id: number;
|
|
34
|
+
getId: () => any;
|
|
35
|
+
getIdObject: () => Object;
|
|
36
|
+
toJSON: () => Object;
|
|
37
|
+
toObject: (options?: import("@loopback/repository").Options) => Object;
|
|
38
|
+
};
|
|
39
|
+
} & E);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.IdMixin = exports.StringIdMixin = exports.NumberIdMixin = void 0;
|
|
13
|
+
const utilities_1 = require("../utilities");
|
|
14
|
+
const repository_1 = require("@loopback/repository");
|
|
15
|
+
const NumberIdMixin = (superClass) => {
|
|
16
|
+
class Mixed extends superClass {
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, repository_1.property)({
|
|
20
|
+
type: 'number',
|
|
21
|
+
id: true,
|
|
22
|
+
generated: true,
|
|
23
|
+
}),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], Mixed.prototype, "id", void 0);
|
|
26
|
+
return Mixed;
|
|
27
|
+
};
|
|
28
|
+
exports.NumberIdMixin = NumberIdMixin;
|
|
29
|
+
const StringIdMixin = (superClass) => {
|
|
30
|
+
class Mixed extends superClass {
|
|
31
|
+
}
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, repository_1.property)({
|
|
34
|
+
type: 'string',
|
|
35
|
+
id: true,
|
|
36
|
+
defaultFn: 'uuidv4',
|
|
37
|
+
}),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Mixed.prototype, "id", void 0);
|
|
40
|
+
return Mixed;
|
|
41
|
+
};
|
|
42
|
+
exports.StringIdMixin = StringIdMixin;
|
|
43
|
+
const IdMixin = (superClass, opts) => {
|
|
44
|
+
switch (opts.idType) {
|
|
45
|
+
case 'string': {
|
|
46
|
+
return (0, exports.StringIdMixin)(superClass);
|
|
47
|
+
}
|
|
48
|
+
case 'number': {
|
|
49
|
+
return (0, exports.NumberIdMixin)(superClass);
|
|
50
|
+
}
|
|
51
|
+
default: {
|
|
52
|
+
throw (0, utilities_1.getError)({
|
|
53
|
+
message: `[IdMixin] Invalid id type | type: ${opts.idType} | Valids: ['string', 'number']`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.IdMixin = IdMixin;
|
package/dist/mixins/index.d.ts
CHANGED
package/dist/mixins/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./data-type.mixin"), exports);
|
|
18
18
|
__exportStar(require("./duplicatable.mixin"), exports);
|
|
19
|
+
__exportStar(require("./id.mixin"), exports);
|
|
19
20
|
__exportStar(require("./object-search.mixin"), exports);
|
|
20
21
|
__exportStar(require("./principal.mixin"), exports);
|
|
21
22
|
__exportStar(require("./soft-delete.mixin"), exports);
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { MixinTarget } from '@loopback/core';
|
|
2
2
|
import { Entity } from '@loopback/repository';
|
|
3
|
-
export declare const TzMixin: <E extends MixinTarget<Entity>>(superClass: E
|
|
3
|
+
export declare const TzMixin: <E extends MixinTarget<Entity>>(superClass: E, opts?: {
|
|
4
|
+
createdAt: {
|
|
5
|
+
columnName: string;
|
|
6
|
+
dataType: string;
|
|
7
|
+
};
|
|
8
|
+
modifiedAt: {
|
|
9
|
+
columnName: string;
|
|
10
|
+
dataType: string;
|
|
11
|
+
};
|
|
12
|
+
}) => {
|
|
4
13
|
new (...args: any[]): {
|
|
5
14
|
createdAt: Date;
|
|
6
15
|
modifiedAt: Date;
|
package/dist/mixins/tz.mixin.js
CHANGED
|
@@ -11,15 +11,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TzMixin = void 0;
|
|
13
13
|
const repository_1 = require("@loopback/repository");
|
|
14
|
-
const TzMixin = (superClass) => {
|
|
14
|
+
const TzMixin = (superClass, opts) => {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
15
16
|
class Mixed extends superClass {
|
|
16
17
|
}
|
|
17
18
|
__decorate([
|
|
18
19
|
(0, repository_1.property)({
|
|
19
20
|
type: 'date',
|
|
20
21
|
postgresql: {
|
|
21
|
-
columnName: 'created_at',
|
|
22
|
-
dataType: 'TIMESTAMPTZ',
|
|
22
|
+
columnName: (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.createdAt) === null || _a === void 0 ? void 0 : _a.columnName) !== null && _b !== void 0 ? _b : 'created_at',
|
|
23
|
+
dataType: (_d = (_c = opts === null || opts === void 0 ? void 0 : opts.createdAt) === null || _c === void 0 ? void 0 : _c.dataType) !== null && _d !== void 0 ? _d : 'TIMESTAMPTZ',
|
|
23
24
|
default: 'NOW()',
|
|
24
25
|
nullable: 'NO',
|
|
25
26
|
},
|
|
@@ -30,8 +31,8 @@ const TzMixin = (superClass) => {
|
|
|
30
31
|
(0, repository_1.property)({
|
|
31
32
|
type: 'date',
|
|
32
33
|
postgresql: {
|
|
33
|
-
columnName: 'modified_at',
|
|
34
|
-
dataType: 'TIMESTAMPTZ',
|
|
34
|
+
columnName: (_f = (_e = opts === null || opts === void 0 ? void 0 : opts.modifiedAt) === null || _e === void 0 ? void 0 : _e.columnName) !== null && _f !== void 0 ? _f : 'modified_at',
|
|
35
|
+
dataType: (_h = (_g = opts === null || opts === void 0 ? void 0 : opts.modifiedAt) === null || _g === void 0 ? void 0 : _g.dataType) !== null && _h !== void 0 ? _h : 'TIMESTAMPTZ',
|
|
35
36
|
default: 'NOW()',
|
|
36
37
|
nullable: 'NO',
|
|
37
38
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TBaseTzEntity } from '../base';
|
|
2
2
|
import { IdType } from '../common/types';
|
|
3
3
|
import { MixinTarget } from '@loopback/core';
|
|
4
4
|
import { Entity, EntityResolver } from '@loopback/repository';
|
|
5
|
-
export declare const UserAuditMixin: <E extends MixinTarget<Entity>, C extends
|
|
5
|
+
export declare const UserAuditMixin: <E extends MixinTarget<Entity>, C extends TBaseTzEntity = TBaseTzEntity, M extends TBaseTzEntity = TBaseTzEntity>(superClass: E, opts?: {
|
|
6
6
|
useRelation: boolean;
|
|
7
7
|
creatorResolver: EntityResolver<C>;
|
|
8
8
|
creatorKeyTo?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SchemaObject } from '@loopback/rest';
|
|
2
|
-
import { BaseEntity
|
|
3
|
-
export declare const getIdSchema: <E extends
|
|
2
|
+
import { BaseEntity } from '../base/models/base.model';
|
|
3
|
+
export declare const getIdSchema: <E extends BaseEntity>(entity: typeof BaseEntity & {
|
|
4
4
|
prototype: E;
|
|
5
5
|
}) => SchemaObject;
|
|
6
6
|
export declare const getIdType: <E extends BaseEntity>(entity: typeof BaseEntity & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseEntity } from '../base';
|
|
2
2
|
import { AnyType, EntityClassType } from '../common';
|
|
3
|
-
export declare const getTableDefinition: <T extends
|
|
3
|
+
export declare const getTableDefinition: <T extends BaseEntity>(opts: {
|
|
4
4
|
model: EntityClassType<T>;
|
|
5
5
|
alias?: string;
|
|
6
6
|
}) => {
|