@tsed/schema 6.76.0 → 6.78.1
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/lib/decorators/common/jsonEntityFn.d.ts +1 -1
- package/lib/domain/JsonEntityStore.d.ts +1 -1
- package/lib/index.js +12 -4
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +12 -4
- package/lib/index.modern.js.map +1 -1
- package/lib/utils/getJsonEntityStore.d.ts +4 -1
- package/package.json +5 -5
|
@@ -18,4 +18,4 @@ import { JsonEntityStore } from "../../domain";
|
|
|
18
18
|
* @utils
|
|
19
19
|
* @model
|
|
20
20
|
*/
|
|
21
|
-
export declare function JsonEntityFn<T extends JsonEntityStore>(fn: (entity: T, parameters: DecoratorParameters) =>
|
|
21
|
+
export declare function JsonEntityFn<T extends JsonEntityStore>(fn: (entity: T, parameters: DecoratorParameters) => any): (...args: any[]) => any;
|
|
@@ -75,7 +75,7 @@ export declare class JsonEntityStore extends Entity implements JsonEntityStoreOp
|
|
|
75
75
|
*
|
|
76
76
|
* @param args
|
|
77
77
|
*/
|
|
78
|
-
static from<T extends JsonEntityStore = JsonEntityStore>(...args: any[]):
|
|
78
|
+
static from<T extends JsonEntityStore = JsonEntityStore>(...args: any[]): T;
|
|
79
79
|
static fromMethod(target: any, propertyKey: string | symbol): JsonEntityStore;
|
|
80
80
|
get<T = any>(key: string, defaultValue?: any): T;
|
|
81
81
|
getResponseOptions(status: number, contentType?: string): undefined | any;
|
package/lib/index.js
CHANGED
|
@@ -180,11 +180,22 @@ function execMapper(type, schema, options) {
|
|
|
180
180
|
*/
|
|
181
181
|
const JsonEntitiesContainer = new Map();
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* @ignore
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
function isJsonEntityStore(model) {
|
|
188
|
+
return model.isStore;
|
|
189
|
+
}
|
|
183
190
|
/**
|
|
184
191
|
* @ignore
|
|
185
192
|
*/
|
|
186
193
|
|
|
187
194
|
function getJsonEntityStore(...args) {
|
|
195
|
+
if (isJsonEntityStore(args[0])) {
|
|
196
|
+
return args[0];
|
|
197
|
+
}
|
|
198
|
+
|
|
188
199
|
const store = core.Store.from(...args);
|
|
189
200
|
|
|
190
201
|
if (!store.has("JsonEntityStore")) {
|
|
@@ -201,9 +212,6 @@ function getJsonEntityStore(...args) {
|
|
|
201
212
|
|
|
202
213
|
return store.get("JsonEntityStore");
|
|
203
214
|
}
|
|
204
|
-
function isJsonEntityStore(model) {
|
|
205
|
-
return model.isStore;
|
|
206
|
-
}
|
|
207
215
|
|
|
208
216
|
class JsonLazyRef {
|
|
209
217
|
constructor(getType) {
|
|
@@ -2873,7 +2881,7 @@ function get$1(entity, options) {
|
|
|
2873
2881
|
}
|
|
2874
2882
|
|
|
2875
2883
|
function getJsonSchema(model, options = {}) {
|
|
2876
|
-
const entity =
|
|
2884
|
+
const entity = getJsonEntityStore(model);
|
|
2877
2885
|
options = _extends({
|
|
2878
2886
|
endpoint: true,
|
|
2879
2887
|
groups: []
|