@xylabs/api 4.13.19 → 4.13.21

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
@@ -12,13 +12,274 @@
12
12
  [![snyk-badge][]][snyk-link]
13
13
  [![socket-badge][]][socket-link]
14
14
 
15
- Version: 4.13.15
16
15
 
17
16
  Base functionality used throughout XY Labs TypeScript/JavaScript libraries
18
17
 
19
- ## Documentation
18
+ ## API Documentation
19
+
20
+ **@xylabs/api**
21
+
22
+ ***
23
+
24
+ ## Classes
25
+
26
+ - [ApiClient](#classes/ApiClient)
27
+ - [ApiEndpoint](#classes/ApiEndpoint)
28
+
29
+ ## Interfaces
30
+
31
+ - [ApiConfig](#interfaces/ApiConfig)
32
+
33
+ ## Type Aliases
34
+
35
+ - [ApiStage](#type-aliases/ApiStage)
36
+
37
+ ## Variables
38
+
39
+ - [ApiStage](#variables/ApiStage)
40
+
41
+ ## Functions
42
+
43
+ - [getApiStage](#functions/getApiStage)
44
+
45
+ ### classes
46
+
47
+ ### <a id="ApiClient"></a>ApiClient
48
+
49
+ [**@xylabs/api**](#../README)
50
+
51
+ ***
52
+
53
+ ## Constructors
54
+
55
+ ### Constructor
56
+
57
+ ```ts
58
+ new ApiClient(token?, stage?): ApiClient;
59
+ ```
60
+
61
+ ### Parameters
62
+
63
+ #### token?
64
+
65
+ `null` | `string`
66
+
67
+ #### stage?
68
+
69
+ [`ApiStage`](#../type-aliases/ApiStage)
70
+
71
+ ### Returns
72
+
73
+ `ApiClient`
74
+
75
+ ## Properties
76
+
77
+ ### token?
78
+
79
+ ```ts
80
+ protected optional token: null | string;
81
+ ```
82
+
83
+ ***
84
+
85
+ ### stage?
86
+
87
+ ```ts
88
+ protected optional stage: ApiStage;
89
+ ```
90
+
91
+ ## Methods
92
+
93
+ ### endPoint()
94
+
95
+ ```ts
96
+ abstract endPoint(): string;
97
+ ```
98
+
99
+ ### Returns
100
+
101
+ `string`
102
+
103
+ ### <a id="ApiEndpoint"></a>ApiEndpoint
104
+
105
+ [**@xylabs/api**](#../README)
106
+
107
+ ***
108
+
109
+ ## Type Parameters
110
+
111
+ ### T
112
+
113
+ `T`
114
+
115
+ ## Constructors
116
+
117
+ ### Constructor
118
+
119
+ ```ts
120
+ new ApiEndpoint<T>(config, path): ApiEndpoint<T>;
121
+ ```
122
+
123
+ ### Parameters
124
+
125
+ #### config
126
+
127
+ [`ApiConfig`](#../interfaces/ApiConfig)
128
+
129
+ #### path
130
+
131
+ `string`
132
+
133
+ ### Returns
134
+
135
+ `ApiEndpoint`\<`T`\>
136
+
137
+ ## Accessors
138
+
139
+ ### value
140
+
141
+ ### Get Signature
142
+
143
+ ```ts
144
+ get value(): undefined | T;
145
+ ```
146
+
147
+ #### Returns
148
+
149
+ `undefined` \| `T`
150
+
151
+ ## Methods
152
+
153
+ ### fetch()
154
+
155
+ ```ts
156
+ fetch(): Promise<T>;
157
+ ```
158
+
159
+ ### Returns
160
+
161
+ `Promise`\<`T`\>
162
+
163
+ ***
164
+
165
+ ### get()
166
+
167
+ ```ts
168
+ get(): Promise<T | NonNullable<T>>;
169
+ ```
170
+
171
+ ### Returns
172
+
173
+ `Promise`\<`T` \| `NonNullable`\<`T`\>\>
174
+
175
+ ***
176
+
177
+ ### insert()
178
+
179
+ ```ts
180
+ insert(value): Promise<T>;
181
+ ```
182
+
183
+ ### Parameters
184
+
185
+ #### value
186
+
187
+ `T`
188
+
189
+ ### Returns
190
+
191
+ `Promise`\<`T`\>
192
+
193
+ ### functions
194
+
195
+ ### <a id="getApiStage"></a>getApiStage
196
+
197
+ [**@xylabs/api**](#../README)
198
+
199
+ ***
200
+
201
+ ```ts
202
+ function getApiStage(hostname): "beta" | "local" | "prod";
203
+ ```
204
+
205
+ ## Parameters
206
+
207
+ ### hostname
208
+
209
+ `string`
210
+
211
+ ## Returns
212
+
213
+ `"beta"` \| `"local"` \| `"prod"`
214
+
215
+ ### interfaces
216
+
217
+ ### <a id="ApiConfig"></a>ApiConfig
218
+
219
+ [**@xylabs/api**](#../README)
220
+
221
+ ***
222
+
223
+ ## Properties
224
+
225
+ ### apiDomain
226
+
227
+ ```ts
228
+ apiDomain: string;
229
+ ```
230
+
231
+ ***
232
+
233
+ ### apiKey?
234
+
235
+ ```ts
236
+ optional apiKey: string;
237
+ ```
238
+
239
+ ***
240
+
241
+ ### jwtToken?
242
+
243
+ ```ts
244
+ optional jwtToken: string;
245
+ ```
246
+
247
+ ***
248
+
249
+ ### userid?
250
+
251
+ ```ts
252
+ optional userid: string;
253
+ ```
254
+
255
+ ### type-aliases
256
+
257
+ ### <a id="ApiStage"></a>ApiStage
258
+
259
+ [**@xylabs/api**](#../README)
260
+
261
+ ***
262
+
263
+ ```ts
264
+ type ApiStage = EnumValue<typeof ApiStage>;
265
+ ```
266
+
267
+ ### variables
268
+
269
+ ### <a id="ApiStage"></a>ApiStage
270
+
271
+ [**@xylabs/api**](#../README)
272
+
273
+ ***
274
+
275
+ ```ts
276
+ const ApiStage: Enum<{
277
+ Beta: "beta";
278
+ Local: "local";
279
+ Prod: "prod";
280
+ }>;
281
+ ```
20
282
 
21
- Coming Soon!
22
283
 
23
284
  Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
24
285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/api",
3
- "version": "4.13.19",
3
+ "version": "4.13.21",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "xylabs",
@@ -28,23 +28,26 @@
28
28
  "exports": {
29
29
  ".": {
30
30
  "types": "./dist/neutral/index.d.ts",
31
+ "source": "./src/index.ts",
31
32
  "default": "./dist/neutral/index.mjs"
32
33
  },
33
34
  "./package.json": "./package.json"
34
35
  },
35
36
  "module": "./dist/neutral/index.mjs",
37
+ "source": "./src/index.ts",
36
38
  "types": "./dist/neutral/index.d.ts",
37
- "workspaces": [
38
- "packages/**/*"
39
+ "files": [
40
+ "dist",
41
+ "src"
39
42
  ],
40
43
  "dependencies": {
41
- "@xylabs/enum": "^4.13.19",
42
- "@xylabs/typeof": "^4.13.19",
44
+ "@xylabs/enum": "^4.13.21",
45
+ "@xylabs/typeof": "^4.13.21",
43
46
  "axios": "^1.10.0"
44
47
  },
45
48
  "devDependencies": {
46
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
47
- "@xylabs/tsconfig": "^7.0.0-rc.27",
49
+ "@xylabs/ts-scripts-yarn3": "^7.0.0",
50
+ "@xylabs/tsconfig": "^7.0.0",
48
51
  "typescript": "^5.8.3",
49
52
  "vitest": "^3.2.4"
50
53
  },
@@ -0,0 +1,12 @@
1
+ import {
2
+ describe, expect, test,
3
+ } from 'vitest'
4
+
5
+ import { ApiEndpoint } from '../ApiEndpoint.ts'
6
+
7
+ describe('ApiEndpoint', () => {
8
+ test('checking happy path', () => {
9
+ const apiEndpoint = new ApiEndpoint({ apiDomain: 'sample.com' }, '/')
10
+ expect(apiEndpoint).toBeDefined()
11
+ })
12
+ })
@@ -0,0 +1,12 @@
1
+ import {
2
+ describe, expect, test,
3
+ } from 'vitest'
4
+
5
+ import { getApiStage } from '../getApiStage.ts'
6
+
7
+ describe('getApiStage', () => {
8
+ test('checking happy path', () => {
9
+ const apiStage = getApiStage('localhost')
10
+ expect(apiStage).toBeDefined()
11
+ })
12
+ })
package/xy.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
- const config: XyTsupConfig = {
3
- compile: {
4
- browser: {},
5
- neutral: { src: true },
6
- node: {},
7
- },
8
- }
9
-
10
- export default config