@empathyco/x-adapter 8.1.0-alpha.19 → 8.1.0-alpha.20
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/endpoint-adapter/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HttpClient, RequestOptions } from '../http-clients/types'\nimport type { Mapper } from '../mappers/types'\n\n/**\n * Connects with a given API endpoint. Transforms the request object into something the API\n * can understand, makes the request, and transforms back the API response into the desired shape.\n *\n * @public\n */\nexport interface EndpointAdapter<Request, Response> {\n /**\n * Triggers a request with the given data.\n *\n * @param request - The initial source request object.\n * @param options - Additional options to make the request with.\n * @returns A response promise.\n */\n (request: Request, options?: RequestOptions): Promise<Response>\n}\n\n/**\n * Adds extends functionality to an {@link EndpointAdapter}.\n *\n * @public\n */\nexport interface ExtendableEndpointAdapter<Request, Response
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/endpoint-adapter/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HttpClient, RequestOptions } from '../http-clients/types'\nimport type { Mapper } from '../mappers/types'\n\n/**\n * Connects with a given API endpoint. Transforms the request object into something the API\n * can understand, makes the request, and transforms back the API response into the desired shape.\n *\n * @public\n */\nexport interface EndpointAdapter<Request, Response> {\n /**\n * Triggers a request with the given data.\n *\n * @param request - The initial source request object.\n * @param options - Additional options to make the request with.\n * @returns A response promise.\n */\n (request: Request, options?: RequestOptions): Promise<Response>\n}\n\n/**\n * Adds extends functionality to an {@link EndpointAdapter}.\n *\n * @public\n */\nexport interface ExtendableEndpointAdapter<Request, Response> extends EndpointAdapter<\n Request,\n Response\n> {\n /**\n * Extends the endpoint adapter, merging its options with the new ones, creating a new\n * {@link ExtendableEndpointAdapter} object.\n *\n * @param options - New options to extend the {@link ExtendableEndpointAdapter} with.\n * @returns A new adapter created by merging the new and old options.\n */\n extends: <NewRequest = Request, NewResponse = Response>(\n options: Partial<EndpointAdapterOptions<NewRequest, NewResponse>>,\n ) => ExtendableEndpointAdapter<NewRequest, NewResponse>\n}\n\n/**\n * Creates an {@link ExtendableEndpointAdapter} with the given options.\n *\n * @param options - Options to create the endpoint adapter with.\n * @returns A brand-new {@link ExtendableEndpointAdapter} instance.\n * @public\n */\nexport type EndpointAdapterFactory = <Request, Response>(\n options: EndpointAdapterOptions<Request, Response>,\n) => ExtendableEndpointAdapter<Request, Response>\n\n/**\n * Options to create an adapter with.\n *\n * @public\n */\nexport interface EndpointAdapterOptions<Request, Response> {\n /**\n * The endpoint to request the information to. If the endpoint can only be decided at run-time you\n * can ignore this property and use {@link RequestOptions.endpoint} parameter.\n */\n endpoint?: string | Mapper<Request, string>\n /**\n * The {@link HttpClient} to use for the requests.\n */\n httpClient?: HttpClient\n /**\n * The default {@link RequestOptions} to use every request.\n */\n defaultRequestOptions?: Omit<RequestOptions, 'endpoint'>\n /**\n * The {@link Mapper} in charge of adapting the request object so the backend API can\n * understand it.\n */\n requestMapper?: Mapper<Request, Record<string, any>>\n /**\n * The {@link Mapper} in charge of adapting the response object to whatever format or\n * shape it is needed.\n */\n responseMapper?: Mapper<any, Response>\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/endpoint-adapter/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HttpClient, RequestOptions } from '../http-clients/types'\nimport type { Mapper } from '../mappers/types'\n\n/**\n * Connects with a given API endpoint. Transforms the request object into something the API\n * can understand, makes the request, and transforms back the API response into the desired shape.\n *\n * @public\n */\nexport interface EndpointAdapter<Request, Response> {\n /**\n * Triggers a request with the given data.\n *\n * @param request - The initial source request object.\n * @param options - Additional options to make the request with.\n * @returns A response promise.\n */\n (request: Request, options?: RequestOptions): Promise<Response>\n}\n\n/**\n * Adds extends functionality to an {@link EndpointAdapter}.\n *\n * @public\n */\nexport interface ExtendableEndpointAdapter<Request, Response
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/endpoint-adapter/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HttpClient, RequestOptions } from '../http-clients/types'\nimport type { Mapper } from '../mappers/types'\n\n/**\n * Connects with a given API endpoint. Transforms the request object into something the API\n * can understand, makes the request, and transforms back the API response into the desired shape.\n *\n * @public\n */\nexport interface EndpointAdapter<Request, Response> {\n /**\n * Triggers a request with the given data.\n *\n * @param request - The initial source request object.\n * @param options - Additional options to make the request with.\n * @returns A response promise.\n */\n (request: Request, options?: RequestOptions): Promise<Response>\n}\n\n/**\n * Adds extends functionality to an {@link EndpointAdapter}.\n *\n * @public\n */\nexport interface ExtendableEndpointAdapter<Request, Response> extends EndpointAdapter<\n Request,\n Response\n> {\n /**\n * Extends the endpoint adapter, merging its options with the new ones, creating a new\n * {@link ExtendableEndpointAdapter} object.\n *\n * @param options - New options to extend the {@link ExtendableEndpointAdapter} with.\n * @returns A new adapter created by merging the new and old options.\n */\n extends: <NewRequest = Request, NewResponse = Response>(\n options: Partial<EndpointAdapterOptions<NewRequest, NewResponse>>,\n ) => ExtendableEndpointAdapter<NewRequest, NewResponse>\n}\n\n/**\n * Creates an {@link ExtendableEndpointAdapter} with the given options.\n *\n * @param options - Options to create the endpoint adapter with.\n * @returns A brand-new {@link ExtendableEndpointAdapter} instance.\n * @public\n */\nexport type EndpointAdapterFactory = <Request, Response>(\n options: EndpointAdapterOptions<Request, Response>,\n) => ExtendableEndpointAdapter<Request, Response>\n\n/**\n * Options to create an adapter with.\n *\n * @public\n */\nexport interface EndpointAdapterOptions<Request, Response> {\n /**\n * The endpoint to request the information to. If the endpoint can only be decided at run-time you\n * can ignore this property and use {@link RequestOptions.endpoint} parameter.\n */\n endpoint?: string | Mapper<Request, string>\n /**\n * The {@link HttpClient} to use for the requests.\n */\n httpClient?: HttpClient\n /**\n * The default {@link RequestOptions} to use every request.\n */\n defaultRequestOptions?: Omit<RequestOptions, 'endpoint'>\n /**\n * The {@link Mapper} in charge of adapting the request object so the backend API can\n * understand it.\n */\n requestMapper?: Mapper<Request, Record<string, any>>\n /**\n * The {@link Mapper} in charge of adapting the response object to whatever format or\n * shape it is needed.\n */\n responseMapper?: Mapper<any, Response>\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-adapter",
|
|
3
|
-
"version": "8.1.0-alpha.
|
|
3
|
+
"version": "8.1.0-alpha.20",
|
|
4
4
|
"description": "A utils library to create a client for any API",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "40f69f71765aab241849f325ce7834fa8d15a6e2"
|
|
58
58
|
}
|