@bitstack/ng-query-codegen-openapi 0.0.30 → 0.0.31-alpha.0
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 +8 -1
- package/lib/bin/cli.mjs +70 -57
- package/lib/bin/cli.mjs.map +1 -1
- package/lib/index.d.mts +4 -18
- package/lib/index.d.ts +4 -18
- package/lib/index.js +343 -275
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +343 -275
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/bin/utils.ts +74 -3
- package/src/generators/common-types-generator.ts +6 -2
- package/src/generators/component-schema-generator.ts +40 -7
- package/src/generators/do-not-modify-generator.ts +2 -2
- package/src/generators/rtk-enhance-endpoints-generator.ts +113 -0
- package/src/generators/{query-service-generator.ts → rtk-query-generator.ts} +45 -33
- package/src/generators/tag-types-generator.ts +30 -0
- package/src/generators/types-generator.ts +216 -112
- package/src/generators/utils-generator.ts +2 -4
- package/src/index.ts +6 -3
- package/src/services/api-code-generator.ts +62 -74
- package/src/services/endpoint-info-extractor.ts +66 -14
- package/src/services/file-writer-service.ts +27 -23
- package/src/services/openapi-parser-service.ts +10 -2
- package/src/services/unified-code-generator.ts +55 -26
- package/src/types.ts +19 -45
- package/src/generators/api-service-generator.ts +0 -112
- package/src/generators/cache-keys-generator.ts +0 -43
- package/src/generators/index-generator.ts +0 -11
- package/src/services/api-service-generator.ts +0 -24
- package/src/services/query-code-generator.ts +0 -24
package/lib/index.d.mts
CHANGED
|
@@ -46,12 +46,12 @@ interface CommonOptions {
|
|
|
46
46
|
importName: string;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* HTTP client configuration for API calls
|
|
50
50
|
* defaults to { file: "@core/httpClient/webapi/webapi-http-client.providers", importName: "WEBAPI_HTTP_CLIENT" }
|
|
51
51
|
*/
|
|
52
52
|
httpClient?: {
|
|
53
53
|
file: string;
|
|
54
|
-
|
|
54
|
+
importReturnTypeName: string;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* defaults to "enhancedApi"
|
|
@@ -71,13 +71,9 @@ interface CommonOptions {
|
|
|
71
71
|
operationNameSuffix?: string;
|
|
72
72
|
/**
|
|
73
73
|
* defaults to `false`
|
|
74
|
-
* `true` will generate
|
|
74
|
+
* `true` will generate lazy query hooks (useLazy prefix) for query endpoints
|
|
75
75
|
*/
|
|
76
|
-
|
|
77
|
-
queries: boolean;
|
|
78
|
-
lazyQueries: boolean;
|
|
79
|
-
mutations: boolean;
|
|
80
|
-
};
|
|
76
|
+
useLazyQueries?: boolean;
|
|
81
77
|
/**
|
|
82
78
|
* defaults to false
|
|
83
79
|
* `true` will generate a union type for `undefined` properties like: `{ id?: string | undefined }` instead of `{ id?: string }`
|
|
@@ -131,11 +127,6 @@ interface CommonOptions {
|
|
|
131
127
|
* File path for importing IRestFulEndpointsQueryReturn type
|
|
132
128
|
*/
|
|
133
129
|
endpointsQueryReturnTypeFile?: string;
|
|
134
|
-
/**
|
|
135
|
-
* defaults to 60 (seconds)
|
|
136
|
-
* Number of seconds to wait before refetching data when component mounts or args change
|
|
137
|
-
*/
|
|
138
|
-
refetchOnMountOrArgChange?: number;
|
|
139
130
|
}
|
|
140
131
|
type TextMatcher = string | RegExp | (string | RegExp)[];
|
|
141
132
|
type EndpointMatcherFunction = (operationName: string, operationDefinition: OperationDefinition) => boolean;
|
|
@@ -147,11 +138,6 @@ interface OutputFileOptions extends Partial<CommonOptions> {
|
|
|
147
138
|
filterEndpoints?: EndpointMatcher;
|
|
148
139
|
endpointOverrides?: EndpointOverrides[];
|
|
149
140
|
queryMatch?: (method: string, path: string) => boolean;
|
|
150
|
-
/**
|
|
151
|
-
* defaults to false
|
|
152
|
-
* If passed as true it will generate TS enums instead of union of strings
|
|
153
|
-
*/
|
|
154
|
-
useEnumType?: boolean;
|
|
155
141
|
sharedTypesFile?: string;
|
|
156
142
|
/**
|
|
157
143
|
* groupKey for service class naming, e.g., "room" -> "RoomService"
|
package/lib/index.d.ts
CHANGED
|
@@ -46,12 +46,12 @@ interface CommonOptions {
|
|
|
46
46
|
importName: string;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* HTTP client configuration for API calls
|
|
50
50
|
* defaults to { file: "@core/httpClient/webapi/webapi-http-client.providers", importName: "WEBAPI_HTTP_CLIENT" }
|
|
51
51
|
*/
|
|
52
52
|
httpClient?: {
|
|
53
53
|
file: string;
|
|
54
|
-
|
|
54
|
+
importReturnTypeName: string;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* defaults to "enhancedApi"
|
|
@@ -71,13 +71,9 @@ interface CommonOptions {
|
|
|
71
71
|
operationNameSuffix?: string;
|
|
72
72
|
/**
|
|
73
73
|
* defaults to `false`
|
|
74
|
-
* `true` will generate
|
|
74
|
+
* `true` will generate lazy query hooks (useLazy prefix) for query endpoints
|
|
75
75
|
*/
|
|
76
|
-
|
|
77
|
-
queries: boolean;
|
|
78
|
-
lazyQueries: boolean;
|
|
79
|
-
mutations: boolean;
|
|
80
|
-
};
|
|
76
|
+
useLazyQueries?: boolean;
|
|
81
77
|
/**
|
|
82
78
|
* defaults to false
|
|
83
79
|
* `true` will generate a union type for `undefined` properties like: `{ id?: string | undefined }` instead of `{ id?: string }`
|
|
@@ -131,11 +127,6 @@ interface CommonOptions {
|
|
|
131
127
|
* File path for importing IRestFulEndpointsQueryReturn type
|
|
132
128
|
*/
|
|
133
129
|
endpointsQueryReturnTypeFile?: string;
|
|
134
|
-
/**
|
|
135
|
-
* defaults to 60 (seconds)
|
|
136
|
-
* Number of seconds to wait before refetching data when component mounts or args change
|
|
137
|
-
*/
|
|
138
|
-
refetchOnMountOrArgChange?: number;
|
|
139
130
|
}
|
|
140
131
|
type TextMatcher = string | RegExp | (string | RegExp)[];
|
|
141
132
|
type EndpointMatcherFunction = (operationName: string, operationDefinition: OperationDefinition) => boolean;
|
|
@@ -147,11 +138,6 @@ interface OutputFileOptions extends Partial<CommonOptions> {
|
|
|
147
138
|
filterEndpoints?: EndpointMatcher;
|
|
148
139
|
endpointOverrides?: EndpointOverrides[];
|
|
149
140
|
queryMatch?: (method: string, path: string) => boolean;
|
|
150
|
-
/**
|
|
151
|
-
* defaults to false
|
|
152
|
-
* If passed as true it will generate TS enums instead of union of strings
|
|
153
|
-
*/
|
|
154
|
-
useEnumType?: boolean;
|
|
155
141
|
sharedTypesFile?: string;
|
|
156
142
|
/**
|
|
157
143
|
* groupKey for service class naming, e.g., "room" -> "RoomService"
|