@nosana/api 0.1.3 → 0.1.6

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.
@@ -2,11 +2,11 @@ import { errorFormatter } from '../utils/errorFormatter.js';
2
2
  export * from './types.js';
3
3
  export function createNosanaJobsApi(client) {
4
4
  return {
5
- async get(jobAddress) {
5
+ async get(address) {
6
6
  const { data, error } = await client.GET('/api/jobs/{address}', {
7
7
  params: {
8
8
  path: {
9
- address: jobAddress
9
+ address
10
10
  }
11
11
  }
12
12
  });
@@ -15,20 +15,20 @@ export function createNosanaJobsApi(client) {
15
15
  }
16
16
  return data;
17
17
  },
18
- async create(request) {
18
+ async list(request) {
19
19
  const { data, error } = await client.POST('/api/jobs/list', {
20
20
  body: request,
21
21
  });
22
22
  if (!data || error) {
23
- throw errorFormatter('Failed to create job', error);
23
+ throw errorFormatter('Failed to list job', error);
24
24
  }
25
25
  return data;
26
26
  },
27
- async extend(jobAddress, request) {
27
+ async extend({ address, ...request }) {
28
28
  const { data, error } = await client.POST('/api/jobs/{address}/extend', {
29
29
  params: {
30
30
  path: {
31
- address: jobAddress
31
+ address
32
32
  }
33
33
  },
34
34
  body: request,
@@ -38,11 +38,11 @@ export function createNosanaJobsApi(client) {
38
38
  }
39
39
  return data;
40
40
  },
41
- async stop(jobAddress) {
41
+ async stop(address) {
42
42
  const { data, error } = await client.POST('/api/jobs/{address}/stop', {
43
43
  params: {
44
44
  path: {
45
- address: jobAddress
45
+ address
46
46
  }
47
47
  },
48
48
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/jobs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAa5D,cAAc,YAAY,CAAC;AAE3B,MAAM,UAAU,mBAAmB,CAAC,MAAmB;IACrD,OAAO;QACL,KAAK,CAAC,GAAG,CAAC,UAAkB;YAC1B,MAAM,EAAE,IAAI,EAAE,K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C,4BAA4B,EAAE;gBACtE,MAAM,EAAE;oBACN,IAAI,EAAE;wBACJ,OAAO;qBACR;iBACF;gBACD,IAAI,EAAE,OAAO;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;gBACnB,MAAM,cAAc,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;YACtD,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,OAAgC;YACzC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE;gBACpE,MAAM,EAAE;oBACN,IAAI,EAAE;wBACJ,OAAO;qBACR;iBACF;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;gBACnB,MAAM,cAAc,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YACpD,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1,13 +1,15 @@
1
1
  import { operations } from "../client/schema.js";
2
- export type CreateJobWithCreditsRequest = operations['postApiJobsList']['requestBody']['content']['application/json'];
3
- export type ExtendJobWithCreditsRequest = operations['postApiJobsByAddressExtend']['requestBody']['content']['application/json'];
4
- export type CreateJobWithCreditsResponse = operations['postApiJobsList']['responses'][200]['content']['application/json'];
5
- export type ExtendJobWithCreditsResponse = operations['postApiJobsByAddressExtend']['responses'][200]['content']['application/json'];
6
- export type StopJobWithCreditsResponse = operations['postApiJobsByAddressStop']['responses'][200]['content']['application/json'];
7
- export type GetJobByAddressResponse = operations['getApiJobsByAddress']['responses'][200]['content']['application/json'];
2
+ export type NosanaApiGetJobByAddressRequest = operations['getApiJobsByAddress']['parameters']['path']['address'];
3
+ export type NosanaApiListJobRequest = operations['postApiJobsList']['requestBody']['content']['application/json'];
4
+ export type NosanaApiExtendJobRequest = operations['postApiJobsByAddressExtend']['requestBody']['content']['application/json'] & operations['postApiJobsByAddressExtend']['parameters']['path'];
5
+ export type NosanaApiStopJobRequest = operations['postApiJobsByAddressStop']['parameters']['path']['address'];
6
+ export type NosanaApiListJobResponse = operations['postApiJobsList']['responses'][200]['content']['application/json'];
7
+ export type NosanaApiExtendJobResponse = operations['postApiJobsByAddressExtend']['responses'][200]['content']['application/json'];
8
+ export type NosanaApiStopJobResponse = operations['postApiJobsByAddressStop']['responses'][200]['content']['application/json'];
9
+ export type NosanaApiGetJobByAddressResponse = operations['getApiJobsByAddress']['responses'][200]['content']['application/json'];
8
10
  export interface NosanaJobsApi {
9
- get: (jobAddress: string) => Promise<GetJobByAddressResponse>;
10
- create: (request: CreateJobWithCreditsRequest) => Promise<CreateJobWithCreditsResponse>;
11
- extend: (jobAddress: string, request: ExtendJobWithCreditsRequest) => Promise<ExtendJobWithCreditsResponse>;
12
- stop: (jobAddress: string) => Promise<StopJobWithCreditsResponse>;
11
+ get: (request: NosanaApiGetJobByAddressRequest) => Promise<NosanaApiGetJobByAddressResponse>;
12
+ list: (request: NosanaApiListJobRequest) => Promise<NosanaApiListJobResponse>;
13
+ extend: (request: NosanaApiExtendJobRequest) => Promise<NosanaApiExtendJobResponse>;
14
+ stop: (request: NosanaApiStopJobRequest) => Promise<NosanaApiStopJobResponse>;
13
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/api",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "description": "Nosana API module",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",