@celljs/openapi 0.0.0-stage → 4.4.0

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.
Files changed (116) hide show
  1. package/README.md +85 -2
  2. package/cell.schema.json +41 -0
  3. package/cell.yml +12 -0
  4. package/esm/common/annotation.d.ts +60 -0
  5. package/esm/common/annotation.js +73 -0
  6. package/esm/common/annotation.js.map +1 -0
  7. package/esm/common/constants.d.ts +11 -0
  8. package/esm/common/constants.js +12 -0
  9. package/esm/common/constants.js.map +1 -0
  10. package/esm/common/index.d.ts +3 -0
  11. package/esm/common/index.js +4 -0
  12. package/esm/common/index.js.map +1 -0
  13. package/esm/common/openapi-protocol.d.ts +143 -0
  14. package/esm/common/openapi-protocol.js +2 -0
  15. package/esm/common/openapi-protocol.js.map +1 -0
  16. package/esm/node/index.d.ts +6 -0
  17. package/esm/node/index.js +7 -0
  18. package/esm/node/index.js.map +1 -0
  19. package/esm/node/module.d.ts +3 -0
  20. package/esm/node/module.js +4 -0
  21. package/esm/node/module.js.map +1 -0
  22. package/esm/node/openapi-document-provider.d.ts +39 -0
  23. package/esm/node/openapi-document-provider.js +310 -0
  24. package/esm/node/openapi-document-provider.js.map +1 -0
  25. package/esm/node/openapi-middleware.d.ts +17 -0
  26. package/esm/node/openapi-middleware.js +76 -0
  27. package/esm/node/openapi-middleware.js.map +1 -0
  28. package/esm/node/openapi-node-protocol.d.ts +7 -0
  29. package/esm/node/openapi-node-protocol.js +4 -0
  30. package/esm/node/openapi-node-protocol.js.map +1 -0
  31. package/esm/node/openapi-path-util.d.ts +10 -0
  32. package/esm/node/openapi-path-util.js +84 -0
  33. package/esm/node/openapi-path-util.js.map +1 -0
  34. package/esm/node/schema-builder.d.ts +39 -0
  35. package/esm/node/schema-builder.js +271 -0
  36. package/esm/node/schema-builder.js.map +1 -0
  37. package/esm/node/swagger-ui.d.ts +10 -0
  38. package/esm/node/swagger-ui.js +31 -0
  39. package/esm/node/swagger-ui.js.map +1 -0
  40. package/esm/package.json +3 -0
  41. package/lib/common/annotation.d.ts +61 -0
  42. package/lib/common/annotation.d.ts.map +1 -0
  43. package/lib/common/annotation.js +86 -0
  44. package/lib/common/annotation.js.map +1 -0
  45. package/lib/common/constants.d.ts +12 -0
  46. package/lib/common/constants.d.ts.map +1 -0
  47. package/lib/common/constants.js +15 -0
  48. package/lib/common/constants.js.map +1 -0
  49. package/lib/common/index.d.ts +4 -0
  50. package/lib/common/index.d.ts.map +1 -0
  51. package/lib/common/index.js +20 -0
  52. package/lib/common/index.js.map +1 -0
  53. package/lib/common/openapi-protocol.d.ts +144 -0
  54. package/lib/common/openapi-protocol.d.ts.map +1 -0
  55. package/lib/common/openapi-protocol.js +3 -0
  56. package/lib/common/openapi-protocol.js.map +1 -0
  57. package/lib/node/index.d.ts +7 -0
  58. package/lib/node/index.d.ts.map +1 -0
  59. package/lib/node/index.js +23 -0
  60. package/lib/node/index.js.map +1 -0
  61. package/lib/node/module.d.ts +4 -0
  62. package/lib/node/module.d.ts.map +1 -0
  63. package/lib/node/module.js +6 -0
  64. package/lib/node/module.js.map +1 -0
  65. package/lib/node/openapi-document-provider.d.ts +40 -0
  66. package/lib/node/openapi-document-provider.d.ts.map +1 -0
  67. package/lib/node/openapi-document-provider.js +313 -0
  68. package/lib/node/openapi-document-provider.js.map +1 -0
  69. package/lib/node/openapi-middleware.d.ts +18 -0
  70. package/lib/node/openapi-middleware.d.ts.map +1 -0
  71. package/lib/node/openapi-middleware.js +79 -0
  72. package/lib/node/openapi-middleware.js.map +1 -0
  73. package/lib/node/openapi-node-protocol.d.ts +8 -0
  74. package/lib/node/openapi-node-protocol.d.ts.map +1 -0
  75. package/lib/node/openapi-node-protocol.js +7 -0
  76. package/lib/node/openapi-node-protocol.js.map +1 -0
  77. package/lib/node/openapi-path-util.d.ts +11 -0
  78. package/lib/node/openapi-path-util.d.ts.map +1 -0
  79. package/lib/node/openapi-path-util.js +87 -0
  80. package/lib/node/openapi-path-util.js.map +1 -0
  81. package/lib/node/openapi.spec.d.ts +30 -0
  82. package/lib/node/openapi.spec.d.ts.map +1 -0
  83. package/lib/node/openapi.spec.js +268 -0
  84. package/lib/node/openapi.spec.js.map +1 -0
  85. package/lib/node/schema-builder.d.ts +40 -0
  86. package/lib/node/schema-builder.d.ts.map +1 -0
  87. package/lib/node/schema-builder.js +275 -0
  88. package/lib/node/schema-builder.js.map +1 -0
  89. package/lib/node/schema-builder.spec.d.ts +2 -0
  90. package/lib/node/schema-builder.spec.d.ts.map +1 -0
  91. package/lib/node/schema-builder.spec.js +143 -0
  92. package/lib/node/schema-builder.spec.js.map +1 -0
  93. package/lib/node/swagger-ui.d.ts +11 -0
  94. package/lib/node/swagger-ui.d.ts.map +1 -0
  95. package/lib/node/swagger-ui.js +34 -0
  96. package/lib/node/swagger-ui.js.map +1 -0
  97. package/lib/package.spec.d.ts +2 -0
  98. package/lib/package.spec.d.ts.map +1 -0
  99. package/lib/package.spec.js +7 -0
  100. package/lib/package.spec.js.map +1 -0
  101. package/package.json +78 -4
  102. package/src/common/annotation.ts +130 -0
  103. package/src/common/constants.ts +12 -0
  104. package/src/common/index.ts +3 -0
  105. package/src/common/openapi-protocol.ts +154 -0
  106. package/src/node/index.ts +6 -0
  107. package/src/node/module.ts +4 -0
  108. package/src/node/openapi-document-provider.ts +334 -0
  109. package/src/node/openapi-middleware.ts +59 -0
  110. package/src/node/openapi-node-protocol.ts +11 -0
  111. package/src/node/openapi-path-util.ts +75 -0
  112. package/src/node/openapi.spec.ts +219 -0
  113. package/src/node/schema-builder.spec.ts +124 -0
  114. package/src/node/schema-builder.ts +282 -0
  115. package/src/node/swagger-ui.ts +38 -0
  116. package/src/package.spec.ts +5 -0
@@ -0,0 +1,271 @@
1
+ import { OPENAPI_METADATA_KEY } from '../common/index.js';
2
+ const PRIMITIVES = new Map([
3
+ [String, { type: 'string' }],
4
+ [Number, { type: 'number' }],
5
+ [Boolean, { type: 'boolean' }],
6
+ [Date, { type: 'string', format: 'date-time' }],
7
+ [Object, { type: 'object' }],
8
+ [Array, { type: 'array', items: {} }],
9
+ ]);
10
+ /** Types that say nothing about the data: `Promise` of an async method, `any` / interfaces (`Object`) are handled by the caller. */
11
+ const OPAQUE = new Set([Promise, Function, Symbol]);
12
+ /** class-validator constraints (by name) that describe a schema. */
13
+ const CONSTRAINTS = {
14
+ isString: s => setType(s, 'string'),
15
+ isInt: s => setType(s, 'integer'),
16
+ isNumber: s => setType(s, 'number'),
17
+ isBoolean: s => setType(s, 'boolean'),
18
+ isObject: s => setType(s, 'object'),
19
+ isDate: s => setType(s, 'string', 'date-time'),
20
+ isDateString: s => setType(s, 'string', 'date-time'),
21
+ isIso8601: s => setType(s, 'string', 'date-time'),
22
+ isEmail: s => setType(s, 'string', 'email'),
23
+ isUrl: s => setType(s, 'string', 'uri'),
24
+ isUuid: s => setType(s, 'string', 'uuid'),
25
+ isNumberString: s => setType(s, 'string'),
26
+ isBooleanString: s => setType(s, 'string'),
27
+ isArray: s => {
28
+ setType(s, 'array');
29
+ s.items = s.items || {};
30
+ },
31
+ isEnum: (s, c) => setEnum(s, EnumUtil.values(c[0])),
32
+ isIn: (s, c) => setEnum(s, [...c[0]]),
33
+ min: (s, c) => {
34
+ s.minimum = c[0];
35
+ },
36
+ max: (s, c) => {
37
+ s.maximum = c[0];
38
+ },
39
+ isPositive: s => {
40
+ s.minimum = 0;
41
+ s.exclusiveMinimum = true;
42
+ },
43
+ isNegative: s => {
44
+ s.maximum = 0;
45
+ s.exclusiveMaximum = true;
46
+ },
47
+ minLength: (s, c) => {
48
+ s.minLength = c[0];
49
+ },
50
+ maxLength: (s, c) => {
51
+ s.maxLength = c[0];
52
+ },
53
+ isLength: (s, c) => {
54
+ s.minLength = c[0];
55
+ if (c[1] !== undefined) {
56
+ s.maxLength = c[1];
57
+ }
58
+ },
59
+ matches: (s, c) => {
60
+ s.pattern = c[0] instanceof RegExp ? c[0].source : String(c[0]);
61
+ },
62
+ arrayMinSize: (s, c) => {
63
+ s.minItems = c[0];
64
+ },
65
+ arrayMaxSize: (s, c) => {
66
+ s.maxItems = c[0];
67
+ },
68
+ };
69
+ function setType(schema, type, format) {
70
+ delete schema.$ref;
71
+ delete schema.allOf;
72
+ schema.type = type;
73
+ if (format) {
74
+ schema.format = format;
75
+ }
76
+ else {
77
+ delete schema.format;
78
+ }
79
+ if (type !== 'array') {
80
+ delete schema.items;
81
+ }
82
+ }
83
+ /** The type of an enum follows its values: the TypeScript type of an enum property may be missing or `Object`. */
84
+ function setEnum(schema, values) {
85
+ schema.enum = values;
86
+ if (schema.$ref || schema.allOf || (schema.type && schema.type !== 'object') || !values.length) {
87
+ return;
88
+ }
89
+ if (values.every(v => typeof v === 'string')) {
90
+ setType(schema, 'string');
91
+ }
92
+ else if (values.every(v => typeof v === 'number')) {
93
+ setType(schema, values.every(v => Number.isInteger(v)) ? 'integer' : 'number');
94
+ }
95
+ }
96
+ export var EnumUtil;
97
+ (function (EnumUtil) {
98
+ /** The values of a list or a TypeScript enum (without the reverse entries of numeric enums). */
99
+ function values(enumOrValues) {
100
+ if (Array.isArray(enumOrValues)) {
101
+ return [...enumOrValues];
102
+ }
103
+ return Object.keys(enumOrValues)
104
+ .filter(key => typeof enumOrValues[enumOrValues[key]] !== 'number')
105
+ .map(key => enumOrValues[key]);
106
+ }
107
+ EnumUtil.values = values;
108
+ })(EnumUtil || (EnumUtil = {}));
109
+ export var ClassValidatorUtil;
110
+ (function (ClassValidatorUtil) {
111
+ function metadatas(target) {
112
+ const storage = globalThis.classValidatorMetadataStorage;
113
+ if (!storage || typeof storage.getTargetValidationMetadatas !== 'function') {
114
+ return [];
115
+ }
116
+ try {
117
+ return storage.getTargetValidationMetadatas(target, '', true, false) || [];
118
+ }
119
+ catch (_a) {
120
+ return [];
121
+ }
122
+ }
123
+ ClassValidatorUtil.metadatas = metadatas;
124
+ })(ClassValidatorUtil || (ClassValidatorUtil = {}));
125
+ /**
126
+ * Turns types into schemas; classes become `components.schemas` entries referred to by `$ref`.
127
+ * One instance builds one document.
128
+ */
129
+ export class SchemaBuilder {
130
+ constructor() {
131
+ this.schemas = {};
132
+ this.names = new Map();
133
+ }
134
+ /** The schema of a type, or undefined when the type says nothing (`Promise`, `void`). */
135
+ resolve(type) {
136
+ if (type === undefined || type === null) {
137
+ return undefined;
138
+ }
139
+ if (Array.isArray(type)) {
140
+ return { type: 'array', items: this.resolve(type[0]) || {} };
141
+ }
142
+ if (typeof type === 'string') {
143
+ return { type };
144
+ }
145
+ const primitive = PRIMITIVES.get(type);
146
+ if (primitive) {
147
+ return structuredClone(primitive);
148
+ }
149
+ if (OPAQUE.has(type) || typeof type !== 'function') {
150
+ return undefined;
151
+ }
152
+ return { $ref: `#/components/schemas/${this.define(type)}` };
153
+ }
154
+ /** The schema of a class, inline: its properties from @ApiProperty and class-validator decorators. */
155
+ build(target) {
156
+ const properties = {};
157
+ const optional = new Set();
158
+ const required = new Set();
159
+ for (const metadata of ClassValidatorUtil.metadatas(target)) {
160
+ const key = metadata.propertyName;
161
+ properties[key] = properties[key] || this.designType(target, key);
162
+ const schema = properties[key];
163
+ if (metadata.type === 'conditionalValidation') {
164
+ optional.add(key);
165
+ continue;
166
+ }
167
+ const apply = metadata.name && CONSTRAINTS[metadata.name];
168
+ if (!apply) {
169
+ continue;
170
+ }
171
+ if (metadata.each) {
172
+ setType(schema, 'array');
173
+ schema.items = schema.items || {};
174
+ apply(schema.items, metadata.constraints || []);
175
+ }
176
+ else {
177
+ apply(schema, metadata.constraints || []);
178
+ }
179
+ }
180
+ for (const { key, options } of this.apiProperties(target)) {
181
+ properties[key] = this.fromOptions(options, properties[key] || this.designType(target, key));
182
+ if (options.required === false) {
183
+ optional.add(key);
184
+ }
185
+ else if (options.required === true) {
186
+ required.add(key);
187
+ }
188
+ }
189
+ const schema = { type: 'object', properties: {} };
190
+ const requiredList = [];
191
+ for (const [key, property] of Object.entries(properties)) {
192
+ schema.properties[key] = SchemaUtil.normalize(property);
193
+ if (required.has(key) || !optional.has(key)) {
194
+ requiredList.push(key);
195
+ }
196
+ }
197
+ if (requiredList.length) {
198
+ schema.required = requiredList;
199
+ }
200
+ return schema;
201
+ }
202
+ /** Applies @ApiProperty-like options to the schema found from the TypeScript type. */
203
+ fromOptions(options, found = {}) {
204
+ const { type, required, enum: values, items, ...rest } = options;
205
+ let schema = { ...found };
206
+ if (type !== undefined) {
207
+ const resolved = this.resolve(type) || {};
208
+ if (resolved.$ref || resolved.type !== found.type) {
209
+ schema = {};
210
+ for (const key of ['description', 'example', 'enum', 'nullable']) {
211
+ if (found[key] !== undefined) {
212
+ schema[key] = found[key];
213
+ }
214
+ }
215
+ }
216
+ Object.assign(schema, resolved);
217
+ }
218
+ if (values !== undefined) {
219
+ setEnum(schema, EnumUtil.values(values));
220
+ }
221
+ if (items !== undefined) {
222
+ schema.items = items;
223
+ }
224
+ return Object.assign(schema, rest);
225
+ }
226
+ designType(target, key) {
227
+ return this.resolve(Reflect.getMetadata('design:type', target.prototype, key)) || {};
228
+ }
229
+ /** @ApiProperty metadata of the class and its parents, parents first; a subclass entry replaces the parent's. */
230
+ apiProperties(target) {
231
+ const chain = [];
232
+ for (let current = target; current && current !== Function.prototype; current = Object.getPrototypeOf(current)) {
233
+ chain.unshift(current);
234
+ }
235
+ const merged = new Map();
236
+ for (const current of chain) {
237
+ for (const metadata of (Reflect.getOwnMetadata(OPENAPI_METADATA_KEY.properties, current) || [])) {
238
+ merged.set(metadata.key, metadata);
239
+ }
240
+ }
241
+ return [...merged.values()];
242
+ }
243
+ define(target) {
244
+ const existing = this.names.get(target);
245
+ if (existing) {
246
+ return existing;
247
+ }
248
+ const base = target.name || 'Anonymous';
249
+ let name = base;
250
+ for (let i = 2; this.schemas[name]; i++) {
251
+ name = `${base}${i}`;
252
+ }
253
+ this.names.set(target, name);
254
+ this.schemas[name] = {};
255
+ this.schemas[name] = this.build(target);
256
+ return name;
257
+ }
258
+ }
259
+ export var SchemaUtil;
260
+ (function (SchemaUtil) {
261
+ /** OpenAPI 3.0 ignores the siblings of `$ref`: keep them by wrapping the reference in `allOf`. */
262
+ function normalize(schema) {
263
+ if (schema.$ref && Object.keys(schema).length > 1) {
264
+ const { $ref, ...rest } = schema;
265
+ return { allOf: [{ $ref }], ...rest };
266
+ }
267
+ return schema;
268
+ }
269
+ SchemaUtil.normalize = normalize;
270
+ })(SchemaUtil || (SchemaUtil = {}));
271
+ //# sourceMappingURL=schema-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-builder.js","sourceRoot":"","sources":["../../src/node/schema-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuE,oBAAoB,EAAmC,MAAM,WAAW,CAAC;AAEvJ,MAAM,UAAU,GAAG,IAAI,GAAG,CAAwB;IAC9C,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC9B,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAC/C,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;CACxC,CAAC,CAAC;AAEH,oIAAoI;AACpI,MAAM,MAAM,GAAG,IAAI,GAAG,CAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7D,oEAAoE;AACpE,MAAM,WAAW,GAAuE;IACpF,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC;IACjC,QAAQ,EAAE,CAAC,CAAC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ACJ;AAED,MAAM,KAAW,UAAU,CAS1B;AATD,WAAiB,UAAU;IACvB,kGAAkG;IAClG,SAAgB,SAAS,CAAC,MAAoB;QAC1C,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;YACjC,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;QAC1C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IANe,WAAA,SAAS,YAMxB,CAAA;AACL,CAAC,EATgB,UAAU,KAAV,UAAU,QAS1B"}
@@ -0,0 +1,10 @@
1
+ export interface SwaggerUiPageOptions {
2
+ title: string;
3
+ /** URL of the OpenAPI document. */
4
+ url: string;
5
+ /** Base URL of swagger-ui-dist. */
6
+ cdn: string;
7
+ }
8
+ export declare namespace SwaggerUiUtil {
9
+ function render({ title, url, cdn }: SwaggerUiPageOptions): string;
10
+ }
@@ -0,0 +1,31 @@
1
+ export var SwaggerUiUtil;
2
+ (function (SwaggerUiUtil) {
3
+ function render({ title, url, cdn }) {
4
+ const base = cdn.replace(/\/+$/, '');
5
+ return `<!doctype html>
6
+ <html lang="en">
7
+ <head>
8
+ <meta charset="utf-8">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+ <title>${escapeHtml(title)}</title>
11
+ <link rel="stylesheet" href="${escapeHtml(base)}/swagger-ui.css">
12
+ </head>
13
+ <body>
14
+ <div id="swagger-ui"></div>
15
+ <script src="${escapeHtml(base)}/swagger-ui-bundle.js" crossorigin></script>
16
+ <script>
17
+ window.ui = SwaggerUIBundle({ url: ${scriptValue(url)}, dom_id: '#swagger-ui', deepLinking: true });
18
+ </script>
19
+ </body>
20
+ </html>
21
+ `;
22
+ }
23
+ SwaggerUiUtil.render = render;
24
+ function escapeHtml(text) {
25
+ return text.replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
26
+ }
27
+ function scriptValue(value) {
28
+ return JSON.stringify(value).replace(/</g, '\\u003c');
29
+ }
30
+ })(SwaggerUiUtil || (SwaggerUiUtil = {}));
31
+ //# sourceMappingURL=swagger-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger-ui.js","sourceRoot":"","sources":["../../src/node/swagger-ui.ts"],"names":[],"mappings":"AAQA,MAAM,KAAW,aAAa,CA6B7B;AA7BD,WAAiB,aAAa;IAC1B,SAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAwB;QAC5D,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACrC,OAAO;;;;;SAKN,UAAU,CAAC,KAAK,CAAC;+BACK,UAAU,CAAC,IAAI,CAAC;;;;eAIhC,UAAU,CAAC,IAAI,CAAC;;qCAEM,WAAW,CAAC,GAAG,CAAC;;;;CAIpD,CAAC;IACE,CAAC;IAnBe,cAAA,MAAM,SAmBrB,CAAA;IAED,SAAS,UAAU,CAAC,IAAY;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IAED,SAAS,WAAW,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;AACL,CAAC,EA7BgB,aAAa,KAAb,aAAa,QA6B7B"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,61 @@
1
+ import type { ParameterLocation, SchemaObject, TypeRef } from './openapi-protocol';
2
+ export interface ApiOperationOptions {
3
+ summary?: string;
4
+ description?: string;
5
+ /** Default: `<ControllerClass>_<method>`. */
6
+ operationId?: string;
7
+ deprecated?: boolean;
8
+ }
9
+ export interface ApiResponseOptions {
10
+ /** Default: 200. */
11
+ status?: number | 'default';
12
+ description?: string;
13
+ /** Type of the body; `[User]` for a list. */
14
+ type?: TypeRef;
15
+ /** A schema written by hand; wins over `type`. */
16
+ schema?: SchemaObject;
17
+ /** Default: by the view of the method (`application/json`, `text/plain` for `@Text()`...). */
18
+ contentType?: string;
19
+ }
20
+ export type ApiPropertyOptions = Omit<SchemaObject, 'type' | 'required' | 'enum' | 'items'> & {
21
+ /** Default: the TypeScript type of the property (`design:type`); needed for arrays (`[Item]`). */
22
+ type?: TypeRef;
23
+ /** Default: true. */
24
+ required?: boolean;
25
+ /** Values, or a TypeScript enum. */
26
+ enum?: any[] | Record<string, any>;
27
+ items?: SchemaObject;
28
+ };
29
+ export type ApiParameterOptions = Omit<ApiPropertyOptions, 'description' | 'example' | 'deprecated'> & {
30
+ name: string;
31
+ description?: string;
32
+ example?: any;
33
+ deprecated?: boolean;
34
+ };
35
+ export interface ApiParameterMetadata extends ApiParameterOptions {
36
+ in: ParameterLocation;
37
+ }
38
+ export interface ApiPropertyMetadata {
39
+ key: string;
40
+ options: ApiPropertyOptions;
41
+ }
42
+ /** Groups the operations of a controller or a method in the UI. Default: the controller name without `Controller`. */
43
+ export declare function ApiTags(...tags: string[]): ClassDecorator & MethodDecorator;
44
+ export declare function ApiOperation(options: ApiOperationOptions): MethodDecorator;
45
+ /** A possible response; on a controller it applies to all its methods. Repeat it for several statuses. */
46
+ export declare function ApiResponse(options: ApiResponseOptions): ClassDecorator & MethodDecorator;
47
+ /** Describes a property of a request or response class. Properties with class-validator decorators are found without it. */
48
+ export declare function ApiProperty(options?: ApiPropertyOptions): PropertyDecorator;
49
+ export declare function ApiPropertyOptional(options?: ApiPropertyOptions): PropertyDecorator;
50
+ /** Describes a path parameter; it is found from the route without it. */
51
+ export declare function ApiParam(options: ApiParameterOptions): MethodDecorator;
52
+ /** Describes a query parameter, or documents one the method reads from the request itself. */
53
+ export declare function ApiQuery(options: ApiParameterOptions): MethodDecorator;
54
+ export declare function ApiHeader(options: ApiParameterOptions): MethodDecorator;
55
+ /** Requires the security scheme `name` (declared in `openapi.document.components.securitySchemes`). */
56
+ export declare function ApiSecurity(name: string, scopes?: string[]): ClassDecorator & MethodDecorator;
57
+ /** Requires a bearer token (`Authorization: Bearer ...`); the scheme `bearer` is declared when it is missing. */
58
+ export declare function ApiBearerAuth(name?: string): ClassDecorator & MethodDecorator;
59
+ /** Leaves a controller or a method out of the document. */
60
+ export declare function ApiExclude(): ClassDecorator & MethodDecorator;
61
+ //# sourceMappingURL=annotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/common/annotation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAA6B,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE9G,MAAM,WAAW,mBAAmB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IAC/B,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kDAAkD;IAClD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG;IAC1F,kGAAkG;IAClG,IAAI,CAAC,EAAE,O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AAC,OAAO,EAAE,mBAAmB,GAAG,eAAe,CAEvE;AAED,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,EAAO,GAAG,cAAc,GAAG,eAAe,CAEjG;AAED,iHAAiH;AACjH,wBAAgB,aAAa,CAAC,IAAI,SAAwB,GAAG,cAAc,GAAG,eAAe,CAE5F;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,IAAI,cAAc,GAAG,eAAe,CAE7D"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiTags = ApiTags;
4
+ exports.ApiOperation = ApiOperation;
5
+ exports.ApiResponse = ApiResponse;
6
+ exports.ApiProperty = ApiProperty;
7
+ exports.ApiPropertyOptional = ApiPropertyOptional;
8
+ exports.ApiParam = ApiParam;
9
+ exports.ApiQuery = ApiQuery;
10
+ exports.ApiHeader = ApiHeader;
11
+ exports.ApiSecurity = ApiSecurity;
12
+ exports.ApiBearerAuth = ApiBearerAuth;
13
+ exports.ApiExclude = ApiExclude;
14
+ const constants_1 = require("./constants");
15
+ function defineList(key, value, target, propertyKey) {
16
+ const list = (propertyKey === undefined ? Reflect.getOwnMetadata(key, target) : Reflect.getOwnMetadata(key, target, propertyKey)) || [];
17
+ list.push(value);
18
+ if (propertyKey === undefined) {
19
+ Reflect.defineMetadata(key, list, target);
20
+ }
21
+ else {
22
+ Reflect.defineMetadata(key, list, target, propertyKey);
23
+ }
24
+ }
25
+ /** A decorator for a controller (`target` is the class) or one of its methods (metadata goes on the class with the method name). */
26
+ function classOrMethod(key, value, list) {
27
+ return ((target, propertyKey) => {
28
+ const owner = propertyKey === undefined ? target : target.constructor;
29
+ if (list) {
30
+ defineList(key, value, owner, propertyKey);
31
+ }
32
+ else if (propertyKey === undefined) {
33
+ Reflect.defineMetadata(key, value, owner);
34
+ }
35
+ else {
36
+ Reflect.defineMetadata(key, value, owner, propertyKey);
37
+ }
38
+ });
39
+ }
40
+ /** Groups the operations of a controller or a method in the UI. Default: the controller name without `Controller`. */
41
+ function ApiTags(...tags) {
42
+ return classOrMethod(constants_1.OPENAPI_METADATA_KEY.tags, tags, false);
43
+ }
44
+ function ApiOperation(options) {
45
+ return classOrMethod(constants_1.OPENAPI_METADATA_KEY.operation, options, false);
46
+ }
47
+ /** A possible response; on a controller it applies to all its methods. Repeat it for several statuses. */
48
+ function ApiResponse(options) {
49
+ return classOrMethod(constants_1.OPENAPI_METADATA_KEY.responses, options, true);
50
+ }
51
+ /** Describes a property of a request or response class. Properties with class-validator decorators are found without it. */
52
+ function ApiProperty(options = {}) {
53
+ return (target, propertyKey) => {
54
+ defineList(constants_1.OPENAPI_METADATA_KEY.properties, { key: propertyKey.toString(), options }, target.constructor);
55
+ };
56
+ }
57
+ function ApiPropertyOptional(options = {}) {
58
+ return ApiProperty({ ...options, required: false });
59
+ }
60
+ function parameter(location, options) {
61
+ return classOrMethod(constants_1.OPENAPI_METADATA_KEY.parameters, { ...options, in: location }, true);
62
+ }
63
+ /** Describes a path parameter; it is found from the route without it. */
64
+ function ApiParam(options) {
65
+ return parameter('path', options);
66
+ }
67
+ /** Describes a query parameter, or documents one the method reads from the request itself. */
68
+ function ApiQuery(options) {
69
+ return parameter('query', options);
70
+ }
71
+ function ApiHeader(options) {
72
+ return parameter('header', options);
73
+ }
74
+ /** Requires the security scheme `name` (declared in `openapi.document.components.securitySchemes`). */
75
+ function ApiSecurity(name, scopes = []) {
76
+ return classOrMethod(constants_1.OPENAPI_METADATA_KEY.security, { [name]: scopes }, true);
77
+ }
78
+ /** Requires a bearer token (`Authorization: Bearer ...`); the scheme `bearer` is declared when it is missing. */
79
+ function ApiBearerAuth(name = constants_1.DEFAULT_BEARER_SCHEME) {
80
+ return ApiSecurity(name);
81
+ }
82
+ /** Leaves a controller or a method out of the document. */
83
+ function ApiExclude() {
84
+ return classOrMethod(constants_1.OPENAPI_METADATA_KEY.exclude, true, false);
85
+ }
86
+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,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,mBAA0B,OAA4B;IAClD,OAAO,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,uGAAuG;AACvG,qBAA4B,IAAY,EAAE,MAAM,GAAa,EAAE;IAC3D,OAAO,aAAa,CAAC,gCAAoB,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAA+B,EAAE,IAAI,CAAC,CAAC;AAC/G,CAAC;AAED,iHAAiH;AACjH,uBAA8B,IAAI,GAAG,iCAAqB;IACtD,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,2DAA2D;AAC3D;IACI,OAAO,aAAa,CAAC,gCAAoB,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const OPENAPI_METADATA_KEY: {
2
+ tags: string;
3
+ operation: string;
4
+ responses: string;
5
+ parameters: string;
6
+ properties: string;
7
+ security: string;
8
+ exclude: string;
9
+ };
10
+ /** Name of the security scheme that `@ApiBearerAuth()` refers to when none is given. */
11
+ export declare const DEFAULT_BEARER_SCHEME = "bearer";
12
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;IAC7B,IAAI;IACJ,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;CACV,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,qBAAqB,WAAW,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_BEARER_SCHEME = exports.OPENAPI_METADATA_KEY = void 0;
4
+ exports.OPENAPI_METADATA_KEY = {
5
+ tags: 'cell:openapi:tags',
6
+ operation: 'cell:openapi:operation',
7
+ responses: 'cell:openapi:responses',
8
+ parameters: 'cell:openapi:parameters',
9
+ properties: 'cell:openapi:properties',
10
+ security: 'cell:openapi:security',
11
+ exclude: 'cell:openapi:exclude',
12
+ };
13
+ /** Name of the security scheme that `@ApiBearerAuth()` refers to when none is given. */
14
+ exports.DEFAULT_BEARER_SCHEME = 'bearer';
15
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG;IAChC,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,wBAAwB;IACnC,SAAS,EAAE,wBAAwB;IACnC,UAAU,EAAE,yBAAyB;IACrC,UAAU,EAAE,yBAAyB;IACrC,QAAQ,EAAE,uBAAuB;IACjC,OAAO,EAAE,sBAAsB;CAClC,CAAC;AAEF,wFAAwF;AAC3E,QAAA,qBAAqB,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './annotation';
2
+ export * from './constants';
3
+ export * from './openapi-protocol';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./annotation"), exports);
18
+ __exportStar(require("./constants"), exports);
19
+ __exportStar(require("./openapi-protocol"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC"}