Skip to content

Commit 1919405

Browse files
committed
chore: remove deprecated APIs
1 parent ac638b7 commit 1919405

File tree

32 files changed

+356
-269
lines changed

32 files changed

+356
-269
lines changed

dev/openapi-ts.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ export default defineConfig(() => {
4444
// 'full.yaml',
4545
// 'object-property-names.yaml',
4646
// 'openai.yaml',
47-
'opencode.yaml',
47+
// 'opencode.yaml',
4848
// 'pagination-ref.yaml',
4949
// 'sdk-instance.yaml',
50+
'sdk-nested-classes.yaml',
5051
// 'string-with-format.yaml',
5152
// 'transformers.json',
5253
// 'transformers-recursive.json',

packages/codegen-core/src/symbols/registry.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export class SymbolRegistry implements ISymbolRegistry {
1111
private _id: SymbolId = 0;
1212
private _indices: Map<IndexEntry[0], Map<IndexEntry[1], Set<SymbolId>>> =
1313
new Map();
14-
/**
15-
* @deprecated
16-
*/
17-
private _nodes: Map<SymbolId, unknown> = new Map();
1814
private _queryCache: Map<QueryCacheKey, ReadonlyArray<SymbolId>> = new Map();
1915
private _queryCacheDependencies: Map<QueryCacheKey, Set<QueryCacheKey>> =
2016
new Map();
@@ -29,13 +25,6 @@ export class SymbolRegistry implements ISymbolRegistry {
2925
: this.query(identifier)[0];
3026
}
3127

32-
/**
33-
* @deprecated
34-
*/
35-
getValue(symbolId: SymbolId): unknown {
36-
return this._nodes.get(symbolId);
37-
}
38-
3928
isRegistered(identifier: ISymbolIdentifier): boolean {
4029
const symbol = this.get(identifier);
4130
return symbol ? this._registered.has(symbol.id) : false;
@@ -122,13 +111,6 @@ export class SymbolRegistry implements ISymbolRegistry {
122111
}
123112
}
124113

125-
/**
126-
* @deprecated
127-
*/
128-
setValue(symbolId: SymbolId, value: unknown): Map<SymbolId, unknown> {
129-
return this._nodes.set(symbolId, value);
130-
}
131-
132114
private buildCacheKey(filter: ISymbolMeta): QueryCacheKey {
133115
const indexKeySpace = this.buildIndexKeySpace(filter);
134116
return indexKeySpace

packages/codegen-core/src/symbols/types.d.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ export interface ISymbolRegistry {
7474
* @returns The symbol, or undefined if not found.
7575
*/
7676
get(identifier: ISymbolIdentifier): Symbol | undefined;
77-
/**
78-
* Returns the value associated with a symbol ID.
79-
*
80-
* @param symbolId Symbol ID.
81-
* @return The value associated with the symbol ID, or undefined if not found.
82-
*/
83-
getValue(symbolId: number): unknown;
8477
/**
8578
* Returns whether a symbol is registered in the registry.
8679
*
@@ -123,12 +116,4 @@ export interface ISymbolRegistry {
123116
* @returns Array of all registered symbols, in insert order.
124117
*/
125118
registered(): IterableIterator<Symbol>;
126-
/**
127-
* Sets a value for a symbol by its ID.
128-
*
129-
* @param symbolId Symbol ID.
130-
* @param value The value to set.
131-
* @returns void
132-
*/
133-
setValue(symbolId: number, value: unknown): Map<number, unknown>;
134119
}

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/sdk.gen.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ class HeyApiClient {
2828
}
2929
}
3030

31+
class HeyApiRegistry<T> {
32+
private readonly defaultKey = 'default';
33+
34+
private readonly instances: Map<string, T> = new Map();
35+
36+
get(key?: string): T {
37+
const instance = this.instances.get(key ?? this.defaultKey);
38+
if (!instance) {
39+
throw new Error(`No SDK client found. Create one with "new NestedSdkWithInstance()" to fix this error.`);
40+
}
41+
return instance;
42+
}
43+
44+
set(value: T, key?: string): void {
45+
this.instances.set(key ?? this.defaultKey, value);
46+
}
47+
}
48+
3149
export class Domains extends HeyApiClient {
3250
public get<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsGetData, ThrowOnError>) {
3351
return (options?.client ?? this.client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ url: '/business/providers/domains', ...options });
@@ -50,24 +68,6 @@ export class Business extends HeyApiClient {
5068
providers = new Providers({ client: this.client });
5169
}
5270

53-
class HeyApiRegistry<T> {
54-
private readonly defaultKey = 'default';
55-
56-
private readonly instances: Map<string, T> = new Map();
57-
58-
get(key?: string): T {
59-
const instance = this.instances.get(key ?? this.defaultKey);
60-
if (!instance) {
61-
throw new Error(`No SDK client found. Create one with "new NestedSdkWithInstance()" to fix this error.`);
62-
}
63-
return instance;
64-
}
65-
66-
set(value: T, key?: string): void {
67-
this.instances.set(key ?? this.defaultKey, value);
68-
}
69-
}
70-
7171
export class NestedSdkWithInstance extends HeyApiClient {
7272
public static readonly __registry = new HeyApiRegistry<NestedSdkWithInstance>();
7373

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/sdk.gen.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ class HeyApiClient {
2828
}
2929
}
3030

31+
class HeyApiRegistry<T> {
32+
private readonly defaultKey = 'default';
33+
34+
private readonly instances: Map<string, T> = new Map();
35+
36+
get(key?: string): T {
37+
const instance = this.instances.get(key ?? this.defaultKey);
38+
if (!instance) {
39+
throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`);
40+
}
41+
return instance;
42+
}
43+
44+
set(value: T, key?: string): void {
45+
this.instances.set(key ?? this.defaultKey, value);
46+
}
47+
}
48+
3149
export class Bar extends HeyApiClient {
3250
public post<ThrowOnError extends boolean = false>(options?: Options<FooBarPostData, ThrowOnError>) {
3351
return (options?.client ?? this.client).post<FooBarPostResponses, unknown, ThrowOnError>({ url: '/foo/bar', ...options });
@@ -50,24 +68,6 @@ export class Foo extends HeyApiClient {
5068
bar = new Bar({ client: this.client });
5169
}
5270

53-
class HeyApiRegistry<T> {
54-
private readonly defaultKey = 'default';
55-
56-
private readonly instances: Map<string, T> = new Map();
57-
58-
get(key?: string): T {
59-
const instance = this.instances.get(key ?? this.defaultKey);
60-
if (!instance) {
61-
throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`);
62-
}
63-
return instance;
64-
}
65-
66-
set(value: T, key?: string): void {
67-
this.instances.set(key ?? this.defaultKey, value);
68-
}
69-
}
70-
7171
export class Sdk extends HeyApiClient {
7272
public static readonly __registry = new HeyApiRegistry<Sdk>();
7373

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/sdk.gen.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as v from 'valibot';
44

55
import type { Client, Options as Options2, TDataShape } from './client';
66
import { client } from './client.gen';
7+
import { postFooResponseTransformer } from './transformers.gen';
78
import type { PostFooData, PostFooResponses } from './types.gen';
89
import { vPostFooData, vPostFooResponse } from './valibot.gen';
910

@@ -23,6 +24,7 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
2324

2425
export const postFoo = <ThrowOnError extends boolean = false>(options?: Options<PostFooData, ThrowOnError>) => (options?.client ?? client).post<PostFooResponses, unknown, ThrowOnError>({
2526
requestValidator: async (data) => await v.parseAsync(vPostFooData, data),
27+
responseTransformer: postFooResponseTransformer,
2628
responseValidator: async (data) => await v.parseAsync(vPostFooResponse, data),
2729
url: '/foo',
2830
...options
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
import type { PostFooResponse } from './types.gen';
4+
35
const fooSchemaResponseTransformer = (data: any) => {
46
data.foo = BigInt(data.foo.toString());
57
return data;
68
};
9+
10+
export const postFooResponseTransformer = async (data: any): Promise<PostFooResponse> => {
11+
data = fooSchemaResponseTransformer(data);
12+
return data;
13+
};

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/sdk.gen.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import type { Client, Options as Options2, TDataShape } from './client';
44
import { client } from './client.gen';
5+
import { postFooResponseTransformer } from './transformers.gen';
56
import type { PostFooData, PostFooResponses } from './types.gen';
67
import { zPostFooData, zPostFooResponse } from './zod.gen';
78

@@ -21,6 +22,7 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
2122

2223
export const postFoo = <ThrowOnError extends boolean = false>(options?: Options<PostFooData, ThrowOnError>) => (options?.client ?? client).post<PostFooResponses, unknown, ThrowOnError>({
2324
requestValidator: async (data) => await zPostFooData.parseAsync(data),
25+
responseTransformer: postFooResponseTransformer,
2426
responseValidator: async (data) => await zPostFooResponse.parseAsync(data),
2527
url: '/foo',
2628
...options
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
import type { PostFooResponse } from './types.gen';
4+
35
const fooSchemaResponseTransformer = (data: any) => {
46
data.foo = BigInt(data.foo.toString());
57
return data;
68
};
9+
10+
export const postFooResponseTransformer = async (data: any): Promise<PostFooResponse> => {
11+
data = fooSchemaResponseTransformer(data);
12+
return data;
13+
};

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/sdk.gen.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ class HeyApiClient {
2828
}
2929
}
3030

31+
class HeyApiRegistry<T> {
32+
private readonly defaultKey = 'default';
33+
34+
private readonly instances: Map<string, T> = new Map();
35+
36+
get(key?: string): T {
37+
const instance = this.instances.get(key ?? this.defaultKey);
38+
if (!instance) {
39+
throw new Error(`No SDK client found. Create one with "new NestedSdkWithInstance()" to fix this error.`);
40+
}
41+
return instance;
42+
}
43+
44+
set(value: T, key?: string): void {
45+
this.instances.set(key ?? this.defaultKey, value);
46+
}
47+
}
48+
3149
export class Domains extends HeyApiClient {
3250
public get<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsGetData, ThrowOnError>) {
3351
return (options?.client ?? this.client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ url: '/business/providers/domains', ...options });
@@ -50,24 +68,6 @@ export class Business extends HeyApiClient {
5068
providers = new Providers({ client: this.client });
5169
}
5270

53-
class HeyApiRegistry<T> {
54-
private readonly defaultKey = 'default';
55-
56-
private readonly instances: Map<string, T> = new Map();
57-
58-
get(key?: string): T {
59-
const instance = this.instances.get(key ?? this.defaultKey);
60-
if (!instance) {
61-
throw new Error(`No SDK client found. Create one with "new NestedSdkWithInstance()" to fix this error.`);
62-
}
63-
return instance;
64-
}
65-
66-
set(value: T, key?: string): void {
67-
this.instances.set(key ?? this.defaultKey, value);
68-
}
69-
}
70-
7171
export class NestedSdkWithInstance extends HeyApiClient {
7272
public static readonly __registry = new HeyApiRegistry<NestedSdkWithInstance>();
7373

0 commit comments

Comments
 (0)