@skmtc/core 0.0.367 → 0.0.369
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/GenerateContext.d.ts +79 -4
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +113 -33
- package/esm/oas/array/Array.d.ts +32 -8
- package/esm/oas/array/Array.d.ts.map +1 -1
- package/esm/oas/array/Array.js +60 -30
- package/esm/oas/boolean/Boolean.d.ts +24 -6
- package/esm/oas/boolean/Boolean.d.ts.map +1 -1
- package/esm/oas/boolean/Boolean.js +40 -24
- package/esm/oas/integer/Integer.d.ts +29 -8
- package/esm/oas/integer/Integer.d.ts.map +1 -1
- package/esm/oas/integer/Integer.js +57 -30
- package/esm/oas/number/Number.d.ts +24 -6
- package/esm/oas/number/Number.d.ts.map +1 -1
- package/esm/oas/number/Number.js +40 -24
- package/esm/oas/object/Object.d.ts +56 -12
- package/esm/oas/object/Object.d.ts.map +1 -1
- package/esm/oas/object/Object.js +52 -5
- package/esm/oas/string/String.d.ts +32 -8
- package/esm/oas/string/String.d.ts.map +1 -1
- package/esm/oas/string/String.js +63 -33
- package/esm/oas/union/Union.d.ts +38 -8
- package/esm/oas/union/Union.d.ts.map +1 -1
- package/esm/oas/union/Union.js +66 -30
- package/esm/oas/unknown/Unknown.d.ts +24 -5
- package/esm/oas/unknown/Unknown.d.ts.map +1 -1
- package/esm/oas/unknown/Unknown.js +34 -21
- package/esm/oas/void/Void.d.ts +22 -5
- package/esm/oas/void/Void.d.ts.map +1 -1
- package/esm/oas/void/Void.js +32 -21
- package/esm/server/createServer.d.ts.map +1 -1
- package/esm/server/createServer.js +2 -1
- package/esm/typescript/List.d.ts +19 -3
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +31 -0
- package/package.json +1 -1
- package/script/context/GenerateContext.d.ts +79 -4
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +113 -33
- package/script/oas/array/Array.d.ts +32 -8
- package/script/oas/array/Array.d.ts.map +1 -1
- package/script/oas/array/Array.js +60 -30
- package/script/oas/boolean/Boolean.d.ts +24 -6
- package/script/oas/boolean/Boolean.d.ts.map +1 -1
- package/script/oas/boolean/Boolean.js +40 -24
- package/script/oas/integer/Integer.d.ts +29 -8
- package/script/oas/integer/Integer.d.ts.map +1 -1
- package/script/oas/integer/Integer.js +57 -30
- package/script/oas/number/Number.d.ts +24 -6
- package/script/oas/number/Number.d.ts.map +1 -1
- package/script/oas/number/Number.js +40 -24
- package/script/oas/object/Object.d.ts +56 -12
- package/script/oas/object/Object.d.ts.map +1 -1
- package/script/oas/object/Object.js +52 -5
- package/script/oas/string/String.d.ts +32 -8
- package/script/oas/string/String.d.ts.map +1 -1
- package/script/oas/string/String.js +63 -33
- package/script/oas/union/Union.d.ts +38 -8
- package/script/oas/union/Union.d.ts.map +1 -1
- package/script/oas/union/Union.js +66 -30
- package/script/oas/unknown/Unknown.d.ts +24 -5
- package/script/oas/unknown/Unknown.d.ts.map +1 -1
- package/script/oas/unknown/Unknown.js +34 -21
- package/script/oas/void/Void.d.ts +22 -5
- package/script/oas/void/Void.d.ts.map +1 -1
- package/script/oas/void/Void.js +32 -21
- package/script/server/createServer.d.ts.map +1 -1
- package/script/server/createServer.js +2 -1
- package/script/typescript/List.d.ts +19 -3
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +33 -1
|
@@ -3,7 +3,7 @@ import { Definition } from '../dsl/Definition.js';
|
|
|
3
3
|
import type { OasDocument } from '../oas/document/Document.js';
|
|
4
4
|
import type { OasSchema } from '../oas/schema/Schema.js';
|
|
5
5
|
import type { OasRef } from '../oas/ref/Ref.js';
|
|
6
|
-
import type { FileContents
|
|
6
|
+
import type { FileContents } from './types.js';
|
|
7
7
|
import type { BaseSettings, ClientSettings } from '../types/Settings.js';
|
|
8
8
|
import type { Method } from '../types/Method.js';
|
|
9
9
|
import type { OperationInsertable, OperationGateway } from '../dsl/operation/OperationInsertable.js';
|
|
@@ -85,18 +85,93 @@ export declare class GenerateContext {
|
|
|
85
85
|
callback: (generatorKey: GeneratorKey) => void;
|
|
86
86
|
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
87
87
|
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail }: ConstructorArgs);
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
88
91
|
generate(generatorsMap: Record<string, OperationGateway | ModelGateway>): Map<string, FileContents>;
|
|
89
92
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
90
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Converts schema to value using `schemaToValueFn` and creates definition
|
|
95
|
+
* with the given `identifier` at `destinationPath`.
|
|
96
|
+
*
|
|
97
|
+
* If a definition with the same name already exists, it will be returned
|
|
98
|
+
* instead of creating a new one.
|
|
99
|
+
*
|
|
100
|
+
* @param schema - The schema to create the definition for.
|
|
101
|
+
* @param identifier - The identifier for the definition.
|
|
102
|
+
* @param destinationPath - The path to the file where the definition will be registered.
|
|
103
|
+
* @param schemaToValueFn - A function that converts the schema to a value.
|
|
104
|
+
* @returns The created definition or cached definition if it already exists.
|
|
105
|
+
*/
|
|
91
106
|
createAndRegisterDefinition<Schema extends SchemaType>({ schema, identifier, destinationPath, schemaToValueFn }: CreateAndRegisterDefinition<Schema>): Definition<TypeSystemOutput<Schema['type']>>;
|
|
107
|
+
/**
|
|
108
|
+
* Insert supplied `imports` and `definitions` into file at `destinationPath`.
|
|
109
|
+
*
|
|
110
|
+
* If an import from a specified module already exists in the file, the
|
|
111
|
+
* import names are appended to the existing import.
|
|
112
|
+
*
|
|
113
|
+
* Definitions will only be added if there is not already a definition with
|
|
114
|
+
* the same name in the file.
|
|
115
|
+
*
|
|
116
|
+
* @mutates this.files
|
|
117
|
+
*/
|
|
92
118
|
register({ imports, definitions, destinationPath }: RegisterArgs): void;
|
|
119
|
+
/**
|
|
120
|
+
* Insert operation or model into the output file with path `destinationPath`.
|
|
121
|
+
*
|
|
122
|
+
* Insert will perform the following steps:
|
|
123
|
+
* 1. Generate content settings for the supplied operation or model
|
|
124
|
+
* 2. Look up definition in file with path `destinationPath`
|
|
125
|
+
* 3. If definition is not found, it will create a new one and register it
|
|
126
|
+
* 4. If the definition is defined at a location that is different from
|
|
127
|
+
* the current file, it will add an import to the current file from
|
|
128
|
+
* that location
|
|
129
|
+
* 5. Use the content settings to generate the operation/model using the
|
|
130
|
+
* insertable's driver
|
|
131
|
+
* @mutates this.files
|
|
132
|
+
*/
|
|
93
133
|
insert<V extends GeneratedValue, T extends GenerationType>({ generation, destinationPath, ...rest }: InsertArgs<V, T>): Inserted<V, T>;
|
|
134
|
+
/**
|
|
135
|
+
* Generate and return content settings for operation insertable and
|
|
136
|
+
* operation.
|
|
137
|
+
*
|
|
138
|
+
* Content settings are produced by passing base settings and operation
|
|
139
|
+
* through toIdentifier, toExportPath and isSelected static methods on the
|
|
140
|
+
* insertable.
|
|
141
|
+
* @param { operation, insertable }
|
|
142
|
+
* @returns
|
|
143
|
+
*/
|
|
94
144
|
toOperationContentSettings<V>({ operation, insertable }: ToOperationSettingsArgs<V>): ContentSettings;
|
|
145
|
+
/**
|
|
146
|
+
* Generate and return content settings for model insertable and refName.
|
|
147
|
+
*
|
|
148
|
+
* Content settings are produced by passing base settings and refName
|
|
149
|
+
* through toIdentifier, toExportPath and isSelected static methods on the
|
|
150
|
+
* insertable.
|
|
151
|
+
* @param { refName, insertable }
|
|
152
|
+
* @returns Content settings for model
|
|
153
|
+
*/
|
|
95
154
|
toModelContentSettings<V>({ refName, insertable }: BuildModelSettingsArgs<V>): ContentSettings;
|
|
155
|
+
/**
|
|
156
|
+
* Look up operation settings for a given generatorId, path and method.
|
|
157
|
+
* @param { generatorId, path, method }
|
|
158
|
+
* @returns Base settings for operation
|
|
159
|
+
*/
|
|
96
160
|
toOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
|
|
97
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Perform one lookup of schema by `refName`.
|
|
163
|
+
* @param refName
|
|
164
|
+
* @returns Matching schema or ref
|
|
165
|
+
* @throws if schema is not found
|
|
166
|
+
*/
|
|
98
167
|
resolveSchemaRefOnce(refName: RefName): OasSchema | OasRef<'schema'>;
|
|
99
|
-
/**
|
|
168
|
+
/**
|
|
169
|
+
* Check if definition name `name` in file with path `exportPath`
|
|
170
|
+
* has already been created and registered.
|
|
171
|
+
*
|
|
172
|
+
* @param { name, exportPath }
|
|
173
|
+
* @returns Matching definition if found or `undefined` otherwise
|
|
174
|
+
*/
|
|
100
175
|
findDefinition({ name, exportPath }: PickArgs): Definition | undefined;
|
|
101
176
|
}
|
|
102
177
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,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E,EACrD,MAAM,EACN,UAAU,EACV,eAAe,EACf,eAAe,EAChB,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAAG,UAAU,CACjD,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CACjC;IAiCD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,OAAY,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,YAAY;IAgCrE;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,EAAE,EACzD,UAAU,EACV,eAAe,EACf,GAAG,IAAI,EACR,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAyBpC;;;;;;;;;OASG;IACH,0BAA0B,CAAC,CAAC,EAAE,EAC5B,SAAS,EACT,UAAU,EACX,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,eAAe;IAiB/C;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CAAC,EAAE,EACxB,OAAO,EACP,UAAU,EACX,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,eAAe;IAgB9C;;;;OAIG;IACH,uBAAuB,CAAC,EACtB,WAAW,EACX,IAAI,EACJ,MAAM,EACP,EAAE,wBAAwB;IA+D3B;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAWpE;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
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
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_toModelBaseSettings;
|
|
12
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_toModelBaseSettings, _GenerateContext_addFile;
|
|
13
13
|
import { join, normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
14
14
|
import { Import } from '../dsl/Import.js';
|
|
15
15
|
import { Definition } from '../dsl/Definition.js';
|
|
@@ -63,6 +63,9 @@ export class GenerateContext {
|
|
|
63
63
|
__classPrivateFieldSet(this, _GenerateContext_stackTrail, stackTrail, "f");
|
|
64
64
|
this.captureCurrentResult = captureCurrentResult;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
66
69
|
generate(generatorsMap) {
|
|
67
70
|
Sentry.startSpan({ name: 'Generate operations' }, () => Object.values(generatorsMap)
|
|
68
71
|
.filter(generator => generator.type === 'operation')
|
|
@@ -89,19 +92,19 @@ export class GenerateContext {
|
|
|
89
92
|
trace(token, fn) {
|
|
90
93
|
return tracer(__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f"), token, fn);
|
|
91
94
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Converts schema to value using `schemaToValueFn` and creates definition
|
|
97
|
+
* with the given `identifier` at `destinationPath`.
|
|
98
|
+
*
|
|
99
|
+
* If a definition with the same name already exists, it will be returned
|
|
100
|
+
* instead of creating a new one.
|
|
101
|
+
*
|
|
102
|
+
* @param schema - The schema to create the definition for.
|
|
103
|
+
* @param identifier - The identifier for the definition.
|
|
104
|
+
* @param destinationPath - The path to the file where the definition will be registered.
|
|
105
|
+
* @param schemaToValueFn - A function that converts the schema to a value.
|
|
106
|
+
* @returns The created definition or cached definition if it already exists.
|
|
107
|
+
*/
|
|
105
108
|
createAndRegisterDefinition({ schema, identifier, destinationPath, schemaToValueFn }) {
|
|
106
109
|
const cachedDefinition = this.findDefinition({
|
|
107
110
|
name: identifier.name,
|
|
@@ -129,8 +132,20 @@ export class GenerateContext {
|
|
|
129
132
|
});
|
|
130
133
|
return responseDefinition;
|
|
131
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Insert supplied `imports` and `definitions` into file at `destinationPath`.
|
|
137
|
+
*
|
|
138
|
+
* If an import from a specified module already exists in the file, the
|
|
139
|
+
* import names are appended to the existing import.
|
|
140
|
+
*
|
|
141
|
+
* Definitions will only be added if there is not already a definition with
|
|
142
|
+
* the same name in the file.
|
|
143
|
+
*
|
|
144
|
+
* @mutates this.files
|
|
145
|
+
*/
|
|
132
146
|
register({ imports = {}, definitions, destinationPath }) {
|
|
133
|
-
|
|
147
|
+
// TODO deduplicate import names and definition names against each other
|
|
148
|
+
const currentFile = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_getFile).call(this, destinationPath);
|
|
134
149
|
Object.entries(imports).forEach(([importModule, importNames]) => {
|
|
135
150
|
const module = currentFile.imports.get(importModule);
|
|
136
151
|
const importItem = new Import({ module: importModule, importNames });
|
|
@@ -141,12 +156,30 @@ export class GenerateContext {
|
|
|
141
156
|
currentFile.imports.set(importModule, new Set(importItem.importNames.map(n => `${n}`)));
|
|
142
157
|
}
|
|
143
158
|
});
|
|
144
|
-
definitions
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
definitions?.forEach(definition => {
|
|
160
|
+
if (!definition) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const { name } = definition.identifier;
|
|
164
|
+
if (!currentFile.definitions.has(name)) {
|
|
165
|
+
currentFile.definitions.set(name, definition);
|
|
166
|
+
}
|
|
148
167
|
});
|
|
149
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Insert operation or model into the output file with path `destinationPath`.
|
|
171
|
+
*
|
|
172
|
+
* Insert will perform the following steps:
|
|
173
|
+
* 1. Generate content settings for the supplied operation or model
|
|
174
|
+
* 2. Look up definition in file with path `destinationPath`
|
|
175
|
+
* 3. If definition is not found, it will create a new one and register it
|
|
176
|
+
* 4. If the definition is defined at a location that is different from
|
|
177
|
+
* the current file, it will add an import to the current file from
|
|
178
|
+
* that location
|
|
179
|
+
* 5. Use the content settings to generate the operation/model using the
|
|
180
|
+
* insertable's driver
|
|
181
|
+
* @mutates this.files
|
|
182
|
+
*/
|
|
150
183
|
insert({ generation, destinationPath, ...rest }) {
|
|
151
184
|
const { settings, definition } = match(rest)
|
|
152
185
|
.with({ operation: P.nonNullable }, ({ insertable, operation }) => {
|
|
@@ -170,6 +203,16 @@ export class GenerateContext {
|
|
|
170
203
|
.exhaustive();
|
|
171
204
|
return new Inserted({ settings, definition });
|
|
172
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Generate and return content settings for operation insertable and
|
|
208
|
+
* operation.
|
|
209
|
+
*
|
|
210
|
+
* Content settings are produced by passing base settings and operation
|
|
211
|
+
* through toIdentifier, toExportPath and isSelected static methods on the
|
|
212
|
+
* insertable.
|
|
213
|
+
* @param { operation, insertable }
|
|
214
|
+
* @returns
|
|
215
|
+
*/
|
|
173
216
|
toOperationContentSettings({ operation, insertable }) {
|
|
174
217
|
const baseSettings = this.toOperationBaseSettings({
|
|
175
218
|
generatorId: insertable.id,
|
|
@@ -184,6 +227,15 @@ export class GenerateContext {
|
|
|
184
227
|
importFrom: baseSettings.importFrom ?? e
|
|
185
228
|
});
|
|
186
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Generate and return content settings for model insertable and refName.
|
|
232
|
+
*
|
|
233
|
+
* Content settings are produced by passing base settings and refName
|
|
234
|
+
* through toIdentifier, toExportPath and isSelected static methods on the
|
|
235
|
+
* insertable.
|
|
236
|
+
* @param { refName, insertable }
|
|
237
|
+
* @returns Content settings for model
|
|
238
|
+
*/
|
|
187
239
|
toModelContentSettings({ refName, insertable }) {
|
|
188
240
|
const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toModelBaseSettings).call(this, {
|
|
189
241
|
generatorId: insertable.id,
|
|
@@ -197,6 +249,11 @@ export class GenerateContext {
|
|
|
197
249
|
importFrom: baseSettings.importFrom ?? e
|
|
198
250
|
});
|
|
199
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Look up operation settings for a given generatorId, path and method.
|
|
254
|
+
* @param { generatorId, path, method }
|
|
255
|
+
* @returns Base settings for operation
|
|
256
|
+
*/
|
|
200
257
|
toOperationBaseSettings({ generatorId, path, method }) {
|
|
201
258
|
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
202
259
|
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
@@ -213,18 +270,12 @@ export class GenerateContext {
|
|
|
213
270
|
};
|
|
214
271
|
return baseSettings;
|
|
215
272
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
definitions: new Map(),
|
|
223
|
-
generatorKeys: new Set()
|
|
224
|
-
};
|
|
225
|
-
__classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
|
|
226
|
-
return newFile;
|
|
227
|
-
}
|
|
273
|
+
/**
|
|
274
|
+
* Perform one lookup of schema by `refName`.
|
|
275
|
+
* @param refName
|
|
276
|
+
* @returns Matching schema or ref
|
|
277
|
+
* @throws if schema is not found
|
|
278
|
+
*/
|
|
228
279
|
resolveSchemaRefOnce(refName) {
|
|
229
280
|
const schema = this.oasDocument.components?.schemas?.[refName]?.resolveOnce();
|
|
230
281
|
if (!schema) {
|
|
@@ -232,9 +283,15 @@ export class GenerateContext {
|
|
|
232
283
|
}
|
|
233
284
|
return schema;
|
|
234
285
|
}
|
|
235
|
-
/**
|
|
286
|
+
/**
|
|
287
|
+
* Check if definition name `name` in file with path `exportPath`
|
|
288
|
+
* has already been created and registered.
|
|
289
|
+
*
|
|
290
|
+
* @param { name, exportPath }
|
|
291
|
+
* @returns Matching definition if found or `undefined` otherwise
|
|
292
|
+
*/
|
|
236
293
|
findDefinition({ name, exportPath }) {
|
|
237
|
-
return this.
|
|
294
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_getFile).call(this, exportPath).definitions.get(name);
|
|
238
295
|
}
|
|
239
296
|
}
|
|
240
297
|
_GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generator }) {
|
|
@@ -296,6 +353,18 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
296
353
|
});
|
|
297
354
|
});
|
|
298
355
|
}
|
|
356
|
+
}, _GenerateContext_getFile = function _GenerateContext_getFile(filePath, { throwIfNotFound = false } = {}) {
|
|
357
|
+
const normalisedPath = normalize(filePath);
|
|
358
|
+
const currentFile = __classPrivateFieldGet(this, _GenerateContext_files, "f").get(normalisedPath);
|
|
359
|
+
if (!currentFile) {
|
|
360
|
+
if (throwIfNotFound) {
|
|
361
|
+
throw new Error(`File not found: '${normalisedPath}'`);
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addFile).call(this, normalisedPath);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return currentFile;
|
|
299
368
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
300
369
|
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
301
370
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
@@ -311,4 +380,15 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
311
380
|
importFrom: modelSettings?.importFrom
|
|
312
381
|
};
|
|
313
382
|
return baseSettings;
|
|
383
|
+
}, _GenerateContext_addFile = function _GenerateContext_addFile(normalisedPath) {
|
|
384
|
+
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
385
|
+
throw new Error(`File already exists: ${normalisedPath}`);
|
|
386
|
+
}
|
|
387
|
+
const newFile = {
|
|
388
|
+
imports: new Map(),
|
|
389
|
+
definitions: new Map(),
|
|
390
|
+
generatorKeys: new Set()
|
|
391
|
+
};
|
|
392
|
+
__classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
|
|
393
|
+
return newFile;
|
|
314
394
|
};
|
package/esm/oas/array/Array.d.ts
CHANGED
|
@@ -7,16 +7,40 @@ export type ArrayFields = {
|
|
|
7
7
|
nullable?: boolean;
|
|
8
8
|
uniqueItems?: boolean;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Object representing an array in the OpenAPI Specification.
|
|
12
|
+
*/
|
|
10
13
|
export declare class OasArray {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Object is part the 'schema' set which is used
|
|
16
|
+
* to define data types in an OpenAPI document.
|
|
17
|
+
*/
|
|
18
|
+
oasType: "schema";
|
|
19
|
+
/**
|
|
20
|
+
* Constant value 'array' useful for type narrowing and tagged unions.
|
|
21
|
+
*/
|
|
22
|
+
type: "array";
|
|
23
|
+
/**
|
|
24
|
+
* Defines the type of items in the array.
|
|
25
|
+
*/
|
|
26
|
+
items: OasSchema | OasRef<'schema'>;
|
|
27
|
+
/**
|
|
28
|
+
* A short summary of the array.
|
|
29
|
+
*/
|
|
30
|
+
title: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* A description of the array.
|
|
33
|
+
*/
|
|
34
|
+
description: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates whether value can be null.
|
|
37
|
+
*/
|
|
38
|
+
nullable: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Indicates whether the array items must be unique.
|
|
41
|
+
*/
|
|
42
|
+
uniqueItems: boolean | undefined;
|
|
14
43
|
constructor(fields: ArrayFields);
|
|
15
|
-
get items(): OasSchema | OasRef<'schema'>;
|
|
16
|
-
get title(): string | undefined;
|
|
17
|
-
get description(): string | undefined;
|
|
18
|
-
get nullable(): boolean | undefined;
|
|
19
|
-
get uniqueItems(): boolean | undefined;
|
|
20
44
|
isRef(): this is OasRef<'schema'>;
|
|
21
45
|
resolve(): OasArray;
|
|
22
46
|
resolveOnce(): OasArray;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Array.d.ts","sourceRoot":"","sources":["../../../src/oas/array/Array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,qBAAa,QAAQ
|
|
1
|
+
{"version":3,"file":"Array.d.ts","sourceRoot":"","sources":["../../../src/oas/array/Array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB;;;OAGG;IACH,OAAO,WAAoB;IAC3B;;OAEG;IACH,IAAI,UAAmB;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,WAAW,EAAE,OAAO,GAAG,SAAS,CAAA;gBAEpB,MAAM,EAAE,WAAW;IAQ/B,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,QAAQ;IAInB,WAAW,IAAI,QAAQ;CAGxB"}
|
package/esm/oas/array/Array.js
CHANGED
|
@@ -1,46 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 _OasArray_fields;
|
|
1
|
+
/**
|
|
2
|
+
* Object representing an array in the OpenAPI Specification.
|
|
3
|
+
*/
|
|
13
4
|
export class OasArray {
|
|
14
5
|
constructor(fields) {
|
|
6
|
+
/**
|
|
7
|
+
* Object is part the 'schema' set which is used
|
|
8
|
+
* to define data types in an OpenAPI document.
|
|
9
|
+
*/
|
|
15
10
|
Object.defineProperty(this, "oasType", {
|
|
16
11
|
enumerable: true,
|
|
17
12
|
configurable: true,
|
|
18
13
|
writable: true,
|
|
19
14
|
value: 'schema'
|
|
20
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
* Constant value 'array' useful for type narrowing and tagged unions.
|
|
18
|
+
*/
|
|
21
19
|
Object.defineProperty(this, "type", {
|
|
22
20
|
enumerable: true,
|
|
23
21
|
configurable: true,
|
|
24
22
|
writable: true,
|
|
25
23
|
value: 'array'
|
|
26
24
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Defines the type of items in the array.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(this, "items", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* A short summary of the array.
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(this, "title", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* A description of the array.
|
|
45
|
+
*/
|
|
46
|
+
Object.defineProperty(this, "description", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: void 0
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Indicates whether value can be null.
|
|
54
|
+
*/
|
|
55
|
+
Object.defineProperty(this, "nullable", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: void 0
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Indicates whether the array items must be unique.
|
|
63
|
+
*/
|
|
64
|
+
Object.defineProperty(this, "uniqueItems", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
70
|
+
this.items = fields.items;
|
|
71
|
+
this.title = fields.title;
|
|
72
|
+
this.description = fields.description;
|
|
73
|
+
this.nullable = fields.nullable;
|
|
74
|
+
this.uniqueItems = fields.uniqueItems;
|
|
44
75
|
}
|
|
45
76
|
isRef() {
|
|
46
77
|
return false;
|
|
@@ -52,4 +83,3 @@ export class OasArray {
|
|
|
52
83
|
return this;
|
|
53
84
|
}
|
|
54
85
|
}
|
|
55
|
-
_OasArray_fields = new WeakMap();
|
|
@@ -4,14 +4,32 @@ export type BooleanFields = {
|
|
|
4
4
|
description?: string;
|
|
5
5
|
nullable?: boolean;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Object representing a boolean in the OpenAPI Specification.
|
|
9
|
+
*/
|
|
7
10
|
export declare class OasBoolean {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Object is part the 'schema' set which is used
|
|
13
|
+
* to define data types in an OpenAPI document.
|
|
14
|
+
*/
|
|
15
|
+
oasType: "schema";
|
|
16
|
+
/**
|
|
17
|
+
* Constant value 'boolean' useful for type narrowing and tagged unions.
|
|
18
|
+
*/
|
|
19
|
+
type: "boolean";
|
|
20
|
+
/**
|
|
21
|
+
* A short summary of the boolean.
|
|
22
|
+
*/
|
|
23
|
+
title: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* A description of the boolean.
|
|
26
|
+
*/
|
|
27
|
+
description: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether value can be null.
|
|
30
|
+
*/
|
|
31
|
+
nullable: boolean | undefined;
|
|
11
32
|
constructor(fields: BooleanFields);
|
|
12
|
-
get title(): string | undefined;
|
|
13
|
-
get description(): string | undefined;
|
|
14
|
-
get nullable(): boolean | undefined;
|
|
15
33
|
isRef(): this is OasRef<'schema'>;
|
|
16
34
|
resolve(): OasBoolean;
|
|
17
35
|
resolveOnce(): OasBoolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Boolean.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/Boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,qBAAa,UAAU
|
|
1
|
+
{"version":3,"file":"Boolean.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/Boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACH,OAAO,WAAoB;IAC3B;;OAEG;IACH,IAAI,YAAqB;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;gBAEjB,MAAM,EAAE,aAAa;IAMjC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,UAAU;IAIrB,WAAW,IAAI,UAAU;CAG1B"}
|
|
@@ -1,40 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 _OasBoolean_fields;
|
|
1
|
+
/**
|
|
2
|
+
* Object representing a boolean in the OpenAPI Specification.
|
|
3
|
+
*/
|
|
13
4
|
export class OasBoolean {
|
|
14
5
|
constructor(fields) {
|
|
6
|
+
/**
|
|
7
|
+
* Object is part the 'schema' set which is used
|
|
8
|
+
* to define data types in an OpenAPI document.
|
|
9
|
+
*/
|
|
15
10
|
Object.defineProperty(this, "oasType", {
|
|
16
11
|
enumerable: true,
|
|
17
12
|
configurable: true,
|
|
18
13
|
writable: true,
|
|
19
14
|
value: 'schema'
|
|
20
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
* Constant value 'boolean' useful for type narrowing and tagged unions.
|
|
18
|
+
*/
|
|
21
19
|
Object.defineProperty(this, "type", {
|
|
22
20
|
enumerable: true,
|
|
23
21
|
configurable: true,
|
|
24
22
|
writable: true,
|
|
25
23
|
value: 'boolean'
|
|
26
24
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
/**
|
|
26
|
+
* A short summary of the boolean.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(this, "title", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* A description of the boolean.
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(this, "description", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Indicates whether value can be null.
|
|
45
|
+
*/
|
|
46
|
+
Object.defineProperty(this, "nullable", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: void 0
|
|
51
|
+
});
|
|
52
|
+
this.title = fields.title;
|
|
53
|
+
this.description = fields.description;
|
|
54
|
+
this.nullable = fields.nullable;
|
|
38
55
|
}
|
|
39
56
|
isRef() {
|
|
40
57
|
return false;
|
|
@@ -46,4 +63,3 @@ export class OasBoolean {
|
|
|
46
63
|
return this;
|
|
47
64
|
}
|
|
48
65
|
}
|
|
49
|
-
_OasBoolean_fields = new WeakMap();
|