Skip to content

Commit

Permalink
chore(#zimic): remove deprecated resources (#334) (#484)
Browse files Browse the repository at this point in the history
Closes #334.
  • Loading branch information
diego-aquino authored Nov 22, 2024
1 parent 11b6669 commit fca810f
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 161 deletions.
27 changes: 0 additions & 27 deletions apps/zimic-test-client/tests/exports/exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,14 @@ import {
type HttpSchema,
type HttpMethod,
type HttpStatusCode,
type HttpServiceSchema,
type HttpServiceMethodsSchema,
type HttpMethodsSchema,
type HttpServiceMethodSchema,
type HttpMethodSchema,
type HttpServiceRequestSchema,
type HttpRequestSchema,
type HttpServiceResponseSchemaByStatusCode,
type HttpResponseSchemaByStatusCode,
type HttpServiceResponseSchema,
type HttpResponseSchema,
type HttpServiceResponseSchemaStatusCode,
type HttpResponseSchemaStatusCode,
type HttpServiceSchemaMethod,
type HttpSchemaMethod,
type HttpServiceSchemaPath,
type HttpSchemaPath,
type LiteralHttpServiceSchemaPath,
type NonLiteralHttpServiceSchemaPath,
type PathParamsSchemaFromPath,
type InferPathParams,
type MergeHttpResponsesByStatusCode,
InvalidFormDataError,
Expand All @@ -64,7 +52,6 @@ import {
type LocalHttpInterceptorOptions,
type RemoteHttpInterceptorOptions,
type UnhandledRequestStrategy,
type ExtractHttpInterceptorSchema,
type InferHttpInterceptorSchema,
type HttpInterceptorRequest,
type HttpInterceptorResponse,
Expand Down Expand Up @@ -132,7 +119,6 @@ describe('Exports', () => {
expectTypeOf<StrictFormData<never>>().not.toBeAny();

expectTypeOf<HttpSchema<never>>().not.toBeAny();
expectTypeOf<HttpSchema.Paths<never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpSchema.Methods<never>>().not.toBeAny();
expectTypeOf<HttpSchema.Method<never>>().not.toBeAny();
expectTypeOf<HttpSchema.Request<never>>().not.toBeAny();
Expand All @@ -146,30 +132,18 @@ describe('Exports', () => {

expectTypeOf<HttpMethod>().not.toBeAny();
expectTypeOf<HttpStatusCode>().not.toBeAny();
expectTypeOf<HttpServiceSchema>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpSchema>().not.toBeAny();
expectTypeOf<HttpServiceMethodsSchema>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpMethodsSchema>().not.toBeAny();
expectTypeOf<HttpServiceMethodSchema>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpMethodSchema>().not.toBeAny();
expectTypeOf<HttpServiceRequestSchema>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpRequestSchema>().not.toBeAny();
expectTypeOf<HttpServiceResponseSchemaByStatusCode>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpResponseSchemaByStatusCode>().not.toBeAny();
expectTypeOf<HttpServiceResponseSchema>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpResponseSchema>().not.toBeAny();
expectTypeOf<HttpServiceResponseSchemaStatusCode<never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpResponseSchemaStatusCode<never>>().not.toBeAny();

expectTypeOf<HttpServiceSchemaMethod<never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpSchemaMethod<never>>().not.toBeAny();
expectTypeOf<HttpServiceSchemaPath<never, never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpSchemaPath<never, never>>().not.toBeAny();
expectTypeOf<LiteralHttpServiceSchemaPath<never, never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpSchemaPath.Literal<never, never>>().not.toBeAny();
expectTypeOf<NonLiteralHttpServiceSchemaPath<never, never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<HttpSchemaPath.NonLiteral<never, never>>().not.toBeAny();
expectTypeOf<PathParamsSchemaFromPath<never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<InferPathParams<never>>().not.toBeAny();
expectTypeOf<MergeHttpResponsesByStatusCode<never>>().not.toBeAny();

Expand Down Expand Up @@ -207,7 +181,6 @@ describe('Exports', () => {
expectTypeOf<HttpInterceptorOptions>().not.toBeAny();
expectTypeOf<LocalHttpInterceptorOptions>().not.toBeAny();
expectTypeOf<RemoteHttpInterceptorOptions>().not.toBeAny();
expectTypeOf<ExtractHttpInterceptorSchema<never>>().not.toBeAny(); // eslint-disable-line @typescript-eslint/no-deprecated
expectTypeOf<InferHttpInterceptorSchema<never>>().not.toBeAny();
expectTypeOf<HttpInterceptorRequest<never, never>>().not.toBeAny();
expectTypeOf<HttpInterceptorResponse<never, never>>().not.toBeAny();
Expand Down
28 changes: 0 additions & 28 deletions docs/wiki/api‐zimic‐http.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
- [`HttpSchemaPath`](#httpschemapath)
- [`HttpSchemaPath.Literal`](#httpschemapathliteral)
- [`HttpSchemaPath.NonLiteral`](#httpschemapathnonliteral)
- [`HttpServiceSchemaPath`](#httpserviceschemapath)
- [`LiteralHttpServiceSchemaPath`](#literalhttpserviceschemapath)
- [`NonLiteralHttpServiceSchemaPath`](#nonliteralhttpserviceschemapath)
- [`InferPathParams`](#inferpathparams)
- [`PathParamsSchemaFromPath`](#pathparamsschemafrompath)
- [`MergeHttpResponsesByStatusCode`](#mergehttpresponsesbystatuscode)

---
Expand Down Expand Up @@ -430,24 +426,6 @@ type NonLiteralGetPath = NonLiteralHttpSchemaPath<Schema, 'GET'>;
// "/users"
```

### `HttpServiceSchemaPath`

> [!WARNING]
>
> This type is **deprecated**. Please use [`HttpSchemaPath`](#httpschemapath) instead.
### `LiteralHttpServiceSchemaPath`

> [!WARNING]
>
> This type is **deprecated**. Please use [`HttpSchemaPath.Literal`](#httpschemapathliteral) instead.
### `NonLiteralHttpServiceSchemaPath`

> [!WARNING]
>
> This type is **deprecated**. Please use [`HttpSchemaPath.NonLiteral`](#httpschemapathnonliteral) instead.
### `InferPathParams`

Infers the path parameters schema from a path string, optionally validating it against an
Expand Down Expand Up @@ -480,12 +458,6 @@ type PathParams = InferPathParams<'/users/:userId'>;
// { userId: string }
```

### `PathParamsSchemaFromPath`

> [!WARNING]
>
> This type is **deprecated**. Please use [`InferPathParams`](#inferpathparams) instead.
### `MergeHttpResponsesByStatusCode`

Merges multiple HTTP response schemas by status code into a single schema. When there are duplicate status codes, the
Expand Down
8 changes: 0 additions & 8 deletions docs/wiki/api‐zimic‐interceptor‐http.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
- [HTTP `interceptor.clear()`](#http-interceptorclear)
- [`HttpInterceptor` utility types](#httpinterceptor-utility-types)
- [`InferHttpInterceptorSchema`](#inferhttpinterceptorschema)
- [`ExtractHttpInterceptorSchema`](#extracthttpinterceptorschema)
- [`HttpRequestHandler`](#httprequesthandler)
- [HTTP `handler.method()`](#http-handlermethod)
- [HTTP `handler.path()`](#http-handlerpath)
Expand Down Expand Up @@ -469,13 +468,6 @@ type Schema = InferHttpInterceptorSchema<typeof interceptor>;
// }
```

#### `ExtractHttpInterceptorSchema`

> [!WARNING]
>
> This type is **deprecated** and was renamed to [`InferHttpInterceptorSchema`](#inferhttpinterceptorschema) with no
> changes in behavior. Please use [`InferHttpInterceptorSchema`](#inferhttpinterceptorschema) instead.
## `HttpRequestHandler`

HTTP request handlers allow declaring HTTP responses to return for intercepted requests. They also keep track of the
Expand Down
62 changes: 0 additions & 62 deletions packages/zimic/src/http/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
import {
HttpMethodSchema,
HttpMethodsSchema,
HttpRequestSchema,
HttpResponseSchema,
HttpResponseSchemaByStatusCode,
HttpResponseSchemaStatusCode,
HttpSchema,
HttpSchemaMethod,
HttpSchemaPath,
InferPathParams,
} from './types/schema';

export { default as InvalidFormDataError } from './errors/InvalidFormDataError';

export { default as HttpFormData } from './formData/HttpFormData';
Expand Down Expand Up @@ -45,55 +32,6 @@ export type {
StrictFormData,
} from './types/requests';

/** @deprecated Use {@link HttpSchema} instead, which is a drop-in replacement. */
export type HttpServiceSchema = HttpSchema;

/** @deprecated Use {@link HttpRequestSchema} instead, which is a drop-in replacement. */
export type HttpServiceRequestSchema = HttpRequestSchema;

/** @deprecated Use {@link HttpResponseSchema} instead, which is a drop-in replacement. */
export type HttpServiceResponseSchema = HttpResponseSchema;

/** @deprecated Use {@link HttpResponseSchemaByStatusCode} instead, which is a drop-in replacement. */
export type HttpServiceResponseSchemaByStatusCode = HttpResponseSchemaByStatusCode;

/** @deprecated Use {@link HttpResponseSchemaStatusCode} instead, which is a drop-in replacement. */
export type HttpServiceResponseSchemaStatusCode<ResponseSchemaByStatusCode extends HttpResponseSchemaByStatusCode> =
HttpResponseSchemaStatusCode<ResponseSchemaByStatusCode>;

/** @deprecated Use {@link HttpMethodSchema} instead, which is a drop-in replacement. */
export type HttpServiceMethodSchema = HttpMethodSchema;

/** @deprecated Use {@link HttpMethodsSchema} instead, which is a drop-in replacement. */
export type HttpServiceMethodsSchema = HttpMethodsSchema;

/** @deprecated Use {@link HttpSchemaMethod} instead, which is a drop-in replacement. */
export type HttpServiceSchemaMethod<Schema extends HttpSchema> = HttpSchemaMethod<Schema>;

/** @deprecated Use {@link HttpSchemaPath.Literal} instead, which is a drop-in replacement. */
export type LiteralHttpServiceSchemaPath<
Schema extends HttpSchema,
Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,
> = HttpSchemaPath.Literal<Schema, Method>;

/** @deprecated Use {@link HttpSchemaPath.NonLiteral} instead, which is a drop-in replacement. */
export type NonLiteralHttpServiceSchemaPath<
Schema extends HttpSchema,
Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,
> = HttpSchemaPath.NonLiteral<Schema, Method>;

/** @deprecated Use {@link HttpSchemaPath} instead, which is a drop-in replacement. */
export type HttpServiceSchemaPath<
Schema extends HttpSchema,
Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,
> = HttpSchemaPath<Schema, Method>;

/**
* @deprecated Use {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#inferpathparams `InferPathParams` }
* instead, which is a drop-in replacement with additional validation.
*/
export type PathParamsSchemaFromPath<Path extends string> = InferPathParams<Path>;

export type {
HttpSchema,
HttpMethod,
Expand Down
29 changes: 0 additions & 29 deletions packages/zimic/src/http/types/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,6 @@ export namespace HttpResponseSchemaByStatusCode {
[StatusCode in keyof Schema]: StatusCode extends 204 ? HttpResponseSchema.NoBody : Schema[StatusCode];
};

/**
* A schema representing the strict structure of HTTP responses by status code.
*
* @deprecated Use {@link HttpResponseSchemaByStatusCode} directly instead.
*/
export type Strict = ConvertToStrict<Loose>;

/** A schema representing the structure of HTTP responses by status code with no body. */
export type NoBody = {
[StatusCode in HttpStatusCode]?: HttpResponseSchema.NoBody;
Expand Down Expand Up @@ -331,28 +324,6 @@ export type ConvertToStrictHttpSchema<Schema extends HttpSchema> = {
export type HttpSchema<Schema extends BaseHttpSchema = BaseHttpSchema> = ConvertToStrictHttpSchema<Schema>;

export namespace HttpSchema {
/**
* Declares an HTTP service schema.
*
* **IMPORTANT**: the input of `HttpSchema.Paths` and all of its internal types, except bodies, must be declared
* inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.
*
* @deprecated Use {@link HttpSchema} directly instead, which is a drop-in replacement.
* @example
* import { type HttpSchema } from 'zimic/http';
*
* type Schema = HttpSchema<{
* '/users': {
* GET: {
* response: {
* 200: { body: User[] };
* };
* };
* };
* }>;
*/
export type Paths<Schema extends BaseHttpSchema> = ConvertToStrictHttpSchema<Schema>;

/**
* Declares an HTTP service methods schema.
*
Expand Down
7 changes: 0 additions & 7 deletions packages/zimic/src/interceptor/http/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { InferHttpInterceptorSchema } from './interceptor/types/schema';
import HttpInterceptorNamespace from './namespace/HttpInterceptorNamespace';

export { default as NotStartedHttpInterceptorError } from './interceptor/errors/NotStartedHttpInterceptorError';
Expand Down Expand Up @@ -39,12 +38,6 @@ export type {
UnhandledRequestStrategy,
} from './interceptor/types/options';

/**
* @deprecated Use
* {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#inferpathparams `InferHttpInterceptorSchema` }
* instead, which is a drop-in replacement.
*/
export type ExtractHttpInterceptorSchema<Interceptor> = InferHttpInterceptorSchema<Interceptor>;
export type { InferHttpInterceptorSchema } from './interceptor/types/schema';

export type { LocalHttpInterceptor, RemoteHttpInterceptor, HttpInterceptor } from './interceptor/types/public';
Expand Down

0 comments on commit fca810f

Please sign in to comment.