@impz/client 2.3.0 → 2.4.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/dist/index.d.ts CHANGED
@@ -16771,6 +16771,206 @@ declare const impContract: {
16771
16771
  }, z.core.$strip>;
16772
16772
  };
16773
16773
  }>, Record<never, never>>;
16774
+ features: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
16775
+ version: z.ZodString;
16776
+ features: z.ZodObject<{
16777
+ sessionOffsets: z.ZodBoolean;
16778
+ leases: z.ZodBoolean;
16779
+ grantableTokens: z.ZodOptional<z.ZodBoolean>;
16780
+ secretRebind: z.ZodOptional<z.ZodBoolean>;
16781
+ tokenUpdate: z.ZodOptional<z.ZodBoolean>;
16782
+ tokenImageAdd: z.ZodOptional<z.ZodBoolean>;
16783
+ databaseCopy: z.ZodOptional<z.ZodBoolean>;
16784
+ imageBuildStream: z.ZodOptional<z.ZodBoolean>;
16785
+ imageOpStream: z.ZodOptional<z.ZodBoolean>;
16786
+ imageBuilds: z.ZodOptional<z.ZodBoolean>;
16787
+ execRequire: z.ZodOptional<z.ZodBoolean>;
16788
+ oauthGrants: z.ZodOptional<z.ZodBoolean>;
16789
+ secretFilesGc: z.ZodOptional<z.ZodBoolean>;
16790
+ sessionLog: z.ZodOptional<z.ZodBoolean>;
16791
+ publicEgress: z.ZodOptional<z.ZodBoolean>;
16792
+ oauthSecrets: z.ZodOptional<z.ZodBoolean>;
16793
+ secretUpstream: z.ZodOptional<z.ZodBoolean>;
16794
+ backupOptOut: z.ZodOptional<z.ZodBoolean>;
16795
+ brokerRefusals: z.ZodOptional<z.ZodBoolean>;
16796
+ grantFilters: z.ZodOptional<z.ZodBoolean>;
16797
+ readOnlyFiles: z.ZodOptional<z.ZodBoolean>;
16798
+ execDropSysAdmin: z.ZodOptional<z.ZodBoolean>;
16799
+ }, z.core.$strip>;
16800
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
16801
+ NOT_FOUND: {
16802
+ readonly message: "Not found";
16803
+ readonly data: z.ZodObject<{
16804
+ kind: z.ZodEnum<{
16805
+ backup: "backup";
16806
+ checkpoint: "checkpoint";
16807
+ "database-copy": "database-copy";
16808
+ grant: "grant";
16809
+ image: "image";
16810
+ imp: "imp";
16811
+ network: "network";
16812
+ "oauth-approval": "oauth-approval";
16813
+ "oauth-client": "oauth-client";
16814
+ "oauth-grant": "oauth-grant";
16815
+ secret: "secret";
16816
+ service: "service";
16817
+ session: "session";
16818
+ "ssh-key": "ssh-key";
16819
+ token: "token";
16820
+ }>;
16821
+ name: z.ZodString;
16822
+ reason: z.ZodOptional<z.ZodEnum<{
16823
+ binding_changed: "binding_changed";
16824
+ }>>;
16825
+ }, z.core.$strip>;
16826
+ };
16827
+ CONFLICT: {
16828
+ readonly message: "Already exists";
16829
+ readonly data: z.ZodObject<{
16830
+ kind: z.ZodEnum<{
16831
+ backup: "backup";
16832
+ checkpoint: "checkpoint";
16833
+ "database-copy": "database-copy";
16834
+ grant: "grant";
16835
+ image: "image";
16836
+ imp: "imp";
16837
+ network: "network";
16838
+ "oauth-approval": "oauth-approval";
16839
+ "oauth-client": "oauth-client";
16840
+ "oauth-grant": "oauth-grant";
16841
+ secret: "secret";
16842
+ service: "service";
16843
+ session: "session";
16844
+ "ssh-key": "ssh-key";
16845
+ token: "token";
16846
+ }>;
16847
+ name: z.ZodString;
16848
+ reason: z.ZodOptional<z.ZodEnum<{
16849
+ binding_changed: "binding_changed";
16850
+ }>>;
16851
+ }, z.core.$strip>;
16852
+ };
16853
+ FORBIDDEN: {
16854
+ readonly message: "Not allowed";
16855
+ readonly data: z.ZodOptional<z.ZodObject<{
16856
+ reason: z.ZodEnum<{
16857
+ imp_out_of_scope: "imp_out_of_scope";
16858
+ not_grantable: "not_grantable";
16859
+ scope: "scope";
16860
+ }>;
16861
+ }, z.core.$strip>>;
16862
+ };
16863
+ PRECONDITION_FAILED: {
16864
+ readonly message: "Not possible on this host";
16865
+ readonly data: z.ZodOptional<z.ZodObject<{
16866
+ reason: z.ZodEnum<{
16867
+ broker_not_ready: "broker_not_ready";
16868
+ impd_outdated: "impd_outdated";
16869
+ }>;
16870
+ detail: z.ZodString;
16871
+ }, z.core.$strip>>;
16872
+ };
16873
+ RAM_BUDGET_EXCEEDED: {
16874
+ readonly message: "Not enough RAM budget, even after sleeping idle imps";
16875
+ readonly status: 503;
16876
+ readonly data: z.ZodObject<{
16877
+ budgetMib: z.ZodInt;
16878
+ usedMib: z.ZodInt;
16879
+ requestedMib: z.ZodInt;
16880
+ neededMib: z.ZodOptional<z.ZodInt>;
16881
+ protected: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
16882
+ name: z.ZodString;
16883
+ ramMib: z.ZodInt;
16884
+ leased: z.ZodBoolean;
16885
+ busy: z.ZodBoolean;
16886
+ }, z.core.$strip>>>>;
16887
+ protectedHidden: z.ZodOptional<z.ZodInt>;
16888
+ }, z.core.$strip>;
16889
+ };
16890
+ SERVICE_UNAVAILABLE: {
16891
+ readonly message: "impd is stopping";
16892
+ };
16893
+ INVALID_STATE: {
16894
+ readonly message: "The imp is not in a state that allows this";
16895
+ readonly status: 409;
16896
+ readonly data: z.ZodObject<{
16897
+ state: z.ZodEnum<{
16898
+ creating: "creating";
16899
+ error: "error";
16900
+ running: "running";
16901
+ sleeping: "sleeping";
16902
+ stopped: "stopped";
16903
+ }>;
16904
+ allowed: z.ZodArray<z.ZodEnum<{
16905
+ creating: "creating";
16906
+ error: "error";
16907
+ running: "running";
16908
+ sleeping: "sleeping";
16909
+ stopped: "stopped";
16910
+ }>>;
16911
+ coldBoots: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
16912
+ bootId: z.ZodString;
16913
+ cause: z.ZodEnum<{
16914
+ recovery: "recovery";
16915
+ restore: "restore";
16916
+ start: "start";
16917
+ unknown: "unknown";
16918
+ wake_fallback: "wake_fallback";
16919
+ watchdog: "watchdog";
16920
+ }>;
16921
+ at: z.ZodISODateTime;
16922
+ }, z.core.$strip>>>>>;
16923
+ }, z.core.$strip>;
16924
+ };
16925
+ INVALID_RESUME: {
16926
+ readonly message: "The resume offset is past the end of the output";
16927
+ readonly status: 409;
16928
+ readonly data: z.ZodReadonly<z.ZodObject<{
16929
+ end: z.ZodInt;
16930
+ bufferStart: z.ZodInt;
16931
+ }, z.core.$strip>>;
16932
+ };
16933
+ DISK_FULL: {
16934
+ readonly message: "Not enough free disk on the host";
16935
+ readonly status: 507;
16936
+ readonly data: z.ZodObject<{
16937
+ availableBytes: z.ZodInt;
16938
+ reserveBytes: z.ZodInt;
16939
+ requestedBytes: z.ZodInt;
16940
+ }, z.core.$strip>;
16941
+ };
16942
+ LEASED: {
16943
+ readonly message: "The imp is leased";
16944
+ readonly status: 409;
16945
+ readonly data: z.ZodObject<{
16946
+ leases: z.ZodReadonly<z.ZodArray<z.ZodObject<{
16947
+ name: z.ZodString;
16948
+ owner: z.ZodObject<{
16949
+ principal: z.ZodString;
16950
+ display: z.ZodString;
16951
+ label: z.ZodString;
16952
+ }, z.core.$strip>;
16953
+ until: z.ZodNullable<z.ZodDate>;
16954
+ }, z.core.$strip>>>;
16955
+ otherCount: z.ZodInt;
16956
+ }, z.core.$strip>;
16957
+ };
16958
+ LEASE_NOT_HELD: {
16959
+ readonly message: "The caller holds no such lease";
16960
+ readonly status: 409;
16961
+ };
16962
+ AGENT_OUTDATED: {
16963
+ readonly message: "The imp's agent is too old for this";
16964
+ readonly status: 409;
16965
+ };
16966
+ MOVING: {
16967
+ readonly message: "The imp is moving between hosts";
16968
+ readonly status: 409;
16969
+ readonly data: z.ZodObject<{
16970
+ retryAfterS: z.ZodInt;
16971
+ }, z.core.$strip>;
16972
+ };
16973
+ }>, Record<never, never>>;
16774
16974
  gc: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
16775
16975
  dryRun: z.ZodOptional<z.ZodBoolean>;
16776
16976
  orphans: z.ZodOptional<z.ZodBoolean>;
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 = "2.3.0";
6
+ const CLIENT_VERSION = "2.4.1";
7
7
  async function checkServer(rpc) {
8
8
  const info = await rpc.system.info();
9
9
  return {
@@ -19,7 +19,7 @@ function isCompatibleVersion(client, server) {
19
19
  return ours.major > 0 || ours.minor === theirs.minor;
20
20
  }
21
21
  function parseVersion(version) {
22
- const groups = /^(?<major>\d+)\.(?<minor>\d+)\.\d+/.exec(version)?.groups;
22
+ const groups = /^(?<major>\d+)\.(?<minor>\d+)\.\d+/u.exec(version)?.groups;
23
23
  return groups === void 0 ? null : {
24
24
  major: Number(groups["major"]),
25
25
  minor: Number(groups["minor"])
@@ -27,8 +27,8 @@ function parseVersion(version) {
27
27
  }
28
28
  //#endregion
29
29
  //#region ../api/src/schemas/name-schema.ts
30
- const NameSchema = z.string().regex(/^[a-z][a-z0-9-]{0,30}$/, "must be a lowercase letter followed by up to 30 lowercase letters, digits or hyphens");
31
- z.string().regex(/^[\w.:-]{1,64}$/, "must be 1–64 letters, digits, dots, underscores, colons or hyphens");
30
+ const NameSchema = z.string().regex(/^[a-z][a-z0-9-]{0,30}$/u, "must be a lowercase letter followed by up to 30 lowercase letters, digits or hyphens");
31
+ z.string().regex(/^[\w.:-]{1,64}$/u, "must be 1–64 letters, digits, dots, underscores, colons or hyphens");
32
32
  z.int().min(10).max(3600);
33
33
  const LeaseOwnerSchema = z.object({
34
34
  principal: z.string(),
@@ -111,7 +111,7 @@ z.discriminatedUnion("type", [
111
111
  const OffsetSchema = z.int().nonnegative();
112
112
  //#endregion
113
113
  //#region ../api/src/schemas/session-output-schema.ts
114
- const ExecutionGenerationSchema = z.string().regex(/^[0-9a-f]{32}$/);
114
+ const ExecutionGenerationSchema = z.string().regex(/^[0-9a-f]{32}$/u);
115
115
  const ColdBootCauseSchema = z.enum([
116
116
  "start",
117
117
  "wake_fallback",
@@ -171,7 +171,7 @@ const InvalidResumeDataSchema = z.object({
171
171
  end: OffsetSchema,
172
172
  bufferStart: OffsetSchema
173
173
  }).readonly();
174
- const SessionNameSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/, "must be a lowercase letter or digit followed by up to 31 lowercase letters, digits or hyphens");
174
+ const SessionNameSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/u, "must be a lowercase letter or digit followed by up to 31 lowercase letters, digits or hyphens");
175
175
  const SessionExitSchema = z.object({
176
176
  code: z.int().nullable(),
177
177
  signal: z.string().nullable()
@@ -268,7 +268,7 @@ z.discriminatedUnion("type", [
268
268
  }),
269
269
  z.object({
270
270
  type: z.literal("signal"),
271
- signal: z.string().regex(/^SIG[A-Z0-9]+$/)
271
+ signal: z.string().regex(/^SIG[A-Z0-9]+$/u)
272
272
  }),
273
273
  z.object({
274
274
  type: z.literal("stdout_ack"),
@@ -333,7 +333,7 @@ const PublicAuthSchema = z.enum([
333
333
  "token",
334
334
  "basic"
335
335
  ]);
336
- const BasicUserSchema = z.string().regex(/^[!-9;-~]{1,64}$/, "must be 1 to 64 printable characters, without a colon");
336
+ const BasicUserSchema = z.string().regex(/^[!-9;-~]{1,64}$/u, "must be 1 to 64 printable characters, without a colon");
337
337
  z.object({
338
338
  name: NameSchema,
339
339
  auth: PublicAuthSchema.default("token"),
@@ -356,7 +356,7 @@ const MoveStateSchema = z.enum([
356
356
  "moved",
357
357
  "receiving"
358
358
  ]);
359
- const PeerUrlSchema = z.url({ protocol: /^https?$/ });
359
+ const PeerUrlSchema = z.url({ protocol: /^https?$/u });
360
360
  const WarmHostSchema = z.object({
361
361
  firecrackerVersion: z.string(),
362
362
  snapshotVersion: z.string(),
@@ -410,9 +410,9 @@ z.object({
410
410
  //#endregion
411
411
  //#region ../api/src/schemas/secret-schema.ts
412
412
  const SecretNameSchema = NameSchema;
413
- const PrintableSchema = z.string().regex(/^[!-~]+$/, "must be printable ASCII without spaces");
413
+ const PrintableSchema = z.string().regex(/^[!-~]+$/u, "must be printable ASCII without spaces");
414
414
  PrintableSchema.min(1).max(8192);
415
- const BrokerHostSchema = z.string().max(253).regex(/^(?:[a-z0-9][a-z0-9-]{0,62}\.)+[a-z][a-z0-9-]{0,62}$/, "must be a lowercase hostname such as api.example.com");
415
+ const BrokerHostSchema = z.string().max(253).regex(/^(?:[a-z0-9][a-z0-9-]{0,62}\.)+[a-z][a-z0-9-]{0,62}$/u, "must be a lowercase hostname such as api.example.com");
416
416
  const BrokerUpstreamSchema = z.string().max(2048).transform((value, context) => {
417
417
  const url = URL.parse(value);
418
418
  if (url === null || url.protocol !== "http:" && url.protocol !== "https:") {
@@ -447,7 +447,7 @@ const BrokerUpstreamSchema = z.string().max(2048).transform((value, context) =>
447
447
  });
448
448
  const BrokerRuleSchema = z.object({
449
449
  host: BrokerHostSchema,
450
- header: z.string().regex(/^[a-z0-9-]{1,64}$/, "must be a lowercase header name such as authorization"),
450
+ header: z.string().regex(/^[a-z0-9-]{1,64}$/u, "must be a lowercase header name such as authorization"),
451
451
  scheme: z.enum([
452
452
  "bearer",
453
453
  "basic",
@@ -464,7 +464,7 @@ const SecretKindSchema = z.enum([
464
464
  "oauth"
465
465
  ]);
466
466
  const OAuthStateSchema = z.object({
467
- tokenUrl: z.url({ protocol: /^https$/ }).max(2048),
467
+ tokenUrl: z.url({ protocol: /^https$/u }).max(2048),
468
468
  clientId: PrintableSchema.min(1).max(256),
469
469
  tokenFormat: z.enum(["json", "form"]).default("form")
470
470
  }).extend({
@@ -486,8 +486,8 @@ z.object({
486
486
  createdAt: z.date(),
487
487
  oauth: OAuthStateSchema.optional()
488
488
  }).extend({ droppedGrants: z.int().nonnegative().default(0) });
489
- const GrantMethodSchema = z.string().regex(/^[A-Z]{1,16}$/, "must be an uppercase method such as GET");
490
- const GrantPathSchema = z.string().max(512).regex(/^(?:\/(?:\*|[A-Za-z0-9._~!$&'()+,;=:@-]*))*(?:\/\*\*)?$/, "must be a path such as /v1/messages, with * for one segment and a last /** for the rest").refine((path) => path.startsWith("/"), "must start with /");
489
+ const GrantMethodSchema = z.string().regex(/^[A-Z]{1,16}$/u, "must be an uppercase method such as GET");
490
+ const GrantPathSchema = z.string().max(512).regex(/^(?:\/(?:\*|[A-Za-z0-9._~!$&'()+,;=:@-]*))*(?:\/\*\*)?$/u, "must be a path such as /v1/messages, with * for one segment and a last /** for the rest").refine((path) => path.startsWith("/"), "must start with /");
491
491
  const GrantFilterSchema = z.object({
492
492
  methods: z.array(GrantMethodSchema).min(1).max(16).readonly().optional(),
493
493
  paths: z.array(GrantPathSchema).min(1).max(64).readonly().optional()
@@ -871,7 +871,7 @@ function parseJson(line) {
871
871
  //#region src/resolve-impd-url.ts
872
872
  function resolveImpdUrl(base, path) {
873
873
  const url = new URL(base);
874
- url.pathname = `${url.pathname.replace(/\/+$/, "")}${path}`;
874
+ url.pathname = `${url.pathname.replace(/\/+$/u, "")}${path}`;
875
875
  return url;
876
876
  }
877
877
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/client",
3
- "version": "2.3.0",
3
+ "version": "2.4.1",
4
4
  "description": "Typed client for impd, the imp host daemon: imps, checkpoints, images and exec",
5
5
  "license": "MIT",
6
6
  "repository": {