wrangler 4.42.0 → 4.42.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/wrangler-dist/cli.d.ts +3 -2
- package/wrangler-dist/cli.js +250 -92
- package/wrangler-dist/metafile-cjs.json +1 -1
package/wrangler-dist/cli.js
CHANGED
|
@@ -31660,7 +31660,7 @@ var require_supports_colors = __commonJS({
|
|
|
31660
31660
|
"../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module3) {
|
|
31661
31661
|
"use strict";
|
|
31662
31662
|
init_import_meta_url();
|
|
31663
|
-
var
|
|
31663
|
+
var os10 = require("os");
|
|
31664
31664
|
var hasFlag3 = require_has_flag();
|
|
31665
31665
|
var env6 = process.env;
|
|
31666
31666
|
var forceColor = void 0;
|
|
@@ -31699,7 +31699,7 @@ var require_supports_colors = __commonJS({
|
|
|
31699
31699
|
}
|
|
31700
31700
|
var min = forceColor ? 1 : 0;
|
|
31701
31701
|
if (process.platform === "win32") {
|
|
31702
|
-
var osRelease =
|
|
31702
|
+
var osRelease = os10.release().split(".");
|
|
31703
31703
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
31704
31704
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
31705
31705
|
}
|
|
@@ -33304,7 +33304,7 @@ var require_OSPaths = __commonJS({
|
|
|
33304
33304
|
}
|
|
33305
33305
|
__name(isEmpty, "isEmpty");
|
|
33306
33306
|
function Adapt(adapter_) {
|
|
33307
|
-
var env6 = adapter_.env,
|
|
33307
|
+
var env6 = adapter_.env, os10 = adapter_.os, path72 = adapter_.path;
|
|
33308
33308
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
|
33309
33309
|
function normalizePath2(path_) {
|
|
33310
33310
|
return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
|
|
@@ -33312,11 +33312,11 @@ var require_OSPaths = __commonJS({
|
|
|
33312
33312
|
__name(normalizePath2, "normalizePath");
|
|
33313
33313
|
function home() {
|
|
33314
33314
|
var posix2 = /* @__PURE__ */ __name(function() {
|
|
33315
|
-
return normalizePath2((typeof
|
|
33315
|
+
return normalizePath2((typeof os10.homedir === "function" ? os10.homedir() : void 0) || env6.get("HOME"));
|
|
33316
33316
|
}, "posix");
|
|
33317
33317
|
var windows = /* @__PURE__ */ __name(function() {
|
|
33318
33318
|
var priorityList = [
|
|
33319
|
-
typeof
|
|
33319
|
+
typeof os10.homedir === "function" ? os10.homedir() : void 0,
|
|
33320
33320
|
env6.get("USERPROFILE"),
|
|
33321
33321
|
env6.get("HOME"),
|
|
33322
33322
|
env6.get("HOMEDRIVE") || env6.get("HOMEPATH") ? path72.join(env6.get("HOMEDRIVE") || "", env6.get("HOMEPATH") || "") : void 0
|
|
@@ -33336,7 +33336,7 @@ var require_OSPaths = __commonJS({
|
|
|
33336
33336
|
function posix2() {
|
|
33337
33337
|
var fallback = "/tmp";
|
|
33338
33338
|
var priorityList = [
|
|
33339
|
-
typeof
|
|
33339
|
+
typeof os10.tmpdir === "function" ? os10.tmpdir() : void 0,
|
|
33340
33340
|
env6.get("TMPDIR"),
|
|
33341
33341
|
env6.get("TEMP"),
|
|
33342
33342
|
env6.get("TMP")
|
|
@@ -33349,7 +33349,7 @@ var require_OSPaths = __commonJS({
|
|
|
33349
33349
|
function windows() {
|
|
33350
33350
|
var fallback = "C:\\Temp";
|
|
33351
33351
|
var priorityListLazy = [
|
|
33352
|
-
typeof
|
|
33352
|
+
typeof os10.tmpdir === "function" ? os10.tmpdir : function() {
|
|
33353
33353
|
return void 0;
|
|
33354
33354
|
},
|
|
33355
33355
|
function() {
|
|
@@ -33436,7 +33436,7 @@ var require_node = __commonJS({
|
|
|
33436
33436
|
};
|
|
33437
33437
|
exports2.__esModule = true;
|
|
33438
33438
|
exports2.adapter = void 0;
|
|
33439
|
-
var
|
|
33439
|
+
var os10 = __importStar(require("os"));
|
|
33440
33440
|
var path72 = __importStar(require("path"));
|
|
33441
33441
|
exports2.adapter = {
|
|
33442
33442
|
atImportPermissions: { env: true },
|
|
@@ -33445,7 +33445,7 @@ var require_node = __commonJS({
|
|
|
33445
33445
|
return process.env[s6];
|
|
33446
33446
|
}, "get")
|
|
33447
33447
|
},
|
|
33448
|
-
os:
|
|
33448
|
+
os: os10,
|
|
33449
33449
|
path: path72,
|
|
33450
33450
|
process
|
|
33451
33451
|
};
|
|
@@ -73380,11 +73380,11 @@ var init_os = __esm({
|
|
|
73380
73380
|
static {
|
|
73381
73381
|
__name(this, "OS");
|
|
73382
73382
|
}
|
|
73383
|
-
get(
|
|
73383
|
+
get(os10, query = {}, options) {
|
|
73384
73384
|
if (isRequestOptions(query)) {
|
|
73385
|
-
return this.get(
|
|
73385
|
+
return this.get(os10, {}, query);
|
|
73386
73386
|
}
|
|
73387
|
-
return this._client.get(`/radar/http/top/ases/os/${
|
|
73387
|
+
return this._client.get(`/radar/http/top/ases/os/${os10}`, { query, ...options })._thenUnwrap((obj) => obj.result);
|
|
73388
73388
|
}
|
|
73389
73389
|
};
|
|
73390
73390
|
}
|
|
@@ -73625,11 +73625,11 @@ var init_os2 = __esm({
|
|
|
73625
73625
|
static {
|
|
73626
73626
|
__name(this, "OS");
|
|
73627
73627
|
}
|
|
73628
|
-
get(
|
|
73628
|
+
get(os10, query = {}, options) {
|
|
73629
73629
|
if (isRequestOptions(query)) {
|
|
73630
|
-
return this.get(
|
|
73630
|
+
return this.get(os10, {}, query);
|
|
73631
73631
|
}
|
|
73632
|
-
return this._client.get(`/radar/http/top/locations/os/${
|
|
73632
|
+
return this._client.get(`/radar/http/top/locations/os/${os10}`, { query, ...options })._thenUnwrap((obj) => obj.result);
|
|
73633
73633
|
}
|
|
73634
73634
|
};
|
|
73635
73635
|
}
|
|
@@ -93898,7 +93898,7 @@ var name, version;
|
|
|
93898
93898
|
var init_package = __esm({
|
|
93899
93899
|
"package.json"() {
|
|
93900
93900
|
name = "wrangler";
|
|
93901
|
-
version = "4.42.
|
|
93901
|
+
version = "4.42.2";
|
|
93902
93902
|
}
|
|
93903
93903
|
});
|
|
93904
93904
|
|
|
@@ -103871,6 +103871,44 @@ async function upsertR2DataCatalogCredential(complianceConfig, accountId, bucket
|
|
|
103871
103871
|
}
|
|
103872
103872
|
);
|
|
103873
103873
|
}
|
|
103874
|
+
async function enableR2CatalogTableCompaction(complianceConfig, accountId, bucketName, namespace, tableName, targetSizeMb) {
|
|
103875
|
+
const body = {
|
|
103876
|
+
compaction: {
|
|
103877
|
+
state: "enabled"
|
|
103878
|
+
}
|
|
103879
|
+
};
|
|
103880
|
+
if (targetSizeMb !== void 0) {
|
|
103881
|
+
body.compaction.target_size_mb = targetSizeMb;
|
|
103882
|
+
}
|
|
103883
|
+
return await fetchResult(
|
|
103884
|
+
complianceConfig,
|
|
103885
|
+
`/accounts/${accountId}/r2-catalog/${bucketName}/namespaces/${namespace}/tables/${tableName}/maintenance-configs`,
|
|
103886
|
+
{
|
|
103887
|
+
method: "POST",
|
|
103888
|
+
body: JSON.stringify(body),
|
|
103889
|
+
headers: {
|
|
103890
|
+
"Content-Type": "application/json"
|
|
103891
|
+
}
|
|
103892
|
+
}
|
|
103893
|
+
);
|
|
103894
|
+
}
|
|
103895
|
+
async function disableR2CatalogTableCompaction(complianceConfig, accountId, bucketName, namespace, tableName) {
|
|
103896
|
+
return await fetchResult(
|
|
103897
|
+
complianceConfig,
|
|
103898
|
+
`/accounts/${accountId}/r2-catalog/${bucketName}/namespaces/${namespace}/tables/${tableName}/maintenance-configs`,
|
|
103899
|
+
{
|
|
103900
|
+
method: "POST",
|
|
103901
|
+
body: JSON.stringify({
|
|
103902
|
+
compaction: {
|
|
103903
|
+
state: "disabled"
|
|
103904
|
+
}
|
|
103905
|
+
}),
|
|
103906
|
+
headers: {
|
|
103907
|
+
"Content-Type": "application/json"
|
|
103908
|
+
}
|
|
103909
|
+
}
|
|
103910
|
+
);
|
|
103911
|
+
}
|
|
103874
103912
|
function eventNotificationHeaders(apiCredentials, jurisdiction) {
|
|
103875
103913
|
const headers = {
|
|
103876
103914
|
"Content-Type": "application/json"
|
|
@@ -104408,6 +104446,8 @@ var init_helpers = __esm({
|
|
|
104408
104446
|
__name(enableR2CatalogCompaction, "enableR2CatalogCompaction");
|
|
104409
104447
|
__name(disableR2CatalogCompaction, "disableR2CatalogCompaction");
|
|
104410
104448
|
__name(upsertR2DataCatalogCredential, "upsertR2DataCatalogCredential");
|
|
104449
|
+
__name(enableR2CatalogTableCompaction, "enableR2CatalogTableCompaction");
|
|
104450
|
+
__name(disableR2CatalogTableCompaction, "disableR2CatalogTableCompaction");
|
|
104411
104451
|
actionsForEventCategories = {
|
|
104412
104452
|
"object-create": ["PutObject", "CompleteMultipartUpload", "CopyObject"],
|
|
104413
104453
|
"object-delete": ["DeleteObject", "LifecycleDeletion"]
|
|
@@ -108977,14 +109017,14 @@ var require_is_wsl = __commonJS({
|
|
|
108977
109017
|
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports2, module3) {
|
|
108978
109018
|
"use strict";
|
|
108979
109019
|
init_import_meta_url();
|
|
108980
|
-
var
|
|
109020
|
+
var os10 = require("os");
|
|
108981
109021
|
var fs25 = require("fs");
|
|
108982
109022
|
var isDocker = require_is_docker();
|
|
108983
109023
|
var isWsl = /* @__PURE__ */ __name(() => {
|
|
108984
109024
|
if (process.platform !== "linux") {
|
|
108985
109025
|
return false;
|
|
108986
109026
|
}
|
|
108987
|
-
if (
|
|
109027
|
+
if (os10.release().toLowerCase().includes("microsoft")) {
|
|
108988
109028
|
if (isDocker()) {
|
|
108989
109029
|
return false;
|
|
108990
109030
|
}
|
|
@@ -110917,8 +110957,8 @@ var require_homedir = __commonJS({
|
|
|
110917
110957
|
"../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/homedir.js"(exports2, module3) {
|
|
110918
110958
|
"use strict";
|
|
110919
110959
|
init_import_meta_url();
|
|
110920
|
-
var
|
|
110921
|
-
module3.exports =
|
|
110960
|
+
var os10 = require("os");
|
|
110961
|
+
module3.exports = os10.homedir || /* @__PURE__ */ __name(function homedir3() {
|
|
110922
110962
|
var home = process.env.HOME;
|
|
110923
110963
|
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
|
110924
110964
|
if (process.platform === "win32") {
|
|
@@ -121204,13 +121244,25 @@ var init_BaseController = __esm({
|
|
|
121204
121244
|
"src/api/startDevWorker/BaseController.ts"() {
|
|
121205
121245
|
init_import_meta_url();
|
|
121206
121246
|
import_node_events = require("events");
|
|
121247
|
+
init_logger();
|
|
121207
121248
|
TypedEventEmitterImpl = import_node_events.EventEmitter;
|
|
121208
121249
|
Controller = class extends TypedEventEmitterImpl {
|
|
121209
121250
|
static {
|
|
121210
121251
|
__name(this, "Controller");
|
|
121211
121252
|
}
|
|
121212
|
-
|
|
121213
|
-
|
|
121253
|
+
#tearingDown = false;
|
|
121254
|
+
async teardown() {
|
|
121255
|
+
this.#tearingDown = true;
|
|
121256
|
+
}
|
|
121257
|
+
emitErrorEvent(event) {
|
|
121258
|
+
if (this.#tearingDown) {
|
|
121259
|
+
logger.debug("Suppressing error event during teardown");
|
|
121260
|
+
logger.debug(`Error in ${event.source}: ${event.reason}
|
|
121261
|
+
`, event.cause);
|
|
121262
|
+
logger.debug("=> Error contextual data:", event.data);
|
|
121263
|
+
return;
|
|
121264
|
+
}
|
|
121265
|
+
this.emit("error", event);
|
|
121214
121266
|
}
|
|
121215
121267
|
};
|
|
121216
121268
|
RuntimeController = class extends Controller {
|
|
@@ -138435,7 +138487,7 @@ function getWranglerVersion() {
|
|
|
138435
138487
|
return version;
|
|
138436
138488
|
}
|
|
138437
138489
|
function getPlatform() {
|
|
138438
|
-
const platform3 =
|
|
138490
|
+
const platform3 = process.platform;
|
|
138439
138491
|
switch (platform3) {
|
|
138440
138492
|
case "win32":
|
|
138441
138493
|
return "Windows";
|
|
@@ -152302,7 +152354,7 @@ var require_main = __commonJS({
|
|
|
152302
152354
|
init_import_meta_url();
|
|
152303
152355
|
var fs25 = require("fs");
|
|
152304
152356
|
var path72 = require("path");
|
|
152305
|
-
var
|
|
152357
|
+
var os10 = require("os");
|
|
152306
152358
|
var crypto8 = require("crypto");
|
|
152307
152359
|
var packageJson = require_package();
|
|
152308
152360
|
var version5 = packageJson.version;
|
|
@@ -152408,7 +152460,7 @@ var require_main = __commonJS({
|
|
|
152408
152460
|
}
|
|
152409
152461
|
__name(_vaultPath, "_vaultPath");
|
|
152410
152462
|
function _resolveHome(envPath) {
|
|
152411
|
-
return envPath[0] === "~" ? path72.join(
|
|
152463
|
+
return envPath[0] === "~" ? path72.join(os10.homedir(), envPath.slice(1)) : envPath;
|
|
152412
152464
|
}
|
|
152413
152465
|
__name(_resolveHome, "_resolveHome");
|
|
152414
152466
|
function _configVault(options) {
|
|
@@ -172710,7 +172762,7 @@ var require_DocTypeReader = __commonJS({
|
|
|
172710
172762
|
i6 += 7;
|
|
172711
172763
|
[entityName, val, i6] = readEntityExp(xmlData, i6 + 1);
|
|
172712
172764
|
if (val.indexOf("&") === -1)
|
|
172713
|
-
entities[
|
|
172765
|
+
entities[validateEntityName2(entityName)] = {
|
|
172714
172766
|
regx: RegExp(`&${entityName};`, "g"),
|
|
172715
172767
|
val
|
|
172716
172768
|
};
|
|
@@ -172788,13 +172840,13 @@ var require_DocTypeReader = __commonJS({
|
|
|
172788
172840
|
return false;
|
|
172789
172841
|
}
|
|
172790
172842
|
__name(isNotation, "isNotation");
|
|
172791
|
-
function
|
|
172843
|
+
function validateEntityName2(name2) {
|
|
172792
172844
|
if (util3.isName(name2))
|
|
172793
172845
|
return name2;
|
|
172794
172846
|
else
|
|
172795
172847
|
throw new Error(`Invalid entity name ${name2}`);
|
|
172796
172848
|
}
|
|
172797
|
-
__name(
|
|
172849
|
+
__name(validateEntityName2, "validateEntityName");
|
|
172798
172850
|
module3.exports = readDocType;
|
|
172799
172851
|
}
|
|
172800
172852
|
});
|
|
@@ -200370,6 +200422,13 @@ var init_legacy_client = __esm({
|
|
|
200370
200422
|
});
|
|
200371
200423
|
|
|
200372
200424
|
// src/pipelines/validate.ts
|
|
200425
|
+
function validateEntityName(label, name2) {
|
|
200426
|
+
if (!name2.match(/^[a-zA-Z0-9_]+$/)) {
|
|
200427
|
+
throw new CommandLineArgsError(
|
|
200428
|
+
`${label} name must contain only letters, numbers, and underscores`
|
|
200429
|
+
);
|
|
200430
|
+
}
|
|
200431
|
+
}
|
|
200373
200432
|
function validateName2(label, name2) {
|
|
200374
200433
|
if (!name2.match(/^[a-zA-Z0-9-]+$/)) {
|
|
200375
200434
|
throw new UserError2(`Must provide a valid ${label}`);
|
|
@@ -200414,6 +200473,7 @@ var init_validate5 = __esm({
|
|
|
200414
200473
|
"src/pipelines/validate.ts"() {
|
|
200415
200474
|
init_import_meta_url();
|
|
200416
200475
|
init_errors();
|
|
200476
|
+
__name(validateEntityName, "validateEntityName");
|
|
200417
200477
|
__name(validateName2, "validateName");
|
|
200418
200478
|
__name(validateCorsOrigins, "validateCorsOrigins");
|
|
200419
200479
|
__name(validateInRange, "validateInRange");
|
|
@@ -200953,11 +201013,7 @@ async function setupPipelineNaming(providedName) {
|
|
|
200953
201013
|
if (!pipelineName) {
|
|
200954
201014
|
throw new UserError2("Pipeline name is required");
|
|
200955
201015
|
}
|
|
200956
|
-
|
|
200957
|
-
throw new UserError2(
|
|
200958
|
-
"Pipeline name must contain only letters, numbers, hyphens, and underscores"
|
|
200959
|
-
);
|
|
200960
|
-
}
|
|
201016
|
+
validateEntityName("pipeline", pipelineName);
|
|
200961
201017
|
const streamName = `${pipelineName}_stream`;
|
|
200962
201018
|
const sinkName = `${pipelineName}_sink`;
|
|
200963
201019
|
return {
|
|
@@ -201557,6 +201613,7 @@ var init_setup = __esm({
|
|
|
201557
201613
|
init_client7();
|
|
201558
201614
|
init_defaults();
|
|
201559
201615
|
init_pipelines2();
|
|
201616
|
+
init_validate5();
|
|
201560
201617
|
init_utils13();
|
|
201561
201618
|
pipelinesSetupCommand = createCommand({
|
|
201562
201619
|
metadata: {
|
|
@@ -201722,6 +201779,7 @@ var init_create6 = __esm({
|
|
|
201722
201779
|
init_client7();
|
|
201723
201780
|
init_defaults();
|
|
201724
201781
|
init_pipelines2();
|
|
201782
|
+
init_validate5();
|
|
201725
201783
|
init_utils14();
|
|
201726
201784
|
__name(parseSinkType, "parseSinkType");
|
|
201727
201785
|
pipelinesSinksCreateCommand = createCommand({
|
|
@@ -201805,6 +201863,7 @@ var init_create6 = __esm({
|
|
|
201805
201863
|
}
|
|
201806
201864
|
},
|
|
201807
201865
|
validateArgs: /* @__PURE__ */ __name((args) => {
|
|
201866
|
+
validateEntityName("sink", args.sink);
|
|
201808
201867
|
const sinkType = parseSinkType(args.type);
|
|
201809
201868
|
if (!isValidR2BucketName(args.bucket)) {
|
|
201810
201869
|
throw new CommandLineArgsError(
|
|
@@ -202141,6 +202200,7 @@ var init_create7 = __esm({
|
|
|
202141
202200
|
init_parse();
|
|
202142
202201
|
init_user3();
|
|
202143
202202
|
init_client7();
|
|
202203
|
+
init_validate5();
|
|
202144
202204
|
init_utils13();
|
|
202145
202205
|
pipelinesStreamsCreateCommand = createCommand({
|
|
202146
202206
|
metadata: {
|
|
@@ -202175,6 +202235,9 @@ var init_create7 = __esm({
|
|
|
202175
202235
|
array: true
|
|
202176
202236
|
}
|
|
202177
202237
|
},
|
|
202238
|
+
validateArgs: /* @__PURE__ */ __name((args) => {
|
|
202239
|
+
validateEntityName("stream", args.stream);
|
|
202240
|
+
}, "validateArgs"),
|
|
202178
202241
|
async handler(args, { config }) {
|
|
202179
202242
|
await requireAuth(config);
|
|
202180
202243
|
const streamName = args.stream;
|
|
@@ -204764,6 +204827,7 @@ var init_catalog = __esm({
|
|
|
204764
204827
|
init_create_command();
|
|
204765
204828
|
init_dialogs();
|
|
204766
204829
|
init_misc_variables();
|
|
204830
|
+
init_errors();
|
|
204767
204831
|
init_logger();
|
|
204768
204832
|
init_parse();
|
|
204769
204833
|
init_user3();
|
|
@@ -204906,17 +204970,27 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
|
|
|
204906
204970
|
});
|
|
204907
204971
|
r2BucketCatalogCompactionEnableCommand = createCommand({
|
|
204908
204972
|
metadata: {
|
|
204909
|
-
description: "Enable automatic file compaction for your R2 data catalog",
|
|
204973
|
+
description: "Enable automatic file compaction for your R2 data catalog or a specific table",
|
|
204910
204974
|
status: "open-beta",
|
|
204911
204975
|
owner: "Product: R2 Data Catalog"
|
|
204912
204976
|
},
|
|
204913
|
-
positionalArgs: ["bucket"],
|
|
204977
|
+
positionalArgs: ["bucket", "namespace", "table"],
|
|
204914
204978
|
args: {
|
|
204915
204979
|
bucket: {
|
|
204916
204980
|
describe: "The name of the bucket which contains the catalog",
|
|
204917
204981
|
type: "string",
|
|
204918
204982
|
demandOption: true
|
|
204919
204983
|
},
|
|
204984
|
+
namespace: {
|
|
204985
|
+
describe: "The namespace containing the table (optional, for table-level compaction)",
|
|
204986
|
+
type: "string",
|
|
204987
|
+
demandOption: false
|
|
204988
|
+
},
|
|
204989
|
+
table: {
|
|
204990
|
+
describe: "The name of the table (optional, for table-level compaction)",
|
|
204991
|
+
type: "string",
|
|
204992
|
+
demandOption: false
|
|
204993
|
+
},
|
|
204920
204994
|
"target-size": {
|
|
204921
204995
|
describe: "The target size for compacted files in MB (allowed values: 64, 128, 256, 512)",
|
|
204922
204996
|
type: "number",
|
|
@@ -204924,57 +204998,121 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
|
|
|
204924
204998
|
default: 128
|
|
204925
204999
|
},
|
|
204926
205000
|
token: {
|
|
204927
|
-
describe: "A cloudflare api token with access to R2 and R2 Data Catalog
|
|
204928
|
-
demandOption:
|
|
205001
|
+
describe: "A cloudflare api token with access to R2 and R2 Data Catalog (required for catalog-level compaction settings only)",
|
|
205002
|
+
demandOption: false,
|
|
204929
205003
|
type: "string"
|
|
204930
205004
|
}
|
|
204931
205005
|
},
|
|
204932
205006
|
async handler(args, { config }) {
|
|
204933
205007
|
const accountId = await requireAuth(config);
|
|
204934
|
-
|
|
204935
|
-
|
|
204936
|
-
|
|
204937
|
-
|
|
204938
|
-
|
|
204939
|
-
|
|
204940
|
-
|
|
204941
|
-
|
|
204942
|
-
|
|
204943
|
-
|
|
204944
|
-
|
|
204945
|
-
|
|
204946
|
-
|
|
204947
|
-
|
|
204948
|
-
|
|
205008
|
+
if (args.namespace && !args.table) {
|
|
205009
|
+
throw new UserError2("Table name is required when namespace is specified");
|
|
205010
|
+
}
|
|
205011
|
+
if (!args.namespace && args.table) {
|
|
205012
|
+
throw new UserError2("Namespace is required when table is specified");
|
|
205013
|
+
}
|
|
205014
|
+
if (args.namespace && args.table) {
|
|
205015
|
+
await enableR2CatalogTableCompaction(
|
|
205016
|
+
config,
|
|
205017
|
+
accountId,
|
|
205018
|
+
args.bucket,
|
|
205019
|
+
args.namespace,
|
|
205020
|
+
args.table,
|
|
205021
|
+
args.targetSize !== 128 ? args.targetSize : void 0
|
|
205022
|
+
);
|
|
205023
|
+
logger.log(
|
|
205024
|
+
`\u2728 Successfully enabled file compaction for table '${args.namespace}.${args.table}' in bucket '${args.bucket}'.`
|
|
205025
|
+
);
|
|
205026
|
+
} else {
|
|
205027
|
+
if (!args.token) {
|
|
205028
|
+
throw new UserError2(
|
|
205029
|
+
"Token is required for catalog-level compaction. Use --token flag to provide a Cloudflare API token."
|
|
205030
|
+
);
|
|
205031
|
+
}
|
|
205032
|
+
await upsertR2DataCatalogCredential(
|
|
205033
|
+
config,
|
|
205034
|
+
accountId,
|
|
205035
|
+
args.bucket,
|
|
205036
|
+
args.token
|
|
205037
|
+
);
|
|
205038
|
+
await enableR2CatalogCompaction(
|
|
205039
|
+
config,
|
|
205040
|
+
accountId,
|
|
205041
|
+
args.bucket,
|
|
205042
|
+
args.targetSize
|
|
205043
|
+
);
|
|
205044
|
+
logger.log(
|
|
205045
|
+
`\u2728 Successfully enabled file compaction for the data catalog for bucket '${args.bucket}'.
|
|
205046
|
+
|
|
205047
|
+
Compaction will automatically combine small files into larger ones to improve query performance.
|
|
205048
|
+
For more details, refer to: https://developers.cloudflare.com/r2/data-catalog/about-compaction/`
|
|
205049
|
+
);
|
|
205050
|
+
}
|
|
204949
205051
|
}
|
|
204950
205052
|
});
|
|
204951
205053
|
r2BucketCatalogCompactionDisableCommand = createCommand({
|
|
204952
205054
|
metadata: {
|
|
204953
|
-
description: "Disable automatic file compaction for your R2 data catalog",
|
|
205055
|
+
description: "Disable automatic file compaction for your R2 data catalog or a specific table",
|
|
204954
205056
|
status: "open-beta",
|
|
204955
205057
|
owner: "Product: R2 Data Catalog"
|
|
204956
205058
|
},
|
|
204957
|
-
positionalArgs: ["bucket"],
|
|
205059
|
+
positionalArgs: ["bucket", "namespace", "table"],
|
|
204958
205060
|
args: {
|
|
204959
205061
|
bucket: {
|
|
204960
205062
|
describe: "The name of the bucket which contains the catalog",
|
|
204961
205063
|
type: "string",
|
|
204962
205064
|
demandOption: true
|
|
205065
|
+
},
|
|
205066
|
+
namespace: {
|
|
205067
|
+
describe: "The namespace containing the table (optional, for table-level compaction)",
|
|
205068
|
+
type: "string",
|
|
205069
|
+
demandOption: false
|
|
205070
|
+
},
|
|
205071
|
+
table: {
|
|
205072
|
+
describe: "The name of the table (optional, for table-level compaction)",
|
|
205073
|
+
type: "string",
|
|
205074
|
+
demandOption: false
|
|
204963
205075
|
}
|
|
204964
205076
|
},
|
|
204965
205077
|
async handler(args, { config }) {
|
|
204966
205078
|
const accountId = await requireAuth(config);
|
|
204967
|
-
|
|
204968
|
-
|
|
204969
|
-
|
|
204970
|
-
if (!
|
|
204971
|
-
|
|
204972
|
-
|
|
205079
|
+
if (args.namespace && !args.table) {
|
|
205080
|
+
throw new UserError2("Table name is required when namespace is specified");
|
|
205081
|
+
}
|
|
205082
|
+
if (!args.namespace && args.table) {
|
|
205083
|
+
throw new UserError2("Namespace is required when table is specified");
|
|
205084
|
+
}
|
|
205085
|
+
if (args.namespace && args.table) {
|
|
205086
|
+
const confirmedDisable = await confirm(
|
|
205087
|
+
`Are you sure you want to disable file compaction for table '${args.namespace}.${args.table}' in bucket '${args.bucket}'?`
|
|
205088
|
+
);
|
|
205089
|
+
if (!confirmedDisable) {
|
|
205090
|
+
logger.log("Disable cancelled.");
|
|
205091
|
+
return;
|
|
205092
|
+
}
|
|
205093
|
+
await disableR2CatalogTableCompaction(
|
|
205094
|
+
config,
|
|
205095
|
+
accountId,
|
|
205096
|
+
args.bucket,
|
|
205097
|
+
args.namespace,
|
|
205098
|
+
args.table
|
|
205099
|
+
);
|
|
205100
|
+
logger.log(
|
|
205101
|
+
`Successfully disabled file compaction for table '${args.namespace}.${args.table}' in bucket '${args.bucket}'.`
|
|
205102
|
+
);
|
|
205103
|
+
} else {
|
|
205104
|
+
const confirmedDisable = await confirm(
|
|
205105
|
+
`Are you sure you want to disable file compaction for the data catalog for bucket '${args.bucket}'?`
|
|
205106
|
+
);
|
|
205107
|
+
if (!confirmedDisable) {
|
|
205108
|
+
logger.log("Disable cancelled.");
|
|
205109
|
+
return;
|
|
205110
|
+
}
|
|
205111
|
+
await disableR2CatalogCompaction(config, accountId, args.bucket);
|
|
205112
|
+
logger.log(
|
|
205113
|
+
`Successfully disabled file compaction for the data catalog for bucket '${args.bucket}'.`
|
|
205114
|
+
);
|
|
204973
205115
|
}
|
|
204974
|
-
await disableR2CatalogCompaction(config, accountId, args.bucket);
|
|
204975
|
-
logger.log(
|
|
204976
|
-
`Successfully disabled file compaction for the data catalog for bucket '${args.bucket}'.`
|
|
204977
|
-
);
|
|
204978
205116
|
}
|
|
204979
205117
|
});
|
|
204980
205118
|
}
|
|
@@ -223518,8 +223656,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
223518
223656
|
sourceMaps: uploadSourceMaps ? loadSourceMaps(main2, modules, bundle) : void 0,
|
|
223519
223657
|
compatibility_date: compatibilityDate,
|
|
223520
223658
|
compatibility_flags: compatibilityFlags,
|
|
223521
|
-
keepVars: false,
|
|
223522
|
-
// the wrangler.toml should be the source-of-truth for vars
|
|
223659
|
+
keepVars: props.keepVars ?? false,
|
|
223523
223660
|
keepSecrets: true,
|
|
223524
223661
|
// until wrangler.toml specifies secret bindings, we need to inherit from the previous Worker Version
|
|
223525
223662
|
placement,
|
|
@@ -224047,7 +224184,7 @@ var init_upload5 = __esm({
|
|
|
224047
224184
|
outDir: args.outdir,
|
|
224048
224185
|
dryRun: args.dryRun,
|
|
224049
224186
|
noBundle: !(args.bundle ?? !config.no_bundle),
|
|
224050
|
-
keepVars:
|
|
224187
|
+
keepVars: config.keep_vars,
|
|
224051
224188
|
projectRoot: entry.projectRoot,
|
|
224052
224189
|
tag: args.tag,
|
|
224053
224190
|
message: args.message,
|
|
@@ -229604,7 +229741,7 @@ async function main(argv) {
|
|
|
229604
229741
|
logger.log(e8.message);
|
|
229605
229742
|
} else if (e8 instanceof Error && e8.message.includes("Raw mode is not supported on")) {
|
|
229606
229743
|
mayReport = false;
|
|
229607
|
-
const currentPlatform =
|
|
229744
|
+
const currentPlatform = process.platform;
|
|
229608
229745
|
const thisTerminalIsUnsupported = "This terminal doesn't support raw mode.";
|
|
229609
229746
|
const soWranglerWontWork = "Wrangler uses raw mode to read user input and write output to the terminal, and won't function correctly without it.";
|
|
229610
229747
|
const tryRunningItIn = "Try running your previous command in a terminal that supports raw mode";
|
|
@@ -229691,12 +229828,11 @@ ${tryRunningItIn}${oneOfThese}`
|
|
|
229691
229828
|
}
|
|
229692
229829
|
}
|
|
229693
229830
|
}
|
|
229694
|
-
var import_node_assert22,
|
|
229831
|
+
var import_node_assert22, import_node_path54, import_promises31, import_undici21;
|
|
229695
229832
|
var init_src2 = __esm({
|
|
229696
229833
|
"src/index.ts"() {
|
|
229697
229834
|
init_import_meta_url();
|
|
229698
229835
|
import_node_assert22 = __toESM(require("assert"));
|
|
229699
|
-
import_node_os7 = __toESM(require("os"));
|
|
229700
229836
|
import_node_path54 = require("path");
|
|
229701
229837
|
import_promises31 = require("timers/promises");
|
|
229702
229838
|
init_cli();
|
|
@@ -229945,7 +230081,13 @@ async function checkStartupHandler({
|
|
|
229945
230081
|
});
|
|
229946
230082
|
await (0, import_promises33.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
|
|
229947
230083
|
log(
|
|
229948
|
-
|
|
230084
|
+
[
|
|
230085
|
+
`CPU Profile has been written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`,
|
|
230086
|
+
"",
|
|
230087
|
+
"Note that the CPU Profile was measured on your Worker running locally on your machine, which has a different CPU than when your Worker runs on Cloudflare.",
|
|
230088
|
+
"",
|
|
230089
|
+
"As such, CPU Profile can be used to understand where time is spent at startup, but the overall startup time in the profile should not be expected to exactly match what your Worker's startup time will be when deploying to Cloudflare."
|
|
230090
|
+
].join("\n")
|
|
229949
230091
|
);
|
|
229950
230092
|
}
|
|
229951
230093
|
async function getEntryValue(entry) {
|
|
@@ -232852,6 +232994,7 @@ var init_BundlerController = __esm({
|
|
|
232852
232994
|
}
|
|
232853
232995
|
async teardown() {
|
|
232854
232996
|
logger.debug("BundlerController teardown beginning...");
|
|
232997
|
+
await super.teardown();
|
|
232855
232998
|
this.#customBuildAborter?.abort();
|
|
232856
232999
|
this.#tmpDir?.remove();
|
|
232857
233000
|
await Promise.all([
|
|
@@ -232988,12 +233131,12 @@ async function getPorts(options) {
|
|
|
232988
233131
|
}
|
|
232989
233132
|
throw new Error("No available ports found");
|
|
232990
233133
|
}
|
|
232991
|
-
var import_node_net,
|
|
233134
|
+
var import_node_net, import_node_os7, Locked, lockedPorts, releaseOldLockedPortsIntervalMs, timeout, getLocalHosts, checkAvailablePort, getAvailablePort, portCheckSequence;
|
|
232992
233135
|
var init_get_port = __esm({
|
|
232993
233136
|
"../../node_modules/.pnpm/get-port@7.0.0/node_modules/get-port/index.js"() {
|
|
232994
233137
|
init_import_meta_url();
|
|
232995
233138
|
import_node_net = __toESM(require("net"), 1);
|
|
232996
|
-
|
|
233139
|
+
import_node_os7 = __toESM(require("os"), 1);
|
|
232997
233140
|
Locked = class extends Error {
|
|
232998
233141
|
static {
|
|
232999
233142
|
__name(this, "Locked");
|
|
@@ -233008,7 +233151,7 @@ var init_get_port = __esm({
|
|
|
233008
233151
|
};
|
|
233009
233152
|
releaseOldLockedPortsIntervalMs = 1e3 * 15;
|
|
233010
233153
|
getLocalHosts = /* @__PURE__ */ __name(() => {
|
|
233011
|
-
const interfaces =
|
|
233154
|
+
const interfaces = import_node_os7.default.networkInterfaces();
|
|
233012
233155
|
const results = /* @__PURE__ */ new Set([void 0, "0.0.0.0"]);
|
|
233013
233156
|
for (const _interface of Object.values(interfaces)) {
|
|
233014
233157
|
for (const config of _interface) {
|
|
@@ -233416,7 +233559,6 @@ var init_ConfigController = __esm({
|
|
|
233416
233559
|
#printCurrentBindings;
|
|
233417
233560
|
#configWatcher;
|
|
233418
233561
|
#abortController;
|
|
233419
|
-
#tearingDown = false;
|
|
233420
233562
|
async #ensureWatchingConfig(configPath) {
|
|
233421
233563
|
await this.#configWatcher?.close();
|
|
233422
233564
|
if (configPath) {
|
|
@@ -233432,17 +233574,28 @@ var init_ConfigController = __esm({
|
|
|
233432
233574
|
this.latestInput,
|
|
233433
233575
|
"Cannot be watching config without having first set an input"
|
|
233434
233576
|
);
|
|
233435
|
-
|
|
233577
|
+
logger.debug("config file changed", configPath);
|
|
233578
|
+
this.#updateConfig(this.latestInput).catch((err) => {
|
|
233579
|
+
this.emitErrorEvent({
|
|
233580
|
+
type: "error",
|
|
233581
|
+
reason: "Error resolving config after change",
|
|
233582
|
+
cause: castErrorCause(err),
|
|
233583
|
+
source: "ConfigController",
|
|
233584
|
+
data: void 0
|
|
233585
|
+
});
|
|
233586
|
+
});
|
|
233436
233587
|
});
|
|
233437
233588
|
}
|
|
233438
233589
|
}
|
|
233439
233590
|
set(input, throwErrors = false) {
|
|
233591
|
+
logger.debug("setting config");
|
|
233440
233592
|
return runWithLogLevel(
|
|
233441
233593
|
input.dev?.logLevel,
|
|
233442
233594
|
() => this.#updateConfig(input, throwErrors)
|
|
233443
233595
|
);
|
|
233444
233596
|
}
|
|
233445
233597
|
patch(input) {
|
|
233598
|
+
logger.debug("patching config");
|
|
233446
233599
|
(0, import_node_assert27.default)(
|
|
233447
233600
|
this.latestInput,
|
|
233448
233601
|
"Cannot call updateConfig without previously calling setConfig"
|
|
@@ -233457,9 +233610,11 @@ var init_ConfigController = __esm({
|
|
|
233457
233610
|
);
|
|
233458
233611
|
}
|
|
233459
233612
|
async #updateConfig(input, throwErrors = false) {
|
|
233460
|
-
|
|
233461
|
-
|
|
233462
|
-
|
|
233613
|
+
logger.debug(
|
|
233614
|
+
"Updating config...",
|
|
233615
|
+
this.#abortController?.signal,
|
|
233616
|
+
this.#configWatcher?.closed
|
|
233617
|
+
);
|
|
233463
233618
|
this.#abortController?.abort();
|
|
233464
233619
|
this.#abortController = new AbortController();
|
|
233465
233620
|
const signal = this.#abortController.signal;
|
|
@@ -233481,11 +233636,8 @@ var init_ConfigController = __esm({
|
|
|
233481
233636
|
if (!getDisableConfigWatching()) {
|
|
233482
233637
|
await this.#ensureWatchingConfig(fileConfig.configPath);
|
|
233483
233638
|
}
|
|
233484
|
-
if (this.#tearingDown || signal.aborted) {
|
|
233485
|
-
return;
|
|
233486
|
-
}
|
|
233487
233639
|
const { config: resolvedConfig, printCurrentBindings } = await resolveConfig(fileConfig, input);
|
|
233488
|
-
if (
|
|
233640
|
+
if (signal.aborted) {
|
|
233489
233641
|
return;
|
|
233490
233642
|
}
|
|
233491
233643
|
this.latestConfig = resolvedConfig;
|
|
@@ -233493,9 +233645,14 @@ var init_ConfigController = __esm({
|
|
|
233493
233645
|
this.emitConfigUpdateEvent(resolvedConfig);
|
|
233494
233646
|
return this.latestConfig;
|
|
233495
233647
|
} catch (err) {
|
|
233648
|
+
logger.debug("Error updating config", err.stack);
|
|
233496
233649
|
if (throwErrors) {
|
|
233497
233650
|
throw err;
|
|
233498
233651
|
} else {
|
|
233652
|
+
if (this.#configWatcher?.closed) {
|
|
233653
|
+
logger.debug("Suppressing config error after watcher closed");
|
|
233654
|
+
return;
|
|
233655
|
+
}
|
|
233499
233656
|
this.emitErrorEvent({
|
|
233500
233657
|
type: "error",
|
|
233501
233658
|
reason: "Error resolving config",
|
|
@@ -233514,7 +233671,7 @@ var init_ConfigController = __esm({
|
|
|
233514
233671
|
}
|
|
233515
233672
|
async teardown() {
|
|
233516
233673
|
logger.debug("ConfigController teardown beginning...");
|
|
233517
|
-
|
|
233674
|
+
await super.teardown();
|
|
233518
233675
|
this.#abortController?.abort();
|
|
233519
233676
|
await this.#configWatcher?.close();
|
|
233520
233677
|
logger.debug("ConfigController teardown complete");
|
|
@@ -233778,12 +233935,11 @@ function maybeHandleNetworkLoadResource(url4, bundle, tmpDir) {
|
|
|
233778
233935
|
return (0, import_fs29.readFileSync)(filePath, "utf-8");
|
|
233779
233936
|
}
|
|
233780
233937
|
}
|
|
233781
|
-
var import_fs29,
|
|
233938
|
+
var import_fs29, import_node_url12, import_path28, import_open2, mapConsoleAPIMessageTypeToConsoleMethod, openInspector;
|
|
233782
233939
|
var init_inspect2 = __esm({
|
|
233783
233940
|
"src/dev/inspect.ts"() {
|
|
233784
233941
|
init_import_meta_url();
|
|
233785
233942
|
import_fs29 = require("fs");
|
|
233786
|
-
import_node_os9 = __toESM(require("os"));
|
|
233787
233943
|
import_node_url12 = require("url");
|
|
233788
233944
|
import_path28 = __toESM(require("path"));
|
|
233789
233945
|
import_open2 = __toESM(require_open());
|
|
@@ -233823,7 +233979,7 @@ var init_inspect2 = __esm({
|
|
|
233823
233979
|
const url4 = `https://devtools.devprod.cloudflare.dev/js_app?${query.toString()}`;
|
|
233824
233980
|
const errorMessage = "Failed to open inspector.\nInspector depends on having a Chromium-based browser installed, maybe you need to install one?";
|
|
233825
233981
|
let braveBrowser;
|
|
233826
|
-
switch (
|
|
233982
|
+
switch (process.platform) {
|
|
233827
233983
|
case "darwin":
|
|
233828
233984
|
case "win32":
|
|
233829
233985
|
braveBrowser = "Brave";
|
|
@@ -252589,6 +252745,7 @@ var init_ProxyController = __esm({
|
|
|
252589
252745
|
}
|
|
252590
252746
|
_torndown = false;
|
|
252591
252747
|
async teardown() {
|
|
252748
|
+
await super.teardown();
|
|
252592
252749
|
logger.debug("ProxyController teardown beginning...");
|
|
252593
252750
|
this._torndown = true;
|
|
252594
252751
|
const { proxyWorker } = this;
|
|
@@ -253292,6 +253449,7 @@ var init_RemoteRuntimeController = __esm({
|
|
|
253292
253449
|
notImplemented(this.onPreviewTokenExpired.name, this.constructor.name);
|
|
253293
253450
|
}
|
|
253294
253451
|
async teardown() {
|
|
253452
|
+
await super.teardown();
|
|
253295
253453
|
if (this.#session) {
|
|
253296
253454
|
logger.log(source_default.dim("\u2394 Shutting down remote preview..."));
|
|
253297
253455
|
}
|
|
@@ -253892,9 +254050,8 @@ var init_LocalRuntimeController = __esm({
|
|
|
253892
254050
|
// current container that is being built
|
|
253893
254051
|
containerBeingBuilt;
|
|
253894
254052
|
onBundleStart(_5) {
|
|
253895
|
-
process.
|
|
253896
|
-
|
|
253897
|
-
});
|
|
254053
|
+
process.off("exit", this.cleanupContainers);
|
|
254054
|
+
process.on("exit", this.cleanupContainers);
|
|
253898
254055
|
}
|
|
253899
254056
|
async #onBundleComplete(data, id) {
|
|
253900
254057
|
try {
|
|
@@ -254059,6 +254216,7 @@ var init_LocalRuntimeController = __esm({
|
|
|
254059
254216
|
}, "cleanupContainers");
|
|
254060
254217
|
#teardown = /* @__PURE__ */ __name(async () => {
|
|
254061
254218
|
logger.debug("LocalRuntimeController teardown beginning...");
|
|
254219
|
+
process.off("exit", this.cleanupContainers);
|
|
254062
254220
|
if (this.#mf) {
|
|
254063
254221
|
logger.log(source_default.dim("\u2394 Shutting down local server..."));
|
|
254064
254222
|
}
|
|
@@ -254072,6 +254230,7 @@ var init_LocalRuntimeController = __esm({
|
|
|
254072
254230
|
logger.debug("LocalRuntimeController teardown complete");
|
|
254073
254231
|
}, "#teardown");
|
|
254074
254232
|
async teardown() {
|
|
254233
|
+
await super.teardown();
|
|
254075
254234
|
return this.#mutex.runWith(this.#teardown);
|
|
254076
254235
|
}
|
|
254077
254236
|
// *********************
|
|
@@ -254340,6 +254499,7 @@ var init_MultiworkerRuntimeController = __esm({
|
|
|
254340
254499
|
logger.debug("MultiworkerRuntimeController teardown complete");
|
|
254341
254500
|
}, "#teardown");
|
|
254342
254501
|
async teardown() {
|
|
254502
|
+
await super.teardown();
|
|
254343
254503
|
return this.#mutex.runWith(this.#teardown);
|
|
254344
254504
|
}
|
|
254345
254505
|
};
|
|
@@ -254364,8 +254524,6 @@ var init_NoOpProxyController = __esm({
|
|
|
254364
254524
|
}
|
|
254365
254525
|
onReloadComplete(_data5) {
|
|
254366
254526
|
}
|
|
254367
|
-
async teardown() {
|
|
254368
|
-
}
|
|
254369
254527
|
};
|
|
254370
254528
|
}
|
|
254371
254529
|
});
|