@xylabs/api 5.0.84 → 5.0.86
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 +49 -79
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
18
20
|
## Reference
|
|
19
21
|
|
|
20
22
|
**@xylabs/api**
|
|
@@ -23,24 +25,34 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
23
25
|
|
|
24
26
|
## Classes
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
| Class | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [ApiClient](#classes/ApiClient) | Abstract base class for API clients that provides stage and token configuration. |
|
|
31
|
+
| [ApiEndpoint](#classes/ApiEndpoint) | Generic REST API endpoint wrapper that supports fetching and inserting typed data. |
|
|
28
32
|
|
|
29
33
|
## Interfaces
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
| Interface | Description |
|
|
36
|
+
| ------ | ------ |
|
|
37
|
+
| [ApiConfig](#interfaces/ApiConfig) | Configuration for connecting to an API, including domain, authentication, and user identification. |
|
|
32
38
|
|
|
33
39
|
## Type Aliases
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
| Type Alias | Description |
|
|
42
|
+
| ------ | ------ |
|
|
43
|
+
| [ApiStage](#type-aliases/ApiStage) | A valid API stage value ('prod', 'beta', or 'local'). |
|
|
36
44
|
|
|
37
45
|
## Variables
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
| Variable | Description |
|
|
48
|
+
| ------ | ------ |
|
|
49
|
+
| [ApiStage](#variables/ApiStage) | Deployment stage identifiers for API environments. |
|
|
40
50
|
|
|
41
51
|
## Functions
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
| Function | Description |
|
|
54
|
+
| ------ | ------ |
|
|
55
|
+
| [getApiStage](#functions/getApiStage) | Determines the API stage based on the hostname. |
|
|
44
56
|
|
|
45
57
|
### classes
|
|
46
58
|
|
|
@@ -57,18 +69,15 @@ Abstract base class for API clients that provides stage and token configuration.
|
|
|
57
69
|
### Constructor
|
|
58
70
|
|
|
59
71
|
```ts
|
|
60
|
-
new ApiClient(token
|
|
72
|
+
new ApiClient(token?: string | null, stage?: ApiStage): ApiClient;
|
|
61
73
|
```
|
|
62
74
|
|
|
63
75
|
### Parameters
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`string`
|
|
68
|
-
|
|
69
|
-
#### stage?
|
|
70
|
-
|
|
71
|
-
[`ApiStage`](#../type-aliases/ApiStage)
|
|
77
|
+
| Parameter | Type |
|
|
78
|
+
| ------ | ------ |
|
|
79
|
+
| `token?` | `string` \| `null` |
|
|
80
|
+
| `stage?` | [`ApiStage`](#../type-aliases/ApiStage) |
|
|
72
81
|
|
|
73
82
|
### Returns
|
|
74
83
|
|
|
@@ -76,19 +85,10 @@ new ApiClient(token?, stage?): ApiClient;
|
|
|
76
85
|
|
|
77
86
|
## Properties
|
|
78
87
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
protected
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
***
|
|
86
|
-
|
|
87
|
-
### token?
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
protected optional token: string | null;
|
|
91
|
-
```
|
|
88
|
+
| Property | Modifier | Type |
|
|
89
|
+
| ------ | ------ | ------ |
|
|
90
|
+
| <a id="stage"></a> `stage?` | `protected` | [`ApiStage`](#../type-aliases/ApiStage) |
|
|
91
|
+
| <a id="token"></a> `token?` | `protected` | `string` \| `null` |
|
|
92
92
|
|
|
93
93
|
## Methods
|
|
94
94
|
|
|
@@ -112,29 +112,24 @@ Generic REST API endpoint wrapper that supports fetching and inserting typed dat
|
|
|
112
112
|
|
|
113
113
|
## Type Parameters
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
`T`
|
|
118
|
-
|
|
119
|
-
The type of data returned by the endpoint
|
|
115
|
+
| Type Parameter | Description |
|
|
116
|
+
| ------ | ------ |
|
|
117
|
+
| `T` | The type of data returned by the endpoint |
|
|
120
118
|
|
|
121
119
|
## Constructors
|
|
122
120
|
|
|
123
121
|
### Constructor
|
|
124
122
|
|
|
125
123
|
```ts
|
|
126
|
-
new ApiEndpoint<T>(config, path): ApiEndpoint<T>;
|
|
124
|
+
new ApiEndpoint<T>(config: ApiConfig, path: string): ApiEndpoint<T>;
|
|
127
125
|
```
|
|
128
126
|
|
|
129
127
|
### Parameters
|
|
130
128
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
[`ApiConfig`](#../interfaces/ApiConfig)
|
|
134
|
-
|
|
135
|
-
#### path
|
|
136
|
-
|
|
137
|
-
`string`
|
|
129
|
+
| Parameter | Type |
|
|
130
|
+
| ------ | ------ |
|
|
131
|
+
| `config` | [`ApiConfig`](#../interfaces/ApiConfig) |
|
|
132
|
+
| `path` | `string` |
|
|
138
133
|
|
|
139
134
|
### Returns
|
|
140
135
|
|
|
@@ -183,14 +178,14 @@ get(): Promise<T | NonNullable<T>>;
|
|
|
183
178
|
### insert()
|
|
184
179
|
|
|
185
180
|
```ts
|
|
186
|
-
insert(value): Promise<T>;
|
|
181
|
+
insert(value: T): Promise<T>;
|
|
187
182
|
```
|
|
188
183
|
|
|
189
184
|
### Parameters
|
|
190
185
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
`T`
|
|
186
|
+
| Parameter | Type |
|
|
187
|
+
| ------ | ------ |
|
|
188
|
+
| `value` | `T` |
|
|
194
189
|
|
|
195
190
|
### Returns
|
|
196
191
|
|
|
@@ -205,18 +200,16 @@ insert(value): Promise<T>;
|
|
|
205
200
|
***
|
|
206
201
|
|
|
207
202
|
```ts
|
|
208
|
-
function getApiStage(hostname): "beta" | "local" | "prod";
|
|
203
|
+
function getApiStage(hostname: string): "beta" | "local" | "prod";
|
|
209
204
|
```
|
|
210
205
|
|
|
211
206
|
Determines the API stage based on the hostname.
|
|
212
207
|
|
|
213
208
|
## Parameters
|
|
214
209
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
`string`
|
|
218
|
-
|
|
219
|
-
The hostname to evaluate
|
|
210
|
+
| Parameter | Type | Description |
|
|
211
|
+
| ------ | ------ | ------ |
|
|
212
|
+
| `hostname` | `string` | The hostname to evaluate |
|
|
220
213
|
|
|
221
214
|
## Returns
|
|
222
215
|
|
|
@@ -236,35 +229,12 @@ Configuration for connecting to an API, including domain, authentication, and us
|
|
|
236
229
|
|
|
237
230
|
## Properties
|
|
238
231
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
***
|
|
246
|
-
|
|
247
|
-
### apiKey?
|
|
248
|
-
|
|
249
|
-
```ts
|
|
250
|
-
optional apiKey: string;
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
***
|
|
254
|
-
|
|
255
|
-
### jwtToken?
|
|
256
|
-
|
|
257
|
-
```ts
|
|
258
|
-
optional jwtToken: string;
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
***
|
|
262
|
-
|
|
263
|
-
### userid?
|
|
264
|
-
|
|
265
|
-
```ts
|
|
266
|
-
optional userid: string;
|
|
267
|
-
```
|
|
232
|
+
| Property | Type |
|
|
233
|
+
| ------ | ------ |
|
|
234
|
+
| <a id="apidomain"></a> `apiDomain` | `string` |
|
|
235
|
+
| <a id="apikey"></a> `apiKey?` | `string` |
|
|
236
|
+
| <a id="jwttoken"></a> `jwtToken?` | `string` |
|
|
237
|
+
| <a id="userid"></a> `userid?` | `string` |
|
|
268
238
|
|
|
269
239
|
### type-aliases
|
|
270
240
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/api",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.86",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"!**/*.test.*"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@xylabs/enum": "~5.0.
|
|
45
|
-
"@xylabs/typeof": "~5.0.
|
|
44
|
+
"@xylabs/enum": "~5.0.86",
|
|
45
|
+
"@xylabs/typeof": "~5.0.86"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
49
|
-
"@xylabs/tsconfig": "~7.4.
|
|
48
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.16",
|
|
49
|
+
"@xylabs/tsconfig": "~7.4.16",
|
|
50
50
|
"axios": "^1.13.6",
|
|
51
51
|
"typescript": "~5.9.3",
|
|
52
52
|
"vitest": "~4.0.18"
|