@nosana/api 0.1.12 → 2.1.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/client/index.d.ts +2 -5
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/schema.d.ts +150 -141
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentGetEvents.d.ts +3 -5
- package/dist/routes/deployments/deployment/actions/deploymentGetEvents.js +12 -4
- package/dist/routes/deployments/deployment/actions/deploymentGetEvents.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentGetJobs.d.ts +3 -5
- package/dist/routes/deployments/deployment/actions/deploymentGetJobs.js +12 -4
- package/dist/routes/deployments/deployment/actions/deploymentGetJobs.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentGetRevisions.d.ts +3 -5
- package/dist/routes/deployments/deployment/actions/deploymentGetRevisions.js +12 -4
- package/dist/routes/deployments/deployment/actions/deploymentGetRevisions.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentGetTasks.d.ts +3 -4
- package/dist/routes/deployments/deployment/actions/deploymentGetTasks.js +12 -4
- package/dist/routes/deployments/deployment/actions/deploymentGetTasks.js.map +1 -1
- package/dist/routes/deployments/deployment/createDeployment.js +16 -12
- package/dist/routes/deployments/deployment/createDeployment.js.map +1 -1
- package/dist/routes/deployments/index.js +15 -3
- package/dist/routes/deployments/index.js.map +1 -1
- package/dist/routes/deployments/types.d.ts +46 -8
- package/dist/types.d.ts +1 -1
- package/dist/utils/withPagination.d.ts +19 -0
- package/dist/utils/withPagination.js +31 -0
- package/dist/utils/withPagination.js.map +1 -0
- package/package.json +17 -9
package/dist/client/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { paths } from './schema.js';
|
|
2
2
|
import type { AuthenticatedClient } from './type.utils.js';
|
|
3
|
-
import type { NosanaNetwork, ApiKeyAuth, SignerAuth, CreateNosanaApiOptions
|
|
3
|
+
import type { NosanaNetwork, ApiKeyAuth, SignerAuth, CreateNosanaApiOptions } from '../types.js';
|
|
4
4
|
export type * from './schema.js';
|
|
5
5
|
export type QueryClient = AuthenticatedClient<paths>;
|
|
6
|
-
export
|
|
7
|
-
backend_url?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function createNosanaClient(environment: NosanaNetwork, authParams: ApiKeyAuth | SignerAuth | IncludeCookiesAuth | undefined, options: CreateNosanaApiOptions | undefined): QueryClient;
|
|
6
|
+
export declare function createNosanaClient(environment: NosanaNetwork, authParams: ApiKeyAuth | SignerAuth | undefined, options: CreateNosanaApiOptions | undefined): QueryClient;
|
package/dist/client/index.js
CHANGED
|
@@ -18,9 +18,9 @@ export function createNosanaClient(environment, authParams, options) {
|
|
|
18
18
|
};
|
|
19
19
|
const client = createClient({
|
|
20
20
|
baseUrl: backend_url,
|
|
21
|
-
...(
|
|
21
|
+
...(options?.include_credentials ? { credentials: 'include' } : {}),
|
|
22
22
|
});
|
|
23
|
-
if (
|
|
23
|
+
if (!options?.include_credentials) {
|
|
24
24
|
client.use(authMiddleware);
|
|
25
25
|
}
|
|
26
26
|
return client;
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAiC,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAiC,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAWrD,MAAM,UAAU,kBAAkB,CAChC,WAA0B,EAC1B,UAA+C,EAC/C,OAA2C;IAE3C,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC;IAEnF,MAAM,cAAc,GAAe;QACjC,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE;YACzB,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;oBACnC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,UAAU,EAAE,CAAC,CAAC;gBAC/D,CAAC;qBAAM,CAAC;oBACN,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;oBACxE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;oBACxD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,YAAY,CAA4B;QACrD,OAAO,EAAE,WAAW;QACpB,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/client/schema.d.ts
CHANGED
|
@@ -127,26 +127,6 @@ export interface paths {
|
|
|
127
127
|
patch?: never;
|
|
128
128
|
trace?: never;
|
|
129
129
|
};
|
|
130
|
-
"/api/auth/sign-message/external": {
|
|
131
|
-
parameters: {
|
|
132
|
-
query?: never;
|
|
133
|
-
header?: never;
|
|
134
|
-
path?: never;
|
|
135
|
-
cookie?: never;
|
|
136
|
-
};
|
|
137
|
-
get?: never;
|
|
138
|
-
put?: never;
|
|
139
|
-
/**
|
|
140
|
-
* Get the signed message for external service authentication
|
|
141
|
-
* @description Authentication required via Authorization header. Supports either JWT (Bearer <jwt>) or API key (Bearer <key>).
|
|
142
|
-
*/
|
|
143
|
-
post: operations["postApiAuthSign-messageExternal"];
|
|
144
|
-
delete?: never;
|
|
145
|
-
options?: never;
|
|
146
|
-
head?: never;
|
|
147
|
-
patch?: never;
|
|
148
|
-
trace?: never;
|
|
149
|
-
};
|
|
150
130
|
"/api/credits/balance": {
|
|
151
131
|
parameters: {
|
|
152
132
|
query?: never;
|
|
@@ -177,7 +157,26 @@ export interface paths {
|
|
|
177
157
|
/** @description List all user deployments. */
|
|
178
158
|
get: {
|
|
179
159
|
parameters: {
|
|
180
|
-
query?:
|
|
160
|
+
query?: {
|
|
161
|
+
/** @description Base64-encoded cursor for keyset pagination */
|
|
162
|
+
cursor?: string;
|
|
163
|
+
/** @description Number of items per page (10, 20, 50, or 100) */
|
|
164
|
+
limit?: 10 | 20 | 50 | 100 | "10" | "20" | "50" | "100";
|
|
165
|
+
/** @description Sort order: 'asc' (oldest first) or 'desc' (newest first) */
|
|
166
|
+
sort_order?: "asc" | "desc";
|
|
167
|
+
/** @description Filter by deployment status. Can be single value or comma-separated list */
|
|
168
|
+
status?: ("DRAFT" | "ERROR" | "STARTING" | "RUNNING" | "STOPPING" | "STOPPED" | "INSUFFICIENT_FUNDS" | "ARCHIVED") | string;
|
|
169
|
+
/** @description Filter by deployment strategy. Can be single value or comma-separated list */
|
|
170
|
+
strategy?: ("SIMPLE" | "SIMPLE-EXTEND" | "SCHEDULED" | "INFINITE") | string;
|
|
171
|
+
/** @description Filter by exact deployment ID */
|
|
172
|
+
id?: string;
|
|
173
|
+
/** @description Filter by vault public key */
|
|
174
|
+
vault?: string;
|
|
175
|
+
/** @description Filter deployments created after this date (ISO 8601 format) */
|
|
176
|
+
created_after?: string;
|
|
177
|
+
/** @description Filter deployments created before this date (ISO 8601 format) */
|
|
178
|
+
created_before?: string;
|
|
179
|
+
};
|
|
181
180
|
header: {
|
|
182
181
|
/** @description Required when using Wallet Authentication. The public key used to sign authentication header. */
|
|
183
182
|
"x-user-id"?: string;
|
|
@@ -192,13 +191,23 @@ export interface paths {
|
|
|
192
191
|
};
|
|
193
192
|
requestBody?: never;
|
|
194
193
|
responses: {
|
|
195
|
-
/** @description List of deployments. */
|
|
194
|
+
/** @description List of deployments with pagination. */
|
|
196
195
|
200: {
|
|
197
196
|
headers: {
|
|
198
197
|
[name: string]: unknown;
|
|
199
198
|
};
|
|
200
199
|
content: {
|
|
201
|
-
"application/json":
|
|
200
|
+
"application/json": {
|
|
201
|
+
deployments: components["schemas"]["Deployment"][];
|
|
202
|
+
pagination: {
|
|
203
|
+
/** @description Cursor for next page, null if no more pages */
|
|
204
|
+
cursor_next: string | null;
|
|
205
|
+
/** @description Cursor for previous page, null if on first page */
|
|
206
|
+
cursor_prev: string | null;
|
|
207
|
+
/** @description Total number of items in collection */
|
|
208
|
+
total_items: number;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
202
211
|
};
|
|
203
212
|
};
|
|
204
213
|
/** @description Unauthorized. Invalid or missing authentication. */
|
|
@@ -369,7 +378,20 @@ export interface paths {
|
|
|
369
378
|
/** @description Get scheduled tasks for a specific deployment. */
|
|
370
379
|
get: {
|
|
371
380
|
parameters: {
|
|
372
|
-
query?:
|
|
381
|
+
query?: {
|
|
382
|
+
/** @description Base64-encoded cursor for keyset pagination */
|
|
383
|
+
cursor?: string;
|
|
384
|
+
/** @description Number of items per page (10, 20, 50, or 100) */
|
|
385
|
+
limit?: 10 | 20 | 50 | 100 | "10" | "20" | "50" | "100";
|
|
386
|
+
/** @description Sort order: 'asc' (oldest first) or 'desc' (newest first) */
|
|
387
|
+
sort_order?: "asc" | "desc";
|
|
388
|
+
/** @description Filter by task type. Can be single value or comma-separated list */
|
|
389
|
+
task?: ("LIST" | "EXTEND" | "STOP") | string;
|
|
390
|
+
/** @description Filter tasks due after this date (ISO 8601 format) */
|
|
391
|
+
due_after?: string;
|
|
392
|
+
/** @description Filter tasks due before this date (ISO 8601 format) */
|
|
393
|
+
due_before?: string;
|
|
394
|
+
};
|
|
373
395
|
header: {
|
|
374
396
|
/** @description Required when using Wallet Authentication. The public key used to sign authentication header. */
|
|
375
397
|
"x-user-id"?: string;
|
|
@@ -386,13 +408,23 @@ export interface paths {
|
|
|
386
408
|
};
|
|
387
409
|
requestBody?: never;
|
|
388
410
|
responses: {
|
|
389
|
-
/** @description List of scheduled tasks for the deployment. */
|
|
411
|
+
/** @description List of scheduled tasks for the deployment with pagination. */
|
|
390
412
|
200: {
|
|
391
413
|
headers: {
|
|
392
414
|
[name: string]: unknown;
|
|
393
415
|
};
|
|
394
416
|
content: {
|
|
395
|
-
"application/json":
|
|
417
|
+
"application/json": {
|
|
418
|
+
tasks: components["schemas"]["Task"][];
|
|
419
|
+
pagination: {
|
|
420
|
+
/** @description Cursor for next page, null if no more pages */
|
|
421
|
+
cursor_next: string | null;
|
|
422
|
+
/** @description Cursor for previous page, null if on first page */
|
|
423
|
+
cursor_prev: string | null;
|
|
424
|
+
/** @description Total number of items in collection */
|
|
425
|
+
total_items: number;
|
|
426
|
+
};
|
|
427
|
+
};
|
|
396
428
|
};
|
|
397
429
|
};
|
|
398
430
|
/** @description Unauthorized. Invalid or missing authentication. */
|
|
@@ -603,7 +635,24 @@ export interface paths {
|
|
|
603
635
|
/** @description Get jobs for a specific deployment. */
|
|
604
636
|
get: {
|
|
605
637
|
parameters: {
|
|
606
|
-
query?:
|
|
638
|
+
query?: {
|
|
639
|
+
/** @description Base64-encoded cursor for keyset pagination */
|
|
640
|
+
cursor?: string;
|
|
641
|
+
/** @description Number of items per page (10, 20, 50, or 100) */
|
|
642
|
+
limit?: 10 | 20 | 50 | 100 | "10" | "20" | "50" | "100";
|
|
643
|
+
/** @description Sort order: 'asc' (oldest first) or 'desc' (newest first) */
|
|
644
|
+
sort_order?: "asc" | "desc";
|
|
645
|
+
/** @description Filter by job state. Can be single value or comma-separated list (e.g., 'RUNNING,COMPLETED') */
|
|
646
|
+
state?: ("QUEUED" | "RUNNING" | "COMPLETED" | "STOPPED") | string;
|
|
647
|
+
/** @description Filter by exact job ID */
|
|
648
|
+
job?: string;
|
|
649
|
+
/** @description Filter by deployment revision number */
|
|
650
|
+
revision?: number;
|
|
651
|
+
/** @description Filter jobs created after this date (ISO 8601 format) */
|
|
652
|
+
created_after?: string;
|
|
653
|
+
/** @description Filter jobs created before this date (ISO 8601 format) */
|
|
654
|
+
created_before?: string;
|
|
655
|
+
};
|
|
607
656
|
header: {
|
|
608
657
|
/** @description Required when using Wallet Authentication. The public key used to sign authentication header. */
|
|
609
658
|
"x-user-id"?: string;
|
|
@@ -620,13 +669,23 @@ export interface paths {
|
|
|
620
669
|
};
|
|
621
670
|
requestBody?: never;
|
|
622
671
|
responses: {
|
|
623
|
-
/** @description List of jobs for the deployment. */
|
|
672
|
+
/** @description List of jobs for the deployment with pagination. */
|
|
624
673
|
200: {
|
|
625
674
|
headers: {
|
|
626
675
|
[name: string]: unknown;
|
|
627
676
|
};
|
|
628
677
|
content: {
|
|
629
|
-
"application/json":
|
|
678
|
+
"application/json": {
|
|
679
|
+
jobs: components["schemas"]["Job"][];
|
|
680
|
+
pagination: {
|
|
681
|
+
/** @description Cursor for next page, null if no more pages */
|
|
682
|
+
cursor_next: string | null;
|
|
683
|
+
/** @description Cursor for previous page, null if on first page */
|
|
684
|
+
cursor_prev: string | null;
|
|
685
|
+
/** @description Total number of items in collection */
|
|
686
|
+
total_items: number;
|
|
687
|
+
};
|
|
688
|
+
};
|
|
630
689
|
};
|
|
631
690
|
};
|
|
632
691
|
/** @description Unauthorized. Invalid or missing authentication. */
|
|
@@ -676,7 +735,20 @@ export interface paths {
|
|
|
676
735
|
/** @description Get revisions for a specific deployment. */
|
|
677
736
|
get: {
|
|
678
737
|
parameters: {
|
|
679
|
-
query?:
|
|
738
|
+
query?: {
|
|
739
|
+
/** @description Base64-encoded cursor for keyset pagination */
|
|
740
|
+
cursor?: string;
|
|
741
|
+
/** @description Number of items per page (10, 20, 50, or 100) */
|
|
742
|
+
limit?: 10 | 20 | 50 | 100 | "10" | "20" | "50" | "100";
|
|
743
|
+
/** @description Sort order: 'asc' (oldest first) or 'desc' (newest first) */
|
|
744
|
+
sort_order?: "asc" | "desc";
|
|
745
|
+
/** @description Filter by exact revision number */
|
|
746
|
+
revision?: number;
|
|
747
|
+
/** @description Filter revisions created after this date (ISO 8601 format) */
|
|
748
|
+
created_after?: string;
|
|
749
|
+
/** @description Filter revisions created before this date (ISO 8601 format) */
|
|
750
|
+
created_before?: string;
|
|
751
|
+
};
|
|
680
752
|
header: {
|
|
681
753
|
/** @description Required when using Wallet Authentication. The public key used to sign authentication header. */
|
|
682
754
|
"x-user-id"?: string;
|
|
@@ -693,13 +765,23 @@ export interface paths {
|
|
|
693
765
|
};
|
|
694
766
|
requestBody?: never;
|
|
695
767
|
responses: {
|
|
696
|
-
/** @description List of revisions for the deployment. */
|
|
768
|
+
/** @description List of revisions for the deployment with pagination. */
|
|
697
769
|
200: {
|
|
698
770
|
headers: {
|
|
699
771
|
[name: string]: unknown;
|
|
700
772
|
};
|
|
701
773
|
content: {
|
|
702
|
-
"application/json":
|
|
774
|
+
"application/json": {
|
|
775
|
+
revisions: components["schemas"]["Revision"][];
|
|
776
|
+
pagination: {
|
|
777
|
+
/** @description Cursor for next page, null if no more pages */
|
|
778
|
+
cursor_next: string | null;
|
|
779
|
+
/** @description Cursor for previous page, null if on first page */
|
|
780
|
+
cursor_prev: string | null;
|
|
781
|
+
/** @description Total number of items in collection */
|
|
782
|
+
total_items: number;
|
|
783
|
+
};
|
|
784
|
+
};
|
|
703
785
|
};
|
|
704
786
|
};
|
|
705
787
|
/** @description Unauthorized. Invalid or missing authentication. */
|
|
@@ -749,7 +831,22 @@ export interface paths {
|
|
|
749
831
|
/** @description Get events for a specific deployment. */
|
|
750
832
|
get: {
|
|
751
833
|
parameters: {
|
|
752
|
-
query?:
|
|
834
|
+
query?: {
|
|
835
|
+
/** @description Base64-encoded cursor for keyset pagination */
|
|
836
|
+
cursor?: string;
|
|
837
|
+
/** @description Number of items per page (10, 20, 50, or 100) */
|
|
838
|
+
limit?: 10 | 20 | 50 | 100 | "10" | "20" | "50" | "100";
|
|
839
|
+
/** @description Sort order: 'asc' (oldest first) or 'desc' (newest first) */
|
|
840
|
+
sort_order?: "asc" | "desc";
|
|
841
|
+
/** @description Filter by event category: 'Deployment' or 'Event'. Can be comma-separated list */
|
|
842
|
+
category?: ("Deployment" | "Event") | string;
|
|
843
|
+
/** @description Filter by event type. Can be single value or comma-separated list */
|
|
844
|
+
type?: string;
|
|
845
|
+
/** @description Filter events created after this date (ISO 8601 format) */
|
|
846
|
+
created_after?: string;
|
|
847
|
+
/** @description Filter events created before this date (ISO 8601 format) */
|
|
848
|
+
created_before?: string;
|
|
849
|
+
};
|
|
753
850
|
header: {
|
|
754
851
|
/** @description Required when using Wallet Authentication. The public key used to sign authentication header. */
|
|
755
852
|
"x-user-id"?: string;
|
|
@@ -766,13 +863,23 @@ export interface paths {
|
|
|
766
863
|
};
|
|
767
864
|
requestBody?: never;
|
|
768
865
|
responses: {
|
|
769
|
-
/** @description List of events for the deployment. */
|
|
866
|
+
/** @description List of events for the deployment with pagination. */
|
|
770
867
|
200: {
|
|
771
868
|
headers: {
|
|
772
869
|
[name: string]: unknown;
|
|
773
870
|
};
|
|
774
871
|
content: {
|
|
775
|
-
"application/json":
|
|
872
|
+
"application/json": {
|
|
873
|
+
events: components["schemas"]["Event"][];
|
|
874
|
+
pagination: {
|
|
875
|
+
/** @description Cursor for next page, null if no more pages */
|
|
876
|
+
cursor_next: string | null;
|
|
877
|
+
/** @description Cursor for previous page, null if on first page */
|
|
878
|
+
cursor_prev: string | null;
|
|
879
|
+
/** @description Total number of items in collection */
|
|
880
|
+
total_items: number;
|
|
881
|
+
};
|
|
882
|
+
};
|
|
776
883
|
};
|
|
777
884
|
};
|
|
778
885
|
/** @description Unauthorized. Invalid or missing authentication. */
|
|
@@ -2353,9 +2460,9 @@ export interface operations {
|
|
|
2353
2460
|
postApiJobsList: {
|
|
2354
2461
|
parameters: {
|
|
2355
2462
|
query?: never;
|
|
2356
|
-
header
|
|
2463
|
+
header?: {
|
|
2357
2464
|
/** @description Authorization header: Bearer <jwt> or Bearer <key> */
|
|
2358
|
-
authorization
|
|
2465
|
+
authorization?: string;
|
|
2359
2466
|
};
|
|
2360
2467
|
path?: never;
|
|
2361
2468
|
cookie?: never;
|
|
@@ -2428,9 +2535,9 @@ export interface operations {
|
|
|
2428
2535
|
postApiJobsByAddressExtend: {
|
|
2429
2536
|
parameters: {
|
|
2430
2537
|
query?: never;
|
|
2431
|
-
header
|
|
2538
|
+
header?: {
|
|
2432
2539
|
/** @description Authorization header: Bearer <jwt> or Bearer <key> */
|
|
2433
|
-
authorization
|
|
2540
|
+
authorization?: string;
|
|
2434
2541
|
};
|
|
2435
2542
|
path: {
|
|
2436
2543
|
address: string;
|
|
@@ -2490,9 +2597,9 @@ export interface operations {
|
|
|
2490
2597
|
postApiJobsByAddressStop: {
|
|
2491
2598
|
parameters: {
|
|
2492
2599
|
query?: never;
|
|
2493
|
-
header
|
|
2600
|
+
header?: {
|
|
2494
2601
|
/** @description Authorization header: Bearer <jwt> or Bearer <key> */
|
|
2495
|
-
authorization
|
|
2602
|
+
authorization?: string;
|
|
2496
2603
|
};
|
|
2497
2604
|
path: {
|
|
2498
2605
|
address: string;
|
|
@@ -3007,110 +3114,12 @@ export interface operations {
|
|
|
3007
3114
|
};
|
|
3008
3115
|
};
|
|
3009
3116
|
};
|
|
3010
|
-
"postApiAuthSign-messageExternal": {
|
|
3011
|
-
parameters: {
|
|
3012
|
-
query?: never;
|
|
3013
|
-
header: {
|
|
3014
|
-
/** @description JWT token (with or without Bearer prefix) */
|
|
3015
|
-
authorization: string;
|
|
3016
|
-
};
|
|
3017
|
-
path?: never;
|
|
3018
|
-
cookie?: never;
|
|
3019
|
-
};
|
|
3020
|
-
requestBody: {
|
|
3021
|
-
content: {
|
|
3022
|
-
"application/json": {
|
|
3023
|
-
/** @description The message to be signed with the user's private key */
|
|
3024
|
-
message: string;
|
|
3025
|
-
};
|
|
3026
|
-
"multipart/form-data": {
|
|
3027
|
-
/** @description The message to be signed with the user's private key */
|
|
3028
|
-
message: string;
|
|
3029
|
-
};
|
|
3030
|
-
"text/plain": {
|
|
3031
|
-
/** @description The message to be signed with the user's private key */
|
|
3032
|
-
message: string;
|
|
3033
|
-
};
|
|
3034
|
-
};
|
|
3035
|
-
};
|
|
3036
|
-
responses: {
|
|
3037
|
-
200: {
|
|
3038
|
-
headers: {
|
|
3039
|
-
[name: string]: unknown;
|
|
3040
|
-
};
|
|
3041
|
-
content: {
|
|
3042
|
-
"application/json": {
|
|
3043
|
-
/** @description The signed message in base58 format */
|
|
3044
|
-
signature: string;
|
|
3045
|
-
/** @description The original message that was signed */
|
|
3046
|
-
message: string;
|
|
3047
|
-
/** @description The address of the user whose private key should be used for signing */
|
|
3048
|
-
userAddress: string;
|
|
3049
|
-
};
|
|
3050
|
-
"multipart/form-data": {
|
|
3051
|
-
/** @description The signed message in base58 format */
|
|
3052
|
-
signature: string;
|
|
3053
|
-
/** @description The original message that was signed */
|
|
3054
|
-
message: string;
|
|
3055
|
-
/** @description The address of the user whose private key should be used for signing */
|
|
3056
|
-
userAddress: string;
|
|
3057
|
-
};
|
|
3058
|
-
"text/plain": {
|
|
3059
|
-
/** @description The signed message in base58 format */
|
|
3060
|
-
signature: string;
|
|
3061
|
-
/** @description The original message that was signed */
|
|
3062
|
-
message: string;
|
|
3063
|
-
/** @description The address of the user whose private key should be used for signing */
|
|
3064
|
-
userAddress: string;
|
|
3065
|
-
};
|
|
3066
|
-
};
|
|
3067
|
-
};
|
|
3068
|
-
401: {
|
|
3069
|
-
headers: {
|
|
3070
|
-
[name: string]: unknown;
|
|
3071
|
-
};
|
|
3072
|
-
content: {
|
|
3073
|
-
"application/json": {
|
|
3074
|
-
name: string;
|
|
3075
|
-
message: string;
|
|
3076
|
-
};
|
|
3077
|
-
"multipart/form-data": {
|
|
3078
|
-
name: string;
|
|
3079
|
-
message: string;
|
|
3080
|
-
};
|
|
3081
|
-
"text/plain": {
|
|
3082
|
-
name: string;
|
|
3083
|
-
message: string;
|
|
3084
|
-
};
|
|
3085
|
-
};
|
|
3086
|
-
};
|
|
3087
|
-
500: {
|
|
3088
|
-
headers: {
|
|
3089
|
-
[name: string]: unknown;
|
|
3090
|
-
};
|
|
3091
|
-
content: {
|
|
3092
|
-
"application/json": {
|
|
3093
|
-
name: string;
|
|
3094
|
-
message: string;
|
|
3095
|
-
};
|
|
3096
|
-
"multipart/form-data": {
|
|
3097
|
-
name: string;
|
|
3098
|
-
message: string;
|
|
3099
|
-
};
|
|
3100
|
-
"text/plain": {
|
|
3101
|
-
name: string;
|
|
3102
|
-
message: string;
|
|
3103
|
-
};
|
|
3104
|
-
};
|
|
3105
|
-
};
|
|
3106
|
-
};
|
|
3107
|
-
};
|
|
3108
3117
|
getApiCreditsBalance: {
|
|
3109
3118
|
parameters: {
|
|
3110
3119
|
query?: never;
|
|
3111
|
-
header
|
|
3120
|
+
header?: {
|
|
3112
3121
|
/** @description Authorization header: Bearer <jwt> or Bearer <key> */
|
|
3113
|
-
authorization
|
|
3122
|
+
authorization?: string;
|
|
3114
3123
|
};
|
|
3115
3124
|
path?: never;
|
|
3116
3125
|
cookie?: never;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type NosanaJobsApi, type NosanaCreditsApi, type NosanaMarketsApi, type DeploymentsApi, type ApiDeploymentsApi } from './routes/index.js';
|
|
2
|
-
import type { ApiKeyAuth, CreateNosanaApiOptions, SignerAuth, NosanaNetwork as NosanaNetworkType
|
|
2
|
+
import type { ApiKeyAuth, CreateNosanaApiOptions, SignerAuth, NosanaNetwork as NosanaNetworkType } from './types.js';
|
|
3
3
|
export interface NosanaApi {
|
|
4
4
|
jobs: NosanaJobsApi;
|
|
5
5
|
credits: NosanaCreditsApi;
|
|
@@ -12,12 +12,12 @@ export interface NosanaApiWithApiKey {
|
|
|
12
12
|
markets: NosanaMarketsApi;
|
|
13
13
|
deployments: ApiDeploymentsApi;
|
|
14
14
|
}
|
|
15
|
+
export type NosanaApiClient = NosanaApi | NosanaApiWithApiKey;
|
|
15
16
|
export declare function createNosanaApi(environment: NosanaNetworkType, noAuth: undefined, options?: CreateNosanaApiOptions): NosanaApi;
|
|
16
17
|
export declare function createNosanaApi(environment: NosanaNetworkType, signerAuth: SignerAuth, options?: CreateNosanaApiOptions): NosanaApi;
|
|
17
18
|
export declare function createNosanaApi(environment: NosanaNetworkType, apiKeyAuth: ApiKeyAuth, options?: CreateNosanaApiOptions): NosanaApiWithApiKey;
|
|
18
|
-
export declare function createNosanaApi(environment: NosanaNetworkType, includeCookies: IncludeCookiesAuth, options?: CreateNosanaApiOptions): NosanaApi;
|
|
19
19
|
export * from './types.js';
|
|
20
|
-
export type { ApiConfig } from './
|
|
20
|
+
export type { CreateNosanaApiOptions as ApiConfig, CreateNosanaApiOptions } from './types.js';
|
|
21
21
|
export type * from './routes/jobs/types.js';
|
|
22
22
|
export type * from './routes/credits/types.js';
|
|
23
23
|
export type * from './routes/markets/types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createNosanaClient } from './client/index.js';
|
|
2
2
|
import { createNosanaJobsApi, createNosanaCreditsApi, createNosanaMarketsApi, createDeploymentsApi } from './routes/index.js';
|
|
3
3
|
import { NosanaNetwork } from './types.js';
|
|
4
|
-
export function createNosanaApi(environment = NosanaNetwork.MAINNET,
|
|
5
|
-
const client = createNosanaClient(environment,
|
|
6
|
-
const hasApiKey = typeof
|
|
4
|
+
export function createNosanaApi(environment = NosanaNetwork.MAINNET, signerOrApiKey, options) {
|
|
5
|
+
const client = createNosanaClient(environment, signerOrApiKey, options);
|
|
6
|
+
const hasApiKey = typeof signerOrApiKey === 'string';
|
|
7
7
|
return {
|
|
8
8
|
jobs: createNosanaJobsApi(client),
|
|
9
9
|
credits: createNosanaCreditsApi(client),
|
|
10
10
|
markets: createNosanaMarketsApi(client),
|
|
11
|
-
deployments: !hasApiKey &&
|
|
12
|
-
? createDeploymentsApi({ client, solana:
|
|
11
|
+
deployments: !hasApiKey && signerOrApiKey
|
|
12
|
+
? createDeploymentsApi({ client, solana: signerOrApiKey.solana }, false)
|
|
13
13
|
: createDeploymentsApi({ client }, true)
|
|
14
14
|
};
|
|
15
15
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAwB3C,MAAM,UAAU,eAAe,CAC7B,cAAiC,aAAa,CAAC,OAAO,EACtD,cAAmD,EACnD,OAAgC;IAEhC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACxE,MAAM,SAAS,GAAG,OAAO,cAAc,KAAK,QAAQ,CAAC;IAErD,OAAO;QACL,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC;QACjC,OAAO,EAAE,sBAAsB,CAAC,MAAM,CAAC;QACvC,OAAO,EAAE,sBAAsB,CAAC,MAAM,CAAC;QACvC,WAAW,EAAE,CAAC,SAAS,IAAI,cAAc;YACvC,CAAC,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC;YACxE,CAAC,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC;KAC3C,CAAC;AACJ,CAAC;AAED,eAAe;AACf,cAAc,YAAY,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { DeploymentState } from '../../types.js';
|
|
4
|
-
export type DeploymentEvents = paths['/api/deployments/{deployment}/events']['get']['responses']['200']['content']['application/json'];
|
|
2
|
+
import type { DeploymentState, PaginationParams, EventListResult } from '../../types.js';
|
|
5
3
|
/**
|
|
6
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<EventListResult>
|
|
7
5
|
* @throws Error if there is an error fetching the events
|
|
8
6
|
* @throws Error if the deployment is not found
|
|
9
7
|
* @description Fetches the events for the deployment.
|
|
10
8
|
* This will return all events associated with the deployment.
|
|
11
9
|
* It is useful for monitoring deployment activity and debugging.
|
|
12
10
|
*/
|
|
13
|
-
export declare function deploymentGetEvents(client: QueryClient, state: DeploymentState): Promise<
|
|
11
|
+
export declare function deploymentGetEvents(client: QueryClient, state: DeploymentState, params?: PaginationParams): Promise<EventListResult>;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
import { withPagination } from '../../../../utils/withPagination.js';
|
|
2
3
|
/**
|
|
3
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<EventListResult>
|
|
4
5
|
* @throws Error if there is an error fetching the events
|
|
5
6
|
* @throws Error if the deployment is not found
|
|
6
7
|
* @description Fetches the events for the deployment.
|
|
7
8
|
* This will return all events associated with the deployment.
|
|
8
9
|
* It is useful for monitoring deployment activity and debugging.
|
|
9
10
|
*/
|
|
10
|
-
export async function deploymentGetEvents(client, state) {
|
|
11
|
+
export async function deploymentGetEvents(client, state, params) {
|
|
11
12
|
const { data, error } = await client.GET('/api/deployments/{deployment}/events', {
|
|
12
|
-
params: {
|
|
13
|
+
params: {
|
|
14
|
+
path: { deployment: state.id },
|
|
15
|
+
query: {
|
|
16
|
+
cursor: params?.cursor,
|
|
17
|
+
limit: params?.limit,
|
|
18
|
+
sort_order: params?.sort_order,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
13
21
|
});
|
|
14
22
|
if (error || !data) {
|
|
15
23
|
throw errorFormatter('Error getting deployment events', error);
|
|
16
24
|
}
|
|
17
|
-
return data;
|
|
25
|
+
return withPagination(data, (cursor) => deploymentGetEvents(client, state, { ...params, cursor }));
|
|
18
26
|
}
|
|
19
27
|
//# sourceMappingURL=deploymentGetEvents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentGetEvents.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"deploymentGetEvents.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAmB,EACnB,KAAsB,EACtB,MAAyB;IAEzB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,sCAAsC,EACtC;QACE,MAAM,EAAE;YACN,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9B,KAAK,EAAE;gBACL,MAAM,EAAE,MAAM,EAAE,MAAM;gBACtB,KAAK,EAAE,MAAM,EAAE,KAAK;gBACpB,UAAU,EAAE,MAAM,EAAE,UAAU;aAC/B;SACF;KACF,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,cAAc,CACnB,IAAI,EACJ,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CACtE,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { DeploymentState } from '../../types.js';
|
|
4
|
-
export type DeploymentJobs = paths['/api/deployments/{deployment}/jobs']['get']['responses']['200']['content']['application/json'];
|
|
2
|
+
import type { DeploymentState, PaginationParams, JobListResult } from '../../types.js';
|
|
5
3
|
/**
|
|
6
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<JobListResult>
|
|
7
5
|
* @throws Error if there is an error fetching the jobs
|
|
8
6
|
* @throws Error if the deployment is not found
|
|
9
7
|
* @description Fetches the jobs for the deployment.
|
|
10
8
|
* This will return the current jobs associated with the deployment.
|
|
11
9
|
* It is useful for monitoring the deployment's job status.
|
|
12
10
|
*/
|
|
13
|
-
export declare function deploymentGetJobs(client: QueryClient, state: DeploymentState): Promise<
|
|
11
|
+
export declare function deploymentGetJobs(client: QueryClient, state: DeploymentState, params?: PaginationParams): Promise<JobListResult>;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
import { withPagination } from '../../../../utils/withPagination.js';
|
|
2
3
|
/**
|
|
3
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<JobListResult>
|
|
4
5
|
* @throws Error if there is an error fetching the jobs
|
|
5
6
|
* @throws Error if the deployment is not found
|
|
6
7
|
* @description Fetches the jobs for the deployment.
|
|
7
8
|
* This will return the current jobs associated with the deployment.
|
|
8
9
|
* It is useful for monitoring the deployment's job status.
|
|
9
10
|
*/
|
|
10
|
-
export async function deploymentGetJobs(client, state) {
|
|
11
|
+
export async function deploymentGetJobs(client, state, params) {
|
|
11
12
|
const { data, error } = await client.GET('/api/deployments/{deployment}/jobs', {
|
|
12
|
-
params: {
|
|
13
|
+
params: {
|
|
14
|
+
path: { deployment: state.id },
|
|
15
|
+
query: {
|
|
16
|
+
cursor: params?.cursor,
|
|
17
|
+
limit: params?.limit,
|
|
18
|
+
sort_order: params?.sort_order,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
13
21
|
});
|
|
14
22
|
if (error || !data) {
|
|
15
23
|
throw errorFormatter('Error getting deployment jobs', error);
|
|
16
24
|
}
|
|
17
|
-
return data;
|
|
25
|
+
return withPagination(data, (cursor) => deploymentGetJobs(client, state, { ...params, cursor }));
|
|
18
26
|
}
|
|
19
27
|
//# sourceMappingURL=deploymentGetJobs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentGetJobs.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetJobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"deploymentGetJobs.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetJobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAmB,EACnB,KAAsB,EACtB,MAAyB;IAEzB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,oCAAoC,EACpC;QACE,MAAM,EAAE;YACN,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9B,KAAK,EAAE;gBACL,MAAM,EAAE,MAAM,EAAE,MAAM;gBACtB,KAAK,EAAE,MAAM,EAAE,KAAK;gBACpB,UAAU,EAAE,MAAM,EAAE,UAAU;aAC/B;SACF;KACF,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,cAAc,CACnB,IAAI,EACJ,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CACpE,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { DeploymentState } from '../../types.js';
|
|
4
|
-
export type DeploymentRevisions = paths['/api/deployments/{deployment}/revisions']['get']['responses']['200']['content']['application/json'];
|
|
2
|
+
import type { DeploymentState, PaginationParams, RevisionListResult } from '../../types.js';
|
|
5
3
|
/**
|
|
6
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<RevisionListResult>
|
|
7
5
|
* @throws Error if there is an error fetching the revisions
|
|
8
6
|
* @throws Error if the deployment is not found
|
|
9
7
|
* @description Fetches the revisions for the deployment.
|
|
10
8
|
* This will return all revisions associated with the deployment.
|
|
11
9
|
* It is useful for viewing the deployment history.
|
|
12
10
|
*/
|
|
13
|
-
export declare function deploymentGetRevisions(client: QueryClient, state: DeploymentState): Promise<
|
|
11
|
+
export declare function deploymentGetRevisions(client: QueryClient, state: DeploymentState, params?: PaginationParams): Promise<RevisionListResult>;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
import { withPagination } from '../../../../utils/withPagination.js';
|
|
2
3
|
/**
|
|
3
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<RevisionListResult>
|
|
4
5
|
* @throws Error if there is an error fetching the revisions
|
|
5
6
|
* @throws Error if the deployment is not found
|
|
6
7
|
* @description Fetches the revisions for the deployment.
|
|
7
8
|
* This will return all revisions associated with the deployment.
|
|
8
9
|
* It is useful for viewing the deployment history.
|
|
9
10
|
*/
|
|
10
|
-
export async function deploymentGetRevisions(client, state) {
|
|
11
|
+
export async function deploymentGetRevisions(client, state, params) {
|
|
11
12
|
const { data, error } = await client.GET('/api/deployments/{deployment}/revisions', {
|
|
12
|
-
params: {
|
|
13
|
+
params: {
|
|
14
|
+
path: { deployment: state.id },
|
|
15
|
+
query: {
|
|
16
|
+
cursor: params?.cursor,
|
|
17
|
+
limit: params?.limit,
|
|
18
|
+
sort_order: params?.sort_order,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
13
21
|
});
|
|
14
22
|
if (error || !data) {
|
|
15
23
|
throw errorFormatter('Error getting deployment revisions', error);
|
|
16
24
|
}
|
|
17
|
-
return data;
|
|
25
|
+
return withPagination(data, (cursor) => deploymentGetRevisions(client, state, { ...params, cursor }));
|
|
18
26
|
}
|
|
19
27
|
//# sourceMappingURL=deploymentGetRevisions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentGetRevisions.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetRevisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"deploymentGetRevisions.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetRevisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAAmB,EACnB,KAAsB,EACtB,MAAyB;IAEzB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,yCAAyC,EACzC;QACE,MAAM,EAAE;YACN,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9B,KAAK,EAAE;gBACL,MAAM,EAAE,MAAM,EAAE,MAAM;gBACtB,KAAK,EAAE,MAAM,EAAE,KAAK;gBACpB,UAAU,EAAE,MAAM,EAAE,UAAU;aAC/B;SACF;KACF,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,cAAc,CACnB,IAAI,EACJ,CAAC,MAAM,EAAE,EAAE,CAAC,sBAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CACzE,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { DeploymentState } from '../../types.js';
|
|
2
|
+
import type { DeploymentState, PaginationParams, TaskListResult } from '../../types.js';
|
|
4
3
|
/**
|
|
5
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<TaskListResult>
|
|
6
5
|
* @throws Error if there is an error fetching the tasks
|
|
7
6
|
* @throws Error if the deployment is not found
|
|
8
7
|
* @description Fetches the tasks for the deployment.
|
|
9
8
|
* This will return the current tasks associated with the deployment.
|
|
10
9
|
* It is useful for monitoring the deployment's progress and status.
|
|
11
10
|
*/
|
|
12
|
-
export declare function deploymentGetTasks(client: QueryClient, state: DeploymentState): Promise<
|
|
11
|
+
export declare function deploymentGetTasks(client: QueryClient, state: DeploymentState, params?: PaginationParams): Promise<TaskListResult>;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
import { withPagination } from '../../../../utils/withPagination.js';
|
|
2
3
|
/**
|
|
3
|
-
* @returns Promise<
|
|
4
|
+
* @returns Promise<TaskListResult>
|
|
4
5
|
* @throws Error if there is an error fetching the tasks
|
|
5
6
|
* @throws Error if the deployment is not found
|
|
6
7
|
* @description Fetches the tasks for the deployment.
|
|
7
8
|
* This will return the current tasks associated with the deployment.
|
|
8
9
|
* It is useful for monitoring the deployment's progress and status.
|
|
9
10
|
*/
|
|
10
|
-
export async function deploymentGetTasks(client, state) {
|
|
11
|
+
export async function deploymentGetTasks(client, state, params) {
|
|
11
12
|
const { data, error } = await client.GET('/api/deployments/{deployment}/tasks', {
|
|
12
|
-
params: {
|
|
13
|
+
params: {
|
|
14
|
+
path: { deployment: state.id },
|
|
15
|
+
query: {
|
|
16
|
+
cursor: params?.cursor,
|
|
17
|
+
limit: params?.limit,
|
|
18
|
+
sort_order: params?.sort_order,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
13
21
|
});
|
|
14
22
|
if (error || !data) {
|
|
15
23
|
throw errorFormatter('Error getting deployment tasks', error);
|
|
16
24
|
}
|
|
17
|
-
return data;
|
|
25
|
+
return withPagination(data, (cursor) => deploymentGetTasks(client, state, { ...params, cursor }));
|
|
18
26
|
}
|
|
19
27
|
//# sourceMappingURL=deploymentGetTasks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentGetTasks.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetTasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"deploymentGetTasks.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetTasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAmB,EACnB,KAAsB,EACtB,MAAyB;IAEzB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,qCAAqC,EACrC;QACE,MAAM,EAAE;YACN,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9B,KAAK,EAAE;gBACL,MAAM,EAAE,MAAM,EAAE,MAAM;gBACtB,KAAK,EAAE,MAAM,EAAE,KAAK;gBACpB,UAAU,EAAE,MAAM,EAAE,UAAU;aAC/B;SACF;KACF,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,cAAc,CACnB,IAAI,EACJ,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CACrE,CAAC;AACJ,CAAC"}
|
|
@@ -38,15 +38,16 @@ export function createDeployment(deployment, options, hasApiKey) {
|
|
|
38
38
|
await deploymentArchive(options.client, state);
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
|
-
* @
|
|
41
|
+
* @param params Pagination parameters (optional: cursor, limit, sort_order)
|
|
42
|
+
* @returns Promise<TaskListResult>
|
|
42
43
|
* @throws Error if there is an error fetching the tasks
|
|
43
44
|
* @throws Error if the deployment is not found
|
|
44
45
|
* @description Fetches the tasks for the deployment.
|
|
45
46
|
* This will return the current tasks associated with the deployment.
|
|
46
47
|
* It is useful for monitoring the deployment's progress and status.
|
|
47
48
|
*/
|
|
48
|
-
const getTasks = async () => {
|
|
49
|
-
return await deploymentGetTasks(options.client, state);
|
|
49
|
+
const getTasks = async (params) => {
|
|
50
|
+
return await deploymentGetTasks(options.client, state, params);
|
|
50
51
|
};
|
|
51
52
|
/**
|
|
52
53
|
* @param jobDefinition Job definition for the new revision
|
|
@@ -114,37 +115,40 @@ export function createDeployment(deployment, options, hasApiKey) {
|
|
|
114
115
|
return await deploymentGetJob(options.client, state.id, job);
|
|
115
116
|
};
|
|
116
117
|
/**
|
|
117
|
-
* @
|
|
118
|
+
* @param params Pagination parameters (optional: cursor, limit, sort_order)
|
|
119
|
+
* @returns Promise<JobListResult>
|
|
118
120
|
* @throws Error if there is an error fetching the jobs
|
|
119
121
|
* @throws Error if the deployment is not found
|
|
120
122
|
* @description Fetches all jobs for the deployment.
|
|
121
123
|
* This will return the current jobs associated with the deployment.
|
|
122
124
|
* It is useful for monitoring the deployment's job status.
|
|
123
125
|
*/
|
|
124
|
-
const getJobs = async () => {
|
|
125
|
-
return await deploymentGetJobs(options.client, state);
|
|
126
|
+
const getJobs = async (params) => {
|
|
127
|
+
return await deploymentGetJobs(options.client, state, params);
|
|
126
128
|
};
|
|
127
129
|
/**
|
|
128
|
-
* @
|
|
130
|
+
* @param params Pagination parameters (optional: cursor, limit, sort_order)
|
|
131
|
+
* @returns Promise<RevisionListResult>
|
|
129
132
|
* @throws Error if there is an error fetching the revisions
|
|
130
133
|
* @throws Error if the deployment is not found
|
|
131
134
|
* @description Fetches all revisions for the deployment.
|
|
132
135
|
* This will return all revisions associated with the deployment.
|
|
133
136
|
* It is useful for viewing the deployment history.
|
|
134
137
|
*/
|
|
135
|
-
const getRevisions = async () => {
|
|
136
|
-
return await deploymentGetRevisions(options.client, state);
|
|
138
|
+
const getRevisions = async (params) => {
|
|
139
|
+
return await deploymentGetRevisions(options.client, state, params);
|
|
137
140
|
};
|
|
138
141
|
/**
|
|
139
|
-
* @
|
|
142
|
+
* @param params Pagination parameters (optional: cursor, limit, sort_order)
|
|
143
|
+
* @returns Promise<EventListResult>
|
|
140
144
|
* @throws Error if there is an error fetching the events
|
|
141
145
|
* @throws Error if the deployment is not found
|
|
142
146
|
* @description Fetches all events for the deployment.
|
|
143
147
|
* This will return all events associated with the deployment.
|
|
144
148
|
* It is useful for monitoring deployment activity and debugging.
|
|
145
149
|
*/
|
|
146
|
-
const getEvents = async () => {
|
|
147
|
-
return await deploymentGetEvents(options.client, state);
|
|
150
|
+
const getEvents = async (params) => {
|
|
151
|
+
return await deploymentGetEvents(options.client, state, params);
|
|
148
152
|
};
|
|
149
153
|
/**
|
|
150
154
|
* @throws Error if the deployment is not stopped
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDeployment.js","sourceRoot":"","sources":["../../../../src/routes/deployments/deployment/createDeployment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"createDeployment.js","sourceRoot":"","sources":["../../../../src/routes/deployments/deployment/createDeployment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAC5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CAAC,CAAC;IAEF;;;;;;;;OAQG;IACH,MAAM,SAAS,GAAG,KAAK,EAAE,MAAyB,EAA4B,EAAE;QAC9E,OAAO,MAAM,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC,CAAC;IAEF;;;;;;;;;QASI;IACJ,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;QAClC,OAAO,MAAM,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE;YACxD,kEAAkE;YAClE,KAAK,GAAG,SAAS,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QAC1B,GAAG,CAAC,CAAC,SAAS,IAAI,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC;YACtC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC;SAC3D,CAAC,CAAC,CAAC,EAAE,CAAC;QACP,KAAK;QACL,IAAI;QACJ,OAAO;QACP,MAAM,EAAE,gBAAgB;QACxB,QAAQ;QACR,MAAM;QACN,OAAO;QACP,YAAY;QACZ,SAAS;QACT,kBAAkB;QAClB,cAAc;QACd,kBAAkB;QAClB,oBAAoB;QACpB,aAAa;QACb,cAAc;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { errorFormatter } from '../../utils/errorFormatter.js';
|
|
2
|
+
import { withPagination } from '../../utils/withPagination.js';
|
|
2
3
|
import { createVault as createVaultFn } from './deployment/createVault.js';
|
|
3
4
|
import { createDeployment as createDeploymentFn } from './deployment/createDeployment.js';
|
|
4
5
|
export function createDeploymentsApi(options, hasApiKey) {
|
|
@@ -27,12 +28,23 @@ export function createDeploymentsApi(options, hasApiKey) {
|
|
|
27
28
|
}
|
|
28
29
|
return createDeployment(data);
|
|
29
30
|
};
|
|
30
|
-
const list = async () => {
|
|
31
|
-
const { data, error } = await options.client.GET('/api/deployments', {
|
|
31
|
+
const list = async (params) => {
|
|
32
|
+
const { data, error } = await options.client.GET('/api/deployments', {
|
|
33
|
+
params: {
|
|
34
|
+
query: {
|
|
35
|
+
cursor: params?.cursor,
|
|
36
|
+
limit: params?.limit,
|
|
37
|
+
sort_order: params?.sort_order,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
32
41
|
if (error || !data) {
|
|
33
42
|
throw errorFormatter('Error listing deployments', error);
|
|
34
43
|
}
|
|
35
|
-
return
|
|
44
|
+
return withPagination({
|
|
45
|
+
...data,
|
|
46
|
+
deployments: data.deployments.map((deployment) => createDeployment(deployment)),
|
|
47
|
+
}, (cursor) => list({ ...params, cursor }));
|
|
36
48
|
};
|
|
37
49
|
const pipe = async (deploymentIDorCreateObject, ...actions) => {
|
|
38
50
|
let deployment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/deployments/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAa1F,MAAM,UAAU,oBAAoB,CAAC,OAA8C,EAAE,SAAuB;IAC1G,MAAM,gBAAgB,GAAG,CAAC,IAAsB,EAAE,EAAE,CAAC,CAAC,SAAS,IAAI,QAAQ,IAAI,OAAO;QACpF,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC;QAC1C,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,KAAK,EAAE,cAAgC,EAAE,EAAE;QACxD,MAA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E,CAAC;YACnB,MAAM,cAAc,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,aAAa,CAClB,IAAI,CAAC,KAAK,EACV,OAAO,EACP,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAC1B,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,IAAI,EAAE;QAC5B,IAAI,SAAS,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,EAAE,CAAC;YACxC,MAAM,cAAc,CAAC,iDAAiD,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;QAEhF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,cAAc,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,aAAa,CACtD,KAAK,EACL,OAAO,EACP,IAAI,IAAI,CAAC,UAAU,CAAC,CACrB,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,GAAG;QACH,IAAI;QACJ,IAAI;QACJ,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACf,MAAM,EAAE;gBACN,MAAM,EAAE,WAAW;gBACnB,IAAI,EAAE,UAAU;aACjB;SACF,CAAC,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { JobDefinition,
|
|
2
|
-
export type { JobDefinition
|
|
1
|
+
import type { JobDefinition, components, paths } from '@nosana/types';
|
|
2
|
+
export type { JobDefinition } from '@nosana/types';
|
|
3
3
|
export type DeploymentState = Omit<components['schemas']['Deployment'], "updated_at" | "created_at"> & {
|
|
4
4
|
updated_at: Date;
|
|
5
5
|
created_at: Date;
|
|
@@ -8,9 +8,43 @@ export type DeploymentCreateBody = components['schemas']['DeploymentCreateBody']
|
|
|
8
8
|
export type CreateDeployment = Omit<DeploymentCreateBody, 'job_definition'> & {
|
|
9
9
|
job_definition: JobDefinition;
|
|
10
10
|
};
|
|
11
|
+
export type PaginationMeta = {
|
|
12
|
+
cursor_next: string | null;
|
|
13
|
+
cursor_prev: string | null;
|
|
14
|
+
total_items: number;
|
|
15
|
+
};
|
|
16
|
+
export type PaginatedResult<T> = T & {
|
|
17
|
+
total_items: number;
|
|
18
|
+
nextPage: (() => Promise<PaginatedResult<T>>) | null;
|
|
19
|
+
previousPage: (() => Promise<PaginatedResult<T>>) | null;
|
|
20
|
+
};
|
|
21
|
+
export type DeploymentListResult = PaginatedResult<{
|
|
22
|
+
deployments: Deployment[];
|
|
23
|
+
}>;
|
|
24
|
+
export type ApiDeploymentListResult = PaginatedResult<{
|
|
25
|
+
deployments: ApiDeployment[];
|
|
26
|
+
}>;
|
|
27
|
+
export type JobListResult = PaginatedResult<{
|
|
28
|
+
jobs: DeploymentJobItem[];
|
|
29
|
+
}>;
|
|
30
|
+
export type EventListResult = PaginatedResult<{
|
|
31
|
+
events: DeploymentEventItem[];
|
|
32
|
+
}>;
|
|
33
|
+
export type RevisionListResult = PaginatedResult<{
|
|
34
|
+
revisions: DeploymentRevisionItem[];
|
|
35
|
+
}>;
|
|
36
|
+
export type TaskListResult = PaginatedResult<{
|
|
37
|
+
tasks: DeploymentTaskItem[];
|
|
38
|
+
}>;
|
|
39
|
+
export type PaginationParams = {
|
|
40
|
+
cursor?: string;
|
|
41
|
+
limit?: 10 | 20 | 50 | 100;
|
|
42
|
+
sort_order?: 'asc' | 'desc';
|
|
43
|
+
};
|
|
11
44
|
export type DeploymentJobs = paths['/api/deployments/{deployment}/jobs']['get']['responses']['200']['content']['application/json'];
|
|
12
45
|
export type DeploymentRevisions = paths['/api/deployments/{deployment}/revisions']['get']['responses']['200']['content']['application/json'];
|
|
13
46
|
export type DeploymentEvents = paths['/api/deployments/{deployment}/events']['get']['responses']['200']['content']['application/json'];
|
|
47
|
+
export type DeploymentTasks = paths['/api/deployments/{deployment}/tasks']['get']['responses']['200']['content']['application/json'];
|
|
14
48
|
export interface TopupVaultOptions {
|
|
15
49
|
SOL?: number;
|
|
16
50
|
NOS?: number;
|
|
@@ -31,16 +65,20 @@ export interface Vault {
|
|
|
31
65
|
withdraw: () => Promise<void>;
|
|
32
66
|
}
|
|
33
67
|
export type DeploymentJob = paths['/api/deployments/{deployment}/jobs/{job}']['get']['responses']['200']['content']['application/json'];
|
|
68
|
+
export type DeploymentJobItem = DeploymentJobs['jobs'][number];
|
|
69
|
+
export type DeploymentRevisionItem = DeploymentRevisions['revisions'][number];
|
|
70
|
+
export type DeploymentEventItem = DeploymentEvents['events'][number];
|
|
71
|
+
export type DeploymentTaskItem = DeploymentTasks['tasks'][number];
|
|
34
72
|
export type ApiDeployment = DeploymentState & {
|
|
35
73
|
start: () => Promise<void>;
|
|
36
74
|
stop: () => Promise<void>;
|
|
37
75
|
archive: () => Promise<void>;
|
|
38
76
|
delete: () => Promise<void>;
|
|
39
|
-
getTasks: () => Promise<
|
|
77
|
+
getTasks: (params?: PaginationParams) => Promise<TaskListResult>;
|
|
40
78
|
getJob: (job: string) => Promise<DeploymentJob>;
|
|
41
|
-
getJobs: () => Promise<
|
|
42
|
-
getRevisions: () => Promise<
|
|
43
|
-
getEvents: () => Promise<
|
|
79
|
+
getJobs: (params?: PaginationParams) => Promise<JobListResult>;
|
|
80
|
+
getRevisions: (params?: PaginationParams) => Promise<RevisionListResult>;
|
|
81
|
+
getEvents: (params?: PaginationParams) => Promise<EventListResult>;
|
|
44
82
|
generateAuthHeader: () => Promise<string>;
|
|
45
83
|
createRevision: (jobDefinition: JobDefinition) => Promise<void>;
|
|
46
84
|
updateActiveRevision: (revision: number) => Promise<void>;
|
|
@@ -54,7 +92,7 @@ export type Deployment = ApiDeployment & {
|
|
|
54
92
|
export interface DeploymentsApi {
|
|
55
93
|
create: (deploymentBody: CreateDeployment) => Promise<Deployment>;
|
|
56
94
|
get: (deployment: string) => Promise<Deployment>;
|
|
57
|
-
list: () => Promise<
|
|
95
|
+
list: (params?: PaginationParams) => Promise<DeploymentListResult>;
|
|
58
96
|
pipe: (deploymentIDorCreateObject: string | CreateDeployment, ...actions: Array<(deployment: Deployment) => Promise<void> | void>) => Promise<Deployment>;
|
|
59
97
|
vaults: {
|
|
60
98
|
create: () => Promise<Vault>;
|
|
@@ -64,6 +102,6 @@ export interface DeploymentsApi {
|
|
|
64
102
|
export interface ApiDeploymentsApi {
|
|
65
103
|
create: (deploymentBody: CreateDeployment) => Promise<ApiDeployment>;
|
|
66
104
|
get: (deployment: string) => Promise<ApiDeployment>;
|
|
67
|
-
list: () => Promise<
|
|
105
|
+
list: (params?: PaginationParams) => Promise<ApiDeploymentListResult>;
|
|
68
106
|
pipe: (deploymentIDorCreateObject: string | CreateDeployment, ...actions: Array<(deployment: ApiDeployment) => Promise<void> | void>) => Promise<ApiDeployment>;
|
|
69
107
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export interface SolanaConfig {
|
|
|
6
6
|
network: string;
|
|
7
7
|
}
|
|
8
8
|
export type ApiKeyAuth = string;
|
|
9
|
-
export type IncludeCookiesAuth = 'include';
|
|
10
9
|
/**
|
|
11
10
|
* SignerAuth provides identifier and generate function for API authentication.
|
|
12
11
|
* Used by nosana-kit which converts Wallet → SignerAuth via @nosana/authorization.
|
|
@@ -29,6 +28,7 @@ export type SignerAuth = {
|
|
|
29
28
|
};
|
|
30
29
|
export type CreateNosanaApiOptions = Partial<{
|
|
31
30
|
backend_url: string;
|
|
31
|
+
include_credentials: boolean;
|
|
32
32
|
}>;
|
|
33
33
|
export interface Config {
|
|
34
34
|
backend_url: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PaginatedResult, PaginationMeta } from '../routes/deployments/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps API response data with pagination helpers.
|
|
4
|
+
*
|
|
5
|
+
* @param data - The API response containing pagination metadata
|
|
6
|
+
* @param fetchFn - Function that fetches the next/previous page given a cursor
|
|
7
|
+
* @returns A PaginatedResult with navigation methods and total items
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* return withPagination(
|
|
12
|
+
* data,
|
|
13
|
+
* (cursor) => deploymentGetEvents(client, state, { ...params, cursor })
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function withPagination<TData extends Record<string, any>>(data: TData & {
|
|
18
|
+
pagination: PaginationMeta;
|
|
19
|
+
}, fetchFn: (cursor: string) => Promise<PaginatedResult<Omit<TData, 'pagination'>>>): PaginatedResult<Omit<TData, 'pagination'>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps API response data with pagination helpers.
|
|
3
|
+
*
|
|
4
|
+
* @param data - The API response containing pagination metadata
|
|
5
|
+
* @param fetchFn - Function that fetches the next/previous page given a cursor
|
|
6
|
+
* @returns A PaginatedResult with navigation methods and total items
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* return withPagination(
|
|
11
|
+
* data,
|
|
12
|
+
* (cursor) => deploymentGetEvents(client, state, { ...params, cursor })
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export function withPagination(data, fetchFn) {
|
|
17
|
+
const { pagination, ...rest } = data;
|
|
18
|
+
const nextPage = pagination.cursor_next
|
|
19
|
+
? async () => fetchFn(pagination.cursor_next)
|
|
20
|
+
: null;
|
|
21
|
+
const previousPage = pagination.cursor_prev
|
|
22
|
+
? async () => fetchFn(pagination.cursor_prev)
|
|
23
|
+
: null;
|
|
24
|
+
return {
|
|
25
|
+
...rest,
|
|
26
|
+
total_items: pagination.total_items,
|
|
27
|
+
nextPage,
|
|
28
|
+
previousPage,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=withPagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withPagination.js","sourceRoot":"","sources":["../../src/utils/withPagination.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAC5B,IAA4C,EAC5C,OAAgF;IAEhF,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAErC,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW;QACrC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,WAAY,CAAC;QAC9C,CAAC,CAAC,IAAI,CAAC;IAET,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW;QACzC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,WAAY,CAAC;QAC9C,CAAC,CAAC,IAAI,CAAC;IAET,OAAO;QACL,GAAG,IAAI;QACP,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,QAAQ;QACR,YAAY;KACiC,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosana/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Nosana API module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"author": "Nosana",
|
|
8
9
|
"license": "MIT",
|
|
@@ -10,8 +11,11 @@
|
|
|
10
11
|
"dist"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
14
|
+
"prepack": "pnpm run build:with-deps",
|
|
13
15
|
"build": "tsc",
|
|
14
|
-
"build:
|
|
16
|
+
"build:with-deps": "pnpm --filter $npm_package_name... run build",
|
|
17
|
+
"dev": "tsc --watch",
|
|
18
|
+
"dev:with-deps": "pnpm --filter $npm_package_name... run dev --parallel",
|
|
15
19
|
"clean": "rm -rf dist",
|
|
16
20
|
"generate:types:dev": "openapi-typescript https://dashboard.k8s.dev.nos.ci/api/swagger/json -o src/client/schema.ts",
|
|
17
21
|
"generate:types:prd": "openapi-typescript https://dashboard.k8s.prd.nos.ci/api/swagger/json -o src/client/schema.ts",
|
|
@@ -19,11 +23,10 @@
|
|
|
19
23
|
"test": "vitest run",
|
|
20
24
|
"test:watch": "vitest",
|
|
21
25
|
"test:coverage": "vitest run --coverage",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"format": "
|
|
25
|
-
"format:fix": "
|
|
26
|
-
"publish:public": "npm run build && npm publish --access public"
|
|
26
|
+
"lint": "eslint ./src",
|
|
27
|
+
"lint:fix": "eslint --fix ./src",
|
|
28
|
+
"format": "echo 'No format' && exit 0",
|
|
29
|
+
"format:fix": "echo 'No format:fix' && exit 0"
|
|
27
30
|
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@types/node": "^24.0.14",
|
|
@@ -38,7 +41,12 @@
|
|
|
38
41
|
"vitest": "^4.0.3"
|
|
39
42
|
},
|
|
40
43
|
"dependencies": {
|
|
41
|
-
"@nosana/types": "
|
|
44
|
+
"@nosana/types": "2.1.0",
|
|
42
45
|
"openapi-fetch": "^0.14.0"
|
|
43
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"packageManager": "pnpm@10.28.1",
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=20.18.0"
|
|
50
|
+
},
|
|
51
|
+
"gitHead": "3164e4634b654bdc2ba9f3030ccd8891e30940f7"
|
|
44
52
|
}
|