@nosana/api 0.1.6 → 0.1.9
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/index.d.ts +1 -1
- package/dist/client/index.js +10 -8
- package/dist/client/index.js.map +1 -1
- package/dist/client/schema.d.ts +188 -776
- package/dist/defaults/index.d.ts +2 -2
- package/dist/defaults/index.js +9 -3
- package/dist/defaults/index.js.map +1 -1
- package/dist/index.d.ts +16 -9
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/{credits → routes/credits}/index.d.ts +1 -1
- package/dist/{credits → routes/credits}/index.js +2 -2
- package/dist/routes/credits/index.js.map +1 -0
- package/dist/{credits → routes/credits}/types.d.ts +1 -1
- package/dist/{jobs → routes/credits}/types.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentArchive.d.ts +11 -0
- package/dist/routes/deployments/deployment/actions/deploymentArchive.js +28 -0
- package/dist/routes/deployments/deployment/actions/deploymentArchive.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentCreateNewRevision.d.ts +3 -0
- package/dist/routes/deployments/deployment/actions/deploymentCreateNewRevision.js +17 -0
- package/dist/routes/deployments/deployment/actions/deploymentCreateNewRevision.js.map +1 -0
- 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/deploymentGenerateAuthHeader.d.ts +3 -0
- package/dist/routes/deployments/deployment/actions/deploymentGenerateAuthHeader.js +11 -0
- package/dist/routes/deployments/deployment/actions/deploymentGenerateAuthHeader.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetJob.d.ts +5 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetJob.js +11 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetJob.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetTasks.d.ts +12 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetTasks.js +19 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetTasks.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentStart.d.ts +9 -0
- package/dist/routes/deployments/deployment/actions/deploymentStart.js +24 -0
- package/dist/routes/deployments/deployment/actions/deploymentStart.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentStop.d.ts +11 -0
- package/dist/routes/deployments/deployment/actions/deploymentStop.js +26 -0
- package/dist/routes/deployments/deployment/actions/deploymentStop.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateActiveRevision.d.ts +3 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateActiveRevision.js +16 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateActiveRevision.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateReplicaCount.d.ts +11 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateReplicaCount.js +26 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateReplicaCount.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateSchedule.d.ts +3 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateSchedule.js +15 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateSchedule.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateTimeout.d.ts +11 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateTimeout.js +26 -0
- package/dist/routes/deployments/deployment/actions/deploymentUpdateTimeout.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/index.d.ts +15 -0
- package/dist/routes/deployments/deployment/actions/index.js +16 -0
- package/dist/routes/deployments/deployment/actions/index.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/vaultGetBalance.d.ts +14 -0
- package/dist/routes/deployments/deployment/actions/vaultGetBalance.js +19 -0
- package/dist/routes/deployments/deployment/actions/vaultGetBalance.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/vaultTopup.d.ts +13 -0
- package/dist/routes/deployments/deployment/actions/vaultTopup.js +20 -0
- package/dist/routes/deployments/deployment/actions/vaultTopup.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/vaultWithdraw.d.ts +14 -0
- package/dist/routes/deployments/deployment/actions/vaultWithdraw.js +34 -0
- package/dist/routes/deployments/deployment/actions/vaultWithdraw.js.map +1 -0
- package/dist/routes/deployments/deployment/createDeployment.d.ts +5 -0
- package/dist/routes/deployments/deployment/createDeployment.js +150 -0
- package/dist/routes/deployments/deployment/createDeployment.js.map +1 -0
- package/dist/routes/deployments/deployment/createVault.d.ts +14 -0
- package/dist/routes/deployments/deployment/createVault.js +40 -0
- package/dist/routes/deployments/deployment/createVault.js.map +1 -0
- package/dist/routes/deployments/deployment/index.d.ts +2 -0
- package/dist/routes/deployments/deployment/index.js +3 -0
- package/dist/routes/deployments/deployment/index.js.map +1 -0
- package/dist/routes/deployments/index.d.ts +5 -0
- package/dist/routes/deployments/index.js +83 -0
- package/dist/routes/deployments/index.js.map +1 -0
- package/dist/routes/deployments/types.d.ts +63 -0
- package/dist/routes/deployments/types.js.map +1 -0
- package/dist/routes/index.d.ts +4 -0
- package/dist/routes/index.js +5 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/{jobs → routes/jobs}/index.d.ts +1 -1
- package/dist/{jobs → routes/jobs}/index.js +5 -5
- package/dist/routes/jobs/index.js.map +1 -0
- package/dist/{jobs → routes/jobs}/types.d.ts +1 -1
- package/dist/{credits → routes/jobs}/types.js.map +1 -1
- package/dist/{markets → routes/markets}/index.d.ts +1 -1
- package/dist/{markets → routes/markets}/index.js +4 -4
- package/dist/routes/markets/index.js.map +1 -0
- package/dist/{markets → routes/markets}/types.d.ts +1 -1
- package/dist/routes/markets/types.js +2 -0
- package/dist/{markets → routes/markets}/types.js.map +1 -1
- package/dist/types.d.ts +34 -17
- package/dist/types.js +2 -5
- package/dist/types.js.map +1 -1
- package/package.json +2 -1
- package/dist/credits/index.js.map +0 -1
- package/dist/jobs/index.js.map +0 -1
- package/dist/markets/index.js.map +0 -1
- /package/dist/{credits → routes/credits}/types.js +0 -0
- /package/dist/{jobs → routes/deployments}/types.js +0 -0
- /package/dist/{markets → routes/jobs}/types.js +0 -0
package/dist/defaults/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const defaultConfig: Record<NosanaNetwork,
|
|
1
|
+
import { NosanaNetwork, type Config } from "../types.js";
|
|
2
|
+
export declare const defaultConfig: Record<typeof NosanaNetwork[keyof typeof NosanaNetwork], Config>;
|
package/dist/defaults/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { NosanaNetwork } from "../types.js";
|
|
1
2
|
export const defaultConfig = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
[NosanaNetwork.MAINNET]: {
|
|
4
|
+
backend_url: 'https://dashboard.k8s.prd.nos.ci',
|
|
5
|
+
nos_address: 'nosXBVoaCTtYdLvKY6Csb4AC8JCdQKKAaWYtx2ZMoo7'
|
|
6
|
+
},
|
|
7
|
+
[NosanaNetwork.DEVNET]: {
|
|
8
|
+
backend_url: 'https://dashboard.k8s.dev.nos.ci',
|
|
9
|
+
nos_address: 'devr1BGQndEW5k5zfvG5FsLyZv1Ap73vNgAHcQ9sUVP'
|
|
10
|
+
}
|
|
5
11
|
};
|
|
6
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/defaults/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/defaults/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,aAAa,GAAqE;IAC7F,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,WAAW,EAAE,kCAAkC;QAC/C,WAAW,EAAE,6CAA6C;KAC3D;IACD,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QACtB,WAAW,EAAE,kCAAkC;QAC/C,WAAW,EAAE,6CAA6C;KAC3D;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import { type NosanaJobsApi } from './
|
|
2
|
-
import {
|
|
3
|
-
import { type NosanaMarketsApi } from './markets/index.js';
|
|
4
|
-
import type { ApiKeyAuth, SignerAuth, NosanaNetwork, CreateNosanaApiOptions } from './types.js';
|
|
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 } from './types.js';
|
|
5
3
|
export interface NosanaApi {
|
|
6
4
|
jobs: NosanaJobsApi;
|
|
7
5
|
credits: NosanaCreditsApi;
|
|
8
6
|
markets: NosanaMarketsApi;
|
|
7
|
+
deployments: DeploymentsApi;
|
|
9
8
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
9
|
+
export interface NosanaApiWithApiKey {
|
|
10
|
+
jobs: NosanaJobsApi;
|
|
11
|
+
credits: NosanaCreditsApi;
|
|
12
|
+
markets: NosanaMarketsApi;
|
|
13
|
+
deployments: ApiDeploymentsApi;
|
|
14
|
+
}
|
|
15
|
+
export declare function createNosanaApi(environment: NosanaNetworkType, noAuth: undefined, options?: CreateNosanaApiOptions): NosanaApi;
|
|
16
|
+
export declare function createNosanaApi(environment: NosanaNetworkType, signerAuth: SignerAuth, options?: CreateNosanaApiOptions): NosanaApi;
|
|
17
|
+
export declare function createNosanaApi(environment: NosanaNetworkType, apiKeyAuth: ApiKeyAuth, options?: CreateNosanaApiOptions): NosanaApiWithApiKey;
|
|
12
18
|
export * from './types.js';
|
|
13
19
|
export type { ApiConfig } from './client/index.js';
|
|
14
|
-
export type * from './jobs/types.js';
|
|
15
|
-
export type * from './credits/types.js';
|
|
16
|
-
export type * from './markets/types.js';
|
|
20
|
+
export type * from './routes/jobs/types.js';
|
|
21
|
+
export type * from './routes/credits/types.js';
|
|
22
|
+
export type * from './routes/markets/types.js';
|
|
23
|
+
export type * from './routes/deployments/types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
1
|
import { createNosanaClient } from './client/index.js';
|
|
3
|
-
import { createNosanaJobsApi } from './
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export function createNosanaApi(environment = 'mainnet', signerOrApiKey, options) {
|
|
7
|
-
assert(typeof signerOrApiKey === 'string' ||
|
|
8
|
-
('identifier' in signerOrApiKey && 'generate' in signerOrApiKey), 'Authentication parameters are required to create Nosana API client');
|
|
2
|
+
import { createNosanaJobsApi, createNosanaCreditsApi, createNosanaMarketsApi, createDeploymentsApi } from './routes/index.js';
|
|
3
|
+
import { NosanaNetwork } from './types.js';
|
|
4
|
+
export function createNosanaApi(environment = NosanaNetwork.MAINNET, signerOrApiKey, options) {
|
|
9
5
|
const client = createNosanaClient(environment, signerOrApiKey, options);
|
|
6
|
+
const hasApiKey = typeof signerOrApiKey === 'string';
|
|
10
7
|
return {
|
|
11
8
|
jobs: createNosanaJobsApi(client),
|
|
12
9
|
credits: createNosanaCreditsApi(client),
|
|
13
10
|
markets: createNosanaMarketsApi(client),
|
|
11
|
+
deployments: !hasApiKey && signerOrApiKey
|
|
12
|
+
? createDeploymentsApi({ client, solana: signerOrApiKey.solana }, false)
|
|
13
|
+
: createDeploymentsApi({ client }, true)
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
// Export types
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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;AAsB3C,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,4 +1,4 @@
|
|
|
1
|
-
import type { QueryClient } from '
|
|
1
|
+
import type { QueryClient } from '../../client/index.js';
|
|
2
2
|
import type { NosanaCreditsApi } from './types.js';
|
|
3
3
|
export * from "./types.js";
|
|
4
4
|
export declare function createNosanaCreditsApi(client: QueryClient): NosanaCreditsApi;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { errorFormatter } from '
|
|
1
|
+
import { errorFormatter } from '../../utils/errorFormatter.js';
|
|
2
2
|
export * from "./types.js";
|
|
3
3
|
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;
|
|
@@ -0,0 +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,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,4 @@
|
|
|
1
|
-
import { operations } from "
|
|
1
|
+
import { operations } from "../../client/schema.js";
|
|
2
2
|
export type Balance = operations['getApiCreditsBalance']['responses'][200]['content']['application/json'];
|
|
3
3
|
export interface NosanaCreditsApi {
|
|
4
4
|
balance: () => Promise<Balance>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/routes/credits/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
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 archiving the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Archives the deployment.
|
|
8
|
+
* This will mark the deployment as archived and prevent further modifications.
|
|
9
|
+
* It is useful for cleaning up deployments that are no longer needed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deploymentArchive(client: QueryClient, state: DeploymentState): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 archiving the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Archives the deployment.
|
|
8
|
+
* This will mark the deployment as archived and prevent further modifications.
|
|
9
|
+
* It is useful for cleaning up deployments that are no longer needed.
|
|
10
|
+
*/
|
|
11
|
+
export async function deploymentArchive(client, state) {
|
|
12
|
+
if (state.status !== DeploymentStatus.STOPPED) {
|
|
13
|
+
throw new Error('Deployment must be stopped before archiving');
|
|
14
|
+
}
|
|
15
|
+
const { data, error } = await client.POST('/api/deployments/{deployment}/archive', {
|
|
16
|
+
params: { path: { deployment: state.id } },
|
|
17
|
+
});
|
|
18
|
+
if (error || !data) {
|
|
19
|
+
throw errorFormatter('Error archiving deployment', error);
|
|
20
|
+
}
|
|
21
|
+
Object.assign(state, {
|
|
22
|
+
status: DeploymentStatus.ARCHIVED,
|
|
23
|
+
updated_at: new Date(data.updated_at),
|
|
24
|
+
});
|
|
25
|
+
// Freeze the state to prevent further modifications
|
|
26
|
+
Object.freeze(state);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=deploymentArchive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DeploymentState, type JobDefinition } from "../../types.js";
|
|
2
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
3
|
+
export declare function deploymentCreateNewRevision(jobDefinition: JobDefinition, client: QueryClient, state: DeploymentState): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { errorFormatter } from "../../../../utils/errorFormatter.js";
|
|
2
|
+
export async function deploymentCreateNewRevision(jobDefinition, client, state) {
|
|
3
|
+
const { data, error } = await client.POST(`/api/deployments/{deployment}/create-revision`, {
|
|
4
|
+
params: { path: { deployment: state.id } },
|
|
5
|
+
body: jobDefinition,
|
|
6
|
+
});
|
|
7
|
+
if (error || !data) {
|
|
8
|
+
throw errorFormatter("Error creating new revision", error);
|
|
9
|
+
}
|
|
10
|
+
Object.assign(state, {
|
|
11
|
+
active_revision: data.active_revision,
|
|
12
|
+
endpoints: data.endpoints,
|
|
13
|
+
updated_at: new Date(data.updated_at),
|
|
14
|
+
revisions: [...state.revisions, data.revisions],
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=deploymentCreateNewRevision.js.map
|
|
@@ -0,0 +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;QACrC,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC;KAChD,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,11 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
export async function deploymentGenerateAuthHeader(client, state) {
|
|
3
|
+
const { data, error } = await client.GET('/api/deployments/{deployment}/header', {
|
|
4
|
+
params: { path: { deployment: state.id } },
|
|
5
|
+
});
|
|
6
|
+
if (error || !data) {
|
|
7
|
+
throw errorFormatter('Error generating deployment header', error);
|
|
8
|
+
}
|
|
9
|
+
return data.header;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=deploymentGenerateAuthHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploymentGenerateAuthHeader.js","sourceRoot":"","sources":["../../../../../src/routes/deployments/deployment/actions/deploymentGenerateAuthHeader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,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,oCAAoC,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { QueryClient } from "../../../../client/index.js";
|
|
2
|
+
import type { paths } from '@nosana/types';
|
|
3
|
+
type DeploymentJob = paths["/api/deployments/{deployment}/jobs/{job}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
4
|
+
export declare function deploymentGetJob(client: QueryClient, deployment: string, job: string): Promise<DeploymentJob>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { errorFormatter } from "../../../../utils/errorFormatter.js";
|
|
2
|
+
export async function deploymentGetJob(client, deployment, job) {
|
|
3
|
+
const { data, error } = await client.GET('/api/deployments/{deployment}/jobs/{job}', {
|
|
4
|
+
params: { path: { deployment, job } },
|
|
5
|
+
});
|
|
6
|
+
if (error || !data) {
|
|
7
|
+
throw errorFormatter('Error getting deployment job', error);
|
|
8
|
+
}
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=deploymentGetJob.js.map
|
|
@@ -0,0 +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,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,12 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { Task } from '@nosana/types';
|
|
3
|
+
import type { DeploymentState } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @returns Promise<Task[]>
|
|
6
|
+
* @throws Error if there is an error fetching the tasks
|
|
7
|
+
* @throws Error if the deployment is not found
|
|
8
|
+
* @description Fetches the tasks for the deployment.
|
|
9
|
+
* This will return the current tasks associated with the deployment.
|
|
10
|
+
* It is useful for monitoring the deployment's progress and status.
|
|
11
|
+
*/
|
|
12
|
+
export declare function deploymentGetTasks(client: QueryClient, state: DeploymentState): Promise<Task[]>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
/**
|
|
3
|
+
* @returns Promise<Task[]>
|
|
4
|
+
* @throws Error if there is an error fetching the tasks
|
|
5
|
+
* @throws Error if the deployment is not found
|
|
6
|
+
* @description Fetches the tasks for the deployment.
|
|
7
|
+
* This will return the current tasks associated with the deployment.
|
|
8
|
+
* It is useful for monitoring the deployment's progress and status.
|
|
9
|
+
*/
|
|
10
|
+
export async function deploymentGetTasks(client, state) {
|
|
11
|
+
const { data, error } = await client.GET('/api/deployments/{deployment}/tasks', {
|
|
12
|
+
params: { path: { deployment: state.id } },
|
|
13
|
+
});
|
|
14
|
+
if (error || !data) {
|
|
15
|
+
throw errorFormatter('Error getting deployment tasks', error);
|
|
16
|
+
}
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=deploymentGetTasks.js.map
|
|
@@ -0,0 +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;AAMrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAmB,EACnB,KAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CACtC,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,gCAAgC,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { DeploymentState } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @throws Error if the deployment is already running or starting
|
|
5
|
+
* @throws Error if there is an error starting the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Starts the deployment.
|
|
8
|
+
*/
|
|
9
|
+
export declare function deploymentStart(client: QueryClient, state: DeploymentState): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
import { DeploymentStatus } from '@nosana/types';
|
|
3
|
+
/**
|
|
4
|
+
* @throws Error if the deployment is already running or starting
|
|
5
|
+
* @throws Error if there is an error starting the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Starts the deployment.
|
|
8
|
+
*/
|
|
9
|
+
export async function deploymentStart(client, state) {
|
|
10
|
+
if ([DeploymentStatus.STARTING, DeploymentStatus.RUNNING].includes(state.status)) {
|
|
11
|
+
throw new Error('Cannot start a deployment that is already running');
|
|
12
|
+
}
|
|
13
|
+
const { data, error } = await client.POST('/api/deployments/{deployment}/start', {
|
|
14
|
+
params: { path: { deployment: state.id } },
|
|
15
|
+
});
|
|
16
|
+
if (error || !data) {
|
|
17
|
+
throw errorFormatter('Error starting deployment', error);
|
|
18
|
+
}
|
|
19
|
+
Object.assign(state, {
|
|
20
|
+
status: data.status,
|
|
21
|
+
updated_at: new Date(data.updated_at),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=deploymentStart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { DeploymentState } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @throws Error if the deployment is already stopped
|
|
5
|
+
* @throws Error if there is an error stopping the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Stops the deployment.
|
|
8
|
+
* This will halt the deployment and prevent further actions until it is started again.
|
|
9
|
+
* It is useful for pausing deployments without archiving them.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deploymentStop(client: QueryClient, state: DeploymentState): 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 already stopped
|
|
5
|
+
* @throws Error if there is an error stopping the deployment
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Stops the deployment.
|
|
8
|
+
* This will halt the deployment and prevent further actions until it is started again.
|
|
9
|
+
* It is useful for pausing deployments without archiving them.
|
|
10
|
+
*/
|
|
11
|
+
export async function deploymentStop(client, state) {
|
|
12
|
+
if ([DeploymentStatus.STOPPING, DeploymentStatus.STOPPED].includes(state.status)) {
|
|
13
|
+
throw new Error('Deployment is already stopped');
|
|
14
|
+
}
|
|
15
|
+
const { data, error } = await client.POST('/api/deployments/{deployment}/stop', {
|
|
16
|
+
params: { path: { deployment: state.id } },
|
|
17
|
+
});
|
|
18
|
+
if (error || !data) {
|
|
19
|
+
throw errorFormatter('Error stopping deployment', error);
|
|
20
|
+
}
|
|
21
|
+
Object.assign(state, {
|
|
22
|
+
status: DeploymentStatus.STOPPING,
|
|
23
|
+
updated_at: new Date(data.updated_at),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=deploymentStop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { errorFormatter } from "../../../../utils/errorFormatter.js";
|
|
2
|
+
export async function deploymentUpdateActiveRevision(active_revision, client, state) {
|
|
3
|
+
const { data, error } = await client.PATCH(`/api/deployments/{deployment}/update-active-revision`, {
|
|
4
|
+
params: { path: { deployment: state.id } },
|
|
5
|
+
body: { active_revision },
|
|
6
|
+
});
|
|
7
|
+
if (error || !data) {
|
|
8
|
+
throw errorFormatter("Error updating active revision", error);
|
|
9
|
+
}
|
|
10
|
+
Object.assign(state, {
|
|
11
|
+
active_revision: data.active_revision,
|
|
12
|
+
endpoints: data.endpoints,
|
|
13
|
+
updated_at: new Date(data.updated_at),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=deploymentUpdateActiveRevision.js.map
|
|
@@ -0,0 +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,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import { type DeploymentState } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @param replicas Number of replicas to set for the deployment
|
|
5
|
+
* @throws Error if replicas is less than 1
|
|
6
|
+
* @throws Error if there is an error updating the replica count
|
|
7
|
+
* @returns Promise<void>
|
|
8
|
+
* @description Updates the number of replicas for the deployment.
|
|
9
|
+
* This will change the number of instances running for the deployment.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deploymentUpdateReplicaCount(replicas: number, client: QueryClient, state: DeploymentState): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
/**
|
|
3
|
+
* @param replicas Number of replicas to set for the deployment
|
|
4
|
+
* @throws Error if replicas is less than 1
|
|
5
|
+
* @throws Error if there is an error updating the replica count
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Updates the number of replicas for the deployment.
|
|
8
|
+
* This will change the number of instances running for the deployment.
|
|
9
|
+
*/
|
|
10
|
+
export async function deploymentUpdateReplicaCount(replicas, client, state) {
|
|
11
|
+
if (replicas < 1) {
|
|
12
|
+
throw new Error('Replica count must be at least 1');
|
|
13
|
+
}
|
|
14
|
+
const { data, error } = await client.PATCH('/api/deployments/{deployment}/update-replica-count', {
|
|
15
|
+
params: { path: { deployment: state.id } },
|
|
16
|
+
body: { replicas },
|
|
17
|
+
});
|
|
18
|
+
if (error || !data) {
|
|
19
|
+
throw errorFormatter('Error updating deployment replica count', error);
|
|
20
|
+
}
|
|
21
|
+
Object.assign(state, {
|
|
22
|
+
replicas: data.replicas,
|
|
23
|
+
updated_at: new Date(data.updated_at),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=deploymentUpdateReplicaCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { errorFormatter } from "../../../../utils/errorFormatter.js";
|
|
2
|
+
export async function deploymentUpdateSchedule(schedule, client, state) {
|
|
3
|
+
const { data, error } = await client.PATCH(`/api/deployments/{deployment}/update-schedule`, {
|
|
4
|
+
params: { path: { deployment: state.id } },
|
|
5
|
+
body: { schedule },
|
|
6
|
+
});
|
|
7
|
+
if (error || !data) {
|
|
8
|
+
throw errorFormatter("Error updating schedule", error);
|
|
9
|
+
}
|
|
10
|
+
Object.assign(state, {
|
|
11
|
+
schedule: data.schedule,
|
|
12
|
+
updated_at: new Date(data.updated_at),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=deploymentUpdateSchedule.js.map
|
|
@@ -0,0 +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;QACvB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { QueryClient } from '../../../../client/index.js';
|
|
2
|
+
import type { DeploymentState } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @param timeout Timeout in seconds
|
|
5
|
+
* @throws Error if timeout is less than 60 seconds
|
|
6
|
+
* @throws Error if there is an error updating the timeout
|
|
7
|
+
* @returns Promise<void>
|
|
8
|
+
* @description Updates the timeout for the deployment.
|
|
9
|
+
* This will change the maximum time the deployment can run before it is stopped.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deploymentUpdateTimeout(timeout: number, client: QueryClient, state: DeploymentState): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
/**
|
|
3
|
+
* @param timeout Timeout in seconds
|
|
4
|
+
* @throws Error if timeout is less than 60 seconds
|
|
5
|
+
* @throws Error if there is an error updating the timeout
|
|
6
|
+
* @returns Promise<void>
|
|
7
|
+
* @description Updates the timeout for the deployment.
|
|
8
|
+
* This will change the maximum time the deployment can run before it is stopped.
|
|
9
|
+
*/
|
|
10
|
+
export async function deploymentUpdateTimeout(timeout, client, state) {
|
|
11
|
+
if (timeout < 60) {
|
|
12
|
+
throw new Error('Timeout must be at least 60 seconds');
|
|
13
|
+
}
|
|
14
|
+
const { data, error } = await client.PATCH('/api/deployments/{deployment}/update-timeout', {
|
|
15
|
+
params: { path: { deployment: state.id } },
|
|
16
|
+
body: { timeout },
|
|
17
|
+
});
|
|
18
|
+
if (error || !data) {
|
|
19
|
+
throw errorFormatter('Error updating deployment timeout', error);
|
|
20
|
+
}
|
|
21
|
+
Object.assign(state, {
|
|
22
|
+
timeout: data.timeout,
|
|
23
|
+
updated_at: new Date(data.updated_at),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=deploymentUpdateTimeout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './deploymentArchive.js';
|
|
2
|
+
export * from './deploymentCreateNewRevision.js';
|
|
3
|
+
export * from './deploymentDelete.js';
|
|
4
|
+
export * from './deploymentGetJob.js';
|
|
5
|
+
export * from './deploymentGetTasks.js';
|
|
6
|
+
export * from './deploymentStart.js';
|
|
7
|
+
export * from './deploymentStop.js';
|
|
8
|
+
export * from './deploymentGenerateAuthHeader.js';
|
|
9
|
+
export * from './deploymentUpdateActiveRevision.js';
|
|
10
|
+
export * from './deploymentUpdateReplicaCount.js';
|
|
11
|
+
export * from './deploymentUpdateSchedule.js';
|
|
12
|
+
export * from './deploymentUpdateTimeout.js';
|
|
13
|
+
export * from './vaultGetBalance.js';
|
|
14
|
+
export * from './vaultTopup.js';
|
|
15
|
+
export * from './vaultWithdraw.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './deploymentArchive.js';
|
|
2
|
+
export * from './deploymentCreateNewRevision.js';
|
|
3
|
+
export * from './deploymentDelete.js';
|
|
4
|
+
export * from './deploymentGetJob.js';
|
|
5
|
+
export * from './deploymentGetTasks.js';
|
|
6
|
+
export * from './deploymentStart.js';
|
|
7
|
+
export * from './deploymentStop.js';
|
|
8
|
+
export * from './deploymentGenerateAuthHeader.js';
|
|
9
|
+
export * from './deploymentUpdateActiveRevision.js';
|
|
10
|
+
export * from './deploymentUpdateReplicaCount.js';
|
|
11
|
+
export * from './deploymentUpdateSchedule.js';
|
|
12
|
+
export * from './deploymentUpdateTimeout.js';
|
|
13
|
+
export * from './vaultGetBalance.js';
|
|
14
|
+
export * from './vaultTopup.js';
|
|
15
|
+
export * from './vaultWithdraw.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,uBAAuB,CAAC;AACtC,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"}
|