@norskvideo/norsk-manager-sdk 1.0.402-2025-05-22-83749aa9 → 1.0.402-2025-05-26-c7282067

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.
@@ -426,6 +426,12 @@ export declare type Log = {
426
426
  /** @public */
427
427
  export declare type NodeId = string;
428
428
 
429
+ /**
430
+ * @public
431
+ * State of a node
432
+ */
433
+ export declare type NodeInfo = NodePending | NodeStarting | NodeRunning | NodeStopping;
434
+
429
435
  /** @public */
430
436
  export declare type NodeMetadata = {
431
437
  nodeId: NodeId;
@@ -436,6 +442,15 @@ export declare type NodeMetadata = {
436
442
  providerMetadata: ProviderMetadata;
437
443
  };
438
444
 
445
+ /**
446
+ * @public
447
+ * A node is pending
448
+ */
449
+ export declare interface NodePending {
450
+ event: "nodePending";
451
+ nodeId: NodeId;
452
+ }
453
+
439
454
  /**
440
455
  * @public
441
456
  * A node is running - used in initial state messages
@@ -581,6 +596,11 @@ export declare class NorskManager {
581
596
  * Search for jobs by tag/date/etc. See {@link JobSearchSettings}
582
597
  */
583
598
  jobSearch(settings: JobSearchSettings): Promise<CurrentJob[]>;
599
+ /**
600
+ * @public
601
+ * Return a list a all the nodes the manager knows about.
602
+ */
603
+ listNodes(): Promise<NodeInfo[]>;
584
604
  }
585
605
 
586
606
  /**
@@ -697,7 +717,7 @@ export declare type PortMapping = {
697
717
  */
698
718
  export declare type ProviderHealth = AwsHealth | OciHealth;
699
719
 
700
- /**
720
+ /**;
701
721
  * @public
702
722
  * The health status of a provider has changed
703
723
  * */
package/lib/src/sdk.d.ts CHANGED
@@ -452,6 +452,14 @@ export interface NodeStopping {
452
452
  nodeId: NodeId;
453
453
  reason: "createFailed" | "pendingTimeExceeded" | "startupTimeExceeded" | "initialisationHealthPingTimeExceeded" | "healthPingTimeExceeded" | "duplicateJob" | "providerStop" | "providerTerminate" | "userRequested" | "unknownNode";
454
454
  }
455
+ /**
456
+ * @public
457
+ * A node is pending
458
+ */
459
+ export interface NodePending {
460
+ event: "nodePending";
461
+ nodeId: NodeId;
462
+ }
455
463
  /**
456
464
  * @public
457
465
  * A node has stopped
@@ -480,6 +488,11 @@ export interface PhysicalNodeConnected {
480
488
  instances: RunningJob[];
481
489
  }
482
490
  /**
491
+ * @public
492
+ * State of a node
493
+ */
494
+ export type NodeInfo = NodePending | NodeStarting | NodeRunning | NodeStopping;
495
+ /**;
483
496
  * @public
484
497
  * The health status of a provider has changed
485
498
  * */
@@ -740,6 +753,11 @@ export declare class NorskManager {
740
753
  * Search for jobs by tag/date/etc. See {@link JobSearchSettings}
741
754
  */
742
755
  jobSearch(settings: JobSearchSettings): Promise<CurrentJob[]>;
756
+ /**
757
+ * @public
758
+ * Return a list a all the nodes the manager knows about.
759
+ */
760
+ listNodes(): Promise<NodeInfo[]>;
743
761
  }
744
762
  interface EventStreamAsyncIterable {
745
763
  [Symbol.asyncIterator](): AsyncIterator<EventStreamEvent, EventStreamEvent>;
package/lib/src/sdk.js CHANGED
@@ -788,6 +788,13 @@ function fromNodeStopping(event) {
788
788
  }), event.nodeId);
789
789
  }
790
790
  /** @internal */
791
+ function fromNodePending(event) {
792
+ return utils.mapOptional((nodeId) => ({
793
+ event: "nodePending",
794
+ nodeId: fromNodeId(nodeId),
795
+ }), event.nodeId);
796
+ }
797
+ /** @internal */
791
798
  function fromNodeStopped(event) {
792
799
  return utils.mapOptional((nodeId) => ({
793
800
  event: "nodeStopped",
@@ -814,6 +821,23 @@ function fromPhysicalNodeConnected(event) {
814
821
  instances: event.instances.map(fromRunningJob),
815
822
  }), event.node);
816
823
  }
824
+ function fromNodeInfo(nodeInfo) {
825
+ const state = nodeInfo.node.case;
826
+ switch (state) {
827
+ case "nodePending":
828
+ return fromNodePending(nodeInfo.node.value);
829
+ case "nodeStarting":
830
+ return fromNodeStarting(nodeInfo.node.value);
831
+ case "nodeRunning":
832
+ return fromNodeRunning(nodeInfo.node.value);
833
+ case "nodeStopping":
834
+ return fromNodeStopping(nodeInfo.node.value);
835
+ case undefined:
836
+ return undefined;
837
+ default:
838
+ utils.exhaustiveCheck(state);
839
+ }
840
+ }
817
841
  /** internal */
818
842
  function toTagFilter(filter) {
819
843
  let comparison;
@@ -1312,6 +1336,25 @@ class NorskManager {
1312
1336
  stream.on("error", (err) => reject(err));
1313
1337
  });
1314
1338
  }
1339
+ /**
1340
+ * @public
1341
+ * Return a list a all the nodes the manager knows about.
1342
+ */
1343
+ async listNodes() {
1344
+ const stream = this.client.listNodes((0, utils_1.provideFull)(protobuf_1.Empty, {}));
1345
+ return new Promise((resolve, reject) => {
1346
+ const nodes = [];
1347
+ // TODO - handle stream errors...
1348
+ stream.on("data", (data) => {
1349
+ const node = fromNodeInfo(data);
1350
+ if (node !== undefined) {
1351
+ nodes.push(node);
1352
+ }
1353
+ });
1354
+ stream.on("close", () => resolve(nodes));
1355
+ stream.on("error", (err) => reject(err));
1356
+ });
1357
+ }
1315
1358
  /** @internal */
1316
1359
  handleStatusEvent(data) {
1317
1360
  const messageCase = data.message.case;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "license": "MIT",
3
3
  "name": "@norskvideo/norsk-manager-sdk",
4
- "version": "1.0.402-2025-05-22-83749aa9+nightly",
4
+ "version": "1.0.402-2025-05-26-c7282067+nightly",
5
5
  "dependencies": {
6
6
  "@bufbuild/protobuf": "^0.3.0",
7
7
  "@grpc/grpc-js": "~1.12.0",
8
- "@norskvideo/norsk-api": "1.0.402-2025-05-22-83749aa9+nightly",
8
+ "@norskvideo/norsk-api": "1.0.402-2025-05-26-c7282067+nightly",
9
9
  "typescript-nullable": "^0.6.0"
10
10
  },
11
11
  "files": [
package/src/sdk.ts CHANGED
@@ -1508,6 +1508,28 @@ function fromNodeStopping(
1508
1508
  );
1509
1509
  }
1510
1510
 
1511
+ /**
1512
+ * @public
1513
+ * A node is pending
1514
+ */
1515
+ export interface NodePending {
1516
+ event: "nodePending";
1517
+ nodeId: NodeId;
1518
+ }
1519
+
1520
+ /** @internal */
1521
+ function fromNodePending(
1522
+ event: ManagerPB.NodePending
1523
+ ): NodePending | undefined {
1524
+ return utils.mapOptional(
1525
+ (nodeId) => ({
1526
+ event: "nodePending",
1527
+ nodeId: fromNodeId(nodeId),
1528
+ }),
1529
+ event.nodeId
1530
+ );
1531
+ }
1532
+
1511
1533
  /**
1512
1534
  * @public
1513
1535
  * A node has stopped
@@ -1581,6 +1603,32 @@ function fromPhysicalNodeConnected(
1581
1603
  }
1582
1604
 
1583
1605
  /**
1606
+ * @public
1607
+ * State of a node
1608
+ */
1609
+ export type NodeInfo = NodePending | NodeStarting | NodeRunning | NodeStopping;
1610
+
1611
+ function fromNodeInfo(
1612
+ nodeInfo: ManagerPB.NodeInfo
1613
+ ): NodeInfo | undefined {
1614
+ const state = nodeInfo.node.case;
1615
+ switch (state) {
1616
+ case "nodePending":
1617
+ return fromNodePending(nodeInfo.node.value);
1618
+ case "nodeStarting":
1619
+ return fromNodeStarting(nodeInfo.node.value);
1620
+ case "nodeRunning":
1621
+ return fromNodeRunning(nodeInfo.node.value);
1622
+ case "nodeStopping":
1623
+ return fromNodeStopping(nodeInfo.node.value);
1624
+ case undefined:
1625
+ return undefined;
1626
+ default:
1627
+ utils.exhaustiveCheck(state);
1628
+ }
1629
+ }
1630
+
1631
+ /**;
1584
1632
  * @public
1585
1633
  * The health status of a provider has changed
1586
1634
  * */
@@ -2368,6 +2416,27 @@ export class NorskManager {
2368
2416
  });
2369
2417
  }
2370
2418
 
2419
+ /**
2420
+ * @public
2421
+ * Return a list a all the nodes the manager knows about.
2422
+ */
2423
+ public async listNodes(): Promise<NodeInfo[]> {
2424
+ const stream = this.client.listNodes(provideFull(Empty, {}));
2425
+ return new Promise((resolve, reject) => {
2426
+ const nodes: NodeInfo[] = [];
2427
+ // TODO - handle stream errors...
2428
+
2429
+ stream.on("data", (data: ManagerPB.NodeInfo) => {
2430
+ const node = fromNodeInfo(data);
2431
+ if (node !== undefined) {
2432
+ nodes.push(node);
2433
+ }
2434
+ });
2435
+ stream.on("close", () => resolve(nodes));
2436
+ stream.on("error", (err) => reject(err));
2437
+ });
2438
+ }
2439
+
2371
2440
  /** @internal */
2372
2441
  handleStatusEvent(data: ManagerPB.NorskStatusEvent) {
2373
2442
  const messageCase = data.message.case;