@norskvideo/norsk-manager-sdk 1.0.402-2025-12-28-2b85d1d6 → 1.0.402-2025-12-30-863e6d8f

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.
@@ -0,0 +1,1028 @@
1
+ import * as ManagerPB from '@norskvideo/norsk-api/lib/manager_pb';
2
+
3
+ export declare type ActiveRoleEntry = JobHistoryJobProvisioned | JobHistoryJobRunning | JobHistoryJobStopping | JobHistoryJobStopped;
4
+
5
+ export declare interface Application {
6
+ name: string;
7
+ containerUrl: string;
8
+ command?: string;
9
+ portMappings?: PortMapping[];
10
+ volumeMounts?: VolumeMount[];
11
+ bindMounts?: BindMount[];
12
+ environmentVariables?: EnvironmentVariable[];
13
+ configuration: string;
14
+ }
15
+
16
+ export declare type AutoJob = Job & AutoJobConfig;
17
+
18
+ export declare type AutoJobConfig = {
19
+ instanceType: AwsInstanceType;
20
+ region: Region;
21
+ applications: Application[];
22
+ repeats: JobRepetition;
23
+ autoAllocateBackup: boolean;
24
+ availabilityDomain: string;
25
+ architecture: string;
26
+ subnet: string;
27
+ shape: string;
28
+ };
29
+
30
+ export declare type AutoJobWithHistory = {
31
+ job: AutoJob;
32
+ history: JobHistoryEntry[];
33
+ primaryRole?: ActiveRoleEntry;
34
+ backupRole?: ActiveRoleEntry;
35
+ };
36
+
37
+ export declare class AutoManager {
38
+ norsk: NorskManager;
39
+ settings: AutoSettings;
40
+ jobMap: Map<JobId, AutoJobWithHistory>;
41
+ nodeMap: Map<NodeId, NodeSummary>;
42
+ pendingNodes: Map<JobId, PendingNode>;
43
+ /** @public */
44
+ static run(settings: AutoSettings): Promise<[AutoManager, Promise<void>]>;
45
+ /** @public */
46
+ createJob(job: CreateAutoJob): Promise<AutoJob | null>;
47
+ /** @public */
48
+ updateJob(job: Omit<AutoJob, "services">): Promise<AutoJob>;
49
+ completeJob(jobId: JobId): Promise<void>;
50
+ /** @public */
51
+ findJob(jobId: JobId): Promise<AutoJob | undefined>;
52
+ /** @public */
53
+ terminateNode(nodeId: NodeId): Promise<void>;
54
+ /** @public */
55
+ jobs(): AutoJobWithHistory[];
56
+ nodes(): NodeSummary[];
57
+ private nodesByJob;
58
+ private jobUpdated;
59
+ private jobPending;
60
+ jobDeleted(jobId: JobId): Promise<void>;
61
+ private jobOutOfWindow;
62
+ private nodeStarting;
63
+ private nodeStarted;
64
+ private nodeStopping;
65
+ private nodeStopped;
66
+ private providerHealthChange;
67
+ private scheduleStartNodeForJob;
68
+ private startNodeForJob;
69
+ private doStartNodeForJob;
70
+ private updateJobMap;
71
+ private removeJob;
72
+ private updateNodeMap;
73
+ private clearPendingTimer;
74
+ private toManagerJob;
75
+ }
76
+
77
+ export declare interface AutoSettings {
78
+ url?: string;
79
+ primaryRegions: Regions;
80
+ backupRegions: Regions;
81
+ pendingWindow: number;
82
+ preStartWindow: number;
83
+ deletePostJobsAfter: number;
84
+ removeStoppedNodesAfter: number;
85
+ onJobUpdated?: (jobWithHistory: AutoJobWithHistory) => void;
86
+ onJobDeleted?: (jobId: JobId) => void;
87
+ onJobInfo?: (jobInfo: JobInfo) => void;
88
+ onNodeStarting?: (node: NodeId) => void;
89
+ onNodeStarted?: (node: NodeSummary) => void;
90
+ onNodeStopped?: (nodeId: NodeId) => void;
91
+ onNodeTerminated?: (nodeId: NodeId) => void;
92
+ onError?: (err: unknown) => void;
93
+ }
94
+
95
+ /**
96
+ * @public
97
+ */
98
+ export declare interface AwsHealth {
99
+ provider: "aws";
100
+ regions: {
101
+ [key: AwsRegion]: Health;
102
+ };
103
+ }
104
+
105
+ /** @public */
106
+ export declare type AwsInstanceId = string;
107
+
108
+ /** @public */
109
+ export declare type AwsInstanceType = string;
110
+
111
+ /** @public */
112
+ export declare interface AwsLaunchTemplateId {
113
+ id: string;
114
+ version?: string;
115
+ }
116
+
117
+ /** @public */
118
+ export declare interface AwsLaunchTemplateName {
119
+ name: string;
120
+ version?: string;
121
+ }
122
+
123
+ /** @public */
124
+ export declare type AwsMetadata = {
125
+ provider: "aws";
126
+ instanceType: AwsInstanceType;
127
+ region: AwsRegion;
128
+ };
129
+
130
+ /** @public */
131
+ export declare interface AwsNodeCreate {
132
+ nodeId: NodeId;
133
+ /**
134
+ * Tags to associate with the node
135
+ */
136
+ tags: {
137
+ [key: string]: string;
138
+ };
139
+ writeFiles?: WriteFile[];
140
+ region: AwsRegion;
141
+ instanceType: string;
142
+ /**
143
+ * Launch template to use for the node
144
+ */
145
+ template?: AwsLaunchTemplateName | AwsLaunchTemplateId;
146
+ workerImageVersion?: NorskVersion;
147
+ workerDaemonVersion?: NorskVersion;
148
+ }
149
+
150
+ /** @public */
151
+ export declare type AwsNodeId = string;
152
+
153
+ /** @public */
154
+ export declare type AwsRegion = string;
155
+
156
+ /** @public */
157
+ export declare type BindMount = {
158
+ hostPath: string;
159
+ containerPath: string;
160
+ readOnly: boolean;
161
+ };
162
+
163
+ /** @public */
164
+ export declare type ClientCode = DockerContainer;
165
+
166
+ /** @public */
167
+ export declare type Cloud = "aws" | "oci";
168
+
169
+ /** @public */
170
+ export declare type ContainerPort = number | RangePort;
171
+
172
+ /** @public */
173
+ export declare type ContainerUrl = string;
174
+
175
+ export declare type CreateAutoJob = Omit<AutoJob, "clientCode" | "state" | "currentHash" | "services">;
176
+
177
+ /** @public */
178
+ export declare type CreateJob = Omit<Job, "state" | "currentHash">;
179
+
180
+ /**
181
+ * @public
182
+ */
183
+ export declare interface CurrentJob {
184
+ job: Job;
185
+ instances: RunningJob[];
186
+ }
187
+
188
+ /** @public */
189
+ export declare type DaemonVersion = string;
190
+
191
+ /** @public */
192
+ export declare type DateComparison = {
193
+ comparison: "eq";
194
+ value: Date;
195
+ } | {
196
+ comparison: "lt";
197
+ value: Date;
198
+ } | {
199
+ comparison: "lte";
200
+ value: Date;
201
+ } | {
202
+ comparison: "gt";
203
+ value: Date;
204
+ } | {
205
+ comparison: "gte";
206
+ value: Date;
207
+ } | {
208
+ comparison: "between";
209
+ from: Date;
210
+ to: Date;
211
+ };
212
+
213
+ /** @public */
214
+ export declare interface DateFilter {
215
+ filterType: "date";
216
+ dateType: "start" | "end";
217
+ comparison: DateComparison;
218
+ }
219
+
220
+ /** @public */
221
+ export declare type DockerContainer = {
222
+ codeType: "docker";
223
+ url: ContainerUrl;
224
+ };
225
+
226
+ /** @public */
227
+ export declare type EnvironmentVariable = {
228
+ name: string;
229
+ value: string;
230
+ };
231
+
232
+ /** @public */
233
+ export declare type EphemeralHostPort = {
234
+ type: "ephemeral";
235
+ };
236
+
237
+ /** @public */
238
+ export declare function eventStream(norsk: NorskManager, options: {
239
+ pendingWindow: number;
240
+ }): Promise<[EventStreamInitialState, EventStreamAsyncIterable]>;
241
+
242
+ declare interface EventStreamAsyncIterable {
243
+ [Symbol.asyncIterator](): AsyncIterator<EventStreamEvent, EventStreamEvent>;
244
+ }
245
+
246
+ /**
247
+ * @public
248
+ * The manager activity stream has closed
249
+ * */
250
+ export declare interface EventStreamClosed {
251
+ event: "eventStreamClosed";
252
+ error?: Error;
253
+ }
254
+
255
+ /**
256
+ * @public
257
+ */
258
+ export declare type EventStreamEvent = JobUpdated | JobPending | JobOutOfWindow | JobDeleted | JobInfo | NodeStarting | NodeStarted | NodeStopping | NodeStopped | PhysicalNodeConnected | ProviderHealthChange | EventStreamClosed;
259
+
260
+ /**
261
+ * @public
262
+ */
263
+ export declare interface EventStreamInitialState {
264
+ nodesStarting: NodeStarting[];
265
+ nodesRunning: NodeRunning[];
266
+ activeJobs: JobWithHistory[];
267
+ health: ProviderHealth[];
268
+ closeStream: () => void;
269
+ }
270
+
271
+ /**
272
+ * @public
273
+ * Configuration for creating an event stream
274
+ */
275
+ export declare interface EventStreamSettings {
276
+ /**
277
+ * The number of seconds in the future to consider jobs as pending.
278
+ * Jobs that are further in the future will not surface in the event stream,
279
+ * and instead be only reachable through the search API.
280
+ */
281
+ pendingWindow: number;
282
+ /**
283
+ * Callback for handling events from the event stream
284
+ * @param event - Event from the Manager
285
+ */
286
+ onEvent: (event: EventStreamEvent) => void;
287
+ }
288
+
289
+ /** @public */
290
+ export declare type FileContent = {
291
+ location: "remote";
292
+ url: string;
293
+ } | {
294
+ location: "local";
295
+ text: string;
296
+ };
297
+
298
+ export declare function fromNodeInfo(nodeInfo: ManagerPB.NodeInfo): NodeInfo | undefined;
299
+
300
+ export declare function getJobIdForNode(nodeMetadata: NodeMetadata | undefined): JobId | undefined;
301
+
302
+ /**
303
+ * @public
304
+ */
305
+ export declare type Health = "healthy" | "unstable" | "failed";
306
+
307
+ /** @public */
308
+ export declare type HostPort = EphemeralHostPort | RangePort | SpecificHostPort;
309
+
310
+ /** @public */
311
+ export declare type IdComparison = {
312
+ comparison: "eq";
313
+ value: string;
314
+ } | {
315
+ comparison: "neq";
316
+ value: string;
317
+ } | {
318
+ comparison: "re";
319
+ value: string;
320
+ };
321
+
322
+ /** @public */
323
+ export declare interface IdFilter {
324
+ filterType: "id";
325
+ comparison: IdComparison;
326
+ }
327
+
328
+ /** @public */
329
+ export declare interface Job {
330
+ jobId: JobId;
331
+ cloud: Cloud;
332
+ description: string;
333
+ /**
334
+ * Tags to associate with the job
335
+ */
336
+ tags: {
337
+ [key: string]: string;
338
+ };
339
+ /**
340
+ * Date and time for when the job should be started
341
+ */
342
+ startDateTime: Date;
343
+ currentHash: bigint;
344
+ /**
345
+ * Additional services to be run as part of the job
346
+ */
347
+ services: Service[];
348
+ volumes?: string[];
349
+ /**
350
+ * JSON configuration to be passed to the manager and stored with the job
351
+ */
352
+ managerConfiguration?: string;
353
+ norskMediaVersion: NorskVersion;
354
+ /**
355
+ * Service parameters to be passed to the Norsk Media container when it is started
356
+ */
357
+ norskServiceParameters?: ServiceParameters;
358
+ writeFiles?: WriteFile[];
359
+ state: JobState;
360
+ shape: string;
361
+ availabilityDomain: string;
362
+ subnet: string;
363
+ architecture: string;
364
+ }
365
+
366
+ /**
367
+ * @public
368
+ * A job has been deleted
369
+ * */
370
+ export declare interface JobDeleted {
371
+ event: "jobDeleted";
372
+ jobId: JobId;
373
+ }
374
+
375
+ /** @public */
376
+ export declare type JobFilter = TagFilter | IdFilter | DateFilter | StateFilter | NoFilter;
377
+
378
+ /** @public */
379
+ export declare type JobHistoryEntry = JobHistoryJobCreated | JobHistoryJobUpdated | JobHistoryJobProvisioned | JobHistoryJobRunning | JobHistoryJobStopping | JobHistoryJobStopped | JobHistoryJobCompleted;
380
+
381
+ /** @public */
382
+ export declare type JobHistoryJobCompleted = {
383
+ event: "completed";
384
+ timestamp: Date;
385
+ };
386
+
387
+ /** @public */
388
+ export declare type JobHistoryJobCreated = {
389
+ event: "created";
390
+ timestamp: Date;
391
+ };
392
+
393
+ /** @public */
394
+ export declare type JobHistoryJobProvisioned = {
395
+ event: "provisioned";
396
+ timestamp: Date;
397
+ role: Role;
398
+ nodeMetadata: NodeMetadata;
399
+ runningNodeMetadata: RunningNodeMetadata;
400
+ };
401
+
402
+ /** @public */
403
+ export declare type JobHistoryJobRunning = {
404
+ event: "running";
405
+ timestamp: Date;
406
+ role: Role;
407
+ nodeMetadata: NodeMetadata;
408
+ runningNodeMetadata: RunningNodeMetadata;
409
+ };
410
+
411
+ /** @public */
412
+ export declare type JobHistoryJobStopped = {
413
+ event: "stopped";
414
+ timestamp: Date;
415
+ role: Role;
416
+ nodeMetadata: NodeMetadata;
417
+ runningNodeMetadata?: RunningNodeMetadata;
418
+ };
419
+
420
+ /** @public */
421
+ export declare type JobHistoryJobStopping = {
422
+ event: "stopping";
423
+ timestamp: Date;
424
+ role: Role;
425
+ nodeMetadata: NodeMetadata;
426
+ runningNodeMetadata?: RunningNodeMetadata;
427
+ reason: "nodeStopped" | "nodeTerminated" | "userRequested" | "unknownJob" | "jobFailed";
428
+ };
429
+
430
+ /** @public */
431
+ export declare type JobHistoryJobUpdated = {
432
+ event: "updated";
433
+ timestamp: Date;
434
+ previousJob: Job;
435
+ };
436
+
437
+ /** @public */
438
+ export declare type JobId = string;
439
+
440
+ /**
441
+ * @public
442
+ * Informational messages about a job
443
+ * */
444
+ export declare interface JobInfo {
445
+ event: "jobInfo";
446
+ jobId: JobId;
447
+ role: Role;
448
+ timestamp: Date;
449
+ message: JobInfoMessage;
450
+ }
451
+
452
+ /** @public */
453
+ declare type JobInfoComponseMessage = {
454
+ type: "composeMessage";
455
+ stage: JobInfoComposeStage;
456
+ text: string;
457
+ };
458
+
459
+ /** @public */
460
+ declare type JobInfoComposeStage = "build" | "create" | "start" | "stop" | "down";
461
+
462
+ /** @public */
463
+ declare type JobInfoContainerEvent = {
464
+ type: "containerEvent";
465
+ serviceName: string;
466
+ text: string;
467
+ };
468
+
469
+ /** @public */
470
+ declare type JobInfoMessage = JobInfoServiceStarted | JobInfoServiceRestarting | JobInfoContainerEvent | JobInfoComponseMessage;
471
+
472
+ /** @public */
473
+ declare type JobInfoServiceRestarting = {
474
+ type: "serviceRestarting";
475
+ serviceName: string;
476
+ };
477
+
478
+ /** @public */
479
+ declare type JobInfoServiceStarted = {
480
+ type: "serviceStarted";
481
+ serviceName: string;
482
+ };
483
+
484
+ /**
485
+ * @public
486
+ * List of events that can be raised by the jobList API - TODO - link
487
+ */
488
+ export declare type JobListEvent = JobUpdated | JobPending;
489
+
490
+ /**
491
+ * @public
492
+ * A job has been updated such that it no longer matches the search criteria
493
+ * */
494
+ export declare interface JobOutOfWindow {
495
+ event: "jobOutOfWindow";
496
+ jobWithHistory: JobWithHistory;
497
+ }
498
+
499
+ /**
500
+ * @public
501
+ * Job is almost ready to start - "almost" defined by property passed into
502
+ * the list functions - todo, sort out this description
503
+ * */
504
+ export declare interface JobPending {
505
+ event: "jobPending";
506
+ jobWithHistory: JobWithHistory;
507
+ }
508
+
509
+ export declare type JobRepetition = "never" | "daily" | "weekly" | "monthly";
510
+
511
+ /**
512
+ * @public
513
+ */
514
+ export declare interface JobSearchSettings {
515
+ filter: JobFilter[];
516
+ }
517
+
518
+ /** @public */
519
+ export declare type JobState = "pre" | "active" | "post";
520
+
521
+ /**
522
+ * @public
523
+ * Job details have been updated
524
+ * */
525
+ export declare interface JobUpdated {
526
+ event: "jobUpdated";
527
+ jobWithHistory: JobWithHistory;
528
+ }
529
+
530
+ /** @public */
531
+ export declare interface JobWithHistory {
532
+ job: Job;
533
+ /**
534
+ * All the events related to this job
535
+ * */
536
+ history: JobHistoryEntry[];
537
+ }
538
+
539
+ /** @public */
540
+ export declare type Log = {
541
+ level: "emergency" | "alert" | "critical" | "error" | "warning" | "notice" | "info" | "debug";
542
+ timestamp: Date;
543
+ message: string;
544
+ };
545
+
546
+ /** @public */
547
+ export declare type NodeId = string;
548
+
549
+ /**
550
+ * @public
551
+ * State of a node
552
+ */
553
+ export declare type NodeInfo = NodePending | NodeStarting | NodeRunning | NodeStopping;
554
+
555
+ /** @public */
556
+ export declare type NodeMetadata = {
557
+ nodeId: NodeId;
558
+ tags: {
559
+ [key: string]: string;
560
+ };
561
+ createdAt?: Date;
562
+ providerMetadata: ProviderMetadata;
563
+ };
564
+
565
+ /**
566
+ * @public
567
+ * A node is pending
568
+ */
569
+ export declare interface NodePending {
570
+ event: "nodePending";
571
+ nodeId: NodeId;
572
+ }
573
+
574
+ /**
575
+ * @public
576
+ * A node is running - used in initial state messages
577
+ * */
578
+ export declare interface NodeRunning {
579
+ event: "nodeRunning";
580
+ nodeMetadata: NodeMetadata;
581
+ runningNodeMetadata: RunningNodeMetadata;
582
+ instances: RunningJob[];
583
+ }
584
+
585
+ /**
586
+ * @public
587
+ * A node has started
588
+ * */
589
+ export declare type NodeStarted = {
590
+ event: "nodeStarted";
591
+ nodeMetadata: NodeMetadata;
592
+ runningNodeMetadata: RunningNodeMetadata;
593
+ };
594
+
595
+ /**
596
+ * @public
597
+ * A node is starting
598
+ * */
599
+ export declare interface NodeStarting {
600
+ event: "nodeStarting";
601
+ nodeMetadata: NodeMetadata;
602
+ }
603
+
604
+ export declare type NodeState = "starting" | "running" | "stopping" | "stopped" | "terminating" | "terminated";
605
+
606
+ /**
607
+ * @public
608
+ * A node has stopped
609
+ * */
610
+ export declare interface NodeStopped {
611
+ event: "nodeStopped";
612
+ nodeId: NodeId;
613
+ }
614
+
615
+ /**
616
+ * @public
617
+ * A node is stopping
618
+ * */
619
+ export declare interface NodeStopping {
620
+ event: "nodeStopping";
621
+ nodeId: NodeId;
622
+ reason: "createFailed" | "pendingTimeExceeded" | "startupTimeExceeded" | "initialisationHealthPingTimeExceeded" | "healthPingTimeExceeded" | "duplicateJob" | "providerStop" | "providerTerminate" | "userRequested" | "unknownNode";
623
+ }
624
+
625
+ export declare type NodeSummary = {
626
+ nodeId: NodeId;
627
+ nodeMetadata?: NodeMetadata;
628
+ runningNodeMetadata?: RunningNodeMetadata;
629
+ nodeState: NodeState;
630
+ lastActivity: Date;
631
+ };
632
+
633
+ /** @public */
634
+ export declare interface NoFilter {
635
+ filterType: "none";
636
+ }
637
+
638
+ /**
639
+ * @public
640
+ * The entrypoint for all Norsk Manager applications
641
+ *
642
+ * @example
643
+ * ```ts
644
+ * const norsk = await NorskManager.connect({ url: "localhost:6790" });
645
+ * ```
646
+ */
647
+ export declare class NorskManager {
648
+ /** @public
649
+ * Connect to the Norsk Manager
650
+ */
651
+ static connect(settings: NorskSettings): Promise<NorskManager>;
652
+ /**
653
+ * @public
654
+ * Norsk Runtime version information
655
+ */
656
+ version: VersionInfo;
657
+ /**
658
+ * @public
659
+ * Close down the Norsk connection
660
+ */
661
+ close(): void;
662
+ /**
663
+ * @public
664
+ * Create a new job
665
+ */
666
+ createJob(job: CreateJob): Promise<Job>;
667
+ /**
668
+ * @public
669
+ * Update a job
670
+ */
671
+ updateJob(job: Job): Promise<Job>;
672
+ /**
673
+ * @public
674
+ * Deletes a job
675
+ */
676
+ deleteJob(jobId: JobId): Promise<void>;
677
+ /**
678
+ * @public
679
+ * Stops a running job
680
+ */
681
+ completeJob(jobId: JobId): Promise<void>;
682
+ /**
683
+ * @public
684
+ * Spawn a new EC2 instance running the worker image, and make it available for picking up jobs
685
+ */
686
+ createAwsNode(node: AwsNodeCreate): Promise<void>;
687
+ /**
688
+ * @public
689
+ * Spawn a new OCI instance running the worker image, and make it available for picking up jobs
690
+ */
691
+ createOciNode(node: OciNodeCreate): Promise<void>;
692
+ /**
693
+ * @public
694
+ * Forcibly stop a node
695
+ */
696
+ terminateNode(nodeId: NodeId): Promise<void>;
697
+ /**
698
+ * @public
699
+ * Start a job on a node
700
+ * @param jobId - The job to start
701
+ * @param role - The role for this node, such as e.g. "primary" or "backup"
702
+ * @param nodeId - The node to start the job on
703
+ */
704
+ startJob(jobId: JobId, role: Role, nodeId: NodeId): Promise<void>;
705
+ /**
706
+ * @public
707
+ * Stop a job running on a node
708
+ * @param jobId - The job to stop
709
+ * @param role - The role for this node, such as e.g. "primary" or "backup"
710
+ * @param nodeId - The node to stop the job on
711
+ */
712
+ stopJob(jobId: JobId, role: Role, nodeId: NodeId): Promise<void>;
713
+ /**
714
+ * @public
715
+ * Provides a stream of the activity that is happening on the server-side.
716
+ * Reacting to these events is essential for the creation of client-side management logic.
717
+ */
718
+ eventStream(settings: EventStreamSettings): Promise<[EventStreamInitialState, () => void]>;
719
+ /**
720
+ * @public
721
+ * Search for jobs by id
722
+ */
723
+ jobById(id: JobId): Promise<CurrentJob | undefined>;
724
+ /**
725
+ * @public
726
+ * Search for jobs by tag/date/etc. See {@link JobSearchSettings}
727
+ */
728
+ jobSearch(settings: JobSearchSettings): Promise<CurrentJob[]>;
729
+ /**
730
+ * @public
731
+ * Return a list a all the nodes the manager knows about.
732
+ */
733
+ listNodes(): Promise<NodeInfo[]>;
734
+ }
735
+
736
+ /**
737
+ * @public
738
+ * Top level Norsk configuration
739
+ */
740
+ export declare interface NorskSettings {
741
+ /**
742
+ * Callback URL to listen on for gRPC session with Norsk Manager
743
+ *
744
+ */
745
+ url?: string;
746
+ /**
747
+ * Called when attempting a connection to the Norsk Manager
748
+ */
749
+ onAttemptingToConnect?: () => void;
750
+ /**
751
+ * Called when a connection to the Norsk Manager is being established
752
+ */
753
+ onConnecting?: () => void;
754
+ /**
755
+ * Called when a connection to the Norsk Manager is ready
756
+ */
757
+ onReady?: () => void;
758
+ /**
759
+ * Called when a connection to the Norsk Manager has failed
760
+ */
761
+ onFailedToConnect?: () => void;
762
+ /**
763
+ * Called when Norsk Manager is shutting down the connection
764
+ */
765
+ onShutdown?: () => void;
766
+ /**
767
+ * Called when receiving the version information from the Norsk Manager
768
+ * @param version - Version information
769
+ * */
770
+ onHello?: (version: VersionInfo) => void;
771
+ /**
772
+ * Called whenever a log event is received from the Norsk Manager
773
+ * @param log - Log event
774
+ * */
775
+ onLogEvent?: (log: Log) => void;
776
+ }
777
+
778
+ /** @public */
779
+ export declare type NorskVersion = "latest" | "recommended" | "previousRecommended" | "LTS";
780
+
781
+ /**
782
+ * @public
783
+ */
784
+ export declare interface OciHealth {
785
+ provider: "oci";
786
+ }
787
+
788
+ /** @public */
789
+ export declare type OciMetadata = {
790
+ provider: "oci";
791
+ };
792
+
793
+ /** @public */
794
+ export declare interface OciNodeCreate {
795
+ nodeId: NodeId;
796
+ /**
797
+ * Tags to associate with the node
798
+ */
799
+ tags: {
800
+ [key: string]: string;
801
+ };
802
+ writeFiles?: WriteFile[];
803
+ availabilityDomain: OciRegion;
804
+ architecture: string;
805
+ shape: string;
806
+ subnet: string;
807
+ workerImageVersion?: NorskVersion;
808
+ workerDaemonVersion?: NorskVersion;
809
+ }
810
+
811
+ /** @public */
812
+ export declare type OciRegion = string;
813
+
814
+ declare type PendingNode = {
815
+ timeout: Timeout;
816
+ job: AutoJob;
817
+ };
818
+
819
+ /** @public */
820
+ export declare type PhysicalNode = {
821
+ nodeType: "physical";
822
+ id: PhysicalNodeId;
823
+ tags: {
824
+ [key: string]: string;
825
+ };
826
+ ipAddress: string;
827
+ };
828
+
829
+ /**
830
+ * @public
831
+ * A physical node has connected
832
+ * */
833
+ export declare interface PhysicalNodeConnected {
834
+ event: "physicalNodeConnected";
835
+ node: PhysicalNode;
836
+ instances: RunningJob[];
837
+ }
838
+
839
+ /** @public */
840
+ export declare type PhysicalNodeId = string;
841
+
842
+ /** @public */
843
+ export declare type PortMapping = {
844
+ containerPort: ContainerPort;
845
+ protocol?: "tcp" | "udp";
846
+ hostPort: HostPort;
847
+ hostAddress?: string;
848
+ group?: string;
849
+ };
850
+
851
+ /**
852
+ * @public
853
+ */
854
+ export declare type ProviderHealth = AwsHealth | OciHealth;
855
+
856
+ /**;
857
+ * @public
858
+ * The health status of a provider has changed
859
+ * */
860
+ export declare interface ProviderHealthChange {
861
+ event: "providerHealthChange";
862
+ health: ProviderHealth;
863
+ }
864
+
865
+ /** @public */
866
+ export declare type ProviderMetadata = AwsMetadata | OciMetadata;
867
+
868
+ /** @public */
869
+ export declare type RangePort = {
870
+ type: "range";
871
+ minPort: number;
872
+ maxPort: number;
873
+ };
874
+
875
+ export declare type Region = AwsRegion | OciRegion;
876
+
877
+ export declare type Regions = {
878
+ aws?: AwsRegion[];
879
+ oci?: OciRegion[];
880
+ };
881
+
882
+ /** @public */
883
+ export declare type RestartIntensity = {
884
+ count: number;
885
+ period: number;
886
+ };
887
+
888
+ /** @public */
889
+ export declare type Role = string;
890
+
891
+ /** @public */
892
+ export declare type RunningAwsMetadata = {
893
+ provider: "aws";
894
+ instanceId: AwsInstanceId;
895
+ };
896
+
897
+ /** @public */
898
+ export declare type RunningJob = {
899
+ jobId: JobId;
900
+ role: Role;
901
+ nodeId: NodeId;
902
+ };
903
+
904
+ /** @public */
905
+ export declare type RunningNodeMetadata = {
906
+ publicDnsName: string;
907
+ privateDnsName: string;
908
+ privateIpAddress: string;
909
+ publicIpAddress: string;
910
+ providerMetadata: RunningNodeProviderMetadata;
911
+ };
912
+
913
+ /** @public */
914
+ export declare type RunningNodeProviderMetadata = RunningAwsMetadata | RunningOciMetadata;
915
+
916
+ /** @public */
917
+ export declare type RunningOciMetadata = {
918
+ provider: "oci";
919
+ };
920
+
921
+ /** @public */
922
+ export declare type Service = {
923
+ name: string;
924
+ container: ClientCode;
925
+ restart?: ServiceRestart;
926
+ dependsOn?: Set<string>;
927
+ configuration?: string;
928
+ restartIntensity?: RestartIntensity;
929
+ command?: string;
930
+ parameters?: ServiceParameters;
931
+ };
932
+
933
+ /** @public */
934
+ export declare type ServiceParameters = {
935
+ portMappings?: PortMapping[];
936
+ environmentVariables?: EnvironmentVariable[];
937
+ sharedMemorySize?: bigint;
938
+ cpuSet?: number[];
939
+ volumeMounts?: VolumeMount[];
940
+ bindMounts?: BindMount[];
941
+ };
942
+
943
+ /** @public */
944
+ export declare type ServiceRestart = "never" | "onFailure" | "always";
945
+
946
+ /** @public */
947
+ export declare type SpecificHostPort = {
948
+ type: "specific";
949
+ port: number;
950
+ };
951
+
952
+ /** @public */
953
+ export declare type StateComparison = {
954
+ comparison: "eq";
955
+ value: JobState;
956
+ } | {
957
+ comparison: "neq";
958
+ value: JobState;
959
+ };
960
+
961
+ /** @public */
962
+ export declare interface StateFilter {
963
+ filterType: "state";
964
+ comparison: StateComparison;
965
+ }
966
+
967
+ /** @public */
968
+ export declare type TagComparison = {
969
+ comparison: "eq";
970
+ value: string;
971
+ } | {
972
+ comparison: "neq";
973
+ value: string;
974
+ } | {
975
+ comparison: "re";
976
+ value: string;
977
+ } | {
978
+ comparison: "exists";
979
+ value: boolean;
980
+ };
981
+
982
+ /** @public */
983
+ export declare interface TagFilter {
984
+ filterType: "tag";
985
+ tagName: string;
986
+ comparison: TagComparison;
987
+ }
988
+
989
+ declare type Timeout = ReturnType<typeof setTimeout>;
990
+
991
+ export declare function toAwsNodeCreate(node: AwsNodeCreate): ManagerPB.CreateAwsNodeRequest;
992
+
993
+ /** internal */
994
+ export declare function toJobFilter(jobFilter: JobFilter): ManagerPB.JobFilter;
995
+
996
+ export declare function toOciNodeCreate(node: OciNodeCreate): ManagerPB.CreateOciNodeRequest;
997
+
998
+ /**
999
+ * @public
1000
+ * Norsk Manager Version information
1001
+ */
1002
+ export declare interface VersionInfo {
1003
+ /** Major version */
1004
+ majorVersion: number;
1005
+ /** Minor version */
1006
+ minorVersion: number;
1007
+ /** Build number for this version */
1008
+ buildNumber: number;
1009
+ /** Git branch at time of build */
1010
+ branchName: string;
1011
+ /** Unique identifier for this build */
1012
+ label: string;
1013
+ }
1014
+
1015
+ /** @public */
1016
+ export declare type VolumeMount = {
1017
+ volumeName: string;
1018
+ containerPath: string;
1019
+ readOnly: boolean;
1020
+ };
1021
+
1022
+ /** @public */
1023
+ export declare type WriteFile = {
1024
+ hostPath: string;
1025
+ fileContent: FileContent;
1026
+ };
1027
+
1028
+ export { }
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-12-28-2b85d1d6+nightly",
4
+ "version": "1.0.402-2025-12-30-863e6d8f+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-12-28-2b85d1d6+nightly",
8
+ "@norskvideo/norsk-api": "1.0.402-2025-12-30-863e6d8f+nightly",
9
9
  "typescript-nullable": "^0.6.0",
10
10
  "uuid": "^11.1.0"
11
11
  },