@trapi/swagger 1.0.0-alpha.2 → 1.0.0-alpha.4

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 (148) hide show
  1. package/dist/config/index.d.ts +3 -0
  2. package/dist/config/index.d.ts.map +1 -0
  3. package/dist/config/index.js +25 -0
  4. package/dist/config/index.js.map +1 -0
  5. package/dist/config/type.d.ts +83 -0
  6. package/dist/config/type.d.ts.map +1 -0
  7. package/dist/config/type.js +9 -0
  8. package/dist/config/type.js.map +1 -0
  9. package/dist/config/utils.d.ts +3 -0
  10. package/dist/config/utils.d.ts.map +1 -0
  11. package/dist/config/utils.js +52 -0
  12. package/dist/config/utils.js.map +1 -0
  13. package/dist/constants.d.ts +15 -0
  14. package/dist/constants.d.ts.map +1 -0
  15. package/dist/constants.js +27 -0
  16. package/dist/constants.js.map +1 -0
  17. package/dist/generator/abstract.d.ts +27 -0
  18. package/dist/generator/abstract.d.ts.map +1 -0
  19. package/dist/{specification → generator}/abstract.js +39 -29
  20. package/dist/generator/abstract.js.map +1 -0
  21. package/dist/{specification → generator}/index.d.ts +0 -2
  22. package/dist/generator/index.d.ts.map +1 -0
  23. package/dist/{specification → generator}/index.js +1 -3
  24. package/dist/generator/index.js.map +1 -0
  25. package/dist/generator/module.d.ts +14 -0
  26. package/dist/generator/module.d.ts.map +1 -0
  27. package/dist/generator/module.js +35 -0
  28. package/dist/generator/module.js.map +1 -0
  29. package/dist/generator/v2/index.d.ts +2 -0
  30. package/dist/generator/v2/index.d.ts.map +1 -0
  31. package/dist/{specification/utils → generator/v2}/index.js +2 -2
  32. package/dist/generator/v2/index.js.map +1 -0
  33. package/dist/generator/v2/module.d.ts +25 -0
  34. package/dist/generator/v2/module.d.ts.map +1 -0
  35. package/dist/generator/v2/module.js +501 -0
  36. package/dist/generator/v2/module.js.map +1 -0
  37. package/dist/generator/v3/index.d.ts +2 -0
  38. package/dist/generator/v3/index.d.ts.map +1 -0
  39. package/dist/generator/v3/index.js +24 -0
  40. package/dist/generator/v3/index.js.map +1 -0
  41. package/dist/generator/v3/module.d.ts +27 -0
  42. package/dist/generator/v3/module.d.ts.map +1 -0
  43. package/dist/{specification → generator}/v3/module.js +170 -109
  44. package/dist/generator/v3/module.js.map +1 -0
  45. package/dist/index.d.ts +3 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +3 -2
  48. package/dist/index.js.map +1 -1
  49. package/dist/metadata.d.ts +2 -2
  50. package/dist/metadata.d.ts.map +1 -1
  51. package/dist/metadata.js +2 -1
  52. package/dist/metadata.js.map +1 -1
  53. package/dist/schema/constants.d.ts +7 -0
  54. package/dist/schema/constants.d.ts.map +1 -0
  55. package/dist/schema/constants.js +17 -0
  56. package/dist/schema/constants.js.map +1 -0
  57. package/dist/schema/index.d.ts +5 -0
  58. package/dist/schema/index.d.ts.map +1 -0
  59. package/dist/schema/index.js +27 -0
  60. package/dist/schema/index.js.map +1 -0
  61. package/dist/schema/type.d.ts +140 -0
  62. package/dist/schema/type.d.ts.map +1 -0
  63. package/dist/schema/type.js.map +1 -0
  64. package/dist/schema/v2/constants.d.ts +8 -0
  65. package/dist/schema/v2/constants.d.ts.map +1 -0
  66. package/dist/schema/v2/constants.js +18 -0
  67. package/dist/schema/v2/constants.js.map +1 -0
  68. package/dist/schema/v2/index.d.ts +3 -0
  69. package/dist/schema/v2/index.d.ts.map +1 -0
  70. package/dist/{specification/v3 → schema/v2}/index.js +1 -1
  71. package/dist/schema/v2/index.js.map +1 -0
  72. package/dist/schema/v2/type.d.ts +116 -0
  73. package/dist/schema/v2/type.d.ts.map +1 -0
  74. package/dist/schema/v2/type.js.map +1 -0
  75. package/dist/schema/v3/constants.d.ts +7 -0
  76. package/dist/schema/v3/constants.d.ts.map +1 -0
  77. package/dist/schema/v3/constants.js +17 -0
  78. package/dist/schema/v3/constants.js.map +1 -0
  79. package/dist/schema/v3/index.d.ts +3 -0
  80. package/dist/schema/v3/index.d.ts.map +1 -0
  81. package/dist/{specification/v2 → schema/v3}/index.js +1 -1
  82. package/dist/schema/v3/index.js.map +1 -0
  83. package/dist/schema/v3/type.d.ts +158 -0
  84. package/dist/schema/v3/type.d.ts.map +1 -0
  85. package/dist/schema/v3/type.js +9 -0
  86. package/dist/schema/v3/type.js.map +1 -0
  87. package/dist/type.d.ts +44 -2
  88. package/dist/type.d.ts.map +1 -1
  89. package/dist/utils/character.d.ts +3 -0
  90. package/dist/utils/character.d.ts.map +1 -0
  91. package/dist/{specification/utils → utils}/character.js +3 -4
  92. package/dist/utils/character.js.map +1 -0
  93. package/dist/utils/index.d.ts +2 -0
  94. package/dist/utils/index.d.ts.map +1 -1
  95. package/dist/utils/index.js +2 -0
  96. package/dist/utils/index.js.map +1 -1
  97. package/dist/utils/object.d.ts.map +1 -1
  98. package/dist/utils/object.js +1 -0
  99. package/dist/utils/object.js.map +1 -1
  100. package/dist/utils/value.d.ts +2 -0
  101. package/dist/utils/value.d.ts.map +1 -0
  102. package/dist/utils/value.js +26 -0
  103. package/dist/utils/value.js.map +1 -0
  104. package/package.json +5 -4
  105. package/dist/module.d.ts +0 -8
  106. package/dist/module.d.ts.map +0 -1
  107. package/dist/module.js +0 -19
  108. package/dist/module.js.map +0 -1
  109. package/dist/specification/abstract.d.ts +0 -28
  110. package/dist/specification/abstract.d.ts.map +0 -1
  111. package/dist/specification/abstract.js.map +0 -1
  112. package/dist/specification/index.d.ts.map +0 -1
  113. package/dist/specification/index.js.map +0 -1
  114. package/dist/specification/module.d.ts +0 -6
  115. package/dist/specification/module.d.ts.map +0 -1
  116. package/dist/specification/module.js +0 -29
  117. package/dist/specification/module.js.map +0 -1
  118. package/dist/specification/type.d.ts +0 -268
  119. package/dist/specification/type.d.ts.map +0 -1
  120. package/dist/specification/type.js +0 -18
  121. package/dist/specification/type.js.map +0 -1
  122. package/dist/specification/utils/character.d.ts +0 -3
  123. package/dist/specification/utils/character.d.ts.map +0 -1
  124. package/dist/specification/utils/character.js.map +0 -1
  125. package/dist/specification/utils/index.d.ts +0 -2
  126. package/dist/specification/utils/index.d.ts.map +0 -1
  127. package/dist/specification/utils/index.js.map +0 -1
  128. package/dist/specification/v2/index.d.ts +0 -3
  129. package/dist/specification/v2/index.d.ts.map +0 -1
  130. package/dist/specification/v2/index.js.map +0 -1
  131. package/dist/specification/v2/module.d.ts +0 -24
  132. package/dist/specification/v2/module.d.ts.map +0 -1
  133. package/dist/specification/v2/module.js +0 -405
  134. package/dist/specification/v2/module.js.map +0 -1
  135. package/dist/specification/v2/type.d.ts +0 -79
  136. package/dist/specification/v2/type.d.ts.map +0 -1
  137. package/dist/specification/v2/type.js.map +0 -1
  138. package/dist/specification/v3/index.d.ts +0 -3
  139. package/dist/specification/v3/index.d.ts.map +0 -1
  140. package/dist/specification/v3/index.js.map +0 -1
  141. package/dist/specification/v3/module.d.ts +0 -24
  142. package/dist/specification/v3/module.d.ts.map +0 -1
  143. package/dist/specification/v3/module.js.map +0 -1
  144. package/dist/specification/v3/type.d.ts +0 -121
  145. package/dist/specification/v3/type.d.ts.map +0 -1
  146. package/dist/specification/v3/type.js.map +0 -1
  147. /package/dist/{specification/v2 → schema}/type.js +0 -0
  148. /package/dist/{specification/v3 → schema/v2}/type.js +0 -0
@@ -0,0 +1,140 @@
1
+ import type { CollectionFormat } from '@trapi/metadata';
2
+ import type { ParameterSourceV2 } from './v2';
3
+ export interface BaseSpec {
4
+ info: Info;
5
+ tags?: Tag[];
6
+ externalDocs?: ExternalDocs;
7
+ }
8
+ export type Info = {
9
+ title: string;
10
+ version: string;
11
+ description?: string;
12
+ termsOfService?: string;
13
+ contact?: Contact;
14
+ license?: License;
15
+ };
16
+ type Contact = {
17
+ name?: string;
18
+ email?: string;
19
+ url?: string;
20
+ };
21
+ type License = {
22
+ name: string;
23
+ url?: string;
24
+ };
25
+ type ExternalDocs = {
26
+ url: string;
27
+ description?: string;
28
+ };
29
+ type Tag = {
30
+ name: string;
31
+ description?: string;
32
+ externalDocs?: ExternalDocs;
33
+ };
34
+ export interface BaseResponse {
35
+ description: string;
36
+ }
37
+ export interface BaseOperation<P, R> {
38
+ responses: {
39
+ [name: string]: R;
40
+ };
41
+ summary?: string;
42
+ description?: string;
43
+ externalDocs?: ExternalDocs;
44
+ operationId?: string;
45
+ consumes?: string[];
46
+ parameters?: P[];
47
+ schemes?: string[];
48
+ deprecated?: boolean;
49
+ security?: Record<string, string[]>[];
50
+ tags?: string[];
51
+ }
52
+ export interface Example {
53
+ value: unknown | unknown[];
54
+ summary?: string;
55
+ description?: string;
56
+ }
57
+ export interface BaseSchema<T> {
58
+ type?: DataType | any;
59
+ format?: DataFormat;
60
+ title?: string;
61
+ description?: string;
62
+ default?: string | boolean | number | any;
63
+ multipleOf?: number;
64
+ maximum?: number;
65
+ exclusiveMaximum?: number;
66
+ minimum?: number;
67
+ exclusiveMinimum?: number;
68
+ maxLength?: number;
69
+ minLength?: number;
70
+ pattern?: string;
71
+ maxItems?: number;
72
+ minItems?: number;
73
+ uniqueItems?: boolean;
74
+ maxProperties?: number;
75
+ minProperties?: number;
76
+ enum?: Array<string | number | boolean>;
77
+ 'x-enum-varnames'?: string[];
78
+ items?: T | BaseSchema<T> | any;
79
+ additionalProperties?: boolean | {
80
+ [ref: string]: string;
81
+ } | T;
82
+ properties?: {
83
+ [propertyName: string]: T;
84
+ };
85
+ discriminator?: string;
86
+ readOnly?: boolean;
87
+ xml?: XML;
88
+ externalDocs?: ExternalDocs;
89
+ example?: {
90
+ [exampleName: string]: Example;
91
+ } | unknown;
92
+ required?: string[];
93
+ $ref?: string;
94
+ }
95
+ interface XML {
96
+ type?: string;
97
+ namespace?: string;
98
+ prefix?: string;
99
+ attribute?: string;
100
+ wrapped?: boolean;
101
+ }
102
+ export type DataType = 'void' | 'integer' | 'number' | 'boolean' | 'string' | 'array' | 'object' | 'file';
103
+ export type DataFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password';
104
+ export interface BaseParameter {
105
+ name: string;
106
+ in: `${ParameterSourceV2}`;
107
+ required?: boolean;
108
+ description?: string;
109
+ }
110
+ export interface BodyParameter extends BaseParameter {
111
+ in: `${ParameterSourceV2.BODY}`;
112
+ }
113
+ export interface QueryParameter extends BaseParameter {
114
+ in: `${ParameterSourceV2.QUERY}`;
115
+ allowEmptyValue?: boolean;
116
+ collectionFormat?: `${CollectionFormat}`;
117
+ }
118
+ export interface PathParameter extends BaseParameter {
119
+ in: `${ParameterSourceV2.PATH}`;
120
+ }
121
+ export interface HeaderParameter extends BaseParameter {
122
+ in: `${ParameterSourceV2.HEADER}`;
123
+ }
124
+ export interface FormDataParameter extends BaseParameter {
125
+ in: `${ParameterSourceV2.FORM_DATA}`;
126
+ collectionFormat?: `${CollectionFormat}`;
127
+ }
128
+ export interface Path<Operation, Parameter> {
129
+ $ref?: string;
130
+ get?: Operation;
131
+ put?: Operation;
132
+ post?: Operation;
133
+ delete?: Operation;
134
+ options?: Operation;
135
+ head?: Operation;
136
+ patch?: Operation;
137
+ parameters?: Parameter[];
138
+ }
139
+ export {};
140
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/schema/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,MAAM,IAAI,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAA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C;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa;IAChD,EAAE,EAAE,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IAClD,EAAE,EAAE,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACpD,EAAE,EAAE,GAAG,iBAAiB,CAAC,SAAS,EAAE,CAAC;IACrC,gBAAgB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;CAC5C;AAID,MAAM,WAAW,IAAI,CAAC,SAAS,EAAE,SAAS;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC5B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/schema/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,8 @@
1
+ export declare enum ParameterSourceV2 {
2
+ BODY = "body",
3
+ FORM_DATA = "formData",
4
+ HEADER = "header",
5
+ PATH = "path",
6
+ QUERY = "query"
7
+ }
8
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/schema/v2/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,iBAAiB;IACzB,IAAI,SAAS;IACb,SAAS,aAAa;IACtB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAClB"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2023.
4
+ * Author Peter Placzek (tada5hi)
5
+ * For the full copyright and license information,
6
+ * view the LICENSE file that was distributed with this source code.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ParameterSourceV2 = void 0;
10
+ var ParameterSourceV2;
11
+ (function (ParameterSourceV2) {
12
+ ParameterSourceV2["BODY"] = "body";
13
+ ParameterSourceV2["FORM_DATA"] = "formData";
14
+ ParameterSourceV2["HEADER"] = "header";
15
+ ParameterSourceV2["PATH"] = "path";
16
+ ParameterSourceV2["QUERY"] = "query";
17
+ })(ParameterSourceV2 = exports.ParameterSourceV2 || (exports.ParameterSourceV2 = {}));
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/schema/v2/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,iBAMX;AAND,WAAY,iBAAiB;IACzB,kCAAa,CAAA;IACb,2CAAsB,CAAA;IACtB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,oCAAe,CAAA;AACnB,CAAC,EANW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAM5B"}
@@ -0,0 +1,3 @@
1
+ export * from './type';
2
+ export * from './constants';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/v2/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -20,6 +20,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
20
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- __exportStar(require("./module"), exports);
24
23
  __exportStar(require("./type"), exports);
24
+ __exportStar(require("./constants"), exports);
25
25
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema/v2/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,yCAAuB;AACvB,8CAA4B"}
@@ -0,0 +1,116 @@
1
+ import type { CollectionFormat } from '@trapi/metadata';
2
+ import type { SecurityType } from '../../constants';
3
+ import type { ApiKeySecurity, BaseSecurity } from '../../type';
4
+ import type { TransferProtocol } from '../constants';
5
+ import type { BaseOperation, BaseResponse, BaseSchema, BaseSpec, BodyParameter, DataFormat, DataType, FormDataParameter, HeaderParameter, Path, PathParameter, QueryParameter } from '../type';
6
+ export interface SpecV2 extends BaseSpec {
7
+ swagger: '2.0';
8
+ host?: string;
9
+ basePath?: string;
10
+ schemes?: string[];
11
+ consumes?: string[];
12
+ produces?: string[];
13
+ paths: {
14
+ [pathName: string]: Path<OperationV2, ResponseV2>;
15
+ };
16
+ definitions?: {
17
+ [definitionsName: string]: SchemaV2;
18
+ };
19
+ parameters?: {
20
+ [parameterName: string]: ParameterV2;
21
+ };
22
+ responses?: {
23
+ [responseName: string]: ResponseV2;
24
+ };
25
+ security?: SecurityV2[];
26
+ securityDefinitions?: {
27
+ [name: string]: SecurityV2;
28
+ };
29
+ }
30
+ type PatternField = `x-${string}`;
31
+ export interface BaseParameterV2 {
32
+ type?: DataType;
33
+ format?: DataFormat;
34
+ allowEmptyValue?: boolean;
35
+ items?: Record<string, any>;
36
+ collectionFormat?: `${CollectionFormat}`;
37
+ default?: any;
38
+ maximum?: number;
39
+ exclusiveMaximum?: number;
40
+ minimum?: number;
41
+ exclusiveMinimum?: number;
42
+ maxLength?: number;
43
+ minLength?: number;
44
+ pattern?: string;
45
+ maxItems?: number;
46
+ minItems?: number;
47
+ uniqueItems?: number;
48
+ enum?: unknown[];
49
+ multipleOf?: number;
50
+ }
51
+ export interface BodyParameterV2 extends BodyParameter {
52
+ schema: BaseSchema<SchemaV2>;
53
+ }
54
+ export interface QueryParameterV2 extends QueryParameter, BaseParameterV2 {
55
+ }
56
+ export interface PathParameterV2 extends PathParameter, BaseParameterV2 {
57
+ }
58
+ export interface HeaderParameterV2 extends HeaderParameter, BaseParameterV2 {
59
+ }
60
+ export interface FormDataParameterV2 extends FormDataParameter, BaseParameterV2 {
61
+ }
62
+ export type ParameterV2 = (BodyParameterV2 | QueryParameterV2 | PathParameterV2 | HeaderParameterV2 | FormDataParameterV2) & {
63
+ [key: PatternField]: any | undefined;
64
+ };
65
+ export interface OperationV2 extends BaseOperation<ParameterV2, ResponseV2> {
66
+ consumes?: string[];
67
+ produces?: string[];
68
+ schemes?: `${TransferProtocol}`[];
69
+ }
70
+ export interface ResponseV2 extends BaseResponse {
71
+ schema?: SchemaV2;
72
+ headers?: {
73
+ [headerName: string]: HeaderV2;
74
+ };
75
+ examples?: {
76
+ [exampleName: string]: unknown;
77
+ };
78
+ }
79
+ export interface HeaderV2 {
80
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
81
+ }
82
+ export interface SchemaV2 extends BaseSchema<SchemaV2> {
83
+ ['x-nullable']?: boolean;
84
+ ['x-deprecated']?: boolean;
85
+ }
86
+ export interface BasicSecurityV2 extends BaseSecurity {
87
+ type: `${SecurityType.BASIC}`;
88
+ }
89
+ export interface BaseOAuthSecurityV2 extends BaseSecurity {
90
+ type: `${SecurityType.OAUTH2}`;
91
+ }
92
+ export interface OAuth2ImplicitSecurityV2 extends BaseOAuthSecurityV2 {
93
+ flow: 'implicit';
94
+ authorizationUrl: string;
95
+ scopes?: Record<string, string>;
96
+ }
97
+ export interface OAuth2PasswordSecurityV2 extends BaseOAuthSecurityV2 {
98
+ flow: 'password';
99
+ tokenUrl: string;
100
+ scopes?: Record<string, string>;
101
+ }
102
+ export interface OAuth2ApplicationSecurityV2 extends BaseOAuthSecurityV2 {
103
+ flow: 'application';
104
+ tokenUrl: string;
105
+ scopes?: Record<string, string>;
106
+ }
107
+ export interface OAuth2AccessCodeSecurityV2 extends BaseOAuthSecurityV2 {
108
+ flow: 'accessCode';
109
+ tokenUrl: string;
110
+ authorizationUrl: string;
111
+ scopes?: Record<string, string>;
112
+ }
113
+ export type OAuth2SecurityV2 = OAuth2AccessCodeSecurityV2 | OAuth2ApplicationSecurityV2 | OAuth2ImplicitSecurityV2 | OAuth2PasswordSecurityV2;
114
+ export type SecurityV2 = BasicSecurityV2 | OAuth2SecurityV2 | ApiKeySecurity;
115
+ export {};
116
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/schema/v2/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EACR,aAAa,EACb,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EACb,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,IAAI,EACJ,aAAa,EACb,cAAc,EACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,MAAO,SAAQ,QAAQ;IACpC,OAAO,EAAE,KAAK,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;KAAE,CAAC;IAC7D,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D,IAAI,EAAE,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACrD,IAAI,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACjE,IAAI,EAAE,UAAU,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACjE,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACpE,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACnE,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,gBAAgB,GAAG,0BAA0B,GACzD,2BAA2B,GAC3B,wBAAwB,GACxB,wBAAwB,CAAC;AAEzB,MAAM,MAAM,UAAU,GACd,eAAe,GACf,gBAAgB,GAChB,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/schema/v2/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,7 @@
1
+ export declare enum ParameterSourceV3 {
2
+ COOKIE = "cookie",
3
+ HEADER = "header",
4
+ PATH = "path",
5
+ QUERY = "query"
6
+ }
7
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/schema/v3/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,iBAAiB;IACzB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAClB"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2023.
4
+ * Author Peter Placzek (tada5hi)
5
+ * For the full copyright and license information,
6
+ * view the LICENSE file that was distributed with this source code.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ParameterSourceV3 = void 0;
10
+ var ParameterSourceV3;
11
+ (function (ParameterSourceV3) {
12
+ ParameterSourceV3["COOKIE"] = "cookie";
13
+ ParameterSourceV3["HEADER"] = "header";
14
+ ParameterSourceV3["PATH"] = "path";
15
+ ParameterSourceV3["QUERY"] = "query";
16
+ })(ParameterSourceV3 = exports.ParameterSourceV3 || (exports.ParameterSourceV3 = {}));
17
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/schema/v3/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,iBAKX;AALD,WAAY,iBAAiB;IACzB,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,oCAAe,CAAA;AACnB,CAAC,EALW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAK5B"}
@@ -0,0 +1,3 @@
1
+ export * from './constants';
2
+ export * from './type';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/v3/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
@@ -20,6 +20,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
20
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- __exportStar(require("./module"), exports);
23
+ __exportStar(require("./constants"), exports);
24
24
  __exportStar(require("./type"), exports);
25
25
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema/v3/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,yCAAuB"}
@@ -0,0 +1,158 @@
1
+ import type { SecurityType } from '../../constants';
2
+ import type { ApiKeySecurity, BaseSecurity } from '../../type';
3
+ import type { BaseOperation, BaseResponse, BaseSchema, BaseSpec, BodyParameter, DataFormat, DataType, Example, FormDataParameter, HeaderParameter, Path, PathParameter, QueryParameter } from '../type';
4
+ import type { ParameterSourceV3 } from './constants';
5
+ export interface SpecV3 extends BaseSpec {
6
+ openapi: '3.0.0';
7
+ servers: ServerV3[];
8
+ components: ComponentsV3;
9
+ paths: PathsV3;
10
+ }
11
+ export interface ServerV3 {
12
+ url: string;
13
+ description?: string;
14
+ variables?: Record<string, VariableV3>;
15
+ }
16
+ export interface VariableV3 {
17
+ enum?: string[];
18
+ description?: string;
19
+ default: string;
20
+ }
21
+ export interface ComponentsV3 {
22
+ callbacks?: {
23
+ [name: string]: any;
24
+ };
25
+ examples?: {
26
+ [name: string]: Example | string;
27
+ };
28
+ headers?: {
29
+ [name: string]: any;
30
+ };
31
+ links?: {
32
+ [name: string]: any;
33
+ };
34
+ parameters?: {
35
+ [name: string]: ParameterV3;
36
+ };
37
+ requestBodies?: {
38
+ [name: string]: any;
39
+ };
40
+ responses?: {
41
+ [name: string]: ResponseV3;
42
+ };
43
+ schemas?: {
44
+ [name: string]: SchemaV3;
45
+ };
46
+ securitySchemes?: {
47
+ [name: string]: SecurityV3;
48
+ };
49
+ }
50
+ export interface PathsV3 {
51
+ [key: string]: Path<OperationV3, ParameterV3>;
52
+ }
53
+ export interface BaseParameterV3 {
54
+ /**
55
+ * Default: false
56
+ */
57
+ deprecated?: boolean;
58
+ /**
59
+ * Default: false
60
+ */
61
+ allowEmptyValue?: boolean;
62
+ style?: string;
63
+ explode?: boolean;
64
+ allowReserved?: boolean;
65
+ schema?: BaseSchema<SchemaV3>;
66
+ example?: unknown;
67
+ examples?: Record<string, Example | string>;
68
+ content?: Record<string, any>;
69
+ }
70
+ export interface BodyParameterV3 extends BodyParameter, BaseParameterV3 {
71
+ }
72
+ export interface CookieParameterV3 extends BaseParameterV3 {
73
+ in: `${ParameterSourceV3.COOKIE}`;
74
+ }
75
+ export interface QueryParameterV3 extends QueryParameter, BaseParameterV3 {
76
+ }
77
+ export interface PathParameterV3 extends PathParameter, BaseParameterV3 {
78
+ }
79
+ export interface HeaderParameterV3 extends HeaderParameter, BaseParameterV3 {
80
+ }
81
+ export interface FormDataParameterV3 extends FormDataParameter, BaseParameterV3 {
82
+ }
83
+ export type ParameterV3 = BodyParameterV3 | CookieParameterV3 | QueryParameterV3 | PathParameterV3 | HeaderParameterV3 | FormDataParameterV3;
84
+ export interface OperationV3 extends BaseOperation<ParameterV3, ResponseV3> {
85
+ requestBody?: RequestBodyV3;
86
+ [key: string]: unknown;
87
+ }
88
+ export interface ResponseV3 extends BaseResponse {
89
+ content?: Record<string, {
90
+ schema: SchemaV3;
91
+ examples?: Record<string, Example>;
92
+ }>;
93
+ headers?: {
94
+ [name: string]: HeaderV3;
95
+ };
96
+ }
97
+ export interface HeaderV3 extends Omit<BaseSchema<SchemaV3>, 'required'> {
98
+ required?: boolean;
99
+ description?: string;
100
+ example?: unknown;
101
+ examples?: Record<string, Example | string>;
102
+ schema: BaseSchema<SchemaV3>;
103
+ type?: DataType;
104
+ format?: DataFormat;
105
+ }
106
+ export interface RequestBodyV3 {
107
+ content: {
108
+ [name: string]: MediaTypeV3;
109
+ };
110
+ description?: string;
111
+ required?: boolean;
112
+ }
113
+ export interface MediaTypeV3 {
114
+ schema?: SchemaV3;
115
+ example?: Example;
116
+ examples?: Record<string, Example | string>;
117
+ encoding?: {
118
+ [name: string]: any;
119
+ };
120
+ }
121
+ export interface SchemaV3 extends BaseSchema<SchemaV3> {
122
+ nullable?: boolean;
123
+ anyOf?: SchemaV3[];
124
+ allOf?: SchemaV3[];
125
+ deprecated?: boolean;
126
+ }
127
+ export interface BasicSecurityV3 extends BaseSecurity {
128
+ type: `${SecurityType.HTTP}`;
129
+ schema: 'basic';
130
+ }
131
+ export interface OAuth2SecurityV3 extends BaseSecurity {
132
+ type: `${SecurityType.OAUTH2}`;
133
+ flows: {
134
+ implicit?: OAuth2ImplicitFlowV3;
135
+ password?: OAuth2PasswordFlowV3;
136
+ authorizationCode?: OAuth2AuthorizationCodeFlowV3;
137
+ clientCredentials?: OAuth2ClientCredentialsFlowV3;
138
+ };
139
+ }
140
+ export interface Oauth2BaseFlowV3 {
141
+ scopes?: Record<string, string>;
142
+ refreshUrl?: string;
143
+ }
144
+ export interface OAuth2ImplicitFlowV3 extends Oauth2BaseFlowV3 {
145
+ authorizationUrl: string;
146
+ }
147
+ export interface OAuth2PasswordFlowV3 extends Oauth2BaseFlowV3 {
148
+ tokenUrl: string;
149
+ }
150
+ export interface OAuth2AuthorizationCodeFlowV3 extends Oauth2BaseFlowV3 {
151
+ authorizationUrl: string;
152
+ tokenUrl: string;
153
+ }
154
+ export interface OAuth2ClientCredentialsFlowV3 extends Oauth2BaseFlowV3 {
155
+ tokenUrl: string;
156
+ }
157
+ export type SecurityV3 = BasicSecurityV3 | OAuth2SecurityV3 | ApiKeySecurity;
158
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/schema/v3/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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AAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,6BAA8B,SAAQ,gBAAgB;IACnE,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,6BAA8B,SAAQ,gBAAgB;IACnE,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,UAAU,GACd,eAAe,GACf,gBAAgB,GAChB,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021.
4
+ * Author Peter Placzek (tada5hi)
5
+ * For the full copyright and license information,
6
+ * view the LICENSE file that was distributed with this source code.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/schema/v3/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
package/dist/type.d.ts CHANGED
@@ -1,7 +1,49 @@
1
- export type SwaggerDocFormatType = 'yaml' | 'json';
2
- export interface SwaggerDocFormatData {
1
+ import type { SecurityType } from './constants';
2
+ export interface DocumentFormatData {
3
3
  path: string;
4
4
  name: string;
5
5
  content?: string;
6
6
  }
7
+ export interface BaseSecurity {
8
+ description?: string;
9
+ }
10
+ export interface ApiKeySecurity extends BaseSecurity {
11
+ type: `${SecurityType.API_KEY}`;
12
+ name: string;
13
+ in: 'query' | 'header';
14
+ }
15
+ export interface BasicSecurity extends BaseSecurity {
16
+ type: `${SecurityType.HTTP}`;
17
+ schema: 'basic';
18
+ }
19
+ export interface OAuth2Security extends BaseSecurity {
20
+ type: `${SecurityType.OAUTH2}`;
21
+ flows: {
22
+ implicit?: OAuth2ImplicitFlow;
23
+ password?: OAuth2PasswordFlow;
24
+ authorizationCode?: OAuth2AuthorizationCodeFlow;
25
+ clientCredentials?: OAuth2ClientCredentialsFlow;
26
+ };
27
+ }
28
+ export interface Oauth2BaseFlow {
29
+ scopes?: Record<string, string>;
30
+ refreshUrl?: string;
31
+ }
32
+ export interface OAuth2ImplicitFlow extends Oauth2BaseFlow {
33
+ authorizationUrl: string;
34
+ }
35
+ export interface OAuth2PasswordFlow extends Oauth2BaseFlow {
36
+ tokenUrl: string;
37
+ }
38
+ export interface OAuth2AuthorizationCodeFlow extends Oauth2BaseFlow {
39
+ authorizationUrl: string;
40
+ tokenUrl: string;
41
+ }
42
+ export interface OAuth2ClientCredentialsFlow extends Oauth2BaseFlow {
43
+ tokenUrl: string;
44
+ }
45
+ export type SecurityDefinition = ApiKeySecurity | BasicSecurity | OAuth2Security;
46
+ export interface SecurityDefinitions {
47
+ [key: string]: SecurityDefinition;
48
+ }
7
49
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IAChD,IAAI,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IAC/C,IAAI,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7B,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IAChD,IAAI,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAC/B,KAAK,EAAE;QACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;QAC9B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;QAC9B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;QAChD,iBAAiB,CAAC,EAAE,2BAA2B,CAAA;KAClD,CAAC;CACL;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACtD,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACtD,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAC/D,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAC/D,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,aAAa,GAAG,cAAc,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACrC"}
@@ -0,0 +1,3 @@
1
+ export declare function removeDuplicateSlashes(str: string): string;
2
+ export declare function removeFinalCharacter(str: string, character: string): string;
3
+ //# sourceMappingURL=character.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character.d.ts","sourceRoot":"","sources":["../../src/utils/character.ts"],"names":[],"mappings":"AAOA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAI,MAAM,CAE3D;AAED,wBAAgB,oBAAoB,CAChC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,UAOpB"}