@xyo-network/api-models 2.39.0-rc.5

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 (68) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +81 -0
  3. package/dist/cjs/Config.d.ts +25 -0
  4. package/dist/cjs/Config.d.ts.map +1 -0
  5. package/dist/cjs/Config.js +3 -0
  6. package/dist/cjs/Config.js.map +1 -0
  7. package/dist/cjs/Envelope.d.ts +15 -0
  8. package/dist/cjs/Envelope.d.ts.map +1 -0
  9. package/dist/cjs/Envelope.js +3 -0
  10. package/dist/cjs/Envelope.js.map +1 -0
  11. package/dist/cjs/Error.d.ts +5 -0
  12. package/dist/cjs/Error.d.ts.map +1 -0
  13. package/dist/cjs/Error.js +3 -0
  14. package/dist/cjs/Error.js.map +1 -0
  15. package/dist/cjs/Reportable.d.ts +8 -0
  16. package/dist/cjs/Reportable.d.ts.map +1 -0
  17. package/dist/cjs/Reportable.js +3 -0
  18. package/dist/cjs/Reportable.js.map +1 -0
  19. package/dist/cjs/Response.d.ts +8 -0
  20. package/dist/cjs/Response.d.ts.map +1 -0
  21. package/dist/cjs/Response.js +3 -0
  22. package/dist/cjs/Response.js.map +1 -0
  23. package/dist/cjs/Warning.d.ts +2 -0
  24. package/dist/cjs/Warning.d.ts.map +1 -0
  25. package/dist/cjs/Warning.js +3 -0
  26. package/dist/cjs/Warning.js.map +1 -0
  27. package/dist/cjs/index.d.ts +7 -0
  28. package/dist/cjs/index.d.ts.map +1 -0
  29. package/dist/cjs/index.js +10 -0
  30. package/dist/cjs/index.js.map +1 -0
  31. package/dist/docs.json +1699 -0
  32. package/dist/esm/Config.d.ts +25 -0
  33. package/dist/esm/Config.d.ts.map +1 -0
  34. package/dist/esm/Config.js +2 -0
  35. package/dist/esm/Config.js.map +1 -0
  36. package/dist/esm/Envelope.d.ts +15 -0
  37. package/dist/esm/Envelope.d.ts.map +1 -0
  38. package/dist/esm/Envelope.js +2 -0
  39. package/dist/esm/Envelope.js.map +1 -0
  40. package/dist/esm/Error.d.ts +5 -0
  41. package/dist/esm/Error.d.ts.map +1 -0
  42. package/dist/esm/Error.js +2 -0
  43. package/dist/esm/Error.js.map +1 -0
  44. package/dist/esm/Reportable.d.ts +8 -0
  45. package/dist/esm/Reportable.d.ts.map +1 -0
  46. package/dist/esm/Reportable.js +2 -0
  47. package/dist/esm/Reportable.js.map +1 -0
  48. package/dist/esm/Response.d.ts +8 -0
  49. package/dist/esm/Response.d.ts.map +1 -0
  50. package/dist/esm/Response.js +2 -0
  51. package/dist/esm/Response.js.map +1 -0
  52. package/dist/esm/Warning.d.ts +2 -0
  53. package/dist/esm/Warning.d.ts.map +1 -0
  54. package/dist/esm/Warning.js +2 -0
  55. package/dist/esm/Warning.js.map +1 -0
  56. package/dist/esm/index.d.ts +7 -0
  57. package/dist/esm/index.d.ts.map +1 -0
  58. package/dist/esm/index.js +7 -0
  59. package/dist/esm/index.js.map +1 -0
  60. package/package.json +53 -0
  61. package/src/Config.ts +35 -0
  62. package/src/Envelope.ts +18 -0
  63. package/src/Error.ts +6 -0
  64. package/src/Reportable.ts +10 -0
  65. package/src/Response.ts +13 -0
  66. package/src/Warning.ts +1 -0
  67. package/src/index.ts +6 -0
  68. package/typedoc.json +11 -0
@@ -0,0 +1,25 @@
1
+ import { XyoApiReportable } from './Reportable';
2
+ interface XyoApiConfig extends XyoApiReportable {
3
+ /** @description The domain where the api is located */
4
+ apiDomain: string;
5
+ /** @description The apiKey used for authentication */
6
+ apiKey?: string;
7
+ /** @description Threshold for Content-Size to cause automatic gzip of request body [default = 1024] */
8
+ compressionThreshold?: number;
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;
13
+ /** @description Parent that should also report events from this api */
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
+ }
24
+ export type { XyoApiConfig };
25
+ //# sourceMappingURL=Config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { XyoApiError } from './Error';
2
+ import { XyoApiWarning } from './Warning';
3
+ export interface XyoApiEnvelopeBase {
4
+ warning?: XyoApiWarning[];
5
+ }
6
+ export interface XyoApiEnvelopeSuccess<T> extends XyoApiEnvelopeBase {
7
+ data: T;
8
+ error: never;
9
+ }
10
+ export interface XyoApiEnvelopeError extends XyoApiEnvelopeBase {
11
+ data: never;
12
+ error: XyoApiError[];
13
+ }
14
+ export declare type XyoApiEnvelope<T> = XyoApiEnvelopeSuccess<T> | XyoApiEnvelopeError;
15
+ //# sourceMappingURL=Envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Envelope.d.ts","sourceRoot":"","sources":["../../src/Envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,aAAa,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAClE,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,EAAE,KAAK,CAAA;CACb;AAED,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB;AAED,oBAAY,cAAc,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Envelope.js","sourceRoot":"","sources":["../../src/Envelope.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { AxiosError } from 'axios';
2
+ export interface XyoApiError<T = any, D = any> extends AxiosError<T, D> {
3
+ isXyoError: true;
4
+ }
5
+ //# sourceMappingURL=Error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGlC,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;IACrE,UAAU,EAAE,IAAI,CAAA;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Error.js","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { XyoApiError } from './Error';
2
+ import { XyoApiResponse } from './Response';
3
+ export interface XyoApiReportable {
4
+ onError?: (error: XyoApiError, depth: number) => void;
5
+ onFailure?: (response: XyoApiResponse, depth: number) => void;
6
+ onSuccess?: (response: XyoApiResponse, depth: number) => void;
7
+ }
8
+ //# sourceMappingURL=Reportable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Reportable.d.ts","sourceRoot":"","sources":["../../src/Reportable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAErD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAE7D,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Reportable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Reportable.js","sourceRoot":"","sources":["../../src/Reportable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { XyoApiEnvelope } from './Envelope';
3
+ export declare type XyoApiResponse<T = unknown, D = unknown> = AxiosResponse<T, D>;
4
+ export declare type XyoApiResponseBody<T> = T | undefined;
5
+ export declare type XyoApiResponseTuple<T> = [T | undefined, XyoApiEnvelope<T | undefined>, XyoApiResponse<XyoApiEnvelope<T | undefined>>];
6
+ export declare type XyoApiResponseTupleOrBody<T> = XyoApiResponseTuple<T> | XyoApiResponseBody<T>;
7
+ export declare type XyoApiResponseType = 'body' | 'tuple';
8
+ //# sourceMappingURL=Response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../src/Response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,oBAAY,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAE1E,oBAAY,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;AAEjD,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAElI,oBAAY,yBAAyB,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAA;AAEzF,oBAAY,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Response.js","sourceRoot":"","sources":["../../src/Response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare type XyoApiWarning = Error;
2
+ //# sourceMappingURL=Warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Warning.d.ts","sourceRoot":"","sources":["../../src/Warning.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG,KAAK,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Warning.js","sourceRoot":"","sources":["../../src/Warning.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export * from './Config';
2
+ export * from './Envelope';
3
+ export * from './Error';
4
+ export * from './Reportable';
5
+ export * from './Response';
6
+ export * from './Warning';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA"}
@@ -0,0 +1,7 @@
1
+ export * from './Config';
2
+ export * from './Envelope';
3
+ export * from './Error';
4
+ export * from './Reportable';
5
+ export * from './Response';
6
+ export * from './Warning';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "author": {
3
+ "email": "support@xyo.network",
4
+ "name": "XYO Development Team",
5
+ "url": "https://xyo.network"
6
+ },
7
+ "bugs": {
8
+ "email": "support@xyo.network",
9
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
10
+ },
11
+ "dependencies": {
12
+ "tslib": "^2.4.1"
13
+ },
14
+ "peerDependencies": {
15
+ "axios": "^1.1.3"
16
+ },
17
+ "description": "Primary SDK for using XYO Protocol 2.0",
18
+ "browser": "dist/esm/index.js",
19
+ "docs": "dist/docs.json",
20
+ "exports": {
21
+ ".": {
22
+ "node": {
23
+ "import": "./dist/esm/index.js",
24
+ "require": "./dist/cjs/index.js"
25
+ },
26
+ "browser": {
27
+ "import": "./dist/esm/index.js",
28
+ "require": "./dist/cjs/index.js"
29
+ },
30
+ "default": "./dist/esm/index.js"
31
+ },
32
+ "./dist/docs.json": {
33
+ "default": "./dist/docs.json"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "main": "dist/cjs/index.js",
38
+ "module": "dist/esm/index.js",
39
+ "homepage": "https://xyo.network",
40
+ "license": "LGPL-3.0-only",
41
+ "name": "@xyo-network/api-models",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
48
+ },
49
+ "sideEffects": false,
50
+ "types": "dist/esm/index.d.ts",
51
+ "version": "2.39.0-rc.5",
52
+ "stableVersion": "2.38.8"
53
+ }
package/src/Config.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { XyoApiReportable } from './Reportable'
2
+
3
+ interface XyoApiConfig extends XyoApiReportable {
4
+ /** @description The domain where the api is located */
5
+ apiDomain: string
6
+
7
+ /** @description The apiKey used for authentication */
8
+ apiKey?: string
9
+
10
+ /** @description Threshold for Content-Size to cause automatic gzip of request body [default = 1024] */
11
+ compressionThreshold?: number
12
+
13
+ /** @description The jwtToken of the currently logged in user */
14
+ jwtToken?: string
15
+
16
+ /** @description The query string, if any, that is added to the end of every request */
17
+ query?: string
18
+
19
+ /** @description Parent that should also report events from this api */
20
+ reportableParent?: XyoApiReportable
21
+
22
+ /** @description The location in the API tree where this API object is mounted */
23
+ root?: string
24
+
25
+ /** @description Throw on error */
26
+ throwError?: boolean
27
+
28
+ /** @description Throw on failures */
29
+ throwFailure?: boolean
30
+
31
+ /** @deprecated use the jwtToken instead*/
32
+ userid?: string
33
+ }
34
+
35
+ export type { XyoApiConfig }
@@ -0,0 +1,18 @@
1
+ import { XyoApiError } from './Error'
2
+ import { XyoApiWarning } from './Warning'
3
+
4
+ export interface XyoApiEnvelopeBase {
5
+ warning?: XyoApiWarning[]
6
+ }
7
+
8
+ export interface XyoApiEnvelopeSuccess<T> extends XyoApiEnvelopeBase {
9
+ data: T
10
+ error: never
11
+ }
12
+
13
+ export interface XyoApiEnvelopeError extends XyoApiEnvelopeBase {
14
+ data: never
15
+ error: XyoApiError[]
16
+ }
17
+
18
+ export type XyoApiEnvelope<T> = XyoApiEnvelopeSuccess<T> | XyoApiEnvelopeError
package/src/Error.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { AxiosError } from 'axios'
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ export interface XyoApiError<T = any, D = any> extends AxiosError<T, D> {
5
+ isXyoError: true
6
+ }
@@ -0,0 +1,10 @@
1
+ import { XyoApiError } from './Error'
2
+ import { XyoApiResponse } from './Response'
3
+
4
+ export interface XyoApiReportable {
5
+ onError?: (error: XyoApiError, depth: number) => void
6
+
7
+ onFailure?: (response: XyoApiResponse, depth: number) => void
8
+
9
+ onSuccess?: (response: XyoApiResponse, depth: number) => void
10
+ }
@@ -0,0 +1,13 @@
1
+ import { AxiosResponse } from 'axios'
2
+
3
+ import { XyoApiEnvelope } from './Envelope'
4
+
5
+ export type XyoApiResponse<T = unknown, D = unknown> = AxiosResponse<T, D>
6
+
7
+ export type XyoApiResponseBody<T> = T | undefined
8
+
9
+ export type XyoApiResponseTuple<T> = [T | undefined, XyoApiEnvelope<T | undefined>, XyoApiResponse<XyoApiEnvelope<T | undefined>>]
10
+
11
+ export type XyoApiResponseTupleOrBody<T> = XyoApiResponseTuple<T> | XyoApiResponseBody<T>
12
+
13
+ export type XyoApiResponseType = 'body' | 'tuple'
package/src/Warning.ts ADDED
@@ -0,0 +1 @@
1
+ export type XyoApiWarning = Error
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from './Config'
2
+ export * from './Envelope'
3
+ export * from './Error'
4
+ export * from './Reportable'
5
+ export * from './Response'
6
+ export * from './Warning'
package/typedoc.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "intentionallyNotExported": [
3
+ "WithXyoPayloadMeta",
4
+ "XyoPayload",
5
+ "XyoPayloadFull",
6
+ "XyoBoundWitness",
7
+ "XyoDataLike",
8
+ "Huri",
9
+ "XyoSchemaPayload"
10
+ ]
11
+ }