From 50b13f60af0eac176a000caf7cc799b21fe3f3c5 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Mon, 27 Jan 2025 18:18:11 +0000 Subject: [PATCH 01/15] Fix R2 bucket name validation error (#7904) --- .changeset/late-gorillas-walk.md | 5 ++ .../__tests__/__snapshots__/r2.test.ts.snap | 64 +++++++++---------- packages/wrangler/src/__tests__/r2.test.ts | 56 +++++++++++----- packages/wrangler/src/r2/bucket.ts | 3 +- packages/wrangler/src/r2/helpers.ts | 4 +- 5 files changed, 82 insertions(+), 50 deletions(-) create mode 100644 .changeset/late-gorillas-walk.md diff --git a/.changeset/late-gorillas-walk.md b/.changeset/late-gorillas-walk.md new file mode 100644 index 000000000000..ffcbd7066d9b --- /dev/null +++ b/.changeset/late-gorillas-walk.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +fix: validation for R2 bucket names, the regex was wrongly rejecting buckets starting with a number and the message wasn't as clear as it could be on what was going wrong. diff --git a/packages/wrangler/src/__tests__/__snapshots__/r2.test.ts.snap b/packages/wrangler/src/__tests__/__snapshots__/r2.test.ts.snap index a1fe92e792f8..2ac10f13d19a 100644 --- a/packages/wrangler/src/__tests__/__snapshots__/r2.test.ts.snap +++ b/packages/wrangler/src/__tests__/__snapshots__/r2.test.ts.snap @@ -1,113 +1,113 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`r2 > bucket > create > wrangler.json > should create a bucket & check request inputs 1`] = ` -"Creating bucket 'testBucket'... -✅ Created bucket 'testBucket' with default storage class of Standard. +"Creating bucket 'test-bucket'... +✅ Created bucket 'test-bucket' with default storage class of Standard. Configure your Worker to write objects to this bucket: { \\"r2_buckets\\": [ { - \\"bucket_name\\": \\"testBucket\\", - \\"binding\\": \\"testBucket\\" + \\"bucket_name\\": \\"test-bucket\\", + \\"binding\\": \\"test_bucket\\" } ] }" `; exports[`r2 > bucket > create > wrangler.json > should create a bucket with the expected default storage class 1`] = ` -"Creating bucket 'testBucket'... -✅ Created bucket 'testBucket' with default storage class of InfrequentAccess. +"Creating bucket 'test-bucket'... +✅ Created bucket 'test-bucket' with default storage class of InfrequentAccess. Configure your Worker to write objects to this bucket: { \\"r2_buckets\\": [ { - \\"bucket_name\\": \\"testBucket\\", - \\"binding\\": \\"testBucket\\" + \\"bucket_name\\": \\"test-bucket\\", + \\"binding\\": \\"test_bucket\\" } ] }" `; exports[`r2 > bucket > create > wrangler.json > should create a bucket with the expected jurisdiction 1`] = ` -"Creating bucket 'testBucket (eu)'... -✅ Created bucket 'testBucket (eu)' with default storage class of Standard. +"Creating bucket 'test-bucket (eu)'... +✅ Created bucket 'test-bucket (eu)' with default storage class of Standard. Configure your Worker to write objects to this bucket: { \\"r2_buckets\\": [ { - \\"bucket_name\\": \\"testBucket\\", - \\"binding\\": \\"testBucket\\" + \\"bucket_name\\": \\"test-bucket\\", + \\"binding\\": \\"test_bucket\\" } ] }" `; exports[`r2 > bucket > create > wrangler.json > should create a bucket with the expected location hint 1`] = ` -"Creating bucket 'testBucket'... -✅ Created bucket 'testBucket' with location hint weur and default storage class of Standard. +"Creating bucket 'test-bucket'... +✅ Created bucket 'test-bucket' with location hint weur and default storage class of Standard. Configure your Worker to write objects to this bucket: { \\"r2_buckets\\": [ { - \\"bucket_name\\": \\"testBucket\\", - \\"binding\\": \\"testBucket\\" + \\"bucket_name\\": \\"test-bucket\\", + \\"binding\\": \\"test_bucket\\" } ] }" `; exports[`r2 > bucket > create > wrangler.toml > should create a bucket & check request inputs 1`] = ` -"Creating bucket 'testBucket'... -✅ Created bucket 'testBucket' with default storage class of Standard. +"Creating bucket 'test-bucket'... +✅ Created bucket 'test-bucket' with default storage class of Standard. Configure your Worker to write objects to this bucket: [[r2_buckets]] -bucket_name = \\"testBucket\\" -binding = \\"testBucket\\" +bucket_name = \\"test-bucket\\" +binding = \\"test_bucket\\" " `; exports[`r2 > bucket > create > wrangler.toml > should create a bucket with the expected default storage class 1`] = ` -"Creating bucket 'testBucket'... -✅ Created bucket 'testBucket' with default storage class of InfrequentAccess. +"Creating bucket 'test-bucket'... +✅ Created bucket 'test-bucket' with default storage class of InfrequentAccess. Configure your Worker to write objects to this bucket: [[r2_buckets]] -bucket_name = \\"testBucket\\" -binding = \\"testBucket\\" +bucket_name = \\"test-bucket\\" +binding = \\"test_bucket\\" " `; exports[`r2 > bucket > create > wrangler.toml > should create a bucket with the expected jurisdiction 1`] = ` -"Creating bucket 'testBucket (eu)'... -✅ Created bucket 'testBucket (eu)' with default storage class of Standard. +"Creating bucket 'test-bucket (eu)'... +✅ Created bucket 'test-bucket (eu)' with default storage class of Standard. Configure your Worker to write objects to this bucket: [[r2_buckets]] -bucket_name = \\"testBucket\\" -binding = \\"testBucket\\" +bucket_name = \\"test-bucket\\" +binding = \\"test_bucket\\" " `; exports[`r2 > bucket > create > wrangler.toml > should create a bucket with the expected location hint 1`] = ` -"Creating bucket 'testBucket'... -✅ Created bucket 'testBucket' with location hint weur and default storage class of Standard. +"Creating bucket 'test-bucket'... +✅ Created bucket 'test-bucket' with location hint weur and default storage class of Standard. Configure your Worker to write objects to this bucket: [[r2_buckets]] -bucket_name = \\"testBucket\\" -binding = \\"testBucket\\" +bucket_name = \\"test-bucket\\" +binding = \\"test_bucket\\" " `; diff --git a/packages/wrangler/src/__tests__/r2.test.ts b/packages/wrangler/src/__tests__/r2.test.ts index 1b4a999f866a..4385bb97caf3 100644 --- a/packages/wrangler/src/__tests__/r2.test.ts +++ b/packages/wrangler/src/__tests__/r2.test.ts @@ -301,14 +301,14 @@ describe("r2", () => { async ({ request, params }) => { const { accountId } = params; expect(accountId).toEqual("some-account-id"); - expect(await request.json()).toEqual({ name: "testBucket" }); + expect(await request.json()).toEqual({ name: "test-bucket" }); return HttpResponse.json(createFetchResult({})); }, { once: true } ) ); writeWranglerConfig({}, configPath); - await runWrangler("r2 bucket create testBucket"); + await runWrangler("r2 bucket create test-bucket"); expect(std.out).toMatchSnapshot(); }); @@ -320,20 +320,20 @@ describe("r2", () => { const { accountId } = params; expect(accountId).toEqual("some-account-id"); expect(request.headers.get("cf-r2-jurisdiction")).toEqual("eu"); - expect(await request.json()).toEqual({ name: "testBucket" }); + expect(await request.json()).toEqual({ name: "test-bucket" }); return HttpResponse.json(createFetchResult({})); }, { once: true } ) ); writeWranglerConfig({}, configPath); - await runWrangler("r2 bucket create testBucket -J eu"); + await runWrangler("r2 bucket create test-bucket -J eu"); expect(std.out).toMatchSnapshot(); }); it("should create a bucket with the expected default storage class", async () => { writeWranglerConfig({}, configPath); - await runWrangler("r2 bucket create testBucket -s InfrequentAccess"); + await runWrangler("r2 bucket create test-bucket -s InfrequentAccess"); expect(std.out).toMatchSnapshot(); }); @@ -345,7 +345,7 @@ describe("r2", () => { const { accountId } = params; expect(accountId).toEqual("some-account-id"); expect(await request.json()).toEqual({ - name: "testBucket", + name: "test-bucket", locationHint: "weur", }); return HttpResponse.json(createFetchResult({})); @@ -355,29 +355,29 @@ describe("r2", () => { ); writeWranglerConfig({}, configPath); - await runWrangler("r2 bucket create testBucket --location weur"); + await runWrangler("r2 bucket create test-bucket --location weur"); expect(std.out).toMatchSnapshot(); }); }); it("should error if storage class is invalid", async () => { await expect( - runWrangler("r2 bucket create testBucket -s Foo") + runWrangler("r2 bucket create test-bucket -s Foo") ).rejects.toThrowErrorMatchingInlineSnapshot( `[APIError: A request to the Cloudflare API (/accounts/some-account-id/r2/buckets) failed.]` ); expect(std.out).toMatchInlineSnapshot(` - "Creating bucket 'testBucket'... + "Creating bucket 'test-bucket'... - X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/r2/buckets) failed. + X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/r2/buckets) failed. - The JSON you provided was not well formed. [code: 10040] + The JSON you provided was not well formed. [code: 10040] - If you think this is a bug, please open an issue at: - https://github.com/cloudflare/workers-sdk/issues/new/choose + If you think this is a bug, please open an issue at: + https://github.com/cloudflare/workers-sdk/issues/new/choose - " - `); + " + `); }); }); @@ -511,7 +511,31 @@ describe("r2", () => { await expect( runWrangler("r2 bucket create abc_def") ).rejects.toThrowErrorMatchingInlineSnapshot( - `[Error: The bucket name "abc_def" is invalid. Bucket names can only have alphanumeric and - characters.]` + `[Error: The bucket name "abc_def" is invalid. Bucket names must begin and end with an alphanumeric and can only contain letters (a-z), numbers (0-9), and hyphens (-).]` + ); + }); + + it("should error if the bucket name starts with a dash", async () => { + await expect( + runWrangler("r2 bucket create -abc") + ).rejects.toThrowErrorMatchingInlineSnapshot( + `[Error: Not enough non-option arguments: got 0, need at least 1]` + ); + }); + + it("should error if the bucket name ends with a dash", async () => { + await expect( + runWrangler("r2 bucket create abc-") + ).rejects.toThrowErrorMatchingInlineSnapshot( + `[Error: The bucket name "abc-" is invalid. Bucket names must begin and end with an alphanumeric and can only contain letters (a-z), numbers (0-9), and hyphens (-).]` + ); + }); + + it("should error if the bucket name is over 63 characters", async () => { + await expect( + runWrangler("r2 bucket create " + "a".repeat(64)) + ).rejects.toThrowErrorMatchingInlineSnapshot( + `[Error: The bucket name "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is invalid. Bucket names must begin and end with an alphanumeric and can only contain letters (a-z), numbers (0-9), and hyphens (-).]` ); }); diff --git a/packages/wrangler/src/r2/bucket.ts b/packages/wrangler/src/r2/bucket.ts index f307f5b9aa7c..8ca47a40765c 100644 --- a/packages/wrangler/src/r2/bucket.ts +++ b/packages/wrangler/src/r2/bucket.ts @@ -66,7 +66,8 @@ export const r2BucketCreateCommand = createCommand({ if (!isValidR2BucketName(name)) { throw new UserError( - `The bucket name "${name}" is invalid. Bucket names can only have alphanumeric and - characters.` + `The bucket name "${name}" is invalid. ` + + "Bucket names must begin and end with an alphanumeric and can only contain letters (a-z), numbers (0-9), and hyphens (-)." ); } diff --git a/packages/wrangler/src/r2/helpers.ts b/packages/wrangler/src/r2/helpers.ts index 43efa2122852..4055cf2d547b 100644 --- a/packages/wrangler/src/r2/helpers.ts +++ b/packages/wrangler/src/r2/helpers.ts @@ -1196,7 +1196,9 @@ export async function deleteCORSPolicy( * R2 bucket names must only contain alphanumeric and - characters. */ export function isValidR2BucketName(name: string | undefined): name is string { - return typeof name === "string" && /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name); + return ( + typeof name === "string" && /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/.test(name) + ); } const CHUNK_SIZE = 1024; From 2b6f1496685b23b6734c3001db49d3086005582e Mon Sep 17 00:00:00 2001 From: emily-shen <69125074+emily-shen@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:15:13 -0800 Subject: [PATCH 02/15] feat: add sanitised error messages to wrangler telemetry collection (#7856) * initial * feedback and some more examples * loads of tests + fixups * changeset + update telemetry docs * update tests --- .changeset/old-teachers-bow.md | 7 + .../wrangler/src/__tests__/errors.test.ts | 135 ++++++++++++++++++ .../wrangler/src/__tests__/metrics.test.ts | 29 ++++ packages/wrangler/src/__tests__/parse.test.ts | 6 + packages/wrangler/src/assets.ts | 54 +++++-- packages/wrangler/src/d1/execute.ts | 4 +- packages/wrangler/src/delete.ts | 9 +- packages/wrangler/src/deployments.ts | 16 ++- packages/wrangler/src/dialogs.ts | 4 +- packages/wrangler/src/errors.ts | 45 ++++-- packages/wrangler/src/index.ts | 8 +- packages/wrangler/src/metrics/types.ts | 4 + packages/wrangler/src/parse.ts | 15 +- packages/wrangler/src/tail/index.ts | 3 +- packages/wrangler/telemetry.md | 2 +- 15 files changed, 300 insertions(+), 41 deletions(-) create mode 100644 .changeset/old-teachers-bow.md create mode 100644 packages/wrangler/src/__tests__/errors.test.ts diff --git a/.changeset/old-teachers-bow.md b/.changeset/old-teachers-bow.md new file mode 100644 index 000000000000..c7eb420a2a18 --- /dev/null +++ b/.changeset/old-teachers-bow.md @@ -0,0 +1,7 @@ +--- +"wrangler": minor +--- + +feat: add sanitised error messages to Wrangler telemetry + +Error messages that have been audited for potential inclusion of personal information, and explicitly opted-in, are now included in Wrangler's telemetry collection. Collected error messages will not include any filepaths, user input or any other potentially private content. diff --git a/packages/wrangler/src/__tests__/errors.test.ts b/packages/wrangler/src/__tests__/errors.test.ts new file mode 100644 index 000000000000..8cec76ebf27a --- /dev/null +++ b/packages/wrangler/src/__tests__/errors.test.ts @@ -0,0 +1,135 @@ +import { + CommandLineArgsError, + DeprecationError, + FatalError, + MissingConfigError, + UserError, +} from "../errors"; +import { APIError, ParseError } from "../parse"; + +describe("errors", () => { + describe("UserError", () => { + it("takes a custom telemetry message", () => { + const error = new UserError("message", { telemetryMessage: "telemetry" }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("telemetry"); + }); + it("can set telemetryMessage to equal the main message", () => { + const error = new UserError("message", { telemetryMessage: true }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("message"); + }); + }); + + describe("DeprecationError", () => { + it("takes a custom telemetry message", () => { + const error = new DeprecationError("message", { + telemetryMessage: "telemetry", + }); + expect(error.message).toBe("Deprecation:\nmessage"); + expect(error.telemetryMessage).toBe("telemetry"); + }); + it("can set telemetryMessage to equal the main message", () => { + const error = new DeprecationError("message", { telemetryMessage: true }); + expect(error.message).toBe("Deprecation:\nmessage"); + expect(error.telemetryMessage).toBe("Deprecation:\nmessage"); + }); + }); + + describe("FatalError", () => { + it("takes a custom telemetry message", () => { + const error = new FatalError("message", undefined, { + telemetryMessage: "telemetry", + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("telemetry"); + expect(error.code).toBeUndefined(); + }); + it("can set telemetryMessage to equal the main message", () => { + const error = new FatalError("message", 1, { telemetryMessage: true }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("message"); + expect(error.code).toBe(1); + }); + }); + + describe("CommandLineArgsError", () => { + it("takes a custom telemetry message", () => { + const error = new CommandLineArgsError("message", { + telemetryMessage: "telemetry", + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("telemetry"); + }); + it("can set telemetryMessage to equal the main message", () => { + const error = new CommandLineArgsError("message", { + telemetryMessage: true, + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("message"); + }); + }); + + describe("JsonFriendlyFatalError", () => { + it("takes a custom telemetry message", () => { + const error = new FatalError("message", undefined, { + telemetryMessage: "telemetry", + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("telemetry"); + expect(error.code).toBeUndefined(); + }); + it("can set telemetryMessage to equal the main message", () => { + const error = new FatalError("message", 1, { telemetryMessage: true }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("message"); + expect(error.code).toBe(1); + }); + }); + + describe("MissingConfigError", () => { + it("just sets the telemetry message as the main message", () => { + const error = new MissingConfigError("message"); + expect(error.message).toBe("Missing config value for message"); + expect(error.telemetryMessage).toBe("Missing config value for message"); + }); + }); + + describe("ParseError", () => { + it("takes a custom telemetry message", () => { + const error = new ParseError({ + text: "message", + telemetryMessage: "telemetry", + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("telemetry"); + }); + it("can set telemetryMessage to equal the main message", () => { + const error = new ParseError({ + text: "message", + telemetryMessage: true, + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("message"); + }); + }); + + describe("APIError", () => { + it("takes a custom telemetry message", () => { + const error = new APIError({ + text: "message", + telemetryMessage: "telemetry", + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("telemetry"); + }); + it("can set telemetryMessage to equal the main message", () => { + const error = new APIError({ + text: "message", + telemetryMessage: true, + }); + expect(error.message).toBe("message"); + expect(error.telemetryMessage).toBe("message"); + }); + }); +}); diff --git a/packages/wrangler/src/__tests__/metrics.test.ts b/packages/wrangler/src/__tests__/metrics.test.ts index d0b5ac3d18b9..2b995223470f 100644 --- a/packages/wrangler/src/__tests__/metrics.test.ts +++ b/packages/wrangler/src/__tests__/metrics.test.ts @@ -321,6 +321,7 @@ describe("metrics", () => { durationSeconds: 6, durationMinutes: 0.1, errorType: "TypeError", + errorMessage: undefined, }, }; @@ -445,6 +446,34 @@ describe("metrics", () => { expect(std.debug).toContain('"isInteractive":false,'); }); + it("should include an error message if the specific error has been allow-listed with {telemetryMessage:true}", async () => { + setIsTTY(false); + const requests = mockMetricRequest(); + + await expect( + runWrangler("docs arg -j=false") + ).rejects.toThrowErrorMatchingInlineSnapshot( + `[Error: Wrangler now supports wrangler.json configuration files by default and ignores the value of the \`--experimental-json-config\` flag.]` + ); + expect(requests.count).toBe(2); + expect(std.debug).toContain( + '"errorMessage":"Wrangler now supports wrangler.json configuration files by default and ignores the value of the `--experimental-json-config` flag."' + ); + }); + + it("should include an error message if the specific error has been allow-listed with a custom telemetry message", async () => { + setIsTTY(false); + const requests = mockMetricRequest(); + + await expect( + runWrangler("bloop") + ).rejects.toThrowErrorMatchingInlineSnapshot( + `[Error: Unknown argument: bloop]` + ); + expect(requests.count).toBe(2); + expect(std.debug).toContain('"errorMessage":"yargs validation error"'); + }); + describe("banner", () => { beforeEach(() => { vi.mocked(getWranglerVersion).mockReturnValue("1.2.3"); diff --git a/packages/wrangler/src/__tests__/parse.test.ts b/packages/wrangler/src/__tests__/parse.test.ts index b87828136ec3..88d21ad5f99f 100644 --- a/packages/wrangler/src/__tests__/parse.test.ts +++ b/packages/wrangler/src/__tests__/parse.test.ts @@ -142,6 +142,7 @@ describe("parseTOML", () => { lineText: "name = 'fail\"", }, notes: [], + telemetryMessage: "TOML parse error", }); } }); @@ -163,6 +164,7 @@ describe("parseTOML", () => { fileText: "\n[name", }, notes: [], + telemetryMessage: "TOML parse error", }); } }); @@ -232,6 +234,7 @@ describe("parseJSON", () => { fileText: `\n{\n"version" "1\n}\n`, }, notes: [], + telemetryMessage: "JSON(C) parse error", }); expect(text).toEqual("UnexpectedEndOfString"); } @@ -257,6 +260,7 @@ describe("parseJSON", () => { lineText: `\t\t\t"c":[012345]`, }, notes: [], + telemetryMessage: "JSON(C) parse error", }); } }); @@ -339,6 +343,7 @@ describe("parseJSONC", () => { fileText: `\n{\n"version" "1\n}\n`, }, notes: [], + telemetryMessage: "JSON(C) parse error", }); } }); @@ -363,6 +368,7 @@ describe("parseJSONC", () => { lineText: `\t\t\t"c":[012345]`, }, notes: [], + telemetryMessage: "JSON(C) parse error", }); } }); diff --git a/packages/wrangler/src/assets.ts b/packages/wrangler/src/assets.ts index e22c6e95703e..7df9018404e4 100644 --- a/packages/wrangler/src/assets.ts +++ b/packages/wrangler/src/assets.ts @@ -77,7 +77,8 @@ export const syncAssets = async ( if (!initializeAssetsResponse.jwt) { throw new FatalError( "Could not find assets information to attach to deployment. Please try again.", - 1 + 1, + { telemetryMessage: true } ); } logger.info(`No files to upload. Proceeding with deployment...`); @@ -102,7 +103,11 @@ export const syncAssets = async ( if (manifestEntry === undefined) { throw new FatalError( `A file was requested that does not appear to exist.`, - 1 + 1, + { + telemetryMessage: + "A file was requested that does not appear to exist. (asset manifest upload)", + } ); } // just logging file uploads at the moment... @@ -182,7 +187,9 @@ export const syncAssets = async ( throw new FatalError( `Upload took too long.\n` + `Asset upload took too long on bucket ${bucketIndex + 1}/${initializeAssetsResponse.buckets.length}. Please try again.\n` + - `Assets already uploaded have been saved, so the next attempt will automatically resume from this point.` + `Assets already uploaded have been saved, so the next attempt will automatically resume from this point.`, + undefined, + { telemetryMessage: "Asset upload took too long" } ); } else { throw e; @@ -207,7 +214,8 @@ export const syncAssets = async ( if (!completionJwt) { throw new FatalError( "Failed to complete asset upload. Please try again.", - 1 + 1, + { telemetryMessage: true } ); } @@ -249,7 +257,8 @@ const buildAssetManifest = async (dir: string) => { throw new UserError( `Maximum number of assets exceeded.\n` + `Cloudflare Workers supports up to ${MAX_ASSET_COUNT.toLocaleString()} assets in a version. We found ${counter.toLocaleString()} files in the specified assets directory "${dir}".\n` + - `Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT.toLocaleString()} files, and that you have specified your assets directory correctly.` + `Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT.toLocaleString()} files, and that you have specified your assets directory correctly.`, + { telemetryMessage: "Maximum number of assets exceeded" } ); } @@ -267,7 +276,8 @@ const buildAssetManifest = async (dir: string) => { binary: true, } )}.\n` + - `Ensure all assets in your assets directory "${dir}" conform with the Workers maximum size requirement.` + `Ensure all assets in your assets directory "${dir}" conform with the Workers maximum size requirement.`, + { telemetryMessage: "Asset too large" } ); } manifest[normalizeFilePath(relativeFilepath)] = { @@ -335,12 +345,15 @@ export function getAssetsOptions( if (directory === undefined) { throw new UserError( - "The `assets` property in your configuration is missing the required `directory` property." + "The `assets` property in your configuration is missing the required `directory` property.", + { telemetryMessage: true } ); } if (directory === "") { - throw new UserError("`The assets directory cannot be an empty string."); + throw new UserError("`The assets directory cannot be an empty string.", { + telemetryMessage: true, + }); } const assetsBasePath = getAssetsBasePath(config, args.assets); @@ -353,7 +366,11 @@ export function getAssetsOptions( throw new UserError( `The directory specified by the ${sourceOfTruthMessage} does not exist:\n` + - `${resolvedAssetsPath}` + `${resolvedAssetsPath}`, + + { + telemetryMessage: `The assets directory specified does not exist`, + } ); } @@ -413,7 +430,11 @@ export function validateAssetsArgsAndConfig( ) { throw new UserError( "Cannot use assets and legacy assets in the same Worker.\n" + - "Please remove either the `legacy_assets` or `assets` field from your configuration file." + "Please remove either the `legacy_assets` or `assets` field from your configuration file.", + { + telemetryMessage: + "Cannot use assets and legacy assets in the same Worker", + } ); } @@ -440,7 +461,8 @@ export function validateAssetsArgsAndConfig( ) { throw new UserError( "Cannot use assets with a binding in an assets-only Worker.\n" + - "Please remove the asset binding from your configuration file, or provide a Worker script in your configuration file (`main`)." + "Please remove the asset binding from your configuration file, or provide a Worker script in your configuration file (`main`).", + { telemetryMessage: true } ); } @@ -481,7 +503,8 @@ export function validateAssetsArgsAndConfig( ) { throw new UserError( "Cannot set experimental_serve_directly=false without a Worker script.\n" + - "Please remove experimental_serve_directly from your configuration file, or provide a Worker script in your configuration file (`main`)." + "Please remove experimental_serve_directly from your configuration file, or provide a Worker script in your configuration file (`main`).", + { telemetryMessage: true } ); } } @@ -526,12 +549,15 @@ function errorOnLegacyPagesWorkerJSAsset( ? "directory" : null; if (workerJsType !== null) { - throw new UserError(dedent` + throw new UserError( + dedent` Uploading a Pages _worker.js ${workerJsType} as an asset. This could expose your private server-side code to the public Internet. Is this intended? If you do not want to upload this ${workerJsType}, either remove it or add an "${CF_ASSETS_IGNORE_FILENAME}" file, to the root of your asset directory, containing "_worker.js" to avoid uploading. If you do want to upload this ${workerJsType}, you can add an empty "${CF_ASSETS_IGNORE_FILENAME}" file, to the root of your asset directory, to hide this error. - `); + `, + { telemetryMessage: true } + ); } } } diff --git a/packages/wrangler/src/d1/execute.ts b/packages/wrangler/src/d1/execute.ts index 24d76c5c8651..f9fcd8071af8 100644 --- a/packages/wrangler/src/d1/execute.ts +++ b/packages/wrangler/src/d1/execute.ts @@ -116,7 +116,9 @@ export const Handler = async (args: HandlerOptions): Promise => { if (file && command) { throw createFatalError( `Error: can't provide both --command and --file.`, - json + json, + undefined, + { telemetryMessage: true } ); } diff --git a/packages/wrangler/src/delete.ts b/packages/wrangler/src/delete.ts index 6a05069d29f8..5f074ba2eaa1 100644 --- a/packages/wrangler/src/delete.ts +++ b/packages/wrangler/src/delete.ts @@ -98,7 +98,8 @@ export async function deleteHandler(args: DeleteArgs) { if (config.pages_build_output_dir) { throw new UserError( "It looks like you've run a Workers-specific command in a Pages project.\n" + - "For Pages, please run `wrangler pages project delete` instead." + "For Pages, please run `wrangler pages project delete` instead.", + { telemetryMessage: true } ); } metrics.sendMetricsEvent( @@ -112,7 +113,11 @@ export async function deleteHandler(args: DeleteArgs) { const scriptName = getScriptName(args, config); if (!scriptName) { throw new UserError( - `A worker name must be defined, either via --name, or in your ${configFileName(config.configPath)} file` + `A worker name must be defined, either via --name, or in your ${configFileName(config.configPath)} file`, + { + telemetryMessage: + "`A worker name must be defined, either via --name, or in your config file", + } ); } diff --git a/packages/wrangler/src/deployments.ts b/packages/wrangler/src/deployments.ts index 999b81e30184..106592d55647 100644 --- a/packages/wrangler/src/deployments.ts +++ b/packages/wrangler/src/deployments.ts @@ -157,13 +157,16 @@ export async function rollbackDeployment( if (deploys.length < 2) { throw new UserError( - "Cannot rollback to previous deployment since there are less than 2 deployments" + "Cannot rollback to previous deployment since there are less than 2 deployments", + { telemetryMessage: true } ); } deploymentId = deploys.at(-2)?.id; if (deploymentId === undefined) { - throw new UserError("Cannot find previous deployment"); + throw new UserError("Cannot find previous deployment", { + telemetryMessage: true, + }); } } @@ -265,7 +268,9 @@ export async function viewDeployment( deploymentId = latest.id; if (deploymentId === undefined) { - throw new UserError("Cannot find previous deployment"); + throw new UserError("Cannot find previous deployment", { + telemetryMessage: true, + }); } } @@ -333,7 +338,10 @@ export async function commonDeploymentCMDSetup( if (!scriptName) { throw new UserError( - `Required Worker name missing. Please specify the Worker name in your ${configFileName(config.configPath)} file, or pass it as an argument with \`--name\`` + `Required Worker name missing. Please specify the Worker name in your ${configFileName(config.configPath)} file, or pass it as an argument with \`--name\``, + { + telemetryMessage: `Required Worker name missing. Please specify the Worker name in your config file, or pass it as an argument with \`--name\``, + } ); } diff --git a/packages/wrangler/src/dialogs.ts b/packages/wrangler/src/dialogs.ts index f8ecba8a4cf2..8c47c0caf8f2 100644 --- a/packages/wrangler/src/dialogs.ts +++ b/packages/wrangler/src/dialogs.ts @@ -9,7 +9,9 @@ export class NoDefaultValueProvided extends UserError { // This is user-facing, so make the message something understandable // It _should_ always be caught and replaced with a more descriptive error // but this is fine as a fallback. - super("This command cannot be run in a non-interactive context"); + super("This command cannot be run in a non-interactive context", { + telemetryMessage: true, + }); Object.setPrototypeOf(this, new.target.prototype); } } diff --git a/packages/wrangler/src/errors.ts b/packages/wrangler/src/errors.ts index e273d9572c98..509ff98b1909 100644 --- a/packages/wrangler/src/errors.ts +++ b/packages/wrangler/src/errors.ts @@ -1,3 +1,11 @@ +/** + * This is used to provide telemetry with a sanitised error + * message that could not have any user-identifying information. + * Set to `true` to duplicate `message`. + * */ +export type TelemetryMessage = { + telemetryMessage?: string | true; +}; /** * Base class for errors where the user has done something wrong. These are not * reported to Sentry. API errors are intentionally *not* `UserError`s, and are @@ -5,26 +13,33 @@ * messaging. */ export class UserError extends Error { - constructor(...args: ConstructorParameters) { - super(...args); + telemetryMessage: string | undefined; + constructor( + message?: string | undefined, + options?: (ErrorOptions & TelemetryMessage) | undefined + ) { + super(message, options); // Restore prototype chain: // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget Object.setPrototypeOf(this, new.target.prototype); + this.telemetryMessage = + options?.telemetryMessage === true ? message : options?.telemetryMessage; } } export class DeprecationError extends UserError { - constructor(message: string) { - super(`Deprecation:\n${message}`); + constructor(message: string, options?: TelemetryMessage) { + super(`Deprecation:\n${message}`, options); } } export class FatalError extends UserError { constructor( message?: string, - readonly code?: number + readonly code?: number | undefined, + options?: TelemetryMessage ) { - super(message); + super(message, options); } } @@ -41,15 +56,18 @@ export class CommandLineArgsError extends UserError {} export class JsonFriendlyFatalError extends FatalError { constructor( message?: string, - readonly code?: number + readonly code?: number, + options?: TelemetryMessage ) { - super(message); + super(message, code, options); } } export class MissingConfigError extends Error { + telemetryMessage: string | undefined; constructor(key: string) { super(`Missing config value for ${key}`); + this.telemetryMessage = `Missing config value for ${key}`; } } @@ -61,11 +79,16 @@ export class MissingConfigError extends Error { export function createFatalError( message: unknown, isJson: boolean, - code?: number + code?: number, + telemetryMessage?: TelemetryMessage ): Error { if (isJson) { - return new JsonFriendlyFatalError(JSON.stringify(message), code); + return new JsonFriendlyFatalError( + JSON.stringify(message), + code, + telemetryMessage + ); } else { - return new FatalError(`${message}`, code); + return new FatalError(`${message}`, code, telemetryMessage); } } diff --git a/packages/wrangler/src/index.ts b/packages/wrangler/src/index.ts index 33ce6dec0fa0..db04b6db7490 100644 --- a/packages/wrangler/src/index.ts +++ b/packages/wrangler/src/index.ts @@ -206,7 +206,9 @@ export function createCLIParser(argv: string[]) { if (!error || error.name === "YError") { // If there is no error or the error is a "YError", then this came from yargs own validation // Wrap it in a `CommandLineArgsError` so that we can handle it appropriately further up. - error = new CommandLineArgsError(msg); + error = new CommandLineArgsError(msg, { + telemetryMessage: "yargs validation error", + }); } throw error; }) @@ -254,7 +256,8 @@ export function createCLIParser(argv: string[]) { .check((args) => { if (args["experimental-json-config"] === false) { throw new CommandLineArgsError( - `Wrangler now supports wrangler.json configuration files by default and ignores the value of the \`--experimental-json-config\` flag.` + `Wrangler now supports wrangler.json configuration files by default and ignores the value of the \`--experimental-json-config\` flag.`, + { telemetryMessage: true } ); } return true; @@ -1143,6 +1146,7 @@ export async function main(argv: string[]): Promise { durationMinutes: durationMs / 1000 / 60, errorType: errorType ?? (e instanceof Error ? e.constructor.name : undefined), + errorMessage: e instanceof UserError ? e.telemetryMessage : undefined, }, argv ); diff --git a/packages/wrangler/src/metrics/types.ts b/packages/wrangler/src/metrics/types.ts index 28ebdf2c2396..caa6d694817a 100644 --- a/packages/wrangler/src/metrics/types.ts +++ b/packages/wrangler/src/metrics/types.ts @@ -125,5 +125,9 @@ export type Events = * Type of error, e.g. UserError, APIError. Does not include stack trace or error message. */ errorType: string | undefined; + /** + * Sanitised error messages that will not include user information like filepaths or stack traces (e.g. `Asset too large`). + */ + errorMessage: string | undefined; }; }; diff --git a/packages/wrangler/src/parse.ts b/packages/wrangler/src/parse.ts index 6e662a0d476d..1e50cb2a4109 100644 --- a/packages/wrangler/src/parse.ts +++ b/packages/wrangler/src/parse.ts @@ -5,6 +5,7 @@ import { formatMessagesSync } from "esbuild"; import * as jsoncParser from "jsonc-parser"; import { UserError } from "./errors"; import { logger } from "./logger"; +import type { TelemetryMessage } from "./errors"; import type { ParseError as JsoncParseError } from "jsonc-parser"; export type Message = { @@ -12,7 +13,7 @@ export type Message = { location?: Location; notes?: Message[]; kind?: "warning" | "error"; -}; +} & TelemetryMessage; export type Location = File & { line: number; @@ -56,8 +57,8 @@ export class ParseError extends UserError implements Message { readonly location?: Location; readonly kind: "warning" | "error"; - constructor({ text, notes, location, kind }: Message) { - super(text); + constructor({ text, notes, location, kind, telemetryMessage }: Message) { + super(text, { telemetryMessage }); this.name = this.constructor.name; this.text = text; this.notes = notes ?? []; @@ -132,7 +133,11 @@ export function parseTOML(input: string, file?: string): TOML.JsonMap | never { file, fileText: input, }; - throw new ParseError({ text, location }); + throw new ParseError({ + text, + location, + telemetryMessage: "TOML parse error", + }); } } @@ -180,6 +185,7 @@ export function parseJSONC( ...indexLocation({ file, fileText: input }, errors[0].offset + 1), length: errors[0].length, }, + telemetryMessage: "JSON(C) parse error", }); } return data; @@ -219,6 +225,7 @@ export function readFileSync(file: string): string { text: message.replace(file, resolve(file)), }, ], + telemetryMessage: "Could not read file", }); } } diff --git a/packages/wrangler/src/tail/index.ts b/packages/wrangler/src/tail/index.ts index a2fdf30b00ae..ee0a5aff703d 100644 --- a/packages/wrangler/src/tail/index.ts +++ b/packages/wrangler/src/tail/index.ts @@ -229,7 +229,8 @@ export const tailCommand = createCommand({ throw createFatalError( "Tail disconnected, exiting.", args.format === "json", - 1 + 1, + { telemetryMessage: true } ); } waitingForPong = true; diff --git a/packages/wrangler/telemetry.md b/packages/wrangler/telemetry.md index 6bf9fd86ff6c..0c867319748a 100644 --- a/packages/wrangler/telemetry.md +++ b/packages/wrangler/telemetry.md @@ -21,7 +21,7 @@ Telemetry in Wrangler allows us to better identify bugs and gain visibility on u - The format of the Wrangler configuration file (e.g. `toml`, `jsonc`) - Total session duration of the command run (e.g. 3 seconds, etc.) - Whether the Wrangler client is running in CI or in an interactive instance -- Error _type_, if one occurs (e.g. `APIError` or `UserError`) +- Error _type_ (e.g. `APIError` or `UserError`), and sanitised error messages that will not include user information like filepaths or stack traces (e.g. `Asset too large`). - General machine information such as OS and OS Version Cloudflare will receive the IP address associated with your machine and such information is handled in accordance with Cloudflare’s [Privacy Policy](https://www.cloudflare.com/privacypolicy/). From bd9228e855c25b2f5d94e298d6d1128484019f83 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Tue, 28 Jan 2025 00:23:59 +0100 Subject: [PATCH 03/15] chore(wrangler): update unenv dependency version (#7900) * chore(wrangler): update unenv dependency version * fixup! --- .changeset/slimy-baboons-care.md | 9 +++++++++ packages/wrangler/package.json | 2 +- packages/wrangler/src/__tests__/deploy.test.ts | 2 +- pnpm-lock.yaml | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .changeset/slimy-baboons-care.md diff --git a/.changeset/slimy-baboons-care.md b/.changeset/slimy-baboons-care.md new file mode 100644 index 000000000000..5d2fbb697b51 --- /dev/null +++ b/.changeset/slimy-baboons-care.md @@ -0,0 +1,9 @@ +--- +"wrangler": minor +--- + +chore(wrangler): update unenv dependency version + +`unenv@2.0.0-rc.1` allows using the workerd implementation for +the Node modules `net`, `timers`, and `timers/promises`. +See `unjs/unenv#396`. diff --git a/packages/wrangler/package.json b/packages/wrangler/package.json index ee35b118d75b..67d7fbb47360 100644 --- a/packages/wrangler/package.json +++ b/packages/wrangler/package.json @@ -76,7 +76,7 @@ "esbuild": "0.17.19", "miniflare": "workspace:*", "path-to-regexp": "6.3.0", - "unenv": "2.0.0-rc.0", + "unenv": "2.0.0-rc.1", "workerd": "1.20250124.0" }, "devDependencies": { diff --git a/packages/wrangler/src/__tests__/deploy.test.ts b/packages/wrangler/src/__tests__/deploy.test.ts index 9966fa677889..04366e08a950 100644 --- a/packages/wrangler/src/__tests__/deploy.test.ts +++ b/packages/wrangler/src/__tests__/deploy.test.ts @@ -9786,7 +9786,7 @@ addEventListener('fetch', event => {});` ) ) ).resolves.toMatchInlineSnapshot(` - "X [ERROR] Unexpected external import of \\"node:events\\", \\"node:net\\", \\"node:stream\\", \\"node:timers/promises\\", and \\"node:tty\\". + "X [ERROR] Unexpected external import of \\"node:net\\", \\"node:stream\\", \\"node:timers/promises\\", and \\"node:tty\\". Your worker has no default export, which means it is assumed to be a Service Worker format Worker. Did you mean to create a ES Module format Worker? If so, try adding \`export default { ... }\` in your entry-point. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2321391ca7e4..f0339342196a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2505,8 +2505,8 @@ importers: specifier: 6.3.0 version: 6.3.0 unenv: - specifier: 2.0.0-rc.0 - version: 2.0.0-rc.0 + specifier: 2.0.0-rc.1 + version: 2.0.0-rc.1 workerd: specifier: 1.20250124.0 version: 1.20250124.0 From 510d599cb187ac9d17f5624702e2cdab6d6f0ac2 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Tue, 28 Jan 2025 10:38:38 +0100 Subject: [PATCH 04/15] refactor(wrangler): max bundle size is now 3MiB (#7913) * refactor(wrangler): max bundle size is now 3MiB --- packages/wrangler/src/deployment-bundle/bundle-reporter.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/wrangler/src/deployment-bundle/bundle-reporter.ts b/packages/wrangler/src/deployment-bundle/bundle-reporter.ts index 150ce74fb88b..5558c0828e10 100644 --- a/packages/wrangler/src/deployment-bundle/bundle-reporter.ts +++ b/packages/wrangler/src/deployment-bundle/bundle-reporter.ts @@ -6,7 +6,9 @@ import type { CfModule } from "./worker"; import type { Metafile } from "esbuild"; const ONE_KIB_BYTES = 1024; -const ALLOWED_INITIAL_MAX = ONE_KIB_BYTES * 1024; // Current max is 1 MiB +// Current max is 3 MiB for free accounts, 10 MiB for paid accounts. +// See https://developers.cloudflare.com/workers/platform/limits/#worker-size +const MAX_GZIP_SIZE_BYTES = 3 * ONE_KIB_BYTES * ONE_KIB_BYTES; async function getSize(modules: Pick[]) { const gzipSize = gzipSync( @@ -30,7 +32,7 @@ export async function printBundleSize( gzipSize / ONE_KIB_BYTES ).toFixed(2)} KiB`; - const percentage = (gzipSize / ALLOWED_INITIAL_MAX) * 100; + const percentage = (gzipSize / MAX_GZIP_SIZE_BYTES) * 100; const colorizedReport = percentage > 90 From e7c7235fd3e8cc76fbb36666614dff8c3b2e35b7 Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Tue, 28 Jan 2025 10:59:45 +0000 Subject: [PATCH 05/15] chore: mark changeset as patch (#7931) --- .changeset/olive-tigers-raise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/olive-tigers-raise.md b/.changeset/olive-tigers-raise.md index 9abadfdb126f..42ebd7ffc67d 100644 --- a/.changeset/olive-tigers-raise.md +++ b/.changeset/olive-tigers-raise.md @@ -1,5 +1,5 @@ --- -"@cloudflare/workers-shared": minor +"@cloudflare/workers-shared": patch --- Fixes bug in router-worker that prevents unexpected errors from being captured. From 8bef7ea1ec5a08a9806bb4079715b88c6a58ace7 Mon Sep 17 00:00:00 2001 From: ANT Bot <116369605+workers-devprod@users.noreply.github.com> Date: Tue, 28 Jan 2025 12:58:24 +0100 Subject: [PATCH 06/15] Version Packages (#7916) Co-authored-by: github-actions[bot] --- .changeset/clean-sheep-promise.md | 6 ---- .changeset/late-gorillas-walk.md | 5 --- .changeset/neat-needles-brush.md | 7 ---- .changeset/nervous-jeans-obey.md | 5 --- .changeset/old-bees-design.md | 5 --- .changeset/old-teachers-bow.md | 7 ---- .changeset/olive-tigers-raise.md | 5 --- .changeset/popular-pigs-glow.md | 8 ----- .changeset/slimy-baboons-care.md | 9 ----- .changeset/thick-bikes-teach.md | 10 ------ .../CHANGELOG.md | 6 ++++ .../package.json | 2 +- .../playground-preview-worker/CHANGELOG.md | 6 ++++ .../playground-preview-worker/package.json | 2 +- packages/unenv-preset/CHANGELOG.md | 9 +++++ packages/unenv-preset/package.json | 2 +- packages/vite-plugin-cloudflare/CHANGELOG.md | 10 ++++++ packages/vite-plugin-cloudflare/package.json | 2 +- packages/vitest-pool-workers/CHANGELOG.md | 8 +++++ packages/vitest-pool-workers/package.json | 2 +- packages/workers-shared/CHANGELOG.md | 6 ++++ packages/workers-shared/package.json | 2 +- packages/wrangler/CHANGELOG.md | 34 +++++++++++++++++++ packages/wrangler/package.json | 2 +- 24 files changed, 86 insertions(+), 74 deletions(-) delete mode 100644 .changeset/clean-sheep-promise.md delete mode 100644 .changeset/late-gorillas-walk.md delete mode 100644 .changeset/neat-needles-brush.md delete mode 100644 .changeset/nervous-jeans-obey.md delete mode 100644 .changeset/old-bees-design.md delete mode 100644 .changeset/old-teachers-bow.md delete mode 100644 .changeset/olive-tigers-raise.md delete mode 100644 .changeset/popular-pigs-glow.md delete mode 100644 .changeset/slimy-baboons-care.md delete mode 100644 .changeset/thick-bikes-teach.md diff --git a/.changeset/clean-sheep-promise.md b/.changeset/clean-sheep-promise.md deleted file mode 100644 index e3426adae4ba..000000000000 --- a/.changeset/clean-sheep-promise.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"edge-preview-authenticated-proxy": patch -"playground-preview-worker": patch ---- - -fix: ensure no body is passed when constructing a GET or HEAD request to the preview worker diff --git a/.changeset/late-gorillas-walk.md b/.changeset/late-gorillas-walk.md deleted file mode 100644 index ffcbd7066d9b..000000000000 --- a/.changeset/late-gorillas-walk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"wrangler": patch ---- - -fix: validation for R2 bucket names, the regex was wrongly rejecting buckets starting with a number and the message wasn't as clear as it could be on what was going wrong. diff --git a/.changeset/neat-needles-brush.md b/.changeset/neat-needles-brush.md deleted file mode 100644 index f7a65dc8459e..000000000000 --- a/.changeset/neat-needles-brush.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -Fix regression in retryOnAPIFailure preventing any requests from being retried - -Also fixes a regression in pipelines that prevented 401 errors from being retried when waiting for an API token to become active. diff --git a/.changeset/nervous-jeans-obey.md b/.changeset/nervous-jeans-obey.md deleted file mode 100644 index 4256c59b49b4..000000000000 --- a/.changeset/nervous-jeans-obey.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"wrangler": patch ---- - -Fix to not require local connection string when using Hyperdrive and wrangler dev --remote diff --git a/.changeset/old-bees-design.md b/.changeset/old-bees-design.md deleted file mode 100644 index 89087baa7a8e..000000000000 --- a/.changeset/old-bees-design.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@cloudflare/vite-plugin": patch ---- - -Support unsafe params diff --git a/.changeset/old-teachers-bow.md b/.changeset/old-teachers-bow.md deleted file mode 100644 index c7eb420a2a18..000000000000 --- a/.changeset/old-teachers-bow.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": minor ---- - -feat: add sanitised error messages to Wrangler telemetry - -Error messages that have been audited for potential inclusion of personal information, and explicitly opted-in, are now included in Wrangler's telemetry collection. Collected error messages will not include any filepaths, user input or any other potentially private content. diff --git a/.changeset/olive-tigers-raise.md b/.changeset/olive-tigers-raise.md deleted file mode 100644 index 42ebd7ffc67d..000000000000 --- a/.changeset/olive-tigers-raise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@cloudflare/workers-shared": patch ---- - -Fixes bug in router-worker that prevents unexpected errors from being captured. diff --git a/.changeset/popular-pigs-glow.md b/.changeset/popular-pigs-glow.md deleted file mode 100644 index 7d328e17efc2..000000000000 --- a/.changeset/popular-pigs-glow.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@cloudflare/unenv-preset": minor ---- - -Use the workerd implementation for Node `net`, `timers`, and `timers/promises` modules - -- drop the polyfills -- update `unenv` to 2.0.0-rc.1 diff --git a/.changeset/slimy-baboons-care.md b/.changeset/slimy-baboons-care.md deleted file mode 100644 index 5d2fbb697b51..000000000000 --- a/.changeset/slimy-baboons-care.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -"wrangler": minor ---- - -chore(wrangler): update unenv dependency version - -`unenv@2.0.0-rc.1` allows using the workerd implementation for -the Node modules `net`, `timers`, and `timers/promises`. -See `unjs/unenv#396`. diff --git a/.changeset/thick-bikes-teach.md b/.changeset/thick-bikes-teach.md deleted file mode 100644 index ee33f10e372e..000000000000 --- a/.changeset/thick-bikes-teach.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -"wrangler": patch ---- - -refactor(wrangler): make JSON parsing independent of Node - -Switch `jsonc-parser` to parse json: - -- `JSON.parse()` exception messages are not stable across Node versions -- While `jsonc-parser` is used, JSONC specific syntax is disabled diff --git a/packages/edge-preview-authenticated-proxy/CHANGELOG.md b/packages/edge-preview-authenticated-proxy/CHANGELOG.md index 2ba3befb8026..78a1cae343b6 100644 --- a/packages/edge-preview-authenticated-proxy/CHANGELOG.md +++ b/packages/edge-preview-authenticated-proxy/CHANGELOG.md @@ -1,5 +1,11 @@ # edge-preview-authenticated-proxy +## 0.2.3 + +### Patch Changes + +- [#7793](https://github.com/cloudflare/workers-sdk/pull/7793) [`9941219`](https://github.com/cloudflare/workers-sdk/commit/994121908de7b0537c06ed4f6bae6cb35d32521d) Thanks [@edmundhung](https://github.com/edmundhung)! - fix: ensure no body is passed when constructing a GET or HEAD request to the preview worker + ## 0.2.2 ### Patch Changes diff --git a/packages/edge-preview-authenticated-proxy/package.json b/packages/edge-preview-authenticated-proxy/package.json index 524343f74453..a50b28713278 100644 --- a/packages/edge-preview-authenticated-proxy/package.json +++ b/packages/edge-preview-authenticated-proxy/package.json @@ -1,6 +1,6 @@ { "name": "edge-preview-authenticated-proxy", - "version": "0.2.2", + "version": "0.2.3", "private": true, "scripts": { "check:lint": "eslint . --max-warnings=0", diff --git a/packages/playground-preview-worker/CHANGELOG.md b/packages/playground-preview-worker/CHANGELOG.md index 336f95757255..f922809dcb52 100644 --- a/packages/playground-preview-worker/CHANGELOG.md +++ b/packages/playground-preview-worker/CHANGELOG.md @@ -1,5 +1,11 @@ # playground-preview-worker +## 0.1.3 + +### Patch Changes + +- [#7793](https://github.com/cloudflare/workers-sdk/pull/7793) [`9941219`](https://github.com/cloudflare/workers-sdk/commit/994121908de7b0537c06ed4f6bae6cb35d32521d) Thanks [@edmundhung](https://github.com/edmundhung)! - fix: ensure no body is passed when constructing a GET or HEAD request to the preview worker + ## 0.1.2 ### Patch Changes diff --git a/packages/playground-preview-worker/package.json b/packages/playground-preview-worker/package.json index c70ec4fca978..710614da6422 100644 --- a/packages/playground-preview-worker/package.json +++ b/packages/playground-preview-worker/package.json @@ -1,6 +1,6 @@ { "name": "playground-preview-worker", - "version": "0.1.2", + "version": "0.1.3", "private": true, "scripts": { "build-middleware": "pnpm run build-middleware:common && pnpm run build-middleware:loader", diff --git a/packages/unenv-preset/CHANGELOG.md b/packages/unenv-preset/CHANGELOG.md index 61a5f89a8c5c..a08ac5e20289 100644 --- a/packages/unenv-preset/CHANGELOG.md +++ b/packages/unenv-preset/CHANGELOG.md @@ -1,5 +1,14 @@ # @cloudflare/unenv-preset +## 1.1.0 + +### Minor Changes + +- [#7853](https://github.com/cloudflare/workers-sdk/pull/7853) [`061587d`](https://github.com/cloudflare/workers-sdk/commit/061587d81deaa5274f04fa0a39f1c8373b828a42) Thanks [@anonrig](https://github.com/anonrig)! - Use the workerd implementation for Node `net`, `timers`, and `timers/promises` modules + + - drop the polyfills + - update `unenv` to 2.0.0-rc.1 + ## 1.0.2 ### Patch Changes diff --git a/packages/unenv-preset/package.json b/packages/unenv-preset/package.json index d7ef24842640..549c23cc5020 100644 --- a/packages/unenv-preset/package.json +++ b/packages/unenv-preset/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/unenv-preset", - "version": "1.0.2", + "version": "1.1.0", "description": "cloudflare preset for unenv", "keywords": [ "cloudflare", diff --git a/packages/vite-plugin-cloudflare/CHANGELOG.md b/packages/vite-plugin-cloudflare/CHANGELOG.md index 7857368cb081..84660b923011 100644 --- a/packages/vite-plugin-cloudflare/CHANGELOG.md +++ b/packages/vite-plugin-cloudflare/CHANGELOG.md @@ -1,5 +1,15 @@ # @cloudflare/vite-plugin +## 0.0.4 + +### Patch Changes + +- [#7909](https://github.com/cloudflare/workers-sdk/pull/7909) [`0b79cec`](https://github.com/cloudflare/workers-sdk/commit/0b79cec51760a5b928b51d4140e6797eaac4644b) Thanks [@byule](https://github.com/byule)! - Support unsafe params + +- Updated dependencies [[`50b13f6`](https://github.com/cloudflare/workers-sdk/commit/50b13f60af0eac176a000caf7cc799b21fe3f3c5), [`134d61d`](https://github.com/cloudflare/workers-sdk/commit/134d61d97bb96337220e530f4af2ec2c8236f383), [`5c02e46`](https://github.com/cloudflare/workers-sdk/commit/5c02e46c89cce24d81d696173b0e52ce04a8ba59), [`2b6f149`](https://github.com/cloudflare/workers-sdk/commit/2b6f1496685b23b6734c3001db49d3086005582e), [`bd9228e`](https://github.com/cloudflare/workers-sdk/commit/bd9228e855c25b2f5d94e298d6d1128484019f83), [`13ab591`](https://github.com/cloudflare/workers-sdk/commit/13ab5916058e8e834f3e13fb9b5b9d9addc0f930)]: + - wrangler@3.106.0 + - miniflare@3.20250124.0 + ## 0.0.3 ### Patch Changes diff --git a/packages/vite-plugin-cloudflare/package.json b/packages/vite-plugin-cloudflare/package.json index 4f6eb61c9903..e3a03c1c4a77 100644 --- a/packages/vite-plugin-cloudflare/package.json +++ b/packages/vite-plugin-cloudflare/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/vite-plugin", - "version": "0.0.3", + "version": "0.0.4", "description": "Cloudflare plugin for Vite", "keywords": [ "cloudflare", diff --git a/packages/vitest-pool-workers/CHANGELOG.md b/packages/vitest-pool-workers/CHANGELOG.md index 09989ca1e3c1..1f642290d50d 100644 --- a/packages/vitest-pool-workers/CHANGELOG.md +++ b/packages/vitest-pool-workers/CHANGELOG.md @@ -1,5 +1,13 @@ # @cloudflare/vitest-pool-workers +## 0.6.8 + +### Patch Changes + +- Updated dependencies [[`50b13f6`](https://github.com/cloudflare/workers-sdk/commit/50b13f60af0eac176a000caf7cc799b21fe3f3c5), [`134d61d`](https://github.com/cloudflare/workers-sdk/commit/134d61d97bb96337220e530f4af2ec2c8236f383), [`5c02e46`](https://github.com/cloudflare/workers-sdk/commit/5c02e46c89cce24d81d696173b0e52ce04a8ba59), [`2b6f149`](https://github.com/cloudflare/workers-sdk/commit/2b6f1496685b23b6734c3001db49d3086005582e), [`bd9228e`](https://github.com/cloudflare/workers-sdk/commit/bd9228e855c25b2f5d94e298d6d1128484019f83), [`13ab591`](https://github.com/cloudflare/workers-sdk/commit/13ab5916058e8e834f3e13fb9b5b9d9addc0f930)]: + - wrangler@3.106.0 + - miniflare@3.20250124.0 + ## 0.6.7 ### Patch Changes diff --git a/packages/vitest-pool-workers/package.json b/packages/vitest-pool-workers/package.json index be71ff780979..8223a48317e4 100644 --- a/packages/vitest-pool-workers/package.json +++ b/packages/vitest-pool-workers/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/vitest-pool-workers", - "version": "0.6.7", + "version": "0.6.8", "description": "Workers Vitest integration for writing Vitest unit and integration tests that run inside the Workers runtime", "keywords": [ "cloudflare", diff --git a/packages/workers-shared/CHANGELOG.md b/packages/workers-shared/CHANGELOG.md index a73d5afdc32f..7985a6b3ee5f 100644 --- a/packages/workers-shared/CHANGELOG.md +++ b/packages/workers-shared/CHANGELOG.md @@ -1,5 +1,11 @@ # @cloudflare/workers-shared +## 0.12.5 + +### Patch Changes + +- [#7906](https://github.com/cloudflare/workers-sdk/pull/7906) [`f5eaf4b`](https://github.com/cloudflare/workers-sdk/commit/f5eaf4bd2fcfdf19a40dd3056fc9b36c2654605c) Thanks [@WillTaylorDev](https://github.com/WillTaylorDev)! - Fixes bug in router-worker that prevents unexpected errors from being captured. + ## 0.12.4 ### Patch Changes diff --git a/packages/workers-shared/package.json b/packages/workers-shared/package.json index 13d7c75f7a41..07bfd0746852 100644 --- a/packages/workers-shared/package.json +++ b/packages/workers-shared/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/workers-shared", - "version": "0.12.4", + "version": "0.12.5", "description": "Package that is used at Cloudflare to power some internal features of Cloudflare Workers.", "keywords": [ "cloudflare", diff --git a/packages/wrangler/CHANGELOG.md b/packages/wrangler/CHANGELOG.md index f28b18616827..c4dd65322375 100644 --- a/packages/wrangler/CHANGELOG.md +++ b/packages/wrangler/CHANGELOG.md @@ -1,5 +1,39 @@ # wrangler +## 3.106.0 + +### Minor Changes + +- [#7856](https://github.com/cloudflare/workers-sdk/pull/7856) [`2b6f149`](https://github.com/cloudflare/workers-sdk/commit/2b6f1496685b23b6734c3001db49d3086005582e) Thanks [@emily-shen](https://github.com/emily-shen)! - feat: add sanitised error messages to Wrangler telemetry + + Error messages that have been audited for potential inclusion of personal information, and explicitly opted-in, are now included in Wrangler's telemetry collection. Collected error messages will not include any filepaths, user input or any other potentially private content. + +- [#7900](https://github.com/cloudflare/workers-sdk/pull/7900) [`bd9228e`](https://github.com/cloudflare/workers-sdk/commit/bd9228e855c25b2f5d94e298d6d1128484019f83) Thanks [@vicb](https://github.com/vicb)! - chore(wrangler): update unenv dependency version + + `unenv@2.0.0-rc.1` allows using the workerd implementation for + the Node modules `net`, `timers`, and `timers/promises`. + See `unjs/unenv#396`. + +### Patch Changes + +- [#7904](https://github.com/cloudflare/workers-sdk/pull/7904) [`50b13f6`](https://github.com/cloudflare/workers-sdk/commit/50b13f60af0eac176a000caf7cc799b21fe3f3c5) Thanks [@WalshyDev](https://github.com/WalshyDev)! - fix: validation for R2 bucket names, the regex was wrongly rejecting buckets starting with a number and the message wasn't as clear as it could be on what was going wrong. + +- [#7895](https://github.com/cloudflare/workers-sdk/pull/7895) [`134d61d`](https://github.com/cloudflare/workers-sdk/commit/134d61d97bb96337220e530f4af2ec2c8236f383) Thanks [@jahands](https://github.com/jahands)! - Fix regression in retryOnAPIFailure preventing any requests from being retried + + Also fixes a regression in pipelines that prevented 401 errors from being retried when waiting for an API token to become active. + +- [#7879](https://github.com/cloudflare/workers-sdk/pull/7879) [`5c02e46`](https://github.com/cloudflare/workers-sdk/commit/5c02e46c89cce24d81d696173b0e52ce04a8ba59) Thanks [@andyjessop](https://github.com/andyjessop)! - Fix to not require local connection string when using Hyperdrive and wrangler dev --remote + +- [#7860](https://github.com/cloudflare/workers-sdk/pull/7860) [`13ab591`](https://github.com/cloudflare/workers-sdk/commit/13ab5916058e8e834f3e13fb9b5b9d9addc0f930) Thanks [@vicb](https://github.com/vicb)! - refactor(wrangler): make JSON parsing independent of Node + + Switch `jsonc-parser` to parse json: + + - `JSON.parse()` exception messages are not stable across Node versions + - While `jsonc-parser` is used, JSONC specific syntax is disabled + +- Updated dependencies []: + - miniflare@3.20250124.0 + ## 3.105.1 ### Patch Changes diff --git a/packages/wrangler/package.json b/packages/wrangler/package.json index 67d7fbb47360..bfb0d4c3d7ff 100644 --- a/packages/wrangler/package.json +++ b/packages/wrangler/package.json @@ -1,6 +1,6 @@ { "name": "wrangler", - "version": "3.105.1", + "version": "3.106.0", "description": "Command-line interface for all things Cloudflare Workers", "keywords": [ "wrangler", From cf4f47a8af2dc476f8a0e61f0d22f080f191de1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Somhairle=20MacLe=C3=B2id?= Date: Tue, 28 Jan 2025 12:21:14 +0000 Subject: [PATCH 07/15] Switch to `capnp-es` (#7788) --- .changeset/neat-foxes-cheer.md | 5 + .prettierignore | 4 +- package.json | 1 - packages/miniflare/package.json | 8 +- packages/miniflare/scripts/build-capnp.mjs | 9 + packages/miniflare/scripts/types.mjs | 12 - packages/miniflare/src/http/websocket.ts | 11 +- .../miniflare/src/plugins/assets/index.ts | 7 +- .../miniflare/src/runtime/config/generated.ts | 3302 ++++++++++++++ .../miniflare/src/runtime/config/index.ts | 16 +- .../src/runtime/config/workerd.capnp | 937 ---- .../src/runtime/config/workerd.capnp.d.ts | 1031 ----- .../src/runtime/config/workerd.capnp.js | 1374 ------ .../miniflare/src/runtime/config/workerd.ts | 7 +- .../miniflare/src/workers/core/devalue.ts | 4 +- packages/miniflare/src/workers/shared/data.ts | 5 +- packages/miniflare/test/http/fetch.spec.ts | 2 +- .../miniflare/test/http/websocket.spec.ts | 12 +- .../src/runtime/node/module/index.ts | 2 +- packages/vite-plugin-cloudflare/package.json | 2 +- .../playground/cloudflare-env/package.json | 2 +- .../playground/durable-objects/package.json | 2 +- .../external-durable-objects/package.json | 2 +- .../external-workflows/package.json | 2 +- .../playground/hot-channel/package.json | 2 +- .../playground/module-resolution/package.json | 2 +- .../playground/multi-worker/package.json | 2 +- .../playground/node-compat/package.json | 2 +- .../playground/package.json | 2 +- .../playground/react-spa/package.json | 2 +- .../playground/spa-with-api/package.json | 2 +- .../playground/static-mpa/package.json | 2 +- .../playground/virtual-modules/package.json | 2 +- .../playground/websockets/package.json | 2 +- .../playground/worker/package.json | 2 +- .../playground/workflows/package.json | 2 +- packages/vitest-pool-workers/package.json | 5 +- .../scripts/build-capnp.mjs | 10 + .../scripts/rtti/query.mjs | 15 +- .../scripts/rtti/rtti.capnp | 11 + .../scripts/rtti/rtti.capnp.d.ts | 614 --- .../scripts/rtti/rtti.capnp.js | 773 ---- .../vitest-pool-workers/scripts/rtti/rtti.js | 4048 +++++++++++++++++ .../src/shared/chunking-socket.ts | 2 +- packages/vitest-pool-workers/tsconfig.json | 1 + .../asset-worker/src/assets-manifest.ts | 5 +- .../find-additional-modules.ts | 4 +- .../deployment-bundle/module-collection.ts | 8 +- .../wrangler/src/deployment-bundle/worker.ts | 6 +- packages/wrangler/src/dev/miniflare.ts | 2 +- .../wrangler/src/versions/secrets/index.ts | 2 +- pnpm-lock.yaml | 807 ++-- pnpm-workspace.yaml | 5 +- 53 files changed, 7861 insertions(+), 5240 deletions(-) create mode 100644 .changeset/neat-foxes-cheer.md create mode 100644 packages/miniflare/scripts/build-capnp.mjs create mode 100644 packages/miniflare/src/runtime/config/generated.ts delete mode 100644 packages/miniflare/src/runtime/config/workerd.capnp delete mode 100644 packages/miniflare/src/runtime/config/workerd.capnp.d.ts delete mode 100644 packages/miniflare/src/runtime/config/workerd.capnp.js create mode 100644 packages/vitest-pool-workers/scripts/build-capnp.mjs delete mode 100644 packages/vitest-pool-workers/scripts/rtti/rtti.capnp.d.ts delete mode 100644 packages/vitest-pool-workers/scripts/rtti/rtti.capnp.js create mode 100644 packages/vitest-pool-workers/scripts/rtti/rtti.js diff --git a/.changeset/neat-foxes-cheer.md b/.changeset/neat-foxes-cheer.md new file mode 100644 index 000000000000..9f40dc3550a2 --- /dev/null +++ b/.changeset/neat-foxes-cheer.md @@ -0,0 +1,5 @@ +--- +"miniflare": patch +--- + +Switch to `capnp-es` over `capnp-ts` diff --git a/.prettierignore b/.prettierignore index 86367f47a72f..4f4b4755e4a0 100644 --- a/.prettierignore +++ b/.prettierignore @@ -26,6 +26,8 @@ packages/create-cloudflare/templates*/**/*.* packages/create-cloudflare/templates*/hello-world/**/worker-configuration.d.ts packages/chrome-devtools-patches/devtools-frontend +packages/vitest-pool-workers/scripts/rtti/rtti.js + # dist-functions are generated in the fixtures/vitest-pool-workers-examples/pages-functions-unit-integration-self folder dist-functions @@ -45,4 +47,4 @@ fixtures/interactive-dev-tests/src/startup-error.ts fixtures/pages-redirected-config/build/* fixtures/redirected-config-worker/build/* -packages/vite-plugin-cloudflare/playground/**/*.d.ts \ No newline at end of file +packages/vite-plugin-cloudflare/playground/**/*.d.ts diff --git a/package.json b/package.json index e0ebb3b668db..06bc49572b1a 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,6 @@ }, "patchedDependencies": { "@cloudflare/component-listbox@1.10.6": "patches/@cloudflare__component-listbox@1.10.6.patch", - "capnp-ts@0.7.0": "patches/capnp-ts@0.7.0.patch", "pg@8.11.3": "patches/pg@8.11.3.patch", "toucan-js@3.3.1": "patches/toucan-js@3.3.1.patch" } diff --git a/packages/miniflare/package.json b/packages/miniflare/package.json index c89bdc541406..679e6988e37d 100644 --- a/packages/miniflare/package.json +++ b/packages/miniflare/package.json @@ -31,7 +31,7 @@ ], "scripts": { "build": "node scripts/build.mjs && pnpm run types:build", - "capnp:workerd": "capnpc -o ts src/runtime/config/workerd.capnp", + "capnp:workerd": "node scripts/build-capnp.mjs", "check:lint": "eslint --max-warnings=0 \"{src,test}/**/*.ts\" \"scripts/**/*.{js,mjs}\" \"types/**/*.ts\"", "check:type": "tsc", "clean": "rimraf ./dist ./dist-types", @@ -45,7 +45,6 @@ "@cspotcode/source-map-support": "0.8.1", "acorn": "^8.8.0", "acorn-walk": "^8.2.0", - "capnp-ts": "^0.7.0", "exit-hook": "^2.2.1", "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", @@ -61,7 +60,7 @@ "@cloudflare/workers-shared": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", "@cloudflare/workflows-shared": "workspace:*", - "@microsoft/api-extractor": "^7.47.0", + "@microsoft/api-extractor": "7.49.1", "@types/debug": "^4.1.7", "@types/estree": "^1.0.0", "@types/glob-to-regexp": "^0.4.1", @@ -74,7 +73,7 @@ "@typescript-eslint/eslint-plugin": "^6.9.0", "@typescript-eslint/parser": "^6.9.0", "ava": "^6.0.1", - "capnpc-ts": "^0.7.0", + "capnp-es": "^0.0.7", "concurrently": "^8.2.2", "devalue": "^4.3.0", "devtools-protocol": "^0.0.1182435", @@ -92,6 +91,7 @@ "pretty-bytes": "^6.0.0", "rimraf": "catalog:default", "source-map": "^0.6.1", + "typescript": "catalog:default", "which": "^2.0.2" }, "engines": { diff --git a/packages/miniflare/scripts/build-capnp.mjs b/packages/miniflare/scripts/build-capnp.mjs new file mode 100644 index 000000000000..a45a654a2a2a --- /dev/null +++ b/packages/miniflare/scripts/build-capnp.mjs @@ -0,0 +1,9 @@ +import { execSync } from "node:child_process"; +import { copyFileSync } from "node:fs"; + +execSync("capnp-es node_modules/workerd/workerd.capnp -ots"); + +copyFileSync( + "node_modules/workerd/workerd.ts", + "src/runtime/config/generated.ts" +); diff --git a/packages/miniflare/scripts/types.mjs b/packages/miniflare/scripts/types.mjs index 6c0c9633e377..f98a28431de3 100644 --- a/packages/miniflare/scripts/types.mjs +++ b/packages/miniflare/scripts/types.mjs @@ -148,18 +148,6 @@ function bundleTypes() { fs.copyFileSync(indexTsPath, indexDtsPath); try { - fs.copyFileSync( - path.join(pkgRoot, "src", "runtime", "config", "workerd.capnp.d.ts"), - path.join( - pkgRoot, - "dist-types", - "src", - "runtime", - "config", - "workerd.capnp.d.ts" - ) - ); - const extractorCfg = ExtractorConfig.prepare({ projectFolderLookupToken: pkgRoot, packageJsonFullPath: path.join(pkgRoot, "package.json"), diff --git a/packages/miniflare/src/http/websocket.ts b/packages/miniflare/src/http/websocket.ts index 8ec12a03eaa2..b6fbdba6eac6 100644 --- a/packages/miniflare/src/http/websocket.ts +++ b/packages/miniflare/src/http/websocket.ts @@ -5,9 +5,12 @@ import { TypedEventTarget } from "../shared"; import { ValueOf, viewToBuffer } from "../workers"; export class MessageEvent extends Event { - readonly data: ArrayBuffer | string; + readonly data: string | ArrayBuffer | Uint8Array; - constructor(type: "message", init: { data: ArrayBuffer | string }) { + constructor( + type: "message", + init: { data: string | ArrayBuffer | Uint8Array } + ) { super(type); this.data = init.data; } @@ -115,7 +118,7 @@ export class WebSocket extends TypedEventTarget { } } - send(message: ArrayBuffer | string): void { + send(message: string | ArrayBuffer | Uint8Array): void { if (!this[kAccepted]) { throw new TypeError( "You must call accept() on this WebSocket before sending messages." @@ -124,7 +127,7 @@ export class WebSocket extends TypedEventTarget { this[kSend](message); } - [kSend](message: ArrayBuffer | string): void { + [kSend](message: string | ArrayBuffer | Uint8Array): void { // Split from send() so we can queue messages before accept() is called when // forwarding message events from the client if (this[kClosedOutgoing]) { diff --git a/packages/miniflare/src/plugins/assets/index.ts b/packages/miniflare/src/plugins/assets/index.ts index e25c369e1e53..abed3d1fd844 100644 --- a/packages/miniflare/src/plugins/assets/index.ts +++ b/packages/miniflare/src/plugins/assets/index.ts @@ -305,7 +305,7 @@ const encodeManifest = (manifest: ManifestEntry[]) => { return assetManifestBytes; }; -const bytesToHex = (buffer: ArrayBufferLike) => { +const bytesToHex = (buffer: Uint8Array) => { return [...new Uint8Array(buffer)] .map((b) => b.toString(16).padStart(2, "0")) .join(""); @@ -314,6 +314,9 @@ const bytesToHex = (buffer: ArrayBufferLike) => { const hashPath = async (path: string) => { const encoder = new TextEncoder(); const data = encoder.encode(path); - const hashBuffer = await crypto.subtle.digest("SHA-256", data.buffer); + const hashBuffer = await crypto.subtle.digest( + "SHA-256", + data.buffer as ArrayBuffer + ); return new Uint8Array(hashBuffer, 0, PATH_HASH_SIZE); }; diff --git a/packages/miniflare/src/runtime/config/generated.ts b/packages/miniflare/src/runtime/config/generated.ts new file mode 100644 index 000000000000..a4c02953b42d --- /dev/null +++ b/packages/miniflare/src/runtime/config/generated.ts @@ -0,0 +1,3302 @@ +// This file has been automatically generated by capnp-es. +import * as $ from "capnp-es"; + +export const _capnpFileId = BigInt("0xe6afd26682091c01"); +/** + * Top-level configuration for a workerd instance. + * */ +export class Config extends $.Struct { + static readonly _capnp = { + displayName: "Config", + id: "8794486c76aaa7d6", + size: new $.ObjectSize(0, 5), + }; + static _Services: $.ListCtor; + static _Sockets: $.ListCtor; + static _Extensions: $.ListCtor; + _adoptServices(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(0, this)); + } + _disownServices(): $.Orphan<$.List> { + return $.utils.disown(this.services); + } + /** + * List of named services defined by this server. These names are private; they are only used + * to refer to the services from elsewhere in this config file, as well as for logging and the + * like. Services are not reachable until you configure some way to make them reachable, such + * as via a Socket. + * + * If you do not define any service called "internet", one is defined implicitly, representing + * the ability to access public internet servers. An explicit definition would look like: + * + * ( name = "internet", + * network = ( + * allow = ["public"], # Allows connections to publicly-routable addresses only. + * tlsOptions = (trustBrowserCas = true) + * ) + * ) + * + * The "internet" service backs the global `fetch()` function in a Worker, unless that Worker's + * configuration specifies some other service using the `globalOutbound` setting. + * */ + get services(): $.List { + return $.utils.getList(0, Config._Services, this); + } + _hasServices(): boolean { + return !$.utils.isNull($.utils.getPointer(0, this)); + } + _initServices(length: number): $.List { + return $.utils.initList(0, Config._Services, length, this); + } + set services(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(0, this)); + } + _adoptSockets(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownSockets(): $.Orphan<$.List> { + return $.utils.disown(this.sockets); + } + /** + * List of sockets on which this server will listen, and the services that will be exposed + * through them. + * */ + get sockets(): $.List { + return $.utils.getList(1, Config._Sockets, this); + } + _hasSockets(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initSockets(length: number): $.List { + return $.utils.initList(1, Config._Sockets, length, this); + } + set sockets(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptV8Flags(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownV8Flags(): $.Orphan<$.List> { + return $.utils.disown(this.v8Flags); + } + /** + * List of "command-line" flags to pass to V8, like "--expose-gc". We put these in the config + * rather than on the actual command line because for most use cases, managing these via the + * config file is probably cleaner and easier than passing on the actual CLI. + * + * WARNING: Use at your own risk. V8 flags can have all sorts of wild effects including completely + * breaking everything. V8 flags also generally do not come with any guarantee of stability + * between V8 versions. Most users should not set any V8 flags. + * */ + get v8Flags(): $.List { + return $.utils.getList(2, $.TextList, this); + } + _hasV8Flags(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initV8Flags(length: number): $.List { + return $.utils.initList(2, $.TextList, length, this); + } + set v8Flags(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + _adoptExtensions(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(3, this)); + } + _disownExtensions(): $.Orphan<$.List> { + return $.utils.disown(this.extensions); + } + /** + * Extensions provide capabilities to all workers. Extensions are usually prepared separately + * and are late-linked with the app using this config field. + * */ + get extensions(): $.List { + return $.utils.getList(3, Config._Extensions, this); + } + _hasExtensions(): boolean { + return !$.utils.isNull($.utils.getPointer(3, this)); + } + _initExtensions(length: number): $.List { + return $.utils.initList(3, Config._Extensions, length, this); + } + set extensions(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(3, this)); + } + _adoptAutogates(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(4, this)); + } + _disownAutogates(): $.Orphan<$.List> { + return $.utils.disown(this.autogates); + } + /** + * A list of gates which are enabled. + * These are used to gate features/changes in workerd and in our internal repo. See the equivalent + * config definition in our internal repo for more details. + * */ + get autogates(): $.List { + return $.utils.getList(4, $.TextList, this); + } + _hasAutogates(): boolean { + return !$.utils.isNull($.utils.getPointer(4, this)); + } + _initAutogates(length: number): $.List { + return $.utils.initList(4, $.TextList, length, this); + } + set autogates(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(4, this)); + } + toString(): string { + return "Config_" + super.toString(); + } +} +export class Socket_Https extends $.Struct { + static readonly _capnp = { + displayName: "https", + id: "de123876383cbbdc", + size: new $.ObjectSize(8, 5), + }; + _adoptOptions(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownOptions(): $.Orphan { + return $.utils.disown(this.options); + } + get options(): HttpOptions { + return $.utils.getStruct(2, HttpOptions, this); + } + _hasOptions(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initOptions(): HttpOptions { + return $.utils.initStructAt(2, HttpOptions, this); + } + set options(value: HttpOptions) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + _adoptTlsOptions(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(3, this)); + } + _disownTlsOptions(): $.Orphan { + return $.utils.disown(this.tlsOptions); + } + get tlsOptions(): TlsOptions { + return $.utils.getStruct(3, TlsOptions, this); + } + _hasTlsOptions(): boolean { + return !$.utils.isNull($.utils.getPointer(3, this)); + } + _initTlsOptions(): TlsOptions { + return $.utils.initStructAt(3, TlsOptions, this); + } + set tlsOptions(value: TlsOptions) { + $.utils.copyFrom(value, $.utils.getPointer(3, this)); + } + toString(): string { + return "Socket_Https_" + super.toString(); + } +} +export const Socket_Which = { + HTTP: 0, + HTTPS: 1, +} as const; +export type Socket_Which = (typeof Socket_Which)[keyof typeof Socket_Which]; +export class Socket extends $.Struct { + static readonly HTTP = Socket_Which.HTTP; + static readonly HTTPS = Socket_Which.HTTPS; + static readonly _capnp = { + displayName: "Socket", + id: "9a0eba45530ee79f", + size: new $.ObjectSize(8, 5), + }; + /** + * Each socket has a unique name which can be used on the command line to override the socket's + * address with `--socket-addr =` or `--socket-fd =`. + * */ + get name(): string { + return $.utils.getText(0, this); + } + set name(value: string) { + $.utils.setText(0, value, this); + } + /** + * Address/port on which this socket will listen. Optional; if not specified, then you will be + * required to specify the socket on the command line with with `--socket-addr =` or + * `--socket-fd =`. + * + * Examples: + * - "*:80": Listen on port 80 on all local IPv4 and IPv6 interfaces. + * - "1.2.3.4": Listen on the specific IPv4 address on the default port for the protocol. + * - "1.2.3.4:80": Listen on the specific IPv4 address and port. + * - "1234:5678::abcd": Listen on the specific IPv6 address on the default port for the protocol. + * - "[1234:5678::abcd]:80": Listen on the specific IPv6 address and port. + * - "unix:/path/to/socket": Listen on a Unix socket. + * - "unix-abstract:name": On Linux, listen on the given "abstract" Unix socket name. + * - "example.com:80": Perform a DNS lookup to determine the address, and then listen on it. If + * this resolves to multiple addresses, listen on all of them. + * + * (These are the formats supported by KJ's parseAddress().) + * */ + get address(): string { + return $.utils.getText(1, this); + } + set address(value: string) { + $.utils.setText(1, value, this); + } + _adoptHttp(value: $.Orphan): void { + $.utils.setUint16(0, 0, this); + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownHttp(): $.Orphan { + return $.utils.disown(this.http); + } + get http(): HttpOptions { + $.utils.testWhich("http", $.utils.getUint16(0, this), 0, this); + return $.utils.getStruct(2, HttpOptions, this); + } + _hasHttp(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initHttp(): HttpOptions { + $.utils.setUint16(0, 0, this); + return $.utils.initStructAt(2, HttpOptions, this); + } + get _isHttp(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set http(value: HttpOptions) { + $.utils.setUint16(0, 0, this); + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + get https(): Socket_Https { + $.utils.testWhich("https", $.utils.getUint16(0, this), 1, this); + return $.utils.getAs(Socket_Https, this); + } + _initHttps(): Socket_Https { + $.utils.setUint16(0, 1, this); + return $.utils.getAs(Socket_Https, this); + } + get _isHttps(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set https(_: true) { + $.utils.setUint16(0, 1, this); + } + _adoptService(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(4, this)); + } + _disownService(): $.Orphan { + return $.utils.disown(this.service); + } + /** + * Service name which should handle requests on this socket. + * */ + get service(): ServiceDesignator { + return $.utils.getStruct(4, ServiceDesignator, this); + } + _hasService(): boolean { + return !$.utils.isNull($.utils.getPointer(4, this)); + } + _initService(): ServiceDesignator { + return $.utils.initStructAt(4, ServiceDesignator, this); + } + set service(value: ServiceDesignator) { + $.utils.copyFrom(value, $.utils.getPointer(4, this)); + } + toString(): string { + return "Socket_" + super.toString(); + } + which(): Socket_Which { + return $.utils.getUint16(0, this) as Socket_Which; + } +} +export const Service_Which = { + UNSPECIFIED: 0, + WORKER: 1, + NETWORK: 2, + EXTERNAL: 3, + DISK: 4, +} as const; +export type Service_Which = (typeof Service_Which)[keyof typeof Service_Which]; +/** + * Defines a named service. Each server has a list of named services. The names are private, + * used to refer to the services within this same config file. + * */ +export class Service extends $.Struct { + static readonly UNSPECIFIED = Service_Which.UNSPECIFIED; + static readonly WORKER = Service_Which.WORKER; + static readonly NETWORK = Service_Which.NETWORK; + static readonly EXTERNAL = Service_Which.EXTERNAL; + static readonly DISK = Service_Which.DISK; + static readonly _capnp = { + displayName: "Service", + id: "e5c88e8bb7bcb6b9", + size: new $.ObjectSize(8, 2), + }; + /** + * Name of the service. Used only to refer to the service from elsewhere in the config file. + * Services are not accessible unless you explicitly configure them to be, such as through a + * `Socket` or through a binding from another Worker. + * */ + get name(): string { + return $.utils.getText(0, this); + } + set name(value: string) { + $.utils.setText(0, value, this); + } + get _isUnspecified(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set unspecified(_: true) { + $.utils.setUint16(0, 0, this); + } + _adoptWorker(value: $.Orphan): void { + $.utils.setUint16(0, 1, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownWorker(): $.Orphan { + return $.utils.disown(this.worker); + } + /** + * A Worker! + * */ + get worker(): Worker { + $.utils.testWhich("worker", $.utils.getUint16(0, this), 1, this); + return $.utils.getStruct(1, Worker, this); + } + _hasWorker(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initWorker(): Worker { + $.utils.setUint16(0, 1, this); + return $.utils.initStructAt(1, Worker, this); + } + get _isWorker(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set worker(value: Worker) { + $.utils.setUint16(0, 1, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptNetwork(value: $.Orphan): void { + $.utils.setUint16(0, 2, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownNetwork(): $.Orphan { + return $.utils.disown(this.network); + } + /** + * A service that implements access to a network. fetch() requests are routed according to + * the URL hostname. + * */ + get network(): Network { + $.utils.testWhich("network", $.utils.getUint16(0, this), 2, this); + return $.utils.getStruct(1, Network, this); + } + _hasNetwork(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initNetwork(): Network { + $.utils.setUint16(0, 2, this); + return $.utils.initStructAt(1, Network, this); + } + get _isNetwork(): boolean { + return $.utils.getUint16(0, this) === 2; + } + set network(value: Network) { + $.utils.setUint16(0, 2, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptExternal(value: $.Orphan): void { + $.utils.setUint16(0, 3, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownExternal(): $.Orphan { + return $.utils.disown(this.external); + } + /** + * A service that forwards all requests to a specific remote server. Typically used to + * connect to a back-end server on your internal network. + * */ + get external(): ExternalServer { + $.utils.testWhich("external", $.utils.getUint16(0, this), 3, this); + return $.utils.getStruct(1, ExternalServer, this); + } + _hasExternal(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initExternal(): ExternalServer { + $.utils.setUint16(0, 3, this); + return $.utils.initStructAt(1, ExternalServer, this); + } + get _isExternal(): boolean { + return $.utils.getUint16(0, this) === 3; + } + set external(value: ExternalServer) { + $.utils.setUint16(0, 3, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptDisk(value: $.Orphan): void { + $.utils.setUint16(0, 4, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownDisk(): $.Orphan { + return $.utils.disown(this.disk); + } + /** + * An HTTP service backed by a directory on disk, supporting a basic HTTP GET/PUT. Generally + * not intended to be exposed directly to the internet; typically you want to bind this into + * a Worker that adds logic for setting Content-Type and the like. + * */ + get disk(): DiskDirectory { + $.utils.testWhich("disk", $.utils.getUint16(0, this), 4, this); + return $.utils.getStruct(1, DiskDirectory, this); + } + _hasDisk(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initDisk(): DiskDirectory { + $.utils.setUint16(0, 4, this); + return $.utils.initStructAt(1, DiskDirectory, this); + } + get _isDisk(): boolean { + return $.utils.getUint16(0, this) === 4; + } + set disk(value: DiskDirectory) { + $.utils.setUint16(0, 4, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + toString(): string { + return "Service_" + super.toString(); + } + which(): Service_Which { + return $.utils.getUint16(0, this) as Service_Which; + } +} +export const ServiceDesignator_Props_Which = { + EMPTY: 0, + JSON: 1, +} as const; +export type ServiceDesignator_Props_Which = + (typeof ServiceDesignator_Props_Which)[keyof typeof ServiceDesignator_Props_Which]; +/** + * Value to provide in `ctx.props` in the target worker. + * */ +export class ServiceDesignator_Props extends $.Struct { + static readonly EMPTY = ServiceDesignator_Props_Which.EMPTY; + static readonly JSON = ServiceDesignator_Props_Which.JSON; + static readonly _capnp = { + displayName: "props", + id: "f0dc90173b494522", + size: new $.ObjectSize(8, 3), + }; + get _isEmpty(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set empty(_: true) { + $.utils.setUint16(0, 0, this); + } + /** + * A JSON-encoded value. + * */ + get json(): string { + $.utils.testWhich("json", $.utils.getUint16(0, this), 1, this); + return $.utils.getText(2, this); + } + get _isJson(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set json(value: string) { + $.utils.setUint16(0, 1, this); + $.utils.setText(2, value, this); + } + toString(): string { + return "ServiceDesignator_Props_" + super.toString(); + } + which(): ServiceDesignator_Props_Which { + return $.utils.getUint16(0, this) as ServiceDesignator_Props_Which; + } +} +/** + * A reference to a service from elsewhere in the config file, e.g. from a service binding in a + * Worker. + * + * In the case that only `name` needs to be specified, then you can provide a raw string wherever + * `ServiceDesignator` is needed. Cap'n proto automatically assumes the string is intended to be + * the value for `name`, since that is the first field. In other words, if you would otherwise + * write something like: + * + * bindings = [(service = (name = "foo"))] + * + * You can write this instead, which is equivalent: + * + * bindings = [(service = "foo")] + * */ +export class ServiceDesignator extends $.Struct { + static readonly _capnp = { + displayName: "ServiceDesignator", + id: "ae8ec91cee724450", + size: new $.ObjectSize(8, 3), + }; + /** + * Name of the service in the Config.services list. + * */ + get name(): string { + return $.utils.getText(0, this); + } + set name(value: string) { + $.utils.setText(0, value, this); + } + /** + * A modules-syntax Worker can export multiple named entrypoints. `export default {` specifies + * the default entrypoint, whereas `export let foo = {` defines an entrypoint named `foo`. If + * `entrypoint` is specified here, it names an alternate entrypoint to use on the target worker, + * otherwise the default is used. + * */ + get entrypoint(): string { + return $.utils.getText(1, this); + } + set entrypoint(value: string) { + $.utils.setText(1, value, this); + } + /** + * Value to provide in `ctx.props` in the target worker. + * */ + get props(): ServiceDesignator_Props { + return $.utils.getAs(ServiceDesignator_Props, this); + } + _initProps(): ServiceDesignator_Props { + return $.utils.getAs(ServiceDesignator_Props, this); + } + toString(): string { + return "ServiceDesignator_" + super.toString(); + } +} +export const Worker_Module_Which = { + ES_MODULE: 0, + COMMON_JS_MODULE: 1, + TEXT: 2, + DATA: 3, + WASM: 4, + JSON: 5, + NODE_JS_COMPAT_MODULE: 6, + PYTHON_MODULE: 7, + PYTHON_REQUIREMENT: 8, +} as const; +export type Worker_Module_Which = + (typeof Worker_Module_Which)[keyof typeof Worker_Module_Which]; +export class Worker_Module extends $.Struct { + static readonly ES_MODULE = Worker_Module_Which.ES_MODULE; + static readonly COMMON_JS_MODULE = Worker_Module_Which.COMMON_JS_MODULE; + static readonly TEXT = Worker_Module_Which.TEXT; + static readonly DATA = Worker_Module_Which.DATA; + static readonly WASM = Worker_Module_Which.WASM; + static readonly JSON = Worker_Module_Which.JSON; + static readonly NODE_JS_COMPAT_MODULE = + Worker_Module_Which.NODE_JS_COMPAT_MODULE; + static readonly PYTHON_MODULE = Worker_Module_Which.PYTHON_MODULE; + static readonly PYTHON_REQUIREMENT = Worker_Module_Which.PYTHON_REQUIREMENT; + static readonly _capnp = { + displayName: "Module", + id: "d9d87a63770a12f3", + size: new $.ObjectSize(8, 3), + }; + /** + * Name (or path) used to import the module. + * */ + get name(): string { + return $.utils.getText(0, this); + } + set name(value: string) { + $.utils.setText(0, value, this); + } + /** + * An ES module file with imports and exports. + * + * As with `serviceWorkerScript`, above, the value is the raw source code. + * */ + get esModule(): string { + $.utils.testWhich("esModule", $.utils.getUint16(0, this), 0, this); + return $.utils.getText(1, this); + } + get _isEsModule(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set esModule(value: string) { + $.utils.setUint16(0, 0, this); + $.utils.setText(1, value, this); + } + /** + * A common JS module, using require(). + * */ + get commonJsModule(): string { + $.utils.testWhich("commonJsModule", $.utils.getUint16(0, this), 1, this); + return $.utils.getText(1, this); + } + get _isCommonJsModule(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set commonJsModule(value: string) { + $.utils.setUint16(0, 1, this); + $.utils.setText(1, value, this); + } + /** + * A raw text blob. Importing this will produce a string with the value. + * */ + get text(): string { + $.utils.testWhich("text", $.utils.getUint16(0, this), 2, this); + return $.utils.getText(1, this); + } + get _isText(): boolean { + return $.utils.getUint16(0, this) === 2; + } + set text(value: string) { + $.utils.setUint16(0, 2, this); + $.utils.setText(1, value, this); + } + _adoptData(value: $.Orphan<$.Data>): void { + $.utils.setUint16(0, 3, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownData(): $.Orphan<$.Data> { + return $.utils.disown(this.data); + } + /** + * A raw data blob. Importing this will produce an ArrayBuffer with the value. + * */ + get data(): $.Data { + $.utils.testWhich("data", $.utils.getUint16(0, this), 3, this); + return $.utils.getData(1, this); + } + _hasData(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initData(length: number): $.Data { + $.utils.setUint16(0, 3, this); + return $.utils.initData(1, length, this); + } + get _isData(): boolean { + return $.utils.getUint16(0, this) === 3; + } + set data(value: $.Data) { + $.utils.setUint16(0, 3, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptWasm(value: $.Orphan<$.Data>): void { + $.utils.setUint16(0, 4, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownWasm(): $.Orphan<$.Data> { + return $.utils.disown(this.wasm); + } + /** + * A Wasm module. The value is a compiled binary Wasm module file. Importing this will produce + * a `WebAssembly.Module` object, which you can then instantiate. + * */ + get wasm(): $.Data { + $.utils.testWhich("wasm", $.utils.getUint16(0, this), 4, this); + return $.utils.getData(1, this); + } + _hasWasm(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initWasm(length: number): $.Data { + $.utils.setUint16(0, 4, this); + return $.utils.initData(1, length, this); + } + get _isWasm(): boolean { + return $.utils.getUint16(0, this) === 4; + } + set wasm(value: $.Data) { + $.utils.setUint16(0, 4, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + /** + * Importing this will produce the result of parsing the given text as JSON. + * */ + get json(): string { + $.utils.testWhich("json", $.utils.getUint16(0, this), 5, this); + return $.utils.getText(1, this); + } + get _isJson(): boolean { + return $.utils.getUint16(0, this) === 5; + } + set json(value: string) { + $.utils.setUint16(0, 5, this); + $.utils.setText(1, value, this); + } + /** + * A Node.js module is a specialization of a commonJsModule that: + * (a) allows for importing Node.js-compat built-ins without the node: specifier-prefix + * (b) exposes the subset of common Node.js globals such as process, Buffer, etc that + * we implement in the workerd runtime. + * */ + get nodeJsCompatModule(): string { + $.utils.testWhich( + "nodeJsCompatModule", + $.utils.getUint16(0, this), + 6, + this + ); + return $.utils.getText(1, this); + } + get _isNodeJsCompatModule(): boolean { + return $.utils.getUint16(0, this) === 6; + } + set nodeJsCompatModule(value: string) { + $.utils.setUint16(0, 6, this); + $.utils.setText(1, value, this); + } + /** + * A Python module. All bundles containing this value type are converted into a JS/WASM Worker + * Bundle prior to execution. + * */ + get pythonModule(): string { + $.utils.testWhich("pythonModule", $.utils.getUint16(0, this), 7, this); + return $.utils.getText(1, this); + } + get _isPythonModule(): boolean { + return $.utils.getUint16(0, this) === 7; + } + set pythonModule(value: string) { + $.utils.setUint16(0, 7, this); + $.utils.setText(1, value, this); + } + /** + * A Python package that is required by this bundle. The package must be supported by + * Pyodide (https://pyodide.org/en/stable/usage/packages-in-pyodide.html). All packages listed + * will be installed prior to the execution of the worker. + * */ + get pythonRequirement(): string { + $.utils.testWhich("pythonRequirement", $.utils.getUint16(0, this), 8, this); + return $.utils.getText(1, this); + } + get _isPythonRequirement(): boolean { + return $.utils.getUint16(0, this) === 8; + } + set pythonRequirement(value: string) { + $.utils.setUint16(0, 8, this); + $.utils.setText(1, value, this); + } + _adoptNamedExports(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownNamedExports(): $.Orphan<$.List> { + return $.utils.disown(this.namedExports); + } + /** + * For commonJsModule and nodeJsCompatModule, this is a list of named exports that the + * module expects to be exported once the evaluation is complete. + * */ + get namedExports(): $.List { + return $.utils.getList(2, $.TextList, this); + } + _hasNamedExports(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initNamedExports(length: number): $.List { + return $.utils.initList(2, $.TextList, length, this); + } + set namedExports(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + toString(): string { + return "Worker_Module_" + super.toString(); + } + which(): Worker_Module_Which { + return $.utils.getUint16(0, this) as Worker_Module_Which; + } +} +export const Worker_Binding_Type_Which = { + UNSPECIFIED: 0, + TEXT: 1, + DATA: 2, + JSON: 3, + WASM: 4, + CRYPTO_KEY: 5, + SERVICE: 6, + DURABLE_OBJECT_NAMESPACE: 7, + KV_NAMESPACE: 8, + R2BUCKET: 9, + R2ADMIN: 10, + QUEUE: 11, + ANALYTICS_ENGINE: 12, + HYPERDRIVE: 13, +} as const; +export type Worker_Binding_Type_Which = + (typeof Worker_Binding_Type_Which)[keyof typeof Worker_Binding_Type_Which]; +/** + * Specifies the type of a parameter binding. + * */ +export class Worker_Binding_Type extends $.Struct { + static readonly UNSPECIFIED = Worker_Binding_Type_Which.UNSPECIFIED; + static readonly TEXT = Worker_Binding_Type_Which.TEXT; + static readonly DATA = Worker_Binding_Type_Which.DATA; + static readonly JSON = Worker_Binding_Type_Which.JSON; + static readonly WASM = Worker_Binding_Type_Which.WASM; + static readonly CRYPTO_KEY = Worker_Binding_Type_Which.CRYPTO_KEY; + static readonly SERVICE = Worker_Binding_Type_Which.SERVICE; + static readonly DURABLE_OBJECT_NAMESPACE = + Worker_Binding_Type_Which.DURABLE_OBJECT_NAMESPACE; + static readonly KV_NAMESPACE = Worker_Binding_Type_Which.KV_NAMESPACE; + static readonly R2BUCKET = Worker_Binding_Type_Which.R2BUCKET; + static readonly R2ADMIN = Worker_Binding_Type_Which.R2ADMIN; + static readonly QUEUE = Worker_Binding_Type_Which.QUEUE; + static readonly ANALYTICS_ENGINE = Worker_Binding_Type_Which.ANALYTICS_ENGINE; + static readonly HYPERDRIVE = Worker_Binding_Type_Which.HYPERDRIVE; + static readonly _capnp = { + displayName: "Type", + id: "8906a1296519bf8a", + size: new $.ObjectSize(8, 1), + }; + get _isUnspecified(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set unspecified(_: true) { + $.utils.setUint16(0, 0, this); + } + get _isText(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set text(_: true) { + $.utils.setUint16(0, 1, this); + } + get _isData(): boolean { + return $.utils.getUint16(0, this) === 2; + } + set data(_: true) { + $.utils.setUint16(0, 2, this); + } + get _isJson(): boolean { + return $.utils.getUint16(0, this) === 3; + } + set json(_: true) { + $.utils.setUint16(0, 3, this); + } + get _isWasm(): boolean { + return $.utils.getUint16(0, this) === 4; + } + set wasm(_: true) { + $.utils.setUint16(0, 4, this); + } + _adoptCryptoKey( + value: $.Orphan<$.List> + ): void { + $.utils.setUint16(0, 5, this); + $.utils.adopt(value, $.utils.getPointer(0, this)); + } + _disownCryptoKey(): $.Orphan<$.List> { + return $.utils.disown(this.cryptoKey); + } + get cryptoKey(): $.List { + $.utils.testWhich("cryptoKey", $.utils.getUint16(0, this), 5, this); + return $.utils.getList( + 0, + $.Uint16List, + this + ) as $.List; + } + _hasCryptoKey(): boolean { + return !$.utils.isNull($.utils.getPointer(0, this)); + } + _initCryptoKey(length: number): $.List { + $.utils.setUint16(0, 5, this); + return $.utils.initList( + 0, + $.Uint16List, + length, + this + ) as $.List; + } + get _isCryptoKey(): boolean { + return $.utils.getUint16(0, this) === 5; + } + set cryptoKey(value: $.List) { + $.utils.setUint16(0, 5, this); + $.utils.copyFrom(value, $.utils.getPointer(0, this)); + } + get _isService(): boolean { + return $.utils.getUint16(0, this) === 6; + } + set service(_: true) { + $.utils.setUint16(0, 6, this); + } + get _isDurableObjectNamespace(): boolean { + return $.utils.getUint16(0, this) === 7; + } + set durableObjectNamespace(_: true) { + $.utils.setUint16(0, 7, this); + } + get _isKvNamespace(): boolean { + return $.utils.getUint16(0, this) === 8; + } + set kvNamespace(_: true) { + $.utils.setUint16(0, 8, this); + } + get _isR2Bucket(): boolean { + return $.utils.getUint16(0, this) === 9; + } + set r2Bucket(_: true) { + $.utils.setUint16(0, 9, this); + } + get _isR2Admin(): boolean { + return $.utils.getUint16(0, this) === 10; + } + set r2Admin(_: true) { + $.utils.setUint16(0, 10, this); + } + get _isQueue(): boolean { + return $.utils.getUint16(0, this) === 11; + } + set queue(_: true) { + $.utils.setUint16(0, 11, this); + } + get _isAnalyticsEngine(): boolean { + return $.utils.getUint16(0, this) === 12; + } + set analyticsEngine(_: true) { + $.utils.setUint16(0, 12, this); + } + get _isHyperdrive(): boolean { + return $.utils.getUint16(0, this) === 13; + } + set hyperdrive(_: true) { + $.utils.setUint16(0, 13, this); + } + toString(): string { + return "Worker_Binding_Type_" + super.toString(); + } + which(): Worker_Binding_Type_Which { + return $.utils.getUint16(0, this) as Worker_Binding_Type_Which; + } +} +/** + * The type of a Durable Object namespace binding. + * */ +export class Worker_Binding_DurableObjectNamespaceDesignator extends $.Struct { + static readonly _capnp = { + displayName: "DurableObjectNamespaceDesignator", + id: "804f144ff477aac7", + size: new $.ObjectSize(0, 2), + }; + /** + * Exported class name that implements the Durable Object. + * */ + get className(): string { + return $.utils.getText(0, this); + } + set className(value: string) { + $.utils.setText(0, value, this); + } + /** + * The service name of the worker that defines this class. If omitted, the current worker + * is assumed. + * + * Use of this field is discouraged. Instead, when accessing a different Worker's Durable + * Objects, specify a `service` binding to that worker, and have the worker implement an + * appropriate API. + * + * (This is intentionally not a ServiceDesignator because you cannot choose an alternate + * entrypoint here; the class name IS the entrypoint.) + * */ + get serviceName(): string { + return $.utils.getText(1, this); + } + set serviceName(value: string) { + $.utils.setText(1, value, this); + } + toString(): string { + return ( + "Worker_Binding_DurableObjectNamespaceDesignator_" + super.toString() + ); + } +} +export const Worker_Binding_CryptoKey_Usage = { + ENCRYPT: 0, + DECRYPT: 1, + SIGN: 2, + VERIFY: 3, + DERIVE_KEY: 4, + DERIVE_BITS: 5, + WRAP_KEY: 6, + UNWRAP_KEY: 7, +} as const; +export type Worker_Binding_CryptoKey_Usage = + (typeof Worker_Binding_CryptoKey_Usage)[keyof typeof Worker_Binding_CryptoKey_Usage]; +export const Worker_Binding_CryptoKey_Algorithm_Which = { + NAME: 0, + JSON: 1, +} as const; +export type Worker_Binding_CryptoKey_Algorithm_Which = + (typeof Worker_Binding_CryptoKey_Algorithm_Which)[keyof typeof Worker_Binding_CryptoKey_Algorithm_Which]; +/** + * Value for the `algorithm` parameter. + * */ +export class Worker_Binding_CryptoKey_Algorithm extends $.Struct { + static readonly NAME = Worker_Binding_CryptoKey_Algorithm_Which.NAME; + static readonly JSON = Worker_Binding_CryptoKey_Algorithm_Which.JSON; + static readonly _capnp = { + displayName: "algorithm", + id: "a1a040c5e00d7021", + size: new $.ObjectSize(8, 3), + }; + /** + * Just a name, like `AES-GCM`. + * */ + get name(): string { + $.utils.testWhich("name", $.utils.getUint16(2, this), 0, this); + return $.utils.getText(1, this); + } + get _isName(): boolean { + return $.utils.getUint16(2, this) === 0; + } + set name(value: string) { + $.utils.setUint16(2, 0, this); + $.utils.setText(1, value, this); + } + /** + * An object, encoded here as JSON. + * */ + get json(): string { + $.utils.testWhich("json", $.utils.getUint16(2, this), 1, this); + return $.utils.getText(1, this); + } + get _isJson(): boolean { + return $.utils.getUint16(2, this) === 1; + } + set json(value: string) { + $.utils.setUint16(2, 1, this); + $.utils.setText(1, value, this); + } + toString(): string { + return "Worker_Binding_CryptoKey_Algorithm_" + super.toString(); + } + which(): Worker_Binding_CryptoKey_Algorithm_Which { + return $.utils.getUint16( + 2, + this + ) as Worker_Binding_CryptoKey_Algorithm_Which; + } +} +export const Worker_Binding_CryptoKey_Which = { + RAW: 0, + HEX: 1, + BASE64: 2, + PKCS8: 3, + SPKI: 4, + JWK: 5, +} as const; +export type Worker_Binding_CryptoKey_Which = + (typeof Worker_Binding_CryptoKey_Which)[keyof typeof Worker_Binding_CryptoKey_Which]; +/** + * Parameters to crypto.subtle.importKey(). + * */ +export class Worker_Binding_CryptoKey extends $.Struct { + static readonly RAW = Worker_Binding_CryptoKey_Which.RAW; + static readonly HEX = Worker_Binding_CryptoKey_Which.HEX; + static readonly BASE64 = Worker_Binding_CryptoKey_Which.BASE64; + static readonly PKCS8 = Worker_Binding_CryptoKey_Which.PKCS8; + static readonly SPKI = Worker_Binding_CryptoKey_Which.SPKI; + static readonly JWK = Worker_Binding_CryptoKey_Which.JWK; + static readonly Usage = Worker_Binding_CryptoKey_Usage; + static readonly _capnp = { + displayName: "CryptoKey", + id: "b5e1bff0e57d6eb0", + size: new $.ObjectSize(8, 3), + defaultExtractable: $.getBitMask(false, 0), + }; + _adoptRaw(value: $.Orphan<$.Data>): void { + $.utils.setUint16(0, 0, this); + $.utils.adopt(value, $.utils.getPointer(0, this)); + } + _disownRaw(): $.Orphan<$.Data> { + return $.utils.disown(this.raw); + } + get raw(): $.Data { + $.utils.testWhich("raw", $.utils.getUint16(0, this), 0, this); + return $.utils.getData(0, this); + } + _hasRaw(): boolean { + return !$.utils.isNull($.utils.getPointer(0, this)); + } + _initRaw(length: number): $.Data { + $.utils.setUint16(0, 0, this); + return $.utils.initData(0, length, this); + } + get _isRaw(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set raw(value: $.Data) { + $.utils.setUint16(0, 0, this); + $.utils.copyFrom(value, $.utils.getPointer(0, this)); + } + get hex(): string { + $.utils.testWhich("hex", $.utils.getUint16(0, this), 1, this); + return $.utils.getText(0, this); + } + get _isHex(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set hex(value: string) { + $.utils.setUint16(0, 1, this); + $.utils.setText(0, value, this); + } + /** + * Raw key material, possibly hex or base64-encoded. Use this for symmetric keys. + * + * Hint: `raw` would typically be used with Cap'n Proto's `embed` syntax to embed an + * external binary key file. `hex` or `base64` could do that too but can also be specified + * inline. + * */ + get base64(): string { + $.utils.testWhich("base64", $.utils.getUint16(0, this), 2, this); + return $.utils.getText(0, this); + } + get _isBase64(): boolean { + return $.utils.getUint16(0, this) === 2; + } + set base64(value: string) { + $.utils.setUint16(0, 2, this); + $.utils.setText(0, value, this); + } + /** + * Private key in PEM-encoded PKCS#8 format. + * */ + get pkcs8(): string { + $.utils.testWhich("pkcs8", $.utils.getUint16(0, this), 3, this); + return $.utils.getText(0, this); + } + get _isPkcs8(): boolean { + return $.utils.getUint16(0, this) === 3; + } + set pkcs8(value: string) { + $.utils.setUint16(0, 3, this); + $.utils.setText(0, value, this); + } + /** + * Public key in PEM-encoded SPKI format. + * */ + get spki(): string { + $.utils.testWhich("spki", $.utils.getUint16(0, this), 4, this); + return $.utils.getText(0, this); + } + get _isSpki(): boolean { + return $.utils.getUint16(0, this) === 4; + } + set spki(value: string) { + $.utils.setUint16(0, 4, this); + $.utils.setText(0, value, this); + } + /** + * Key in JSON format. + * */ + get jwk(): string { + $.utils.testWhich("jwk", $.utils.getUint16(0, this), 5, this); + return $.utils.getText(0, this); + } + get _isJwk(): boolean { + return $.utils.getUint16(0, this) === 5; + } + set jwk(value: string) { + $.utils.setUint16(0, 5, this); + $.utils.setText(0, value, this); + } + /** + * Value for the `algorithm` parameter. + * */ + get algorithm(): Worker_Binding_CryptoKey_Algorithm { + return $.utils.getAs(Worker_Binding_CryptoKey_Algorithm, this); + } + _initAlgorithm(): Worker_Binding_CryptoKey_Algorithm { + return $.utils.getAs(Worker_Binding_CryptoKey_Algorithm, this); + } + /** + * Is the Worker allowed to export this key to obtain the underlying key material? Setting + * this false ensures that the key cannot be leaked by errant JavaScript code; the key can + * only be used in WebCrypto operations. + * */ + get extractable(): boolean { + return $.utils.getBit( + 32, + this, + Worker_Binding_CryptoKey._capnp.defaultExtractable + ); + } + set extractable(value: boolean) { + $.utils.setBit( + 32, + value, + this, + Worker_Binding_CryptoKey._capnp.defaultExtractable + ); + } + _adoptUsages(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownUsages(): $.Orphan<$.List> { + return $.utils.disown(this.usages); + } + /** + * What operations is this key permitted to be used for? + * */ + get usages(): $.List { + return $.utils.getList( + 2, + $.Uint16List, + this + ) as $.List; + } + _hasUsages(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initUsages(length: number): $.List { + return $.utils.initList( + 2, + $.Uint16List, + length, + this + ) as $.List; + } + set usages(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + toString(): string { + return "Worker_Binding_CryptoKey_" + super.toString(); + } + which(): Worker_Binding_CryptoKey_Which { + return $.utils.getUint16(0, this) as Worker_Binding_CryptoKey_Which; + } +} +export class Worker_Binding_MemoryCacheLimits extends $.Struct { + static readonly _capnp = { + displayName: "MemoryCacheLimits", + id: "8d66725b0867e634", + size: new $.ObjectSize(16, 0), + }; + get maxKeys(): number { + return $.utils.getUint32(0, this); + } + set maxKeys(value: number) { + $.utils.setUint32(0, value, this); + } + get maxValueSize(): number { + return $.utils.getUint32(4, this); + } + set maxValueSize(value: number) { + $.utils.setUint32(4, value, this); + } + get maxTotalValueSize(): bigint { + return $.utils.getUint64(8, this); + } + set maxTotalValueSize(value: bigint) { + $.utils.setUint64(8, value, this); + } + toString(): string { + return "Worker_Binding_MemoryCacheLimits_" + super.toString(); + } +} +/** + * A binding that wraps a group of (lower-level) bindings in a common API. + * */ +export class Worker_Binding_WrappedBinding extends $.Struct { + static readonly _capnp = { + displayName: "WrappedBinding", + id: "e6f066b75f0ea113", + size: new $.ObjectSize(0, 3), + defaultEntrypoint: "default", + }; + static _InnerBindings: $.ListCtor; + /** + * Wrapper module name. + * The module must be an internal one (provided by extension or registered in the c++ code). + * Module will be instantitated during binding initialization phase. + * */ + get moduleName(): string { + return $.utils.getText(0, this); + } + set moduleName(value: string) { + $.utils.setText(0, value, this); + } + /** + * Module needs to export a function with a given name (default export gets "default" name). + * The function needs to accept a single `env` argument - a dictionary with inner bindings. + * Function will be invoked during initialization phase and its return value will be used as + * resulting binding value. + * */ + get entrypoint(): string { + return $.utils.getText( + 1, + this, + Worker_Binding_WrappedBinding._capnp.defaultEntrypoint + ); + } + set entrypoint(value: string) { + $.utils.setText(1, value, this); + } + _adoptInnerBindings(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownInnerBindings(): $.Orphan<$.List> { + return $.utils.disown(this.innerBindings); + } + /** + * Inner bindings that will be created and passed in the env dictionary. + * These bindings shall be used to implement end-user api, and are not available to the + * binding consumers unless "re-exported" in wrapBindings function. + * */ + get innerBindings(): $.List { + return $.utils.getList( + 2, + Worker_Binding_WrappedBinding._InnerBindings, + this + ); + } + _hasInnerBindings(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initInnerBindings(length: number): $.List { + return $.utils.initList( + 2, + Worker_Binding_WrappedBinding._InnerBindings, + length, + this + ); + } + set innerBindings(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + toString(): string { + return "Worker_Binding_WrappedBinding_" + super.toString(); + } +} +/** + * Indicates that the Worker requires a binding of the given type, but it won't be specified + * here. Another Worker can inherit this Worker and fill in this binding. + * */ +export class Worker_Binding_Parameter extends $.Struct { + static readonly _capnp = { + displayName: "parameter", + id: "dc57e1258d26d152", + size: new $.ObjectSize(8, 6), + }; + _adoptType(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownType(): $.Orphan { + return $.utils.disown(this.type); + } + /** + * Expected type of this parameter. + * */ + get type(): Worker_Binding_Type { + return $.utils.getStruct(1, Worker_Binding_Type, this); + } + _hasType(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initType(): Worker_Binding_Type { + return $.utils.initStructAt(1, Worker_Binding_Type, this); + } + set type(value: Worker_Binding_Type) { + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + /** + * If true, this binding is optional. Derived workers need not specify it, in which case + * the binding won't be present in the environment object passed to the worker. + * + * When a Worker has any non-optional parameters that haven't been filled in, then it can + * only be used for inheritance; it cannot be invoked directly. + * */ + get optional(): boolean { + return $.utils.getBit(16, this); + } + set optional(value: boolean) { + $.utils.setBit(16, value, this); + } + toString(): string { + return "Worker_Binding_Parameter_" + super.toString(); + } +} +/** + * A binding for Hyperdrive. Allows workers to use Hyperdrive caching & pooling for Postgres + * databases. + * */ +export class Worker_Binding_Hyperdrive extends $.Struct { + static readonly _capnp = { + displayName: "hyperdrive", + id: "ad6c391cd55f3134", + size: new $.ObjectSize(8, 6), + }; + _adoptDesignator(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownDesignator(): $.Orphan { + return $.utils.disown(this.designator); + } + get designator(): ServiceDesignator { + return $.utils.getStruct(1, ServiceDesignator, this); + } + _hasDesignator(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initDesignator(): ServiceDesignator { + return $.utils.initStructAt(1, ServiceDesignator, this); + } + set designator(value: ServiceDesignator) { + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + get database(): string { + return $.utils.getText(2, this); + } + set database(value: string) { + $.utils.setText(2, value, this); + } + get user(): string { + return $.utils.getText(3, this); + } + set user(value: string) { + $.utils.setText(3, value, this); + } + get password(): string { + return $.utils.getText(4, this); + } + set password(value: string) { + $.utils.setText(4, value, this); + } + get scheme(): string { + return $.utils.getText(5, this); + } + set scheme(value: string) { + $.utils.setText(5, value, this); + } + toString(): string { + return "Worker_Binding_Hyperdrive_" + super.toString(); + } +} +/** + * A binding representing access to an in-memory cache. + * */ +export class Worker_Binding_MemoryCache extends $.Struct { + static readonly _capnp = { + displayName: "memoryCache", + id: "aed5760c349869da", + size: new $.ObjectSize(8, 6), + }; + /** + * The identifier associated with this cache. Any number of isolates + * can access the same in-memory cache (within the same process), and + * each worker may use any number of in-memory caches. + * */ + get id(): string { + return $.utils.getText(1, this); + } + set id(value: string) { + $.utils.setText(1, value, this); + } + _adoptLimits(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownLimits(): $.Orphan { + return $.utils.disown(this.limits); + } + get limits(): Worker_Binding_MemoryCacheLimits { + return $.utils.getStruct(2, Worker_Binding_MemoryCacheLimits, this); + } + _hasLimits(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initLimits(): Worker_Binding_MemoryCacheLimits { + return $.utils.initStructAt(2, Worker_Binding_MemoryCacheLimits, this); + } + set limits(value: Worker_Binding_MemoryCacheLimits) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + toString(): string { + return "Worker_Binding_MemoryCache_" + super.toString(); + } +} +export const Worker_Binding_Which = { + UNSPECIFIED: 0, + PARAMETER: 1, + TEXT: 2, + DATA: 3, + JSON: 4, + WASM_MODULE: 5, + CRYPTO_KEY: 6, + SERVICE: 7, + DURABLE_OBJECT_NAMESPACE: 8, + KV_NAMESPACE: 9, + R2BUCKET: 10, + R2ADMIN: 11, + WRAPPED: 12, + QUEUE: 13, + FROM_ENVIRONMENT: 14, + ANALYTICS_ENGINE: 15, + HYPERDRIVE: 16, + UNSAFE_EVAL: 17, + MEMORY_CACHE: 18, +} as const; +export type Worker_Binding_Which = + (typeof Worker_Binding_Which)[keyof typeof Worker_Binding_Which]; +export class Worker_Binding extends $.Struct { + static readonly UNSPECIFIED = Worker_Binding_Which.UNSPECIFIED; + static readonly PARAMETER = Worker_Binding_Which.PARAMETER; + static readonly TEXT = Worker_Binding_Which.TEXT; + static readonly DATA = Worker_Binding_Which.DATA; + static readonly JSON = Worker_Binding_Which.JSON; + static readonly WASM_MODULE = Worker_Binding_Which.WASM_MODULE; + static readonly CRYPTO_KEY = Worker_Binding_Which.CRYPTO_KEY; + static readonly SERVICE = Worker_Binding_Which.SERVICE; + static readonly DURABLE_OBJECT_NAMESPACE = + Worker_Binding_Which.DURABLE_OBJECT_NAMESPACE; + static readonly KV_NAMESPACE = Worker_Binding_Which.KV_NAMESPACE; + static readonly R2BUCKET = Worker_Binding_Which.R2BUCKET; + static readonly R2ADMIN = Worker_Binding_Which.R2ADMIN; + static readonly WRAPPED = Worker_Binding_Which.WRAPPED; + static readonly QUEUE = Worker_Binding_Which.QUEUE; + static readonly FROM_ENVIRONMENT = Worker_Binding_Which.FROM_ENVIRONMENT; + static readonly ANALYTICS_ENGINE = Worker_Binding_Which.ANALYTICS_ENGINE; + static readonly HYPERDRIVE = Worker_Binding_Which.HYPERDRIVE; + static readonly UNSAFE_EVAL = Worker_Binding_Which.UNSAFE_EVAL; + static readonly MEMORY_CACHE = Worker_Binding_Which.MEMORY_CACHE; + static readonly Type = Worker_Binding_Type; + static readonly DurableObjectNamespaceDesignator = + Worker_Binding_DurableObjectNamespaceDesignator; + static readonly CryptoKey = Worker_Binding_CryptoKey; + static readonly MemoryCacheLimits = Worker_Binding_MemoryCacheLimits; + static readonly WrappedBinding = Worker_Binding_WrappedBinding; + static readonly _capnp = { + displayName: "Binding", + id: "8e7e492fd7e35f3e", + size: new $.ObjectSize(8, 6), + }; + get name(): string { + return $.utils.getText(0, this); + } + set name(value: string) { + $.utils.setText(0, value, this); + } + get _isUnspecified(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set unspecified(_: true) { + $.utils.setUint16(0, 0, this); + } + /** + * Indicates that the Worker requires a binding of the given type, but it won't be specified + * here. Another Worker can inherit this Worker and fill in this binding. + * */ + get parameter(): Worker_Binding_Parameter { + $.utils.testWhich("parameter", $.utils.getUint16(0, this), 1, this); + return $.utils.getAs(Worker_Binding_Parameter, this); + } + _initParameter(): Worker_Binding_Parameter { + $.utils.setUint16(0, 1, this); + return $.utils.getAs(Worker_Binding_Parameter, this); + } + get _isParameter(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set parameter(_: true) { + $.utils.setUint16(0, 1, this); + } + /** + * A string. + * */ + get text(): string { + $.utils.testWhich("text", $.utils.getUint16(0, this), 2, this); + return $.utils.getText(1, this); + } + get _isText(): boolean { + return $.utils.getUint16(0, this) === 2; + } + set text(value: string) { + $.utils.setUint16(0, 2, this); + $.utils.setText(1, value, this); + } + _adoptData(value: $.Orphan<$.Data>): void { + $.utils.setUint16(0, 3, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownData(): $.Orphan<$.Data> { + return $.utils.disown(this.data); + } + /** + * An ArrayBuffer. + * */ + get data(): $.Data { + $.utils.testWhich("data", $.utils.getUint16(0, this), 3, this); + return $.utils.getData(1, this); + } + _hasData(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initData(length: number): $.Data { + $.utils.setUint16(0, 3, this); + return $.utils.initData(1, length, this); + } + get _isData(): boolean { + return $.utils.getUint16(0, this) === 3; + } + set data(value: $.Data) { + $.utils.setUint16(0, 3, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + /** + * A value parsed from JSON. + * */ + get json(): string { + $.utils.testWhich("json", $.utils.getUint16(0, this), 4, this); + return $.utils.getText(1, this); + } + get _isJson(): boolean { + return $.utils.getUint16(0, this) === 4; + } + set json(value: string) { + $.utils.setUint16(0, 4, this); + $.utils.setText(1, value, this); + } + _adoptWasmModule(value: $.Orphan<$.Data>): void { + $.utils.setUint16(0, 5, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownWasmModule(): $.Orphan<$.Data> { + return $.utils.disown(this.wasmModule); + } + /** + * A WebAssembly module. The binding will be an instance of `WebAssembly.Module`. Only + * supported when using Service Workers syntax. + * + * DEPRECATED: Please switch to ES modules syntax instead, and embed Wasm modules as modules. + * */ + get wasmModule(): $.Data { + $.utils.testWhich("wasmModule", $.utils.getUint16(0, this), 5, this); + return $.utils.getData(1, this); + } + _hasWasmModule(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initWasmModule(length: number): $.Data { + $.utils.setUint16(0, 5, this); + return $.utils.initData(1, length, this); + } + get _isWasmModule(): boolean { + return $.utils.getUint16(0, this) === 5; + } + set wasmModule(value: $.Data) { + $.utils.setUint16(0, 5, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptCryptoKey(value: $.Orphan): void { + $.utils.setUint16(0, 6, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownCryptoKey(): $.Orphan { + return $.utils.disown(this.cryptoKey); + } + /** + * A CryptoKey instance, for use with the WebCrypto API. + * + * Note that by setting `extractable = false`, you can prevent the Worker code from accessing + * or leaking the raw key material; it will only be able to use the key to perform WebCrypto + * operations. + * */ + get cryptoKey(): Worker_Binding_CryptoKey { + $.utils.testWhich("cryptoKey", $.utils.getUint16(0, this), 6, this); + return $.utils.getStruct(1, Worker_Binding_CryptoKey, this); + } + _hasCryptoKey(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initCryptoKey(): Worker_Binding_CryptoKey { + $.utils.setUint16(0, 6, this); + return $.utils.initStructAt(1, Worker_Binding_CryptoKey, this); + } + get _isCryptoKey(): boolean { + return $.utils.getUint16(0, this) === 6; + } + set cryptoKey(value: Worker_Binding_CryptoKey) { + $.utils.setUint16(0, 6, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptService(value: $.Orphan): void { + $.utils.setUint16(0, 7, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownService(): $.Orphan { + return $.utils.disown(this.service); + } + /** + * Binding to a named service (possibly, a worker). + * */ + get service(): ServiceDesignator { + $.utils.testWhich("service", $.utils.getUint16(0, this), 7, this); + return $.utils.getStruct(1, ServiceDesignator, this); + } + _hasService(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initService(): ServiceDesignator { + $.utils.setUint16(0, 7, this); + return $.utils.initStructAt(1, ServiceDesignator, this); + } + get _isService(): boolean { + return $.utils.getUint16(0, this) === 7; + } + set service(value: ServiceDesignator) { + $.utils.setUint16(0, 7, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptDurableObjectNamespace( + value: $.Orphan + ): void { + $.utils.setUint16(0, 8, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownDurableObjectNamespace(): $.Orphan { + return $.utils.disown(this.durableObjectNamespace); + } + /** + * Binding to the durable object namespace implemented by the given class. + * + * In the common case that this refers to a class in the same Worker, you can specify just + * a string, like: + * + * durableObjectNamespace = "MyClass" + * */ + get durableObjectNamespace(): Worker_Binding_DurableObjectNamespaceDesignator { + $.utils.testWhich( + "durableObjectNamespace", + $.utils.getUint16(0, this), + 8, + this + ); + return $.utils.getStruct( + 1, + Worker_Binding_DurableObjectNamespaceDesignator, + this + ); + } + _hasDurableObjectNamespace(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initDurableObjectNamespace(): Worker_Binding_DurableObjectNamespaceDesignator { + $.utils.setUint16(0, 8, this); + return $.utils.initStructAt( + 1, + Worker_Binding_DurableObjectNamespaceDesignator, + this + ); + } + get _isDurableObjectNamespace(): boolean { + return $.utils.getUint16(0, this) === 8; + } + set durableObjectNamespace( + value: Worker_Binding_DurableObjectNamespaceDesignator + ) { + $.utils.setUint16(0, 8, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptKvNamespace(value: $.Orphan): void { + $.utils.setUint16(0, 9, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownKvNamespace(): $.Orphan { + return $.utils.disown(this.kvNamespace); + } + /** + * A KV namespace, implemented by the named service. The Worker sees a KvNamespace-typed + * binding. Requests to the namespace will be converted into HTTP requests targeting the + * given service name. + * */ + get kvNamespace(): ServiceDesignator { + $.utils.testWhich("kvNamespace", $.utils.getUint16(0, this), 9, this); + return $.utils.getStruct(1, ServiceDesignator, this); + } + _hasKvNamespace(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initKvNamespace(): ServiceDesignator { + $.utils.setUint16(0, 9, this); + return $.utils.initStructAt(1, ServiceDesignator, this); + } + get _isKvNamespace(): boolean { + return $.utils.getUint16(0, this) === 9; + } + set kvNamespace(value: ServiceDesignator) { + $.utils.setUint16(0, 9, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptR2Bucket(value: $.Orphan): void { + $.utils.setUint16(0, 10, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownR2Bucket(): $.Orphan { + return $.utils.disown(this.r2Bucket); + } + get r2Bucket(): ServiceDesignator { + $.utils.testWhich("r2Bucket", $.utils.getUint16(0, this), 10, this); + return $.utils.getStruct(1, ServiceDesignator, this); + } + _hasR2Bucket(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initR2Bucket(): ServiceDesignator { + $.utils.setUint16(0, 10, this); + return $.utils.initStructAt(1, ServiceDesignator, this); + } + get _isR2Bucket(): boolean { + return $.utils.getUint16(0, this) === 10; + } + set r2Bucket(value: ServiceDesignator) { + $.utils.setUint16(0, 10, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptR2Admin(value: $.Orphan): void { + $.utils.setUint16(0, 11, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownR2Admin(): $.Orphan { + return $.utils.disown(this.r2Admin); + } + /** + * R2 bucket and admin API bindings. Similar to KV namespaces, these turn operations into + * HTTP requests aimed at the named service. + * */ + get r2Admin(): ServiceDesignator { + $.utils.testWhich("r2Admin", $.utils.getUint16(0, this), 11, this); + return $.utils.getStruct(1, ServiceDesignator, this); + } + _hasR2Admin(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initR2Admin(): ServiceDesignator { + $.utils.setUint16(0, 11, this); + return $.utils.initStructAt(1, ServiceDesignator, this); + } + get _isR2Admin(): boolean { + return $.utils.getUint16(0, this) === 11; + } + set r2Admin(value: ServiceDesignator) { + $.utils.setUint16(0, 11, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptWrapped(value: $.Orphan): void { + $.utils.setUint16(0, 12, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownWrapped(): $.Orphan { + return $.utils.disown(this.wrapped); + } + /** + * Wraps a collection of inner bindings in a common api functionality. + * */ + get wrapped(): Worker_Binding_WrappedBinding { + $.utils.testWhich("wrapped", $.utils.getUint16(0, this), 12, this); + return $.utils.getStruct(1, Worker_Binding_WrappedBinding, this); + } + _hasWrapped(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initWrapped(): Worker_Binding_WrappedBinding { + $.utils.setUint16(0, 12, this); + return $.utils.initStructAt(1, Worker_Binding_WrappedBinding, this); + } + get _isWrapped(): boolean { + return $.utils.getUint16(0, this) === 12; + } + set wrapped(value: Worker_Binding_WrappedBinding) { + $.utils.setUint16(0, 12, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptQueue(value: $.Orphan): void { + $.utils.setUint16(0, 13, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownQueue(): $.Orphan { + return $.utils.disown(this.queue); + } + /** + * A Queue binding, implemented by the named service. Requests to the + * namespace will be converted into HTTP requests targeting the given + * service name. + * */ + get queue(): ServiceDesignator { + $.utils.testWhich("queue", $.utils.getUint16(0, this), 13, this); + return $.utils.getStruct(1, ServiceDesignator, this); + } + _hasQueue(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initQueue(): ServiceDesignator { + $.utils.setUint16(0, 13, this); + return $.utils.initStructAt(1, ServiceDesignator, this); + } + get _isQueue(): boolean { + return $.utils.getUint16(0, this) === 13; + } + set queue(value: ServiceDesignator) { + $.utils.setUint16(0, 13, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + /** + * Takes the value of an environment variable from the system. The value specified here is + * the name of a system environment variable. The value of the binding is obtained by invoking + * `getenv()` with that name. If the environment variable isn't set, the binding value is + * `null`. + * */ + get fromEnvironment(): string { + $.utils.testWhich("fromEnvironment", $.utils.getUint16(0, this), 14, this); + return $.utils.getText(1, this); + } + get _isFromEnvironment(): boolean { + return $.utils.getUint16(0, this) === 14; + } + set fromEnvironment(value: string) { + $.utils.setUint16(0, 14, this); + $.utils.setText(1, value, this); + } + _adoptAnalyticsEngine(value: $.Orphan): void { + $.utils.setUint16(0, 15, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownAnalyticsEngine(): $.Orphan { + return $.utils.disown(this.analyticsEngine); + } + /** + * A binding for Analytics Engine. Allows workers to store information through Analytics Engine Events. + * workerd will forward AnalyticsEngineEvents to designated service in the body of HTTP requests + * This binding is subject to change and requires the `--experimental` flag + * */ + get analyticsEngine(): ServiceDesignator { + $.utils.testWhich("analyticsEngine", $.utils.getUint16(0, this), 15, this); + return $.utils.getStruct(1, ServiceDesignator, this); + } + _hasAnalyticsEngine(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initAnalyticsEngine(): ServiceDesignator { + $.utils.setUint16(0, 15, this); + return $.utils.initStructAt(1, ServiceDesignator, this); + } + get _isAnalyticsEngine(): boolean { + return $.utils.getUint16(0, this) === 15; + } + set analyticsEngine(value: ServiceDesignator) { + $.utils.setUint16(0, 15, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + /** + * A binding for Hyperdrive. Allows workers to use Hyperdrive caching & pooling for Postgres + * databases. + * */ + get hyperdrive(): Worker_Binding_Hyperdrive { + $.utils.testWhich("hyperdrive", $.utils.getUint16(0, this), 16, this); + return $.utils.getAs(Worker_Binding_Hyperdrive, this); + } + _initHyperdrive(): Worker_Binding_Hyperdrive { + $.utils.setUint16(0, 16, this); + return $.utils.getAs(Worker_Binding_Hyperdrive, this); + } + get _isHyperdrive(): boolean { + return $.utils.getUint16(0, this) === 16; + } + set hyperdrive(_: true) { + $.utils.setUint16(0, 16, this); + } + get _isUnsafeEval(): boolean { + return $.utils.getUint16(0, this) === 17; + } + set unsafeEval(_: true) { + $.utils.setUint16(0, 17, this); + } + /** + * A binding representing access to an in-memory cache. + * */ + get memoryCache(): Worker_Binding_MemoryCache { + $.utils.testWhich("memoryCache", $.utils.getUint16(0, this), 18, this); + return $.utils.getAs(Worker_Binding_MemoryCache, this); + } + _initMemoryCache(): Worker_Binding_MemoryCache { + $.utils.setUint16(0, 18, this); + return $.utils.getAs(Worker_Binding_MemoryCache, this); + } + get _isMemoryCache(): boolean { + return $.utils.getUint16(0, this) === 18; + } + set memoryCache(_: true) { + $.utils.setUint16(0, 18, this); + } + toString(): string { + return "Worker_Binding_" + super.toString(); + } + which(): Worker_Binding_Which { + return $.utils.getUint16(0, this) as Worker_Binding_Which; + } +} +export const Worker_DurableObjectNamespace_Which = { + UNIQUE_KEY: 0, + EPHEMERAL_LOCAL: 1, +} as const; +export type Worker_DurableObjectNamespace_Which = + (typeof Worker_DurableObjectNamespace_Which)[keyof typeof Worker_DurableObjectNamespace_Which]; +export class Worker_DurableObjectNamespace extends $.Struct { + static readonly UNIQUE_KEY = Worker_DurableObjectNamespace_Which.UNIQUE_KEY; + static readonly EPHEMERAL_LOCAL = + Worker_DurableObjectNamespace_Which.EPHEMERAL_LOCAL; + static readonly _capnp = { + displayName: "DurableObjectNamespace", + id: "b429dd547d15747d", + size: new $.ObjectSize(8, 2), + }; + /** + * Exported class name that implements the Durable Object. + * + * Changing the class name will not break compatibility with existing storage, so long as + * `uniqueKey` stays the same. + * */ + get className(): string { + return $.utils.getText(0, this); + } + set className(value: string) { + $.utils.setText(0, value, this); + } + /** + * A unique, stable ID associated with this namespace. This could be a GUID, or any other + * string which does not appear anywhere else in the world. + * + * This string is used to ensure that objects of this class have unique identifiers distinct + * from objects of any other class. Object IDs are cryptographically derived from `uniqueKey` + * and validated against it. It is impossible to guess or forge a valid object ID without + * knowing the `uniqueKey`. Hence, if you keep the key secret, you can prevent anyone from + * forging IDs. However, if you don't care if users can forge valid IDs, then it's not a big + * deal if the key leaks. + * + * DO NOT LOSE this key, otherwise it may be difficult or impossible to recover stored data. + * */ + get uniqueKey(): string { + $.utils.testWhich("uniqueKey", $.utils.getUint16(0, this), 0, this); + return $.utils.getText(1, this); + } + get _isUniqueKey(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set uniqueKey(value: string) { + $.utils.setUint16(0, 0, this); + $.utils.setText(1, value, this); + } + get _isEphemeralLocal(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set ephemeralLocal(_: true) { + $.utils.setUint16(0, 1, this); + } + /** + * By default, Durable Objects are evicted after 10 seconds of inactivity, and expire 70 seconds + * after all clients have disconnected. Some applications may want to keep their Durable Objects + * pinned to memory forever, so we provide this flag to change the default behavior. + * + * Note that this is only supported in Workerd; production Durable Objects cannot toggle eviction. + * */ + get preventEviction(): boolean { + return $.utils.getBit(16, this); + } + set preventEviction(value: boolean) { + $.utils.setBit(16, value, this); + } + /** + * Whether or not Durable Objects in this namespace can use the `storage.sql` API to execute SQL + * queries. + * + * workerd uses SQLite to back all Durable Objects, but the SQL API is hidden by default to + * emulate behavior of traditional DO namespaces on Cloudflare that aren't SQLite-backed. This + * flag should be enabled when testing code that will run on a SQLite-backed namespace. + * */ + get enableSql(): boolean { + return $.utils.getBit(17, this); + } + set enableSql(value: boolean) { + $.utils.setBit(17, value, this); + } + toString(): string { + return "Worker_DurableObjectNamespace_" + super.toString(); + } + which(): Worker_DurableObjectNamespace_Which { + return $.utils.getUint16(0, this) as Worker_DurableObjectNamespace_Which; + } +} +export const Worker_DurableObjectStorage_Which = { + NONE: 0, + IN_MEMORY: 1, + LOCAL_DISK: 2, +} as const; +export type Worker_DurableObjectStorage_Which = + (typeof Worker_DurableObjectStorage_Which)[keyof typeof Worker_DurableObjectStorage_Which]; +/** + * Specifies where this worker's Durable Objects are stored. + * */ +export class Worker_DurableObjectStorage extends $.Struct { + static readonly NONE = Worker_DurableObjectStorage_Which.NONE; + static readonly IN_MEMORY = Worker_DurableObjectStorage_Which.IN_MEMORY; + static readonly LOCAL_DISK = Worker_DurableObjectStorage_Which.LOCAL_DISK; + static readonly _capnp = { + displayName: "durableObjectStorage", + id: "cc72b3faa57827d4", + size: new $.ObjectSize(8, 11), + }; + get _isNone(): boolean { + return $.utils.getUint16(2, this) === 0; + } + set none(_: true) { + $.utils.setUint16(2, 0, this); + } + get _isInMemory(): boolean { + return $.utils.getUint16(2, this) === 1; + } + set inMemory(_: true) { + $.utils.setUint16(2, 1, this); + } + /** + * ** EXPERIMENTAL; SUBJECT TO BACKWARDS-INCOMPATIBLE CHANGE ** + * + * Durable Object data will be stored in a directory on local disk. This field is the name of + * a service, which must be a DiskDirectory service. For each Durable Object class, a + * subdirectory will be created using `uniqueKey` as the name. Within the directory, one or + * more files are created for each object, with names `.`, where `.` may be any of + * a number of different extensions depending on the storage mode. (Currently, the main storage + * is a file with the extension `.sqlite`, and in certain situations extra files with the + * extensions `.sqlite-wal`, and `.sqlite-shm` may also be present.) + * */ + get localDisk(): string { + $.utils.testWhich("localDisk", $.utils.getUint16(2, this), 2, this); + return $.utils.getText(8, this); + } + get _isLocalDisk(): boolean { + return $.utils.getUint16(2, this) === 2; + } + set localDisk(value: string) { + $.utils.setUint16(2, 2, this); + $.utils.setText(8, value, this); + } + toString(): string { + return "Worker_DurableObjectStorage_" + super.toString(); + } + which(): Worker_DurableObjectStorage_Which { + return $.utils.getUint16(2, this) as Worker_DurableObjectStorage_Which; + } +} +export const Worker_Which = { + MODULES: 0, + SERVICE_WORKER_SCRIPT: 1, + INHERIT: 2, +} as const; +export type Worker_Which = (typeof Worker_Which)[keyof typeof Worker_Which]; +export class Worker extends $.Struct { + static readonly MODULES = Worker_Which.MODULES; + static readonly SERVICE_WORKER_SCRIPT = Worker_Which.SERVICE_WORKER_SCRIPT; + static readonly INHERIT = Worker_Which.INHERIT; + static readonly Module = Worker_Module; + static readonly Binding = Worker_Binding; + static readonly DurableObjectNamespace = Worker_DurableObjectNamespace; + static readonly _capnp = { + displayName: "Worker", + id: "acfa77e88fd97d1c", + size: new $.ObjectSize(8, 11), + defaultGlobalOutbound: $.readRawPointer( + new Uint8Array([ + 0x10, 0x07, 0x50, 0x01, 0x03, 0x00, 0x00, 0x11, 0x09, 0x4a, 0x00, 0x01, + 0xff, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x00, 0x00, 0x00, + ]).buffer + ), + }; + static _Modules: $.ListCtor; + static _Bindings: $.ListCtor; + static _DurableObjectNamespaces: $.ListCtor; + static _Tails: $.ListCtor; + _adoptModules(value: $.Orphan<$.List>): void { + $.utils.setUint16(0, 0, this); + $.utils.adopt(value, $.utils.getPointer(0, this)); + } + _disownModules(): $.Orphan<$.List> { + return $.utils.disown(this.modules); + } + /** + * The Worker is composed of ES modules that may import each other. The first module in the list + * is the main module, which exports event handlers. + * */ + get modules(): $.List { + $.utils.testWhich("modules", $.utils.getUint16(0, this), 0, this); + return $.utils.getList(0, Worker._Modules, this); + } + _hasModules(): boolean { + return !$.utils.isNull($.utils.getPointer(0, this)); + } + _initModules(length: number): $.List { + $.utils.setUint16(0, 0, this); + return $.utils.initList(0, Worker._Modules, length, this); + } + get _isModules(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set modules(value: $.List) { + $.utils.setUint16(0, 0, this); + $.utils.copyFrom(value, $.utils.getPointer(0, this)); + } + /** + * The Worker is composed of one big script that uses global `addEventListener()` to register + * event handlers. + * + * The value of this field is the raw source code. When using Cap'n Proto text format, use the + * `embed` directive to read the code from an external file: + * + * serviceWorkerScript = embed "worker.js" + * */ + get serviceWorkerScript(): string { + $.utils.testWhich( + "serviceWorkerScript", + $.utils.getUint16(0, this), + 1, + this + ); + return $.utils.getText(0, this); + } + get _isServiceWorkerScript(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set serviceWorkerScript(value: string) { + $.utils.setUint16(0, 1, this); + $.utils.setText(0, value, this); + } + /** + * Inherit the configuration of some other Worker by its service name. This Worker is a clone + * of the other worker, but various settings can be modified: + * * `bindings`, if specified, overrides specific named bindings. (Each binding listed in the + * derived worker must match the name and type of some binding in the inherited worker.) + * * `globalOutbound`, if non-null, overrides the one specified in the inherited worker. + * * `compatibilityDate` and `compatibilityFlags` CANNOT be modified; they must be null. + * * If the inherited worker defines durable object namespaces, then the derived worker must + * specify `durableObjectStorage` to specify where its instances should be stored. Each + * devived worker receives its own namespace of objects. `durableObjectUniqueKeyModifier` + * must also be specified by derived workers. + * + * This can be useful when you want to run the same Worker in multiple configurations or hooked + * up to different back-ends. Note that all derived workers run in the same isolate as the + * base worker; they differ in the content of the `env` object passed to them, which contains + * the bindings. (When using service workers syntax, the global scope contains the bindings; + * in this case each derived worker runs in its own global scope, though still in the same + * isolate.) + * */ + get inherit(): string { + $.utils.testWhich("inherit", $.utils.getUint16(0, this), 2, this); + return $.utils.getText(0, this); + } + get _isInherit(): boolean { + return $.utils.getUint16(0, this) === 2; + } + set inherit(value: string) { + $.utils.setUint16(0, 2, this); + $.utils.setText(0, value, this); + } + get compatibilityDate(): string { + return $.utils.getText(1, this); + } + set compatibilityDate(value: string) { + $.utils.setText(1, value, this); + } + _adoptCompatibilityFlags(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownCompatibilityFlags(): $.Orphan<$.List> { + return $.utils.disown(this.compatibilityFlags); + } + /** + * See: https://developers.cloudflare.com/workers/platform/compatibility-dates/ + * + * `compatibilityDate` must be specified, unless the Worker inhits from another worker, in which + * case it must not be specified. `compatibilityFlags` can optionally be specified when + * `compatibilityDate` is specified. + * */ + get compatibilityFlags(): $.List { + return $.utils.getList(2, $.TextList, this); + } + _hasCompatibilityFlags(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initCompatibilityFlags(length: number): $.List { + return $.utils.initList(2, $.TextList, length, this); + } + set compatibilityFlags(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + _adoptBindings(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(3, this)); + } + _disownBindings(): $.Orphan<$.List> { + return $.utils.disown(this.bindings); + } + /** + * List of bindings, which give the Worker access to external resources and configuration + * settings. + * + * For Workers using ES modules syntax, the bindings are delivered via the `env` object. For + * service workers syntax, each binding shows up as a global variable. + * */ + get bindings(): $.List { + return $.utils.getList(3, Worker._Bindings, this); + } + _hasBindings(): boolean { + return !$.utils.isNull($.utils.getPointer(3, this)); + } + _initBindings(length: number): $.List { + return $.utils.initList(3, Worker._Bindings, length, this); + } + set bindings(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(3, this)); + } + _adoptGlobalOutbound(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(4, this)); + } + _disownGlobalOutbound(): $.Orphan { + return $.utils.disown(this.globalOutbound); + } + /** + * Where should the global "fetch" go to? The default is the service called "internet", which + * should usually be configured to talk to the public internet. + * */ + get globalOutbound(): ServiceDesignator { + return $.utils.getStruct( + 4, + ServiceDesignator, + this, + Worker._capnp.defaultGlobalOutbound + ); + } + _hasGlobalOutbound(): boolean { + return !$.utils.isNull($.utils.getPointer(4, this)); + } + _initGlobalOutbound(): ServiceDesignator { + return $.utils.initStructAt(4, ServiceDesignator, this); + } + set globalOutbound(value: ServiceDesignator) { + $.utils.copyFrom(value, $.utils.getPointer(4, this)); + } + _adoptCacheApiOutbound(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(7, this)); + } + _disownCacheApiOutbound(): $.Orphan { + return $.utils.disown(this.cacheApiOutbound); + } + /** + * List of durable object namespaces in this Worker. + * */ + get cacheApiOutbound(): ServiceDesignator { + return $.utils.getStruct(7, ServiceDesignator, this); + } + _hasCacheApiOutbound(): boolean { + return !$.utils.isNull($.utils.getPointer(7, this)); + } + _initCacheApiOutbound(): ServiceDesignator { + return $.utils.initStructAt(7, ServiceDesignator, this); + } + set cacheApiOutbound(value: ServiceDesignator) { + $.utils.copyFrom(value, $.utils.getPointer(7, this)); + } + _adoptDurableObjectNamespaces( + value: $.Orphan<$.List> + ): void { + $.utils.adopt(value, $.utils.getPointer(5, this)); + } + _disownDurableObjectNamespaces(): $.Orphan< + $.List + > { + return $.utils.disown(this.durableObjectNamespaces); + } + /** + * Additional text which is hashed together with `DurableObjectNamespace.uniqueKey`. When using + * worker inheritance, each derived worker must specify a unique modifier to ensure that its + * Durable Object instances have unique IDs from all other workers inheriting the same parent. + * + * DO NOT LOSE this value, otherwise it may be difficult or impossible to recover stored data. + * */ + get durableObjectNamespaces(): $.List { + return $.utils.getList(5, Worker._DurableObjectNamespaces, this); + } + _hasDurableObjectNamespaces(): boolean { + return !$.utils.isNull($.utils.getPointer(5, this)); + } + _initDurableObjectNamespaces( + length: number + ): $.List { + return $.utils.initList(5, Worker._DurableObjectNamespaces, length, this); + } + set durableObjectNamespaces(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(5, this)); + } + /** + * Specifies where this worker's Durable Objects are stored. + * */ + get durableObjectUniqueKeyModifier(): string { + return $.utils.getText(6, this); + } + set durableObjectUniqueKeyModifier(value: string) { + $.utils.setText(6, value, this); + } + /** + * Where should cache API (i.e. caches.default and caches.open(...)) requests go? + * */ + get durableObjectStorage(): Worker_DurableObjectStorage { + return $.utils.getAs(Worker_DurableObjectStorage, this); + } + _initDurableObjectStorage(): Worker_DurableObjectStorage { + return $.utils.getAs(Worker_DurableObjectStorage, this); + } + get moduleFallback(): string { + return $.utils.getText(9, this); + } + set moduleFallback(value: string) { + $.utils.setText(9, value, this); + } + _adoptTails(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(10, this)); + } + _disownTails(): $.Orphan<$.List> { + return $.utils.disown(this.tails); + } + /** + * List of tail worker services that should receive tail events for this worker. + * See: https://developers.cloudflare.com/workers/observability/logs/tail-workers/ + * */ + get tails(): $.List { + return $.utils.getList(10, Worker._Tails, this); + } + _hasTails(): boolean { + return !$.utils.isNull($.utils.getPointer(10, this)); + } + _initTails(length: number): $.List { + return $.utils.initList(10, Worker._Tails, length, this); + } + set tails(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(10, this)); + } + toString(): string { + return "Worker_" + super.toString(); + } + which(): Worker_Which { + return $.utils.getUint16(0, this) as Worker_Which; + } +} +/** + * Talk to the server over encrypted HTTPS. + * */ +export class ExternalServer_Https extends $.Struct { + static readonly _capnp = { + displayName: "https", + id: "ac37e02afd3dc6db", + size: new $.ObjectSize(8, 4), + }; + _adoptOptions(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownOptions(): $.Orphan { + return $.utils.disown(this.options); + } + get options(): HttpOptions { + return $.utils.getStruct(1, HttpOptions, this); + } + _hasOptions(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initOptions(): HttpOptions { + return $.utils.initStructAt(1, HttpOptions, this); + } + set options(value: HttpOptions) { + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptTlsOptions(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownTlsOptions(): $.Orphan { + return $.utils.disown(this.tlsOptions); + } + get tlsOptions(): TlsOptions { + return $.utils.getStruct(2, TlsOptions, this); + } + _hasTlsOptions(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initTlsOptions(): TlsOptions { + return $.utils.initStructAt(2, TlsOptions, this); + } + set tlsOptions(value: TlsOptions) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + /** + * If present, expect the host to present a certificate authenticating it as this hostname. + * If `certificateHost` is not provided, then the certificate is checked against `address`. + * */ + get certificateHost(): string { + return $.utils.getText(3, this); + } + set certificateHost(value: string) { + $.utils.setText(3, value, this); + } + toString(): string { + return "ExternalServer_Https_" + super.toString(); + } +} +/** + * Connect to the server over raw TCP. Bindings to this service will only support the + * `connect()` method; `fetch()` will throw an exception. + * */ +export class ExternalServer_Tcp extends $.Struct { + static readonly _capnp = { + displayName: "tcp", + id: "d941637df0fb39f1", + size: new $.ObjectSize(8, 4), + }; + _adoptTlsOptions(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownTlsOptions(): $.Orphan { + return $.utils.disown(this.tlsOptions); + } + get tlsOptions(): TlsOptions { + return $.utils.getStruct(1, TlsOptions, this); + } + _hasTlsOptions(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initTlsOptions(): TlsOptions { + return $.utils.initStructAt(1, TlsOptions, this); + } + set tlsOptions(value: TlsOptions) { + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + get certificateHost(): string { + return $.utils.getText(2, this); + } + set certificateHost(value: string) { + $.utils.setText(2, value, this); + } + toString(): string { + return "ExternalServer_Tcp_" + super.toString(); + } +} +export const ExternalServer_Which = { + HTTP: 0, + HTTPS: 1, + TCP: 2, +} as const; +export type ExternalServer_Which = + (typeof ExternalServer_Which)[keyof typeof ExternalServer_Which]; +/** + * Describes the ability to talk to a specific server, typically a back-end server available + * on the internal network. + * + * When a Worker contains a service binding that points to an ExternalServer, *all* fetch() + * calls on that binding will be delivered to that server, regardless of whether the hostname + * or protocol specified in the URL actually match the hostname or protocol used by the actual + * server. Typically, a Worker implementing a reverse proxy would use this to forward a request + * to a back-end application server. Such a back-end typically does not have a real public + * hostname, since it is only reachable through the proxy, but the requests forwarded to it will + * keep the hostname that was on the original request. + * + * Note that this also implies that regardless of whether the original URL was http: or https:, + * the request will be delivered to the target server using the protocol specified below. A + * header like `X-Forwarded-Proto` can be used to pass along the original protocol; see + * `HttpOptions`. + * */ +export class ExternalServer extends $.Struct { + static readonly HTTP = ExternalServer_Which.HTTP; + static readonly HTTPS = ExternalServer_Which.HTTPS; + static readonly TCP = ExternalServer_Which.TCP; + static readonly _capnp = { + displayName: "ExternalServer", + id: "ff209f9aa352f5a4", + size: new $.ObjectSize(8, 4), + }; + /** + * Address/port of the server. Optional; if not specified, then you will be required to specify + * the address on the command line with with `--external-addr =`. + * + * Examples: + * - "1.2.3.4": Connect to the given IPv4 address on the protocol's default port. + * - "1.2.3.4:80": Connect to the given IPv4 address and port. + * - "1234:5678::abcd": Connect to the given IPv6 address on the protocol's default port. + * - "[1234:5678::abcd]:80": Connect to the given IPv6 address and port. + * - "unix:/path/to/socket": Connect to the given Unix Domain socket by path. + * - "unix-abstract:name": On Linux, connect to the given "abstract" Unix socket name. + * - "example.com:80": Perform a DNS lookup to determine the address, and then connect to it. + * + * (These are the formats supported by KJ's parseAddress().) + * */ + get address(): string { + return $.utils.getText(0, this); + } + set address(value: string) { + $.utils.setText(0, value, this); + } + _adoptHttp(value: $.Orphan): void { + $.utils.setUint16(0, 0, this); + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownHttp(): $.Orphan { + return $.utils.disown(this.http); + } + /** + * Talk to the server over unencrypted HTTP. + * */ + get http(): HttpOptions { + $.utils.testWhich("http", $.utils.getUint16(0, this), 0, this); + return $.utils.getStruct(1, HttpOptions, this); + } + _hasHttp(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initHttp(): HttpOptions { + $.utils.setUint16(0, 0, this); + return $.utils.initStructAt(1, HttpOptions, this); + } + get _isHttp(): boolean { + return $.utils.getUint16(0, this) === 0; + } + set http(value: HttpOptions) { + $.utils.setUint16(0, 0, this); + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + /** + * Talk to the server over encrypted HTTPS. + * */ + get https(): ExternalServer_Https { + $.utils.testWhich("https", $.utils.getUint16(0, this), 1, this); + return $.utils.getAs(ExternalServer_Https, this); + } + _initHttps(): ExternalServer_Https { + $.utils.setUint16(0, 1, this); + return $.utils.getAs(ExternalServer_Https, this); + } + get _isHttps(): boolean { + return $.utils.getUint16(0, this) === 1; + } + set https(_: true) { + $.utils.setUint16(0, 1, this); + } + /** + * Connect to the server over raw TCP. Bindings to this service will only support the + * `connect()` method; `fetch()` will throw an exception. + * */ + get tcp(): ExternalServer_Tcp { + $.utils.testWhich("tcp", $.utils.getUint16(0, this), 2, this); + return $.utils.getAs(ExternalServer_Tcp, this); + } + _initTcp(): ExternalServer_Tcp { + $.utils.setUint16(0, 2, this); + return $.utils.getAs(ExternalServer_Tcp, this); + } + get _isTcp(): boolean { + return $.utils.getUint16(0, this) === 2; + } + set tcp(_: true) { + $.utils.setUint16(0, 2, this); + } + toString(): string { + return "ExternalServer_" + super.toString(); + } + which(): ExternalServer_Which { + return $.utils.getUint16(0, this) as ExternalServer_Which; + } +} +/** + * Describes the ability to talk to a network. + * + * This is commonly used to define the "internet" service which is the default `globalOutbound` + * for all Workers. To prevent SSRF, by default Workers will not be permitted to reach internal + * network addresses using global fetch(). It's recommended that you create ExternalServer + * bindings instead to grant access to specific servers. However, if you really want to, you + * can configure a service that grants arbitrary internal network access, like: + * + * ( name = "internalNetwork", + * network = ( + * allow = ["public", "private"], + * ) + * ) + * */ +export class Network extends $.Struct { + static readonly _capnp = { + displayName: "Network", + id: "fa42244f950c9b9c", + size: new $.ObjectSize(0, 3), + defaultAllow: $.readRawPointer( + new Uint8Array([ + 0x10, 0x03, 0x11, 0x01, 0x0e, 0x11, 0x01, 0x3a, 0x3f, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, + ]).buffer + ), + }; + _adoptAllow(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(0, this)); + } + _disownAllow(): $.Orphan<$.List> { + return $.utils.disown(this.allow); + } + get allow(): $.List { + return $.utils.getList(0, $.TextList, this, Network._capnp.defaultAllow); + } + _hasAllow(): boolean { + return !$.utils.isNull($.utils.getPointer(0, this)); + } + _initAllow(length: number): $.List { + return $.utils.initList(0, $.TextList, length, this); + } + set allow(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(0, this)); + } + _adoptDeny(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownDeny(): $.Orphan<$.List> { + return $.utils.disown(this.deny); + } + /** + * Specifies which network addresses the Worker will be allowed to connect to, e.g. using fetch(). + * The default allows publicly-routable IP addresses only, in order to prevent SSRF attacks. + * + * The allow and deny lists specify network blocks in CIDR notation (IPv4 and IPv6), such as + * "192.0.2.0/24" or "2001:db8::/32". Traffic will be permitted as long as the address + * matches at least one entry in the allow list and none in the deny list. + * + * In addition to IPv4 and IPv6 CIDR notation, several special strings may be specified: + * - "private": Matches network addresses that are reserved by standards for private networks, + * such as "10.0.0.0/8" or "192.168.0.0/16". This is a superset of "local". + * - "public": Opposite of "private". + * - "local": Matches network addresses that are defined by standards to only be accessible from + * the local machine, such as "127.0.0.0/8" or Unix domain addresses. + * - "network": Opposite of "local". + * - "unix": Matches all Unix domain socket addresses. (In the future, we may support specifying a + * glob to narrow this to specific paths.) + * - "unix-abstract": Matches Linux's "abstract unix domain" addresses. (In the future, we may + * support specifying a glob.) + * + * In the case that the Worker specifies a DNS hostname rather than a raw address, these rules are + * used to filter the addresses returned by the lookup. If none of the returned addresses turn + * out to be permitted, then the system will behave as if the DNS entry did not exist. + * + * (The above is exactly the format supported by kj::Network::restrictPeers().) + * */ + get deny(): $.List { + return $.utils.getList(1, $.TextList, this); + } + _hasDeny(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initDeny(length: number): $.List { + return $.utils.initList(1, $.TextList, length, this); + } + set deny(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + _adoptTlsOptions(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownTlsOptions(): $.Orphan { + return $.utils.disown(this.tlsOptions); + } + get tlsOptions(): TlsOptions { + return $.utils.getStruct(2, TlsOptions, this); + } + _hasTlsOptions(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initTlsOptions(): TlsOptions { + return $.utils.initStructAt(2, TlsOptions, this); + } + set tlsOptions(value: TlsOptions) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + toString(): string { + return "Network_" + super.toString(); + } +} +/** + * Configures access to a directory on disk. This is a type of service which will expose an HTTP + * interface to the directory content. + * + * This is very bare-bones, generally not suitable for serving a web site on its own. In + * particular, no attempt is made to guess the `Content-Type` header. You normally would wrap + * this in a Worker that fills in the metadata in the way you want. + * + * A GET request targeting a directory (rather than a file) will return a basic JSAN directory + * listing like: + * + * [{"name":"foo","type":"file"},{"name":"bar","type":"directory"}] + * + * Possible "type" values are "file", "directory", "symlink", "blockDevice", "characterDevice", + * "namedPipe", "socket", "other". + * + * `Content-Type` will be `application/octet-stream` for files or `application/json` for a + * directory listing. Files will have a `Content-Length` header, directories will not. Symlinks + * will be followed (but there is intentionally no way to create one, even if `writable` is + * `true`), and treated according to the type of file they point to. The other inode types cannot + * be opened; trying to do so will produce a "406 Not Acceptable" error (on the theory that there + * is no acceptable format for these, regardless of what the client says it accepts). + * + * `HEAD` requests are properly optimized to perform a stat() without actually opening the file. + * */ +export class DiskDirectory extends $.Struct { + static readonly _capnp = { + displayName: "DiskDirectory", + id: "9048ab22835f51c3", + size: new $.ObjectSize(8, 1), + defaultWritable: $.getBitMask(false, 0), + defaultAllowDotfiles: $.getBitMask(false, 1), + }; + /** + * The filesystem path of the directory. If not specified, then it must be specified on the + * command line with `--directory-path =`. + * + * Relative paths are interpreted relative to the current directory where the server is executed, + * NOT relative to the config file. So, you should usually use absolute paths in the config file. + * */ + get path(): string { + return $.utils.getText(0, this); + } + set path(value: string) { + $.utils.setText(0, value, this); + } + /** + * Whether to support PUT requests for writing. A PUT will write to a temporary file which + * is atomically moved into place upon successful completion of the upload. Parent directories are + * created as needed. + * */ + get writable(): boolean { + return $.utils.getBit(0, this, DiskDirectory._capnp.defaultWritable); + } + set writable(value: boolean) { + $.utils.setBit(0, value, this, DiskDirectory._capnp.defaultWritable); + } + /** + * Whether to allow access to files and directories whose name starts with '.'. These are made + * inaccessible by default since they very often store metadata that is not meant to be served, + * e.g. a git repository or an `.htaccess` file. + * + * Note that the special links "." and ".." will never be accessible regardless of this setting. + * */ + get allowDotfiles(): boolean { + return $.utils.getBit(1, this, DiskDirectory._capnp.defaultAllowDotfiles); + } + set allowDotfiles(value: boolean) { + $.utils.setBit(1, value, this, DiskDirectory._capnp.defaultAllowDotfiles); + } + toString(): string { + return "DiskDirectory_" + super.toString(); + } +} +export const HttpOptions_Style = { + HOST: 0, + PROXY: 1, +} as const; +export type HttpOptions_Style = + (typeof HttpOptions_Style)[keyof typeof HttpOptions_Style]; +export class HttpOptions_Header extends $.Struct { + static readonly _capnp = { + displayName: "Header", + id: "dc0394b5a6f3417e", + size: new $.ObjectSize(0, 2), + }; + /** + * Case-insensitive. + * */ + get name(): string { + return $.utils.getText(0, this); + } + set name(value: string) { + $.utils.setText(0, value, this); + } + /** + * If null, the header will be removed. + * */ + get value(): string { + return $.utils.getText(1, this); + } + set value(value: string) { + $.utils.setText(1, value, this); + } + toString(): string { + return "HttpOptions_Header_" + super.toString(); + } +} +/** + * Options for using HTTP (as a client or server). In particular, this specifies behavior that is + * important in the presence of proxy servers, whether forward or reverse. + * */ +export class HttpOptions extends $.Struct { + static readonly Style = HttpOptions_Style; + static readonly Header = HttpOptions_Header; + static readonly _capnp = { + displayName: "HttpOptions", + id: "aa8dc6885da78f19", + size: new $.ObjectSize(8, 5), + defaultStyle: $.getUint16Mask(0), + }; + static _InjectRequestHeaders: $.ListCtor; + static _InjectResponseHeaders: $.ListCtor; + get style(): HttpOptions_Style { + return $.utils.getUint16( + 0, + this, + HttpOptions._capnp.defaultStyle + ) as HttpOptions_Style; + } + set style(value: HttpOptions_Style) { + $.utils.setUint16(0, value, this, HttpOptions._capnp.defaultStyle); + } + /** + * If specified, then when the given header is present on a request, it specifies the protocol + * ("http" or "https") that was used by the original client. The request URL reported to the + * Worker will reflect this protocol. Otherwise, the URL will reflect the actual physical protocol + * used by the server in receiving the request. + * + * This option is useful when this server sits behind a reverse proxy that performs TLS + * termination. Typically such proxies forward the original protocol in a header named something + * like "X-Forwarded-Proto". + * + * This setting is ignored when `style` is `proxy`. + * */ + get forwardedProtoHeader(): string { + return $.utils.getText(0, this); + } + set forwardedProtoHeader(value: string) { + $.utils.setText(0, value, this); + } + /** + * If set, then the `request.cf` object will be encoded (as JSON) into / parsed from the header + * with this name. Otherwise, it will be discarded on send / `undefined` on receipt. + * */ + get cfBlobHeader(): string { + return $.utils.getText(1, this); + } + set cfBlobHeader(value: string) { + $.utils.setText(1, value, this); + } + _adoptInjectRequestHeaders( + value: $.Orphan<$.List> + ): void { + $.utils.adopt(value, $.utils.getPointer(2, this)); + } + _disownInjectRequestHeaders(): $.Orphan<$.List> { + return $.utils.disown(this.injectRequestHeaders); + } + /** + * List of headers which will be automatically injected into all requests. This can be used + * e.g. to add an authorization token to all requests when using `ExternalServer`. It can also + * apply to incoming requests received on a `Socket` to modify the headers that will be delivered + * to the app. Any existing header with the same name is removed. + * */ + get injectRequestHeaders(): $.List { + return $.utils.getList(2, HttpOptions._InjectRequestHeaders, this); + } + _hasInjectRequestHeaders(): boolean { + return !$.utils.isNull($.utils.getPointer(2, this)); + } + _initInjectRequestHeaders(length: number): $.List { + return $.utils.initList(2, HttpOptions._InjectRequestHeaders, length, this); + } + set injectRequestHeaders(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(2, this)); + } + _adoptInjectResponseHeaders( + value: $.Orphan<$.List> + ): void { + $.utils.adopt(value, $.utils.getPointer(3, this)); + } + _disownInjectResponseHeaders(): $.Orphan<$.List> { + return $.utils.disown(this.injectResponseHeaders); + } + /** + * Same as `injectRequestHeaders` but for responses. + * */ + get injectResponseHeaders(): $.List { + return $.utils.getList(3, HttpOptions._InjectResponseHeaders, this); + } + _hasInjectResponseHeaders(): boolean { + return !$.utils.isNull($.utils.getPointer(3, this)); + } + _initInjectResponseHeaders(length: number): $.List { + return $.utils.initList( + 3, + HttpOptions._InjectResponseHeaders, + length, + this + ); + } + set injectResponseHeaders(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(3, this)); + } + /** + * A CONNECT request for this host+port will be treated as a request to form a Cap'n Proto RPC + * connection. The server will expose a WorkerdBootstrap as the bootstrap interface, allowing + * events to be delivered to the target worker via capnp. Clients will use capnp for non-HTTP + * event types (especially JSRPC). + * */ + get capnpConnectHost(): string { + return $.utils.getText(4, this); + } + set capnpConnectHost(value: string) { + $.utils.setText(4, value, this); + } + toString(): string { + return "HttpOptions_" + super.toString(); + } +} +export class TlsOptions_Keypair extends $.Struct { + static readonly _capnp = { + displayName: "Keypair", + id: "f546bf2d5d8bd13e", + size: new $.ObjectSize(0, 2), + }; + /** + * Private key in PEM format. Supports PKCS8 keys as well as "traditional format" RSA and DSA + * keys. + * + * Remember that you can use Cap'n Proto's `embed` syntax to reference an external file. + * */ + get privateKey(): string { + return $.utils.getText(0, this); + } + set privateKey(value: string) { + $.utils.setText(0, value, this); + } + /** + * Certificate chain in PEM format. A chain can be constructed by concatenating multiple + * PEM-encoded certificates, starting with the leaf certificate. + * */ + get certificateChain(): string { + return $.utils.getText(1, this); + } + set certificateChain(value: string) { + $.utils.setText(1, value, this); + } + toString(): string { + return "TlsOptions_Keypair_" + super.toString(); + } +} +export const TlsOptions_Version = { + GOOD_DEFAULT: 0, + SSL3: 1, + TLS1DOT0: 2, + TLS1DOT1: 3, + TLS1DOT2: 4, + TLS1DOT3: 5, +} as const; +export type TlsOptions_Version = + (typeof TlsOptions_Version)[keyof typeof TlsOptions_Version]; +/** + * Options that apply when using TLS. Can apply on either the client or the server side, depending + * on the context. + * + * This is based on KJ's TlsContext::Options. + * */ +export class TlsOptions extends $.Struct { + static readonly Keypair = TlsOptions_Keypair; + static readonly Version = TlsOptions_Version; + static readonly _capnp = { + displayName: "TlsOptions", + id: "aabb3c3778ac4311", + size: new $.ObjectSize(8, 3), + defaultRequireClientCerts: $.getBitMask(false, 0), + defaultTrustBrowserCas: $.getBitMask(false, 1), + defaultMinVersion: $.getUint16Mask(0), + }; + _adoptKeypair(value: $.Orphan): void { + $.utils.adopt(value, $.utils.getPointer(0, this)); + } + _disownKeypair(): $.Orphan { + return $.utils.disown(this.keypair); + } + /** + * The default private key and certificate to use. Optional when acting as a client. + * */ + get keypair(): TlsOptions_Keypair { + return $.utils.getStruct(0, TlsOptions_Keypair, this); + } + _hasKeypair(): boolean { + return !$.utils.isNull($.utils.getPointer(0, this)); + } + _initKeypair(): TlsOptions_Keypair { + return $.utils.initStructAt(0, TlsOptions_Keypair, this); + } + set keypair(value: TlsOptions_Keypair) { + $.utils.copyFrom(value, $.utils.getPointer(0, this)); + } + /** + * If true, then when acting as a server, incoming connections will be rejected unless they bear + * a certificate signed by one of the trusted CAs. + * + * Typically, when using this, you'd set `trustBrowserCas = false` and list a specific private CA + * in `trustedCertificates`. + * */ + get requireClientCerts(): boolean { + return $.utils.getBit(0, this, TlsOptions._capnp.defaultRequireClientCerts); + } + set requireClientCerts(value: boolean) { + $.utils.setBit(0, value, this, TlsOptions._capnp.defaultRequireClientCerts); + } + /** + * If true, trust certificates which are signed by one of the CAs that browsers normally trust. + * You should typically set this true when talking to the public internet, but you may want to + * set it false when talking to servers on your internal network. + * */ + get trustBrowserCas(): boolean { + return $.utils.getBit(1, this, TlsOptions._capnp.defaultTrustBrowserCas); + } + set trustBrowserCas(value: boolean) { + $.utils.setBit(1, value, this, TlsOptions._capnp.defaultTrustBrowserCas); + } + _adoptTrustedCertificates(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(1, this)); + } + _disownTrustedCertificates(): $.Orphan<$.List> { + return $.utils.disown(this.trustedCertificates); + } + /** + * Additional CA certificates to trust, in PEM format. Remember that you can use Cap'n Proto's + * `embed` syntax to read the certificates from other files. + * */ + get trustedCertificates(): $.List { + return $.utils.getList(1, $.TextList, this); + } + _hasTrustedCertificates(): boolean { + return !$.utils.isNull($.utils.getPointer(1, this)); + } + _initTrustedCertificates(length: number): $.List { + return $.utils.initList(1, $.TextList, length, this); + } + set trustedCertificates(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(1, this)); + } + /** + * Minimum TLS version that will be allowed. Generally you should not override this unless you + * have unusual backwards-compatibility needs. + * */ + get minVersion(): TlsOptions_Version { + return $.utils.getUint16( + 2, + this, + TlsOptions._capnp.defaultMinVersion + ) as TlsOptions_Version; + } + set minVersion(value: TlsOptions_Version) { + $.utils.setUint16(2, value, this, TlsOptions._capnp.defaultMinVersion); + } + /** + * OpenSSL cipher list string. The default is a curated list designed to be compatible with + * almost all software in current use (specifically, based on Mozilla's "intermediate" + * recommendations). The defaults will change in future versions of this software to account + * for the latest cryptanalysis. + * + * Generally you should only specify your own `cipherList` if: + * - You have extreme backwards-compatibility needs and wish to enable obsolete and/or broken + * algorithms. + * - You need quickly to disable an algorithm recently discovered to be broken. + * */ + get cipherList(): string { + return $.utils.getText(2, this); + } + set cipherList(value: string) { + $.utils.setText(2, value, this); + } + toString(): string { + return "TlsOptions_" + super.toString(); + } +} +/** + * A module extending workerd functionality. + * */ +export class Extension_Module extends $.Struct { + static readonly _capnp = { + displayName: "Module", + id: "d5d16e76fdedc37d", + size: new $.ObjectSize(8, 2), + defaultInternal: $.getBitMask(false, 0), + }; + /** + * Full js module name. + * */ + get name(): string { + return $.utils.getText(0, this); + } + set name(value: string) { + $.utils.setText(0, value, this); + } + /** + * Internal modules can be imported by other extension modules only and not the user code. + * */ + get internal(): boolean { + return $.utils.getBit(0, this, Extension_Module._capnp.defaultInternal); + } + set internal(value: boolean) { + $.utils.setBit(0, value, this, Extension_Module._capnp.defaultInternal); + } + /** + * Raw source code of ES module. + * */ + get esModule(): string { + return $.utils.getText(1, this); + } + set esModule(value: string) { + $.utils.setText(1, value, this); + } + toString(): string { + return "Extension_Module_" + super.toString(); + } +} +/** + * Additional capabilities for workers. + * */ +export class Extension extends $.Struct { + static readonly Module = Extension_Module; + static readonly _capnp = { + displayName: "Extension", + id: "e390128a861973a6", + size: new $.ObjectSize(0, 1), + }; + static _Modules: $.ListCtor; + _adoptModules(value: $.Orphan<$.List>): void { + $.utils.adopt(value, $.utils.getPointer(0, this)); + } + _disownModules(): $.Orphan<$.List> { + return $.utils.disown(this.modules); + } + /** + * List of javascript modules provided by the extension. + * These modules can either be imported directly as user-level api (if not marked internal) + * or used to define more complicated workerd constructs such as wrapped bindings and events. + * */ + get modules(): $.List { + return $.utils.getList(0, Extension._Modules, this); + } + _hasModules(): boolean { + return !$.utils.isNull($.utils.getPointer(0, this)); + } + _initModules(length: number): $.List { + return $.utils.initList(0, Extension._Modules, length, this); + } + set modules(value: $.List) { + $.utils.copyFrom(value, $.utils.getPointer(0, this)); + } + toString(): string { + return "Extension_" + super.toString(); + } +} +Config._Services = $.CompositeList(Service); +Config._Sockets = $.CompositeList(Socket); +Config._Extensions = $.CompositeList(Extension); +Worker_Binding_WrappedBinding._InnerBindings = $.CompositeList(Worker_Binding); +Worker._Modules = $.CompositeList(Worker_Module); +Worker._Bindings = $.CompositeList(Worker_Binding); +Worker._DurableObjectNamespaces = $.CompositeList( + Worker_DurableObjectNamespace +); +Worker._Tails = $.CompositeList(ServiceDesignator); +HttpOptions._InjectRequestHeaders = $.CompositeList(HttpOptions_Header); +HttpOptions._InjectResponseHeaders = $.CompositeList(HttpOptions_Header); +Extension._Modules = $.CompositeList(Extension_Module); diff --git a/packages/miniflare/src/runtime/config/index.ts b/packages/miniflare/src/runtime/config/index.ts index 84ad081eccc5..606b3ffeec94 100644 --- a/packages/miniflare/src/runtime/config/index.ts +++ b/packages/miniflare/src/runtime/config/index.ts @@ -1,6 +1,6 @@ -import { Data, List, Message, Struct } from "capnp-ts"; +import { Data, List, Message, Struct } from "capnp-es"; +import { Config as CapnpConfig } from "./generated"; import { Config, kVoid } from "./workerd"; -import { Config as CapnpConfig } from "./workerd.capnp.js"; function capitalize(str: S): Capitalize { return ( @@ -19,11 +19,13 @@ function encodeCapnpStruct(obj: any, struct: Struct) { const anyStruct = struct as any; for (const [key, value] of Object.entries(obj)) { const capitalized = capitalize(key); + const safeKey = key === "constructor" ? `$${key}` : key; + if (value instanceof Uint8Array) { - const newData: Data = anyStruct[`init${capitalized}`](value.byteLength); + const newData: Data = anyStruct[`_init${capitalized}`](value.byteLength); newData.copyBuffer(value); } else if (Array.isArray(value)) { - const newList: List = anyStruct[`init${capitalized}`](value.length); + const newList: List = anyStruct[`_init${capitalized}`](value.length); for (let i = 0; i < value.length; i++) { if (typeof value[i] === "object") { encodeCapnpStruct(value[i], newList.get(i)); @@ -32,14 +34,14 @@ function encodeCapnpStruct(obj: any, struct: Struct) { } } } else if (typeof value === "object") { - const newStruct: Struct = anyStruct[`init${capitalized}`](); + const newStruct: Struct = anyStruct[`_init${capitalized}`](); encodeCapnpStruct(value, newStruct); } else if (value === kVoid) { - anyStruct[`set${capitalized}`](); + anyStruct[safeKey] = undefined; } else if (value !== undefined) { // Ignore all `undefined` values, explicitly `undefined` values should use // kVoid symbol instead. - anyStruct[`set${capitalized}`](value); + anyStruct[safeKey] = value; } } } diff --git a/packages/miniflare/src/runtime/config/workerd.capnp b/packages/miniflare/src/runtime/config/workerd.capnp deleted file mode 100644 index 4125421e68b5..000000000000 --- a/packages/miniflare/src/runtime/config/workerd.capnp +++ /dev/null @@ -1,937 +0,0 @@ -# Copyright (c) 2017-2022 Cloudflare, Inc. -# Licensed under the Apache 2.0 license found in the LICENSE file or at: -# https://opensource.org/licenses/Apache-2.0 - -@0xe6afd26682091c01; -# This file defines the schema for configuring the workerd runtime. -# -# A config file can be written as a `.capnp` file that imports this file and then defines a -# constant of type `Config`. Alternatively, various higher-level tooling (e.g. wrangler) may -# generate configs for you, outputting a binary Cap'n Proto file. -# -# To start a server with a config, do: -# -# workerd serve my-config.capnp constantName -# -# You can also build a new self-contained binary which combines the `workerd` binary with your -# configuration and all your source code: -# -# workerd compile my-config.capnp constantName -o my-server-bin -# -# This binary can then be run stand-alone. -# -# A common theme in this configuration is capability-based design. We generally like to avoid -# giving a Worker the ability to access external resources by name, since this makes it hard -# to see and restrict what each Worker can access. Instead, the default is that a Worker has -# access to no privileged resources at all, and you must explicitly declare "bindings" to give -# it access to specific resources. A binding gives the Worker a JavaScript API object that points -# to a specific resource. This means that by changing config alone, you can fully control which -# resources an Worker connects to. (You can even disallow access to the public internet, although -# public internet access is granted by default.) -# -# This config format is fairly powerful, allowing you to do things like define a TLS-terminating -# reverse proxy server without using any actual JavaScript code. However, you should not be -# afraid to fall back to code for anything the config cannot express, as Workers are very fast -# to execute! - -# Any capnp files imported here must be: -# 1. embedded into workerd-meta.capnp -# 2. added to `tryImportBulitin` in workerd.c++ (grep for '"/workerd/workerd.capnp"'). -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("workerd::server::config"); -$Cxx.allowCancellation; - -struct Config { - # Top-level configuration for a workerd instance. - - services @0 :List(Service); - # List of named services defined by this server. These names are private; they are only used - # to refer to the services from elsewhere in this config file, as well as for logging and the - # like. Services are not reachable until you configure some way to make them reachable, such - # as via a Socket. - # - # If you do not define any service called "internet", one is defined implicitly, representing - # the ability to access public internet servers. An explicit definition would look like: - # - # ( name = "internet", - # network = ( - # allow = ["public"], # Allows connections to publicly-routable addresses only. - # tlsOptions = (trustBrowserCas = true) - # ) - # ) - # - # The "internet" service backs the global `fetch()` function in a Worker, unless that Worker's - # configuration specifies some other service using the `globalOutbound` setting. - - sockets @1 :List(Socket); - # List of sockets on which this server will listen, and the services that will be exposed - # through them. - - v8Flags @2 :List(Text); - # List of "command-line" flags to pass to V8, like "--expose-gc". We put these in the config - # rather than on the actual command line because for most use cases, managing these via the - # config file is probably cleaner and easier than passing on the actual CLI. - # - # WARNING: Use at your own risk. V8 flags can have all sorts of wild effects including completely - # breaking everything. V8 flags also generally do not come with any guarantee of stability - # between V8 versions. Most users should not set any V8 flags. - - extensions @3 :List(Extension); - # Extensions provide capabilities to all workers. Extensions are usually prepared separately - # and are late-linked with the app using this config field. - - autogates @4 :List(Text); - # A list of gates which are enabled. - # These are used to gate features/changes in workerd and in our internal repo. See the equivalent - # config definition in our internal repo for more details. -} - -# ======================================================================================== -# Sockets - -struct Socket { - name @0 :Text; - # Each socket has a unique name which can be used on the command line to override the socket's - # address with `--socket-addr =` or `--socket-fd =`. - - address @1 :Text; - # Address/port on which this socket will listen. Optional; if not specified, then you will be - # required to specify the socket on the command line with with `--socket-addr =` or - # `--socket-fd =`. - # - # Examples: - # - "*:80": Listen on port 80 on all local IPv4 and IPv6 interfaces. - # - "1.2.3.4": Listen on the specific IPv4 address on the default port for the protocol. - # - "1.2.3.4:80": Listen on the specific IPv4 address and port. - # - "1234:5678::abcd": Listen on the specific IPv6 address on the default port for the protocol. - # - "[1234:5678::abcd]:80": Listen on the specific IPv6 address and port. - # - "unix:/path/to/socket": Listen on a Unix socket. - # - "unix-abstract:name": On Linux, listen on the given "abstract" Unix socket name. - # - "example.com:80": Perform a DNS lookup to determine the address, and then listen on it. If - # this resolves to multiple addresses, listen on all of them. - # - # (These are the formats supported by KJ's parseAddress().) - - union { - http @2 :HttpOptions; - https :group { - options @3 :HttpOptions; - tlsOptions @4 :TlsOptions; - } - - # TODO(someday): TCP, TCP proxy, SMTP, Cap'n Proto, ... - } - - service @5 :ServiceDesignator; - # Service name which should handle requests on this socket. - - # TODO(someday): Support mapping different hostnames to different services? Or should that be - # done strictly via JavaScript? -} - -# ======================================================================================== -# Services - -struct Service { - # Defines a named service. Each server has a list of named services. The names are private, - # used to refer to the services within this same config file. - - name @0 :Text; - # Name of the service. Used only to refer to the service from elsewhere in the config file. - # Services are not accessible unless you explicitly configure them to be, such as through a - # `Socket` or through a binding from another Worker. - - union { - unspecified @1 :Void; - # (This catches when someone forgets to specify one of the union members. Do not set this.) - - worker @2 :Worker; - # A Worker! - - network @3 :Network; - # A service that implements access to a network. fetch() requests are routed according to - # the URL hostname. - - external @4 :ExternalServer; - # A service that forwards all requests to a specific remote server. Typically used to - # connect to a back-end server on your internal network. - - disk @5 :DiskDirectory; - # An HTTP service backed by a directory on disk, supporting a basic HTTP GET/PUT. Generally - # not intended to be exposed directly to the internet; typically you want to bind this into - # a Worker that adds logic for setting Content-Type and the like. - } - - # TODO(someday): Allow defining a list of middlewares to stack on top of the service. This would - # be a list of Worker names, where each Worker must have a binding called `next`. This - # implicitly creates an inherited worker that wraps this service, with the `next` binding - # pointing to the service itself (or to the next middleware in the stack). -} - -struct ServiceDesignator { - # A reference to a service from elsewhere in the config file, e.g. from a service binding in a - # Worker. - # - # In the case that only `name` needs to be specified, then you can provide a raw string wherever - # `ServiceDesignator` is needed. Cap'n proto automatically assumes the string is intended to be - # the value for `name`, since that is the first field. In other words, if you would otherwise - # write something like: - # - # bindings = [(service = (name = "foo"))] - # - # You can write this instead, which is equivalent: - # - # bindings = [(service = "foo")] - - name @0 :Text; - # Name of the service in the Config.services list. - - entrypoint @1 :Text; - # A modules-syntax Worker can export multiple named entrypoints. `export default {` specifies - # the default entrypoint, whereas `export let foo = {` defines an entrypoint named `foo`. If - # `entrypoint` is specified here, it names an alternate entrypoint to use on the target worker, - # otherwise the default is used. - - # TODO(someday): Options to specify which event types are allowed. - # TODO(someday): Allow adding an outgoing middleware stack here (see TODO in Service, above). -} - -struct Worker { - union { - modules @0 :List(Module); - # The Worker is composed of ES modules that may import each other. The first module in the list - # is the main module, which exports event handlers. - - serviceWorkerScript @1 :Text; - # The Worker is composed of one big script that uses global `addEventListener()` to register - # event handlers. - # - # The value of this field is the raw source code. When using Cap'n Proto text format, use the - # `embed` directive to read the code from an external file: - # - # serviceWorkerScript = embed "worker.js" - - inherit @2 :Text; - # Inherit the configuration of some other Worker by its service name. This Worker is a clone - # of the other worker, but various settings can be modified: - # * `bindings`, if specified, overrides specific named bindings. (Each binding listed in the - # derived worker must match the name and type of some binding in the inherited worker.) - # * `globalOutbound`, if non-null, overrides the one specified in the inherited worker. - # * `compatibilityDate` and `compatibilityFlags` CANNOT be modified; they must be null. - # * If the inherited worker defines durable object namespaces, then the derived worker must - # specify `durableObjectStorage` to specify where its instances should be stored. Each - # devived worker receives its own namespace of objects. `durableObjectUniqueKeyModifier` - # must also be specified by derived workers. - # - # This can be useful when you want to run the same Worker in multiple configurations or hooked - # up to different back-ends. Note that all derived workers run in the same isolate as the - # base worker; they differ in the content of the `env` object passed to them, which contains - # the bindings. (When using service workers syntax, the global scope contains the bindings; - # in this case each derived worker runs in its own global scope, though still in the same - # isolate.) - } - - struct Module { - name @0 :Text; - # Name (or path) used to import the module. - - union { - esModule @1 :Text; - # An ES module file with imports and exports. - # - # As with `serviceWorkerScript`, above, the value is the raw source code. - - commonJsModule @2 :Text; - # A common JS module, using require(). - - text @3 :Text; - # A raw text blob. Importing this will produce a string with the value. - - data @4 :Data; - # A raw data blob. Importing this will produce an ArrayBuffer with the value. - - wasm @5 :Data; - # A Wasm module. The value is a compiled binary Wasm module file. Importing this will produce - # a `WebAssembly.Module` object, which you can then instantiate. - - json @6 :Text; - # Importing this will produce the result of parsing the given text as JSON. - - nodeJsCompatModule @7 :Text; - # A Node.js module is a specialization of a commonJsModule that: - # (a) allows for importing Node.js-compat built-ins without the node: specifier-prefix - # (b) exposes the subset of common Node.js globals such as process, Buffer, etc that - # we implement in the workerd runtime. - - pythonModule @8 :Text; - # A Python module. All bundles containing this value type are converted into a JS/WASM Worker - # Bundle prior to execution. - - pythonRequirement @9 :Text; - # A Python package that is required by this bundle. The package must be supported by - # Pyodide (https://pyodide.org/en/stable/usage/packages-in-pyodide.html). All packages listed - # will be installed prior to the execution of the worker. - } - - namedExports @10 :List(Text); - # For commonJsModule and nodeJsCompatModule, this is a list of named exports that the - # module expects to be exported once the evaluation is complete. - } - - compatibilityDate @3 :Text; - compatibilityFlags @4 :List(Text); - # See: https://developers.cloudflare.com/workers/platform/compatibility-dates/ - # - # `compatibilityDate` must be specified, unless the Worker inhits from another worker, in which - # case it must not be specified. `compatibilityFlags` can optionally be specified when - # `compatibilityDate` is specified. - - bindings @5 :List(Binding); - # List of bindings, which give the Worker access to external resources and configuration - # settings. - # - # For Workers using ES modules syntax, the bindings are delivered via the `env` object. For - # service workers syntax, each binding shows up as a global variable. - - struct Binding { - name @0 :Text; - - union { - unspecified @1 :Void; - # (This catches when someone forgets to specify one of the union members. Do not set this.) - - parameter :group { - # Indicates that the Worker requires a binding of the given type, but it won't be specified - # here. Another Worker can inherit this Worker and fill in this binding. - - type @2 :Type; - # Expected type of this parameter. - - optional @3 :Bool; - # If true, this binding is optional. Derived workers need not specify it, in which case - # the binding won't be present in the environment object passed to the worker. - # - # When a Worker has any non-optional parameters that haven't been filled in, then it can - # only be used for inheritance; it cannot be invoked directly. - } - - text @4 :Text; - # A string. - - data @5 :Data; - # An ArrayBuffer. - - json @6 :Text; - # A value parsed from JSON. - - wasmModule @7 :Data; - # A WebAssembly module. The binding will be an instance of `WebAssembly.Module`. Only - # supported when using Service Workers syntax. - # - # DEPRECATED: Please switch to ES modules syntax instead, and embed Wasm modules as modules. - - cryptoKey @8 :CryptoKey; - # A CryptoKey instance, for use with the WebCrypto API. - # - # Note that by setting `extractable = false`, you can prevent the Worker code from accessing - # or leaking the raw key material; it will only be able to use the key to perform WebCrypto - # operations. - - service @9 :ServiceDesignator; - # Binding to a named service (possibly, a worker). - - durableObjectNamespace @10 :DurableObjectNamespaceDesignator; - # Binding to the durable object namespace implemented by the given class. - # - # In the common case that this refers to a class in the same Worker, you can specify just - # a string, like: - # - # durableObjectNamespace = "MyClass" - - kvNamespace @11 :ServiceDesignator; - # A KV namespace, implemented by the named service. The Worker sees a KvNamespace-typed - # binding. Requests to the namespace will be converted into HTTP requests targeting the - # given service name. - - r2Bucket @12 :ServiceDesignator; - r2Admin @13 :ServiceDesignator; - # R2 bucket and admin API bindings. Similar to KV namespaces, these turn operations into - # HTTP requests aimed at the named service. - - wrapped @14 :WrappedBinding; - # Wraps a collection of inner bindings in a common api functionality. - - queue @15 :ServiceDesignator; - # A Queue binding, implemented by the named service. Requests to the - # namespace will be converted into HTTP requests targeting the given - # service name. - - fromEnvironment @16 :Text; - # Takes the value of an environment variable from the system. The value specified here is - # the name of a system environment variable. The value of the binding is obtained by invoking - # `getenv()` with that name. If the environment variable isn't set, the binding value is - # `null`. - - analyticsEngine @17 :ServiceDesignator; - # A binding for Analytics Engine. Allows workers to store information through Analytics Engine Events. - # workerd will forward AnalyticsEngineEvents to designated service in the body of HTTP requests - # This binding is subject to change and requires the `--experimental` flag - - hyperdrive :group { - designator @18 :ServiceDesignator; - database @19 :Text; - user @20 :Text; - password @21 :Text; - scheme @22 :Text; - } - # A binding for Hyperdrive. Allows workers to use Hyperdrive caching & pooling for Postgres - # databases. - - unsafeEval @23 :Void; - # A simple binding that enables access to the UnsafeEval API. - - memoryCache :group { - # A binding representing access to an in-memory cache. - - id @24 :Text; - # The identifier associated with this cache. Any number of isolates - # can access the same in-memory cache (within the same process), and - # each worker may use any number of in-memory caches. - - limits @25 :MemoryCacheLimits; - } - - # TODO(someday): dispatch, other new features - } - - struct Type { - # Specifies the type of a parameter binding. - - union { - unspecified @0 :Void; - # (This catches when someone forgets to specify one of the union members. Do not set this.) - - text @1 :Void; - data @2 :Void; - json @3 :Void; - wasm @4 :Void; - cryptoKey @5 :List(CryptoKey.Usage); - service @6 :Void; - durableObjectNamespace @7 :Void; - kvNamespace @8 :Void; - r2Bucket @9 :Void; - r2Admin @10 :Void; - queue @11 :Void; - analyticsEngine @12 : Void; - hyperdrive @13: Void; - } - } - - struct DurableObjectNamespaceDesignator { - # The type of a Durable Object namespace binding. - - className @0 :Text; - # Exported class name that implements the Durable Object. - - serviceName @1 :Text; - # The service name of the worker that defines this class. If omitted, the current worker - # is assumed. - # - # Use of this field is discouraged. Instead, when accessing a different Worker's Durable - # Objects, specify a `service` binding to that worker, and have the worker implement an - # appropriate API. - # - # (This is intentionally not a ServiceDesignator because you cannot choose an alternate - # entrypoint here; the class name IS the entrypoint.) - } - - struct CryptoKey { - # Parameters to crypto.subtle.importKey(). - - union { - raw @0 :Data; - hex @1 :Text; - base64 @2 :Text; - # Raw key material, possibly hex or base64-encoded. Use this for symmetric keys. - # - # Hint: `raw` would typically be used with Cap'n Proto's `embed` syntax to embed an - # external binary key file. `hex` or `base64` could do that too but can also be specified - # inline. - - pkcs8 @3 :Text; - # Private key in PEM-encoded PKCS#8 format. - - spki @4 :Text; - # Public key in PEM-encoded SPKI format. - - jwk @5 :Text; - # Key in JSON format. - } - - algorithm :union { - # Value for the `algorithm` parameter. - - name @6 :Text; - # Just a name, like `AES-GCM`. - - json @7 :Text; - # An object, encoded here as JSON. - } - - extractable @8 :Bool = false; - # Is the Worker allowed to export this key to obtain the underlying key material? Setting - # this false ensures that the key cannot be leaked by errant JavaScript code; the key can - # only be used in WebCrypto operations. - - usages @9 :List(Usage); - # What operations is this key permitted to be used for? - - enum Usage { - encrypt @0; - decrypt @1; - sign @2; - verify @3; - deriveKey @4; - deriveBits @5; - wrapKey @6; - unwrapKey @7; - } - } - - struct MemoryCacheLimits { - maxKeys @0 :UInt32; - maxValueSize @1 :UInt32; - maxTotalValueSize @2 :UInt64; - } - - struct WrappedBinding { - # A binding that wraps a group of (lower-level) bindings in a common API. - - moduleName @0 :Text; - # Wrapper module name. - # The module must be an internal one (provided by extension or registered in the c++ code). - # Module will be instantitated during binding initialization phase. - - entrypoint @1 :Text = "default"; - # Module needs to export a function with a given name (default export gets "default" name). - # The function needs to accept a single `env` argument - a dictionary with inner bindings. - # Function will be invoked during initialization phase and its return value will be used as - # resulting binding value. - - innerBindings @2 :List(Binding); - # Inner bindings that will be created and passed in the env dictionary. - # These bindings shall be used to implement end-user api, and are not available to the - # binding consumers unless "re-exported" in wrapBindings function. - } - } - - globalOutbound @6 :ServiceDesignator = "internet"; - # Where should the global "fetch" go to? The default is the service called "internet", which - # should usually be configured to talk to the public internet. - - cacheApiOutbound @11 :ServiceDesignator; - # Where should cache API (i.e. caches.default and caches.open(...)) requests go? - - durableObjectNamespaces @7 :List(DurableObjectNamespace); - # List of durable object namespaces in this Worker. - - struct DurableObjectNamespace { - className @0 :Text; - # Exported class name that implements the Durable Object. - # - # Changing the class name will not break compatibility with existing storage, so long as - # `uniqueKey` stays the same. - - union { - uniqueKey @1 :Text; - # A unique, stable ID associated with this namespace. This could be a GUID, or any other - # string which does not appear anywhere else in the world. - # - # This string is used to ensure that objects of this class have unique identifiers distinct - # from objects of any other class. Object IDs are cryptographically derived from `uniqueKey` - # and validated against it. It is impossible to guess or forge a valid object ID without - # knowing the `uniqueKey`. Hence, if you keep the key secret, you can prevent anyone from - # forging IDs. However, if you don't care if users can forge valid IDs, then it's not a big - # deal if the key leaks. - # - # DO NOT LOSE this key, otherwise it may be difficult or impossible to recover stored data. - - ephemeralLocal @2 :Void; - # Instances of this class are ephemeral -- they have no durable storage at all. The - # `state.storage` API will not be present. Additionally, this namespace will allow arbitrary - # strings as IDs. There are no `idFromName()` nor `newUniqueId()` methods; `get()` takes any - # string as a parameter. - # - # Ephemeral objects are NOT globally unique, only "locally" unique, for some definition of - # "local". For example, on Cloudflare's network, these objects are unique per-colo. - # - # WARNING: Cloudflare Workers currently limits this feature to Cloudflare-internal users - # only, because using them correctly requires deep understanding of Cloudflare network - # topology. We're working on something better for public consuption. Until then for - # "ephemeral" use cases we recommend using regular durable objects and just not storing - # anything. An object that hasn't stored anything will not consume any storage space on - # disk. - } - - preventEviction @3 :Bool; - # By default, Durable Objects are evicted after 10 seconds of inactivity, and expire 70 seconds - # after all clients have disconnected. Some applications may want to keep their Durable Objects - # pinned to memory forever, so we provide this flag to change the default behavior. - # - # Note that this is only supported in Workerd; production Durable Objects cannot toggle eviction. - - enableSql @4 :Bool; - # Whether or not Durable Objects in this namespace can use the `storage.sql` API to execute SQL - # queries. - # - # workerd uses SQLite to back all Durable Objects, but the SQL API is hidden by default to - # emulate behavior of traditional DO namespaces on Cloudflare that aren't SQLite-backed. This - # flag should be enabled when testing code that will run on a SQLite-backed namespace. - } - - durableObjectUniqueKeyModifier @8 :Text; - # Additional text which is hashed together with `DurableObjectNamespace.uniqueKey`. When using - # worker inheritance, each derived worker must specify a unique modifier to ensure that its - # Durable Object instances have unique IDs from all other workers inheriting the same parent. - # - # DO NOT LOSE this value, otherwise it may be difficult or impossible to recover stored data. - - durableObjectStorage :union { - # Specifies where this worker's Durable Objects are stored. - - none @9 :Void; - # Default. The worker has no Durable Objects. `durableObjectNamespaces` must be empty, or - # define all namespaces as `ephemeralLocal`, or this must be an abstract worker (meant to be - # inherited by other workers, who will specify `durableObjectStorage`). - - inMemory @10 :Void; - # The `state.storage` API stores in-memory only. All stored data will persist for the - # lifetime of the process, but will be lost upon process exit. - # - # Individual objects will still shut down when idle as normal -- only data stored with the - # `state.storage` interface is persistent for the lifetime of the process. - # - # This mode is intended for local testing purposes. - - localDisk @12 :Text; - # ** EXPERIMENTAL; SUBJECT TO BACKWARDS-INCOMPATIBLE CHANGE ** - # - # Durable Object data will be stored in a directory on local disk. This field is the name of - # a service, which must be a DiskDirectory service. For each Durable Object class, a - # subdirectory will be created using `uniqueKey` as the name. Within the directory, one or - # more files are created for each object, with names `.`, where `.` may be any of - # a number of different extensions depending on the storage mode. (Currently, the main storage - # is a file with the extension `.sqlite`, and in certain situations extra files with the - # extensions `.sqlite-wal`, and `.sqlite-shm` may also be present.) - } - - # TODO(someday): Support distributing objects across a cluster. At present, objects are always - # local to one instance of the runtime. - - moduleFallback @13 :Text; - -} - -struct ExternalServer { - # Describes the ability to talk to a specific server, typically a back-end server available - # on the internal network. - # - # When a Worker contains a service binding that points to an ExternalServer, *all* fetch() - # calls on that binding will be delivered to that server, regardless of whether the hostname - # or protocol specified in the URL actually match the hostname or protocol used by the actual - # server. Typically, a Worker implementing a reverse proxy would use this to forward a request - # to a back-end application server. Such a back-end typically does not have a real public - # hostname, since it is only reachable through the proxy, but the requests forwarded to it will - # keep the hostname that was on the original request. - # - # Note that this also implies that regardless of whether the original URL was http: or https:, - # the request will be delivered to the target server using the protocol specified below. A - # header like `X-Forwarded-Proto` can be used to pass along the original protocol; see - # `HttpOptions`. - - address @0 :Text; - # Address/port of the server. Optional; if not specified, then you will be required to specify - # the address on the command line with with `--external-addr =`. - # - # Examples: - # - "1.2.3.4": Connect to the given IPv4 address on the protocol's default port. - # - "1.2.3.4:80": Connect to the given IPv4 address and port. - # - "1234:5678::abcd": Connect to the given IPv6 address on the protocol's default port. - # - "[1234:5678::abcd]:80": Connect to the given IPv6 address and port. - # - "unix:/path/to/socket": Connect to the given Unix Domain socket by path. - # - "unix-abstract:name": On Linux, connect to the given "abstract" Unix socket name. - # - "example.com:80": Perform a DNS lookup to determine the address, and then connect to it. - # - # (These are the formats supported by KJ's parseAddress().) - - union { - http @1 :HttpOptions; - # Talk to the server over unencrypted HTTP. - - https :group { - # Talk to the server over encrypted HTTPS. - - options @2 :HttpOptions; - tlsOptions @3 :TlsOptions; - - certificateHost @4 :Text; - # If present, expect the host to present a certificate authenticating it as this hostname. - # If `certificateHost` is not provided, then the certificate is checked against `address`. - } - - tcp :group { - # Connect to the server over raw TCP. Bindings to this service will only support the - # `connect()` method; `fetch()` will throw an exception. - tlsOptions @5 :TlsOptions; - certificateHost @6 :Text; - } - - # TODO(someday): Cap'n Proto RPC - } -} - -struct Network { - # Describes the ability to talk to a network. - # - # This is commonly used to define the "internet" service which is the default `globalOutbound` - # for all Workers. To prevent SSRF, by default Workers will not be permitted to reach internal - # network addresses using global fetch(). It's recommended that you create ExternalServer - # bindings instead to grant access to specific servers. However, if you really want to, you - # can configure a service that grants arbitrary internal network access, like: - # - # ( name = "internalNetwork", - # network = ( - # allow = ["public", "private"], - # ) - # ) - - allow @0 :List(Text) = ["public"]; - deny @1 :List(Text); - # Specifies which network addresses the Worker will be allowed to connect to, e.g. using fetch(). - # The default allows publicly-routable IP addresses only, in order to prevent SSRF attacks. - # - # The allow and deny lists specify network blocks in CIDR notation (IPv4 and IPv6), such as - # "192.0.2.0/24" or "2001:db8::/32". Traffic will be permitted as long as the address - # matches at least one entry in the allow list and none in the deny list. - # - # In addition to IPv4 and IPv6 CIDR notation, several special strings may be specified: - # - "private": Matches network addresses that are reserved by standards for private networks, - # such as "10.0.0.0/8" or "192.168.0.0/16". This is a superset of "local". - # - "public": Opposite of "private". - # - "local": Matches network addresses that are defined by standards to only be accessible from - # the local machine, such as "127.0.0.0/8" or Unix domain addresses. - # - "network": Opposite of "local". - # - "unix": Matches all Unix domain socket addresses. (In the future, we may support specifying a - # glob to narrow this to specific paths.) - # - "unix-abstract": Matches Linux's "abstract unix domain" addresses. (In the future, we may - # support specifying a glob.) - # - # In the case that the Worker specifies a DNS hostname rather than a raw address, these rules are - # used to filter the addresses returned by the lookup. If none of the returned addresses turn - # out to be permitted, then the system will behave as if the DNS entry did not exist. - # - # (The above is exactly the format supported by kj::Network::restrictPeers().) - - tlsOptions @2 :TlsOptions; -} - -struct DiskDirectory { - # Configures access to a directory on disk. This is a type of service which will expose an HTTP - # interface to the directory content. - # - # This is very bare-bones, generally not suitable for serving a web site on its own. In - # particular, no attempt is made to guess the `Content-Type` header. You normally would wrap - # this in a Worker that fills in the metadata in the way you want. - # - # A GET request targeting a directory (rather than a file) will return a basic JSAN directory - # listing like: - # - # [{"name":"foo","type":"file"},{"name":"bar","type":"directory"}] - # - # Possible "type" values are "file", "directory", "symlink", "blockDevice", "characterDevice", - # "namedPipe", "socket", "other". - # - # `Content-Type` will be `application/octet-stream` for files or `application/json` for a - # directory listing. Files will have a `Content-Length` header, directories will not. Symlinks - # will be followed (but there is intentionally no way to create one, even if `writable` is - # `true`), and treated according to the type of file they point to. The other inode types cannot - # be opened; trying to do so will produce a "406 Not Acceptable" error (on the theory that there - # is no acceptable format for these, regardless of what the client says it accepts). - # - # `HEAD` requests are properly optimized to perform a stat() without actually opening the file. - - path @0 :Text; - # The filesystem path of the directory. If not specified, then it must be specified on the - # command line with `--directory-path =`. - # - # Relative paths are interpreted relative to the current directory where the server is executed, - # NOT relative to the config file. So, you should usually use absolute paths in the config file. - - writable @1 :Bool = false; - # Whether to support PUT requests for writing. A PUT will write to a temporary file which - # is atomically moved into place upon successful completion of the upload. Parent directories are - # created as needed. - - allowDotfiles @2 :Bool = false; - # Whether to allow access to files and directories whose name starts with '.'. These are made - # inaccessible by default since they very often store metadata that is not meant to be served, - # e.g. a git repository or an `.htaccess` file. - # - # Note that the special links "." and ".." will never be accessible regardless of this setting. -} - -# ======================================================================================== -# Protocol options - -struct HttpOptions { - # Options for using HTTP (as a client or server). In particular, this specifies behavior that is - # important in the presence of proxy servers, whether forward or reverse. - - style @0 :Style = host; - - enum Style { - host @0; - # Normal HTTP. The request line contains only the path, and the separate `Host` header - # specifies the hostname. - - proxy @1; - # HTTP proxy protocol. The request line contains a full URL instead of a path. No `Host` - # header is required. This is the protocol used by HTTP forward proxies. This allows you to - # implement such a proxy as a Worker. - } - - forwardedProtoHeader @1 :Text; - # If specified, then when the given header is present on a request, it specifies the protocol - # ("http" or "https") that was used by the original client. The request URL reported to the - # Worker will reflect this protocol. Otherwise, the URL will reflect the actual physical protocol - # used by the server in receiving the request. - # - # This option is useful when this server sits behind a reverse proxy that performs TLS - # termination. Typically such proxies forward the original protocol in a header named something - # like "X-Forwarded-Proto". - # - # This setting is ignored when `style` is `proxy`. - - cfBlobHeader @2 :Text; - # If set, then the `request.cf` object will be encoded (as JSON) into / parsed from the header - # with this name. Otherwise, it will be discarded on send / `undefined` on receipt. - - injectRequestHeaders @3 :List(Header); - # List of headers which will be automatically injected into all requests. This can be used - # e.g. to add an authorization token to all requests when using `ExternalServer`. It can also - # apply to incoming requests received on a `Socket` to modify the headers that will be delivered - # to the app. Any existing header with the same name is removed. - - injectResponseHeaders @4 :List(Header); - # Same as `injectRequestHeaders` but for responses. - - struct Header { - name @0 :Text; - # Case-insensitive. - - value @1 :Text; - # If null, the header will be removed. - } - - capnpConnectHost @5 :Text; - # A CONNECT request for this host+port will be treated as a request to form a Cap'n Proto RPC - # connection. The server will expose a WorkerdBootstrap as the bootstrap interface, allowing - # events to be delivered to the target worker via capnp. Clients will use capnp for non-HTTP - # event types (especially JSRPC). - - # TODO(someday): When we support TCP, include an option to deliver CONNECT requests to the - # TCP handler. -} - -struct TlsOptions { - # Options that apply when using TLS. Can apply on either the client or the server side, depending - # on the context. - # - # This is based on KJ's TlsContext::Options. - - keypair @0 :Keypair; - # The default private key and certificate to use. Optional when acting as a client. - - struct Keypair { - privateKey @0 :Text; - # Private key in PEM format. Supports PKCS8 keys as well as "traditional format" RSA and DSA - # keys. - # - # Remember that you can use Cap'n Proto's `embed` syntax to reference an external file. - - certificateChain @1 :Text; - # Certificate chain in PEM format. A chain can be constructed by concatenating multiple - # PEM-encoded certificates, starting with the leaf certificate. - } - - # TODO(someday): Support SNI-based keypair selection? Is a hostname -> keypair map good enough? - # Does it need to support wildcards? Maybe we should just let you provide a pile of certs and - # we can figure out which hosts each one matches? - - requireClientCerts @1 :Bool = false; - # If true, then when acting as a server, incoming connections will be rejected unless they bear - # a certificate signed by one of the trusted CAs. - # - # Typically, when using this, you'd set `trustBrowserCas = false` and list a specific private CA - # in `trustedCertificates`. - - trustBrowserCas @2 :Bool = false; - # If true, trust certificates which are signed by one of the CAs that browsers normally trust. - # You should typically set this true when talking to the public internet, but you may want to - # set it false when talking to servers on your internal network. - - trustedCertificates @3 :List(Text); - # Additional CA certificates to trust, in PEM format. Remember that you can use Cap'n Proto's - # `embed` syntax to read the certificates from other files. - - minVersion @4 :Version = goodDefault; - # Minimum TLS version that will be allowed. Generally you should not override this unless you - # have unusual backwards-compatibility needs. - - enum Version { - goodDefault @0; - # A good default chosen by the code maintainers. May change over time. - - ssl3 @1; - tls1Dot0 @2; - tls1Dot1 @3; - tls1Dot2 @4; - tls1Dot3 @5; - } - - cipherList @5 :Text; - # OpenSSL cipher list string. The default is a curated list designed to be compatible with - # almost all software in current use (specifically, based on Mozilla's "intermediate" - # recommendations). The defaults will change in future versions of this software to account - # for the latest cryptanalysis. - # - # Generally you should only specify your own `cipherList` if: - # - You have extreme backwards-compatibility needs and wish to enable obsolete and/or broken - # algorithms. - # - You need quickly to disable an algorithm recently discovered to be broken. -} - -# ======================================================================================== -# Extensions - -struct Extension { - # Additional capabilities for workers. - - modules @0 :List(Module); - # List of javascript modules provided by the extension. - # These modules can either be imported directly as user-level api (if not marked internal) - # or used to define more complicated workerd constructs such as wrapped bindings and events. - - struct Module { - # A module extending workerd functionality. - - name @0 :Text; - # Full js module name. - - internal @1 :Bool = false; - # Internal modules can be imported by other extension modules only and not the user code. - - esModule @2 :Text; - # Raw source code of ES module. - } -} \ No newline at end of file diff --git a/packages/miniflare/src/runtime/config/workerd.capnp.d.ts b/packages/miniflare/src/runtime/config/workerd.capnp.d.ts deleted file mode 100644 index 1294b3815e7b..000000000000 --- a/packages/miniflare/src/runtime/config/workerd.capnp.d.ts +++ /dev/null @@ -1,1031 +0,0 @@ -/** - * This file has been automatically generated by the [capnpc-ts utility](https://github.com/jdiaz5513/capnp-ts). - */ -import * as capnp from "capnp-ts"; -import { Struct as __S } from 'capnp-ts'; -export declare const _capnpFileId = "e6afd26682091c01"; -export declare class Config extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Services: capnp.ListCtor; - static _Sockets: capnp.ListCtor; - static _Extensions: capnp.ListCtor; - adoptServices(value: capnp.Orphan>): void; - disownServices(): capnp.Orphan>; - getServices(): capnp.List; - hasServices(): boolean; - initServices(length: number): capnp.List; - setServices(value: capnp.List): void; - adoptSockets(value: capnp.Orphan>): void; - disownSockets(): capnp.Orphan>; - getSockets(): capnp.List; - hasSockets(): boolean; - initSockets(length: number): capnp.List; - setSockets(value: capnp.List): void; - adoptV8Flags(value: capnp.Orphan>): void; - disownV8Flags(): capnp.Orphan>; - getV8Flags(): capnp.List; - hasV8Flags(): boolean; - initV8Flags(length: number): capnp.List; - setV8Flags(value: capnp.List): void; - adoptExtensions(value: capnp.Orphan>): void; - disownExtensions(): capnp.Orphan>; - getExtensions(): capnp.List; - hasExtensions(): boolean; - initExtensions(length: number): capnp.List; - setExtensions(value: capnp.List): void; - adoptAutogates(value: capnp.Orphan>): void; - disownAutogates(): capnp.Orphan>; - getAutogates(): capnp.List; - hasAutogates(): boolean; - initAutogates(length: number): capnp.List; - setAutogates(value: capnp.List): void; - toString(): string; -} -export declare class Socket_Https extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptOptions(value: capnp.Orphan): void; - disownOptions(): capnp.Orphan; - getOptions(): HttpOptions; - hasOptions(): boolean; - initOptions(): HttpOptions; - setOptions(value: HttpOptions): void; - adoptTlsOptions(value: capnp.Orphan): void; - disownTlsOptions(): capnp.Orphan; - getTlsOptions(): TlsOptions; - hasTlsOptions(): boolean; - initTlsOptions(): TlsOptions; - setTlsOptions(value: TlsOptions): void; - toString(): string; -} -export declare enum Socket_Which { - HTTP = 0, - HTTPS = 1 -} -export declare class Socket extends __S { - static readonly HTTP = Socket_Which.HTTP; - static readonly HTTPS = Socket_Which.HTTPS; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - getAddress(): string; - setAddress(value: string): void; - adoptHttp(value: capnp.Orphan): void; - disownHttp(): capnp.Orphan; - getHttp(): HttpOptions; - hasHttp(): boolean; - initHttp(): HttpOptions; - isHttp(): boolean; - setHttp(value: HttpOptions): void; - getHttps(): Socket_Https; - initHttps(): Socket_Https; - isHttps(): boolean; - setHttps(): void; - adoptService(value: capnp.Orphan): void; - disownService(): capnp.Orphan; - getService(): ServiceDesignator; - hasService(): boolean; - initService(): ServiceDesignator; - setService(value: ServiceDesignator): void; - toString(): string; - which(): Socket_Which; -} -export declare enum Service_Which { - UNSPECIFIED = 0, - WORKER = 1, - NETWORK = 2, - EXTERNAL = 3, - DISK = 4 -} -export declare class Service extends __S { - static readonly UNSPECIFIED = Service_Which.UNSPECIFIED; - static readonly WORKER = Service_Which.WORKER; - static readonly NETWORK = Service_Which.NETWORK; - static readonly EXTERNAL = Service_Which.EXTERNAL; - static readonly DISK = Service_Which.DISK; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - isUnspecified(): boolean; - setUnspecified(): void; - adoptWorker(value: capnp.Orphan): void; - disownWorker(): capnp.Orphan; - getWorker(): Worker; - hasWorker(): boolean; - initWorker(): Worker; - isWorker(): boolean; - setWorker(value: Worker): void; - adoptNetwork(value: capnp.Orphan): void; - disownNetwork(): capnp.Orphan; - getNetwork(): Network; - hasNetwork(): boolean; - initNetwork(): Network; - isNetwork(): boolean; - setNetwork(value: Network): void; - adoptExternal(value: capnp.Orphan): void; - disownExternal(): capnp.Orphan; - getExternal(): ExternalServer; - hasExternal(): boolean; - initExternal(): ExternalServer; - isExternal(): boolean; - setExternal(value: ExternalServer): void; - adoptDisk(value: capnp.Orphan): void; - disownDisk(): capnp.Orphan; - getDisk(): DiskDirectory; - hasDisk(): boolean; - initDisk(): DiskDirectory; - isDisk(): boolean; - setDisk(value: DiskDirectory): void; - toString(): string; - which(): Service_Which; -} -export declare class ServiceDesignator extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - getEntrypoint(): string; - setEntrypoint(value: string): void; - toString(): string; -} -export declare enum Worker_Module_Which { - ES_MODULE = 0, - COMMON_JS_MODULE = 1, - TEXT = 2, - DATA = 3, - WASM = 4, - JSON = 5, - NODE_JS_COMPAT_MODULE = 6, - PYTHON_MODULE = 7, - PYTHON_REQUIREMENT = 8 -} -export declare class Worker_Module extends __S { - static readonly ES_MODULE = Worker_Module_Which.ES_MODULE; - static readonly COMMON_JS_MODULE = Worker_Module_Which.COMMON_JS_MODULE; - static readonly TEXT = Worker_Module_Which.TEXT; - static readonly DATA = Worker_Module_Which.DATA; - static readonly WASM = Worker_Module_Which.WASM; - static readonly JSON = Worker_Module_Which.JSON; - static readonly NODE_JS_COMPAT_MODULE = Worker_Module_Which.NODE_JS_COMPAT_MODULE; - static readonly PYTHON_MODULE = Worker_Module_Which.PYTHON_MODULE; - static readonly PYTHON_REQUIREMENT = Worker_Module_Which.PYTHON_REQUIREMENT; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - getEsModule(): string; - isEsModule(): boolean; - setEsModule(value: string): void; - getCommonJsModule(): string; - isCommonJsModule(): boolean; - setCommonJsModule(value: string): void; - getText(): string; - isText(): boolean; - setText(value: string): void; - adoptData(value: capnp.Orphan): void; - disownData(): capnp.Orphan; - getData(): capnp.Data; - hasData(): boolean; - initData(length: number): capnp.Data; - isData(): boolean; - setData(value: capnp.Data): void; - adoptWasm(value: capnp.Orphan): void; - disownWasm(): capnp.Orphan; - getWasm(): capnp.Data; - hasWasm(): boolean; - initWasm(length: number): capnp.Data; - isWasm(): boolean; - setWasm(value: capnp.Data): void; - getJson(): string; - isJson(): boolean; - setJson(value: string): void; - getNodeJsCompatModule(): string; - isNodeJsCompatModule(): boolean; - setNodeJsCompatModule(value: string): void; - getPythonModule(): string; - isPythonModule(): boolean; - setPythonModule(value: string): void; - getPythonRequirement(): string; - isPythonRequirement(): boolean; - setPythonRequirement(value: string): void; - adoptNamedExports(value: capnp.Orphan>): void; - disownNamedExports(): capnp.Orphan>; - getNamedExports(): capnp.List; - hasNamedExports(): boolean; - initNamedExports(length: number): capnp.List; - setNamedExports(value: capnp.List): void; - toString(): string; - which(): Worker_Module_Which; -} -export declare enum Worker_Binding_Type_Which { - UNSPECIFIED = 0, - TEXT = 1, - DATA = 2, - JSON = 3, - WASM = 4, - CRYPTO_KEY = 5, - SERVICE = 6, - DURABLE_OBJECT_NAMESPACE = 7, - KV_NAMESPACE = 8, - R2BUCKET = 9, - R2ADMIN = 10, - QUEUE = 11, - ANALYTICS_ENGINE = 12, - HYPERDRIVE = 13 -} -export declare class Worker_Binding_Type extends __S { - static readonly UNSPECIFIED = Worker_Binding_Type_Which.UNSPECIFIED; - static readonly TEXT = Worker_Binding_Type_Which.TEXT; - static readonly DATA = Worker_Binding_Type_Which.DATA; - static readonly JSON = Worker_Binding_Type_Which.JSON; - static readonly WASM = Worker_Binding_Type_Which.WASM; - static readonly CRYPTO_KEY = Worker_Binding_Type_Which.CRYPTO_KEY; - static readonly SERVICE = Worker_Binding_Type_Which.SERVICE; - static readonly DURABLE_OBJECT_NAMESPACE = Worker_Binding_Type_Which.DURABLE_OBJECT_NAMESPACE; - static readonly KV_NAMESPACE = Worker_Binding_Type_Which.KV_NAMESPACE; - static readonly R2BUCKET = Worker_Binding_Type_Which.R2BUCKET; - static readonly R2ADMIN = Worker_Binding_Type_Which.R2ADMIN; - static readonly QUEUE = Worker_Binding_Type_Which.QUEUE; - static readonly ANALYTICS_ENGINE = Worker_Binding_Type_Which.ANALYTICS_ENGINE; - static readonly HYPERDRIVE = Worker_Binding_Type_Which.HYPERDRIVE; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - isUnspecified(): boolean; - setUnspecified(): void; - isText(): boolean; - setText(): void; - isData(): boolean; - setData(): void; - isJson(): boolean; - setJson(): void; - isWasm(): boolean; - setWasm(): void; - adoptCryptoKey(value: capnp.Orphan>): void; - disownCryptoKey(): capnp.Orphan>; - getCryptoKey(): capnp.List; - hasCryptoKey(): boolean; - initCryptoKey(length: number): capnp.List; - isCryptoKey(): boolean; - setCryptoKey(value: capnp.List): void; - isService(): boolean; - setService(): void; - isDurableObjectNamespace(): boolean; - setDurableObjectNamespace(): void; - isKvNamespace(): boolean; - setKvNamespace(): void; - isR2Bucket(): boolean; - setR2Bucket(): void; - isR2Admin(): boolean; - setR2Admin(): void; - isQueue(): boolean; - setQueue(): void; - isAnalyticsEngine(): boolean; - setAnalyticsEngine(): void; - isHyperdrive(): boolean; - setHyperdrive(): void; - toString(): string; - which(): Worker_Binding_Type_Which; -} -export declare class Worker_Binding_DurableObjectNamespaceDesignator extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getClassName(): string; - setClassName(value: string): void; - getServiceName(): string; - setServiceName(value: string): void; - toString(): string; -} -export declare enum Worker_Binding_CryptoKey_Usage { - ENCRYPT = 0, - DECRYPT = 1, - SIGN = 2, - VERIFY = 3, - DERIVE_KEY = 4, - DERIVE_BITS = 5, - WRAP_KEY = 6, - UNWRAP_KEY = 7 -} -export declare enum Worker_Binding_CryptoKey_Algorithm_Which { - NAME = 0, - JSON = 1 -} -export declare class Worker_Binding_CryptoKey_Algorithm extends __S { - static readonly NAME = Worker_Binding_CryptoKey_Algorithm_Which.NAME; - static readonly JSON = Worker_Binding_CryptoKey_Algorithm_Which.JSON; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - isName(): boolean; - setName(value: string): void; - getJson(): string; - isJson(): boolean; - setJson(value: string): void; - toString(): string; - which(): Worker_Binding_CryptoKey_Algorithm_Which; -} -export declare enum Worker_Binding_CryptoKey_Which { - RAW = 0, - HEX = 1, - BASE64 = 2, - PKCS8 = 3, - SPKI = 4, - JWK = 5 -} -export declare class Worker_Binding_CryptoKey extends __S { - static readonly RAW = Worker_Binding_CryptoKey_Which.RAW; - static readonly HEX = Worker_Binding_CryptoKey_Which.HEX; - static readonly BASE64 = Worker_Binding_CryptoKey_Which.BASE64; - static readonly PKCS8 = Worker_Binding_CryptoKey_Which.PKCS8; - static readonly SPKI = Worker_Binding_CryptoKey_Which.SPKI; - static readonly JWK = Worker_Binding_CryptoKey_Which.JWK; - static readonly Usage: typeof Worker_Binding_CryptoKey_Usage; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultExtractable: DataView; - }; - adoptRaw(value: capnp.Orphan): void; - disownRaw(): capnp.Orphan; - getRaw(): capnp.Data; - hasRaw(): boolean; - initRaw(length: number): capnp.Data; - isRaw(): boolean; - setRaw(value: capnp.Data): void; - getHex(): string; - isHex(): boolean; - setHex(value: string): void; - getBase64(): string; - isBase64(): boolean; - setBase64(value: string): void; - getPkcs8(): string; - isPkcs8(): boolean; - setPkcs8(value: string): void; - getSpki(): string; - isSpki(): boolean; - setSpki(value: string): void; - getJwk(): string; - isJwk(): boolean; - setJwk(value: string): void; - getAlgorithm(): Worker_Binding_CryptoKey_Algorithm; - initAlgorithm(): Worker_Binding_CryptoKey_Algorithm; - getExtractable(): boolean; - setExtractable(value: boolean): void; - adoptUsages(value: capnp.Orphan>): void; - disownUsages(): capnp.Orphan>; - getUsages(): capnp.List; - hasUsages(): boolean; - initUsages(length: number): capnp.List; - setUsages(value: capnp.List): void; - toString(): string; - which(): Worker_Binding_CryptoKey_Which; -} -export declare class Worker_Binding_MemoryCacheLimits extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getMaxKeys(): number; - setMaxKeys(value: number): void; - getMaxValueSize(): number; - setMaxValueSize(value: number): void; - getMaxTotalValueSize(): capnp.Uint64; - setMaxTotalValueSize(value: capnp.Uint64): void; - toString(): string; -} -export declare class Worker_Binding_WrappedBinding extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultEntrypoint: string; - }; - static _InnerBindings: capnp.ListCtor; - getModuleName(): string; - setModuleName(value: string): void; - getEntrypoint(): string; - setEntrypoint(value: string): void; - adoptInnerBindings(value: capnp.Orphan>): void; - disownInnerBindings(): capnp.Orphan>; - getInnerBindings(): capnp.List; - hasInnerBindings(): boolean; - initInnerBindings(length: number): capnp.List; - setInnerBindings(value: capnp.List): void; - toString(): string; -} -export declare class Worker_Binding_Parameter extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptType(value: capnp.Orphan): void; - disownType(): capnp.Orphan; - getType(): Worker_Binding_Type; - hasType(): boolean; - initType(): Worker_Binding_Type; - setType(value: Worker_Binding_Type): void; - getOptional(): boolean; - setOptional(value: boolean): void; - toString(): string; -} -export declare class Worker_Binding_Hyperdrive extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptDesignator(value: capnp.Orphan): void; - disownDesignator(): capnp.Orphan; - getDesignator(): ServiceDesignator; - hasDesignator(): boolean; - initDesignator(): ServiceDesignator; - setDesignator(value: ServiceDesignator): void; - getDatabase(): string; - setDatabase(value: string): void; - getUser(): string; - setUser(value: string): void; - getPassword(): string; - setPassword(value: string): void; - getScheme(): string; - setScheme(value: string): void; - toString(): string; -} -export declare class Worker_Binding_MemoryCache extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getId(): string; - setId(value: string): void; - adoptLimits(value: capnp.Orphan): void; - disownLimits(): capnp.Orphan; - getLimits(): Worker_Binding_MemoryCacheLimits; - hasLimits(): boolean; - initLimits(): Worker_Binding_MemoryCacheLimits; - setLimits(value: Worker_Binding_MemoryCacheLimits): void; - toString(): string; -} -export declare enum Worker_Binding_Which { - UNSPECIFIED = 0, - PARAMETER = 1, - TEXT = 2, - DATA = 3, - JSON = 4, - WASM_MODULE = 5, - CRYPTO_KEY = 6, - SERVICE = 7, - DURABLE_OBJECT_NAMESPACE = 8, - KV_NAMESPACE = 9, - R2BUCKET = 10, - R2ADMIN = 11, - WRAPPED = 12, - QUEUE = 13, - FROM_ENVIRONMENT = 14, - ANALYTICS_ENGINE = 15, - HYPERDRIVE = 16, - UNSAFE_EVAL = 17, - MEMORY_CACHE = 18 -} -export declare class Worker_Binding extends __S { - static readonly UNSPECIFIED = Worker_Binding_Which.UNSPECIFIED; - static readonly PARAMETER = Worker_Binding_Which.PARAMETER; - static readonly TEXT = Worker_Binding_Which.TEXT; - static readonly DATA = Worker_Binding_Which.DATA; - static readonly JSON = Worker_Binding_Which.JSON; - static readonly WASM_MODULE = Worker_Binding_Which.WASM_MODULE; - static readonly CRYPTO_KEY = Worker_Binding_Which.CRYPTO_KEY; - static readonly SERVICE = Worker_Binding_Which.SERVICE; - static readonly DURABLE_OBJECT_NAMESPACE = Worker_Binding_Which.DURABLE_OBJECT_NAMESPACE; - static readonly KV_NAMESPACE = Worker_Binding_Which.KV_NAMESPACE; - static readonly R2BUCKET = Worker_Binding_Which.R2BUCKET; - static readonly R2ADMIN = Worker_Binding_Which.R2ADMIN; - static readonly WRAPPED = Worker_Binding_Which.WRAPPED; - static readonly QUEUE = Worker_Binding_Which.QUEUE; - static readonly FROM_ENVIRONMENT = Worker_Binding_Which.FROM_ENVIRONMENT; - static readonly ANALYTICS_ENGINE = Worker_Binding_Which.ANALYTICS_ENGINE; - static readonly HYPERDRIVE = Worker_Binding_Which.HYPERDRIVE; - static readonly UNSAFE_EVAL = Worker_Binding_Which.UNSAFE_EVAL; - static readonly MEMORY_CACHE = Worker_Binding_Which.MEMORY_CACHE; - static readonly Type: typeof Worker_Binding_Type; - static readonly DurableObjectNamespaceDesignator: typeof Worker_Binding_DurableObjectNamespaceDesignator; - static readonly CryptoKey: typeof Worker_Binding_CryptoKey; - static readonly MemoryCacheLimits: typeof Worker_Binding_MemoryCacheLimits; - static readonly WrappedBinding: typeof Worker_Binding_WrappedBinding; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - isUnspecified(): boolean; - setUnspecified(): void; - getParameter(): Worker_Binding_Parameter; - initParameter(): Worker_Binding_Parameter; - isParameter(): boolean; - setParameter(): void; - getText(): string; - isText(): boolean; - setText(value: string): void; - adoptData(value: capnp.Orphan): void; - disownData(): capnp.Orphan; - getData(): capnp.Data; - hasData(): boolean; - initData(length: number): capnp.Data; - isData(): boolean; - setData(value: capnp.Data): void; - getJson(): string; - isJson(): boolean; - setJson(value: string): void; - adoptWasmModule(value: capnp.Orphan): void; - disownWasmModule(): capnp.Orphan; - getWasmModule(): capnp.Data; - hasWasmModule(): boolean; - initWasmModule(length: number): capnp.Data; - isWasmModule(): boolean; - setWasmModule(value: capnp.Data): void; - adoptCryptoKey(value: capnp.Orphan): void; - disownCryptoKey(): capnp.Orphan; - getCryptoKey(): Worker_Binding_CryptoKey; - hasCryptoKey(): boolean; - initCryptoKey(): Worker_Binding_CryptoKey; - isCryptoKey(): boolean; - setCryptoKey(value: Worker_Binding_CryptoKey): void; - adoptService(value: capnp.Orphan): void; - disownService(): capnp.Orphan; - getService(): ServiceDesignator; - hasService(): boolean; - initService(): ServiceDesignator; - isService(): boolean; - setService(value: ServiceDesignator): void; - adoptDurableObjectNamespace(value: capnp.Orphan): void; - disownDurableObjectNamespace(): capnp.Orphan; - getDurableObjectNamespace(): Worker_Binding_DurableObjectNamespaceDesignator; - hasDurableObjectNamespace(): boolean; - initDurableObjectNamespace(): Worker_Binding_DurableObjectNamespaceDesignator; - isDurableObjectNamespace(): boolean; - setDurableObjectNamespace(value: Worker_Binding_DurableObjectNamespaceDesignator): void; - adoptKvNamespace(value: capnp.Orphan): void; - disownKvNamespace(): capnp.Orphan; - getKvNamespace(): ServiceDesignator; - hasKvNamespace(): boolean; - initKvNamespace(): ServiceDesignator; - isKvNamespace(): boolean; - setKvNamespace(value: ServiceDesignator): void; - adoptR2Bucket(value: capnp.Orphan): void; - disownR2Bucket(): capnp.Orphan; - getR2Bucket(): ServiceDesignator; - hasR2Bucket(): boolean; - initR2Bucket(): ServiceDesignator; - isR2Bucket(): boolean; - setR2Bucket(value: ServiceDesignator): void; - adoptR2Admin(value: capnp.Orphan): void; - disownR2Admin(): capnp.Orphan; - getR2Admin(): ServiceDesignator; - hasR2Admin(): boolean; - initR2Admin(): ServiceDesignator; - isR2Admin(): boolean; - setR2Admin(value: ServiceDesignator): void; - adoptWrapped(value: capnp.Orphan): void; - disownWrapped(): capnp.Orphan; - getWrapped(): Worker_Binding_WrappedBinding; - hasWrapped(): boolean; - initWrapped(): Worker_Binding_WrappedBinding; - isWrapped(): boolean; - setWrapped(value: Worker_Binding_WrappedBinding): void; - adoptQueue(value: capnp.Orphan): void; - disownQueue(): capnp.Orphan; - getQueue(): ServiceDesignator; - hasQueue(): boolean; - initQueue(): ServiceDesignator; - isQueue(): boolean; - setQueue(value: ServiceDesignator): void; - getFromEnvironment(): string; - isFromEnvironment(): boolean; - setFromEnvironment(value: string): void; - adoptAnalyticsEngine(value: capnp.Orphan): void; - disownAnalyticsEngine(): capnp.Orphan; - getAnalyticsEngine(): ServiceDesignator; - hasAnalyticsEngine(): boolean; - initAnalyticsEngine(): ServiceDesignator; - isAnalyticsEngine(): boolean; - setAnalyticsEngine(value: ServiceDesignator): void; - getHyperdrive(): Worker_Binding_Hyperdrive; - initHyperdrive(): Worker_Binding_Hyperdrive; - isHyperdrive(): boolean; - setHyperdrive(): void; - isUnsafeEval(): boolean; - setUnsafeEval(): void; - getMemoryCache(): Worker_Binding_MemoryCache; - initMemoryCache(): Worker_Binding_MemoryCache; - isMemoryCache(): boolean; - setMemoryCache(): void; - toString(): string; - which(): Worker_Binding_Which; -} -export declare enum Worker_DurableObjectNamespace_Which { - UNIQUE_KEY = 0, - EPHEMERAL_LOCAL = 1 -} -export declare class Worker_DurableObjectNamespace extends __S { - static readonly UNIQUE_KEY = Worker_DurableObjectNamespace_Which.UNIQUE_KEY; - static readonly EPHEMERAL_LOCAL = Worker_DurableObjectNamespace_Which.EPHEMERAL_LOCAL; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getClassName(): string; - setClassName(value: string): void; - getUniqueKey(): string; - isUniqueKey(): boolean; - setUniqueKey(value: string): void; - isEphemeralLocal(): boolean; - setEphemeralLocal(): void; - getPreventEviction(): boolean; - setPreventEviction(value: boolean): void; - getEnableSql(): boolean; - setEnableSql(value: boolean): void; - toString(): string; - which(): Worker_DurableObjectNamespace_Which; -} -export declare enum Worker_DurableObjectStorage_Which { - NONE = 0, - IN_MEMORY = 1, - LOCAL_DISK = 2 -} -export declare class Worker_DurableObjectStorage extends __S { - static readonly NONE = Worker_DurableObjectStorage_Which.NONE; - static readonly IN_MEMORY = Worker_DurableObjectStorage_Which.IN_MEMORY; - static readonly LOCAL_DISK = Worker_DurableObjectStorage_Which.LOCAL_DISK; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - isNone(): boolean; - setNone(): void; - isInMemory(): boolean; - setInMemory(): void; - getLocalDisk(): string; - isLocalDisk(): boolean; - setLocalDisk(value: string): void; - toString(): string; - which(): Worker_DurableObjectStorage_Which; -} -export declare enum Worker_Which { - MODULES = 0, - SERVICE_WORKER_SCRIPT = 1, - INHERIT = 2 -} -export declare class Worker extends __S { - static readonly MODULES = Worker_Which.MODULES; - static readonly SERVICE_WORKER_SCRIPT = Worker_Which.SERVICE_WORKER_SCRIPT; - static readonly INHERIT = Worker_Which.INHERIT; - static readonly Module: typeof Worker_Module; - static readonly Binding: typeof Worker_Binding; - static readonly DurableObjectNamespace: typeof Worker_DurableObjectNamespace; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultGlobalOutbound: capnp.Pointer; - }; - static _Modules: capnp.ListCtor; - static _Bindings: capnp.ListCtor; - static _DurableObjectNamespaces: capnp.ListCtor; - adoptModules(value: capnp.Orphan>): void; - disownModules(): capnp.Orphan>; - getModules(): capnp.List; - hasModules(): boolean; - initModules(length: number): capnp.List; - isModules(): boolean; - setModules(value: capnp.List): void; - getServiceWorkerScript(): string; - isServiceWorkerScript(): boolean; - setServiceWorkerScript(value: string): void; - getInherit(): string; - isInherit(): boolean; - setInherit(value: string): void; - getCompatibilityDate(): string; - setCompatibilityDate(value: string): void; - adoptCompatibilityFlags(value: capnp.Orphan>): void; - disownCompatibilityFlags(): capnp.Orphan>; - getCompatibilityFlags(): capnp.List; - hasCompatibilityFlags(): boolean; - initCompatibilityFlags(length: number): capnp.List; - setCompatibilityFlags(value: capnp.List): void; - adoptBindings(value: capnp.Orphan>): void; - disownBindings(): capnp.Orphan>; - getBindings(): capnp.List; - hasBindings(): boolean; - initBindings(length: number): capnp.List; - setBindings(value: capnp.List): void; - adoptGlobalOutbound(value: capnp.Orphan): void; - disownGlobalOutbound(): capnp.Orphan; - getGlobalOutbound(): ServiceDesignator; - hasGlobalOutbound(): boolean; - initGlobalOutbound(): ServiceDesignator; - setGlobalOutbound(value: ServiceDesignator): void; - adoptCacheApiOutbound(value: capnp.Orphan): void; - disownCacheApiOutbound(): capnp.Orphan; - getCacheApiOutbound(): ServiceDesignator; - hasCacheApiOutbound(): boolean; - initCacheApiOutbound(): ServiceDesignator; - setCacheApiOutbound(value: ServiceDesignator): void; - adoptDurableObjectNamespaces(value: capnp.Orphan>): void; - disownDurableObjectNamespaces(): capnp.Orphan>; - getDurableObjectNamespaces(): capnp.List; - hasDurableObjectNamespaces(): boolean; - initDurableObjectNamespaces(length: number): capnp.List; - setDurableObjectNamespaces(value: capnp.List): void; - getDurableObjectUniqueKeyModifier(): string; - setDurableObjectUniqueKeyModifier(value: string): void; - getDurableObjectStorage(): Worker_DurableObjectStorage; - initDurableObjectStorage(): Worker_DurableObjectStorage; - getModuleFallback(): string; - setModuleFallback(value: string): void; - toString(): string; - which(): Worker_Which; -} -export declare class ExternalServer_Https extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptOptions(value: capnp.Orphan): void; - disownOptions(): capnp.Orphan; - getOptions(): HttpOptions; - hasOptions(): boolean; - initOptions(): HttpOptions; - setOptions(value: HttpOptions): void; - adoptTlsOptions(value: capnp.Orphan): void; - disownTlsOptions(): capnp.Orphan; - getTlsOptions(): TlsOptions; - hasTlsOptions(): boolean; - initTlsOptions(): TlsOptions; - setTlsOptions(value: TlsOptions): void; - getCertificateHost(): string; - setCertificateHost(value: string): void; - toString(): string; -} -export declare class ExternalServer_Tcp extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptTlsOptions(value: capnp.Orphan): void; - disownTlsOptions(): capnp.Orphan; - getTlsOptions(): TlsOptions; - hasTlsOptions(): boolean; - initTlsOptions(): TlsOptions; - setTlsOptions(value: TlsOptions): void; - getCertificateHost(): string; - setCertificateHost(value: string): void; - toString(): string; -} -export declare enum ExternalServer_Which { - HTTP = 0, - HTTPS = 1, - TCP = 2 -} -export declare class ExternalServer extends __S { - static readonly HTTP = ExternalServer_Which.HTTP; - static readonly HTTPS = ExternalServer_Which.HTTPS; - static readonly TCP = ExternalServer_Which.TCP; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getAddress(): string; - setAddress(value: string): void; - adoptHttp(value: capnp.Orphan): void; - disownHttp(): capnp.Orphan; - getHttp(): HttpOptions; - hasHttp(): boolean; - initHttp(): HttpOptions; - isHttp(): boolean; - setHttp(value: HttpOptions): void; - getHttps(): ExternalServer_Https; - initHttps(): ExternalServer_Https; - isHttps(): boolean; - setHttps(): void; - getTcp(): ExternalServer_Tcp; - initTcp(): ExternalServer_Tcp; - isTcp(): boolean; - setTcp(): void; - toString(): string; - which(): ExternalServer_Which; -} -export declare class Network extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultAllow: capnp.Pointer; - }; - adoptAllow(value: capnp.Orphan>): void; - disownAllow(): capnp.Orphan>; - getAllow(): capnp.List; - hasAllow(): boolean; - initAllow(length: number): capnp.List; - setAllow(value: capnp.List): void; - adoptDeny(value: capnp.Orphan>): void; - disownDeny(): capnp.Orphan>; - getDeny(): capnp.List; - hasDeny(): boolean; - initDeny(length: number): capnp.List; - setDeny(value: capnp.List): void; - adoptTlsOptions(value: capnp.Orphan): void; - disownTlsOptions(): capnp.Orphan; - getTlsOptions(): TlsOptions; - hasTlsOptions(): boolean; - initTlsOptions(): TlsOptions; - setTlsOptions(value: TlsOptions): void; - toString(): string; -} -export declare class DiskDirectory extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultWritable: DataView; - defaultAllowDotfiles: DataView; - }; - getPath(): string; - setPath(value: string): void; - getWritable(): boolean; - setWritable(value: boolean): void; - getAllowDotfiles(): boolean; - setAllowDotfiles(value: boolean): void; - toString(): string; -} -export declare enum HttpOptions_Style { - HOST = 0, - PROXY = 1 -} -export declare class HttpOptions_Header extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - getValue(): string; - setValue(value: string): void; - toString(): string; -} -export declare class HttpOptions extends __S { - static readonly Style: typeof HttpOptions_Style; - static readonly Header: typeof HttpOptions_Header; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultStyle: DataView; - }; - static _InjectRequestHeaders: capnp.ListCtor; - static _InjectResponseHeaders: capnp.ListCtor; - getStyle(): HttpOptions_Style; - setStyle(value: HttpOptions_Style): void; - getForwardedProtoHeader(): string; - setForwardedProtoHeader(value: string): void; - getCfBlobHeader(): string; - setCfBlobHeader(value: string): void; - adoptInjectRequestHeaders(value: capnp.Orphan>): void; - disownInjectRequestHeaders(): capnp.Orphan>; - getInjectRequestHeaders(): capnp.List; - hasInjectRequestHeaders(): boolean; - initInjectRequestHeaders(length: number): capnp.List; - setInjectRequestHeaders(value: capnp.List): void; - adoptInjectResponseHeaders(value: capnp.Orphan>): void; - disownInjectResponseHeaders(): capnp.Orphan>; - getInjectResponseHeaders(): capnp.List; - hasInjectResponseHeaders(): boolean; - initInjectResponseHeaders(length: number): capnp.List; - setInjectResponseHeaders(value: capnp.List): void; - getCapnpConnectHost(): string; - setCapnpConnectHost(value: string): void; - toString(): string; -} -export declare class TlsOptions_Keypair extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getPrivateKey(): string; - setPrivateKey(value: string): void; - getCertificateChain(): string; - setCertificateChain(value: string): void; - toString(): string; -} -export declare enum TlsOptions_Version { - GOOD_DEFAULT = 0, - SSL3 = 1, - TLS1DOT0 = 2, - TLS1DOT1 = 3, - TLS1DOT2 = 4, - TLS1DOT3 = 5 -} -export declare class TlsOptions extends __S { - static readonly Keypair: typeof TlsOptions_Keypair; - static readonly Version: typeof TlsOptions_Version; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultRequireClientCerts: DataView; - defaultTrustBrowserCas: DataView; - defaultMinVersion: DataView; - }; - adoptKeypair(value: capnp.Orphan): void; - disownKeypair(): capnp.Orphan; - getKeypair(): TlsOptions_Keypair; - hasKeypair(): boolean; - initKeypair(): TlsOptions_Keypair; - setKeypair(value: TlsOptions_Keypair): void; - getRequireClientCerts(): boolean; - setRequireClientCerts(value: boolean): void; - getTrustBrowserCas(): boolean; - setTrustBrowserCas(value: boolean): void; - adoptTrustedCertificates(value: capnp.Orphan>): void; - disownTrustedCertificates(): capnp.Orphan>; - getTrustedCertificates(): capnp.List; - hasTrustedCertificates(): boolean; - initTrustedCertificates(length: number): capnp.List; - setTrustedCertificates(value: capnp.List): void; - getMinVersion(): TlsOptions_Version; - setMinVersion(value: TlsOptions_Version): void; - getCipherList(): string; - setCipherList(value: string): void; - toString(): string; -} -export declare class Extension_Module extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - defaultInternal: DataView; - }; - getName(): string; - setName(value: string): void; - getInternal(): boolean; - setInternal(value: boolean): void; - getEsModule(): string; - setEsModule(value: string): void; - toString(): string; -} -export declare class Extension extends __S { - static readonly Module: typeof Extension_Module; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Modules: capnp.ListCtor; - adoptModules(value: capnp.Orphan>): void; - disownModules(): capnp.Orphan>; - getModules(): capnp.List; - hasModules(): boolean; - initModules(length: number): capnp.List; - setModules(value: capnp.List): void; - toString(): string; -} diff --git a/packages/miniflare/src/runtime/config/workerd.capnp.js b/packages/miniflare/src/runtime/config/workerd.capnp.js deleted file mode 100644 index 0c8d94c5a792..000000000000 --- a/packages/miniflare/src/runtime/config/workerd.capnp.js +++ /dev/null @@ -1,1374 +0,0 @@ -"use strict"; -/* tslint:disable */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Extension = exports.Extension_Module = exports.TlsOptions = exports.TlsOptions_Version = exports.TlsOptions_Keypair = exports.HttpOptions = exports.HttpOptions_Header = exports.HttpOptions_Style = exports.DiskDirectory = exports.Network = exports.ExternalServer = exports.ExternalServer_Which = exports.ExternalServer_Tcp = exports.ExternalServer_Https = exports.Worker = exports.Worker_Which = exports.Worker_DurableObjectStorage = exports.Worker_DurableObjectStorage_Which = exports.Worker_DurableObjectNamespace = exports.Worker_DurableObjectNamespace_Which = exports.Worker_Binding = exports.Worker_Binding_Which = exports.Worker_Binding_MemoryCache = exports.Worker_Binding_Hyperdrive = exports.Worker_Binding_Parameter = exports.Worker_Binding_WrappedBinding = exports.Worker_Binding_MemoryCacheLimits = exports.Worker_Binding_CryptoKey = exports.Worker_Binding_CryptoKey_Which = exports.Worker_Binding_CryptoKey_Algorithm = exports.Worker_Binding_CryptoKey_Algorithm_Which = exports.Worker_Binding_CryptoKey_Usage = exports.Worker_Binding_DurableObjectNamespaceDesignator = exports.Worker_Binding_Type = exports.Worker_Binding_Type_Which = exports.Worker_Module = exports.Worker_Module_Which = exports.ServiceDesignator = exports.Service = exports.Service_Which = exports.Socket = exports.Socket_Which = exports.Socket_Https = exports.Config = exports._capnpFileId = void 0; -/** - * This file has been automatically generated by the [capnpc-ts utility](https://github.com/jdiaz5513/capnp-ts). - */ -const capnp = require("capnp-ts"); -const capnp_ts_1 = require("capnp-ts"); -exports._capnpFileId = "e6afd26682091c01"; -class Config extends capnp_ts_1.Struct { - adoptServices(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownServices() { return capnp_ts_1.Struct.disown(this.getServices()); } - getServices() { return capnp_ts_1.Struct.getList(0, Config._Services, this); } - hasServices() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initServices(length) { return capnp_ts_1.Struct.initList(0, Config._Services, length, this); } - setServices(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - adoptSockets(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownSockets() { return capnp_ts_1.Struct.disown(this.getSockets()); } - getSockets() { return capnp_ts_1.Struct.getList(1, Config._Sockets, this); } - hasSockets() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initSockets(length) { return capnp_ts_1.Struct.initList(1, Config._Sockets, length, this); } - setSockets(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - adoptV8Flags(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownV8Flags() { return capnp_ts_1.Struct.disown(this.getV8Flags()); } - getV8Flags() { return capnp_ts_1.Struct.getList(2, capnp.TextList, this); } - hasV8Flags() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initV8Flags(length) { return capnp_ts_1.Struct.initList(2, capnp.TextList, length, this); } - setV8Flags(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - adoptExtensions(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(3, this)); } - disownExtensions() { return capnp_ts_1.Struct.disown(this.getExtensions()); } - getExtensions() { return capnp_ts_1.Struct.getList(3, Config._Extensions, this); } - hasExtensions() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(3, this)); } - initExtensions(length) { return capnp_ts_1.Struct.initList(3, Config._Extensions, length, this); } - setExtensions(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(3, this)); } - adoptAutogates(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(4, this)); } - disownAutogates() { return capnp_ts_1.Struct.disown(this.getAutogates()); } - getAutogates() { return capnp_ts_1.Struct.getList(4, capnp.TextList, this); } - hasAutogates() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(4, this)); } - initAutogates(length) { return capnp_ts_1.Struct.initList(4, capnp.TextList, length, this); } - setAutogates(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(4, this)); } - toString() { return "Config_" + super.toString(); } -} -exports.Config = Config; -Config._capnp = { displayName: "Config", id: "8794486c76aaa7d6", size: new capnp_ts_1.ObjectSize(0, 5) }; -class Socket_Https extends capnp_ts_1.Struct { - adoptOptions(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownOptions() { return capnp_ts_1.Struct.disown(this.getOptions()); } - getOptions() { return capnp_ts_1.Struct.getStruct(2, HttpOptions, this); } - hasOptions() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initOptions() { return capnp_ts_1.Struct.initStructAt(2, HttpOptions, this); } - setOptions(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - adoptTlsOptions(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(3, this)); } - disownTlsOptions() { return capnp_ts_1.Struct.disown(this.getTlsOptions()); } - getTlsOptions() { return capnp_ts_1.Struct.getStruct(3, TlsOptions, this); } - hasTlsOptions() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(3, this)); } - initTlsOptions() { return capnp_ts_1.Struct.initStructAt(3, TlsOptions, this); } - setTlsOptions(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(3, this)); } - toString() { return "Socket_Https_" + super.toString(); } -} -exports.Socket_Https = Socket_Https; -Socket_Https._capnp = { displayName: "https", id: "de123876383cbbdc", size: new capnp_ts_1.ObjectSize(8, 5) }; -var Socket_Which; -(function (Socket_Which) { - Socket_Which[Socket_Which["HTTP"] = 0] = "HTTP"; - Socket_Which[Socket_Which["HTTPS"] = 1] = "HTTPS"; -})(Socket_Which = exports.Socket_Which || (exports.Socket_Which = {})); -class Socket extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getAddress() { return capnp_ts_1.Struct.getText(1, this); } - setAddress(value) { capnp_ts_1.Struct.setText(1, value, this); } - adoptHttp(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); - } - disownHttp() { return capnp_ts_1.Struct.disown(this.getHttp()); } - getHttp() { - capnp_ts_1.Struct.testWhich("http", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getStruct(2, HttpOptions, this); - } - hasHttp() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initHttp() { - capnp_ts_1.Struct.setUint16(0, 0, this); - return capnp_ts_1.Struct.initStructAt(2, HttpOptions, this); - } - isHttp() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setHttp(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); - } - getHttps() { - capnp_ts_1.Struct.testWhich("https", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getAs(Socket_Https, this); - } - initHttps() { - capnp_ts_1.Struct.setUint16(0, 1, this); - return capnp_ts_1.Struct.getAs(Socket_Https, this); - } - isHttps() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setHttps() { capnp_ts_1.Struct.setUint16(0, 1, this); } - adoptService(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(4, this)); } - disownService() { return capnp_ts_1.Struct.disown(this.getService()); } - getService() { return capnp_ts_1.Struct.getStruct(4, ServiceDesignator, this); } - hasService() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(4, this)); } - initService() { return capnp_ts_1.Struct.initStructAt(4, ServiceDesignator, this); } - setService(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(4, this)); } - toString() { return "Socket_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Socket = Socket; -Socket.HTTP = Socket_Which.HTTP; -Socket.HTTPS = Socket_Which.HTTPS; -Socket._capnp = { displayName: "Socket", id: "9a0eba45530ee79f", size: new capnp_ts_1.ObjectSize(8, 5) }; -var Service_Which; -(function (Service_Which) { - Service_Which[Service_Which["UNSPECIFIED"] = 0] = "UNSPECIFIED"; - Service_Which[Service_Which["WORKER"] = 1] = "WORKER"; - Service_Which[Service_Which["NETWORK"] = 2] = "NETWORK"; - Service_Which[Service_Which["EXTERNAL"] = 3] = "EXTERNAL"; - Service_Which[Service_Which["DISK"] = 4] = "DISK"; -})(Service_Which = exports.Service_Which || (exports.Service_Which = {})); -class Service extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - isUnspecified() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setUnspecified() { capnp_ts_1.Struct.setUint16(0, 0, this); } - adoptWorker(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownWorker() { return capnp_ts_1.Struct.disown(this.getWorker()); } - getWorker() { - capnp_ts_1.Struct.testWhich("worker", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getStruct(1, Worker, this); - } - hasWorker() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initWorker() { - capnp_ts_1.Struct.setUint16(0, 1, this); - return capnp_ts_1.Struct.initStructAt(1, Worker, this); - } - isWorker() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setWorker(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptNetwork(value) { - capnp_ts_1.Struct.setUint16(0, 2, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownNetwork() { return capnp_ts_1.Struct.disown(this.getNetwork()); } - getNetwork() { - capnp_ts_1.Struct.testWhich("network", capnp_ts_1.Struct.getUint16(0, this), 2, this); - return capnp_ts_1.Struct.getStruct(1, Network, this); - } - hasNetwork() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initNetwork() { - capnp_ts_1.Struct.setUint16(0, 2, this); - return capnp_ts_1.Struct.initStructAt(1, Network, this); - } - isNetwork() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setNetwork(value) { - capnp_ts_1.Struct.setUint16(0, 2, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptExternal(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownExternal() { return capnp_ts_1.Struct.disown(this.getExternal()); } - getExternal() { - capnp_ts_1.Struct.testWhich("external", capnp_ts_1.Struct.getUint16(0, this), 3, this); - return capnp_ts_1.Struct.getStruct(1, ExternalServer, this); - } - hasExternal() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initExternal() { - capnp_ts_1.Struct.setUint16(0, 3, this); - return capnp_ts_1.Struct.initStructAt(1, ExternalServer, this); - } - isExternal() { return capnp_ts_1.Struct.getUint16(0, this) === 3; } - setExternal(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptDisk(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownDisk() { return capnp_ts_1.Struct.disown(this.getDisk()); } - getDisk() { - capnp_ts_1.Struct.testWhich("disk", capnp_ts_1.Struct.getUint16(0, this), 4, this); - return capnp_ts_1.Struct.getStruct(1, DiskDirectory, this); - } - hasDisk() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initDisk() { - capnp_ts_1.Struct.setUint16(0, 4, this); - return capnp_ts_1.Struct.initStructAt(1, DiskDirectory, this); - } - isDisk() { return capnp_ts_1.Struct.getUint16(0, this) === 4; } - setDisk(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - toString() { return "Service_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Service = Service; -Service.UNSPECIFIED = Service_Which.UNSPECIFIED; -Service.WORKER = Service_Which.WORKER; -Service.NETWORK = Service_Which.NETWORK; -Service.EXTERNAL = Service_Which.EXTERNAL; -Service.DISK = Service_Which.DISK; -Service._capnp = { displayName: "Service", id: "e5c88e8bb7bcb6b9", size: new capnp_ts_1.ObjectSize(8, 2) }; -class ServiceDesignator extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getEntrypoint() { return capnp_ts_1.Struct.getText(1, this); } - setEntrypoint(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "ServiceDesignator_" + super.toString(); } -} -exports.ServiceDesignator = ServiceDesignator; -ServiceDesignator._capnp = { displayName: "ServiceDesignator", id: "ae8ec91cee724450", size: new capnp_ts_1.ObjectSize(0, 2) }; -var Worker_Module_Which; -(function (Worker_Module_Which) { - Worker_Module_Which[Worker_Module_Which["ES_MODULE"] = 0] = "ES_MODULE"; - Worker_Module_Which[Worker_Module_Which["COMMON_JS_MODULE"] = 1] = "COMMON_JS_MODULE"; - Worker_Module_Which[Worker_Module_Which["TEXT"] = 2] = "TEXT"; - Worker_Module_Which[Worker_Module_Which["DATA"] = 3] = "DATA"; - Worker_Module_Which[Worker_Module_Which["WASM"] = 4] = "WASM"; - Worker_Module_Which[Worker_Module_Which["JSON"] = 5] = "JSON"; - Worker_Module_Which[Worker_Module_Which["NODE_JS_COMPAT_MODULE"] = 6] = "NODE_JS_COMPAT_MODULE"; - Worker_Module_Which[Worker_Module_Which["PYTHON_MODULE"] = 7] = "PYTHON_MODULE"; - Worker_Module_Which[Worker_Module_Which["PYTHON_REQUIREMENT"] = 8] = "PYTHON_REQUIREMENT"; -})(Worker_Module_Which = exports.Worker_Module_Which || (exports.Worker_Module_Which = {})); -class Worker_Module extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getEsModule() { - capnp_ts_1.Struct.testWhich("esModule", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getText(1, this); - } - isEsModule() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setEsModule(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.setText(1, value, this); - } - getCommonJsModule() { - capnp_ts_1.Struct.testWhich("commonJsModule", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getText(1, this); - } - isCommonJsModule() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setCommonJsModule(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.setText(1, value, this); - } - getText() { - capnp_ts_1.Struct.testWhich("text", capnp_ts_1.Struct.getUint16(0, this), 2, this); - return capnp_ts_1.Struct.getText(1, this); - } - isText() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setText(value) { - capnp_ts_1.Struct.setUint16(0, 2, this); - capnp_ts_1.Struct.setText(1, value, this); - } - adoptData(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownData() { return capnp_ts_1.Struct.disown(this.getData()); } - getData() { - capnp_ts_1.Struct.testWhich("data", capnp_ts_1.Struct.getUint16(0, this), 3, this); - return capnp_ts_1.Struct.getData(1, this); - } - hasData() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initData(length) { - capnp_ts_1.Struct.setUint16(0, 3, this); - return capnp_ts_1.Struct.initData(1, length, this); - } - isData() { return capnp_ts_1.Struct.getUint16(0, this) === 3; } - setData(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptWasm(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownWasm() { return capnp_ts_1.Struct.disown(this.getWasm()); } - getWasm() { - capnp_ts_1.Struct.testWhich("wasm", capnp_ts_1.Struct.getUint16(0, this), 4, this); - return capnp_ts_1.Struct.getData(1, this); - } - hasWasm() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initWasm(length) { - capnp_ts_1.Struct.setUint16(0, 4, this); - return capnp_ts_1.Struct.initData(1, length, this); - } - isWasm() { return capnp_ts_1.Struct.getUint16(0, this) === 4; } - setWasm(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - getJson() { - capnp_ts_1.Struct.testWhich("json", capnp_ts_1.Struct.getUint16(0, this), 5, this); - return capnp_ts_1.Struct.getText(1, this); - } - isJson() { return capnp_ts_1.Struct.getUint16(0, this) === 5; } - setJson(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.setText(1, value, this); - } - getNodeJsCompatModule() { - capnp_ts_1.Struct.testWhich("nodeJsCompatModule", capnp_ts_1.Struct.getUint16(0, this), 6, this); - return capnp_ts_1.Struct.getText(1, this); - } - isNodeJsCompatModule() { return capnp_ts_1.Struct.getUint16(0, this) === 6; } - setNodeJsCompatModule(value) { - capnp_ts_1.Struct.setUint16(0, 6, this); - capnp_ts_1.Struct.setText(1, value, this); - } - getPythonModule() { - capnp_ts_1.Struct.testWhich("pythonModule", capnp_ts_1.Struct.getUint16(0, this), 7, this); - return capnp_ts_1.Struct.getText(1, this); - } - isPythonModule() { return capnp_ts_1.Struct.getUint16(0, this) === 7; } - setPythonModule(value) { - capnp_ts_1.Struct.setUint16(0, 7, this); - capnp_ts_1.Struct.setText(1, value, this); - } - getPythonRequirement() { - capnp_ts_1.Struct.testWhich("pythonRequirement", capnp_ts_1.Struct.getUint16(0, this), 8, this); - return capnp_ts_1.Struct.getText(1, this); - } - isPythonRequirement() { return capnp_ts_1.Struct.getUint16(0, this) === 8; } - setPythonRequirement(value) { - capnp_ts_1.Struct.setUint16(0, 8, this); - capnp_ts_1.Struct.setText(1, value, this); - } - adoptNamedExports(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownNamedExports() { return capnp_ts_1.Struct.disown(this.getNamedExports()); } - getNamedExports() { return capnp_ts_1.Struct.getList(2, capnp.TextList, this); } - hasNamedExports() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initNamedExports(length) { return capnp_ts_1.Struct.initList(2, capnp.TextList, length, this); } - setNamedExports(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - toString() { return "Worker_Module_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Worker_Module = Worker_Module; -Worker_Module.ES_MODULE = Worker_Module_Which.ES_MODULE; -Worker_Module.COMMON_JS_MODULE = Worker_Module_Which.COMMON_JS_MODULE; -Worker_Module.TEXT = Worker_Module_Which.TEXT; -Worker_Module.DATA = Worker_Module_Which.DATA; -Worker_Module.WASM = Worker_Module_Which.WASM; -Worker_Module.JSON = Worker_Module_Which.JSON; -Worker_Module.NODE_JS_COMPAT_MODULE = Worker_Module_Which.NODE_JS_COMPAT_MODULE; -Worker_Module.PYTHON_MODULE = Worker_Module_Which.PYTHON_MODULE; -Worker_Module.PYTHON_REQUIREMENT = Worker_Module_Which.PYTHON_REQUIREMENT; -Worker_Module._capnp = { displayName: "Module", id: "d9d87a63770a12f3", size: new capnp_ts_1.ObjectSize(8, 3) }; -var Worker_Binding_Type_Which; -(function (Worker_Binding_Type_Which) { - Worker_Binding_Type_Which[Worker_Binding_Type_Which["UNSPECIFIED"] = 0] = "UNSPECIFIED"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["TEXT"] = 1] = "TEXT"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["DATA"] = 2] = "DATA"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["JSON"] = 3] = "JSON"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["WASM"] = 4] = "WASM"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["CRYPTO_KEY"] = 5] = "CRYPTO_KEY"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["SERVICE"] = 6] = "SERVICE"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["DURABLE_OBJECT_NAMESPACE"] = 7] = "DURABLE_OBJECT_NAMESPACE"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["KV_NAMESPACE"] = 8] = "KV_NAMESPACE"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["R2BUCKET"] = 9] = "R2BUCKET"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["R2ADMIN"] = 10] = "R2ADMIN"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["QUEUE"] = 11] = "QUEUE"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["ANALYTICS_ENGINE"] = 12] = "ANALYTICS_ENGINE"; - Worker_Binding_Type_Which[Worker_Binding_Type_Which["HYPERDRIVE"] = 13] = "HYPERDRIVE"; -})(Worker_Binding_Type_Which = exports.Worker_Binding_Type_Which || (exports.Worker_Binding_Type_Which = {})); -class Worker_Binding_Type extends capnp_ts_1.Struct { - isUnspecified() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setUnspecified() { capnp_ts_1.Struct.setUint16(0, 0, this); } - isText() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setText() { capnp_ts_1.Struct.setUint16(0, 1, this); } - isData() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setData() { capnp_ts_1.Struct.setUint16(0, 2, this); } - isJson() { return capnp_ts_1.Struct.getUint16(0, this) === 3; } - setJson() { capnp_ts_1.Struct.setUint16(0, 3, this); } - isWasm() { return capnp_ts_1.Struct.getUint16(0, this) === 4; } - setWasm() { capnp_ts_1.Struct.setUint16(0, 4, this); } - adoptCryptoKey(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownCryptoKey() { return capnp_ts_1.Struct.disown(this.getCryptoKey()); } - getCryptoKey() { - capnp_ts_1.Struct.testWhich("cryptoKey", capnp_ts_1.Struct.getUint16(0, this), 5, this); - return capnp_ts_1.Struct.getList(0, capnp.Uint16List, this); - } - hasCryptoKey() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initCryptoKey(length) { - capnp_ts_1.Struct.setUint16(0, 5, this); - return capnp_ts_1.Struct.initList(0, capnp.Uint16List, length, this); - } - isCryptoKey() { return capnp_ts_1.Struct.getUint16(0, this) === 5; } - setCryptoKey(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - isService() { return capnp_ts_1.Struct.getUint16(0, this) === 6; } - setService() { capnp_ts_1.Struct.setUint16(0, 6, this); } - isDurableObjectNamespace() { return capnp_ts_1.Struct.getUint16(0, this) === 7; } - setDurableObjectNamespace() { capnp_ts_1.Struct.setUint16(0, 7, this); } - isKvNamespace() { return capnp_ts_1.Struct.getUint16(0, this) === 8; } - setKvNamespace() { capnp_ts_1.Struct.setUint16(0, 8, this); } - isR2Bucket() { return capnp_ts_1.Struct.getUint16(0, this) === 9; } - setR2Bucket() { capnp_ts_1.Struct.setUint16(0, 9, this); } - isR2Admin() { return capnp_ts_1.Struct.getUint16(0, this) === 10; } - setR2Admin() { capnp_ts_1.Struct.setUint16(0, 10, this); } - isQueue() { return capnp_ts_1.Struct.getUint16(0, this) === 11; } - setQueue() { capnp_ts_1.Struct.setUint16(0, 11, this); } - isAnalyticsEngine() { return capnp_ts_1.Struct.getUint16(0, this) === 12; } - setAnalyticsEngine() { capnp_ts_1.Struct.setUint16(0, 12, this); } - isHyperdrive() { return capnp_ts_1.Struct.getUint16(0, this) === 13; } - setHyperdrive() { capnp_ts_1.Struct.setUint16(0, 13, this); } - toString() { return "Worker_Binding_Type_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Worker_Binding_Type = Worker_Binding_Type; -Worker_Binding_Type.UNSPECIFIED = Worker_Binding_Type_Which.UNSPECIFIED; -Worker_Binding_Type.TEXT = Worker_Binding_Type_Which.TEXT; -Worker_Binding_Type.DATA = Worker_Binding_Type_Which.DATA; -Worker_Binding_Type.JSON = Worker_Binding_Type_Which.JSON; -Worker_Binding_Type.WASM = Worker_Binding_Type_Which.WASM; -Worker_Binding_Type.CRYPTO_KEY = Worker_Binding_Type_Which.CRYPTO_KEY; -Worker_Binding_Type.SERVICE = Worker_Binding_Type_Which.SERVICE; -Worker_Binding_Type.DURABLE_OBJECT_NAMESPACE = Worker_Binding_Type_Which.DURABLE_OBJECT_NAMESPACE; -Worker_Binding_Type.KV_NAMESPACE = Worker_Binding_Type_Which.KV_NAMESPACE; -Worker_Binding_Type.R2BUCKET = Worker_Binding_Type_Which.R2BUCKET; -Worker_Binding_Type.R2ADMIN = Worker_Binding_Type_Which.R2ADMIN; -Worker_Binding_Type.QUEUE = Worker_Binding_Type_Which.QUEUE; -Worker_Binding_Type.ANALYTICS_ENGINE = Worker_Binding_Type_Which.ANALYTICS_ENGINE; -Worker_Binding_Type.HYPERDRIVE = Worker_Binding_Type_Which.HYPERDRIVE; -Worker_Binding_Type._capnp = { displayName: "Type", id: "8906a1296519bf8a", size: new capnp_ts_1.ObjectSize(8, 1) }; -class Worker_Binding_DurableObjectNamespaceDesignator extends capnp_ts_1.Struct { - getClassName() { return capnp_ts_1.Struct.getText(0, this); } - setClassName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getServiceName() { return capnp_ts_1.Struct.getText(1, this); } - setServiceName(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "Worker_Binding_DurableObjectNamespaceDesignator_" + super.toString(); } -} -exports.Worker_Binding_DurableObjectNamespaceDesignator = Worker_Binding_DurableObjectNamespaceDesignator; -Worker_Binding_DurableObjectNamespaceDesignator._capnp = { displayName: "DurableObjectNamespaceDesignator", id: "804f144ff477aac7", size: new capnp_ts_1.ObjectSize(0, 2) }; -var Worker_Binding_CryptoKey_Usage; -(function (Worker_Binding_CryptoKey_Usage) { - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["ENCRYPT"] = 0] = "ENCRYPT"; - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["DECRYPT"] = 1] = "DECRYPT"; - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["SIGN"] = 2] = "SIGN"; - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["VERIFY"] = 3] = "VERIFY"; - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["DERIVE_KEY"] = 4] = "DERIVE_KEY"; - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["DERIVE_BITS"] = 5] = "DERIVE_BITS"; - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["WRAP_KEY"] = 6] = "WRAP_KEY"; - Worker_Binding_CryptoKey_Usage[Worker_Binding_CryptoKey_Usage["UNWRAP_KEY"] = 7] = "UNWRAP_KEY"; -})(Worker_Binding_CryptoKey_Usage = exports.Worker_Binding_CryptoKey_Usage || (exports.Worker_Binding_CryptoKey_Usage = {})); -var Worker_Binding_CryptoKey_Algorithm_Which; -(function (Worker_Binding_CryptoKey_Algorithm_Which) { - Worker_Binding_CryptoKey_Algorithm_Which[Worker_Binding_CryptoKey_Algorithm_Which["NAME"] = 0] = "NAME"; - Worker_Binding_CryptoKey_Algorithm_Which[Worker_Binding_CryptoKey_Algorithm_Which["JSON"] = 1] = "JSON"; -})(Worker_Binding_CryptoKey_Algorithm_Which = exports.Worker_Binding_CryptoKey_Algorithm_Which || (exports.Worker_Binding_CryptoKey_Algorithm_Which = {})); -class Worker_Binding_CryptoKey_Algorithm extends capnp_ts_1.Struct { - getName() { - capnp_ts_1.Struct.testWhich("name", capnp_ts_1.Struct.getUint16(2, this), 0, this); - return capnp_ts_1.Struct.getText(1, this); - } - isName() { return capnp_ts_1.Struct.getUint16(2, this) === 0; } - setName(value) { - capnp_ts_1.Struct.setUint16(2, 0, this); - capnp_ts_1.Struct.setText(1, value, this); - } - getJson() { - capnp_ts_1.Struct.testWhich("json", capnp_ts_1.Struct.getUint16(2, this), 1, this); - return capnp_ts_1.Struct.getText(1, this); - } - isJson() { return capnp_ts_1.Struct.getUint16(2, this) === 1; } - setJson(value) { - capnp_ts_1.Struct.setUint16(2, 1, this); - capnp_ts_1.Struct.setText(1, value, this); - } - toString() { return "Worker_Binding_CryptoKey_Algorithm_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(2, this); } -} -exports.Worker_Binding_CryptoKey_Algorithm = Worker_Binding_CryptoKey_Algorithm; -Worker_Binding_CryptoKey_Algorithm.NAME = Worker_Binding_CryptoKey_Algorithm_Which.NAME; -Worker_Binding_CryptoKey_Algorithm.JSON = Worker_Binding_CryptoKey_Algorithm_Which.JSON; -Worker_Binding_CryptoKey_Algorithm._capnp = { displayName: "algorithm", id: "a1a040c5e00d7021", size: new capnp_ts_1.ObjectSize(8, 3) }; -var Worker_Binding_CryptoKey_Which; -(function (Worker_Binding_CryptoKey_Which) { - Worker_Binding_CryptoKey_Which[Worker_Binding_CryptoKey_Which["RAW"] = 0] = "RAW"; - Worker_Binding_CryptoKey_Which[Worker_Binding_CryptoKey_Which["HEX"] = 1] = "HEX"; - Worker_Binding_CryptoKey_Which[Worker_Binding_CryptoKey_Which["BASE64"] = 2] = "BASE64"; - Worker_Binding_CryptoKey_Which[Worker_Binding_CryptoKey_Which["PKCS8"] = 3] = "PKCS8"; - Worker_Binding_CryptoKey_Which[Worker_Binding_CryptoKey_Which["SPKI"] = 4] = "SPKI"; - Worker_Binding_CryptoKey_Which[Worker_Binding_CryptoKey_Which["JWK"] = 5] = "JWK"; -})(Worker_Binding_CryptoKey_Which = exports.Worker_Binding_CryptoKey_Which || (exports.Worker_Binding_CryptoKey_Which = {})); -class Worker_Binding_CryptoKey extends capnp_ts_1.Struct { - adoptRaw(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownRaw() { return capnp_ts_1.Struct.disown(this.getRaw()); } - getRaw() { - capnp_ts_1.Struct.testWhich("raw", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getData(0, this); - } - hasRaw() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initRaw(length) { - capnp_ts_1.Struct.setUint16(0, 0, this); - return capnp_ts_1.Struct.initData(0, length, this); - } - isRaw() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setRaw(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - getHex() { - capnp_ts_1.Struct.testWhich("hex", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getText(0, this); - } - isHex() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setHex(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.setText(0, value, this); - } - getBase64() { - capnp_ts_1.Struct.testWhich("base64", capnp_ts_1.Struct.getUint16(0, this), 2, this); - return capnp_ts_1.Struct.getText(0, this); - } - isBase64() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setBase64(value) { - capnp_ts_1.Struct.setUint16(0, 2, this); - capnp_ts_1.Struct.setText(0, value, this); - } - getPkcs8() { - capnp_ts_1.Struct.testWhich("pkcs8", capnp_ts_1.Struct.getUint16(0, this), 3, this); - return capnp_ts_1.Struct.getText(0, this); - } - isPkcs8() { return capnp_ts_1.Struct.getUint16(0, this) === 3; } - setPkcs8(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.setText(0, value, this); - } - getSpki() { - capnp_ts_1.Struct.testWhich("spki", capnp_ts_1.Struct.getUint16(0, this), 4, this); - return capnp_ts_1.Struct.getText(0, this); - } - isSpki() { return capnp_ts_1.Struct.getUint16(0, this) === 4; } - setSpki(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.setText(0, value, this); - } - getJwk() { - capnp_ts_1.Struct.testWhich("jwk", capnp_ts_1.Struct.getUint16(0, this), 5, this); - return capnp_ts_1.Struct.getText(0, this); - } - isJwk() { return capnp_ts_1.Struct.getUint16(0, this) === 5; } - setJwk(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.setText(0, value, this); - } - getAlgorithm() { return capnp_ts_1.Struct.getAs(Worker_Binding_CryptoKey_Algorithm, this); } - initAlgorithm() { return capnp_ts_1.Struct.getAs(Worker_Binding_CryptoKey_Algorithm, this); } - getExtractable() { return capnp_ts_1.Struct.getBit(32, this, Worker_Binding_CryptoKey._capnp.defaultExtractable); } - setExtractable(value) { capnp_ts_1.Struct.setBit(32, value, this); } - adoptUsages(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownUsages() { return capnp_ts_1.Struct.disown(this.getUsages()); } - getUsages() { return capnp_ts_1.Struct.getList(2, capnp.Uint16List, this); } - hasUsages() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initUsages(length) { return capnp_ts_1.Struct.initList(2, capnp.Uint16List, length, this); } - setUsages(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - toString() { return "Worker_Binding_CryptoKey_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Worker_Binding_CryptoKey = Worker_Binding_CryptoKey; -Worker_Binding_CryptoKey.RAW = Worker_Binding_CryptoKey_Which.RAW; -Worker_Binding_CryptoKey.HEX = Worker_Binding_CryptoKey_Which.HEX; -Worker_Binding_CryptoKey.BASE64 = Worker_Binding_CryptoKey_Which.BASE64; -Worker_Binding_CryptoKey.PKCS8 = Worker_Binding_CryptoKey_Which.PKCS8; -Worker_Binding_CryptoKey.SPKI = Worker_Binding_CryptoKey_Which.SPKI; -Worker_Binding_CryptoKey.JWK = Worker_Binding_CryptoKey_Which.JWK; -Worker_Binding_CryptoKey.Usage = Worker_Binding_CryptoKey_Usage; -Worker_Binding_CryptoKey._capnp = { displayName: "CryptoKey", id: "b5e1bff0e57d6eb0", size: new capnp_ts_1.ObjectSize(8, 3), defaultExtractable: capnp.getBitMask(false, 0) }; -class Worker_Binding_MemoryCacheLimits extends capnp_ts_1.Struct { - getMaxKeys() { return capnp_ts_1.Struct.getUint32(0, this); } - setMaxKeys(value) { capnp_ts_1.Struct.setUint32(0, value, this); } - getMaxValueSize() { return capnp_ts_1.Struct.getUint32(4, this); } - setMaxValueSize(value) { capnp_ts_1.Struct.setUint32(4, value, this); } - getMaxTotalValueSize() { return capnp_ts_1.Struct.getUint64(8, this); } - setMaxTotalValueSize(value) { capnp_ts_1.Struct.setUint64(8, value, this); } - toString() { return "Worker_Binding_MemoryCacheLimits_" + super.toString(); } -} -exports.Worker_Binding_MemoryCacheLimits = Worker_Binding_MemoryCacheLimits; -Worker_Binding_MemoryCacheLimits._capnp = { displayName: "MemoryCacheLimits", id: "8d66725b0867e634", size: new capnp_ts_1.ObjectSize(16, 0) }; -class Worker_Binding_WrappedBinding extends capnp_ts_1.Struct { - getModuleName() { return capnp_ts_1.Struct.getText(0, this); } - setModuleName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getEntrypoint() { return capnp_ts_1.Struct.getText(1, this, Worker_Binding_WrappedBinding._capnp.defaultEntrypoint); } - setEntrypoint(value) { capnp_ts_1.Struct.setText(1, value, this); } - adoptInnerBindings(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownInnerBindings() { return capnp_ts_1.Struct.disown(this.getInnerBindings()); } - getInnerBindings() { return capnp_ts_1.Struct.getList(2, Worker_Binding_WrappedBinding._InnerBindings, this); } - hasInnerBindings() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initInnerBindings(length) { return capnp_ts_1.Struct.initList(2, Worker_Binding_WrappedBinding._InnerBindings, length, this); } - setInnerBindings(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - toString() { return "Worker_Binding_WrappedBinding_" + super.toString(); } -} -exports.Worker_Binding_WrappedBinding = Worker_Binding_WrappedBinding; -Worker_Binding_WrappedBinding._capnp = { displayName: "WrappedBinding", id: "e6f066b75f0ea113", size: new capnp_ts_1.ObjectSize(0, 3), defaultEntrypoint: "default" }; -class Worker_Binding_Parameter extends capnp_ts_1.Struct { - adoptType(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownType() { return capnp_ts_1.Struct.disown(this.getType()); } - getType() { return capnp_ts_1.Struct.getStruct(1, Worker_Binding_Type, this); } - hasType() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initType() { return capnp_ts_1.Struct.initStructAt(1, Worker_Binding_Type, this); } - setType(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - getOptional() { return capnp_ts_1.Struct.getBit(16, this); } - setOptional(value) { capnp_ts_1.Struct.setBit(16, value, this); } - toString() { return "Worker_Binding_Parameter_" + super.toString(); } -} -exports.Worker_Binding_Parameter = Worker_Binding_Parameter; -Worker_Binding_Parameter._capnp = { displayName: "parameter", id: "dc57e1258d26d152", size: new capnp_ts_1.ObjectSize(8, 6) }; -class Worker_Binding_Hyperdrive extends capnp_ts_1.Struct { - adoptDesignator(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownDesignator() { return capnp_ts_1.Struct.disown(this.getDesignator()); } - getDesignator() { return capnp_ts_1.Struct.getStruct(1, ServiceDesignator, this); } - hasDesignator() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initDesignator() { return capnp_ts_1.Struct.initStructAt(1, ServiceDesignator, this); } - setDesignator(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - getDatabase() { return capnp_ts_1.Struct.getText(2, this); } - setDatabase(value) { capnp_ts_1.Struct.setText(2, value, this); } - getUser() { return capnp_ts_1.Struct.getText(3, this); } - setUser(value) { capnp_ts_1.Struct.setText(3, value, this); } - getPassword() { return capnp_ts_1.Struct.getText(4, this); } - setPassword(value) { capnp_ts_1.Struct.setText(4, value, this); } - getScheme() { return capnp_ts_1.Struct.getText(5, this); } - setScheme(value) { capnp_ts_1.Struct.setText(5, value, this); } - toString() { return "Worker_Binding_Hyperdrive_" + super.toString(); } -} -exports.Worker_Binding_Hyperdrive = Worker_Binding_Hyperdrive; -Worker_Binding_Hyperdrive._capnp = { displayName: "hyperdrive", id: "ad6c391cd55f3134", size: new capnp_ts_1.ObjectSize(8, 6) }; -class Worker_Binding_MemoryCache extends capnp_ts_1.Struct { - getId() { return capnp_ts_1.Struct.getText(1, this); } - setId(value) { capnp_ts_1.Struct.setText(1, value, this); } - adoptLimits(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownLimits() { return capnp_ts_1.Struct.disown(this.getLimits()); } - getLimits() { return capnp_ts_1.Struct.getStruct(2, Worker_Binding_MemoryCacheLimits, this); } - hasLimits() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initLimits() { return capnp_ts_1.Struct.initStructAt(2, Worker_Binding_MemoryCacheLimits, this); } - setLimits(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - toString() { return "Worker_Binding_MemoryCache_" + super.toString(); } -} -exports.Worker_Binding_MemoryCache = Worker_Binding_MemoryCache; -Worker_Binding_MemoryCache._capnp = { displayName: "memoryCache", id: "aed5760c349869da", size: new capnp_ts_1.ObjectSize(8, 6) }; -var Worker_Binding_Which; -(function (Worker_Binding_Which) { - Worker_Binding_Which[Worker_Binding_Which["UNSPECIFIED"] = 0] = "UNSPECIFIED"; - Worker_Binding_Which[Worker_Binding_Which["PARAMETER"] = 1] = "PARAMETER"; - Worker_Binding_Which[Worker_Binding_Which["TEXT"] = 2] = "TEXT"; - Worker_Binding_Which[Worker_Binding_Which["DATA"] = 3] = "DATA"; - Worker_Binding_Which[Worker_Binding_Which["JSON"] = 4] = "JSON"; - Worker_Binding_Which[Worker_Binding_Which["WASM_MODULE"] = 5] = "WASM_MODULE"; - Worker_Binding_Which[Worker_Binding_Which["CRYPTO_KEY"] = 6] = "CRYPTO_KEY"; - Worker_Binding_Which[Worker_Binding_Which["SERVICE"] = 7] = "SERVICE"; - Worker_Binding_Which[Worker_Binding_Which["DURABLE_OBJECT_NAMESPACE"] = 8] = "DURABLE_OBJECT_NAMESPACE"; - Worker_Binding_Which[Worker_Binding_Which["KV_NAMESPACE"] = 9] = "KV_NAMESPACE"; - Worker_Binding_Which[Worker_Binding_Which["R2BUCKET"] = 10] = "R2BUCKET"; - Worker_Binding_Which[Worker_Binding_Which["R2ADMIN"] = 11] = "R2ADMIN"; - Worker_Binding_Which[Worker_Binding_Which["WRAPPED"] = 12] = "WRAPPED"; - Worker_Binding_Which[Worker_Binding_Which["QUEUE"] = 13] = "QUEUE"; - Worker_Binding_Which[Worker_Binding_Which["FROM_ENVIRONMENT"] = 14] = "FROM_ENVIRONMENT"; - Worker_Binding_Which[Worker_Binding_Which["ANALYTICS_ENGINE"] = 15] = "ANALYTICS_ENGINE"; - Worker_Binding_Which[Worker_Binding_Which["HYPERDRIVE"] = 16] = "HYPERDRIVE"; - Worker_Binding_Which[Worker_Binding_Which["UNSAFE_EVAL"] = 17] = "UNSAFE_EVAL"; - Worker_Binding_Which[Worker_Binding_Which["MEMORY_CACHE"] = 18] = "MEMORY_CACHE"; -})(Worker_Binding_Which = exports.Worker_Binding_Which || (exports.Worker_Binding_Which = {})); -class Worker_Binding extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - isUnspecified() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setUnspecified() { capnp_ts_1.Struct.setUint16(0, 0, this); } - getParameter() { - capnp_ts_1.Struct.testWhich("parameter", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getAs(Worker_Binding_Parameter, this); - } - initParameter() { - capnp_ts_1.Struct.setUint16(0, 1, this); - return capnp_ts_1.Struct.getAs(Worker_Binding_Parameter, this); - } - isParameter() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setParameter() { capnp_ts_1.Struct.setUint16(0, 1, this); } - getText() { - capnp_ts_1.Struct.testWhich("text", capnp_ts_1.Struct.getUint16(0, this), 2, this); - return capnp_ts_1.Struct.getText(1, this); - } - isText() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setText(value) { - capnp_ts_1.Struct.setUint16(0, 2, this); - capnp_ts_1.Struct.setText(1, value, this); - } - adoptData(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownData() { return capnp_ts_1.Struct.disown(this.getData()); } - getData() { - capnp_ts_1.Struct.testWhich("data", capnp_ts_1.Struct.getUint16(0, this), 3, this); - return capnp_ts_1.Struct.getData(1, this); - } - hasData() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initData(length) { - capnp_ts_1.Struct.setUint16(0, 3, this); - return capnp_ts_1.Struct.initData(1, length, this); - } - isData() { return capnp_ts_1.Struct.getUint16(0, this) === 3; } - setData(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - getJson() { - capnp_ts_1.Struct.testWhich("json", capnp_ts_1.Struct.getUint16(0, this), 4, this); - return capnp_ts_1.Struct.getText(1, this); - } - isJson() { return capnp_ts_1.Struct.getUint16(0, this) === 4; } - setJson(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.setText(1, value, this); - } - adoptWasmModule(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownWasmModule() { return capnp_ts_1.Struct.disown(this.getWasmModule()); } - getWasmModule() { - capnp_ts_1.Struct.testWhich("wasmModule", capnp_ts_1.Struct.getUint16(0, this), 5, this); - return capnp_ts_1.Struct.getData(1, this); - } - hasWasmModule() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initWasmModule(length) { - capnp_ts_1.Struct.setUint16(0, 5, this); - return capnp_ts_1.Struct.initData(1, length, this); - } - isWasmModule() { return capnp_ts_1.Struct.getUint16(0, this) === 5; } - setWasmModule(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptCryptoKey(value) { - capnp_ts_1.Struct.setUint16(0, 6, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownCryptoKey() { return capnp_ts_1.Struct.disown(this.getCryptoKey()); } - getCryptoKey() { - capnp_ts_1.Struct.testWhich("cryptoKey", capnp_ts_1.Struct.getUint16(0, this), 6, this); - return capnp_ts_1.Struct.getStruct(1, Worker_Binding_CryptoKey, this); - } - hasCryptoKey() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initCryptoKey() { - capnp_ts_1.Struct.setUint16(0, 6, this); - return capnp_ts_1.Struct.initStructAt(1, Worker_Binding_CryptoKey, this); - } - isCryptoKey() { return capnp_ts_1.Struct.getUint16(0, this) === 6; } - setCryptoKey(value) { - capnp_ts_1.Struct.setUint16(0, 6, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptService(value) { - capnp_ts_1.Struct.setUint16(0, 7, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownService() { return capnp_ts_1.Struct.disown(this.getService()); } - getService() { - capnp_ts_1.Struct.testWhich("service", capnp_ts_1.Struct.getUint16(0, this), 7, this); - return capnp_ts_1.Struct.getStruct(1, ServiceDesignator, this); - } - hasService() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initService() { - capnp_ts_1.Struct.setUint16(0, 7, this); - return capnp_ts_1.Struct.initStructAt(1, ServiceDesignator, this); - } - isService() { return capnp_ts_1.Struct.getUint16(0, this) === 7; } - setService(value) { - capnp_ts_1.Struct.setUint16(0, 7, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptDurableObjectNamespace(value) { - capnp_ts_1.Struct.setUint16(0, 8, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownDurableObjectNamespace() { return capnp_ts_1.Struct.disown(this.getDurableObjectNamespace()); } - getDurableObjectNamespace() { - capnp_ts_1.Struct.testWhich("durableObjectNamespace", capnp_ts_1.Struct.getUint16(0, this), 8, this); - return capnp_ts_1.Struct.getStruct(1, Worker_Binding_DurableObjectNamespaceDesignator, this); - } - hasDurableObjectNamespace() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initDurableObjectNamespace() { - capnp_ts_1.Struct.setUint16(0, 8, this); - return capnp_ts_1.Struct.initStructAt(1, Worker_Binding_DurableObjectNamespaceDesignator, this); - } - isDurableObjectNamespace() { return capnp_ts_1.Struct.getUint16(0, this) === 8; } - setDurableObjectNamespace(value) { - capnp_ts_1.Struct.setUint16(0, 8, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptKvNamespace(value) { - capnp_ts_1.Struct.setUint16(0, 9, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownKvNamespace() { return capnp_ts_1.Struct.disown(this.getKvNamespace()); } - getKvNamespace() { - capnp_ts_1.Struct.testWhich("kvNamespace", capnp_ts_1.Struct.getUint16(0, this), 9, this); - return capnp_ts_1.Struct.getStruct(1, ServiceDesignator, this); - } - hasKvNamespace() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initKvNamespace() { - capnp_ts_1.Struct.setUint16(0, 9, this); - return capnp_ts_1.Struct.initStructAt(1, ServiceDesignator, this); - } - isKvNamespace() { return capnp_ts_1.Struct.getUint16(0, this) === 9; } - setKvNamespace(value) { - capnp_ts_1.Struct.setUint16(0, 9, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptR2Bucket(value) { - capnp_ts_1.Struct.setUint16(0, 10, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownR2Bucket() { return capnp_ts_1.Struct.disown(this.getR2Bucket()); } - getR2Bucket() { - capnp_ts_1.Struct.testWhich("r2Bucket", capnp_ts_1.Struct.getUint16(0, this), 10, this); - return capnp_ts_1.Struct.getStruct(1, ServiceDesignator, this); - } - hasR2Bucket() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initR2Bucket() { - capnp_ts_1.Struct.setUint16(0, 10, this); - return capnp_ts_1.Struct.initStructAt(1, ServiceDesignator, this); - } - isR2Bucket() { return capnp_ts_1.Struct.getUint16(0, this) === 10; } - setR2Bucket(value) { - capnp_ts_1.Struct.setUint16(0, 10, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptR2Admin(value) { - capnp_ts_1.Struct.setUint16(0, 11, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownR2Admin() { return capnp_ts_1.Struct.disown(this.getR2Admin()); } - getR2Admin() { - capnp_ts_1.Struct.testWhich("r2Admin", capnp_ts_1.Struct.getUint16(0, this), 11, this); - return capnp_ts_1.Struct.getStruct(1, ServiceDesignator, this); - } - hasR2Admin() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initR2Admin() { - capnp_ts_1.Struct.setUint16(0, 11, this); - return capnp_ts_1.Struct.initStructAt(1, ServiceDesignator, this); - } - isR2Admin() { return capnp_ts_1.Struct.getUint16(0, this) === 11; } - setR2Admin(value) { - capnp_ts_1.Struct.setUint16(0, 11, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptWrapped(value) { - capnp_ts_1.Struct.setUint16(0, 12, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownWrapped() { return capnp_ts_1.Struct.disown(this.getWrapped()); } - getWrapped() { - capnp_ts_1.Struct.testWhich("wrapped", capnp_ts_1.Struct.getUint16(0, this), 12, this); - return capnp_ts_1.Struct.getStruct(1, Worker_Binding_WrappedBinding, this); - } - hasWrapped() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initWrapped() { - capnp_ts_1.Struct.setUint16(0, 12, this); - return capnp_ts_1.Struct.initStructAt(1, Worker_Binding_WrappedBinding, this); - } - isWrapped() { return capnp_ts_1.Struct.getUint16(0, this) === 12; } - setWrapped(value) { - capnp_ts_1.Struct.setUint16(0, 12, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - adoptQueue(value) { - capnp_ts_1.Struct.setUint16(0, 13, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownQueue() { return capnp_ts_1.Struct.disown(this.getQueue()); } - getQueue() { - capnp_ts_1.Struct.testWhich("queue", capnp_ts_1.Struct.getUint16(0, this), 13, this); - return capnp_ts_1.Struct.getStruct(1, ServiceDesignator, this); - } - hasQueue() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initQueue() { - capnp_ts_1.Struct.setUint16(0, 13, this); - return capnp_ts_1.Struct.initStructAt(1, ServiceDesignator, this); - } - isQueue() { return capnp_ts_1.Struct.getUint16(0, this) === 13; } - setQueue(value) { - capnp_ts_1.Struct.setUint16(0, 13, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - getFromEnvironment() { - capnp_ts_1.Struct.testWhich("fromEnvironment", capnp_ts_1.Struct.getUint16(0, this), 14, this); - return capnp_ts_1.Struct.getText(1, this); - } - isFromEnvironment() { return capnp_ts_1.Struct.getUint16(0, this) === 14; } - setFromEnvironment(value) { - capnp_ts_1.Struct.setUint16(0, 14, this); - capnp_ts_1.Struct.setText(1, value, this); - } - adoptAnalyticsEngine(value) { - capnp_ts_1.Struct.setUint16(0, 15, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownAnalyticsEngine() { return capnp_ts_1.Struct.disown(this.getAnalyticsEngine()); } - getAnalyticsEngine() { - capnp_ts_1.Struct.testWhich("analyticsEngine", capnp_ts_1.Struct.getUint16(0, this), 15, this); - return capnp_ts_1.Struct.getStruct(1, ServiceDesignator, this); - } - hasAnalyticsEngine() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initAnalyticsEngine() { - capnp_ts_1.Struct.setUint16(0, 15, this); - return capnp_ts_1.Struct.initStructAt(1, ServiceDesignator, this); - } - isAnalyticsEngine() { return capnp_ts_1.Struct.getUint16(0, this) === 15; } - setAnalyticsEngine(value) { - capnp_ts_1.Struct.setUint16(0, 15, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - getHyperdrive() { - capnp_ts_1.Struct.testWhich("hyperdrive", capnp_ts_1.Struct.getUint16(0, this), 16, this); - return capnp_ts_1.Struct.getAs(Worker_Binding_Hyperdrive, this); - } - initHyperdrive() { - capnp_ts_1.Struct.setUint16(0, 16, this); - return capnp_ts_1.Struct.getAs(Worker_Binding_Hyperdrive, this); - } - isHyperdrive() { return capnp_ts_1.Struct.getUint16(0, this) === 16; } - setHyperdrive() { capnp_ts_1.Struct.setUint16(0, 16, this); } - isUnsafeEval() { return capnp_ts_1.Struct.getUint16(0, this) === 17; } - setUnsafeEval() { capnp_ts_1.Struct.setUint16(0, 17, this); } - getMemoryCache() { - capnp_ts_1.Struct.testWhich("memoryCache", capnp_ts_1.Struct.getUint16(0, this), 18, this); - return capnp_ts_1.Struct.getAs(Worker_Binding_MemoryCache, this); - } - initMemoryCache() { - capnp_ts_1.Struct.setUint16(0, 18, this); - return capnp_ts_1.Struct.getAs(Worker_Binding_MemoryCache, this); - } - isMemoryCache() { return capnp_ts_1.Struct.getUint16(0, this) === 18; } - setMemoryCache() { capnp_ts_1.Struct.setUint16(0, 18, this); } - toString() { return "Worker_Binding_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Worker_Binding = Worker_Binding; -Worker_Binding.UNSPECIFIED = Worker_Binding_Which.UNSPECIFIED; -Worker_Binding.PARAMETER = Worker_Binding_Which.PARAMETER; -Worker_Binding.TEXT = Worker_Binding_Which.TEXT; -Worker_Binding.DATA = Worker_Binding_Which.DATA; -Worker_Binding.JSON = Worker_Binding_Which.JSON; -Worker_Binding.WASM_MODULE = Worker_Binding_Which.WASM_MODULE; -Worker_Binding.CRYPTO_KEY = Worker_Binding_Which.CRYPTO_KEY; -Worker_Binding.SERVICE = Worker_Binding_Which.SERVICE; -Worker_Binding.DURABLE_OBJECT_NAMESPACE = Worker_Binding_Which.DURABLE_OBJECT_NAMESPACE; -Worker_Binding.KV_NAMESPACE = Worker_Binding_Which.KV_NAMESPACE; -Worker_Binding.R2BUCKET = Worker_Binding_Which.R2BUCKET; -Worker_Binding.R2ADMIN = Worker_Binding_Which.R2ADMIN; -Worker_Binding.WRAPPED = Worker_Binding_Which.WRAPPED; -Worker_Binding.QUEUE = Worker_Binding_Which.QUEUE; -Worker_Binding.FROM_ENVIRONMENT = Worker_Binding_Which.FROM_ENVIRONMENT; -Worker_Binding.ANALYTICS_ENGINE = Worker_Binding_Which.ANALYTICS_ENGINE; -Worker_Binding.HYPERDRIVE = Worker_Binding_Which.HYPERDRIVE; -Worker_Binding.UNSAFE_EVAL = Worker_Binding_Which.UNSAFE_EVAL; -Worker_Binding.MEMORY_CACHE = Worker_Binding_Which.MEMORY_CACHE; -Worker_Binding.Type = Worker_Binding_Type; -Worker_Binding.DurableObjectNamespaceDesignator = Worker_Binding_DurableObjectNamespaceDesignator; -Worker_Binding.CryptoKey = Worker_Binding_CryptoKey; -Worker_Binding.MemoryCacheLimits = Worker_Binding_MemoryCacheLimits; -Worker_Binding.WrappedBinding = Worker_Binding_WrappedBinding; -Worker_Binding._capnp = { displayName: "Binding", id: "8e7e492fd7e35f3e", size: new capnp_ts_1.ObjectSize(8, 6) }; -var Worker_DurableObjectNamespace_Which; -(function (Worker_DurableObjectNamespace_Which) { - Worker_DurableObjectNamespace_Which[Worker_DurableObjectNamespace_Which["UNIQUE_KEY"] = 0] = "UNIQUE_KEY"; - Worker_DurableObjectNamespace_Which[Worker_DurableObjectNamespace_Which["EPHEMERAL_LOCAL"] = 1] = "EPHEMERAL_LOCAL"; -})(Worker_DurableObjectNamespace_Which = exports.Worker_DurableObjectNamespace_Which || (exports.Worker_DurableObjectNamespace_Which = {})); -class Worker_DurableObjectNamespace extends capnp_ts_1.Struct { - getClassName() { return capnp_ts_1.Struct.getText(0, this); } - setClassName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getUniqueKey() { - capnp_ts_1.Struct.testWhich("uniqueKey", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getText(1, this); - } - isUniqueKey() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setUniqueKey(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.setText(1, value, this); - } - isEphemeralLocal() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setEphemeralLocal() { capnp_ts_1.Struct.setUint16(0, 1, this); } - getPreventEviction() { return capnp_ts_1.Struct.getBit(16, this); } - setPreventEviction(value) { capnp_ts_1.Struct.setBit(16, value, this); } - getEnableSql() { return capnp_ts_1.Struct.getBit(17, this); } - setEnableSql(value) { capnp_ts_1.Struct.setBit(17, value, this); } - toString() { return "Worker_DurableObjectNamespace_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Worker_DurableObjectNamespace = Worker_DurableObjectNamespace; -Worker_DurableObjectNamespace.UNIQUE_KEY = Worker_DurableObjectNamespace_Which.UNIQUE_KEY; -Worker_DurableObjectNamespace.EPHEMERAL_LOCAL = Worker_DurableObjectNamespace_Which.EPHEMERAL_LOCAL; -Worker_DurableObjectNamespace._capnp = { displayName: "DurableObjectNamespace", id: "b429dd547d15747d", size: new capnp_ts_1.ObjectSize(8, 2) }; -var Worker_DurableObjectStorage_Which; -(function (Worker_DurableObjectStorage_Which) { - Worker_DurableObjectStorage_Which[Worker_DurableObjectStorage_Which["NONE"] = 0] = "NONE"; - Worker_DurableObjectStorage_Which[Worker_DurableObjectStorage_Which["IN_MEMORY"] = 1] = "IN_MEMORY"; - Worker_DurableObjectStorage_Which[Worker_DurableObjectStorage_Which["LOCAL_DISK"] = 2] = "LOCAL_DISK"; -})(Worker_DurableObjectStorage_Which = exports.Worker_DurableObjectStorage_Which || (exports.Worker_DurableObjectStorage_Which = {})); -class Worker_DurableObjectStorage extends capnp_ts_1.Struct { - isNone() { return capnp_ts_1.Struct.getUint16(2, this) === 0; } - setNone() { capnp_ts_1.Struct.setUint16(2, 0, this); } - isInMemory() { return capnp_ts_1.Struct.getUint16(2, this) === 1; } - setInMemory() { capnp_ts_1.Struct.setUint16(2, 1, this); } - getLocalDisk() { - capnp_ts_1.Struct.testWhich("localDisk", capnp_ts_1.Struct.getUint16(2, this), 2, this); - return capnp_ts_1.Struct.getText(8, this); - } - isLocalDisk() { return capnp_ts_1.Struct.getUint16(2, this) === 2; } - setLocalDisk(value) { - capnp_ts_1.Struct.setUint16(2, 2, this); - capnp_ts_1.Struct.setText(8, value, this); - } - toString() { return "Worker_DurableObjectStorage_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(2, this); } -} -exports.Worker_DurableObjectStorage = Worker_DurableObjectStorage; -Worker_DurableObjectStorage.NONE = Worker_DurableObjectStorage_Which.NONE; -Worker_DurableObjectStorage.IN_MEMORY = Worker_DurableObjectStorage_Which.IN_MEMORY; -Worker_DurableObjectStorage.LOCAL_DISK = Worker_DurableObjectStorage_Which.LOCAL_DISK; -Worker_DurableObjectStorage._capnp = { displayName: "durableObjectStorage", id: "cc72b3faa57827d4", size: new capnp_ts_1.ObjectSize(8, 10) }; -var Worker_Which; -(function (Worker_Which) { - Worker_Which[Worker_Which["MODULES"] = 0] = "MODULES"; - Worker_Which[Worker_Which["SERVICE_WORKER_SCRIPT"] = 1] = "SERVICE_WORKER_SCRIPT"; - Worker_Which[Worker_Which["INHERIT"] = 2] = "INHERIT"; -})(Worker_Which = exports.Worker_Which || (exports.Worker_Which = {})); -class Worker extends capnp_ts_1.Struct { - adoptModules(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownModules() { return capnp_ts_1.Struct.disown(this.getModules()); } - getModules() { - capnp_ts_1.Struct.testWhich("modules", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getList(0, Worker._Modules, this); - } - hasModules() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initModules(length) { - capnp_ts_1.Struct.setUint16(0, 0, this); - return capnp_ts_1.Struct.initList(0, Worker._Modules, length, this); - } - isModules() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setModules(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - getServiceWorkerScript() { - capnp_ts_1.Struct.testWhich("serviceWorkerScript", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getText(0, this); - } - isServiceWorkerScript() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setServiceWorkerScript(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.setText(0, value, this); - } - getInherit() { - capnp_ts_1.Struct.testWhich("inherit", capnp_ts_1.Struct.getUint16(0, this), 2, this); - return capnp_ts_1.Struct.getText(0, this); - } - isInherit() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setInherit(value) { - capnp_ts_1.Struct.setUint16(0, 2, this); - capnp_ts_1.Struct.setText(0, value, this); - } - getCompatibilityDate() { return capnp_ts_1.Struct.getText(1, this); } - setCompatibilityDate(value) { capnp_ts_1.Struct.setText(1, value, this); } - adoptCompatibilityFlags(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownCompatibilityFlags() { return capnp_ts_1.Struct.disown(this.getCompatibilityFlags()); } - getCompatibilityFlags() { return capnp_ts_1.Struct.getList(2, capnp.TextList, this); } - hasCompatibilityFlags() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initCompatibilityFlags(length) { return capnp_ts_1.Struct.initList(2, capnp.TextList, length, this); } - setCompatibilityFlags(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - adoptBindings(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(3, this)); } - disownBindings() { return capnp_ts_1.Struct.disown(this.getBindings()); } - getBindings() { return capnp_ts_1.Struct.getList(3, Worker._Bindings, this); } - hasBindings() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(3, this)); } - initBindings(length) { return capnp_ts_1.Struct.initList(3, Worker._Bindings, length, this); } - setBindings(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(3, this)); } - adoptGlobalOutbound(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(4, this)); } - disownGlobalOutbound() { return capnp_ts_1.Struct.disown(this.getGlobalOutbound()); } - getGlobalOutbound() { return capnp_ts_1.Struct.getStruct(4, ServiceDesignator, this, Worker._capnp.defaultGlobalOutbound); } - hasGlobalOutbound() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(4, this)); } - initGlobalOutbound() { return capnp_ts_1.Struct.initStructAt(4, ServiceDesignator, this); } - setGlobalOutbound(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(4, this)); } - adoptCacheApiOutbound(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(7, this)); } - disownCacheApiOutbound() { return capnp_ts_1.Struct.disown(this.getCacheApiOutbound()); } - getCacheApiOutbound() { return capnp_ts_1.Struct.getStruct(7, ServiceDesignator, this); } - hasCacheApiOutbound() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(7, this)); } - initCacheApiOutbound() { return capnp_ts_1.Struct.initStructAt(7, ServiceDesignator, this); } - setCacheApiOutbound(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(7, this)); } - adoptDurableObjectNamespaces(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(5, this)); } - disownDurableObjectNamespaces() { return capnp_ts_1.Struct.disown(this.getDurableObjectNamespaces()); } - getDurableObjectNamespaces() { return capnp_ts_1.Struct.getList(5, Worker._DurableObjectNamespaces, this); } - hasDurableObjectNamespaces() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(5, this)); } - initDurableObjectNamespaces(length) { return capnp_ts_1.Struct.initList(5, Worker._DurableObjectNamespaces, length, this); } - setDurableObjectNamespaces(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(5, this)); } - getDurableObjectUniqueKeyModifier() { return capnp_ts_1.Struct.getText(6, this); } - setDurableObjectUniqueKeyModifier(value) { capnp_ts_1.Struct.setText(6, value, this); } - getDurableObjectStorage() { return capnp_ts_1.Struct.getAs(Worker_DurableObjectStorage, this); } - initDurableObjectStorage() { return capnp_ts_1.Struct.getAs(Worker_DurableObjectStorage, this); } - getModuleFallback() { return capnp_ts_1.Struct.getText(9, this); } - setModuleFallback(value) { capnp_ts_1.Struct.setText(9, value, this); } - toString() { return "Worker_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Worker = Worker; -Worker.MODULES = Worker_Which.MODULES; -Worker.SERVICE_WORKER_SCRIPT = Worker_Which.SERVICE_WORKER_SCRIPT; -Worker.INHERIT = Worker_Which.INHERIT; -Worker.Module = Worker_Module; -Worker.Binding = Worker_Binding; -Worker.DurableObjectNamespace = Worker_DurableObjectNamespace; -Worker._capnp = { displayName: "Worker", id: "acfa77e88fd97d1c", size: new capnp_ts_1.ObjectSize(8, 10), defaultGlobalOutbound: capnp.readRawPointer(new Uint8Array([0x10, 0x05, 0x40, 0x02, 0x11, 0x05, 0x4a, 0x00, 0x00, 0xff, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x00, 0x00, 0x00]).buffer) }; -class ExternalServer_Https extends capnp_ts_1.Struct { - adoptOptions(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownOptions() { return capnp_ts_1.Struct.disown(this.getOptions()); } - getOptions() { return capnp_ts_1.Struct.getStruct(1, HttpOptions, this); } - hasOptions() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initOptions() { return capnp_ts_1.Struct.initStructAt(1, HttpOptions, this); } - setOptions(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - adoptTlsOptions(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownTlsOptions() { return capnp_ts_1.Struct.disown(this.getTlsOptions()); } - getTlsOptions() { return capnp_ts_1.Struct.getStruct(2, TlsOptions, this); } - hasTlsOptions() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initTlsOptions() { return capnp_ts_1.Struct.initStructAt(2, TlsOptions, this); } - setTlsOptions(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - getCertificateHost() { return capnp_ts_1.Struct.getText(3, this); } - setCertificateHost(value) { capnp_ts_1.Struct.setText(3, value, this); } - toString() { return "ExternalServer_Https_" + super.toString(); } -} -exports.ExternalServer_Https = ExternalServer_Https; -ExternalServer_Https._capnp = { displayName: "https", id: "ac37e02afd3dc6db", size: new capnp_ts_1.ObjectSize(8, 4) }; -class ExternalServer_Tcp extends capnp_ts_1.Struct { - adoptTlsOptions(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownTlsOptions() { return capnp_ts_1.Struct.disown(this.getTlsOptions()); } - getTlsOptions() { return capnp_ts_1.Struct.getStruct(1, TlsOptions, this); } - hasTlsOptions() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initTlsOptions() { return capnp_ts_1.Struct.initStructAt(1, TlsOptions, this); } - setTlsOptions(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - getCertificateHost() { return capnp_ts_1.Struct.getText(2, this); } - setCertificateHost(value) { capnp_ts_1.Struct.setText(2, value, this); } - toString() { return "ExternalServer_Tcp_" + super.toString(); } -} -exports.ExternalServer_Tcp = ExternalServer_Tcp; -ExternalServer_Tcp._capnp = { displayName: "tcp", id: "d941637df0fb39f1", size: new capnp_ts_1.ObjectSize(8, 4) }; -var ExternalServer_Which; -(function (ExternalServer_Which) { - ExternalServer_Which[ExternalServer_Which["HTTP"] = 0] = "HTTP"; - ExternalServer_Which[ExternalServer_Which["HTTPS"] = 1] = "HTTPS"; - ExternalServer_Which[ExternalServer_Which["TCP"] = 2] = "TCP"; -})(ExternalServer_Which = exports.ExternalServer_Which || (exports.ExternalServer_Which = {})); -class ExternalServer extends capnp_ts_1.Struct { - getAddress() { return capnp_ts_1.Struct.getText(0, this); } - setAddress(value) { capnp_ts_1.Struct.setText(0, value, this); } - adoptHttp(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); - } - disownHttp() { return capnp_ts_1.Struct.disown(this.getHttp()); } - getHttp() { - capnp_ts_1.Struct.testWhich("http", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getStruct(1, HttpOptions, this); - } - hasHttp() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initHttp() { - capnp_ts_1.Struct.setUint16(0, 0, this); - return capnp_ts_1.Struct.initStructAt(1, HttpOptions, this); - } - isHttp() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setHttp(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); - } - getHttps() { - capnp_ts_1.Struct.testWhich("https", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getAs(ExternalServer_Https, this); - } - initHttps() { - capnp_ts_1.Struct.setUint16(0, 1, this); - return capnp_ts_1.Struct.getAs(ExternalServer_Https, this); - } - isHttps() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setHttps() { capnp_ts_1.Struct.setUint16(0, 1, this); } - getTcp() { - capnp_ts_1.Struct.testWhich("tcp", capnp_ts_1.Struct.getUint16(0, this), 2, this); - return capnp_ts_1.Struct.getAs(ExternalServer_Tcp, this); - } - initTcp() { - capnp_ts_1.Struct.setUint16(0, 2, this); - return capnp_ts_1.Struct.getAs(ExternalServer_Tcp, this); - } - isTcp() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setTcp() { capnp_ts_1.Struct.setUint16(0, 2, this); } - toString() { return "ExternalServer_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.ExternalServer = ExternalServer; -ExternalServer.HTTP = ExternalServer_Which.HTTP; -ExternalServer.HTTPS = ExternalServer_Which.HTTPS; -ExternalServer.TCP = ExternalServer_Which.TCP; -ExternalServer._capnp = { displayName: "ExternalServer", id: "ff209f9aa352f5a4", size: new capnp_ts_1.ObjectSize(8, 4) }; -class Network extends capnp_ts_1.Struct { - adoptAllow(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownAllow() { return capnp_ts_1.Struct.disown(this.getAllow()); } - getAllow() { return capnp_ts_1.Struct.getList(0, capnp.TextList, this, Network._capnp.defaultAllow); } - hasAllow() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initAllow(length) { return capnp_ts_1.Struct.initList(0, capnp.TextList, length, this); } - setAllow(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - adoptDeny(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownDeny() { return capnp_ts_1.Struct.disown(this.getDeny()); } - getDeny() { return capnp_ts_1.Struct.getList(1, capnp.TextList, this); } - hasDeny() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initDeny(length) { return capnp_ts_1.Struct.initList(1, capnp.TextList, length, this); } - setDeny(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - adoptTlsOptions(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownTlsOptions() { return capnp_ts_1.Struct.disown(this.getTlsOptions()); } - getTlsOptions() { return capnp_ts_1.Struct.getStruct(2, TlsOptions, this); } - hasTlsOptions() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initTlsOptions() { return capnp_ts_1.Struct.initStructAt(2, TlsOptions, this); } - setTlsOptions(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - toString() { return "Network_" + super.toString(); } -} -exports.Network = Network; -Network._capnp = { displayName: "Network", id: "fa42244f950c9b9c", size: new capnp_ts_1.ObjectSize(0, 3), defaultAllow: capnp.readRawPointer(new Uint8Array([0x10, 0x03, 0x11, 0x01, 0x0e, 0x11, 0x01, 0x3a, 0x3f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63]).buffer) }; -class DiskDirectory extends capnp_ts_1.Struct { - getPath() { return capnp_ts_1.Struct.getText(0, this); } - setPath(value) { capnp_ts_1.Struct.setText(0, value, this); } - getWritable() { return capnp_ts_1.Struct.getBit(0, this, DiskDirectory._capnp.defaultWritable); } - setWritable(value) { capnp_ts_1.Struct.setBit(0, value, this); } - getAllowDotfiles() { return capnp_ts_1.Struct.getBit(1, this, DiskDirectory._capnp.defaultAllowDotfiles); } - setAllowDotfiles(value) { capnp_ts_1.Struct.setBit(1, value, this); } - toString() { return "DiskDirectory_" + super.toString(); } -} -exports.DiskDirectory = DiskDirectory; -DiskDirectory._capnp = { displayName: "DiskDirectory", id: "9048ab22835f51c3", size: new capnp_ts_1.ObjectSize(8, 1), defaultWritable: capnp.getBitMask(false, 0), defaultAllowDotfiles: capnp.getBitMask(false, 1) }; -var HttpOptions_Style; -(function (HttpOptions_Style) { - HttpOptions_Style[HttpOptions_Style["HOST"] = 0] = "HOST"; - HttpOptions_Style[HttpOptions_Style["PROXY"] = 1] = "PROXY"; -})(HttpOptions_Style = exports.HttpOptions_Style || (exports.HttpOptions_Style = {})); -class HttpOptions_Header extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getValue() { return capnp_ts_1.Struct.getText(1, this); } - setValue(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "HttpOptions_Header_" + super.toString(); } -} -exports.HttpOptions_Header = HttpOptions_Header; -HttpOptions_Header._capnp = { displayName: "Header", id: "dc0394b5a6f3417e", size: new capnp_ts_1.ObjectSize(0, 2) }; -class HttpOptions extends capnp_ts_1.Struct { - getStyle() { return capnp_ts_1.Struct.getUint16(0, this, HttpOptions._capnp.defaultStyle); } - setStyle(value) { capnp_ts_1.Struct.setUint16(0, value, this); } - getForwardedProtoHeader() { return capnp_ts_1.Struct.getText(0, this); } - setForwardedProtoHeader(value) { capnp_ts_1.Struct.setText(0, value, this); } - getCfBlobHeader() { return capnp_ts_1.Struct.getText(1, this); } - setCfBlobHeader(value) { capnp_ts_1.Struct.setText(1, value, this); } - adoptInjectRequestHeaders(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownInjectRequestHeaders() { return capnp_ts_1.Struct.disown(this.getInjectRequestHeaders()); } - getInjectRequestHeaders() { return capnp_ts_1.Struct.getList(2, HttpOptions._InjectRequestHeaders, this); } - hasInjectRequestHeaders() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initInjectRequestHeaders(length) { return capnp_ts_1.Struct.initList(2, HttpOptions._InjectRequestHeaders, length, this); } - setInjectRequestHeaders(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - adoptInjectResponseHeaders(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(3, this)); } - disownInjectResponseHeaders() { return capnp_ts_1.Struct.disown(this.getInjectResponseHeaders()); } - getInjectResponseHeaders() { return capnp_ts_1.Struct.getList(3, HttpOptions._InjectResponseHeaders, this); } - hasInjectResponseHeaders() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(3, this)); } - initInjectResponseHeaders(length) { return capnp_ts_1.Struct.initList(3, HttpOptions._InjectResponseHeaders, length, this); } - setInjectResponseHeaders(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(3, this)); } - getCapnpConnectHost() { return capnp_ts_1.Struct.getText(4, this); } - setCapnpConnectHost(value) { capnp_ts_1.Struct.setText(4, value, this); } - toString() { return "HttpOptions_" + super.toString(); } -} -exports.HttpOptions = HttpOptions; -HttpOptions.Style = HttpOptions_Style; -HttpOptions.Header = HttpOptions_Header; -HttpOptions._capnp = { displayName: "HttpOptions", id: "aa8dc6885da78f19", size: new capnp_ts_1.ObjectSize(8, 5), defaultStyle: capnp.getUint16Mask(0) }; -class TlsOptions_Keypair extends capnp_ts_1.Struct { - getPrivateKey() { return capnp_ts_1.Struct.getText(0, this); } - setPrivateKey(value) { capnp_ts_1.Struct.setText(0, value, this); } - getCertificateChain() { return capnp_ts_1.Struct.getText(1, this); } - setCertificateChain(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "TlsOptions_Keypair_" + super.toString(); } -} -exports.TlsOptions_Keypair = TlsOptions_Keypair; -TlsOptions_Keypair._capnp = { displayName: "Keypair", id: "f546bf2d5d8bd13e", size: new capnp_ts_1.ObjectSize(0, 2) }; -var TlsOptions_Version; -(function (TlsOptions_Version) { - TlsOptions_Version[TlsOptions_Version["GOOD_DEFAULT"] = 0] = "GOOD_DEFAULT"; - TlsOptions_Version[TlsOptions_Version["SSL3"] = 1] = "SSL3"; - TlsOptions_Version[TlsOptions_Version["TLS1DOT0"] = 2] = "TLS1DOT0"; - TlsOptions_Version[TlsOptions_Version["TLS1DOT1"] = 3] = "TLS1DOT1"; - TlsOptions_Version[TlsOptions_Version["TLS1DOT2"] = 4] = "TLS1DOT2"; - TlsOptions_Version[TlsOptions_Version["TLS1DOT3"] = 5] = "TLS1DOT3"; -})(TlsOptions_Version = exports.TlsOptions_Version || (exports.TlsOptions_Version = {})); -class TlsOptions extends capnp_ts_1.Struct { - adoptKeypair(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownKeypair() { return capnp_ts_1.Struct.disown(this.getKeypair()); } - getKeypair() { return capnp_ts_1.Struct.getStruct(0, TlsOptions_Keypair, this); } - hasKeypair() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initKeypair() { return capnp_ts_1.Struct.initStructAt(0, TlsOptions_Keypair, this); } - setKeypair(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - getRequireClientCerts() { return capnp_ts_1.Struct.getBit(0, this, TlsOptions._capnp.defaultRequireClientCerts); } - setRequireClientCerts(value) { capnp_ts_1.Struct.setBit(0, value, this); } - getTrustBrowserCas() { return capnp_ts_1.Struct.getBit(1, this, TlsOptions._capnp.defaultTrustBrowserCas); } - setTrustBrowserCas(value) { capnp_ts_1.Struct.setBit(1, value, this); } - adoptTrustedCertificates(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownTrustedCertificates() { return capnp_ts_1.Struct.disown(this.getTrustedCertificates()); } - getTrustedCertificates() { return capnp_ts_1.Struct.getList(1, capnp.TextList, this); } - hasTrustedCertificates() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initTrustedCertificates(length) { return capnp_ts_1.Struct.initList(1, capnp.TextList, length, this); } - setTrustedCertificates(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - getMinVersion() { return capnp_ts_1.Struct.getUint16(2, this, TlsOptions._capnp.defaultMinVersion); } - setMinVersion(value) { capnp_ts_1.Struct.setUint16(2, value, this); } - getCipherList() { return capnp_ts_1.Struct.getText(2, this); } - setCipherList(value) { capnp_ts_1.Struct.setText(2, value, this); } - toString() { return "TlsOptions_" + super.toString(); } -} -exports.TlsOptions = TlsOptions; -TlsOptions.Keypair = TlsOptions_Keypair; -TlsOptions.Version = TlsOptions_Version; -TlsOptions._capnp = { displayName: "TlsOptions", id: "aabb3c3778ac4311", size: new capnp_ts_1.ObjectSize(8, 3), defaultRequireClientCerts: capnp.getBitMask(false, 0), defaultTrustBrowserCas: capnp.getBitMask(false, 1), defaultMinVersion: capnp.getUint16Mask(0) }; -class Extension_Module extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getInternal() { return capnp_ts_1.Struct.getBit(0, this, Extension_Module._capnp.defaultInternal); } - setInternal(value) { capnp_ts_1.Struct.setBit(0, value, this); } - getEsModule() { return capnp_ts_1.Struct.getText(1, this); } - setEsModule(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "Extension_Module_" + super.toString(); } -} -exports.Extension_Module = Extension_Module; -Extension_Module._capnp = { displayName: "Module", id: "d5d16e76fdedc37d", size: new capnp_ts_1.ObjectSize(8, 2), defaultInternal: capnp.getBitMask(false, 0) }; -class Extension extends capnp_ts_1.Struct { - adoptModules(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownModules() { return capnp_ts_1.Struct.disown(this.getModules()); } - getModules() { return capnp_ts_1.Struct.getList(0, Extension._Modules, this); } - hasModules() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initModules(length) { return capnp_ts_1.Struct.initList(0, Extension._Modules, length, this); } - setModules(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - toString() { return "Extension_" + super.toString(); } -} -exports.Extension = Extension; -Extension.Module = Extension_Module; -Extension._capnp = { displayName: "Extension", id: "e390128a861973a6", size: new capnp_ts_1.ObjectSize(0, 1) }; -Config._Services = capnp.CompositeList(Service); -Config._Sockets = capnp.CompositeList(Socket); -Config._Extensions = capnp.CompositeList(Extension); -Worker_Binding_WrappedBinding._InnerBindings = capnp.CompositeList(Worker_Binding); -Worker._Modules = capnp.CompositeList(Worker_Module); -Worker._Bindings = capnp.CompositeList(Worker_Binding); -Worker._DurableObjectNamespaces = capnp.CompositeList(Worker_DurableObjectNamespace); -HttpOptions._InjectRequestHeaders = capnp.CompositeList(HttpOptions_Header); -HttpOptions._InjectResponseHeaders = capnp.CompositeList(HttpOptions_Header); -Extension._Modules = capnp.CompositeList(Extension_Module); diff --git a/packages/miniflare/src/runtime/config/workerd.ts b/packages/miniflare/src/runtime/config/workerd.ts index 49a80b0c8a10..d1e43b455a15 100644 --- a/packages/miniflare/src/runtime/config/workerd.ts +++ b/packages/miniflare/src/runtime/config/workerd.ts @@ -1,15 +1,16 @@ -// TODO: auto-generate this file import type { HttpOptions_Style, TlsOptions_Version, Worker_Binding_CryptoKey_Usage, -} from "./workerd.capnp.js"; +} from "./generated"; + +// TODO: auto-generate this file export { HttpOptions_Style, TlsOptions_Version, Worker_Binding_CryptoKey_Usage, -} from "./workerd.capnp.js"; +} from "./generated"; export const kVoid = Symbol("kVoid"); export type Void = typeof kVoid; diff --git a/packages/miniflare/src/workers/core/devalue.ts b/packages/miniflare/src/workers/core/devalue.ts index df98359da315..495b0fdf32b9 100644 --- a/packages/miniflare/src/workers/core/devalue.ts +++ b/packages/miniflare/src/workers/core/devalue.ts @@ -20,7 +20,7 @@ export type ReducerReviver = (value: unknown) => unknown; export type ReducersRevivers = Record; const ALLOWED_ARRAY_BUFFER_VIEW_CONSTRUCTORS = [ - DataView, + DataView, Int8Array, Uint8Array, Uint8ClampedArray, @@ -95,7 +95,7 @@ export const structuredSerializableRevivers: ReducersRevivers = { assert(ALLOWED_ARRAY_BUFFER_VIEW_CONSTRUCTORS.includes(ctor)); let length = byteLength; if ("BYTES_PER_ELEMENT" in ctor) length /= ctor.BYTES_PER_ELEMENT; - return new ctor(buffer, byteOffset, length); + return new ctor(buffer as ArrayBuffer, byteOffset, length); }, Error(value) { assert(Array.isArray(value)); diff --git a/packages/miniflare/src/workers/shared/data.ts b/packages/miniflare/src/workers/shared/data.ts index 3ad1c764d885..864309c2d390 100644 --- a/packages/miniflare/src/workers/shared/data.ts +++ b/packages/miniflare/src/workers/shared/data.ts @@ -1,7 +1,10 @@ import { Buffer } from "node:buffer"; export function viewToBuffer(view: ArrayBufferView): ArrayBuffer { - return view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength); + return view.buffer.slice( + view.byteOffset, + view.byteOffset + view.byteLength + ) as ArrayBuffer; } export function base64Encode(value: string): string { diff --git a/packages/miniflare/test/http/fetch.spec.ts b/packages/miniflare/test/http/fetch.spec.ts index 1d2b70ef1202..4f71657a37d2 100644 --- a/packages/miniflare/test/http/fetch.spec.ts +++ b/packages/miniflare/test/http/fetch.spec.ts @@ -56,7 +56,7 @@ test("fetch: performs web socket upgrade", async (t) => { assert(webSocket); const eventPromise = new DeferredPromise(); - const messages: (string | ArrayBuffer)[] = []; + const messages: MessageEvent["data"][] = []; webSocket.addEventListener("message", (e) => { messages.push(e.data); if (e.data === "hello server") eventPromise.resolve(); diff --git a/packages/miniflare/test/http/websocket.spec.ts b/packages/miniflare/test/http/websocket.spec.ts index c7fcac21fbd6..cf0386d17f88 100644 --- a/packages/miniflare/test/http/websocket.spec.ts +++ b/packages/miniflare/test/http/websocket.spec.ts @@ -39,8 +39,8 @@ test("WebSocket: sends message to pair", async (t) => { webSocket1.accept(); webSocket2.accept(); - const messages1: (string | ArrayBuffer)[] = []; - const messages2: (string | ArrayBuffer)[] = []; + const messages1: MessageEvent["data"][] = []; + const messages2: MessageEvent["data"][] = []; webSocket1.addEventListener("message", (e) => messages1.push(e.data)); webSocket2.addEventListener("message", (e) => messages2.push(e.data)); @@ -64,8 +64,8 @@ test("WebSocket: must accept before sending", (t) => { test("WebSocket: queues messages if pair not accepted", async (t) => { const [webSocket1, webSocket2] = Object.values(new WebSocketPair()); - const messages1: (string | ArrayBuffer)[] = []; - const messages2: (string | ArrayBuffer)[] = []; + const messages1: MessageEvent["data"][] = []; + const messages2: MessageEvent["data"][] = []; webSocket1.addEventListener("message", (e) => messages1.push(e.data)); webSocket2.addEventListener("message", (e) => messages2.push(e.data)); @@ -112,8 +112,8 @@ test("WebSocket: queues closes if pair not accepted", async (t) => { test("WebSocket: discards sent message to pair if other side closed", async (t) => { const [webSocket1, webSocket2] = Object.values(new WebSocketPair()); - const messages1: (string | ArrayBuffer)[] = []; - const messages2: (string | ArrayBuffer)[] = []; + const messages1: MessageEvent["data"][] = []; + const messages2: MessageEvent["data"][] = []; webSocket1.addEventListener("message", (e) => messages1.push(e.data)); webSocket2.addEventListener("message", (e) => messages2.push(e.data)); diff --git a/packages/unenv-preset/src/runtime/node/module/index.ts b/packages/unenv-preset/src/runtime/node/module/index.ts index b50299f6b89f..8997d3110551 100644 --- a/packages/unenv-preset/src/runtime/node/module/index.ts +++ b/packages/unenv-preset/src/runtime/node/module/index.ts @@ -58,7 +58,7 @@ export { const workerdModule = process.getBuiltinModule("node:module"); export const createRequire: typeof nodeModule.createRequire = ( - file: string + file: string | URL ) => { return Object.assign(workerdModule.createRequire(file), { resolve: Object.assign(notImplemented("module.require.resolve"), { diff --git a/packages/vite-plugin-cloudflare/package.json b/packages/vite-plugin-cloudflare/package.json index e3a03c1c4a77..ed36f0d6148c 100644 --- a/packages/vite-plugin-cloudflare/package.json +++ b/packages/vite-plugin-cloudflare/package.json @@ -53,7 +53,7 @@ "@types/ws": "^8.5.13", "magic-string": "^0.30.12", "tsup": "8.3.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "workspace:*" }, diff --git a/packages/vite-plugin-cloudflare/playground/cloudflare-env/package.json b/packages/vite-plugin-cloudflare/playground/cloudflare-env/package.json index 19a882058946..90cd9e172792 100644 --- a/packages/vite-plugin-cloudflare/playground/cloudflare-env/package.json +++ b/packages/vite-plugin-cloudflare/playground/cloudflare-env/package.json @@ -15,7 +15,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/durable-objects/package.json b/packages/vite-plugin-cloudflare/playground/durable-objects/package.json index 9e9d11b2f9f3..d14e8e5d8c3f 100644 --- a/packages/vite-plugin-cloudflare/playground/durable-objects/package.json +++ b/packages/vite-plugin-cloudflare/playground/durable-objects/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/external-durable-objects/package.json b/packages/vite-plugin-cloudflare/playground/external-durable-objects/package.json index 6e935ffb811c..a1c71084fc54 100644 --- a/packages/vite-plugin-cloudflare/playground/external-durable-objects/package.json +++ b/packages/vite-plugin-cloudflare/playground/external-durable-objects/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/external-workflows/package.json b/packages/vite-plugin-cloudflare/playground/external-workflows/package.json index 1e34eedce91a..c77ea8890fdf 100644 --- a/packages/vite-plugin-cloudflare/playground/external-workflows/package.json +++ b/packages/vite-plugin-cloudflare/playground/external-workflows/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/hot-channel/package.json b/packages/vite-plugin-cloudflare/playground/hot-channel/package.json index 1da190a2b090..2837fa8bdd02 100644 --- a/packages/vite-plugin-cloudflare/playground/hot-channel/package.json +++ b/packages/vite-plugin-cloudflare/playground/hot-channel/package.json @@ -11,7 +11,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/module-resolution/package.json b/packages/vite-plugin-cloudflare/playground/module-resolution/package.json index 1a313e4625d8..45e69ed0ba41 100644 --- a/packages/vite-plugin-cloudflare/playground/module-resolution/package.json +++ b/packages/vite-plugin-cloudflare/playground/module-resolution/package.json @@ -22,7 +22,7 @@ "discord-api-types": "0.37.98", "react": "18.3.1", "slash-create": "6.2.1", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/multi-worker/package.json b/packages/vite-plugin-cloudflare/playground/multi-worker/package.json index 63d1a668312c..f49a3f50d086 100644 --- a/packages/vite-plugin-cloudflare/playground/multi-worker/package.json +++ b/packages/vite-plugin-cloudflare/playground/multi-worker/package.json @@ -17,7 +17,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/node-compat/package.json b/packages/vite-plugin-cloudflare/playground/node-compat/package.json index 493c9634d239..cd2dd14208b3 100644 --- a/packages/vite-plugin-cloudflare/playground/node-compat/package.json +++ b/packages/vite-plugin-cloudflare/playground/node-compat/package.json @@ -40,7 +40,7 @@ "cross-fetch": "^4.0.0", "pg": "^8.13.0", "pg-cloudflare": "^1.1.1", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/package.json b/packages/vite-plugin-cloudflare/playground/package.json index c651b7c51fe6..4fb6091f8f96 100644 --- a/packages/vite-plugin-cloudflare/playground/package.json +++ b/packages/vite-plugin-cloudflare/playground/package.json @@ -14,6 +14,6 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "playwright-chromium": "^1.48.1", - "typescript": "catalog:vite-plugin" + "typescript": "catalog:default" } } diff --git a/packages/vite-plugin-cloudflare/playground/react-spa/package.json b/packages/vite-plugin-cloudflare/playground/react-spa/package.json index 2f24108f23c2..4ec2b0af26e4 100644 --- a/packages/vite-plugin-cloudflare/playground/react-spa/package.json +++ b/packages/vite-plugin-cloudflare/playground/react-spa/package.json @@ -19,7 +19,7 @@ "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", "@vitejs/plugin-react": "^4.3.4", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json b/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json index cf8a7b2fc35b..14120bc43f90 100644 --- a/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json +++ b/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json @@ -21,7 +21,7 @@ "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", "@vitejs/plugin-react": "^4.3.4", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/static-mpa/package.json b/packages/vite-plugin-cloudflare/playground/static-mpa/package.json index 6b02b5fa6813..a30aa0591c3c 100644 --- a/packages/vite-plugin-cloudflare/playground/static-mpa/package.json +++ b/packages/vite-plugin-cloudflare/playground/static-mpa/package.json @@ -15,7 +15,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/virtual-modules/package.json b/packages/vite-plugin-cloudflare/playground/virtual-modules/package.json index 74231aadb8c2..ae20b3ce2cf3 100644 --- a/packages/vite-plugin-cloudflare/playground/virtual-modules/package.json +++ b/packages/vite-plugin-cloudflare/playground/virtual-modules/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/websockets/package.json b/packages/vite-plugin-cloudflare/playground/websockets/package.json index 136f2eeab6f8..c9bc2b1abdbf 100644 --- a/packages/vite-plugin-cloudflare/playground/websockets/package.json +++ b/packages/vite-plugin-cloudflare/playground/websockets/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/worker/package.json b/packages/vite-plugin-cloudflare/playground/worker/package.json index bd79f070f737..1e811452856a 100644 --- a/packages/vite-plugin-cloudflare/playground/worker/package.json +++ b/packages/vite-plugin-cloudflare/playground/worker/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vite-plugin-cloudflare/playground/workflows/package.json b/packages/vite-plugin-cloudflare/playground/workflows/package.json index 2382e18c4087..a7c687887a2f 100644 --- a/packages/vite-plugin-cloudflare/playground/workflows/package.json +++ b/packages/vite-plugin-cloudflare/playground/workflows/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20250121.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/packages/vitest-pool-workers/package.json b/packages/vitest-pool-workers/package.json index 8223a48317e4..364eaab8a6c7 100644 --- a/packages/vitest-pool-workers/package.json +++ b/packages/vitest-pool-workers/package.json @@ -44,7 +44,7 @@ ], "scripts": { "build": "node scripts/bundle.mjs && tsc -p tsconfig.emit.json", - "capnp:rtti": "capnpc -o ts scripts/rtti/rtti.capnp", + "capnp:rtti": "node scripts/build-capnp.mjs", "check:lint": "eslint . --max-warnings=0", "check:type": "tsc && tsc -p src/worker/tsconfig.json && tsc -p types/tsconfig.json", "dev": "node scripts/bundle.mjs watch", @@ -69,8 +69,7 @@ "@types/semver": "^7.5.1", "@vitest/runner": "catalog:default", "@vitest/snapshot": "catalog:default", - "capnp-ts": "^0.7.0", - "capnpc-ts": "^0.7.0", + "capnp-es": "^0.0.7", "ts-dedent": "^2.2.0", "typescript": "catalog:default", "undici": "catalog:default", diff --git a/packages/vitest-pool-workers/scripts/build-capnp.mjs b/packages/vitest-pool-workers/scripts/build-capnp.mjs new file mode 100644 index 000000000000..f760a55edbd3 --- /dev/null +++ b/packages/vitest-pool-workers/scripts/build-capnp.mjs @@ -0,0 +1,10 @@ +import { execSync, spawnSync } from "node:child_process"; +import { rmSync } from "node:fs"; + +// TODO (someday): Figure out why the dts and js generators fail on rtti.capnp files +execSync("capnp-es scripts/rtti/rtti.capnp -ots"); + +spawnSync( + "esbuild --bundle --platform=node scripts/rtti/rtti.ts --outfile=scripts/rtti/rtti.js" +); +rmSync("scripts/rtti/rtti.ts"); diff --git a/packages/vitest-pool-workers/scripts/rtti/query.mjs b/packages/vitest-pool-workers/scripts/rtti/query.mjs index 41dd03a6f27e..9dd2983c2100 100644 --- a/packages/vitest-pool-workers/scripts/rtti/query.mjs +++ b/packages/vitest-pool-workers/scripts/rtti/query.mjs @@ -1,6 +1,6 @@ -import { Message } from "capnp-ts"; +import { Message } from "capnp-es"; import { Miniflare } from "miniflare"; -import { StructureGroups } from "./rtti.capnp.js"; +import { StructureGroups } from "./rtti.js"; // Extract RTTI from `workerd` const mf = new Miniflare({ @@ -23,18 +23,19 @@ await mf.dispose(); // Parse RTTI const message = new Message(buffer, /* packed */ false); + const root = message.getRoot(StructureGroups); const structures = new Map(); -root.getGroups().forEach((group) => { - group.getStructures().forEach((structure) => { - structures.set(structure.getFullyQualifiedName(), structure); +root.groups.forEach((group) => { + group.structures.forEach((structure) => { + structures.set(structure.fullyQualifiedName, structure); }); }); // Get built-in modules list const builtinModuleNames = new Set(); -root.getModules().forEach((module) => { - builtinModuleNames.add(module.getSpecifier()); +root.modules.forEach((module) => { + builtinModuleNames.add(module.specifier); }); // TODO(soon): remove this line once `exportTypes()` supports compatibility // flags that require `--experimental` (e.g. "unsafe_module") diff --git a/packages/vitest-pool-workers/scripts/rtti/rtti.capnp b/packages/vitest-pool-workers/scripts/rtti/rtti.capnp index 59dc95a8a86c..9416aec5b526 100644 --- a/packages/vitest-pool-workers/scripts/rtti/rtti.capnp +++ b/packages/vitest-pool-workers/scripts/rtti/rtti.capnp @@ -7,6 +7,7 @@ using Cxx = import "/capnp/c++.capnp"; $Cxx.namespace("workerd::jsg::rtti"); +$Cxx.allowCancellation; # TODO: I can't figure out how to make both capnpc-ts and capnpc-cpp generators to see this import # without code changes. capnpc-ts code is weird: # https://github.com/jdiaz5513/capnp-ts/blob/master/packages/capnpc-ts/src/generators.ts#L92 @@ -211,6 +212,16 @@ struct Structure { asyncIterator @7 :Method; # Method returning async iterator if the structure is async iterable + disposable @13 :Bool; + # true if the structure is disposable + dispose @14 :Method; + # dispose method + + asyncDisposable @15 :Bool; + # true if the structure is async disposable + asyncDispose @16 :Method; + # asyncDispose method + tsRoot @8 :Bool; # See `JSG_TS_ROOT`'s documentation in the `## TypeScript` section of the JSG README.md. # If `JSG_(STRUCT_)TS_ROOT` is declared for a type, this value will be `true`. diff --git a/packages/vitest-pool-workers/scripts/rtti/rtti.capnp.d.ts b/packages/vitest-pool-workers/scripts/rtti/rtti.capnp.d.ts deleted file mode 100644 index d1d3072cba03..000000000000 --- a/packages/vitest-pool-workers/scripts/rtti/rtti.capnp.d.ts +++ /dev/null @@ -1,614 +0,0 @@ -/** - * This file has been automatically generated by the [capnpc-ts utility](https://github.com/jdiaz5513/capnp-ts). - */ -import * as capnp from "capnp-ts"; -import { Struct as __S } from 'capnp-ts'; -export declare const _capnpFileId = "b042d6da9e1721ad"; -export declare enum Type_Which { - UNKNOWN = 0, - VOIDT = 1, - BOOLT = 2, - NUMBER = 3, - PROMISE = 4, - STRUCTURE = 5, - STRING = 6, - OBJECT = 7, - ARRAY = 8, - MAYBE = 9, - DICT = 10, - ONE_OF = 11, - BUILTIN = 12, - INTRINSIC = 13, - FUNCTION = 14, - JSG_IMPL = 15, - JS_BUILTIN = 16 -} -export declare class Type extends __S { - static readonly UNKNOWN = Type_Which.UNKNOWN; - static readonly VOIDT = Type_Which.VOIDT; - static readonly BOOLT = Type_Which.BOOLT; - static readonly NUMBER = Type_Which.NUMBER; - static readonly PROMISE = Type_Which.PROMISE; - static readonly STRUCTURE = Type_Which.STRUCTURE; - static readonly STRING = Type_Which.STRING; - static readonly OBJECT = Type_Which.OBJECT; - static readonly ARRAY = Type_Which.ARRAY; - static readonly MAYBE = Type_Which.MAYBE; - static readonly DICT = Type_Which.DICT; - static readonly ONE_OF = Type_Which.ONE_OF; - static readonly BUILTIN = Type_Which.BUILTIN; - static readonly INTRINSIC = Type_Which.INTRINSIC; - static readonly FUNCTION = Type_Which.FUNCTION; - static readonly JSG_IMPL = Type_Which.JSG_IMPL; - static readonly JS_BUILTIN = Type_Which.JS_BUILTIN; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - isUnknown(): boolean; - setUnknown(): void; - isVoidt(): boolean; - setVoidt(): void; - isBoolt(): boolean; - setBoolt(): void; - adoptNumber(value: capnp.Orphan): void; - disownNumber(): capnp.Orphan; - getNumber(): NumberType; - hasNumber(): boolean; - initNumber(): NumberType; - isNumber(): boolean; - setNumber(value: NumberType): void; - adoptPromise(value: capnp.Orphan): void; - disownPromise(): capnp.Orphan; - getPromise(): PromiseType; - hasPromise(): boolean; - initPromise(): PromiseType; - isPromise(): boolean; - setPromise(value: PromiseType): void; - adoptStructure(value: capnp.Orphan): void; - disownStructure(): capnp.Orphan; - getStructure(): StructureType; - hasStructure(): boolean; - initStructure(): StructureType; - isStructure(): boolean; - setStructure(value: StructureType): void; - adoptString(value: capnp.Orphan): void; - disownString(): capnp.Orphan; - getString(): StringType; - hasString(): boolean; - initString(): StringType; - isString(): boolean; - setString(value: StringType): void; - isObject(): boolean; - setObject(): void; - adoptArray(value: capnp.Orphan): void; - disownArray(): capnp.Orphan; - getArray(): ArrayType; - hasArray(): boolean; - initArray(): ArrayType; - isArray(): boolean; - setArray(value: ArrayType): void; - adoptMaybe(value: capnp.Orphan): void; - disownMaybe(): capnp.Orphan; - getMaybe(): MaybeType; - hasMaybe(): boolean; - initMaybe(): MaybeType; - isMaybe(): boolean; - setMaybe(value: MaybeType): void; - adoptDict(value: capnp.Orphan): void; - disownDict(): capnp.Orphan; - getDict(): DictType; - hasDict(): boolean; - initDict(): DictType; - isDict(): boolean; - setDict(value: DictType): void; - adoptOneOf(value: capnp.Orphan): void; - disownOneOf(): capnp.Orphan; - getOneOf(): OneOfType; - hasOneOf(): boolean; - initOneOf(): OneOfType; - isOneOf(): boolean; - setOneOf(value: OneOfType): void; - adoptBuiltin(value: capnp.Orphan): void; - disownBuiltin(): capnp.Orphan; - getBuiltin(): BuiltinType; - hasBuiltin(): boolean; - initBuiltin(): BuiltinType; - isBuiltin(): boolean; - setBuiltin(value: BuiltinType): void; - adoptIntrinsic(value: capnp.Orphan): void; - disownIntrinsic(): capnp.Orphan; - getIntrinsic(): IntrinsicType; - hasIntrinsic(): boolean; - initIntrinsic(): IntrinsicType; - isIntrinsic(): boolean; - setIntrinsic(value: IntrinsicType): void; - adoptFunction(value: capnp.Orphan): void; - disownFunction(): capnp.Orphan; - getFunction(): FunctionType; - hasFunction(): boolean; - initFunction(): FunctionType; - isFunction(): boolean; - setFunction(value: FunctionType): void; - adoptJsgImpl(value: capnp.Orphan): void; - disownJsgImpl(): capnp.Orphan; - getJsgImpl(): JsgImplType; - hasJsgImpl(): boolean; - initJsgImpl(): JsgImplType; - isJsgImpl(): boolean; - setJsgImpl(value: JsgImplType): void; - adoptJsBuiltin(value: capnp.Orphan): void; - disownJsBuiltin(): capnp.Orphan; - getJsBuiltin(): JsBuiltinType; - hasJsBuiltin(): boolean; - initJsBuiltin(): JsBuiltinType; - isJsBuiltin(): boolean; - setJsBuiltin(value: JsBuiltinType): void; - toString(): string; - which(): Type_Which; -} -export declare class NumberType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - toString(): string; -} -export declare class PromiseType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptValue(value: capnp.Orphan): void; - disownValue(): capnp.Orphan; - getValue(): Type; - hasValue(): boolean; - initValue(): Type; - setValue(value: Type): void; - toString(): string; -} -export declare class StructureType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - getFullyQualifiedName(): string; - setFullyQualifiedName(value: string): void; - toString(): string; -} -export declare class StringType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - toString(): string; -} -export declare class IntrinsicType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - toString(): string; -} -export declare class ArrayType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptElement(value: capnp.Orphan): void; - disownElement(): capnp.Orphan; - getElement(): Type; - hasElement(): boolean; - initElement(): Type; - setElement(value: Type): void; - getName(): string; - setName(value: string): void; - toString(): string; -} -export declare class MaybeType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptValue(value: capnp.Orphan): void; - disownValue(): capnp.Orphan; - getValue(): Type; - hasValue(): boolean; - initValue(): Type; - setValue(value: Type): void; - getName(): string; - setName(value: string): void; - toString(): string; -} -export declare class DictType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptKey(value: capnp.Orphan): void; - disownKey(): capnp.Orphan; - getKey(): Type; - hasKey(): boolean; - initKey(): Type; - setKey(value: Type): void; - adoptValue(value: capnp.Orphan): void; - disownValue(): capnp.Orphan; - getValue(): Type; - hasValue(): boolean; - initValue(): Type; - setValue(value: Type): void; - toString(): string; -} -export declare class OneOfType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Variants: capnp.ListCtor; - adoptVariants(value: capnp.Orphan>): void; - disownVariants(): capnp.Orphan>; - getVariants(): capnp.List; - hasVariants(): boolean; - initVariants(length: number): capnp.List; - setVariants(value: capnp.List): void; - toString(): string; -} -export declare enum BuiltinType_Type { - V8UINT8ARRAY = 0, - V8ARRAY_BUFFER_VIEW = 1, - JSG_BUFFER_SOURCE = 2, - KJ_DATE = 3, - V8FUNCTION = 4, - V8ARRAY_BUFFER = 5 -} -export declare class BuiltinType extends __S { - static readonly Type: typeof BuiltinType_Type; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getType(): BuiltinType_Type; - setType(value: BuiltinType_Type): void; - toString(): string; -} -export declare class FunctionType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Args: capnp.ListCtor; - adoptReturnType(value: capnp.Orphan): void; - disownReturnType(): capnp.Orphan; - getReturnType(): Type; - hasReturnType(): boolean; - initReturnType(): Type; - setReturnType(value: Type): void; - adoptArgs(value: capnp.Orphan>): void; - disownArgs(): capnp.Orphan>; - getArgs(): capnp.List; - hasArgs(): boolean; - initArgs(length: number): capnp.List; - setArgs(value: capnp.List): void; - toString(): string; -} -export declare enum JsgImplType_Type { - CONFIGURATION = 0, - V8ISOLATE = 1, - JSG_LOCK = 2, - JSG_TYPE_HANDLER = 3, - JSG_UNIMPLEMENTED = 4, - JSG_VARARGS = 5, - JSG_SELF_REF = 6, - V8FUNCTION_CALLBACK_INFO = 7, - V8PROPERTY_CALLBACK_INFO = 8, - JSG_NAME = 9 -} -export declare class JsgImplType extends __S { - static readonly Type: typeof JsgImplType_Type; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getType(): JsgImplType_Type; - setType(value: JsgImplType_Type): void; - toString(): string; -} -export declare class Structure extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Members: capnp.ListCtor; - static _BuiltinModules: capnp.ListCtor; - getName(): string; - setName(value: string): void; - getFullyQualifiedName(): string; - setFullyQualifiedName(value: string): void; - adoptMembers(value: capnp.Orphan>): void; - disownMembers(): capnp.Orphan>; - getMembers(): capnp.List; - hasMembers(): boolean; - initMembers(length: number): capnp.List; - setMembers(value: capnp.List): void; - adoptExtends(value: capnp.Orphan): void; - disownExtends(): capnp.Orphan; - getExtends(): Type; - hasExtends(): boolean; - initExtends(): Type; - setExtends(value: Type): void; - getIterable(): boolean; - setIterable(value: boolean): void; - adoptIterator(value: capnp.Orphan): void; - disownIterator(): capnp.Orphan; - getIterator(): Method; - hasIterator(): boolean; - initIterator(): Method; - setIterator(value: Method): void; - getAsyncIterable(): boolean; - setAsyncIterable(value: boolean): void; - adoptAsyncIterator(value: capnp.Orphan): void; - disownAsyncIterator(): capnp.Orphan; - getAsyncIterator(): Method; - hasAsyncIterator(): boolean; - initAsyncIterator(): Method; - setAsyncIterator(value: Method): void; - getTsRoot(): boolean; - setTsRoot(value: boolean): void; - getTsOverride(): string; - setTsOverride(value: string): void; - getTsDefine(): string; - setTsDefine(value: string): void; - adoptCallable(value: capnp.Orphan): void; - disownCallable(): capnp.Orphan; - getCallable(): FunctionType; - hasCallable(): boolean; - initCallable(): FunctionType; - setCallable(value: FunctionType): void; - adoptBuiltinModules(value: capnp.Orphan>): void; - disownBuiltinModules(): capnp.Orphan>; - getBuiltinModules(): capnp.List; - hasBuiltinModules(): boolean; - initBuiltinModules(length: number): capnp.List; - setBuiltinModules(value: capnp.List): void; - toString(): string; -} -export declare class Member_Nested extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptStructure(value: capnp.Orphan): void; - disownStructure(): capnp.Orphan; - getStructure(): Structure; - hasStructure(): boolean; - initStructure(): Structure; - setStructure(value: Structure): void; - getName(): string; - setName(value: string): void; - toString(): string; -} -export declare enum Member_Which { - METHOD = 0, - PROPERTY = 1, - NESTED = 2, - CONSTANT = 3, - CONSTRUCTOR = 4 -} -export declare class Member extends __S { - static readonly METHOD = Member_Which.METHOD; - static readonly PROPERTY = Member_Which.PROPERTY; - static readonly NESTED = Member_Which.NESTED; - static readonly CONSTANT = Member_Which.CONSTANT; - static readonly CONSTRUCTOR = Member_Which.CONSTRUCTOR; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - adoptMethod(value: capnp.Orphan): void; - disownMethod(): capnp.Orphan; - getMethod(): Method; - hasMethod(): boolean; - initMethod(): Method; - isMethod(): boolean; - setMethod(value: Method): void; - adoptProperty(value: capnp.Orphan): void; - disownProperty(): capnp.Orphan; - getProperty(): Property; - hasProperty(): boolean; - initProperty(): Property; - isProperty(): boolean; - setProperty(value: Property): void; - getNested(): Member_Nested; - initNested(): Member_Nested; - isNested(): boolean; - setNested(): void; - adoptConstant(value: capnp.Orphan): void; - disownConstant(): capnp.Orphan; - getConstant(): Constant; - hasConstant(): boolean; - initConstant(): Constant; - isConstant(): boolean; - setConstant(value: Constant): void; - adoptConstructor(value: capnp.Orphan): void; - disownConstructor(): capnp.Orphan; - getConstructor(): Constructor; - hasConstructor(): boolean; - initConstructor(): Constructor; - isConstructor(): boolean; - setConstructor(value: Constructor): void; - toString(): string; - which(): Member_Which; -} -export declare class Method extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Args: capnp.ListCtor; - getName(): string; - setName(value: string): void; - adoptReturnType(value: capnp.Orphan): void; - disownReturnType(): capnp.Orphan; - getReturnType(): Type; - hasReturnType(): boolean; - initReturnType(): Type; - setReturnType(value: Type): void; - adoptArgs(value: capnp.Orphan>): void; - disownArgs(): capnp.Orphan>; - getArgs(): capnp.List; - hasArgs(): boolean; - initArgs(length: number): capnp.List; - setArgs(value: capnp.List): void; - getStatic(): boolean; - setStatic(value: boolean): void; - toString(): string; -} -export declare class Property extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - adoptType(value: capnp.Orphan): void; - disownType(): capnp.Orphan; - getType(): Type; - hasType(): boolean; - initType(): Type; - setType(value: Type): void; - getReadonly(): boolean; - setReadonly(value: boolean): void; - getLazy(): boolean; - setLazy(value: boolean): void; - getPrototype(): boolean; - setPrototype(value: boolean): void; - toString(): string; -} -export declare class Constant extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getName(): string; - setName(value: string): void; - getValue(): capnp.Int64; - setValue(value: capnp.Int64): void; - toString(): string; -} -export declare class Constructor extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Args: capnp.ListCtor; - adoptArgs(value: capnp.Orphan>): void; - disownArgs(): capnp.Orphan>; - getArgs(): capnp.List; - hasArgs(): boolean; - initArgs(length: number): capnp.List; - setArgs(value: capnp.List): void; - toString(): string; -} -export declare enum Module_Which { - STRUCTURE_NAME = 0, - TS_DECLARATIONS = 1 -} -export declare class Module extends __S { - static readonly STRUCTURE_NAME = Module_Which.STRUCTURE_NAME; - static readonly TS_DECLARATIONS = Module_Which.TS_DECLARATIONS; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getSpecifier(): string; - setSpecifier(value: string): void; - getStructureName(): string; - isStructureName(): boolean; - setStructureName(value: string): void; - getTsDeclarations(): string; - isTsDeclarations(): boolean; - setTsDeclarations(value: string): void; - toString(): string; - which(): Module_Which; -} -export declare class StructureGroups_StructureGroup extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Structures: capnp.ListCtor; - getName(): string; - setName(value: string): void; - adoptStructures(value: capnp.Orphan>): void; - disownStructures(): capnp.Orphan>; - getStructures(): capnp.List; - hasStructures(): boolean; - initStructures(length: number): capnp.List; - setStructures(value: capnp.List): void; - toString(): string; -} -export declare class StructureGroups extends __S { - static readonly StructureGroup: typeof StructureGroups_StructureGroup; - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - static _Groups: capnp.ListCtor; - static _Modules: capnp.ListCtor; - adoptGroups(value: capnp.Orphan>): void; - disownGroups(): capnp.Orphan>; - getGroups(): capnp.List; - hasGroups(): boolean; - initGroups(length: number): capnp.List; - setGroups(value: capnp.List): void; - adoptModules(value: capnp.Orphan>): void; - disownModules(): capnp.Orphan>; - getModules(): capnp.List; - hasModules(): boolean; - initModules(length: number): capnp.List; - setModules(value: capnp.List): void; - toString(): string; -} -export declare class JsBuiltinType extends __S { - static readonly _capnp: { - displayName: string; - id: string; - size: capnp.ObjectSize; - }; - getModule(): string; - setModule(value: string): void; - getExport(): string; - setExport(value: string): void; - toString(): string; -} diff --git a/packages/vitest-pool-workers/scripts/rtti/rtti.capnp.js b/packages/vitest-pool-workers/scripts/rtti/rtti.capnp.js deleted file mode 100644 index 94e8b0acaec6..000000000000 --- a/packages/vitest-pool-workers/scripts/rtti/rtti.capnp.js +++ /dev/null @@ -1,773 +0,0 @@ -"use strict"; -/* tslint:disable */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JsBuiltinType = exports.StructureGroups = exports.StructureGroups_StructureGroup = exports.Module = exports.Module_Which = exports.Constructor = exports.Constant = exports.Property = exports.Method = exports.Member = exports.Member_Which = exports.Member_Nested = exports.Structure = exports.JsgImplType = exports.JsgImplType_Type = exports.FunctionType = exports.BuiltinType = exports.BuiltinType_Type = exports.OneOfType = exports.DictType = exports.MaybeType = exports.ArrayType = exports.IntrinsicType = exports.StringType = exports.StructureType = exports.PromiseType = exports.NumberType = exports.Type = exports.Type_Which = exports._capnpFileId = void 0; -/** - * This file has been automatically generated by the [capnpc-ts utility](https://github.com/jdiaz5513/capnp-ts). - */ -const capnp = require("capnp-ts"); -const capnp_ts_1 = require("capnp-ts"); -exports._capnpFileId = "b042d6da9e1721ad"; -var Type_Which; -(function (Type_Which) { - Type_Which[Type_Which["UNKNOWN"] = 0] = "UNKNOWN"; - Type_Which[Type_Which["VOIDT"] = 1] = "VOIDT"; - Type_Which[Type_Which["BOOLT"] = 2] = "BOOLT"; - Type_Which[Type_Which["NUMBER"] = 3] = "NUMBER"; - Type_Which[Type_Which["PROMISE"] = 4] = "PROMISE"; - Type_Which[Type_Which["STRUCTURE"] = 5] = "STRUCTURE"; - Type_Which[Type_Which["STRING"] = 6] = "STRING"; - Type_Which[Type_Which["OBJECT"] = 7] = "OBJECT"; - Type_Which[Type_Which["ARRAY"] = 8] = "ARRAY"; - Type_Which[Type_Which["MAYBE"] = 9] = "MAYBE"; - Type_Which[Type_Which["DICT"] = 10] = "DICT"; - Type_Which[Type_Which["ONE_OF"] = 11] = "ONE_OF"; - Type_Which[Type_Which["BUILTIN"] = 12] = "BUILTIN"; - Type_Which[Type_Which["INTRINSIC"] = 13] = "INTRINSIC"; - Type_Which[Type_Which["FUNCTION"] = 14] = "FUNCTION"; - Type_Which[Type_Which["JSG_IMPL"] = 15] = "JSG_IMPL"; - Type_Which[Type_Which["JS_BUILTIN"] = 16] = "JS_BUILTIN"; -})(Type_Which = exports.Type_Which || (exports.Type_Which = {})); -class Type extends capnp_ts_1.Struct { - isUnknown() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setUnknown() { capnp_ts_1.Struct.setUint16(0, 0, this); } - isVoidt() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setVoidt() { capnp_ts_1.Struct.setUint16(0, 1, this); } - isBoolt() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setBoolt() { capnp_ts_1.Struct.setUint16(0, 2, this); } - adoptNumber(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownNumber() { return capnp_ts_1.Struct.disown(this.getNumber()); } - getNumber() { - capnp_ts_1.Struct.testWhich("number", capnp_ts_1.Struct.getUint16(0, this), 3, this); - return capnp_ts_1.Struct.getStruct(0, NumberType, this); - } - hasNumber() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initNumber() { - capnp_ts_1.Struct.setUint16(0, 3, this); - return capnp_ts_1.Struct.initStructAt(0, NumberType, this); - } - isNumber() { return capnp_ts_1.Struct.getUint16(0, this) === 3; } - setNumber(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptPromise(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownPromise() { return capnp_ts_1.Struct.disown(this.getPromise()); } - getPromise() { - capnp_ts_1.Struct.testWhich("promise", capnp_ts_1.Struct.getUint16(0, this), 4, this); - return capnp_ts_1.Struct.getStruct(0, PromiseType, this); - } - hasPromise() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initPromise() { - capnp_ts_1.Struct.setUint16(0, 4, this); - return capnp_ts_1.Struct.initStructAt(0, PromiseType, this); - } - isPromise() { return capnp_ts_1.Struct.getUint16(0, this) === 4; } - setPromise(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptStructure(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownStructure() { return capnp_ts_1.Struct.disown(this.getStructure()); } - getStructure() { - capnp_ts_1.Struct.testWhich("structure", capnp_ts_1.Struct.getUint16(0, this), 5, this); - return capnp_ts_1.Struct.getStruct(0, StructureType, this); - } - hasStructure() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initStructure() { - capnp_ts_1.Struct.setUint16(0, 5, this); - return capnp_ts_1.Struct.initStructAt(0, StructureType, this); - } - isStructure() { return capnp_ts_1.Struct.getUint16(0, this) === 5; } - setStructure(value) { - capnp_ts_1.Struct.setUint16(0, 5, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptString(value) { - capnp_ts_1.Struct.setUint16(0, 6, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownString() { return capnp_ts_1.Struct.disown(this.getString()); } - getString() { - capnp_ts_1.Struct.testWhich("string", capnp_ts_1.Struct.getUint16(0, this), 6, this); - return capnp_ts_1.Struct.getStruct(0, StringType, this); - } - hasString() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initString() { - capnp_ts_1.Struct.setUint16(0, 6, this); - return capnp_ts_1.Struct.initStructAt(0, StringType, this); - } - isString() { return capnp_ts_1.Struct.getUint16(0, this) === 6; } - setString(value) { - capnp_ts_1.Struct.setUint16(0, 6, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - isObject() { return capnp_ts_1.Struct.getUint16(0, this) === 7; } - setObject() { capnp_ts_1.Struct.setUint16(0, 7, this); } - adoptArray(value) { - capnp_ts_1.Struct.setUint16(0, 8, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownArray() { return capnp_ts_1.Struct.disown(this.getArray()); } - getArray() { - capnp_ts_1.Struct.testWhich("array", capnp_ts_1.Struct.getUint16(0, this), 8, this); - return capnp_ts_1.Struct.getStruct(0, ArrayType, this); - } - hasArray() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initArray() { - capnp_ts_1.Struct.setUint16(0, 8, this); - return capnp_ts_1.Struct.initStructAt(0, ArrayType, this); - } - isArray() { return capnp_ts_1.Struct.getUint16(0, this) === 8; } - setArray(value) { - capnp_ts_1.Struct.setUint16(0, 8, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptMaybe(value) { - capnp_ts_1.Struct.setUint16(0, 9, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownMaybe() { return capnp_ts_1.Struct.disown(this.getMaybe()); } - getMaybe() { - capnp_ts_1.Struct.testWhich("maybe", capnp_ts_1.Struct.getUint16(0, this), 9, this); - return capnp_ts_1.Struct.getStruct(0, MaybeType, this); - } - hasMaybe() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initMaybe() { - capnp_ts_1.Struct.setUint16(0, 9, this); - return capnp_ts_1.Struct.initStructAt(0, MaybeType, this); - } - isMaybe() { return capnp_ts_1.Struct.getUint16(0, this) === 9; } - setMaybe(value) { - capnp_ts_1.Struct.setUint16(0, 9, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptDict(value) { - capnp_ts_1.Struct.setUint16(0, 10, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownDict() { return capnp_ts_1.Struct.disown(this.getDict()); } - getDict() { - capnp_ts_1.Struct.testWhich("dict", capnp_ts_1.Struct.getUint16(0, this), 10, this); - return capnp_ts_1.Struct.getStruct(0, DictType, this); - } - hasDict() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initDict() { - capnp_ts_1.Struct.setUint16(0, 10, this); - return capnp_ts_1.Struct.initStructAt(0, DictType, this); - } - isDict() { return capnp_ts_1.Struct.getUint16(0, this) === 10; } - setDict(value) { - capnp_ts_1.Struct.setUint16(0, 10, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptOneOf(value) { - capnp_ts_1.Struct.setUint16(0, 11, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownOneOf() { return capnp_ts_1.Struct.disown(this.getOneOf()); } - getOneOf() { - capnp_ts_1.Struct.testWhich("oneOf", capnp_ts_1.Struct.getUint16(0, this), 11, this); - return capnp_ts_1.Struct.getStruct(0, OneOfType, this); - } - hasOneOf() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initOneOf() { - capnp_ts_1.Struct.setUint16(0, 11, this); - return capnp_ts_1.Struct.initStructAt(0, OneOfType, this); - } - isOneOf() { return capnp_ts_1.Struct.getUint16(0, this) === 11; } - setOneOf(value) { - capnp_ts_1.Struct.setUint16(0, 11, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptBuiltin(value) { - capnp_ts_1.Struct.setUint16(0, 12, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownBuiltin() { return capnp_ts_1.Struct.disown(this.getBuiltin()); } - getBuiltin() { - capnp_ts_1.Struct.testWhich("builtin", capnp_ts_1.Struct.getUint16(0, this), 12, this); - return capnp_ts_1.Struct.getStruct(0, BuiltinType, this); - } - hasBuiltin() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initBuiltin() { - capnp_ts_1.Struct.setUint16(0, 12, this); - return capnp_ts_1.Struct.initStructAt(0, BuiltinType, this); - } - isBuiltin() { return capnp_ts_1.Struct.getUint16(0, this) === 12; } - setBuiltin(value) { - capnp_ts_1.Struct.setUint16(0, 12, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptIntrinsic(value) { - capnp_ts_1.Struct.setUint16(0, 13, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownIntrinsic() { return capnp_ts_1.Struct.disown(this.getIntrinsic()); } - getIntrinsic() { - capnp_ts_1.Struct.testWhich("intrinsic", capnp_ts_1.Struct.getUint16(0, this), 13, this); - return capnp_ts_1.Struct.getStruct(0, IntrinsicType, this); - } - hasIntrinsic() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initIntrinsic() { - capnp_ts_1.Struct.setUint16(0, 13, this); - return capnp_ts_1.Struct.initStructAt(0, IntrinsicType, this); - } - isIntrinsic() { return capnp_ts_1.Struct.getUint16(0, this) === 13; } - setIntrinsic(value) { - capnp_ts_1.Struct.setUint16(0, 13, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptFunction(value) { - capnp_ts_1.Struct.setUint16(0, 14, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownFunction() { return capnp_ts_1.Struct.disown(this.getFunction()); } - getFunction() { - capnp_ts_1.Struct.testWhich("function", capnp_ts_1.Struct.getUint16(0, this), 14, this); - return capnp_ts_1.Struct.getStruct(0, FunctionType, this); - } - hasFunction() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initFunction() { - capnp_ts_1.Struct.setUint16(0, 14, this); - return capnp_ts_1.Struct.initStructAt(0, FunctionType, this); - } - isFunction() { return capnp_ts_1.Struct.getUint16(0, this) === 14; } - setFunction(value) { - capnp_ts_1.Struct.setUint16(0, 14, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptJsgImpl(value) { - capnp_ts_1.Struct.setUint16(0, 15, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownJsgImpl() { return capnp_ts_1.Struct.disown(this.getJsgImpl()); } - getJsgImpl() { - capnp_ts_1.Struct.testWhich("jsgImpl", capnp_ts_1.Struct.getUint16(0, this), 15, this); - return capnp_ts_1.Struct.getStruct(0, JsgImplType, this); - } - hasJsgImpl() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initJsgImpl() { - capnp_ts_1.Struct.setUint16(0, 15, this); - return capnp_ts_1.Struct.initStructAt(0, JsgImplType, this); - } - isJsgImpl() { return capnp_ts_1.Struct.getUint16(0, this) === 15; } - setJsgImpl(value) { - capnp_ts_1.Struct.setUint16(0, 15, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptJsBuiltin(value) { - capnp_ts_1.Struct.setUint16(0, 16, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownJsBuiltin() { return capnp_ts_1.Struct.disown(this.getJsBuiltin()); } - getJsBuiltin() { - capnp_ts_1.Struct.testWhich("jsBuiltin", capnp_ts_1.Struct.getUint16(0, this), 16, this); - return capnp_ts_1.Struct.getStruct(0, JsBuiltinType, this); - } - hasJsBuiltin() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initJsBuiltin() { - capnp_ts_1.Struct.setUint16(0, 16, this); - return capnp_ts_1.Struct.initStructAt(0, JsBuiltinType, this); - } - isJsBuiltin() { return capnp_ts_1.Struct.getUint16(0, this) === 16; } - setJsBuiltin(value) { - capnp_ts_1.Struct.setUint16(0, 16, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - toString() { return "Type_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Type = Type; -Type.UNKNOWN = Type_Which.UNKNOWN; -Type.VOIDT = Type_Which.VOIDT; -Type.BOOLT = Type_Which.BOOLT; -Type.NUMBER = Type_Which.NUMBER; -Type.PROMISE = Type_Which.PROMISE; -Type.STRUCTURE = Type_Which.STRUCTURE; -Type.STRING = Type_Which.STRING; -Type.OBJECT = Type_Which.OBJECT; -Type.ARRAY = Type_Which.ARRAY; -Type.MAYBE = Type_Which.MAYBE; -Type.DICT = Type_Which.DICT; -Type.ONE_OF = Type_Which.ONE_OF; -Type.BUILTIN = Type_Which.BUILTIN; -Type.INTRINSIC = Type_Which.INTRINSIC; -Type.FUNCTION = Type_Which.FUNCTION; -Type.JSG_IMPL = Type_Which.JSG_IMPL; -Type.JS_BUILTIN = Type_Which.JS_BUILTIN; -Type._capnp = { displayName: "Type", id: "d2347ab301451a8c", size: new capnp_ts_1.ObjectSize(8, 1) }; -class NumberType extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - toString() { return "NumberType_" + super.toString(); } -} -exports.NumberType = NumberType; -NumberType._capnp = { displayName: "NumberType", id: "afd4316863bdd80a", size: new capnp_ts_1.ObjectSize(0, 1) }; -class PromiseType extends capnp_ts_1.Struct { - adoptValue(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownValue() { return capnp_ts_1.Struct.disown(this.getValue()); } - getValue() { return capnp_ts_1.Struct.getStruct(0, Type, this); } - hasValue() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initValue() { return capnp_ts_1.Struct.initStructAt(0, Type, this); } - setValue(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - toString() { return "PromiseType_" + super.toString(); } -} -exports.PromiseType = PromiseType; -PromiseType._capnp = { displayName: "PromiseType", id: "977eaa74d24bb2dc", size: new capnp_ts_1.ObjectSize(0, 1) }; -class StructureType extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getFullyQualifiedName() { return capnp_ts_1.Struct.getText(1, this); } - setFullyQualifiedName(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "StructureType_" + super.toString(); } -} -exports.StructureType = StructureType; -StructureType._capnp = { displayName: "StructureType", id: "9001b3522132305a", size: new capnp_ts_1.ObjectSize(0, 2) }; -class StringType extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - toString() { return "StringType_" + super.toString(); } -} -exports.StringType = StringType; -StringType._capnp = { displayName: "StringType", id: "913621db0713d640", size: new capnp_ts_1.ObjectSize(0, 1) }; -class IntrinsicType extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - toString() { return "IntrinsicType_" + super.toString(); } -} -exports.IntrinsicType = IntrinsicType; -IntrinsicType._capnp = { displayName: "IntrinsicType", id: "87c24648e89ccc02", size: new capnp_ts_1.ObjectSize(0, 1) }; -class ArrayType extends capnp_ts_1.Struct { - adoptElement(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownElement() { return capnp_ts_1.Struct.disown(this.getElement()); } - getElement() { return capnp_ts_1.Struct.getStruct(0, Type, this); } - hasElement() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initElement() { return capnp_ts_1.Struct.initStructAt(0, Type, this); } - setElement(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - getName() { return capnp_ts_1.Struct.getText(1, this); } - setName(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "ArrayType_" + super.toString(); } -} -exports.ArrayType = ArrayType; -ArrayType._capnp = { displayName: "ArrayType", id: "f6d86da0d225932b", size: new capnp_ts_1.ObjectSize(0, 2) }; -class MaybeType extends capnp_ts_1.Struct { - adoptValue(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownValue() { return capnp_ts_1.Struct.disown(this.getValue()); } - getValue() { return capnp_ts_1.Struct.getStruct(0, Type, this); } - hasValue() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initValue() { return capnp_ts_1.Struct.initStructAt(0, Type, this); } - setValue(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - getName() { return capnp_ts_1.Struct.getText(1, this); } - setName(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "MaybeType_" + super.toString(); } -} -exports.MaybeType = MaybeType; -MaybeType._capnp = { displayName: "MaybeType", id: "9d64649bff8a5cee", size: new capnp_ts_1.ObjectSize(0, 2) }; -class DictType extends capnp_ts_1.Struct { - adoptKey(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownKey() { return capnp_ts_1.Struct.disown(this.getKey()); } - getKey() { return capnp_ts_1.Struct.getStruct(0, Type, this); } - hasKey() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initKey() { return capnp_ts_1.Struct.initStructAt(0, Type, this); } - setKey(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - adoptValue(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownValue() { return capnp_ts_1.Struct.disown(this.getValue()); } - getValue() { return capnp_ts_1.Struct.getStruct(1, Type, this); } - hasValue() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initValue() { return capnp_ts_1.Struct.initStructAt(1, Type, this); } - setValue(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - toString() { return "DictType_" + super.toString(); } -} -exports.DictType = DictType; -DictType._capnp = { displayName: "DictType", id: "b7d8e1ee6205d554", size: new capnp_ts_1.ObjectSize(0, 2) }; -class OneOfType extends capnp_ts_1.Struct { - adoptVariants(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownVariants() { return capnp_ts_1.Struct.disown(this.getVariants()); } - getVariants() { return capnp_ts_1.Struct.getList(0, OneOfType._Variants, this); } - hasVariants() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initVariants(length) { return capnp_ts_1.Struct.initList(0, OneOfType._Variants, length, this); } - setVariants(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - toString() { return "OneOfType_" + super.toString(); } -} -exports.OneOfType = OneOfType; -OneOfType._capnp = { displayName: "OneOfType", id: "95216521d1f195ae", size: new capnp_ts_1.ObjectSize(0, 1) }; -var BuiltinType_Type; -(function (BuiltinType_Type) { - BuiltinType_Type[BuiltinType_Type["V8UINT8ARRAY"] = 0] = "V8UINT8ARRAY"; - BuiltinType_Type[BuiltinType_Type["V8ARRAY_BUFFER_VIEW"] = 1] = "V8ARRAY_BUFFER_VIEW"; - BuiltinType_Type[BuiltinType_Type["JSG_BUFFER_SOURCE"] = 2] = "JSG_BUFFER_SOURCE"; - BuiltinType_Type[BuiltinType_Type["KJ_DATE"] = 3] = "KJ_DATE"; - BuiltinType_Type[BuiltinType_Type["V8FUNCTION"] = 4] = "V8FUNCTION"; - BuiltinType_Type[BuiltinType_Type["V8ARRAY_BUFFER"] = 5] = "V8ARRAY_BUFFER"; -})(BuiltinType_Type = exports.BuiltinType_Type || (exports.BuiltinType_Type = {})); -class BuiltinType extends capnp_ts_1.Struct { - getType() { return capnp_ts_1.Struct.getUint16(0, this); } - setType(value) { capnp_ts_1.Struct.setUint16(0, value, this); } - toString() { return "BuiltinType_" + super.toString(); } -} -exports.BuiltinType = BuiltinType; -BuiltinType.Type = BuiltinType_Type; -BuiltinType._capnp = { displayName: "BuiltinType", id: "96dfb79b276b3379", size: new capnp_ts_1.ObjectSize(8, 0) }; -class FunctionType extends capnp_ts_1.Struct { - adoptReturnType(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownReturnType() { return capnp_ts_1.Struct.disown(this.getReturnType()); } - getReturnType() { return capnp_ts_1.Struct.getStruct(0, Type, this); } - hasReturnType() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initReturnType() { return capnp_ts_1.Struct.initStructAt(0, Type, this); } - setReturnType(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - adoptArgs(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownArgs() { return capnp_ts_1.Struct.disown(this.getArgs()); } - getArgs() { return capnp_ts_1.Struct.getList(1, FunctionType._Args, this); } - hasArgs() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initArgs(length) { return capnp_ts_1.Struct.initList(1, FunctionType._Args, length, this); } - setArgs(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - toString() { return "FunctionType_" + super.toString(); } -} -exports.FunctionType = FunctionType; -FunctionType._capnp = { displayName: "FunctionType", id: "d7c3505ac05e5fad", size: new capnp_ts_1.ObjectSize(0, 2) }; -var JsgImplType_Type; -(function (JsgImplType_Type) { - JsgImplType_Type[JsgImplType_Type["CONFIGURATION"] = 0] = "CONFIGURATION"; - JsgImplType_Type[JsgImplType_Type["V8ISOLATE"] = 1] = "V8ISOLATE"; - JsgImplType_Type[JsgImplType_Type["JSG_LOCK"] = 2] = "JSG_LOCK"; - JsgImplType_Type[JsgImplType_Type["JSG_TYPE_HANDLER"] = 3] = "JSG_TYPE_HANDLER"; - JsgImplType_Type[JsgImplType_Type["JSG_UNIMPLEMENTED"] = 4] = "JSG_UNIMPLEMENTED"; - JsgImplType_Type[JsgImplType_Type["JSG_VARARGS"] = 5] = "JSG_VARARGS"; - JsgImplType_Type[JsgImplType_Type["JSG_SELF_REF"] = 6] = "JSG_SELF_REF"; - JsgImplType_Type[JsgImplType_Type["V8FUNCTION_CALLBACK_INFO"] = 7] = "V8FUNCTION_CALLBACK_INFO"; - JsgImplType_Type[JsgImplType_Type["V8PROPERTY_CALLBACK_INFO"] = 8] = "V8PROPERTY_CALLBACK_INFO"; - JsgImplType_Type[JsgImplType_Type["JSG_NAME"] = 9] = "JSG_NAME"; -})(JsgImplType_Type = exports.JsgImplType_Type || (exports.JsgImplType_Type = {})); -class JsgImplType extends capnp_ts_1.Struct { - getType() { return capnp_ts_1.Struct.getUint16(0, this); } - setType(value) { capnp_ts_1.Struct.setUint16(0, value, this); } - toString() { return "JsgImplType_" + super.toString(); } -} -exports.JsgImplType = JsgImplType; -JsgImplType.Type = JsgImplType_Type; -JsgImplType._capnp = { displayName: "JsgImplType", id: "e0dfbe1216e6985e", size: new capnp_ts_1.ObjectSize(8, 0) }; -class Structure extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getFullyQualifiedName() { return capnp_ts_1.Struct.getText(3, this); } - setFullyQualifiedName(value) { capnp_ts_1.Struct.setText(3, value, this); } - adoptMembers(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownMembers() { return capnp_ts_1.Struct.disown(this.getMembers()); } - getMembers() { return capnp_ts_1.Struct.getList(1, Structure._Members, this); } - hasMembers() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initMembers(length) { return capnp_ts_1.Struct.initList(1, Structure._Members, length, this); } - setMembers(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - adoptExtends(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownExtends() { return capnp_ts_1.Struct.disown(this.getExtends()); } - getExtends() { return capnp_ts_1.Struct.getStruct(2, Type, this); } - hasExtends() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initExtends() { return capnp_ts_1.Struct.initStructAt(2, Type, this); } - setExtends(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - getIterable() { return capnp_ts_1.Struct.getBit(0, this); } - setIterable(value) { capnp_ts_1.Struct.setBit(0, value, this); } - adoptIterator(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(4, this)); } - disownIterator() { return capnp_ts_1.Struct.disown(this.getIterator()); } - getIterator() { return capnp_ts_1.Struct.getStruct(4, Method, this); } - hasIterator() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(4, this)); } - initIterator() { return capnp_ts_1.Struct.initStructAt(4, Method, this); } - setIterator(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(4, this)); } - getAsyncIterable() { return capnp_ts_1.Struct.getBit(1, this); } - setAsyncIterable(value) { capnp_ts_1.Struct.setBit(1, value, this); } - adoptAsyncIterator(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(5, this)); } - disownAsyncIterator() { return capnp_ts_1.Struct.disown(this.getAsyncIterator()); } - getAsyncIterator() { return capnp_ts_1.Struct.getStruct(5, Method, this); } - hasAsyncIterator() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(5, this)); } - initAsyncIterator() { return capnp_ts_1.Struct.initStructAt(5, Method, this); } - setAsyncIterator(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(5, this)); } - getTsRoot() { return capnp_ts_1.Struct.getBit(2, this); } - setTsRoot(value) { capnp_ts_1.Struct.setBit(2, value, this); } - getTsOverride() { return capnp_ts_1.Struct.getText(6, this); } - setTsOverride(value) { capnp_ts_1.Struct.setText(6, value, this); } - getTsDefine() { return capnp_ts_1.Struct.getText(7, this); } - setTsDefine(value) { capnp_ts_1.Struct.setText(7, value, this); } - adoptCallable(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(8, this)); } - disownCallable() { return capnp_ts_1.Struct.disown(this.getCallable()); } - getCallable() { return capnp_ts_1.Struct.getStruct(8, FunctionType, this); } - hasCallable() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(8, this)); } - initCallable() { return capnp_ts_1.Struct.initStructAt(8, FunctionType, this); } - setCallable(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(8, this)); } - adoptBuiltinModules(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(9, this)); } - disownBuiltinModules() { return capnp_ts_1.Struct.disown(this.getBuiltinModules()); } - getBuiltinModules() { return capnp_ts_1.Struct.getList(9, Structure._BuiltinModules, this); } - hasBuiltinModules() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(9, this)); } - initBuiltinModules(length) { return capnp_ts_1.Struct.initList(9, Structure._BuiltinModules, length, this); } - setBuiltinModules(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(9, this)); } - toString() { return "Structure_" + super.toString(); } -} -exports.Structure = Structure; -Structure._capnp = { displayName: "Structure", id: "c9aee5d3d27484f2", size: new capnp_ts_1.ObjectSize(8, 10) }; -class Member_Nested extends capnp_ts_1.Struct { - adoptStructure(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownStructure() { return capnp_ts_1.Struct.disown(this.getStructure()); } - getStructure() { return capnp_ts_1.Struct.getStruct(0, Structure, this); } - hasStructure() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initStructure() { return capnp_ts_1.Struct.initStructAt(0, Structure, this); } - setStructure(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - getName() { return capnp_ts_1.Struct.getText(1, this); } - setName(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "Member_Nested_" + super.toString(); } -} -exports.Member_Nested = Member_Nested; -Member_Nested._capnp = { displayName: "nested", id: "cc1920702876b1f6", size: new capnp_ts_1.ObjectSize(8, 2) }; -var Member_Which; -(function (Member_Which) { - Member_Which[Member_Which["METHOD"] = 0] = "METHOD"; - Member_Which[Member_Which["PROPERTY"] = 1] = "PROPERTY"; - Member_Which[Member_Which["NESTED"] = 2] = "NESTED"; - Member_Which[Member_Which["CONSTANT"] = 3] = "CONSTANT"; - Member_Which[Member_Which["CONSTRUCTOR"] = 4] = "CONSTRUCTOR"; -})(Member_Which = exports.Member_Which || (exports.Member_Which = {})); -class Member extends capnp_ts_1.Struct { - adoptMethod(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownMethod() { return capnp_ts_1.Struct.disown(this.getMethod()); } - getMethod() { - capnp_ts_1.Struct.testWhich("method", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getStruct(0, Method, this); - } - hasMethod() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initMethod() { - capnp_ts_1.Struct.setUint16(0, 0, this); - return capnp_ts_1.Struct.initStructAt(0, Method, this); - } - isMethod() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setMethod(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptProperty(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownProperty() { return capnp_ts_1.Struct.disown(this.getProperty()); } - getProperty() { - capnp_ts_1.Struct.testWhich("property", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getStruct(0, Property, this); - } - hasProperty() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initProperty() { - capnp_ts_1.Struct.setUint16(0, 1, this); - return capnp_ts_1.Struct.initStructAt(0, Property, this); - } - isProperty() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setProperty(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - getNested() { - capnp_ts_1.Struct.testWhich("nested", capnp_ts_1.Struct.getUint16(0, this), 2, this); - return capnp_ts_1.Struct.getAs(Member_Nested, this); - } - initNested() { - capnp_ts_1.Struct.setUint16(0, 2, this); - return capnp_ts_1.Struct.getAs(Member_Nested, this); - } - isNested() { return capnp_ts_1.Struct.getUint16(0, this) === 2; } - setNested() { capnp_ts_1.Struct.setUint16(0, 2, this); } - adoptConstant(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownConstant() { return capnp_ts_1.Struct.disown(this.getConstant()); } - getConstant() { - capnp_ts_1.Struct.testWhich("constant", capnp_ts_1.Struct.getUint16(0, this), 3, this); - return capnp_ts_1.Struct.getStruct(0, Constant, this); - } - hasConstant() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initConstant() { - capnp_ts_1.Struct.setUint16(0, 3, this); - return capnp_ts_1.Struct.initStructAt(0, Constant, this); - } - isConstant() { return capnp_ts_1.Struct.getUint16(0, this) === 3; } - setConstant(value) { - capnp_ts_1.Struct.setUint16(0, 3, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - adoptConstructor(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); - } - disownConstructor() { return capnp_ts_1.Struct.disown(this.getConstructor()); } - getConstructor() { - capnp_ts_1.Struct.testWhich("constructor", capnp_ts_1.Struct.getUint16(0, this), 4, this); - return capnp_ts_1.Struct.getStruct(0, Constructor, this); - } - hasConstructor() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initConstructor() { - capnp_ts_1.Struct.setUint16(0, 4, this); - return capnp_ts_1.Struct.initStructAt(0, Constructor, this); - } - isConstructor() { return capnp_ts_1.Struct.getUint16(0, this) === 4; } - setConstructor(value) { - capnp_ts_1.Struct.setUint16(0, 4, this); - capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); - } - toString() { return "Member_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Member = Member; -Member.METHOD = Member_Which.METHOD; -Member.PROPERTY = Member_Which.PROPERTY; -Member.NESTED = Member_Which.NESTED; -Member.CONSTANT = Member_Which.CONSTANT; -Member.CONSTRUCTOR = Member_Which.CONSTRUCTOR; -Member._capnp = { displayName: "Member", id: "85c316fd4114aba7", size: new capnp_ts_1.ObjectSize(8, 2) }; -class Method extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - adoptReturnType(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownReturnType() { return capnp_ts_1.Struct.disown(this.getReturnType()); } - getReturnType() { return capnp_ts_1.Struct.getStruct(1, Type, this); } - hasReturnType() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initReturnType() { return capnp_ts_1.Struct.initStructAt(1, Type, this); } - setReturnType(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - adoptArgs(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this)); } - disownArgs() { return capnp_ts_1.Struct.disown(this.getArgs()); } - getArgs() { return capnp_ts_1.Struct.getList(2, Method._Args, this); } - hasArgs() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this)); } - initArgs(length) { return capnp_ts_1.Struct.initList(2, Method._Args, length, this); } - setArgs(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this)); } - getStatic() { return capnp_ts_1.Struct.getBit(0, this); } - setStatic(value) { capnp_ts_1.Struct.setBit(0, value, this); } - toString() { return "Method_" + super.toString(); } -} -exports.Method = Method; -Method._capnp = { displayName: "Method", id: "a0a20f19ed7321e8", size: new capnp_ts_1.ObjectSize(8, 3) }; -class Property extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - adoptType(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownType() { return capnp_ts_1.Struct.disown(this.getType()); } - getType() { return capnp_ts_1.Struct.getStruct(1, Type, this); } - hasType() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initType() { return capnp_ts_1.Struct.initStructAt(1, Type, this); } - setType(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - getReadonly() { return capnp_ts_1.Struct.getBit(0, this); } - setReadonly(value) { capnp_ts_1.Struct.setBit(0, value, this); } - getLazy() { return capnp_ts_1.Struct.getBit(1, this); } - setLazy(value) { capnp_ts_1.Struct.setBit(1, value, this); } - getPrototype() { return capnp_ts_1.Struct.getBit(2, this); } - setPrototype(value) { capnp_ts_1.Struct.setBit(2, value, this); } - toString() { return "Property_" + super.toString(); } -} -exports.Property = Property; -Property._capnp = { displayName: "Property", id: "e1d238e9fecd3757", size: new capnp_ts_1.ObjectSize(8, 2) }; -class Constant extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - getValue() { return capnp_ts_1.Struct.getInt64(0, this); } - setValue(value) { capnp_ts_1.Struct.setInt64(0, value, this); } - toString() { return "Constant_" + super.toString(); } -} -exports.Constant = Constant; -Constant._capnp = { displayName: "Constant", id: "e354a1a55c4cfc59", size: new capnp_ts_1.ObjectSize(8, 1) }; -class Constructor extends capnp_ts_1.Struct { - adoptArgs(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownArgs() { return capnp_ts_1.Struct.disown(this.getArgs()); } - getArgs() { return capnp_ts_1.Struct.getList(0, Constructor._Args, this); } - hasArgs() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initArgs(length) { return capnp_ts_1.Struct.initList(0, Constructor._Args, length, this); } - setArgs(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - toString() { return "Constructor_" + super.toString(); } -} -exports.Constructor = Constructor; -Constructor._capnp = { displayName: "Constructor", id: "f4610fdb47099d17", size: new capnp_ts_1.ObjectSize(0, 1) }; -var Module_Which; -(function (Module_Which) { - Module_Which[Module_Which["STRUCTURE_NAME"] = 0] = "STRUCTURE_NAME"; - Module_Which[Module_Which["TS_DECLARATIONS"] = 1] = "TS_DECLARATIONS"; -})(Module_Which = exports.Module_Which || (exports.Module_Which = {})); -class Module extends capnp_ts_1.Struct { - getSpecifier() { return capnp_ts_1.Struct.getText(0, this); } - setSpecifier(value) { capnp_ts_1.Struct.setText(0, value, this); } - getStructureName() { - capnp_ts_1.Struct.testWhich("structureName", capnp_ts_1.Struct.getUint16(0, this), 0, this); - return capnp_ts_1.Struct.getText(1, this); - } - isStructureName() { return capnp_ts_1.Struct.getUint16(0, this) === 0; } - setStructureName(value) { - capnp_ts_1.Struct.setUint16(0, 0, this); - capnp_ts_1.Struct.setText(1, value, this); - } - getTsDeclarations() { - capnp_ts_1.Struct.testWhich("tsDeclarations", capnp_ts_1.Struct.getUint16(0, this), 1, this); - return capnp_ts_1.Struct.getText(1, this); - } - isTsDeclarations() { return capnp_ts_1.Struct.getUint16(0, this) === 1; } - setTsDeclarations(value) { - capnp_ts_1.Struct.setUint16(0, 1, this); - capnp_ts_1.Struct.setText(1, value, this); - } - toString() { return "Module_" + super.toString(); } - which() { return capnp_ts_1.Struct.getUint16(0, this); } -} -exports.Module = Module; -Module.STRUCTURE_NAME = Module_Which.STRUCTURE_NAME; -Module.TS_DECLARATIONS = Module_Which.TS_DECLARATIONS; -Module._capnp = { displayName: "Module", id: "cd4221e3248069bd", size: new capnp_ts_1.ObjectSize(8, 2) }; -class StructureGroups_StructureGroup extends capnp_ts_1.Struct { - getName() { return capnp_ts_1.Struct.getText(0, this); } - setName(value) { capnp_ts_1.Struct.setText(0, value, this); } - adoptStructures(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownStructures() { return capnp_ts_1.Struct.disown(this.getStructures()); } - getStructures() { return capnp_ts_1.Struct.getList(1, StructureGroups_StructureGroup._Structures, this); } - hasStructures() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initStructures(length) { return capnp_ts_1.Struct.initList(1, StructureGroups_StructureGroup._Structures, length, this); } - setStructures(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - toString() { return "StructureGroups_StructureGroup_" + super.toString(); } -} -exports.StructureGroups_StructureGroup = StructureGroups_StructureGroup; -StructureGroups_StructureGroup._capnp = { displayName: "StructureGroup", id: "fe89d9d03a268a31", size: new capnp_ts_1.ObjectSize(0, 2) }; -class StructureGroups extends capnp_ts_1.Struct { - adoptGroups(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(0, this)); } - disownGroups() { return capnp_ts_1.Struct.disown(this.getGroups()); } - getGroups() { return capnp_ts_1.Struct.getList(0, StructureGroups._Groups, this); } - hasGroups() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(0, this)); } - initGroups(length) { return capnp_ts_1.Struct.initList(0, StructureGroups._Groups, length, this); } - setGroups(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(0, this)); } - adoptModules(value) { capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(1, this)); } - disownModules() { return capnp_ts_1.Struct.disown(this.getModules()); } - getModules() { return capnp_ts_1.Struct.getList(1, StructureGroups._Modules, this); } - hasModules() { return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(1, this)); } - initModules(length) { return capnp_ts_1.Struct.initList(1, StructureGroups._Modules, length, this); } - setModules(value) { capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(1, this)); } - toString() { return "StructureGroups_" + super.toString(); } -} -exports.StructureGroups = StructureGroups; -StructureGroups.StructureGroup = StructureGroups_StructureGroup; -StructureGroups._capnp = { displayName: "StructureGroups", id: "ed8c71dbb06eb831", size: new capnp_ts_1.ObjectSize(0, 2) }; -class JsBuiltinType extends capnp_ts_1.Struct { - getModule() { return capnp_ts_1.Struct.getText(0, this); } - setModule(value) { capnp_ts_1.Struct.setText(0, value, this); } - getExport() { return capnp_ts_1.Struct.getText(1, this); } - setExport(value) { capnp_ts_1.Struct.setText(1, value, this); } - toString() { return "JsBuiltinType_" + super.toString(); } -} -exports.JsBuiltinType = JsBuiltinType; -JsBuiltinType._capnp = { displayName: "JsBuiltinType", id: "ccf1cde29b10a0bb", size: new capnp_ts_1.ObjectSize(0, 2) }; -OneOfType._Variants = capnp.CompositeList(Type); -FunctionType._Args = capnp.CompositeList(Type); -Structure._Members = capnp.CompositeList(Member); -Structure._BuiltinModules = capnp.CompositeList(Module); -Method._Args = capnp.CompositeList(Type); -Constructor._Args = capnp.CompositeList(Type); -StructureGroups_StructureGroup._Structures = capnp.CompositeList(Structure); -StructureGroups._Groups = capnp.CompositeList(StructureGroups_StructureGroup); -StructureGroups._Modules = capnp.CompositeList(Module); diff --git a/packages/vitest-pool-workers/scripts/rtti/rtti.js b/packages/vitest-pool-workers/scripts/rtti/rtti.js new file mode 100644 index 000000000000..7d455307ada3 --- /dev/null +++ b/packages/vitest-pool-workers/scripts/rtti/rtti.js @@ -0,0 +1,4048 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; +}; +var __accessCheck = (obj, member, msg) => { + if (!member.has(obj)) + throw TypeError("Cannot " + msg); +}; +var __privateGet = (obj, member, getter) => { + __accessCheck(obj, member, "read from private field"); + return getter ? getter.call(obj) : member.get(obj); +}; +var __privateAdd = (obj, member, value) => { + if (member.has(obj)) + throw TypeError("Cannot add the same private member more than once"); + member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +}; + +// scripts/rtti/rtti.ts +var rtti_exports = {}; +__export(rtti_exports, { + ArrayType: () => ArrayType, + BuiltinType: () => BuiltinType, + BuiltinType_Type: () => BuiltinType_Type, + Constant: () => Constant, + Constructor: () => Constructor, + DictType: () => DictType, + FunctionType: () => FunctionType, + IntrinsicType: () => IntrinsicType, + JsBuiltinType: () => JsBuiltinType, + JsgImplType: () => JsgImplType, + JsgImplType_Type: () => JsgImplType_Type, + MaybeType: () => MaybeType, + Member: () => Member, + Member_Nested: () => Member_Nested, + Member_Which: () => Member_Which, + Method: () => Method, + Module: () => Module, + Module_Which: () => Module_Which, + NumberType: () => NumberType, + OneOfType: () => OneOfType, + PromiseType: () => PromiseType, + Property: () => Property, + StringType: () => StringType, + Structure: () => Structure, + StructureGroups: () => StructureGroups, + StructureGroups_StructureGroup: () => StructureGroups_StructureGroup, + StructureType: () => StructureType, + Type: () => Type, + Type_Which: () => Type_Which, + _capnpFileId: () => _capnpFileId +}); +module.exports = __toCommonJS(rtti_exports); + +// ../../node_modules/.pnpm/capnp-es@0.0.7_typescript@5.7.3/node_modules/capnp-es/dist/shared/capnp-es.DAoyiaGr.mjs +var ListElementSize = /* @__PURE__ */ ((ListElementSize2) => { + ListElementSize2[ListElementSize2["VOID"] = 0] = "VOID"; + ListElementSize2[ListElementSize2["BIT"] = 1] = "BIT"; + ListElementSize2[ListElementSize2["BYTE"] = 2] = "BYTE"; + ListElementSize2[ListElementSize2["BYTE_2"] = 3] = "BYTE_2"; + ListElementSize2[ListElementSize2["BYTE_4"] = 4] = "BYTE_4"; + ListElementSize2[ListElementSize2["BYTE_8"] = 5] = "BYTE_8"; + ListElementSize2[ListElementSize2["POINTER"] = 6] = "POINTER"; + ListElementSize2[ListElementSize2["COMPOSITE"] = 7] = "COMPOSITE"; + return ListElementSize2; +})(ListElementSize || {}); +var tmpWord = new DataView(new ArrayBuffer(8)); +new Uint16Array(tmpWord.buffer)[0] = 258; +var DEFAULT_TRAVERSE_LIMIT = 64 << 20; +var LIST_SIZE_MASK = 7; +var MAX_INT32 = 2147483647; +var MAX_UINT32 = 4294967295; +var NATIVE_LITTLE_ENDIAN = tmpWord.getUint8(0) === 2; +var POINTER_DOUBLE_FAR_MASK = 4; +var POINTER_TYPE_MASK = 3; +var MAX_DEPTH = MAX_INT32; +var MAX_SEGMENT_LENGTH = MAX_UINT32; +var INVARIANT_UNREACHABLE_CODE = "CAPNP-TS000 Unreachable code detected."; +var PTR_ADOPT_WRONG_MESSAGE = "CAPNP-TS008 Attempted to adopt %s into a pointer in a different message %s."; +var PTR_ALREADY_ADOPTED = "CAPNP-TS009 Attempted to adopt %s more than once."; +var PTR_COMPOSITE_SIZE_UNDEFINED = "CAPNP-TS010 Attempted to set a composite list without providing a composite element size."; +var PTR_DEPTH_LIMIT_EXCEEDED = "CAPNP-TS011 Nesting depth limit exceeded for %s."; +var PTR_INIT_COMPOSITE_STRUCT = "CAPNP-TS013 Attempted to initialize a struct member from a composite list (%s)."; +var PTR_INVALID_FAR_TARGET = "CAPNP-TS015 Target of a far pointer (%s) is another far pointer."; +var PTR_INVALID_LIST_SIZE = "CAPNP-TS016 Invalid list element size: %x."; +var PTR_INVALID_POINTER_TYPE = "CAPNP-TS017 Invalid pointer type: %x."; +var PTR_INVALID_UNION_ACCESS = "CAPNP-TS018 Attempted to access getter on %s for union field %s that is not currently set (wanted: %d, found: %d)."; +var PTR_OFFSET_OUT_OF_BOUNDS = "CAPNP-TS019 Pointer offset %a is out of bounds for underlying buffer."; +var PTR_STRUCT_DATA_OUT_OF_BOUNDS = "CAPNP-TS020 Attempted to access out-of-bounds struct data (struct: %s, %d bytes at %a, data words: %d)."; +var PTR_STRUCT_POINTER_OUT_OF_BOUNDS = "CAPNP-TS021 Attempted to access out-of-bounds struct pointer (%s, index: %d, length: %d)."; +var PTR_TRAVERSAL_LIMIT_EXCEEDED = "CAPNP-TS022 Traversal limit exceeded! Slow down! %s"; +var PTR_WRONG_LIST_TYPE = "CAPNP-TS023 Cannot convert %s to a %s list."; +var PTR_WRONG_POINTER_TYPE = "CAPNP-TS024 Attempted to convert pointer %s to a %s type."; +var SEG_SIZE_OVERFLOW = `CAPNP-TS039 Requested size %x exceeds maximum value (${MAX_SEGMENT_LENGTH}).`; +var TYPE_COMPOSITE_SIZE_UNDEFINED = "CAPNP-TS040 Must provide a composite element size for composite list pointers."; +var LIST_NO_MUTABLE = "CAPNP-TS045: Cannot call mutative methods on an immutable list."; +var LIST_NO_SEARCH = "CAPNP-TS046: Search is not supported for list."; +var RPC_NULL_CLIENT = "CAPNP-TS100 Call on null client."; +function bufferToHex(buffer) { + const a = new Uint8Array(buffer); + const h = []; + for (let i = 0; i < a.byteLength; i++) { + h.push(pad(a[i].toString(16), 2)); + } + return `[${h.join(" ")}]`; +} +function format(s, ...args) { + const n = s.length; + let arg; + let argIndex = 0; + let c; + let escaped = false; + let i = 0; + let leadingZero = false; + let precision; + let result = ""; + function nextArg() { + return args[argIndex++]; + } + function slurpNumber() { + let digits = ""; + while (/\d/.test(s[i])) { + digits += s[i++]; + c = s[i]; + } + return digits.length > 0 ? Number.parseInt(digits, 10) : null; + } + for (; i < n; ++i) { + c = s[i]; + if (escaped) { + escaped = false; + if (c === ".") { + leadingZero = false; + c = s[++i]; + } else if (c === "0" && s[i + 1] === ".") { + leadingZero = true; + i += 2; + c = s[i]; + } else { + leadingZero = true; + } + precision = slurpNumber(); + switch (c) { + case "a": { + result += "0x" + pad(Number.parseInt(String(nextArg()), 10).toString(16), 8); + break; + } + case "b": { + result += Number.parseInt(String(nextArg()), 10).toString(2); + break; + } + case "c": { + arg = nextArg(); + result += typeof arg === "string" || arg instanceof String ? arg : String.fromCharCode(Number.parseInt(String(arg), 10)); + break; + } + case "d": { + result += Number.parseInt(String(nextArg()), 10); + break; + } + case "f": { + const tmp = Number.parseFloat(String(nextArg())).toFixed( + precision || 6 + ); + result += leadingZero ? tmp : tmp.replace(/^0/, ""); + break; + } + case "j": { + result += JSON.stringify(nextArg()); + break; + } + case "o": { + result += "0" + Number.parseInt(String(nextArg()), 10).toString(8); + break; + } + case "s": { + result += nextArg(); + break; + } + case "x": { + result += "0x" + Number.parseInt(String(nextArg()), 10).toString(16); + break; + } + case "X": { + result += "0x" + Number.parseInt(String(nextArg()), 10).toString(16).toUpperCase(); + break; + } + default: { + result += c; + break; + } + } + } else if (c === "%") { + escaped = true; + } else { + result += c; + } + } + return result; +} +function pad(v, width, pad2 = "0") { + return v.length >= width ? v : Array.from({ length: width - v.length + 1 }).join(pad2) + v; +} +function padToWord$1(size) { + return size + 7 & -8; +} +var ObjectSize = class { + /** The number of bytes required for the data section. */ + dataByteLength; + /** The number of pointers in the object. */ + pointerLength; + constructor(dataByteLength, pointerCount) { + this.dataByteLength = dataByteLength; + this.pointerLength = pointerCount; + } + toString() { + return format( + "ObjectSize_dw:%d,pc:%d", + getDataWordLength(this), + this.pointerLength + ); + } +}; +function getByteLength(o) { + return o.dataByteLength + o.pointerLength * 8; +} +function getDataWordLength(o) { + return o.dataByteLength / 8; +} +function getWordLength(o) { + return o.dataByteLength / 8 + o.pointerLength; +} +function padToWord(o) { + return new ObjectSize(padToWord$1(o.dataByteLength), o.pointerLength); +} +var Orphan = class { + /** If this member is not present then the orphan has already been adopted, or something went very wrong. */ + _capnp; + byteOffset; + segment; + constructor(src) { + const c = getContent(src); + this.segment = c.segment; + this.byteOffset = c.byteOffset; + this._capnp = {}; + this._capnp.type = getTargetPointerType(src); + switch (this._capnp.type) { + case PointerType.STRUCT: { + this._capnp.size = getTargetStructSize(src); + break; + } + case PointerType.LIST: { + this._capnp.length = getTargetListLength(src); + this._capnp.elementSize = getTargetListElementSize(src); + if (this._capnp.elementSize === ListElementSize.COMPOSITE) { + this._capnp.size = getTargetCompositeListSize(src); + } + break; + } + case PointerType.OTHER: { + this._capnp.capId = getCapabilityId(src); + break; + } + default: { + throw new Error(PTR_INVALID_POINTER_TYPE); + } + } + erasePointer(src); + } + /** + * Adopt (move) this orphan into the target pointer location. This will allocate far pointers in `dst` as needed. + * + * @param {T} dst The destination pointer. + * @returns {void} + */ + _moveTo(dst) { + if (this._capnp === void 0) { + throw new Error(format(PTR_ALREADY_ADOPTED, this)); + } + if (this.segment.message !== dst.segment.message) { + throw new Error(format(PTR_ADOPT_WRONG_MESSAGE, this, dst)); + } + erase(dst); + const res = initPointer(this.segment, this.byteOffset, dst); + switch (this._capnp.type) { + case PointerType.STRUCT: { + setStructPointer(res.offsetWords, this._capnp.size, res.pointer); + break; + } + case PointerType.LIST: { + let offsetWords = res.offsetWords; + if (this._capnp.elementSize === ListElementSize.COMPOSITE) { + offsetWords--; + } + setListPointer( + offsetWords, + this._capnp.elementSize, + this._capnp.length, + res.pointer, + this._capnp.size + ); + break; + } + case PointerType.OTHER: { + setInterfacePointer(this._capnp.capId, res.pointer); + break; + } + default: { + throw new Error(PTR_INVALID_POINTER_TYPE); + } + } + this._capnp = void 0; + } + dispose() { + if (this._capnp === void 0) { + return; + } + switch (this._capnp.type) { + case PointerType.STRUCT: { + this.segment.fillZeroWords( + this.byteOffset, + getWordLength(this._capnp.size) + ); + break; + } + case PointerType.LIST: { + const byteLength = getListByteLength( + this._capnp.elementSize, + this._capnp.length, + this._capnp.size + ); + this.segment.fillZeroWords(this.byteOffset, byteLength); + break; + } + } + this._capnp = void 0; + } + [Symbol.for("nodejs.util.inspect.custom")]() { + return format( + "Orphan_%d@%a,type:%s", + this.segment.id, + this.byteOffset, + this._capnp && this._capnp.type + ); + } +}; +function adopt(src, p) { + src._moveTo(p); +} +function disown(p) { + return new Orphan(p); +} +function dump(p) { + return bufferToHex(p.segment.buffer.slice(p.byteOffset, p.byteOffset + 8)); +} +function getListByteLength(elementSize, length, compositeSize) { + switch (elementSize) { + case ListElementSize.BIT: { + return padToWord$1(length + 7 >>> 3); + } + case ListElementSize.BYTE: + case ListElementSize.BYTE_2: + case ListElementSize.BYTE_4: + case ListElementSize.BYTE_8: + case ListElementSize.POINTER: + case ListElementSize.VOID: { + return padToWord$1(getListElementByteLength(elementSize) * length); + } + case ListElementSize.COMPOSITE: { + if (compositeSize === void 0) { + throw new Error(format(PTR_INVALID_LIST_SIZE, Number.NaN)); + } + return length * padToWord$1(getByteLength(compositeSize)); + } + default: { + throw new Error(PTR_INVALID_LIST_SIZE); + } + } +} +function getListElementByteLength(elementSize) { + switch (elementSize) { + case ListElementSize.BIT: { + return Number.NaN; + } + case ListElementSize.BYTE: { + return 1; + } + case ListElementSize.BYTE_2: { + return 2; + } + case ListElementSize.BYTE_4: { + return 4; + } + case ListElementSize.BYTE_8: + case ListElementSize.POINTER: { + return 8; + } + case ListElementSize.COMPOSITE: { + return Number.NaN; + } + case ListElementSize.VOID: { + return 0; + } + default: { + throw new Error(format(PTR_INVALID_LIST_SIZE, elementSize)); + } + } +} +function add(offset, p) { + return new Pointer(p.segment, p.byteOffset + offset, p._capnp.depthLimit); +} +function copyFrom(src, p) { + if (p.segment === src.segment && p.byteOffset === src.byteOffset) { + return; + } + erase(p); + if (isNull(src)) + return; + switch (getTargetPointerType(src)) { + case PointerType.STRUCT: { + copyFromStruct(src, p); + break; + } + case PointerType.LIST: { + copyFromList(src, p); + break; + } + case PointerType.OTHER: { + copyFromInterface(src, p); + break; + } + default: { + throw new Error( + format(PTR_INVALID_POINTER_TYPE, getTargetPointerType(p)) + ); + } + } +} +function erase(p) { + if (isNull(p)) + return; + let c; + switch (getTargetPointerType(p)) { + case PointerType.STRUCT: { + const size = getTargetStructSize(p); + c = getContent(p); + c.segment.fillZeroWords(c.byteOffset, size.dataByteLength / 8); + for (let i = 0; i < size.pointerLength; i++) { + erase(add(i * 8, c)); + } + break; + } + case PointerType.LIST: { + const elementSize = getTargetListElementSize(p); + const length = getTargetListLength(p); + let contentWords = padToWord$1( + length * getListElementByteLength(elementSize) + ); + c = getContent(p); + if (elementSize === ListElementSize.POINTER) { + for (let i = 0; i < length; i++) { + erase( + new Pointer( + c.segment, + c.byteOffset + i * 8, + p._capnp.depthLimit - 1 + ) + ); + } + break; + } else if (elementSize === ListElementSize.COMPOSITE) { + const tag = add(-8, c); + const compositeSize = getStructSize(tag); + const compositeByteLength = getByteLength(compositeSize); + contentWords = getOffsetWords(tag); + c.segment.setWordZero(c.byteOffset - 8); + for (let i = 0; i < length; i++) { + for (let j = 0; j < compositeSize.pointerLength; j++) { + erase( + new Pointer( + c.segment, + c.byteOffset + i * compositeByteLength + j * 8, + p._capnp.depthLimit - 1 + ) + ); + } + } + } + c.segment.fillZeroWords(c.byteOffset, contentWords); + break; + } + case PointerType.OTHER: { + break; + } + default: { + throw new Error( + format(PTR_INVALID_POINTER_TYPE, getTargetPointerType(p)) + ); + } + } + erasePointer(p); +} +function erasePointer(p) { + if (getPointerType(p) === PointerType.FAR) { + const landingPad = followFar(p); + if (isDoubleFar(p)) { + landingPad.segment.setWordZero(landingPad.byteOffset + 8); + } + landingPad.segment.setWordZero(landingPad.byteOffset); + } + p.segment.setWordZero(p.byteOffset); +} +function followFar(p) { + const targetSegment = p.segment.message.getSegment( + p.segment.getUint32(p.byteOffset + 4) + ); + const targetWordOffset = p.segment.getUint32(p.byteOffset) >>> 3; + return new Pointer( + targetSegment, + targetWordOffset * 8, + p._capnp.depthLimit - 1 + ); +} +function followFars(p) { + if (getPointerType(p) === PointerType.FAR) { + const landingPad = followFar(p); + if (isDoubleFar(p)) + landingPad.byteOffset += 8; + return landingPad; + } + return p; +} +function getCapabilityId(p) { + return p.segment.getUint32(p.byteOffset + 4); +} +function isCompositeList(p) { + return getTargetPointerType(p) === PointerType.LIST && getTargetListElementSize(p) === ListElementSize.COMPOSITE; +} +function getContent(p, ignoreCompositeIndex) { + let c; + if (isDoubleFar(p)) { + const landingPad = followFar(p); + c = new Pointer( + p.segment.message.getSegment(getFarSegmentId(landingPad)), + getOffsetWords(landingPad) * 8 + ); + } else { + const target = followFars(p); + c = new Pointer( + target.segment, + target.byteOffset + 8 + getOffsetWords(target) * 8 + ); + } + if (isCompositeList(p)) + c.byteOffset += 8; + if (!ignoreCompositeIndex && p._capnp.compositeIndex !== void 0) { + c.byteOffset -= 8; + c.byteOffset += 8 + p._capnp.compositeIndex * getByteLength(padToWord(getStructSize(c))); + } + return c; +} +function getFarSegmentId(p) { + return p.segment.getUint32(p.byteOffset + 4); +} +function getListElementSize(p) { + return p.segment.getUint32(p.byteOffset + 4) & LIST_SIZE_MASK; +} +function getListLength(p) { + return p.segment.getUint32(p.byteOffset + 4) >>> 3; +} +function getOffsetWords(p) { + const o = p.segment.getInt32(p.byteOffset); + return o & 2 ? o >> 3 : o >> 2; +} +function getPointerType(p) { + return p.segment.getUint32(p.byteOffset) & POINTER_TYPE_MASK; +} +function getStructDataWords(p) { + return p.segment.getUint16(p.byteOffset + 4); +} +function getStructPointerLength(p) { + return p.segment.getUint16(p.byteOffset + 6); +} +function getStructSize(p) { + return new ObjectSize(getStructDataWords(p) * 8, getStructPointerLength(p)); +} +function getTargetCompositeListTag(p) { + const c = getContent(p); + c.byteOffset -= 8; + return c; +} +function getTargetCompositeListSize(p) { + return getStructSize(getTargetCompositeListTag(p)); +} +function getTargetListElementSize(p) { + return getListElementSize(followFars(p)); +} +function getTargetListLength(p) { + const t = followFars(p); + if (getListElementSize(t) === ListElementSize.COMPOSITE) { + return getOffsetWords(getTargetCompositeListTag(p)); + } + return getListLength(t); +} +function getTargetPointerType(p) { + const t = getPointerType(followFars(p)); + if (t === PointerType.FAR) + throw new Error(format(PTR_INVALID_FAR_TARGET, p)); + return t; +} +function getTargetStructSize(p) { + return getStructSize(followFars(p)); +} +function initPointer(contentSegment, contentOffset, p) { + if (p.segment !== contentSegment) { + if (!contentSegment.hasCapacity(8)) { + const landingPad2 = p.segment.allocate(16); + setFarPointer(true, landingPad2.byteOffset / 8, landingPad2.segment.id, p); + setFarPointer(false, contentOffset / 8, contentSegment.id, landingPad2); + landingPad2.byteOffset += 8; + return new PointerAllocationResult(landingPad2, 0); + } + const landingPad = contentSegment.allocate(8); + if (landingPad.segment.id !== contentSegment.id) { + throw new Error(INVARIANT_UNREACHABLE_CODE); + } + setFarPointer(false, landingPad.byteOffset / 8, landingPad.segment.id, p); + return new PointerAllocationResult( + landingPad, + (contentOffset - landingPad.byteOffset - 8) / 8 + ); + } + return new PointerAllocationResult(p, (contentOffset - p.byteOffset - 8) / 8); +} +function isDoubleFar(p) { + return getPointerType(p) === PointerType.FAR && (p.segment.getUint32(p.byteOffset) & POINTER_DOUBLE_FAR_MASK) !== 0; +} +function isNull(p) { + return p.segment.isWordZero(p.byteOffset); +} +function relocateTo(dst, src) { + const t = followFars(src); + const lo = t.segment.getUint8(t.byteOffset) & 3; + const hi = t.segment.getUint32(t.byteOffset + 4); + erase(dst); + const res = initPointer( + t.segment, + t.byteOffset + 8 + getOffsetWords(t) * 8, + dst + ); + res.pointer.segment.setUint32( + res.pointer.byteOffset, + lo | res.offsetWords << 2 + ); + res.pointer.segment.setUint32(res.pointer.byteOffset + 4, hi); + erasePointer(src); +} +function setFarPointer(doubleFar, offsetWords, segmentId, p) { + const A = PointerType.FAR; + const B = doubleFar ? 1 : 0; + const C = offsetWords; + const D = segmentId; + p.segment.setUint32(p.byteOffset, A | B << 2 | C << 3); + p.segment.setUint32(p.byteOffset + 4, D); +} +function setInterfacePointer(capId, p) { + p.segment.setUint32(p.byteOffset, PointerType.OTHER); + p.segment.setUint32(p.byteOffset + 4, capId); +} +function getInterfacePointer(p) { + return p.segment.getUint32(p.byteOffset + 4); +} +function setListPointer(offsetWords, size, length, p, compositeSize) { + const A = PointerType.LIST; + const B = offsetWords; + const C = size; + let D = length; + if (size === ListElementSize.COMPOSITE) { + if (compositeSize === void 0) { + throw new TypeError(TYPE_COMPOSITE_SIZE_UNDEFINED); + } + D *= getWordLength(compositeSize); + } + p.segment.setUint32(p.byteOffset, A | B << 2); + p.segment.setUint32(p.byteOffset + 4, C | D << 3); +} +function setStructPointer(offsetWords, size, p) { + const A = PointerType.STRUCT; + const B = offsetWords; + const C = getDataWordLength(size); + const D = size.pointerLength; + p.segment.setUint32(p.byteOffset, A | B << 2); + p.segment.setUint16(p.byteOffset + 4, C); + p.segment.setUint16(p.byteOffset + 6, D); +} +function validate(pointerType, p, elementSize) { + if (isNull(p)) + return; + const t = followFars(p); + const A = t.segment.getUint32(t.byteOffset) & POINTER_TYPE_MASK; + if (A !== pointerType) { + throw new Error(format(PTR_WRONG_POINTER_TYPE, p, pointerType)); + } + if (elementSize !== void 0) { + const C = t.segment.getUint32(t.byteOffset + 4) & LIST_SIZE_MASK; + if (C !== elementSize) { + throw new Error( + format(PTR_WRONG_LIST_TYPE, p, ListElementSize[elementSize]) + ); + } + } +} +function copyFromInterface(src, dst) { + const srcCapId = getInterfacePointer(src); + if (srcCapId < 0) { + return; + } + const srcCapTable = src.segment.message._capnp.capTable; + if (!srcCapTable) { + return; + } + const client = srcCapTable[srcCapId]; + if (!client) { + return; + } + const dstCapId = dst.segment.message.addCap(client); + setInterfacePointer(dstCapId, dst); +} +function copyFromList(src, dst) { + if (dst._capnp.depthLimit <= 0) + throw new Error(PTR_DEPTH_LIMIT_EXCEEDED); + const srcContent = getContent(src); + const srcElementSize = getTargetListElementSize(src); + const srcLength = getTargetListLength(src); + let srcCompositeSize; + let srcStructByteLength; + let dstContent; + if (srcElementSize === ListElementSize.POINTER) { + dstContent = dst.segment.allocate(srcLength << 3); + for (let i = 0; i < srcLength; i++) { + const srcPtr = new Pointer( + srcContent.segment, + srcContent.byteOffset + (i << 3), + src._capnp.depthLimit - 1 + ); + const dstPtr = new Pointer( + dstContent.segment, + dstContent.byteOffset + (i << 3), + dst._capnp.depthLimit - 1 + ); + copyFrom(srcPtr, dstPtr); + } + } else if (srcElementSize === ListElementSize.COMPOSITE) { + srcCompositeSize = padToWord(getTargetCompositeListSize(src)); + srcStructByteLength = getByteLength(srcCompositeSize); + dstContent = dst.segment.allocate( + getByteLength(srcCompositeSize) * srcLength + 8 + ); + dstContent.segment.copyWord( + dstContent.byteOffset, + srcContent.segment, + srcContent.byteOffset - 8 + ); + if (srcCompositeSize.dataByteLength > 0) { + const wordLength = getWordLength(srcCompositeSize) * srcLength; + dstContent.segment.copyWords( + dstContent.byteOffset + 8, + srcContent.segment, + srcContent.byteOffset, + wordLength + ); + } + for (let i = 0; i < srcLength; i++) { + for (let j = 0; j < srcCompositeSize.pointerLength; j++) { + const offset = i * srcStructByteLength + srcCompositeSize.dataByteLength + (j << 3); + const srcPtr = new Pointer( + srcContent.segment, + srcContent.byteOffset + offset, + src._capnp.depthLimit - 1 + ); + const dstPtr = new Pointer( + dstContent.segment, + dstContent.byteOffset + offset + 8, + dst._capnp.depthLimit - 1 + ); + copyFrom(srcPtr, dstPtr); + } + } + } else { + const byteLength = padToWord$1( + srcElementSize === ListElementSize.BIT ? srcLength + 7 >>> 3 : getListElementByteLength(srcElementSize) * srcLength + ); + const wordLength = byteLength >>> 3; + dstContent = dst.segment.allocate(byteLength); + dstContent.segment.copyWords( + dstContent.byteOffset, + srcContent.segment, + srcContent.byteOffset, + wordLength + ); + } + const res = initPointer(dstContent.segment, dstContent.byteOffset, dst); + setListPointer( + res.offsetWords, + srcElementSize, + srcLength, + res.pointer, + srcCompositeSize + ); +} +function copyFromStruct(src, dst) { + if (dst._capnp.depthLimit <= 0) + throw new Error(PTR_DEPTH_LIMIT_EXCEEDED); + const srcContent = getContent(src); + const srcSize = getTargetStructSize(src); + const srcDataWordLength = getDataWordLength(srcSize); + const dstContent = dst.segment.allocate(getByteLength(srcSize)); + dstContent.segment.copyWords( + dstContent.byteOffset, + srcContent.segment, + srcContent.byteOffset, + srcDataWordLength + ); + for (let i = 0; i < srcSize.pointerLength; i++) { + const offset = srcSize.dataByteLength + i * 8; + const srcPtr = new Pointer( + srcContent.segment, + srcContent.byteOffset + offset, + src._capnp.depthLimit - 1 + ); + const dstPtr = new Pointer( + dstContent.segment, + dstContent.byteOffset + offset, + dst._capnp.depthLimit - 1 + ); + copyFrom(srcPtr, dstPtr); + } + if (dst._capnp.compositeList) + return; + const res = initPointer(dstContent.segment, dstContent.byteOffset, dst); + setStructPointer(res.offsetWords, srcSize, res.pointer); +} +function trackPointerAllocation(message, p) { + message._capnp.traversalLimit -= 8; + if (message._capnp.traversalLimit <= 0) { + throw new Error(format(PTR_TRAVERSAL_LIMIT_EXCEEDED, p)); + } +} +var PointerAllocationResult = class { + offsetWords; + pointer; + constructor(pointer, offsetWords) { + this.pointer = pointer; + this.offsetWords = offsetWords; + } +}; +var PointerType = /* @__PURE__ */ ((PointerType2) => { + PointerType2[PointerType2["STRUCT"] = 0] = "STRUCT"; + PointerType2[PointerType2["LIST"] = 1] = "LIST"; + PointerType2[PointerType2["FAR"] = 2] = "FAR"; + PointerType2[PointerType2["OTHER"] = 3] = "OTHER"; + return PointerType2; +})(PointerType || {}); +var Pointer = class { + _capnp; + /** Offset, in bytes, from the start of the segment to the beginning of this pointer. */ + byteOffset; + /** + * The starting segment for this pointer's data. In the case of a far pointer, the actual content this pointer is + * referencing will be in another segment within the same message. + */ + segment; + constructor(segment, byteOffset, depthLimit = MAX_DEPTH) { + this._capnp = { compositeList: false, depthLimit }; + this.segment = segment; + this.byteOffset = byteOffset; + if (depthLimit < 1) { + throw new Error(format(PTR_DEPTH_LIMIT_EXCEEDED, this)); + } + trackPointerAllocation(segment.message, this); + if (byteOffset < 0 || byteOffset > segment.byteLength) { + throw new Error(format(PTR_OFFSET_OUT_OF_BOUNDS, byteOffset)); + } + } + [Symbol.toStringTag]() { + return format("Pointer_%d", this.segment.id); + } + toString() { + return format("->%d@%a%s", this.segment.id, this.byteOffset, dump(this)); + } +}; +__publicField(Pointer, "_capnp", { + displayName: "Pointer" +}); +var _proxyHandler; +var _List = class extends Pointer { + constructor(segment, byteOffset, depthLimit) { + super(segment, byteOffset, depthLimit); + return new Proxy(this, __privateGet(_List, _proxyHandler)); + } + get length() { + return getTargetListLength(this); + } + toArray() { + const length = this.length; + const res = Array.from({ length }); + for (let i = 0; i < length; i++) { + res[i] = this.at(i); + } + return res; + } + get(_index) { + throw new TypeError("Cannot get from a generic list."); + } + set(_index, _value) { + throw new TypeError("Cannot set on a generic list."); + } + at(index) { + if (index < 0) { + const length = this.length; + index += length; + } + return this.get(index); + } + concat(other) { + const length = this.length; + const otherLength = other.length; + const res = Array.from({ length: length + otherLength }); + for (let i = 0; i < length; i++) + res[i] = this.at(i); + for (let i = 0; i < otherLength; i++) + res[i + length] = other.at(i); + return res; + } + some(cb, _this) { + const length = this.length; + for (let i = 0; i < length; i++) { + if (cb.call(_this, this.at(i), i, this)) { + return true; + } + } + return false; + } + filter(cb, _this) { + const length = this.length; + const res = []; + for (let i = 0; i < length; i++) { + const value = this.at(i); + if (cb.call(_this, value, i, this)) { + res.push(value); + } + } + return res; + } + find(cb, _this) { + const length = this.length; + for (let i = 0; i < length; i++) { + const value = this.at(i); + if (cb.call(_this, value, i, this)) { + return value; + } + } + return void 0; + } + findIndex(cb, _this) { + const length = this.length; + for (let i = 0; i < length; i++) { + const value = this.at(i); + if (cb.call(_this, value, i, this)) { + return i; + } + } + return -1; + } + forEach(cb, _this) { + const length = this.length; + for (let i = 0; i < length; i++) { + cb.call(_this, this.at(i), i, this); + } + } + map(cb, _this) { + const length = this.length; + const res = Array.from({ length }); + for (let i = 0; i < length; i++) { + res[i] = cb.call(_this, this.at(i), i, this); + } + return res; + } + flatMap(cb, _this) { + const length = this.length; + const res = []; + for (let i = 0; i < length; i++) { + const r = cb.call(_this, this.at(i), i, this); + res.push(...Array.isArray(r) ? r : [r]); + } + return res; + } + every(cb, _this) { + const length = this.length; + for (let i = 0; i < length; i++) { + if (!cb.call(_this, this.at(i), i, this)) { + return false; + } + } + return true; + } + reduce(cb, initialValue) { + let i = 0; + let res; + if (initialValue === void 0) { + res = this.at(0); + i++; + } else { + res = initialValue; + } + for (; i < this.length; i++) { + res = cb(res, this.at(i), i, this); + } + return res; + } + reduceRight(cb, initialValue) { + let i = this.length - 1; + let res; + if (initialValue === void 0) { + res = this.at(i); + i--; + } else { + res = initialValue; + } + for (; i >= 0; i--) { + res = cb(res, this.at(i), i, this); + } + return res; + } + slice(start = 0, end) { + const length = end ? Math.min(this.length, end) : this.length; + const res = Array.from({ length: length - start }); + for (let i = start; i < length; i++) + res[i] = this.at(i); + return res; + } + join(separator) { + return this.toArray().join(separator); + } + toReversed() { + return this.toArray().reverse(); + } + toSorted(compareFn) { + return this.toArray().sort(compareFn); + } + toSpliced(start, deleteCount, ...items) { + return this.toArray().splice(start, deleteCount, ...items); + } + fill(value, start, end) { + const length = this.length; + const s = Math.max(start ?? 0, 0); + const e = Math.min(end ?? length, length); + for (let i = s; i < e; i++) { + this.set(i, value); + } + return this; + } + copyWithin(target, start, end) { + const length = this.length; + const e = end ?? length; + const s = start < 0 ? Math.max(length + start, 0) : start; + const t = target < 0 ? Math.max(length + target, 0) : target; + const len = Math.min(e - s, length - t); + for (let i = 0; i < len; i++) { + this.set(t + i, this.at(s + i)); + } + return this; + } + keys() { + const length = this.length; + return Array.from({ length }, (_, i) => i)[Symbol.iterator](); + } + values() { + return this.toArray().values(); + } + entries() { + return this.toArray().entries(); + } + flat(depth) { + return this.toArray().flat(depth); + } + with(index, value) { + return this.toArray().with(index, value); + } + includes(_searchElement, _fromIndex) { + throw new Error(LIST_NO_SEARCH); + } + findLast(_cb, _thisArg) { + throw new Error(LIST_NO_SEARCH); + } + findLastIndex(_cb, _t) { + throw new Error(LIST_NO_SEARCH); + } + indexOf(_searchElement, _fromIndex) { + throw new Error(LIST_NO_SEARCH); + } + lastIndexOf(_searchElement, _fromIndex) { + throw new Error(LIST_NO_SEARCH); + } + pop() { + throw new Error(LIST_NO_MUTABLE); + } + push(..._items) { + throw new Error(LIST_NO_MUTABLE); + } + reverse() { + throw new Error(LIST_NO_MUTABLE); + } + shift() { + throw new Error(LIST_NO_MUTABLE); + } + unshift(..._items) { + throw new Error(LIST_NO_MUTABLE); + } + splice(_start, _deleteCount, ..._rest) { + throw new Error(LIST_NO_MUTABLE); + } + sort(_fn) { + throw new Error(LIST_NO_MUTABLE); + } + get [Symbol.unscopables]() { + return Array.prototype[Symbol.unscopables]; + } + [Symbol.iterator]() { + return this.values(); + } + toJSON() { + return this.toArray(); + } + toString() { + return this.join(","); + } + toLocaleString(_locales, _options) { + return this.toString(); + } + [Symbol.toStringTag]() { + return "[object Array]"; + } + static [Symbol.toStringTag]() { + return this._capnp.displayName; + } +}; +var List = _List; +_proxyHandler = new WeakMap(); +__publicField(List, "_capnp", { + displayName: "List", + size: ListElementSize.VOID +}); +__privateAdd(List, _proxyHandler, { + get(target, prop, receiver) { + const val = Reflect.get(target, prop, receiver); + if (val !== void 0) + return val; + if (typeof prop === "string") { + return target.get(+prop); + } + } +}); +function initList$1(elementSize, length, l, compositeSize) { + let c; + switch (elementSize) { + case ListElementSize.BIT: { + c = l.segment.allocate(Math.ceil(length / 8)); + break; + } + case ListElementSize.BYTE: + case ListElementSize.BYTE_2: + case ListElementSize.BYTE_4: + case ListElementSize.BYTE_8: + case ListElementSize.POINTER: { + c = l.segment.allocate(length * getListElementByteLength(elementSize)); + break; + } + case ListElementSize.COMPOSITE: { + if (compositeSize === void 0) { + throw new Error(format(PTR_COMPOSITE_SIZE_UNDEFINED)); + } + compositeSize = padToWord(compositeSize); + const byteLength = getByteLength(compositeSize) * length; + c = l.segment.allocate(byteLength + 8); + setStructPointer(length, compositeSize, c); + break; + } + case ListElementSize.VOID: { + setListPointer(0, elementSize, length, l); + return; + } + default: { + throw new Error(format(PTR_INVALID_LIST_SIZE, elementSize)); + } + } + const res = initPointer(c.segment, c.byteOffset, l); + setListPointer( + res.offsetWords, + elementSize, + length, + res.pointer, + compositeSize + ); +} +var Data = class extends List { + static fromPointer(pointer) { + validate(PointerType.LIST, pointer, ListElementSize.BYTE); + return this._fromPointerUnchecked(pointer); + } + static _fromPointerUnchecked(pointer) { + return new this( + pointer.segment, + pointer.byteOffset, + pointer._capnp.depthLimit + ); + } + /** + * Copy the contents of `src` into this Data pointer. If `src` is smaller than the length of this pointer then the + * remaining bytes will be zeroed out. Extra bytes in `src` are ignored. + * + * @param {(ArrayBuffer | ArrayBufferView)} src The source buffer. + * @returns {void} + */ + // TODO: Would be nice to have a way to zero-copy a buffer by allocating a new segment into the message with that + // buffer data. + copyBuffer(src) { + const c = getContent(this); + const dstLength = this.length; + const srcLength = src.byteLength; + const i = src instanceof ArrayBuffer ? new Uint8Array(src) : new Uint8Array( + src.buffer, + src.byteOffset, + Math.min(dstLength, srcLength) + ); + const o = new Uint8Array(c.segment.buffer, c.byteOffset, this.length); + o.set(i); + if (dstLength > srcLength) { + o.fill(0, srcLength, dstLength); + } + } + /** + * Read a byte from the specified offset. + * + * @param {number} byteOffset The byte offset to read. + * @returns {number} The byte value. + */ + get(byteOffset) { + const c = getContent(this); + return c.segment.getUint8(c.byteOffset + byteOffset); + } + /** + * Write a byte at the specified offset. + * + * @param {number} byteOffset The byte offset to set. + * @param {number} value The byte value to set. + * @returns {void} + */ + set(byteOffset, value) { + const c = getContent(this); + c.segment.setUint8(c.byteOffset + byteOffset, value); + } + /** + * Creates a **copy** of the underlying buffer data and returns it as an ArrayBuffer. + * + * To obtain a reference to the underlying buffer instead, use `toUint8Array()` or `toDataView()`. + * + * @returns {ArrayBuffer} A copy of this data buffer. + */ + toArrayBuffer() { + const c = getContent(this); + return c.segment.buffer.slice(c.byteOffset, c.byteOffset + this.length); + } + /** + * Convert this Data pointer to a DataView representing the pointer's contents. + * + * WARNING: The DataView references memory from a message segment, so do not venture outside the bounds of the + * DataView or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toDataView() { + const c = getContent(this); + return new DataView(c.segment.buffer, c.byteOffset, this.length); + } + [Symbol.toStringTag]() { + return `Data_${super.toString()}`; + } + /** + * Convert this Data pointer to a Uint8Array representing the pointer's contents. + * + * WARNING: The Uint8Array references memory from a message segment, so do not venture outside the bounds of the + * Uint8Array or else BAD THINGS. + * + * @returns {DataView} A live reference to the underlying buffer. + */ + toUint8Array() { + const c = getContent(this); + return new Uint8Array(c.segment.buffer, c.byteOffset, this.length); + } +}; +var textEncoder = new TextEncoder(); +var textDecoder = new TextDecoder(); +var Text = class extends List { + static fromPointer(pointer) { + validate(PointerType.LIST, pointer, ListElementSize.BYTE); + return textFromPointerUnchecked(pointer); + } + /** + * Read a utf-8 encoded string value from this pointer. + * + * @param {number} [index] The index at which to start reading; defaults to zero. + * @returns {string} The string value. + */ + get(index = 0) { + if (isNull(this)) + return ""; + const c = getContent(this); + return textDecoder.decode( + new Uint8Array( + c.segment.buffer, + c.byteOffset + index, + this.length - index + ) + ); + } + /** + * Get the number of utf-8 encoded bytes in this text. This does **not** include the NUL byte. + * + * @returns {number} The number of bytes allocated for the text. + */ + get length() { + return super.length - 1; + } + /** + * Write a utf-8 encoded string value starting at the specified index. + * + * @param {number} index The index at which to start copying the string. Note that if this is not zero the bytes + * before `index` will be left as-is. All bytes after `index` will be overwritten. + * @param {string} value The string value to set. + * @returns {void} + */ + set(index, value) { + const src = textEncoder.encode(value); + const dstLength = src.byteLength + index; + let c; + let original; + if (!isNull(this)) { + c = getContent(this); + let originalLength = this.length; + if (originalLength >= index) { + originalLength = index; + } + original = new Uint8Array( + c.segment.buffer.slice( + c.byteOffset, + c.byteOffset + Math.min(originalLength, index) + ) + ); + erase(this); + } + initList$1(ListElementSize.BYTE, dstLength + 1, this); + c = getContent(this); + const dst = new Uint8Array(c.segment.buffer, c.byteOffset, dstLength); + if (original) + dst.set(original); + dst.set(src, index); + } + toString() { + return this.get(); + } + toJSON() { + return this.get(); + } + [Symbol.toPrimitive]() { + return this.get(); + } + [Symbol.toStringTag]() { + return `Text_${super.toString()}`; + } +}; +function textFromPointerUnchecked(pointer) { + return new Text( + pointer.segment, + pointer.byteOffset, + pointer._capnp.depthLimit + ); +} +var Struct = class extends Pointer { + /** + * Create a new pointer to a struct. + * + * @constructor {Struct} + * @param {Segment} segment The segment the pointer resides in. + * @param {number} byteOffset The offset from the beginning of the segment to the beginning of the pointer data. + * @param {any} [depthLimit=MAX_DEPTH] The nesting depth limit for this object. + * @param {number} [compositeIndex] If set, then this pointer is actually a reference to a composite list + * (`this._getPointerTargetType() === PointerType.LIST`), and this number is used as the index of the struct within + * the list. It is not valid to call `initStruct()` on a composite struct – the struct contents are initialized when + * the list pointer is initialized. + */ + constructor(segment, byteOffset, depthLimit = MAX_DEPTH, compositeIndex) { + super(segment, byteOffset, depthLimit); + this._capnp.compositeIndex = compositeIndex; + this._capnp.compositeList = compositeIndex !== void 0; + } + static [Symbol.toStringTag]() { + return this._capnp.displayName; + } + [Symbol.toStringTag]() { + return `Struct_${super.toString()}${this._capnp.compositeIndex === void 0 ? "" : `,ci:${this._capnp.compositeIndex}`} > ${getContent(this).toString()}`; + } +}; +__publicField(Struct, "_capnp", { + displayName: "Struct" +}); +var AnyStruct = class extends Struct { +}; +__publicField(AnyStruct, "_capnp", { + displayName: "AnyStruct", + id: "0", + size: new ObjectSize(0, 0) +}); +var FixedAnswer = class { + struct() { + return Promise.resolve(this.structSync()); + } +}; +var ErrorAnswer = class extends FixedAnswer { + err; + constructor(err) { + super(); + this.err = err; + } + structSync() { + throw this.err; + } + pipelineCall(_transform, _call) { + return this; + } + pipelineClose(_transform) { + throw this.err; + } +}; +var ErrorClient = class { + err; + constructor(err) { + this.err = err; + } + call(_call) { + return new ErrorAnswer(this.err); + } + close() { + throw this.err; + } +}; +function clientOrNull(client) { + return client ? client : new ErrorClient(new Error(RPC_NULL_CLIENT)); +} +var TMP_WORD = new DataView(new ArrayBuffer(8)); +function initStruct(size, s) { + if (s._capnp.compositeIndex !== void 0) { + throw new Error(format(PTR_INIT_COMPOSITE_STRUCT, s)); + } + erase(s); + const c = s.segment.allocate(getByteLength(size)); + const res = initPointer(c.segment, c.byteOffset, s); + setStructPointer(res.offsetWords, size, res.pointer); +} +function initStructAt(index, StructClass, p) { + const s = getPointerAs(index, StructClass, p); + initStruct(StructClass._capnp.size, s); + return s; +} +function checkPointerBounds(index, s) { + const pointerLength = getSize(s).pointerLength; + if (index < 0 || index >= pointerLength) { + throw new Error( + format(PTR_STRUCT_POINTER_OUT_OF_BOUNDS, s, index, pointerLength) + ); + } +} +function getInterfaceClientOrNullAt(index, s) { + return getInterfaceClientOrNull(getPointer(index, s)); +} +function getInterfaceClientOrNull(p) { + let client = null; + const capId = getInterfacePointer(p); + const capTable = p.segment.message._capnp.capTable; + if (capTable && capId >= 0 && capId < capTable.length) { + client = capTable[capId]; + } + return clientOrNull(client); +} +function resize(dstSize, s) { + const srcSize = getSize(s); + const srcContent = getContent(s); + const dstContent = s.segment.allocate(getByteLength(dstSize)); + dstContent.segment.copyWords( + dstContent.byteOffset, + srcContent.segment, + srcContent.byteOffset, + Math.min(getDataWordLength(srcSize), getDataWordLength(dstSize)) + ); + const res = initPointer(dstContent.segment, dstContent.byteOffset, s); + setStructPointer(res.offsetWords, dstSize, res.pointer); + for (let i = 0; i < Math.min(srcSize.pointerLength, dstSize.pointerLength); i++) { + const srcPtr = new Pointer( + srcContent.segment, + srcContent.byteOffset + srcSize.dataByteLength + i * 8 + ); + if (isNull(srcPtr)) { + continue; + } + const srcPtrTarget = followFars(srcPtr); + const srcPtrContent = getContent(srcPtr); + const dstPtr = new Pointer( + dstContent.segment, + dstContent.byteOffset + dstSize.dataByteLength + i * 8 + ); + if (getTargetPointerType(srcPtr) === PointerType.LIST && getTargetListElementSize(srcPtr) === ListElementSize.COMPOSITE) { + srcPtrContent.byteOffset -= 8; + } + const r = initPointer( + srcPtrContent.segment, + srcPtrContent.byteOffset, + dstPtr + ); + const a = srcPtrTarget.segment.getUint8(srcPtrTarget.byteOffset) & 3; + const b = srcPtrTarget.segment.getUint32(srcPtrTarget.byteOffset + 4); + r.pointer.segment.setUint32(r.pointer.byteOffset, a | r.offsetWords << 2); + r.pointer.segment.setUint32(r.pointer.byteOffset + 4, b); + } + srcContent.segment.fillZeroWords( + srcContent.byteOffset, + getWordLength(srcSize) + ); +} +function getAs(StructClass, s) { + return new StructClass( + s.segment, + s.byteOffset, + s._capnp.depthLimit, + s._capnp.compositeIndex + ); +} +function getBit(bitOffset, s, defaultMask) { + const byteOffset = Math.floor(bitOffset / 8); + const bitMask = 1 << bitOffset % 8; + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + const v = ds.segment.getUint8(ds.byteOffset + byteOffset); + if (defaultMask === void 0) + return (v & bitMask) !== 0; + const defaultValue = defaultMask.getUint8(0); + return ((v ^ defaultValue) & bitMask) !== 0; +} +function getData(index, s, defaultValue) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new Data(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + if (isNull(l)) { + if (defaultValue) { + copyFrom(defaultValue, l); + } else { + initList$1(ListElementSize.BYTE, 0, l); + } + } + return l; +} +function getDataSection(s) { + return getContent(s); +} +function getFloat32(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask === void 0) { + return ds.segment.getFloat32(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + TMP_WORD.setUint32(0, v, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getFloat32(0, NATIVE_LITTLE_ENDIAN); +} +function getFloat64(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(0, lo, NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(4, hi, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getFloat64(0, NATIVE_LITTLE_ENDIAN); + } + return ds.segment.getFloat64(ds.byteOffset + byteOffset); +} +function getInt16(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask === void 0) { + return ds.segment.getInt16(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint16(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); + TMP_WORD.setUint16(0, v, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getInt16(0, NATIVE_LITTLE_ENDIAN); +} +function getInt32(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask === void 0) { + return ds.segment.getInt32(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); + TMP_WORD.setUint32(0, v, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getInt32(0, NATIVE_LITTLE_ENDIAN); +} +function getInt64(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(NATIVE_LITTLE_ENDIAN ? 0 : 4, lo, NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(NATIVE_LITTLE_ENDIAN ? 4 : 0, hi, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getBigInt64(0, NATIVE_LITTLE_ENDIAN); + } + return ds.segment.getInt64(ds.byteOffset + byteOffset); +} +function getInt8(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask === void 0) { + return ds.segment.getInt8(ds.byteOffset + byteOffset); + } + const v = ds.segment.getUint8(ds.byteOffset + byteOffset) ^ defaultMask.getUint8(0); + TMP_WORD.setUint8(0, v); + return TMP_WORD.getInt8(0); +} +function getList(index, ListClass, s, defaultValue) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new ListClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + if (isNull(l)) { + if (defaultValue) { + copyFrom(defaultValue, l); + } else { + initList$1(ListClass._capnp.size, 0, l, ListClass._capnp.compositeSize); + } + } else if (ListClass._capnp.compositeSize !== void 0) { + const srcSize = getTargetCompositeListSize(l); + const dstSize = ListClass._capnp.compositeSize; + if (dstSize.dataByteLength > srcSize.dataByteLength || dstSize.pointerLength > srcSize.pointerLength) { + const srcContent = getContent(l); + const srcLength = getTargetListLength(l); + const dstContent = l.segment.allocate( + getByteLength(dstSize) * srcLength + 8 + ); + const res = initPointer(dstContent.segment, dstContent.byteOffset, l); + setListPointer( + res.offsetWords, + ListClass._capnp.size, + srcLength, + res.pointer, + dstSize + ); + setStructPointer(srcLength, dstSize, dstContent); + dstContent.byteOffset += 8; + for (let i = 0; i < srcLength; i++) { + const srcElementOffset = srcContent.byteOffset + i * getByteLength(srcSize); + const dstElementOffset = dstContent.byteOffset + i * getByteLength(dstSize); + dstContent.segment.copyWords( + dstElementOffset, + srcContent.segment, + srcElementOffset, + getWordLength(srcSize) + ); + for (let j = 0; j < srcSize.pointerLength; j++) { + const srcPtr = new Pointer( + srcContent.segment, + srcElementOffset + srcSize.dataByteLength + j * 8 + ); + const dstPtr = new Pointer( + dstContent.segment, + dstElementOffset + dstSize.dataByteLength + j * 8 + ); + const srcPtrTarget = followFars(srcPtr); + const srcPtrContent = getContent(srcPtr); + if (getTargetPointerType(srcPtr) === PointerType.LIST && getTargetListElementSize(srcPtr) === ListElementSize.COMPOSITE) { + srcPtrContent.byteOffset -= 8; + } + const r = initPointer( + srcPtrContent.segment, + srcPtrContent.byteOffset, + dstPtr + ); + const a = srcPtrTarget.segment.getUint8(srcPtrTarget.byteOffset) & 3; + const b = srcPtrTarget.segment.getUint32(srcPtrTarget.byteOffset + 4); + r.pointer.segment.setUint32( + r.pointer.byteOffset, + a | r.offsetWords << 2 + ); + r.pointer.segment.setUint32(r.pointer.byteOffset + 4, b); + } + } + srcContent.segment.fillZeroWords( + srcContent.byteOffset, + getWordLength(srcSize) * srcLength + ); + } + } + return l; +} +function getPointer(index, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + return new Pointer(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); +} +function getPointerAs(index, PointerClass, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + return new PointerClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); +} +function getPointerSection(s) { + const ps = getContent(s); + ps.byteOffset += padToWord$1(getSize(s).dataByteLength); + return ps; +} +function getSize(s) { + if (s._capnp.compositeIndex !== void 0) { + const c = getContent(s, true); + c.byteOffset -= 8; + return getStructSize(c); + } + return getTargetStructSize(s); +} +function getStruct(index, StructClass, s, defaultValue) { + const t = getPointerAs(index, StructClass, s); + if (isNull(t)) { + if (defaultValue) { + copyFrom(defaultValue, t); + } else { + initStruct(StructClass._capnp.size, t); + } + } else { + validate(PointerType.STRUCT, t); + const ts = getTargetStructSize(t); + if (ts.dataByteLength < StructClass._capnp.size.dataByteLength || ts.pointerLength < StructClass._capnp.size.pointerLength) { + resize(StructClass._capnp.size, t); + } + } + return t; +} +function getText(index, s, defaultValue) { + const t = Text.fromPointer(getPointer(index, s)); + if (isNull(t) && defaultValue) + t.set(0, defaultValue); + return t.get(0); +} +function getUint16(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask === void 0) { + return ds.segment.getUint16(ds.byteOffset + byteOffset); + } + return ds.segment.getUint16(ds.byteOffset + byteOffset) ^ defaultMask.getUint16(0, true); +} +function getUint32(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask === void 0) { + return ds.segment.getUint32(ds.byteOffset + byteOffset); + } + return ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); +} +function getUint64(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + const lo = ds.segment.getUint32(ds.byteOffset + byteOffset) ^ defaultMask.getUint32(0, true); + const hi = ds.segment.getUint32(ds.byteOffset + byteOffset + 4) ^ defaultMask.getUint32(4, true); + TMP_WORD.setUint32(NATIVE_LITTLE_ENDIAN ? 0 : 4, lo, NATIVE_LITTLE_ENDIAN); + TMP_WORD.setUint32(NATIVE_LITTLE_ENDIAN ? 4 : 0, hi, NATIVE_LITTLE_ENDIAN); + return TMP_WORD.getBigUint64(0, NATIVE_LITTLE_ENDIAN); + } + return ds.segment.getUint64(ds.byteOffset + byteOffset); +} +function getUint8(byteOffset, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask === void 0) { + return ds.segment.getUint8(ds.byteOffset + byteOffset); + } + return ds.segment.getUint8(ds.byteOffset + byteOffset) ^ defaultMask.getUint8(0); +} +function initData(index, length, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new Data(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + erase(l); + initList$1(ListElementSize.BYTE, length, l); + return l; +} +function initList(index, ListClass, length, s) { + checkPointerBounds(index, s); + const ps = getPointerSection(s); + ps.byteOffset += index * 8; + const l = new ListClass(ps.segment, ps.byteOffset, s._capnp.depthLimit - 1); + erase(l); + initList$1(ListClass._capnp.size, length, l, ListClass._capnp.compositeSize); + return l; +} +function setBit(bitOffset, value, s, defaultMask) { + const byteOffset = Math.floor(bitOffset / 8); + const bitMask = 1 << bitOffset % 8; + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + const b = ds.segment.getUint8(ds.byteOffset + byteOffset); + if (defaultMask !== void 0) { + value = (defaultMask.getUint8(0) & bitMask) === 0 ? value : !value; + } + ds.segment.setUint8( + ds.byteOffset + byteOffset, + value ? b | bitMask : b & ~bitMask + ); +} +function setFloat32(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + TMP_WORD.setFloat32(0, value, NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint32(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setFloat32(ds.byteOffset + byteOffset, value); +} +function setFloat64(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + TMP_WORD.setFloat64(0, value, NATIVE_LITTLE_ENDIAN); + const lo = TMP_WORD.getUint32(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + const hi = TMP_WORD.getUint32(4, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(4, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, lo); + ds.segment.setUint32(ds.byteOffset + byteOffset + 4, hi); + return; + } + ds.segment.setFloat64(ds.byteOffset + byteOffset, value); +} +function setInt16(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + TMP_WORD.setInt16(0, value, NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint16(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint16(0, true); + ds.segment.setUint16(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setInt16(ds.byteOffset + byteOffset, value); +} +function setInt32(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + TMP_WORD.setInt32(0, value, NATIVE_LITTLE_ENDIAN); + const v = TMP_WORD.getUint32(0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setInt32(ds.byteOffset + byteOffset, value); +} +function setInt64(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + TMP_WORD.setBigInt64(0, value, NATIVE_LITTLE_ENDIAN); + const lo = TMP_WORD.getUint32(NATIVE_LITTLE_ENDIAN ? 0 : 4, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + const hi = TMP_WORD.getUint32(NATIVE_LITTLE_ENDIAN ? 4 : 0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(4, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, lo); + ds.segment.setUint32(ds.byteOffset + byteOffset + 4, hi); + return; + } + ds.segment.setInt64(ds.byteOffset + byteOffset, value); +} +function setInt8(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + TMP_WORD.setInt8(0, value); + const v = TMP_WORD.getUint8(0) ^ defaultMask.getUint8(0); + ds.segment.setUint8(ds.byteOffset + byteOffset, v); + return; + } + ds.segment.setInt8(ds.byteOffset + byteOffset, value); +} +function setText(index, value, s) { + Text.fromPointer(getPointer(index, s)).set(0, value); +} +function setUint16(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 2, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) + value ^= defaultMask.getUint16(0, true); + ds.segment.setUint16(ds.byteOffset + byteOffset, value); +} +function setUint32(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 4, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) + value ^= defaultMask.getUint32(0, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, value); +} +function setUint64(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 8, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) { + TMP_WORD.setBigUint64(0, value, NATIVE_LITTLE_ENDIAN); + const lo = TMP_WORD.getUint32(NATIVE_LITTLE_ENDIAN ? 0 : 4, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(0, true); + const hi = TMP_WORD.getUint32(NATIVE_LITTLE_ENDIAN ? 4 : 0, NATIVE_LITTLE_ENDIAN) ^ defaultMask.getUint32(4, true); + ds.segment.setUint32(ds.byteOffset + byteOffset, lo); + ds.segment.setUint32(ds.byteOffset + byteOffset + 4, hi); + return; + } + ds.segment.setUint64(ds.byteOffset + byteOffset, value); +} +function setUint8(byteOffset, value, s, defaultMask) { + checkDataBounds(byteOffset, 1, s); + const ds = getDataSection(s); + if (defaultMask !== void 0) + value ^= defaultMask.getUint8(0); + ds.segment.setUint8(ds.byteOffset + byteOffset, value); +} +function testWhich(name, found, wanted, s) { + if (found !== wanted) { + throw new Error(format(PTR_INVALID_UNION_ACCESS, s, name, found, wanted)); + } +} +function checkDataBounds(byteOffset, byteLength, s) { + const dataByteLength = getSize(s).dataByteLength; + if (byteOffset < 0 || byteLength < 0 || byteOffset + byteLength > dataByteLength) { + throw new Error( + format( + PTR_STRUCT_DATA_OUT_OF_BOUNDS, + s, + byteLength, + byteOffset, + dataByteLength + ) + ); + } +} + +// ../../node_modules/.pnpm/capnp-es@0.0.7_typescript@5.7.3/node_modules/capnp-es/dist/shared/capnp-es.DCKndyix.mjs +function CompositeList(CompositeClass) { + return class extends List { + static _capnp = { + compositeSize: CompositeClass._capnp.size, + displayName: `List<${CompositeClass._capnp.displayName}>`, + size: ListElementSize.COMPOSITE + }; + get(index) { + return new CompositeClass( + this.segment, + this.byteOffset, + this._capnp.depthLimit - 1, + index + ); + } + set(index, value) { + copyFrom(value, this.get(index)); + } + [Symbol.toStringTag]() { + return `Composite_${super.toString()},cls:${CompositeClass.toString()}`; + } + }; +} +function _makePrimitiveMaskFn(byteLength, setter) { + return (x) => { + const dv = new DataView(new ArrayBuffer(byteLength)); + setter.call(dv, 0, x, true); + return dv; + }; +} +var getFloat32Mask = _makePrimitiveMaskFn( + 4, + DataView.prototype.setFloat32 +); +var getFloat64Mask = _makePrimitiveMaskFn( + 8, + DataView.prototype.setFloat64 +); +var getInt16Mask = _makePrimitiveMaskFn( + 2, + DataView.prototype.setInt16 +); +var getInt32Mask = _makePrimitiveMaskFn( + 4, + DataView.prototype.setInt32 +); +var getInt64Mask = _makePrimitiveMaskFn( + 8, + DataView.prototype.setBigInt64 +); +var getInt8Mask = _makePrimitiveMaskFn(1, DataView.prototype.setInt8); +var getUint16Mask = _makePrimitiveMaskFn( + 2, + DataView.prototype.setUint16 +); +var getUint32Mask = _makePrimitiveMaskFn( + 4, + DataView.prototype.setUint32 +); +var getUint64Mask = _makePrimitiveMaskFn( + 8, + DataView.prototype.setBigUint64 +); +var getUint8Mask = _makePrimitiveMaskFn( + 1, + DataView.prototype.setUint8 +); + +// ../../node_modules/.pnpm/capnp-es@0.0.7_typescript@5.7.3/node_modules/capnp-es/dist/shared/capnp-es.B1ADXvSS.mjs +var Interface = class extends Pointer { + constructor(segment, byteOffset, depthLimit = MAX_DEPTH) { + super(segment, byteOffset, depthLimit); + } + static fromPointer(p) { + return getAsInterface(p); + } + getCapId() { + return getCapID(this); + } + getClient() { + return getClient(this); + } + [Symbol.for("nodejs.util.inspect.custom")]() { + return format( + "Interface_%d@%a,%d,limit:%x", + this.segment.id, + this.byteOffset, + this.getCapId(), + this._capnp.depthLimit + ); + } +}; +__publicField(Interface, "_capnp", { + displayName: "Interface" +}); +__publicField(Interface, "getCapID", getCapID); +__publicField(Interface, "getAsInterface", getAsInterface); +__publicField(Interface, "isInterface", isInterface); +__publicField(Interface, "getClient", getClient); +function getAsInterface(p) { + if (getTargetPointerType(p) === PointerType.OTHER) { + return new Interface(p.segment, p.byteOffset, p._capnp.depthLimit); + } + return null; +} +function isInterface(p) { + return getTargetPointerType(p) === PointerType.OTHER; +} +function getCapID(i) { + if (i.segment.getUint32(i.byteOffset) !== PointerType.OTHER) { + return -1; + } + return i.segment.getUint32(i.byteOffset + 4); +} +function getClient(i) { + const capID = getCapID(i); + const { capTable } = i.segment.message._capnp; + if (!capTable) { + return null; + } + return capTable[capID]; +} + +// ../../node_modules/.pnpm/capnp-es@0.0.7_typescript@5.7.3/node_modules/capnp-es/dist/index.mjs +var Void = class extends Struct { +}; +__publicField(Void, "_capnp", { + displayName: "Void", + id: "0", + size: new ObjectSize(0, 0) +}); +var utils = { + __proto__: null, + PointerAllocationResult, + add, + adopt, + checkDataBounds, + checkPointerBounds, + copyFrom, + copyFromInterface, + copyFromList, + copyFromStruct, + disown, + dump, + erase, + erasePointer, + followFar, + followFars, + getAs, + getBit, + getCapabilityId, + getContent, + getData, + getDataSection, + getFarSegmentId, + getFloat32, + getFloat64, + getInt16, + getInt32, + getInt64, + getInt8, + getInterfaceClientOrNull, + getInterfaceClientOrNullAt, + getInterfacePointer, + getList, + getListByteLength, + getListElementByteLength, + getListElementSize, + getListLength, + getOffsetWords, + getPointer, + getPointerAs, + getPointerSection, + getPointerType, + getSize, + getStruct, + getStructDataWords, + getStructPointerLength, + getStructSize, + getTargetCompositeListSize, + getTargetCompositeListTag, + getTargetListElementSize, + getTargetListLength, + getTargetPointerType, + getTargetStructSize, + getText, + getUint16, + getUint32, + getUint64, + getUint8, + initData, + initList, + initPointer, + initStruct, + initStructAt, + isDoubleFar, + isNull, + relocateTo, + resize, + setBit, + setFarPointer, + setFloat32, + setFloat64, + setInt16, + setInt32, + setInt64, + setInt8, + setInterfacePointer, + setListPointer, + setStructPointer, + setText, + setUint16, + setUint32, + setUint64, + setUint8, + testWhich, + trackPointerAllocation, + validate +}; +function PointerList(PointerClass) { + return class extends List { + static _capnp = { + displayName: `List<${PointerClass._capnp.displayName}>`, + size: ListElementSize.POINTER + }; + get(index) { + const c = getContent(this); + return new PointerClass( + c.segment, + c.byteOffset + index * 8, + this._capnp.depthLimit - 1 + ); + } + set(index, value) { + copyFrom(value, this.get(index)); + } + [Symbol.toStringTag]() { + return `Pointer_${super.toString()},cls:${PointerClass.toString()}`; + } + }; +} +var AnyPointerList = PointerList(Pointer); +var BoolList = class extends List { + get(index) { + const bitMask = 1 << index % 8; + const byteOffset = index >>> 3; + const c = getContent(this); + const v = c.segment.getUint8(c.byteOffset + byteOffset); + return (v & bitMask) !== 0; + } + set(index, value) { + const bitMask = 1 << index % 8; + const c = getContent(this); + const byteOffset = c.byteOffset + (index >>> 3); + const v = c.segment.getUint8(byteOffset); + c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask); + } + [Symbol.toStringTag]() { + return `Bool_${super.toString()}`; + } +}; +__publicField(BoolList, "_capnp", { + displayName: "List", + size: ListElementSize.BIT +}); +var DataList = PointerList(Data); +var Float32List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getFloat32(c.byteOffset + index * 4); + } + set(index, value) { + const c = getContent(this); + c.segment.setFloat32(c.byteOffset + index * 4, value); + } + [Symbol.toStringTag]() { + return `Float32_${super.toString()}`; + } +}; +__publicField(Float32List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_4 +}); +var Float64List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getFloat64(c.byteOffset + index * 8); + } + set(index, value) { + const c = getContent(this); + c.segment.setFloat64(c.byteOffset + index * 8, value); + } + [Symbol.toStringTag]() { + return `Float64_${super.toString()}`; + } +}; +__publicField(Float64List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_8 +}); +var Int8List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getInt8(c.byteOffset + index); + } + set(index, value) { + const c = getContent(this); + c.segment.setInt8(c.byteOffset + index, value); + } + [Symbol.toStringTag]() { + return `Int8_${super.toString()}`; + } +}; +__publicField(Int8List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE +}); +var Int16List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getInt16(c.byteOffset + index * 2); + } + set(index, value) { + const c = getContent(this); + c.segment.setInt16(c.byteOffset + index * 2, value); + } + [Symbol.toStringTag]() { + return `Int16_${super.toString()}`; + } +}; +__publicField(Int16List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_2 +}); +var Int32List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getInt32(c.byteOffset + index * 4); + } + set(index, value) { + const c = getContent(this); + c.segment.setInt32(c.byteOffset + index * 4, value); + } + [Symbol.toStringTag]() { + return `Int32_${super.toString()}`; + } +}; +__publicField(Int32List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_4 +}); +var Int64List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getInt64(c.byteOffset + index * 8); + } + set(index, value) { + const c = getContent(this); + c.segment.setInt64(c.byteOffset + index * 8, value); + } + [Symbol.toStringTag]() { + return `Int64_${super.toString()}`; + } +}; +__publicField(Int64List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_8 +}); +var InterfaceList = PointerList(Interface); +var TextList = class extends List { + get(index) { + const c = getContent(this); + c.byteOffset += index * 8; + return Text.fromPointer(c).get(0); + } + set(index, value) { + const c = getContent(this); + c.byteOffset += index * 8; + Text.fromPointer(c).set(0, value); + } + [Symbol.toStringTag]() { + return `Text_${super.toString()}`; + } +}; +__publicField(TextList, "_capnp", { + displayName: "List", + size: ListElementSize.POINTER +}); +var Uint8List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getUint8(c.byteOffset + index); + } + set(index, value) { + const c = getContent(this); + c.segment.setUint8(c.byteOffset + index, value); + } + [Symbol.toStringTag]() { + return `Uint8_${super.toString()}`; + } +}; +__publicField(Uint8List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE +}); +var Uint16List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getUint16(c.byteOffset + index * 2); + } + set(index, value) { + const c = getContent(this); + c.segment.setUint16(c.byteOffset + index * 2, value); + } + [Symbol.toStringTag]() { + return `Uint16_${super.toString()}`; + } +}; +__publicField(Uint16List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_2 +}); +var Uint32List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getUint32(c.byteOffset + index * 4); + } + set(index, value) { + const c = getContent(this); + c.segment.setUint32(c.byteOffset + index * 4, value); + } + [Symbol.toStringTag]() { + return `Uint32_${super.toString()}`; + } +}; +__publicField(Uint32List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_4 +}); +var Uint64List = class extends List { + get(index) { + const c = getContent(this); + return c.segment.getUint64(c.byteOffset + index * 8); + } + set(index, value) { + const c = getContent(this); + c.segment.setUint64(c.byteOffset + index * 8, value); + } + [Symbol.toStringTag]() { + return `Uint64_${super.toString()}`; + } +}; +__publicField(Uint64List, "_capnp", { + displayName: "List", + size: ListElementSize.BYTE_8 +}); +var VoidList = PointerList(Void); +var ConnWeakRefRegistry = globalThis.FinalizationRegistry ? new FinalizationRegistry((cb) => cb()) : void 0; + +// scripts/rtti/rtti.ts +var _capnpFileId = BigInt("0xb042d6da9e1721ad"); +var Type_Which = { + UNKNOWN: 0, + VOIDT: 1, + BOOLT: 2, + NUMBER: 3, + PROMISE: 4, + STRUCTURE: 5, + STRING: 6, + OBJECT: 7, + ARRAY: 8, + MAYBE: 9, + DICT: 10, + ONE_OF: 11, + BUILTIN: 12, + INTRINSIC: 13, + FUNCTION: 14, + JSG_IMPL: 15, + JS_BUILTIN: 16 +}; +var Type = class extends Struct { + get _isUnknown() { + return utils.getUint16(0, this) === 0; + } + set unknown(_) { + utils.setUint16(0, 0, this); + } + get _isVoidt() { + return utils.getUint16(0, this) === 1; + } + set voidt(_) { + utils.setUint16(0, 1, this); + } + get _isBoolt() { + return utils.getUint16(0, this) === 2; + } + set boolt(_) { + utils.setUint16(0, 2, this); + } + _adoptNumber(value) { + utils.setUint16(0, 3, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownNumber() { + return utils.disown(this.number); + } + /** + * number type + * */ + get number() { + utils.testWhich("number", utils.getUint16(0, this), 3, this); + return utils.getStruct(0, NumberType, this); + } + _hasNumber() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initNumber() { + utils.setUint16(0, 3, this); + return utils.initStructAt(0, NumberType, this); + } + get _isNumber() { + return utils.getUint16(0, this) === 3; + } + set number(value) { + utils.setUint16(0, 3, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptPromise(value) { + utils.setUint16(0, 4, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownPromise() { + return utils.disown(this.promise); + } + /** + * jsg, kj Promise + * */ + get promise() { + utils.testWhich("promise", utils.getUint16(0, this), 4, this); + return utils.getStruct(0, PromiseType, this); + } + _hasPromise() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initPromise() { + utils.setUint16(0, 4, this); + return utils.initStructAt(0, PromiseType, this); + } + get _isPromise() { + return utils.getUint16(0, this) === 4; + } + set promise(value) { + utils.setUint16(0, 4, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptStructure(value) { + utils.setUint16(0, 5, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownStructure() { + return utils.disown(this.structure); + } + /** + * jsg resource or struct + * */ + get structure() { + utils.testWhich("structure", utils.getUint16(0, this), 5, this); + return utils.getStruct(0, StructureType, this); + } + _hasStructure() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initStructure() { + utils.setUint16(0, 5, this); + return utils.initStructAt(0, StructureType, this); + } + get _isStructure() { + return utils.getUint16(0, this) === 5; + } + set structure(value) { + utils.setUint16(0, 5, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptString(value) { + utils.setUint16(0, 6, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownString() { + return utils.disown(this.string); + } + /** + * any string-like type + * */ + get string() { + utils.testWhich("string", utils.getUint16(0, this), 6, this); + return utils.getStruct(0, StringType, this); + } + _hasString() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initString() { + utils.setUint16(0, 6, this); + return utils.initStructAt(0, StringType, this); + } + get _isString() { + return utils.getUint16(0, this) === 6; + } + set string(value) { + utils.setUint16(0, 6, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + get _isObject() { + return utils.getUint16(0, this) === 7; + } + set object(_) { + utils.setUint16(0, 7, this); + } + _adoptArray(value) { + utils.setUint16(0, 8, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownArray() { + return utils.disown(this.array); + } + /** + * Array or ArrayPtr + * */ + get array() { + utils.testWhich("array", utils.getUint16(0, this), 8, this); + return utils.getStruct(0, ArrayType, this); + } + _hasArray() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initArray() { + utils.setUint16(0, 8, this); + return utils.initStructAt(0, ArrayType, this); + } + get _isArray() { + return utils.getUint16(0, this) === 8; + } + set array(value) { + utils.setUint16(0, 8, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptMaybe(value) { + utils.setUint16(0, 9, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownMaybe() { + return utils.disown(this.maybe); + } + /** + * kj::Maybe or jsg::Optional + * */ + get maybe() { + utils.testWhich("maybe", utils.getUint16(0, this), 9, this); + return utils.getStruct(0, MaybeType, this); + } + _hasMaybe() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initMaybe() { + utils.setUint16(0, 9, this); + return utils.initStructAt(0, MaybeType, this); + } + get _isMaybe() { + return utils.getUint16(0, this) === 9; + } + set maybe(value) { + utils.setUint16(0, 9, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptDict(value) { + utils.setUint16(0, 10, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownDict() { + return utils.disown(this.dict); + } + /** + * jsg::Dict + * */ + get dict() { + utils.testWhich("dict", utils.getUint16(0, this), 10, this); + return utils.getStruct(0, DictType, this); + } + _hasDict() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initDict() { + utils.setUint16(0, 10, this); + return utils.initStructAt(0, DictType, this); + } + get _isDict() { + return utils.getUint16(0, this) === 10; + } + set dict(value) { + utils.setUint16(0, 10, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptOneOf(value) { + utils.setUint16(0, 11, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownOneOf() { + return utils.disown(this.oneOf); + } + /** + * kj::OneOf + * */ + get oneOf() { + utils.testWhich("oneOf", utils.getUint16(0, this), 11, this); + return utils.getStruct(0, OneOfType, this); + } + _hasOneOf() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initOneOf() { + utils.setUint16(0, 11, this); + return utils.initStructAt(0, OneOfType, this); + } + get _isOneOf() { + return utils.getUint16(0, this) === 11; + } + set oneOf(value) { + utils.setUint16(0, 11, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptBuiltin(value) { + utils.setUint16(0, 12, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownBuiltin() { + return utils.disown(this.builtin); + } + /** + * one of the builtin types + * */ + get builtin() { + utils.testWhich("builtin", utils.getUint16(0, this), 12, this); + return utils.getStruct(0, BuiltinType, this); + } + _hasBuiltin() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initBuiltin() { + utils.setUint16(0, 12, this); + return utils.initStructAt(0, BuiltinType, this); + } + get _isBuiltin() { + return utils.getUint16(0, this) === 12; + } + set builtin(value) { + utils.setUint16(0, 12, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptIntrinsic(value) { + utils.setUint16(0, 13, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownIntrinsic() { + return utils.disown(this.intrinsic); + } + /** + * one of v8 intrinsics + * */ + get intrinsic() { + utils.testWhich("intrinsic", utils.getUint16(0, this), 13, this); + return utils.getStruct(0, IntrinsicType, this); + } + _hasIntrinsic() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initIntrinsic() { + utils.setUint16(0, 13, this); + return utils.initStructAt(0, IntrinsicType, this); + } + get _isIntrinsic() { + return utils.getUint16(0, this) === 13; + } + set intrinsic(value) { + utils.setUint16(0, 13, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptFunction(value) { + utils.setUint16(0, 14, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownFunction() { + return utils.disown(this.function); + } + /** + * jsg::Function + * */ + get function() { + utils.testWhich("function", utils.getUint16(0, this), 14, this); + return utils.getStruct(0, FunctionType, this); + } + _hasFunction() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initFunction() { + utils.setUint16(0, 14, this); + return utils.initStructAt(0, FunctionType, this); + } + get _isFunction() { + return utils.getUint16(0, this) === 14; + } + set function(value) { + utils.setUint16(0, 14, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptJsgImpl(value) { + utils.setUint16(0, 15, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownJsgImpl() { + return utils.disown(this.jsgImpl); + } + /** + * jsg implementation type + * */ + get jsgImpl() { + utils.testWhich("jsgImpl", utils.getUint16(0, this), 15, this); + return utils.getStruct(0, JsgImplType, this); + } + _hasJsgImpl() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initJsgImpl() { + utils.setUint16(0, 15, this); + return utils.initStructAt(0, JsgImplType, this); + } + get _isJsgImpl() { + return utils.getUint16(0, this) === 15; + } + set jsgImpl(value) { + utils.setUint16(0, 15, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptJsBuiltin(value) { + utils.setUint16(0, 16, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownJsBuiltin() { + return utils.disown(this.jsBuiltin); + } + get jsBuiltin() { + utils.testWhich("jsBuiltin", utils.getUint16(0, this), 16, this); + return utils.getStruct(0, JsBuiltinType, this); + } + _hasJsBuiltin() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initJsBuiltin() { + utils.setUint16(0, 16, this); + return utils.initStructAt(0, JsBuiltinType, this); + } + get _isJsBuiltin() { + return utils.getUint16(0, this) === 16; + } + set jsBuiltin(value) { + utils.setUint16(0, 16, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + toString() { + return "Type_" + super.toString(); + } + which() { + return utils.getUint16(0, this); + } +}; +__publicField(Type, "UNKNOWN", Type_Which.UNKNOWN); +__publicField(Type, "VOIDT", Type_Which.VOIDT); +__publicField(Type, "BOOLT", Type_Which.BOOLT); +__publicField(Type, "NUMBER", Type_Which.NUMBER); +__publicField(Type, "PROMISE", Type_Which.PROMISE); +__publicField(Type, "STRUCTURE", Type_Which.STRUCTURE); +__publicField(Type, "STRING", Type_Which.STRING); +__publicField(Type, "OBJECT", Type_Which.OBJECT); +__publicField(Type, "ARRAY", Type_Which.ARRAY); +__publicField(Type, "MAYBE", Type_Which.MAYBE); +__publicField(Type, "DICT", Type_Which.DICT); +__publicField(Type, "ONE_OF", Type_Which.ONE_OF); +__publicField(Type, "BUILTIN", Type_Which.BUILTIN); +__publicField(Type, "INTRINSIC", Type_Which.INTRINSIC); +__publicField(Type, "FUNCTION", Type_Which.FUNCTION); +__publicField(Type, "JSG_IMPL", Type_Which.JSG_IMPL); +__publicField(Type, "JS_BUILTIN", Type_Which.JS_BUILTIN); +__publicField(Type, "_capnp", { + displayName: "Type", + id: "d2347ab301451a8c", + size: new ObjectSize(8, 1) +}); +var NumberType = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + toString() { + return "NumberType_" + super.toString(); + } +}; +__publicField(NumberType, "_capnp", { + displayName: "NumberType", + id: "afd4316863bdd80a", + size: new ObjectSize(0, 1) +}); +var PromiseType = class extends Struct { + _adoptValue(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownValue() { + return utils.disown(this.value); + } + get value() { + return utils.getStruct(0, Type, this); + } + _hasValue() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initValue() { + return utils.initStructAt(0, Type, this); + } + set value(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + toString() { + return "PromiseType_" + super.toString(); + } +}; +__publicField(PromiseType, "_capnp", { + displayName: "PromiseType", + id: "977eaa74d24bb2dc", + size: new ObjectSize(0, 1) +}); +var StructureType = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + get fullyQualifiedName() { + return utils.getText(1, this); + } + set fullyQualifiedName(value) { + utils.setText(1, value, this); + } + toString() { + return "StructureType_" + super.toString(); + } +}; +__publicField(StructureType, "_capnp", { + displayName: "StructureType", + id: "9001b3522132305a", + size: new ObjectSize(0, 2) +}); +var StringType = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + toString() { + return "StringType_" + super.toString(); + } +}; +__publicField(StringType, "_capnp", { + displayName: "StringType", + id: "913621db0713d640", + size: new ObjectSize(0, 1) +}); +var IntrinsicType = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + toString() { + return "IntrinsicType_" + super.toString(); + } +}; +__publicField(IntrinsicType, "_capnp", { + displayName: "IntrinsicType", + id: "87c24648e89ccc02", + size: new ObjectSize(0, 1) +}); +var ArrayType = class extends Struct { + _adoptElement(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownElement() { + return utils.disown(this.element); + } + get element() { + return utils.getStruct(0, Type, this); + } + _hasElement() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initElement() { + return utils.initStructAt(0, Type, this); + } + set element(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + get name() { + return utils.getText(1, this); + } + set name(value) { + utils.setText(1, value, this); + } + toString() { + return "ArrayType_" + super.toString(); + } +}; +__publicField(ArrayType, "_capnp", { + displayName: "ArrayType", + id: "f6d86da0d225932b", + size: new ObjectSize(0, 2) +}); +var MaybeType = class extends Struct { + _adoptValue(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownValue() { + return utils.disown(this.value); + } + get value() { + return utils.getStruct(0, Type, this); + } + _hasValue() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initValue() { + return utils.initStructAt(0, Type, this); + } + set value(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + get name() { + return utils.getText(1, this); + } + set name(value) { + utils.setText(1, value, this); + } + toString() { + return "MaybeType_" + super.toString(); + } +}; +__publicField(MaybeType, "_capnp", { + displayName: "MaybeType", + id: "9d64649bff8a5cee", + size: new ObjectSize(0, 2) +}); +var DictType = class extends Struct { + _adoptKey(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownKey() { + return utils.disown(this.key); + } + get key() { + return utils.getStruct(0, Type, this); + } + _hasKey() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initKey() { + return utils.initStructAt(0, Type, this); + } + set key(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptValue(value) { + utils.adopt(value, utils.getPointer(1, this)); + } + _disownValue() { + return utils.disown(this.value); + } + get value() { + return utils.getStruct(1, Type, this); + } + _hasValue() { + return !utils.isNull(utils.getPointer(1, this)); + } + _initValue() { + return utils.initStructAt(1, Type, this); + } + set value(value) { + utils.copyFrom(value, utils.getPointer(1, this)); + } + toString() { + return "DictType_" + super.toString(); + } +}; +__publicField(DictType, "_capnp", { + displayName: "DictType", + id: "b7d8e1ee6205d554", + size: new ObjectSize(0, 2) +}); +var _OneOfType = class extends Struct { + _adoptVariants(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownVariants() { + return utils.disown(this.variants); + } + get variants() { + return utils.getList(0, _OneOfType._Variants, this); + } + _hasVariants() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initVariants(length) { + return utils.initList(0, _OneOfType._Variants, length, this); + } + set variants(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + toString() { + return "OneOfType_" + super.toString(); + } +}; +var OneOfType = _OneOfType; +__publicField(OneOfType, "_capnp", { + displayName: "OneOfType", + id: "95216521d1f195ae", + size: new ObjectSize(0, 1) +}); +__publicField(OneOfType, "_Variants"); +var BuiltinType_Type = { + V8UINT8ARRAY: 0, + V8ARRAY_BUFFER_VIEW: 1, + JSG_BUFFER_SOURCE: 2, + KJ_DATE: 3, + V8FUNCTION: 4, + V8ARRAY_BUFFER: 5 +}; +var BuiltinType = class extends Struct { + get type() { + return utils.getUint16(0, this); + } + set type(value) { + utils.setUint16(0, value, this); + } + toString() { + return "BuiltinType_" + super.toString(); + } +}; +__publicField(BuiltinType, "Type", BuiltinType_Type); +__publicField(BuiltinType, "_capnp", { + displayName: "BuiltinType", + id: "96dfb79b276b3379", + size: new ObjectSize(8, 0) +}); +var _FunctionType = class extends Struct { + _adoptReturnType(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownReturnType() { + return utils.disown(this.returnType); + } + get returnType() { + return utils.getStruct(0, Type, this); + } + _hasReturnType() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initReturnType() { + return utils.initStructAt(0, Type, this); + } + set returnType(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptArgs(value) { + utils.adopt(value, utils.getPointer(1, this)); + } + _disownArgs() { + return utils.disown(this.args); + } + get args() { + return utils.getList(1, _FunctionType._Args, this); + } + _hasArgs() { + return !utils.isNull(utils.getPointer(1, this)); + } + _initArgs(length) { + return utils.initList(1, _FunctionType._Args, length, this); + } + set args(value) { + utils.copyFrom(value, utils.getPointer(1, this)); + } + toString() { + return "FunctionType_" + super.toString(); + } +}; +var FunctionType = _FunctionType; +__publicField(FunctionType, "_capnp", { + displayName: "FunctionType", + id: "d7c3505ac05e5fad", + size: new ObjectSize(0, 2) +}); +__publicField(FunctionType, "_Args"); +var JsgImplType_Type = { + CONFIGURATION: 0, + V8ISOLATE: 1, + JSG_LOCK: 2, + JSG_TYPE_HANDLER: 3, + JSG_UNIMPLEMENTED: 4, + JSG_VARARGS: 5, + JSG_SELF_REF: 6, + V8FUNCTION_CALLBACK_INFO: 7, + V8PROPERTY_CALLBACK_INFO: 8, + JSG_NAME: 9 +}; +var JsgImplType = class extends Struct { + get type() { + return utils.getUint16(0, this); + } + set type(value) { + utils.setUint16(0, value, this); + } + toString() { + return "JsgImplType_" + super.toString(); + } +}; +__publicField(JsgImplType, "Type", JsgImplType_Type); +__publicField(JsgImplType, "_capnp", { + displayName: "JsgImplType", + id: "e0dfbe1216e6985e", + size: new ObjectSize(8, 0) +}); +var _Structure = class extends Struct { + /** + * Structure name + * */ + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + /** + * All members in declaration order + * */ + get fullyQualifiedName() { + return utils.getText(3, this); + } + set fullyQualifiedName(value) { + utils.setText(3, value, this); + } + _adoptMembers(value) { + utils.adopt(value, utils.getPointer(1, this)); + } + _disownMembers() { + return utils.disown(this.members); + } + /** + * base type + * */ + get members() { + return utils.getList(1, _Structure._Members, this); + } + _hasMembers() { + return !utils.isNull(utils.getPointer(1, this)); + } + _initMembers(length) { + return utils.initList(1, _Structure._Members, length, this); + } + set members(value) { + utils.copyFrom(value, utils.getPointer(1, this)); + } + _adoptExtends(value) { + utils.adopt(value, utils.getPointer(2, this)); + } + _disownExtends() { + return utils.disown(this.extends); + } + /** + * true if the structure is iterable + * */ + get extends() { + return utils.getStruct(2, Type, this); + } + _hasExtends() { + return !utils.isNull(utils.getPointer(2, this)); + } + _initExtends() { + return utils.initStructAt(2, Type, this); + } + set extends(value) { + utils.copyFrom(value, utils.getPointer(2, this)); + } + /** + * true if the structure is async iterable + * */ + get iterable() { + return utils.getBit(0, this); + } + set iterable(value) { + utils.setBit(0, value, this); + } + _adoptIterator(value) { + utils.adopt(value, utils.getPointer(4, this)); + } + _disownIterator() { + return utils.disown(this.iterator); + } + /** + * Fully-qualified structure name including namespaces and parents + * */ + get iterator() { + return utils.getStruct(4, Method, this); + } + _hasIterator() { + return !utils.isNull(utils.getPointer(4, this)); + } + _initIterator() { + return utils.initStructAt(4, Method, this); + } + set iterator(value) { + utils.copyFrom(value, utils.getPointer(4, this)); + } + /** + * Method returning iterator if the structure is iterable + * */ + get asyncIterable() { + return utils.getBit(1, this); + } + set asyncIterable(value) { + utils.setBit(1, value, this); + } + _adoptAsyncIterator(value) { + utils.adopt(value, utils.getPointer(5, this)); + } + _disownAsyncIterator() { + return utils.disown(this.asyncIterator); + } + /** + * Method returning async iterator if the structure is async iterable + * */ + get asyncIterator() { + return utils.getStruct(5, Method, this); + } + _hasAsyncIterator() { + return !utils.isNull(utils.getPointer(5, this)); + } + _initAsyncIterator() { + return utils.initStructAt(5, Method, this); + } + set asyncIterator(value) { + utils.copyFrom(value, utils.getPointer(5, this)); + } + /** + * See `JSG_TS_ROOT`'s documentation in the `## TypeScript` section of the JSG README.md. + * If `JSG_(STRUCT_)TS_ROOT` is declared for a type, this value will be `true`. + * */ + get disposable() { + return utils.getBit(3, this); + } + set disposable(value) { + utils.setBit(3, value, this); + } + _adoptDispose(value) { + utils.adopt(value, utils.getPointer(10, this)); + } + _disownDispose() { + return utils.disown(this.dispose); + } + /** + * See `JSG_TS_OVERRIDE`'s documentation in the `## TypeScript` section of the JSG README.md. + * If `JSG_(STRUCT_)TS_OVERRIDE` is declared for a type, this value will be the contents of the + * macro declaration verbatim. + * */ + get dispose() { + return utils.getStruct(10, Method, this); + } + _hasDispose() { + return !utils.isNull(utils.getPointer(10, this)); + } + _initDispose() { + return utils.initStructAt(10, Method, this); + } + set dispose(value) { + utils.copyFrom(value, utils.getPointer(10, this)); + } + /** + * See `JSG_TS_DEFINE`'s documentation in the `## TypeScript` section of the JSG README.md. + * If `JSG_(STRUCT_)TS_DEFINE` is declared for a type, this value will be the contents of the + * macro declaration verbatim. + * */ + get asyncDisposable() { + return utils.getBit(4, this); + } + set asyncDisposable(value) { + utils.setBit(4, value, this); + } + _adoptAsyncDispose(value) { + utils.adopt(value, utils.getPointer(11, this)); + } + _disownAsyncDispose() { + return utils.disown(this.asyncDispose); + } + /** + * If this type is callable as a function, the signature of said function. Otherwise, null. + * */ + get asyncDispose() { + return utils.getStruct(11, Method, this); + } + _hasAsyncDispose() { + return !utils.isNull(utils.getPointer(11, this)); + } + _initAsyncDispose() { + return utils.initStructAt(11, Method, this); + } + set asyncDispose(value) { + utils.copyFrom(value, utils.getPointer(11, this)); + } + /** + * List of all builtin modules provided by the context. + * */ + get tsRoot() { + return utils.getBit(2, this); + } + set tsRoot(value) { + utils.setBit(2, value, this); + } + /** + * true if the structure is disposable + * */ + get tsOverride() { + return utils.getText(6, this); + } + set tsOverride(value) { + utils.setText(6, value, this); + } + /** + * dispose method + * */ + get tsDefine() { + return utils.getText(7, this); + } + set tsDefine(value) { + utils.setText(7, value, this); + } + _adoptCallable(value) { + utils.adopt(value, utils.getPointer(8, this)); + } + _disownCallable() { + return utils.disown(this.callable); + } + /** + * true if the structure is async disposable + * */ + get callable() { + return utils.getStruct(8, FunctionType, this); + } + _hasCallable() { + return !utils.isNull(utils.getPointer(8, this)); + } + _initCallable() { + return utils.initStructAt(8, FunctionType, this); + } + set callable(value) { + utils.copyFrom(value, utils.getPointer(8, this)); + } + _adoptBuiltinModules(value) { + utils.adopt(value, utils.getPointer(9, this)); + } + _disownBuiltinModules() { + return utils.disown(this.builtinModules); + } + /** + * asyncDispose method + * */ + get builtinModules() { + return utils.getList(9, _Structure._BuiltinModules, this); + } + _hasBuiltinModules() { + return !utils.isNull(utils.getPointer(9, this)); + } + _initBuiltinModules(length) { + return utils.initList(9, _Structure._BuiltinModules, length, this); + } + set builtinModules(value) { + utils.copyFrom(value, utils.getPointer(9, this)); + } + toString() { + return "Structure_" + super.toString(); + } +}; +var Structure = _Structure; +__publicField(Structure, "_capnp", { + displayName: "Structure", + id: "c9aee5d3d27484f2", + size: new ObjectSize(8, 12) +}); +__publicField(Structure, "_Members"); +__publicField(Structure, "_BuiltinModules"); +var Member_Nested = class extends Struct { + _adoptStructure(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownStructure() { + return utils.disown(this.structure); + } + get structure() { + return utils.getStruct(0, Structure, this); + } + _hasStructure() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initStructure() { + return utils.initStructAt(0, Structure, this); + } + set structure(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + /** + * For JSG_NESTED_TYPE_NAMED, if name is different to structure + * */ + get name() { + return utils.getText(1, this); + } + set name(value) { + utils.setText(1, value, this); + } + toString() { + return "Member_Nested_" + super.toString(); + } +}; +__publicField(Member_Nested, "_capnp", { + displayName: "nested", + id: "cc1920702876b1f6", + size: new ObjectSize(8, 2) +}); +var Member_Which = { + METHOD: 0, + PROPERTY: 1, + NESTED: 2, + CONSTANT: 3, + CONSTRUCTOR: 4 +}; +var Member = class extends Struct { + _adoptMethod(value) { + utils.setUint16(0, 0, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownMethod() { + return utils.disown(this.method); + } + /** + * any kind of method + * */ + get method() { + utils.testWhich("method", utils.getUint16(0, this), 0, this); + return utils.getStruct(0, Method, this); + } + _hasMethod() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initMethod() { + utils.setUint16(0, 0, this); + return utils.initStructAt(0, Method, this); + } + get _isMethod() { + return utils.getUint16(0, this) === 0; + } + set method(value) { + utils.setUint16(0, 0, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptProperty(value) { + utils.setUint16(0, 1, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownProperty() { + return utils.disown(this.property); + } + /** + * any kind of property + * */ + get property() { + utils.testWhich("property", utils.getUint16(0, this), 1, this); + return utils.getStruct(0, Property, this); + } + _hasProperty() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initProperty() { + utils.setUint16(0, 1, this); + return utils.initStructAt(0, Property, this); + } + get _isProperty() { + return utils.getUint16(0, this) === 1; + } + set property(value) { + utils.setUint16(0, 1, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + /** + * nested type + * */ + get nested() { + utils.testWhich("nested", utils.getUint16(0, this), 2, this); + return utils.getAs(Member_Nested, this); + } + _initNested() { + utils.setUint16(0, 2, this); + return utils.getAs(Member_Nested, this); + } + get _isNested() { + return utils.getUint16(0, this) === 2; + } + set nested(_) { + utils.setUint16(0, 2, this); + } + _adoptConstant(value) { + utils.setUint16(0, 3, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownConstant() { + return utils.disown(this.constant); + } + /** + * static constant + * */ + get constant() { + utils.testWhich("constant", utils.getUint16(0, this), 3, this); + return utils.getStruct(0, Constant, this); + } + _hasConstant() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initConstant() { + utils.setUint16(0, 3, this); + return utils.initStructAt(0, Constant, this); + } + get _isConstant() { + return utils.getUint16(0, this) === 3; + } + set constant(value) { + utils.setUint16(0, 3, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptConstructor(value) { + utils.setUint16(0, 4, this); + utils.adopt(value, utils.getPointer(0, this)); + } + _disownConstructor() { + return utils.disown(this.constructor); + } + /** + * structure constructor + * */ + get $constructor() { + utils.testWhich("constructor", utils.getUint16(0, this), 4, this); + return utils.getStruct(0, Constructor, this); + } + _hasConstructor() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initConstructor() { + utils.setUint16(0, 4, this); + return utils.initStructAt(0, Constructor, this); + } + get _isConstructor() { + return utils.getUint16(0, this) === 4; + } + set $constructor(value) { + utils.setUint16(0, 4, this); + utils.copyFrom(value, utils.getPointer(0, this)); + } + toString() { + return "Member_" + super.toString(); + } + which() { + return utils.getUint16(0, this); + } +}; +__publicField(Member, "METHOD", Member_Which.METHOD); +__publicField(Member, "PROPERTY", Member_Which.PROPERTY); +__publicField(Member, "NESTED", Member_Which.NESTED); +__publicField(Member, "CONSTANT", Member_Which.CONSTANT); +__publicField(Member, "CONSTRUCTOR", Member_Which.CONSTRUCTOR); +__publicField(Member, "_capnp", { + displayName: "Member", + id: "85c316fd4114aba7", + size: new ObjectSize(8, 2) +}); +var _Method = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + _adoptReturnType(value) { + utils.adopt(value, utils.getPointer(1, this)); + } + _disownReturnType() { + return utils.disown(this.returnType); + } + get returnType() { + return utils.getStruct(1, Type, this); + } + _hasReturnType() { + return !utils.isNull(utils.getPointer(1, this)); + } + _initReturnType() { + return utils.initStructAt(1, Type, this); + } + set returnType(value) { + utils.copyFrom(value, utils.getPointer(1, this)); + } + _adoptArgs(value) { + utils.adopt(value, utils.getPointer(2, this)); + } + _disownArgs() { + return utils.disown(this.args); + } + get args() { + return utils.getList(2, _Method._Args, this); + } + _hasArgs() { + return !utils.isNull(utils.getPointer(2, this)); + } + _initArgs(length) { + return utils.initList(2, _Method._Args, length, this); + } + set args(value) { + utils.copyFrom(value, utils.getPointer(2, this)); + } + get static() { + return utils.getBit(0, this); + } + set static(value) { + utils.setBit(0, value, this); + } + toString() { + return "Method_" + super.toString(); + } +}; +var Method = _Method; +__publicField(Method, "_capnp", { + displayName: "Method", + id: "a0a20f19ed7321e8", + size: new ObjectSize(8, 3) +}); +__publicField(Method, "_Args"); +var Property = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + _adoptType(value) { + utils.adopt(value, utils.getPointer(1, this)); + } + _disownType() { + return utils.disown(this.type); + } + get type() { + return utils.getStruct(1, Type, this); + } + _hasType() { + return !utils.isNull(utils.getPointer(1, this)); + } + _initType() { + return utils.initStructAt(1, Type, this); + } + set type(value) { + utils.copyFrom(value, utils.getPointer(1, this)); + } + get readonly() { + return utils.getBit(0, this); + } + set readonly(value) { + utils.setBit(0, value, this); + } + get lazy() { + return utils.getBit(1, this); + } + set lazy(value) { + utils.setBit(1, value, this); + } + get prototype() { + return utils.getBit(2, this); + } + set prototype(value) { + utils.setBit(2, value, this); + } + toString() { + return "Property_" + super.toString(); + } +}; +__publicField(Property, "_capnp", { + displayName: "Property", + id: "e1d238e9fecd3757", + size: new ObjectSize(8, 2) +}); +var Constant = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + /** + * TODO: we may need a union here + * */ + get value() { + return utils.getInt64(0, this); + } + set value(value) { + utils.setInt64(0, value, this); + } + toString() { + return "Constant_" + super.toString(); + } +}; +__publicField(Constant, "_capnp", { + displayName: "Constant", + id: "e354a1a55c4cfc59", + size: new ObjectSize(8, 1) +}); +var _Constructor = class extends Struct { + _adoptArgs(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownArgs() { + return utils.disown(this.args); + } + get args() { + return utils.getList(0, _Constructor._Args, this); + } + _hasArgs() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initArgs(length) { + return utils.initList(0, _Constructor._Args, length, this); + } + set args(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + toString() { + return "Constructor_" + super.toString(); + } +}; +var Constructor = _Constructor; +__publicField(Constructor, "_capnp", { + displayName: "Constructor", + id: "f4610fdb47099d17", + size: new ObjectSize(0, 1) +}); +__publicField(Constructor, "_Args"); +var Module_Which = { + STRUCTURE_NAME: 0, + TS_DECLARATIONS: 1 +}; +var Module = class extends Struct { + /** + * if anyone ever needs module type, it can be implemented by either fixing the Modules reference + * problem above or copying the original enum. + * type @1 :Modules.ModuleType; + * */ + get specifier() { + return utils.getText(0, this); + } + set specifier(value) { + utils.setText(0, value, this); + } + get structureName() { + utils.testWhich("structureName", utils.getUint16(0, this), 0, this); + return utils.getText(1, this); + } + get _isStructureName() { + return utils.getUint16(0, this) === 0; + } + set structureName(value) { + utils.setUint16(0, 0, this); + utils.setText(1, value, this); + } + get tsDeclarations() { + utils.testWhich("tsDeclarations", utils.getUint16(0, this), 1, this); + return utils.getText(1, this); + } + get _isTsDeclarations() { + return utils.getUint16(0, this) === 1; + } + set tsDeclarations(value) { + utils.setUint16(0, 1, this); + utils.setText(1, value, this); + } + toString() { + return "Module_" + super.toString(); + } + which() { + return utils.getUint16(0, this); + } +}; +__publicField(Module, "STRUCTURE_NAME", Module_Which.STRUCTURE_NAME); +__publicField(Module, "TS_DECLARATIONS", Module_Which.TS_DECLARATIONS); +__publicField(Module, "_capnp", { + displayName: "Module", + id: "cd4221e3248069bd", + size: new ObjectSize(8, 2) +}); +var _StructureGroups_StructureGroup = class extends Struct { + get name() { + return utils.getText(0, this); + } + set name(value) { + utils.setText(0, value, this); + } + _adoptStructures(value) { + utils.adopt(value, utils.getPointer(1, this)); + } + _disownStructures() { + return utils.disown(this.structures); + } + get structures() { + return utils.getList(1, _StructureGroups_StructureGroup._Structures, this); + } + _hasStructures() { + return !utils.isNull(utils.getPointer(1, this)); + } + _initStructures(length) { + return utils.initList(1, _StructureGroups_StructureGroup._Structures, length, this); + } + set structures(value) { + utils.copyFrom(value, utils.getPointer(1, this)); + } + toString() { + return "StructureGroups_StructureGroup_" + super.toString(); + } +}; +var StructureGroups_StructureGroup = _StructureGroups_StructureGroup; +__publicField(StructureGroups_StructureGroup, "_capnp", { + displayName: "StructureGroup", + id: "fe89d9d03a268a31", + size: new ObjectSize(0, 2) +}); +__publicField(StructureGroups_StructureGroup, "_Structures"); +var _StructureGroups = class extends Struct { + _adoptGroups(value) { + utils.adopt(value, utils.getPointer(0, this)); + } + _disownGroups() { + return utils.disown(this.groups); + } + get groups() { + return utils.getList(0, _StructureGroups._Groups, this); + } + _hasGroups() { + return !utils.isNull(utils.getPointer(0, this)); + } + _initGroups(length) { + return utils.initList(0, _StructureGroups._Groups, length, this); + } + set groups(value) { + utils.copyFrom(value, utils.getPointer(0, this)); + } + _adoptModules(value) { + utils.adopt(value, utils.getPointer(1, this)); + } + _disownModules() { + return utils.disown(this.modules); + } + get modules() { + return utils.getList(1, _StructureGroups._Modules, this); + } + _hasModules() { + return !utils.isNull(utils.getPointer(1, this)); + } + _initModules(length) { + return utils.initList(1, _StructureGroups._Modules, length, this); + } + set modules(value) { + utils.copyFrom(value, utils.getPointer(1, this)); + } + toString() { + return "StructureGroups_" + super.toString(); + } +}; +var StructureGroups = _StructureGroups; +__publicField(StructureGroups, "StructureGroup", StructureGroups_StructureGroup); +__publicField(StructureGroups, "_capnp", { + displayName: "StructureGroups", + id: "ed8c71dbb06eb831", + size: new ObjectSize(0, 2) +}); +__publicField(StructureGroups, "_Groups"); +__publicField(StructureGroups, "_Modules"); +var JsBuiltinType = class extends Struct { + /** + * module from which the property is imported + * */ + get module() { + return utils.getText(0, this); + } + set module(value) { + utils.setText(0, value, this); + } + /** + * export name of the property + * */ + get export() { + return utils.getText(1, this); + } + set export(value) { + utils.setText(1, value, this); + } + toString() { + return "JsBuiltinType_" + super.toString(); + } +}; +__publicField(JsBuiltinType, "_capnp", { + displayName: "JsBuiltinType", + id: "ccf1cde29b10a0bb", + size: new ObjectSize(0, 2) +}); +OneOfType._Variants = CompositeList(Type); +FunctionType._Args = CompositeList(Type); +Structure._Members = CompositeList(Member); +Structure._BuiltinModules = CompositeList(Module); +Method._Args = CompositeList(Type); +Constructor._Args = CompositeList(Type); +StructureGroups_StructureGroup._Structures = CompositeList(Structure); +StructureGroups._Groups = CompositeList(StructureGroups_StructureGroup); +StructureGroups._Modules = CompositeList(Module); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + ArrayType, + BuiltinType, + BuiltinType_Type, + Constant, + Constructor, + DictType, + FunctionType, + IntrinsicType, + JsBuiltinType, + JsgImplType, + JsgImplType_Type, + MaybeType, + Member, + Member_Nested, + Member_Which, + Method, + Module, + Module_Which, + NumberType, + OneOfType, + PromiseType, + Property, + StringType, + Structure, + StructureGroups, + StructureGroups_StructureGroup, + StructureType, + Type, + Type_Which, + _capnpFileId +}); diff --git a/packages/vitest-pool-workers/src/shared/chunking-socket.ts b/packages/vitest-pool-workers/src/shared/chunking-socket.ts index 1b13347a0b90..a07dd528669f 100644 --- a/packages/vitest-pool-workers/src/shared/chunking-socket.ts +++ b/packages/vitest-pool-workers/src/shared/chunking-socket.ts @@ -13,7 +13,7 @@ export interface SocketLike { * This assumes in-order delivery of chunks. */ export function createChunkingSocket( - socket: SocketLike, + socket: SocketLike | string>, maxChunkByteLength = 1_048_576 /* 1 MiB */ ): SocketLike { const listeners: ((message: string) => void)[] = []; diff --git a/packages/vitest-pool-workers/tsconfig.json b/packages/vitest-pool-workers/tsconfig.json index 0240c5ea0c1b..358fb330a631 100644 --- a/packages/vitest-pool-workers/tsconfig.json +++ b/packages/vitest-pool-workers/tsconfig.json @@ -9,6 +9,7 @@ "@cloudflare/vitest-pool-workers/config": ["./src/config"] } }, + "exclude": ["./scripts/**/rtti.ts"], "include": [ "./scripts/**/*.ts", "./src/config/**/*.ts", diff --git a/packages/workers-shared/asset-worker/src/assets-manifest.ts b/packages/workers-shared/asset-worker/src/assets-manifest.ts index 25eb8a797de4..6f2ad737d1c8 100644 --- a/packages/workers-shared/asset-worker/src/assets-manifest.ts +++ b/packages/workers-shared/asset-worker/src/assets-manifest.ts @@ -25,7 +25,10 @@ export class AssetsManifest { const hashPath = async (path: string) => { const encoder = new TextEncoder(); const data = encoder.encode(path); - const hashBuffer = await crypto.subtle.digest("SHA-256", data.buffer); + const hashBuffer = await crypto.subtle.digest( + "SHA-256", + data.buffer as ArrayBuffer + ); return new Uint8Array(hashBuffer, 0, PATH_HASH_SIZE); }; diff --git a/packages/wrangler/src/deployment-bundle/find-additional-modules.ts b/packages/wrangler/src/deployment-bundle/find-additional-modules.ts index 55ee98d2ba2c..cdefd16c179c 100644 --- a/packages/wrangler/src/deployment-bundle/find-additional-modules.ts +++ b/packages/wrangler/src/deployment-bundle/find-additional-modules.ts @@ -157,7 +157,9 @@ async function matchFiles( continue; } const absoluteFilePath = path.join(relativeTo, filePath); - const fileContent = await readFile(absoluteFilePath); + const fileContent = (await readFile( + absoluteFilePath + )) as Buffer; const module = { name: filePath, diff --git a/packages/wrangler/src/deployment-bundle/module-collection.ts b/packages/wrangler/src/deployment-bundle/module-collection.ts index 8087d0ac8a62..b35e9f576384 100644 --- a/packages/wrangler/src/deployment-bundle/module-collection.ts +++ b/packages/wrangler/src/deployment-bundle/module-collection.ts @@ -200,7 +200,9 @@ export function createModuleCollector(props: { props.wrangler1xLegacyModuleReferences!.rootDirectory, args.path ); - const fileContent = await readFile(filePath); + const fileContent = (await readFile( + filePath + )) as Buffer; const fileHash = crypto .createHash("sha1") .update(fileContent) @@ -296,7 +298,9 @@ export function createModuleCollector(props: { // Finally, load the file and hash it // If we didn't do any smart resolution above, this will attempt to load as an absolute path - const fileContent = await readFile(filePath); + const fileContent = (await readFile( + filePath + )) as Buffer; const fileHash = crypto .createHash("sha1") .update(fileContent) diff --git a/packages/wrangler/src/deployment-bundle/worker.ts b/packages/wrangler/src/deployment-bundle/worker.ts index 352eabd69f01..9622b838a6ef 100644 --- a/packages/wrangler/src/deployment-bundle/worker.ts +++ b/packages/wrangler/src/deployment-bundle/worker.ts @@ -55,7 +55,7 @@ export interface CfModule { * } * } */ - content: string | Buffer; + content: string | Buffer; /** * An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present * if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled @@ -99,7 +99,7 @@ export interface CfSendEmailBindings { */ export interface CfWasmModuleBindings { - [key: string]: string | Uint8Array; + [key: string]: string | Uint8Array; } /** @@ -140,7 +140,7 @@ export interface CfVersionMetadataBinding { */ export interface CfDataBlobBindings { - [key: string]: string | Uint8Array; + [key: string]: string | Uint8Array; } /** diff --git a/packages/wrangler/src/dev/miniflare.ts b/packages/wrangler/src/dev/miniflare.ts index d5c16274f57b..42298aa7b4d2 100644 --- a/packages/wrangler/src/dev/miniflare.ts +++ b/packages/wrangler/src/dev/miniflare.ts @@ -446,7 +446,7 @@ export function buildMiniflareBindingOptions(config: MiniflareBindingsConfig): { // services support JSRPC over HTTP CONNECT using a special hostname. // Refer to https://github.com/cloudflare/workerd/pull/1757 for details. let address: `${string}:${number}`; - let style = HttpOptions_Style.PROXY; + let style: HttpOptions_Style = HttpOptions_Style.PROXY; if (service.entrypoint !== undefined) { // If the user has requested a named entrypoint... if (target.entrypointAddresses === undefined) { diff --git a/packages/wrangler/src/versions/secrets/index.ts b/packages/wrangler/src/versions/secrets/index.ts index 8c2ef4254d3a..9152f64fe64a 100644 --- a/packages/wrangler/src/versions/secrets/index.ts +++ b/packages/wrangler/src/versions/secrets/index.ts @@ -247,7 +247,7 @@ async function parseModules( const mainModule: CfModule = { name: entrypointPart.name, filePath: "", - content: Buffer.from(await entrypointPart.arrayBuffer()), + content: Buffer.from(await entrypointPart.arrayBuffer()), type: fromMimeType(entrypointPart.type), }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0339342196a..60d44a211209 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,8 +19,8 @@ catalogs: specifier: ^5.0.10 version: 5.0.10 typescript: - specifier: ~5.6.3 - version: 5.6.3 + specifier: ^5.7.2 + version: 5.7.3 undici: specifier: ^5.28.4 version: 5.28.4 @@ -31,9 +31,6 @@ catalogs: specifier: ~2.1.8 version: 2.1.8 vite-plugin: - typescript: - specifier: ^5.7.2 - version: 5.7.3 unenv: specifier: npm:unenv-nightly@2.0.0-20241218-183400-5d6aec3 version: 2.0.0-20241218-183400-5d6aec3 @@ -50,15 +47,12 @@ overrides: '@types/react-transition-group>@types/react': ^18 '@cloudflare/elements>@types/react': ^18 capnpc-ts>typescript: 4.2.4 - '@types/node': ^18.19.59 + '@types/node': ^18.19.71 patchedDependencies: '@cloudflare/component-listbox@1.10.6': hash: r2d7tqjujhdts7e7zxsa3stjki path: patches/@cloudflare__component-listbox@1.10.6.patch - capnp-ts@0.7.0: - hash: l4yimnxyvkiyj6alnps2ec3sii - path: patches/capnp-ts@0.7.0.patch pg@8.11.3: hash: afbi5l3roukyz2s7kkn56yzjte path: patches/pg@8.11.3.patch @@ -93,10 +87,10 @@ importers: version: 0.21.4 '@turbo/gen': specifier: ^1.10.13 - version: 1.10.14(@types/node@18.19.59)(typescript@5.6.3) + version: 1.10.14(@types/node@18.19.74)(typescript@5.7.3) '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@vue/compiler-sfc': specifier: ^3.3.4 version: 3.3.4 @@ -129,13 +123,13 @@ importers: version: 2.2.3 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 vite: specifier: ^5.0.12 - version: 5.0.12(@types/node@18.19.59) + version: 5.0.12(@types/node@18.19.74) vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) fixtures/additional-modules: devDependencies: @@ -147,13 +141,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -165,13 +159,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -192,13 +186,13 @@ importers: version: 1.1.6 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -219,7 +213,7 @@ importers: version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -237,7 +231,7 @@ importers: version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -252,13 +246,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -276,13 +270,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -306,7 +300,7 @@ importers: version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) fixtures/isomorphic-random-example: {} @@ -321,17 +315,17 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 buffer: specifier: ^6.0.3 version: 6.0.3 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -343,7 +337,7 @@ importers: version: 7.0.0 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -362,13 +356,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -386,7 +380,7 @@ importers: version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -413,7 +407,7 @@ importers: version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -425,13 +419,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -446,13 +440,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -474,13 +468,13 @@ importers: version: link:../pages-plugin-example typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -492,13 +486,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -510,13 +504,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -531,13 +525,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -549,13 +543,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -586,13 +580,13 @@ importers: version: link:../pages-plugin-example typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -607,13 +601,13 @@ importers: version: link:../../packages/miniflare typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -628,7 +622,7 @@ importers: version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -643,13 +637,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -661,13 +655,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -679,13 +673,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -697,13 +691,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -715,13 +709,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -733,13 +727,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -751,13 +745,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -772,10 +766,10 @@ importers: version: link:../../packages/miniflare typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -790,13 +784,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -811,7 +805,7 @@ importers: version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -836,7 +830,7 @@ importers: devDependencies: vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -856,8 +850,8 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 ext-dep: specifier: file:./internal-module-resolution/vendor/ext-dep version: file:fixtures/vitest-pool-workers-examples/internal-module-resolution/vendor/ext-dep @@ -875,10 +869,10 @@ importers: version: 3.3.1(patch_hash=b5gffumfuckaq3c77sda2gdfuq) typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -899,13 +893,13 @@ importers: version: link:../../packages/workers-tsconfig typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -931,13 +925,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -952,13 +946,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -973,13 +967,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -991,13 +985,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -1009,13 +1003,13 @@ importers: version: 4.20250121.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../../packages/wrangler @@ -1071,8 +1065,8 @@ importers: specifier: ^10.0.7 version: 10.0.10 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/vscode': specifier: ^1.92.0 version: 1.95.0 @@ -1155,8 +1149,8 @@ importers: specifier: ^4.0.3 version: 4.0.3 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/semver': specifier: ^7.5.1 version: 7.5.1 @@ -1168,10 +1162,10 @@ importers: version: 17.0.24 '@typescript-eslint/eslint-plugin': specifier: ^6.9.0 - version: 6.10.0(@typescript-eslint/parser@6.10.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0)(typescript@5.6.3) + version: 6.10.0(@typescript-eslint/parser@6.10.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0)(typescript@5.7.3) '@typescript-eslint/parser': specifier: ^6.9.0 - version: 6.10.0(eslint@8.57.0)(typescript@5.6.3) + version: 6.10.0(eslint@8.57.0)(typescript@5.7.3) chalk: specifier: ^5.2.0 version: 5.3.0 @@ -1222,19 +1216,19 @@ importers: version: 7.6.3 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vite: specifier: catalog:default - version: 5.0.12(@types/node@18.19.59) + version: 5.0.12(@types/node@18.19.74) vite-tsconfig-paths: specifier: ^4.0.8 - version: 4.2.0(typescript@5.6.3)(vite@5.0.12(@types/node@18.19.59)) + version: 4.2.0(typescript@5.7.3)(vite@5.0.12(@types/node@18.19.74)) vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) which-pm-runs: specifier: ^1.1.0 version: 1.1.0 @@ -1361,8 +1355,8 @@ importers: specifier: ^3.0.4 version: 3.0.4 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/service-worker-mock': specifier: ^2.0.1 version: 2.0.4 @@ -1384,9 +1378,6 @@ importers: acorn-walk: specifier: ^8.2.0 version: 8.3.2 - capnp-ts: - specifier: ^0.7.0 - version: 0.7.0(patch_hash=l4yimnxyvkiyj6alnps2ec3sii) exit-hook: specifier: ^2.2.1 version: 2.2.1 @@ -1428,8 +1419,8 @@ importers: specifier: workspace:* version: link:../workflows-shared '@microsoft/api-extractor': - specifier: ^7.47.0 - version: 7.47.4(@types/node@18.19.59) + specifier: 7.49.1 + version: 7.49.1(@types/node@18.19.74) '@types/debug': specifier: ^4.1.7 version: 4.1.7 @@ -1446,8 +1437,8 @@ importers: specifier: ^3.0.4 version: 3.0.4 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/stoppable': specifier: ^1.1.1 version: 1.1.3 @@ -1466,9 +1457,9 @@ importers: ava: specifier: ^6.0.1 version: 6.1.1(@ava/typescript@4.1.0)(encoding@0.1.13) - capnpc-ts: - specifier: ^0.7.0 - version: 0.7.0 + capnp-es: + specifier: ^0.0.7 + version: 0.0.7(typescript@5.7.3) concurrently: specifier: ^8.2.2 version: 8.2.2 @@ -1520,6 +1511,9 @@ importers: source-map: specifier: ^0.6.1 version: 0.6.1 + typescript: + specifier: catalog:default + version: 5.7.3 which: specifier: ^2.0.2 version: 2.0.2 @@ -1680,16 +1674,16 @@ importers: version: '@types/node@22.10.6' typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 unbuild: specifier: ^3.2.0 - version: 3.3.1(typescript@5.6.3)(vue-tsc@2.0.29(typescript@5.6.3)) + version: 3.3.1(typescript@5.7.3)(vue-tsc@2.0.29(typescript@5.7.3)) undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../wrangler @@ -1719,8 +1713,8 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/ws': specifier: ^8.5.13 version: 8.5.13 @@ -1729,13 +1723,13 @@ importers: version: 0.30.17 tsup: specifier: 8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.4(@types/node@18.19.59))(jiti@2.4.2)(postcss@8.4.49)(typescript@5.7.3) + version: 8.3.0(@microsoft/api-extractor@7.49.1(@types/node@18.19.74))(jiti@2.4.2)(postcss@8.4.49)(typescript@5.7.3) typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: workspace:* version: link:../wrangler @@ -1752,7 +1746,7 @@ importers: specifier: ^1.48.1 version: 1.49.1 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 packages/vite-plugin-cloudflare/playground/cloudflare-env: @@ -1767,11 +1761,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1788,11 +1782,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1809,11 +1803,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1830,11 +1824,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1851,11 +1845,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1893,11 +1887,11 @@ importers: specifier: 6.2.1 version: 6.2.1 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1914,11 +1908,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1935,8 +1929,8 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/pg': specifier: ^8.11.2 version: 8.11.6 @@ -1950,11 +1944,11 @@ importers: specifier: ^1.1.1 version: 1.1.1 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -1985,13 +1979,13 @@ importers: version: 19.0.3(@types/react@19.0.7) '@vitejs/plugin-react': specifier: ^4.3.4 - version: 4.3.4(vite@6.0.7(@types/node@18.19.59)(jiti@2.4.2)) + version: 4.3.4(vite@6.0.7(@types/node@18.19.74)(jiti@2.4.2)) typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -2022,13 +2016,13 @@ importers: version: 19.0.3(@types/react@19.0.7) '@vitejs/plugin-react': specifier: ^4.3.4 - version: 4.3.4(vite@6.0.7(@types/node@18.19.59)(jiti@2.4.2)) + version: 4.3.4(vite@6.0.7(@types/node@18.19.74)(jiti@2.4.2)) typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -2045,11 +2039,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -2066,11 +2060,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -2087,11 +2081,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -2108,11 +2102,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -2129,11 +2123,11 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -2175,8 +2169,8 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/semver': specifier: ^7.5.1 version: 7.5.1 @@ -2186,24 +2180,21 @@ importers: '@vitest/snapshot': specifier: catalog:default version: 2.1.8 - capnp-ts: - specifier: ^0.7.0 - version: 0.7.0(patch_hash=l4yimnxyvkiyj6alnps2ec3sii) - capnpc-ts: - specifier: ^0.7.0 - version: 0.7.0 + capnp-es: + specifier: ^0.0.7 + version: 0.0.7(typescript@5.7.3) ts-dedent: specifier: ^2.2.0 version: 2.2.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) packages/workers-editor-shared: dependencies: @@ -2234,7 +2225,7 @@ importers: version: 6.10.0(eslint@8.57.0)(typescript@5.7.3) '@vitejs/plugin-react': specifier: ^4.3.3 - version: 4.3.3(vite@5.0.12(@types/node@18.19.59)) + version: 4.3.3(vite@5.0.12(@types/node@18.19.74)) eslint: specifier: ^8.49.0 version: 8.57.0 @@ -2246,10 +2237,10 @@ importers: version: 18.3.1(react@18.3.1) vite: specifier: ^5.0.12 - version: 5.0.12(@types/node@18.19.59) + version: 5.0.12(@types/node@18.19.74) vite-plugin-dts: specifier: ^4.0.1 - version: 4.0.1(@types/node@18.19.59)(rollup@4.30.1)(typescript@5.7.3)(vite@5.0.12(@types/node@18.19.59)) + version: 4.0.1(@types/node@18.19.74)(rollup@4.30.1)(typescript@5.7.3)(vite@5.0.12(@types/node@18.19.74)) packages/workers-playground: dependencies: @@ -2355,7 +2346,7 @@ importers: version: 6.10.0(eslint@8.57.0)(typescript@5.7.3) '@vitejs/plugin-react': specifier: ^4.3.3 - version: 4.3.3(vite@5.0.12(@types/node@18.19.59)) + version: 4.3.3(vite@5.0.12(@types/node@18.19.74)) eslint: specifier: ^8.49.0 version: 8.57.0 @@ -2367,7 +2358,7 @@ importers: version: 5.28.4 vite: specifier: catalog:default - version: 5.0.12(@types/node@18.19.59) + version: 5.0.12(@types/node@18.19.74) wrangler: specifier: workspace:^ version: link:../wrangler @@ -2410,10 +2401,10 @@ importers: version: 3.3.1(patch_hash=b5gffumfuckaq3c77sda2gdfuq) typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) packages/workers-tsconfig: {} @@ -2426,17 +2417,17 @@ importers: specifier: ^4.20250121.0 version: 4.20250121.0 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 miniflare: specifier: workspace:* version: link:../miniflare typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: specifier: workspace:* version: link:../wrangler @@ -2476,10 +2467,10 @@ importers: version: 5.0.10 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) packages/wrangler: dependencies: @@ -2547,7 +2538,7 @@ importers: version: 3.0.0 '@microsoft/api-extractor': specifier: ^7.47.0 - version: 7.47.4(@types/node@18.19.59) + version: 7.47.4(@types/node@18.19.74) '@sentry/node': specifier: ^7.86.0 version: 7.87.0(supports-color@9.2.2) @@ -2576,8 +2567,8 @@ importers: specifier: ^5.1.2 version: 5.1.2 '@types/node': - specifier: ^18.19.59 - version: 18.19.59 + specifier: ^18.19.71 + version: 18.19.74 '@types/node-forge': specifier: ^1.3.11 version: 1.3.11 @@ -2676,7 +2667,7 @@ importers: version: 9.3.1 msw: specifier: 2.4.3 - version: 2.4.3(typescript@5.6.3) + version: 2.4.3(typescript@5.7.3) node-forge: specifier: ^1.3.1 version: 1.3.1 @@ -2733,7 +2724,7 @@ importers: version: 1.5.0 typescript: specifier: catalog:default - version: 5.6.3 + version: 5.7.3 undici: specifier: catalog:default version: 5.28.4 @@ -2742,7 +2733,7 @@ importers: version: 1.5.4 vitest: specifier: catalog:default - version: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + version: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) vitest-websocket-mock: specifier: ^0.4.0 version: 0.4.0(vitest@2.1.8) @@ -4462,16 +4453,29 @@ packages: '@microsoft/api-extractor-model@7.29.4': resolution: {integrity: sha512-LHOMxmT8/tU1IiiiHOdHFF83Qsi+V8d0kLfscG4EvQE9cafiR8blOYr8SfkQKWB1wgEilQgXJX3MIA4vetDLZw==} + '@microsoft/api-extractor-model@7.30.2': + resolution: {integrity: sha512-3/t2F+WhkJgBzSNwlkTIL0tBgUoBqDqL66pT+nh2mPbM0NIDGVGtpqbGWPgHIzn/mn7kGS/Ep8D8po58e8UUIw==} + '@microsoft/api-extractor@7.47.4': resolution: {integrity: sha512-HKm+P4VNzWwvq1Ey+Jfhhj/3MjsD+ka2hbt8L5AcRM95lu1MFOYnz3XlU7Gr79Q/ZhOb7W/imAKeYrOI0bFydg==} hasBin: true + '@microsoft/api-extractor@7.49.1': + resolution: {integrity: sha512-jRTR/XbQF2kb+dYn8hfYSicOGA99+Fo00GrsdMwdfE3eIgLtKdH6Qa2M3wZV9S2XmbgCaGX1OdPtYctbfu5jQg==} + hasBin: true + '@microsoft/tsdoc-config@0.17.0': resolution: {integrity: sha512-v/EYRXnCAIHxOHW+Plb6OWuUoMotxTN0GLatnpOb1xq0KuTNw/WI3pamJx/UbsoJP5k9MCw1QxvvhPcF9pH3Zg==} + '@microsoft/tsdoc-config@0.17.1': + resolution: {integrity: sha512-UtjIFe0C6oYgTnad4q1QP4qXwLhe6tIpNTRStJ2RZEPIkqQPREAwE5spzVxsdn9UaEMUqhh0AqSx3X4nWAKXWw==} + '@microsoft/tsdoc@0.15.0': resolution: {integrity: sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==} + '@microsoft/tsdoc@0.15.1': + resolution: {integrity: sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==} + '@miniflare/cache@2.14.4': resolution: {integrity: sha512-ayzdjhcj+4mjydbNK7ZGDpIXNliDbQY4GPcY2KrYw0v1OSUdj5kZUkygD09fqoGRfAks0d91VelkyRsAXX8FQA==} engines: {node: '>=16.13'} @@ -4985,10 +4989,18 @@ packages: cpu: [x64] os: [win32] + '@rushstack/node-core-library@5.10.2': + resolution: {integrity: sha512-xOF/2gVJZTfjTxbo4BDj9RtQq/HFnrrKdtem4JkyRLnwsRz2UDTg8gA1/et10fBx5RxmZD9bYVGST69W8ME5OQ==} + peerDependencies: + '@types/node': ^18.19.71 + peerDependenciesMeta: + '@types/node': + optional: true + '@rushstack/node-core-library@5.5.1': resolution: {integrity: sha512-ZutW56qIzH8xIOlfyaLQJFx+8IBqdbVCZdnj+XT1MorQ1JqqxHse8vbCpEM+2MjsrqcbxcgDIbfggB1ZSQ2A3g==} peerDependencies: - '@types/node': ^18.19.59 + '@types/node': ^18.19.71 peerDependenciesMeta: '@types/node': optional: true @@ -4999,7 +5011,15 @@ packages: '@rushstack/terminal@0.13.3': resolution: {integrity: sha512-fc3zjXOw8E0pXS5t9vTiIPx9gHA0fIdTXsu9mT4WbH+P3mYvnrX0iAQ5a6NvyK1+CqYWBTw/wVNx7SDJkI+WYQ==} peerDependencies: - '@types/node': ^18.19.59 + '@types/node': ^18.19.71 + peerDependenciesMeta: + '@types/node': + optional: true + + '@rushstack/terminal@0.14.5': + resolution: {integrity: sha512-TEOpNwwmsZVrkp0omnuTUTGZRJKTr6n6m4OITiNjkqzLAkcazVpwR1SOtBg6uzpkIBLgrcNHETqI8rbw3uiUfw==} + peerDependencies: + '@types/node': ^18.19.71 peerDependenciesMeta: '@types/node': optional: true @@ -5007,6 +5027,9 @@ packages: '@rushstack/ts-command-line@4.22.3': resolution: {integrity: sha512-edMpWB3QhFFZ4KtSzS8WNjBgR4PXPPOVrOHMbb7kNpmQ1UFS9HdVtjCXg1H5fG+xYAbeE+TMPcVPUyX2p84STA==} + '@rushstack/ts-command-line@4.23.3': + resolution: {integrity: sha512-HazKL8fv4HMQMzrKJCrOrhyBPPdzk7iajUXgsASwjQ8ROo1cmgyqxt/k9+SdmrNLGE1zATgRqMUH3s/6smbRMA==} + '@sentry-internal/tracing@7.87.0': resolution: {integrity: sha512-HYa0+rfFmYQ/DadXoiuarTSxrcnYDCd/fm0pFuOHjICtfja8IcLegVYP2/r3CgwB+IjquCtJ5kDcqS/NTgUcpA==} engines: {node: '>=8'} @@ -5427,8 +5450,8 @@ packages: '@types/node-polyglot@2.4.2': resolution: {integrity: sha512-Tfx3TU/PBK8vW/BG1TK793EHlVpGnoHUj+DGxOwNOYwZiueLeu7FgksvDdpEyFSw4+AKKiEuiMm8EGUHUR4o6g==} - '@types/node@18.19.59': - resolution: {integrity: sha512-vizm2EqwV/7Zay+A6J3tGl9Lhr7CjZe2HmWS988sefiEmsyP9CeXEleho6i4hJk/8UtZAo0bWN4QPZZr83RxvQ==} + '@types/node@18.19.74': + resolution: {integrity: sha512-HMwEkkifei3L605gFdV+/UwtpxP6JSzM+xFk2Ia6DNFSwSVBRh9qp5Tgf4lNFOMfPVuU0WnkcWpXZpgn5ufO4A==} '@types/node@22.10.6': resolution: {integrity: sha512-qNiuwC4ZDAUNcY47xgaSuS92cjf8JbSUoaKS77bmLG1rU7MlATVSiw/IlrjtIyyskXBZ8KkNfjK/P5na7rgXbQ==} @@ -6194,16 +6217,18 @@ packages: caniuse-lite@1.0.30001669: resolution: {integrity: sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==} - capnp-ts@0.5.1: - resolution: {integrity: sha512-Bg68xRboJiEyUqOaxAM5Xbozadqkc/Q7Lu01Qv6CoF4wCtf8fCsm0uh/OzgcTJCa8d0dTm8+ELfm9WR95XcOmA==} + capnp-es@0.0.7: + resolution: {integrity: sha512-gjDJBgNbdPA2PilGjAixf5op2HTI7jaBGc5Gs0zrAjfG9/6hqPwjTIC7dGPxrU4Y0a3WnzX1I5r/XUa9jVRSWw==} + hasBin: true + peerDependencies: + typescript: ^5.7.3 + peerDependenciesMeta: + typescript: + optional: true capnp-ts@0.7.0: resolution: {integrity: sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==} - capnpc-ts@0.7.0: - resolution: {integrity: sha512-aIvGuLQJMEqRYeT92Lr3rzRyyb2hPePg7XpjIKfGLa/whaZ582IU8W4VqFvbbjKimlNE41ISCorX6kv4lSFk4A==} - hasBin: true - cbor@9.0.2: resolution: {integrity: sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ==} engines: {node: '>=16'} @@ -7337,10 +7362,6 @@ packages: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} - format@0.2.2: - resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} - engines: {node: '>=0.4.x'} - fp-ts@2.13.1: resolution: {integrity: sha512-0eu5ULPS2c/jsa1lGFneEFFEdTbembJv8e4QKXeVJ3lm/5hyve06dlKZrpxmMwJt6rYen7sxmHHK2CLaXvWuWQ==} @@ -7580,9 +7601,6 @@ packages: resolution: {integrity: sha512-kUGoI3p7u6B41z/dp33G6OaL7J4DRqRYwVmeIlwLClx7yaaAy7hoDExnuejTKtuDwfcatGmddHDEOjf6EyIxtQ==} engines: {node: '>=10.0.0'} - hex2dec@1.1.2: - resolution: {integrity: sha512-Yu+q/XWr2fFQ11tHxPq4p4EiNkb2y+lAacJNhAdRXVfRIcDH6gi7htWFnnlIzvqHMHoWeIsfXlNAjZInpAOJDA==} - hono@3.12.11: resolution: {integrity: sha512-LSpxVgIMR3UzyFiXZaPvqBUGqyOKG0LMZqgMn2RXz9f+YAdkHSfFQQX0dtU72fPm5GnEMh5AYXs0ek5NYgMOmA==} engines: {node: '>=16.0.0'} @@ -8709,9 +8727,6 @@ packages: resolution: {integrity: sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==} engines: {node: '>= 0.4'} - obtain-unicode@0.0.5: - resolution: {integrity: sha512-0BQHvF6VCYEdXiRYlxRo5X/2fKFau/eymrhs453IA8W610+nEelS5mhvanWeiSnSyKfw/hjhB4MlogxannjQVA==} - obuf@1.1.2: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} @@ -10319,7 +10334,7 @@ packages: peerDependencies: '@swc/core': '>=1.2.50' '@swc/wasm': '>=1.2.50' - '@types/node': ^18.19.59 + '@types/node': ^18.19.71 typescript: '>=2.7' peerDependenciesMeta: '@swc/core': @@ -10495,11 +10510,6 @@ packages: engines: {node: '>=4.2.0'} hasBin: true - typescript@4.2.4: - resolution: {integrity: sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==} - engines: {node: '>=4.2.0'} - hasBin: true - typescript@5.3.3: resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} engines: {node: '>=14.17'} @@ -10515,6 +10525,11 @@ packages: engines: {node: '>=14.17'} hasBin: true + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + engines: {node: '>=14.17'} + hasBin: true + typescript@5.7.3: resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} engines: {node: '>=14.17'} @@ -10647,9 +10662,6 @@ packages: peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 - utf8-encoding@0.1.2: - resolution: {integrity: sha512-TMrA9HlIUzIbBiEKeCzjFcNrDyjaz0kdpJtcSXu1UT0f/fYyo2Ij9oH2ChIHEA+UUPwtA/mRXfgu+OUa2s3x6A==} - util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -10709,7 +10721,7 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: - '@types/node': ^18.19.59 + '@types/node': ^18.19.71 less: '*' lightningcss: ^1.21.0 sass: '*' @@ -10737,7 +10749,7 @@ packages: engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: - '@types/node': ^18.19.59 + '@types/node': ^18.19.71 jiti: '>=1.21.0' less: '*' lightningcss: ^1.21.0 @@ -10783,7 +10795,7 @@ packages: hasBin: true peerDependencies: '@edge-runtime/vm': '*' - '@types/node': ^18.19.59 + '@types/node': ^18.19.71 '@vitest/browser': 2.1.8 '@vitest/ui': 2.1.8 happy-dom: '*' @@ -12284,7 +12296,7 @@ snapshots: esbuild: 0.17.19 miniflare: 3.20241106.1 semver: 7.6.3 - vitest: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + vitest: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) wrangler: 3.90.0(@cloudflare/workers-types@4.20250121.0) zod: 3.22.3 transitivePeerDependencies: @@ -12888,7 +12900,7 @@ snapshots: '@inquirer/figures': 1.0.7 '@inquirer/type': 2.0.0 '@types/mute-stream': 0.0.4 - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/wrap-ansi': 3.0.0 ansi-escapes: 4.3.2 cli-width: 4.1.0 @@ -12965,7 +12977,7 @@ snapshots: '@manypkg/find-root@1.1.0': dependencies: '@babel/runtime': 7.22.5 - '@types/node': 18.19.59 + '@types/node': 18.19.74 find-up: 4.1.0 fs-extra: 8.1.0 @@ -13011,23 +13023,31 @@ snapshots: - encoding - supports-color - '@microsoft/api-extractor-model@7.29.4(@types/node@18.19.59)': + '@microsoft/api-extractor-model@7.29.4(@types/node@18.19.74)': dependencies: '@microsoft/tsdoc': 0.15.0 '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.5.1(@types/node@18.19.59) + '@rushstack/node-core-library': 5.5.1(@types/node@18.19.74) + transitivePeerDependencies: + - '@types/node' + + '@microsoft/api-extractor-model@7.30.2(@types/node@18.19.74)': + dependencies: + '@microsoft/tsdoc': 0.15.1 + '@microsoft/tsdoc-config': 0.17.1 + '@rushstack/node-core-library': 5.10.2(@types/node@18.19.74) transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.47.4(@types/node@18.19.59)': + '@microsoft/api-extractor@7.47.4(@types/node@18.19.74)': dependencies: - '@microsoft/api-extractor-model': 7.29.4(@types/node@18.19.59) + '@microsoft/api-extractor-model': 7.29.4(@types/node@18.19.74) '@microsoft/tsdoc': 0.15.0 '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.5.1(@types/node@18.19.59) + '@rushstack/node-core-library': 5.5.1(@types/node@18.19.74) '@rushstack/rig-package': 0.5.3 - '@rushstack/terminal': 0.13.3(@types/node@18.19.59) - '@rushstack/ts-command-line': 4.22.3(@types/node@18.19.59) + '@rushstack/terminal': 0.13.3(@types/node@18.19.74) + '@rushstack/ts-command-line': 4.22.3(@types/node@18.19.74) lodash: 4.17.21 minimatch: 3.0.8 resolve: 1.22.8 @@ -13037,6 +13057,24 @@ snapshots: transitivePeerDependencies: - '@types/node' + '@microsoft/api-extractor@7.49.1(@types/node@18.19.74)': + dependencies: + '@microsoft/api-extractor-model': 7.30.2(@types/node@18.19.74) + '@microsoft/tsdoc': 0.15.1 + '@microsoft/tsdoc-config': 0.17.1 + '@rushstack/node-core-library': 5.10.2(@types/node@18.19.74) + '@rushstack/rig-package': 0.5.3 + '@rushstack/terminal': 0.14.5(@types/node@18.19.74) + '@rushstack/ts-command-line': 4.23.3(@types/node@18.19.74) + lodash: 4.17.21 + minimatch: 3.0.8 + resolve: 1.22.8 + semver: 7.5.4 + source-map: 0.6.1 + typescript: 5.7.2 + transitivePeerDependencies: + - '@types/node' + '@microsoft/tsdoc-config@0.17.0': dependencies: '@microsoft/tsdoc': 0.15.0 @@ -13044,8 +13082,17 @@ snapshots: jju: 1.4.0 resolve: 1.22.8 + '@microsoft/tsdoc-config@0.17.1': + dependencies: + '@microsoft/tsdoc': 0.15.1 + ajv: 8.12.0 + jju: 1.4.0 + resolve: 1.22.8 + '@microsoft/tsdoc@0.15.0': {} + '@microsoft/tsdoc@0.15.1': {} + '@miniflare/cache@2.14.4': dependencies: '@miniflare/core': 2.14.4 @@ -13536,7 +13583,20 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.9.6': optional: true - '@rushstack/node-core-library@5.5.1(@types/node@18.19.59)': + '@rushstack/node-core-library@5.10.2(@types/node@18.19.74)': + dependencies: + ajv: 8.13.0 + ajv-draft-04: 1.0.0(ajv@8.13.0) + ajv-formats: 3.0.1(ajv@8.13.0) + fs-extra: 7.0.1 + import-lazy: 4.0.0 + jju: 1.4.0 + resolve: 1.22.8 + semver: 7.5.4 + optionalDependencies: + '@types/node': 18.19.74 + + '@rushstack/node-core-library@5.5.1(@types/node@18.19.74)': dependencies: ajv: 8.13.0 ajv-draft-04: 1.0.0(ajv@8.13.0) @@ -13547,23 +13607,39 @@ snapshots: resolve: 1.22.8 semver: 7.5.4 optionalDependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@rushstack/rig-package@0.5.3': dependencies: resolve: 1.22.8 strip-json-comments: 3.1.1 - '@rushstack/terminal@0.13.3(@types/node@18.19.59)': + '@rushstack/terminal@0.13.3(@types/node@18.19.74)': + dependencies: + '@rushstack/node-core-library': 5.5.1(@types/node@18.19.74) + supports-color: 8.1.1 + optionalDependencies: + '@types/node': 18.19.74 + + '@rushstack/terminal@0.14.5(@types/node@18.19.74)': dependencies: - '@rushstack/node-core-library': 5.5.1(@types/node@18.19.59) + '@rushstack/node-core-library': 5.10.2(@types/node@18.19.74) supports-color: 8.1.1 optionalDependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 - '@rushstack/ts-command-line@4.22.3(@types/node@18.19.59)': + '@rushstack/ts-command-line@4.22.3(@types/node@18.19.74)': dependencies: - '@rushstack/terminal': 0.13.3(@types/node@18.19.59) + '@rushstack/terminal': 0.13.3(@types/node@18.19.74) + '@types/argparse': 1.0.38 + argparse: 1.0.10 + string-argv: 0.3.1 + transitivePeerDependencies: + - '@types/node' + + '@rushstack/ts-command-line@4.23.3(@types/node@18.19.74)': + dependencies: + '@rushstack/terminal': 0.14.5(@types/node@18.19.74) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.1 @@ -14017,7 +14093,7 @@ snapshots: '@tsconfig/node16@1.0.4': {} - '@turbo/gen@1.10.14(@types/node@18.19.59)(typescript@5.6.3)': + '@turbo/gen@1.10.14(@types/node@18.19.74)(typescript@5.7.3)': dependencies: '@turbo/workspaces': 1.10.14 chalk: 2.4.2 @@ -14027,7 +14103,7 @@ snapshots: minimatch: 9.0.5 node-plop: 0.26.3 proxy-agent: 6.3.1 - ts-node: 10.9.2(@types/node@18.19.59)(typescript@5.6.3) + ts-node: 10.9.2(@types/node@18.19.74)(typescript@5.7.3) update-check: 1.5.4 validate-npm-package-name: 5.0.0 transitivePeerDependencies: @@ -14077,7 +14153,7 @@ snapshots: '@types/better-sqlite3@7.6.8': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/command-exists@1.2.0': {} @@ -14085,7 +14161,7 @@ snapshots: '@types/cross-spawn@6.0.2': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/debug@4.1.7': dependencies: @@ -14099,7 +14175,7 @@ snapshots: '@types/dns2@2.0.3': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/esprima@4.0.3': dependencies: @@ -14114,7 +14190,7 @@ snapshots: '@types/glob@7.2.0': dependencies: '@types/minimatch': 5.1.2 - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/http-cache-semantics@4.0.4': {} @@ -14147,20 +14223,20 @@ snapshots: '@types/mute-stream@0.0.4': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/node-fetch@2.6.11': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 form-data: 4.0.0 '@types/node-forge@1.3.11': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/node-polyglot@2.4.2': {} - '@types/node@18.19.59': + '@types/node@18.19.74': dependencies: undici-types: 5.26.5 @@ -14172,13 +14248,13 @@ snapshots: '@types/pg@8.11.6': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 pg-protocol: 1.6.1 pg-types: 4.0.2 '@types/prompts@2.0.14': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/prop-types@15.7.4': {} @@ -14224,7 +14300,7 @@ snapshots: '@types/stoppable@1.1.3': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/strip-bom@3.0.0': {} @@ -14234,7 +14310,7 @@ snapshots: '@types/through@0.0.31': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/tinycolor2@1.4.4': {} @@ -14242,7 +14318,7 @@ snapshots: '@types/tunnel@0.0.3': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/uuid@9.0.4': {} @@ -14256,11 +14332,11 @@ snapshots: '@types/ws@8.5.10': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/ws@8.5.13': dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@types/yargs-parser@20.2.1': {} @@ -14268,26 +14344,6 @@ snapshots: dependencies: '@types/yargs-parser': 20.2.1 - '@typescript-eslint/eslint-plugin@6.10.0(@typescript-eslint/parser@6.10.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0)(typescript@5.6.3)': - dependencies: - '@eslint-community/regexpp': 4.10.1 - '@typescript-eslint/parser': 6.10.0(eslint@8.57.0)(typescript@5.6.3) - '@typescript-eslint/scope-manager': 6.10.0 - '@typescript-eslint/type-utils': 6.10.0(eslint@8.57.0)(typescript@5.6.3) - '@typescript-eslint/utils': 6.10.0(eslint@8.57.0)(typescript@5.6.3) - '@typescript-eslint/visitor-keys': 6.10.0 - debug: 4.3.7(supports-color@9.2.2) - eslint: 8.57.0 - graphemer: 1.4.0 - ignore: 5.3.1 - natural-compare: 1.4.0 - semver: 7.6.3 - ts-api-utils: 1.4.3(typescript@5.6.3) - optionalDependencies: - typescript: 5.6.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/eslint-plugin@6.10.0(@typescript-eslint/parser@6.10.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0)(typescript@5.7.3)': dependencies: '@eslint-community/regexpp': 4.10.1 @@ -14326,19 +14382,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@6.10.0(eslint@8.57.0)(typescript@5.6.3)': - dependencies: - '@typescript-eslint/scope-manager': 6.10.0 - '@typescript-eslint/types': 6.10.0 - '@typescript-eslint/typescript-estree': 6.10.0(typescript@5.6.3) - '@typescript-eslint/visitor-keys': 6.10.0 - debug: 4.3.7(supports-color@9.2.2) - eslint: 8.57.0 - optionalDependencies: - typescript: 5.6.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/parser@6.10.0(eslint@8.57.0)(typescript@5.7.3)': dependencies: '@typescript-eslint/scope-manager': 6.10.0 @@ -14375,18 +14418,6 @@ snapshots: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/visitor-keys': 7.18.0 - '@typescript-eslint/type-utils@6.10.0(eslint@8.57.0)(typescript@5.6.3)': - dependencies: - '@typescript-eslint/typescript-estree': 6.10.0(typescript@5.6.3) - '@typescript-eslint/utils': 6.10.0(eslint@8.57.0)(typescript@5.6.3) - debug: 4.3.7(supports-color@9.2.2) - eslint: 8.57.0 - ts-api-utils: 1.4.3(typescript@5.6.3) - optionalDependencies: - typescript: 5.6.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/type-utils@6.10.0(eslint@8.57.0)(typescript@5.7.3)': dependencies: '@typescript-eslint/typescript-estree': 6.10.0(typescript@5.7.3) @@ -14415,20 +14446,6 @@ snapshots: '@typescript-eslint/types@7.18.0': {} - '@typescript-eslint/typescript-estree@6.10.0(typescript@5.6.3)': - dependencies: - '@typescript-eslint/types': 6.10.0 - '@typescript-eslint/visitor-keys': 6.10.0 - debug: 4.3.7(supports-color@9.2.2) - globby: 11.1.0 - is-glob: 4.0.3 - semver: 7.6.3 - ts-api-utils: 1.4.3(typescript@5.6.3) - optionalDependencies: - typescript: 5.6.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/typescript-estree@6.10.0(typescript@5.7.3)': dependencies: '@typescript-eslint/types': 6.10.0 @@ -14458,20 +14475,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@6.10.0(eslint@8.57.0)(typescript@5.6.3)': - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@types/json-schema': 7.0.13 - '@types/semver': 7.5.1 - '@typescript-eslint/scope-manager': 6.10.0 - '@typescript-eslint/types': 6.10.0 - '@typescript-eslint/typescript-estree': 6.10.0(typescript@5.6.3) - eslint: 8.57.0 - semver: 7.6.3 - transitivePeerDependencies: - - supports-color - - typescript - '@typescript-eslint/utils@6.10.0(eslint@8.57.0)(typescript@5.7.3)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) @@ -14527,25 +14530,25 @@ snapshots: - encoding - supports-color - '@vitejs/plugin-react@4.3.3(vite@5.0.12(@types/node@18.19.59))': + '@vitejs/plugin-react@4.3.3(vite@5.0.12(@types/node@18.19.74))': dependencies: '@babel/core': 7.26.0 '@babel/plugin-transform-react-jsx-self': 7.25.9(@babel/core@7.26.0) '@babel/plugin-transform-react-jsx-source': 7.25.9(@babel/core@7.26.0) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 5.0.12(@types/node@18.19.59) + vite: 5.0.12(@types/node@18.19.74) transitivePeerDependencies: - supports-color - '@vitejs/plugin-react@4.3.4(vite@6.0.7(@types/node@18.19.59)(jiti@2.4.2))': + '@vitejs/plugin-react@4.3.4(vite@6.0.7(@types/node@18.19.74)(jiti@2.4.2))': dependencies: '@babel/core': 7.26.0 '@babel/plugin-transform-react-jsx-self': 7.25.9(@babel/core@7.26.0) '@babel/plugin-transform-react-jsx-source': 7.25.9(@babel/core@7.26.0) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + vite: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) transitivePeerDependencies: - supports-color @@ -14556,14 +14559,14 @@ snapshots: chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.8(msw@2.4.3(typescript@5.6.3))(vite@5.0.12(@types/node@18.19.59))': + '@vitest/mocker@2.1.8(msw@2.4.3(typescript@5.7.3))(vite@5.0.12(@types/node@18.19.74))': dependencies: '@vitest/spy': 2.1.8 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - msw: 2.4.3(typescript@5.6.3) - vite: 5.0.12(@types/node@18.19.59) + msw: 2.4.3(typescript@5.7.3) + vite: 5.0.12(@types/node@18.19.74) '@vitest/pretty-format@2.1.8': dependencies: @@ -14593,7 +14596,7 @@ snapshots: sirv: 3.0.0 tinyglobby: 0.2.10 tinyrainbow: 1.2.0 - vitest: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + vitest: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) '@vitest/utils@2.1.8': dependencies: @@ -14683,20 +14686,6 @@ snapshots: de-indent: 1.0.2 he: 1.2.0 - '@vue/language-core@2.0.29(typescript@5.6.3)': - dependencies: - '@volar/language-core': 2.4.0-alpha.18 - '@vue/compiler-dom': 3.4.36 - '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.4.36 - computeds: 0.0.1 - minimatch: 9.0.5 - muggle-string: 0.4.1 - path-browserify: 1.0.1 - optionalDependencies: - typescript: 5.6.3 - optional: true - '@vue/language-core@2.0.29(typescript@5.7.3)': dependencies: '@volar/language-core': 2.4.0-alpha.18 @@ -15220,30 +15209,14 @@ snapshots: caniuse-lite@1.0.30001669: {} - capnp-ts@0.5.1: - dependencies: - debug: 4.3.7(supports-color@9.2.2) - format: 0.2.2 - tslib: 2.8.1 - utf8-encoding: 0.1.2 - transitivePeerDependencies: - - supports-color - - capnp-ts@0.7.0(patch_hash=l4yimnxyvkiyj6alnps2ec3sii): - dependencies: - debug: 4.3.7(supports-color@9.2.2) - tslib: 2.8.1 - transitivePeerDependencies: - - supports-color + capnp-es@0.0.7(typescript@5.7.3): + optionalDependencies: + typescript: 5.7.3 - capnpc-ts@0.7.0: + capnp-ts@0.7.0: dependencies: - capnp-ts: 0.5.1 debug: 4.3.7(supports-color@9.2.2) - hex2dec: 1.1.2 - mkdirp: 1.0.4 tslib: 2.8.1 - typescript: 4.2.4 transitivePeerDependencies: - supports-color @@ -16664,8 +16637,6 @@ snapshots: combined-stream: 1.0.8 mime-types: 2.1.35 - format@0.2.2: {} - fp-ts@2.13.1: {} fraction.js@4.3.7: {} @@ -16954,8 +16925,6 @@ snapshots: heap-js@2.5.0: {} - hex2dec@1.1.2: {} - hono@3.12.11: {} hookable@5.5.3: {} @@ -17707,7 +17676,7 @@ snapshots: '@cspotcode/source-map-support': 0.8.1 acorn: 8.14.0 acorn-walk: 8.3.2 - capnp-ts: 0.7.0(patch_hash=l4yimnxyvkiyj6alnps2ec3sii) + capnp-ts: 0.7.0 exit-hook: 2.2.1 glob-to-regexp: 0.4.1 stoppable: 1.1.0 @@ -17726,7 +17695,7 @@ snapshots: '@cspotcode/source-map-support': 0.8.1 acorn: 8.14.0 acorn-walk: 8.3.2 - capnp-ts: 0.7.0(patch_hash=l4yimnxyvkiyj6alnps2ec3sii) + capnp-ts: 0.7.0 exit-hook: 2.2.1 glob-to-regexp: 0.4.1 stoppable: 1.1.0 @@ -17795,7 +17764,7 @@ snapshots: mkdirp@1.0.4: {} - mkdist@2.2.0(typescript@5.6.3)(vue-tsc@2.0.29(typescript@5.6.3)): + mkdist@2.2.0(typescript@5.7.3)(vue-tsc@2.0.29(typescript@5.7.3)): dependencies: autoprefixer: 10.4.20(postcss@8.4.49) citty: 0.1.6 @@ -17811,8 +17780,8 @@ snapshots: semver: 7.6.3 tinyglobby: 0.2.10 optionalDependencies: - typescript: 5.6.3 - vue-tsc: 2.0.29(typescript@5.6.3) + typescript: 5.7.3 + vue-tsc: 2.0.29(typescript@5.7.3) mlly@1.7.3: dependencies: @@ -17859,7 +17828,7 @@ snapshots: ms@2.1.3: {} - msw@2.4.3(typescript@5.6.3): + msw@2.4.3(typescript@5.7.3): dependencies: '@bundled-es-modules/cookie': 2.0.0 '@bundled-es-modules/statuses': 1.0.1 @@ -17879,7 +17848,7 @@ snapshots: type-fest: 4.26.1 yargs: 17.7.2 optionalDependencies: - typescript: 5.6.3 + typescript: 5.7.3 muggle-string@0.4.1: {} @@ -18065,8 +18034,6 @@ snapshots: define-properties: 1.2.1 es-abstract: 1.23.5 - obtain-unicode@0.0.5: {} - obuf@1.1.2: {} ohash@1.1.4: {} @@ -19059,11 +19026,11 @@ snapshots: dependencies: glob: 10.4.5 - rollup-plugin-dts@6.1.1(rollup@4.30.1)(typescript@5.6.3): + rollup-plugin-dts@6.1.1(rollup@4.30.1)(typescript@5.7.3): dependencies: magic-string: 0.30.17 rollup: 4.30.1 - typescript: 5.6.3 + typescript: 5.7.3 optionalDependencies: '@babel/code-frame': 7.26.2 @@ -19516,7 +19483,7 @@ snapshots: stripe@9.16.0: dependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 qs: 6.10.3 strnum@1.0.5: {} @@ -19737,21 +19704,21 @@ snapshots: safe-stable-stringify: 2.4.3 typescript: 5.3.3 - ts-node@10.9.2(@types/node@18.19.59)(typescript@5.6.3): + ts-node@10.9.2(@types/node@18.19.74)(typescript@5.7.3): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.9 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 18.19.59 + '@types/node': 18.19.74 acorn: 8.14.0 acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.6.3 + typescript: 5.7.3 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 @@ -19760,9 +19727,9 @@ snapshots: lodash: 4.17.21 prettier: 2.7.1 - tsconfck@2.1.1(typescript@5.6.3): + tsconfck@2.1.1(typescript@5.7.3): optionalDependencies: - typescript: 5.6.3 + typescript: 5.7.3 tsconfig-paths@3.14.1: dependencies: @@ -19782,7 +19749,7 @@ snapshots: tslib@2.8.1: {} - tsup@8.3.0(@microsoft/api-extractor@7.47.4(@types/node@18.19.59))(jiti@2.4.2)(postcss@8.4.49)(typescript@5.7.3): + tsup@8.3.0(@microsoft/api-extractor@7.49.1(@types/node@18.19.74))(jiti@2.4.2)(postcss@8.4.49)(typescript@5.7.3): dependencies: bundle-require: 5.1.0(esbuild@0.23.1) cac: 6.7.14 @@ -19801,7 +19768,7 @@ snapshots: tinyglobby: 0.2.10 tree-kill: 1.2.2 optionalDependencies: - '@microsoft/api-extractor': 7.47.4(@types/node@18.19.59) + '@microsoft/api-extractor': 7.49.1(@types/node@18.19.74) postcss: 8.4.49 typescript: 5.7.3 transitivePeerDependencies: @@ -19935,14 +19902,14 @@ snapshots: typescript@3.9.10: {} - typescript@4.2.4: {} - typescript@5.3.3: {} typescript@5.4.2: {} typescript@5.6.3: {} + typescript@5.7.2: {} + typescript@5.7.3: {} uc.micro@1.0.6: {} @@ -19959,7 +19926,7 @@ snapshots: has-symbols: 1.1.0 which-boxed-primitive: 1.0.2 - unbuild@3.3.1(typescript@5.6.3)(vue-tsc@2.0.29(typescript@5.6.3)): + unbuild@3.3.1(typescript@5.7.3)(vue-tsc@2.0.29(typescript@5.7.3)): dependencies: '@rollup/plugin-alias': 5.1.1(rollup@4.30.1) '@rollup/plugin-commonjs': 28.0.2(rollup@4.30.1) @@ -19974,18 +19941,18 @@ snapshots: hookable: 5.5.3 jiti: 2.4.2 magic-string: 0.30.17 - mkdist: 2.2.0(typescript@5.6.3)(vue-tsc@2.0.29(typescript@5.6.3)) + mkdist: 2.2.0(typescript@5.7.3)(vue-tsc@2.0.29(typescript@5.7.3)) mlly: 1.7.4 pathe: 2.0.1 pkg-types: 1.3.1 pretty-bytes: 6.1.1 rollup: 4.30.1 - rollup-plugin-dts: 6.1.1(rollup@4.30.1)(typescript@5.6.3) + rollup-plugin-dts: 6.1.1(rollup@4.30.1)(typescript@5.7.3) scule: 1.3.0 tinyglobby: 0.2.10 untyped: 1.5.2 optionalDependencies: - typescript: 5.6.3 + typescript: 5.7.3 transitivePeerDependencies: - sass - supports-color @@ -20113,10 +20080,6 @@ snapshots: dependencies: react: 18.3.1 - utf8-encoding@0.1.2: - dependencies: - obtain-unicode: 0.0.5 - util-deprecate@1.0.2: {} util@0.12.5: @@ -20150,13 +20113,13 @@ snapshots: dependencies: builtins: 5.0.1 - vite-node@2.1.8(@types/node@18.19.59)(supports-color@9.2.2): + vite-node@2.1.8(@types/node@18.19.74)(supports-color@9.2.2): dependencies: cac: 6.7.14 debug: 4.3.7(supports-color@9.2.2) es-module-lexer: 1.5.4 pathe: 1.1.2 - vite: 5.0.12(@types/node@18.19.59) + vite: 5.0.12(@types/node@18.19.74) transitivePeerDependencies: - '@types/node' - less @@ -20167,9 +20130,9 @@ snapshots: - supports-color - terser - vite-plugin-dts@4.0.1(@types/node@18.19.59)(rollup@4.30.1)(typescript@5.7.3)(vite@5.0.12(@types/node@18.19.59)): + vite-plugin-dts@4.0.1(@types/node@18.19.74)(rollup@4.30.1)(typescript@5.7.3)(vite@5.0.12(@types/node@18.19.74)): dependencies: - '@microsoft/api-extractor': 7.47.4(@types/node@18.19.59) + '@microsoft/api-extractor': 7.47.4(@types/node@18.19.74) '@rollup/pluginutils': 5.1.0(rollup@4.30.1) '@volar/typescript': 2.3.4 '@vue/language-core': 2.0.29(typescript@5.7.3) @@ -20181,39 +20144,39 @@ snapshots: typescript: 5.7.3 vue-tsc: 2.0.29(typescript@5.7.3) optionalDependencies: - vite: 5.0.12(@types/node@18.19.59) + vite: 5.0.12(@types/node@18.19.74) transitivePeerDependencies: - '@types/node' - rollup - supports-color - vite-tsconfig-paths@4.2.0(typescript@5.6.3)(vite@5.0.12(@types/node@18.19.59)): + vite-tsconfig-paths@4.2.0(typescript@5.7.3)(vite@5.0.12(@types/node@18.19.74)): dependencies: debug: 4.3.7(supports-color@9.2.2) globrex: 0.1.2 - tsconfck: 2.1.1(typescript@5.6.3) + tsconfck: 2.1.1(typescript@5.7.3) optionalDependencies: - vite: 5.0.12(@types/node@18.19.59) + vite: 5.0.12(@types/node@18.19.74) transitivePeerDependencies: - supports-color - typescript - vite@5.0.12(@types/node@18.19.59): + vite@5.0.12(@types/node@18.19.74): dependencies: esbuild: 0.19.12 postcss: 8.4.49 rollup: 4.9.6 optionalDependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 fsevents: 2.3.3 - vite@6.0.7(@types/node@18.19.59)(jiti@2.4.2): + vite@6.0.7(@types/node@18.19.74)(jiti@2.4.2): dependencies: esbuild: 0.24.2 postcss: 8.4.49 rollup: 4.30.1 optionalDependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 fsevents: 2.3.3 jiti: 2.4.2 @@ -20221,12 +20184,12 @@ snapshots: dependencies: '@vitest/utils': 2.1.8 mock-socket: 9.3.1 - vitest: 2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2) + vitest: 2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2) - vitest@2.1.8(@types/node@18.19.59)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.6.3))(supports-color@9.2.2): + vitest@2.1.8(@types/node@18.19.74)(@vitest/ui@2.1.8)(msw@2.4.3(typescript@5.7.3))(supports-color@9.2.2): dependencies: '@vitest/expect': 2.1.8 - '@vitest/mocker': 2.1.8(msw@2.4.3(typescript@5.6.3))(vite@5.0.12(@types/node@18.19.59)) + '@vitest/mocker': 2.1.8(msw@2.4.3(typescript@5.7.3))(vite@5.0.12(@types/node@18.19.74)) '@vitest/pretty-format': 2.1.8 '@vitest/runner': 2.1.8 '@vitest/snapshot': 2.1.8 @@ -20242,11 +20205,11 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.0.12(@types/node@18.19.59) - vite-node: 2.1.8(@types/node@18.19.59)(supports-color@9.2.2) + vite: 5.0.12(@types/node@18.19.74) + vite-node: 2.1.8(@types/node@18.19.74)(supports-color@9.2.2) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 18.19.59 + '@types/node': 18.19.74 '@vitest/ui': 2.1.8(vitest@2.1.8) transitivePeerDependencies: - less @@ -20283,14 +20246,6 @@ snapshots: vscode-uri@3.0.8: {} - vue-tsc@2.0.29(typescript@5.6.3): - dependencies: - '@volar/typescript': 2.4.0-alpha.18 - '@vue/language-core': 2.0.29(typescript@5.6.3) - semver: 7.6.3 - typescript: 5.6.3 - optional: true - vue-tsc@2.0.29(typescript@5.7.3): dependencies: '@volar/typescript': 2.4.0-alpha.18 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 17a5c44259d8..166d758fded2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -6,20 +6,19 @@ packages: - "tools" catalog: - "@types/node": "^18.19.59" + "@types/node": "^18.19.71" "@vitest/runner": ~2.1.8 "@vitest/snapshot": ~2.1.8 "@vitest/ui": ~2.1.8 # rimraf@6 requires node 20 or >=22 rimraf: "^5.0.10" - typescript: "~5.6.3" + typescript: "^5.7.2" undici: "^5.28.4" vitest: "~2.1.8" vite: "^5.0.12" catalogs: vite-plugin: - "typescript": "^5.7.2" "vite": "^6.0.7" "@types/node": "^22.10.1" "unenv": "npm:unenv-nightly@2.0.0-20241218-183400-5d6aec3" From 5251052ff47a98e0dd63d62d05d11e0e2c84549c Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 28 Jan 2025 13:20:16 +0000 Subject: [PATCH 08/15] chore: do not build the world when publishing Wrangler and C3 (#7928) --- packages/create-cloudflare/package.json | 2 +- packages/wrangler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/create-cloudflare/package.json b/packages/create-cloudflare/package.json index dd6346f9df82..218e30869812 100644 --- a/packages/create-cloudflare/package.json +++ b/packages/create-cloudflare/package.json @@ -31,7 +31,7 @@ "dev:codemod": "node -r esbuild-register scripts/codemodDev.ts", "check:lint": "eslint . --max-warnings=0", "check:type": "tsc", - "prepublishOnly": "pnpm -w run build", + "prepublishOnly": "pnpm exec turbo build -F create-cloudflare", "test:e2e": "vitest run --config ./vitest-e2e.config.mts", "test:e2e:npm": "pnpm run build && cross-env TEST_PM=npm vitest run --config ./vitest-e2e.config.mts", "test:e2e:pnpm": "pnpm run build && cross-env TEST_PM=pnpm vitest run --config ./vitest-e2e.config.mts", diff --git a/packages/wrangler/package.json b/packages/wrangler/package.json index bfb0d4c3d7ff..06bce2434aa9 100644 --- a/packages/wrangler/package.json +++ b/packages/wrangler/package.json @@ -59,7 +59,7 @@ "dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm run bundle --watch\" \"pnpm run check:type --watch --preserveWatchOutput\"", "emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts", "generate-json-schema": "pnpm exec ts-json-schema-generator --no-type-check --path src/config/config.ts --type RawConfig --out config-schema.json", - "prepublishOnly": "SOURCEMAPS=false pnpm run -w build", + "prepublishOnly": "SOURCEMAPS=false pnpm exec turbo build -F wrangler", "start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js", "test": "dotenv -- pnpm run assert-git-version && dotenv -- vitest", "test:ci": "pnpm run test run", From 34f9797822836b98edc4d8ddc6e2fb0ab322b864 Mon Sep 17 00:00:00 2001 From: WillTaylorDev Date: Tue, 28 Jan 2025 08:38:33 -0500 Subject: [PATCH 09/15] Provides support for run_worker_first option (#7897) - Warning for sunsetting of experimental_serve_directly - Error for using run_worker_first and experimental_serve_directly together - Sends run_worker_first field to EWC (in production) instead of old `serve_directly` --- .changeset/cuddly-wombats-decide.md | 6 + fixtures/asset-config/html-handling.test.ts | 3 +- fixtures/asset-config/redirects.test.ts | 3 +- .../asset-config/url-normalization.test.ts | 3 +- .../README.md | 17 ++ .../package.json | 2 +- .../public/index.html | 0 .../src/index.ts | 0 .../tests/index.test.ts | 2 +- .../tests/tsconfig.json | 0 .../tsconfig.json | 0 .../wrangler.toml | 4 +- .../README.md | 17 -- fixtures/workers-with-assets/wrangler.toml | 1 + .../asset-worker/src/configuration.ts | 12 +- .../asset-worker/tests/handler.test.ts | 5 + packages/workers-shared/utils/types.ts | 1 + packages/wrangler/e2e/deployments.test.ts | 4 +- .../wrangler/src/__tests__/deploy.test.ts | 204 ++++++++++++++++-- packages/wrangler/src/__tests__/dev.test.ts | 61 +++++- packages/wrangler/src/assets.ts | 45 ++-- packages/wrangler/src/config/environment.ts | 7 +- packages/wrangler/src/config/validation.ts | 39 +++- packages/wrangler/src/deploy/deploy.ts | 4 +- .../create-worker-upload-form.ts | 9 +- pnpm-lock.yaml | 2 +- 26 files changed, 364 insertions(+), 87 deletions(-) create mode 100644 .changeset/cuddly-wombats-decide.md create mode 100644 fixtures/workers-with-assets-run-worker-first/README.md rename fixtures/{workers-with-assets-serve-directly => workers-with-assets-run-worker-first}/package.json (88%) rename fixtures/{workers-with-assets-serve-directly => workers-with-assets-run-worker-first}/public/index.html (100%) rename fixtures/{workers-with-assets-serve-directly => workers-with-assets-run-worker-first}/src/index.ts (100%) rename fixtures/{workers-with-assets-serve-directly => workers-with-assets-run-worker-first}/tests/index.test.ts (94%) rename fixtures/{workers-with-assets-serve-directly => workers-with-assets-run-worker-first}/tests/tsconfig.json (100%) rename fixtures/{workers-with-assets-serve-directly => workers-with-assets-run-worker-first}/tsconfig.json (100%) rename fixtures/{workers-with-assets-serve-directly => workers-with-assets-run-worker-first}/wrangler.toml (66%) delete mode 100644 fixtures/workers-with-assets-serve-directly/README.md diff --git a/.changeset/cuddly-wombats-decide.md b/.changeset/cuddly-wombats-decide.md new file mode 100644 index 000000000000..b14fb8e9e230 --- /dev/null +++ b/.changeset/cuddly-wombats-decide.md @@ -0,0 +1,6 @@ +--- +"@cloudflare/workers-shared": minor +"wrangler": minor +--- + +chore: provides `run_worker_first` for Worker-script-first configuration. Deprecates `experimental_serve_directly`. diff --git a/fixtures/asset-config/html-handling.test.ts b/fixtures/asset-config/html-handling.test.ts index 2700ad69876e..d092b46f2ab5 100644 --- a/fixtures/asset-config/html-handling.test.ts +++ b/fixtures/asset-config/html-handling.test.ts @@ -64,7 +64,8 @@ describe.each(testSuites)("$title", ({ title, suite }) => { return { html_handling, not_found_handling: "none", - serve_directly: true, + run_worker_first: true, + serve_directly: false, }; }); }); diff --git a/fixtures/asset-config/redirects.test.ts b/fixtures/asset-config/redirects.test.ts index 1c8bfbbb02c2..e6e2306b5a3d 100644 --- a/fixtures/asset-config/redirects.test.ts +++ b/fixtures/asset-config/redirects.test.ts @@ -41,7 +41,8 @@ describe("[Asset Worker] `test location rewrite`", () => { return { html_handling: "none", not_found_handling: "none", - serve_directly: true, + run_worker_first: true, + serve_directly: false, }; }); }); diff --git a/fixtures/asset-config/url-normalization.test.ts b/fixtures/asset-config/url-normalization.test.ts index a679445e795f..0967b84e0865 100644 --- a/fixtures/asset-config/url-normalization.test.ts +++ b/fixtures/asset-config/url-normalization.test.ts @@ -41,7 +41,8 @@ describe("[Asset Worker] `test slash normalization`", () => { return { html_handling: "none", not_found_handling: "none", - serve_directly: true, + run_worker_first: true, + serve_directly: false, }; }); }); diff --git a/fixtures/workers-with-assets-run-worker-first/README.md b/fixtures/workers-with-assets-run-worker-first/README.md new file mode 100644 index 000000000000..44a4129cba9a --- /dev/null +++ b/fixtures/workers-with-assets-run-worker-first/README.md @@ -0,0 +1,17 @@ +# workers-assets-with-user-worker" + +`workers-assets-with-user-worker-run-worker-first"` is a test fixture that showcases Workers with Assets using the run_worker_first option. This particular fixture forces a user Worker to be invoked, even if it otherwise would have matched an assets request. + +## dev + +To start a dev session you can run + +``` +wrangler dev +``` + +## Run tests + +``` +npm run test +``` diff --git a/fixtures/workers-with-assets-serve-directly/package.json b/fixtures/workers-with-assets-run-worker-first/package.json similarity index 88% rename from fixtures/workers-with-assets-serve-directly/package.json rename to fixtures/workers-with-assets-run-worker-first/package.json index 31528dd7297f..125763c585d0 100644 --- a/fixtures/workers-with-assets-serve-directly/package.json +++ b/fixtures/workers-with-assets-run-worker-first/package.json @@ -1,5 +1,5 @@ { - "name": "workers-assets-with-user-worker-serve-directly", + "name": "workers-assets-with-user-worker-run-worker-first", "private": true, "scripts": { "check:type": "tsc", diff --git a/fixtures/workers-with-assets-serve-directly/public/index.html b/fixtures/workers-with-assets-run-worker-first/public/index.html similarity index 100% rename from fixtures/workers-with-assets-serve-directly/public/index.html rename to fixtures/workers-with-assets-run-worker-first/public/index.html diff --git a/fixtures/workers-with-assets-serve-directly/src/index.ts b/fixtures/workers-with-assets-run-worker-first/src/index.ts similarity index 100% rename from fixtures/workers-with-assets-serve-directly/src/index.ts rename to fixtures/workers-with-assets-run-worker-first/src/index.ts diff --git a/fixtures/workers-with-assets-serve-directly/tests/index.test.ts b/fixtures/workers-with-assets-run-worker-first/tests/index.test.ts similarity index 94% rename from fixtures/workers-with-assets-serve-directly/tests/index.test.ts rename to fixtures/workers-with-assets-run-worker-first/tests/index.test.ts index 12a881222fd2..c52dba0c39b8 100644 --- a/fixtures/workers-with-assets-serve-directly/tests/index.test.ts +++ b/fixtures/workers-with-assets-run-worker-first/tests/index.test.ts @@ -3,7 +3,7 @@ import { fetch } from "undici"; import { afterAll, beforeAll, describe, it } from "vitest"; import { runWranglerDev } from "../../shared/src/run-wrangler-long-lived"; -describe("[Workers + Assets] serve_directly false", () => { +describe("[Workers + Assets] run_worker_first true", () => { let ip: string, port: number, stop: (() => Promise) | undefined; beforeAll(async () => { diff --git a/fixtures/workers-with-assets-serve-directly/tests/tsconfig.json b/fixtures/workers-with-assets-run-worker-first/tests/tsconfig.json similarity index 100% rename from fixtures/workers-with-assets-serve-directly/tests/tsconfig.json rename to fixtures/workers-with-assets-run-worker-first/tests/tsconfig.json diff --git a/fixtures/workers-with-assets-serve-directly/tsconfig.json b/fixtures/workers-with-assets-run-worker-first/tsconfig.json similarity index 100% rename from fixtures/workers-with-assets-serve-directly/tsconfig.json rename to fixtures/workers-with-assets-run-worker-first/tsconfig.json diff --git a/fixtures/workers-with-assets-serve-directly/wrangler.toml b/fixtures/workers-with-assets-run-worker-first/wrangler.toml similarity index 66% rename from fixtures/workers-with-assets-serve-directly/wrangler.toml rename to fixtures/workers-with-assets-run-worker-first/wrangler.toml index 72ffc14cdea0..641f48bb08e8 100644 --- a/fixtures/workers-with-assets-serve-directly/wrangler.toml +++ b/fixtures/workers-with-assets-run-worker-first/wrangler.toml @@ -1,10 +1,10 @@ #:schema node_modules/wrangler/config-schema.json -name = "worker-with-assets-serve-directly" +name = "worker-with-assets-run-worker-first" main = "src/index.ts" compatibility_date = "2024-01-01" [assets] directory = "./public" binding="ASSETS" -experimental_serve_directly = false +run_worker_first = true diff --git a/fixtures/workers-with-assets-serve-directly/README.md b/fixtures/workers-with-assets-serve-directly/README.md deleted file mode 100644 index 53a972162566..000000000000 --- a/fixtures/workers-with-assets-serve-directly/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# workers-assets-with-user-worker" - -`workers-assets-with-user-worker-serve-directly"` is a test fixture that showcases Workers with Assets using the serve_directly option. This particular fixture forces a user Worker to be invoked, even if it otherwise would have matched an assets request. - -## dev - -To start a dev session you can run - -``` -wrangler dev -``` - -## Run tests - -``` -npm run test -``` diff --git a/fixtures/workers-with-assets/wrangler.toml b/fixtures/workers-with-assets/wrangler.toml index 9431c78feb05..61aba1a9d889 100644 --- a/fixtures/workers-with-assets/wrangler.toml +++ b/fixtures/workers-with-assets/wrangler.toml @@ -5,3 +5,4 @@ compatibility_date = "2024-01-01" [assets] directory = "./public" binding="ASSETS" +experimental_serve_directly = true diff --git a/packages/workers-shared/asset-worker/src/configuration.ts b/packages/workers-shared/asset-worker/src/configuration.ts index 4d776715bce3..fd0f4e25d198 100644 --- a/packages/workers-shared/asset-worker/src/configuration.ts +++ b/packages/workers-shared/asset-worker/src/configuration.ts @@ -3,9 +3,19 @@ import type { AssetConfig } from "../../utils/types"; export const applyConfigurationDefaults = ( configuration?: AssetConfig ): Required => { + let runWorkerFirst = undefined; + if (configuration?.run_worker_first !== undefined) { + runWorkerFirst = configuration?.run_worker_first; + } else if (configuration?.serve_directly !== undefined) { + runWorkerFirst = !configuration.serve_directly; + } else { + runWorkerFirst = false; + } + return { html_handling: configuration?.html_handling ?? "auto-trailing-slash", not_found_handling: configuration?.not_found_handling ?? "none", - serve_directly: configuration?.serve_directly ?? true, + run_worker_first: runWorkerFirst, + serve_directly: !runWorkerFirst, }; }; diff --git a/packages/workers-shared/asset-worker/tests/handler.test.ts b/packages/workers-shared/asset-worker/tests/handler.test.ts index 0a46093ac70b..323773583750 100644 --- a/packages/workers-shared/asset-worker/tests/handler.test.ts +++ b/packages/workers-shared/asset-worker/tests/handler.test.ts @@ -9,6 +9,7 @@ describe("[Asset Worker] `handleRequest`", () => { const configuration: Required = { html_handling: "none", not_found_handling: "none", + run_worker_first: false, serve_directly: true, }; const eTag = "some-etag"; @@ -38,6 +39,7 @@ describe("[Asset Worker] `handleRequest`", () => { const configuration: Required = { html_handling: "none", not_found_handling: "none", + run_worker_first: false, serve_directly: true, }; const eTag = "some-etag"; @@ -69,6 +71,7 @@ describe("[Asset Worker] `handleRequest`", () => { const configuration: Required = { html_handling: "none", not_found_handling: "none", + run_worker_first: false, serve_directly: true, }; const eTag = "some-etag"; @@ -100,6 +103,7 @@ describe("[Asset Worker] `handleRequest`", () => { const configuration: Required = { html_handling: "none", not_found_handling: "none", + run_worker_first: false, serve_directly: true, }; const eTag = "some-etag"; @@ -192,6 +196,7 @@ describe("[Asset Worker] `handleRequest`", () => { const configuration: Required = { html_handling: "drop-trailing-slash", not_found_handling: "none", + run_worker_first: false, serve_directly: true, }; diff --git a/packages/workers-shared/utils/types.ts b/packages/workers-shared/utils/types.ts index abdda642e0e5..5802cca430ca 100644 --- a/packages/workers-shared/utils/types.ts +++ b/packages/workers-shared/utils/types.ts @@ -22,6 +22,7 @@ export const AssetConfigSchema = z.object({ .enum(["single-page-application", "404-page", "none"]) .optional(), serve_directly: z.boolean().optional(), + run_worker_first: z.boolean().optional(), }); export const InternalConfigSchema = z.object({ diff --git a/packages/wrangler/e2e/deployments.test.ts b/packages/wrangler/e2e/deployments.test.ts index 13cef1a30f40..a820fa15a38b 100644 --- a/packages/wrangler/e2e/deployments.test.ts +++ b/packages/wrangler/e2e/deployments.test.ts @@ -490,7 +490,7 @@ Current Version ID: 00000000-0000-0000-0000-000000000000`); ); expect(text).toContain("

404.html

"); }); - it("runs user worker ahead of matching assets when serve_directly = false", async () => { + it("runs user worker ahead of matching assets when run_worker_first = true", async () => { await helper.seed({ "wrangler.toml": dedent` name = "${workerName}" @@ -501,7 +501,7 @@ Current Version ID: 00000000-0000-0000-0000-000000000000`); binding = "ASSETS" html_handling = "none" not_found_handling = "404-page" - experimental_serve_directly = false + run_worker_first = true `, "src/index.ts": dedent` export default { diff --git a/packages/wrangler/src/__tests__/deploy.test.ts b/packages/wrangler/src/__tests__/deploy.test.ts index 04366e08a950..58462b69fceb 100644 --- a/packages/wrangler/src/__tests__/deploy.test.ts +++ b/packages/wrangler/src/__tests__/deploy.test.ts @@ -1849,7 +1849,7 @@ Update them to point to this script instead?`, `); }); - it("should not warn on mounted paths if serve_directly = true", async () => { + it("should not warn on mounted paths if run_worker_first = false", async () => { writeWranglerConfig({ routes: [ "simple.co.uk/path/*", @@ -1862,7 +1862,7 @@ Update them to point to this script instead?`, ], assets: { directory: "assets", - experimental_serve_directly: true, + run_worker_first: false, }, }); await mockAUSRequest([]); @@ -1872,7 +1872,7 @@ Update them to point to this script instead?`, expectedAssets: { jwt: "<>", config: { - serve_directly: true, + run_worker_first: false, }, }, expectedType: "none", @@ -4702,7 +4702,7 @@ addEventListener('fetch', event => {});` main: "index.js", assets: { directory: "assets", - experimental_serve_directly: false, + run_worker_first: true, binding: "ASSETS", }, placement: { @@ -4716,7 +4716,7 @@ addEventListener('fetch', event => {});` expectedAssets: { jwt: "<>", config: { - serve_directly: false, + run_worker_first: true, }, }, expectedMainModule: "index.js", @@ -4726,7 +4726,7 @@ addEventListener('fetch', event => {});` await runWrangler("deploy"); expect(std.warn).toMatchInlineSnapshot(` - "▲ [WARNING] Turning on Smart Placement in a Worker that is using assets and serve_directly set to false means that your entire Worker could be moved to run closer to your data source, and all requests will go to that Worker before serving assets. + "▲ [WARNING] Turning on Smart Placement in a Worker that is using assets and run_worker_first set to true means that your entire Worker could be moved to run closer to your data source, and all requests will go to that Worker before serving assets. This could result in poor performance as round trip times could increase when serving assets. @@ -4736,7 +4736,7 @@ addEventListener('fetch', event => {});` `); }); - it("should warn if experimental_serve_directly=false but no binding is provided", async () => { + it("should warn if run_worker_first=true but no binding is provided", async () => { const assets = [ { filePath: ".assetsignore", content: "*.bak\nsub-dir" }, { filePath: "file-1.txt", content: "Content of file-1" }, @@ -4751,7 +4751,7 @@ addEventListener('fetch', event => {});` main: "index.js", assets: { directory: "assets", - experimental_serve_directly: false, + run_worker_first: true, }, }); const bodies: AssetManifest[] = []; @@ -4761,7 +4761,7 @@ addEventListener('fetch', event => {});` expectedAssets: { jwt: "<>", config: { - serve_directly: false, + run_worker_first: true, }, }, expectedMainModule: "index.js", @@ -4770,9 +4770,9 @@ addEventListener('fetch', event => {});` await runWrangler("deploy"); expect(std.warn).toMatchInlineSnapshot(` - "▲ [WARNING] experimental_serve_directly=false set without an assets binding + "▲ [WARNING] run_worker_first=true set without an assets binding - Setting experimental_serve_directly to false will always invoke your Worker script. + Setting run_worker_first to true will always invoke your Worker script. To fetch your assets from your Worker, please set the [assets.binding] key in your configuration file. @@ -4782,18 +4782,103 @@ addEventListener('fetch', event => {});` `); }); - it("should error if experimental_serve_directly is false and no user Worker is provided", async () => { + it("should warn if using experimental_serve_directly", async () => { + const assets = [ + { filePath: ".assetsignore", content: "*.bak\nsub-dir" }, + { filePath: "file-1.txt", content: "Content of file-1" }, + { filePath: "file-2.bak", content: "Content of file-2" }, + { filePath: "file-3.txt", content: "Content of file-3" }, + { filePath: "sub-dir/file-4.bak", content: "Content of file-4" }, + { filePath: "sub-dir/file-5.txt", content: "Content of file-5" }, + ]; + writeAssets(assets, "assets"); + writeWorkerSource({ format: "js" }); + writeWranglerConfig({ + main: "index.js", + assets: { + directory: "assets", + experimental_serve_directly: true, + }, + }); + const bodies: AssetManifest[] = []; + await mockAUSRequest(bodies); + mockSubDomainRequest(); + mockUploadWorkerRequest({ + expectedAssets: { + jwt: "<>", + config: { + run_worker_first: false, + }, + }, + expectedMainModule: "index.js", + }); + + await runWrangler("deploy"); + + expect(std.warn).toMatchInlineSnapshot( + ` + "▲ [WARNING] Processing wrangler.toml configuration: + + - Deprecation: \\"assets.experimental_serve_directly\\": + The \\"experimental_serve_directly\\" field is not longer supported. Please use run_worker_first. + Read more: https://developers.cloudflare.com/workers/static-assets/binding/#run_worker_first + + " + ` + ); + }); + + it("should error if using experimental_serve_directly and run_worker_first", async () => { + const assets = [ + { filePath: ".assetsignore", content: "*.bak\nsub-dir" }, + { filePath: "file-1.txt", content: "Content of file-1" }, + { filePath: "file-2.bak", content: "Content of file-2" }, + { filePath: "file-3.txt", content: "Content of file-3" }, + { filePath: "sub-dir/file-4.bak", content: "Content of file-4" }, + { filePath: "sub-dir/file-5.txt", content: "Content of file-5" }, + ]; + writeAssets(assets, "assets"); + writeWorkerSource({ format: "js" }); + writeWranglerConfig({ + main: "index.js", + assets: { + directory: "assets", + experimental_serve_directly: true, + run_worker_first: false, + }, + }); + const bodies: AssetManifest[] = []; + await mockAUSRequest(bodies); + mockSubDomainRequest(); + mockUploadWorkerRequest({ + expectedAssets: { + jwt: "<>", + config: { + run_worker_first: true, + }, + }, + expectedMainModule: "index.js", + }); + + await expect(runWrangler("deploy")).rejects + .toThrowErrorMatchingInlineSnapshot(` + [Error: run_worker_first and experimental_serve_directly specified. + Only one of these configuration options may be provided.] + `); + }); + + it("should error if run_worker_first is true and no user Worker is provided", async () => { writeWranglerConfig({ assets: { directory: "xyz", - experimental_serve_directly: false, + run_worker_first: true, }, }); await expect(runWrangler("deploy")).rejects .toThrowErrorMatchingInlineSnapshot(` - [Error: Cannot set experimental_serve_directly=false without a Worker script. - Please remove experimental_serve_directly from your configuration file, or provide a Worker script in your configuration file (\`main\`).] + [Error: Cannot set run_worker_first=true without a Worker script. + Please remove run_worker_first from your configuration file, or provide a Worker script in your configuration file (\`main\`).] `); }); @@ -5291,7 +5376,6 @@ addEventListener('fetch', event => {});` ["Q29udGVudCBvZiBmaWxlLTI="], "7574a8cd3094a050388ac9663af1c1d6", { - // TODO: this should be "text/plain; charset=utf-8", but msw? is stripping the charset part type: "text/plain", } ) @@ -5353,7 +5437,7 @@ addEventListener('fetch', event => {});` await runWrangler("deploy"); }); - it("serve_directly correctly overrides default if set to false", async () => { + it("run_worker_first correctly overrides default if set to true", async () => { const assets = [ { filePath: "file-1.txt", content: "Content of file-1" }, { filePath: "boop/file-2.txt", content: "Content of file-2" }, @@ -5369,7 +5453,7 @@ addEventListener('fetch', event => {});` binding: "ASSETS", html_handling: "none", not_found_handling: "404-page", - experimental_serve_directly: false, + run_worker_first: true, }, }); await mockAUSRequest(); @@ -5380,7 +5464,7 @@ addEventListener('fetch', event => {});` config: { html_handling: "none", not_found_handling: "404-page", - serve_directly: false, + run_worker_first: true, }, }, expectedBindings: [{ name: "ASSETS", type: "assets" }], @@ -5391,7 +5475,7 @@ addEventListener('fetch', event => {});` await runWrangler("deploy"); }); - it("serve_directly omitted when not provided in config", async () => { + it("experimental_serve_directly=false maps run_worker_first=true", async () => { const assets = [ { filePath: "file-1.txt", content: "Content of file-1" }, { filePath: "boop/file-2.txt", content: "Content of file-2" }, @@ -5407,6 +5491,7 @@ addEventListener('fetch', event => {});` binding: "ASSETS", html_handling: "none", not_found_handling: "404-page", + experimental_serve_directly: false, }, }); await mockAUSRequest(); @@ -5417,6 +5502,7 @@ addEventListener('fetch', event => {});` config: { html_handling: "none", not_found_handling: "404-page", + run_worker_first: true, }, }, expectedBindings: [{ name: "ASSETS", type: "assets" }], @@ -5427,7 +5513,7 @@ addEventListener('fetch', event => {});` await runWrangler("deploy"); }); - it("serve_directly provided if set to true", async () => { + it("experimental_serve_directly=true maps run_worker_first=false", async () => { const assets = [ { filePath: "file-1.txt", content: "Content of file-1" }, { filePath: "boop/file-2.txt", content: "Content of file-2" }, @@ -5454,7 +5540,81 @@ addEventListener('fetch', event => {});` config: { html_handling: "none", not_found_handling: "404-page", - serve_directly: true, + run_worker_first: false, + }, + }, + expectedBindings: [{ name: "ASSETS", type: "assets" }], + expectedMainModule: "index.js", + expectedCompatibilityDate: "2024-09-27", + expectedCompatibilityFlags: ["nodejs_compat"], + }); + await runWrangler("deploy"); + }); + + it("run_worker_first provided when in config", async () => { + const assets = [ + { filePath: "file-1.txt", content: "Content of file-1" }, + { filePath: "boop/file-2.txt", content: "Content of file-2" }, + ]; + writeAssets(assets); + writeWorkerSource({ format: "js" }); + writeWranglerConfig({ + main: "index.js", + compatibility_date: "2024-09-27", + compatibility_flags: ["nodejs_compat"], + assets: { + directory: "assets", + binding: "ASSETS", + html_handling: "none", + not_found_handling: "404-page", + run_worker_first: true, + }, + }); + await mockAUSRequest(); + mockSubDomainRequest(); + mockUploadWorkerRequest({ + expectedAssets: { + jwt: "<>", + config: { + html_handling: "none", + not_found_handling: "404-page", + run_worker_first: true, + }, + }, + expectedBindings: [{ name: "ASSETS", type: "assets" }], + expectedMainModule: "index.js", + expectedCompatibilityDate: "2024-09-27", + expectedCompatibilityFlags: ["nodejs_compat"], + }); + await runWrangler("deploy"); + }); + + it("run_worker_first omitted when not provided in config", async () => { + const assets = [ + { filePath: "file-1.txt", content: "Content of file-1" }, + { filePath: "boop/file-2.txt", content: "Content of file-2" }, + ]; + writeAssets(assets); + writeWorkerSource({ format: "js" }); + writeWranglerConfig({ + main: "index.js", + compatibility_date: "2024-09-27", + compatibility_flags: ["nodejs_compat"], + assets: { + directory: "assets", + binding: "ASSETS", + html_handling: "none", + not_found_handling: "404-page", + }, + }); + await mockAUSRequest(); + mockSubDomainRequest(); + mockUploadWorkerRequest({ + expectedAssets: { + jwt: "<>", + config: { + html_handling: "none", + not_found_handling: "404-page", }, }, expectedBindings: [{ name: "ASSETS", type: "assets" }], diff --git a/packages/wrangler/src/__tests__/dev.test.ts b/packages/wrangler/src/__tests__/dev.test.ts index 4318e902c827..5cbce0f5ecb1 100644 --- a/packages/wrangler/src/__tests__/dev.test.ts +++ b/packages/wrangler/src/__tests__/dev.test.ts @@ -1678,12 +1678,12 @@ describe.sequential("wrangler dev", () => { ); }); - it("should warn if experimental_serve_directly=false but no binding is provided", async () => { + it("should warn if run_worker_first=true but no binding is provided", async () => { writeWranglerConfig({ main: "index.js", assets: { directory: "assets", - experimental_serve_directly: false, + run_worker_first: true, }, }); fs.mkdirSync("assets"); @@ -1692,9 +1692,9 @@ describe.sequential("wrangler dev", () => { await runWranglerUntilConfig("dev"); expect(std.warn).toMatchInlineSnapshot(` - "▲ [WARNING] experimental_serve_directly=false set without an assets binding + "▲ [WARNING] run_worker_first=true set without an assets binding - Setting experimental_serve_directly to false will always invoke your Worker script. + Setting run_worker_first to true will always invoke your Worker script. To fetch your assets from your Worker, please set the [assets.binding] key in your configuration file. @@ -1704,17 +1704,62 @@ describe.sequential("wrangler dev", () => { `); }); - it("should error if experimental_serve_directly is false and no user Worker is provided", async () => { + it("should error if using experimental_serve_directly and run_worker_first", async () => { writeWranglerConfig({ - assets: { directory: "assets", experimental_serve_directly: false }, + assets: { + directory: "assets", + run_worker_first: true, + experimental_serve_directly: true, + }, + }); + fs.mkdirSync("assets"); + await expect( + runWrangler("dev") + ).rejects.toThrowErrorMatchingInlineSnapshot( + ` + [Error: run_worker_first and experimental_serve_directly specified. + Only one of these configuration options may be provided.] + ` + ); + }); + + it("should warn if using experimental_serve_directly", async () => { + writeWranglerConfig({ + main: "index.js", + assets: { + directory: "assets", + experimental_serve_directly: true, + }, + }); + fs.mkdirSync("assets"); + fs.writeFileSync("index.js", `export default {};`); + + await runWranglerUntilConfig("dev"); + + expect(std.warn).toMatchInlineSnapshot( + ` + "▲ [WARNING] Processing wrangler.toml configuration: + + - Deprecation: \\"assets.experimental_serve_directly\\": + The \\"experimental_serve_directly\\" field is not longer supported. Please use run_worker_first. + Read more: https://developers.cloudflare.com/workers/static-assets/binding/#run_worker_first + + " + ` + ); + }); + + it("should error if run_worker_first is true and no user Worker is provided", async () => { + writeWranglerConfig({ + assets: { directory: "assets", run_worker_first: true }, }); fs.mkdirSync("assets"); await expect( runWrangler("dev") ).rejects.toThrowErrorMatchingInlineSnapshot( ` - [Error: Cannot set experimental_serve_directly=false without a Worker script. - Please remove experimental_serve_directly from your configuration file, or provide a Worker script in your configuration file (\`main\`).] + [Error: Cannot set run_worker_first=true without a Worker script. + Please remove run_worker_first from your configuration file, or provide a Worker script in your configuration file (\`main\`).] ` ); }); diff --git a/packages/wrangler/src/assets.ts b/packages/wrangler/src/assets.ts index 7df9018404e4..fede65e8bb16 100644 --- a/packages/wrangler/src/assets.ts +++ b/packages/wrangler/src/assets.ts @@ -376,14 +376,15 @@ export function getAssetsOptions( const routingConfig = { has_user_worker: Boolean(args.script || config.main), - invoke_user_worker_ahead_of_assets: !( - config.assets?.experimental_serve_directly ?? true - ), + invoke_user_worker_ahead_of_assets: + config.assets?.run_worker_first || false, }; + // defaults are set in asset worker const assetConfig = { html_handling: config.assets?.html_handling, not_found_handling: config.assets?.not_found_handling, + run_worker_first: config.assets?.run_worker_first, serve_directly: config.assets?.experimental_serve_directly, }; @@ -469,42 +470,54 @@ export function validateAssetsArgsAndConfig( // Smart placement turned on when using assets if ( config?.placement?.mode === "smart" && - config?.assets?.experimental_serve_directly === false + config?.assets?.run_worker_first === true ) { logger.warn( - "Turning on Smart Placement in a Worker that is using assets and serve_directly set to false means that your entire Worker could be moved to run closer to your data source, and all requests will go to that Worker before serving assets.\n" + + "Turning on Smart Placement in a Worker that is using assets and run_worker_first set to true means that your entire Worker could be moved to run closer to your data source, and all requests will go to that Worker before serving assets.\n" + "This could result in poor performance as round trip times could increase when serving assets.\n\n" + "Read more: https://developers.cloudflare.com/workers/static-assets/binding/#smart-placement" ); } + // Provided both the run_worker_first and experimental_serve_directly options + if ( + "legacy" in args + ? args.assets?.assetConfig?.run_worker_first !== undefined && + args.assets?.assetConfig.serve_directly !== undefined + : config?.assets?.run_worker_first !== undefined && + config?.assets?.experimental_serve_directly !== undefined + ) { + throw new UserError( + "run_worker_first and experimental_serve_directly specified.\n" + + "Only one of these configuration options may be provided." + ); + } + // User Worker ahead of assets, but no assets binding provided if ( "legacy" in args - ? args.assets?.assetConfig?.serve_directly === false && + ? args.assets?.assetConfig?.run_worker_first === true && !args.assets?.binding - : config?.assets?.experimental_serve_directly === false && - !config?.assets?.binding + : config?.assets?.run_worker_first === true && !config?.assets?.binding ) { logger.warn( - "experimental_serve_directly=false set without an assets binding\n" + - "Setting experimental_serve_directly to false will always invoke your Worker script.\n" + + "run_worker_first=true set without an assets binding\n" + + "Setting run_worker_first to true will always invoke your Worker script.\n" + "To fetch your assets from your Worker, please set the [assets.binding] key in your configuration file.\n\n" + "Read more: https://developers.cloudflare.com/workers/static-assets/binding/#binding" ); } - // Using serve_directly=false, but didn't provide a Worker script + // Using run_worker_first=true, but didn't provide a Worker script if ( "legacy" in args ? args.entrypoint === noOpEntrypoint && - args.assets?.assetConfig?.serve_directly === false - : !config?.main && config?.assets?.experimental_serve_directly === false + args.assets?.assetConfig?.run_worker_first === true + : !config?.main && config?.assets?.run_worker_first === true ) { throw new UserError( - "Cannot set experimental_serve_directly=false without a Worker script.\n" + - "Please remove experimental_serve_directly from your configuration file, or provide a Worker script in your configuration file (`main`).", - { telemetryMessage: true } + "Cannot set run_worker_first=true without a Worker script.\n" + + "Please remove run_worker_first from your configuration file, or provide a Worker script in your configuration file (`main`)." ); } } diff --git a/packages/wrangler/src/config/environment.ts b/packages/wrangler/src/config/environment.ts index b11b42895dbf..94106cc8f40e 100644 --- a/packages/wrangler/src/config/environment.ts +++ b/packages/wrangler/src/config/environment.ts @@ -996,9 +996,12 @@ export type Assets = { /** How to handle requests that do not match an asset. */ not_found_handling?: "single-page-application" | "404-page" | "none"; /** - * If true, then respond to requests that match an asset with that asset directly. - * If false, route every request to the User Worker, whether or not it matches an asset. + * If true, route every request to the User Worker, whether or not it matches an asset. + * If false, then respond to requests that match an asset with that asset directly. * */ + run_worker_first?: boolean; + + /** Deprecated; Inverse of run_worker_first. Should use run_worker_first instead */ experimental_serve_directly?: boolean; }; diff --git a/packages/wrangler/src/config/validation.ts b/packages/wrangler/src/config/validation.ts index c1f4db139fcc..89f30c8a1e84 100644 --- a/packages/wrangler/src/config/validation.ts +++ b/packages/wrangler/src/config/validation.ts @@ -583,6 +583,26 @@ function normalizeAndValidateDev( return { ip, port, inspector_port, local_protocol, upstream_protocol, host }; } +function normalizeAndValidateAssets( + diagnostics: Diagnostics, + topLevelEnv: Environment | undefined, + rawEnv: RawEnvironment +): Config["assets"] { + if (rawEnv?.assets !== undefined) { + deprecated( + diagnostics, + rawEnv, + "assets.experimental_serve_directly", + `The "experimental_serve_directly" field is not longer supported. Please use run_worker_first.\nRead more: https://developers.cloudflare.com/workers/static-assets/binding/#run_worker_first`, + false // Leave in for the moment, to be removed in a future release + ); + + validateAssetsConfig(diagnostics, "assets", rawEnv.assets, topLevelEnv); + return rawEnv.assets; + } + return undefined; +} + /** * Validate the `site` configuration and return the normalized values. */ @@ -1283,14 +1303,7 @@ function normalizeAndValidateEnvironment( isObjectWith("crons"), { crons: [] } ), - assets: inheritable( - diagnostics, - topLevelEnv, - rawEnv, - "assets", - validateAssetsConfig, - undefined - ), + assets: normalizeAndValidateAssets(diagnostics, topLevelEnv, rawEnv), usage_model: inheritable( diagnostics, topLevelEnv, @@ -2199,6 +2212,15 @@ const validateAssetsConfig: ValidatorFn = (diagnostics, field, value) => { ["single-page-application", "404-page", "none"] ) && isValid; + isValid = + validateOptionalProperty( + diagnostics, + field, + "run_worker_first", + (value as Assets).run_worker_first, + "boolean" + ) && isValid; + isValid = validateOptionalProperty( diagnostics, @@ -2214,6 +2236,7 @@ const validateAssetsConfig: ValidatorFn = (diagnostics, field, value) => { "binding", "html_handling", "not_found_handling", + "run_worker_first", "experimental_serve_directly", ]) && isValid; diff --git a/packages/wrangler/src/deploy/deploy.ts b/packages/wrangler/src/deploy/deploy.ts index 2f956bc2933b..67ca627a9721 100644 --- a/packages/wrangler/src/deploy/deploy.ts +++ b/packages/wrangler/src/deploy/deploy.ts @@ -193,10 +193,10 @@ export const validateRoutes = (routes: Route[], assets?: AssetsOptions) => { `Paths are not allowed in Custom Domains` ); } - // If we have Assets but we're not always hitting the Worker then validate } else if ( + // If we have Assets but we're not always hitting the Worker then validate assets?.directory !== undefined && - assets.assetConfig.serve_directly !== true + assets.assetConfig.run_worker_first !== true ) { const pattern = typeof route === "string" ? route : route.pattern; const components = pattern.split("/"); diff --git a/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts b/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts index 754a298ad09f..e440ff8a7b0f 100644 --- a/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts +++ b/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts @@ -193,10 +193,17 @@ export function createWorkerUploadForm(worker: CfWorkerInit): FormData { observability, } = worker; + let runWorkerFirst = undefined; + if (assets?.assetConfig?.run_worker_first !== undefined) { + runWorkerFirst = assets.assetConfig?.run_worker_first; + } else if (assets?.assetConfig?.serve_directly !== undefined) { + runWorkerFirst = !assets?.assetConfig?.serve_directly; + } + const assetConfig = { html_handling: assets?.assetConfig?.html_handling, not_found_handling: assets?.assetConfig?.not_found_handling, - serve_directly: assets?.assetConfig?.serve_directly, + run_worker_first: runWorkerFirst, }; // short circuit if static assets upload only diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 60d44a211209..503e93e82c95 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -957,7 +957,7 @@ importers: specifier: workspace:* version: link:../../packages/wrangler - fixtures/workers-with-assets-serve-directly: + fixtures/workers-with-assets-run-worker-first: devDependencies: '@cloudflare/workers-tsconfig': specifier: workspace:* From f1ef4f10e862876a6575b05db3a2e412db08433f Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Tue, 28 Jan 2025 15:19:48 +0100 Subject: [PATCH 10/15] fix(wrangler): handling of `process.env.NODE_ENV` in bundling mode (#7932) --- .changeset/lucky-jeans-relax.md | 5 ++++ .../wrangler/src/deployment-bundle/bundle.ts | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .changeset/lucky-jeans-relax.md diff --git a/.changeset/lucky-jeans-relax.md b/.changeset/lucky-jeans-relax.md new file mode 100644 index 000000000000..251c7145ab80 --- /dev/null +++ b/.changeset/lucky-jeans-relax.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +fix(wrangler): handling of `process.env.NODE_ENV` in bundling mode diff --git a/packages/wrangler/src/deployment-bundle/bundle.ts b/packages/wrangler/src/deployment-bundle/bundle.ts index 7cc968fcd8bd..310e6f4afbec 100644 --- a/packages/wrangler/src/deployment-bundle/bundle.ts +++ b/packages/wrangler/src/deployment-bundle/bundle.ts @@ -393,6 +393,11 @@ export async function bundleWorker( const unenvResolvePaths = getUnenvResolvePathsFromEnv()?.split(","); + // Use `process.env["NODE_ENV" + ""]` to get the runtime value when wranler is executed. + // Esbuild would replace `process.env.NODE_ENV` with the value it has when wrangler gets bundled. + // See: https://github.com/cloudflare/workers-sdk/issues/1477) + const runtimeProcessEnv = process.env["NODE_ENV" + ""]; + const buildOptions = { // Don't use entryFile here as the file may have been changed when applying the middleware entryPoints: [entry.file], @@ -422,18 +427,16 @@ export async function bundleWorker( metafile: true, conditions: getBuildConditions(), platform: getBuildPlatform(), - ...(process.env.NODE_ENV && { - define: { - ...(defineNavigatorUserAgent - ? { "navigator.userAgent": `"Cloudflare-Workers"` } - : {}), - // use process.env["NODE_ENV" + ""] so that esbuild doesn't replace it - // when we do a build of wrangler. (re: https://github.com/cloudflare/workers-sdk/issues/1477) - "process.env.NODE_ENV": `"${process.env["NODE_ENV" + ""]}"`, - ...(nodejsCompatMode === "legacy" ? { global: "globalThis" } : {}), - ...define, - }, - }), + define: { + ...(defineNavigatorUserAgent + ? { "navigator.userAgent": `"Cloudflare-Workers"` } + : {}), + ...(runtimeProcessEnv + ? { "process.env.NODE_ENV": `"${runtimeProcessEnv}"` } + : {}), + ...(nodejsCompatMode === "legacy" ? { global: "globalThis" } : {}), + ...define, + }, loader: COMMON_ESBUILD_OPTIONS.loader, plugins: [ aliasPlugin, From de6fa1846ac793a86356a319a09482f08819b632 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Tue, 28 Jan 2025 14:52:25 +0000 Subject: [PATCH 11/15] improve and test vite-plugin-cloudflare `.dev.vars` files support (#7864) Co-authored-by: James Opstad <13586373+jamesopstad@users.noreply.github.com> Co-authored-by: Victor Berchet Co-authored-by: Pete Bacon Darwin --- .changeset/orange-camels-hunt_vite-plugin.md | 10 ++++ .changeset/orange-camels-hunt_wrangler.md | 9 ++++ packages/vite-plugin-cloudflare/README.md | 7 +++ .../playground/dev-vars/.dev.vars | 4 ++ .../playground/dev-vars/.dev.vars.staging | 3 ++ .../dev-vars/.env.with-specified-env | 1 + .../playground/dev-vars/.gitignore | 1 + .../__tests__/dev-vars-loading.spec.ts | 34 ++++++++++++ .../dev-vars-loading.spec.ts | 33 ++++++++++++ .../playground/dev-vars/package.json | 19 +++++++ .../playground/dev-vars/src/index.ts | 9 ++++ .../playground/dev-vars/tsconfig.json | 7 +++ .../playground/dev-vars/tsconfig.node.json | 8 +++ .../playground/dev-vars/tsconfig.worker.json | 4 ++ .../playground/dev-vars/turbo.json | 9 ++++ .../playground/dev-vars/vite.config.ts | 6 +++ .../vite.config.with-specified-env.ts | 7 +++ .../dev-vars/worker-configuration.d.ts | 8 +++ .../playground/dev-vars/wrangler.toml | 5 ++ packages/vite-plugin-cloudflare/src/index.ts | 53 ++++++++++++++++++- .../src/miniflare-options.ts | 11 ++-- .../src/plugin-config.ts | 23 ++++---- .../src/api/integrations/platform/index.ts | 3 +- packages/wrangler/src/config/index.ts | 4 ++ pnpm-lock.yaml | 21 ++++++++ 25 files changed, 283 insertions(+), 16 deletions(-) create mode 100644 .changeset/orange-camels-hunt_vite-plugin.md create mode 100644 .changeset/orange-camels-hunt_wrangler.md create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars.staging create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/.env.with-specified-env create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/.gitignore create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/dev-vars-loading.spec.ts create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/with-specified-env/dev-vars-loading.spec.ts create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/package.json create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/src/index.ts create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.json create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.node.json create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.worker.json create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/turbo.json create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.ts create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.with-specified-env.ts create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/worker-configuration.d.ts create mode 100644 packages/vite-plugin-cloudflare/playground/dev-vars/wrangler.toml diff --git a/.changeset/orange-camels-hunt_vite-plugin.md b/.changeset/orange-camels-hunt_vite-plugin.md new file mode 100644 index 000000000000..bed482dbb677 --- /dev/null +++ b/.changeset/orange-camels-hunt_vite-plugin.md @@ -0,0 +1,10 @@ +--- +"@cloudflare/vite-plugin": patch +--- + +Add full support for `.dev.vars` files. + +This change makes sure that `.dev.vars` files work when the environment is specified. It also +copies the target `.dev.vars` file (which might be environment specific, e.g. `.dev.vars.prod`) +to the worker's dist directory so that `vite preview` can pick it up. +The copied file will always be named `.dev.vars`. diff --git a/.changeset/orange-camels-hunt_wrangler.md b/.changeset/orange-camels-hunt_wrangler.md new file mode 100644 index 000000000000..5579e8224cc3 --- /dev/null +++ b/.changeset/orange-camels-hunt_wrangler.md @@ -0,0 +1,9 @@ +--- +"wrangler": minor +--- + +Update the `unstable_getMiniflareWorkerOptions` types to always include an `env` parameter. + +The `unstable_getMiniflareWorkerOptions` types, when accepting a config object as the first argument, +didn't accept a second `env` argument. The changes here make sure they do, since the `env` is still +relevant for picking up variables from `.dev.vars` files. diff --git a/packages/vite-plugin-cloudflare/README.md b/packages/vite-plugin-cloudflare/README.md index 5f9e83f15c36..f944c4264b7d 100644 --- a/packages/vite-plugin-cloudflare/README.md +++ b/packages/vite-plugin-cloudflare/README.md @@ -466,6 +466,13 @@ The value of `MY_VAR` will therefore be `'Production var'`. If you run `vite build --mode staging` then the 'staging' Vite mode will be used and the 'staging' Cloudflare environment will be selected. The value of `MY_VAR` will therefore be `'Staging var'`. +## Secrets + +Secrets can be provided to your Worker in local development using a [`.dev.vars`](https://developers.cloudflare.com/workers/configuration/secrets/#local-development-with-secrets) file. If you are using [Cloudflare Environments](#cloudflare-environments) then the relevant `.dev.vars` file will be selected. For example, `CLOUDFLARE_ENV=staging vite dev` will load `.dev.vars.staging` if it exists and fall back to `.dev.vars`. + +> [!NOTE] +> The `vite build` command copies the relevant `.dev.vars[.env-name]` file to the output directory. This is only used when running `vite preview` and is not deployed with your Worker. + ## Migrating from `wrangler dev` Migrating from `wrangler dev` is a simple process and you can follow the instructions in the [Quick start](#quick-start) to get started. diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars b/packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars new file mode 100644 index 000000000000..aaf2f60b4efc --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars @@ -0,0 +1,4 @@ +ENV_NAME = "" +MY_DEV_VAR_A = "my .dev.vars variable A" +MY_DEV_VAR_B = "my .dev.vars variable B" +MY_DEV_VAR_C = "my .dev.vars variable C" diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars.staging b/packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars.staging new file mode 100644 index 000000000000..779cac5be467 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/.dev.vars.staging @@ -0,0 +1,3 @@ +ENV_NAME = "staging" +MY_DEV_VAR_A = "my .dev.vars staging variable A" +MY_DEV_VAR_B = "my .dev.vars staging variable B" diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/.env.with-specified-env b/packages/vite-plugin-cloudflare/playground/dev-vars/.env.with-specified-env new file mode 100644 index 000000000000..69498a438586 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/.env.with-specified-env @@ -0,0 +1 @@ +CLOUDFLARE_ENV=staging diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/.gitignore b/packages/vite-plugin-cloudflare/playground/dev-vars/.gitignore new file mode 100644 index 000000000000..24f3425bb31e --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/.gitignore @@ -0,0 +1 @@ +!.dev.vars* diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/dev-vars-loading.spec.ts b/packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/dev-vars-loading.spec.ts new file mode 100644 index 000000000000..270ca6870aa2 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/dev-vars-loading.spec.ts @@ -0,0 +1,34 @@ +import fs from "node:fs"; +import { describe, expect, test } from "vitest"; +import { getJsonResponse, isBuild, testDir } from "../../__test-utils__"; + +test("reading variables from a standard .dev.vars file", async () => { + expect(await getJsonResponse()).toEqual({ + "variables present in .dev.vars": { + MY_DEV_VAR_A: "my .dev.vars variable A", + MY_DEV_VAR_B: "my .dev.vars variable B", + MY_DEV_VAR_C: "my .dev.vars variable C", + }, + }); +}); + +describe.runIf(isBuild)("build output files", () => { + test("the .dev.vars file has been copied over", async () => { + const srcDevVarsPath = `${testDir}/.dev.vars`; + const distDevVarsPath = `${testDir}/dist/worker/.dev.vars`; + + const distDevVarsExists = fs.existsSync(distDevVarsPath); + expect(distDevVarsExists).toBe(true); + + const srcDevVarsContent = fs.readFileSync(srcDevVarsPath, "utf-8"); + const distDevVarsContent = fs.readFileSync(distDevVarsPath, "utf-8"); + expect(distDevVarsContent).toEqual(srcDevVarsContent); + }); + + test("secrets from .dev.vars haven't been inlined in the js output file", async () => { + const distIndexPath = `${testDir}/dist/worker/index.js`; + + const distIndexContent = fs.readFileSync(distIndexPath, "utf-8"); + expect(distIndexContent).not.toContain("my .dev.vars variable"); + }); +}); diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/with-specified-env/dev-vars-loading.spec.ts b/packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/with-specified-env/dev-vars-loading.spec.ts new file mode 100644 index 000000000000..9dc8216fc048 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/__tests__/with-specified-env/dev-vars-loading.spec.ts @@ -0,0 +1,33 @@ +import fs from "node:fs"; +import { describe, expect, test } from "vitest"; +import { getJsonResponse, isBuild, testDir } from "../../../__test-utils__"; + +test("reading variables from a staging .dev.vars file", async () => { + expect(await getJsonResponse()).toEqual({ + "variables present in .dev.vars.staging": { + MY_DEV_VAR_A: "my .dev.vars staging variable A", + MY_DEV_VAR_B: "my .dev.vars staging variable B", + }, + }); +}); + +describe.runIf(isBuild)("build output files", () => { + test("the .dev.vars.staging file has been copied over as .dev.vars", async () => { + const srcDevVarsStagingPath = `${testDir}/.dev.vars.staging`; + const distDevVarsPath = `${testDir}/dist/worker/.dev.vars`; + const distDevVarsStagingPath = `${distDevVarsPath}.staging`; + + const distDevVarsExists = fs.existsSync(distDevVarsPath); + expect(distDevVarsExists).toBe(true); + + const srcDevVarsStagingContent = fs.readFileSync( + srcDevVarsStagingPath, + "utf-8" + ); + const distDevVarsContent = fs.readFileSync(distDevVarsPath, "utf-8"); + expect(distDevVarsContent).toEqual(srcDevVarsStagingContent); + + const distDevVarsStagingExists = fs.existsSync(distDevVarsStagingPath); + expect(distDevVarsStagingExists).toBe(false); + }); +}); diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/package.json b/packages/vite-plugin-cloudflare/playground/dev-vars/package.json new file mode 100644 index 000000000000..f137e96319ee --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/package.json @@ -0,0 +1,19 @@ +{ + "name": "@playground/dev-vars", + "private": true, + "type": "module", + "scripts": { + "build": "vite build --app", + "check:types": "tsc --build", + "dev": "vite dev", + "preview": "vite preview" + }, + "devDependencies": { + "@cloudflare/vite-plugin": "workspace:*", + "@cloudflare/workers-tsconfig": "workspace:*", + "@cloudflare/workers-types": "^4.20241230.0", + "typescript": "catalog:vite-plugin", + "vite": "catalog:vite-plugin", + "wrangler": "catalog:vite-plugin" + } +} diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/src/index.ts b/packages/vite-plugin-cloudflare/playground/dev-vars/src/index.ts new file mode 100644 index 000000000000..55de2f4cfb33 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/src/index.ts @@ -0,0 +1,9 @@ +export default { + async fetch(_req, env) { + const { ENV_NAME, ...dotDevDotVarsVariables } = env; + const extension = ENV_NAME ? `.${ENV_NAME}` : ""; + return Response.json({ + [`variables present in .dev.vars${extension}`]: dotDevDotVarsVariables, + }); + }, +} satisfies ExportedHandler; diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.json b/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.json new file mode 100644 index 000000000000..b52af703bdc2 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.node.json" }, + { "path": "./tsconfig.worker.json" } + ] +} diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.node.json b/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.node.json new file mode 100644 index 000000000000..57214ece0e56 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.node.json @@ -0,0 +1,8 @@ +{ + "extends": ["@cloudflare/workers-tsconfig/base.json"], + "include": [ + "vite.config.ts", + "vite.config.with-specified-env.ts", + "__tests__" + ] +} diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.worker.json b/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.worker.json new file mode 100644 index 000000000000..c22c55c577c8 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/tsconfig.worker.json @@ -0,0 +1,4 @@ +{ + "extends": ["@cloudflare/workers-tsconfig/worker.json"], + "include": ["src", "worker-configuration.d.ts"] +} diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/turbo.json b/packages/vite-plugin-cloudflare/playground/dev-vars/turbo.json new file mode 100644 index 000000000000..6556dcf3e5e5 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/turbo.json @@ -0,0 +1,9 @@ +{ + "$schema": "http://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "outputs": ["dist/**"] + } + } +} diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.ts b/packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.ts new file mode 100644 index 000000000000..55c8276338d7 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.ts @@ -0,0 +1,6 @@ +import { cloudflare } from "@cloudflare/vite-plugin"; +import { defineConfig } from "vite"; + +export default defineConfig({ + plugins: [cloudflare({ persistState: false })], +}); diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.with-specified-env.ts b/packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.with-specified-env.ts new file mode 100644 index 000000000000..8f3985e7f5dc --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/vite.config.with-specified-env.ts @@ -0,0 +1,7 @@ +import { cloudflare } from "@cloudflare/vite-plugin"; +import { defineConfig } from "vite"; + +export default defineConfig({ + mode: "with-specified-env", + plugins: [cloudflare({ persistState: false })], +}); diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/worker-configuration.d.ts b/packages/vite-plugin-cloudflare/playground/dev-vars/worker-configuration.d.ts new file mode 100644 index 000000000000..913b9d5e9e99 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/worker-configuration.d.ts @@ -0,0 +1,8 @@ +// Generated by Wrangler by running `wrangler types` + +interface Env { + ENV_NAME: string; + MY_DEV_VAR_A: string; + MY_DEV_VAR_B: string; + MY_DEV_VAR_C: string; +} diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/wrangler.toml b/packages/vite-plugin-cloudflare/playground/dev-vars/wrangler.toml new file mode 100644 index 000000000000..7f62f5ec3b68 --- /dev/null +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/wrangler.toml @@ -0,0 +1,5 @@ +name = "worker" +main = "./src/index.ts" +compatibility_date = "2024-12-30" + +[env.staging] diff --git a/packages/vite-plugin-cloudflare/src/index.ts b/packages/vite-plugin-cloudflare/src/index.ts index 2a7b1da3025d..6e91a9c66fee 100644 --- a/packages/vite-plugin-cloudflare/src/index.ts +++ b/packages/vite-plugin-cloudflare/src/index.ts @@ -198,15 +198,33 @@ export function cloudflare(pluginConfig: PluginConfig = {}): vite.Plugin { } config = workerConfig; + + if (workerConfig.configPath) { + const dotDevDotVarsContent = getDotDevDotVarsContent( + workerConfig.configPath, + resolvedPluginConfig.cloudflareEnv + ); + // Save a .dev.vars file to the worker's build output directory + // when it exists so that it will be then detected by `vite preview` + if (dotDevDotVarsContent) { + this.emitFile({ + type: "asset", + fileName: ".dev.vars", + source: dotDevDotVarsContent, + }); + } + } } else if (this.environment.name === "client") { const assetsOnlyConfig = resolvedPluginConfig.config; assetsOnlyConfig.assets.directory = "."; + const filesToAssetsIgnore = ["wrangler.json", ".dev.vars"]; + this.emitFile({ type: "asset", fileName: ".assetsignore", - source: "wrangler.json", + source: `${filesToAssetsIgnore.join("\n")}\n`, }); config = assetsOnlyConfig; @@ -299,3 +317,36 @@ export function cloudflare(pluginConfig: PluginConfig = {}): vite.Plugin { }, }; } + +/** + * Gets the content of a the potential `.dev.vars` target file + * + * Note: This resolves the .dev.vars file path following the same logic + * as `loadDotEnv` in `/packages/wrangler/src/config/index.ts` + * the two need to be kept in sync + * + * @param configPath the path to the worker's wrangler config file + * @param cloudflareEnv the target cloudflare environment + */ +function getDotDevDotVarsContent( + configPath: string, + cloudflareEnv: string | undefined +) { + const configDir = path.dirname(configPath); + + const defaultDotDevDotVarsPath = `${configDir}/.dev.vars`; + const inputDotDevDotVarsPath = `${defaultDotDevDotVarsPath}${cloudflareEnv ? `.${cloudflareEnv}` : ""}`; + + const targetPath = fs.existsSync(inputDotDevDotVarsPath) + ? inputDotDevDotVarsPath + : fs.existsSync(defaultDotDevDotVarsPath) + ? defaultDotDevDotVarsPath + : null; + + if (targetPath) { + const dotDevDotVarsContent = fs.readFileSync(targetPath); + return dotDevDotVarsContent; + } + + return null; +} diff --git a/packages/vite-plugin-cloudflare/src/miniflare-options.ts b/packages/vite-plugin-cloudflare/src/miniflare-options.ts index a43fb59c2d15..c7716e79b52e 100644 --- a/packages/vite-plugin-cloudflare/src/miniflare-options.ts +++ b/packages/vite-plugin-cloudflare/src/miniflare-options.ts @@ -280,10 +280,13 @@ export function getDevMiniflareOptions( resolvedPluginConfig.type === "workers" ? Object.entries(resolvedPluginConfig.workers).map( ([environmentName, workerConfig]) => { - const miniflareWorkerOptions = unstable_getMiniflareWorkerOptions({ - ...workerConfig, - assets: undefined, - }); + const miniflareWorkerOptions = unstable_getMiniflareWorkerOptions( + { + ...workerConfig, + assets: undefined, + }, + resolvedPluginConfig.cloudflareEnv + ); const { ratelimits, ...workerOptions } = miniflareWorkerOptions.workerOptions; diff --git a/packages/vite-plugin-cloudflare/src/plugin-config.ts b/packages/vite-plugin-cloudflare/src/plugin-config.ts index f1e6235a79f5..94208e58ae74 100644 --- a/packages/vite-plugin-cloudflare/src/plugin-config.ts +++ b/packages/vite-plugin-cloudflare/src/plugin-config.ts @@ -47,6 +47,7 @@ export interface WorkerConfig extends BaseConfig { interface BasePluginConfig { configPaths: Set; persistState: PersistState; + cloudflareEnv: string | undefined; } interface AssetsOnlyPluginConfig extends BasePluginConfig { @@ -82,7 +83,11 @@ export function resolvePluginConfig( const configPaths = new Set(); const persistState = pluginConfig.persistState ?? true; const root = userConfig.root ? path.resolve(userConfig.root) : process.cwd(); - const { CLOUDFLARE_ENV } = vite.loadEnv(viteEnv.mode, root, ""); + const { CLOUDFLARE_ENV: cloudflareEnv } = vite.loadEnv( + viteEnv.mode, + root, + /* prefixes */ "" + ); const configPath = pluginConfig.configPath ? path.resolve(root, pluginConfig.configPath) @@ -93,14 +98,10 @@ export function resolvePluginConfig( `Config not found. Have you created a wrangler.json(c) or wrangler.toml file?` ); - const entryWorkerResolvedConfig = getWorkerConfig( - configPath, - CLOUDFLARE_ENV, - { - visitedConfigPaths: configPaths, - isEntryWorker: true, - } - ); + const entryWorkerResolvedConfig = getWorkerConfig(configPath, cloudflareEnv, { + visitedConfigPaths: configPaths, + isEntryWorker: true, + }); if (entryWorkerResolvedConfig.type === "assets-only") { return { @@ -111,6 +112,7 @@ export function resolvePluginConfig( rawConfigs: { entryWorker: entryWorkerResolvedConfig, }, + cloudflareEnv, }; } @@ -129,7 +131,7 @@ export function resolvePluginConfig( for (const auxiliaryWorker of pluginConfig.auxiliaryWorkers ?? []) { const workerResolvedConfig = getWorkerConfig( path.resolve(root, auxiliaryWorker.configPath), - CLOUDFLARE_ENV, + cloudflareEnv, { visitedConfigPaths: configPaths, } @@ -167,5 +169,6 @@ export function resolvePluginConfig( entryWorker: entryWorkerResolvedConfig, auxiliaryWorkers: auxiliaryWorkersResolvedConfigs, }, + cloudflareEnv, }; } diff --git a/packages/wrangler/src/api/integrations/platform/index.ts b/packages/wrangler/src/api/integrations/platform/index.ts index d6b78c38f7bd..708def042c16 100644 --- a/packages/wrangler/src/api/integrations/platform/index.ts +++ b/packages/wrangler/src/api/integrations/platform/index.ts @@ -249,7 +249,8 @@ export function unstable_getMiniflareWorkerOptions( env?: string ): Unstable_MiniflareWorkerOptions; export function unstable_getMiniflareWorkerOptions( - config: Config + config: Config, + env?: string ): Unstable_MiniflareWorkerOptions; export function unstable_getMiniflareWorkerOptions( configOrConfigPath: string | Config, diff --git a/packages/wrangler/src/config/index.ts b/packages/wrangler/src/config/index.ts index 65b1a42542e7..cf9998aea95b 100644 --- a/packages/wrangler/src/config/index.ts +++ b/packages/wrangler/src/config/index.ts @@ -222,6 +222,10 @@ function tryLoadDotEnv(basePath: string): DotEnv | undefined { /** * Loads a dotenv file from `envPath`, preferring to read `${envPath}.${env}` if * `env` is defined and that file exists. + * + * Note: The `getDotDevDotVarsContent` function in the `packages/vite-plugin-cloudflare/src/index.ts` file + * follows the same logic implemented here, the two need to be kept in sync, so if you modify some logic + * here make sure that, if applicable, the same change is reflected there */ export function loadDotEnv(envPath: string, env?: string): DotEnv | undefined { if (env === undefined) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 503e93e82c95..cef5e1c85f71 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1770,6 +1770,27 @@ importers: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) + packages/vite-plugin-cloudflare/playground/dev-vars: + devDependencies: + '@cloudflare/vite-plugin': + specifier: workspace:* + version: link:../.. + '@cloudflare/workers-tsconfig': + specifier: workspace:* + version: link:../../../workers-tsconfig + '@cloudflare/workers-types': + specifier: ^4.20241230.0 + version: 4.20250121.0 + typescript: + specifier: catalog:vite-plugin + version: 5.7.3 + vite: + specifier: catalog:vite-plugin + version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + wrangler: + specifier: catalog:vite-plugin + version: 3.103.2(@cloudflare/workers-types@4.20250121.0) + packages/vite-plugin-cloudflare/playground/durable-objects: devDependencies: '@cloudflare/vite-plugin': From 1af92e3f5ce6684460113d90032b484493b4b562 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 28 Jan 2025 14:55:13 +0000 Subject: [PATCH 12/15] chore: don't fail the PR description check for draft PRs (#7930) --- .github/workflows/validate-pr-description.yml | 14 +++++++++++++- tools/deployments/validate-pr-description.ts | 9 ++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-pr-description.yml b/.github/workflows/validate-pr-description.yml index 683e1e40f9a9..a2618164ef71 100644 --- a/.github/workflows/validate-pr-description.yml +++ b/.github/workflows/validate-pr-description.yml @@ -2,10 +2,21 @@ name: Validate PR Description on: pull_request: - types: [opened, synchronize, reopened, labeled, unlabeled, edited] + types: + [ + opened, + synchronize, + reopened, + labeled, + unlabeled, + edited, + ready_for_review, + converted_to_draft, + ] jobs: check: + # Don't check the Version Packages PR if: github.head_ref != 'changeset-release/main' concurrency: group: ${{ github.workflow }}-${{ github.ref }}-add-pr @@ -47,3 +58,4 @@ jobs: BODY: ${{ github.event.pull_request.body }} LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} FILES: ${{ steps.files.outputs.all }} + DRAFT: ${{ github.event.pull_request.draft }} diff --git a/tools/deployments/validate-pr-description.ts b/tools/deployments/validate-pr-description.ts index ee830aaad0fc..abaedfea9556 100644 --- a/tools/deployments/validate-pr-description.ts +++ b/tools/deployments/validate-pr-description.ts @@ -11,7 +11,14 @@ if (require.main === module) { for (const error of errors) { console.error("- ", error); } - process.exit(1); + if (process.env.DRAFT !== "true") { + process.exit(1); + } else { + console.error("These errors must be fixed before you can merge this PR."); + console.error( + "When you mark this PR as ready for review the CI check will start failing." + ); + } } } From 471cc748bf8257892a0026668db64efee912b447 Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Tue, 28 Jan 2025 15:38:17 +0000 Subject: [PATCH 13/15] chore: fix broken lockfile (#7938) --- .../playground/dev-vars/package.json | 2 +- pnpm-lock.yaml | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/vite-plugin-cloudflare/playground/dev-vars/package.json b/packages/vite-plugin-cloudflare/playground/dev-vars/package.json index f137e96319ee..19b36e7f363c 100644 --- a/packages/vite-plugin-cloudflare/playground/dev-vars/package.json +++ b/packages/vite-plugin-cloudflare/playground/dev-vars/package.json @@ -12,7 +12,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "^4.20241230.0", - "typescript": "catalog:vite-plugin", + "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "catalog:vite-plugin" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cef5e1c85f71..036533b68693 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1782,11 +1782,11 @@ importers: specifier: ^4.20241230.0 version: 4.20250121.0 typescript: - specifier: catalog:vite-plugin + specifier: catalog:default version: 5.7.3 vite: specifier: catalog:vite-plugin - version: 6.0.7(@types/node@18.19.59)(jiti@2.4.2) + version: 6.0.7(@types/node@18.19.74)(jiti@2.4.2) wrangler: specifier: catalog:vite-plugin version: 3.103.2(@cloudflare/workers-types@4.20250121.0) @@ -10605,9 +10605,6 @@ packages: unenv-nightly@2.0.0-20250109-100802-88ad671: resolution: {integrity: sha512-Uij6gODNNNNsNBoDlnaMvZI99I6YlVJLRfYH8AOLMlbFrW7k2w872v9VLuIdch2vF8QBeSC4EftIh5sG4ibzdA==} - unenv@2.0.0-rc.0: - resolution: {integrity: sha512-H0kl2w8jFL/FAk0xvjVing4bS3jd//mbg1QChDnn58l9Sc5RtduaKmLAL8n+eBw5jJo8ZjYV7CrEGage5LAOZQ==} - unenv@2.0.0-rc.1: resolution: {integrity: sha512-PU5fb40H8X149s117aB4ytbORcCvlASdtF97tfls4BPIyj4PeVxvpSuy1jAptqYHqB0vb2w2sHvzM0XWcp2OKg==} @@ -20015,14 +20012,6 @@ snapshots: pathe: 1.1.2 ufo: 1.5.4 - unenv@2.0.0-rc.0: - dependencies: - defu: 6.1.4 - mlly: 1.7.4 - ohash: 1.1.4 - pathe: 1.1.2 - ufo: 1.5.4 - unenv@2.0.0-rc.1: dependencies: defu: 6.1.4 From 17ce7f5661d6db913a3fd35a636b34988b22b131 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 28 Jan 2025 10:53:00 -0500 Subject: [PATCH 14/15] remove setImmediate and clearImmediate from injects (#7939) --- .changeset/poor-rabbits-compete.md | 5 ++ packages/unenv-preset/src/preset.ts | 8 --- .../src/runtime/node/timers/index.ts | 52 ------------------- 3 files changed, 5 insertions(+), 60 deletions(-) create mode 100644 .changeset/poor-rabbits-compete.md delete mode 100644 packages/unenv-preset/src/runtime/node/timers/index.ts diff --git a/.changeset/poor-rabbits-compete.md b/.changeset/poor-rabbits-compete.md new file mode 100644 index 000000000000..457f9d337d59 --- /dev/null +++ b/.changeset/poor-rabbits-compete.md @@ -0,0 +1,5 @@ +--- +"@cloudflare/unenv-preset": patch +--- + +Remove clearImmediate and setImmediate injects diff --git a/packages/unenv-preset/src/preset.ts b/packages/unenv-preset/src/preset.ts index ca798d4b522c..6eb10a250109 100644 --- a/packages/unenv-preset/src/preset.ts +++ b/packages/unenv-preset/src/preset.ts @@ -86,14 +86,6 @@ export const cloudflare: Preset = { global: false, console: "@cloudflare/unenv-preset/runtime/node/console/index", process: "@cloudflare/unenv-preset/runtime/node/process/index", - setImmediate: [ - "@cloudflare/unenv-preset/runtime/node/timers/index", - "setImmediate", - ], - clearImmediate: [ - "@cloudflare/unenv-preset/runtime/node/timers/index", - "clearImmediate", - ], }, polyfill: [], external: nodeCompatModules.flatMap((p) => [p, `node:${p}`]), diff --git a/packages/unenv-preset/src/runtime/node/timers/index.ts b/packages/unenv-preset/src/runtime/node/timers/index.ts deleted file mode 100644 index ba682c69abb2..000000000000 --- a/packages/unenv-preset/src/runtime/node/timers/index.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { - _unrefActive, - active, - clearInterval, - clearTimeout, - enroll, - promises, - setInterval, - setTimeout, - unenroll, -} from "unenv/runtime/node/timers/index"; -import { - clearImmediateFallback as clearImmediate, - setImmediateFallback as setImmediate, -} from "unenv/runtime/node/timers/internal/set-immediate"; -import type nodeTimers from "node:timers"; - -export { - _unrefActive, - active, - clearInterval, - clearTimeout, - enroll, - promises, - setInterval, - setTimeout, - unenroll, -} from "unenv/runtime/node/timers/index"; - -// Always use the polyfill rather than the worked implementation. -// -// NOTE: -// `setImmediate` and `clearImmediate` must be function (re)exports. -// `export const setImmediate = ...` might cause esbuild to generate invalid code. -export { - setImmediateFallback as setImmediate, - clearImmediateFallback as clearImmediate, -} from "unenv/runtime/node/timers/internal/set-immediate"; - -export default { - _unrefActive, - active, - clearImmediate, - clearInterval, - clearTimeout, - enroll, - promises, - setImmediate, - setInterval, - setTimeout, - unenroll, -}; From 12675cc598f0c10b6aca73c2f906aa6d37a73e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Somhairle=20MacLe=C3=B2id?= Date: Tue, 28 Jan 2025 18:15:07 +0000 Subject: [PATCH 15/15] Collapse CI jobs into one (#7937) --- .github/workflows/test-and-check.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-and-check.yml b/.github/workflows/test-and-check.yml index 92278510111f..a5c27538b801 100644 --- a/.github/workflows/test-and-check.yml +++ b/.github/workflows/test-and-check.yml @@ -102,15 +102,11 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-13] filter: - [ - "./packages/*", - "./fixtures/*", - "./packages/vite-plugin-cloudflare/playground", - ] + - '--filter="./packages/*" --filter="./fixtures/*" --filter="./packages/vite-plugin-cloudflare/playground"' # Things in the tools folder are for running in CI, and so only need to run on linux include: - os: ubuntu-latest - filter: "./tools" + filter: '--filter="./tools"' runs-on: ${{ matrix.os }} steps: - name: Checkout Repo @@ -136,7 +132,7 @@ jobs: - name: Run tests if: steps.changes.outputs.everything_but_markdown == 'true' - run: pnpm run test:ci --concurrency 1 --filter=${{ matrix.filter }} + run: pnpm run test:ci --concurrency 1 ${{ matrix.filter }} env: TMP_CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} TMP_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}