@canton-network/core-token-standard 1.14.0 → 1.15.0

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Logger, PartyId } from '@canton-network/core-types';
2
1
  import { AccessTokenProvider } from '@canton-network/core-wallet-auth';
3
2
  import * as damlTypes from '@daml/types';
3
+ import { PartyId } from '@canton-network/core-types';
4
4
 
5
5
  interface paths$4 {
6
6
  '/registry/allocations/v1/{allocationId}/choice-contexts/execute-transfer': {
@@ -1006,6 +1006,7 @@ declare namespace transferInstructionV1 {
1006
1006
  export type { transferInstructionV1_$defs as $defs, transferInstructionV1_components as components, transferInstructionV1_operations as operations, paths$1 as paths, transferInstructionV1_webhooks as webhooks };
1007
1007
  }
1008
1008
 
1009
+ type Logger = Pick<Console, 'debug' | 'info' | 'warn' | 'error'>;
1009
1010
  type paths = paths$4 & paths$2 & paths$1 & paths$3;
1010
1011
  type PostEndpoint = {
1011
1012
  [Pathname in keyof paths]: paths[Pathname] extends {
package/dist/index.js CHANGED
@@ -31,21 +31,17 @@ class TokenStandardClient {
31
31
  baseUrl,
32
32
  fetch: async (url, options = {}) => {
33
33
  const accessToken = await this.accessTokenProvider.getAccessToken();
34
- return fetch(url, {
35
- ...options,
36
- headers: {
37
- ...(options.headers || {}),
38
- ...(accessToken
39
- ? { Authorization: `Bearer ${accessToken}` }
40
- : {}),
41
- 'Content-Type': 'application/json',
42
- },
43
- });
34
+ const headers = new Headers(options.headers);
35
+ if (accessToken) {
36
+ headers.set('Authorization', `Bearer ${accessToken}`);
37
+ }
38
+ headers.set('Content-Type', 'application/json');
39
+ return fetch(url, { ...options, headers });
44
40
  },
45
41
  });
46
42
  }
47
43
  async post(path, body, params) {
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- (cant align this with openapi-fetch generics :shrug:)
44
+ // oxlint-disable-next-line typescript/no-explicit-any -- (cant align this with openapi-fetch generics :shrug:)
49
45
  const options = { body, params };
50
46
  this.logger.debug({ requestBody: body }, `POST ${path}`);
51
47
  const resp = await this.client.POST(path, options);
@@ -53,7 +49,7 @@ class TokenStandardClient {
53
49
  return this.valueOrError(resp);
54
50
  }
55
51
  async get(path, params) {
56
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- (cant align this with openapi-fetch generics :shrug:)
52
+ // oxlint-disable-next-line typescript/no-explicit-any -- (cant align this with openapi-fetch generics :shrug:)
57
53
  const options = { params };
58
54
  const resp = await this.client.GET(path, options);
59
55
  this.logger.debug({ path: path, params: params, response: resp }, `GET ${path}`);