wapi-client 0.10.4 → 0.10.6

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 (54) hide show
  1. package/dist/api/base-client.browser.cjs +27 -8
  2. package/dist/api/base-client.browser.js +28 -9
  3. package/dist/api/base-client.cjs +27 -8
  4. package/dist/api/base-client.d.ts +6 -2
  5. package/dist/api/base-client.js +28 -9
  6. package/dist/api/http-client.browser.cjs +47 -21
  7. package/dist/api/http-client.browser.js +47 -21
  8. package/dist/api/http-client.cjs +47 -21
  9. package/dist/api/http-client.d.ts +2 -2
  10. package/dist/api/http-client.js +47 -21
  11. package/dist/api/index.d.ts +4 -0
  12. package/dist/api/ws-client.browser.cjs +26 -10
  13. package/dist/api/ws-client.browser.js +27 -11
  14. package/dist/api/ws-client.cjs +27 -11
  15. package/dist/api/ws-client.d.ts +5 -4
  16. package/dist/api/ws-client.js +28 -12
  17. package/dist/client.browser.cjs +47 -17
  18. package/dist/client.browser.js +48 -18
  19. package/dist/client.cjs +48 -18
  20. package/dist/client.d.ts +10 -5
  21. package/dist/client.js +49 -19
  22. package/dist/fns/list-exports/list-exports.browser.cjs +4 -7
  23. package/dist/fns/list-exports/list-exports.browser.js +9 -8
  24. package/dist/fns/list-exports/list-exports.cjs +4 -7
  25. package/dist/fns/list-exports/list-exports.enums.d.ts +9 -4
  26. package/dist/fns/list-exports/list-exports.js +9 -8
  27. package/dist/fns/list-exports/list-exports.schema.input.json +20 -2
  28. package/dist/index.browser.cjs +3 -0
  29. package/dist/index.browser.js +3 -0
  30. package/dist/index.cjs +3 -0
  31. package/dist/index.d.ts +23 -5
  32. package/dist/index.js +3 -0
  33. package/dist/lib/errors.browser.cjs +21 -1
  34. package/dist/lib/errors.browser.js +21 -1
  35. package/dist/lib/errors.cjs +21 -1
  36. package/dist/lib/errors.d.ts +180 -109
  37. package/dist/lib/errors.js +21 -1
  38. package/dist/lib/utils.browser.cjs +24 -0
  39. package/dist/lib/utils.browser.js +24 -0
  40. package/dist/lib/utils.cjs +27 -0
  41. package/dist/lib/utils.d.ts +6 -0
  42. package/dist/lib/utils.js +24 -0
  43. package/dist/lib/validator.browser.cjs +3 -0
  44. package/dist/lib/validator.browser.js +4 -1
  45. package/dist/lib/validator.cjs +3 -0
  46. package/dist/lib/validator.js +4 -1
  47. package/dist/txs/get-export/get-export.enums.d.ts +2 -1
  48. package/dist/txs/get-export/get-export.schema.output.json +13 -2
  49. package/dist/txs/list-export-many/list-export-many.enums.d.ts +5 -5
  50. package/dist/txs/list-export-many/list-export-many.schema.input.json +5 -4
  51. package/dist/types/index.d.ts +252 -137
  52. package/dist/wapi-client-web.iife.js +6 -6
  53. package/dist/wapi-client.iife.js +6 -6
  54. package/package.json +1 -1
@@ -200,7 +200,7 @@ var ERROR_GROUPS = {
200
200
  INVALID_FIELD_FOR_MODEL: {
201
201
  code: -12301,
202
202
  message: "INVALID_FIELD_FOR_MODEL",
203
- description: `Provided groupBy field was not found on Model`
203
+ description: `Provided field was not found on Model`
204
204
  },
205
205
  NO_METADATA_ON_MODEL: {
206
206
  code: -12302,
@@ -388,6 +388,11 @@ var ERROR_GROUPS = {
388
388
  message: "TR_UNIQUE_IDENTIFIER",
389
389
  description: `The identifier for Transfer object must be unique`
390
390
  },
391
+ TR_DIFFERENT_WALLETS: {
392
+ code: -19116,
393
+ message: "TR_DIFFERENT_WALLETS",
394
+ description: `To and from wallets have to be different`
395
+ },
391
396
  TRG_SINGLE_PENDING_TR_CANT_RV: {
392
397
  code: -19200,
393
398
  message: "TRG_SINGLE_PENDING_TR_CANT_RV",
@@ -453,6 +458,21 @@ var ERROR_GROUPS = {
453
458
  code: -15003,
454
459
  message: "TRANSACTION_TIMEOUT",
455
460
  description: "Database transaction timed out"
461
+ },
462
+ CONNECTION_TIMEOUT: {
463
+ code: -15004,
464
+ message: "CONNECTION_TIMEOUT",
465
+ description: "Unable to get initial response in specified time"
466
+ },
467
+ SENDING_TIMEOUT: {
468
+ code: -15005,
469
+ message: "SENDING_TIMEOUT",
470
+ description: "Unable to get ack from server in specified time"
471
+ },
472
+ CONFIG_INVALID: {
473
+ code: -15100,
474
+ message: "CONFIG_INVALID",
475
+ description: "Provided configuration is invalid"
456
476
  }
457
477
  }
458
478
  }
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
22
  checkCopyObject: () => checkCopyObject,
23
+ checkFnOptionsOrderBy: () => checkFnOptionsOrderBy,
24
+ convertToString: () => convertToString,
23
25
  copyObject: () => copyObject,
24
26
  getConnectionParams: () => getConnectionParams,
25
27
  getConnectionUrl: () => getConnectionUrl,
@@ -29,6 +31,7 @@ __export(utils_exports, {
29
31
  getRandomHex: () => import_get_random_hex.getRandomHex,
30
32
  getTxIdSync: () => getTxIdSync,
31
33
  inputToString: () => inputToString,
34
+ isDate: () => isDate,
32
35
  isDateTime: () => isDateTime,
33
36
  isFutureDate: () => isFutureDate,
34
37
  modifyObject: () => modifyObject,
@@ -257,6 +260,27 @@ function orderByToOrder(orderBy) {
257
260
  };
258
261
  });
259
262
  }
263
+ function checkFnOptionsOrderBy(input) {
264
+ if (!input) {
265
+ return void 0;
266
+ }
267
+ if (!input.order_by) {
268
+ return input;
269
+ }
270
+ const orderBy = input.order_by;
271
+ delete input.order_by;
272
+ if (input.order) {
273
+ return input;
274
+ }
275
+ input.order = orderByToOrder(orderBy);
276
+ return input;
277
+ }
278
+ function convertToString(input) {
279
+ if (input === void 0 || input === null) {
280
+ return;
281
+ }
282
+ return input + "";
283
+ }
260
284
  function isFutureDate(dateString) {
261
285
  return new Date(dateString).setHours(0, 0, 0, 0) > (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
262
286
  }
@@ -217,6 +217,27 @@ function orderByToOrder(orderBy) {
217
217
  };
218
218
  });
219
219
  }
220
+ function checkFnOptionsOrderBy(input) {
221
+ if (!input) {
222
+ return void 0;
223
+ }
224
+ if (!input.order_by) {
225
+ return input;
226
+ }
227
+ const orderBy = input.order_by;
228
+ delete input.order_by;
229
+ if (input.order) {
230
+ return input;
231
+ }
232
+ input.order = orderByToOrder(orderBy);
233
+ return input;
234
+ }
235
+ function convertToString(input) {
236
+ if (input === void 0 || input === null) {
237
+ return;
238
+ }
239
+ return input + "";
240
+ }
220
241
  function isFutureDate(dateString) {
221
242
  return new Date(dateString).setHours(0, 0, 0, 0) > (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
222
243
  }
@@ -253,6 +274,8 @@ function isDateTime(str) {
253
274
  }
254
275
  export {
255
276
  checkCopyObject,
277
+ checkFnOptionsOrderBy,
278
+ convertToString,
256
279
  copyObject,
257
280
  getConnectionParams,
258
281
  getConnectionUrl,
@@ -262,6 +285,7 @@ export {
262
285
  getRandomHex,
263
286
  getTxIdSync,
264
287
  inputToString,
288
+ isDate,
265
289
  isDateTime,
266
290
  isFutureDate,
267
291
  modifyObject,
@@ -552,6 +552,8 @@ var require_dist = __commonJS({
552
552
  var utils_exports = {};
553
553
  __export(utils_exports, {
554
554
  checkCopyObject: () => checkCopyObject,
555
+ checkFnOptionsOrderBy: () => checkFnOptionsOrderBy,
556
+ convertToString: () => convertToString,
555
557
  copyObject: () => copyObject,
556
558
  getConnectionParams: () => getConnectionParams,
557
559
  getConnectionUrl: () => getConnectionUrl,
@@ -561,6 +563,7 @@ __export(utils_exports, {
561
563
  getRandomHex: () => import_get_random_hex.getRandomHex,
562
564
  getTxIdSync: () => getTxIdSync,
563
565
  inputToString: () => inputToString,
566
+ isDate: () => isDate,
564
567
  isDateTime: () => isDateTime,
565
568
  isFutureDate: () => isFutureDate,
566
569
  modifyObject: () => modifyObject,
@@ -740,6 +743,27 @@ function orderByToOrder(orderBy) {
740
743
  };
741
744
  });
742
745
  }
746
+ function checkFnOptionsOrderBy(input) {
747
+ if (!input) {
748
+ return void 0;
749
+ }
750
+ if (!input.order_by) {
751
+ return input;
752
+ }
753
+ const orderBy = input.order_by;
754
+ delete input.order_by;
755
+ if (input.order) {
756
+ return input;
757
+ }
758
+ input.order = orderByToOrder(orderBy);
759
+ return input;
760
+ }
761
+ function convertToString(input) {
762
+ if (input === void 0 || input === null) {
763
+ return;
764
+ }
765
+ return input + "";
766
+ }
743
767
  function isFutureDate(dateString) {
744
768
  return new Date(dateString).setHours(0, 0, 0, 0) > (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
745
769
  }
@@ -777,6 +801,8 @@ function isDateTime(str) {
777
801
  // Annotate the CommonJS export names for ESM import in node:
778
802
  0 && (module.exports = {
779
803
  checkCopyObject,
804
+ checkFnOptionsOrderBy,
805
+ convertToString,
780
806
  copyObject,
781
807
  getConnectionParams,
782
808
  getConnectionUrl,
@@ -786,6 +812,7 @@ function isDateTime(str) {
786
812
  getRandomHex,
787
813
  getTxIdSync,
788
814
  inputToString,
815
+ isDate,
789
816
  isDateTime,
790
817
  isFutureDate,
791
818
  modifyObject,
@@ -44,5 +44,11 @@ export declare function modifyObject<R>(original: {
44
44
  [k: string]: string | ((i: any) => any);
45
45
  }): R;
46
46
  export declare function orderByToOrder(orderBy: string): ITxOrderingInput[];
47
+ export declare function checkFnOptionsOrderBy<T extends {
48
+ order_by?: string;
49
+ order?: ITxOrderingInput[];
50
+ }>(input?: T): Omit<T, 'order_by'>;
51
+ export declare function convertToString(input?: unknown): string | undefined;
47
52
  export declare function isFutureDate(dateString: string): boolean;
53
+ export declare function isDate(str: string): boolean;
48
54
  export declare function isDateTime(str: string): boolean;
package/dist/lib/utils.js CHANGED
@@ -719,6 +719,27 @@ function orderByToOrder(orderBy) {
719
719
  };
720
720
  });
721
721
  }
722
+ function checkFnOptionsOrderBy(input) {
723
+ if (!input) {
724
+ return void 0;
725
+ }
726
+ if (!input.order_by) {
727
+ return input;
728
+ }
729
+ const orderBy = input.order_by;
730
+ delete input.order_by;
731
+ if (input.order) {
732
+ return input;
733
+ }
734
+ input.order = orderByToOrder(orderBy);
735
+ return input;
736
+ }
737
+ function convertToString(input) {
738
+ if (input === void 0 || input === null) {
739
+ return;
740
+ }
741
+ return input + "";
742
+ }
722
743
  function isFutureDate(dateString) {
723
744
  return new Date(dateString).setHours(0, 0, 0, 0) > (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
724
745
  }
@@ -755,6 +776,8 @@ function isDateTime(str) {
755
776
  }
756
777
  export {
757
778
  checkCopyObject,
779
+ checkFnOptionsOrderBy,
780
+ convertToString,
758
781
  copyObject,
759
782
  getConnectionParams,
760
783
  getConnectionUrl,
@@ -764,6 +787,7 @@ export {
764
787
  getRandomHex,
765
788
  getTxIdSync,
766
789
  inputToString,
790
+ isDate,
767
791
  isDateTime,
768
792
  isFutureDate,
769
793
  modifyObject,
@@ -6711,6 +6711,9 @@ var ajv = new import_ajv.default({
6711
6711
  ajv.addFormat("date-time", {
6712
6712
  validate: import_utils.isDateTime
6713
6713
  });
6714
+ ajv.addFormat("date", {
6715
+ validate: import_utils.isDate
6716
+ });
6714
6717
  function getValidationError(errors, errorsText) {
6715
6718
  if (errorsText === void 0) {
6716
6719
  return;
@@ -6465,7 +6465,7 @@ var require_ajv = __commonJS({
6465
6465
 
6466
6466
  // src/lib/validator.ts
6467
6467
  var import_ajv = __toESM(require_ajv(), 1);
6468
- import { copyObject, isDateTime } from "./utils.browser.js";
6468
+ import { copyObject, isDate, isDateTime } from "./utils.browser.js";
6469
6469
  import { ValidationError } from "./errors.browser.js";
6470
6470
  import JSONRPCRequestSchema from "../api/jsonrpc/jsonrpc.request.schema.json";
6471
6471
  import JSONRPCResponseSchema from "../api/jsonrpc/jsonrpc.response.schema.json";
@@ -6698,6 +6698,9 @@ var ajv = new import_ajv.default({
6698
6698
  ajv.addFormat("date-time", {
6699
6699
  validate: isDateTime
6700
6700
  });
6701
+ ajv.addFormat("date", {
6702
+ validate: isDate
6703
+ });
6701
6704
  function getValidationError(errors, errorsText) {
6702
6705
  if (errorsText === void 0) {
6703
6706
  return;
@@ -283,6 +283,9 @@ var ajv = new import_ajv.default({
283
283
  ajv.addFormat("date-time", {
284
284
  validate: import_utils.isDateTime
285
285
  });
286
+ ajv.addFormat("date", {
287
+ validate: import_utils.isDate
288
+ });
286
289
  function getValidationError(errors, errorsText) {
287
290
  if (errorsText === void 0) {
288
291
  return;
@@ -16,7 +16,7 @@ var __spreadValues = (a, b) => {
16
16
  };
17
17
 
18
18
  // src/lib/validator.ts
19
- import { copyObject, isDateTime } from "./utils";
19
+ import { copyObject, isDate, isDateTime } from "./utils";
20
20
  import Ajv from "ajv";
21
21
  import { ValidationError } from "./errors";
22
22
  import JSONRPCRequestSchema from "../api/jsonrpc/jsonrpc.request.schema.json";
@@ -250,6 +250,9 @@ var ajv = new Ajv({
250
250
  ajv.addFormat("date-time", {
251
251
  validate: isDateTime
252
252
  });
253
+ ajv.addFormat("date", {
254
+ validate: isDate
255
+ });
253
256
  function getValidationError(errors, errorsText) {
254
257
  if (errorsText === void 0) {
255
258
  return;
@@ -27,6 +27,7 @@ export interface GetExportTxInput {
27
27
  export: UniqueExportFilter;
28
28
  options?: GetExportTxOptions;
29
29
  }
30
+ export type ExportType = 'transfers' | 'transfer_groups' | 'tokens' | 'wallets' | 'balance_history' | 'unknown';
30
31
  export type Export = {
31
32
  /**
32
33
  * Unique identifier of the export
@@ -39,7 +40,7 @@ export type Export = {
39
40
  /**
40
41
  * Type of the export
41
42
  */
42
- type: string;
43
+ type: ExportType;
43
44
  /**
44
45
  * Timestamp when export was finished
45
46
  */
@@ -15,6 +15,18 @@
15
15
  }
16
16
  },
17
17
  "definitions": {
18
+ "export_type": {
19
+ "description": "The type of the export",
20
+ "type": "string",
21
+ "enum": [
22
+ "transfers",
23
+ "transfer_groups",
24
+ "tokens",
25
+ "wallets",
26
+ "balance_history",
27
+ "unknown"
28
+ ]
29
+ },
18
30
  "export": {
19
31
  "properties": {
20
32
  "identifier": {
@@ -27,8 +39,7 @@
27
39
  "enum": ["started", "completed", "error"]
28
40
  },
29
41
  "type": {
30
- "description": "The type of the export",
31
- "type": "string"
42
+ "$ref": "#/definitions/export_type"
32
43
  },
33
44
  "created_at": {
34
45
  "description": "Timestamp when export was initiated",
@@ -1,16 +1,16 @@
1
1
  import { Export } from '../get-export/get-export.enums';
2
2
  import { ITxGeneralOptions, ITxLimitingOptions, ITxOrderingInput } from '../tx-consts.enums';
3
3
  export type ListExportManyOrderingOptions = {
4
- order: ListExportManyOrderingInput[];
4
+ order?: ListExportManyOrderingInput[];
5
5
  };
6
6
  export type ListExportManyOrderingInputField = {
7
- field: 'name';
7
+ field: 'identifier' | 'created_at' | 'completed_at';
8
8
  };
9
- export type ListExportManyOrderingInput = ITxOrderingInput & ListExportManyOrderingInputField & ListExportManyOrderingOptions;
10
- export type ListExportManyTxOptions = ITxLimitingOptions & ITxGeneralOptions;
9
+ export type ListExportManyOrderingInput = ITxOrderingInput & ListExportManyOrderingInputField;
10
+ export type ListExportManyTxOptions = ITxLimitingOptions & ITxGeneralOptions & ListExportManyOrderingOptions;
11
11
  export interface ListExportManyTxInput {
12
12
  export?: {
13
- entity?: 'tx';
13
+ type?: 'transfers' | 'transfer_groups' | 'tokens' | 'wallets' | 'balance_history' | 'unknown';
14
14
  date?: string;
15
15
  };
16
16
  options?: ListExportManyTxOptions;
@@ -10,12 +10,13 @@
10
10
  "properties": {
11
11
  "date": {
12
12
  "description": "Date the file was created on",
13
- "type": "string"
13
+ "type": "string",
14
+ "format": "date"
14
15
  },
15
- "entity": {
16
+ "type": {
16
17
  "description": "Entity that was exported",
17
18
  "type": "string",
18
- "enum": ["tx"]
19
+ "$ref": "/txs/get-export/get-export.schema.output.json#/definitions/export_type"
19
20
  }
20
21
  }
21
22
  },
@@ -66,7 +67,7 @@
66
67
  "properties": {
67
68
  "field": {
68
69
  "type": "string",
69
- "enum": ["name"]
70
+ "enum": ["identifier", "completed_at", "created_at"]
70
71
  }
71
72
  },
72
73
  "$typescript": "{\"additionalProperties\": false}"