@lemoncloud/ssocio-tenants-api 0.25.424 → 0.25.620
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/service/backend-model.d.ts +7 -2
- package/dist/service/backend-types.d.ts +6 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/view/types.d.ts +9 -1
- package/package.json +1 -1
- package/dist/cores/abstract-controllers.d.ts +0 -185
- package/dist/cores/abstract-rest-apis.d.ts +0 -111
- package/dist/cores/abstract-services.d.ts +0 -244
- package/dist/cores/commons.d.ts +0 -32
- package/dist/cores/index.d.ts +0 -14
- package/dist/view/index.d.ts +0 -11
- package/dist/view/transformer.d.ts +0 -332
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `abstract-controllers.ts`
|
|
3
|
-
* - pre-coded Model basic CRUD with backend-service and backend-proxy on GeneralWEBController.
|
|
4
|
-
*
|
|
5
|
-
* @author Steve <steve@lemoncloud.io>
|
|
6
|
-
* @date 2022-06-21 optimized w/ `abstract-services`
|
|
7
|
-
* @date 2022-06-24 fixed some failures.
|
|
8
|
-
* @date 2022-06-28 supports `doGetList` w/ search-id.
|
|
9
|
-
* @date 2022-08-02 use `nextId()` w/ `manager.initialNo`.
|
|
10
|
-
* @date 2022-08-03 improved `transformer` w/ helpers.
|
|
11
|
-
* @date 2022-08-09 opt w/ `session-token` in CRUD.
|
|
12
|
-
* @date 2022-09-21 optimized the model management.
|
|
13
|
-
* @date 2022-11-09 param `isCreate` in `bodyToModel`, and support `GET /<type>/<cmd>/admin`
|
|
14
|
-
* @date 2022-11-11 cleanup and optimized names.
|
|
15
|
-
* @date 2022-12-29 optimized with `lemon-core@3.2.1`
|
|
16
|
-
* @date 2023-01-18 optimized with `lemon-core@3.2.4`
|
|
17
|
-
* @date 2023-01-20 optimized `doSearch()` w/ `SearchParam()`
|
|
18
|
-
* @date 2023-02-09 optimized `doPutBulk()`, and `doPostBulk()`
|
|
19
|
-
* @date 2023-02-13 optimized `doList()` to support `stereo` filter.
|
|
20
|
-
* @date 2023-02-15 optimized with `lemon-core@3.2.5`
|
|
21
|
-
* @date 2023-05-31 optimized to use `cores` in `modelAsView()` & `makeModelBase()`
|
|
22
|
-
* @date 2023-09-15 optimized to use `hasCores` in `modelAsView()`
|
|
23
|
-
*
|
|
24
|
-
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
25
|
-
*/
|
|
26
|
-
import { NextContext } from 'lemon-core';
|
|
27
|
-
import { GeneralWEBController, NextHandler, SimpleSet } from 'lemon-core';
|
|
28
|
-
import { CoreModel, AbstractTransformer, View, Body } from 'lemon-model';
|
|
29
|
-
import { BulkBody, ListResult, PaginatedListResult, PaginateParam } from './types';
|
|
30
|
-
import { MyCoreManager, MyCoreService, MyCoreProxy } from './abstract-services';
|
|
31
|
-
export { CoreModel, AbstractTransformer };
|
|
32
|
-
/**
|
|
33
|
-
* type: `CRUDCreationOptions`
|
|
34
|
-
* - options for cunstructor.
|
|
35
|
-
*/
|
|
36
|
-
interface CRUDCreationOptions {
|
|
37
|
-
/**
|
|
38
|
-
* (optional) flag to use `session-token` in CRUD
|
|
39
|
-
* - initialize this as `true` if required to use `session-token`
|
|
40
|
-
*
|
|
41
|
-
* @see proxy.getCurrenSession()
|
|
42
|
-
*/
|
|
43
|
-
useSession?: boolean;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* class: `AbstractCRUDController`
|
|
47
|
-
* - abstract high level class not to create directly.
|
|
48
|
-
*/
|
|
49
|
-
export declare abstract class AbstractCRUDController<ModelType extends string, MyModel extends CoreModel<ModelType>, MyView extends View, MyBody extends Body, MyService extends MyCoreService<MyModel, ModelType, MyCoreProxy<ModelType, MyService>>, MyManager extends MyCoreManager<MyModel, ModelType, MyService>, MyTransformer extends AbstractTransformer<MyModel, MyView, MyBody>> extends GeneralWEBController {
|
|
50
|
-
/**
|
|
51
|
-
* service instances
|
|
52
|
-
*/
|
|
53
|
-
protected readonly service: MyService;
|
|
54
|
-
/**
|
|
55
|
-
* namespace for log(print)
|
|
56
|
-
*/
|
|
57
|
-
protected readonly logNS: string;
|
|
58
|
-
/**
|
|
59
|
-
* my model manager
|
|
60
|
-
*/
|
|
61
|
-
protected readonly manager: MyManager;
|
|
62
|
-
/**
|
|
63
|
-
* transformer between model and view.
|
|
64
|
-
*/
|
|
65
|
-
protected readonly transformer: MyTransformer;
|
|
66
|
-
/** options in creation */
|
|
67
|
-
protected readonly options?: CRUDCreationOptions;
|
|
68
|
-
/**
|
|
69
|
-
* public constructor
|
|
70
|
-
*
|
|
71
|
-
* @param type - api controller's type name (ex: tests for `/tests`)
|
|
72
|
-
* @param service - backend service
|
|
73
|
-
* @param manager - my model manager in backend-service
|
|
74
|
-
* @param transformer - GeneralCRUDWEBControllerOptions
|
|
75
|
-
*/
|
|
76
|
-
constructor(type: string, service: MyService, manager: MyManager, transformer: MyTransformer, options?: CRUDCreationOptions);
|
|
77
|
-
/**
|
|
78
|
-
* get the manager's type (= model-type)
|
|
79
|
-
*/
|
|
80
|
-
get modelType(): ModelType;
|
|
81
|
-
/**
|
|
82
|
-
* get config of using session.
|
|
83
|
-
*/
|
|
84
|
-
get confUseSession(): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* model transformer from model to view
|
|
87
|
-
*/
|
|
88
|
-
modelAsView(model: MyModel, options?: {
|
|
89
|
-
useOnlyDefined?: boolean;
|
|
90
|
-
hasCores?: boolean;
|
|
91
|
-
}): MyView;
|
|
92
|
-
/**
|
|
93
|
-
* model transformer from body to body
|
|
94
|
-
*/
|
|
95
|
-
bodyToModel(body: MyBody, isCreate?: boolean): MyModel;
|
|
96
|
-
/**
|
|
97
|
-
* from `session-token`, make base of model { sid, uid }
|
|
98
|
-
* @param proxy the current proxy.
|
|
99
|
-
* @returns base model
|
|
100
|
-
*/
|
|
101
|
-
protected makeModelBase(proxy: MyCoreProxy<ModelType, any>, options?: {
|
|
102
|
-
/** use this parent to prepare base-model. (hiher than session) */
|
|
103
|
-
parent?: CoreModel;
|
|
104
|
-
/** flag to use session (default as confUseSession) */
|
|
105
|
-
useSession?: boolean;
|
|
106
|
-
/** flag to throw error (default true) */
|
|
107
|
-
throwable?: boolean;
|
|
108
|
-
}): Promise<MyModel>;
|
|
109
|
-
/** load yml as model list */
|
|
110
|
-
loadMockData<T extends object>(name: string, base?: string): Promise<T[]>;
|
|
111
|
-
/**
|
|
112
|
-
* load mock-model from `.yml` file.
|
|
113
|
-
*/
|
|
114
|
-
loadFromFile(file: string): Promise<MyModel & {
|
|
115
|
-
list: any[];
|
|
116
|
-
}>;
|
|
117
|
-
/**
|
|
118
|
-
* say hello
|
|
119
|
-
*/
|
|
120
|
-
hello: () => string;
|
|
121
|
-
/**
|
|
122
|
-
* GET /<typeName>
|
|
123
|
-
* - list types
|
|
124
|
-
*
|
|
125
|
-
* ```sh
|
|
126
|
-
* $ http ':8888/<typeName>'
|
|
127
|
-
*/
|
|
128
|
-
doList: NextHandler<PaginateParam & SimpleSet, PaginatedListResult<MyView>>;
|
|
129
|
-
/**
|
|
130
|
-
* list types by id
|
|
131
|
-
* - id means the search(query) id to use.
|
|
132
|
-
*
|
|
133
|
-
* ```sh
|
|
134
|
-
* $ http ':8888/<typeName>/<id>/list'
|
|
135
|
-
*/
|
|
136
|
-
doGetList: NextHandler<PaginateParam & SimpleSet, PaginatedListResult<MyView>>;
|
|
137
|
-
/**
|
|
138
|
-
* internal admin command
|
|
139
|
-
*/
|
|
140
|
-
doGetAdmin: NextHandler;
|
|
141
|
-
/**
|
|
142
|
-
* read a `MyModel`
|
|
143
|
-
*
|
|
144
|
-
* ```sh
|
|
145
|
-
* $ http ':8888/<typeName>/1'
|
|
146
|
-
*/
|
|
147
|
-
doGet: NextHandler<any, MyView>;
|
|
148
|
-
/**
|
|
149
|
-
* create(or insert) a `MyModel`
|
|
150
|
-
* - `id` must be emptry (or '0')
|
|
151
|
-
*
|
|
152
|
-
* ```sh
|
|
153
|
-
* $ http POST ':8888/<typeName>/0' "key"="modelValue"
|
|
154
|
-
*/
|
|
155
|
-
doPost(id: string, param: any, body: MyBody, $ctx?: NextContext): Promise<MyView>;
|
|
156
|
-
/**
|
|
157
|
-
* create(or insert) multi `MyModel`
|
|
158
|
-
* - `id` must be emptry (or '0')
|
|
159
|
-
*
|
|
160
|
-
* ```sh
|
|
161
|
-
* $ http POST ':8888/<typeName>/0/bulk' "key"="modelValue"
|
|
162
|
-
*/
|
|
163
|
-
doPostBulk: NextHandler<any, MyView[], BulkBody<MyBody> | MyBody[]>;
|
|
164
|
-
/**
|
|
165
|
-
* update a `MyModel`
|
|
166
|
-
*
|
|
167
|
-
* ```sh
|
|
168
|
-
* $ http PUT ':8888/<typeName>/1000002' name="test-update"
|
|
169
|
-
*/
|
|
170
|
-
doPut: NextHandler<any, MyView, MyBody>;
|
|
171
|
-
/**
|
|
172
|
-
* delete a `MyModel`
|
|
173
|
-
*
|
|
174
|
-
* ```sh
|
|
175
|
-
* $ http DELETE ':8888/<typeName>/1000003'
|
|
176
|
-
*/
|
|
177
|
-
doDelete: NextHandler<any, MyView>;
|
|
178
|
-
/**
|
|
179
|
-
* bulk update a `TypeModel`
|
|
180
|
-
*
|
|
181
|
-
* ```sh
|
|
182
|
-
* $ http PUT ':8888/types/0/bulk'
|
|
183
|
-
*/
|
|
184
|
-
doPutBulk: NextHandler<any, ListResult<MyView>, BulkBody<MyBody> | MyBody[]>;
|
|
185
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `abstract-rest-api.ts`
|
|
3
|
-
* - support the rest-api pattern w/ remote service.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @author Steve <steve@lemoncloud.io>
|
|
7
|
-
* @date 2022-09-21 optimized w/ `abstract-rest-apis`
|
|
8
|
-
*
|
|
9
|
-
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
10
|
-
*/
|
|
11
|
-
import { NextContext } from 'lemon-core';
|
|
12
|
-
import { Reversable } from 'lemon-model';
|
|
13
|
-
import { PaginatedListResult, PaginateParam } from './types';
|
|
14
|
-
export { Reversable };
|
|
15
|
-
/**
|
|
16
|
-
* support rest-api from remote service.
|
|
17
|
-
* - useful to use the common CRUD RestAPI.
|
|
18
|
-
*/
|
|
19
|
-
export declare class RestAPI<View extends object = any, Body = View, Model = View> {
|
|
20
|
-
readonly context: NextContext;
|
|
21
|
-
readonly endpoint: string;
|
|
22
|
-
readonly _reverser?: Reversable<Model, View, Body>;
|
|
23
|
-
readonly options?: {
|
|
24
|
-
isProd?: boolean;
|
|
25
|
-
};
|
|
26
|
-
constructor(context: NextContext, endpoint: string, _reverser?: Reversable<Model, View, Body>, options?: {
|
|
27
|
-
isProd?: boolean;
|
|
28
|
-
});
|
|
29
|
-
protected asProtocol(id?: string, cmd?: string): {
|
|
30
|
-
hello: () => string;
|
|
31
|
-
asTargetUrl: () => string;
|
|
32
|
-
execute: <T = any>(param?: any, body?: any, mode?: string) => Promise<T>;
|
|
33
|
-
enqueue: <T_1 = any>(param?: any, body?: any, mode?: string, callback?: string, delaySeconds?: number) => Promise<string>;
|
|
34
|
-
notify: (param?: any, body?: any, mode?: string, callback?: string) => Promise<string>;
|
|
35
|
-
};
|
|
36
|
-
/** get the current transform (may throw error) */
|
|
37
|
-
get reverser(): Reversable<Model, View, Body>;
|
|
38
|
-
/** say hello */
|
|
39
|
-
hello: () => string;
|
|
40
|
-
/** list model as view */
|
|
41
|
-
list: <T extends PaginateParam>(param?: T) => Promise<PaginatedListResult<View>>;
|
|
42
|
-
/** read model as view */
|
|
43
|
-
read: (id: string, param?: any) => Promise<View>;
|
|
44
|
-
/** insert model w/ body w/o id */
|
|
45
|
-
insert: (body: Body, param?: any) => Promise<View>;
|
|
46
|
-
/** update model w/ body by id */
|
|
47
|
-
update: (id: string, body: Body, param?: any) => Promise<View>;
|
|
48
|
-
/** delete model by id */
|
|
49
|
-
delete: (id: string, param?: any) => Promise<View>;
|
|
50
|
-
/** enqueue vis SQS */
|
|
51
|
-
enqueue: (params: {
|
|
52
|
-
id?: string;
|
|
53
|
-
cmd?: string;
|
|
54
|
-
mode?: string;
|
|
55
|
-
param?: any;
|
|
56
|
-
body?: any;
|
|
57
|
-
}, delay?: number) => Promise<string>;
|
|
58
|
-
/** execute vis API */
|
|
59
|
-
execute: <T = any>(params: {
|
|
60
|
-
id?: string;
|
|
61
|
-
cmd?: string;
|
|
62
|
-
mode?: string;
|
|
63
|
-
param?: any;
|
|
64
|
-
body?: any;
|
|
65
|
-
}) => Promise<T>;
|
|
66
|
-
/**
|
|
67
|
-
* set by model.
|
|
68
|
-
*/
|
|
69
|
-
set: (id: string, model: Model) => Promise<Model>;
|
|
70
|
-
/**
|
|
71
|
-
* get by id
|
|
72
|
-
*/
|
|
73
|
-
get: (id: string, throwable?: boolean) => Promise<Model>;
|
|
74
|
-
/**
|
|
75
|
-
* make new (w/ auto id)
|
|
76
|
-
*/
|
|
77
|
-
new: (model: Model) => Promise<Model>;
|
|
78
|
-
/**
|
|
79
|
-
* delete (w/ auto id)
|
|
80
|
-
*/
|
|
81
|
-
del: (id: string) => Promise<Model>;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* rest-api for dummy
|
|
85
|
-
* - save model in memory.
|
|
86
|
-
*/
|
|
87
|
-
export declare class DummyRestAPI<View = any, Body = View, Model = View> extends RestAPI {
|
|
88
|
-
readonly context: NextContext;
|
|
89
|
-
readonly endpoint: string;
|
|
90
|
-
readonly _reverser?: Reversable<Model, View, Body>;
|
|
91
|
-
initialNo: number;
|
|
92
|
-
constructor(context: NextContext, endpoint: string, _reverser?: Reversable<Model, View, Body>, initialNo?: number);
|
|
93
|
-
/** say hello */
|
|
94
|
-
hello: () => string;
|
|
95
|
-
/** internal dummy memory */
|
|
96
|
-
protected $buf: {
|
|
97
|
-
[key: string]: any;
|
|
98
|
-
};
|
|
99
|
-
read: (id: string, param?: any) => Promise<View>;
|
|
100
|
-
insert: (body: any, param?: any) => Promise<View>;
|
|
101
|
-
update: (id: string, body: any, param?: any) => Promise<View>;
|
|
102
|
-
delete: (id: string, param?: any) => Promise<View>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* factory to create `rest-api` instance for both real and dummy.
|
|
106
|
-
*/
|
|
107
|
-
export declare const $createApi: <View extends object = object, Body_1 = View, Model = View>($context: NextContext, endpoint: string, reversor?: Reversable<Model, View, Body_1>, options?: {
|
|
108
|
-
isProd?: boolean;
|
|
109
|
-
isDummy?: boolean;
|
|
110
|
-
initialNo?: number;
|
|
111
|
-
}) => RestAPI<View, Body_1, Model>;
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import { CoreManager, CoreModel, CoreService, SearchBody, ManagerProxy, AbstractProxy, NextContext, NextIdentityCognito, SortTerm, SimpleSet, SearchResult } from 'lemon-core';
|
|
2
|
-
import { SessionToken } from '../service/backend-types';
|
|
3
|
-
import { ListResult, PaginateParam } from './types';
|
|
4
|
-
export declare type SearchParam<T> = T & {
|
|
5
|
-
[key: string]: string | number;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* class: `MyCoreService`
|
|
9
|
-
* - CoreService의 공통 부분을 채워넣는다.
|
|
10
|
-
*/
|
|
11
|
-
export declare abstract class MyCoreService<Model extends CoreModel<ModelType>, ModelType extends string, Proxy extends MyCoreProxy<ModelType, any>> extends CoreService<Model, ModelType> {
|
|
12
|
-
constructor(tableName?: string, ns?: string);
|
|
13
|
-
/**
|
|
14
|
-
* make proxy instance w/ this service.
|
|
15
|
-
*/
|
|
16
|
-
abstract createProxy(context: NextContext): Proxy;
|
|
17
|
-
/**
|
|
18
|
-
* make proxy, and use callback to handle.
|
|
19
|
-
* - it will save automatically.
|
|
20
|
-
*/
|
|
21
|
-
guardProxy: <T>(context: NextContext, callback: (proxy: Proxy) => Promise<T>) => Promise<T>;
|
|
22
|
-
/**
|
|
23
|
-
* run search
|
|
24
|
-
* - override this to hide `$ES6`
|
|
25
|
-
*/
|
|
26
|
-
doSearch<T>(body: SearchBody): Promise<SearchResult<T>>;
|
|
27
|
-
/**
|
|
28
|
-
* check if using useSession from environ.
|
|
29
|
-
*/
|
|
30
|
-
isUseSssion(): boolean;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* class: `CoreManager`
|
|
34
|
-
* - shared core manager for all model
|
|
35
|
-
*
|
|
36
|
-
* @abstract
|
|
37
|
-
*/
|
|
38
|
-
export declare abstract class MyCoreManager<Model extends CoreModel<ModelType>, ModelType extends string, Service extends MyCoreService<Model, ModelType, any>> extends CoreManager<Model, ModelType, Service> {
|
|
39
|
-
readonly options?: {
|
|
40
|
-
/** initial next-id number of auto-seq (default 1000000) */
|
|
41
|
-
initialNo?: number;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* namespace for log(print)
|
|
45
|
-
*/
|
|
46
|
-
protected readonly logNS: string;
|
|
47
|
-
/**
|
|
48
|
-
* constructor
|
|
49
|
-
* @protected
|
|
50
|
-
*/
|
|
51
|
-
protected constructor(type: ModelType, parent: Service, fields: string[], uniqueField?: string, options?: {
|
|
52
|
-
/** initial next-id number of auto-seq (default 1000000) */
|
|
53
|
-
initialNo?: number;
|
|
54
|
-
});
|
|
55
|
-
nextId(): Promise<number>;
|
|
56
|
-
/**
|
|
57
|
-
* build default model for creation.
|
|
58
|
-
*/
|
|
59
|
-
buildDefault(id: string): Model;
|
|
60
|
-
/**
|
|
61
|
-
* validate the request's model before saving.
|
|
62
|
-
* - `$org`에 따라서, 신규 생성인지 업데이트인지 구분 가능함.
|
|
63
|
-
*
|
|
64
|
-
* @param model request's model
|
|
65
|
-
* @param $org (optional) the origin model (valid ONLY if 업데이트)
|
|
66
|
-
* @returns validatated model.
|
|
67
|
-
*/
|
|
68
|
-
validateModel(model: Model, $org?: Model): Promise<Model>;
|
|
69
|
-
/**
|
|
70
|
-
* find lookup-model (improved @2022)
|
|
71
|
-
* - lookup to `auto-id` by key.
|
|
72
|
-
* - if not exits, make the new id (auto-seq) and store the key.
|
|
73
|
-
* - type should be like `#<type>`.
|
|
74
|
-
*
|
|
75
|
-
* NOTE! must to support race condition.
|
|
76
|
-
*
|
|
77
|
-
* @param key any string
|
|
78
|
-
*/
|
|
79
|
-
findLookup$(key: string | number, params?: {
|
|
80
|
-
/** rate to reset lock (default 0.9) */
|
|
81
|
-
resetRate?: number;
|
|
82
|
-
/** flag to use sha256 for hash (default true) */
|
|
83
|
-
useSha256?: boolean;
|
|
84
|
-
/** use meta to save lookup info (default false) */
|
|
85
|
-
isUseMeta?: boolean;
|
|
86
|
-
/** throw if lookup is not found (default false) - useful to check if exists of key */
|
|
87
|
-
throwable?: boolean;
|
|
88
|
-
}): Promise<Model>;
|
|
89
|
-
/**
|
|
90
|
-
* build search query from filters
|
|
91
|
-
*/
|
|
92
|
-
buildQuery<T extends Model>(param: PaginateParam, model?: SearchParam<T>, options?: {
|
|
93
|
-
errScope?: string;
|
|
94
|
-
}): SearchBody;
|
|
95
|
-
/**
|
|
96
|
-
* sort 기준 추가하기.
|
|
97
|
-
*/
|
|
98
|
-
addSortTerm(body: SearchBody, param?: PaginateParam): SearchBody;
|
|
99
|
-
/**
|
|
100
|
-
* basic ElasticSearch Query.
|
|
101
|
-
* you can override this method for customization.
|
|
102
|
-
*
|
|
103
|
-
* @param limit pagination limit (default 10)
|
|
104
|
-
* @param page page number (starts from 0)
|
|
105
|
-
* @param filters model filters
|
|
106
|
-
* @param param (optional) addtion params
|
|
107
|
-
*/
|
|
108
|
-
list($page: PaginateParam, $param?: SearchParam<Model>): Promise<ListResult<Model>>;
|
|
109
|
-
/**
|
|
110
|
-
* list of projection fields
|
|
111
|
-
* - ONLY fields defined in `goods-model`
|
|
112
|
-
* - 모델별 추가 필드목록만 추림
|
|
113
|
-
*/
|
|
114
|
-
listProjections(params?: {
|
|
115
|
-
includes?: string[];
|
|
116
|
-
excludes?: string[];
|
|
117
|
-
sorted?: boolean;
|
|
118
|
-
}): string[];
|
|
119
|
-
/**
|
|
120
|
-
* fetch all list of goods for filtering.
|
|
121
|
-
*
|
|
122
|
-
* @override if required.
|
|
123
|
-
*/
|
|
124
|
-
buildSearchAll(params?: {
|
|
125
|
-
size?: number;
|
|
126
|
-
}, sort?: SortTerm): SearchBody;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* class: `MyCoreProxy`
|
|
130
|
-
* - common parent of proxy.
|
|
131
|
-
*/
|
|
132
|
-
export declare class MyCoreProxy<U extends string, MyService extends MyCoreService<CoreModel<U>, U, any>> extends AbstractProxy<U, MyService> {
|
|
133
|
-
readonly managerProxies: {
|
|
134
|
-
[propKey: string]: MyManagerProxy<any, any, MyService>;
|
|
135
|
-
};
|
|
136
|
-
constructor(context: NextContext, service: MyService, cacheScope?: string);
|
|
137
|
-
/**
|
|
138
|
-
* register this.
|
|
139
|
-
*/
|
|
140
|
-
register(mgr: MyManagerProxy<any, any, MyService>): number;
|
|
141
|
-
/**
|
|
142
|
-
* add into proxy lookup.
|
|
143
|
-
*/
|
|
144
|
-
protected addManagerProxy(modelType: U, proxy: MyManagerProxy<any, any, MyService>): void;
|
|
145
|
-
/**
|
|
146
|
-
* get from lookup table.
|
|
147
|
-
*/
|
|
148
|
-
getManagerProxy<Model, ModelManager extends MyCoreManager<Model, U, MyService>>(modelType: U): MyManagerProxy<Model, ModelManager, MyService>;
|
|
149
|
-
/**
|
|
150
|
-
* get the `session-token` from current req-context.
|
|
151
|
-
* - 1차 호출(front에서) 에서는 이 세션이 꼭 필요함.
|
|
152
|
-
* - 2차 호출(protocol이용) 에서는 선택사항으로, 조절가능해야함! (#TODO - 이걸 어떻게 구불할것인가?)
|
|
153
|
-
* - 로컬) 로컬 개발에서는 시뮬레이션 방법은 #TODO
|
|
154
|
-
*
|
|
155
|
-
* @param options.throwable flag to throw (default true)
|
|
156
|
-
*/
|
|
157
|
-
getCurrenSession(options?: {
|
|
158
|
-
throwable?: boolean;
|
|
159
|
-
normalize?: boolean;
|
|
160
|
-
}): SessionToken;
|
|
161
|
-
/**
|
|
162
|
-
* find the current identity-id from context.
|
|
163
|
-
* - or, use env[LOCAL_ACCOUNT]
|
|
164
|
-
*/
|
|
165
|
-
asCurrentIdentityId: (context?: NextContext) => string | null;
|
|
166
|
-
/**
|
|
167
|
-
* prepare `next-context` w/ the customized { domain, userAgent }
|
|
168
|
-
* @param identityId the target identity-id
|
|
169
|
-
*/
|
|
170
|
-
asNextContext(identityId?: string, params?: {
|
|
171
|
-
domain?: string;
|
|
172
|
-
userAgent?: string;
|
|
173
|
-
}): NextContext<NextIdentityCognito<any>>;
|
|
174
|
-
/**
|
|
175
|
-
* from `session-token`, make base of model { sid, uid }
|
|
176
|
-
* @param proxy the current proxy.
|
|
177
|
-
* @returns base model
|
|
178
|
-
*/
|
|
179
|
-
makeModelBase<M extends CoreModel<U>>(model: M, options?: {
|
|
180
|
-
/** use this parent to prepare base-model. (hiher than session) */
|
|
181
|
-
parent?: CoreModel;
|
|
182
|
-
/** flag to use session (default as confUseSession) */
|
|
183
|
-
useSession?: boolean;
|
|
184
|
-
/** flag to throw error (default true) */
|
|
185
|
-
throwable?: boolean;
|
|
186
|
-
}): Promise<M>;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* class: `MyProxy`
|
|
190
|
-
* - common parent of manager-proxy.
|
|
191
|
-
*/
|
|
192
|
-
export declare class MyManagerProxy<MyModel extends CoreModel<ModelType>, MyManager extends MyCoreManager<MyModel, ModelType, MyService>, MyService extends MyCoreService<MyModel, ModelType, any>, ModelType extends string = string> extends ManagerProxy<MyModel, MyManager, ModelType> {
|
|
193
|
-
readonly proxy: MyCoreProxy<ModelType, MyService>;
|
|
194
|
-
constructor(proxy: MyCoreProxy<ModelType, MyService>, mgr: MyManager);
|
|
195
|
-
/**
|
|
196
|
-
* @override the default `normal()` to support _name.
|
|
197
|
-
*/
|
|
198
|
-
normal: (N: MyModel) => MyModel;
|
|
199
|
-
/**
|
|
200
|
-
* pack the query parameter for list
|
|
201
|
-
* - `param` has the string values only including '', '!'
|
|
202
|
-
* - `model` has the valid data type. (number | string | ... )
|
|
203
|
-
*
|
|
204
|
-
* ```ts
|
|
205
|
-
* let model = bodyToModel(param)
|
|
206
|
-
* ```
|
|
207
|
-
*
|
|
208
|
-
* @param param the original query parameter.
|
|
209
|
-
* @param model the transformed model from `param`.
|
|
210
|
-
* @param options (optional)
|
|
211
|
-
* @returns
|
|
212
|
-
*/
|
|
213
|
-
packSearchParam(param: SimpleSet, model?: MyModel, options?: {
|
|
214
|
-
/** flag to use session-token (default false) */
|
|
215
|
-
useSession?: boolean;
|
|
216
|
-
}): {
|
|
217
|
-
$page: PaginateParam;
|
|
218
|
-
$param: SearchParam<MyModel>;
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* override this to validate request'body.
|
|
222
|
-
* @param model model from request.
|
|
223
|
-
* @param modelId (optional) modelId if to update the target model.
|
|
224
|
-
* @return validated model to save.
|
|
225
|
-
*/
|
|
226
|
-
validateModel<T extends MyModel>(model: T, modelId?: string): Promise<T>;
|
|
227
|
-
/**
|
|
228
|
-
* callback before saving model.
|
|
229
|
-
* - could change field before saving.
|
|
230
|
-
*
|
|
231
|
-
* @param model the last model to save
|
|
232
|
-
* @param $org (optional) original model (null if create)
|
|
233
|
-
*/
|
|
234
|
-
onBeforeSave(model: MyModel, $org?: MyModel): Promise<MyModel>;
|
|
235
|
-
/**
|
|
236
|
-
* create new model
|
|
237
|
-
* - use `.id` or `nextId()` for model-id
|
|
238
|
-
* - validate model in seperate way before using this.
|
|
239
|
-
*
|
|
240
|
-
* @param model creation model
|
|
241
|
-
* @param validate (optional) flag to validate (default is true)
|
|
242
|
-
*/
|
|
243
|
-
makeModel(model: MyModel, validate?: boolean): Promise<MyModel>;
|
|
244
|
-
}
|
package/dist/cores/commons.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `commons.ts`
|
|
3
|
-
* - common tools to export.
|
|
4
|
-
*
|
|
5
|
-
* @author Steve <steve@lemoncloud.io>
|
|
6
|
-
* @date 2022-11-01 optimized w/ `commons`
|
|
7
|
-
*
|
|
8
|
-
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
9
|
-
*/
|
|
10
|
-
import { ListParam, PaginateParam } from './types';
|
|
11
|
-
/**
|
|
12
|
-
* extract only the defined attribute.
|
|
13
|
-
* ex) `{ a:1, b: undefined }` -> `{ a:1 }`
|
|
14
|
-
*/
|
|
15
|
-
export declare const onlyDefined: <T>(N: T) => T;
|
|
16
|
-
/**
|
|
17
|
-
* list param parser
|
|
18
|
-
* @param param
|
|
19
|
-
*/
|
|
20
|
-
export declare function parseListParam(param?: ListParam, $def?: {
|
|
21
|
-
limit?: number;
|
|
22
|
-
}): Required<ListParam>;
|
|
23
|
-
/**
|
|
24
|
-
* paginate param parser
|
|
25
|
-
*/
|
|
26
|
-
export declare function parsePaginateParam(param?: PaginateParam,
|
|
27
|
-
/** default value or conditions */
|
|
28
|
-
options?: {
|
|
29
|
-
noLimit?: boolean;
|
|
30
|
-
limit?: number;
|
|
31
|
-
page?: number;
|
|
32
|
-
}): PaginateParam;
|
package/dist/cores/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `index.ts`
|
|
3
|
-
* - shared export in `/cores`
|
|
4
|
-
*
|
|
5
|
-
* @author Steve <steve@lemoncloud.io>
|
|
6
|
-
* @date 2022-06-21 optimized w/ `abstract-services`
|
|
7
|
-
*
|
|
8
|
-
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
9
|
-
*/
|
|
10
|
-
export * from './types';
|
|
11
|
-
export * from './commons';
|
|
12
|
-
export * from './abstract-services';
|
|
13
|
-
export * from './abstract-controllers';
|
|
14
|
-
export * from './abstract-rest-apis';
|
package/dist/view/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `index.ts`
|
|
3
|
-
* - main export of `view`
|
|
4
|
-
*
|
|
5
|
-
* @author Steve <steve@lemoncloud.io>
|
|
6
|
-
* @date 2022-06-21 optimized w/ `abstract-services`
|
|
7
|
-
*
|
|
8
|
-
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
9
|
-
*/
|
|
10
|
-
export * from './types';
|
|
11
|
-
export * from './transformer';
|