@tstdl/base 0.92.126 → 0.92.127

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.
@@ -43,13 +43,13 @@ export function compileClient(definition, options = defaultOptions) {
43
43
  const url = this.getEndpointResource(endpoint, parameters);
44
44
  return new URL(url, this[httpClientSymbol].options.baseUrl);
45
45
  }
46
- }
46
+ },
47
47
  }[apiName];
48
48
  Injector.registerSingleton(api, {
49
49
  useFactory: (argument, context) => {
50
50
  const httpClient = (argument instanceof HttpClient) ? argument : context.resolve(HttpClient, argument ?? options.defaultHttpClientOptions ?? undefined);
51
51
  return new api(httpClient);
52
- }
52
+ },
53
53
  });
54
54
  const endpointsEntries = normalizedApiDefinitionEndpointsEntries(endpoints);
55
55
  for (const [name, endpoint] of endpointsEntries) {
@@ -74,17 +74,17 @@ export function compileClient(definition, options = defaultOptions) {
74
74
  parameters,
75
75
  body: getRequestBody(requestBody),
76
76
  credentials: (endpoint.credentials == true) ? 'include' : undefined,
77
- context
77
+ context,
78
78
  });
79
79
  const response = await this[httpClientSymbol].rawRequest(request);
80
80
  return getResponseBody(response, endpoint.result);
81
- }
81
+ },
82
82
  }[name];
83
83
  Object.defineProperty(api.prototype, name, {
84
84
  enumerable: true,
85
85
  configurable: true,
86
86
  writable: true,
87
- value: apiEndpointFunction
87
+ value: apiEndpointFunction,
88
88
  });
89
89
  }
90
90
  return api;
package/api/types.d.ts CHANGED
@@ -82,7 +82,7 @@ export type ApiDefinition<Resource extends string = string, Endpoints extends Ap
82
82
  prefix?: string | null;
83
83
  endpoints: Endpoints;
84
84
  };
85
- export type ApiEndpointKeys<T extends ApiDefinition> = keyof T['endpoints'];
85
+ export type ApiEndpointKeys<T extends ApiDefinition> = Extract<keyof T['endpoints'], string>;
86
86
  export type NormalizedApiEndpoints<T extends ApiDefinition['endpoints']> = {
87
87
  [P in keyof T]: ReturnTypeOrT<T[P]>;
88
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.126",
3
+ "version": "0.92.127",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,10 +75,7 @@ export function Memoize() {
75
75
  cache.set(this, value);
76
76
  return value; // eslint-disable-line @typescript-eslint/no-unsafe-return
77
77
  }
78
- return {
79
- writable: false,
80
- get: cachedGetter,
81
- };
78
+ return { get: cachedGetter };
82
79
  },
83
80
  });
84
81
  }