@skmtc/core 0.0.809 → 0.0.810
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/esm/context/types.d.ts +0 -8
- package/esm/context/types.d.ts.map +1 -1
- package/esm/dsl/model/toModelBase.d.ts +24 -2
- package/esm/dsl/model/toModelBase.d.ts.map +1 -1
- package/esm/dsl/model/types.d.ts +2 -2
- package/esm/dsl/operation/toOperationBase.d.ts +26 -3
- package/esm/dsl/operation/toOperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/types.d.ts +2 -2
- package/esm/oas/header/Header.d.ts +8 -185
- package/esm/oas/header/Header.d.ts.map +1 -1
- package/esm/oas/header/Header.js +57 -220
- package/esm/typescript/List.d.ts +2 -2
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +4 -4
- package/esm/typescript/toPathTemplate.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/context/types.d.ts +0 -8
- package/script/context/types.d.ts.map +1 -1
- package/script/dsl/model/toModelBase.d.ts +24 -2
- package/script/dsl/model/toModelBase.d.ts.map +1 -1
- package/script/dsl/model/types.d.ts +2 -2
- package/script/dsl/operation/toOperationBase.d.ts +26 -3
- package/script/dsl/operation/toOperationBase.d.ts.map +1 -1
- package/script/dsl/operation/types.d.ts +2 -2
- package/script/oas/header/Header.d.ts +8 -185
- package/script/oas/header/Header.d.ts.map +1 -1
- package/script/oas/header/Header.js +57 -220
- package/script/typescript/List.d.ts +2 -2
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +4 -4
- package/script/typescript/toPathTemplate.d.ts.map +1 -1
package/esm/oas/header/Header.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _OasHeader_fields;
|
|
13
1
|
/**
|
|
14
2
|
* Represents a Header Object in the OpenAPI Specification.
|
|
15
3
|
*
|
|
@@ -21,15 +9,6 @@ var _OasHeader_fields;
|
|
|
21
9
|
* This class provides comprehensive support for header definitions with typed
|
|
22
10
|
* values, validation schemas, examples, and documentation.
|
|
23
11
|
*
|
|
24
|
-
* ## Key Features
|
|
25
|
-
*
|
|
26
|
-
* - **Schema Validation**: Typed header values through schema definitions
|
|
27
|
-
* - **Examples**: Multiple example values for documentation and testing
|
|
28
|
-
* - **Content Types**: Support for complex header values with media types
|
|
29
|
-
* - **Deprecation Support**: Mark headers as deprecated with proper warnings
|
|
30
|
-
* - **Required/Optional**: Control whether headers are mandatory
|
|
31
|
-
* - **Documentation**: Rich description support for API documentation
|
|
32
|
-
*
|
|
33
12
|
* @example Basic authentication header
|
|
34
13
|
* ```typescript
|
|
35
14
|
* import { OasHeader, OasString } from '@skmtc/core';
|
|
@@ -49,173 +28,6 @@ var _OasHeader_fields;
|
|
|
49
28
|
* }
|
|
50
29
|
* });
|
|
51
30
|
* ```
|
|
52
|
-
*
|
|
53
|
-
* @example Pagination headers
|
|
54
|
-
* ```typescript
|
|
55
|
-
* const totalCountHeader = new OasHeader({
|
|
56
|
-
* description: 'Total number of items available',
|
|
57
|
-
* required: false,
|
|
58
|
-
* schema: new OasInteger({
|
|
59
|
-
* minimum: 0,
|
|
60
|
-
* description: 'Non-negative integer count'
|
|
61
|
-
* }),
|
|
62
|
-
* examples: {
|
|
63
|
-
* empty: new OasExample({ value: 0, description: 'No items' }),
|
|
64
|
-
* normal: new OasExample({ value: 150, description: 'Normal case' }),
|
|
65
|
-
* large: new OasExample({ value: 10000, description: 'Large dataset' })
|
|
66
|
-
* }
|
|
67
|
-
* });
|
|
68
|
-
*
|
|
69
|
-
* const linkHeader = new OasHeader({
|
|
70
|
-
* description: 'Pagination links (RFC 5988)',
|
|
71
|
-
* required: false,
|
|
72
|
-
* schema: new OasString({
|
|
73
|
-
* description: 'Comma-separated list of link relations'
|
|
74
|
-
* }),
|
|
75
|
-
* examples: {
|
|
76
|
-
* withNext: new OasExample({
|
|
77
|
-
* value: '</api/users?page=2>; rel="next", </api/users?page=10>; rel="last"'
|
|
78
|
-
* }),
|
|
79
|
-
* lastPage: new OasExample({
|
|
80
|
-
* value: '</api/users?page=9>; rel="prev", </api/users?page=1>; rel="first"'
|
|
81
|
-
* })
|
|
82
|
-
* }
|
|
83
|
-
* });
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @example Content type and encoding headers
|
|
87
|
-
* ```typescript
|
|
88
|
-
* const contentTypeHeader = new OasHeader({
|
|
89
|
-
* description: 'MIME type of the response content',
|
|
90
|
-
* required: true,
|
|
91
|
-
* schema: new OasString({
|
|
92
|
-
* enum: [
|
|
93
|
-
* 'application/json',
|
|
94
|
-
* 'application/xml',
|
|
95
|
-
* 'text/csv',
|
|
96
|
-
* 'application/pdf',
|
|
97
|
-
* 'application/octet-stream'
|
|
98
|
-
* ]
|
|
99
|
-
* }),
|
|
100
|
-
* examples: {
|
|
101
|
-
* json: new OasExample({ value: 'application/json' }),
|
|
102
|
-
* xml: new OasExample({ value: 'application/xml' }),
|
|
103
|
-
* csv: new OasExample({ value: 'text/csv' })
|
|
104
|
-
* }
|
|
105
|
-
* });
|
|
106
|
-
*
|
|
107
|
-
* const contentLengthHeader = new OasHeader({
|
|
108
|
-
* description: 'Size of the response body in bytes',
|
|
109
|
-
* required: false,
|
|
110
|
-
* schema: new OasInteger({
|
|
111
|
-
* minimum: 0,
|
|
112
|
-
* description: 'Content size in bytes'
|
|
113
|
-
* })
|
|
114
|
-
* });
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
|
-
* @example Rate limiting headers
|
|
118
|
-
* ```typescript
|
|
119
|
-
* const rateLimitHeader = new OasHeader({
|
|
120
|
-
* description: 'Number of requests remaining in the current window',
|
|
121
|
-
* required: false,
|
|
122
|
-
* schema: new OasInteger({
|
|
123
|
-
* minimum: 0,
|
|
124
|
-
* description: 'Remaining request count'
|
|
125
|
-
* }),
|
|
126
|
-
* examples: {
|
|
127
|
-
* available: new OasExample({ value: 95, description: '95 requests remaining' }),
|
|
128
|
-
* depleted: new OasExample({ value: 0, description: 'Rate limit reached' })
|
|
129
|
-
* }
|
|
130
|
-
* });
|
|
131
|
-
*
|
|
132
|
-
* const rateLimitResetHeader = new OasHeader({
|
|
133
|
-
* description: 'Unix timestamp when the rate limit window resets',
|
|
134
|
-
* required: false,
|
|
135
|
-
* schema: new OasInteger({
|
|
136
|
-
* minimum: 0,
|
|
137
|
-
* description: 'Unix timestamp in seconds'
|
|
138
|
-
* }),
|
|
139
|
-
* examples: {
|
|
140
|
-
* reset: new OasExample({
|
|
141
|
-
* value: 1634567890,
|
|
142
|
-
* description: 'Reset at 2021-10-18 12:31:30 UTC'
|
|
143
|
-
* })
|
|
144
|
-
* }
|
|
145
|
-
* });
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @example Custom application headers
|
|
149
|
-
* ```typescript
|
|
150
|
-
* const requestIdHeader = new OasHeader({
|
|
151
|
-
* description: 'Unique identifier for request tracing',
|
|
152
|
-
* required: false,
|
|
153
|
-
* schema: new OasString({
|
|
154
|
-
* format: 'uuid',
|
|
155
|
-
* description: 'UUID v4 request identifier'
|
|
156
|
-
* }),
|
|
157
|
-
* examples: {
|
|
158
|
-
* uuid: new OasExample({
|
|
159
|
-
* value: '123e4567-e89b-12d3-a456-426614174000',
|
|
160
|
-
* description: 'Request tracking ID'
|
|
161
|
-
* })
|
|
162
|
-
* }
|
|
163
|
-
* });
|
|
164
|
-
*
|
|
165
|
-
* const serverTimingHeader = new OasHeader({
|
|
166
|
-
* description: 'Server-side performance metrics',
|
|
167
|
-
* required: false,
|
|
168
|
-
* schema: new OasString({
|
|
169
|
-
* description: 'Server-Timing header format (RFC 8760)'
|
|
170
|
-
* }),
|
|
171
|
-
* examples: {
|
|
172
|
-
* timing: new OasExample({
|
|
173
|
-
* value: 'db;dur=53, app;dur=47.2',
|
|
174
|
-
* description: 'Database took 53ms, app logic 47.2ms'
|
|
175
|
-
* })
|
|
176
|
-
* }
|
|
177
|
-
* });
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
* @example Deprecated header
|
|
181
|
-
* ```typescript
|
|
182
|
-
* const deprecatedHeader = new OasHeader({
|
|
183
|
-
* description: 'Legacy API version header (deprecated)',
|
|
184
|
-
* required: false,
|
|
185
|
-
* deprecated: true,
|
|
186
|
-
* schema: new OasString({
|
|
187
|
-
* enum: ['v1', 'v2'],
|
|
188
|
-
* description: 'Use Accept or Content-Type header instead'
|
|
189
|
-
* }),
|
|
190
|
-
* examples: {
|
|
191
|
-
* legacy: new OasExample({
|
|
192
|
-
* value: 'v1',
|
|
193
|
-
* description: 'Legacy version (use Accept header instead)'
|
|
194
|
-
* })
|
|
195
|
-
* }
|
|
196
|
-
* });
|
|
197
|
-
* ```
|
|
198
|
-
*
|
|
199
|
-
* @example Using in response definitions
|
|
200
|
-
* ```typescript
|
|
201
|
-
* const successResponse = new OasResponse({
|
|
202
|
-
* description: 'Paginated user list',
|
|
203
|
-
* headers: {
|
|
204
|
-
* 'X-Total-Count': totalCountHeader,
|
|
205
|
-
* 'Link': linkHeader,
|
|
206
|
-
* 'X-Rate-Limit-Remaining': rateLimitHeader,
|
|
207
|
-
* 'X-Rate-Limit-Reset': rateLimitResetHeader,
|
|
208
|
-
* 'X-Request-ID': requestIdHeader
|
|
209
|
-
* },
|
|
210
|
-
* content: {
|
|
211
|
-
* 'application/json': new OasMediaType({
|
|
212
|
-
* schema: new OasArray({
|
|
213
|
-
* items: new OasRef({ $ref: '#/components/schemas/User' })
|
|
214
|
-
* })
|
|
215
|
-
* })
|
|
216
|
-
* }
|
|
217
|
-
* });
|
|
218
|
-
* ```
|
|
219
31
|
*/
|
|
220
32
|
export class OasHeader {
|
|
221
33
|
constructor(fields) {
|
|
@@ -225,36 +37,62 @@ export class OasHeader {
|
|
|
225
37
|
writable: true,
|
|
226
38
|
value: 'header'
|
|
227
39
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
40
|
+
/** Brief description of header */
|
|
41
|
+
Object.defineProperty(this, "description", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true,
|
|
45
|
+
value: void 0
|
|
46
|
+
});
|
|
47
|
+
/** Indicates if header is mandatory. Default value is `false` */
|
|
48
|
+
Object.defineProperty(this, "required", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: void 0
|
|
53
|
+
});
|
|
54
|
+
/** Indicates if header is deprecated and should no longer be used. Default value is false */
|
|
55
|
+
Object.defineProperty(this, "deprecated", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: void 0
|
|
60
|
+
});
|
|
61
|
+
/** Schema for the header */
|
|
62
|
+
Object.defineProperty(this, "schema", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true,
|
|
66
|
+
value: void 0
|
|
67
|
+
});
|
|
68
|
+
/** Examples of the header */
|
|
69
|
+
Object.defineProperty(this, "examples", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
configurable: true,
|
|
72
|
+
writable: true,
|
|
73
|
+
value: void 0
|
|
74
|
+
});
|
|
75
|
+
/** Content of the header */
|
|
76
|
+
Object.defineProperty(this, "content", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
configurable: true,
|
|
79
|
+
writable: true,
|
|
80
|
+
value: void 0
|
|
81
|
+
});
|
|
82
|
+
/** Specification Extension fields */
|
|
83
|
+
Object.defineProperty(this, "extensionFields", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
value: void 0
|
|
88
|
+
});
|
|
89
|
+
this.description = fields.description;
|
|
90
|
+
this.required = fields.required;
|
|
91
|
+
this.deprecated = fields.deprecated;
|
|
92
|
+
this.schema = fields.schema;
|
|
93
|
+
this.examples = fields.examples;
|
|
94
|
+
this.content = fields.content;
|
|
95
|
+
this.extensionFields = fields.extensionFields;
|
|
258
96
|
}
|
|
259
97
|
/** Returns true if object is a reference */
|
|
260
98
|
isRef() {
|
|
@@ -276,7 +114,7 @@ export class OasHeader {
|
|
|
276
114
|
if (this.schema) {
|
|
277
115
|
return this.schema;
|
|
278
116
|
}
|
|
279
|
-
const schema =
|
|
117
|
+
const schema = this.content?.[mediaType]?.schema;
|
|
280
118
|
if (!schema) {
|
|
281
119
|
throw new Error(`Schema not found for media type ${mediaType}`);
|
|
282
120
|
}
|
|
@@ -292,4 +130,3 @@ export class OasHeader {
|
|
|
292
130
|
};
|
|
293
131
|
}
|
|
294
132
|
}
|
|
295
|
-
_OasHeader_fields = new WeakMap();
|
package/esm/typescript/List.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type ListKeyValue<Key extends Stringable, Value extends Stringable> = Lis
|
|
|
27
27
|
/**
|
|
28
28
|
* Type representing the different bookend styles for lists.
|
|
29
29
|
*/
|
|
30
|
-
export type BookendsType = '[]' | '{}' | '()' | '
|
|
30
|
+
export type BookendsType = '[]' | '{}' | '()' | 'none';
|
|
31
31
|
type ConstructorOptions<Separator extends string = ', ', Bookends extends BookendsType = 'none'> = {
|
|
32
32
|
separator?: Separator;
|
|
33
33
|
bookends?: Bookends;
|
|
@@ -62,7 +62,7 @@ type ToConditionalReturn<Value extends Stringable, Condition extends boolean> =
|
|
|
62
62
|
*
|
|
63
63
|
* @template Values - Array of stringable values
|
|
64
64
|
* @template Separator - String used to separate items
|
|
65
|
-
* @template Bookends - Style of bookends ('[]', '{}', '()', '
|
|
65
|
+
* @template Bookends - Style of bookends ('[]', '{}', '()', 'none')
|
|
66
66
|
*
|
|
67
67
|
* @example Basic usage
|
|
68
68
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/typescript/List.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGtD,4EAA4E;AAC5E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEpE,2DAA2D;AAC3D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAErE,8EAA8E;AAC9E,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC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AC;IAI/D;;;;OAIG;IACH,YAAY,IAAI,SAAS,CAAC,MAAM,CAAC;CAGlC;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AAEjE;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,IAAI,CACnE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,KAAK,EAAE,MAAM,KACV,CAAC,GAAG,SAAS,CAAA;AAElB;;;;;;;GAOG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,UAAU;IACzC,sCAAsC;IACtC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAEnB;;;;OAIG;gBACS,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;IAI/B;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAItE;;;;;OAKG;IACH,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAIpE;;;;;OAKG;IACH,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;CAGrE"}
|
package/esm/typescript/List.js
CHANGED
|
@@ -22,7 +22,7 @@ import { match } from 'ts-pattern';
|
|
|
22
22
|
*
|
|
23
23
|
* @template Values - Array of stringable values
|
|
24
24
|
* @template Separator - String used to separate items
|
|
25
|
-
* @template Bookends - Style of bookends ('[]', '{}', '()', '
|
|
25
|
+
* @template Bookends - Style of bookends ('[]', '{}', '()', 'none')
|
|
26
26
|
*
|
|
27
27
|
* @example Basic usage
|
|
28
28
|
* ```typescript
|
|
@@ -149,13 +149,13 @@ export class List {
|
|
|
149
149
|
return '';
|
|
150
150
|
}
|
|
151
151
|
const joined = this.values.map(value => value.toString()).join(this.separator);
|
|
152
|
-
return match(this.bookends)
|
|
152
|
+
return (match(this.bookends)
|
|
153
153
|
.with('[]', () => `[${joined}]`)
|
|
154
154
|
.with('{}', () => `{${joined}}`)
|
|
155
155
|
.with('()', () => `(${joined})`)
|
|
156
|
-
.with('<>', () => `<${joined}>`)
|
|
156
|
+
// .with('<>', () => `<${joined}>`)
|
|
157
157
|
.with('none', () => joined)
|
|
158
|
-
.exhaustive();
|
|
158
|
+
.exhaustive());
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPathTemplate.d.ts","sourceRoot":"","sources":["../../src/typescript/toPathTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiHG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"toPathTemplate.d.ts","sourceRoot":"","sources":["../../src/typescript/toPathTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiHG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,MAEhE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
2
1
|
import type { ManifestEntry } from '../types/Manifest.js';
|
|
3
2
|
import type { Mapping, Preview } from '../types/Preview.js';
|
|
4
3
|
import type { ResultsItem } from '../types/Results.js';
|
|
@@ -14,13 +13,6 @@ export type GetFileOptions = {
|
|
|
14
13
|
/** Whether to throw an error if the file is not found */
|
|
15
14
|
throwIfNotFound?: boolean;
|
|
16
15
|
};
|
|
17
|
-
/**
|
|
18
|
-
* Arguments for adding a generator key to the context.
|
|
19
|
-
*/
|
|
20
|
-
export type AddGeneratorKeyArgs = {
|
|
21
|
-
/** The generator key to add */
|
|
22
|
-
generatorKey: GeneratorKey;
|
|
23
|
-
};
|
|
24
16
|
/**
|
|
25
17
|
* Result of rendering files in the context.
|
|
26
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yDAAyD;IACzD,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACrC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,oCAAoC;IACpC,OAAO,EAAE,WAAW,CAAA;CACrB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;AAE3F;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,qBAAqB,GACrB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,wBAAwB,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
2
2
|
import type { RefName } from '../../types/RefName.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
-
import { ModelBase } from './ModelBase.js';
|
|
5
4
|
import type { Identifier } from '../Identifier.js';
|
|
6
5
|
import * as v from 'valibot';
|
|
6
|
+
import type { ModelInsertable } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Arguments for creating a model insertable instance.
|
|
9
9
|
*
|
|
@@ -17,6 +17,10 @@ export type ModelInsertableArgs<EnrichmentType = undefined> = {
|
|
|
17
17
|
/** Reference name identifying the model schema */
|
|
18
18
|
refName: RefName;
|
|
19
19
|
};
|
|
20
|
+
type ToEnrichmentsArgs = {
|
|
21
|
+
refName: RefName;
|
|
22
|
+
context: GenerateContext;
|
|
23
|
+
};
|
|
20
24
|
/**
|
|
21
25
|
* Configuration for creating a base model class.
|
|
22
26
|
*
|
|
@@ -81,5 +85,23 @@ export type BaseModelConfig<EnrichmentType = undefined> = {
|
|
|
81
85
|
* });
|
|
82
86
|
* ```
|
|
83
87
|
*/
|
|
84
|
-
export declare const toModelBase: <EnrichmentType = undefined>(config: BaseModelConfig<EnrichmentType>) =>
|
|
88
|
+
export declare const toModelBase: <EnrichmentType = undefined>(config: BaseModelConfig<EnrichmentType>) => {
|
|
89
|
+
new (args: ModelInsertableArgs<EnrichmentType>): {
|
|
90
|
+
settings: ContentSettings<EnrichmentType>;
|
|
91
|
+
refName: RefName;
|
|
92
|
+
generatorKey: import("../../types/GeneratorKeys.js").GeneratorKey;
|
|
93
|
+
insertModel<V extends import("../../mod.js").GeneratedValue, EnrichmentType_1 = undefined>(insertable: ModelInsertable<V, EnrichmentType_1>, refName: RefName, options?: Pick<import("../../context/GenerateContext.js").InsertModelOptions<"force">, "noExport">): import("../Inserted.js").Inserted<V, "force", EnrichmentType_1>;
|
|
94
|
+
insertNormalizedModel<V extends import("../../mod.js").GeneratedValue, Schema extends import("../../mod.js").OasSchema | import("../../mod.js").OasRef<"schema"> | import("../../mod.js").OasVoid, EnrichmentType_2 = undefined>(insertable: ModelInsertable<V, EnrichmentType_2>, { schema, fallbackName }: Omit<import("../../context/GenerateContext.js").InsertNormalisedModelArgs<Schema>, "destinationPath">, options?: Pick<import("../../context/GenerateContext.js").InsertModelOptions<"force">, "noExport">): import("../../context/GenerateContext.js").InsertNormalisedModelReturn<V, Schema>;
|
|
95
|
+
register(args: import("../../context/GenerateContext.js").BaseRegisterArgs): void;
|
|
96
|
+
context: GenerateContext;
|
|
97
|
+
skipped: boolean;
|
|
98
|
+
};
|
|
99
|
+
id: string;
|
|
100
|
+
type: "model";
|
|
101
|
+
toIdentifier: (refName: RefName) => Identifier;
|
|
102
|
+
toExportPath: (refName: RefName) => string;
|
|
103
|
+
toEnrichments: ({ refName, context }: ToEnrichmentsArgs) => EnrichmentType;
|
|
104
|
+
isSupported: () => boolean;
|
|
105
|
+
};
|
|
106
|
+
export {};
|
|
85
107
|
//# sourceMappingURL=toModelBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"toModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,cAAc,GAAG,SAAS,IAAI;IAC5D,2EAA2E;IAC3E,OAAO,EAAE,eAAe,CAAA;IACxB,iEAAiE;IACjE,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;IACzC,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,eAAe,CAAA;CACzB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,CAAC,cAAc,GAAG,SAAS,IAAI;IACxD,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,4DAA4D;IAC5D,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,UAAU,CAAA;IAC9C,6DAA6D;IAC7D,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;IAC1C,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC9F,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,GAAI,cAAc,GAAG,SAAS,EACpD,QAAQ,eAAe,CAAC,cAAc,CAAC;eAiBnB,mBAAmB,CAAC,cAAc,CAAC;;;;;;;;;;;UAbvC,OAAO;4BA1DC,OAAO,KAAK,UAAU;4BAEtB,OAAO,KAAK,MAAM;oBA4DhB,sBAAsB,iBAAiB,KAAG,cAAc;;CAmBnF,CAAA"}
|
|
@@ -30,7 +30,7 @@ export type WithTransformModel = {
|
|
|
30
30
|
/**
|
|
31
31
|
* Arguments for generating enrichment data for models.
|
|
32
32
|
*/
|
|
33
|
-
export type
|
|
33
|
+
export type ToModelEnrichmentsArgs = {
|
|
34
34
|
refName: RefName;
|
|
35
35
|
context: GenerateContext;
|
|
36
36
|
};
|
|
@@ -81,7 +81,7 @@ export type ModelInsertable<V, EnrichmentType = undefined> = {
|
|
|
81
81
|
type: 'model';
|
|
82
82
|
toIdentifier: (refName: RefName) => Identifier;
|
|
83
83
|
toExportPath: (refName: RefName) => string;
|
|
84
|
-
toEnrichments: ({ refName, context }:
|
|
84
|
+
toEnrichments: ({ refName, context }: ToModelEnrichmentsArgs) => EnrichmentType;
|
|
85
85
|
schemaToValueFn: SchemaToValueFn;
|
|
86
86
|
createIdentifier: (name: string) => Identifier;
|
|
87
87
|
} & Function;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
1
2
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
2
|
-
import { OperationBase } from './OperationBase.js';
|
|
3
3
|
import type { Identifier } from '../Identifier.js';
|
|
4
|
-
import type { OperationInsertableArgs } from './types.js';
|
|
4
|
+
import type { OperationInsertable, OperationInsertableArgs } from './types.js';
|
|
5
5
|
import * as v from 'valibot';
|
|
6
6
|
/**
|
|
7
7
|
* Configuration for creating a base operation class.
|
|
@@ -21,6 +21,10 @@ export type BaseOperationConfig<EnrichmentType = undefined> = {
|
|
|
21
21
|
/** Optional function to provide enrichment validation schema */
|
|
22
22
|
toEnrichmentSchema?: () => v.BaseSchema<EnrichmentType, EnrichmentType, v.BaseIssue<unknown>>;
|
|
23
23
|
};
|
|
24
|
+
type ToEnrichmentsArgs = {
|
|
25
|
+
operation: OasOperation;
|
|
26
|
+
context: GenerateContext;
|
|
27
|
+
};
|
|
24
28
|
/**
|
|
25
29
|
* Creates a base operation class constructor for generating type-safe operation artifacts.
|
|
26
30
|
*
|
|
@@ -67,5 +71,24 @@ export type BaseOperationConfig<EnrichmentType = undefined> = {
|
|
|
67
71
|
* });
|
|
68
72
|
* ```
|
|
69
73
|
*/
|
|
70
|
-
export declare const toOperationBase: <EnrichmentType = undefined>(config: BaseOperationConfig<EnrichmentType>) =>
|
|
74
|
+
export declare const toOperationBase: <EnrichmentType = undefined>(config: BaseOperationConfig<EnrichmentType>) => {
|
|
75
|
+
new (args: OperationInsertableArgs<EnrichmentType>): {
|
|
76
|
+
settings: import("../ContentSettings.js").ContentSettings<EnrichmentType>;
|
|
77
|
+
operation: OasOperation;
|
|
78
|
+
generatorKey: import("../../types/GeneratorKeys.js").GeneratorKey;
|
|
79
|
+
insertOperation<V extends import("../../mod.js").GeneratedValue, EnrichmentType_1 = undefined>(insertable: OperationInsertable<V, EnrichmentType_1>, operation: OasOperation, options?: Pick<import("../../context/GenerateContext.js").InsertOperationOptions<"force">, "noExport">): import("../Inserted.js").Inserted<V, "force", EnrichmentType_1>;
|
|
80
|
+
insertModel<V extends import("../../mod.js").GeneratedValue, EnrichmentType_2 = undefined>(insertable: import("../model/types.js").ModelInsertable<V, EnrichmentType_2>, refName: import("../../mod.js").RefName, options?: Pick<import("../../context/GenerateContext.js").InsertModelOptions<"force">, "noExport">): import("../Inserted.js").Inserted<V, "force", EnrichmentType_2>;
|
|
81
|
+
insertNormalizedModel<V extends import("../../mod.js").GeneratedValue, Schema extends import("../../mod.js").OasSchema | import("../../mod.js").OasRef<"schema"> | import("../../mod.js").OasVoid, EnrichmentType_3 = undefined>(insertable: import("../model/types.js").ModelInsertable<V, EnrichmentType_3>, { schema, fallbackName }: Omit<import("../../context/GenerateContext.js").InsertNormalisedModelArgs<Schema>, "destinationPath">, options?: Pick<import("../../context/GenerateContext.js").InsertModelOptions<"force">, "noExport">): import("../../context/GenerateContext.js").InsertNormalisedModelReturn<V, Schema>;
|
|
82
|
+
defineAndRegister<V extends import("../../mod.js").GeneratedValue>({ identifier, value, noExport }: Omit<import("../../context/GenerateContext.js").DefineAndRegisterArgs<V>, "destinationPath">): import("../Definition.js").Definition<V>;
|
|
83
|
+
register(args: import("../../context/GenerateContext.js").BaseRegisterArgs): void;
|
|
84
|
+
context: GenerateContext;
|
|
85
|
+
skipped: boolean;
|
|
86
|
+
};
|
|
87
|
+
id: string;
|
|
88
|
+
type: "operation";
|
|
89
|
+
toIdentifier: (operation: OasOperation) => Identifier;
|
|
90
|
+
toExportPath: (operation: OasOperation) => string;
|
|
91
|
+
toEnrichments: ({ operation, context }: ToEnrichmentsArgs) => EnrichmentType;
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
71
94
|
//# sourceMappingURL=toOperationBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,CAAC,cAAc,GAAG,SAAS,IAAI;IAC5D,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,uDAAuD;IACvD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAA;IACrD,wDAAwD;IACxD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,MAAM,CAAA;IACjD,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC9F,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;CACzB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,GAAG,SAAS,EACxD,QAAQ,mBAAmB,CAAC,cAAc,CAAC;eAoBvB,uBAAuB,CAAC,cAAc,CAAC;;;;;;;;;;;;;UAhB3C,WAAW;8BA/DD,YAAY,KAAK,UAAU;8BAE3B,YAAY,KAAK,MAAM;oBAkEvB,wBAAwB,iBAAiB,KAAG,cAAc;CAqBrF,CAAA"}
|
|
@@ -54,7 +54,7 @@ export type IsSupportedOperationArgs = {
|
|
|
54
54
|
/**
|
|
55
55
|
* Arguments for generating enrichment data for operations.
|
|
56
56
|
*/
|
|
57
|
-
export type
|
|
57
|
+
export type ToOperationEnrichmentsArgs = {
|
|
58
58
|
operation: OasOperation;
|
|
59
59
|
context: GenerateContext;
|
|
60
60
|
};
|
|
@@ -95,7 +95,7 @@ export type OperationInsertable<V, EnrichmentType = undefined> = {
|
|
|
95
95
|
type: 'operation';
|
|
96
96
|
toIdentifier: (operation: OasOperation) => Identifier;
|
|
97
97
|
toExportPath: (operation: OasOperation) => string;
|
|
98
|
-
toEnrichments: ({ operation, context }:
|
|
98
|
+
toEnrichments: ({ operation, context }: ToOperationEnrichmentsArgs) => EnrichmentType;
|
|
99
99
|
} & Function;
|
|
100
100
|
/**
|
|
101
101
|
* Arguments for checking if an operation is supported for generation.
|