@xyo-network/api 2.38.8 → 2.38.10

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 (97) hide show
  1. package/dist/cjs/Archivist/XyoRemoteArchivist.d.ts.map +1 -1
  2. package/dist/cjs/Archivist/XyoRemoteArchivist.js +12 -9
  3. package/dist/cjs/Archivist/XyoRemoteArchivist.js.map +1 -1
  4. package/dist/cjs/Base.d.ts +14 -14
  5. package/dist/cjs/Base.d.ts.map +1 -1
  6. package/dist/cjs/Base.js +71 -68
  7. package/dist/cjs/Base.js.map +1 -1
  8. package/dist/cjs/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.d.ts +2 -0
  9. package/dist/cjs/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.d.ts.map +1 -1
  10. package/dist/cjs/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js +8 -5
  11. package/dist/cjs/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js.map +1 -1
  12. package/dist/cjs/Diviner/LocationDiviner/ApiConfig.d.ts +2 -2
  13. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +1 -1
  14. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts.map +1 -1
  15. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +1 -1
  16. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts.map +1 -1
  17. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +4 -4
  18. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -1
  19. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +1 -1
  20. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts.map +1 -1
  21. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +1 -1
  22. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts.map +1 -1
  23. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js.map +1 -1
  24. package/dist/cjs/Diviner/LocationDiviner/models.d.ts +1 -1
  25. package/dist/cjs/Diviner/LocationDiviner/models.d.ts.map +1 -1
  26. package/dist/cjs/Diviner/RemoteDivinerError.d.ts +1 -1
  27. package/dist/cjs/Diviner/RemoteDivinerError.d.ts.map +1 -1
  28. package/dist/cjs/Diviner/RemoteDivinerError.js.map +1 -1
  29. package/dist/cjs/Diviner/XyoRemoteDivinerConfig.d.ts +1 -1
  30. package/dist/cjs/Diviner/XyoRemoteDivinerConfig.d.ts.map +1 -1
  31. package/dist/cjs/Simple.d.ts +6 -6
  32. package/dist/cjs/Simple.d.ts.map +1 -1
  33. package/dist/cjs/Simple.js +12 -12
  34. package/dist/cjs/Simple.js.map +1 -1
  35. package/dist/cjs/User/Api.d.ts +5 -5
  36. package/dist/cjs/models/Api/Config.d.ts +12 -12
  37. package/dist/cjs/models/Api/Config.d.ts.map +1 -1
  38. package/dist/cjs/models/Archive.d.ts +2 -2
  39. package/dist/cjs/models/Archive.d.ts.map +1 -1
  40. package/dist/docs.json +6192 -6037
  41. package/dist/esm/Archivist/XyoRemoteArchivist.d.ts.map +1 -1
  42. package/dist/esm/Archivist/XyoRemoteArchivist.js +11 -8
  43. package/dist/esm/Archivist/XyoRemoteArchivist.js.map +1 -1
  44. package/dist/esm/Base.d.ts +14 -14
  45. package/dist/esm/Base.d.ts.map +1 -1
  46. package/dist/esm/Base.js +63 -64
  47. package/dist/esm/Base.js.map +1 -1
  48. package/dist/esm/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.d.ts +2 -0
  49. package/dist/esm/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.d.ts.map +1 -1
  50. package/dist/esm/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js +5 -4
  51. package/dist/esm/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js.map +1 -1
  52. package/dist/esm/Diviner/LocationDiviner/ApiConfig.d.ts +2 -2
  53. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +1 -1
  54. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts.map +1 -1
  55. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +1 -1
  56. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts.map +1 -1
  57. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +4 -4
  58. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -1
  59. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +1 -1
  60. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts.map +1 -1
  61. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +1 -1
  62. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts.map +1 -1
  63. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js.map +1 -1
  64. package/dist/esm/Diviner/LocationDiviner/models.d.ts +1 -1
  65. package/dist/esm/Diviner/LocationDiviner/models.d.ts.map +1 -1
  66. package/dist/esm/Diviner/RemoteDivinerError.d.ts +1 -1
  67. package/dist/esm/Diviner/RemoteDivinerError.d.ts.map +1 -1
  68. package/dist/esm/Diviner/RemoteDivinerError.js +1 -1
  69. package/dist/esm/Diviner/RemoteDivinerError.js.map +1 -1
  70. package/dist/esm/Diviner/XyoRemoteDivinerConfig.d.ts +1 -1
  71. package/dist/esm/Diviner/XyoRemoteDivinerConfig.d.ts.map +1 -1
  72. package/dist/esm/Simple.d.ts +6 -6
  73. package/dist/esm/Simple.d.ts.map +1 -1
  74. package/dist/esm/Simple.js +11 -11
  75. package/dist/esm/Simple.js.map +1 -1
  76. package/dist/esm/User/Api.d.ts +5 -5
  77. package/dist/esm/models/Api/Config.d.ts +12 -12
  78. package/dist/esm/models/Api/Config.d.ts.map +1 -1
  79. package/dist/esm/models/Archive.d.ts +2 -2
  80. package/dist/esm/models/Archive.d.ts.map +1 -1
  81. package/package.json +9 -9
  82. package/src/Archivist/XyoRemoteArchivist.spec.ts +5 -0
  83. package/src/Archivist/XyoRemoteArchivist.ts +11 -8
  84. package/src/Base.ts +72 -73
  85. package/src/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.ts +7 -7
  86. package/src/Diviner/LocationDiviner/ApiConfig.ts +2 -2
  87. package/src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts +1 -1
  88. package/src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts +1 -1
  89. package/src/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.ts +4 -4
  90. package/src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.ts +1 -1
  91. package/src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts +2 -1
  92. package/src/Diviner/LocationDiviner/models.ts +1 -1
  93. package/src/Diviner/RemoteDivinerError.ts +1 -1
  94. package/src/Diviner/XyoRemoteDivinerConfig.ts +1 -1
  95. package/src/Simple.ts +18 -18
  96. package/src/models/Api/Config.ts +14 -14
  97. package/src/models/Archive.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Simple.d.ts","sourceRoot":"","sources":["../../src/Simple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAiD,MAAM,UAAU,CAAA;AAG/H,oBAAY,iBAAiB,GAAG,oBAAoB,CAAA;AAEpD,qBAAa,YAAY,CACvB,CAAC,GAAG,UAAU,EACd,CAAC,GAAG,CAAC,EACL,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,EAC/C,CAAC,SAAS,YAAY,GAAG,YAAY,CACrC,SAAQ,UAAU,CAAC,CAAC,CAAC;IACR,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACrC,GAAG,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC1D,GAAG,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAU5D,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAUxE,IAAI,CAAC,IAA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IACrE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAUvE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC7C,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACpE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CASpF"}
@@ -1,12 +1,12 @@
1
1
  import { XyoApiBase } from './Base';
2
2
  import { objToQuery } from './objToQuery';
3
3
  export class XyoApiSimple extends XyoApiBase {
4
- async get(responseType) {
4
+ async delete(responseType) {
5
5
  switch (responseType) {
6
6
  case 'tuple':
7
- return await this.getEndpoint(undefined, 'tuple');
7
+ return await this.deleteEndpoint(undefined, 'tuple');
8
8
  default:
9
- return await this.getEndpoint(undefined);
9
+ return await this.deleteEndpoint(undefined);
10
10
  }
11
11
  }
12
12
  async find(query = {}, responseType) {
@@ -17,6 +17,14 @@ export class XyoApiSimple extends XyoApiBase {
17
17
  return await this.getEndpoint(objToQuery(query));
18
18
  }
19
19
  }
20
+ async get(responseType) {
21
+ switch (responseType) {
22
+ case 'tuple':
23
+ return await this.getEndpoint(undefined, 'tuple');
24
+ default:
25
+ return await this.getEndpoint(undefined);
26
+ }
27
+ }
20
28
  async post(data, responseType) {
21
29
  switch (responseType) {
22
30
  case 'tuple':
@@ -33,13 +41,5 @@ export class XyoApiSimple extends XyoApiBase {
33
41
  return await this.putEndpoint(undefined, data);
34
42
  }
35
43
  }
36
- async delete(responseType) {
37
- switch (responseType) {
38
- case 'tuple':
39
- return await this.deleteEndpoint(undefined, 'tuple');
40
- default:
41
- return await this.deleteEndpoint(undefined);
42
- }
43
- }
44
44
  }
45
45
  //# sourceMappingURL=Simple.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Simple.js","sourceRoot":"","sources":["../../src/Simple.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,MAAM,OAAO,YAKX,SAAQ,UAAa;IAId,KAAK,CAAC,GAAG,CAAC,YAAiC;QAChD,QAAQ,YAAY,EAAE;YACpB,KAAK,OAAO;gBACV,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YACnD;gBACE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;SAC3C;IACH,CAAC;IAKM,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,YAAiC;QAC7D,QAAQ,YAAY,EAAE;YACpB,KAAK,OAAO;gBACV,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAA;YAC3D;gBACE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;SACnD;IACH,CAAC;IAKM,KAAK,CAAC,IAAI,CAAC,IAAQ,EAAE,YAAiC;QAC3D,QAAQ,YAAY,EAAE;YACpB,KAAK,OAAO;gBACV,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;YAC1D;gBACE,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;SAClD;IACH,CAAC;IAKM,KAAK,CAAC,GAAG,CAAC,IAAQ,EAAE,YAAiC;QAC1D,QAAQ,YAAY,EAAE;YACpB,KAAK,OAAO;gBACV,OAAO,MAAM,IAAI,CAA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,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YACnD;gBACE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;SAC3C;IACH,CAAC;IAKM,KAAK,CAAC,IAAI,CAAC,IAAQ,EAAE,YAAiC;QAC3D,QAAQ,YAAY,EAAE;YACpB,KAAK,OAAO;gBACV,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;YAC1D;gBACE,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;SAClD;IACH,CAAC;IAKM,KAAK,CAAC,GAAG,CAAC,IAAQ,EAAE,YAAiC;QAC1D,QAAQ,YAAY,EAAE;YACpB,KAAK,OAAO;gBACV,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;YACzD;gBACE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;SACjD;IACH,CAAC;CACF"}
@@ -19,14 +19,14 @@ export declare class XyoUserApi extends XyoApiBase {
19
19
  }, import("@xyo-network/payload").XyoPayloadFindFilter, {
20
20
  root: string;
21
21
  apiDomain: string; /** @field Password of the user [in] */
22
- userid?: string | undefined;
23
- jwtToken?: string | undefined;
24
22
  apiKey?: string | undefined;
25
- query?: string | undefined;
26
23
  compressionThreshold?: number | undefined;
27
- throwFailure?: boolean | undefined;
28
- throwError?: boolean | undefined;
24
+ jwtToken?: string | undefined;
25
+ query?: string | undefined;
29
26
  reportableParent?: import("..").XyoApiReportable | undefined;
27
+ throwError?: boolean | undefined;
28
+ throwFailure?: boolean | undefined;
29
+ userid?: string | undefined;
30
30
  onError?: ((error: import("..").XyoApiError<any, any>, depth: number) => void) | undefined;
31
31
  /** @field Password of the user [in] */
32
32
  onFailure?: ((response: import("..").XyoApiResponse<unknown, unknown>, depth: number) => void) | undefined; /** @field Token to access the API as that user [out] */
@@ -2,24 +2,24 @@ import { XyoApiReportable } from './Reportable';
2
2
  interface XyoApiConfig extends XyoApiReportable {
3
3
  /** @description The domain where the api is located */
4
4
  apiDomain: string;
5
- /** @deprecated use the jwtToken instead*/
6
- userid?: string;
7
- /** @description The jwtToken of the currently logged in user */
8
- jwtToken?: string;
9
5
  /** @description The apiKey used for authentication */
10
6
  apiKey?: string;
11
- /** @description The location in the API tree where this API object is mounted */
12
- root?: string;
13
- /** @description The query string, if any, that is added to the end of every request */
14
- query?: string;
15
7
  /** @description Threshold for Content-Size to cause automatic gzip of request body [default = 1024] */
16
8
  compressionThreshold?: number;
17
- /** @description Throw on failures */
18
- throwFailure?: boolean;
19
- /** @description Throw on error */
20
- throwError?: boolean;
9
+ /** @description The jwtToken of the currently logged in user */
10
+ jwtToken?: string;
11
+ /** @description The query string, if any, that is added to the end of every request */
12
+ query?: string;
21
13
  /** @description Parent that should also report events from this api */
22
14
  reportableParent?: XyoApiReportable;
15
+ /** @description The location in the API tree where this API object is mounted */
16
+ root?: string;
17
+ /** @description Throw on error */
18
+ throwError?: boolean;
19
+ /** @description Throw on failures */
20
+ throwFailure?: boolean;
21
+ /** @deprecated use the jwtToken instead*/
22
+ userid?: string;
23
23
  }
24
24
  export type { XyoApiConfig };
25
25
  //# sourceMappingURL=Config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../../src/models/Api/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,UAAU,YAAa,SAAQ,gBAAgB;IAC7C,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAA;IAEjB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,uGAAuG;IACvG,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAE7B,qCAAqC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB,kCAAkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAED,YAAY,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../../src/models/Api/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,UAAU,YAAa,SAAQ,gBAAgB;IAC7C,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAA;IAEjB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,uGAAuG;IACvG,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAE7B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IAEnC,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,kCAAkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB,qCAAqC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,YAAY,EAAE,YAAY,EAAE,CAAA"}
@@ -5,8 +5,8 @@ export declare type ExpirationWindow = 'create' | 'read';
5
5
  export interface XyoAccessControl {
6
6
  access?: Record<AccessType, AccessLevel>;
7
7
  expiration?: {
8
- window?: ExpirationWindow;
9
8
  delay?: number;
9
+ window?: ExpirationWindow;
10
10
  };
11
11
  }
12
12
  export interface XyoAccessControls {
@@ -19,7 +19,7 @@ export interface XyoAccessControls {
19
19
  schema?: Record<string, XyoAccessControl>;
20
20
  }
21
21
  export interface XyoArchive extends XyoArchivePath {
22
- user?: string;
23
22
  accessControl?: XyoAccessControl | boolean;
23
+ user?: string;
24
24
  }
25
25
  //# sourceMappingURL=Archive.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Archive.d.ts","sourceRoot":"","sources":["../../../src/models/Archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,oBAAY,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AACvD,oBAAY,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAA;AAC9D,oBAAY,gBAAgB,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;IACxC,UAAU,CAAC,EAAE;QACX,MAAM,CAAC,EAAE,gBAAgB,CAAA;QACzB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAA;CAC3C"}
1
+ {"version":3,"file":"Archive.d.ts","sourceRoot":"","sources":["../../../src/models/Archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,oBAAY,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AACvD,oBAAY,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAA;AAC9D,oBAAY,gBAAgB,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;IACxC,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,gBAAgB,CAAA;KAC1B,CAAA;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,aAAa,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAA;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
package/package.json CHANGED
@@ -11,14 +11,14 @@
11
11
  "dependencies": {
12
12
  "@xylabs/assert": "^2.6.9",
13
13
  "@xylabs/delay": "^2.6.9",
14
- "@xyo-network/account": "^2.38.8",
15
- "@xyo-network/archivist": "^2.38.8",
16
- "@xyo-network/boundwitness": "^2.38.8",
17
- "@xyo-network/core": "^2.38.8",
18
- "@xyo-network/diviner": "^2.38.8",
19
- "@xyo-network/module": "^2.38.8",
20
- "@xyo-network/payload": "^2.38.8",
21
- "@xyo-network/schema-payload-plugin": "^2.38.8",
14
+ "@xyo-network/account": "^2.38.10",
15
+ "@xyo-network/archivist": "^2.38.10",
16
+ "@xyo-network/boundwitness": "^2.38.10",
17
+ "@xyo-network/core": "^2.38.10",
18
+ "@xyo-network/diviner": "^2.38.10",
19
+ "@xyo-network/module": "^2.38.10",
20
+ "@xyo-network/payload": "^2.38.10",
21
+ "@xyo-network/schema-payload-plugin": "^2.38.10",
22
22
  "tslib": "^2.4.0"
23
23
  },
24
24
  "peerDependencies": {
@@ -65,5 +65,5 @@
65
65
  },
66
66
  "sideEffects": false,
67
67
  "types": "dist/esm/index.d.ts",
68
- "version": "2.38.8"
68
+ "version": "2.38.10"
69
69
  }
@@ -1,3 +1,4 @@
1
+ import { XyoArchivistWrapper } from '@xyo-network/archivist'
1
2
  import { PayloadWrapper } from '@xyo-network/payload'
2
3
 
3
4
  import { XyoApiConfig } from '../models'
@@ -25,4 +26,8 @@ test('XyoRemoteArchivist', async () => {
25
26
  console.log(`getResult: ${JSON.stringify(getResult)}`)
26
27
  expect(getResult.length).toBe(1)
27
28
  expect(getResult[0]?.schema).toBe(payload.schema)
29
+
30
+ const wrapper = new XyoArchivistWrapper(archivist)
31
+ const findResult = await wrapper.find()
32
+ expect(findResult.length).toBe(20)
28
33
  })
@@ -83,16 +83,19 @@ export class XyoRemoteArchivist extends XyoArchivist<XyoRemoteArchivistConfig> {
83
83
 
84
84
  public override async find<R extends XyoPayload = XyoPayload>(filter: XyoPayloadFindFilter): Promise<R[]> {
85
85
  try {
86
- const [payloads = [], { error: payloadError }] = await this.api.archive(this.archive).payload.find(filter, 'tuple')
87
- if (payloadError?.length) {
88
- throw new RemoteArchivistError('find', payloadError, 'payloads')
86
+ const [payloads = [], payloadEnvelope, payloadResponse] = await this.api.archive(this.archive).payload.find(filter, 'tuple')
87
+ if (payloadEnvelope.error?.length) {
88
+ throw new RemoteArchivistError('find', payloadEnvelope.error.shift(), 'payloads')
89
89
  }
90
- const [blocks = [], response, error] = await this.api.archive(this.archive).block.find(filter, 'tuple')
91
- if (error?.status >= 400) {
92
- throw new RemoteArchivistError('find', `${error.statusText} [${error.status}]`)
90
+ if (payloadResponse.status >= 300) {
91
+ throw new RemoteArchivistError('find', `Invalid payload status [${payloadResponse.status}]`, 'payloads')
93
92
  }
94
- if (response?.error?.length) {
95
- throw new RemoteArchivistError('find', response?.error)
93
+ const [blocks = [], blockEnvelope, blockResponse] = await this.api.archive(this.archive).block.find(filter, 'tuple')
94
+ if (blockEnvelope.error?.length) {
95
+ throw new RemoteArchivistError('find', blockEnvelope.error.shift(), 'payloads')
96
+ }
97
+ if (blockResponse.status >= 300) {
98
+ throw new RemoteArchivistError('find', `Invalid block status [${blockResponse.status}]`, 'payloads')
96
99
  }
97
100
  return payloads.concat(blocks) as R[]
98
101
  } catch (ex) {
package/src/Base.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Axios, AxiosRequestConfig, AxiosRequestHeaders } from 'axios'
1
+ import { Axios, AxiosRequestConfig, RawAxiosRequestHeaders } from 'axios'
2
2
  import { gzip } from 'pako'
3
3
 
4
4
  import {
@@ -22,35 +22,36 @@ export class XyoApiBase<C extends XyoApiConfig = XyoApiConfig> implements XyoApi
22
22
  this.axios = new Axios(this.axiosConfig())
23
23
  }
24
24
 
25
- private axiosHeaders(): AxiosRequestHeaders {
26
- return {
27
- ...this.headers,
28
- Accept: 'application/json, text/plain, *.*',
29
- 'Content-Type': 'application/json',
30
- }
25
+ public get authenticated() {
26
+ return !!this.config.apiKey || !!this.config.jwtToken
31
27
  }
32
28
 
33
- private axiosConfig(): AxiosRequestConfig {
34
- return {
35
- headers: this.axiosHeaders(),
36
- transformRequest: (data, headers) => {
37
- const json = JSON.stringify(data)
38
- if (headers && data) {
39
- if (json.length > (this.config.compressionThreshold ?? 1024)) {
40
- headers['Content-Encoding'] = 'gzip'
41
- return gzip(JSON.stringify(data)).buffer
42
- }
43
- }
44
- return JSON.stringify(data)
45
- },
46
- transformResponse: (data) => {
47
- try {
48
- return JSON.parse(data)
49
- } catch (ex) {
50
- return null
51
- }
52
- },
29
+ protected get headers(): Record<string, string> {
30
+ const headers: Record<string, string> = {}
31
+ if (this.config.jwtToken) {
32
+ headers.Authorization = `Bearer ${this.config.jwtToken}`
33
+ }
34
+ if (this.config.apiKey) {
35
+ headers['x-api-key'] = this.config.apiKey
53
36
  }
37
+ return headers
38
+ }
39
+
40
+ protected get query() {
41
+ return this.config.query ?? ''
42
+ }
43
+
44
+ protected get root() {
45
+ return this.config.root ?? '/'
46
+ }
47
+
48
+ private static resolveResponse<T>(result?: XyoApiResponse<XyoApiEnvelope<T>>) {
49
+ return [result?.data?.data, result?.data, result] as XyoApiResponseTuple<T>
50
+ }
51
+
52
+ private static shapeResponse<T = unknown>(response: XyoApiResponse<XyoApiEnvelope<T>> | undefined, responseType?: XyoApiResponseType) {
53
+ const resolvedResponse = XyoApiBase.resolveResponse(response)
54
+ return responseType === 'tuple' ? resolvedResponse : resolvedResponse[0]
54
55
  }
55
56
 
56
57
  onError(error: XyoApiError, depth = 0) {
@@ -68,20 +69,24 @@ export class XyoApiBase<C extends XyoApiConfig = XyoApiConfig> implements XyoApi
68
69
  this.config.onSuccess?.(response, depth)
69
70
  }
70
71
 
71
- protected get root() {
72
- return this.config.root ?? '/'
73
- }
74
-
75
- protected get query() {
76
- return this.config.query ?? ''
77
- }
78
-
79
- private resolveRoot() {
80
- return `${this.config.apiDomain}${this.root}`
72
+ protected async deleteEndpoint<T = unknown>(endPoint?: string): Promise<XyoApiResponseBody<T>>
73
+ protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<XyoApiResponseBody<T>>
74
+ protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
75
+ protected async deleteEndpoint<T = unknown>(endPoint = '', responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
76
+ const response = await this.monitorResponse<T>(async () => {
77
+ return await this.axios.delete<XyoApiEnvelope<T>, XyoApiResponse<XyoApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)
78
+ })
79
+ return XyoApiBase.shapeResponse<T>(response, responseType)
81
80
  }
82
81
 
83
- private static resolveResponse<T>(result?: XyoApiResponse<XyoApiEnvelope<T>>) {
84
- return [result?.data?.data, result?.data, result] as XyoApiResponseTuple<T>
82
+ protected async getEndpoint<T = unknown>(endPoint?: string): Promise<XyoApiResponseBody<T>>
83
+ protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<XyoApiResponseBody<T>>
84
+ protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
85
+ protected async getEndpoint<T = unknown>(endPoint = '', responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
86
+ const response = await this.monitorResponse<T>(async () => {
87
+ return await this.axios.get<XyoApiEnvelope<T>, XyoApiResponse<XyoApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)
88
+ })
89
+ return XyoApiBase.shapeResponse<T>(response, responseType)
85
90
  }
86
91
 
87
92
  protected handleMonitorResponseError<T>(error: XyoApiError, trapAxiosException: boolean) {
@@ -113,16 +118,6 @@ export class XyoApiBase<C extends XyoApiConfig = XyoApiConfig> implements XyoApi
113
118
  }
114
119
  }
115
120
 
116
- protected async getEndpoint<T = unknown>(endPoint?: string): Promise<XyoApiResponseBody<T>>
117
- protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<XyoApiResponseBody<T>>
118
- protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
119
- protected async getEndpoint<T = unknown>(endPoint = '', responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
120
- const response = await this.monitorResponse<T>(async () => {
121
- return await this.axios.get<XyoApiEnvelope<T>, XyoApiResponse<XyoApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)
122
- })
123
- return XyoApiBase.shapeResponse<T>(response, responseType)
124
- }
125
-
126
121
  protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<XyoApiResponseBody<T>>
127
122
  protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<XyoApiResponseBody<T>>
128
123
  protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
@@ -151,33 +146,37 @@ export class XyoApiBase<C extends XyoApiConfig = XyoApiConfig> implements XyoApi
151
146
  return XyoApiBase.shapeResponse<T>(response, responseType)
152
147
  }
153
148
 
154
- protected async deleteEndpoint<T = unknown>(endPoint?: string): Promise<XyoApiResponseBody<T>>
155
- protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<XyoApiResponseBody<T>>
156
- protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
157
- protected async deleteEndpoint<T = unknown>(endPoint = '', responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
158
- const response = await this.monitorResponse<T>(async () => {
159
- return await this.axios.delete<XyoApiEnvelope<T>, XyoApiResponse<XyoApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)
160
- })
161
- return XyoApiBase.shapeResponse<T>(response, responseType)
162
- }
163
-
164
- private static shapeResponse<T = unknown>(response: XyoApiResponse<XyoApiEnvelope<T>> | undefined, responseType?: XyoApiResponseType) {
165
- const resolvedResponse = XyoApiBase.resolveResponse(response)
166
- return responseType === 'tuple' ? resolvedResponse : resolvedResponse[0]
149
+ private axiosConfig(): AxiosRequestConfig {
150
+ return {
151
+ headers: this.axiosHeaders(),
152
+ transformRequest: (data, headers) => {
153
+ const json = JSON.stringify(data)
154
+ if (headers && data) {
155
+ if (json.length > (this.config.compressionThreshold ?? 1024)) {
156
+ headers['Content-Encoding'] = 'gzip'
157
+ return gzip(JSON.stringify(data)).buffer
158
+ }
159
+ }
160
+ return JSON.stringify(data)
161
+ },
162
+ transformResponse: (data) => {
163
+ try {
164
+ return JSON.parse(data)
165
+ } catch (ex) {
166
+ return null
167
+ }
168
+ },
169
+ }
167
170
  }
168
171
 
169
- protected get headers(): Record<string, string> {
170
- const headers: Record<string, string> = {}
171
- if (this.config.jwtToken) {
172
- headers.Authorization = `Bearer ${this.config.jwtToken}`
173
- }
174
- if (this.config.apiKey) {
175
- headers['x-api-key'] = this.config.apiKey
176
- }
177
- return headers
172
+ private axiosHeaders(): RawAxiosRequestHeaders {
173
+ const axiosHeaders: RawAxiosRequestHeaders = { ...this.headers }
174
+ axiosHeaders['Accept'] = 'application/json, text/plain, *.*'
175
+ axiosHeaders['Content-Type'] = 'application/json'
176
+ return axiosHeaders
178
177
  }
179
178
 
180
- public get authenticated() {
181
- return !!this.config.apiKey || !!this.config.jwtToken
179
+ private resolveRoot() {
180
+ return `${this.config.apiDomain}${this.root}`
182
181
  }
183
182
  }
@@ -1,20 +1,17 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import { XyoBoundWitness } from '@xyo-network/boundwitness'
2
+ import { XyoBoundWitness, XyoBoundWitnessSchema } from '@xyo-network/boundwitness'
3
3
  import { XyoDiviner, XyoDivinerDivineQuerySchema } from '@xyo-network/diviner'
4
4
  import { XyoModuleParams } from '@xyo-network/module'
5
5
  import { XyoPayloads } from '@xyo-network/payload'
6
6
 
7
7
  import { RemoteDivinerError } from '../RemoteDivinerError'
8
- import { XyoRemoteDivinerConfig } from '../XyoRemoteDivinerConfig'
8
+ import { XyoRemoteDivinerConfig, XyoRemoteDivinerConfigSchema } from '../XyoRemoteDivinerConfig'
9
9
  import { AddressHistoryDiviner, isAddressHistoryQueryPayload } from './AddressHistoryDiviner'
10
10
 
11
11
  /** @description Diviner Context that connects to a remote Diviner using the API */
12
12
  export class XyoRemoteAddressHistoryDiviner extends XyoDiviner<XyoRemoteDivinerConfig> implements AddressHistoryDiviner {
13
- static override async create(params?: XyoModuleParams<XyoRemoteDivinerConfig>): Promise<XyoRemoteAddressHistoryDiviner> {
14
- params?.logger?.debug(`params: ${JSON.stringify(params, null, 2)}`)
15
- const module = new XyoRemoteAddressHistoryDiviner(params)
16
- await module.start()
17
- return module
13
+ static override async create(params?: XyoModuleParams<XyoRemoteDivinerConfig>) {
14
+ return (await super.create(params)) as XyoRemoteAddressHistoryDiviner
18
15
  }
19
16
 
20
17
  public get api() {
@@ -50,4 +47,7 @@ export class XyoRemoteAddressHistoryDiviner extends XyoDiviner<XyoRemoteDivinerC
50
47
  throw ex
51
48
  }
52
49
  }
50
+
51
+ static override configSchema = XyoRemoteDivinerConfigSchema
52
+ static override targetSchema = XyoBoundWitnessSchema
53
53
  }
@@ -1,6 +1,6 @@
1
1
  export interface ApiConfig {
2
2
  apiDomain: string
3
- userid?: string
4
- jwtToken?: string
5
3
  apiKey?: string
4
+ jwtToken?: string
5
+ userid?: string
6
6
  }
@@ -7,9 +7,9 @@ export type LocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'
7
7
  export const locationHeatmapAnswerSchema: LocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'
8
8
 
9
9
  export type LocationHeatmapQuery = {
10
+ schema: LocationWitnessSchema
10
11
  startTime?: string
11
12
  stopTime?: string
12
- schema: LocationWitnessSchema
13
13
  }
14
14
 
15
15
  export const isLocationHeatmapQuery = (query: Record<string, unknown>): query is LocationHeatmapQuery => {
@@ -5,9 +5,9 @@ export const locationQuadkeyHeatmapQuerySchema: LocationQuadkeyHeatmapQuerySchem
5
5
  export type LocationQuadkeyHeatmapAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'
6
6
  export const locationQuadkeyHeatmapAnswerSchema: LocationQuadkeyHeatmapAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'
7
7
  export type LocationQuadkeyHeatmapQuery = {
8
+ schema: LocationWitnessSchema
8
9
  startTime?: string
9
10
  stopTime?: string
10
- schema: LocationWitnessSchema
11
11
  }
12
12
 
13
13
  export const isLocationQuadkeyHeatmapQuery = (query: Record<string, unknown>): query is LocationQuadkeyHeatmapQuery => {
@@ -8,12 +8,12 @@ export interface LocationQueryCreationRequest<
8
8
  TSchema extends LocationQuerySchema = LocationQuerySchema,
9
9
  TQuery extends Record<string, unknown> = Record<string, unknown>,
10
10
  > {
11
- sourceArchivist: XyoApiConfig
12
- sourceArchive: string
13
- resultArchivist: XyoApiConfig
11
+ query: TQuery
14
12
  resultArchive: string
13
+ resultArchivist: XyoApiConfig
15
14
  schema: TSchema
16
- query: TQuery
15
+ sourceArchive: string
16
+ sourceArchivist: XyoApiConfig
17
17
  }
18
18
 
19
19
  export type LocationTimeRangeQueryCreationRequest = LocationQueryCreationRequest<LocationTimeRangeQuerySchema, LocationTimeRangeQuery>
@@ -1,8 +1,8 @@
1
1
  import { LocationWitnessSchema } from '../../Witnesses'
2
2
 
3
3
  export interface LocationTimeRangePointProperties {
4
- schema: LocationWitnessSchema
5
4
  _archive: string
6
5
  _client: string
7
6
  _timestamp: number
7
+ schema: LocationWitnessSchema
8
8
  }
@@ -7,9 +7,10 @@ export type LocationTimeRangeAnswerSchema = 'network.xyo.location.range.answer'
7
7
  export const LocationTimeRangeAnswerSchema: LocationTimeRangeAnswerSchema = 'network.xyo.location.range.answer'
8
8
 
9
9
  export type LocationTimeRangeQuery = {
10
+ schema: LocationWitnessSchema
10
11
  startTime?: string
11
12
  stopTime?: string
12
- schema: LocationWitnessSchema
13
+
13
14
  // TODO: Bounding rectangle, etc.
14
15
  }
15
16
 
@@ -1,4 +1,4 @@
1
1
  export interface GetLocationQueryResponse {
2
- queryHash: string
3
2
  answerHash?: string
3
+ queryHash: string
4
4
  }
@@ -1,8 +1,8 @@
1
1
  export class RemoteDivinerError extends Error {
2
+ isRemoteDivinerError = true
2
3
  constructor(action: string, error: Error['cause'], message?: string) {
3
4
  super(`Remote Diviner [${action}] failed${message ? ` (${message})` : ''}`, { cause: error })
4
5
  }
5
- isRemoteDivinerError = true
6
6
  static isRemoteDivinerError(error: unknown): RemoteDivinerError | undefined {
7
7
  return (error as RemoteDivinerError).isRemoteDivinerError ? (error as RemoteDivinerError) : undefined
8
8
  }
@@ -6,7 +6,7 @@ export type XyoRemoteDivinerConfigSchema = 'network.xyo.diviner.remote.config'
6
6
  export const XyoRemoteDivinerConfigSchema: XyoRemoteDivinerConfigSchema = 'network.xyo.diviner.remote.config'
7
7
 
8
8
  export type XyoRemoteDivinerConfig = XyoDivinerConfig & {
9
- schema: XyoRemoteDivinerConfigSchema
10
9
  api?: XyoArchivistApi
11
10
  archive?: string
11
+ schema: XyoRemoteDivinerConfigSchema
12
12
  }
package/src/Simple.ts CHANGED
@@ -12,15 +12,15 @@ export class XyoApiSimple<
12
12
  Q extends XyoApiSimpleQuery = XyoApiSimpleQuery,
13
13
  C extends XyoApiConfig = XyoApiConfig,
14
14
  > extends XyoApiBase<C> {
15
- public async get(): Promise<XyoApiResponseBody<T>>
16
- public async get(responseType?: 'body'): Promise<XyoApiResponseBody<T>>
17
- public async get(responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
18
- public async get(responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
15
+ public async delete(): Promise<XyoApiResponseBody<T>>
16
+ public async delete(responseType?: 'body'): Promise<XyoApiResponseBody<T>>
17
+ public async delete(responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
18
+ public async delete(responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
19
19
  switch (responseType) {
20
20
  case 'tuple':
21
- return await this.getEndpoint(undefined, 'tuple')
21
+ return await this.deleteEndpoint(undefined, 'tuple')
22
22
  default:
23
- return await this.getEndpoint(undefined)
23
+ return await this.deleteEndpoint(undefined)
24
24
  }
25
25
  }
26
26
 
@@ -36,6 +36,18 @@ export class XyoApiSimple<
36
36
  }
37
37
  }
38
38
 
39
+ public async get(): Promise<XyoApiResponseBody<T>>
40
+ public async get(responseType?: 'body'): Promise<XyoApiResponseBody<T>>
41
+ public async get(responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
42
+ public async get(responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
43
+ switch (responseType) {
44
+ case 'tuple':
45
+ return await this.getEndpoint(undefined, 'tuple')
46
+ default:
47
+ return await this.getEndpoint(undefined)
48
+ }
49
+ }
50
+
39
51
  public async post(data?: D): Promise<XyoApiResponseBody<T>>
40
52
  public async post(data?: D, responseType?: 'body'): Promise<XyoApiResponseBody<T>>
41
53
  public async post(data?: D, responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
@@ -59,16 +71,4 @@ export class XyoApiSimple<
59
71
  return await this.putEndpoint(undefined, data)
60
72
  }
61
73
  }
62
-
63
- public async delete(): Promise<XyoApiResponseBody<T>>
64
- public async delete(responseType?: 'body'): Promise<XyoApiResponseBody<T>>
65
- public async delete(responseType?: 'tuple'): Promise<XyoApiResponseTuple<T>>
66
- public async delete(responseType?: XyoApiResponseType): Promise<XyoApiResponseTupleOrBody<T>> {
67
- switch (responseType) {
68
- case 'tuple':
69
- return await this.deleteEndpoint(undefined, 'tuple')
70
- default:
71
- return await this.deleteEndpoint(undefined)
72
- }
73
- }
74
74
  }