wrangler 4.20.4 → 4.20.5

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.
@@ -20010,254 +20010,6 @@ var init_OpenAPI = __esm({
20010
20010
  }
20011
20011
  });
20012
20012
 
20013
- // ../containers-shared/src/client/core/request.ts
20014
- var import_undici, isDefined, isString, isStringWithValue, isBlob, base64, getQueryString, getUrl, getFormData, resolve5, getHeaders, getRequestBody, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, request;
20015
- var init_request = __esm({
20016
- "../containers-shared/src/client/core/request.ts"() {
20017
- init_import_meta_url();
20018
- import_undici = __toESM(require_undici());
20019
- init_ApiError();
20020
- init_CancelablePromise();
20021
- isDefined = /* @__PURE__ */ __name((value) => {
20022
- return value !== void 0 && value !== null;
20023
- }, "isDefined");
20024
- isString = /* @__PURE__ */ __name((value) => {
20025
- return typeof value === "string";
20026
- }, "isString");
20027
- isStringWithValue = /* @__PURE__ */ __name((value) => {
20028
- return isString(value) && value !== "";
20029
- }, "isStringWithValue");
20030
- isBlob = /* @__PURE__ */ __name((value) => {
20031
- return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
20032
- }, "isBlob");
20033
- base64 = /* @__PURE__ */ __name((str) => {
20034
- try {
20035
- return btoa(str);
20036
- } catch (err) {
20037
- return Buffer.from(str).toString("base64");
20038
- }
20039
- }, "base64");
20040
- getQueryString = /* @__PURE__ */ __name((params) => {
20041
- const qs = [];
20042
- const append = /* @__PURE__ */ __name((key, value) => {
20043
- qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
20044
- }, "append");
20045
- const process11 = /* @__PURE__ */ __name((key, value) => {
20046
- if (isDefined(value)) {
20047
- if (Array.isArray(value)) {
20048
- value.forEach((v7) => {
20049
- process11(key, v7);
20050
- });
20051
- } else if (typeof value === "object") {
20052
- Object.entries(value).forEach(([k6, v7]) => {
20053
- process11(`${key}[${k6}]`, v7);
20054
- });
20055
- } else {
20056
- append(key, value);
20057
- }
20058
- }
20059
- }, "process");
20060
- Object.entries(params).forEach(([key, value]) => {
20061
- process11(key, value);
20062
- });
20063
- if (qs.length > 0) {
20064
- return `?${qs.join("&")}`;
20065
- }
20066
- return "";
20067
- }, "getQueryString");
20068
- getUrl = /* @__PURE__ */ __name((config, options) => {
20069
- const encoder = config.ENCODE_PATH || encodeURI;
20070
- const path71 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring2, group) => {
20071
- if (options.path?.hasOwnProperty(group)) {
20072
- return encoder(String(options.path[group]));
20073
- }
20074
- return substring2;
20075
- });
20076
- const url4 = `${config.BASE}${path71}`;
20077
- if (options.query) {
20078
- return `${url4}${getQueryString(options.query)}`;
20079
- }
20080
- return url4;
20081
- }, "getUrl");
20082
- getFormData = /* @__PURE__ */ __name((options) => {
20083
- if (options.formData) {
20084
- const formData = new import_undici.FormData();
20085
- const process11 = /* @__PURE__ */ __name((key, value) => {
20086
- if (isString(value) || isBlob(value)) {
20087
- formData.append(key, value);
20088
- } else {
20089
- formData.append(key, JSON.stringify(value));
20090
- }
20091
- }, "process");
20092
- Object.entries(options.formData).filter(([_4, value]) => isDefined(value)).forEach(([key, value]) => {
20093
- if (Array.isArray(value)) {
20094
- value.forEach((v7) => process11(key, v7));
20095
- } else {
20096
- process11(key, value);
20097
- }
20098
- });
20099
- return formData;
20100
- }
20101
- return void 0;
20102
- }, "getFormData");
20103
- resolve5 = /* @__PURE__ */ __name(async (options, resolver) => {
20104
- if (typeof resolver === "function") {
20105
- return resolver(options);
20106
- }
20107
- return resolver;
20108
- }, "resolve");
20109
- getHeaders = /* @__PURE__ */ __name(async (config, options) => {
20110
- const token = await resolve5(options, config.TOKEN);
20111
- const username = await resolve5(options, config.USERNAME);
20112
- const password = await resolve5(options, config.PASSWORD);
20113
- const additionalHeaders = await resolve5(options, config.HEADERS);
20114
- const headers = Object.entries({
20115
- Accept: "application/json",
20116
- ...additionalHeaders,
20117
- ...options.headers
20118
- }).filter(([_4, value]) => isDefined(value)).reduce(
20119
- (headers2, [key, value]) => ({
20120
- ...headers2,
20121
- [key]: String(value)
20122
- }),
20123
- {}
20124
- );
20125
- if (isStringWithValue(token)) {
20126
- headers["Authorization"] = `Bearer ${token}`;
20127
- }
20128
- if (isStringWithValue(username) && isStringWithValue(password)) {
20129
- const credentials = base64(`${username}:${password}`);
20130
- headers["Authorization"] = `Basic ${credentials}`;
20131
- }
20132
- if (options.body) {
20133
- if (options.mediaType) {
20134
- headers["Content-Type"] = options.mediaType;
20135
- } else if (isBlob(options.body)) {
20136
- headers["Content-Type"] = options.body.type || "application/octet-stream";
20137
- } else if (isString(options.body)) {
20138
- headers["Content-Type"] = "text/plain";
20139
- } else {
20140
- headers["Content-Type"] = "application/json";
20141
- }
20142
- }
20143
- return new import_undici.Headers(headers);
20144
- }, "getHeaders");
20145
- getRequestBody = /* @__PURE__ */ __name((options) => {
20146
- if (options.body !== void 0) {
20147
- if (options.mediaType?.includes("/json")) {
20148
- return JSON.stringify(options.body);
20149
- } else if (isString(options.body) || isBlob(options.body)) {
20150
- return options.body;
20151
- } else {
20152
- return JSON.stringify(options.body);
20153
- }
20154
- }
20155
- return void 0;
20156
- }, "getRequestBody");
20157
- sendRequest = /* @__PURE__ */ __name(async (config, options, url4, body, formData, headers, onCancel) => {
20158
- const controller = new AbortController();
20159
- const request4 = {
20160
- headers,
20161
- body: body ?? formData,
20162
- method: options.method,
20163
- signal: controller.signal,
20164
- dispatcher: config.AGENT ?? void 0
20165
- };
20166
- if (config.WITH_CREDENTIALS) {
20167
- request4.credentials = config.CREDENTIALS;
20168
- }
20169
- onCancel(() => controller.abort());
20170
- return await (0, import_undici.fetch)(url4, request4);
20171
- }, "sendRequest");
20172
- getResponseHeader = /* @__PURE__ */ __name((response, responseHeader) => {
20173
- if (responseHeader) {
20174
- const content = response.headers.get(responseHeader);
20175
- if (isString(content)) {
20176
- return content;
20177
- }
20178
- }
20179
- return void 0;
20180
- }, "getResponseHeader");
20181
- getResponseBody = /* @__PURE__ */ __name(async (response) => {
20182
- if (response.status !== 204) {
20183
- try {
20184
- const contentType = response.headers.get("Content-Type");
20185
- if (contentType) {
20186
- const jsonTypes = ["application/json", "application/problem+json"];
20187
- const isJSON = jsonTypes.some(
20188
- (type) => contentType.toLowerCase().startsWith(type)
20189
- );
20190
- if (isJSON) {
20191
- return await response.json();
20192
- } else {
20193
- return await response.text();
20194
- }
20195
- }
20196
- } catch (error2) {
20197
- console.error(error2);
20198
- }
20199
- }
20200
- return void 0;
20201
- }, "getResponseBody");
20202
- catchErrorCodes = /* @__PURE__ */ __name((options, result) => {
20203
- const errors = {
20204
- 400: "Bad Request",
20205
- 401: "Unauthorized",
20206
- 403: "Forbidden",
20207
- 404: "Not Found",
20208
- 500: "Internal Server Error",
20209
- 502: "Bad Gateway",
20210
- 503: "Service Unavailable",
20211
- ...options.errors
20212
- };
20213
- const error2 = errors[result.status];
20214
- if (error2) {
20215
- throw new ApiError(options, result, error2);
20216
- }
20217
- if (!result.ok) {
20218
- throw new ApiError(options, result, "Generic Error");
20219
- }
20220
- }, "catchErrorCodes");
20221
- request = /* @__PURE__ */ __name((config, options) => {
20222
- return new CancelablePromise(async (resolve24, reject, onCancel) => {
20223
- try {
20224
- const url4 = getUrl(config, options);
20225
- const formData = getFormData(options);
20226
- const body = getRequestBody(options);
20227
- const headers = await getHeaders(config, options);
20228
- if (!onCancel.isCancelled) {
20229
- const response = await sendRequest(
20230
- config,
20231
- options,
20232
- url4,
20233
- body,
20234
- formData,
20235
- headers,
20236
- onCancel
20237
- );
20238
- const responseBody = await getResponseBody(response);
20239
- const responseHeader = getResponseHeader(
20240
- response,
20241
- options.responseHeader
20242
- );
20243
- const result = {
20244
- url: url4,
20245
- ok: response.ok,
20246
- status: response.status,
20247
- statusText: response.statusText,
20248
- body: responseHeader ?? responseBody
20249
- };
20250
- catchErrorCodes(options, result);
20251
- resolve24(result.body);
20252
- }
20253
- } catch (error2) {
20254
- reject(error2);
20255
- }
20256
- });
20257
- }, "request");
20258
- }
20259
- });
20260
-
20261
20013
  // ../containers-shared/src/client/models/ApplicationAffinityColocation.ts
20262
20014
  var init_ApplicationAffinityColocation = __esm({
20263
20015
  "../containers-shared/src/client/models/ApplicationAffinityColocation.ts"() {
@@ -20569,6 +20321,13 @@ var init_ImageRegistryProtocolNotFound = __esm({
20569
20321
  }
20570
20322
  });
20571
20323
 
20324
+ // ../containers-shared/src/client/models/InstanceType.ts
20325
+ var init_InstanceType = __esm({
20326
+ "../containers-shared/src/client/models/InstanceType.ts"() {
20327
+ init_import_meta_url();
20328
+ }
20329
+ });
20330
+
20572
20331
  // ../containers-shared/src/client/models/IPType.ts
20573
20332
  var init_IPType = __esm({
20574
20333
  "../containers-shared/src/client/models/IPType.ts"() {
@@ -20703,11 +20462,273 @@ var init_UpdateApplicationRolloutRequest = __esm({
20703
20462
  ((action2) => {
20704
20463
  action2["NEXT"] = "next";
20705
20464
  action2["PREVIOUS"] = "previous";
20465
+ action2["REVERT"] = "revert";
20706
20466
  })(action = UpdateApplicationRolloutRequest2.action || (UpdateApplicationRolloutRequest2.action = {}));
20707
20467
  })(UpdateApplicationRolloutRequest || (UpdateApplicationRolloutRequest = {}));
20708
20468
  }
20709
20469
  });
20710
20470
 
20471
+ // ../containers-shared/src/client/core/request.ts
20472
+ var import_undici, isDefined, isString, isStringWithValue, isBlob, base64, getQueryString, getUrl, getFormData, resolve5, getHeaders, getRequestBody, isResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, request;
20473
+ var init_request = __esm({
20474
+ "../containers-shared/src/client/core/request.ts"() {
20475
+ init_import_meta_url();
20476
+ import_undici = __toESM(require_undici());
20477
+ init_ApiError();
20478
+ init_CancelablePromise();
20479
+ isDefined = /* @__PURE__ */ __name((value) => {
20480
+ return value !== void 0 && value !== null;
20481
+ }, "isDefined");
20482
+ isString = /* @__PURE__ */ __name((value) => {
20483
+ return typeof value === "string";
20484
+ }, "isString");
20485
+ isStringWithValue = /* @__PURE__ */ __name((value) => {
20486
+ return isString(value) && value !== "";
20487
+ }, "isStringWithValue");
20488
+ isBlob = /* @__PURE__ */ __name((value) => {
20489
+ return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
20490
+ }, "isBlob");
20491
+ base64 = /* @__PURE__ */ __name((str) => {
20492
+ try {
20493
+ return btoa(str);
20494
+ } catch (err) {
20495
+ return Buffer.from(str).toString("base64");
20496
+ }
20497
+ }, "base64");
20498
+ getQueryString = /* @__PURE__ */ __name((params) => {
20499
+ const qs = [];
20500
+ const append = /* @__PURE__ */ __name((key, value) => {
20501
+ qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
20502
+ }, "append");
20503
+ const process11 = /* @__PURE__ */ __name((key, value) => {
20504
+ if (isDefined(value)) {
20505
+ if (Array.isArray(value)) {
20506
+ value.forEach((v7) => {
20507
+ process11(key, v7);
20508
+ });
20509
+ } else if (typeof value === "object") {
20510
+ Object.entries(value).forEach(([k6, v7]) => {
20511
+ process11(`${key}[${k6}]`, v7);
20512
+ });
20513
+ } else {
20514
+ append(key, value);
20515
+ }
20516
+ }
20517
+ }, "process");
20518
+ Object.entries(params).forEach(([key, value]) => {
20519
+ process11(key, value);
20520
+ });
20521
+ if (qs.length > 0) {
20522
+ return `?${qs.join("&")}`;
20523
+ }
20524
+ return "";
20525
+ }, "getQueryString");
20526
+ getUrl = /* @__PURE__ */ __name((config, options) => {
20527
+ const encoder = config.ENCODE_PATH || encodeURI;
20528
+ const path71 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring2, group) => {
20529
+ if (options.path?.hasOwnProperty(group)) {
20530
+ return encoder(String(options.path[group]));
20531
+ }
20532
+ return substring2;
20533
+ });
20534
+ const url4 = `${config.BASE}${path71}`;
20535
+ if (options.query) {
20536
+ return `${url4}${getQueryString(options.query)}`;
20537
+ }
20538
+ return url4;
20539
+ }, "getUrl");
20540
+ getFormData = /* @__PURE__ */ __name((options) => {
20541
+ if (options.formData) {
20542
+ const formData = new import_undici.FormData();
20543
+ const process11 = /* @__PURE__ */ __name((key, value) => {
20544
+ if (isString(value) || isBlob(value)) {
20545
+ formData.append(key, value);
20546
+ } else {
20547
+ formData.append(key, JSON.stringify(value));
20548
+ }
20549
+ }, "process");
20550
+ Object.entries(options.formData).filter(([_4, value]) => isDefined(value)).forEach(([key, value]) => {
20551
+ if (Array.isArray(value)) {
20552
+ value.forEach((v7) => process11(key, v7));
20553
+ } else {
20554
+ process11(key, value);
20555
+ }
20556
+ });
20557
+ return formData;
20558
+ }
20559
+ return void 0;
20560
+ }, "getFormData");
20561
+ resolve5 = /* @__PURE__ */ __name(async (options, resolver) => {
20562
+ if (typeof resolver === "function") {
20563
+ return resolver(options);
20564
+ }
20565
+ return resolver;
20566
+ }, "resolve");
20567
+ getHeaders = /* @__PURE__ */ __name(async (config, options) => {
20568
+ const token = await resolve5(options, config.TOKEN);
20569
+ const username = await resolve5(options, config.USERNAME);
20570
+ const password = await resolve5(options, config.PASSWORD);
20571
+ const additionalHeaders = await resolve5(options, config.HEADERS);
20572
+ const headers = Object.entries({
20573
+ Accept: "application/json",
20574
+ ...additionalHeaders,
20575
+ ...options.headers
20576
+ }).filter(([_4, value]) => isDefined(value)).reduce(
20577
+ (headers2, [key, value]) => ({
20578
+ ...headers2,
20579
+ [key]: String(value)
20580
+ }),
20581
+ {}
20582
+ );
20583
+ if (isStringWithValue(token)) {
20584
+ headers["Authorization"] = `Bearer ${token}`;
20585
+ }
20586
+ if (isStringWithValue(username) && isStringWithValue(password)) {
20587
+ const credentials = base64(`${username}:${password}`);
20588
+ headers["Authorization"] = `Basic ${credentials}`;
20589
+ }
20590
+ if (options.body) {
20591
+ if (options.mediaType) {
20592
+ headers["Content-Type"] = options.mediaType;
20593
+ } else if (isBlob(options.body)) {
20594
+ headers["Content-Type"] = options.body.type || "application/octet-stream";
20595
+ } else if (isString(options.body)) {
20596
+ headers["Content-Type"] = "text/plain";
20597
+ } else {
20598
+ headers["Content-Type"] = "application/json";
20599
+ }
20600
+ }
20601
+ return new import_undici.Headers(headers);
20602
+ }, "getHeaders");
20603
+ getRequestBody = /* @__PURE__ */ __name((options) => {
20604
+ if (options.body !== void 0) {
20605
+ if (options.mediaType?.includes("/json")) {
20606
+ return JSON.stringify(options.body);
20607
+ } else if (isString(options.body) || isBlob(options.body)) {
20608
+ return options.body;
20609
+ } else {
20610
+ return JSON.stringify(options.body);
20611
+ }
20612
+ }
20613
+ return void 0;
20614
+ }, "getRequestBody");
20615
+ isResponseSchemaV4 = /* @__PURE__ */ __name((config, _options) => {
20616
+ return config.BASE.endsWith("/containers");
20617
+ }, "isResponseSchemaV4");
20618
+ sendRequest = /* @__PURE__ */ __name(async (config, options, url4, body, formData, headers, onCancel) => {
20619
+ const controller = new AbortController();
20620
+ const request4 = {
20621
+ headers,
20622
+ body: body ?? formData,
20623
+ method: options.method,
20624
+ signal: controller.signal,
20625
+ dispatcher: config.AGENT ?? void 0
20626
+ };
20627
+ if (config.WITH_CREDENTIALS) {
20628
+ request4.credentials = config.CREDENTIALS;
20629
+ }
20630
+ onCancel(() => controller.abort());
20631
+ return await (0, import_undici.fetch)(url4, request4);
20632
+ }, "sendRequest");
20633
+ getResponseHeader = /* @__PURE__ */ __name((response, responseHeader) => {
20634
+ if (responseHeader) {
20635
+ const content = response.headers.get(responseHeader);
20636
+ if (isString(content)) {
20637
+ return content;
20638
+ }
20639
+ }
20640
+ return void 0;
20641
+ }, "getResponseHeader");
20642
+ getResponseBody = /* @__PURE__ */ __name(async (response) => {
20643
+ if (response.status !== 204) {
20644
+ try {
20645
+ const contentType = response.headers.get("Content-Type");
20646
+ if (contentType) {
20647
+ const jsonTypes = ["application/json", "application/problem+json"];
20648
+ const isJSON = jsonTypes.some(
20649
+ (type) => contentType.toLowerCase().startsWith(type)
20650
+ );
20651
+ if (isJSON) {
20652
+ return await response.json();
20653
+ } else {
20654
+ return await response.text();
20655
+ }
20656
+ }
20657
+ } catch (error2) {
20658
+ console.error(error2);
20659
+ }
20660
+ }
20661
+ return void 0;
20662
+ }, "getResponseBody");
20663
+ catchErrorCodes = /* @__PURE__ */ __name((options, result) => {
20664
+ const errors = {
20665
+ 400: "Bad Request",
20666
+ 401: "Unauthorized",
20667
+ 403: "Forbidden",
20668
+ 404: "Not Found",
20669
+ 500: "Internal Server Error",
20670
+ 502: "Bad Gateway",
20671
+ 503: "Service Unavailable",
20672
+ ...options.errors
20673
+ };
20674
+ const error2 = errors[result.status];
20675
+ if (error2) {
20676
+ throw new ApiError(options, result, error2);
20677
+ }
20678
+ if (!result.ok) {
20679
+ throw new ApiError(options, result, "Generic Error");
20680
+ }
20681
+ }, "catchErrorCodes");
20682
+ request = /* @__PURE__ */ __name((config, options) => {
20683
+ return new CancelablePromise(async (resolve24, reject, onCancel) => {
20684
+ try {
20685
+ const url4 = getUrl(config, options);
20686
+ const formData = getFormData(options);
20687
+ const body = getRequestBody(options);
20688
+ const headers = await getHeaders(config, options);
20689
+ if (!onCancel.isCancelled) {
20690
+ const response = await sendRequest(
20691
+ config,
20692
+ options,
20693
+ url4,
20694
+ body,
20695
+ formData,
20696
+ headers,
20697
+ onCancel
20698
+ );
20699
+ const responseBody = await getResponseBody(response);
20700
+ const responseHeader = getResponseHeader(
20701
+ response,
20702
+ options.responseHeader
20703
+ );
20704
+ const parseResponseSchemaV4 = /* @__PURE__ */ __name((body2) => {
20705
+ const fetchResult2 = body2;
20706
+ return {
20707
+ url: url4,
20708
+ ok: response.ok && fetchResult2.success,
20709
+ status: response.status,
20710
+ statusText: response.statusText,
20711
+ body: responseHeader ?? fetchResult2.result
20712
+ };
20713
+ }, "parseResponseSchemaV4");
20714
+ const result = isResponseSchemaV4(config, options) ? parseResponseSchemaV4(responseBody) : {
20715
+ url: url4,
20716
+ ok: response.ok,
20717
+ status: response.status,
20718
+ statusText: response.statusText,
20719
+ body: responseHeader ?? responseBody
20720
+ };
20721
+ catchErrorCodes(options, result);
20722
+ resolve24(result.body);
20723
+ }
20724
+ } catch (error2) {
20725
+ reject(error2);
20726
+ }
20727
+ });
20728
+ }, "request");
20729
+ }
20730
+ });
20731
+
20711
20732
  // ../containers-shared/src/client/services/AccountService.ts
20712
20733
  var AccountService;
20713
20734
  var init_AccountService = __esm({
@@ -21029,16 +21050,22 @@ var init_ApplicationsService = __esm({
21029
21050
  * List rollouts
21030
21051
  * List all rollouts within an application
21031
21052
  * @param applicationId
21053
+ * @param limit The amount of rollouts to return. By default it is all of them.
21054
+ * @param last The last rollout that was used to paginate
21032
21055
  * @returns ApplicationRollout
21033
21056
  * @throws ApiError
21034
21057
  */
21035
- static listApplicationRollouts(applicationId) {
21058
+ static listApplicationRollouts(applicationId, limit, last) {
21036
21059
  return request(OpenAPI, {
21037
21060
  method: "GET",
21038
21061
  url: "/applications/{application_id}/rollouts",
21039
21062
  path: {
21040
21063
  application_id: applicationId
21041
21064
  },
21065
+ query: {
21066
+ limit,
21067
+ last
21068
+ },
21042
21069
  errors: {
21043
21070
  401: `Unauthorized`,
21044
21071
  404: `Response body when an Application is not found`,
@@ -21140,6 +21167,58 @@ var init_ApplicationsService = __esm({
21140
21167
  }
21141
21168
  });
21142
21169
  }
21170
+ /**
21171
+ * Get a specific deployment within an application
21172
+ * Get a deployment by its app and deployment IDs
21173
+ * @param applicationId
21174
+ * @param deploymentId
21175
+ * @returns DeploymentV2 Get a specific deployment along with its respective placements
21176
+ * @throws ApiError
21177
+ */
21178
+ static getApplicationsV3Deployment(applicationId, deploymentId) {
21179
+ return request(OpenAPI, {
21180
+ method: "GET",
21181
+ url: "/applications/{application_id}/deployments/{deployment_id}",
21182
+ path: {
21183
+ application_id: applicationId,
21184
+ deployment_id: deploymentId
21185
+ },
21186
+ errors: {
21187
+ 400: `Unknown account`,
21188
+ 401: `Unauthorized`,
21189
+ 404: `Deployment not found`,
21190
+ 500: `Deployment Get Error`
21191
+ }
21192
+ });
21193
+ }
21194
+ /**
21195
+ * Recreate an existing deployment within an application.
21196
+ * The given existing deployment is deleted and a replacement deployment is created. The latter retains some properties of the former that cannot be set by the client.
21197
+ *
21198
+ * @param applicationId
21199
+ * @param deploymentId
21200
+ * @param requestBody
21201
+ * @returns DeploymentV2 Deployment created
21202
+ * @throws ApiError
21203
+ */
21204
+ static recreateDeploymentV3(applicationId, deploymentId, requestBody) {
21205
+ return request(OpenAPI, {
21206
+ method: "POST",
21207
+ url: "/applications/{application_id}/deployments/{deployment_id}/recreate",
21208
+ path: {
21209
+ application_id: applicationId,
21210
+ deployment_id: deploymentId
21211
+ },
21212
+ body: requestBody,
21213
+ mediaType: "application/json",
21214
+ errors: {
21215
+ 400: `Could not create the deployment because of input/limits reasons, more details in the error code`,
21216
+ 401: `Unauthorized`,
21217
+ 404: `Deployment not found`,
21218
+ 500: `Deployment Creation Error`
21219
+ }
21220
+ });
21221
+ }
21143
21222
  };
21144
21223
  }
21145
21224
  });
@@ -21155,6 +21234,58 @@ var init_DeploymentsService = __esm({
21155
21234
  static {
21156
21235
  __name(this, "DeploymentsService");
21157
21236
  }
21237
+ /**
21238
+ * Get a specific deployment within an application
21239
+ * Get a deployment by its app and deployment IDs
21240
+ * @param applicationId
21241
+ * @param deploymentId
21242
+ * @returns DeploymentV2 Get a specific deployment along with its respective placements
21243
+ * @throws ApiError
21244
+ */
21245
+ static getApplicationsV3Deployment(applicationId, deploymentId) {
21246
+ return request(OpenAPI, {
21247
+ method: "GET",
21248
+ url: "/applications/{application_id}/deployments/{deployment_id}",
21249
+ path: {
21250
+ application_id: applicationId,
21251
+ deployment_id: deploymentId
21252
+ },
21253
+ errors: {
21254
+ 400: `Unknown account`,
21255
+ 401: `Unauthorized`,
21256
+ 404: `Deployment not found`,
21257
+ 500: `Deployment Get Error`
21258
+ }
21259
+ });
21260
+ }
21261
+ /**
21262
+ * Recreate an existing deployment within an application.
21263
+ * The given existing deployment is deleted and a replacement deployment is created. The latter retains some properties of the former that cannot be set by the client.
21264
+ *
21265
+ * @param applicationId
21266
+ * @param deploymentId
21267
+ * @param requestBody
21268
+ * @returns DeploymentV2 Deployment created
21269
+ * @throws ApiError
21270
+ */
21271
+ static recreateDeploymentV3(applicationId, deploymentId, requestBody) {
21272
+ return request(OpenAPI, {
21273
+ method: "POST",
21274
+ url: "/applications/{application_id}/deployments/{deployment_id}/recreate",
21275
+ path: {
21276
+ application_id: applicationId,
21277
+ deployment_id: deploymentId
21278
+ },
21279
+ body: requestBody,
21280
+ mediaType: "application/json",
21281
+ errors: {
21282
+ 400: `Could not create the deployment because of input/limits reasons, more details in the error code`,
21283
+ 401: `Unauthorized`,
21284
+ 404: `Deployment not found`,
21285
+ 500: `Deployment Creation Error`
21286
+ }
21287
+ });
21288
+ }
21158
21289
  /**
21159
21290
  * Create a new deployment
21160
21291
  * Creates a new deployment. A Deployment represents an intent to run one container, with image, in a particular location
@@ -21276,6 +21407,32 @@ var init_DeploymentsService = __esm({
21276
21407
  }
21277
21408
  });
21278
21409
  }
21410
+ /**
21411
+ * Recreate an existing deployment.
21412
+ * The given existing deployment is deleted and a replacement deployment is created. The latter retains some properties of the former that cannot be set by the client.
21413
+ *
21414
+ * @param deploymentId
21415
+ * @param requestBody
21416
+ * @returns DeploymentV2 Deployment created
21417
+ * @throws ApiError
21418
+ */
21419
+ static recreateDeployment(deploymentId, requestBody) {
21420
+ return request(OpenAPI, {
21421
+ method: "POST",
21422
+ url: "/deployments/{deployment_id}/recreate",
21423
+ path: {
21424
+ deployment_id: deploymentId
21425
+ },
21426
+ body: requestBody,
21427
+ mediaType: "application/json",
21428
+ errors: {
21429
+ 400: `Could not create the deployment because of input/limits reasons, more details in the error code`,
21430
+ 401: `Unauthorized`,
21431
+ 404: `Deployment not found`,
21432
+ 500: `Deployment Creation Error`
21433
+ }
21434
+ });
21435
+ }
21279
21436
  /**
21280
21437
  * Replace a deployment
21281
21438
  * You can stop the current placement and create a new one. The new one will have the same durable properties of the deployment, but will otherwise be like new
@@ -21617,16 +21774,22 @@ var init_RolloutsService = __esm({
21617
21774
  * List rollouts
21618
21775
  * List all rollouts within an application
21619
21776
  * @param applicationId
21777
+ * @param limit The amount of rollouts to return. By default it is all of them.
21778
+ * @param last The last rollout that was used to paginate
21620
21779
  * @returns ApplicationRollout
21621
21780
  * @throws ApiError
21622
21781
  */
21623
- static listApplicationRollouts(applicationId) {
21782
+ static listApplicationRollouts(applicationId, limit, last) {
21624
21783
  return request(OpenAPI, {
21625
21784
  method: "GET",
21626
21785
  url: "/applications/{application_id}/rollouts",
21627
21786
  path: {
21628
21787
  application_id: applicationId
21629
21788
  },
21789
+ query: {
21790
+ limit,
21791
+ last
21792
+ },
21630
21793
  errors: {
21631
21794
  401: `Unauthorized`,
21632
21795
  404: `Response body when an Application is not found`,
@@ -21798,7 +21961,6 @@ var init_client = __esm({
21798
21961
  init_ApiError();
21799
21962
  init_CancelablePromise();
21800
21963
  init_OpenAPI();
21801
- init_request();
21802
21964
  init_ApplicationAffinityColocation();
21803
21965
  init_ApplicationMutationError();
21804
21966
  init_ApplicationRollout();
@@ -21827,6 +21989,7 @@ var init_client = __esm({
21827
21989
  init_ImageRegistryProtocolAlreadyExists();
21828
21990
  init_ImageRegistryProtocolIsReferencedError();
21829
21991
  init_ImageRegistryProtocolNotFound();
21992
+ init_InstanceType();
21830
21993
  init_IPType();
21831
21994
  init_JobStatusHealth();
21832
21995
  init_NetworkMode();
@@ -21853,41 +22016,98 @@ var init_client = __esm({
21853
22016
  }
21854
22017
  });
21855
22018
 
21856
- // ../containers-shared/src/inspect.ts
21857
- async function dockerImageInspect(dockerPath, options) {
22019
+ // ../containers-shared/src/build.ts
22020
+ async function constructBuildCommand(options, logger4) {
22021
+ const platform3 = options.platform ?? "linux/amd64";
22022
+ const buildCmd = [
22023
+ "build",
22024
+ "-t",
22025
+ options.tag,
22026
+ "--platform",
22027
+ platform3,
22028
+ "--provenance=false"
22029
+ ];
22030
+ if (options.args) {
22031
+ for (const arg in options.args) {
22032
+ buildCmd.push("--build-arg", `${arg}=${options.args[arg]}`);
22033
+ }
22034
+ }
22035
+ if (options.setNetworkToHost) {
22036
+ buildCmd.push("--network", "host");
22037
+ }
22038
+ const dockerfile = (0, import_fs5.readFileSync)(options.pathToDockerfile, "utf-8");
22039
+ buildCmd.push("-f", "-");
22040
+ buildCmd.push(options.buildContext);
22041
+ logger4?.debug(`Building image with command: ${buildCmd.join(" ")}`);
22042
+ return { buildCmd, dockerfile };
22043
+ }
22044
+ function dockerBuild(dockerPath, options) {
22045
+ let errorHandled = false;
21858
22046
  return new Promise((resolve24, reject) => {
21859
- const proc = (0, import_child_process.spawn)(
21860
- dockerPath,
21861
- ["image", "inspect", options.imageTag, "--format", options.formatString],
21862
- {
21863
- stdio: ["ignore", "pipe", "pipe"]
22047
+ const child = (0, import_child_process.spawn)(dockerPath, options.buildCmd, {
22048
+ stdio: ["pipe", "inherit", "inherit"]
22049
+ });
22050
+ if (child.stdin !== null) {
22051
+ child.stdin.write(options.dockerfile);
22052
+ child.stdin.end();
22053
+ }
22054
+ child.on("exit", (code) => {
22055
+ if (code === 0) {
22056
+ resolve24();
22057
+ } else if (!errorHandled) {
22058
+ errorHandled = true;
22059
+ reject(new Error(`Build exited with code: ${code}`));
21864
22060
  }
21865
- );
21866
- let stdout2 = "";
21867
- let stderr2 = "";
21868
- proc.stdout.on("data", (chunk) => stdout2 += chunk);
21869
- proc.stderr.on("data", (chunk) => stderr2 += chunk);
21870
- proc.on("close", (code) => {
21871
- if (code !== 0) {
21872
- return reject(
21873
- new Error(`failed inspecting image locally: ${stderr2.trim()}`)
21874
- );
22061
+ });
22062
+ child.on("error", (err) => {
22063
+ if (!errorHandled) {
22064
+ errorHandled = true;
22065
+ reject(err);
21875
22066
  }
21876
- resolve24(stdout2.trim());
21877
22067
  });
21878
- proc.on("error", (err) => reject(err));
21879
22068
  });
21880
22069
  }
21881
- var import_child_process;
21882
- var init_inspect = __esm({
21883
- "../containers-shared/src/inspect.ts"() {
22070
+ async function buildImage(dockerPath, options) {
22071
+ const { buildCmd, dockerfile } = await constructBuildCommand({
22072
+ tag: options.imageTag,
22073
+ pathToDockerfile: options.image,
22074
+ buildContext: options.imageBuildContext ?? import_path5.default.dirname(options.image),
22075
+ args: options.args,
22076
+ platform: "linux/amd64"
22077
+ });
22078
+ await dockerBuild(dockerPath, { buildCmd, dockerfile });
22079
+ }
22080
+ var import_child_process, import_fs5, import_path5;
22081
+ var init_build = __esm({
22082
+ "../containers-shared/src/build.ts"() {
21884
22083
  init_import_meta_url();
21885
22084
  import_child_process = require("child_process");
21886
- __name(dockerImageInspect, "dockerImageInspect");
22085
+ import_fs5 = require("fs");
22086
+ import_path5 = __toESM(require("path"));
22087
+ __name(constructBuildCommand, "constructBuildCommand");
22088
+ __name(dockerBuild, "dockerBuild");
22089
+ __name(buildImage, "buildImage");
22090
+ }
22091
+ });
22092
+
22093
+ // ../containers-shared/src/registry.ts
22094
+ var getCloudflareRegistryWithAccountNamespace, MF_DEV_CONTAINER_PREFIX;
22095
+ var init_registry = __esm({
22096
+ "../containers-shared/src/registry.ts"() {
22097
+ init_import_meta_url();
22098
+ init_knobs();
22099
+ getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name((accountID, tag) => {
22100
+ return `${getCloudflareContainerRegistry()}/${accountID}/${tag}`;
22101
+ }, "getCloudflareRegistryWithAccountNamespace");
22102
+ MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
21887
22103
  }
21888
22104
  });
21889
22105
 
21890
22106
  // ../containers-shared/src/knobs.ts
22107
+ function isCloudflareRegistryLink(image) {
22108
+ const cfRegistry = getCloudflareContainerRegistry();
22109
+ return image.includes(cfRegistry);
22110
+ }
21891
22111
  var getCloudflareContainerRegistry, getDevContainerImageName;
21892
22112
  var init_knobs = __esm({
21893
22113
  "../containers-shared/src/knobs.ts"() {
@@ -21896,38 +22116,122 @@ var init_knobs = __esm({
21896
22116
  getCloudflareContainerRegistry = /* @__PURE__ */ __name(() => {
21897
22117
  return process.env.CLOUDFLARE_CONTAINER_REGISTRY ?? "registry.cloudflare.com";
21898
22118
  }, "getCloudflareContainerRegistry");
22119
+ __name(isCloudflareRegistryLink, "isCloudflareRegistryLink");
21899
22120
  getDevContainerImageName = /* @__PURE__ */ __name((name2, tag) => {
21900
22121
  return `${MF_DEV_CONTAINER_PREFIX}/${name2.toLowerCase()}:${tag}`;
21901
22122
  }, "getDevContainerImageName");
21902
22123
  }
21903
22124
  });
21904
22125
 
21905
- // ../containers-shared/src/registry.ts
21906
- var getCloudflareRegistryWithAccountNamespace, MF_DEV_CONTAINER_PREFIX;
21907
- var init_registry = __esm({
21908
- "../containers-shared/src/registry.ts"() {
22126
+ // ../containers-shared/src/login.ts
22127
+ async function dockerLoginManagedRegistry(pathToDocker) {
22128
+ const expirationMinutes = 15;
22129
+ const credentials = await ImageRegistriesService.generateImageRegistryCredentials(
22130
+ getCloudflareContainerRegistry(),
22131
+ {
22132
+ expiration_minutes: expirationMinutes,
22133
+ permissions: [
22134
+ "push" /* PUSH */,
22135
+ "pull" /* PULL */
22136
+ ]
22137
+ }
22138
+ );
22139
+ const child = (0, import_node_child_process.spawn)(
22140
+ pathToDocker,
22141
+ [
22142
+ "login",
22143
+ "--password-stdin",
22144
+ "--username",
22145
+ "v1",
22146
+ getCloudflareContainerRegistry()
22147
+ ],
22148
+ { stdio: ["pipe", "inherit", "inherit"] }
22149
+ ).on("error", (err) => {
22150
+ throw err;
22151
+ });
22152
+ child.stdin.write(credentials.password);
22153
+ child.stdin.end();
22154
+ await new Promise((resolve24, reject) => {
22155
+ child.on("close", (code) => {
22156
+ if (code === 0) {
22157
+ resolve24();
22158
+ } else {
22159
+ reject(new Error(`Login failed with code: ${code}`));
22160
+ }
22161
+ });
22162
+ });
22163
+ }
22164
+ var import_node_child_process;
22165
+ var init_login = __esm({
22166
+ "../containers-shared/src/login.ts"() {
21909
22167
  init_import_meta_url();
22168
+ import_node_child_process = require("child_process");
22169
+ init_client();
21910
22170
  init_knobs();
21911
- getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name((accountID, tag) => {
21912
- return `${getCloudflareContainerRegistry()}/${accountID}/${tag}`;
21913
- }, "getCloudflareRegistryWithAccountNamespace");
21914
- MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
22171
+ __name(dockerLoginManagedRegistry, "dockerLoginManagedRegistry");
22172
+ }
22173
+ });
22174
+
22175
+ // ../containers-shared/src/inspect.ts
22176
+ async function dockerImageInspect(dockerPath, options) {
22177
+ return new Promise((resolve24, reject) => {
22178
+ const proc = (0, import_child_process2.spawn)(
22179
+ dockerPath,
22180
+ ["image", "inspect", options.imageTag, "--format", options.formatString],
22181
+ {
22182
+ stdio: ["ignore", "pipe", "pipe"]
22183
+ }
22184
+ );
22185
+ let stdout2 = "";
22186
+ let stderr2 = "";
22187
+ proc.stdout.on("data", (chunk) => stdout2 += chunk);
22188
+ proc.stderr.on("data", (chunk) => stderr2 += chunk);
22189
+ proc.on("close", (code) => {
22190
+ if (code !== 0) {
22191
+ return reject(
22192
+ new Error(`failed inspecting image locally: ${stderr2.trim()}`)
22193
+ );
22194
+ }
22195
+ resolve24(stdout2.trim());
22196
+ });
22197
+ proc.on("error", (err) => reject(err));
22198
+ });
22199
+ }
22200
+ var import_child_process2;
22201
+ var init_inspect = __esm({
22202
+ "../containers-shared/src/inspect.ts"() {
22203
+ init_import_meta_url();
22204
+ import_child_process2 = require("child_process");
22205
+ __name(dockerImageInspect, "dockerImageInspect");
21915
22206
  }
21916
22207
  });
21917
22208
 
21918
22209
  // ../containers-shared/src/utils.ts
21919
22210
  function isDir(path71) {
21920
- const stats = (0, import_fs5.statSync)(path71);
22211
+ const stats = (0, import_fs6.statSync)(path71);
21921
22212
  return stats.isDirectory();
21922
22213
  }
21923
- var import_child_process2, import_fs5, runDockerCmd, runDockerCmdWithOutput, verifyDockerInstalled, isDockerfile, cleanupContainers, getContainerIdsFromImage;
22214
+ async function checkExposedPorts(dockerPath, options) {
22215
+ const output = await dockerImageInspect(dockerPath, {
22216
+ imageTag: options.imageTag,
22217
+ formatString: "{{ len .Config.ExposedPorts }}"
22218
+ });
22219
+ if (output === "0" && process.platform !== "linux") {
22220
+ throw new Error(
22221
+ `The container "${options.class_name}" does not expose any ports.
22222
+ To develop containers locally on non-Linux platforms, you must expose any ports that you call with \`getTCPPort()\` in your Dockerfile.`
22223
+ );
22224
+ }
22225
+ }
22226
+ var import_child_process3, import_fs6, runDockerCmd, runDockerCmdWithOutput, verifyDockerInstalled, isDockerfile, cleanupContainers, getContainerIdsFromImage;
21924
22227
  var init_utils = __esm({
21925
22228
  "../containers-shared/src/utils.ts"() {
21926
22229
  init_import_meta_url();
21927
- import_child_process2 = require("child_process");
21928
- import_fs5 = require("fs");
22230
+ import_child_process3 = require("child_process");
22231
+ import_fs6 = require("fs");
22232
+ init_inspect();
21929
22233
  runDockerCmd = /* @__PURE__ */ __name(async (dockerPath, args, stdio) => {
21930
- const child = (0, import_child_process2.spawn)(dockerPath, args, {
22234
+ const child = (0, import_child_process3.spawn)(dockerPath, args, {
21931
22235
  stdio: stdio ?? "inherit"
21932
22236
  });
21933
22237
  let errorHandled = false;
@@ -21950,7 +22254,7 @@ var init_utils = __esm({
21950
22254
  }, "runDockerCmd");
21951
22255
  runDockerCmdWithOutput = /* @__PURE__ */ __name(async (dockerPath, args) => {
21952
22256
  return new Promise((resolve24, reject) => {
21953
- (0, import_child_process2.execFile)(dockerPath, args, (error2, stdout2) => {
22257
+ (0, import_child_process3.execFile)(dockerPath, args, (error2, stdout2) => {
21954
22258
  if (error2) {
21955
22259
  return reject(
21956
22260
  new Error(
@@ -21975,7 +22279,7 @@ To suppress this error if you do not intend on triggering any container instance
21975
22279
  }, "verifyDockerInstalled");
21976
22280
  __name(isDir, "isDir");
21977
22281
  isDockerfile = /* @__PURE__ */ __name((image) => {
21978
- if ((0, import_fs5.existsSync)(image)) {
22282
+ if ((0, import_fs6.existsSync)(image)) {
21979
22283
  if (isDir(image)) {
21980
22284
  throw new Error(
21981
22285
  `${image} is a directory, you should specify a path to the Dockerfile`
@@ -22038,158 +22342,10 @@ To suppress this error if you do not intend on triggering any container instance
22038
22342
  ]);
22039
22343
  return output.split("\n").filter((line) => line.trim());
22040
22344
  }, "getContainerIdsFromImage");
22041
- }
22042
- });
22043
-
22044
- // ../containers-shared/src/build.ts
22045
- async function constructBuildCommand(options, logger4) {
22046
- const platform3 = options.platform ?? "linux/amd64";
22047
- const buildCmd = [
22048
- "build",
22049
- "-t",
22050
- options.tag,
22051
- "--platform",
22052
- platform3,
22053
- "--provenance=false"
22054
- ];
22055
- if (options.args) {
22056
- for (const arg in options.args) {
22057
- buildCmd.push("--build-arg", `${arg}=${options.args[arg]}`);
22058
- }
22059
- }
22060
- if (options.setNetworkToHost) {
22061
- buildCmd.push("--network", "host");
22062
- }
22063
- const dockerfile = (0, import_fs6.readFileSync)(options.pathToDockerfile, "utf-8");
22064
- buildCmd.push("-f", "-");
22065
- buildCmd.push(options.buildContext);
22066
- logger4?.debug(`Building image with command: ${buildCmd.join(" ")}`);
22067
- return { buildCmd, dockerfile };
22068
- }
22069
- function dockerBuild(dockerPath, options) {
22070
- let errorHandled = false;
22071
- return new Promise((resolve24, reject) => {
22072
- const child = (0, import_child_process3.spawn)(dockerPath, options.buildCmd, {
22073
- stdio: ["pipe", "inherit", "inherit"]
22074
- });
22075
- if (child.stdin !== null) {
22076
- child.stdin.write(options.dockerfile);
22077
- child.stdin.end();
22078
- }
22079
- child.on("exit", (code) => {
22080
- if (code === 0) {
22081
- resolve24();
22082
- } else if (!errorHandled) {
22083
- errorHandled = true;
22084
- reject(new Error(`Build exited with code: ${code}`));
22085
- }
22086
- });
22087
- child.on("error", (err) => {
22088
- if (!errorHandled) {
22089
- errorHandled = true;
22090
- reject(err);
22091
- }
22092
- });
22093
- });
22094
- }
22095
- async function prepareContainerImagesForDev(dockerPath, containerOptions) {
22096
- if (process.platform === "win32") {
22097
- throw new Error(
22098
- "Local development with containers is currently not supported on Windows. You should use WSL instead. You can also set `enable_containers` to false if you do not need to develop the container as part of your application."
22099
- );
22100
- }
22101
- await verifyDockerInstalled(dockerPath);
22102
- for (const options of containerOptions) {
22103
- await buildContainer(dockerPath, options);
22104
- await checkExposedPorts(dockerPath, options.imageTag);
22105
- }
22106
- }
22107
- async function buildContainer(dockerPath, options) {
22108
- const { buildCmd, dockerfile } = await constructBuildCommand({
22109
- tag: options.imageTag,
22110
- pathToDockerfile: options.image,
22111
- buildContext: options.imageBuildContext ?? import_path5.default.dirname(options.image),
22112
- args: options.args,
22113
- platform: "linux/amd64"
22114
- });
22115
- await dockerBuild(dockerPath, { buildCmd, dockerfile });
22116
- }
22117
- async function checkExposedPorts(dockerPath, imageTag) {
22118
- const output = await dockerImageInspect(dockerPath, {
22119
- imageTag,
22120
- formatString: "{{ len .Config.ExposedPorts }}"
22121
- });
22122
- if (output === "0" && process.platform !== "linux") {
22123
- throw new Error(
22124
- `The container "${imageTag.replace(MF_DEV_CONTAINER_PREFIX + "/", "")}" does not expose any ports.
22125
- To develop containers locally on non-Linux platforms, you must expose any ports that you call with \`getTCPPort()\` in your Dockerfile.`
22126
- );
22127
- }
22128
- }
22129
- var import_child_process3, import_fs6, import_path5;
22130
- var init_build = __esm({
22131
- "../containers-shared/src/build.ts"() {
22132
- init_import_meta_url();
22133
- import_child_process3 = require("child_process");
22134
- import_fs6 = require("fs");
22135
- import_path5 = __toESM(require("path"));
22136
- init_inspect();
22137
- init_registry();
22138
- init_utils();
22139
- __name(constructBuildCommand, "constructBuildCommand");
22140
- __name(dockerBuild, "dockerBuild");
22141
- __name(prepareContainerImagesForDev, "prepareContainerImagesForDev");
22142
- __name(buildContainer, "buildContainer");
22143
22345
  __name(checkExposedPorts, "checkExposedPorts");
22144
22346
  }
22145
22347
  });
22146
22348
 
22147
- // ../containers-shared/src/login.ts
22148
- async function dockerLoginManagedRegistry(pathToDocker) {
22149
- const expirationMinutes = 15;
22150
- const credentials = await ImageRegistriesService.generateImageRegistryCredentials(
22151
- getCloudflareContainerRegistry(),
22152
- {
22153
- expiration_minutes: expirationMinutes,
22154
- permissions: ["push", "pull"]
22155
- }
22156
- );
22157
- const child = (0, import_node_child_process.spawn)(
22158
- pathToDocker,
22159
- [
22160
- "login",
22161
- "--password-stdin",
22162
- "--username",
22163
- "v1",
22164
- getCloudflareContainerRegistry()
22165
- ],
22166
- { stdio: ["pipe", "inherit", "inherit"] }
22167
- ).on("error", (err) => {
22168
- throw err;
22169
- });
22170
- child.stdin.write(credentials.password);
22171
- child.stdin.end();
22172
- await new Promise((resolve24, reject) => {
22173
- child.on("close", (code) => {
22174
- if (code === 0) {
22175
- resolve24();
22176
- } else {
22177
- reject(new Error(`Login failed with code: ${code}`));
22178
- }
22179
- });
22180
- });
22181
- }
22182
- var import_node_child_process;
22183
- var init_login = __esm({
22184
- "../containers-shared/src/login.ts"() {
22185
- init_import_meta_url();
22186
- import_node_child_process = require("child_process");
22187
- init_client();
22188
- init_knobs();
22189
- __name(dockerLoginManagedRegistry, "dockerLoginManagedRegistry");
22190
- }
22191
- });
22192
-
22193
22349
  // ../containers-shared/src/types.ts
22194
22350
  var init_types = __esm({
22195
22351
  "../containers-shared/src/types.ts"() {
@@ -22216,12 +22372,51 @@ async function getDockerImageDigest(dockerPath, imageTag) {
22216
22372
  );
22217
22373
  });
22218
22374
  }
22375
+ async function pullImage(dockerPath, options) {
22376
+ await dockerLoginManagedRegistry(dockerPath);
22377
+ await runDockerCmd(dockerPath, [
22378
+ "pull",
22379
+ options.image,
22380
+ // All containers running on our platform need to be built for amd64 architecture, but by default docker pull seems to look for an image matching the host system, so we need to specify this here
22381
+ "--platform",
22382
+ "linux/amd64"
22383
+ ]);
22384
+ await runDockerCmd(dockerPath, ["tag", options.image, options.imageTag]);
22385
+ }
22386
+ async function prepareContainerImagesForDev(dockerPath, containerOptions) {
22387
+ if (process.platform === "win32") {
22388
+ throw new Error(
22389
+ "Local development with containers is currently not supported on Windows. You should use WSL instead. You can also set `enable_containers` to false if you do not need to develop the container part of your application."
22390
+ );
22391
+ }
22392
+ await verifyDockerInstalled(dockerPath);
22393
+ for (const options of containerOptions) {
22394
+ if (isDockerfile(options.image)) {
22395
+ await buildImage(dockerPath, options);
22396
+ } else {
22397
+ if (!isCloudflareRegistryLink(options.image)) {
22398
+ throw new Error(
22399
+ `Image "${options.image}" is a registry link but does not point to the Cloudflare container registry.
22400
+ To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images`
22401
+ );
22402
+ }
22403
+ await pullImage(dockerPath, options);
22404
+ }
22405
+ await checkExposedPorts(dockerPath, options);
22406
+ }
22407
+ }
22219
22408
  var import_child_process4;
22220
22409
  var init_images = __esm({
22221
22410
  "../containers-shared/src/images.ts"() {
22222
22411
  init_import_meta_url();
22223
22412
  import_child_process4 = require("child_process");
22413
+ init_build();
22414
+ init_knobs();
22415
+ init_login();
22416
+ init_utils();
22224
22417
  __name(getDockerImageDigest, "getDockerImageDigest");
22418
+ __name(pullImage, "pullImage");
22419
+ __name(prepareContainerImagesForDev, "prepareContainerImagesForDev");
22225
22420
  }
22226
22421
  });
22227
22422
 
@@ -29292,7 +29487,7 @@ var name, version;
29292
29487
  var init_package = __esm({
29293
29488
  "package.json"() {
29294
29489
  name = "wrangler";
29295
- version = "4.20.4";
29490
+ version = "4.20.5";
29296
29491
  }
29297
29492
  });
29298
29493
 
@@ -34464,31 +34659,6 @@ var require_main2 = __commonJS({
34464
34659
  }
34465
34660
  });
34466
34661
 
34467
- // src/experimental-flags.ts
34468
- var import_async_hooks, flags, run, getFlag;
34469
- var init_experimental_flags = __esm({
34470
- "src/experimental-flags.ts"() {
34471
- init_import_meta_url();
34472
- import_async_hooks = require("async_hooks");
34473
- init_logger();
34474
- flags = new import_async_hooks.AsyncLocalStorage();
34475
- run = /* @__PURE__ */ __name((flagValues, cb2) => flags.run(flagValues, cb2), "run");
34476
- getFlag = /* @__PURE__ */ __name((flag) => {
34477
- const store = flags.getStore();
34478
- if (store === void 0) {
34479
- logger.debug("No experimental flag store instantiated");
34480
- }
34481
- const value = flags.getStore()?.[flag];
34482
- if (value === void 0) {
34483
- logger.debug(
34484
- `Attempted to use flag "${flag}" which has not been instantiated`
34485
- );
34486
- }
34487
- return value;
34488
- }, "getFlag");
34489
- }
34490
- });
34491
-
34492
34662
  // src/pages/constants.ts
34493
34663
  var isWindows, MAX_ASSET_COUNT2, MAX_ASSET_SIZE2, PAGES_CONFIG_CACHE_FILENAME, MAX_BUCKET_SIZE, MAX_BUCKET_FILE_COUNT, BULK_UPLOAD_CONCURRENCY, MAX_UPLOAD_ATTEMPTS, MAX_UPLOAD_GATEWAY_ERRORS, MAX_DEPLOYMENT_ATTEMPTS, MAX_DEPLOYMENT_STATUS_ATTEMPTS, MAX_CHECK_MISSING_ATTEMPTS, SECONDS_TO_WAIT_FOR_PROXY, MAX_FUNCTIONS_ROUTES_RULES, MAX_FUNCTIONS_ROUTES_RULE_LENGTH, ROUTES_SPEC_VERSION, ROUTES_SPEC_DESCRIPTION;
34494
34664
  var init_constants3 = __esm({
@@ -34928,6 +35098,31 @@ var init_config_helpers = __esm({
34928
35098
  }
34929
35099
  });
34930
35100
 
35101
+ // src/experimental-flags.ts
35102
+ var import_async_hooks, flags, run, getFlag;
35103
+ var init_experimental_flags = __esm({
35104
+ "src/experimental-flags.ts"() {
35105
+ init_import_meta_url();
35106
+ import_async_hooks = require("async_hooks");
35107
+ init_logger();
35108
+ flags = new import_async_hooks.AsyncLocalStorage();
35109
+ run = /* @__PURE__ */ __name((flagValues, cb2) => flags.run(flagValues, cb2), "run");
35110
+ getFlag = /* @__PURE__ */ __name((flag) => {
35111
+ const store = flags.getStore();
35112
+ if (store === void 0) {
35113
+ logger.debug("No experimental flag store instantiated");
35114
+ }
35115
+ const value = flags.getStore()?.[flag];
35116
+ if (value === void 0) {
35117
+ logger.debug(
35118
+ `Attempted to use flag "${flag}" which has not been instantiated`
35119
+ );
35120
+ }
35121
+ return value;
35122
+ }, "getFlag");
35123
+ }
35124
+ });
35125
+
34931
35126
  // ../../node_modules/.pnpm/pretty-bytes@6.1.1/node_modules/pretty-bytes/index.js
34932
35127
  function prettyBytes(number, options) {
34933
35128
  if (!Number.isFinite(number)) {
@@ -38519,9 +38714,6 @@ function warnIfDurableObjectsHaveNoMigrations(diagnostics, durableObjects, migra
38519
38714
  }
38520
38715
  }
38521
38716
  function isRemoteValid(targetObject, fieldPath, diagnostics) {
38522
- if (!getFlag("REMOTE_BINDINGS")) {
38523
- return true;
38524
- }
38525
38717
  if (!isOptionalProperty(targetObject, "experimental_remote", "boolean")) {
38526
38718
  diagnostics.errors.push(
38527
38719
  `"${fieldPath}" should, optionally, have a boolean "experimental_remote" field but got ${JSON.stringify(
@@ -39112,7 +39304,7 @@ Please add a binding for each to "${fieldPath}.bindings":
39112
39304
  }
39113
39305
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
39114
39306
  "binding",
39115
- ...getFlag("REMOTE_BINDINGS") ? ["experimental_remote"] : []
39307
+ "experimental_remote"
39116
39308
  ]);
39117
39309
  return isValid2;
39118
39310
  }, "validateNamedSimpleBinding");
@@ -39242,7 +39434,7 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39242
39434
  }
39243
39435
  return isValid2;
39244
39436
  }, "validateBindingArray");
39245
- validateContainerAppConfig = /* @__PURE__ */ __name((diagnostics, _field, value) => {
39437
+ validateContainerAppConfig = /* @__PURE__ */ __name((diagnostics, field, value) => {
39246
39438
  if (!value) {
39247
39439
  return true;
39248
39440
  }
@@ -39309,6 +39501,16 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39309
39501
  `"containers.image" should be defined and a string`
39310
39502
  );
39311
39503
  }
39504
+ if ("instance_type" in containerAppOptional) {
39505
+ validateOptionalProperty(
39506
+ diagnostics,
39507
+ field,
39508
+ "instance_type",
39509
+ containerAppOptional.instance_type,
39510
+ "string",
39511
+ ["dev", "basic", "standard"]
39512
+ );
39513
+ }
39312
39514
  }
39313
39515
  if (diagnostics.errors.length > 0) {
39314
39516
  return false;
@@ -39340,6 +39542,18 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39340
39542
  }
39341
39543
  });
39342
39544
  });
39545
+ if ("instance_type" in value && value.instance_type !== void 0) {
39546
+ if (typeof value.instance_type !== "string" || !["dev", "basic", "standard"].includes(value.instance_type)) {
39547
+ diagnostics.errors.push(
39548
+ `"instance_type" should be one of 'dev', 'basic', or 'standard', but got ${value.instance_type}`
39549
+ );
39550
+ }
39551
+ if ("memory" in value && value.memory !== void 0 || "vcpu" in value && value.vcpu !== void 0) {
39552
+ diagnostics.errors.push(
39553
+ `"${field}" configuration should not set either "memory" or "vcpu" with "instance_type"`
39554
+ );
39555
+ }
39556
+ }
39343
39557
  return isValid2;
39344
39558
  }, "validateCloudchamberConfig");
39345
39559
  validateKVBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
@@ -39383,7 +39597,7 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39383
39597
  "binding",
39384
39598
  "id",
39385
39599
  "preview_id",
39386
- ...getFlag("REMOTE_BINDINGS") ? ["experimental_remote"] : []
39600
+ "experimental_remote"
39387
39601
  ]);
39388
39602
  return isValid2;
39389
39603
  }, "validateKVBinding");
@@ -39446,7 +39660,7 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39446
39660
  "binding",
39447
39661
  "queue",
39448
39662
  "delivery_delay",
39449
- ...getFlag("REMOTE_BINDINGS") ? ["experimental_remote"] : []
39663
+ "experimental_remote"
39450
39664
  ])) {
39451
39665
  return false;
39452
39666
  }
@@ -39543,7 +39757,7 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39543
39757
  "bucket_name",
39544
39758
  "preview_bucket_name",
39545
39759
  "jurisdiction",
39546
- ...getFlag("REMOTE_BINDINGS") ? ["experimental_remote"] : []
39760
+ "experimental_remote"
39547
39761
  ]);
39548
39762
  return isValid2;
39549
39763
  }, "validateR2Binding");
@@ -39596,7 +39810,7 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39596
39810
  "migrations_dir",
39597
39811
  "migrations_table",
39598
39812
  "preview_database_id",
39599
- ...getFlag("REMOTE_BINDINGS") ? ["experimental_remote"] : []
39813
+ "experimental_remote"
39600
39814
  ]);
39601
39815
  return isValid2;
39602
39816
  }, "validateD1Binding");
@@ -39630,7 +39844,7 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
39630
39844
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
39631
39845
  "binding",
39632
39846
  "index_name",
39633
- ...getFlag("REMOTE_BINDINGS") ? ["experimental_remote"] : []
39847
+ "experimental_remote"
39634
39848
  ]);
39635
39849
  return isValid2;
39636
39850
  }, "validateVectorizeBinding");
@@ -39870,7 +40084,7 @@ ${resolution}`);
39870
40084
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
39871
40085
  "binding",
39872
40086
  "certificate_id",
39873
- ...getFlag("REMOTE_BINDINGS") ? ["experimental_remote"] : []
40087
+ "experimental_remote"
39874
40088
  ]);
39875
40089
  if (!isRemoteValid(value, field, diagnostics)) {
39876
40090
  isValid2 = false;
@@ -40489,20 +40703,11 @@ function readConfig(args, options = {}) {
40489
40703
  args,
40490
40704
  options
40491
40705
  );
40492
- const { diagnostics, config } = run(
40493
- {
40494
- RESOURCES_PROVISION: getFlag("RESOURCES_PROVISION") ?? false,
40495
- MULTIWORKER: getFlag("MULTIWORKER") ?? false,
40496
- REMOTE_BINDINGS: options.experimental?.remoteBindingsEnabled ?? getFlag("REMOTE_BINDINGS") ?? false
40497
- },
40498
- () => {
40499
- return normalizeAndValidateConfig(
40500
- rawConfig,
40501
- configPath,
40502
- userConfigPath,
40503
- args
40504
- );
40505
- }
40706
+ const { diagnostics, config } = normalizeAndValidateConfig(
40707
+ rawConfig,
40708
+ configPath,
40709
+ userConfigPath,
40710
+ args
40506
40711
  );
40507
40712
  if (diagnostics.hasWarnings() && !options?.hideWarnings) {
40508
40713
  logger.warn(diagnostics.renderWarnings());
@@ -40594,7 +40799,6 @@ var init_config2 = __esm({
40594
40799
  import_toml2 = __toESM(require_toml());
40595
40800
  import_dotenv = __toESM(require_main2());
40596
40801
  init_errors();
40597
- init_experimental_flags();
40598
40802
  init_logger();
40599
40803
  init_errors3();
40600
40804
  init_parse();
@@ -60451,6 +60655,7 @@ function checkEverythingIsSet(object, keys) {
60451
60655
  function renderDeploymentConfiguration(action, {
60452
60656
  image,
60453
60657
  location,
60658
+ instanceType,
60454
60659
  vcpu,
60455
60660
  memoryMib,
60456
60661
  environmentVariables,
@@ -60474,11 +60679,13 @@ No environment variables added! You can set some under [${env6 ? "env." + env6 +
60474
60679
  const containerInformation = [
60475
60680
  ["image", image],
60476
60681
  ["location", idToLocationName(location)],
60477
- ["vCPU", `${vcpu}`],
60478
- ["memory", `${memoryMib} MiB`],
60479
60682
  ["environment variables", environmentVariablesText],
60480
60683
  ["labels", labelsText],
60481
- ...network === void 0 ? [] : [["IPv4", network.assign_ipv4 === "predefined" ? "yes" : "no"]]
60684
+ ...network === void 0 ? [] : [["IPv4", network.assign_ipv4 === "predefined" ? "yes" : "no"]],
60685
+ ...instanceType === void 0 ? [
60686
+ ["vCPU", `${vcpu}`],
60687
+ ["memory", `${memoryMib} MiB`]
60688
+ ] : [["instance type", `${instanceType}`]]
60482
60689
  ];
60483
60690
  updateStatus(
60484
60691
  `You're about to ${action} a container with the following configuration
@@ -60681,6 +60888,34 @@ async function promptForLabels(labels, initiallySelected, allowSkipping) {
60681
60888
  }
60682
60889
  return [];
60683
60890
  }
60891
+ async function promptForInstanceType(allowSkipping) {
60892
+ let options = [
60893
+ { label: "dev: 1/16 vCPU, 256 MiB memory, 2 GB disk", value: "dev" },
60894
+ { label: "basic: 1/4 vCPU, 1 GiB memory, 4 GB disk", value: "basic" },
60895
+ { label: "standard: 1/2 vCPU, 4 GiB memory, 4 GB disk", value: "standard" }
60896
+ ];
60897
+ if (allowSkipping) {
60898
+ options = [{ label: "Do not set", value: "skip" }].concat(options);
60899
+ }
60900
+ const action = await inputPrompt({
60901
+ question: "Which instance type should we use for your container?",
60902
+ label: "",
60903
+ defaultValue: false,
60904
+ helpText: "",
60905
+ type: "select",
60906
+ options
60907
+ });
60908
+ switch (action) {
60909
+ case "dev":
60910
+ return "dev" /* DEV */;
60911
+ case "basic":
60912
+ return "basic" /* BASIC */;
60913
+ case "standard":
60914
+ return "standard" /* STANDARD */;
60915
+ default:
60916
+ return void 0;
60917
+ }
60918
+ }
60684
60919
  function resolveMemory(args, config) {
60685
60920
  const MiB = 1024 * 1024;
60686
60921
  const memory = args.memory ?? config.memory;
@@ -60696,6 +60931,54 @@ function resolveAppDiskSize(account, app) {
60696
60931
  const disk = app.configuration.disk?.size ?? "2GB";
60697
60932
  return Math.round(parseByteSize(disk));
60698
60933
  }
60934
+ function checkInstanceType(args, config) {
60935
+ const instance_type = args.instanceType ?? config.instance_type;
60936
+ if (instance_type === void 0) {
60937
+ return;
60938
+ }
60939
+ if (args.memory !== void 0 || args.vcpu !== void 0) {
60940
+ throw new UserError(
60941
+ `Field "instance_type" is mutually exclusive with "memory" and "vcpu". These fields cannot be set together.`
60942
+ );
60943
+ }
60944
+ switch (instance_type) {
60945
+ case "dev":
60946
+ return "dev" /* DEV */;
60947
+ case "basic":
60948
+ return "basic" /* BASIC */;
60949
+ case "standard":
60950
+ return "standard" /* STANDARD */;
60951
+ default:
60952
+ throw new UserError(
60953
+ `"instance_type" field value is expected to be one of "dev", "basic", or "standard", but got "${instance_type}"`
60954
+ );
60955
+ }
60956
+ }
60957
+ function inferInstanceType(configuration) {
60958
+ if (configuration?.disk?.size_mb !== void 0 && configuration?.memory_mib !== void 0 && configuration?.vcpu !== void 0) {
60959
+ if (configuration.disk.size_mb === 2e3 && configuration.memory_mib === 256 && configuration.vcpu === 0.0625) {
60960
+ return "dev" /* DEV */;
60961
+ } else if (configuration.disk.size_mb === 4e3 && configuration.memory_mib === 1024 && configuration.vcpu === 0.25) {
60962
+ return "basic" /* BASIC */;
60963
+ } else if (configuration.disk.size_mb === 4e3 && configuration.memory_mib === 4096 && configuration.vcpu === 0.5) {
60964
+ return "standard" /* STANDARD */;
60965
+ }
60966
+ }
60967
+ }
60968
+ function cleanForInstanceType(app) {
60969
+ if (!("configuration" in app)) {
60970
+ return app;
60971
+ }
60972
+ const instance_type = inferInstanceType(app.configuration);
60973
+ if (instance_type !== void 0) {
60974
+ app.configuration.instance_type = instance_type;
60975
+ }
60976
+ delete app.configuration.disk;
60977
+ delete app.configuration.memory;
60978
+ delete app.configuration.memory_mib;
60979
+ delete app.configuration.vcpu;
60980
+ return app;
60981
+ }
60699
60982
  var import_promises12, imageRe;
60700
60983
  var init_common = __esm({
60701
60984
  "src/cloudchamber/common.ts"() {
@@ -60745,8 +61028,12 @@ var init_common = __esm({
60745
61028
  __name(sortLabels, "sortLabels");
60746
61029
  __name(collectLabels, "collectLabels");
60747
61030
  __name(promptForLabels, "promptForLabels");
61031
+ __name(promptForInstanceType, "promptForInstanceType");
60748
61032
  __name(resolveMemory, "resolveMemory");
60749
61033
  __name(resolveAppDiskSize, "resolveAppDiskSize");
61034
+ __name(checkInstanceType, "checkInstanceType");
61035
+ __name(inferInstanceType, "inferInstanceType");
61036
+ __name(cleanForInstanceType, "cleanForInstanceType");
60750
61037
  }
60751
61038
  });
60752
61039
 
@@ -61017,8 +61304,39 @@ function applicationToCreateApplication(application) {
61017
61304
  };
61018
61305
  return app;
61019
61306
  }
61020
- function containerAppToCreateApplication(containerApp, skipDefaults = false) {
61021
- const configuration = containerApp.configuration;
61307
+ function cleanupObservability(observability) {
61308
+ if (observability === void 0) {
61309
+ return;
61310
+ }
61311
+ if (observability.logging !== void 0 && observability.logs !== void 0) {
61312
+ delete observability.logging;
61313
+ }
61314
+ }
61315
+ function observabilityToConfiguration(observability, existingObservabilityConfig) {
61316
+ const observabilityLogsEnabled = observability?.logs?.enabled === true || observability?.enabled === true && observability?.logs?.enabled !== false;
61317
+ const logsAlreadyEnabled = existingObservabilityConfig?.logs?.enabled;
61318
+ if (observabilityLogsEnabled) {
61319
+ return { logs: { enabled: true } };
61320
+ } else {
61321
+ if (logsAlreadyEnabled === void 0) {
61322
+ return void 0;
61323
+ } else {
61324
+ return { logs: { enabled: false } };
61325
+ }
61326
+ }
61327
+ }
61328
+ function containerAppToCreateApplication(containerApp, observability, existingApp, skipDefaults = false) {
61329
+ const observabilityConfiguration = observabilityToConfiguration(
61330
+ observability,
61331
+ existingApp?.configuration.observability
61332
+ );
61333
+ const configuration = {
61334
+ ...containerApp.configuration,
61335
+ observability: observabilityConfiguration
61336
+ };
61337
+ if (containerApp.instance_type !== void 0) {
61338
+ configuration.instance_type = containerApp.instance_type;
61339
+ }
61022
61340
  const app = {
61023
61341
  ...containerApp,
61024
61342
  configuration,
@@ -61040,6 +61358,7 @@ function containerAppToCreateApplication(containerApp, skipDefaults = false) {
61040
61358
  delete app["image_vars"];
61041
61359
  delete app["rollout_step_percentage"];
61042
61360
  delete app["rollout_kind"];
61361
+ delete app["instance_type"];
61043
61362
  return app;
61044
61363
  }
61045
61364
  function isNumber(c6) {
@@ -61181,7 +61500,8 @@ async function apply(args, config) {
61181
61500
  const configuration = {
61182
61501
  image: "docker.io/cloudflare/hello-world:1.0",
61183
61502
  instances: 2,
61184
- name: config.name ?? "my-containers-application"
61503
+ name: config.name ?? "my-containers-application",
61504
+ instance_type: "dev"
61185
61505
  };
61186
61506
  const endConfig = args.env !== void 0 ? {
61187
61507
  env: { [args.env]: { containers: [configuration] } }
@@ -61195,6 +61515,9 @@ async function apply(args, config) {
61195
61515
  ApplicationsService.listApplications(),
61196
61516
  { json: args.json, message: "Loading applications" }
61197
61517
  );
61518
+ applications.forEach(
61519
+ (app) => cleanupObservability(app.configuration.observability)
61520
+ );
61198
61521
  const applicationByNames = {};
61199
61522
  for (const application of applications) {
61200
61523
  applicationByNames[application.name] = application;
@@ -61208,6 +61531,8 @@ async function apply(args, config) {
61208
61531
  }
61209
61532
  const appConfig = containerAppToCreateApplication(
61210
61533
  appConfigNoDefaults,
61534
+ config.observability,
61535
+ application,
61211
61536
  args.skipDefaults
61212
61537
  );
61213
61538
  if (application !== void 0 && application !== null) {
@@ -61223,19 +61548,17 @@ async function apply(args, config) {
61223
61548
  you should delete the container application and deploy again`
61224
61549
  );
61225
61550
  }
61551
+ const prevContainer = appConfig.configuration.instance_type !== void 0 ? cleanForInstanceType(prevApp) : prevApp;
61552
+ const nowContainer = mergeDeep2(
61553
+ prevContainer,
61554
+ sortObjectRecursive(appConfig)
61555
+ );
61226
61556
  const prev = formatConfigSnippet(
61227
- { containers: [prevApp] },
61557
+ { containers: [prevContainer] },
61228
61558
  config.configPath
61229
61559
  );
61230
61560
  const now = formatConfigSnippet(
61231
- {
61232
- containers: [
61233
- mergeDeep2(
61234
- prevApp,
61235
- sortObjectRecursive(appConfig)
61236
- )
61237
- ]
61238
- },
61561
+ { containers: [nowContainer] },
61239
61562
  config.configPath
61240
61563
  );
61241
61564
  const results = diffLines(prev, now);
@@ -61415,8 +61738,7 @@ ${formatError(err)}`
61415
61738
  await promiseSpinner(
61416
61739
  ApplicationsService.modifyApplication(action.id, {
61417
61740
  ...action.application,
61418
- instances: action.application.max_instances !== void 0 ? void 0 : action.application.instances,
61419
- configuration: void 0
61741
+ instances: action.application.max_instances !== void 0 ? void 0 : action.application.instances
61420
61742
  })
61421
61743
  );
61422
61744
  } catch (err) {
@@ -61508,6 +61830,8 @@ var init_apply = __esm({
61508
61830
  __name(applyCommandOptionalYargs, "applyCommandOptionalYargs");
61509
61831
  __name(createApplicationToModifyApplication, "createApplicationToModifyApplication");
61510
61832
  __name(applicationToCreateApplication, "applicationToCreateApplication");
61833
+ __name(cleanupObservability, "cleanupObservability");
61834
+ __name(observabilityToConfiguration, "observabilityToConfiguration");
61511
61835
  __name(containerAppToCreateApplication, "containerAppToCreateApplication");
61512
61836
  __name(isNumber, "isNumber");
61513
61837
  __name(createLine, "createLine");
@@ -75632,7 +75956,6 @@ function statusToColored(status2) {
75632
75956
  const mappings = {
75633
75957
  placed: bgYellow,
75634
75958
  running: bgGreen,
75635
- do_connected: bgGreen,
75636
75959
  stopped: bgYellow,
75637
75960
  stopping: bgYellow,
75638
75961
  failed: bgRed,
@@ -76455,6 +76778,11 @@ function createCommandOptionalYargs(yargs) {
76455
76778
  array: true,
76456
76779
  demandOption: false,
76457
76780
  describe: "ID of the SSH key to add to the deployment"
76781
+ }).option("instance-type", {
76782
+ requiresArg: true,
76783
+ choices: ["dev", "basic", "standard"],
76784
+ demandOption: false,
76785
+ describe: "Instance type to allocate to this deployment"
76458
76786
  }).option("vcpu", {
76459
76787
  requiresArg: true,
76460
76788
  type: "number",
@@ -76496,17 +76824,23 @@ async function createCommand2(args, config) {
76496
76824
  const useIpv4 = args.ipv4 ?? config.cloudchamber.ipv4;
76497
76825
  const network = useIpv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : { assign_ipv6: "predefined" /* PREDEFINED */ };
76498
76826
  const memoryMib = resolveMemory(args, config.cloudchamber);
76499
- const deployment = await DeploymentsService.createDeploymentV2({
76827
+ const vcpu = args.vcpu ?? config.cloudchamber.vcpu;
76828
+ const instanceType = checkInstanceType(args, config.cloudchamber);
76829
+ const deploymentRequest = {
76500
76830
  image: body.image,
76501
76831
  location: body.location,
76502
76832
  ssh_public_key_ids: keysToAdd,
76503
76833
  environment_variables: environmentVariables,
76504
76834
  labels,
76505
- vcpu: args.vcpu ?? config.cloudchamber.vcpu,
76506
- network,
76507
- memory_mib: memoryMib
76508
- });
76509
- console.log(JSON.stringify(deployment, null, 4));
76835
+ instance_type: instanceType,
76836
+ network
76837
+ };
76838
+ if (instanceType === void 0) {
76839
+ deploymentRequest.vcpu = vcpu;
76840
+ deploymentRequest.memory_mib = memoryMib;
76841
+ }
76842
+ const deployment = await DeploymentsService.createDeploymentV2(deploymentRequest);
76843
+ logger.log(JSON.stringify(deployment, null, 4));
76510
76844
  return;
76511
76845
  }
76512
76846
  await handleCreateCommand(args, config, environmentVariables, labels);
@@ -76611,12 +76945,17 @@ async function handleCreateCommand(args, config, environmentVariables, labels) {
76611
76945
  );
76612
76946
  const selectedLabels = await promptForLabels(labels, [], false);
76613
76947
  const account = await loadAccount();
76614
- const memoryMib = resolveMemory(args, config.cloudchamber) ?? account.defaults.memory_mib ?? Math.round(parseByteSize(account.defaults.memory, 1024) / (1024 * 1024));
76948
+ const memoryMib = resolveMemory(args, config.cloudchamber) ?? account.defaults.memory_mib ?? Math.round(
76949
+ parseByteSize(account.defaults.memory ?? "2000MiB", 1024) / (1024 * 1024)
76950
+ );
76951
+ const vcpu = args.vcpu ?? config.cloudchamber.vcpu ?? account.defaults.vcpus;
76952
+ const instanceType = await promptForInstanceType(true);
76615
76953
  renderDeploymentConfiguration("create", {
76616
76954
  image,
76617
76955
  location,
76618
76956
  network,
76619
- vcpu: args.vcpu ?? config.cloudchamber.vcpu ?? account.defaults.vcpus,
76957
+ instanceType,
76958
+ vcpu,
76620
76959
  memoryMib,
76621
76960
  environmentVariables: selectedEnvironmentVariables,
76622
76961
  labels: selectedLabels,
@@ -76633,17 +76972,23 @@ async function handleCreateCommand(args, config, environmentVariables, labels) {
76633
76972
  }
76634
76973
  const { start, stop } = spinner();
76635
76974
  start("Creating your container", "your container will be created shortly");
76975
+ const deploymentRequest = {
76976
+ image,
76977
+ location,
76978
+ ssh_public_key_ids: keys,
76979
+ environment_variables: environmentVariables,
76980
+ labels,
76981
+ instance_type: instanceType,
76982
+ vcpu: void 0,
76983
+ memory_mib: void 0,
76984
+ network
76985
+ };
76986
+ if (instanceType === void 0) {
76987
+ deploymentRequest.vcpu = vcpu;
76988
+ deploymentRequest.memory_mib = memoryMib;
76989
+ }
76636
76990
  const [deployment, err] = await wrap2(
76637
- DeploymentsService.createDeploymentV2({
76638
- image,
76639
- location,
76640
- ssh_public_key_ids: keys,
76641
- environment_variables: environmentVariables,
76642
- labels,
76643
- vcpu: args.vcpu ?? config.cloudchamber.vcpu,
76644
- memory_mib: memoryMib,
76645
- network
76646
- })
76991
+ DeploymentsService.createDeploymentV2(deploymentRequest)
76647
76992
  );
76648
76993
  if (err) {
76649
76994
  stop();
@@ -76667,6 +77012,7 @@ var init_create2 = __esm({
76667
77012
  init_colors();
76668
77013
  init_interactive();
76669
77014
  init_containers_shared();
77015
+ init_logger();
76670
77016
  init_parse();
76671
77017
  init_cli2();
76672
77018
  init_locations2();
@@ -76847,6 +77193,7 @@ var init_curl = __esm({
76847
77193
  init_cli();
76848
77194
  init_colors();
76849
77195
  init_containers_shared();
77196
+ init_request();
76850
77197
  init_render_labelled_values();
76851
77198
  __name(yargsCurl, "yargsCurl");
76852
77199
  __name(curlCommand, "curlCommand");
@@ -77682,6 +78029,11 @@ function modifyCommandOptionalYargs(yargs) {
77682
78029
  type: "string",
77683
78030
  demandOption: false,
77684
78031
  describe: "The new location that the deployment will have from now on"
78032
+ }).option("instance-type", {
78033
+ requiresArg: true,
78034
+ choices: ["dev", "basic", "standard"],
78035
+ demandOption: false,
78036
+ describe: "The new instance type that the deployment will have from now on"
77685
78037
  }).option("vcpu", {
77686
78038
  requiresArg: true,
77687
78039
  type: "number",
@@ -77709,17 +78061,25 @@ async function modifyCommand(modifyArgs, config) {
77709
78061
  );
77710
78062
  const labels = collectLabels(modifyArgs.label);
77711
78063
  const memoryMib = resolveMemory(modifyArgs, config.cloudchamber);
78064
+ const vcpu = modifyArgs.vcpu ?? config.cloudchamber.vcpu;
78065
+ const instanceType = checkInstanceType(modifyArgs, config.cloudchamber);
78066
+ const modifyRequest = {
78067
+ image: modifyArgs.image ?? config.cloudchamber.image,
78068
+ location: modifyArgs.location ?? config.cloudchamber.location,
78069
+ environment_variables: environmentVariables,
78070
+ labels,
78071
+ ssh_public_key_ids: modifyArgs.sshPublicKeyId,
78072
+ instance_type: instanceType,
78073
+ vcpu: void 0,
78074
+ memory_mib: void 0
78075
+ };
78076
+ if (instanceType === void 0) {
78077
+ modifyRequest.vcpu = vcpu;
78078
+ modifyRequest.memory_mib = memoryMib;
78079
+ }
77712
78080
  const deployment = await DeploymentsService.modifyDeploymentV2(
77713
78081
  modifyArgs.deploymentId,
77714
- {
77715
- image: modifyArgs.image ?? config.cloudchamber.image,
77716
- location: modifyArgs.location ?? config.cloudchamber.location,
77717
- environment_variables: environmentVariables,
77718
- labels,
77719
- ssh_public_key_ids: modifyArgs.sshPublicKeyId,
77720
- vcpu: modifyArgs.vcpu ?? config.cloudchamber.vcpu,
77721
- memory_mib: memoryMib
77722
- }
78082
+ modifyRequest
77723
78083
  );
77724
78084
  console.log(JSON.stringify(deployment, null, 4));
77725
78085
  return;
@@ -77807,9 +78167,11 @@ async function handleModifyCommand(args, config) {
77807
78167
  true
77808
78168
  );
77809
78169
  const memoryMib = resolveMemory(args, config.cloudchamber);
78170
+ const instanceType = await promptForInstanceType(true);
77810
78171
  renderDeploymentConfiguration("modify", {
77811
78172
  image,
77812
78173
  location: location ?? deployment.location.name,
78174
+ instanceType,
77813
78175
  vcpu: args.vcpu ?? config.cloudchamber.vcpu ?? deployment.vcpu,
77814
78176
  memoryMib: memoryMib ?? deployment.memory_mib,
77815
78177
  env: args.env,
@@ -77832,16 +78194,20 @@ async function handleModifyCommand(args, config) {
77832
78194
  "Modifying your container",
77833
78195
  "shortly your container will be modified to a new version"
77834
78196
  );
78197
+ const modifyRequest = {
78198
+ image,
78199
+ location,
78200
+ ssh_public_key_ids: keys,
78201
+ environment_variables: selectedEnvironmentVariables,
78202
+ labels: selectedLabels,
78203
+ instance_type: instanceType
78204
+ };
78205
+ if (instanceType === void 0) {
78206
+ modifyRequest.vcpu = args.vcpu ?? config.cloudchamber.vcpu;
78207
+ modifyRequest.memory_mib = memoryMib;
78208
+ }
77835
78209
  const [newDeployment, err] = await wrap2(
77836
- DeploymentsService.modifyDeploymentV2(deployment.id, {
77837
- image,
77838
- location,
77839
- ssh_public_key_ids: keys,
77840
- environment_variables: selectedEnvironmentVariables,
77841
- labels: selectedLabels,
77842
- vcpu: args.vcpu ?? config.cloudchamber.vcpu,
77843
- memory_mib: memoryMib
77844
- })
78210
+ DeploymentsService.modifyDeploymentV2(deployment.id, modifyRequest)
77845
78211
  );
77846
78212
  stop();
77847
78213
  if (err) {
@@ -153500,6 +153866,12 @@ If you are trying to develop Pages and Workers together, please use \`wrangler p
153500
153866
  "Setting upstream-protocol to http is not currently supported for remote mode.\nIf this is required in your project, please add your use case to the following issue:\nhttps://github.com/cloudflare/workers-sdk/issues/583."
153501
153867
  );
153502
153868
  }
153869
+ const needsPulling = resolved.containers?.some(
153870
+ (c6) => !isDockerfile(c6.image ?? c6.configuration.image)
153871
+ );
153872
+ if (needsPulling && !resolved.dev.remote) {
153873
+ await fillOpenAPIConfiguration(config, isNonInteractiveOrCI());
153874
+ }
153503
153875
  const queues = extractBindingsOfType("queue", resolved.bindings);
153504
153876
  if (resolved.dev.remote && (queues?.length || resolved.triggers?.some((t7) => t7.type === "queue-consumer"))) {
153505
153877
  logger.warn("Queues are not yet supported in wrangler dev remote mode.");
@@ -153524,8 +153896,10 @@ var init_ConfigController = __esm({
153524
153896
  init_import_meta_url();
153525
153897
  import_node_assert23 = __toESM(require("assert"));
153526
153898
  import_node_path57 = __toESM(require("path"));
153899
+ init_containers_shared();
153527
153900
  init_esm4();
153528
153901
  init_assets();
153902
+ init_common();
153529
153903
  init_config2();
153530
153904
  init_entry();
153531
153905
  init_dev2();
@@ -153534,6 +153908,7 @@ var init_ConfigController = __esm({
153534
153908
  init_misc_variables();
153535
153909
  init_errors();
153536
153910
  init_experimental_flags();
153911
+ init_is_interactive();
153537
153912
  init_logger();
153538
153913
  init_helpers8();
153539
153914
  init_user2();
@@ -173862,7 +174237,8 @@ async function getContainerOptions(config) {
173862
174237
  config.dev.containerBuildId
173863
174238
  ),
173864
174239
  args: container.image_vars,
173865
- imageBuildContext: container.image_build_context
174240
+ imageBuildContext: container.image_build_context,
174241
+ class_name: container.class_name
173866
174242
  });
173867
174243
  }
173868
174244
  return containers2;
@@ -178180,25 +178556,23 @@ var init_services = __esm({
178180
178556
 
178181
178557
  // src/api/integrations/platform/index.ts
178182
178558
  async function getPlatformProxy(options = {}) {
178559
+ const experimentalRemoteBindings = !!options.experimental?.remoteBindings;
178183
178560
  const env6 = options.environment;
178184
- const rawConfig = readConfig({
178561
+ const config = readConfig({
178185
178562
  config: options.configPath,
178186
178563
  env: env6
178187
178564
  });
178188
- const miniflareOptions = await run(
178189
- {
178190
- MULTIWORKER: false,
178191
- RESOURCES_PROVISION: false,
178192
- // TODO: when possible remote bindings should be made available for getPlatformProxy
178193
- REMOTE_BINDINGS: false
178194
- },
178195
- () => getMiniflareOptionsFromConfig(rawConfig, env6, options)
178196
- );
178197
- const mf = new import_miniflare31.Miniflare({
178198
- script: "",
178199
- modules: true,
178200
- ...miniflareOptions
178565
+ let remoteProxySession = void 0;
178566
+ if (experimentalRemoteBindings && config.configPath) {
178567
+ remoteProxySession = (await maybeStartOrUpdateRemoteProxySession(config.configPath) ?? {}).session;
178568
+ }
178569
+ const miniflareOptions = await getMiniflareOptionsFromConfig({
178570
+ config,
178571
+ options,
178572
+ remoteProxyConnectionString: remoteProxySession?.remoteProxyConnectionString,
178573
+ remoteBindingsEnabled: experimentalRemoteBindings
178201
178574
  });
178575
+ const mf = new import_miniflare31.Miniflare(miniflareOptions);
178202
178576
  const bindings = await mf.getBindings();
178203
178577
  const cf2 = await mf.getCf();
178204
178578
  deepFreeze(cf2);
@@ -178207,13 +178581,22 @@ async function getPlatformProxy(options = {}) {
178207
178581
  cf: cf2,
178208
178582
  ctx: new ExecutionContext(),
178209
178583
  caches: new CacheStorage(),
178210
- dispose: /* @__PURE__ */ __name(() => mf.dispose(), "dispose")
178584
+ dispose: /* @__PURE__ */ __name(async () => {
178585
+ await remoteProxySession?.dispose();
178586
+ await mf.dispose();
178587
+ }, "dispose")
178211
178588
  };
178212
178589
  }
178213
- async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
178214
- const bindings = getBindings2(rawConfig, env6, true, {});
178215
- if (rawConfig["durable_objects"]) {
178216
- const { localBindings } = partitionDurableObjectBindings(rawConfig);
178590
+ async function getMiniflareOptionsFromConfig(args) {
178591
+ const {
178592
+ config,
178593
+ options,
178594
+ remoteProxyConnectionString,
178595
+ remoteBindingsEnabled
178596
+ } = args;
178597
+ const bindings = getBindings2(config, options.environment, true, {});
178598
+ if (config["durable_objects"]) {
178599
+ const { localBindings } = partitionDurableObjectBindings(config);
178217
178600
  if (localBindings.length > 0) {
178218
178601
  logger.warn(dedent2`
178219
178602
  You have defined bindings to the following internal Durable Objects:
@@ -178226,28 +178609,28 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
178226
178609
  }
178227
178610
  }
178228
178611
  const workerDefinitions = await getBoundRegisteredWorkers({
178229
- name: rawConfig.name,
178612
+ name: config.name,
178230
178613
  services: bindings.services,
178231
- durableObjects: rawConfig["durable_objects"],
178614
+ durableObjects: config["durable_objects"],
178232
178615
  tailConsumers: []
178233
178616
  });
178234
178617
  const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions(
178235
178618
  {
178236
- name: rawConfig.name,
178237
- complianceRegion: rawConfig.compliance_region,
178619
+ name: config.name,
178620
+ complianceRegion: config.compliance_region,
178238
178621
  bindings,
178239
178622
  workerDefinitions,
178240
178623
  queueConsumers: void 0,
178241
- services: rawConfig.services,
178624
+ services: config.services,
178242
178625
  serviceBindings: {},
178243
- migrations: rawConfig.migrations,
178626
+ migrations: config.migrations,
178244
178627
  imagesLocalMode: false,
178245
178628
  tails: [],
178246
178629
  containers: void 0,
178247
178630
  containerBuildId: void 0
178248
178631
  },
178249
- void 0,
178250
- false
178632
+ remoteProxyConnectionString,
178633
+ remoteBindingsEnabled
178251
178634
  );
178252
178635
  const defaultPersistRoot = getMiniflarePersistRoot(options.persist);
178253
178636
  const serviceBindings = await getServiceBindings(bindings.services);
@@ -178256,7 +178639,7 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
178256
178639
  {
178257
178640
  script: "",
178258
178641
  modules: true,
178259
- name: rawConfig.name,
178642
+ name: config.name,
178260
178643
  ...bindingOptions,
178261
178644
  serviceBindings: {
178262
178645
  ...serviceBindings,
@@ -178267,7 +178650,11 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options) {
178267
178650
  ],
178268
178651
  defaultPersistRoot
178269
178652
  };
178270
- return miniflareOptions;
178653
+ return {
178654
+ script: "",
178655
+ modules: true,
178656
+ ...miniflareOptions
178657
+ };
178271
178658
  }
178272
178659
  function getMiniflarePersistRoot(persist) {
178273
178660
  if (persist === false) {
@@ -178381,10 +178768,10 @@ var init_platform = __esm({
178381
178768
  init_dev_registry();
178382
178769
  init_class_names_sqlite();
178383
178770
  init_miniflare();
178384
- init_experimental_flags();
178385
178771
  init_logger();
178386
178772
  init_sites();
178387
178773
  init_dedent();
178774
+ init_remoteBindings();
178388
178775
  init_caches();
178389
178776
  init_executionContext();
178390
178777
  init_services();