@azure-net/kit 0.6.5 → 0.6.7

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,6 +1,6 @@
1
1
  export declare enum AppLayers {
2
- INFRASTRUCTURE = "infrastructure",
3
- DOMAIN = "domain",
4
- APPLICATION = "application",
5
- PRESENTATION = "presentation"
2
+ INFRASTRUCTURE = "Infrastructure",
3
+ DOMAIN = "Domain",
4
+ APPLICATION = "Application",
5
+ PRESENTATION = "Presentation"
6
6
  }
@@ -1,7 +1,7 @@
1
1
  export var AppLayers;
2
2
  (function (AppLayers) {
3
- AppLayers["INFRASTRUCTURE"] = "infrastructure";
4
- AppLayers["DOMAIN"] = "domain";
5
- AppLayers["APPLICATION"] = "application";
6
- AppLayers["PRESENTATION"] = "presentation";
3
+ AppLayers["INFRASTRUCTURE"] = "Infrastructure";
4
+ AppLayers["DOMAIN"] = "Domain";
5
+ AppLayers["APPLICATION"] = "Application";
6
+ AppLayers["PRESENTATION"] = "Presentation";
7
7
  })(AppLayers || (AppLayers = {}));
@@ -1,5 +1,5 @@
1
1
  import { HttpServiceResponse } from '../httpService/index.js';
2
- export declare class UseCasesHandler {
2
+ export declare class ResourceService {
3
3
  protected transformResponse<TData extends object, TResult = TData, TKey extends keyof TData | undefined = undefined>(requestPromise: Promise<HttpServiceResponse<TData>>, options?: {
4
4
  responseModel?: {
5
5
  new (response: HttpServiceResponse<TData>): {
@@ -1,5 +1,5 @@
1
1
  import { HttpServiceResponse } from '../httpService/index.js';
2
- export class UseCasesHandler {
2
+ export class ResourceService {
3
3
  async transformResponse(requestPromise, options) {
4
4
  const response = await requestPromise;
5
5
  if (options?.responseModel) {
@@ -1 +1 @@
1
- export * from './UseCasesHandler.js';
1
+ export * from './ResourceService.js';
@@ -1 +1 @@
1
- export * from './UseCasesHandler.js';
1
+ export * from './ResourceService.js';
@@ -1,33 +1,35 @@
1
1
  import { HttpService, HttpServiceResponse } from '../httpService/HttpService.js';
2
2
  import { QueryBuilder } from '../query/index.js';
3
- type ApplyWrapper<TWrapper, T, TDataKey extends keyof TWrapper> = TWrapper extends Record<TDataKey, unknown> ? Omit<TWrapper, TDataKey> & {
4
- [K in TDataKey]: T;
5
- } : T;
6
- export interface IHttpDatasource<TWrapper = never, TDataKey extends keyof TWrapper = never> {
7
- createRequest<T>(callback: <J = ApplyWrapper<TWrapper, T, TDataKey>>(params: {
3
+ export interface IDatasource {
4
+ /**
5
+ * Executes a wrapped HTTP request and handles the response.
6
+ *
7
+ * @param callback - A function that receives the HttpService and returns a Promise of a response.
8
+ * @returns A typed HTTP response wrapped in a Promise.
9
+ */
10
+ createRequest<T>(callback: <J = T>(params: {
8
11
  http: HttpService;
9
12
  query: QueryBuilder;
10
- }) => Promise<HttpServiceResponse<J>>): Promise<HttpServiceResponse<ApplyWrapper<TWrapper, T, TDataKey>>>;
13
+ }) => Promise<HttpServiceResponse<J>>): Promise<HttpServiceResponse<T>>;
11
14
  createRawRequest<T>(callback: (params: {
12
15
  http: HttpService;
13
16
  query: QueryBuilder;
14
17
  }) => Promise<HttpServiceResponse<T>>): Promise<HttpServiceResponse<T>>;
15
18
  }
16
- export declare class BaseHttpDatasource<TWrapper = never, TDataKey extends keyof TWrapper = never> implements IHttpDatasource<TWrapper, TDataKey> {
19
+ export declare class BaseHttpDatasource implements IDatasource {
17
20
  protected readonly httpClient: HttpService;
18
21
  protected readonly query: QueryBuilder;
19
22
  constructor(params: {
20
23
  http?: HttpService;
21
24
  query?: QueryBuilder;
22
25
  });
23
- createRequest<T>(callback: <J = ApplyWrapper<TWrapper, T, TDataKey>>(params: {
26
+ createRequest<T>(callback: <J = T>(params: {
24
27
  http: HttpService;
25
28
  query: QueryBuilder;
26
- }) => Promise<HttpServiceResponse<J>>): Promise<HttpServiceResponse<ApplyWrapper<TWrapper, T, TDataKey>>>;
29
+ }) => Promise<HttpServiceResponse<J>>): Promise<HttpServiceResponse<T>>;
27
30
  private _createRawRequest;
28
31
  readonly createRawRequest: <T>(callback: (params: {
29
32
  http: HttpService;
30
33
  query: QueryBuilder;
31
34
  }) => Promise<HttpServiceResponse<T>>) => Promise<HttpServiceResponse<T>>;
32
35
  }
33
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-net/kit",
3
- "version": "0.6.5",
3
+ "version": "0.6.7",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",