@xyo-network/api 7.0.12 → 7.0.14

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.
package/README.md CHANGED
@@ -1,3 +1,49 @@
1
+ [![logo][]](https://xyo.network)
2
+
1
3
  # @xyo-network/api
2
4
 
3
- Deprecated compatibility stub. Use `@xyo-network/sdk-protocol/api` instead.
5
+ [![npm][npm-badge]][npm-link]
6
+ [![license][license-badge]][license-link]
7
+
8
+ > Primary SDK for using XYO Protocol 2.0
9
+
10
+ ## Install
11
+
12
+ Using npm:
13
+
14
+ ```sh
15
+ npm install {{name}}
16
+ ```
17
+
18
+ Using yarn:
19
+
20
+ ```sh
21
+ yarn add {{name}}
22
+ ```
23
+
24
+ Using pnpm:
25
+
26
+ ```sh
27
+ pnpm add {{name}}
28
+ ```
29
+
30
+ Using bun:
31
+
32
+ ```sh
33
+ bun add {{name}}
34
+ ```
35
+
36
+
37
+ ## License
38
+
39
+ See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
40
+
41
+ ## Credits
42
+
43
+ [Made with 🔥 and ❄️ by XYO Foundation](https://xyo.network)
44
+
45
+ [npm-badge]: https://img.shields.io/npm/v/@xyo-network/api.svg
46
+ [npm-link]: https://www.npmjs.com/package/@xyo-network/api
47
+ [license-badge]: https://img.shields.io/npm/l/@xyo-network/api.svg
48
+ [license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
49
+ [logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
@@ -0,0 +1,8 @@
1
+ import type { ApiConfig } from '@xyo-network/api-models';
2
+ import { Huri } from '@xyo-network/huri';
3
+ import type { Payload } from '@xyo-network/payload-model';
4
+ import { ApiSimple } from '../Simple.ts';
5
+ export declare class ArchivistApi<C extends ApiConfig = ApiConfig> extends ApiSimple<Payload[], C> {
6
+ huri(huri: Huri | string): ApiSimple<Payload, Payload, import("@xyo-network/payload-model").PayloadFindFilter, ApiConfig>;
7
+ }
8
+ //# sourceMappingURL=Api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,qBAAa,YAAY,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACxF,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;CAOzB"}
@@ -0,0 +1,2 @@
1
+ export * from './Api.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Api/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { FetchJsonClient } from '@ariestools/sdk';
2
+ import type { ApiConfig, ApiEnvelope, ApiError, ApiReportable, ApiResponse, ApiResponseBody, ApiResponseTuple } from '@xyo-network/api-models';
3
+ export declare class ApiBase<C extends ApiConfig = ApiConfig> implements ApiReportable {
4
+ readonly config: C;
5
+ protected fetchClient: FetchJsonClient;
6
+ constructor(config: C);
7
+ private static resolveResponse;
8
+ private static shapeResponse;
9
+ private resolveRoot;
10
+ get authenticated(): boolean;
11
+ protected get headers(): Record<string, string>;
12
+ protected get query(): string;
13
+ protected get root(): string;
14
+ onError(error: ApiError, depth?: number): void;
15
+ onFailure(response: ApiResponse, depth?: number): void;
16
+ onSuccess(response: ApiResponse, depth?: number): void;
17
+ protected deleteEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>;
18
+ protected deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>;
19
+ protected deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
20
+ protected getEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>;
21
+ protected getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>;
22
+ protected getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
23
+ protected handleMonitorResponseError<T>(error: unknown, trapFetchException: boolean): ApiResponse<ApiEnvelope<T>> | undefined;
24
+ protected monitorResponse<T>(closure: () => Promise<ApiResponse<ApiEnvelope<T>>>): Promise<ApiResponse<ApiEnvelope<T>> | undefined>;
25
+ protected postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>;
26
+ protected postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>;
27
+ protected postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
28
+ protected putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>;
29
+ protected putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>;
30
+ protected putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
31
+ }
32
+ //# sourceMappingURL=Base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../src/Base.ts"],"names":[],"mappings":"AAAA,OAAO,EACa,eAAe,EAClC,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,yBAAyB,C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EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;cACtH,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAOzI"}
@@ -0,0 +1,22 @@
1
+ import type { ApiConfig, ApiResponseBody, ApiResponseTuple } from '@xyo-network/api-models';
2
+ import type { Payload, PayloadFindFilter } from '@xyo-network/payload-model';
3
+ import { ApiBase } from './Base.ts';
4
+ export type ApiSimpleQuery = PayloadFindFilter;
5
+ export declare class ApiSimple<T = Payload, D = T, Q extends ApiSimpleQuery = ApiSimpleQuery, C extends ApiConfig = ApiConfig> extends ApiBase<C> {
6
+ delete(): Promise<ApiResponseBody<T>>;
7
+ delete(responseType?: 'body'): Promise<ApiResponseBody<T>>;
8
+ delete(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
9
+ find(query?: Q): Promise<ApiResponseBody<T>>;
10
+ find(query?: Q, responseType?: 'body'): Promise<ApiResponseBody<T>>;
11
+ find(query?: Q, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
12
+ get(): Promise<ApiResponseBody<T>>;
13
+ get(responseType?: 'body'): Promise<ApiResponseBody<T>>;
14
+ get(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
15
+ post(data?: D): Promise<ApiResponseBody<T>>;
16
+ post(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>;
17
+ post(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
18
+ put(data?: D): Promise<ApiResponseBody<T>>;
19
+ put(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>;
20
+ put(data?: D, responseType?: 'tuple'): Promise<ApiResponseT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C,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACvD,GAAG,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAYzD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAYpE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC1C,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACjE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAW1E"}
@@ -0,0 +1,4 @@
1
+ export declare type WithArchive<ArchivistApiConfig> = ArchivistApiConfig & {
2
+ _archive?: string;
3
+ };
4
+ //# sourceMappingURL=WithArchive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithArchive.d.ts","sourceRoot":"","sources":["../../src/WithArchive.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,MAAM,WAAW,CAAC,kBAAkB,IAAI,kBAAkB,GAAG;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA"}
@@ -1,6 +1,6 @@
1
- /**
2
- * @deprecated Use `@xyo-network/sdk-protocol/api` instead.
3
- * `@xyo-network/api` is a backward-compatibility re-export stub.
4
- */
5
- export * from '@xyo-network/sdk-protocol/api';
1
+ export * from './Api/index.ts';
2
+ export * from './Base.ts';
3
+ export * from './models/index.ts';
4
+ export * from './Simple.ts';
5
+ export * from './WithArchive.ts';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,+BAA+B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA"}
@@ -1,3 +1,187 @@
1
- // src/index.ts
2
- export * from "@xyo-network/sdk-protocol/api";
1
+ // src/Api/Api.ts
2
+ import { Huri } from "@xyo-network/huri";
3
+
4
+ // src/Base.ts
5
+ import {
6
+ FetchClientError,
7
+ FetchJsonClient,
8
+ isString
9
+ } from "@ariestools/sdk";
10
+ var ApiBase = class _ApiBase {
11
+ config;
12
+ fetchClient;
13
+ constructor(config) {
14
+ this.config = config;
15
+ this.fetchClient = new FetchJsonClient({ ...this.config, headers: this.headers });
16
+ }
17
+ static resolveResponse(result) {
18
+ return [result?.data?.data, result?.data, result];
19
+ }
20
+ static shapeResponse(response, responseType) {
21
+ const resolvedResponse = this.resolveResponse(response);
22
+ return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
23
+ }
24
+ resolveRoot() {
25
+ return `${this.config.apiDomain}${this.root}`;
26
+ }
27
+ get authenticated() {
28
+ return isString(this.config.apiKey) || isString(this.config.jwtToken);
29
+ }
30
+ get headers() {
31
+ const headers = {};
32
+ if (isString(this.config.jwtToken)) {
33
+ headers.Authorization = `Bearer ${this.config.jwtToken}`;
34
+ }
35
+ if (isString(this.config.apiKey)) {
36
+ headers["x-api-key"] = this.config.apiKey;
37
+ }
38
+ return headers;
39
+ }
40
+ get query() {
41
+ return this.config.query ?? "";
42
+ }
43
+ get root() {
44
+ return this.config.root ?? "/";
45
+ }
46
+ onError(error, depth = 0) {
47
+ this.config.reportableParent?.onError?.(error, depth + 1);
48
+ this.config.onError?.(error, depth);
49
+ }
50
+ onFailure(response, depth = 0) {
51
+ this.config.reportableParent?.onFailure?.(response, depth + 1);
52
+ this.config.onFailure?.(response, depth);
53
+ }
54
+ onSuccess(response, depth = 0) {
55
+ this.config.reportableParent?.onSuccess?.(response, depth + 1);
56
+ this.config.onSuccess?.(response, depth);
57
+ }
58
+ async deleteEndpoint(endPoint = "", responseType) {
59
+ const response = await this.monitorResponse(async () => {
60
+ return await this.fetchClient.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
61
+ });
62
+ return _ApiBase.shapeResponse(response, responseType);
63
+ }
64
+ async getEndpoint(endPoint = "", responseType) {
65
+ const response = await this.monitorResponse(async () => {
66
+ return await this.fetchClient.get(`${this.resolveRoot()}${endPoint}${this.query}`);
67
+ });
68
+ return _ApiBase.shapeResponse(response, responseType);
69
+ }
70
+ handleMonitorResponseError(error, trapFetchException) {
71
+ if (!(error instanceof FetchClientError)) {
72
+ throw error;
73
+ }
74
+ if (trapFetchException) {
75
+ this.onFailure(error.response);
76
+ if (this.config.throwFailure === true) {
77
+ throw error;
78
+ }
79
+ return error.response;
80
+ }
81
+ }
82
+ async monitorResponse(closure) {
83
+ let trapFetchException = true;
84
+ try {
85
+ const response = await closure();
86
+ trapFetchException = false;
87
+ if (response.status < 300) {
88
+ this.onSuccess(response);
89
+ } else {
90
+ this.onFailure(response);
91
+ }
92
+ return response;
93
+ } catch (error) {
94
+ this.handleMonitorResponseError(error, trapFetchException);
95
+ }
96
+ }
97
+ async postEndpoint(endPoint = "", data, responseType) {
98
+ const response = await this.monitorResponse(async () => {
99
+ return await this.fetchClient.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
100
+ });
101
+ return _ApiBase.shapeResponse(response, responseType);
102
+ }
103
+ async putEndpoint(endPoint = "", data, responseType) {
104
+ const response = await this.monitorResponse(async () => {
105
+ return await this.fetchClient.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
106
+ });
107
+ return _ApiBase.shapeResponse(response, responseType);
108
+ }
109
+ };
110
+
111
+ // src/objToQuery.ts
112
+ var objToQuery = (obj) => {
113
+ return `?${Object.entries(obj).map(([key, value]) => {
114
+ return `${key}=${value}`;
115
+ }).filter((value) => value !== void 0).join("&")}`;
116
+ };
117
+
118
+ // src/Simple.ts
119
+ var ApiSimple = class extends ApiBase {
120
+ async delete(responseType) {
121
+ switch (responseType) {
122
+ case "tuple": {
123
+ return await this.deleteEndpoint(void 0, "tuple");
124
+ }
125
+ default: {
126
+ return await this.deleteEndpoint();
127
+ }
128
+ }
129
+ }
130
+ async find(query = {}, responseType) {
131
+ switch (responseType) {
132
+ case "tuple": {
133
+ return await this.getEndpoint(objToQuery(query), "tuple");
134
+ }
135
+ default: {
136
+ return await this.getEndpoint(objToQuery(query));
137
+ }
138
+ }
139
+ }
140
+ async get(responseType) {
141
+ switch (responseType) {
142
+ case "tuple": {
143
+ return await this.getEndpoint(void 0, "tuple");
144
+ }
145
+ default: {
146
+ return await this.getEndpoint();
147
+ }
148
+ }
149
+ }
150
+ async post(data, responseType) {
151
+ switch (responseType) {
152
+ case "tuple": {
153
+ return await this.postEndpoint(void 0, data, "tuple");
154
+ }
155
+ default: {
156
+ return await this.postEndpoint(void 0, data);
157
+ }
158
+ }
159
+ }
160
+ async put(data, responseType) {
161
+ switch (responseType) {
162
+ case "tuple": {
163
+ return await this.putEndpoint(void 0, data, "tuple");
164
+ }
165
+ default: {
166
+ return await this.putEndpoint(void 0, data);
167
+ }
168
+ }
169
+ }
170
+ };
171
+
172
+ // src/Api/Api.ts
173
+ var ArchivistApi = class extends ApiSimple {
174
+ huri(huri) {
175
+ const huriObj = typeof huri === "string" ? new Huri(huri) : huri;
176
+ return new ApiSimple({
177
+ ...this.config,
178
+ root: `${this.root}${huriObj.href}/`
179
+ });
180
+ }
181
+ };
182
+ export {
183
+ ApiBase,
184
+ ApiSimple,
185
+ ArchivistApi
186
+ };
3
187
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["/**\n * @deprecated Use `@xyo-network/sdk-protocol/api` instead.\n * `@xyo-network/api` is a backward-compatibility re-export stub.\n */\nexport * from '@xyo-network/sdk-protocol/api'\n"],
5
- "mappings": ";AAIA,cAAc;",
3
+ "sources": ["../../src/Api/Api.ts", "../../src/Base.ts", "../../src/objToQuery.ts", "../../src/Simple.ts"],
4
+ "sourcesContent": ["import type { ApiConfig } from '@xyo-network/api-models'\nimport { Huri } from '@xyo-network/huri'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { ApiSimple } from '../Simple.ts'\n\nexport class ArchivistApi<C extends ApiConfig = ApiConfig> extends ApiSimple<Payload[], C> {\n huri(huri: Huri | string) {\n const huriObj = typeof huri === 'string' ? new Huri(huri) : huri\n return new ApiSimple<Payload>({\n ...this.config,\n root: `${this.root}${huriObj.href}/`,\n })\n }\n}\n", "import {\n FetchClientError, FetchJsonClient, isString,\n} from '@ariestools/sdk'\nimport type {\n ApiConfig,\n ApiEnvelope,\n ApiError,\n ApiReportable,\n ApiResponse,\n ApiResponseBody,\n ApiResponseTuple,\n ApiResponseTupleOrBody,\n ApiResponseType,\n} from '@xyo-network/api-models'\n\nexport class ApiBase<C extends ApiConfig = ApiConfig> implements ApiReportable {\n readonly config: C\n protected fetchClient: FetchJsonClient\n\n constructor(config: C) {\n this.config = config\n this.fetchClient = new FetchJsonClient({ ...this.config, headers: this.headers })\n }\n\n private static resolveResponse<T>(result?: ApiResponse<ApiEnvelope<T>>) {\n return [result?.data?.data, result?.data, result] as ApiResponseTuple<T>\n }\n\n private static shapeResponse<T = unknown>(response: ApiResponse<ApiEnvelope<T>> | undefined, responseType?: ApiResponseType) {\n const resolvedResponse = this.resolveResponse(response)\n return responseType === 'tuple' ? resolvedResponse : resolvedResponse[0]\n }\n\n private resolveRoot() {\n return `${this.config.apiDomain}${this.root}`\n }\n\n get authenticated() {\n return isString(this.config.apiKey) || isString(this.config.jwtToken)\n }\n\n protected get headers(): Record<string, string> {\n const headers: Record<string, string> = {}\n if (isString(this.config.jwtToken)) {\n headers.Authorization = `Bearer ${this.config.jwtToken}`\n }\n if (isString(this.config.apiKey)) {\n headers['x-api-key'] = this.config.apiKey\n }\n return headers\n }\n\n protected get query() {\n return this.config.query ?? ''\n }\n\n protected get root() {\n return this.config.root ?? '/'\n }\n\n onError(error: ApiError, depth = 0) {\n this.config.reportableParent?.onError?.(error, depth + 1)\n this.config.onError?.(error, depth)\n }\n\n onFailure(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onFailure?.(response, depth + 1)\n this.config.onFailure?.(response, depth)\n }\n\n onSuccess(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onSuccess?.(response, depth + 1)\n this.config.onSuccess?.(response, depth)\n }\n\n protected async deleteEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async deleteEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.fetchClient.delete<ApiEnvelope<T>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async getEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async getEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.fetchClient.get<ApiEnvelope<T>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected handleMonitorResponseError<T>(error: unknown, trapFetchException: boolean) {\n if (!(error instanceof FetchClientError)) {\n throw error\n }\n\n if (trapFetchException) {\n this.onFailure(error.response)\n if (this.config.throwFailure === true) {\n throw error\n }\n return error.response as ApiResponse<ApiEnvelope<T>>\n }\n }\n\n protected async monitorResponse<T>(closure: () => Promise<ApiResponse<ApiEnvelope<T>>>) {\n // we use this to prevent accidental catching on exceptions in callbacks\n let trapFetchException = true\n try {\n const response = await closure()\n\n trapFetchException = false\n\n if (response.status < 300) {\n this.onSuccess(response)\n } else {\n this.onFailure(response)\n }\n\n return response\n } catch (error) {\n this.handleMonitorResponseError(error, trapFetchException)\n }\n }\n\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async postEndpoint<T = unknown, D = unknown>(\n endPoint = '',\n data?: D,\n responseType?: ApiResponseType,\n ): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.fetchClient.post<ApiEnvelope<T>>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint = '', data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.fetchClient.put<ApiEnvelope<T>>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n}\n", "export const objToQuery = (obj: Record<string, string | number | undefined>) => {\n return `?${Object.entries(obj)\n .map(([key, value]) => {\n return `${key}=${value}`\n })\n .filter(value => value !== undefined)\n .join('&')}`\n}\n", "import type {\n ApiConfig, ApiResponseBody, ApiResponseTuple, ApiResponseTupleOrBody, ApiResponseType,\n} from '@xyo-network/api-models'\nimport type { Payload, PayloadFindFilter } from '@xyo-network/payload-model'\n\nimport { ApiBase } from './Base.ts'\nimport { objToQuery } from './objToQuery.ts'\n\nexport type ApiSimpleQuery = PayloadFindFilter\n\nexport class ApiSimple<T = Payload, D = T, Q extends ApiSimpleQuery = ApiSimpleQuery, C extends ApiConfig = ApiConfig> extends ApiBase<C> {\n async delete(): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async delete(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple': {\n return await this.deleteEndpoint(undefined, 'tuple')\n }\n default: {\n return await this.deleteEndpoint()\n }\n }\n }\n\n async find(query?: Q): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async find(query = {}, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple': {\n return await this.getEndpoint(objToQuery(query), 'tuple')\n }\n default: {\n return await this.getEndpoint(objToQuery(query))\n }\n }\n }\n\n async get(): Promise<ApiResponseBody<T>>\n async get(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async get(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async get(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple': {\n return await this.getEndpoint(undefined, 'tuple')\n }\n default: {\n return await this.getEndpoint()\n }\n }\n }\n\n async post(data?: D): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async post(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple': {\n return await this.postEndpoint(undefined, data, 'tuple')\n }\n default: {\n return await this.postEndpoint(undefined, data)\n }\n }\n }\n\n async put(data?: D): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async put(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple': {\n return await this.putEndpoint(undefined, data, 'tuple')\n }\n default: {\n return await this.putEndpoint(undefined, data)\n }\n }\n }\n}\n"],
5
+ "mappings": ";AACA,SAAS,YAAY;;;ACDrB;AAAA,EACE;AAAA,EAAkB;AAAA,EAAiB;AAAA,OAC9B;AAaA,IAAM,UAAN,MAAM,SAAkE;AAAA,EACpE;AAAA,EACC;AAAA,EAEV,YAAY,QAAW;AACrB,SAAK,SAAS;AACd,SAAK,cAAc,IAAI,gBAAgB,EAAE,GAAG,KAAK,QAAQ,SAAS,KAAK,QAAQ,CAAC;AAAA,EAClF;AAAA,EAEA,OAAe,gBAAmB,QAAsC;AACtE,WAAO,CAAC,QAAQ,MAAM,MAAM,QAAQ,MAAM,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YAAY;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAAA,EAKA,MAAM,KAAK,MAAU,cAAoE;AACvF,YAAQ,cAAc;AAAA,MACpB,KAAK,SAAS;AACZ,eAAO,MAAM,KAAK,aAAa,QAAW,MAAM,OAAO;AAAA,MACzD;AAAA,MACA,SAAS;AACP,eAAO,MAAM,KAAK,aAAa,QAAW,IAAI;AAAA,MAChD;AAAA,IACF;AAAA,EACF;AAAA,EAKA,MAAM,IAAI,MAAU,cAAoE;AACtF,YAAQ,cAAc;AAAA,MACpB,KAAK,SAAS;AACZ,eAAO,MAAM,KAAK,YAAY,QAAW,MAAM,OAAO;AAAA,MACxD;AAAA,MACA,SAAS;AACP,eAAO,MAAM,KAAK,YAAY,QAAW,IAAI;AAAA,MAC/C;AAAA,IACF;AAAA,EACF;AACF;;;AH1EO,IAAM,eAAN,cAA4D,UAAwB;AAAA,EACzF,KAAK,MAAqB;AACxB,UAAM,UAAU,OAAO,SAAS,WAAW,IAAI,KAAK,IAAI,IAAI;AAC5D,WAAO,IAAI,UAAmB;AAAA,MAC5B,GAAG,KAAK;AAAA,MACR,MAAM,GAAG,KAAK,IAAI,GAAG,QAAQ,IAAI;AAAA,IACnC,CAAC;AAAA,EACH;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,4 @@
1
+ export interface ArchivePath {
2
+ archive: string;
3
+ }
4
+ //# sourceMappingURL=ArchivePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArchivePath.d.ts","sourceRoot":"","sources":["../../../src/models/ArchivePath.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,2 @@
1
+ export * from './ArchivePath.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const objToQuery: (obj: Record<string, string | number | undefined>) => string;
2
+ //# sourceMappingURL=objToQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objToQuery.d.ts","sourceRoot":"","sources":["../../src/objToQuery.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,WAO1E,CAAA"}
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@xyo-network/api",
3
- "version": "7.0.12",
4
- "description": "DEPRECATED - use @xyo-network/sdk-protocol/api. Backward-compatibility re-export stub for @xyo-network/api.",
5
- "deprecated": "Use @xyo-network/sdk-protocol/api instead. @xyo-network/api is a backward-compatibility re-export stub and will not receive further updates.",
3
+ "version": "7.0.14",
4
+ "description": "Primary SDK for using XYO Protocol 2.0",
6
5
  "homepage": "https://xyo.network",
7
6
  "bugs": {
8
7
  "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues",
@@ -35,34 +34,43 @@
35
34
  "README.md"
36
35
  ],
37
36
  "dependencies": {
38
- "@xyo-network/sdk-protocol": "~7.0.12"
37
+ "@xyo-network/huri": "~7.0.14",
38
+ "@xyo-network/api-models": "~7.0.14",
39
+ "@xyo-network/payload-model": "~7.0.14"
39
40
  },
40
41
  "devDependencies": {
41
- "@xylabs/toolchain": "~8.5.15",
42
- "@xylabs/tsconfig": "~8.5.15",
43
- "browserslist": "4.28.4",
44
- "eslint": "^10.6.0",
45
- "eslint-import-resolver-typescript": "^4.4.5",
46
- "typescript": "~6.0.3"
42
+ "@ariestools/sdk": "~8.0.2",
43
+ "@ariestools/threads": "~8.0.2",
44
+ "@ariestools/vitest-extended": "~8.0.2",
45
+ "@bitauth/libauth": "~3.0.0",
46
+ "@opentelemetry/api": "~1.9.1",
47
+ "@opentelemetry/sdk-trace-base": "~2.9.0",
48
+ "@scure/base": "~2.2.0",
49
+ "@xylabs/toolchain": "~8.6.3",
50
+ "@xylabs/tsconfig": "~8.6.3",
51
+ "async-mutex": "~0.5.0",
52
+ "debug": "~4.4.3",
53
+ "eslint": "~10.6.0",
54
+ "eslint-import-resolver-typescript": "~4.4.5",
55
+ "ethers": "~6.17.0",
56
+ "hash-wasm": "~4.12.0",
57
+ "observable-fns": "~0.6.1",
58
+ "typescript": "~6.0.3",
59
+ "vite": "~8.1.3",
60
+ "vitest": "~4.1.9",
61
+ "zod": "~4.4.3",
62
+ "@xyo-network/boundwitness-model": "~7.0.14",
63
+ "@xyo-network/query-payload-plugin": "~7.0.14"
47
64
  },
48
65
  "peerDependencies": {
49
- "@ariestools/sdk": "^7.0.4",
50
- "@bitauth/libauth": "~3.0",
51
- "@noble/post-quantum": "~0.6.1",
52
- "@opentelemetry/api": "^1.9",
53
- "@opentelemetry/sdk-trace-base": "^2.7",
54
- "@scure/base": "~2.2",
55
- "@scure/bip39": "~2.2",
56
- "@xylabs/geo": "^7.0",
57
- "@xylabs/threads": "^7.0",
58
- "ajv": "^8.20",
59
- "async-mutex": "^0.5",
60
- "debug": "^4.4",
61
- "ethers": "^6.16",
62
- "hash-wasm": "~4.12",
63
- "idb": "^8.0",
64
- "observable-fns": "^0.6",
65
- "zod": "^4.4"
66
+ "@ariestools/sdk": "^8.0.2",
67
+ "@bitauth/libauth": "^3.0.0",
68
+ "@opentelemetry/api": "^1.9.1",
69
+ "@opentelemetry/sdk-trace-base": "^2.9.0",
70
+ "@scure/base": "^2.2.0",
71
+ "async-mutex": "^0.5.0",
72
+ "ethers": "^6.17.0",
73
+ "zod": "^4.4.3"
66
74
  },
67
75
  "engines": {
68
76
  "node": "^24"