@nosana/api 2.12.0 → 2.13.1
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 +35 -0
- package/dist/client/createClient.d.ts +5 -3
- package/dist/client/createClient.d.ts.map +1 -1
- package/dist/client/createClient.js +4 -2
- package/dist/client/createClient.js.map +1 -1
- package/dist/client/deployment-manager/schema.d.ts +166 -100
- package/dist/client/deployment-manager/schema.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/node/index.d.ts +23 -0
- package/dist/client/node/index.d.ts.map +1 -0
- package/dist/client/node/index.js +24 -0
- package/dist/client/node/index.js.map +1 -0
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +3 -0
- package/dist/defaults/index.js.map +1 -1
- package/dist/index.d.ts +32 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/dist/routes/auth/index.d.ts.map +1 -1
- package/dist/routes/auth/index.js +12 -0
- package/dist/routes/auth/index.js.map +1 -1
- package/dist/routes/auth/types.d.ts +8 -0
- package/dist/routes/auth/types.d.ts.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentAddSshKeys.d.ts +9 -0
- package/dist/routes/deployments/deployment/actions/deploymentAddSshKeys.d.ts.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentAddSshKeys.js +17 -0
- package/dist/routes/deployments/deployment/actions/deploymentAddSshKeys.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetSshKeys.d.ts +7 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetSshKeys.d.ts.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetSshKeys.js +14 -0
- package/dist/routes/deployments/deployment/actions/deploymentGetSshKeys.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentRemoveSshKeys.d.ts +9 -0
- package/dist/routes/deployments/deployment/actions/deploymentRemoveSshKeys.d.ts.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentRemoveSshKeys.js +17 -0
- package/dist/routes/deployments/deployment/actions/deploymentRemoveSshKeys.js.map +1 -0
- package/dist/routes/deployments/deployment/actions/deploymentStream.d.ts.map +1 -1
- package/dist/routes/deployments/deployment/actions/deploymentStream.js +10 -30
- package/dist/routes/deployments/deployment/actions/deploymentStream.js.map +1 -1
- package/dist/routes/deployments/deployment/actions/index.d.ts +3 -0
- package/dist/routes/deployments/deployment/actions/index.d.ts.map +1 -1
- package/dist/routes/deployments/deployment/actions/index.js +3 -0
- package/dist/routes/deployments/deployment/actions/index.js.map +1 -1
- package/dist/routes/deployments/deployment/createDeployment.d.ts.map +1 -1
- package/dist/routes/deployments/deployment/createDeployment.js +68 -12
- package/dist/routes/deployments/deployment/createDeployment.js.map +1 -1
- package/dist/routes/deployments/types.d.ts +44 -10
- package/dist/routes/deployments/types.d.ts.map +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/jobs/index.d.ts +8 -2
- package/dist/routes/jobs/index.d.ts.map +1 -1
- package/dist/routes/jobs/index.js +28 -14
- package/dist/routes/jobs/index.js.map +1 -1
- package/dist/routes/jobs/types.d.ts +16 -1
- package/dist/routes/jobs/types.d.ts.map +1 -1
- package/dist/routes/node/__tests__/fixtures.d.ts +30 -0
- package/dist/routes/node/__tests__/fixtures.d.ts.map +1 -0
- package/dist/routes/node/__tests__/fixtures.js +38 -0
- package/dist/routes/node/__tests__/fixtures.js.map +1 -0
- package/dist/routes/node/actions/authorization.d.ts +4 -0
- package/dist/routes/node/actions/authorization.d.ts.map +1 -0
- package/dist/routes/node/actions/authorization.js +9 -0
- package/dist/routes/node/actions/authorization.js.map +1 -0
- package/dist/routes/node/actions/nodeInfo.d.ts +4 -0
- package/dist/routes/node/actions/nodeInfo.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeInfo.js +9 -0
- package/dist/routes/node/actions/nodeInfo.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/index.d.ts +14 -0
- package/dist/routes/node/actions/nodeJob/index.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/index.js +14 -0
- package/dist/routes/node/actions/nodeJob/index.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobDefinition.d.ts +4 -0
- package/dist/routes/node/actions/nodeJob/nodeJobDefinition.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobDefinition.js +9 -0
- package/dist/routes/node/actions/nodeJob/nodeJobDefinition.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobEndpoints.d.ts +4 -0
- package/dist/routes/node/actions/nodeJob/nodeJobEndpoints.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobEndpoints.js +9 -0
- package/dist/routes/node/actions/nodeJob/nodeJobEndpoints.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobGroup.d.ts +4 -0
- package/dist/routes/node/actions/nodeJob/nodeJobGroup.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobGroup.js +11 -0
- package/dist/routes/node/actions/nodeJob/nodeJobGroup.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperation.d.ts +3 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperation.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperation.js +9 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperation.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperations.d.ts +4 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperations.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperations.js +9 -0
- package/dist/routes/node/actions/nodeJob/nodeJobOperations.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobResults.d.ts +4 -0
- package/dist/routes/node/actions/nodeJob/nodeJobResults.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobResults.js +9 -0
- package/dist/routes/node/actions/nodeJob/nodeJobResults.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobStats.d.ts +4 -0
- package/dist/routes/node/actions/nodeJob/nodeJobStats.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/nodeJobStats.js +9 -0
- package/dist/routes/node/actions/nodeJob/nodeJobStats.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobGroup.d.ts +3 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobGroup.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobGroup.js +10 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobGroup.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobOperation.d.ts +3 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobOperation.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobOperation.js +10 -0
- package/dist/routes/node/actions/nodeJob/restartNodeJobOperation.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/setNodeJobDefinition.d.ts +4 -0
- package/dist/routes/node/actions/nodeJob/setNodeJobDefinition.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/setNodeJobDefinition.js +12 -0
- package/dist/routes/node/actions/nodeJob/setNodeJobDefinition.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJob.d.ts +3 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJob.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJob.js +11 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJob.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobGroup.d.ts +3 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobGroup.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobGroup.js +10 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobGroup.js.map +1 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobOperation.d.ts +3 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobOperation.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobOperation.js +10 -0
- package/dist/routes/node/actions/nodeJob/stopNodeJobOperation.js.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/index.d.ts +4 -0
- package/dist/routes/node/actions/nodeJobSsh/index.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/index.js +4 -0
- package/dist/routes/node/actions/nodeJobSsh/index.js.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshAdd.d.ts +5 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshAdd.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshAdd.js +25 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshAdd.js.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshKeys.d.ts +4 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshKeys.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshKeys.js +12 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshKeys.js.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshRemove.d.ts +4 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshRemove.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshRemove.js +14 -0
- package/dist/routes/node/actions/nodeJobSsh/nodeJobSshRemove.js.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/index.d.ts +3 -0
- package/dist/routes/node/actions/nodeJobStreams/index.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/index.js +3 -0
- package/dist/routes/node/actions/nodeJobStreams/index.js.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobInfoStream.d.ts +4 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobInfoStream.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobInfoStream.js +5 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobInfoStream.js.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobStatsStream.d.ts +4 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobStatsStream.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobStatsStream.js +6 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeJobStatsStream.js.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeStream.d.ts +5 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeStream.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeStream.js +10 -0
- package/dist/routes/node/actions/nodeJobStreams/nodeStream.js.map +1 -0
- package/dist/routes/node/actions/nodeSocket/index.d.ts +4 -0
- package/dist/routes/node/actions/nodeSocket/index.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeSocket/index.js +4 -0
- package/dist/routes/node/actions/nodeSocket/index.js.map +1 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobLogs.d.ts +3 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobLogs.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobLogs.js +10 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobLogs.js.map +1 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobStatus.d.ts +3 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobStatus.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobStatus.js +5 -0
- package/dist/routes/node/actions/nodeSocket/nodeJobStatus.js.map +1 -0
- package/dist/routes/node/actions/nodeSocket/socket.d.ts +19 -0
- package/dist/routes/node/actions/nodeSocket/socket.d.ts.map +1 -0
- package/dist/routes/node/actions/nodeSocket/socket.js +38 -0
- package/dist/routes/node/actions/nodeSocket/socket.js.map +1 -0
- package/dist/routes/node/actions/terminal/grant.d.ts +21 -0
- package/dist/routes/node/actions/terminal/grant.d.ts.map +1 -0
- package/dist/routes/node/actions/terminal/grant.js +28 -0
- package/dist/routes/node/actions/terminal/grant.js.map +1 -0
- package/dist/routes/node/actions/terminal/openTerminal.d.ts +4 -0
- package/dist/routes/node/actions/terminal/openTerminal.d.ts.map +1 -0
- package/dist/routes/node/actions/terminal/openTerminal.js +22 -0
- package/dist/routes/node/actions/terminal/openTerminal.js.map +1 -0
- package/dist/routes/node/actions/terminal/session.d.ts +7 -0
- package/dist/routes/node/actions/terminal/session.d.ts.map +1 -0
- package/dist/routes/node/actions/terminal/session.js +133 -0
- package/dist/routes/node/actions/terminal/session.js.map +1 -0
- package/dist/routes/node/createNodeJob.d.ts +3 -0
- package/dist/routes/node/createNodeJob.d.ts.map +1 -0
- package/dist/routes/node/createNodeJob.js +39 -0
- package/dist/routes/node/createNodeJob.js.map +1 -0
- package/dist/routes/node/index.d.ts +8 -0
- package/dist/routes/node/index.d.ts.map +1 -0
- package/dist/routes/node/index.js +21 -0
- package/dist/routes/node/index.js.map +1 -0
- package/dist/routes/node/types.d.ts +148 -0
- package/dist/routes/node/types.d.ts.map +1 -0
- package/dist/routes/node/types.js +2 -0
- package/dist/routes/node/types.js.map +1 -0
- package/dist/types.d.ts +31 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/eventStream.d.ts +15 -0
- package/dist/utils/eventStream.d.ts.map +1 -0
- package/dist/utils/eventStream.js +36 -0
- package/dist/utils/eventStream.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +10 -0
- package/dist/utils/json.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
export async function setNodeJobDefinition(client, job, definition) {
|
|
3
|
+
const { data, error, response } = await client.POST('/job/{job}/job-definition', {
|
|
4
|
+
params: { path: { job } },
|
|
5
|
+
body: definition,
|
|
6
|
+
parseAs: 'text',
|
|
7
|
+
});
|
|
8
|
+
if ((error !== undefined && error !== null) || data === undefined) {
|
|
9
|
+
throw errorFormatter('Failed to send job definition', error, response);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=setNodeJobDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setNodeJobDefinition.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJob/setNodeJobDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAkB,EAClB,GAAW,EACX,UAAyB;IAEzB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;QAC/E,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QACzB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,cAAc,CAAC,+BAA+B,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACzE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopNodeJob.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJob/stopNodeJob.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
export async function stopNodeJob(client, job) {
|
|
3
|
+
const { data, error, response } = await client.POST('/job/{job}/stop', {
|
|
4
|
+
params: { path: { job } },
|
|
5
|
+
parseAs: 'text',
|
|
6
|
+
});
|
|
7
|
+
if ((error !== undefined && error !== null) || data === undefined) {
|
|
8
|
+
throw errorFormatter('Failed to stop job', error, response);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=stopNodeJob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopNodeJob.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJob/stopNodeJob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAkB,EAAE,GAAW;IAC/D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;QACrE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QACzB,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,cAAc,CAAC,oBAAoB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopNodeJobGroup.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJob/stopNodeJobGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
export async function stopNodeJobGroup(client, job, group) {
|
|
3
|
+
const { data, error, response } = await client.POST('/job/{job}/group/{group}/stop', {
|
|
4
|
+
params: { path: { job, group } },
|
|
5
|
+
});
|
|
6
|
+
if ((error !== undefined && error !== null) || data === undefined) {
|
|
7
|
+
throw errorFormatter('Failed to stop group', error, response);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=stopNodeJobGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopNodeJobGroup.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJob/stopNodeJobGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAkB,EAAE,GAAW,EAAE,KAAa;IACnF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE;QACnF,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;KACjC,CAAC,CAAC;IACH,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,cAAc,CAAC,sBAAsB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopNodeJobOperation.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJob/stopNodeJobOperation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
export async function stopNodeJobOperation(client, job, group, op) {
|
|
3
|
+
const { data, error, response } = await client.POST('/job/{job}/group/{group}/operation/{op}/stop', {
|
|
4
|
+
params: { path: { job, group, op } },
|
|
5
|
+
});
|
|
6
|
+
if ((error !== undefined && error !== null) || data === undefined) {
|
|
7
|
+
throw errorFormatter('Failed to stop operation', error, response);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=stopNodeJobOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopNodeJobOperation.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJob/stopNodeJobOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAIrE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAkB,EAClB,GAAW,EACX,KAAa,EACb,EAAU;IAEV,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,8CAA8C,EAAE;QAClG,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;KACrC,CAAC,CAAC;IACH,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,cAAc,CAAC,0BAA0B,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NodeClient } from '../../../../client/node/index.js';
|
|
2
|
+
import type { NodeSshAddKeyOptions, NodeSshAuthorization } from '../../types.js';
|
|
3
|
+
/** Grants one key, permanently unless `expiresAt` is set. Validated before anything is sent. */
|
|
4
|
+
export declare function nodeJobSshAdd(client: NodeClient, job: string, publicKey: string, { expiresAt, signal }?: NodeSshAddKeyOptions): Promise<NodeSshAuthorization>;
|
|
5
|
+
//# sourceMappingURL=nodeJobSshAdd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobSshAdd.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/nodeJobSshAdd.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEjF,gGAAgG;AAChG,wBAAsB,aAAa,CACjC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,EAAE,SAAS,EAAE,MAAM,EAAE,GAAE,oBAAyB,GAC/C,OAAO,CAAC,oBAAoB,CAAC,CAY/B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { requireSshPublicKey } from '@nosana/ssh';
|
|
2
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
3
|
+
/** Grants one key, permanently unless `expiresAt` is set. Validated before anything is sent. */
|
|
4
|
+
export async function nodeJobSshAdd(client, job, publicKey, { expiresAt, signal } = {}) {
|
|
5
|
+
const sshPublicKey = requireSshPublicKey(publicKey);
|
|
6
|
+
const expiry = toExpiry(expiresAt);
|
|
7
|
+
const { data, error, response } = await client.POST('/job/{job}/ssh/authorize', {
|
|
8
|
+
params: { path: { job } },
|
|
9
|
+
signal,
|
|
10
|
+
body: expiry === undefined ? { sshPublicKey } : { sshPublicKey, expiresAt: expiry },
|
|
11
|
+
});
|
|
12
|
+
if ((error !== undefined && error !== null) || data === undefined) {
|
|
13
|
+
throw errorFormatter('Failed to add SSH key', error, response);
|
|
14
|
+
}
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function toExpiry(expiresAt) {
|
|
18
|
+
if (expiresAt === undefined)
|
|
19
|
+
return undefined;
|
|
20
|
+
if (!(expiresAt instanceof Date) || !(expiresAt.getTime() > Date.now())) {
|
|
21
|
+
throw new Error('SSH expiry must be a valid future Date.');
|
|
22
|
+
}
|
|
23
|
+
return expiresAt.toISOString();
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=nodeJobSshAdd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobSshAdd.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/nodeJobSshAdd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,gGAAgG;AAChG,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAkB,EAClB,GAAW,EACX,SAAiB,EACjB,EAAE,SAAS,EAAE,MAAM,KAA2B,EAAE;IAEhD,MAAM,YAAY,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IACnC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE;QAC9E,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QACzB,MAAM;QACN,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE;KACpF,CAAC,CAAC;IACH,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,cAAc,CAAC,uBAAuB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,SAA2B;IAC3C,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,CAAC,CAAC,SAAS,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeClient } from '../../../../client/node/index.js';
|
|
2
|
+
import type { NodeSshAuthorizedKey, NodeSshKeyOptions } from '../../types.js';
|
|
3
|
+
export declare function nodeJobSshKeys(client: NodeClient, job: string, { signal }?: NodeSshKeyOptions): Promise<NodeSshAuthorizedKey[]>;
|
|
4
|
+
//# sourceMappingURL=nodeJobSshKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobSshKeys.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/nodeJobSshKeys.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,wBAAsB,cAAc,CAClC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,EAAE,MAAM,EAAE,GAAE,iBAAsB,GACjC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CASjC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
2
|
+
export async function nodeJobSshKeys(client, job, { signal } = {}) {
|
|
3
|
+
const { data, error, response } = await client.GET('/job/{job}/ssh/keys', {
|
|
4
|
+
params: { path: { job } },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
if ((error !== undefined && error !== null) || data === undefined) {
|
|
8
|
+
throw errorFormatter('Failed to get SSH keys', error, response);
|
|
9
|
+
}
|
|
10
|
+
return data.keys;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=nodeJobSshKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobSshKeys.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/nodeJobSshKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAkB,EAClB,GAAW,EACX,EAAE,MAAM,KAAwB,EAAE;IAElC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAqB,EAAE;QACxE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QACzB,MAAM;KACP,CAAC,CAAC;IACH,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,cAAc,CAAC,wBAAwB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeClient } from '../../../../client/node/index.js';
|
|
2
|
+
import type { NodeSshKeyOptions, NodeSshRevocation } from '../../types.js';
|
|
3
|
+
export declare function nodeJobSshRemove(client: NodeClient, job: string, publicKey: string, { signal }?: NodeSshKeyOptions): Promise<NodeSshRevocation>;
|
|
4
|
+
//# sourceMappingURL=nodeJobSshRemove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobSshRemove.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/nodeJobSshRemove.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,EAAE,MAAM,EAAE,GAAE,iBAAsB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAU5B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { requireSshPublicKey } from '@nosana/ssh';
|
|
2
|
+
import { errorFormatter } from '../../../../utils/errorFormatter.js';
|
|
3
|
+
export async function nodeJobSshRemove(client, job, publicKey, { signal } = {}) {
|
|
4
|
+
const { data, error, response } = await client.DELETE('/job/{job}/ssh/keys', {
|
|
5
|
+
params: { path: { job } },
|
|
6
|
+
signal,
|
|
7
|
+
body: { sshPublicKey: requireSshPublicKey(publicKey) },
|
|
8
|
+
});
|
|
9
|
+
if ((error !== undefined && error !== null) || data === undefined) {
|
|
10
|
+
throw errorFormatter('Failed to remove SSH key', error, response);
|
|
11
|
+
}
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=nodeJobSshRemove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobSshRemove.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobSsh/nodeJobSshRemove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAkB,EAClB,GAAW,EACX,SAAiB,EACjB,EAAE,MAAM,KAAwB,EAAE;IAElC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE;QAC3E,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QACzB,MAAM;QACN,IAAI,EAAE,EAAE,YAAY,EAAE,mBAAmB,CAAC,SAAS,CAAC,EAAE;KACvD,CAAC,CAAC;IACH,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,cAAc,CAAC,0BAA0B,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeClient } from '../../../../client/node/index.js';
|
|
2
|
+
import type { NodeJobInfo, NodeStreamHandlers, NodeStreamSubscription } from '../../types.js';
|
|
3
|
+
export declare function nodeJobInfoStream(client: NodeClient, job: string, handlers: NodeStreamHandlers<NodeJobInfo>): NodeStreamSubscription;
|
|
4
|
+
//# sourceMappingURL=nodeJobInfoStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobInfoStream.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/nodeJobInfoStream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE9F,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,kBAAkB,CAAC,WAAW,CAAC,GACxC,sBAAsB,CAExB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobInfoStream.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/nodeJobInfoStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK7C,MAAM,UAAU,iBAAiB,CAC/B,MAAkB,EAClB,GAAW,EACX,QAAyC;IAEzC,OAAO,UAAU,CAAC,MAAM,EAAE,QAAQ,kBAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeClient } from '../../../../client/node/index.js';
|
|
2
|
+
import type { NodeStatsQuery, NodeStreamHandlers, NodeStreamSubscription, NodeTaskStat } from '../../types.js';
|
|
3
|
+
export declare function nodeJobStatsStream(client: NodeClient, job: string, handlers: NodeStreamHandlers<NodeTaskStat[]>, { interval }?: Pick<NodeStatsQuery, 'interval'>): NodeStreamSubscription;
|
|
4
|
+
//# sourceMappingURL=nodeJobStatsStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobStatsStream.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/nodeJobStatsStream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/G,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,kBAAkB,CAAC,YAAY,EAAE,CAAC,EAC5C,EAAE,QAAQ,EAAE,GAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAM,GAClD,sBAAsB,CAGxB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { nodeStream } from './nodeStream.js';
|
|
2
|
+
export function nodeJobStatsStream(client, job, handlers, { interval } = {}) {
|
|
3
|
+
const query = interval === undefined ? '' : `?interval=${encodeURIComponent(interval)}`;
|
|
4
|
+
return nodeStream(client, `/job/${encodeURIComponent(job)}/stats/stream${query}`, handlers);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=nodeJobStatsStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobStatsStream.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/nodeJobStatsStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK7C,MAAM,UAAU,kBAAkB,CAChC,MAAkB,EAClB,GAAW,EACX,QAA4C,EAC5C,EAAE,QAAQ,KAAuC,EAAE;IAEnD,MAAM,KAAK,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxF,OAAO,UAAU,CAAC,MAAM,EAAE,QAAQ,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NodeClient } from '../../../../client/node/index.js';
|
|
2
|
+
import type { NodeStreamHandlers, NodeStreamSubscription } from '../../types.js';
|
|
3
|
+
/** The node's streams carry one typed frame per message; the shape is taken on trust from the schema. */
|
|
4
|
+
export declare function nodeStream<T>(client: NodeClient, path: string, handlers: NodeStreamHandlers<T>): NodeStreamSubscription;
|
|
5
|
+
//# sourceMappingURL=nodeStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeStream.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/nodeStream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEjF,yGAAyG;AACzG,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC9B,sBAAsB,CAMxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { openEventStream } from '../../../../utils/eventStream.js';
|
|
2
|
+
/** The node's streams carry one typed frame per message; the shape is taken on trust from the schema. */
|
|
3
|
+
export function nodeStream(client, path, handlers) {
|
|
4
|
+
return openEventStream(client.connection, path, {
|
|
5
|
+
onOpen: handlers.onOpen,
|
|
6
|
+
onError: handlers.onError,
|
|
7
|
+
onMessage: (frame) => handlers.onData(frame),
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=nodeStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeStream.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeJobStreams/nodeStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAKnE,yGAAyG;AACzG,MAAM,UAAU,UAAU,CACxB,MAAkB,EAClB,IAAY,EACZ,QAA+B;IAE/B,OAAO,eAAe,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE;QAC9C,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAU,CAAC;KAClD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NodeJobContext, NodeLogsFilter, NodeSocketOptions, NodeStreamHandlers, NodeStreamSubscription, NodeTaskLog } from '../../types.js';
|
|
2
|
+
export declare function nodeJobLogs(context: NodeJobContext, handlers: NodeStreamHandlers<NodeTaskLog>, filter?: NodeLogsFilter, options?: NodeSocketOptions): NodeStreamSubscription;
|
|
3
|
+
//# sourceMappingURL=nodeJobLogs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobLogs.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/nodeJobLogs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAOxB,wBAAgB,WAAW,CACzB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,kBAAkB,CAAC,WAAW,CAAC,EACzC,MAAM,GAAE,cAAmB,EAC3B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,sBAAsB,CAQxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { tryParseJson } from '../../../../utils/json.js';
|
|
2
|
+
import { openNodeSocket } from './socket.js';
|
|
3
|
+
/** Task manager logs arrive JSON-encoded inside the frame's `data`. */
|
|
4
|
+
function parseTaskLog(data) {
|
|
5
|
+
return typeof data === 'string' ? tryParseJson(data) : undefined;
|
|
6
|
+
}
|
|
7
|
+
export function nodeJobLogs(context, handlers, filter = {}, options) {
|
|
8
|
+
return openNodeSocket(context, { path: '/flog', body: { jobAddress: context.job, ...filter } }, handlers, parseTaskLog, options);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=nodeJobLogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobLogs.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/nodeJobLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAW7C,uEAAuE;AACvE,SAAS,YAAY,CAAC,IAAa;IACjC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAE,YAAY,CAAC,IAAI,CAA6B,CAAC,CAAC,CAAC,SAAS,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,OAAuB,EACvB,QAAyC,EACzC,SAAyB,EAAE,EAC3B,OAA2B;IAE3B,OAAO,cAAc,CACnB,OAAO,EACP,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,EAAE,EAC/D,QAAQ,EACR,YAAY,EACZ,OAAO,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NodeJobContext, NodeSocketOptions, NodeStreamHandlers, NodeStreamSubscription } from '../../types.js';
|
|
2
|
+
export declare function nodeJobStatus(context: NodeJobContext, handlers: NodeStreamHandlers<unknown>, options?: NodeSocketOptions): NodeStreamSubscription;
|
|
3
|
+
//# sourceMappingURL=nodeJobStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobStatus.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/nodeJobStatus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,wBAAgB,aAAa,CAC3B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,sBAAsB,CAQxB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { openNodeSocket } from './socket.js';
|
|
2
|
+
export function nodeJobStatus(context, handlers, options) {
|
|
3
|
+
return openNodeSocket(context, { path: '/status', body: { jobAddress: context.job } }, handlers, (data) => data, options);
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=nodeJobStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeJobStatus.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/nodeJobStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAS7C,MAAM,UAAU,aAAa,CAC3B,OAAuB,EACvB,QAAqC,EACrC,OAA2B;IAE3B,OAAO,cAAc,CACnB,OAAO,EACP,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,EACtD,QAAQ,EACR,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EACd,OAAO,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NodeClient } from '../../../../client/node/index.js';
|
|
2
|
+
import type { NodeJobContext, NodeSocketOptions, NodeStreamHandlers, NodeStreamSubscription } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The node multiplexes its WebSocket routes over one endpoint: the first
|
|
5
|
+
* frame is a JSON handshake naming the route, carrying the authorization
|
|
6
|
+
* string and the route's body, and every frame after that is `{ path, data }`.
|
|
7
|
+
*/
|
|
8
|
+
export interface NodeSocketHandshake {
|
|
9
|
+
path: '/log' | '/flog' | '/status';
|
|
10
|
+
body: {
|
|
11
|
+
jobAddress: string;
|
|
12
|
+
} & Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
/** The node's WebSocket endpoint, derived from the client's HTTP base URL. */
|
|
15
|
+
export declare function nodeSocketUrl(client: NodeClient, path?: string): string;
|
|
16
|
+
/** A fresh socket to the node, from the caller's factory or the runtime's `WebSocket`. */
|
|
17
|
+
export declare function openNodeWebSocket(client: NodeClient, path: string, factory?: (url: string) => WebSocket): WebSocket;
|
|
18
|
+
export declare function openNodeSocket<T>(context: NodeJobContext, handshake: NodeSocketHandshake, handlers: NodeStreamHandlers<T>, parse: (data: unknown) => T | undefined, options?: NodeSocketOptions): NodeStreamSubscription;
|
|
19
|
+
//# sourceMappingURL=socket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/socket.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACnC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxD;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,SAAK,GAAG,MAAM,CAEnE;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAuC,GAChE,SAAS,CAEX;AAED,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,CAAC,GAAG,SAAS,EACvC,OAAO,GAAE,iBAAsB,GAC9B,sBAAsB,CAuBxB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NOSANA_API_AUTH_MESSAGE } from '../../../../client/createClient.js';
|
|
2
|
+
import { tryParseJson } from '../../../../utils/json.js';
|
|
3
|
+
import { requireNodeAuthorization } from '../authorization.js';
|
|
4
|
+
/** The node's WebSocket endpoint, derived from the client's HTTP base URL. */
|
|
5
|
+
export function nodeSocketUrl(client, path = '') {
|
|
6
|
+
return `${client.connection.baseUrl.replace(/^http/, 'ws')}${path}`;
|
|
7
|
+
}
|
|
8
|
+
/** A fresh socket to the node, from the caller's factory or the runtime's `WebSocket`. */
|
|
9
|
+
export function openNodeWebSocket(client, path, factory = (url) => new WebSocket(url)) {
|
|
10
|
+
return factory(nodeSocketUrl(client, path));
|
|
11
|
+
}
|
|
12
|
+
export function openNodeSocket(context, handshake, handlers, parse, options = {}) {
|
|
13
|
+
const authorize = requireNodeAuthorization(context, options.authorizationProvider);
|
|
14
|
+
const socket = openNodeWebSocket(context.client, '', options.webSocketFactory);
|
|
15
|
+
socket.onopen = async () => {
|
|
16
|
+
try {
|
|
17
|
+
socket.send(JSON.stringify({ ...handshake, header: await authorize(NOSANA_API_AUTH_MESSAGE) }));
|
|
18
|
+
handlers.onOpen?.();
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
handlers.onError?.(error);
|
|
22
|
+
socket.close();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
socket.onmessage = (event) => {
|
|
26
|
+
if (typeof event.data !== 'string')
|
|
27
|
+
return;
|
|
28
|
+
const frame = tryParseJson(event.data);
|
|
29
|
+
if (typeof frame !== 'object' || frame === null)
|
|
30
|
+
return;
|
|
31
|
+
const data = parse(frame.data);
|
|
32
|
+
if (data !== undefined)
|
|
33
|
+
handlers.onData(data);
|
|
34
|
+
};
|
|
35
|
+
socket.onerror = (event) => handlers.onError?.(event);
|
|
36
|
+
return { close: () => socket.close() };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=socket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/nodeSocket/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAoB/D,8EAA8E;AAC9E,MAAM,UAAU,aAAa,CAAC,MAAkB,EAAE,IAAI,GAAG,EAAE;IACzD,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;AACtE,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,iBAAiB,CAC/B,MAAkB,EAClB,IAAY,EACZ,UAAsC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC;IAEjE,OAAO,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,OAAuB,EACvB,SAA8B,EAC9B,QAA+B,EAC/B,KAAuC,EACvC,UAA6B,EAAE;IAE/B,MAAM,SAAS,GAAG,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE/E,MAAM,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE;QACzB,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAC;YAChG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IACF,MAAM,CAAC,SAAS,GAAG,CAAC,KAAmB,EAAE,EAAE;QACzC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO;QAC3C,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAA0C,CAAC;QAChF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO;QACxD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,IAAI,KAAK,SAAS;YAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC,CAAC;IACF,MAAM,CAAC,OAAO,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IAE7D,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { buildTerminalAuthorizationMessage, isSafeTerminalOperation, TERMINAL_AUTHORIZATION_AUDIENCE, TERMINAL_AUTHORIZATION_MAX_TTL_MS, TERMINAL_AUTHORIZATION_MESSAGE_HEADER } from '@nosana/ssh';
|
|
2
|
+
import type { NodeAuthorizationProvider, TerminalAuthorizationGrant } from '../../types.js';
|
|
3
|
+
export { buildTerminalAuthorizationMessage, isSafeTerminalOperation, TERMINAL_AUTHORIZATION_AUDIENCE, TERMINAL_AUTHORIZATION_MAX_TTL_MS, TERMINAL_AUTHORIZATION_MESSAGE_HEADER, };
|
|
4
|
+
export type { TerminalAuthorizationMessageOptions } from '@nosana/ssh';
|
|
5
|
+
export declare const DEFAULT_TERMINAL_AUTHORIZATION_TTL_MS: number;
|
|
6
|
+
export interface CreateTerminalAuthorizationGrantOptions {
|
|
7
|
+
job: string;
|
|
8
|
+
node: string;
|
|
9
|
+
network: string;
|
|
10
|
+
op?: string;
|
|
11
|
+
ttlMs?: number;
|
|
12
|
+
now?: Date;
|
|
13
|
+
authorize: NodeAuthorizationProvider;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Signs a short-lived grant for one terminal session on one job. The node
|
|
17
|
+
* verifies the raw signature over the message, so it is pulled back out of
|
|
18
|
+
* the `message:signature` authorization string the signer produces.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createTerminalAuthorizationGrant({ job, node, network, op, ttlMs, now, authorize, }: CreateTerminalAuthorizationGrantOptions): Promise<TerminalAuthorizationGrant>;
|
|
21
|
+
//# sourceMappingURL=grant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/terminal/grant.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iCAAiC,EACjC,uBAAuB,EACvB,+BAA+B,EAC/B,iCAAiC,EACjC,qCAAqC,EACtC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAI5F,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACvB,+BAA+B,EAC/B,iCAAiC,EACjC,qCAAqC,GACtC,CAAC;AACF,YAAY,EAAE,mCAAmC,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,qCAAqC,QAAgB,CAAC;AAEnE,MAAM,WAAW,uCAAuC;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,yBAAyB,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CAAC,EACrD,GAAG,EACH,IAAI,EACJ,OAAO,EACP,EAAE,EACF,KAA6C,EAC7C,GAAgB,EAChB,SAAS,GACV,EAAE,uCAAuC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAmB/E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { parseAuthorization } from '@nosana/authorization';
|
|
2
|
+
import { bytesToBase64, buildTerminalAuthorizationMessage, isSafeTerminalOperation, TERMINAL_AUTHORIZATION_AUDIENCE, TERMINAL_AUTHORIZATION_MAX_TTL_MS, TERMINAL_AUTHORIZATION_MESSAGE_HEADER, } from '@nosana/ssh';
|
|
3
|
+
// The message contract now lives in @nosana/ssh, shared with the node; re-exported
|
|
4
|
+
// here so existing importers of this module keep resolving it.
|
|
5
|
+
export { buildTerminalAuthorizationMessage, isSafeTerminalOperation, TERMINAL_AUTHORIZATION_AUDIENCE, TERMINAL_AUTHORIZATION_MAX_TTL_MS, TERMINAL_AUTHORIZATION_MESSAGE_HEADER, };
|
|
6
|
+
export const DEFAULT_TERMINAL_AUTHORIZATION_TTL_MS = 4 * 60 * 1000;
|
|
7
|
+
/**
|
|
8
|
+
* Signs a short-lived grant for one terminal session on one job. The node
|
|
9
|
+
* verifies the raw signature over the message, so it is pulled back out of
|
|
10
|
+
* the `message:signature` authorization string the signer produces.
|
|
11
|
+
*/
|
|
12
|
+
export async function createTerminalAuthorizationGrant({ job, node, network, op, ttlMs = DEFAULT_TERMINAL_AUTHORIZATION_TTL_MS, now = new Date(), authorize, }) {
|
|
13
|
+
if (ttlMs <= 0 || ttlMs > TERMINAL_AUTHORIZATION_MAX_TTL_MS) {
|
|
14
|
+
throw new Error(`Terminal authorization TTL must be between 1 and ${TERMINAL_AUTHORIZATION_MAX_TTL_MS} milliseconds.`);
|
|
15
|
+
}
|
|
16
|
+
if (op && !isSafeTerminalOperation(op)) {
|
|
17
|
+
throw new Error('Invalid terminal operation selector.');
|
|
18
|
+
}
|
|
19
|
+
const expiresAt = new Date(now.getTime() + ttlMs).toISOString();
|
|
20
|
+
const message = buildTerminalAuthorizationMessage({ job, node, expiresAt, op, network });
|
|
21
|
+
// A grant is scoped to this job, operation and expiry. It must neither reuse
|
|
22
|
+
// a cached API authentication header nor replace one in a wallet's store.
|
|
23
|
+
const { signature } = parseAuthorization(await authorize(message, { skipCache: true }), {
|
|
24
|
+
expected_message: message,
|
|
25
|
+
});
|
|
26
|
+
return { message, signature: bytesToBase64(signature), expiresAt };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=grant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/terminal/grant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,iCAAiC,EACjC,uBAAuB,EACvB,+BAA+B,EAC/B,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,aAAa,CAAC;AAIrB,mFAAmF;AACnF,+DAA+D;AAC/D,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACvB,+BAA+B,EAC/B,iCAAiC,EACjC,qCAAqC,GACtC,CAAC;AAGF,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAYnE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,EACrD,GAAG,EACH,IAAI,EACJ,OAAO,EACP,EAAE,EACF,KAAK,GAAG,qCAAqC,EAC7C,GAAG,GAAG,IAAI,IAAI,EAAE,EAChB,SAAS,GAC+B;IACxC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,iCAAiC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CACb,oDAAoD,iCAAiC,gBAAgB,CACtG,CAAC;IACJ,CAAC;IACD,IAAI,EAAE,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAChE,MAAM,OAAO,GAAG,iCAAiC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACzF,6EAA6E;IAC7E,0EAA0E;IAC1E,MAAM,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAAC,MAAM,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE;QACtF,gBAAgB,EAAE,OAAO;KAC1B,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeJobContext, NodeTerminalOptions, TerminalSession } from '../../types.js';
|
|
2
|
+
/** Signs a short-lived grant for the job, then hands a fresh WebSocket to a session. */
|
|
3
|
+
export declare function openNodeJobTerminal(context: NodeJobContext, options: NodeTerminalOptions): Promise<TerminalSession>;
|
|
4
|
+
//# sourceMappingURL=openTerminal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openTerminal.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/terminal/openTerminal.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE3F,wFAAwF;AACxF,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAiB1B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { requireNodeAuthorization } from '../authorization.js';
|
|
2
|
+
import { openNodeWebSocket } from '../nodeSocket/index.js';
|
|
3
|
+
import { createTerminalAuthorizationGrant } from './grant.js';
|
|
4
|
+
import { openTerminalSession } from './session.js';
|
|
5
|
+
/** Signs a short-lived grant for the job, then hands a fresh WebSocket to a session. */
|
|
6
|
+
export async function openNodeJobTerminal(context, options) {
|
|
7
|
+
options.signal?.throwIfAborted();
|
|
8
|
+
const authorize = requireNodeAuthorization(context, options.authorizationProvider);
|
|
9
|
+
options.onStatus?.('authorizing');
|
|
10
|
+
const authorization = await createTerminalAuthorizationGrant({
|
|
11
|
+
job: context.job,
|
|
12
|
+
node: context.node,
|
|
13
|
+
network: context.environment,
|
|
14
|
+
op: options.op,
|
|
15
|
+
ttlMs: options.ttlMs,
|
|
16
|
+
authorize,
|
|
17
|
+
});
|
|
18
|
+
options.signal?.throwIfAborted();
|
|
19
|
+
const socket = openNodeWebSocket(context.client, '/terminal', options.webSocketFactory);
|
|
20
|
+
return openTerminalSession(socket, context.job, authorization, options);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=openTerminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openTerminal.js","sourceRoot":"","sources":["../../../../../src/routes/node/actions/terminal/openTerminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAuB,EACvB,OAA4B;IAE5B,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,OAAO,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,CAAC;IAElC,MAAM,aAAa,GAAG,MAAM,gCAAgC,CAAC;QAC3D,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,WAAW;QAC5B,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS;KACV,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxF,OAAO,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodeTerminalOptions, TerminalAuthorizationGrant, TerminalSession } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Drives one terminal WebSocket: sends the signed handshake once the socket
|
|
4
|
+
* opens, relays frames in both directions, and reports each status change once.
|
|
5
|
+
*/
|
|
6
|
+
export declare function openTerminalSession(socket: WebSocket, job: string, authorization: TerminalAuthorizationGrant, options: NodeTerminalOptions): TerminalSession;
|
|
7
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../../src/routes/node/actions/terminal/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AAgBxB;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,0BAA0B,EACzC,OAAO,EAAE,mBAAmB,GAC3B,eAAe,CA+FjB"}
|