@wisemen/one-of 0.0.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/README.md +117 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/one-of.decorators.d.ts +15 -0
- package/dist/one-of.decorators.js +248 -0
- package/dist/one-of.decorators.js.map +1 -0
- package/dist/pascal-case.d.ts +1 -0
- package/dist/pascal-case.js +7 -0
- package/dist/pascal-case.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Wisemen One-Of Decorators
|
|
2
|
+
## Features
|
|
3
|
+
|
|
4
|
+
✔ Document One of properties in OpenApi \
|
|
5
|
+
✔ Scalable way to define polymorphic response without the need to change a shared file \
|
|
6
|
+
✔ Easy type narrowing for consumers of OpenApi docs \
|
|
7
|
+
✔ TypeScript Support – Fully typed for a smooth developer experience.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Philosophy
|
|
11
|
+
|
|
12
|
+
Some models have a common core but different variations based on a type discriminator. This package allows you to document these models in an OpenApi doc generated by `Nestjs Swagger`.
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
@OneOfResponse(Notification) // -> register this class as the response for Notification
|
|
18
|
+
class NotificationResponse {
|
|
19
|
+
@ApiProperty({type: 'string', format: 'uuid'})
|
|
20
|
+
uuid: string
|
|
21
|
+
|
|
22
|
+
@OneOfTypeApiProperty() // -> defines the type descriminator
|
|
23
|
+
type: NotificationType
|
|
24
|
+
|
|
25
|
+
@OneOfMetaApiProperty() // -> defines the meta property
|
|
26
|
+
meta: unknown
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@OneOfMeta(Notification, NotificationType.DRIVER_CREATED) // -> register this class as a meta object of notification
|
|
30
|
+
class DriverCreatedNotificaitonMeta {
|
|
31
|
+
@ApiProperty({ type: String, format: 'uuid' })
|
|
32
|
+
driverUuid: string
|
|
33
|
+
|
|
34
|
+
@ApiProperty({ type: String })
|
|
35
|
+
driverName: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@OneOfApiExtraModels(Notification) // -> register one of models for notification
|
|
40
|
+
export class GetNotificationsResponse {
|
|
41
|
+
@OneOfApiProperty(Notification, { isArray: true }) // -> register one of api property for response
|
|
42
|
+
items: NotificationResponse[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Deep Dive
|
|
49
|
+
|
|
50
|
+
### Response
|
|
51
|
+
|
|
52
|
+
You need to define a `OneOfResponse` for a class. Which class is given to this decorator as an argument strictly speaking not important, but I consider it to be good practice to use the model for which this response is created.
|
|
53
|
+
|
|
54
|
+
The response should contain both a `OneOfTypeApiProperty` and a `OneOfMetaApiProperty`. `OneOfTypeApiProperty` is used to discriminate the type of the meta property. It's usually a type enum from the model for which you are creating a response.
|
|
55
|
+
`OneOfMetaApiProperty` defines the key for which the meta docs will be generated.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
@OneOfResponse(Notification) // -> register this class as the response for Notification
|
|
59
|
+
class NotificationResponse {
|
|
60
|
+
@ApiProperty({type: 'string', format: 'uuid'})
|
|
61
|
+
uuid: string
|
|
62
|
+
|
|
63
|
+
@OneOfTypeApiProperty() // -> defines the type descriminator
|
|
64
|
+
type: NotificationType
|
|
65
|
+
|
|
66
|
+
@OneOfMetaApiProperty() // -> defines the meta property
|
|
67
|
+
meta: unknown
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Meta types
|
|
72
|
+
|
|
73
|
+
The meta type can be defined in a separate file. No changes need to be made to the other files where OneOf is used. `OneOfMeta` registers the object as one of the meta object which can exist in the model.
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
@OneOfMeta(
|
|
77
|
+
Notification, // -> the model to which this meta object belongs
|
|
78
|
+
NotificationType.DRIVER_CREATED // -> the type associated with this meta object
|
|
79
|
+
)
|
|
80
|
+
class DriverCreatedNotificaitonMeta {
|
|
81
|
+
@ApiProperty({ type: String, format: 'uuid' })
|
|
82
|
+
driverUuid: string
|
|
83
|
+
|
|
84
|
+
@ApiProperty({ type: String })
|
|
85
|
+
driverName: string
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Using the Generated Docs
|
|
90
|
+
|
|
91
|
+
#### As an API response
|
|
92
|
+
|
|
93
|
+
If you need to directly return a single response item in a controller, use the `OneOfApiResponse`.
|
|
94
|
+
You do not need to define extra models.
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
@Controller('/notifications')
|
|
98
|
+
class NotificationController {
|
|
99
|
+
@Get()
|
|
100
|
+
@OneOfApiResponse(Notification, { /* other Api Response options */ })
|
|
101
|
+
async getNotifications(): Promise<NotificationResponse> {
|
|
102
|
+
// ...
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Nested in another response
|
|
108
|
+
|
|
109
|
+
If you need to include the response nested in another response, use the `OneOfApiProperty`. Here you must also define extra models.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
@OneOfApiExtraModels(Notification) // -> register one of models for notification
|
|
113
|
+
export class GetNotificationsResponse {
|
|
114
|
+
@OneOfApiProperty(Notification, { isArray: true }) // -> register one of api property for response
|
|
115
|
+
items: NotificationResponse[]
|
|
116
|
+
}
|
|
117
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './one-of.decorators.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ClassConstructor } from 'class-transformer';
|
|
2
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
3
|
+
import { ApiResponseCommonMetadata } from '@nestjs/swagger/dist/decorators/api-response.decorator.js';
|
|
4
|
+
export declare const ONE_OF_TYPE_API_PROPERTY = "wisemen.one_of_type_api_property";
|
|
5
|
+
export declare const ONE_OF_META_API_PROPERTY = "wisemen.one_of_meta_api_property";
|
|
6
|
+
export declare const ONE_OF_DISCRIMINATED_TYPES = "wisemen.one_of_discriminated_types";
|
|
7
|
+
export declare const ONE_OF_DISCRIMINATED_RESPONSE = "wisemen.one_of_discriminated_response";
|
|
8
|
+
export type OneOfApiResponseOptions = Omit<ApiResponseCommonMetadata, 'type'>;
|
|
9
|
+
export declare function OneOfTypeApiProperty(): PropertyDecorator;
|
|
10
|
+
export declare function OneOfMetaApiProperty(): PropertyDecorator;
|
|
11
|
+
export declare function OneOfMeta(forClass: ClassConstructor<unknown>, discriminatorType: string): ClassDecorator;
|
|
12
|
+
export declare function OneOfResponse(forClass: ClassConstructor<unknown>): ClassDecorator;
|
|
13
|
+
export declare function OneOfApiProperty(forClass: ClassConstructor<unknown>, options?: ApiPropertyOptions): PropertyDecorator;
|
|
14
|
+
export declare function OneOfApiExtraModels(forClass: ClassConstructor<unknown>): ClassDecorator;
|
|
15
|
+
export declare function OneOfApiResponse(forClass: ClassConstructor<unknown>, options?: OneOfApiResponseOptions): MethodDecorator;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { ApiExtraModels, ApiProperty, ApiResponse, getSchemaPath } from '@nestjs/swagger';
|
|
2
|
+
import { applyDecorators } from '@nestjs/common';
|
|
3
|
+
import { DECORATORS } from '@nestjs/swagger/dist/constants.js';
|
|
4
|
+
import { isFunction, isString } from '@nestjs/common/utils/shared.utils.js';
|
|
5
|
+
import { pascalCase } from './pascal-case.js';
|
|
6
|
+
export const ONE_OF_TYPE_API_PROPERTY = 'wisemen.one_of_type_api_property';
|
|
7
|
+
export const ONE_OF_META_API_PROPERTY = 'wisemen.one_of_meta_api_property';
|
|
8
|
+
export const ONE_OF_DISCRIMINATED_TYPES = 'wisemen.one_of_discriminated_types';
|
|
9
|
+
export const ONE_OF_DISCRIMINATED_RESPONSE = 'wisemen.one_of_discriminated_response';
|
|
10
|
+
export function OneOfTypeApiProperty() {
|
|
11
|
+
return (target, propertyKey) => {
|
|
12
|
+
Reflect.defineMetadata(ONE_OF_TYPE_API_PROPERTY, propertyKey, target);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function OneOfMetaApiProperty() {
|
|
16
|
+
return (target, propertyKey) => {
|
|
17
|
+
Reflect.defineMetadata(ONE_OF_META_API_PROPERTY, propertyKey, target);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function OneOfMeta(forClass, discriminatorType) {
|
|
21
|
+
return (target) => {
|
|
22
|
+
const types = Reflect.getMetadata(ONE_OF_DISCRIMINATED_TYPES, forClass)
|
|
23
|
+
?? new Map();
|
|
24
|
+
types.set(discriminatorType, target);
|
|
25
|
+
Reflect.defineMetadata(ONE_OF_DISCRIMINATED_TYPES, types, forClass);
|
|
26
|
+
CALLBACKS.reRender(forClass);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function OneOfResponse(forClass) {
|
|
30
|
+
return (target) => {
|
|
31
|
+
Reflect.defineMetadata(ONE_OF_DISCRIMINATED_RESPONSE, target, forClass);
|
|
32
|
+
CALLBACKS.reRender(forClass);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function OneOfApiProperty(forClass, options) {
|
|
36
|
+
return (target, propertyKey) => {
|
|
37
|
+
const decorators = new OneOfDecorators(forClass);
|
|
38
|
+
const decorator = decorators.OneOfApiPropertyDecorator(options);
|
|
39
|
+
CALLBACKS.subscribeApiProperty(forClass, target, propertyKey, options);
|
|
40
|
+
return decorator(target, propertyKey);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function OneOfApiExtraModels(forClass) {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
45
|
+
return (target) => {
|
|
46
|
+
const decorators = new OneOfDecorators(forClass);
|
|
47
|
+
const decorator = decorators.OneOfApiExtraModelsDecorator();
|
|
48
|
+
CALLBACKS.subscribeApiExtraModels(forClass, target);
|
|
49
|
+
return decorator(target);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function OneOfApiResponse(forClass, options) {
|
|
53
|
+
return (target, propertyKey, descriptor) => {
|
|
54
|
+
const decorators = new OneOfDecorators(forClass);
|
|
55
|
+
const oneOfApiResponseDecorator = decorators.OneOfApiResponseDecorator(options);
|
|
56
|
+
return oneOfApiResponseDecorator(target, propertyKey, descriptor);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
class OneOfDecoratorCallbacks {
|
|
60
|
+
apiProperties;
|
|
61
|
+
apiExtraModels;
|
|
62
|
+
apiResponses;
|
|
63
|
+
constructor() {
|
|
64
|
+
this.apiProperties = new Map();
|
|
65
|
+
this.apiExtraModels = new Map();
|
|
66
|
+
this.apiResponses = new Map();
|
|
67
|
+
}
|
|
68
|
+
subscribeApiProperty(toClass, target, propertyKey, options) {
|
|
69
|
+
const subscribers = this.apiProperties.get(toClass) ?? [];
|
|
70
|
+
subscribers.push({ target, propertyKey, options });
|
|
71
|
+
this.apiProperties.set(toClass, subscribers);
|
|
72
|
+
}
|
|
73
|
+
subscribeApiExtraModels(toClass,
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
75
|
+
target) {
|
|
76
|
+
const subscribers = this.apiExtraModels.get(toClass) ?? [];
|
|
77
|
+
subscribers.push({ target });
|
|
78
|
+
this.apiExtraModels.set(toClass, subscribers);
|
|
79
|
+
}
|
|
80
|
+
subscribeApiResponse(toClass, target, propertyKey, descriptor, options) {
|
|
81
|
+
const subscribers = this.apiResponses.get(toClass) ?? [];
|
|
82
|
+
subscribers.push({ target, propertyKey, descriptor, options });
|
|
83
|
+
this.apiResponses.set(toClass, subscribers);
|
|
84
|
+
}
|
|
85
|
+
reRender(ofClass) {
|
|
86
|
+
const apiPropertySubscribers = this.apiProperties.get(ofClass) ?? [];
|
|
87
|
+
const extraModelsSubscribers = this.apiExtraModels.get(ofClass) ?? [];
|
|
88
|
+
const apiResponseSubscribers = this.apiResponses.get(ofClass) ?? [];
|
|
89
|
+
if (apiPropertySubscribers.length === 0
|
|
90
|
+
&& extraModelsSubscribers.length === 0
|
|
91
|
+
&& apiPropertySubscribers.length === 0) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const decorators = new OneOfDecorators(ofClass);
|
|
95
|
+
const apiPropertyDecorator = decorators.OneOfApiPropertyDecorator;
|
|
96
|
+
for (const subscriber of apiPropertySubscribers) {
|
|
97
|
+
const subscribeDecorator = apiPropertyDecorator(subscriber.options);
|
|
98
|
+
subscribeDecorator(subscriber.target, subscriber.propertyKey);
|
|
99
|
+
}
|
|
100
|
+
const extraModelsDecorator = decorators.OneOfApiExtraModelsDecorator();
|
|
101
|
+
for (const subscriber of extraModelsSubscribers) {
|
|
102
|
+
extraModelsDecorator(subscriber.target);
|
|
103
|
+
}
|
|
104
|
+
const apiResponseDecorator = decorators.OneOfApiResponseDecorator;
|
|
105
|
+
for (const subscriber of apiResponseSubscribers) {
|
|
106
|
+
const subscribeDecorator = apiResponseDecorator(subscriber.options);
|
|
107
|
+
subscribeDecorator(subscriber.target, subscriber.propertyKey, subscriber.descriptor);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const CALLBACKS = new OneOfDecoratorCallbacks();
|
|
112
|
+
class OneOfDecorators {
|
|
113
|
+
forClass;
|
|
114
|
+
discriminatedTypes;
|
|
115
|
+
responseClass;
|
|
116
|
+
discriminatedClasses;
|
|
117
|
+
dynamicClasses;
|
|
118
|
+
responseDecorator;
|
|
119
|
+
propertyDecorator;
|
|
120
|
+
extraModelsDecorator;
|
|
121
|
+
constructor(forClass) {
|
|
122
|
+
this.forClass = forClass;
|
|
123
|
+
this.discriminatedTypes
|
|
124
|
+
= Reflect.getMetadata(ONE_OF_DISCRIMINATED_TYPES, forClass)
|
|
125
|
+
?? new Map();
|
|
126
|
+
this.responseClass = this.extractResponseClass(forClass);
|
|
127
|
+
this.discriminatedClasses = new Map();
|
|
128
|
+
this.dynamicClasses = new Map();
|
|
129
|
+
this.buildDynamicClasses();
|
|
130
|
+
this.buildDecorators();
|
|
131
|
+
}
|
|
132
|
+
get OneOfApiResponseDecorator() {
|
|
133
|
+
return this.responseDecorator;
|
|
134
|
+
}
|
|
135
|
+
get OneOfApiPropertyDecorator() {
|
|
136
|
+
return this.propertyDecorator;
|
|
137
|
+
}
|
|
138
|
+
get OneOfApiExtraModelsDecorator() {
|
|
139
|
+
return this.extraModelsDecorator;
|
|
140
|
+
}
|
|
141
|
+
generateName(type) {
|
|
142
|
+
const kebabCase = type.replaceAll('.', '-');
|
|
143
|
+
return pascalCase(kebabCase) + this.forClass.name;
|
|
144
|
+
}
|
|
145
|
+
generateDiscriminatedClass(type) {
|
|
146
|
+
const discriminatedClass = this.discriminatedTypes.get(type);
|
|
147
|
+
if (discriminatedClass === undefined) {
|
|
148
|
+
throw new Error(`${type} not found on class ${this.forClass.name}`);
|
|
149
|
+
}
|
|
150
|
+
return discriminatedClass;
|
|
151
|
+
}
|
|
152
|
+
extractResponseClass(forClass) {
|
|
153
|
+
const responseClass = Reflect.getMetadata(ONE_OF_DISCRIMINATED_RESPONSE, forClass);
|
|
154
|
+
if (responseClass === undefined) {
|
|
155
|
+
throw new Error(`Response class missing for ${this.forClass.name}\n`
|
|
156
|
+
+ `Did you forget to add \x1b[31m@${OneOfResponse.name}(${this.forClass.name})\x1b[0m?`);
|
|
157
|
+
}
|
|
158
|
+
return responseClass;
|
|
159
|
+
}
|
|
160
|
+
buildDynamicClasses() {
|
|
161
|
+
for (const type of this.discriminatedTypes.keys()) {
|
|
162
|
+
this.discriminatedClasses.set(type, this.generateDiscriminatedClass(type));
|
|
163
|
+
this.dynamicClasses.set(type, this.generateDynamicClass(type));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
buildDecorators() {
|
|
167
|
+
const extraModels = [...this.dynamicClasses.values(), ...this.discriminatedClasses.values()];
|
|
168
|
+
const references = this.buildOpenApiReferences();
|
|
169
|
+
this.propertyDecorator = (options) => {
|
|
170
|
+
return ApiProperty({ ...options, oneOf: references });
|
|
171
|
+
};
|
|
172
|
+
this.extraModelsDecorator = () => {
|
|
173
|
+
return ApiExtraModels(...extraModels);
|
|
174
|
+
};
|
|
175
|
+
this.responseDecorator = (options) => {
|
|
176
|
+
return applyDecorators(ApiExtraModels(...extraModels), ApiResponse({ ...options, schema: { oneOf: references } }));
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
buildOpenApiReferences() {
|
|
180
|
+
const references = [];
|
|
181
|
+
for (const type of this.discriminatedTypes.keys()) {
|
|
182
|
+
references.push({ $ref: getSchemaPath(this.generateName(type)) });
|
|
183
|
+
}
|
|
184
|
+
return references;
|
|
185
|
+
}
|
|
186
|
+
generateDynamicClass(forType) {
|
|
187
|
+
const dynamicClass = class {
|
|
188
|
+
};
|
|
189
|
+
this.addClassName(dynamicClass, this.generateName(forType));
|
|
190
|
+
this.copyApiModelPropertiesMetadata(this.responseClass, dynamicClass);
|
|
191
|
+
this.copyResponseApiPropertyMetadata(this.responseClass, dynamicClass);
|
|
192
|
+
this.addDiscriminatorApiPropertyMetadata(forType, dynamicClass, this.responseClass);
|
|
193
|
+
this.addDiscriminatedApiPropertyMetadata(forType, dynamicClass, this.responseClass);
|
|
194
|
+
return dynamicClass;
|
|
195
|
+
}
|
|
196
|
+
addClassName(dynamicClass, name) {
|
|
197
|
+
Object.defineProperty(dynamicClass, 'name', {
|
|
198
|
+
value: name,
|
|
199
|
+
writable: false
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
copyApiModelPropertiesMetadata(responseClass, dynamicClass) {
|
|
203
|
+
const propertiesMetadata = Reflect.getMetadata(DECORATORS.API_MODEL_PROPERTIES_ARRAY, responseClass.prototype);
|
|
204
|
+
Reflect.defineMetadata(DECORATORS.API_MODEL_PROPERTIES_ARRAY, Array.from(propertiesMetadata), dynamicClass.prototype);
|
|
205
|
+
}
|
|
206
|
+
copyResponseApiPropertyMetadata(responseClass, dynamicClass) {
|
|
207
|
+
for (const property of this.getModelProperties(responseClass.prototype)) {
|
|
208
|
+
const metaData = Reflect.getMetadata(DECORATORS.API_MODEL_PROPERTIES, responseClass.prototype, property);
|
|
209
|
+
const metaDataCopy = { ...metaData };
|
|
210
|
+
const decorator = ApiProperty(metaDataCopy);
|
|
211
|
+
decorator(dynamicClass.prototype, property);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
addDiscriminatedApiPropertyMetadata(enumValue, dynamicClass, responseClass) {
|
|
215
|
+
const discriminatedDecorator = ApiProperty({ type: this.generateDiscriminatedClass(enumValue) });
|
|
216
|
+
const propertyName = this.extractMetaProperty(responseClass);
|
|
217
|
+
discriminatedDecorator(dynamicClass.prototype, propertyName);
|
|
218
|
+
}
|
|
219
|
+
addDiscriminatorApiPropertyMetadata(enumValue, dynamicClass, responseClass) {
|
|
220
|
+
const discriminatorDecorator = ApiProperty({ type: 'string', enum: [String(enumValue)] });
|
|
221
|
+
const propertyName = this.extractTypeProperty(responseClass);
|
|
222
|
+
discriminatorDecorator(dynamicClass.prototype, propertyName);
|
|
223
|
+
}
|
|
224
|
+
extractTypeProperty(responseClass) {
|
|
225
|
+
const propertyName = Reflect.getMetadata(ONE_OF_TYPE_API_PROPERTY, responseClass.prototype);
|
|
226
|
+
if (propertyName === undefined) {
|
|
227
|
+
throw new Error(`Response class ${responseClass.name} does not have a type property\n`
|
|
228
|
+
+ `Did you forget to add \x1b[31m@${OneOfTypeApiProperty.name}()\x1b[0m on the type property in ${responseClass.name}?`);
|
|
229
|
+
}
|
|
230
|
+
return propertyName;
|
|
231
|
+
}
|
|
232
|
+
extractMetaProperty(responseClass) {
|
|
233
|
+
const propertyName = Reflect.getMetadata(ONE_OF_META_API_PROPERTY, responseClass.prototype);
|
|
234
|
+
if (propertyName === undefined) {
|
|
235
|
+
throw new Error(`Response class ${responseClass.name} does not have a meta property\n`
|
|
236
|
+
+ `Did you forget to add \x1b[31m@${OneOfMetaApiProperty.name}()\x1b[0m on the meta property in ${responseClass.name}?`);
|
|
237
|
+
}
|
|
238
|
+
return propertyName;
|
|
239
|
+
}
|
|
240
|
+
getModelProperties(prototype) {
|
|
241
|
+
const properties = Reflect.getMetadata(DECORATORS.API_MODEL_PROPERTIES_ARRAY, prototype) ?? [];
|
|
242
|
+
return properties
|
|
243
|
+
.filter(isString)
|
|
244
|
+
.filter((key) => key.charAt(0) === ':' && !isFunction(prototype[key]))
|
|
245
|
+
.map((key) => key.slice(1));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=one-of.decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-of.decorators.js","sourceRoot":"","sources":["../lib/one-of.decorators.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,WAAW,EAEX,WAAW,EACX,aAAa,EACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,eAAe,EAAQ,MAAM,gBAAgB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,kCAAkC,CAAA;AAC1E,MAAM,CAAC,MAAM,wBAAwB,GAAG,kCAAkC,CAAA;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,oCAAoC,CAAA;AAC9E,MAAM,CAAC,MAAM,6BAA6B,GAAG,uCAAuC,CAAA;AAKpF,MAAM,UAAU,oBAAoB;IAClC,OA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":["../lib/pascal-case.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAE,IAAY;IACtC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,CAAA;AAClD,CAAC;AAED,SAAS,aAAa,CAAE,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;AAC5C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wisemen/one-of",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"prebuild": "rm -rf ./dist",
|
|
12
|
+
"clean": "rm -rf ./dist",
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"pretest": "npm run clean && npm run build",
|
|
15
|
+
"test": "node --test",
|
|
16
|
+
"lint": "eslint --cache",
|
|
17
|
+
"prerelease": "npm run build",
|
|
18
|
+
"release": "release-it"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@nestjs/common": "^11.0.10",
|
|
22
|
+
"@nestjs/swagger": "^11.0.4",
|
|
23
|
+
"class-transformer": "^0.5.1",
|
|
24
|
+
"class-validator": "^0.14.1",
|
|
25
|
+
"typeorm": "^0.3.20",
|
|
26
|
+
"reflect-metadata": "^0.2.2"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^20.17.10",
|
|
30
|
+
"expect": "^29.7.0",
|
|
31
|
+
"release-it": "^18.1.2",
|
|
32
|
+
"typescript": "^5.7.2",
|
|
33
|
+
"@stylistic/eslint-plugin": "^2.8.0",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
|
35
|
+
"@wisemen/eslint-config-nestjs": "^0.1.6",
|
|
36
|
+
"eslint": "^9.21.0"
|
|
37
|
+
},
|
|
38
|
+
"author": "Kobe Kwanten",
|
|
39
|
+
"contributors": [],
|
|
40
|
+
"license": "GPL",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git@github.com:wisemen-digital/node-core.git"
|
|
44
|
+
}
|
|
45
|
+
}
|