@kinotic-ai/os-api 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -40,6 +40,13 @@ var __export = (target, all) => {
40
40
  // packages/os-api/src/index.ts
41
41
  var exports_src = {};
42
42
  __export(exports_src, {
43
+ WorkloadStatus: () => WorkloadStatus,
44
+ WorkloadServiceProxy: () => WorkloadServiceProxy,
45
+ Workload: () => Workload,
46
+ VmProviderType: () => VmProviderType,
47
+ VmNodeStatus: () => VmNodeStatus,
48
+ VmNodeServiceProxy: () => VmNodeServiceProxy,
49
+ VmNode: () => VmNode,
43
50
  VersionDecorator: () => VersionDecorator,
44
51
  TimeReferenceDecorator: () => TimeReferenceDecorator,
45
52
  TextDecorator: () => TextDecorator,
@@ -259,8 +266,6 @@ class Application {
259
266
  id;
260
267
  description;
261
268
  updated = null;
262
- enableGraphQL = false;
263
- enableOpenAPI = false;
264
269
  constructor(id, description) {
265
270
  this.id = id;
266
271
  this.description = description;
@@ -284,10 +289,7 @@ class Project {
284
289
  // packages/os-api/src/api/model/ProjectType.ts
285
290
  var ProjectType;
286
291
  ((ProjectType2) => {
287
- ProjectType2[ProjectType2["TYPESCRIPT"] = 0] = "TYPESCRIPT";
288
- ProjectType2[ProjectType2["GRAPHQL"] = 1] = "GRAPHQL";
289
- ProjectType2[ProjectType2["GRAPHICAL"] = 2] = "GRAPHICAL";
290
- ProjectType2[ProjectType2["ELASTICSEARCH"] = 3] = "ELASTICSEARCH";
292
+ ProjectType2["TYPESCRIPT"] = "TYPESCRIPT";
291
293
  })(ProjectType ||= {});
292
294
  // packages/os-api/src/api/model/EntityDefinition.ts
293
295
  class EntityDefinition {
@@ -335,6 +337,72 @@ var ProgressType;
335
337
  ProgressType2["COMPLETED"] = "COMPLETED";
336
338
  ProgressType2["ERROR"] = "ERROR";
337
339
  })(ProgressType ||= {});
340
+ // packages/os-api/src/api/model/workload/WorkloadStatus.ts
341
+ var WorkloadStatus;
342
+ ((WorkloadStatus2) => {
343
+ WorkloadStatus2["PENDING"] = "PENDING";
344
+ WorkloadStatus2["STARTING"] = "STARTING";
345
+ WorkloadStatus2["RUNNING"] = "RUNNING";
346
+ WorkloadStatus2["STOPPING"] = "STOPPING";
347
+ WorkloadStatus2["STOPPED"] = "STOPPED";
348
+ WorkloadStatus2["FAILED"] = "FAILED";
349
+ })(WorkloadStatus ||= {});
350
+
351
+ // packages/os-api/src/api/model/workload/VmProviderType.ts
352
+ var VmProviderType;
353
+ ((VmProviderType2) => {
354
+ VmProviderType2["BOXLITE"] = "BOXLITE";
355
+ VmProviderType2["FIRECRACKER"] = "FIRECRACKER";
356
+ VmProviderType2["CLOUD_HYPERVISOR"] = "CLOUD_HYPERVISOR";
357
+ })(VmProviderType ||= {});
358
+
359
+ // packages/os-api/src/api/model/workload/Workload.ts
360
+ class Workload {
361
+ id = null;
362
+ name;
363
+ description;
364
+ providerType = "BOXLITE" /* BOXLITE */;
365
+ image;
366
+ vcpus = 1;
367
+ memoryMb = 512;
368
+ diskSizeMb = 1024;
369
+ status = "PENDING" /* PENDING */;
370
+ environment = {};
371
+ portMappings = {};
372
+ created = null;
373
+ updated = null;
374
+ constructor(name, image) {
375
+ this.name = name;
376
+ this.image = image;
377
+ }
378
+ }
379
+ // packages/os-api/src/api/model/workload/VmNodeStatus.ts
380
+ var VmNodeStatus;
381
+ ((VmNodeStatus2) => {
382
+ VmNodeStatus2["ONLINE"] = "ONLINE";
383
+ VmNodeStatus2["OFFLINE"] = "OFFLINE";
384
+ VmNodeStatus2["DRAINING"] = "DRAINING";
385
+ })(VmNodeStatus ||= {});
386
+
387
+ // packages/os-api/src/api/model/workload/VmNode.ts
388
+ class VmNode {
389
+ id;
390
+ name;
391
+ hostname;
392
+ status = "ONLINE" /* ONLINE */;
393
+ totalCpus = 0;
394
+ totalMemoryMb = 0;
395
+ totalDiskMb = 0;
396
+ allocatedCpus = 0;
397
+ allocatedMemoryMb = 0;
398
+ allocatedDiskMb = 0;
399
+ lastSeen = null;
400
+ constructor(id, name, hostname) {
401
+ this.id = id;
402
+ this.name = name;
403
+ this.hostname = hostname;
404
+ }
405
+ }
338
406
  // packages/os-api/src/api/services/IApplicationService.ts
339
407
  var import_core = require("@kinotic-ai/core");
340
408
 
@@ -505,6 +573,41 @@ class DataInsightsService {
505
573
  return this.serviceProxy.invokeStream("processRequest", [request]);
506
574
  }
507
575
  }
576
+ // packages/os-api/src/api/services/IVmNodeService.ts
577
+ var import_core5 = require("@kinotic-ai/core");
578
+
579
+ class VmNodeServiceProxy extends import_core5.CrudServiceProxy {
580
+ constructor(kinotic) {
581
+ super(kinotic.serviceProxy("org.kinotic.os.api.services.VmNodeService"));
582
+ }
583
+ findAvailableNode(requiredCpus, requiredMemoryMb, requiredDiskMb) {
584
+ return this.serviceProxy.invoke("findAvailableNode", [requiredCpus, requiredMemoryMb, requiredDiskMb]);
585
+ }
586
+ syncIndex() {
587
+ return this.serviceProxy.invoke("syncIndex", []);
588
+ }
589
+ }
590
+ // packages/os-api/src/api/services/IWorkloadService.ts
591
+ var import_core6 = require("@kinotic-ai/core");
592
+
593
+ class WorkloadServiceProxy extends import_core6.CrudServiceProxy {
594
+ constructor(kinotic) {
595
+ super(kinotic.serviceProxy("org.kinotic.os.api.services.WorkloadService"));
596
+ }
597
+ async findAllForNode(nodeId, pageable) {
598
+ const page = await this.findAllForNodeSinglePage(nodeId, pageable);
599
+ return new import_core6.FunctionalIterablePage(pageable, page, (pageable2) => this.findAllForNodeSinglePage(nodeId, pageable2));
600
+ }
601
+ findAllForNodeSinglePage(nodeId, pageable) {
602
+ return this.serviceProxy.invoke("findAllForNode", [nodeId, pageable]);
603
+ }
604
+ countForNode(nodeId) {
605
+ return this.serviceProxy.invoke("countForNode", [nodeId]);
606
+ }
607
+ syncIndex() {
608
+ return this.serviceProxy.invoke("syncIndex", []);
609
+ }
610
+ }
508
611
  // packages/os-api/src/api/OsApiPlugin.ts
509
612
  var OsApiPlugin = {
510
613
  install(kinotic) {
@@ -515,7 +618,9 @@ var OsApiPlugin = {
515
618
  entityDefinitions: new EntityDefinitionService(kinotic),
516
619
  namedQueriesDefinitions: new NamedQueriesDefinitionService(kinotic),
517
620
  migrations: new MigrationService(kinotic),
518
- dataInsights: new DataInsightsService(kinotic)
621
+ dataInsights: new DataInsightsService(kinotic),
622
+ vmNodes: new VmNodeServiceProxy(kinotic),
623
+ workloads: new WorkloadServiceProxy(kinotic)
519
624
  };
520
625
  }
521
626
  };
package/dist/index.d.cts CHANGED
@@ -140,16 +140,11 @@ declare class Application implements Identifiable<string> {
140
140
  id: string;
141
141
  description: string;
142
142
  updated: number | null;
143
- enableGraphQL: boolean;
144
- enableOpenAPI: boolean;
145
143
  constructor(id: string, description: string);
146
144
  }
147
145
  import { Identifiable as Identifiable2 } from "@kinotic-ai/core";
148
146
  declare enum ProjectType {
149
- TYPESCRIPT = 0,
150
- GRAPHQL = 1,
151
- GRAPHICAL = 2,
152
- ELASTICSEARCH = 3
147
+ TYPESCRIPT = "TYPESCRIPT"
153
148
  }
154
149
  declare class Project implements Identifiable2<string> {
155
150
  /**
@@ -347,6 +342,136 @@ interface InsightRequest {
347
342
  */
348
343
  additionalContext?: string;
349
344
  }
345
+ import { Identifiable as Identifiable5 } from "@kinotic-ai/core";
346
+ declare enum WorkloadStatus {
347
+ PENDING = "PENDING",
348
+ STARTING = "STARTING",
349
+ RUNNING = "RUNNING",
350
+ STOPPING = "STOPPING",
351
+ STOPPED = "STOPPED",
352
+ FAILED = "FAILED"
353
+ }
354
+ declare enum VmProviderType {
355
+ BOXLITE = "BOXLITE",
356
+ FIRECRACKER = "FIRECRACKER",
357
+ CLOUD_HYPERVISOR = "CLOUD_HYPERVISOR"
358
+ }
359
+ /**
360
+ * Represents a workload to be managed by the VM manager.
361
+ * A workload defines the configuration for a micro VM instance.
362
+ */
363
+ declare class Workload implements Identifiable5<string> {
364
+ /**
365
+ * Unique identifier for this workload.
366
+ */
367
+ id: string | null;
368
+ /**
369
+ * Human-readable name for the workload.
370
+ */
371
+ name: string;
372
+ /**
373
+ * Optional description of the workload.
374
+ */
375
+ description?: string;
376
+ /**
377
+ * The VM provider to use for this workload.
378
+ */
379
+ providerType: VmProviderType;
380
+ /**
381
+ * The image or rootfs to use for the VM.
382
+ */
383
+ image: string;
384
+ /**
385
+ * Number of vCPUs allocated to the VM.
386
+ */
387
+ vcpus: number;
388
+ /**
389
+ * Memory allocated to the VM in megabytes.
390
+ */
391
+ memoryMb: number;
392
+ /**
393
+ * Disk size allocated to the VM in megabytes.
394
+ */
395
+ diskSizeMb: number;
396
+ /**
397
+ * Current status of the workload.
398
+ */
399
+ status: WorkloadStatus;
400
+ /**
401
+ * Optional environment variables to pass to the VM.
402
+ */
403
+ environment: Record<string, string>;
404
+ /**
405
+ * Optional port mappings from host to guest (hostPort -> guestPort).
406
+ */
407
+ portMappings: Record<number, number>;
408
+ /**
409
+ * The date and time the workload was created.
410
+ */
411
+ created: number | null;
412
+ /**
413
+ * The date and time the workload was last updated.
414
+ */
415
+ updated: number | null;
416
+ constructor(name: string, image: string);
417
+ }
418
+ import { Identifiable as Identifiable6 } from "@kinotic-ai/core";
419
+ declare enum VmNodeStatus {
420
+ ONLINE = "ONLINE",
421
+ OFFLINE = "OFFLINE",
422
+ DRAINING = "DRAINING"
423
+ }
424
+ /**
425
+ * Represents a node in the cluster that is running a VmManager process
426
+ * and is capable of hosting workloads.
427
+ */
428
+ declare class VmNode implements Identifiable6<string> {
429
+ /**
430
+ * Unique identifier for this node.
431
+ */
432
+ id: string;
433
+ /**
434
+ * Human-readable name for the node.
435
+ */
436
+ name: string;
437
+ /**
438
+ * The hostname or address of the node.
439
+ */
440
+ hostname: string;
441
+ /**
442
+ * Current status of the node.
443
+ */
444
+ status: VmNodeStatus;
445
+ /**
446
+ * Total number of vCPUs available on this node.
447
+ */
448
+ totalCpus: number;
449
+ /**
450
+ * Total memory available on this node in megabytes.
451
+ */
452
+ totalMemoryMb: number;
453
+ /**
454
+ * Total disk space available on this node in megabytes.
455
+ */
456
+ totalDiskMb: number;
457
+ /**
458
+ * Number of vCPUs currently allocated to workloads.
459
+ */
460
+ allocatedCpus: number;
461
+ /**
462
+ * Memory currently allocated to workloads in megabytes.
463
+ */
464
+ allocatedMemoryMb: number;
465
+ /**
466
+ * Disk space currently allocated to workloads in megabytes.
467
+ */
468
+ allocatedDiskMb: number;
469
+ /**
470
+ * The date and time the node was last seen/heartbeat.
471
+ */
472
+ lastSeen: number | null;
473
+ constructor(id: string, name: string, hostname: string);
474
+ }
350
475
  import { IKinotic } from "@kinotic-ai/core";
351
476
  import { CrudServiceProxy, ICrudServiceProxy } from "@kinotic-ai/core";
352
477
  interface IApplicationService extends ICrudServiceProxy<Application> {
@@ -599,6 +724,56 @@ declare class DataInsightsService implements IDataInsightsService {
599
724
  constructor(kinotic: IKinotic7);
600
725
  processRequest(request: InsightRequest): Observable<InsightProgress>;
601
726
  }
727
+ import { IKinotic as IKinotic8 } from "@kinotic-ai/core";
728
+ import { CrudServiceProxy as CrudServiceProxy5, ICrudServiceProxy as ICrudServiceProxy5 } from "@kinotic-ai/core";
729
+ interface IVmNodeService extends ICrudServiceProxy5<VmNode> {
730
+ /**
731
+ * Finds a node with sufficient resources to host a workload with the given requirements.
732
+ * @param requiredCpus the number of vCPUs required
733
+ * @param requiredMemoryMb the amount of memory required in megabytes
734
+ * @param requiredDiskMb the amount of disk space required in megabytes
735
+ * @return a Promise resolving to a suitable node, or null if none available
736
+ */
737
+ findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
738
+ /**
739
+ * This operation makes all the recent writes immediately available for search.
740
+ * @return a Promise that resolves when the operation is complete
741
+ */
742
+ syncIndex(): Promise<void>;
743
+ }
744
+ declare class VmNodeServiceProxy extends CrudServiceProxy5<VmNode> implements IVmNodeService {
745
+ constructor(kinotic: IKinotic8);
746
+ findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
747
+ syncIndex(): Promise<void>;
748
+ }
749
+ import { CrudServiceProxy as CrudServiceProxy6, IKinotic as IKinotic9, ICrudServiceProxy as ICrudServiceProxy6, IterablePage as IterablePage3, Page as Page2, Pageable as Pageable3 } from "@kinotic-ai/core";
750
+ interface IWorkloadService extends ICrudServiceProxy6<Workload> {
751
+ /**
752
+ * Finds all workloads deployed on the given node.
753
+ * @param nodeId the id of the node to find workloads for
754
+ * @param pageable the page to return
755
+ * @return a Promise resolving to a page of workloads
756
+ */
757
+ findAllForNode(nodeId: string, pageable: Pageable3): Promise<IterablePage3<Workload>>;
758
+ /**
759
+ * Counts all workloads deployed on the given node.
760
+ * @param nodeId the id of the node to count workloads for
761
+ * @return a Promise resolving to the number of workloads
762
+ */
763
+ countForNode(nodeId: string): Promise<number>;
764
+ /**
765
+ * This operation makes all the recent writes immediately available for search.
766
+ * @return a Promise that resolves when the operation is complete
767
+ */
768
+ syncIndex(): Promise<void>;
769
+ }
770
+ declare class WorkloadServiceProxy extends CrudServiceProxy6<Workload> implements IWorkloadService {
771
+ constructor(kinotic: IKinotic9);
772
+ findAllForNode(nodeId: string, pageable: Pageable3): Promise<IterablePage3<Workload>>;
773
+ findAllForNodeSinglePage(nodeId: string, pageable: Pageable3): Promise<Page2<Workload>>;
774
+ countForNode(nodeId: string): Promise<number>;
775
+ syncIndex(): Promise<void>;
776
+ }
602
777
  import { KinoticPlugin } from "@kinotic-ai/core";
603
778
  interface IOsApiExtension {
604
779
  applications: IApplicationService;
@@ -608,9 +783,11 @@ interface IOsApiExtension {
608
783
  namedQueriesDefinitions: INamedQueriesDefinitionService;
609
784
  migrations: IMigrationService;
610
785
  dataInsights: IDataInsightsService;
786
+ vmNodes: IVmNodeService;
787
+ workloads: IWorkloadService;
611
788
  }
612
789
  declare const OsApiPlugin: KinoticPlugin<IOsApiExtension>;
613
790
  declare module "@kinotic-ai/core" {
614
791
  interface KinoticSingleton extends IOsApiExtension {}
615
792
  }
616
- export { VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, PageableC3Type, PageC3Type, OsApiPlugin, NotIndexedDecorator, NestedDecorator, NamedQueriesDefinitionService, NamedQueriesDefinition, MigrationService, MigrationResult, MigrationRequest, MigrationDefinition, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, InsightRequest, InsightProgress, IdDecorator, IProjectService, IOsApiExtension, INamedQueriesDefinitionService, IMigrationService, ILogManager, IEntityDefinitionService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, DiscriminatorDecorator, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, ApplicationService, Application };
793
+ export { WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, PageableC3Type, PageC3Type, OsApiPlugin, NotIndexedDecorator, NestedDecorator, NamedQueriesDefinitionService, NamedQueriesDefinition, MigrationService, MigrationResult, MigrationRequest, MigrationDefinition, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, InsightRequest, InsightProgress, IdDecorator, IWorkloadService, IVmNodeService, IProjectService, IOsApiExtension, INamedQueriesDefinitionService, IMigrationService, ILogManager, IEntityDefinitionService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, DiscriminatorDecorator, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, ApplicationService, Application };
package/dist/index.d.ts CHANGED
@@ -140,16 +140,11 @@ declare class Application implements Identifiable<string> {
140
140
  id: string;
141
141
  description: string;
142
142
  updated: number | null;
143
- enableGraphQL: boolean;
144
- enableOpenAPI: boolean;
145
143
  constructor(id: string, description: string);
146
144
  }
147
145
  import { Identifiable as Identifiable2 } from "@kinotic-ai/core";
148
146
  declare enum ProjectType {
149
- TYPESCRIPT = 0,
150
- GRAPHQL = 1,
151
- GRAPHICAL = 2,
152
- ELASTICSEARCH = 3
147
+ TYPESCRIPT = "TYPESCRIPT"
153
148
  }
154
149
  declare class Project implements Identifiable2<string> {
155
150
  /**
@@ -347,6 +342,136 @@ interface InsightRequest {
347
342
  */
348
343
  additionalContext?: string;
349
344
  }
345
+ import { Identifiable as Identifiable5 } from "@kinotic-ai/core";
346
+ declare enum WorkloadStatus {
347
+ PENDING = "PENDING",
348
+ STARTING = "STARTING",
349
+ RUNNING = "RUNNING",
350
+ STOPPING = "STOPPING",
351
+ STOPPED = "STOPPED",
352
+ FAILED = "FAILED"
353
+ }
354
+ declare enum VmProviderType {
355
+ BOXLITE = "BOXLITE",
356
+ FIRECRACKER = "FIRECRACKER",
357
+ CLOUD_HYPERVISOR = "CLOUD_HYPERVISOR"
358
+ }
359
+ /**
360
+ * Represents a workload to be managed by the VM manager.
361
+ * A workload defines the configuration for a micro VM instance.
362
+ */
363
+ declare class Workload implements Identifiable5<string> {
364
+ /**
365
+ * Unique identifier for this workload.
366
+ */
367
+ id: string | null;
368
+ /**
369
+ * Human-readable name for the workload.
370
+ */
371
+ name: string;
372
+ /**
373
+ * Optional description of the workload.
374
+ */
375
+ description?: string;
376
+ /**
377
+ * The VM provider to use for this workload.
378
+ */
379
+ providerType: VmProviderType;
380
+ /**
381
+ * The image or rootfs to use for the VM.
382
+ */
383
+ image: string;
384
+ /**
385
+ * Number of vCPUs allocated to the VM.
386
+ */
387
+ vcpus: number;
388
+ /**
389
+ * Memory allocated to the VM in megabytes.
390
+ */
391
+ memoryMb: number;
392
+ /**
393
+ * Disk size allocated to the VM in megabytes.
394
+ */
395
+ diskSizeMb: number;
396
+ /**
397
+ * Current status of the workload.
398
+ */
399
+ status: WorkloadStatus;
400
+ /**
401
+ * Optional environment variables to pass to the VM.
402
+ */
403
+ environment: Record<string, string>;
404
+ /**
405
+ * Optional port mappings from host to guest (hostPort -> guestPort).
406
+ */
407
+ portMappings: Record<number, number>;
408
+ /**
409
+ * The date and time the workload was created.
410
+ */
411
+ created: number | null;
412
+ /**
413
+ * The date and time the workload was last updated.
414
+ */
415
+ updated: number | null;
416
+ constructor(name: string, image: string);
417
+ }
418
+ import { Identifiable as Identifiable6 } from "@kinotic-ai/core";
419
+ declare enum VmNodeStatus {
420
+ ONLINE = "ONLINE",
421
+ OFFLINE = "OFFLINE",
422
+ DRAINING = "DRAINING"
423
+ }
424
+ /**
425
+ * Represents a node in the cluster that is running a VmManager process
426
+ * and is capable of hosting workloads.
427
+ */
428
+ declare class VmNode implements Identifiable6<string> {
429
+ /**
430
+ * Unique identifier for this node.
431
+ */
432
+ id: string;
433
+ /**
434
+ * Human-readable name for the node.
435
+ */
436
+ name: string;
437
+ /**
438
+ * The hostname or address of the node.
439
+ */
440
+ hostname: string;
441
+ /**
442
+ * Current status of the node.
443
+ */
444
+ status: VmNodeStatus;
445
+ /**
446
+ * Total number of vCPUs available on this node.
447
+ */
448
+ totalCpus: number;
449
+ /**
450
+ * Total memory available on this node in megabytes.
451
+ */
452
+ totalMemoryMb: number;
453
+ /**
454
+ * Total disk space available on this node in megabytes.
455
+ */
456
+ totalDiskMb: number;
457
+ /**
458
+ * Number of vCPUs currently allocated to workloads.
459
+ */
460
+ allocatedCpus: number;
461
+ /**
462
+ * Memory currently allocated to workloads in megabytes.
463
+ */
464
+ allocatedMemoryMb: number;
465
+ /**
466
+ * Disk space currently allocated to workloads in megabytes.
467
+ */
468
+ allocatedDiskMb: number;
469
+ /**
470
+ * The date and time the node was last seen/heartbeat.
471
+ */
472
+ lastSeen: number | null;
473
+ constructor(id: string, name: string, hostname: string);
474
+ }
350
475
  import { IKinotic } from "@kinotic-ai/core";
351
476
  import { CrudServiceProxy, ICrudServiceProxy } from "@kinotic-ai/core";
352
477
  interface IApplicationService extends ICrudServiceProxy<Application> {
@@ -599,6 +724,56 @@ declare class DataInsightsService implements IDataInsightsService {
599
724
  constructor(kinotic: IKinotic7);
600
725
  processRequest(request: InsightRequest): Observable<InsightProgress>;
601
726
  }
727
+ import { IKinotic as IKinotic8 } from "@kinotic-ai/core";
728
+ import { CrudServiceProxy as CrudServiceProxy5, ICrudServiceProxy as ICrudServiceProxy5 } from "@kinotic-ai/core";
729
+ interface IVmNodeService extends ICrudServiceProxy5<VmNode> {
730
+ /**
731
+ * Finds a node with sufficient resources to host a workload with the given requirements.
732
+ * @param requiredCpus the number of vCPUs required
733
+ * @param requiredMemoryMb the amount of memory required in megabytes
734
+ * @param requiredDiskMb the amount of disk space required in megabytes
735
+ * @return a Promise resolving to a suitable node, or null if none available
736
+ */
737
+ findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
738
+ /**
739
+ * This operation makes all the recent writes immediately available for search.
740
+ * @return a Promise that resolves when the operation is complete
741
+ */
742
+ syncIndex(): Promise<void>;
743
+ }
744
+ declare class VmNodeServiceProxy extends CrudServiceProxy5<VmNode> implements IVmNodeService {
745
+ constructor(kinotic: IKinotic8);
746
+ findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
747
+ syncIndex(): Promise<void>;
748
+ }
749
+ import { CrudServiceProxy as CrudServiceProxy6, IKinotic as IKinotic9, ICrudServiceProxy as ICrudServiceProxy6, IterablePage as IterablePage3, Page as Page2, Pageable as Pageable3 } from "@kinotic-ai/core";
750
+ interface IWorkloadService extends ICrudServiceProxy6<Workload> {
751
+ /**
752
+ * Finds all workloads deployed on the given node.
753
+ * @param nodeId the id of the node to find workloads for
754
+ * @param pageable the page to return
755
+ * @return a Promise resolving to a page of workloads
756
+ */
757
+ findAllForNode(nodeId: string, pageable: Pageable3): Promise<IterablePage3<Workload>>;
758
+ /**
759
+ * Counts all workloads deployed on the given node.
760
+ * @param nodeId the id of the node to count workloads for
761
+ * @return a Promise resolving to the number of workloads
762
+ */
763
+ countForNode(nodeId: string): Promise<number>;
764
+ /**
765
+ * This operation makes all the recent writes immediately available for search.
766
+ * @return a Promise that resolves when the operation is complete
767
+ */
768
+ syncIndex(): Promise<void>;
769
+ }
770
+ declare class WorkloadServiceProxy extends CrudServiceProxy6<Workload> implements IWorkloadService {
771
+ constructor(kinotic: IKinotic9);
772
+ findAllForNode(nodeId: string, pageable: Pageable3): Promise<IterablePage3<Workload>>;
773
+ findAllForNodeSinglePage(nodeId: string, pageable: Pageable3): Promise<Page2<Workload>>;
774
+ countForNode(nodeId: string): Promise<number>;
775
+ syncIndex(): Promise<void>;
776
+ }
602
777
  import { KinoticPlugin } from "@kinotic-ai/core";
603
778
  interface IOsApiExtension {
604
779
  applications: IApplicationService;
@@ -608,9 +783,11 @@ interface IOsApiExtension {
608
783
  namedQueriesDefinitions: INamedQueriesDefinitionService;
609
784
  migrations: IMigrationService;
610
785
  dataInsights: IDataInsightsService;
786
+ vmNodes: IVmNodeService;
787
+ workloads: IWorkloadService;
611
788
  }
612
789
  declare const OsApiPlugin: KinoticPlugin<IOsApiExtension>;
613
790
  declare module "@kinotic-ai/core" {
614
791
  interface KinoticSingleton extends IOsApiExtension {}
615
792
  }
616
- export { VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, PageableC3Type, PageC3Type, OsApiPlugin, NotIndexedDecorator, NestedDecorator, NamedQueriesDefinitionService, NamedQueriesDefinition, MigrationService, MigrationResult, MigrationRequest, MigrationDefinition, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, InsightRequest, InsightProgress, IdDecorator, IProjectService, IOsApiExtension, INamedQueriesDefinitionService, IMigrationService, ILogManager, IEntityDefinitionService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, DiscriminatorDecorator, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, ApplicationService, Application };
793
+ export { WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, PageableC3Type, PageC3Type, OsApiPlugin, NotIndexedDecorator, NestedDecorator, NamedQueriesDefinitionService, NamedQueriesDefinition, MigrationService, MigrationResult, MigrationRequest, MigrationDefinition, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, InsightRequest, InsightProgress, IdDecorator, IWorkloadService, IVmNodeService, IProjectService, IOsApiExtension, INamedQueriesDefinitionService, IMigrationService, ILogManager, IEntityDefinitionService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, DiscriminatorDecorator, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, ApplicationService, Application };
package/dist/index.js CHANGED
@@ -178,8 +178,6 @@ class Application {
178
178
  id;
179
179
  description;
180
180
  updated = null;
181
- enableGraphQL = false;
182
- enableOpenAPI = false;
183
181
  constructor(id, description) {
184
182
  this.id = id;
185
183
  this.description = description;
@@ -203,10 +201,7 @@ class Project {
203
201
  // packages/os-api/src/api/model/ProjectType.ts
204
202
  var ProjectType;
205
203
  ((ProjectType2) => {
206
- ProjectType2[ProjectType2["TYPESCRIPT"] = 0] = "TYPESCRIPT";
207
- ProjectType2[ProjectType2["GRAPHQL"] = 1] = "GRAPHQL";
208
- ProjectType2[ProjectType2["GRAPHICAL"] = 2] = "GRAPHICAL";
209
- ProjectType2[ProjectType2["ELASTICSEARCH"] = 3] = "ELASTICSEARCH";
204
+ ProjectType2["TYPESCRIPT"] = "TYPESCRIPT";
210
205
  })(ProjectType ||= {});
211
206
  // packages/os-api/src/api/model/EntityDefinition.ts
212
207
  class EntityDefinition {
@@ -254,6 +249,72 @@ var ProgressType;
254
249
  ProgressType2["COMPLETED"] = "COMPLETED";
255
250
  ProgressType2["ERROR"] = "ERROR";
256
251
  })(ProgressType ||= {});
252
+ // packages/os-api/src/api/model/workload/WorkloadStatus.ts
253
+ var WorkloadStatus;
254
+ ((WorkloadStatus2) => {
255
+ WorkloadStatus2["PENDING"] = "PENDING";
256
+ WorkloadStatus2["STARTING"] = "STARTING";
257
+ WorkloadStatus2["RUNNING"] = "RUNNING";
258
+ WorkloadStatus2["STOPPING"] = "STOPPING";
259
+ WorkloadStatus2["STOPPED"] = "STOPPED";
260
+ WorkloadStatus2["FAILED"] = "FAILED";
261
+ })(WorkloadStatus ||= {});
262
+
263
+ // packages/os-api/src/api/model/workload/VmProviderType.ts
264
+ var VmProviderType;
265
+ ((VmProviderType2) => {
266
+ VmProviderType2["BOXLITE"] = "BOXLITE";
267
+ VmProviderType2["FIRECRACKER"] = "FIRECRACKER";
268
+ VmProviderType2["CLOUD_HYPERVISOR"] = "CLOUD_HYPERVISOR";
269
+ })(VmProviderType ||= {});
270
+
271
+ // packages/os-api/src/api/model/workload/Workload.ts
272
+ class Workload {
273
+ id = null;
274
+ name;
275
+ description;
276
+ providerType = "BOXLITE" /* BOXLITE */;
277
+ image;
278
+ vcpus = 1;
279
+ memoryMb = 512;
280
+ diskSizeMb = 1024;
281
+ status = "PENDING" /* PENDING */;
282
+ environment = {};
283
+ portMappings = {};
284
+ created = null;
285
+ updated = null;
286
+ constructor(name, image) {
287
+ this.name = name;
288
+ this.image = image;
289
+ }
290
+ }
291
+ // packages/os-api/src/api/model/workload/VmNodeStatus.ts
292
+ var VmNodeStatus;
293
+ ((VmNodeStatus2) => {
294
+ VmNodeStatus2["ONLINE"] = "ONLINE";
295
+ VmNodeStatus2["OFFLINE"] = "OFFLINE";
296
+ VmNodeStatus2["DRAINING"] = "DRAINING";
297
+ })(VmNodeStatus ||= {});
298
+
299
+ // packages/os-api/src/api/model/workload/VmNode.ts
300
+ class VmNode {
301
+ id;
302
+ name;
303
+ hostname;
304
+ status = "ONLINE" /* ONLINE */;
305
+ totalCpus = 0;
306
+ totalMemoryMb = 0;
307
+ totalDiskMb = 0;
308
+ allocatedCpus = 0;
309
+ allocatedMemoryMb = 0;
310
+ allocatedDiskMb = 0;
311
+ lastSeen = null;
312
+ constructor(id, name, hostname) {
313
+ this.id = id;
314
+ this.name = name;
315
+ this.hostname = hostname;
316
+ }
317
+ }
257
318
  // packages/os-api/src/api/services/IApplicationService.ts
258
319
  import { CrudServiceProxy } from "@kinotic-ai/core";
259
320
 
@@ -424,6 +485,41 @@ class DataInsightsService {
424
485
  return this.serviceProxy.invokeStream("processRequest", [request]);
425
486
  }
426
487
  }
488
+ // packages/os-api/src/api/services/IVmNodeService.ts
489
+ import { CrudServiceProxy as CrudServiceProxy5 } from "@kinotic-ai/core";
490
+
491
+ class VmNodeServiceProxy extends CrudServiceProxy5 {
492
+ constructor(kinotic) {
493
+ super(kinotic.serviceProxy("org.kinotic.os.api.services.VmNodeService"));
494
+ }
495
+ findAvailableNode(requiredCpus, requiredMemoryMb, requiredDiskMb) {
496
+ return this.serviceProxy.invoke("findAvailableNode", [requiredCpus, requiredMemoryMb, requiredDiskMb]);
497
+ }
498
+ syncIndex() {
499
+ return this.serviceProxy.invoke("syncIndex", []);
500
+ }
501
+ }
502
+ // packages/os-api/src/api/services/IWorkloadService.ts
503
+ import { CrudServiceProxy as CrudServiceProxy6, FunctionalIterablePage as FunctionalIterablePage3 } from "@kinotic-ai/core";
504
+
505
+ class WorkloadServiceProxy extends CrudServiceProxy6 {
506
+ constructor(kinotic) {
507
+ super(kinotic.serviceProxy("org.kinotic.os.api.services.WorkloadService"));
508
+ }
509
+ async findAllForNode(nodeId, pageable) {
510
+ const page = await this.findAllForNodeSinglePage(nodeId, pageable);
511
+ return new FunctionalIterablePage3(pageable, page, (pageable2) => this.findAllForNodeSinglePage(nodeId, pageable2));
512
+ }
513
+ findAllForNodeSinglePage(nodeId, pageable) {
514
+ return this.serviceProxy.invoke("findAllForNode", [nodeId, pageable]);
515
+ }
516
+ countForNode(nodeId) {
517
+ return this.serviceProxy.invoke("countForNode", [nodeId]);
518
+ }
519
+ syncIndex() {
520
+ return this.serviceProxy.invoke("syncIndex", []);
521
+ }
522
+ }
427
523
  // packages/os-api/src/api/OsApiPlugin.ts
428
524
  var OsApiPlugin = {
429
525
  install(kinotic) {
@@ -434,11 +530,20 @@ var OsApiPlugin = {
434
530
  entityDefinitions: new EntityDefinitionService(kinotic),
435
531
  namedQueriesDefinitions: new NamedQueriesDefinitionService(kinotic),
436
532
  migrations: new MigrationService(kinotic),
437
- dataInsights: new DataInsightsService(kinotic)
533
+ dataInsights: new DataInsightsService(kinotic),
534
+ vmNodes: new VmNodeServiceProxy(kinotic),
535
+ workloads: new WorkloadServiceProxy(kinotic)
438
536
  };
439
537
  }
440
538
  };
441
539
  export {
540
+ WorkloadStatus,
541
+ WorkloadServiceProxy,
542
+ Workload,
543
+ VmProviderType,
544
+ VmNodeStatus,
545
+ VmNodeServiceProxy,
546
+ VmNode,
442
547
  VersionDecorator,
443
548
  TimeReferenceDecorator,
444
549
  TextDecorator,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinotic-ai/os-api",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@kinotic-ai/idl": "1.0.9",
40
- "@kinotic-ai/persistence": "1.0.10",
40
+ "@kinotic-ai/persistence": "1.1.0",
41
41
  "rxjs": "^7.8.2"
42
42
  },
43
43
  "devDependencies": {