wriftai 0.16.0 → 0.18.0
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/dist/index.cjs +574 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +784 -0
- package/dist/index.mjs +571 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +7 -2
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Representation of an error from WriftAI's API.
|
|
3
|
+
*/
|
|
4
|
+
class WriftAIAPIError extends Error {
|
|
5
|
+
status;
|
|
6
|
+
body;
|
|
7
|
+
url;
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of the error.
|
|
10
|
+
* @param status HTTP status code returned by the API
|
|
11
|
+
* @param body Raw response text body
|
|
12
|
+
* @param url Full URL of the request
|
|
13
|
+
*/
|
|
14
|
+
constructor(status, body, url) {
|
|
15
|
+
super(`WriftAIAPI error ${String(status)}: ${body}`);
|
|
16
|
+
this.status = status;
|
|
17
|
+
this.body = body;
|
|
18
|
+
this.url = url;
|
|
19
|
+
this.name = 'WriftAIAPIError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Client for WriftAI's API.
|
|
24
|
+
*/
|
|
25
|
+
class API {
|
|
26
|
+
baseUrl;
|
|
27
|
+
fetchImpl;
|
|
28
|
+
defaultHeaders;
|
|
29
|
+
/**
|
|
30
|
+
* Create an instance of the API client.
|
|
31
|
+
* @param baseUrl Base URL for the API without trailing slashes.
|
|
32
|
+
* @param fetchImpl Fetch implementation to use.
|
|
33
|
+
* @param accessToken Optional bearer token used for authentication
|
|
34
|
+
* @param headers Optional additional headers (overrides defaults).
|
|
35
|
+
*/
|
|
36
|
+
constructor(baseUrl, fetchImpl, accessToken, headers) {
|
|
37
|
+
this.baseUrl = baseUrl;
|
|
38
|
+
this.fetchImpl = fetchImpl;
|
|
39
|
+
// Build default headers
|
|
40
|
+
const defaults = {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
'User-Agent': 'wriftai-javascript/' + "0.18.0",
|
|
43
|
+
};
|
|
44
|
+
if (accessToken) {
|
|
45
|
+
defaults.Authorization = `Bearer ${accessToken}`;
|
|
46
|
+
}
|
|
47
|
+
// User injected headers are allowed to override
|
|
48
|
+
// default headers
|
|
49
|
+
this.defaultHeaders = { ...defaults, ...headers };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Makes an HTTP request to the API.
|
|
53
|
+
* @template T The expected JSON response shape
|
|
54
|
+
* @param path The path relative to `baseUrl` (e.g. `/users`)
|
|
55
|
+
* @param options Request options
|
|
56
|
+
* @param options.method The HTTP method to use
|
|
57
|
+
* @param options.params Optional query parameters
|
|
58
|
+
* @param options.body Optional JSON-serializable body
|
|
59
|
+
* @param options.headers Optional extra request headers
|
|
60
|
+
* @returns The parsed JSON response
|
|
61
|
+
* @throws {WriftAIAPIError} If the response is not ok (`!res.ok`)
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const users = await client.request<User[]>("/users", { method: "GET" });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
async request(path, options) {
|
|
68
|
+
const url = new URL(this.baseUrl + path);
|
|
69
|
+
if (options.params) {
|
|
70
|
+
for (const [k, v] of Object.entries(options.params)) {
|
|
71
|
+
url.searchParams.append(k, String(v));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const headers = { ...this.defaultHeaders, ...options.headers };
|
|
75
|
+
const res = await this.fetchImpl(url.toString(), {
|
|
76
|
+
method: options.method,
|
|
77
|
+
headers,
|
|
78
|
+
body: options.body ? JSON.stringify(options.body) : undefined,
|
|
79
|
+
});
|
|
80
|
+
if (!res.ok) {
|
|
81
|
+
const errorBody = await res.text();
|
|
82
|
+
throw new WriftAIAPIError(res.status, errorBody, url.toString());
|
|
83
|
+
}
|
|
84
|
+
// handle empty-body responses safely
|
|
85
|
+
if (res.status === 204) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return res.json();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Abstract base class for WriftAI API resources.
|
|
94
|
+
*/
|
|
95
|
+
class Resource {
|
|
96
|
+
api;
|
|
97
|
+
MODELS_API_PREFIX = '/models';
|
|
98
|
+
VERSIONS_API_PREFIX = '/versions';
|
|
99
|
+
SEARCH_API_PREFIX = '/search';
|
|
100
|
+
/**
|
|
101
|
+
* Create a new resource.
|
|
102
|
+
* @param api API client instance used to
|
|
103
|
+
* communicate with WriftAI's API.
|
|
104
|
+
*/
|
|
105
|
+
constructor(api) {
|
|
106
|
+
this.api = api;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Enumeration of possible error sources.
|
|
112
|
+
*/
|
|
113
|
+
var ErrorSource;
|
|
114
|
+
(function (ErrorSource) {
|
|
115
|
+
ErrorSource["internal"] = "internal";
|
|
116
|
+
ErrorSource["external"] = "external";
|
|
117
|
+
})(ErrorSource || (ErrorSource = {}));
|
|
118
|
+
/**
|
|
119
|
+
* Enumeration of possible prediction statuses.
|
|
120
|
+
*/
|
|
121
|
+
var Status;
|
|
122
|
+
(function (Status) {
|
|
123
|
+
Status["pending"] = "pending";
|
|
124
|
+
Status["started"] = "started";
|
|
125
|
+
Status["failed"] = "failed";
|
|
126
|
+
Status["succeeded"] = "succeeded";
|
|
127
|
+
})(Status || (Status = {}));
|
|
128
|
+
/**
|
|
129
|
+
* Resource class for interacting with predictions.
|
|
130
|
+
*/
|
|
131
|
+
class PredictionsResource extends Resource {
|
|
132
|
+
PREDICTIONS_API_PREFIX = '/predictions';
|
|
133
|
+
ERROR_MSG_INVALID_PREDICTION_PARAMS = 'Either a version_id or both model_owner and model_name must be provided.';
|
|
134
|
+
/**
|
|
135
|
+
* Get a prediction by its ID.
|
|
136
|
+
* @param id The ID of the prediction to fetch.
|
|
137
|
+
* @returns The prediction object.
|
|
138
|
+
*/
|
|
139
|
+
async get(id) {
|
|
140
|
+
const response = await this.api.request(`${this.PREDICTIONS_API_PREFIX}/${id}`, { method: 'GET' });
|
|
141
|
+
return response;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Constructs the API path to create a prediction.
|
|
145
|
+
* @param options Options for prediction creation.
|
|
146
|
+
* @returns The API path.
|
|
147
|
+
* @throws {TypeError} When an invalid combination of version_id,
|
|
148
|
+
* model_owner and model_name is provided.
|
|
149
|
+
*/
|
|
150
|
+
predictionPath(options) {
|
|
151
|
+
if ('version_id' in options && options.version_id) {
|
|
152
|
+
return `${this.VERSIONS_API_PREFIX}/${options.version_id}/predictions`;
|
|
153
|
+
}
|
|
154
|
+
if ('model_owner' in options &&
|
|
155
|
+
'model_name' in options &&
|
|
156
|
+
options.model_owner &&
|
|
157
|
+
options.model_name) {
|
|
158
|
+
return (`${this.MODELS_API_PREFIX}/${options.model_owner}/` +
|
|
159
|
+
`${options.model_name}/predictions`);
|
|
160
|
+
}
|
|
161
|
+
throw new TypeError(this.ERROR_MSG_INVALID_PREDICTION_PARAMS);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Create a prediction.
|
|
165
|
+
* This method creates a prediction using either the latest version of a model
|
|
166
|
+
* or a specific model version.
|
|
167
|
+
* @param options Options for prediction creation.
|
|
168
|
+
* @returns The new prediction.
|
|
169
|
+
* @throws {TypeError} When an invalid combination of version_id,
|
|
170
|
+
* model_owner and model_name is provided.
|
|
171
|
+
*/
|
|
172
|
+
async create(options) {
|
|
173
|
+
const { input, webhook_url, validate_input, ...rest } = options;
|
|
174
|
+
const path = this.predictionPath(rest);
|
|
175
|
+
const body = {
|
|
176
|
+
input,
|
|
177
|
+
...(webhook_url !== undefined && { webhook_url }),
|
|
178
|
+
};
|
|
179
|
+
const headers = validate_input !== undefined
|
|
180
|
+
? { 'Validate-Input': String(validate_input) }
|
|
181
|
+
: undefined;
|
|
182
|
+
return this.api.request(path, {
|
|
183
|
+
method: 'POST',
|
|
184
|
+
body,
|
|
185
|
+
headers,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* List predictions.
|
|
190
|
+
* @param options Optional settings to control pagination behavior.
|
|
191
|
+
* @returns Paginated response containing predictions and navigation metadata.
|
|
192
|
+
*/
|
|
193
|
+
async list(options) {
|
|
194
|
+
const response = await this.api.request(this.PREDICTIONS_API_PREFIX, {
|
|
195
|
+
method: 'GET',
|
|
196
|
+
params: options,
|
|
197
|
+
});
|
|
198
|
+
return response;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Waits for a prediction to complete.
|
|
202
|
+
* This method uses short polling to check the prediction status at
|
|
203
|
+
* regular intervals until it reaches a terminal state.
|
|
204
|
+
* @param prediction Initial prediction object.
|
|
205
|
+
* @param pollInterval Time in milliseconds between polling attempts to check
|
|
206
|
+
* the prediction status. Defaults to 1000ms.
|
|
207
|
+
* @returns Prediction after completion.
|
|
208
|
+
*/
|
|
209
|
+
async wait(prediction, pollInterval = 1000) {
|
|
210
|
+
const isTerminal = (status) => status === Status.succeeded || status === Status.failed;
|
|
211
|
+
if (isTerminal(prediction.status)) {
|
|
212
|
+
return prediction;
|
|
213
|
+
}
|
|
214
|
+
for (;;) {
|
|
215
|
+
const result = await this.get(prediction.id);
|
|
216
|
+
if (isTerminal(result.status)) {
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Model visibility states.
|
|
226
|
+
*/
|
|
227
|
+
var ModelVisibility;
|
|
228
|
+
(function (ModelVisibility) {
|
|
229
|
+
ModelVisibility["private"] = "private";
|
|
230
|
+
ModelVisibility["public"] = "public";
|
|
231
|
+
})(ModelVisibility || (ModelVisibility = {}));
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Enumeration of possible sorting options for querying models.
|
|
235
|
+
*/
|
|
236
|
+
var ModelsSortBy;
|
|
237
|
+
(function (ModelsSortBy) {
|
|
238
|
+
ModelsSortBy["created_at_asc"] = "created_at_asc";
|
|
239
|
+
ModelsSortBy["prediction_count_desc"] = "prediction_count_desc";
|
|
240
|
+
})(ModelsSortBy || (ModelsSortBy = {}));
|
|
241
|
+
/**
|
|
242
|
+
* Resource for operations related to models.
|
|
243
|
+
*/
|
|
244
|
+
class Models extends Resource {
|
|
245
|
+
/**
|
|
246
|
+
* Delete a model.
|
|
247
|
+
* @param owner Username of the model's owner.
|
|
248
|
+
* @param name Name of the model.
|
|
249
|
+
*/
|
|
250
|
+
async delete(owner, name) {
|
|
251
|
+
await this.api.request(`${this.MODELS_API_PREFIX}/${owner}/${name}`, {
|
|
252
|
+
method: 'DELETE',
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Create a model.
|
|
257
|
+
* @param options Parameters for creating a model.
|
|
258
|
+
* @returns The new model.
|
|
259
|
+
*/
|
|
260
|
+
async create(options) {
|
|
261
|
+
const response = await this.api.request(this.MODELS_API_PREFIX, {
|
|
262
|
+
method: 'POST',
|
|
263
|
+
body: options,
|
|
264
|
+
});
|
|
265
|
+
return response;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Get a model.
|
|
269
|
+
* @param owner Username of the model's owner.
|
|
270
|
+
* @param name Name of the model.
|
|
271
|
+
* @returns A model object.
|
|
272
|
+
*/
|
|
273
|
+
async get(owner, name) {
|
|
274
|
+
const response = await this.api.request(`${this.MODELS_API_PREFIX}/${owner}/${name}`, {
|
|
275
|
+
method: 'GET',
|
|
276
|
+
});
|
|
277
|
+
return response;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Constructs the API path for listing models.
|
|
281
|
+
* @param owner - Username of the model's owner to fetch models for.
|
|
282
|
+
* If not passed, returns a path to fetch all models.
|
|
283
|
+
* @returns The constructed API path for listing models.
|
|
284
|
+
*/
|
|
285
|
+
buildListPath(owner) {
|
|
286
|
+
return owner
|
|
287
|
+
? `${this.MODELS_API_PREFIX}/${owner}`
|
|
288
|
+
: this.MODELS_API_PREFIX;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* List models.
|
|
292
|
+
* @param options Optional settings to control pagination behavior.
|
|
293
|
+
* @param owner Optional username of the model's owner to fetch models for.
|
|
294
|
+
* If not passed, all models are fetched.
|
|
295
|
+
* @returns Paginated response containing models and navigation metadata.
|
|
296
|
+
*/
|
|
297
|
+
async list(options, owner) {
|
|
298
|
+
const path = this.buildListPath(owner);
|
|
299
|
+
const response = await this.api.request(path, {
|
|
300
|
+
method: 'GET',
|
|
301
|
+
params: options,
|
|
302
|
+
});
|
|
303
|
+
return response;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Update a model.
|
|
307
|
+
* @param owner Username of the model's owner.
|
|
308
|
+
* @param name Name of the model.
|
|
309
|
+
* @param params The fields to update.
|
|
310
|
+
* @returns The updated model.
|
|
311
|
+
*/
|
|
312
|
+
async update(owner, name, params) {
|
|
313
|
+
const response = await this.api.request(`${this.MODELS_API_PREFIX}/${owner}/${name}`, {
|
|
314
|
+
method: 'PATCH',
|
|
315
|
+
body: params,
|
|
316
|
+
});
|
|
317
|
+
return response;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Search models.
|
|
321
|
+
* @param q The search query.
|
|
322
|
+
* @param options Optional settings to control pagination behavior.
|
|
323
|
+
* @returns Paginated response containing models and navigation metadata.
|
|
324
|
+
*/
|
|
325
|
+
async search(q, options) {
|
|
326
|
+
const params = {
|
|
327
|
+
...(options ?? {}),
|
|
328
|
+
q,
|
|
329
|
+
};
|
|
330
|
+
const response = await this.api.request(`${this.SEARCH_API_PREFIX}/models`, {
|
|
331
|
+
method: 'GET',
|
|
332
|
+
params: params,
|
|
333
|
+
});
|
|
334
|
+
return response;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Resource class for interacting with model versions.
|
|
340
|
+
*/
|
|
341
|
+
class Versions extends Resource {
|
|
342
|
+
/**
|
|
343
|
+
* Get a model version by its ID.
|
|
344
|
+
* @param id The ID of the model version to retrieve.
|
|
345
|
+
* @returns The model version object.
|
|
346
|
+
*/
|
|
347
|
+
async get(id) {
|
|
348
|
+
const response = await this.api.request(`${this.VERSIONS_API_PREFIX}/${id}`, { method: 'GET' });
|
|
349
|
+
return response;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Create a version of a model.
|
|
353
|
+
* @param modelOwner The username of the model's owner.
|
|
354
|
+
* @param modelName The name of the model.
|
|
355
|
+
* @param release_notes Information about changes such as new features,
|
|
356
|
+
* bug fixes, or optimizations in this version.
|
|
357
|
+
* @param schemas The schemas of the model version.
|
|
358
|
+
* @param container_image_digest A sha256 hash digest of the version's
|
|
359
|
+
* container image.
|
|
360
|
+
* @returns The new version object.
|
|
361
|
+
*/
|
|
362
|
+
async create(modelOwner, modelName, release_notes, schemas, container_image_digest) {
|
|
363
|
+
const path = `${this.MODELS_API_PREFIX}/${modelOwner}/` + `${modelName}/versions`;
|
|
364
|
+
const response = await this.api.request(path, {
|
|
365
|
+
method: 'POST',
|
|
366
|
+
body: {
|
|
367
|
+
release_notes,
|
|
368
|
+
schemas: schemas,
|
|
369
|
+
container_image_digest,
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
return response;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Delete a model version by its ID.
|
|
376
|
+
* @param id The ID of the model version to delete.
|
|
377
|
+
*/
|
|
378
|
+
async delete(id) {
|
|
379
|
+
await this.api.request(`${this.VERSIONS_API_PREFIX}/${id}`, {
|
|
380
|
+
method: 'DELETE',
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* List versions.
|
|
385
|
+
* @param modelOwner Username of the model's owner.
|
|
386
|
+
* @param modelName Name of the model.
|
|
387
|
+
* @param options Pagination options.
|
|
388
|
+
* @returns A paginated response containing model versions.
|
|
389
|
+
*/
|
|
390
|
+
async list(modelOwner, modelName, options) {
|
|
391
|
+
const path = `${this.MODELS_API_PREFIX}/${modelOwner}/` + `${modelName}/versions`;
|
|
392
|
+
const response = await this.api.request(path, {
|
|
393
|
+
method: 'GET',
|
|
394
|
+
params: options,
|
|
395
|
+
});
|
|
396
|
+
return response;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
class Users extends Resource {
|
|
401
|
+
API_PREFIX = '/users';
|
|
402
|
+
/**
|
|
403
|
+
* Fetch a user by their username.
|
|
404
|
+
* @param username The username of the user.
|
|
405
|
+
* @returns The user object.
|
|
406
|
+
*/
|
|
407
|
+
async get(username) {
|
|
408
|
+
const response = await this.api.request(`${this.API_PREFIX}/${username}`, { method: 'GET' });
|
|
409
|
+
return response;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* List users.
|
|
413
|
+
* @param options Optional settings to control pagination behavior.
|
|
414
|
+
* @returns Paginated response containing users and navigation metadata.
|
|
415
|
+
*/
|
|
416
|
+
async list(options) {
|
|
417
|
+
const response = await this.api.request(this.API_PREFIX, {
|
|
418
|
+
method: 'GET',
|
|
419
|
+
params: options,
|
|
420
|
+
});
|
|
421
|
+
return response;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Search users.
|
|
425
|
+
* @param q The search query.
|
|
426
|
+
* @param options Optional settings to control pagination behavior.
|
|
427
|
+
* @returns Paginated response containing users and navigation metadata.
|
|
428
|
+
*/
|
|
429
|
+
async search(q, options) {
|
|
430
|
+
const params = {
|
|
431
|
+
...(options ?? {}),
|
|
432
|
+
q,
|
|
433
|
+
};
|
|
434
|
+
const response = await this.api.request(`${this.SEARCH_API_PREFIX}/users`, {
|
|
435
|
+
method: 'GET',
|
|
436
|
+
params: params,
|
|
437
|
+
});
|
|
438
|
+
return response;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Resource for operations related to the authenticated user.
|
|
444
|
+
*/
|
|
445
|
+
class AuthenticatedUser extends Resource {
|
|
446
|
+
API_PREFIX = '/user';
|
|
447
|
+
/*
|
|
448
|
+
* Get the authenticated user.
|
|
449
|
+
* @returns The user object.
|
|
450
|
+
*/
|
|
451
|
+
async get() {
|
|
452
|
+
const response = await this.api.request(this.API_PREFIX, {
|
|
453
|
+
method: 'GET',
|
|
454
|
+
});
|
|
455
|
+
return response;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Update the authenticated user.
|
|
459
|
+
* @param params - The fields to update.
|
|
460
|
+
* @returns The updated user object.
|
|
461
|
+
*/
|
|
462
|
+
async update(params) {
|
|
463
|
+
const response = await this.api.request(this.API_PREFIX, {
|
|
464
|
+
method: 'PATCH',
|
|
465
|
+
body: params,
|
|
466
|
+
});
|
|
467
|
+
return response;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* List models of the authenticated user.
|
|
471
|
+
* @param options - Optional settings to control pagination behavior.
|
|
472
|
+
* @returns A paginated response containing models and navigation metadata.
|
|
473
|
+
*/
|
|
474
|
+
async models(options) {
|
|
475
|
+
const response = await this.api.request(`${this.API_PREFIX}/models`, {
|
|
476
|
+
method: 'GET',
|
|
477
|
+
params: options,
|
|
478
|
+
});
|
|
479
|
+
return response;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Resource for operations related to hardware.
|
|
485
|
+
*/
|
|
486
|
+
class HardwareResource extends Resource {
|
|
487
|
+
/**
|
|
488
|
+
* List hardware.
|
|
489
|
+
* @param options Optional settings to control pagination behavior.
|
|
490
|
+
* @returns Paginated response containing hardware and navigation metadata.
|
|
491
|
+
*/
|
|
492
|
+
async list(options) {
|
|
493
|
+
const response = await this.api.request('/hardware', {
|
|
494
|
+
method: 'GET',
|
|
495
|
+
params: options,
|
|
496
|
+
});
|
|
497
|
+
return response;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const API_BASE_URL = 'https://api.wrift.ai/v1';
|
|
502
|
+
/**
|
|
503
|
+
* Client for WriftAI.
|
|
504
|
+
*/
|
|
505
|
+
class WriftAI {
|
|
506
|
+
/**
|
|
507
|
+
* The client used to interact with WriftAI's API.
|
|
508
|
+
*/
|
|
509
|
+
api;
|
|
510
|
+
/**
|
|
511
|
+
* Interface for accessing prediction related
|
|
512
|
+
* resources and operations.
|
|
513
|
+
*/
|
|
514
|
+
predictions;
|
|
515
|
+
/**
|
|
516
|
+
* Interface for accessing version related
|
|
517
|
+
* resources and operations.
|
|
518
|
+
*/
|
|
519
|
+
versions;
|
|
520
|
+
/**
|
|
521
|
+
* Interface for accessing user related
|
|
522
|
+
* resources and operations.
|
|
523
|
+
*/
|
|
524
|
+
users;
|
|
525
|
+
/**
|
|
526
|
+
* Interface for accessing model related
|
|
527
|
+
* resources and operations.
|
|
528
|
+
*/
|
|
529
|
+
models;
|
|
530
|
+
/*
|
|
531
|
+
* Interface for accessing authenticated user related
|
|
532
|
+
* resources and operations
|
|
533
|
+
*/
|
|
534
|
+
authenticatedUser;
|
|
535
|
+
/**
|
|
536
|
+
* Interface for accessing hardware related
|
|
537
|
+
* resources and operations
|
|
538
|
+
*/
|
|
539
|
+
hardware;
|
|
540
|
+
/**
|
|
541
|
+
* Create an instance of the WriftAI client.
|
|
542
|
+
* @param options Client options
|
|
543
|
+
* @param options.apiBaseUrl Base URL for the API without
|
|
544
|
+
* trailing slashes. Defaults to {@link API_BASE_URL} if not provided.
|
|
545
|
+
* @param options.fetch Fetch implementation to use.
|
|
546
|
+
* Defaults to `globalThis.fetch`.
|
|
547
|
+
* @param options.accessToken Bearer token used for
|
|
548
|
+
* authentication. Defaults to `process.env.WRIFTAI_API_ACCESS_TOKEN`
|
|
549
|
+
* if available.
|
|
550
|
+
* @param options.headers Optional additional headers (overrides defaults).
|
|
551
|
+
*/
|
|
552
|
+
constructor(options = {}) {
|
|
553
|
+
const apiBaseUrl = options.apiBaseUrl ?? API_BASE_URL;
|
|
554
|
+
const accessToken = options.accessToken ??
|
|
555
|
+
// check if on browser
|
|
556
|
+
(typeof process !== 'undefined'
|
|
557
|
+
? process.env.WRIFTAI_API_ACCESS_TOKEN
|
|
558
|
+
: undefined);
|
|
559
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
560
|
+
this.api = new API(apiBaseUrl, fetchImpl, accessToken, options.headers);
|
|
561
|
+
this.predictions = new PredictionsResource(this.api);
|
|
562
|
+
this.versions = new Versions(this.api);
|
|
563
|
+
this.users = new Users(this.api);
|
|
564
|
+
this.models = new Models(this.api);
|
|
565
|
+
this.authenticatedUser = new AuthenticatedUser(this.api);
|
|
566
|
+
this.hardware = new HardwareResource(this.api);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export { ErrorSource, ModelVisibility, ModelsSortBy, Status, WriftAI, WriftAIAPIError };
|
|
571
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/api.ts","../src/resources/resource.ts","../src/resources/predictions.ts","../src/types.ts","../src/resources/models.ts","../src/resources/versions.ts","../src/resources/users.ts","../src/resources/authenticated-user.ts","../src/resources/hardware.ts","../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":"AAEA;;AAEG;AACG,MAAO,eAAgB,SAAQ,KAAK,CAAA;AAQ/B,IAAA,MAAA;AACA,IAAA,IAAA;AACA,IAAA,GAAA;AATT;;;;;AAKG;AACH,IAAA,WAAA,CACS,MAAc,EACd,IAAY,EACZ,GAAW,EAAA;QAElB,KAAK,CAAC,CAAA,iBAAA,EAAoB,MAAM,CAAC,MAAM,CAAC,CAAA,EAAA,EAAK,IAAI,CAAA,CA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|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Javascript client for WriftAI",
|
|
5
5
|
"homepage": "https://github.com/wriftai/wriftai-javascript",
|
|
6
6
|
"bugs": "https://github.com/wriftai/wriftai-javascript/issues",
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"rollup": "^4.50.1",
|
|
49
49
|
"rollup-plugin-dts": "^6.2.3",
|
|
50
50
|
"tslib": "^2.8.1",
|
|
51
|
+
"typedoc": "^0.28.13",
|
|
52
|
+
"typedoc-plugin-frontmatter": "^1.3.0",
|
|
53
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
54
|
+
"typedoc-plugin-missing-exports": "^4.1.0",
|
|
51
55
|
"typescript": "^5.9.2",
|
|
52
56
|
"typescript-eslint": "^8.43.0",
|
|
53
57
|
"vitest": "^3.2.4"
|
|
@@ -70,6 +74,7 @@
|
|
|
70
74
|
"test:integration:watch": "vitest -c vitest.integration.config.ts",
|
|
71
75
|
"test": "pnpm test:unit && pnpm test:integration",
|
|
72
76
|
"test:watch": "pnpm test:unit:watch && pnpm test:integration:watch",
|
|
73
|
-
"check": "pnpm format && pnpm build && pnpm lint && pnpm typecheck && pnpm test"
|
|
77
|
+
"check": "pnpm format && pnpm build && pnpm lint && pnpm typecheck && pnpm test",
|
|
78
|
+
"docs": "rimraf docs/reference && typedoc"
|
|
74
79
|
}
|
|
75
80
|
}
|