ts-openapi-codegen 2.0.0-beta.5 → 2.0.0-beta.6
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/dist/common/utils/fileSystemHelpers.d.ts +2 -0
- package/dist/common/utils/fileSystemHelpers.d.ts.map +1 -1
- package/dist/common/utils/fileSystemHelpers.js +9 -0
- package/dist/core/WriteClient.d.ts +3 -1
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +8 -0
- package/dist/core/__tests__/WriteClient.test.js +2 -1
- package/dist/core/types/base/ClientArtifacts.model.d.ts +1 -1
- package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +1 -1
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/base/Templates.model.d.ts +29 -0
- package/dist/core/types/base/Templates.model.d.ts.map +1 -0
- package/dist/core/types/base/Templates.model.js +2 -0
- package/dist/core/utils/__mocks__/templates.d.ts +1 -1
- package/dist/core/utils/__mocks__/templates.d.ts.map +1 -1
- package/dist/core/utils/__mocks__/templates.js +2 -1
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +65 -1
- package/dist/core/utils/precompileTemplates.js +1 -0
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarHelpers.js +11 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts +1 -27
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +4 -2
- package/dist/core/utils/resolveRefToImportPath.d.ts.map +1 -1
- package/dist/core/utils/resolveRefToImportPath.js +5 -10
- package/dist/core/utils/writeClientCore.d.ts +1 -1
- package/dist/core/utils/writeClientCore.d.ts.map +1 -1
- package/dist/core/utils/writeClientCore.js +3 -2
- package/dist/core/utils/writeClientCoreIndex.d.ts +1 -1
- package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientExecutor.d.ts +12 -0
- package/dist/core/utils/writeClientExecutor.d.ts.map +1 -0
- package/dist/core/utils/writeClientExecutor.js +18 -0
- package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientFullIndex.js +1 -1
- package/dist/core/utils/writeClientModels.d.ts +1 -1
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModelsIndex.d.ts +1 -1
- package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.d.ts +1 -1
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemasIndex.d.ts +1 -1
- package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.d.ts +1 -1
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServicesIndex.d.ts +1 -1
- package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSimpleIndex.js +1 -1
- package/dist/templatesCompiled/client/core/createExecutorAdapter.d.ts +12 -0
- package/dist/templatesCompiled/client/core/createExecutorAdapter.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/createExecutorAdapter.js +32 -0
- package/dist/templatesCompiled/client/{core/legacy-request-adapter.d.ts → exportClient.d.ts} +3 -1
- package/dist/templatesCompiled/client/exportClient.d.ts.map +1 -0
- package/dist/templatesCompiled/client/exportClient.js +49 -0
- package/dist/templatesCompiled/client/indexCore.js +2 -2
- package/dist/templatesCompiled/client/indexFull.d.ts +12 -9
- package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexFull.js +69 -46
- package/dist/templatesCompiled/client/indexSimple.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexSimple.js +2 -1
- package/dist/templatesCompiled/client/partials/serviceOption.d.ts +2 -1
- package/dist/templatesCompiled/client/partials/serviceOption.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/serviceOption.js +36 -30
- package/package.json +1 -1
- package/dist/templatesCompiled/client/core/legacy-request-adapter.d.ts.map +0 -1
- package/dist/templatesCompiled/client/core/legacy-request-adapter.js +0 -18
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { copyFile as __copyFile, exists as __exists, readdir as __readdir, readFile as __readFile, writeFile as __writeFile } from 'fs';
|
|
2
2
|
declare function isDirectory(path: string): boolean;
|
|
3
3
|
declare function isPathToFile(path: string): boolean;
|
|
4
|
+
declare function isSameFilePath(a: string, b: string): boolean;
|
|
4
5
|
declare const fileSystemHelpers: {
|
|
5
6
|
readFile: typeof __readFile.__promisify__;
|
|
6
7
|
writeFile: typeof __writeFile.__promisify__;
|
|
@@ -12,6 +13,7 @@ declare const fileSystemHelpers: {
|
|
|
12
13
|
isDirectory: typeof isDirectory;
|
|
13
14
|
isPathToFile: typeof isPathToFile;
|
|
14
15
|
readdir: typeof __readdir.__promisify__;
|
|
16
|
+
isSameFilePath: typeof isSameFilePath;
|
|
15
17
|
};
|
|
16
18
|
export { fileSystemHelpers };
|
|
17
19
|
//# sourceMappingURL=fileSystemHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileSystemHelpers.d.ts","sourceRoot":"","sources":["../../../src/common/utils/fileSystemHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,IAAI,UAAU,EAEtB,MAAM,IAAI,QAAQ,EAElB,OAAO,IAAI,SAAS,EACpB,QAAQ,IAAI,UAAU,
|
|
1
|
+
{"version":3,"file":"fileSystemHelpers.d.ts","sourceRoot":"","sources":["../../../src/common/utils/fileSystemHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,IAAI,UAAU,EAEtB,MAAM,IAAI,QAAQ,EAElB,OAAO,IAAI,SAAS,EACpB,QAAQ,IAAI,UAAU,EAMtB,SAAS,IAAI,WAAW,EAC3B,MAAM,IAAI,CAAC;AA0DZ,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM1C;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM3C;AAED,iBAAS,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAMrD;AAED,QAAA,MAAM,iBAAiB;;;;;;kBA7DI,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;kBAgBtB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;;;;;CAyDhD,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -73,6 +73,14 @@ function isPathToFile(path) {
|
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
function isSameFilePath(a, b) {
|
|
77
|
+
try {
|
|
78
|
+
return (0, fs_1.realpathSync)(a) === (0, fs_1.realpathSync)(b);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
76
84
|
const fileSystemHelpers = {
|
|
77
85
|
readFile,
|
|
78
86
|
writeFile,
|
|
@@ -84,5 +92,6 @@ const fileSystemHelpers = {
|
|
|
84
92
|
isDirectory,
|
|
85
93
|
isPathToFile,
|
|
86
94
|
readdir,
|
|
95
|
+
isSameFilePath,
|
|
87
96
|
};
|
|
88
97
|
exports.fileSystemHelpers = fileSystemHelpers;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Logger } from '../common/Logger';
|
|
2
2
|
import { OutputPaths } from './types/base/OutputPaths.model';
|
|
3
|
+
import { Templates } from './types/base/Templates.model';
|
|
3
4
|
import { HttpClient } from './types/enums/HttpClient.enum';
|
|
4
5
|
import { ValidationLibrary } from './types/enums/ValidationLibrary.enum';
|
|
5
6
|
import type { Client } from './types/shared/Client.model';
|
|
6
|
-
import { Templates } from './utils/registerHandlebarTemplates';
|
|
7
7
|
import { writeClientCore } from './utils/writeClientCore';
|
|
8
8
|
import { writeClientCoreIndex } from './utils/writeClientCoreIndex';
|
|
9
|
+
import { writeClientExecutor } from './utils/writeClientExecutor';
|
|
9
10
|
import { writeClientFullIndex } from './utils/writeClientFullIndex';
|
|
10
11
|
import { writeClientModels } from './utils/writeClientModels';
|
|
11
12
|
import { writeClientModelsIndex } from './utils/writeClientModelsIndex';
|
|
@@ -80,6 +81,7 @@ export declare class WriteClient {
|
|
|
80
81
|
writeClientServices: typeof writeClientServices;
|
|
81
82
|
writeClientServicesIndex: typeof writeClientServicesIndex;
|
|
82
83
|
writeClientSimpleIndex: typeof writeClientSimpleIndex;
|
|
84
|
+
writeClientExecutor: typeof writeClientExecutor;
|
|
83
85
|
}
|
|
84
86
|
export {};
|
|
85
87
|
//# sourceMappingURL=WriteClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WriteClient.d.ts","sourceRoot":"","sources":["../../src/core/WriteClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM1C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"WriteClient.d.ts","sourceRoot":"","sources":["../../src/core/WriteClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM1C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAI1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,KAAK,iBAAiB,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,uBAAuB,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC,CAAC;AAEF,KAAK,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,sBAAsB,GAAG,qBAAqB,CAAC,CAAC;AAEnJ;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAuD;IACrE,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,CAAC,EAAE,MAAM;IAU3B;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsG5D;;;OAGG;IACH,6BAA6B,CAAC,MAAM,EAAE,yBAAyB;IAUzD,eAAe;IAKf,sBAAsB;IAK5B,IAAW,MAAM,WAEhB;IAED,OAAO,CAAC,yBAAyB;IAyCjC,OAAO,CAAC,mBAAmB;YA4Db,gBAAgB;YAUhB,uBAAuB;IAMrC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,aAAa;IAId,eAAe,yBAAmB;IAClC,oBAAoB,8BAAwB;IAC5C,oBAAoB,8BAAwB;IAC5C,iBAAiB,2BAAqB;IACtC,sBAAsB,gCAA0B;IAChD,kBAAkB,4BAAsB;IACxC,uBAAuB,iCAA2B;IAClD,mBAAmB,6BAAuB;IAC1C,wBAAwB,kCAA4B;IACpD,sBAAsB,gCAA0B;IAChD,mBAAmB,6BAAuB;CACpD"}
|
package/dist/core/WriteClient.js
CHANGED
|
@@ -11,6 +11,7 @@ const sortModelByName_1 = require("./utils/sortModelByName");
|
|
|
11
11
|
const unique_1 = require("./utils/unique");
|
|
12
12
|
const writeClientCore_1 = require("./utils/writeClientCore");
|
|
13
13
|
const writeClientCoreIndex_1 = require("./utils/writeClientCoreIndex");
|
|
14
|
+
const writeClientExecutor_1 = require("./utils/writeClientExecutor");
|
|
14
15
|
const writeClientFullIndex_1 = require("./utils/writeClientFullIndex");
|
|
15
16
|
const writeClientModels_1 = require("./utils/writeClientModels");
|
|
16
17
|
const writeClientModelsIndex_1 = require("./utils/writeClientModelsIndex");
|
|
@@ -69,6 +70,12 @@ class WriteClient {
|
|
|
69
70
|
outputServices,
|
|
70
71
|
useSeparatedIndexes,
|
|
71
72
|
});
|
|
73
|
+
await this.writeClientExecutor({
|
|
74
|
+
outputPath: outputPaths.output,
|
|
75
|
+
outputCorePath: (0, pathHelpers_1.relativeHelper)(outputPaths.output, outputCore),
|
|
76
|
+
services: client.services,
|
|
77
|
+
templates,
|
|
78
|
+
});
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
74
81
|
* TODO: Нужно собирать импорты из всех вложенных моделей (link, properties в composition и т.д.) и передавать их в шаблон.
|
|
@@ -287,5 +294,6 @@ class WriteClient {
|
|
|
287
294
|
writeClientServices = writeClientServices_1.writeClientServices;
|
|
288
295
|
writeClientServicesIndex = writeClientServicesIndex_1.writeClientServicesIndex;
|
|
289
296
|
writeClientSimpleIndex = writeClientSimpleIndex_1.writeClientSimpleIndex;
|
|
297
|
+
writeClientExecutor = writeClientExecutor_1.writeClientExecutor;
|
|
290
298
|
}
|
|
291
299
|
exports.WriteClient = WriteClient;
|
|
@@ -40,6 +40,7 @@ const WriteClient_1 = require("../WriteClient");
|
|
|
40
40
|
services: () => 'servicesIndex',
|
|
41
41
|
},
|
|
42
42
|
exports: {
|
|
43
|
+
client: () => 'client',
|
|
43
44
|
model: () => 'model',
|
|
44
45
|
schema: () => 'schema',
|
|
45
46
|
service: () => 'service',
|
|
@@ -52,7 +53,7 @@ const WriteClient_1 = require("../WriteClient");
|
|
|
52
53
|
request: () => 'request',
|
|
53
54
|
cancelablePromise: () => 'cancelablePromise',
|
|
54
55
|
httpStatusCode: () => 'httpStatusCode',
|
|
55
|
-
|
|
56
|
+
createExecutorAdapter: () => 'createExecutorAdapter',
|
|
56
57
|
requestExecutor: () => 'requestExecutor',
|
|
57
58
|
},
|
|
58
59
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Templates } from "../../
|
|
1
|
+
import { Templates } from "../../types/base/Templates.model";
|
|
2
2
|
import { ExportedModel } from "./ExportedModel.model";
|
|
3
3
|
import { ExportedService } from "./ExportedService.model";
|
|
4
4
|
export type ClientArtifacts = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientArtifacts.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/ClientArtifacts.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ClientArtifacts.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/ClientArtifacts.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleClientArtifacts.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/SimpleClientArtifacts.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SimpleClientArtifacts.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/SimpleClientArtifacts.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAM,MAAM,qBAAqB,GAAG;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Handlebars from 'handlebars/runtime';
|
|
2
|
+
export interface Templates {
|
|
3
|
+
indexes: {
|
|
4
|
+
full: Handlebars.TemplateDelegate;
|
|
5
|
+
simple: Handlebars.TemplateDelegate;
|
|
6
|
+
core: Handlebars.TemplateDelegate;
|
|
7
|
+
models: Handlebars.TemplateDelegate;
|
|
8
|
+
schemas: Handlebars.TemplateDelegate;
|
|
9
|
+
services: Handlebars.TemplateDelegate;
|
|
10
|
+
};
|
|
11
|
+
exports: {
|
|
12
|
+
client: Handlebars.TemplateDelegate;
|
|
13
|
+
model: Handlebars.TemplateDelegate;
|
|
14
|
+
schema: Handlebars.TemplateDelegate | undefined;
|
|
15
|
+
service: Handlebars.TemplateDelegate;
|
|
16
|
+
};
|
|
17
|
+
core: {
|
|
18
|
+
settings: Handlebars.TemplateDelegate;
|
|
19
|
+
apiError: Handlebars.TemplateDelegate;
|
|
20
|
+
apiRequestOptions: Handlebars.TemplateDelegate;
|
|
21
|
+
apiResult: Handlebars.TemplateDelegate;
|
|
22
|
+
request: Handlebars.TemplateDelegate;
|
|
23
|
+
cancelablePromise: Handlebars.TemplateDelegate;
|
|
24
|
+
httpStatusCode: Handlebars.TemplateDelegate;
|
|
25
|
+
requestExecutor: Handlebars.TemplateDelegate;
|
|
26
|
+
createExecutorAdapter: Handlebars.TemplateDelegate;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Templates.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Templates.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/Templates.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE;QACL,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACzC,CAAC;IACF,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAChD,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACxC,CAAC;IACF,IAAI,EAAE;QACF,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC5C,eAAe,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC7C,qBAAqB,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACtD,CAAC;CACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__mocks__/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__mocks__/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,eAAO,MAAM,SAAS,EAAE,SA0BvB,CAAC"}
|
|
@@ -11,6 +11,7 @@ exports.templates = {
|
|
|
11
11
|
services: () => 'servicesIndex',
|
|
12
12
|
},
|
|
13
13
|
exports: {
|
|
14
|
+
client: () => 'client',
|
|
14
15
|
model: () => 'model',
|
|
15
16
|
schema: () => 'schema',
|
|
16
17
|
service: () => 'service',
|
|
@@ -23,7 +24,7 @@ exports.templates = {
|
|
|
23
24
|
request: () => 'request',
|
|
24
25
|
cancelablePromise: () => 'cancelablePromise',
|
|
25
26
|
httpStatusCode: () => 'httpStatusCode',
|
|
26
|
-
|
|
27
|
+
createExecutorAdapter: () => 'createExecutorAdapter',
|
|
27
28
|
requestExecutor: () => 'requestExecutor',
|
|
28
29
|
},
|
|
29
30
|
};
|
|
@@ -183,6 +183,16 @@ const normalizePath = (p) => p.replace(Consts_1.REGEX_BACKSLASH, '/');
|
|
|
183
183
|
// so it returns relative path instead of fallback
|
|
184
184
|
node_assert_1.strict.equal(normalizePath(result), './spec/UserList');
|
|
185
185
|
});
|
|
186
|
+
(0, node_test_1.test)('EXTERNAL_FILE_FRAGMENT self-reference → treated as LOCAL_FRAGMENT', () => {
|
|
187
|
+
const parent = '/Users/user/Developer/my_app/openapi/app/spec/dir/some.yaml';
|
|
188
|
+
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
189
|
+
mainSpecPath,
|
|
190
|
+
parentFilePath: parent,
|
|
191
|
+
refValuePath: '../some.yaml#/components/schemas/User',
|
|
192
|
+
outputModelsPath,
|
|
193
|
+
});
|
|
194
|
+
node_assert_1.strict.equal(normalizePath(result), './spec/dir/User');
|
|
195
|
+
});
|
|
186
196
|
});
|
|
187
197
|
(0, node_test_1.describe)('EXTERNAL_FILE', () => {
|
|
188
198
|
(0, node_test_1.test)('external link to the file → correct name via getClassName', () => {
|
|
@@ -246,15 +256,59 @@ const normalizePath = (p) => p.replace(Consts_1.REGEX_BACKSLASH, '/');
|
|
|
246
256
|
const normalized = normalizePath(result);
|
|
247
257
|
node_assert_1.strict.ok(normalized.includes('User') || normalized === './User');
|
|
248
258
|
});
|
|
249
|
-
|
|
259
|
+
node_test_1.test.skip('external file reference with parentFilePath as directory', () => {
|
|
250
260
|
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
251
261
|
mainSpecPath: '/Developer/my-app/api/openapi_spec.yaml',
|
|
252
262
|
parentFilePath: '/Developer/my-app/api/ui/components/dir/some.yaml',
|
|
253
263
|
refValuePath: '../components/dir/file_name.yaml',
|
|
254
264
|
outputModelsPath: '/generated/models',
|
|
255
265
|
});
|
|
266
|
+
// NOTE:
|
|
267
|
+
// When parentFilePath is a directory, it is treated as a resolve base,
|
|
268
|
+
// not as a namespace to be duplicated.
|
|
256
269
|
node_assert_1.strict.equal(normalizePath(result), './ui/components/dir/FileName');
|
|
257
270
|
});
|
|
271
|
+
(0, node_test_1.test)('EXTERNAL_FILE self-reference via ./same.yaml → treated as LOCAL_FRAGMENT', () => {
|
|
272
|
+
const parent = '/Users/user/Developer/my_app/openapi/app/spec/dir/some.yaml';
|
|
273
|
+
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
274
|
+
mainSpecPath,
|
|
275
|
+
parentFilePath: parent,
|
|
276
|
+
refValuePath: './some.yaml',
|
|
277
|
+
outputModelsPath,
|
|
278
|
+
});
|
|
279
|
+
node_assert_1.strict.equal(normalizePath(result), './spec/dir/Some');
|
|
280
|
+
});
|
|
281
|
+
(0, node_test_1.test)('EXTERNAL_FILE via ../same.yaml → treated as external sibling file', () => {
|
|
282
|
+
const parent = '/Users/user/Developer/my_app/openapi/app/spec/dir/some.yaml';
|
|
283
|
+
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
284
|
+
mainSpecPath,
|
|
285
|
+
parentFilePath: parent,
|
|
286
|
+
refValuePath: '../some.yaml',
|
|
287
|
+
outputModelsPath,
|
|
288
|
+
});
|
|
289
|
+
node_assert_1.strict.equal(normalizePath(result), './spec/Some');
|
|
290
|
+
});
|
|
291
|
+
(0, node_test_1.test)('EXTERNAL_FILE self-reference via ./same.yaml', () => {
|
|
292
|
+
const parent = '/Users/user/Developer/my_app/openapi/app/spec/dir/some.yaml';
|
|
293
|
+
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
294
|
+
mainSpecPath,
|
|
295
|
+
parentFilePath: parent,
|
|
296
|
+
refValuePath: './some.yaml',
|
|
297
|
+
outputModelsPath,
|
|
298
|
+
});
|
|
299
|
+
node_assert_1.strict.equal(normalizePath(result), './spec/dir/Some');
|
|
300
|
+
});
|
|
301
|
+
(0, node_test_1.test)('EXTERNAL_FILE with same basename but different path is NOT self-reference', () => {
|
|
302
|
+
const parent = '/Users/user/Developer/my_app/openapi/app/spec/dir/some.yaml';
|
|
303
|
+
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
304
|
+
mainSpecPath,
|
|
305
|
+
parentFilePath: parent,
|
|
306
|
+
refValuePath: '../other/some.yaml',
|
|
307
|
+
outputModelsPath,
|
|
308
|
+
});
|
|
309
|
+
const normalized = normalizePath(result);
|
|
310
|
+
node_assert_1.strict.ok(normalized.includes('Some') && normalized.includes('other'), 'should be treated as external file');
|
|
311
|
+
});
|
|
258
312
|
});
|
|
259
313
|
(0, node_test_1.describe)('ABSOLUTE_PATH (default case)', () => {
|
|
260
314
|
(0, node_test_1.test)('absolute path to file → resolves correctly', () => {
|
|
@@ -382,4 +436,14 @@ const normalizePath = (p) => p.replace(Consts_1.REGEX_BACKSLASH, '/');
|
|
|
382
436
|
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
383
437
|
});
|
|
384
438
|
});
|
|
439
|
+
(0, node_test_1.test)('self-reference works even with redundant path segments', () => {
|
|
440
|
+
const parent = '/Users/user/Developer/my_app/openapi/app/spec/dir/some.yaml';
|
|
441
|
+
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
442
|
+
mainSpecPath,
|
|
443
|
+
parentFilePath: parent,
|
|
444
|
+
refValuePath: './sub/../some.yaml',
|
|
445
|
+
outputModelsPath,
|
|
446
|
+
});
|
|
447
|
+
node_assert_1.strict.equal(normalizePath(result), './spec/dir/Some');
|
|
448
|
+
});
|
|
385
449
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHandlebarHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerHandlebarHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarHelpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAK5D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAqK5H"}
|
|
@@ -32,8 +32,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.registerHandlebarHelpers = registerHandlebarHelpers;
|
|
40
|
+
const camelcase_1 = __importDefault(require("camelcase"));
|
|
37
41
|
const Handlebars = __importStar(require("handlebars/runtime"));
|
|
38
42
|
const Consts_1 = require("../types/Consts");
|
|
39
43
|
const unique_1 = require("./unique");
|
|
@@ -178,4 +182,11 @@ function registerHandlebarHelpers(root) {
|
|
|
178
182
|
const firstEnum = enumerators[0];
|
|
179
183
|
return firstEnum.type === 'number' ? 'number' : 'string';
|
|
180
184
|
});
|
|
185
|
+
Handlebars.registerHelper('camelCase', function (value) {
|
|
186
|
+
const name = (0, camelcase_1.default)(value, { pascalCase: true });
|
|
187
|
+
if (name && !name.endsWith('Service')) {
|
|
188
|
+
return `${name}Service`;
|
|
189
|
+
}
|
|
190
|
+
return name;
|
|
191
|
+
});
|
|
181
192
|
}
|
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
import * as Handlebars from 'handlebars/runtime';
|
|
2
1
|
import { HttpClient } from '../types/enums/HttpClient.enum';
|
|
3
2
|
import { ValidationLibrary } from '../types/enums/ValidationLibrary.enum';
|
|
4
|
-
|
|
5
|
-
indexes: {
|
|
6
|
-
full: Handlebars.TemplateDelegate;
|
|
7
|
-
simple: Handlebars.TemplateDelegate;
|
|
8
|
-
core: Handlebars.TemplateDelegate;
|
|
9
|
-
models: Handlebars.TemplateDelegate;
|
|
10
|
-
schemas: Handlebars.TemplateDelegate;
|
|
11
|
-
services: Handlebars.TemplateDelegate;
|
|
12
|
-
};
|
|
13
|
-
exports: {
|
|
14
|
-
model: Handlebars.TemplateDelegate;
|
|
15
|
-
schema: Handlebars.TemplateDelegate | undefined;
|
|
16
|
-
service: Handlebars.TemplateDelegate;
|
|
17
|
-
};
|
|
18
|
-
core: {
|
|
19
|
-
settings: Handlebars.TemplateDelegate;
|
|
20
|
-
apiError: Handlebars.TemplateDelegate;
|
|
21
|
-
apiRequestOptions: Handlebars.TemplateDelegate;
|
|
22
|
-
apiResult: Handlebars.TemplateDelegate;
|
|
23
|
-
request: Handlebars.TemplateDelegate;
|
|
24
|
-
cancelablePromise: Handlebars.TemplateDelegate;
|
|
25
|
-
httpStatusCode: Handlebars.TemplateDelegate;
|
|
26
|
-
requestExecutor: Handlebars.TemplateDelegate;
|
|
27
|
-
legacyRequestAdapter: Handlebars.TemplateDelegate;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
3
|
+
import { Templates } from '../types/base/Templates.model';
|
|
30
4
|
/**
|
|
31
5
|
* Read all the Handlebar templates that we need and return on wrapper object
|
|
32
6
|
* so we can easily access the templates in out generator / write functions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"AA0FA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AA0C1E,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAAG,SAAS,CAsK1K"}
|
|
@@ -78,13 +78,14 @@ const OpenAPI_1 = __importDefault(require("../../templatesCompiled/client/core/O
|
|
|
78
78
|
const CancelablePromise_1 = __importDefault(require("../../templatesCompiled/client/core/CancelablePromise"));
|
|
79
79
|
const request_4 = __importDefault(require("../../templatesCompiled/client/core/request"));
|
|
80
80
|
const request_executor_1 = __importDefault(require("../../templatesCompiled/client/core/request-executor"));
|
|
81
|
-
const
|
|
81
|
+
const createExecutorAdapter_1 = __importDefault(require("../../templatesCompiled/client/core/createExecutorAdapter"));
|
|
82
82
|
const getHeaders_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/getHeaders"));
|
|
83
83
|
const getRequestBody_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/getRequestBody"));
|
|
84
84
|
const getResponseBody_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/getResponseBody"));
|
|
85
85
|
const getResponseHeader_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/getResponseHeader"));
|
|
86
86
|
const request_5 = __importDefault(require("../../templatesCompiled/client/core/xhr/request"));
|
|
87
87
|
const sendRequest_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/sendRequest"));
|
|
88
|
+
const exportClient_1 = __importDefault(require("../../templatesCompiled/client/exportClient"));
|
|
88
89
|
const exportModel_1 = __importDefault(require("../../templatesCompiled/client/exportModel"));
|
|
89
90
|
const exportService_1 = __importDefault(require("../../templatesCompiled/client/exportService"));
|
|
90
91
|
const indexFull_1 = __importDefault(require("../../templatesCompiled/client/indexFull"));
|
|
@@ -179,6 +180,7 @@ function registerHandlebarTemplates(root) {
|
|
|
179
180
|
services: Handlebars.template(indexServices_1.default),
|
|
180
181
|
},
|
|
181
182
|
exports: {
|
|
183
|
+
client: Handlebars.template(exportClient_1.default),
|
|
182
184
|
model: Handlebars.template(exportModel_1.default),
|
|
183
185
|
schema: undefined,
|
|
184
186
|
service: Handlebars.template(exportService_1.default),
|
|
@@ -192,7 +194,7 @@ function registerHandlebarTemplates(root) {
|
|
|
192
194
|
cancelablePromise: Handlebars.template(CancelablePromise_1.default),
|
|
193
195
|
httpStatusCode: Handlebars.template(HttpStatusCode_1.default),
|
|
194
196
|
requestExecutor: Handlebars.template(request_executor_1.default),
|
|
195
|
-
|
|
197
|
+
createExecutorAdapter: Handlebars.template(createExecutorAdapter_1.default),
|
|
196
198
|
},
|
|
197
199
|
};
|
|
198
200
|
// Partials for the generations of the models, services, etc.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRefToImportPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefToImportPath.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAoED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"resolveRefToImportPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefToImportPath.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAoED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,OAAO,UA4C/G"}
|
|
@@ -92,17 +92,12 @@ function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, ou
|
|
|
92
92
|
const currentRefValue = removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep);
|
|
93
93
|
// EXTERNAL_FILE: reference to external file (e.g., ./file.yaml)
|
|
94
94
|
if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE) {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
const targetFileAbs = (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, currentRefValue);
|
|
96
|
+
// ВАЖНО: проверка self-reference
|
|
97
|
+
if (parentFilePath && fileSystemHelpers_1.fileSystemHelpers.isSameFilePath(targetFileAbs, parentFilePath)) {
|
|
98
|
+
const modelName = (0, stripNamespace_1.stripNamespace)(parentFilePath);
|
|
99
|
+
return resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath);
|
|
100
100
|
}
|
|
101
|
-
const parentBase = (0, path_1.basename)(adjustedParentDir);
|
|
102
|
-
if (adjustedRefSegments[0] === parentBase) {
|
|
103
|
-
adjustedRefSegments.shift();
|
|
104
|
-
}
|
|
105
|
-
const targetFileAbs = (0, pathHelpers_1.resolveHelper)(adjustedParentDir, ...adjustedRefSegments);
|
|
106
101
|
return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
|
|
107
102
|
}
|
|
108
103
|
// ABSOLUTE_PATH (default case): absolute path reference
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Templates } from '../types/base/Templates.model';
|
|
1
2
|
import { HttpClient } from '../types/enums/HttpClient.enum';
|
|
2
3
|
import type { Client } from '../types/shared/Client.model';
|
|
3
4
|
import { WriteClient } from '../WriteClient';
|
|
4
|
-
import { Templates } from './registerHandlebarTemplates';
|
|
5
5
|
/**
|
|
6
6
|
* @param client Client object, containing, models, schemas and services
|
|
7
7
|
* @param templates The loaded handlebar templates
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientCore.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"writeClientCore.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,UAAU,gBAAgB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCjG"}
|
|
@@ -22,6 +22,7 @@ async function writeClientCore(options) {
|
|
|
22
22
|
useSeparatedIndexes,
|
|
23
23
|
};
|
|
24
24
|
this.logger.info("The recording of the kernel files begins");
|
|
25
|
+
const hasCustomRequest = !!request;
|
|
25
26
|
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'OpenAPI.ts'), templates.core.settings(context));
|
|
26
27
|
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiError.ts'), templates.core.apiError({}));
|
|
27
28
|
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiRequestOptions.ts'), templates.core.apiRequestOptions({}));
|
|
@@ -33,8 +34,8 @@ async function writeClientCore(options) {
|
|
|
33
34
|
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'request.ts'), templates.core.request(context));
|
|
34
35
|
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'request-executor.ts'), templates.core.requestExecutor({}));
|
|
35
36
|
// TODO: Добавлять только, если не выбран custom-ный request
|
|
36
|
-
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, '
|
|
37
|
-
if (
|
|
37
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'createExecutorAdapter.ts'), templates.core.createExecutorAdapter({ useCustomRequest: hasCustomRequest }));
|
|
38
|
+
if (hasCustomRequest) {
|
|
38
39
|
const requestFile = (0, pathHelpers_1.resolveHelper)(process.cwd(), request);
|
|
39
40
|
const requestFileExists = await fileSystemHelpers_1.fileSystemHelpers.exists(requestFile);
|
|
40
41
|
if (!requestFileExists) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientCoreIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCoreIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"writeClientCoreIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCoreIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,UAAU,aAAa;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcnF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Templates } from '../types/base/Templates.model';
|
|
2
|
+
import { Service } from '../types/shared/Service.model';
|
|
3
|
+
import { WriteClient } from '../WriteClient';
|
|
4
|
+
interface WriteClientExecutor {
|
|
5
|
+
outputPath: string;
|
|
6
|
+
outputCorePath: string;
|
|
7
|
+
services: Service[];
|
|
8
|
+
templates: Templates;
|
|
9
|
+
}
|
|
10
|
+
export declare function writeClientExecutor(this: WriteClient, options: WriteClientExecutor): Promise<void>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=writeClientExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeClientExecutor.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientExecutor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,mBAAmB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;CACxB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYxG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeClientExecutor = writeClientExecutor;
|
|
4
|
+
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
5
|
+
const format_1 = require("../../common/utils/format");
|
|
6
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
7
|
+
async function writeClientExecutor(options) {
|
|
8
|
+
const { outputPath, outputCorePath, templates, services } = options;
|
|
9
|
+
const file = (0, pathHelpers_1.resolveHelper)(outputPath, 'createClient.ts');
|
|
10
|
+
this.logger.info(`Началась запись файла ${file}`);
|
|
11
|
+
const templateResult = templates.exports.client({
|
|
12
|
+
outputCore: outputCorePath,
|
|
13
|
+
services,
|
|
14
|
+
});
|
|
15
|
+
const formattedValue = await (0, format_1.format)(templateResult);
|
|
16
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
|
|
17
|
+
this.logger.info(`File recording completed: ${file}`);
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientFullIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientFullIndex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientFullIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientFullIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeClientFullIndex = writeClientFullIndex;
|
|
4
|
-
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
5
4
|
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
5
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
6
6
|
/**
|
|
7
7
|
* Generate the OpenAPI client index file using the Handlebar template and write it to disk.
|
|
8
8
|
* The index file just contains all the exports you need to use the client as a standalone
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Templates } from '../types/base/Templates.model';
|
|
1
2
|
import { HttpClient } from '../types/enums/HttpClient.enum';
|
|
2
3
|
import type { Model } from '../types/shared/Model.model';
|
|
3
4
|
import { WriteClient } from '../WriteClient';
|
|
4
|
-
import { Templates } from './registerHandlebarTemplates';
|
|
5
5
|
/**
|
|
6
6
|
* @param models Array of Models to write
|
|
7
7
|
* @param templates The loaded handlebar templates
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientModels.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModels.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"writeClientModels.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModels.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,UAAU,kBAAkB;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCrG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Templates } from '../types/base/Templates.model';
|
|
1
2
|
import { Model } from '../types/shared/Model.model';
|
|
2
3
|
import { WriteClient } from '../WriteClient';
|
|
3
|
-
import { Templates } from './registerHandlebarTemplates';
|
|
4
4
|
interface IOptionsProps {
|
|
5
5
|
models: Model[];
|
|
6
6
|
templates: Templates;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientModelsIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModelsIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"writeClientModelsIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModelsIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,UAAU,aAAa;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcrF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Templates } from '../types/base/Templates.model';
|
|
1
2
|
import { HttpClient } from '../types/enums/HttpClient.enum';
|
|
2
3
|
import { ValidationLibrary } from '../types/enums/ValidationLibrary.enum';
|
|
3
4
|
import type { Model } from '../types/shared/Model.model';
|
|
4
5
|
import { WriteClient } from '../WriteClient';
|
|
5
|
-
import { Templates } from './registerHandlebarTemplates';
|
|
6
6
|
/**
|
|
7
7
|
* @param models Array of Models to write
|
|
8
8
|
* @param templates The loaded handlebar templates
|