@robosystems/client 1.13.2 → 1.14.1

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.
Files changed (60) hide show
  1. package/artifacts/LedgerClient.d.ts +26 -1
  2. package/artifacts/LedgerClient.js +27 -1
  3. package/artifacts/LedgerClient.ts +53 -1
  4. package/artifacts/OperatorClient.js +2 -2
  5. package/artifacts/OperatorClient.ts +3 -2
  6. package/artifacts/QueryClient.js +1 -1
  7. package/artifacts/QueryClient.ts +1 -1
  8. package/artifacts/SSEClient.js +1 -1
  9. package/artifacts/SSEClient.ts +2 -1
  10. package/artifacts/graphql/client.js +1 -1
  11. package/artifacts/graphql/client.ts +2 -1
  12. package/artifacts/graphql/generated/graphql.d.ts +312 -2526
  13. package/artifacts/graphql/generated/graphql.js +173 -2
  14. package/artifacts/graphql/generated/graphql.ts +493 -2658
  15. package/artifacts/graphql/queries/ledger/journalEntries.d.ts +14 -0
  16. package/artifacts/graphql/queries/ledger/journalEntries.js +75 -0
  17. package/artifacts/graphql/queries/ledger/journalEntries.ts +73 -0
  18. package/client/index.d.ts +2 -0
  19. package/client/index.ts +2 -0
  20. package/client/utils.gen.d.ts +1 -1
  21. package/client/utils.gen.ts +2 -2
  22. package/client.gen.d.ts +2 -2
  23. package/client.gen.ts +2 -2
  24. package/core/auth.gen.d.ts +7 -0
  25. package/core/auth.gen.ts +7 -0
  26. package/core/params.gen.d.ts +2 -2
  27. package/core/params.gen.js +21 -13
  28. package/core/params.gen.ts +21 -12
  29. package/core/pathSerializer.gen.ts +6 -6
  30. package/core/queryKeySerializer.gen.d.ts +1 -1
  31. package/core/queryKeySerializer.gen.ts +1 -1
  32. package/core/types.gen.d.ts +5 -0
  33. package/core/types.gen.ts +6 -0
  34. package/core/utils.gen.ts +4 -4
  35. package/package.json +11 -8
  36. package/sdk/client/index.d.ts +2 -0
  37. package/sdk/client/index.ts +2 -0
  38. package/sdk/client/utils.gen.d.ts +1 -1
  39. package/sdk/client/utils.gen.ts +2 -2
  40. package/sdk/client.gen.d.ts +2 -2
  41. package/sdk/client.gen.ts +2 -2
  42. package/sdk/core/auth.gen.d.ts +7 -0
  43. package/sdk/core/auth.gen.ts +7 -0
  44. package/sdk/core/params.gen.d.ts +2 -2
  45. package/sdk/core/params.gen.js +21 -13
  46. package/sdk/core/params.gen.ts +21 -12
  47. package/sdk/core/pathSerializer.gen.ts +6 -6
  48. package/sdk/core/queryKeySerializer.gen.d.ts +1 -1
  49. package/sdk/core/queryKeySerializer.gen.ts +1 -1
  50. package/sdk/core/types.gen.d.ts +5 -0
  51. package/sdk/core/types.gen.ts +6 -0
  52. package/sdk/core/utils.gen.ts +4 -4
  53. package/sdk/sdk.gen.d.ts +199 -199
  54. package/sdk/sdk.gen.ts +199 -199
  55. package/sdk/types.gen.d.ts +35 -2
  56. package/sdk/types.gen.ts +35 -2
  57. package/sdk.gen.d.ts +199 -199
  58. package/sdk.gen.ts +199 -199
  59. package/types.gen.d.ts +35 -2
  60. package/types.gen.ts +35 -2
@@ -14,8 +14,8 @@ import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'
14
14
  export const createQuerySerializer = <T = unknown>({
15
15
  parameters = {},
16
16
  ...args
17
- }: QuerySerializerOptions = {}) => {
18
- const querySerializer = (queryParams: T) => {
17
+ }: QuerySerializerOptions = {}): ((queryParams: T) => string) => {
18
+ const querySerializer = (queryParams: T): string => {
19
19
  const search: string[] = [];
20
20
  if (queryParams && typeof queryParams === 'object') {
21
21
  for (const name in queryParams) {
@@ -1,4 +1,4 @@
1
- import { type ClientOptions, type Config } from './client';
1
+ import { type Client, type ClientOptions, type Config } from './client';
2
2
  import type { ClientOptions as ClientOptions2 } from './types.gen';
3
3
  /**
4
4
  * The `createClientConfig()` function will be called on client initialization
@@ -9,4 +9,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
9
9
  * to ensure your client always has the correct values.
10
10
  */
11
11
  export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
12
- export declare const client: import("./client").Client;
12
+ export declare const client: Client;
package/sdk/client.gen.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- import { type ClientOptions, type Config, createClient, createConfig } from './client';
3
+ import { type Client, type ClientOptions, type Config, createClient, createConfig } from './client';
4
4
  import type { ClientOptions as ClientOptions2 } from './types.gen';
5
5
 
6
6
  /**
@@ -13,4 +13,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
13
13
  */
14
14
  export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
15
15
 
16
- export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:8000' }));
16
+ export const client: Client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:8000' }));
@@ -6,6 +6,13 @@ export interface Auth {
6
6
  * @default 'header'
7
7
  */
8
8
  in?: 'header' | 'query' | 'cookie';
9
+ /**
10
+ * A unique identifier for the security scheme.
11
+ *
12
+ * Defined only when there are multiple security schemes whose `Auth`
13
+ * shape would otherwise be identical.
14
+ */
15
+ key?: string;
9
16
  /**
10
17
  * Header or query parameter name.
11
18
  *
@@ -9,6 +9,13 @@ export interface Auth {
9
9
  * @default 'header'
10
10
  */
11
11
  in?: 'header' | 'query' | 'cookie';
12
+ /**
13
+ * A unique identifier for the security scheme.
14
+ *
15
+ * Defined only when there are multiple security schemes whose `Auth`
16
+ * shape would otherwise be identical.
17
+ */
18
+ key?: string;
12
19
  /**
13
20
  * Header or query parameter name.
14
21
  *
@@ -34,10 +34,10 @@ export interface Fields {
34
34
  }
35
35
  export type FieldsConfig = ReadonlyArray<Field | Fields>;
36
36
  interface Params {
37
- body: unknown;
37
+ body?: unknown;
38
38
  headers: Record<string, unknown>;
39
39
  path: Record<string, unknown>;
40
40
  query: Record<string, unknown>;
41
41
  }
42
- export declare const buildClientParams: (args: ReadonlyArray<unknown>, fields: FieldsConfig) => Params;
42
+ export declare function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params;
43
43
  export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // This file is auto-generated by @hey-api/openapi-ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.buildClientParams = void 0;
4
+ exports.buildClientParams = buildClientParams;
5
5
  const extraPrefixesMap = {
6
6
  $body_: 'body',
7
7
  $headers_: 'headers',
@@ -9,7 +9,7 @@ const extraPrefixesMap = {
9
9
  $query_: 'query',
10
10
  };
11
11
  const extraPrefixes = Object.entries(extraPrefixesMap);
12
- const buildKeyMap = (fields, map) => {
12
+ function buildKeyMap(fields, map) {
13
13
  if (!map) {
14
14
  map = new Map();
15
15
  }
@@ -32,22 +32,31 @@ const buildKeyMap = (fields, map) => {
32
32
  }
33
33
  }
34
34
  return map;
35
- };
36
- const stripEmptySlots = (params) => {
35
+ }
36
+ function stripEmptySlots(params) {
37
37
  for (const [slot, value] of Object.entries(params)) {
38
+ if (slot === 'body')
39
+ continue;
38
40
  if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
39
41
  delete params[slot];
40
42
  }
41
43
  }
42
- };
43
- const buildClientParams = (args, fields) => {
44
+ }
45
+ function buildClientParams(args, fields) {
44
46
  const params = {
45
- body: Object.create(null),
46
47
  headers: Object.create(null),
47
48
  path: Object.create(null),
48
49
  query: Object.create(null),
49
50
  };
50
51
  const map = buildKeyMap(fields);
52
+ function writeSlot(slot, key, value) {
53
+ let record = params[slot];
54
+ if (record === undefined) {
55
+ record = Object.create(null);
56
+ params[slot] = record;
57
+ }
58
+ record[key] = value;
59
+ }
51
60
  let config;
52
61
  for (const [index, arg] of args.entries()) {
53
62
  if (fields[index]) {
@@ -61,7 +70,7 @@ const buildClientParams = (args, fields) => {
61
70
  const field = map.get(config.key);
62
71
  const name = field.map || config.key;
63
72
  if (field.in) {
64
- params[field.in][name] = arg;
73
+ writeSlot(field.in, name, arg);
65
74
  }
66
75
  }
67
76
  else {
@@ -74,7 +83,7 @@ const buildClientParams = (args, fields) => {
74
83
  if (field) {
75
84
  if (field.in) {
76
85
  const name = field.map || key;
77
- params[field.in][name] = value;
86
+ writeSlot(field.in, name, value);
78
87
  }
79
88
  else {
80
89
  params[field.map] = value;
@@ -84,12 +93,12 @@ const buildClientParams = (args, fields) => {
84
93
  const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
85
94
  if (extra) {
86
95
  const [prefix, slot] = extra;
87
- params[slot][key.slice(prefix.length)] = value;
96
+ writeSlot(slot, key.slice(prefix.length), value);
88
97
  }
89
98
  else if ('allowExtra' in config && config.allowExtra) {
90
99
  for (const [slot, allowed] of Object.entries(config.allowExtra)) {
91
100
  if (allowed) {
92
- params[slot][key] = value;
101
+ writeSlot(slot, key, value);
93
102
  break;
94
103
  }
95
104
  }
@@ -100,5 +109,4 @@ const buildClientParams = (args, fields) => {
100
109
  }
101
110
  stripEmptySlots(params);
102
111
  return params;
103
- };
104
- exports.buildClientParams = buildClientParams;
112
+ }
@@ -62,7 +62,7 @@ type KeyMap = Map<
62
62
  }
63
63
  >;
64
64
 
65
- const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
65
+ function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
66
66
  if (!map) {
67
67
  map = new Map();
68
68
  }
@@ -85,26 +85,26 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
85
85
  }
86
86
 
87
87
  return map;
88
- };
88
+ }
89
89
 
90
90
  interface Params {
91
- body: unknown;
91
+ body?: unknown;
92
92
  headers: Record<string, unknown>;
93
93
  path: Record<string, unknown>;
94
94
  query: Record<string, unknown>;
95
95
  }
96
96
 
97
- const stripEmptySlots = (params: Params) => {
97
+ function stripEmptySlots(params: Params): void {
98
98
  for (const [slot, value] of Object.entries(params)) {
99
+ if (slot === 'body') continue;
99
100
  if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
100
101
  delete params[slot as Slot];
101
102
  }
102
103
  }
103
- };
104
+ }
104
105
 
105
- export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
106
+ export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
106
107
  const params: Params = {
107
- body: Object.create(null),
108
108
  headers: Object.create(null),
109
109
  path: Object.create(null),
110
110
  query: Object.create(null),
@@ -112,6 +112,15 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
112
112
 
113
113
  const map = buildKeyMap(fields);
114
114
 
115
+ function writeSlot(slot: Slot, key: string, value: unknown): void {
116
+ let record = params[slot] as Record<string, unknown> | undefined;
117
+ if (record === undefined) {
118
+ record = Object.create(null) as Record<string, unknown>;
119
+ params[slot] = record;
120
+ }
121
+ record[key] = value;
122
+ }
123
+
115
124
  let config: FieldsConfig[number] | undefined;
116
125
 
117
126
  for (const [index, arg] of args.entries()) {
@@ -128,7 +137,7 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
128
137
  const field = map.get(config.key)!;
129
138
  const name = field.map || config.key;
130
139
  if (field.in) {
131
- (params[field.in] as Record<string, unknown>)[name] = arg;
140
+ writeSlot(field.in, name, arg);
132
141
  }
133
142
  } else {
134
143
  params.body = arg;
@@ -140,7 +149,7 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
140
149
  if (field) {
141
150
  if (field.in) {
142
151
  const name = field.map || key;
143
- (params[field.in] as Record<string, unknown>)[name] = value;
152
+ writeSlot(field.in, name, value);
144
153
  } else {
145
154
  params[field.map] = value;
146
155
  }
@@ -149,11 +158,11 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
149
158
 
150
159
  if (extra) {
151
160
  const [prefix, slot] = extra;
152
- (params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value;
161
+ writeSlot(slot, key.slice(prefix.length), value);
153
162
  } else if ('allowExtra' in config && config.allowExtra) {
154
163
  for (const [slot, allowed] of Object.entries(config.allowExtra)) {
155
164
  if (allowed) {
156
- (params[slot as Slot] as Record<string, unknown>)[key] = value;
165
+ writeSlot(slot as Slot, key, value);
157
166
  break;
158
167
  }
159
168
  }
@@ -166,4 +175,4 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
166
175
  stripEmptySlots(params);
167
176
 
168
177
  return params;
169
- };
178
+ }
@@ -25,7 +25,7 @@ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
25
25
  value: string;
26
26
  }
27
27
 
28
- export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
28
+ export const separatorArrayExplode = (style: ArraySeparatorStyle): '.' | ';' | ',' | '&' => {
29
29
  switch (style) {
30
30
  case 'label':
31
31
  return '.';
@@ -38,7 +38,7 @@ export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
38
38
  }
39
39
  };
40
40
 
41
- export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
41
+ export const separatorArrayNoExplode = (style: ArraySeparatorStyle): ',' | '|' | '%20' => {
42
42
  switch (style) {
43
43
  case 'form':
44
44
  return ',';
@@ -51,7 +51,7 @@ export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
51
51
  }
52
52
  };
53
53
 
54
- export const separatorObjectExplode = (style: ObjectSeparatorStyle) => {
54
+ export const separatorObjectExplode = (style: ObjectSeparatorStyle): '.' | ';' | ',' | '&' => {
55
55
  switch (style) {
56
56
  case 'label':
57
57
  return '.';
@@ -72,7 +72,7 @@ export const serializeArrayParam = ({
72
72
  value,
73
73
  }: SerializeOptions<ArraySeparatorStyle> & {
74
74
  value: unknown[];
75
- }) => {
75
+ }): string => {
76
76
  if (!explode) {
77
77
  const joinedValues = (
78
78
  allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
@@ -110,7 +110,7 @@ export const serializePrimitiveParam = ({
110
110
  allowReserved,
111
111
  name,
112
112
  value,
113
- }: SerializePrimitiveParam) => {
113
+ }: SerializePrimitiveParam): string => {
114
114
  if (value === undefined || value === null) {
115
115
  return '';
116
116
  }
@@ -134,7 +134,7 @@ export const serializeObjectParam = ({
134
134
  }: SerializeOptions<ObjectSeparatorStyle> & {
135
135
  value: Record<string, unknown> | Date;
136
136
  valueOnly?: boolean;
137
- }) => {
137
+ }): string => {
138
138
  if (value instanceof Date) {
139
139
  return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
140
140
  }
@@ -7,7 +7,7 @@ export type JsonValue = null | string | number | boolean | JsonValue[] | {
7
7
  /**
8
8
  * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
9
9
  */
10
- export declare const queryKeyJsonReplacer: (_key: string, value: unknown) => unknown;
10
+ export declare const queryKeyJsonReplacer: (_key: string, value: unknown) => unknown | undefined;
11
11
  /**
12
12
  * Safely stringifies a value and parses it back into a JsonValue.
13
13
  */
@@ -14,7 +14,7 @@ export type JsonValue =
14
14
  /**
15
15
  * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
16
16
  */
17
- export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
17
+ export const queryKeyJsonReplacer = (_key: string, value: unknown): unknown | undefined => {
18
18
  if (value === undefined || typeof value === 'function' || typeof value === 'symbol') {
19
19
  return undefined;
20
20
  }
@@ -71,6 +71,11 @@ export interface Config {
71
71
  */
72
72
  responseValidator?: (data: unknown) => Promise<unknown>;
73
73
  }
74
+ /**
75
+ * Arbitrary metadata passed through the `meta` request option.
76
+ */
77
+ export interface ClientMeta {
78
+ }
74
79
  type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] ? true : [T] extends [never | undefined] ? [undefined] extends [T] ? false : true : false;
75
80
  export type OmitNever<T extends Record<string, unknown>> = {
76
81
  [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
@@ -91,6 +91,12 @@ export interface Config {
91
91
  responseValidator?: (data: unknown) => Promise<unknown>;
92
92
  }
93
93
 
94
+ /**
95
+ * Arbitrary metadata passed through the `meta` request option.
96
+ */
97
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
98
+ export interface ClientMeta {}
99
+
94
100
  type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
95
101
  ? true
96
102
  : [T] extends [never | undefined]
@@ -13,9 +13,9 @@ export interface PathSerializer {
13
13
  url: string;
14
14
  }
15
15
 
16
- export const PATH_PARAM_RE = /\{[^{}]+\}/g;
16
+ export const PATH_PARAM_RE: RegExp = /\{[^{}]+\}/g;
17
17
 
18
- export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
18
+ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer): string => {
19
19
  let url = _url;
20
20
  const matches = _url.match(PATH_PARAM_RE);
21
21
  if (matches) {
@@ -94,7 +94,7 @@ export const getUrl = ({
94
94
  query?: Record<string, unknown>;
95
95
  querySerializer: QuerySerializer;
96
96
  url: string;
97
- }) => {
97
+ }): string => {
98
98
  const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
99
99
  let url = (baseUrl ?? '') + pathUrl;
100
100
  if (path) {
@@ -114,7 +114,7 @@ export function getValidRequestBody(options: {
114
114
  body?: unknown;
115
115
  bodySerializer?: BodySerializer | null;
116
116
  serializedBody?: unknown;
117
- }) {
117
+ }): unknown {
118
118
  const hasBody = options.body !== undefined;
119
119
  const isSerializedBody = hasBody && options.bodySerializer;
120
120