@xyo-network/api-models 4.0.3 → 4.1.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.
@@ -0,0 +1,58 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+
3
+ interface ApiError<T = any, D = any> extends AxiosError<T, D> {
4
+ isError: true;
5
+ }
6
+
7
+ type ApiWarning = Error;
8
+
9
+ interface ApiEnvelopeBase {
10
+ warning?: ApiWarning[];
11
+ }
12
+ interface ApiEnvelopeSuccess<T> extends ApiEnvelopeBase {
13
+ data: T;
14
+ errors: never;
15
+ }
16
+ interface ApiEnvelopeError extends ApiEnvelopeBase {
17
+ data: never;
18
+ errors: ApiError[];
19
+ }
20
+ type ApiEnvelope<T> = ApiEnvelopeSuccess<T> | ApiEnvelopeError;
21
+
22
+ type ApiResponse<T = unknown, D = unknown> = AxiosResponse<T, D>;
23
+ type ApiResponseBody<T> = T | undefined;
24
+ type ApiResponseTuple<T> = [T | undefined, ApiEnvelope<T | undefined>, ApiResponse<ApiEnvelope<T | undefined>>];
25
+ type ApiResponseTupleOrBody<T> = ApiResponseTuple<T> | ApiResponseBody<T>;
26
+ type ApiResponseType = 'body' | 'tuple';
27
+
28
+ interface ApiReportable {
29
+ onError?: (error: ApiError, depth: number) => void;
30
+ onFailure?: (response: ApiResponse, depth: number) => void;
31
+ onSuccess?: (response: ApiResponse, depth: number) => void;
32
+ }
33
+
34
+ interface ApiConfig extends ApiReportable {
35
+ /** @description The domain where the api is located */
36
+ apiDomain: string;
37
+ /** @description The apiKey used for authentication */
38
+ apiKey?: string;
39
+ /** @description Threshold for Content-Size to cause automatic gzip of request body [default = 1024] */
40
+ compressionThreshold?: number;
41
+ /** @description The jwtToken of the currently logged in user */
42
+ jwtToken?: string;
43
+ /** @description The query string, if any, that is added to the end of every request */
44
+ query?: string;
45
+ /** @description Parent that should also report events from this api */
46
+ reportableParent?: ApiReportable;
47
+ /** @description The location in the API tree where this API object is mounted */
48
+ root?: string;
49
+ /** @description Throw on error */
50
+ throwError?: boolean;
51
+ /** @description Throw on failures */
52
+ throwFailure?: boolean;
53
+ /** @deprecated use the jwtToken instead */
54
+ userid?: string;
55
+ }
56
+ //# sourceMappingURL=Config.d.ts.map
57
+
58
+ export type { ApiConfig, ApiEnvelope, ApiEnvelopeBase, ApiEnvelopeError, ApiEnvelopeSuccess, ApiError, ApiReportable, ApiResponse, ApiResponseBody, ApiResponseTuple, ApiResponseTupleOrBody, ApiResponseType, ApiWarning };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/api-models",
3
- "version": "4.0.3",
3
+ "version": "4.1.1",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -21,19 +21,19 @@
21
21
  "type": "module",
22
22
  "exports": {
23
23
  ".": {
24
- "types": "./dist/types/index.d.ts",
24
+ "types": "./dist/neutral/index.d.ts",
25
25
  "default": "./dist/neutral/index.mjs"
26
26
  },
27
27
  "./package.json": "./package.json"
28
28
  },
29
29
  "module": "dist/neutral/index.mjs",
30
- "types": "dist/types/index.d.ts",
30
+ "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
32
  "axios": "^1.10.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@xylabs/ts-scripts-yarn3": "^6.5.18",
36
- "@xylabs/tsconfig": "^6.5.18",
35
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.23",
36
+ "@xylabs/tsconfig": "^7.0.0-rc.23",
37
37
  "typescript": "^5.8.3"
38
38
  },
39
39
  "publishConfig": {
@@ -1,7 +0,0 @@
1
- export * from './Config.ts';
2
- export * from './Envelope.ts';
3
- export * from './Error.ts';
4
- export * from './Reportable.ts';
5
- export * from './Response.ts';
6
- export * from './Warning.ts';
7
- //# sourceMappingURL=index.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes