Skip to content

Commit 7480727

Browse files
authored
feat: re-export renamed v1 APIs as deprecated aliases (#1758)
Code written against v1 breaks on v2 for a set of APIs that were only renamed, not changed — the import fails with "no exported member" and gives no hint at the new name. This adds deprecated aliases for those, so v1 code keeps compiling and the IDE points at the current name via `@deprecated`.
1 parent c2bca33 commit 7480727

11 files changed

Lines changed: 155 additions & 0 deletions

File tree

packages/client/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export * from './error-utils'
1414
export * from './rpc-json-serializer'
1515
export * from './rpc-serializer'
1616
export * from './types'
17+
export type {
18+
/**
19+
* @deprecated Use `InferClientError` instead.
20+
*/
21+
InferClientError as InferClientErrorUnion,
22+
} from './types'
1723
export * from './utils'
1824

1925
export type {
@@ -55,6 +61,13 @@ export {
5561
streamToAsyncIteratorObject as streamToEventIterator,
5662
} from '@orpc/shared'
5763

64+
export type {
65+
/**
66+
* @deprecated Use `PromiseWithError` instead.
67+
*/
68+
PromiseWithError as ClientPromiseResult,
69+
} from '@orpc/shared'
70+
5871
export type {
5972
EventMeta,
6073
} from '@standardserver/core'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
11
export * from './batch'
22
export * from './dedupe'
3+
export {
4+
/**
5+
* @deprecated Use `DedupeLinkPlugin` instead.
6+
*/
7+
DedupeLinkPlugin as DedupeRequestsPlugin,
8+
} from './dedupe'
39
export * from './request-compression'
410
export * from './response-compression'
511
export * from './retry'
12+
export {
13+
/**
14+
* @deprecated Use `RetryLinkPlugin` instead.
15+
*/
16+
RetryLinkPlugin as ClientRetryPlugin,
17+
} from './retry'
18+
export type {
19+
/**
20+
* @deprecated Use `RetryLinkPluginContext` instead.
21+
*/
22+
RetryLinkPluginContext as ClientRetryPluginContext,
23+
} from './retry'
624
export * from './retry-after'
25+
export {
26+
/**
27+
* @deprecated Use `RetryAfterLinkPlugin` instead.
28+
*/
29+
RetryAfterLinkPlugin as RetryAfterPlugin,
30+
} from './retry-after'
731
export * from './timeout'

packages/contract/src/index.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,44 @@ export * from './meta'
77
export * from './meta-built-in'
88
export * from './meta-utils'
99
export * from './procedure'
10+
export type {
11+
/**
12+
* @deprecated Use `AnyProcedureContract` instead.
13+
*/
14+
AnyProcedureContract as AnyContractProcedure,
15+
} from './procedure'
1016
export * from './procedure-client'
1117
export * from './router'
18+
export type {
19+
/**
20+
* @deprecated Use `RouterContract` instead.
21+
*/
22+
RouterContract as AnyContractRouter,
23+
/**
24+
* @deprecated Use `InferRouterContractErrorMap` instead.
25+
*/
26+
InferRouterContractErrorMap as InferContractRouterErrorMap,
27+
/**
28+
* @deprecated Use `InferRouterContractInputs` instead.
29+
*/
30+
InferRouterContractInputs as InferContractRouterInputs,
31+
/**
32+
* @deprecated Use `InferRouterContractOutputs` instead.
33+
*/
34+
InferRouterContractOutputs as InferContractRouterOutputs,
35+
} from './router'
1236
export * from './router-client'
1337
export * from './router-utils'
38+
export {
39+
/**
40+
* @deprecated Use `getRouterContract` instead.
41+
*/
42+
getRouterContract as getContractRouter,
43+
/**
44+
* @deprecated Use `minifyRouterContract` instead.
45+
*/
46+
minifyRouterContract as minifyContractRouter,
47+
} from './router-utils'
1448
export * from './schema'
1549
export * from './schema-built-in'
1650
export {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
export * from './request-validation'
2+
export {
3+
/**
4+
* @deprecated Use `RequestValidationLinkPlugin` instead.
5+
*/
6+
RequestValidationLinkPlugin as RequestValidationPlugin,
7+
} from './request-validation'
28
export * from './response-validation'
9+
export {
10+
/**
11+
* @deprecated Use `ResponseValidationLinkPlugin` instead.
12+
*/
13+
ResponseValidationLinkPlugin as ResponseValidationPlugin,
14+
} from './response-validation'

packages/next/src/hooks/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
export * from './optimistic-server-function'
2+
export {
3+
/**
4+
* @deprecated Use `useOptimisticServerFunction` instead.
5+
*/
6+
useOptimisticServerFunction as useOptimisticServerAction,
7+
} from './optimistic-server-function'
28
export * from './server-function'
9+
export {
10+
/**
11+
* @deprecated Use `useServerFunction` instead.
12+
*/
13+
useServerFunction as useServerAction,
14+
} from './server-function'

packages/next/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
export * from './deferred-interceptors'
22
export * from './server-form-function'
3+
export {
4+
/**
5+
* @deprecated Use `createServerFormFunction` instead.
6+
*/
7+
createServerFormFunction as createFormAction,
8+
} from './server-form-function'
39
export * from './server-form-functionable'
410
export * from './server-function'
511
export * from './server-functionable'

packages/pinia-colada/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ export * from './meta'
55
export * from './plugin'
66
export * from './procedure-utils'
77
export * from './router-utils'
8+
export {
9+
/**
10+
* @deprecated Use `createRouterUtils` instead.
11+
*/
12+
createRouterUtils as createORPCVueColadaUtils,
13+
} from './router-utils'
814
export {
915
createRouterUtils as createPiniaColadaUtils,
1016
} from './router-utils'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
export {
2+
/**
3+
* @deprecated Use `RequestLimitHandlerPlugin` from `@orpc/server/plugins` instead.
4+
*/
5+
RequestLimitHandlerPlugin as BodyLimitPlugin,
6+
} from '../../plugins/request-limit'
17
export * from './handler'
28
export * from './plugin'
39
export * from './rpc-handler'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
export {
2+
/**
3+
* @deprecated Use `RequestLimitHandlerPlugin` from `@orpc/server/plugins` instead.
4+
*/
5+
RequestLimitHandlerPlugin as BodyLimitPlugin,
6+
} from '../../plugins/request-limit'
17
export * from './handler'
28
export * from './plugin'
39
export * from './rpc-handler'

packages/server/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export * from './procedure-client'
1414
export * from './procedure-decorated'
1515
export * from './procedure-utils'
1616
export * from './router'
17+
export type {
18+
/**
19+
* @deprecated Use `InferRouterFinalContexts` instead.
20+
*/
21+
InferRouterFinalContexts as InferRouterCurrentContexts,
22+
} from './router'
1723
export * from './router-client'
1824
export * from './router-hidden'
1925
export * from './router-utils'

0 commit comments

Comments
 (0)