@nosana/api 0.1.7 → 0.1.11
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 +73 -0
- package/dist/client/deployment-manager-schema.d.ts +2100 -0
- package/dist/client/deployment-manager-schema.js +6 -0
- package/dist/client/deployment-manager-schema.js.map +1 -0
- package/dist/client/index.js +4 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/schema.d.ts +406 -804
- package/dist/routes/credits/index.js +1 -1
- package/dist/routes/credits/index.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentArchive.js +3 -2
- package/dist/routes/deployments/deployment/actions/deploymentArchive.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentCreateNewRevision.js +0 -1
- package/dist/routes/deployments/deployment/actions/deploymentCreateNewRevision.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentDelete.d.ts +13 -0
- package/dist/routes/deployments/deployment/actions/deploymentDelete.js +26 -0
- package/dist/routes/deployments/deployment/actions/deploymentDelete.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetEvents.d.ts +13 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetEvents.js +19 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetEvents.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetJob.js +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentGetJob.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentGetJobs.d.ts +13 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetJobs.js +19 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetJobs.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetRevisions.d.ts +13 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetRevisions.js +19 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetRevisions.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentStart.js +3 -2
- package/dist/routes/deployments/deployment/actions/deploymentStart.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentStop.js +3 -2
- package/dist/routes/deployments/deployment/actions/deploymentStop.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentUpdateActiveRevision.js +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentUpdateActiveRevision.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentUpdateReplicaCount.js +3 -2
- package/dist/routes/deployments/deployment/actions/deploymentUpdateReplicaCount.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentUpdateSchedule.js +2 -1
- package/dist/routes/deployments/deployment/actions/deploymentUpdateSchedule.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentUpdateTimeout.js +3 -2
- package/dist/routes/deployments/deployment/actions/deploymentUpdateTimeout.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/index.d.ts +4 -0
- package/dist/routes/deployments/deployment/actions/index.js +4 -0
- package/dist/routes/deployments/deployment/actions/index.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/vaultWithdraw.js +1 -1
- package/dist/routes/deployments/deployment/actions/vaultWithdraw.js.map +1 -1
- package/dist/routes/deployments/deployment/createDeployment.d.ts +3 -1
- package/dist/routes/deployments/deployment/createDeployment.js +60 -3
- package/dist/routes/deployments/deployment/createDeployment.js.map +1 -1
- package/dist/routes/deployments/index.js +0 -3
- package/dist/routes/deployments/index.js.map +1 -1
- package/dist/routes/deployments/types.d.ts +9 -2
- package/dist/routes/jobs/index.js +4 -4
- package/dist/routes/jobs/index.js.map +1 -1
- package/dist/routes/markets/index.js +3 -3
- package/dist/routes/markets/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ export function createNosanaCreditsApi(client) {
|
|
|
4
4
|
return {
|
|
5
5
|
async balance() {
|
|
6
6
|
const { data, error } = await client.GET('/api/credits/balance', {});
|
|
7
|
-
if (
|
|
7
|
+
if (error || !data) {
|
|
8
8
|
throw errorFormatter('Failed to fetch balance', error);
|
|
9
9
|
}
|
|
10
10
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/credits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/credits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,cAAc,YAAY,CAAC;AAE3B,MAAM,UAAU,sBAAsB,CAAC,MAAmB;IACxD,OAAO;QACL,KAAK,CAAC,OAAO;YACX,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;YACrE,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;gBACnB,MAAM,cAAc,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
3
2
|
import { DeploymentStatus } from '@nosana/types';
|
|
4
3
|
/**
|
|
@@ -10,7 +9,9 @@ import { DeploymentStatus } from '@nosana/types';
|
|
|
10
9
|
* It is useful for cleaning up deployments that are no longer needed.
|
|
11
10
|
*/
|
|
12
11
|
export async function deploymentArchive(client, state) {
|
|
13
|
-
|
|
12
|
+
if (state.status !== DeploymentStatus.STOPPED) {
|
|
13
|
+
throw new Error('Deployment must be stopped before archiving');
|
|
14
|
+
}
|
|
14
15
|
const { data, error } = await client.POST('/api/deployments/{deployment}/archive', {
|
|
15
16
|
params: { path: { deployment: state.id } },
|
|
16
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentArchive.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentArchive.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deploymentArchive.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentArchive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAmB,EACnB,KAAsB;IAEtB,IAAI,KAAK,CAAC,MAAM,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CACvC,uCAAuC,EACvC;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;KAC3C,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,MAAM,EAAE,gBAAgB,CAAC,QAAQ;QACjC,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;IAEH,oDAAoD;IACpD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -11,7 +11,6 @@ export async function deploymentCreateNewRevision(jobDefinition, client, state)
|
|
|
11
11
|
active_revision: data.active_revision,
|
|
12
12
|
endpoints: data.endpoints,
|
|
13
13
|
updated_at: new Date(data.updated_at),
|
|
14
|
-
revisions: [...state.revisions, data.revisions],
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=deploymentCreateNewRevision.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentCreateNewRevision.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentCreateNewRevision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAMrE,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,aAA4B,EAAE,MAAmB,EAAE,KAAsB;IACzH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,+CAA+C,EAAE;QACzF,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,aAAuD;KAC9D,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"deploymentCreateNewRevision.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentCreateNewRevision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAMrE,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,aAA4B,EAAE,MAAmB,EAAE,KAAsB;IACzH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,+CAA+C,EAAE;QACzF,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,aAAuD;KAC9D,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { DeploymentState } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @throws Error if the deployment is not stopped
|
|
5
|
+
* @throws Error if there is an error deleting the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Deletes the deployment permanently.
|
|
8
|
+
* This will remove the deployment and all associated data (jobs, results, revisions, events).
|
|
9
|
+
* The deployment must be in STOPPED state before it can be deleted.
|
|
10
|
+
* The vault associated with the deployment is NOT deleted.
|
|
11
|
+
* After successful deletion, the clearState callback is invoked to prevent further interaction.
|
|
12
|
+
*/
|
|
13
|
+
export declare function deploymentDelete(client: QueryClient, state: DeploymentState, clearState: () => void): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
import { DeploymentStatus } from '@nosana/types';
|
|
3
|
+
/**
|
|
4
|
+
* @throws Error if the deployment is not stopped
|
|
5
|
+
* @throws Error if there is an error deleting the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Deletes the deployment permanently.
|
|
8
|
+
* This will remove the deployment and all associated data (jobs, results, revisions, events).
|
|
9
|
+
* The deployment must be in STOPPED state before it can be deleted.
|
|
10
|
+
* The vault associated with the deployment is NOT deleted.
|
|
11
|
+
* After successful deletion, the clearState callback is invoked to prevent further interaction.
|
|
12
|
+
*/
|
|
13
|
+
export async function deploymentDelete(client, state, clearState) {
|
|
14
|
+
if (state.status !== DeploymentStatus.STOPPED) {
|
|
15
|
+
throw new Error('Deployment must be stopped before it can be deleted');
|
|
16
|
+
}
|
|
17
|
+
const { error } = await client.DELETE('/api/deployments/{deployment}', {
|
|
18
|
+
params: { path: { deployment: state.id } },
|
|
19
|
+
});
|
|
20
|
+
if (error) {
|
|
21
|
+
throw errorFormatter('Error deleting deployment', error);
|
|
22
|
+
}
|
|
23
|
+
// Clear the state to prevent further interaction
|
|
24
|
+
clearState();
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=deploymentDelete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploymentDelete.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAmB,EACnB,KAAsB,EACtB,UAAsB;IAEtB,IAAI,KAAK,CAAC,MAAM,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CACnC,+BAA+B,EAC/B;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;KAC3C,CACF,CAAC;IAEF,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,cAAc,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;IAED,iDAAiD;IACjD,UAAU,EAAE,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { paths } from '@nosana/types';
|
|
3
|
+
import type { DeploymentState } from '../../types.js';
|
|
4
|
+
export type DeploymentEvents = paths['/api/deployments/{deployment}/events']['get']['responses']['200']['content']['application/json'];
|
|
5
|
+
/**
|
|
6
|
+
* @returns Promise<DeploymentEvents>
|
|
7
|
+
* @throws Error if there is an error fetching the events
|
|
8
|
+
* @throws Error if the deployment is not found
|
|
9
|
+
* @description Fetches the events for the deployment.
|
|
10
|
+
* This will return all events associated with the deployment.
|
|
11
|
+
* It is useful for monitoring deployment activity and debugging.
|
|
12
|
+
*/
|
|
13
|
+
export declare function deploymentGetEvents(client: QueryClient, state: DeploymentState): Promise<DeploymentEvents>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
/**
|
|
3
|
+
* @returns Promise<DeploymentEvents>
|
|
4
|
+
* @throws Error if there is an error fetching the events
|
|
5
|
+
* @throws Error if the deployment is not found
|
|
6
|
+
* @description Fetches the events for the deployment.
|
|
7
|
+
* This will return all events associated with the deployment.
|
|
8
|
+
* It is useful for monitoring deployment activity and debugging.
|
|
9
|
+
*/
|
|
10
|
+
export async function deploymentGetEvents(client, state) {
|
|
11
|
+
const { data, error } = await client.GET('/api/deployments/{deployment}/events', {
|
|
12
|
+
params: { path: { deployment: state.id } },
|
|
13
|
+
});
|
|
14
|
+
if (error || !data) {
|
|
15
|
+
throw errorFormatter('Error getting deployment events', error);
|
|
16
|
+
}
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=deploymentGetEvents.js.map
|
|
@@ -0,0 +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;AAQrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAmB,EACnB,KAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,sCAAsC,EACtC;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;KAC3C,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -3,7 +3,7 @@ export async function deploymentGetJob(client, deployment, job) {
|
|
|
3
3
|
const { data, error } = await client.GET('/api/deployments/{deployment}/jobs/{job}', {
|
|
4
4
|
params: { path: { deployment, job } },
|
|
5
5
|
});
|
|
6
|
-
if (error) {
|
|
6
|
+
if (error || !data) {
|
|
7
7
|
throw errorFormatter('Error getting deployment job', error);
|
|
8
8
|
}
|
|
9
9
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentGetJob.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetJob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAOrE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAmB,EACnB,UAAkB,EAClB,GAAW;IAEX,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,0CAA0C,EAC1C;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE;KACtC,CACF,
|
|
1
|
+
{"version":3,"file":"deploymentGetJob.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGetJob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAOrE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAmB,EACnB,UAAkB,EAClB,GAAW;IAEX,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,0CAA0C,EAC1C;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE;KACtC,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { paths } from '@nosana/types';
|
|
3
|
+
import type { DeploymentState } from '../../types.js';
|
|
4
|
+
export type DeploymentJobs = paths['/api/deployments/{deployment}/jobs']['get']['responses']['200']['content']['application/json'];
|
|
5
|
+
/**
|
|
6
|
+
* @returns Promise<DeploymentJobs>
|
|
7
|
+
* @throws Error if there is an error fetching the jobs
|
|
8
|
+
* @throws Error if the deployment is not found
|
|
9
|
+
* @description Fetches the jobs for the deployment.
|
|
10
|
+
* This will return the current jobs associated with the deployment.
|
|
11
|
+
* It is useful for monitoring the deployment's job status.
|
|
12
|
+
*/
|
|
13
|
+
export declare function deploymentGetJobs(client: QueryClient, state: DeploymentState): Promise<DeploymentJobs>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
/**
|
|
3
|
+
* @returns Promise<DeploymentJobs>
|
|
4
|
+
* @throws Error if there is an error fetching the jobs
|
|
5
|
+
* @throws Error if the deployment is not found
|
|
6
|
+
* @description Fetches the jobs for the deployment.
|
|
7
|
+
* This will return the current jobs associated with the deployment.
|
|
8
|
+
* It is useful for monitoring the deployment's job status.
|
|
9
|
+
*/
|
|
10
|
+
export async function deploymentGetJobs(client, state) {
|
|
11
|
+
const { data, error } = await client.GET('/api/deployments/{deployment}/jobs', {
|
|
12
|
+
params: { path: { deployment: state.id } },
|
|
13
|
+
});
|
|
14
|
+
if (error || !data) {
|
|
15
|
+
throw errorFormatter('Error getting deployment jobs', error);
|
|
16
|
+
}
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=deploymentGetJobs.js.map
|
|
@@ -0,0 +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;AAQrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAmB,EACnB,KAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,oCAAoC,EACpC;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;KAC3C,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,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { paths } from '@nosana/types';
|
|
3
|
+
import type { DeploymentState } from '../../types.js';
|
|
4
|
+
export type DeploymentRevisions = paths['/api/deployments/{deployment}/revisions']['get']['responses']['200']['content']['application/json'];
|
|
5
|
+
/**
|
|
6
|
+
* @returns Promise<DeploymentRevisions>
|
|
7
|
+
* @throws Error if there is an error fetching the revisions
|
|
8
|
+
* @throws Error if the deployment is not found
|
|
9
|
+
* @description Fetches the revisions for the deployment.
|
|
10
|
+
* This will return all revisions associated with the deployment.
|
|
11
|
+
* It is useful for viewing the deployment history.
|
|
12
|
+
*/
|
|
13
|
+
export declare function deploymentGetRevisions(client: QueryClient, state: DeploymentState): Promise<DeploymentRevisions>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
/**
|
|
3
|
+
* @returns Promise<DeploymentRevisions>
|
|
4
|
+
* @throws Error if there is an error fetching the revisions
|
|
5
|
+
* @throws Error if the deployment is not found
|
|
6
|
+
* @description Fetches the revisions for the deployment.
|
|
7
|
+
* This will return all revisions associated with the deployment.
|
|
8
|
+
* It is useful for viewing the deployment history.
|
|
9
|
+
*/
|
|
10
|
+
export async function deploymentGetRevisions(client, state) {
|
|
11
|
+
const { data, error } = await client.GET('/api/deployments/{deployment}/revisions', {
|
|
12
|
+
params: { path: { deployment: state.id } },
|
|
13
|
+
});
|
|
14
|
+
if (error || !data) {
|
|
15
|
+
throw errorFormatter('Error getting deployment revisions', error);
|
|
16
|
+
}
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=deploymentGetRevisions.js.map
|
|
@@ -0,0 +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;AAQrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAAmB,EACnB,KAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,yCAAyC,EACzC;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;KAC3C,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
3
2
|
import { DeploymentStatus } from '@nosana/types';
|
|
4
3
|
/**
|
|
@@ -8,7 +7,9 @@ import { DeploymentStatus } from '@nosana/types';
|
|
|
8
7
|
* @description Starts the deployment.
|
|
9
8
|
*/
|
|
10
9
|
export async function deploymentStart(client, state) {
|
|
11
|
-
|
|
10
|
+
if ([DeploymentStatus.STARTING, DeploymentStatus.RUNNING].includes(state.status)) {
|
|
11
|
+
throw new Error('Cannot start a deployment that is already running');
|
|
12
|
+
}
|
|
12
13
|
const { data, error } = await client.POST('/api/deployments/{deployment}/start', {
|
|
13
14
|
params: { path: { deployment: state.id } },
|
|
14
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentStart.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentStart.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deploymentStart.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentStart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAmB,EACnB,KAAsB;IAEtB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CACvC,qCAAqC,EACrC;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;KAC3C,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
3
2
|
import { DeploymentStatus } from '@nosana/types';
|
|
4
3
|
/**
|
|
@@ -10,7 +9,9 @@ import { DeploymentStatus } from '@nosana/types';
|
|
|
10
9
|
* It is useful for pausing deployments without archiving them.
|
|
11
10
|
*/
|
|
12
11
|
export async function deploymentStop(client, state) {
|
|
13
|
-
|
|
12
|
+
if ([DeploymentStatus.STOPPING, DeploymentStatus.STOPPED].includes(state.status)) {
|
|
13
|
+
throw new Error('Deployment is already stopped');
|
|
14
|
+
}
|
|
14
15
|
const { data, error } = await client.POST('/api/deployments/{deployment}/stop', {
|
|
15
16
|
params: { path: { deployment: state.id } },
|
|
16
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentStop.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentStop.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deploymentStop.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentStop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAmB,EACnB,KAAsB;IAEtB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CACvC,oCAAoC,EACpC;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;KAC3C,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,MAAM,EAAE,gBAAgB,CAAC,QAAQ;QACjC,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -10,7 +10,7 @@ export async function deploymentUpdateActiveRevision(active_revision, client, st
|
|
|
10
10
|
Object.assign(state, {
|
|
11
11
|
active_revision: data.active_revision,
|
|
12
12
|
endpoints: data.endpoints,
|
|
13
|
-
updated_at: data.updated_at,
|
|
13
|
+
updated_at: new Date(data.updated_at),
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=deploymentUpdateActiveRevision.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentUpdateActiveRevision.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateActiveRevision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,eAAuB,EAAE,MAAmB,EAAE,KAAsB;IACvH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,sDAAsD,EAAE;QACjG,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,EAAE,eAAe,EAAE;KAC1B,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"deploymentUpdateActiveRevision.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateActiveRevision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,eAAuB,EAAE,MAAmB,EAAE,KAAsB;IACvH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,sDAAsD,EAAE;QACjG,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,EAAE,eAAe,EAAE;KAC1B,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
3
2
|
/**
|
|
4
3
|
* @param replicas Number of replicas to set for the deployment
|
|
@@ -9,7 +8,9 @@ import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
|
9
8
|
* This will change the number of instances running for the deployment.
|
|
10
9
|
*/
|
|
11
10
|
export async function deploymentUpdateReplicaCount(replicas, client, state) {
|
|
12
|
-
|
|
11
|
+
if (replicas < 1) {
|
|
12
|
+
throw new Error('Replica count must be at least 1');
|
|
13
|
+
}
|
|
13
14
|
const { data, error } = await client.PATCH('/api/deployments/{deployment}/update-replica-count', {
|
|
14
15
|
params: { path: { deployment: state.id } },
|
|
15
16
|
body: { replicas },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentUpdateReplicaCount.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateReplicaCount.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deploymentUpdateReplicaCount.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateReplicaCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,QAAgB,EAChB,MAAmB,EACnB,KAAsB;IAEtB,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CACxC,oDAAoD,EACpD;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,EAAE,QAAQ,EAAE;KACnB,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -8,7 +8,8 @@ export async function deploymentUpdateSchedule(schedule, client, state) {
|
|
|
8
8
|
throw errorFormatter("Error updating schedule", error);
|
|
9
9
|
}
|
|
10
10
|
Object.assign(state, {
|
|
11
|
-
schedule: data.schedule
|
|
11
|
+
schedule: data.schedule,
|
|
12
|
+
updated_at: new Date(data.updated_at),
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=deploymentUpdateSchedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentUpdateSchedule.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateSchedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,QAAgB,EAAE,MAAmB,EAAE,KAAsB;IAC1G,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,+CAA+C,EAAE;QAC1F,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,EAAE,QAAQ,EAAE;KACnB,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"deploymentUpdateSchedule.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateSchedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,QAAgB,EAAE,MAAmB,EAAE,KAAsB;IAC1G,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,+CAA+C,EAAE;QAC1F,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,EAAE,QAAQ,EAAE;KACnB,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
1
|
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
3
2
|
/**
|
|
4
3
|
* @param timeout Timeout in seconds
|
|
@@ -9,7 +8,9 @@ import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
|
9
8
|
* This will change the maximum time the deployment can run before it is stopped.
|
|
10
9
|
*/
|
|
11
10
|
export async function deploymentUpdateTimeout(timeout, client, state) {
|
|
12
|
-
|
|
11
|
+
if (timeout < 60) {
|
|
12
|
+
throw new Error('Timeout must be at least 60 seconds');
|
|
13
|
+
}
|
|
13
14
|
const { data, error } = await client.PATCH('/api/deployments/{deployment}/update-timeout', {
|
|
14
15
|
params: { path: { deployment: state.id } },
|
|
15
16
|
body: { timeout },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploymentUpdateTimeout.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deploymentUpdateTimeout.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentUpdateTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAAe,EACf,MAAmB,EACnB,KAAsB;IAEtB,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CACxC,8CAA8C,EAC9C;QACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,EAAE,EAAE,OAAO,EAAE;KAClB,CACF,CAAC;IAEF,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from './deploymentArchive.js';
|
|
2
2
|
export * from './deploymentCreateNewRevision.js';
|
|
3
|
+
export * from './deploymentDelete.js';
|
|
4
|
+
export * from './deploymentGetEvents.js';
|
|
3
5
|
export * from './deploymentGetJob.js';
|
|
6
|
+
export * from './deploymentGetJobs.js';
|
|
7
|
+
export * from './deploymentGetRevisions.js';
|
|
4
8
|
export * from './deploymentGetTasks.js';
|
|
5
9
|
export * from './deploymentStart.js';
|
|
6
10
|
export * from './deploymentStop.js';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from './deploymentArchive.js';
|
|
2
2
|
export * from './deploymentCreateNewRevision.js';
|
|
3
|
+
export * from './deploymentDelete.js';
|
|
4
|
+
export * from './deploymentGetEvents.js';
|
|
3
5
|
export * from './deploymentGetJob.js';
|
|
6
|
+
export * from './deploymentGetJobs.js';
|
|
7
|
+
export * from './deploymentGetRevisions.js';
|
|
4
8
|
export * from './deploymentGetTasks.js';
|
|
5
9
|
export * from './deploymentStart.js';
|
|
6
10
|
export * from './deploymentStop.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|
|
@@ -28,7 +28,7 @@ export async function vaultWithdraw(vaultAddress, { client, solana: { deserializ
|
|
|
28
28
|
await deserializeSignSendAndConfirmTransaction(transaction);
|
|
29
29
|
}
|
|
30
30
|
catch (error) {
|
|
31
|
-
errorFormatter('Vault withdrawal transaction failed.', error);
|
|
31
|
+
throw errorFormatter('Vault withdrawal transaction failed.', error);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
//# sourceMappingURL=vaultWithdraw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultWithdraw.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/vaultWithdraw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,YAAoB,EACpB,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,wCAAwC,EAAE,EAA0B;IAExF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE;QACpF,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,KAAK,EAAE,YAAY;aACpB;SACF;QACD,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAC7B,MAAM,wCAAwC,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,cAAc,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"vaultWithdraw.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/vaultWithdraw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,YAAoB,EACpB,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,wCAAwC,EAAE,EAA0B;IAExF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE;QACpF,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,KAAK,EAAE,YAAY;aACpB;SACF;QACD,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAC7B,MAAM,wCAAwC,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,cAAc,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { Deployment as DeploymentSchema } from '@nosana/types';
|
|
2
1
|
import type { Deployment, ApiDeployment } from '../types.js';
|
|
3
2
|
import type { RouteOptions, RouteOptionsWithSigner } from '../../../types.js';
|
|
3
|
+
import type { components } from '@nosana/types';
|
|
4
|
+
type DeploymentSchema = components['schemas']['Deployment'];
|
|
4
5
|
export declare function createDeployment(deployment: DeploymentSchema, options: RouteOptions, hasApiKey: true): ApiDeployment;
|
|
5
6
|
export declare function createDeployment(deployment: DeploymentSchema, options: RouteOptionsWithSigner, hasApiKey: false): Deployment;
|
|
7
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { deploymentStop, deploymentStart, deploymentGetJob, deploymentArchive, deploymentUpdateReplicaCount, deploymentGetTasks, deploymentUpdateTimeout, deploymentCreateNewRevision, deploymentUpdateActiveRevision, deploymentUpdateSchedule, deploymentGenerateAuthHeader } from './actions/index.js';
|
|
1
|
+
import { deploymentStop, deploymentStart, deploymentGetEvents, deploymentGetJob, deploymentGetJobs, deploymentGetRevisions, deploymentArchive, deploymentUpdateReplicaCount, deploymentGetTasks, deploymentUpdateTimeout, deploymentCreateNewRevision, deploymentUpdateActiveRevision, deploymentUpdateSchedule, deploymentGenerateAuthHeader, deploymentDelete } from './actions/index.js';
|
|
2
2
|
import { createVault } from './createVault.js';
|
|
3
3
|
export function createDeployment(deployment, options, hasApiKey) {
|
|
4
|
-
|
|
4
|
+
let state = {
|
|
5
5
|
...deployment,
|
|
6
6
|
updated_at: new Date(deployment.updated_at),
|
|
7
7
|
created_at: new Date(deployment.created_at),
|
|
@@ -92,7 +92,11 @@ export function createDeployment(deployment, options, hasApiKey) {
|
|
|
92
92
|
await deploymentUpdateActiveRevision(active_revision, options.client, state);
|
|
93
93
|
};
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
95
|
+
* @param schedule Schedule string for the deployment
|
|
96
|
+
* @throws Error if there is an error updating the schedule
|
|
97
|
+
* @returns Promise<void>
|
|
98
|
+
* @description Updates the schedule for the deployment.
|
|
99
|
+
* This will change when the deployment runs based on the provided schedule.
|
|
96
100
|
*/
|
|
97
101
|
const updateSchedule = async (schedule) => {
|
|
98
102
|
await deploymentUpdateSchedule(schedule, options.client, state);
|
|
@@ -109,6 +113,55 @@ export function createDeployment(deployment, options, hasApiKey) {
|
|
|
109
113
|
const getJob = async (job) => {
|
|
110
114
|
return await deploymentGetJob(options.client, state.id, job);
|
|
111
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* @returns Promise<DeploymentJobs>
|
|
118
|
+
* @throws Error if there is an error fetching the jobs
|
|
119
|
+
* @throws Error if the deployment is not found
|
|
120
|
+
* @description Fetches all jobs for the deployment.
|
|
121
|
+
* This will return the current jobs associated with the deployment.
|
|
122
|
+
* It is useful for monitoring the deployment's job status.
|
|
123
|
+
*/
|
|
124
|
+
const getJobs = async () => {
|
|
125
|
+
return await deploymentGetJobs(options.client, state);
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* @returns Promise<DeploymentRevisions>
|
|
129
|
+
* @throws Error if there is an error fetching the revisions
|
|
130
|
+
* @throws Error if the deployment is not found
|
|
131
|
+
* @description Fetches all revisions for the deployment.
|
|
132
|
+
* This will return all revisions associated with the deployment.
|
|
133
|
+
* It is useful for viewing the deployment history.
|
|
134
|
+
*/
|
|
135
|
+
const getRevisions = async () => {
|
|
136
|
+
return await deploymentGetRevisions(options.client, state);
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* @returns Promise<DeploymentEvents>
|
|
140
|
+
* @throws Error if there is an error fetching the events
|
|
141
|
+
* @throws Error if the deployment is not found
|
|
142
|
+
* @description Fetches all events for the deployment.
|
|
143
|
+
* This will return all events associated with the deployment.
|
|
144
|
+
* It is useful for monitoring deployment activity and debugging.
|
|
145
|
+
*/
|
|
146
|
+
const getEvents = async () => {
|
|
147
|
+
return await deploymentGetEvents(options.client, state);
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* @throws Error if the deployment is not stopped
|
|
151
|
+
* @throws Error if there is an error deleting the deployment
|
|
152
|
+
* @returns Promise<void>
|
|
153
|
+
* @description Deletes the deployment permanently.
|
|
154
|
+
* This will remove the deployment and all associated data (jobs, results, revisions, events).
|
|
155
|
+
* The deployment must be in STOPPED state before it can be deleted.
|
|
156
|
+
* The vault associated with the deployment is NOT deleted.
|
|
157
|
+
* After successful deletion, the deployment object becomes unusable.
|
|
158
|
+
*/
|
|
159
|
+
const deleteDeployment = async () => {
|
|
160
|
+
return await deploymentDelete(options.client, state, () => {
|
|
161
|
+
// @ts-expect-error Clear the state to prevent further interaction
|
|
162
|
+
state = undefined;
|
|
163
|
+
});
|
|
164
|
+
};
|
|
112
165
|
return Object.assign(state, {
|
|
113
166
|
...(!hasApiKey && "solana" in options ? {
|
|
114
167
|
vault: createVault(state.vault, options, state.created_at)
|
|
@@ -116,8 +169,12 @@ export function createDeployment(deployment, options, hasApiKey) {
|
|
|
116
169
|
start,
|
|
117
170
|
stop,
|
|
118
171
|
archive,
|
|
172
|
+
delete: deleteDeployment,
|
|
119
173
|
getTasks,
|
|
120
174
|
getJob,
|
|
175
|
+
getJobs,
|
|
176
|
+
getRevisions,
|
|
177
|
+
getEvents,
|
|
121
178
|
generateAuthHeader,
|
|
122
179
|
createRevision,
|
|
123
180
|
updateReplicaCount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDeployment.js","sourceRoot":"","sources":["../../../../src/routes/deployments/deployment/createDeployment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDeployment.js","sourceRoot":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OAAO,MAAM,iBAAiB,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,YAAY,GAAG,KAAK,IAAkC,EAAE;QAC5D,OAAO,MAAM,sBAAsB,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,SAAS,GAAG,KAAK,IAA+B,EAAE;QACtD,OAAO,MAAM,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1D,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"}
|
|
@@ -42,9 +42,6 @@ export function createDeploymentsApi(options, hasApiKey) {
|
|
|
42
42
|
else {
|
|
43
43
|
deployment = await create(deploymentIDorCreateObject);
|
|
44
44
|
}
|
|
45
|
-
if (!deployment) {
|
|
46
|
-
throw new Error('Deployment not found or created');
|
|
47
|
-
}
|
|
48
45
|
for (const action of actions) {
|
|
49
46
|
await action(deployment);
|
|
50
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/deployments/index.ts"],"names":[],"mappings":"
|
|
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,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;YAC3E,IAAI,EAAE,cAAsC;SAC7C,CAAC,CAAC;QAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,cAAc,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,MAAM,GAAG,GAAG,KAAK,EAAE,UAAkB,EAAE,EAAE;QACvC,MAAM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AAE;gBACN,MAAM,EAAE,WAAW;gBACnB,IAAI,EAAE,UAAU;aACjB;SACF,CAAC,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { JobDefinition, Task,
|
|
1
|
+
import type { JobDefinition, Task, components, paths } from '@nosana/types';
|
|
2
2
|
export type { JobDefinition, Task } from '@nosana/types';
|
|
3
|
-
export type DeploymentState = Omit<
|
|
3
|
+
export type DeploymentState = Omit<components['schemas']['Deployment'], "updated_at" | "created_at"> & {
|
|
4
4
|
updated_at: Date;
|
|
5
5
|
created_at: Date;
|
|
6
6
|
};
|
|
@@ -8,6 +8,9 @@ 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 DeploymentJobs = paths['/api/deployments/{deployment}/jobs']['get']['responses']['200']['content']['application/json'];
|
|
12
|
+
export type DeploymentRevisions = paths['/api/deployments/{deployment}/revisions']['get']['responses']['200']['content']['application/json'];
|
|
13
|
+
export type DeploymentEvents = paths['/api/deployments/{deployment}/events']['get']['responses']['200']['content']['application/json'];
|
|
11
14
|
export interface TopupVaultOptions {
|
|
12
15
|
SOL?: number;
|
|
13
16
|
NOS?: number;
|
|
@@ -32,8 +35,12 @@ export type ApiDeployment = DeploymentState & {
|
|
|
32
35
|
start: () => Promise<void>;
|
|
33
36
|
stop: () => Promise<void>;
|
|
34
37
|
archive: () => Promise<void>;
|
|
38
|
+
delete: () => Promise<void>;
|
|
35
39
|
getTasks: () => Promise<Task[]>;
|
|
36
40
|
getJob: (job: string) => Promise<DeploymentJob>;
|
|
41
|
+
getJobs: () => Promise<DeploymentJobs>;
|
|
42
|
+
getRevisions: () => Promise<DeploymentRevisions>;
|
|
43
|
+
getEvents: () => Promise<DeploymentEvents>;
|
|
37
44
|
generateAuthHeader: () => Promise<string>;
|
|
38
45
|
createRevision: (jobDefinition: JobDefinition) => Promise<void>;
|
|
39
46
|
updateActiveRevision: (revision: number) => Promise<void>;
|