@zgeoff/imp-client 0.18.0 → 0.20.0

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.d.ts CHANGED
@@ -4614,9 +4614,208 @@ declare const impContract: {
4614
4614
  xfs: "xfs";
4615
4615
  zfs: "zfs";
4616
4616
  }>>;
4617
+ target: z.ZodOptional<z.ZodObject<{
4618
+ firecrackerVersion: z.ZodString;
4619
+ snapshotVersion: z.ZodString;
4620
+ hostKernel: z.ZodString;
4621
+ cpuModel: z.ZodString;
4622
+ cpuFlags: z.ZodString;
4623
+ dataDir: z.ZodString;
4624
+ storage: z.ZodEnum<{
4625
+ xfs: "xfs";
4626
+ zfs: "zfs";
4627
+ }>;
4628
+ subnet: z.ZodString;
4629
+ slotCount: z.ZodInt;
4630
+ brokerPort: z.ZodInt;
4631
+ dns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
4632
+ }, z.core.$strip>>;
4617
4633
  }, z.core.$strip>, z.ZodObject<{
4618
4634
  bytes: z.ZodInt;
4619
4635
  checkpoints: z.ZodInt;
4636
+ warm: z.ZodNullable<z.ZodObject<{
4637
+ slot: z.ZodInt;
4638
+ egressMode: z.ZodString;
4639
+ snapshot: z.ZodObject<{
4640
+ firecrackerVersion: z.ZodString;
4641
+ snapshotVersion: z.ZodString;
4642
+ hostKernel: z.ZodString;
4643
+ cpuModel: z.ZodNullable<z.ZodString>;
4644
+ cpuFlags: z.ZodNullable<z.ZodString>;
4645
+ ipv6Prefix: z.ZodNullable<z.ZodString>;
4646
+ }, z.core.$strip>;
4647
+ host: z.ZodObject<{
4648
+ dataDir: z.ZodString;
4649
+ storage: z.ZodEnum<{
4650
+ xfs: "xfs";
4651
+ zfs: "zfs";
4652
+ }>;
4653
+ subnet: z.ZodString;
4654
+ brokerPort: z.ZodInt;
4655
+ dns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
4656
+ }, z.core.$strip>;
4657
+ }, z.core.$strip>>;
4658
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4659
+ NOT_FOUND: {
4660
+ readonly message: "Not found";
4661
+ readonly data: z.ZodObject<{
4662
+ kind: z.ZodEnum<{
4663
+ backup: "backup";
4664
+ checkpoint: "checkpoint";
4665
+ grant: "grant";
4666
+ image: "image";
4667
+ imp: "imp";
4668
+ network: "network";
4669
+ secret: "secret";
4670
+ service: "service";
4671
+ session: "session";
4672
+ "ssh-key": "ssh-key";
4673
+ token: "token";
4674
+ }>;
4675
+ name: z.ZodString;
4676
+ }, z.core.$strip>;
4677
+ };
4678
+ CONFLICT: {
4679
+ readonly message: "Already exists";
4680
+ readonly data: z.ZodObject<{
4681
+ kind: z.ZodEnum<{
4682
+ backup: "backup";
4683
+ checkpoint: "checkpoint";
4684
+ grant: "grant";
4685
+ image: "image";
4686
+ imp: "imp";
4687
+ network: "network";
4688
+ secret: "secret";
4689
+ service: "service";
4690
+ session: "session";
4691
+ "ssh-key": "ssh-key";
4692
+ token: "token";
4693
+ }>;
4694
+ name: z.ZodString;
4695
+ }, z.core.$strip>;
4696
+ };
4697
+ FORBIDDEN: {
4698
+ readonly message: "Not allowed";
4699
+ };
4700
+ PRECONDITION_FAILED: {
4701
+ readonly message: "Not possible on this host";
4702
+ };
4703
+ RAM_BUDGET_EXCEEDED: {
4704
+ readonly message: "Not enough RAM budget, even after sleeping idle imps";
4705
+ readonly status: 503;
4706
+ readonly data: z.ZodObject<{
4707
+ budgetMib: z.ZodInt;
4708
+ usedMib: z.ZodInt;
4709
+ requestedMib: z.ZodInt;
4710
+ neededMib: z.ZodOptional<z.ZodInt>;
4711
+ protected: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
4712
+ name: z.ZodString;
4713
+ ramMib: z.ZodInt;
4714
+ leased: z.ZodBoolean;
4715
+ busy: z.ZodBoolean;
4716
+ }, z.core.$strip>>>>;
4717
+ protectedHidden: z.ZodOptional<z.ZodInt>;
4718
+ }, z.core.$strip>;
4719
+ };
4720
+ SERVICE_UNAVAILABLE: {
4721
+ readonly message: "impd is stopping";
4722
+ };
4723
+ INVALID_STATE: {
4724
+ readonly message: "The imp is not in a state that allows this";
4725
+ readonly status: 409;
4726
+ readonly data: z.ZodObject<{
4727
+ state: z.ZodEnum<{
4728
+ creating: "creating";
4729
+ error: "error";
4730
+ running: "running";
4731
+ sleeping: "sleeping";
4732
+ stopped: "stopped";
4733
+ }>;
4734
+ allowed: z.ZodArray<z.ZodEnum<{
4735
+ creating: "creating";
4736
+ error: "error";
4737
+ running: "running";
4738
+ sleeping: "sleeping";
4739
+ stopped: "stopped";
4740
+ }>>;
4741
+ coldBoots: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
4742
+ bootId: z.ZodString;
4743
+ cause: z.ZodEnum<{
4744
+ recovery: "recovery";
4745
+ restore: "restore";
4746
+ start: "start";
4747
+ unknown: "unknown";
4748
+ wake_fallback: "wake_fallback";
4749
+ watchdog: "watchdog";
4750
+ }>;
4751
+ at: z.ZodISODateTime;
4752
+ }, z.core.$strip>>>>>;
4753
+ }, z.core.$strip>;
4754
+ };
4755
+ INVALID_RESUME: {
4756
+ readonly message: "The resume offset is past the end of the output";
4757
+ readonly status: 409;
4758
+ readonly data: z.ZodReadonly<z.ZodObject<{
4759
+ end: z.ZodInt;
4760
+ bufferStart: z.ZodInt;
4761
+ }, z.core.$strip>>;
4762
+ };
4763
+ DISK_FULL: {
4764
+ readonly message: "Not enough free disk on the host";
4765
+ readonly status: 507;
4766
+ readonly data: z.ZodObject<{
4767
+ availableBytes: z.ZodInt;
4768
+ reserveBytes: z.ZodInt;
4769
+ requestedBytes: z.ZodInt;
4770
+ }, z.core.$strip>;
4771
+ };
4772
+ LEASED: {
4773
+ readonly message: "The imp is leased";
4774
+ readonly status: 409;
4775
+ readonly data: z.ZodObject<{
4776
+ leases: z.ZodReadonly<z.ZodArray<z.ZodObject<{
4777
+ name: z.ZodString;
4778
+ owner: z.ZodObject<{
4779
+ principal: z.ZodString;
4780
+ display: z.ZodString;
4781
+ label: z.ZodString;
4782
+ }, z.core.$strip>;
4783
+ until: z.ZodNullable<z.ZodDate>;
4784
+ }, z.core.$strip>>>;
4785
+ otherCount: z.ZodInt;
4786
+ }, z.core.$strip>;
4787
+ };
4788
+ LEASE_NOT_HELD: {
4789
+ readonly message: "The caller holds no such lease";
4790
+ readonly status: 409;
4791
+ };
4792
+ AGENT_OUTDATED: {
4793
+ readonly message: "The imp's agent is too old for this";
4794
+ readonly status: 409;
4795
+ };
4796
+ MOVING: {
4797
+ readonly message: "The imp is moving between hosts";
4798
+ readonly status: 409;
4799
+ readonly data: z.ZodObject<{
4800
+ retryAfterS: z.ZodInt;
4801
+ }, z.core.$strip>;
4802
+ };
4803
+ }>, Record<never, never>>;
4804
+ facts: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
4805
+ firecrackerVersion: z.ZodString;
4806
+ snapshotVersion: z.ZodString;
4807
+ hostKernel: z.ZodString;
4808
+ cpuModel: z.ZodString;
4809
+ cpuFlags: z.ZodString;
4810
+ dataDir: z.ZodString;
4811
+ storage: z.ZodEnum<{
4812
+ xfs: "xfs";
4813
+ zfs: "zfs";
4814
+ }>;
4815
+ subnet: z.ZodString;
4816
+ slotCount: z.ZodInt;
4817
+ brokerPort: z.ZodInt;
4818
+ dns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
4620
4819
  }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4621
4820
  NOT_FOUND: {
4622
4821
  readonly message: "Not found";
@@ -4766,6 +4965,28 @@ declare const impContract: {
4766
4965
  receive: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4767
4966
  name: z.ZodString;
4768
4967
  bytes: z.ZodInt;
4968
+ warm: z.ZodOptional<z.ZodObject<{
4969
+ slot: z.ZodInt;
4970
+ egressMode: z.ZodString;
4971
+ snapshot: z.ZodObject<{
4972
+ firecrackerVersion: z.ZodString;
4973
+ snapshotVersion: z.ZodString;
4974
+ hostKernel: z.ZodString;
4975
+ cpuModel: z.ZodNullable<z.ZodString>;
4976
+ cpuFlags: z.ZodNullable<z.ZodString>;
4977
+ ipv6Prefix: z.ZodNullable<z.ZodString>;
4978
+ }, z.core.$strip>;
4979
+ host: z.ZodObject<{
4980
+ dataDir: z.ZodString;
4981
+ storage: z.ZodEnum<{
4982
+ xfs: "xfs";
4983
+ zfs: "zfs";
4984
+ }>;
4985
+ subnet: z.ZodString;
4986
+ brokerPort: z.ZodInt;
4987
+ dns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
4988
+ }, z.core.$strip>;
4989
+ }, z.core.$strip>>;
4769
4990
  }, z.core.$strip>, z.ZodObject<{
4770
4991
  ticket: z.ZodString;
4771
4992
  expiresAt: z.ZodDate;
@@ -11878,6 +12099,7 @@ declare const impContract: {
11878
12099
  ramUsedMib: z.ZodInt;
11879
12100
  ramReservedMib: z.ZodInt;
11880
12101
  ramCommittedMib: z.ZodInt;
12102
+ ramSleepingMib: z.ZodOptional<z.ZodInt>;
11881
12103
  awakeCount: z.ZodInt;
11882
12104
  impCount: z.ZodInt;
11883
12105
  sessionCount: z.ZodInt;
@@ -11927,6 +12149,13 @@ declare const impContract: {
11927
12149
  hostCpus: z.ZodInt;
11928
12150
  limitsEnforced: z.ZodBoolean;
11929
12151
  }, z.core.$strip>>;
12152
+ defaults: z.ZodOptional<z.ZodObject<{
12153
+ memoryMib: z.ZodInt;
12154
+ image: z.ZodNullable<z.ZodString>;
12155
+ }, z.core.$strip>>;
12156
+ egress: z.ZodOptional<z.ZodObject<{
12157
+ isEnforced: z.ZodBoolean;
12158
+ }, z.core.$strip>>;
11930
12159
  public: z.ZodOptional<z.ZodNullable<z.ZodObject<{
11931
12160
  ip: z.ZodIPv4;
11932
12161
  imps: z.ZodInt;
@@ -13454,6 +13683,7 @@ declare const SystemInfoSchema: z.ZodObject<{
13454
13683
  ramUsedMib: z.ZodInt;
13455
13684
  ramReservedMib: z.ZodInt;
13456
13685
  ramCommittedMib: z.ZodInt;
13686
+ ramSleepingMib: z.ZodOptional<z.ZodInt>;
13457
13687
  awakeCount: z.ZodInt;
13458
13688
  impCount: z.ZodInt;
13459
13689
  sessionCount: z.ZodInt;
@@ -13503,6 +13733,13 @@ declare const SystemInfoSchema: z.ZodObject<{
13503
13733
  hostCpus: z.ZodInt;
13504
13734
  limitsEnforced: z.ZodBoolean;
13505
13735
  }, z.core.$strip>>;
13736
+ defaults: z.ZodOptional<z.ZodObject<{
13737
+ memoryMib: z.ZodInt;
13738
+ image: z.ZodNullable<z.ZodString>;
13739
+ }, z.core.$strip>>;
13740
+ egress: z.ZodOptional<z.ZodObject<{
13741
+ isEnforced: z.ZodBoolean;
13742
+ }, z.core.$strip>>;
13506
13743
  public: z.ZodOptional<z.ZodNullable<z.ZodObject<{
13507
13744
  ip: z.ZodIPv4;
13508
13745
  imps: z.ZodInt;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { RPCLink } from "@orpc/client/fetch";
3
3
  import * as z from "zod";
4
4
  //#endregion
5
5
  //#region src/check-server.ts
6
- const CLIENT_VERSION = "0.18.0";
6
+ const CLIENT_VERSION = "0.20.0";
7
7
  async function checkServer(rpc) {
8
8
  const info = await rpc.system.info();
9
9
  return {
@@ -74,9 +74,42 @@ const MoveStateSchema = z.enum([
74
74
  "receiving"
75
75
  ]);
76
76
  const PeerUrlSchema = z.url({ protocol: /^https?$/ });
77
+ const WarmHostSchema = z.object({
78
+ firecrackerVersion: z.string(),
79
+ snapshotVersion: z.string(),
80
+ hostKernel: z.string(),
81
+ cpuModel: z.string(),
82
+ cpuFlags: z.string(),
83
+ dataDir: z.string(),
84
+ storage: z.enum(["xfs", "zfs"]),
85
+ subnet: z.string(),
86
+ slotCount: z.int().positive(),
87
+ brokerPort: z.int().positive(),
88
+ dns: z.array(z.string()).readonly()
89
+ });
90
+ const WarmMoveSchema = z.object({
91
+ slot: z.int().nonnegative(),
92
+ egressMode: z.string(),
93
+ snapshot: z.object({
94
+ firecrackerVersion: z.string(),
95
+ snapshotVersion: z.string(),
96
+ hostKernel: z.string(),
97
+ cpuModel: z.string().nullable(),
98
+ cpuFlags: z.string().nullable(),
99
+ ipv6Prefix: z.string().nullable()
100
+ }),
101
+ host: WarmHostSchema.pick({
102
+ dataDir: true,
103
+ storage: true,
104
+ subnet: true,
105
+ brokerPort: true,
106
+ dns: true
107
+ })
108
+ });
77
109
  z.object({
78
110
  bytes: z.int().nonnegative(),
79
- checkpoints: z.int().nonnegative()
111
+ checkpoints: z.int().nonnegative(),
112
+ warm: WarmMoveSchema.nullable()
80
113
  });
81
114
  z.object({
82
115
  ticket: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgeoff/imp-client",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Typed client for impd, the imp host daemon: imps, checkpoints, images and exec",
5
5
  "license": "MIT",
6
6
  "repository": {