@impz/client 2.2.1 → 2.4.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.js +16 -16
- package/package.json +1 -1
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.
|
|
6
|
+
const CLIENT_VERSION = "2.4.0";
|
|
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
|
|
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}
|
|
31
|
-
z.string().regex(/^[\w.:-]{1,64}
|
|
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}
|
|
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}
|
|
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(/^[!-~]
|
|
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}
|
|
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}
|
|
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}
|
|
490
|
-
const GrantPathSchema = z.string().max(512).regex(/^(?:\/(?:\*|[A-Za-z0-9._~!$&'()+,;=:@-]*))*(?:\/\*\*)
|
|
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(
|
|
874
|
+
url.pathname = `${url.pathname.replace(/\/+$/u, "")}${path}`;
|
|
875
875
|
return url;
|
|
876
876
|
}
|
|
877
877
|
//#endregion
|