@fern-api/fern-api-dev 4.94.0-1-gee9b4dcf222 → 4.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +101 -224
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -80532,11 +80532,11 @@ var require_utils19 = __commonJS({
|
|
|
80532
80532
|
throw new Error(`Parameter "allowedValues" is not provided for "${ruleType}-mime-type" rule`);
|
|
80533
80533
|
if (!value2[type8])
|
|
80534
80534
|
return;
|
|
80535
|
-
for (const
|
|
80536
|
-
if (!allowedValues.includes(
|
|
80535
|
+
for (const mime3 of value2[type8]) {
|
|
80536
|
+
if (!allowedValues.includes(mime3)) {
|
|
80537
80537
|
report({
|
|
80538
|
-
message: `Mime type "${
|
|
80539
|
-
location: location2.child(value2[type8].indexOf(
|
|
80538
|
+
message: `Mime type "${mime3}" is not allowed`,
|
|
80539
|
+
location: location2.child(value2[type8].indexOf(mime3)).key()
|
|
80540
80540
|
});
|
|
80541
80541
|
}
|
|
80542
80542
|
}
|
|
@@ -80547,11 +80547,11 @@ var require_utils19 = __commonJS({
|
|
|
80547
80547
|
throw new Error(`Parameter "allowedValues" is not provided for "${ruleType}-mime-type" rule`);
|
|
80548
80548
|
if (!value2.content)
|
|
80549
80549
|
return;
|
|
80550
|
-
for (const
|
|
80551
|
-
if (!allowedValues.includes(
|
|
80550
|
+
for (const mime3 of Object.keys(value2.content)) {
|
|
80551
|
+
if (!allowedValues.includes(mime3)) {
|
|
80552
80552
|
report({
|
|
80553
|
-
message: `Mime type "${
|
|
80554
|
-
location: location2.child("content").child(
|
|
80553
|
+
message: `Mime type "${mime3}" is not allowed`,
|
|
80554
|
+
location: location2.child("content").child(mime3).key()
|
|
80555
80555
|
});
|
|
80556
80556
|
}
|
|
80557
80557
|
}
|
|
@@ -211541,9 +211541,9 @@ var require_mime_types = __commonJS({
|
|
|
211541
211541
|
return false;
|
|
211542
211542
|
}
|
|
211543
211543
|
var match3 = EXTRACT_TYPE_REGEXP.exec(type8);
|
|
211544
|
-
var
|
|
211545
|
-
if (
|
|
211546
|
-
return
|
|
211544
|
+
var mime3 = match3 && db[match3[1].toLowerCase()];
|
|
211545
|
+
if (mime3 && mime3.charset) {
|
|
211546
|
+
return mime3.charset;
|
|
211547
211547
|
}
|
|
211548
211548
|
if (match3 && TEXT_TYPE_REGEXP.test(match3[1])) {
|
|
211549
211549
|
return "UTF-8";
|
|
@@ -211554,15 +211554,15 @@ var require_mime_types = __commonJS({
|
|
|
211554
211554
|
if (!str3 || typeof str3 !== "string") {
|
|
211555
211555
|
return false;
|
|
211556
211556
|
}
|
|
211557
|
-
var
|
|
211558
|
-
if (!
|
|
211557
|
+
var mime3 = str3.indexOf("/") === -1 ? exports2.lookup(str3) : str3;
|
|
211558
|
+
if (!mime3) {
|
|
211559
211559
|
return false;
|
|
211560
211560
|
}
|
|
211561
|
-
if (
|
|
211562
|
-
var charset2 = exports2.charset(
|
|
211563
|
-
if (charset2)
|
|
211561
|
+
if (mime3.indexOf("charset") === -1) {
|
|
211562
|
+
var charset2 = exports2.charset(mime3);
|
|
211563
|
+
if (charset2) mime3 += "; charset=" + charset2.toLowerCase();
|
|
211564
211564
|
}
|
|
211565
|
-
return
|
|
211565
|
+
return mime3;
|
|
211566
211566
|
}
|
|
211567
211567
|
function extension4(type8) {
|
|
211568
211568
|
if (!type8 || typeof type8 !== "string") {
|
|
@@ -211588,8 +211588,8 @@ var require_mime_types = __commonJS({
|
|
|
211588
211588
|
function populateMaps(extensions2, types4) {
|
|
211589
211589
|
var preference = ["nginx", "apache", void 0, "iana"];
|
|
211590
211590
|
Object.keys(db).forEach(function forEachMimeType(type8) {
|
|
211591
|
-
var
|
|
211592
|
-
var exts =
|
|
211591
|
+
var mime3 = db[type8];
|
|
211592
|
+
var exts = mime3.extensions;
|
|
211593
211593
|
if (!exts || !exts.length) {
|
|
211594
211594
|
return;
|
|
211595
211595
|
}
|
|
@@ -211598,7 +211598,7 @@ var require_mime_types = __commonJS({
|
|
|
211598
211598
|
var extension5 = exts[i9];
|
|
211599
211599
|
if (types4[extension5]) {
|
|
211600
211600
|
var from4 = preference.indexOf(db[types4[extension5]].source);
|
|
211601
|
-
var to10 = preference.indexOf(
|
|
211601
|
+
var to10 = preference.indexOf(mime3.source);
|
|
211602
211602
|
if (types4[extension5] !== "application/octet-stream" && (from4 > to10 || from4 === to10 && types4[extension5].substr(0, 12) === "application/")) {
|
|
211603
211603
|
continue;
|
|
211604
211604
|
}
|
|
@@ -211898,7 +211898,7 @@ var require_form_data = __commonJS({
|
|
|
211898
211898
|
var fs28 = require("fs");
|
|
211899
211899
|
var Stream5 = require("stream").Stream;
|
|
211900
211900
|
var crypto5 = require("crypto");
|
|
211901
|
-
var
|
|
211901
|
+
var mime3 = require_mime_types();
|
|
211902
211902
|
var asynckit = require_asynckit();
|
|
211903
211903
|
var setToStringTag = require_es_set_tostringtag();
|
|
211904
211904
|
var hasOwn2 = require_hasown();
|
|
@@ -212032,16 +212032,16 @@ var require_form_data = __commonJS({
|
|
|
212032
212032
|
FormData6.prototype._getContentType = function(value2, options2) {
|
|
212033
212033
|
var contentType = options2.contentType;
|
|
212034
212034
|
if (!contentType && value2 && value2.name) {
|
|
212035
|
-
contentType =
|
|
212035
|
+
contentType = mime3.lookup(value2.name);
|
|
212036
212036
|
}
|
|
212037
212037
|
if (!contentType && value2 && value2.path) {
|
|
212038
|
-
contentType =
|
|
212038
|
+
contentType = mime3.lookup(value2.path);
|
|
212039
212039
|
}
|
|
212040
212040
|
if (!contentType && value2 && value2.readable && hasOwn2(value2, "httpVersion")) {
|
|
212041
212041
|
contentType = value2.headers["content-type"];
|
|
212042
212042
|
}
|
|
212043
212043
|
if (!contentType && (options2.filepath || options2.filename)) {
|
|
212044
|
-
contentType =
|
|
212044
|
+
contentType = mime3.lookup(options2.filepath || options2.filename);
|
|
212045
212045
|
}
|
|
212046
212046
|
if (!contentType && value2 && typeof value2 === "object") {
|
|
212047
212047
|
contentType = FormData6.DEFAULT_CONTENT_TYPE;
|
|
@@ -282126,7 +282126,7 @@ var require_type_is = __commonJS({
|
|
|
282126
282126
|
"../../../node_modules/.pnpm/type-is@1.6.18/node_modules/type-is/index.js"(exports2, module4) {
|
|
282127
282127
|
"use strict";
|
|
282128
282128
|
var typer = require_media_typer();
|
|
282129
|
-
var
|
|
282129
|
+
var mime3 = require_mime_types();
|
|
282130
282130
|
module4.exports = typeofrequest;
|
|
282131
282131
|
module4.exports.is = typeis;
|
|
282132
282132
|
module4.exports.hasBody = hasbody;
|
|
@@ -282186,7 +282186,7 @@ var require_type_is = __commonJS({
|
|
|
282186
282186
|
if (type8[0] === "+") {
|
|
282187
282187
|
return "*/*" + type8;
|
|
282188
282188
|
}
|
|
282189
|
-
return type8.indexOf("/") === -1 ?
|
|
282189
|
+
return type8.indexOf("/") === -1 ? mime3.lookup(type8) : type8;
|
|
282190
282190
|
}
|
|
282191
282191
|
function mimeMatch(expected, actual) {
|
|
282192
282192
|
if (expected === false) {
|
|
@@ -284305,16 +284305,16 @@ var require_mime = __commonJS({
|
|
|
284305
284305
|
var type8 = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
|
|
284306
284306
|
return this.extensions[type8];
|
|
284307
284307
|
};
|
|
284308
|
-
var
|
|
284309
|
-
|
|
284310
|
-
|
|
284311
|
-
|
|
284312
|
-
|
|
284308
|
+
var mime3 = new Mime();
|
|
284309
|
+
mime3.define(require_types22());
|
|
284310
|
+
mime3.default_type = mime3.lookup("bin");
|
|
284311
|
+
mime3.Mime = Mime;
|
|
284312
|
+
mime3.charsets = {
|
|
284313
284313
|
lookup: function(mimeType, fallback2) {
|
|
284314
284314
|
return /^text\/|^application\/(javascript|json)/.test(mimeType) ? "UTF-8" : fallback2;
|
|
284315
284315
|
}
|
|
284316
284316
|
};
|
|
284317
|
-
module4.exports =
|
|
284317
|
+
module4.exports = mime3;
|
|
284318
284318
|
}
|
|
284319
284319
|
});
|
|
284320
284320
|
|
|
@@ -284412,7 +284412,7 @@ var require_send = __commonJS({
|
|
|
284412
284412
|
var etag = require_etag();
|
|
284413
284413
|
var fresh = require_fresh();
|
|
284414
284414
|
var fs28 = require("fs");
|
|
284415
|
-
var
|
|
284415
|
+
var mime3 = require_mime();
|
|
284416
284416
|
var ms5 = require_ms();
|
|
284417
284417
|
var onFinished = require_on_finished();
|
|
284418
284418
|
var parseRange = require_range_parser();
|
|
@@ -284429,7 +284429,7 @@ var require_send = __commonJS({
|
|
|
284429
284429
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
284430
284430
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
284431
284431
|
module4.exports = send;
|
|
284432
|
-
module4.exports.mime =
|
|
284432
|
+
module4.exports.mime = mime3;
|
|
284433
284433
|
function send(req, path104, options2) {
|
|
284434
284434
|
return new SendStream(req, path104, options2);
|
|
284435
284435
|
}
|
|
@@ -284807,12 +284807,12 @@ var require_send = __commonJS({
|
|
|
284807
284807
|
SendStream.prototype.type = function type8(path104) {
|
|
284808
284808
|
var res = this.res;
|
|
284809
284809
|
if (res.getHeader("Content-Type")) return;
|
|
284810
|
-
var type9 =
|
|
284810
|
+
var type9 = mime3.lookup(path104);
|
|
284811
284811
|
if (!type9) {
|
|
284812
284812
|
debug9("no content-type");
|
|
284813
284813
|
return;
|
|
284814
284814
|
}
|
|
284815
|
-
var charset =
|
|
284815
|
+
var charset = mime3.charsets.lookup(type9);
|
|
284816
284816
|
debug9("content-type %s", type9);
|
|
284817
284817
|
res.setHeader("Content-Type", type9 + (charset ? "; charset=" + charset : ""));
|
|
284818
284818
|
};
|
|
@@ -285782,7 +285782,7 @@ var require_utils29 = __commonJS({
|
|
|
285782
285782
|
var contentType = require_content_type();
|
|
285783
285783
|
var deprecate2 = require_depd()("express");
|
|
285784
285784
|
var flatten3 = require_array_flatten();
|
|
285785
|
-
var
|
|
285785
|
+
var mime3 = require_send().mime;
|
|
285786
285786
|
var etag = require_etag();
|
|
285787
285787
|
var proxyaddr = require_proxy_addr();
|
|
285788
285788
|
var qs9 = require_lib3();
|
|
@@ -285799,7 +285799,7 @@ var require_utils29 = __commonJS({
|
|
|
285799
285799
|
"utils.flatten: use array-flatten npm module instead"
|
|
285800
285800
|
);
|
|
285801
285801
|
exports2.normalizeType = function(type8) {
|
|
285802
|
-
return ~type8.indexOf("/") ? acceptParams(type8) : { value:
|
|
285802
|
+
return ~type8.indexOf("/") ? acceptParams(type8) : { value: mime3.lookup(type8), params: {} };
|
|
285803
285803
|
};
|
|
285804
285804
|
exports2.normalizeTypes = function(types4) {
|
|
285805
285805
|
var ret = [];
|
|
@@ -286688,7 +286688,7 @@ var require_accepts = __commonJS({
|
|
|
286688
286688
|
"../../../node_modules/.pnpm/accepts@1.3.8/node_modules/accepts/index.js"(exports2, module4) {
|
|
286689
286689
|
"use strict";
|
|
286690
286690
|
var Negotiator = require_negotiator();
|
|
286691
|
-
var
|
|
286691
|
+
var mime3 = require_mime_types();
|
|
286692
286692
|
module4.exports = Accepts;
|
|
286693
286693
|
function Accepts(req) {
|
|
286694
286694
|
if (!(this instanceof Accepts)) {
|
|
@@ -286756,7 +286756,7 @@ var require_accepts = __commonJS({
|
|
|
286756
286756
|
return this.negotiator.languages(languages)[0] || false;
|
|
286757
286757
|
};
|
|
286758
286758
|
function extToMime(type8) {
|
|
286759
|
-
return type8.indexOf("/") === -1 ?
|
|
286759
|
+
return type8.indexOf("/") === -1 ? mime3.lookup(type8) : type8;
|
|
286760
286760
|
}
|
|
286761
286761
|
function validMime(type8) {
|
|
286762
286762
|
return typeof type8 === "string";
|
|
@@ -287139,7 +287139,7 @@ var require_response = __commonJS({
|
|
|
287139
287139
|
var cookie = require_cookie();
|
|
287140
287140
|
var send = require_send();
|
|
287141
287141
|
var extname2 = path103.extname;
|
|
287142
|
-
var
|
|
287142
|
+
var mime3 = send.mime;
|
|
287143
287143
|
var resolve15 = path103.resolve;
|
|
287144
287144
|
var vary = require_vary();
|
|
287145
287145
|
var res = Object.create(http13.ServerResponse.prototype);
|
|
@@ -287403,7 +287403,7 @@ var require_response = __commonJS({
|
|
|
287403
287403
|
return this.sendFile(fullPath, opts, done);
|
|
287404
287404
|
};
|
|
287405
287405
|
res.contentType = res.type = function contentType(type8) {
|
|
287406
|
-
var ct8 = type8.indexOf("/") === -1 ?
|
|
287406
|
+
var ct8 = type8.indexOf("/") === -1 ? mime3.lookup(type8) : type8;
|
|
287407
287407
|
return this.set("Content-Type", ct8);
|
|
287408
287408
|
};
|
|
287409
287409
|
res.format = function(obj) {
|
|
@@ -287451,7 +287451,7 @@ var require_response = __commonJS({
|
|
|
287451
287451
|
throw new TypeError("Content-Type cannot be set to an Array");
|
|
287452
287452
|
}
|
|
287453
287453
|
if (!charsetRegExp.test(value2)) {
|
|
287454
|
-
var charset =
|
|
287454
|
+
var charset = mime3.charsets.lookup(value2.split(";")[0]);
|
|
287455
287455
|
if (charset) value2 += "; charset=" + charset.toLowerCase();
|
|
287456
287456
|
}
|
|
287457
287457
|
}
|
|
@@ -505109,18 +505109,18 @@ var fileProcessor = (schema2, _ctx, json3, _params) => {
|
|
|
505109
505109
|
format: "binary",
|
|
505110
505110
|
contentEncoding: "binary"
|
|
505111
505111
|
};
|
|
505112
|
-
const { minimum, maximum, mime:
|
|
505112
|
+
const { minimum, maximum, mime: mime3 } = schema2._zod.bag;
|
|
505113
505113
|
if (minimum !== void 0)
|
|
505114
505114
|
file4.minLength = minimum;
|
|
505115
505115
|
if (maximum !== void 0)
|
|
505116
505116
|
file4.maxLength = maximum;
|
|
505117
|
-
if (
|
|
505118
|
-
if (
|
|
505119
|
-
file4.contentMediaType =
|
|
505117
|
+
if (mime3) {
|
|
505118
|
+
if (mime3.length === 1) {
|
|
505119
|
+
file4.contentMediaType = mime3[0];
|
|
505120
505120
|
Object.assign(_json, file4);
|
|
505121
505121
|
} else {
|
|
505122
505122
|
Object.assign(_json, file4);
|
|
505123
|
-
_json.anyOf =
|
|
505123
|
+
_json.anyOf = mime3.map((m7) => ({ contentMediaType: m7 }));
|
|
505124
505124
|
}
|
|
505125
505125
|
} else {
|
|
505126
505126
|
Object.assign(_json, file4);
|
|
@@ -579376,7 +579376,7 @@ function fromDataURI(uri, asBlob, options2) {
|
|
|
579376
579376
|
if (!match3) {
|
|
579377
579377
|
throw new AxiosError_default("Invalid URL", AxiosError_default.ERR_INVALID_URL);
|
|
579378
579378
|
}
|
|
579379
|
-
const
|
|
579379
|
+
const mime3 = match3[1];
|
|
579380
579380
|
const isBase64 = match3[2];
|
|
579381
579381
|
const body = match3[3];
|
|
579382
579382
|
const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8");
|
|
@@ -579384,7 +579384,7 @@ function fromDataURI(uri, asBlob, options2) {
|
|
|
579384
579384
|
if (!_Blob) {
|
|
579385
579385
|
throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
|
|
579386
579386
|
}
|
|
579387
|
-
return new _Blob([buffer], { type:
|
|
579387
|
+
return new _Blob([buffer], { type: mime3 });
|
|
579388
579388
|
}
|
|
579389
579389
|
return buffer;
|
|
579390
579390
|
}
|
|
@@ -618020,7 +618020,7 @@ var AccessTokenPosthogManager = class {
|
|
|
618020
618020
|
properties: {
|
|
618021
618021
|
...event,
|
|
618022
618022
|
...event.properties,
|
|
618023
|
-
version: "4.94.0
|
|
618023
|
+
version: "4.94.0",
|
|
618024
618024
|
usingAccessToken: true
|
|
618025
618025
|
}
|
|
618026
618026
|
});
|
|
@@ -618074,7 +618074,7 @@ var UserPosthogManager = class {
|
|
|
618074
618074
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
618075
618075
|
event: "CLI",
|
|
618076
618076
|
properties: {
|
|
618077
|
-
version: "4.94.0
|
|
618077
|
+
version: "4.94.0",
|
|
618078
618078
|
...event,
|
|
618079
618079
|
...event.properties,
|
|
618080
618080
|
usingAccessToken: false,
|
|
@@ -797015,7 +797015,6 @@ function convertAvailability5(availability) {
|
|
|
797015
797015
|
// ../docs-resolver/lib/stitchGlobalTheme.js
|
|
797016
797016
|
init_lib6();
|
|
797017
797017
|
var import_promises63 = require("fs/promises");
|
|
797018
|
-
var import_mime_types = __toESM(require_mime_types(), 1);
|
|
797019
797018
|
var import_path53 = __toESM(require("path"), 1);
|
|
797020
797019
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
797021
797020
|
function isPresignedUrl(value2) {
|
|
@@ -797024,52 +797023,21 @@ function isPresignedUrl(value2) {
|
|
|
797024
797023
|
function isRemoteUrl(value2) {
|
|
797025
797024
|
return value2.startsWith("http://") || value2.startsWith("https://");
|
|
797026
797025
|
}
|
|
797027
|
-
function parseFilenameFromDisposition(value2) {
|
|
797028
|
-
if (value2 == null) {
|
|
797029
|
-
return void 0;
|
|
797030
|
-
}
|
|
797031
|
-
const match3 = value2.match(/filename\*?=(?:"([^"]+)"|([^;]+))/i);
|
|
797032
|
-
const name2 = match3?.[1] ?? match3?.[2]?.trim();
|
|
797033
|
-
return name2 != null && import_path53.default.extname(name2) !== "" ? name2 : void 0;
|
|
797034
|
-
}
|
|
797035
|
-
function filenameFromUrl(url3) {
|
|
797036
|
-
try {
|
|
797037
|
-
const params2 = new URL(url3).searchParams;
|
|
797038
|
-
const rcd = params2.get("response-content-disposition");
|
|
797039
|
-
return parseFilenameFromDisposition(rcd);
|
|
797040
|
-
} catch {
|
|
797041
|
-
return void 0;
|
|
797042
|
-
}
|
|
797043
|
-
}
|
|
797044
797026
|
async function downloadToTemp(url3, tmpDir, index3) {
|
|
797045
|
-
const
|
|
797027
|
+
const ext2 = (() => {
|
|
797028
|
+
try {
|
|
797029
|
+
const pathname = new URL(url3).pathname;
|
|
797030
|
+
const dot = pathname.lastIndexOf(".");
|
|
797031
|
+
return dot >= 0 ? pathname.slice(dot) : "";
|
|
797032
|
+
} catch {
|
|
797033
|
+
return "";
|
|
797034
|
+
}
|
|
797035
|
+
})();
|
|
797036
|
+
const dest = import_path53.default.join(tmpDir, `theme_asset_${index3}${ext2}`);
|
|
797046
797037
|
const res = await fetch(url3);
|
|
797047
797038
|
if (!res.ok) {
|
|
797048
797039
|
throw new Error(`Failed to download theme asset: ${res.status} ${url3}`);
|
|
797049
797040
|
}
|
|
797050
|
-
const cdFilename = parseFilenameFromDisposition(res.headers.get("content-disposition"));
|
|
797051
|
-
const filename = urlFilename ?? cdFilename ?? (() => {
|
|
797052
|
-
const ext2 = (() => {
|
|
797053
|
-
const contentType = res.headers.get("content-type")?.split(";")[0]?.trim();
|
|
797054
|
-
if (contentType) {
|
|
797055
|
-
const mapped = import_mime_types.default.extension(contentType);
|
|
797056
|
-
if (mapped) {
|
|
797057
|
-
return `.${mapped}`;
|
|
797058
|
-
}
|
|
797059
|
-
}
|
|
797060
|
-
return "";
|
|
797061
|
-
})() || (() => {
|
|
797062
|
-
try {
|
|
797063
|
-
const pathname = new URL(url3).pathname;
|
|
797064
|
-
const dot = pathname.lastIndexOf(".");
|
|
797065
|
-
return dot >= 0 ? pathname.slice(dot) : "";
|
|
797066
|
-
} catch {
|
|
797067
|
-
return "";
|
|
797068
|
-
}
|
|
797069
|
-
})();
|
|
797070
|
-
return `theme_asset_${index3}${ext2}`;
|
|
797071
|
-
})();
|
|
797072
|
-
const dest = import_path53.default.join(tmpDir, filename);
|
|
797073
797041
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
797074
797042
|
await (0, import_promises63.writeFile)(dest, buf);
|
|
797075
797043
|
return dest;
|
|
@@ -829198,7 +829166,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
829198
829166
|
var LOGS_FOLDER_NAME = "logs";
|
|
829199
829167
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
829200
829168
|
function getCliSource() {
|
|
829201
|
-
const version7 = "4.94.0
|
|
829169
|
+
const version7 = "4.94.0";
|
|
829202
829170
|
return `cli@${version7}`;
|
|
829203
829171
|
}
|
|
829204
829172
|
var DebugLogger = class {
|
|
@@ -840085,7 +840053,7 @@ init_lib6();
|
|
|
840085
840053
|
var import_crypto8 = require("crypto");
|
|
840086
840054
|
var import_promises94 = require("fs/promises");
|
|
840087
840055
|
init_lodash();
|
|
840088
|
-
var
|
|
840056
|
+
var mime = __toESM(require_mime_types(), 1);
|
|
840089
840057
|
|
|
840090
840058
|
// ../generation/remote-generation/remote-workspace-runner/lib/measureImageSizes.js
|
|
840091
840059
|
init_lib4();
|
|
@@ -840246,7 +840214,7 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
|
|
|
840246
840214
|
const sanitizedToAbsoluteMap = new Map(filesWithSanitizedPaths.map((file4) => [file4.sanitizedPath, file4.absoluteFilePath]));
|
|
840247
840215
|
const filesWithMimeType = filesWithSanitizedPaths.map((fileMetadata) => ({
|
|
840248
840216
|
...fileMetadata,
|
|
840249
|
-
mediaType:
|
|
840217
|
+
mediaType: mime.lookup(fileMetadata.absoluteFilePath)
|
|
840250
840218
|
})).filter((fileMetadata) => fileMetadata.mediaType !== false);
|
|
840251
840219
|
const imagesToMeasure = filesWithMimeType.filter((file4) => MediaType.parse(file4.mediaType)?.isImage() ?? false).map((file4) => file4.absoluteFilePath);
|
|
840252
840220
|
const measuredImages = await measureImageSizes(imagesToMeasure, MEASURE_IMAGE_BATCH_SIZE, context3);
|
|
@@ -840526,7 +840494,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
840526
840494
|
const absoluteFilePath = sanitizedToAbsoluteMap.get(key2) || resolve6(docsWorkspacePath, RelativeFilePath2.of(key2));
|
|
840527
840495
|
try {
|
|
840528
840496
|
const uploadUrl = extractUploadUrl(urlValue);
|
|
840529
|
-
const mimeType =
|
|
840497
|
+
const mimeType = mime.lookup(absoluteFilePath);
|
|
840530
840498
|
await axios_default.put(uploadUrl, await (0, import_promises94.readFile)(absoluteFilePath), {
|
|
840531
840499
|
headers: {
|
|
840532
840500
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
@@ -841161,7 +841129,7 @@ var LegacyDocsPublisher = class {
|
|
|
841161
841129
|
previewId,
|
|
841162
841130
|
disableTemplates: void 0,
|
|
841163
841131
|
skipUpload,
|
|
841164
|
-
cliVersion: "4.94.0
|
|
841132
|
+
cliVersion: "4.94.0",
|
|
841165
841133
|
loginCommand: "fern auth login"
|
|
841166
841134
|
});
|
|
841167
841135
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -842248,30 +842216,9 @@ var import_child_process8 = require("child_process");
|
|
|
842248
842216
|
var import_crypto9 = require("crypto");
|
|
842249
842217
|
var import_promises96 = require("fs/promises");
|
|
842250
842218
|
init_js_yaml();
|
|
842251
|
-
var
|
|
842219
|
+
var import_mime_types = __toESM(require_mime_types(), 1);
|
|
842252
842220
|
var import_path63 = __toESM(require("path"), 1);
|
|
842253
842221
|
var FDR_ORIGIN2 = process.env.FERN_FDR_ORIGIN ?? "https://registry-dev2.buildwithfern.com" ?? "https://registry.buildwithfern.com";
|
|
842254
|
-
function describeFetchError(error50) {
|
|
842255
|
-
if (!(error50 instanceof Error)) {
|
|
842256
|
-
return String(error50);
|
|
842257
|
-
}
|
|
842258
|
-
const cause = error50.cause;
|
|
842259
|
-
if (cause instanceof Error) {
|
|
842260
|
-
return cause.message;
|
|
842261
|
-
}
|
|
842262
|
-
return error50.message;
|
|
842263
|
-
}
|
|
842264
|
-
function parseErrorDetail(body) {
|
|
842265
|
-
try {
|
|
842266
|
-
const parsed = JSON.parse(body);
|
|
842267
|
-
const message = parsed.message ?? parsed.error?.message;
|
|
842268
|
-
if (typeof message === "string") {
|
|
842269
|
-
return message;
|
|
842270
|
-
}
|
|
842271
|
-
} catch {
|
|
842272
|
-
}
|
|
842273
|
-
return void 0;
|
|
842274
|
-
}
|
|
842275
842222
|
function getGitRoot() {
|
|
842276
842223
|
try {
|
|
842277
842224
|
return (0, import_child_process8.execSync)("git rev-parse --show-toplevel", { encoding: "utf-8" }).trim();
|
|
@@ -842284,81 +842231,49 @@ function posixBindPath(gitRoot, absolutePath) {
|
|
|
842284
842231
|
const relative5 = import_path63.default.relative(gitRoot, absolutePath);
|
|
842285
842232
|
return [repoName, ...relative5.split(import_path63.default.sep)].join("/");
|
|
842286
842233
|
}
|
|
842287
|
-
async function uploadToCas(content5, contentType, bindPath, orgId, token, label
|
|
842234
|
+
async function uploadToCas(content5, contentType, bindPath, orgId, token, label) {
|
|
842288
842235
|
const hash5 = (0, import_crypto9.createHash)("sha256").update(content5).digest("hex");
|
|
842289
842236
|
const casUrl = `${FDR_ORIGIN2}/v2/registry/content/${hash5}?orgId=${encodeURIComponent(orgId)}`;
|
|
842290
|
-
|
|
842291
|
-
|
|
842292
|
-
|
|
842293
|
-
|
|
842294
|
-
|
|
842295
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
842296
|
-
body: JSON.stringify({ contentType, contentLength: content5.byteLength })
|
|
842297
|
-
});
|
|
842298
|
-
} catch (err) {
|
|
842299
|
-
throw new CliError({
|
|
842300
|
-
message: `CAS check for ${label} failed \u2014 could not reach ${FDR_ORIGIN2}: ${describeFetchError(err)}`,
|
|
842301
|
-
code: CliError.Code.NetworkError
|
|
842302
|
-
});
|
|
842303
|
-
}
|
|
842237
|
+
const checkRes = await fetch(casUrl, {
|
|
842238
|
+
method: "PUT",
|
|
842239
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
842240
|
+
body: JSON.stringify({ contentType, contentLength: content5.byteLength })
|
|
842241
|
+
});
|
|
842304
842242
|
if (!checkRes.ok) {
|
|
842305
842243
|
const errorBody = await checkRes.text();
|
|
842306
|
-
const detail = parseErrorDetail(errorBody) ?? errorBody;
|
|
842307
842244
|
throw new CliError({
|
|
842308
|
-
message: `CAS check failed for ${label}: HTTP ${checkRes.status} \u2014 ${
|
|
842245
|
+
message: `CAS check failed for ${label}: HTTP ${checkRes.status} \u2014 ${errorBody}`,
|
|
842309
842246
|
code: CliError.Code.NetworkError
|
|
842310
842247
|
});
|
|
842311
842248
|
}
|
|
842312
842249
|
const checkBody = await checkRes.json();
|
|
842313
|
-
context3.stdout.debug(` CAS status for ${label}: ${checkBody.status}`);
|
|
842314
842250
|
if (checkBody.status === "upload_required" && checkBody.uploadUrl != null) {
|
|
842315
|
-
|
|
842316
|
-
|
|
842317
|
-
|
|
842318
|
-
|
|
842319
|
-
|
|
842320
|
-
headers: { "Content-Type": contentType },
|
|
842321
|
-
body: new Uint8Array(content5.buffer, content5.byteOffset, content5.byteLength)
|
|
842322
|
-
});
|
|
842323
|
-
} catch (err) {
|
|
842324
|
-
throw new CliError({
|
|
842325
|
-
message: `S3 upload for ${label} failed \u2014 could not reach upload URL: ${describeFetchError(err)}`,
|
|
842326
|
-
code: CliError.Code.NetworkError
|
|
842327
|
-
});
|
|
842328
|
-
}
|
|
842251
|
+
const uploadRes = await fetch(checkBody.uploadUrl, {
|
|
842252
|
+
method: "PUT",
|
|
842253
|
+
headers: { "Content-Type": contentType },
|
|
842254
|
+
body: new Uint8Array(content5.buffer, content5.byteOffset, content5.byteLength)
|
|
842255
|
+
});
|
|
842329
842256
|
if (!uploadRes.ok) {
|
|
842330
|
-
const errorBody = await uploadRes.text().catch(() => "");
|
|
842331
842257
|
throw new CliError({
|
|
842332
|
-
message: `S3 upload failed for ${label}: HTTP ${uploadRes.status}
|
|
842258
|
+
message: `S3 upload failed for ${label}: HTTP ${uploadRes.status}`,
|
|
842333
842259
|
code: CliError.Code.NetworkError
|
|
842334
842260
|
});
|
|
842335
842261
|
}
|
|
842336
842262
|
}
|
|
842337
|
-
const
|
|
842338
|
-
|
|
842339
|
-
|
|
842340
|
-
|
|
842341
|
-
|
|
842342
|
-
method: "PUT",
|
|
842343
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
842344
|
-
body: JSON.stringify({ hash: hash5, contentType })
|
|
842345
|
-
});
|
|
842346
|
-
} catch (err) {
|
|
842347
|
-
throw new CliError({
|
|
842348
|
-
message: `File bind for ${label} failed \u2014 could not reach ${FDR_ORIGIN2}: ${describeFetchError(err)}`,
|
|
842349
|
-
code: CliError.Code.NetworkError
|
|
842350
|
-
});
|
|
842351
|
-
}
|
|
842263
|
+
const bindRes = await fetch(`${FDR_ORIGIN2}/v2/registry/files/${orgId}/${bindPath}`, {
|
|
842264
|
+
method: "PUT",
|
|
842265
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
842266
|
+
body: JSON.stringify({ hash: hash5, contentType })
|
|
842267
|
+
});
|
|
842352
842268
|
if (!bindRes.ok) {
|
|
842353
|
-
const errorBody = await bindRes.text().catch(() => "");
|
|
842354
842269
|
throw new CliError({
|
|
842355
|
-
message: `File bind failed for ${label}: HTTP ${bindRes.status}
|
|
842270
|
+
message: `File bind failed for ${label}: HTTP ${bindRes.status}`,
|
|
842356
842271
|
code: CliError.Code.NetworkError
|
|
842357
842272
|
});
|
|
842358
842273
|
}
|
|
842359
842274
|
return hash5;
|
|
842360
842275
|
}
|
|
842361
|
-
async function uploadFileToCas(absolutePath, orgId, token, gitRoot
|
|
842276
|
+
async function uploadFileToCas(absolutePath, orgId, token, gitRoot) {
|
|
842362
842277
|
try {
|
|
842363
842278
|
await (0, import_promises96.access)(absolutePath);
|
|
842364
842279
|
} catch {
|
|
@@ -842368,9 +842283,9 @@ async function uploadFileToCas(absolutePath, orgId, token, gitRoot, context3) {
|
|
|
842368
842283
|
});
|
|
842369
842284
|
}
|
|
842370
842285
|
const content5 = await (0, import_promises96.readFile)(absolutePath);
|
|
842371
|
-
const contentType =
|
|
842286
|
+
const contentType = import_mime_types.default.lookup(absolutePath) || "application/octet-stream";
|
|
842372
842287
|
const bindPath = posixBindPath(gitRoot, absolutePath);
|
|
842373
|
-
return uploadToCas(content5, contentType, bindPath, orgId, token, import_path63.default.basename(absolutePath)
|
|
842288
|
+
return uploadToCas(content5, contentType, bindPath, orgId, token, import_path63.default.basename(absolutePath));
|
|
842374
842289
|
}
|
|
842375
842290
|
async function processFileField(value2, themeDir, orgId, token, gitRoot, context3) {
|
|
842376
842291
|
if (value2 == null) {
|
|
@@ -842381,39 +842296,26 @@ async function processFileField(value2, themeDir, orgId, token, gitRoot, context
|
|
|
842381
842296
|
}
|
|
842382
842297
|
const abs = import_path63.default.resolve(themeDir, value2);
|
|
842383
842298
|
context3.stdout.debug(` Uploading ${value2}...`);
|
|
842384
|
-
const hash5 = await uploadFileToCas(abs, orgId, token, gitRoot
|
|
842299
|
+
const hash5 = await uploadFileToCas(abs, orgId, token, gitRoot);
|
|
842385
842300
|
return { hash: hash5 };
|
|
842386
842301
|
}
|
|
842387
842302
|
async function processThemeConfig(raw, themeDir, orgId, token, gitRoot, context3) {
|
|
842388
842303
|
const cfg = { ...raw };
|
|
842389
|
-
|
|
842390
|
-
const field5 = async (v6) => {
|
|
842391
|
-
const result = await processFileField(v6, themeDir, orgId, token, gitRoot, context3);
|
|
842392
|
-
if (result != null && typeof result === "object") {
|
|
842393
|
-
filesUploaded++;
|
|
842394
|
-
}
|
|
842395
|
-
return result;
|
|
842396
|
-
};
|
|
842304
|
+
const field5 = (v6) => processFileField(v6, themeDir, orgId, token, gitRoot, context3);
|
|
842397
842305
|
if (cfg.logo != null && typeof cfg.logo === "object") {
|
|
842398
|
-
context3.stdout.debug("Processing logo...");
|
|
842399
842306
|
const logo = { ...cfg.logo };
|
|
842400
842307
|
logo.dark = await field5(logo.dark);
|
|
842401
842308
|
logo.light = await field5(logo.light);
|
|
842402
842309
|
cfg.logo = logo;
|
|
842403
842310
|
}
|
|
842404
|
-
if (cfg.favicon != null) {
|
|
842405
|
-
context3.stdout.debug("Processing favicon...");
|
|
842406
|
-
}
|
|
842407
842311
|
cfg.favicon = await field5(cfg.favicon);
|
|
842408
842312
|
if (cfg["background-image"] != null && typeof cfg["background-image"] === "object") {
|
|
842409
|
-
context3.stdout.debug("Processing background-image...");
|
|
842410
842313
|
const bg2 = { ...cfg["background-image"] };
|
|
842411
842314
|
bg2.dark = await field5(bg2.dark);
|
|
842412
842315
|
bg2.light = await field5(bg2.light);
|
|
842413
842316
|
cfg["background-image"] = bg2;
|
|
842414
842317
|
}
|
|
842415
842318
|
if (cfg.typography != null && typeof cfg.typography === "object") {
|
|
842416
|
-
context3.stdout.debug("Processing typography fonts...");
|
|
842417
842319
|
const typo = { ...cfg.typography };
|
|
842418
842320
|
for (const fontKey of ["bodyFont", "headingsFont", "codeFont"]) {
|
|
842419
842321
|
const font = typo[fontKey];
|
|
@@ -842435,12 +842337,10 @@ async function processThemeConfig(raw, themeDir, orgId, token, gitRoot, context3
|
|
|
842435
842337
|
}
|
|
842436
842338
|
if (cfg.css != null) {
|
|
842437
842339
|
const cssList = Array.isArray(cfg.css) ? cfg.css : [cfg.css];
|
|
842438
|
-
context3.stdout.debug(`Processing ${cssList.length} CSS file(s)...`);
|
|
842439
842340
|
cfg.css = await Promise.all(cssList.map((item) => typeof item === "string" ? field5(item) : item));
|
|
842440
842341
|
}
|
|
842441
842342
|
if (cfg.js != null) {
|
|
842442
842343
|
const jsList = Array.isArray(cfg.js) ? cfg.js : [cfg.js];
|
|
842443
|
-
context3.stdout.debug(`Processing ${jsList.length} JS file(s)...`);
|
|
842444
842344
|
cfg.js = await Promise.all(jsList.map(async (entry) => {
|
|
842445
842345
|
if (typeof entry === "string") {
|
|
842446
842346
|
return field5(entry);
|
|
@@ -842458,16 +842358,9 @@ async function processThemeConfig(raw, themeDir, orgId, token, gitRoot, context3
|
|
|
842458
842358
|
return entry;
|
|
842459
842359
|
}));
|
|
842460
842360
|
}
|
|
842461
|
-
if (cfg.header != null) {
|
|
842462
|
-
context3.stdout.debug("Processing header component...");
|
|
842463
|
-
}
|
|
842464
842361
|
cfg.header = await field5(cfg.header);
|
|
842465
|
-
if (cfg.footer != null) {
|
|
842466
|
-
context3.stdout.debug("Processing footer component...");
|
|
842467
|
-
}
|
|
842468
842362
|
cfg.footer = await field5(cfg.footer);
|
|
842469
842363
|
if (cfg.metadata != null && typeof cfg.metadata === "object") {
|
|
842470
|
-
context3.stdout.debug("Processing metadata images...");
|
|
842471
842364
|
const meta5 = { ...cfg.metadata };
|
|
842472
842365
|
for (const imgKey of ["og:image", "twitter:image", "og:background-image", "og:logo"]) {
|
|
842473
842366
|
if (typeof meta5[imgKey] === "string") {
|
|
@@ -842476,7 +842369,7 @@ async function processThemeConfig(raw, themeDir, orgId, token, gitRoot, context3
|
|
|
842476
842369
|
}
|
|
842477
842370
|
cfg.metadata = meta5;
|
|
842478
842371
|
}
|
|
842479
|
-
return
|
|
842372
|
+
return cfg;
|
|
842480
842373
|
}
|
|
842481
842374
|
var UploadThemeCommand = class {
|
|
842482
842375
|
async handle(context3, args) {
|
|
@@ -842499,32 +842392,16 @@ var UploadThemeCommand = class {
|
|
|
842499
842392
|
throw new CliError({ message: "theme.yml must be a YAML object", code: CliError.Code.ConfigError });
|
|
842500
842393
|
}
|
|
842501
842394
|
context3.stdout.info(`Uploading theme "${args.name}" for org "${orgId}"...`);
|
|
842502
|
-
|
|
842503
|
-
|
|
842504
|
-
|
|
842505
|
-
|
|
842506
|
-
|
|
842507
|
-
}
|
|
842508
|
-
const saveUrl = `${FDR_ORIGIN2}/v2/registry/themes/${orgId}`;
|
|
842509
|
-
context3.stdout.debug(`Saving theme to ${saveUrl}`);
|
|
842510
|
-
let res;
|
|
842511
|
-
try {
|
|
842512
|
-
res = await fetch(saveUrl, {
|
|
842513
|
-
method: "POST",
|
|
842514
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token.value}` },
|
|
842515
|
-
body: JSON.stringify({ name: args.name, config: processedConfig })
|
|
842516
|
-
});
|
|
842517
|
-
} catch (err) {
|
|
842518
|
-
throw new CliError({
|
|
842519
|
-
message: `Failed to save theme "${args.name}" \u2014 could not reach ${FDR_ORIGIN2}: ${describeFetchError(err)}`,
|
|
842520
|
-
code: CliError.Code.NetworkError
|
|
842521
|
-
});
|
|
842522
|
-
}
|
|
842395
|
+
const processedConfig = await processThemeConfig(rawYaml, themeDir, orgId, token.value, gitRoot, context3);
|
|
842396
|
+
const res = await fetch(`${FDR_ORIGIN2}/v2/registry/themes/${orgId}`, {
|
|
842397
|
+
method: "POST",
|
|
842398
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token.value}` },
|
|
842399
|
+
body: JSON.stringify({ name: args.name, config: processedConfig })
|
|
842400
|
+
});
|
|
842523
842401
|
if (!res.ok) {
|
|
842524
842402
|
const body = await res.text();
|
|
842525
|
-
const detail = parseErrorDetail(body) ?? body;
|
|
842526
842403
|
throw new CliError({
|
|
842527
|
-
message: `Failed to save theme
|
|
842404
|
+
message: `Failed to save theme: HTTP ${res.status} \u2014 ${body}`,
|
|
842528
842405
|
code: CliError.Code.NetworkError
|
|
842529
842406
|
});
|
|
842530
842407
|
}
|
|
@@ -915624,7 +915501,7 @@ var CliContext = class _CliContext {
|
|
|
915624
915501
|
if (false) {
|
|
915625
915502
|
this.logger.error("CLI_VERSION is not defined");
|
|
915626
915503
|
}
|
|
915627
|
-
return "4.94.0
|
|
915504
|
+
return "4.94.0";
|
|
915628
915505
|
}
|
|
915629
915506
|
getCliName() {
|
|
915630
915507
|
if (false) {
|
package/package.json
CHANGED