@team-supercharge/oasg 17.1.0 → 18.0.0-temp-chore-fix-tanstack-query-version.2eaaff54
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/README.md +260 -47
- package/bin/oasg +23 -4
- package/bin/save-lock.js +101 -0
- package/bin/target-version.js +84 -0
- package/config.schema.yml +15 -0
- package/package.json +1 -1
- package/targets/android/generate.sh +2 -2
- package/targets/android/generator-config.json +2 -1
- package/targets/android/publish.sh +1 -1
- package/targets/android/templates/build.gradle.mustache +63 -46
- package/targets/angular/generate.sh +35 -9
- package/targets/angular/publish.sh +1 -1
- package/targets/apple-swift/generate.sh +1 -1
- package/targets/apple-swift/publish.sh +1 -1
- package/targets/common.sh +3 -1
- package/targets/contract-testing/generate.sh +1 -1
- package/targets/contract-testing/publish.sh +1 -1
- package/targets/dependency-lock-utils.sh +290 -0
- package/targets/feign/generate.sh +1 -1
- package/targets/feign/publish.sh +1 -1
- package/targets/feign-kotlin/generate.sh +1 -1
- package/targets/feign-kotlin/publish.sh +1 -1
- package/targets/flutter/generate.sh +1 -1
- package/targets/flutter/publish.sh +1 -1
- package/targets/ios/generate.sh +1 -1
- package/targets/ios/publish.sh +1 -1
- package/targets/kmp/generate.sh +1 -1
- package/targets/kmp/publish.sh +1 -1
- package/targets/kmp/templates/build.gradle.kts.mustache +17 -13
- package/targets/kmp/templates/libraries/multiplatform/api.mustache +2 -0
- package/targets/msw/generate.sh +25 -0
- package/targets/msw/generator-config.json +28 -0
- package/targets/msw/templates/apis.index.mustache +9 -0
- package/targets/msw/templates/apis.mustache +178 -0
- package/targets/msw/templates/config.mustache +23 -0
- package/targets/msw/templates/index.mustache +11 -0
- package/targets/msw/templates/modelEnum.mustache +1 -0
- package/targets/msw/templates/modelGeneric.mustache +7 -0
- package/targets/msw/templates/package.mustache +35 -0
- package/targets/msw/templates/prettierrc.mustache +6 -0
- package/targets/msw/templates/tsconfig.mustache +18 -0
- package/targets/msw/templates/utils.mustache +15 -0
- package/targets/nestjs/generate.sh +36 -4
- package/targets/nestjs/publish.sh +1 -1
- package/targets/nestjs/templates/api.service.mustache +8 -14
- package/targets/plain-java/generate.sh +1 -1
- package/targets/plain-java/publish.sh +1 -1
- package/targets/python/generate.sh +1 -1
- package/targets/python/publish.sh +1 -1
- package/targets/python-fastapi/generate.sh +1 -1
- package/targets/python-fastapi/publish.sh +1 -1
- package/targets/python-fastapi-raw-request/generate.sh +1 -1
- package/targets/python-fastapi-raw-request/publish.sh +1 -1
- package/targets/python-legacy/generate.sh +1 -1
- package/targets/python-legacy/publish.sh +1 -1
- package/targets/react/generate.sh +17 -5
- package/targets/react/publish.sh +1 -1
- package/targets/react/templates/hook.mustache +172 -51
- package/targets/react/templates/package.mustache +1 -1
- package/targets/react/templates/use-api.hook.mustache +2 -0
- package/targets/spring/generate.sh +1 -1
- package/targets/spring/publish.sh +1 -1
- package/targets/spring-kotlin/generate.sh +1 -1
- package/targets/spring-kotlin/publish.sh +1 -1
- package/targets/stubby/generate.sh +1 -1
- package/targets/stubby/publish.sh +1 -1
- package/targets/typescript-axios/generate.sh +16 -5
- package/targets/typescript-axios/publish.sh +1 -1
- package/targets/typescript-fetch/generate.sh +17 -5
- package/targets/typescript-fetch/publish.sh +1 -1
- package/targets/android/templates/libraries/jvm-retrofit2/api.mustache +0 -157
- package/targets/android/templates/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache +0 -354
package/targets/ios/publish.sh
CHANGED
package/targets/kmp/generate.sh
CHANGED
package/targets/kmp/publish.sh
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
|
2
2
|
|
|
3
3
|
plugins {
|
|
4
|
-
kotlin("multiplatform"){{^omitGradlePluginVersions}} version "2.
|
|
5
|
-
kotlin("plugin.serialization"){{^omitGradlePluginVersions}} version "2.
|
|
4
|
+
kotlin("multiplatform"){{^omitGradlePluginVersions}} version "2.2.20" // kotlin_version{{/omitGradlePluginVersions}}
|
|
5
|
+
kotlin("plugin.serialization"){{^omitGradlePluginVersions}} version "2.2.20" // kotlin_version{{/omitGradlePluginVersions}}
|
|
6
6
|
id("maven-publish") // OASg added for publication
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
group = "{{groupId}}"
|
|
10
10
|
version = "{{artifactVersion}}"
|
|
11
11
|
|
|
12
|
-
val kotlin_version = "2.
|
|
12
|
+
val kotlin_version = "2.2.20"
|
|
13
13
|
val coroutines_version = "1.10.2"
|
|
14
|
-
val serialization_version = "1.
|
|
15
|
-
val ktor_version = "3.
|
|
14
|
+
val serialization_version = "1.9.0"
|
|
15
|
+
val ktor_version = "3.2.3"
|
|
16
16
|
|
|
17
17
|
repositories {
|
|
18
18
|
mavenCentral()
|
|
@@ -44,7 +44,7 @@ kotlin {
|
|
|
44
44
|
api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
|
|
45
45
|
|
|
46
46
|
{{#kotlinx-datetime}}
|
|
47
|
-
api("org.jetbrains.kotlinx:kotlinx-datetime:0.
|
|
47
|
+
api("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1")
|
|
48
48
|
{{/kotlinx-datetime}}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -80,21 +80,25 @@ kotlin {
|
|
|
80
80
|
api("io.ktor:ktor-client-js:$ktor_version")
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
{{#kotlinx-datetime}}
|
|
85
|
+
all {
|
|
86
|
+
languageSettings {
|
|
87
|
+
optIn("kotlin.time.ExperimentalTime")
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
{{/kotlinx-datetime}}
|
|
83
91
|
}
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
tasks {
|
|
87
|
-
register("iosTest") {
|
|
95
|
+
register<Exec>("iosTest") {
|
|
88
96
|
val device = project.findProperty("device")?.toString() ?: "iPhone 8"
|
|
89
97
|
dependsOn("linkDebugTestIosX64")
|
|
90
98
|
group = JavaBasePlugin.VERIFICATION_GROUP
|
|
91
99
|
description = "Execute unit tests on ${device} simulator"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
exec {
|
|
95
|
-
commandLine("xcrun", "simctl", "spawn", device, binary.outputFile)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
100
|
+
val binary = kotlin.targets.getByName<KotlinNativeTarget>("iosX64").binaries.getTest("DEBUG")
|
|
101
|
+
commandLine("xcrun", "simctl", "spawn", device, binary.outputFile)
|
|
98
102
|
}
|
|
99
103
|
register("test") {
|
|
100
104
|
dependsOn("allTests")
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#/bin/bash
|
|
2
|
+
|
|
3
|
+
source $(dirname "$0")/../common.sh
|
|
4
|
+
|
|
5
|
+
rm -rf out/$targetId
|
|
6
|
+
mkdir -p out/$targetId
|
|
7
|
+
|
|
8
|
+
java -jar $binary generate \
|
|
9
|
+
-g $generatorId \
|
|
10
|
+
-i $openApiFile \
|
|
11
|
+
-t $templateDir \
|
|
12
|
+
-o out/$targetId \
|
|
13
|
+
-c $(dirname "$0")/generator-config.json \
|
|
14
|
+
-p "npmVersion=$version,npmName=$packageName,npmRepository=$repository" \
|
|
15
|
+
--reserved-words-mappings delete=delete $generatorCustomArgs
|
|
16
|
+
|
|
17
|
+
cd out/$targetId
|
|
18
|
+
|
|
19
|
+
rm src/runtime.ts
|
|
20
|
+
|
|
21
|
+
npx prettier --write src
|
|
22
|
+
|
|
23
|
+
npm install
|
|
24
|
+
npm run build
|
|
25
|
+
cd ../..
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"typescriptThreePlus": "true",
|
|
3
|
+
"supportsES6": "true",
|
|
4
|
+
"modelPropertyNaming": "original",
|
|
5
|
+
"withInterfaces": "true",
|
|
6
|
+
"fileNaming": "camelCase",
|
|
7
|
+
"stringEnums": "true",
|
|
8
|
+
"enumPropertyNaming": "UPPERCASE",
|
|
9
|
+
"inlineSchemaOptions": {
|
|
10
|
+
"ARRAY_ITEM_SUFFIX": "",
|
|
11
|
+
"MAP_ITEM_SUFFIX": "",
|
|
12
|
+
"SKIP_SCHEMA_REUSE": "true"
|
|
13
|
+
},
|
|
14
|
+
"files": {
|
|
15
|
+
"prettierrc.mustache": {
|
|
16
|
+
"folder": ".",
|
|
17
|
+
"destinationFilename": ".prettierrc"
|
|
18
|
+
},
|
|
19
|
+
"config.mustache": {
|
|
20
|
+
"folder": "src",
|
|
21
|
+
"destinationFilename": "config.ts"
|
|
22
|
+
},
|
|
23
|
+
"utils.mustache": {
|
|
24
|
+
"folder": "src",
|
|
25
|
+
"destinationFilename": "utils.ts"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import {
|
|
4
|
+
http,
|
|
5
|
+
type RequestHandler,
|
|
6
|
+
type ResponseResolverInfo,
|
|
7
|
+
type AsyncResponseResolverReturnType,
|
|
8
|
+
type HttpRequestResolverExtras,
|
|
9
|
+
type PathParams,
|
|
10
|
+
} from 'msw';
|
|
11
|
+
import { getMswSdkConfig } from '../config';
|
|
12
|
+
import { delay, transformPathParams } from '../utils';
|
|
13
|
+
{{#imports.0}}
|
|
14
|
+
import type {
|
|
15
|
+
{{#imports}}
|
|
16
|
+
{{className}},
|
|
17
|
+
{{/imports}}
|
|
18
|
+
} from '../models/index{{importFileExtension}}';
|
|
19
|
+
{{/imports.0}}
|
|
20
|
+
|
|
21
|
+
type {{#lambda.titlecase}}{{classname}}{{/lambda.titlecase}}Resolvers = {
|
|
22
|
+
{{#operations}}
|
|
23
|
+
{{#operation}}
|
|
24
|
+
{{nickname}}: (info: ResponseResolverInfo<
|
|
25
|
+
HttpRequestResolverExtras<
|
|
26
|
+
{{! Parameters }}
|
|
27
|
+
{{#hasPathParams}}
|
|
28
|
+
{
|
|
29
|
+
{{#allParams}}
|
|
30
|
+
{{#isPathParam}}
|
|
31
|
+
{{paramName}}{{^required}}?{{/required}}: {{#isArray}}ReadonlyArray<{{/isArray}}string{{#isArray}}>{{/isArray}};
|
|
32
|
+
{{/isPathParam}}
|
|
33
|
+
{{/allParams}}
|
|
34
|
+
}
|
|
35
|
+
{{/hasPathParams}}
|
|
36
|
+
{{^hasPathParams}}
|
|
37
|
+
PathParams<never>
|
|
38
|
+
{{/hasPathParams}},
|
|
39
|
+
>
|
|
40
|
+
{{#hasQueryParams}}
|
|
41
|
+
& {
|
|
42
|
+
queryParams: {{#lambda.titlecase}}{{classname}}{{/lambda.titlecase}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}QueryParams;
|
|
43
|
+
}
|
|
44
|
+
{{/hasQueryParams}}
|
|
45
|
+
,
|
|
46
|
+
{{! Request body }}
|
|
47
|
+
{{#hasBodyParam}}
|
|
48
|
+
{{#bodyParam}}
|
|
49
|
+
{{{dataType}}}
|
|
50
|
+
{{/bodyParam}}
|
|
51
|
+
{{/hasBodyParam}}
|
|
52
|
+
{{^hasBodyParam}}
|
|
53
|
+
undefined
|
|
54
|
+
{{/hasBodyParam}},
|
|
55
|
+
>) => AsyncResponseResolverReturnType<
|
|
56
|
+
{{! Response }}
|
|
57
|
+
{{#returnType}}
|
|
58
|
+
{{#isResponseFile}}
|
|
59
|
+
Blob
|
|
60
|
+
{{/isResponseFile}}
|
|
61
|
+
{{^isResponseFile}}
|
|
62
|
+
{{{returnType}}}
|
|
63
|
+
{{/isResponseFile}}
|
|
64
|
+
{{/returnType}}
|
|
65
|
+
{{^returnType}}
|
|
66
|
+
undefined
|
|
67
|
+
{{/returnType}}
|
|
68
|
+
>;
|
|
69
|
+
{{/operation}}
|
|
70
|
+
{{/operations}}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
{{! Typed wrapper around query parameters }}
|
|
74
|
+
{{#operations}}
|
|
75
|
+
{{#operation}}
|
|
76
|
+
{{#hasQueryParams}}
|
|
77
|
+
const get{{#lambda.titlecase}}{{classname}}{{/lambda.titlecase}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}QueryParams = (url: string) => {
|
|
78
|
+
const { searchParams } = new URL(url);
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
{{#allParams}}
|
|
82
|
+
{{#isQueryParam}}
|
|
83
|
+
get {{paramName}}(): {{{dataType}}}{{^required}} | undefined{{/required}} {
|
|
84
|
+
{{#isArray}}
|
|
85
|
+
const values = searchParams.getAll('{{paramName}}');
|
|
86
|
+
return values as unknown as {{{dataType}}};
|
|
87
|
+
{{/isArray}}
|
|
88
|
+
{{^isArray}}
|
|
89
|
+
const value = searchParams.get('{{paramName}}');
|
|
90
|
+
|
|
91
|
+
{{!
|
|
92
|
+
Mustache doesn't have if..else statements, so we have to be really tricky
|
|
93
|
+
about supporting multiple data types here. We comment out each not relevant
|
|
94
|
+
type transformations.
|
|
95
|
+
}}
|
|
96
|
+
{{^isDate}}//{{/isDate}}return value ? new Date(value) : undefined;
|
|
97
|
+
{{^isInteger}}//{{/isInteger}}return value ? Number(value) : undefined;
|
|
98
|
+
|
|
99
|
+
return value as unknown as {{{dataType}}};
|
|
100
|
+
{{/isArray}}
|
|
101
|
+
},
|
|
102
|
+
{{/isQueryParam}}
|
|
103
|
+
{{/allParams}}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export type {{#lambda.titlecase}}{{classname}}{{/lambda.titlecase}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}QueryParams = ReturnType<
|
|
108
|
+
typeof get{{#lambda.titlecase}}{{classname}}{{/lambda.titlecase}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}QueryParams
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
{{/hasQueryParams}}
|
|
112
|
+
{{/operation}}
|
|
113
|
+
{{/operations}}
|
|
114
|
+
|
|
115
|
+
export function mock{{classname}}(resolvers: Partial<{{#lambda.titlecase}}{{classname}}{{/lambda.titlecase}}Resolvers>) {
|
|
116
|
+
const config = getMswSdkConfig();
|
|
117
|
+
|
|
118
|
+
const requestHandlers: RequestHandler[] = [];
|
|
119
|
+
|
|
120
|
+
{{#operations}}
|
|
121
|
+
{{#operation}}
|
|
122
|
+
const {{nickname}}Resolver = resolvers.{{nickname}};
|
|
123
|
+
if (typeof {{nickname}}Resolver !== 'undefined') {
|
|
124
|
+
requestHandlers.push(
|
|
125
|
+
http.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}<
|
|
126
|
+
{{! Parameters }}
|
|
127
|
+
{{#hasPathParams}}
|
|
128
|
+
{
|
|
129
|
+
{{#allParams}}
|
|
130
|
+
{{#isPathParam}}
|
|
131
|
+
{{paramName}}{{^required}}?{{/required}}: {{#isArray}}ReadonlyArray<{{/isArray}}string{{#isArray}}>{{/isArray}};
|
|
132
|
+
{{/isPathParam}}
|
|
133
|
+
{{/allParams}}
|
|
134
|
+
}
|
|
135
|
+
{{/hasPathParams}}
|
|
136
|
+
{{^hasPathParams}}
|
|
137
|
+
PathParams<never>
|
|
138
|
+
{{/hasPathParams}},
|
|
139
|
+
{{! Request body }}
|
|
140
|
+
{{#hasBodyParam}}
|
|
141
|
+
{{#bodyParam}}
|
|
142
|
+
{{{dataType}}}
|
|
143
|
+
{{/bodyParam}}
|
|
144
|
+
{{/hasBodyParam}}
|
|
145
|
+
{{^hasBodyParam}}
|
|
146
|
+
undefined
|
|
147
|
+
{{/hasBodyParam}},
|
|
148
|
+
{{! Response }}
|
|
149
|
+
{{#returnType}}
|
|
150
|
+
{{#isResponseFile}}
|
|
151
|
+
Blob
|
|
152
|
+
{{/isResponseFile}}
|
|
153
|
+
{{^isResponseFile}}
|
|
154
|
+
{{{returnType}}}
|
|
155
|
+
{{/isResponseFile}}
|
|
156
|
+
{{/returnType}}
|
|
157
|
+
{{^returnType}}
|
|
158
|
+
undefined
|
|
159
|
+
{{/returnType}}
|
|
160
|
+
>(`${config.baseUrl}${transformPathParams('{{path}}')}`, async (info) => {
|
|
161
|
+
await delay(config.delay);
|
|
162
|
+
|
|
163
|
+
{{#hasQueryParams}}
|
|
164
|
+
const queryParams = get{{#lambda.titlecase}}{{classname}}{{/lambda.titlecase}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}QueryParams(info.request.url);
|
|
165
|
+
return {{nickname}}Resolver({ ...info, queryParams });
|
|
166
|
+
{{/hasQueryParams}}
|
|
167
|
+
{{^hasQueryParams}}
|
|
168
|
+
return {{nickname}}Resolver(info);
|
|
169
|
+
{{/hasQueryParams}}
|
|
170
|
+
})
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
{{/operation}}
|
|
175
|
+
{{/operations}}
|
|
176
|
+
|
|
177
|
+
return requestHandlers;
|
|
178
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type MswSdkConfig = {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
delay?: [number, number];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
let config: MswSdkConfig | null = null;
|
|
7
|
+
|
|
8
|
+
export const setMswSdkConfig = ({ baseUrl, ...newConfig }: MswSdkConfig): void => {
|
|
9
|
+
config = {
|
|
10
|
+
delay: [100, 400],
|
|
11
|
+
// Replace any trailing slash in the baseUrl as all the paths are constructed with a leading slash.
|
|
12
|
+
baseUrl: baseUrl.replace(/\/+$/, ''),
|
|
13
|
+
...newConfig,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const getMswSdkConfig = (): Readonly<MswSdkConfig> => {
|
|
18
|
+
if (config === null) {
|
|
19
|
+
throw new Error('MSW SDK is not configured. Please configure it before using the SDK.');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return Object.freeze(config);
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
{{#apiInfo}}
|
|
4
|
+
{{#apis.0}}
|
|
5
|
+
export * from './apis/index{{importFileExtension}}';
|
|
6
|
+
{{/apis.0}}
|
|
7
|
+
{{/apiInfo}}
|
|
8
|
+
{{#models.0}}
|
|
9
|
+
export * from './models/index{{importFileExtension}}';
|
|
10
|
+
{{/models.0}}
|
|
11
|
+
export * from './config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{>modelEnumInterfaces}}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{npmName}}",
|
|
3
|
+
"version": "{{npmVersion}}",
|
|
4
|
+
"description": "OpenAPI client for {{npmName}}",
|
|
5
|
+
"author": "OpenAPI-Generator",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git"
|
|
9
|
+
},
|
|
10
|
+
{{#packageAsSourceOnlyLibrary}}
|
|
11
|
+
"main": "./index.ts",
|
|
12
|
+
{{/packageAsSourceOnlyLibrary}}
|
|
13
|
+
{{^packageAsSourceOnlyLibrary}}
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"typings": "./dist/index.d.ts",
|
|
16
|
+
"module": "./dist/esm/index.js",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc && tsc -p tsconfig.esm.json"{{^sagasAndRecords}},
|
|
20
|
+
"prepare": "npm run build"{{/sagasAndRecords}}
|
|
21
|
+
},
|
|
22
|
+
{{/packageAsSourceOnlyLibrary}}
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.9.3",
|
|
25
|
+
"prettier": "^3.7.4"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"msw": "^2.12.4"
|
|
29
|
+
}{{#npmRepository}},{{/npmRepository}}
|
|
30
|
+
{{#npmRepository}}
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"registry": "{{npmRepository}}"
|
|
33
|
+
}
|
|
34
|
+
{{/npmRepository}}
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"declaration": true,
|
|
4
|
+
"target": "es2022",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"typeRoots": [
|
|
9
|
+
"node_modules/@types"
|
|
10
|
+
],
|
|
11
|
+
"lib": ["es2022", "dom"],
|
|
12
|
+
"strictNullChecks": true
|
|
13
|
+
},
|
|
14
|
+
"exclude": [
|
|
15
|
+
"dist",
|
|
16
|
+
"node_modules"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export async function delay(config?: [number, number]): Promise<void> {
|
|
2
|
+
if (!config) return;
|
|
3
|
+
|
|
4
|
+
const [minDelay, maxDelay] = config;
|
|
5
|
+
const delayTime =
|
|
6
|
+
minDelay === maxDelay
|
|
7
|
+
? minDelay
|
|
8
|
+
: Math.floor(Math.random() * (maxDelay - minDelay) + minDelay);
|
|
9
|
+
|
|
10
|
+
return new Promise((resolve) => setTimeout(resolve, delayTime));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function transformPathParams(path: string): string {
|
|
14
|
+
return path.replaceAll(/\{([^}]+)\}/g, ':$1');
|
|
15
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dependency-lock-utils.sh
|
|
4
5
|
|
|
5
6
|
rm -rf out/$targetId
|
|
6
7
|
mkdir -p out/$targetId
|
|
@@ -38,6 +39,37 @@ rm unescape-patterns.js
|
|
|
38
39
|
node rewrite-path-parameters.js
|
|
39
40
|
rm rewrite-path-parameters.js
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
# Extract framework version for dependency locking
|
|
43
|
+
# Priority: 1. generatorCustomArgs override, 2. generator-config.json default
|
|
44
|
+
framework_version=""
|
|
45
|
+
|
|
46
|
+
# First, check if ngVersion is overridden in generatorCustomArgs
|
|
47
|
+
if [ -n "$generatorCustomArgs" ]; then
|
|
48
|
+
# Match patterns: -p ngVersion=X.X.X or -pngVersion=X.X.X
|
|
49
|
+
if [[ "$generatorCustomArgs" =~ -p[[:space:]]*ngVersion=([0-9]+\.[0-9]+\.[0-9]+) ]]; then
|
|
50
|
+
framework_version="${BASH_REMATCH[1]}"
|
|
51
|
+
echo "Using ngVersion from generatorCustomArgs: $framework_version"
|
|
52
|
+
fi
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Fall back to generator-config.json if not found in generatorCustomArgs
|
|
56
|
+
if [ -z "$framework_version" ] && command -v jq &> /dev/null; then
|
|
57
|
+
framework_version=$(jq -r '.ngVersion // empty' $(dirname "$0")/generator-config.json 2>/dev/null)
|
|
58
|
+
if [ -n "$framework_version" ]; then
|
|
59
|
+
echo "Using ngVersion from generator-config.json: $framework_version"
|
|
60
|
+
fi
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Use dependency locking mechanism for build
|
|
64
|
+
echo "Building NestJS target with dependency locking support..."
|
|
65
|
+
|
|
66
|
+
install_cmd="npm install"
|
|
67
|
+
build_cmd="npm run build"
|
|
68
|
+
|
|
69
|
+
if build_with_dependency_locking "$targetId" "$framework_version" "out/$targetId" "$install_cmd" "$build_cmd" "$forceLock"; then
|
|
70
|
+
echo "NestJS target generation completed successfully!"
|
|
71
|
+
else
|
|
72
|
+
echo "NestJS target generation failed!"
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
@@ -32,20 +32,11 @@ export abstract class {{classname}} {
|
|
|
32
32
|
// ||||||||||
|
|
33
33
|
/**
|
|
34
34
|
{{#summary}}
|
|
35
|
-
* {{.}}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* {{
|
|
39
|
-
|
|
40
|
-
{{#allParams}}
|
|
41
|
-
* @param {{paramName}} {{description}}
|
|
42
|
-
{{/allParams}}
|
|
43
|
-
{{#isDeprecated}}
|
|
44
|
-
* @deprecated
|
|
45
|
-
{{/isDeprecated}}
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
{{#authMethods}}{{#-first}}
|
|
35
|
+
* {{.}}{{/summary}}{{#notes}}
|
|
36
|
+
* {{.}}{{/notes}}{{#allParams}}
|
|
37
|
+
* @param {{paramName}} {{description}}{{/allParams}}{{#isDeprecated}}
|
|
38
|
+
* @deprecated{{/isDeprecated}}
|
|
39
|
+
*/{{#authMethods}}{{#-first}}
|
|
49
40
|
@AuthSchemes([{{#authMethods}}SecurityScheme.{{name}}{{^-last}}, {{/-last}}{{/authMethods}}])
|
|
50
41
|
@UseGuards(AuthGuard) {{/-first}}{{/authMethods}}
|
|
51
42
|
//// @{{httpMethod}}('{{path}}'){{#isMultipart}}
|
|
@@ -55,6 +46,9 @@ export abstract class {{classname}} {
|
|
|
55
46
|
return this.{{nickname}}({{#allParams.0}}{ params: { {{#allParams}}{{^isBodyParam}}{{^-first}}, {{/-first}}{{paramName}}{{/isBodyParam}}{{/allParams}} }{{#bodyParam}}, body: requestBody{{/bodyParam}} }, {{/allParams.0}}req, res);
|
|
56
47
|
}
|
|
57
48
|
|
|
49
|
+
/**
|
|
50
|
+
* `{{path}}`
|
|
51
|
+
*/
|
|
58
52
|
abstract {{nickname}}({{#allParams.0}}context: {{operationIdCamelCase}}Context, {{/allParams.0}}req?: unknown, res?: unknown): Promise<{{#returnType}}{{#isResponseFile}}StreamableFile{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/returnType}}{{^returnType}}void{{/returnType}}>;
|
|
59
53
|
|
|
60
54
|
{{/operation}}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dependency-lock-utils.sh
|
|
4
5
|
|
|
5
6
|
rm -rf out/$targetId
|
|
6
7
|
mkdir -p out/$targetId
|
|
@@ -13,7 +14,18 @@ java -jar $binary generate \
|
|
|
13
14
|
-c $(dirname "$0")/generator-config.json \
|
|
14
15
|
-p "npmVersion=$version,npmName=$packageName,npmRepository=$repository" $generatorCustomArgs
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
# No framework version for React target
|
|
18
|
+
framework_version=""
|
|
19
|
+
|
|
20
|
+
# Use dependency locking mechanism for build
|
|
21
|
+
echo "Building React target with dependency locking support..."
|
|
22
|
+
|
|
23
|
+
install_cmd="npm install"
|
|
24
|
+
build_cmd="npm run build"
|
|
25
|
+
|
|
26
|
+
if build_with_dependency_locking "$targetId" "$framework_version" "out/$targetId" "$install_cmd" "$build_cmd" "$forceLock"; then
|
|
27
|
+
echo "React target generation completed successfully!"
|
|
28
|
+
else
|
|
29
|
+
echo "React target generation failed!"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|