@fern-api/fern-api-dev 5.56.4 → 5.58.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 +577 -502
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -99837,8 +99837,8 @@ var require_graceful_fs = __commonJS({
|
|
|
99837
99837
|
}
|
|
99838
99838
|
var fs$appendFile = fs35.appendFile;
|
|
99839
99839
|
if (fs$appendFile)
|
|
99840
|
-
fs35.appendFile =
|
|
99841
|
-
function
|
|
99840
|
+
fs35.appendFile = appendFile4;
|
|
99841
|
+
function appendFile4(path119, data2, options2, cb) {
|
|
99842
99842
|
if (typeof options2 === "function")
|
|
99843
99843
|
cb = options2, options2 = null;
|
|
99844
99844
|
return go$appendFile(path119, data2, options2, cb);
|
|
@@ -454802,20 +454802,129 @@ var init_lib65 = __esm({
|
|
|
454802
454802
|
}
|
|
454803
454803
|
});
|
|
454804
454804
|
|
|
454805
|
-
// ../register/lib/ai-example-enhancer/
|
|
454806
|
-
|
|
454807
|
-
|
|
454808
|
-
|
|
454805
|
+
// ../register/lib/ai-example-enhancer/filterHelpers.js
|
|
454806
|
+
function isFdrTypedValueWrapper(value2) {
|
|
454807
|
+
if (value2 === null || value2 === void 0 || typeof value2 !== "object" || Array.isArray(value2)) {
|
|
454808
|
+
return false;
|
|
454809
|
+
}
|
|
454810
|
+
const obj = value2;
|
|
454811
|
+
const keys25 = Object.keys(obj);
|
|
454812
|
+
if (keys25.length === 0 || keys25.length > 2) {
|
|
454813
|
+
return false;
|
|
454814
|
+
}
|
|
454815
|
+
const hasType = "type" in obj && typeof obj.type === "string";
|
|
454816
|
+
const hasValue = "value" in obj;
|
|
454817
|
+
return hasType && keys25.length === 1 || hasType && hasValue && keys25.length === 2 || hasValue && keys25.length === 1;
|
|
454818
|
+
}
|
|
454819
|
+
function unwrapExampleValue(value2) {
|
|
454820
|
+
if (value2 === null || value2 === void 0) {
|
|
454821
|
+
return value2;
|
|
454822
|
+
}
|
|
454823
|
+
if (Array.isArray(value2)) {
|
|
454824
|
+
return value2.map(unwrapExampleValue);
|
|
454825
|
+
}
|
|
454826
|
+
if (typeof value2 !== "object") {
|
|
454827
|
+
return value2;
|
|
454828
|
+
}
|
|
454829
|
+
const obj = value2;
|
|
454830
|
+
if (isFdrTypedValueWrapper(obj)) {
|
|
454831
|
+
if ("value" in obj) {
|
|
454832
|
+
return unwrapExampleValue(obj.value);
|
|
454833
|
+
}
|
|
454834
|
+
return void 0;
|
|
454835
|
+
}
|
|
454836
|
+
const result = {};
|
|
454837
|
+
for (const [key2, val] of Object.entries(obj)) {
|
|
454838
|
+
const unwrapped = unwrapExampleValue(val);
|
|
454839
|
+
if (unwrapped !== void 0) {
|
|
454840
|
+
result[key2] = unwrapped;
|
|
454841
|
+
}
|
|
454842
|
+
}
|
|
454843
|
+
return result;
|
|
454844
|
+
}
|
|
454845
|
+
function isEmptyObject3(value2) {
|
|
454846
|
+
if (value2 === null || value2 === void 0) {
|
|
454847
|
+
return true;
|
|
454848
|
+
}
|
|
454849
|
+
if (typeof value2 !== "object") {
|
|
454850
|
+
return false;
|
|
454851
|
+
}
|
|
454852
|
+
if (Array.isArray(value2)) {
|
|
454853
|
+
return value2.length === 0;
|
|
454854
|
+
}
|
|
454855
|
+
return Object.keys(value2).length === 0;
|
|
454856
|
+
}
|
|
454857
|
+
function filterRequestBody(requestBody, pathParameters, queryParameters, headers2) {
|
|
454858
|
+
const extractedPathParams = {};
|
|
454859
|
+
const extractedQueryParams = {};
|
|
454860
|
+
const extractedHeaders = {};
|
|
454861
|
+
if (requestBody === null || requestBody === void 0 || typeof requestBody !== "object" || Array.isArray(requestBody)) {
|
|
454862
|
+
return { filteredBody: requestBody, extractedPathParams, extractedQueryParams, extractedHeaders };
|
|
454863
|
+
}
|
|
454864
|
+
const bodyRecord = requestBody;
|
|
454865
|
+
const filteredBody = {};
|
|
454866
|
+
const pathParamKeys = new Set(Object.keys(pathParameters ?? {}));
|
|
454867
|
+
const queryParamKeys = new Set(Object.keys(queryParameters ?? {}));
|
|
454868
|
+
const headerKeys = new Set(Object.keys(headers2 ?? {}));
|
|
454869
|
+
for (const [key2, value2] of Object.entries(bodyRecord)) {
|
|
454870
|
+
const normalizedKey = key2.toLowerCase().replace(/[-_]/g, "");
|
|
454871
|
+
let isPathParam = false;
|
|
454872
|
+
let isQueryParam = false;
|
|
454873
|
+
let isHeader = false;
|
|
454874
|
+
for (const pathKey of pathParamKeys) {
|
|
454875
|
+
const normalizedPathKey = pathKey.toLowerCase().replace(/[-_]/g, "");
|
|
454876
|
+
if (normalizedKey === normalizedPathKey) {
|
|
454877
|
+
isPathParam = true;
|
|
454878
|
+
extractedPathParams[pathKey] = value2;
|
|
454879
|
+
break;
|
|
454880
|
+
}
|
|
454881
|
+
}
|
|
454882
|
+
if (!isPathParam) {
|
|
454883
|
+
for (const queryKey of queryParamKeys) {
|
|
454884
|
+
const normalizedQueryKey = queryKey.toLowerCase().replace(/[-_]/g, "");
|
|
454885
|
+
if (normalizedKey === normalizedQueryKey) {
|
|
454886
|
+
isQueryParam = true;
|
|
454887
|
+
extractedQueryParams[queryKey] = value2;
|
|
454888
|
+
break;
|
|
454889
|
+
}
|
|
454890
|
+
}
|
|
454891
|
+
}
|
|
454892
|
+
if (!isPathParam && !isQueryParam) {
|
|
454893
|
+
for (const headerKey of headerKeys) {
|
|
454894
|
+
const normalizedHeaderKey = headerKey.toLowerCase().replace(/[-_]/g, "");
|
|
454895
|
+
if (normalizedKey === normalizedHeaderKey) {
|
|
454896
|
+
isHeader = true;
|
|
454897
|
+
extractedHeaders[headerKey] = value2;
|
|
454898
|
+
break;
|
|
454899
|
+
}
|
|
454900
|
+
}
|
|
454901
|
+
}
|
|
454902
|
+
if (!isPathParam && !isQueryParam && !isHeader) {
|
|
454903
|
+
filteredBody[key2] = value2;
|
|
454904
|
+
}
|
|
454905
|
+
}
|
|
454906
|
+
return { filteredBody, extractedPathParams, extractedQueryParams, extractedHeaders };
|
|
454907
|
+
}
|
|
454908
|
+
var init_filterHelpers = __esm({
|
|
454909
|
+
"../register/lib/ai-example-enhancer/filterHelpers.js"() {
|
|
454910
|
+
"use strict";
|
|
454911
|
+
}
|
|
454912
|
+
});
|
|
454913
|
+
|
|
454914
|
+
// ../register/lib/ai-example-enhancer/lambdaClient.js
|
|
454915
|
+
var DEFAULT_AI_ENHANCEMENT_MAX_RETRIES, DEFAULT_AI_ENHANCEMENT_TIMEOUT_MS, LambdaExampleEnhancer;
|
|
454916
|
+
var init_lambdaClient = __esm({
|
|
454917
|
+
"../register/lib/ai-example-enhancer/lambdaClient.js"() {
|
|
454809
454918
|
"use strict";
|
|
454810
454919
|
init_lib4();
|
|
454811
454920
|
init_lib35();
|
|
454812
454921
|
init_lib6();
|
|
454813
454922
|
DEFAULT_AI_ENHANCEMENT_MAX_RETRIES = 0;
|
|
454814
454923
|
DEFAULT_AI_ENHANCEMENT_TIMEOUT_MS = 15e3;
|
|
454815
|
-
|
|
454924
|
+
LambdaExampleEnhancer = class {
|
|
454816
454925
|
config;
|
|
454817
454926
|
context;
|
|
454818
|
-
|
|
454927
|
+
lambdaOrigin;
|
|
454819
454928
|
venusOrigin;
|
|
454820
454929
|
token;
|
|
454821
454930
|
jwtPromise;
|
|
@@ -454831,14 +454940,14 @@ var init_faiClient = __esm({
|
|
|
454831
454940
|
styleInstructions: config5.styleInstructions
|
|
454832
454941
|
};
|
|
454833
454942
|
this.context = context3;
|
|
454834
|
-
const
|
|
454835
|
-
if (!
|
|
454943
|
+
const lambdaOrigin = "https://ykq45y6fvnszd35iv5yuuatkze0rpwuz.lambda-url.us-east-1.on.aws";
|
|
454944
|
+
if (!lambdaOrigin) {
|
|
454836
454945
|
throw new CliError({
|
|
454837
|
-
message: "
|
|
454946
|
+
message: "DEFAULT_FDR_LAMBDA_DOCS_ORIGIN environment variable is not set. AI example enhancement requires this to be configured.",
|
|
454838
454947
|
code: CliError.Code.EnvironmentError
|
|
454839
454948
|
});
|
|
454840
454949
|
}
|
|
454841
|
-
this.
|
|
454950
|
+
this.lambdaOrigin = lambdaOrigin;
|
|
454842
454951
|
this.venusOrigin = "https://venus-dev2.buildwithfern.com";
|
|
454843
454952
|
this.token = token;
|
|
454844
454953
|
this.organizationId = organizationId;
|
|
@@ -454943,7 +455052,7 @@ var init_faiClient = __esm({
|
|
|
454943
455052
|
const maxAttempts = this.config.maxRetries + 1;
|
|
454944
455053
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
454945
455054
|
try {
|
|
454946
|
-
this.context.logger.debug(`Enhancing example for ${request7.method} ${request7.endpointPath} via
|
|
455055
|
+
this.context.logger.debug(`Enhancing example for ${request7.method} ${request7.endpointPath} via lambda (attempt ${attempt}/${maxAttempts})`);
|
|
454947
455056
|
const requestBody = {
|
|
454948
455057
|
method: request7.method,
|
|
454949
455058
|
endpointPath: request7.endpointPath,
|
|
@@ -454959,7 +455068,7 @@ var init_faiClient = __esm({
|
|
|
454959
455068
|
...requestBody,
|
|
454960
455069
|
openApiSpec: request7.openApiSpec ? `[OpenAPI spec present: ${request7.openApiSpec.length} chars]` : "[No OpenAPI spec]"
|
|
454961
455070
|
}, null, 2)}`);
|
|
454962
|
-
const response = await fetch(`${this.
|
|
455071
|
+
const response = await fetch(`${this.lambdaOrigin}/v2/registry/ai/enhance-example`, {
|
|
454963
455072
|
method: "POST",
|
|
454964
455073
|
headers: {
|
|
454965
455074
|
"Content-Type": "application/json",
|
|
@@ -454971,7 +455080,7 @@ var init_faiClient = __esm({
|
|
|
454971
455080
|
if (!response.ok) {
|
|
454972
455081
|
const errorText = await response.text();
|
|
454973
455082
|
throw new CliError({
|
|
454974
|
-
message: `
|
|
455083
|
+
message: `Lambda returned ${response.status}: ${errorText || response.statusText}`,
|
|
454975
455084
|
code: CliError.Code.NetworkError
|
|
454976
455085
|
});
|
|
454977
455086
|
}
|
|
@@ -454999,115 +455108,6 @@ var init_faiClient = __esm({
|
|
|
454999
455108
|
}
|
|
455000
455109
|
});
|
|
455001
455110
|
|
|
455002
|
-
// ../register/lib/ai-example-enhancer/filterHelpers.js
|
|
455003
|
-
function isFdrTypedValueWrapper(value2) {
|
|
455004
|
-
if (value2 === null || value2 === void 0 || typeof value2 !== "object" || Array.isArray(value2)) {
|
|
455005
|
-
return false;
|
|
455006
|
-
}
|
|
455007
|
-
const obj = value2;
|
|
455008
|
-
const keys25 = Object.keys(obj);
|
|
455009
|
-
if (keys25.length === 0 || keys25.length > 2) {
|
|
455010
|
-
return false;
|
|
455011
|
-
}
|
|
455012
|
-
const hasType = "type" in obj && typeof obj.type === "string";
|
|
455013
|
-
const hasValue = "value" in obj;
|
|
455014
|
-
return hasType && keys25.length === 1 || hasType && hasValue && keys25.length === 2 || hasValue && keys25.length === 1;
|
|
455015
|
-
}
|
|
455016
|
-
function unwrapExampleValue(value2) {
|
|
455017
|
-
if (value2 === null || value2 === void 0) {
|
|
455018
|
-
return value2;
|
|
455019
|
-
}
|
|
455020
|
-
if (Array.isArray(value2)) {
|
|
455021
|
-
return value2.map(unwrapExampleValue);
|
|
455022
|
-
}
|
|
455023
|
-
if (typeof value2 !== "object") {
|
|
455024
|
-
return value2;
|
|
455025
|
-
}
|
|
455026
|
-
const obj = value2;
|
|
455027
|
-
if (isFdrTypedValueWrapper(obj)) {
|
|
455028
|
-
if ("value" in obj) {
|
|
455029
|
-
return unwrapExampleValue(obj.value);
|
|
455030
|
-
}
|
|
455031
|
-
return void 0;
|
|
455032
|
-
}
|
|
455033
|
-
const result = {};
|
|
455034
|
-
for (const [key2, val] of Object.entries(obj)) {
|
|
455035
|
-
const unwrapped = unwrapExampleValue(val);
|
|
455036
|
-
if (unwrapped !== void 0) {
|
|
455037
|
-
result[key2] = unwrapped;
|
|
455038
|
-
}
|
|
455039
|
-
}
|
|
455040
|
-
return result;
|
|
455041
|
-
}
|
|
455042
|
-
function isEmptyObject3(value2) {
|
|
455043
|
-
if (value2 === null || value2 === void 0) {
|
|
455044
|
-
return true;
|
|
455045
|
-
}
|
|
455046
|
-
if (typeof value2 !== "object") {
|
|
455047
|
-
return false;
|
|
455048
|
-
}
|
|
455049
|
-
if (Array.isArray(value2)) {
|
|
455050
|
-
return value2.length === 0;
|
|
455051
|
-
}
|
|
455052
|
-
return Object.keys(value2).length === 0;
|
|
455053
|
-
}
|
|
455054
|
-
function filterRequestBody(requestBody, pathParameters, queryParameters, headers2) {
|
|
455055
|
-
const extractedPathParams = {};
|
|
455056
|
-
const extractedQueryParams = {};
|
|
455057
|
-
const extractedHeaders = {};
|
|
455058
|
-
if (requestBody === null || requestBody === void 0 || typeof requestBody !== "object" || Array.isArray(requestBody)) {
|
|
455059
|
-
return { filteredBody: requestBody, extractedPathParams, extractedQueryParams, extractedHeaders };
|
|
455060
|
-
}
|
|
455061
|
-
const bodyRecord = requestBody;
|
|
455062
|
-
const filteredBody = {};
|
|
455063
|
-
const pathParamKeys = new Set(Object.keys(pathParameters ?? {}));
|
|
455064
|
-
const queryParamKeys = new Set(Object.keys(queryParameters ?? {}));
|
|
455065
|
-
const headerKeys = new Set(Object.keys(headers2 ?? {}));
|
|
455066
|
-
for (const [key2, value2] of Object.entries(bodyRecord)) {
|
|
455067
|
-
const normalizedKey = key2.toLowerCase().replace(/[-_]/g, "");
|
|
455068
|
-
let isPathParam = false;
|
|
455069
|
-
let isQueryParam = false;
|
|
455070
|
-
let isHeader = false;
|
|
455071
|
-
for (const pathKey of pathParamKeys) {
|
|
455072
|
-
const normalizedPathKey = pathKey.toLowerCase().replace(/[-_]/g, "");
|
|
455073
|
-
if (normalizedKey === normalizedPathKey) {
|
|
455074
|
-
isPathParam = true;
|
|
455075
|
-
extractedPathParams[pathKey] = value2;
|
|
455076
|
-
break;
|
|
455077
|
-
}
|
|
455078
|
-
}
|
|
455079
|
-
if (!isPathParam) {
|
|
455080
|
-
for (const queryKey of queryParamKeys) {
|
|
455081
|
-
const normalizedQueryKey = queryKey.toLowerCase().replace(/[-_]/g, "");
|
|
455082
|
-
if (normalizedKey === normalizedQueryKey) {
|
|
455083
|
-
isQueryParam = true;
|
|
455084
|
-
extractedQueryParams[queryKey] = value2;
|
|
455085
|
-
break;
|
|
455086
|
-
}
|
|
455087
|
-
}
|
|
455088
|
-
}
|
|
455089
|
-
if (!isPathParam && !isQueryParam) {
|
|
455090
|
-
for (const headerKey of headerKeys) {
|
|
455091
|
-
const normalizedHeaderKey = headerKey.toLowerCase().replace(/[-_]/g, "");
|
|
455092
|
-
if (normalizedKey === normalizedHeaderKey) {
|
|
455093
|
-
isHeader = true;
|
|
455094
|
-
extractedHeaders[headerKey] = value2;
|
|
455095
|
-
break;
|
|
455096
|
-
}
|
|
455097
|
-
}
|
|
455098
|
-
}
|
|
455099
|
-
if (!isPathParam && !isQueryParam && !isHeader) {
|
|
455100
|
-
filteredBody[key2] = value2;
|
|
455101
|
-
}
|
|
455102
|
-
}
|
|
455103
|
-
return { filteredBody, extractedPathParams, extractedQueryParams, extractedHeaders };
|
|
455104
|
-
}
|
|
455105
|
-
var init_filterHelpers = __esm({
|
|
455106
|
-
"../register/lib/ai-example-enhancer/filterHelpers.js"() {
|
|
455107
|
-
"use strict";
|
|
455108
|
-
}
|
|
455109
|
-
});
|
|
455110
|
-
|
|
455111
455111
|
// ../register/lib/ai-example-enhancer/spinnerStatusCoordinator.js
|
|
455112
455112
|
var SpinnerStatusCoordinator;
|
|
455113
455113
|
var init_spinnerStatusCoordinator = __esm({
|
|
@@ -455713,7 +455713,7 @@ async function enhanceExamplesWithAI(apiDefinition, config5, context3, token, or
|
|
|
455713
455713
|
}
|
|
455714
455714
|
}
|
|
455715
455715
|
async function performAIEnhancement(apiDefinition, config5, context3, token, organizationId, sourceSpecs, apiName) {
|
|
455716
|
-
const enhancer = new
|
|
455716
|
+
const enhancer = new LambdaExampleEnhancer(config5, context3, token, organizationId);
|
|
455717
455717
|
const circuitBreaker = new CircuitBreaker();
|
|
455718
455718
|
let openApiSpec;
|
|
455719
455719
|
let endpointsNeedingRegeneration = /* @__PURE__ */ new Set();
|
|
@@ -455926,7 +455926,7 @@ function collectWorkItems(pkg2, coveredEndpoints, endpointsNeedingRegeneration,
|
|
|
455926
455926
|
}
|
|
455927
455927
|
async function processEndpointsConcurrently(allWorkItems, enhancer, context3, organizationId, stats, enhancedExampleRecords, openApiSpec, sourceFilePath, statusId, apiStats, circuitBreaker) {
|
|
455928
455928
|
const maxConcurrentRequests = parseInt(process.env.FERN_AI_MAX_CONCURRENT || "25", 10);
|
|
455929
|
-
context3.logger.debug(`Processing ${allWorkItems.length} endpoints with max ${maxConcurrentRequests} concurrent
|
|
455929
|
+
context3.logger.debug(`Processing ${allWorkItems.length} endpoints with max ${maxConcurrentRequests} concurrent Lambda calls using rolling window queue`);
|
|
455930
455930
|
if (circuitBreaker?.shouldSkip()) {
|
|
455931
455931
|
context3.logger.debug(`Circuit breaker is open after ${circuitBreaker.getFailureCount()} failures (threshold: ${circuitBreaker.getThreshold()}). Skipping AI enhancement for remaining endpoints.`);
|
|
455932
455932
|
return /* @__PURE__ */ new Map();
|
|
@@ -456043,7 +456043,7 @@ async function processEndpoint(workItem, enhancer, context3, organizationId, sta
|
|
|
456043
456043
|
const result = await enhancer.enhanceExample(request7);
|
|
456044
456044
|
circuitBreaker?.recordSuccess();
|
|
456045
456045
|
if (result.enhancedRequestExample != null && request7.originalRequestExample != null) {
|
|
456046
|
-
const unwrapped =
|
|
456046
|
+
const unwrapped = unwrapLambdaBodyEnvelope(result.enhancedRequestExample);
|
|
456047
456047
|
const originalHasBody = isObjectWithKey(request7.originalRequestExample, "body");
|
|
456048
456048
|
if (unwrapped.wasWrapped && !originalHasBody) {
|
|
456049
456049
|
result.enhancedRequestExample = backfillMissingFields(unwrapped.inner, request7.originalRequestExample);
|
|
@@ -456327,7 +456327,7 @@ function extractExampleValue(bodyV3) {
|
|
|
456327
456327
|
function isObjectWithKey(value2, key2) {
|
|
456328
456328
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2) && key2 in value2;
|
|
456329
456329
|
}
|
|
456330
|
-
function
|
|
456330
|
+
function unwrapLambdaBodyEnvelope(value2) {
|
|
456331
456331
|
if (typeof value2 === "object" && value2 !== null && !Array.isArray(value2) && "body" in value2) {
|
|
456332
456332
|
return { wasWrapped: true, inner: value2.body };
|
|
456333
456333
|
}
|
|
@@ -456365,8 +456365,8 @@ var init_enhanceExamplesWithAI = __esm({
|
|
|
456365
456365
|
init_lib65();
|
|
456366
456366
|
import_promises72 = require("fs/promises");
|
|
456367
456367
|
init_js_yaml();
|
|
456368
|
-
init_faiClient();
|
|
456369
456368
|
init_filterHelpers();
|
|
456369
|
+
init_lambdaClient();
|
|
456370
456370
|
init_spinnerStatusCoordinator();
|
|
456371
456371
|
init_validateAiExamples();
|
|
456372
456372
|
init_writeAiExamplesOverride();
|
|
@@ -459852,7 +459852,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
459852
459852
|
navigationConfig: tabbed,
|
|
459853
459853
|
parentSlug: slug
|
|
459854
459854
|
}),
|
|
459855
|
-
versioned: (versioned) => this.toVersionedNode(versioned, slug),
|
|
459855
|
+
versioned: (versioned) => this.toVersionedNode(versioned, slug, this.parsedDocsConfig.landingPage),
|
|
459856
459856
|
productgroup: (productGroup) => this.toProductGroupNode({
|
|
459857
459857
|
landingPageConfig: this.parsedDocsConfig.landingPage,
|
|
459858
459858
|
productGroup,
|
|
@@ -459888,7 +459888,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
459888
459888
|
const child = navigationConfig.type === "tabbed" ? await this.convertTabbedNavigation(id, navigationConfig.items, parentSlug) : await this.toSidebarRootNode(id, navigationConfig.items, parentSlug);
|
|
459889
459889
|
return { type: "unversioned", id, collapsed: void 0, landingPage, child };
|
|
459890
459890
|
}
|
|
459891
|
-
async toVersionedNode(versioned, parentSlug) {
|
|
459891
|
+
async toVersionedNode(versioned, parentSlug, landingPage) {
|
|
459892
459892
|
const id = this.#idgen.get("versioned");
|
|
459893
459893
|
const defaultVersion = versioned.versions[0];
|
|
459894
459894
|
if (defaultVersion?.hidden === true) {
|
|
@@ -459901,7 +459901,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
459901
459901
|
const children2 = [];
|
|
459902
459902
|
for (let i5 = 0; i5 < versioned.versions.length; i5 += BATCH_SIZE2) {
|
|
459903
459903
|
const batch = versioned.versions.slice(i5, i5 + BATCH_SIZE2);
|
|
459904
|
-
const batchResults = await Promise.all(batch.map((item, batchIdx) => this.toVersionNode(item, parentSlug, i5 + batchIdx === 0)));
|
|
459904
|
+
const batchResults = await Promise.all(batch.map((item, batchIdx) => this.toVersionNode(item, parentSlug, i5 + batchIdx === 0, landingPage)));
|
|
459905
459905
|
children2.push(...batchResults);
|
|
459906
459906
|
}
|
|
459907
459907
|
return {
|
|
@@ -459932,7 +459932,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
459932
459932
|
type: "unversioned",
|
|
459933
459933
|
id: this.#idgen.get(product.product),
|
|
459934
459934
|
collapsed: void 0,
|
|
459935
|
-
landingPage: void 0,
|
|
459935
|
+
landingPage: product.landingPage != null ? this.toLandingPageNode(product.landingPage, slug) : void 0,
|
|
459936
459936
|
child: await this.convertTabbedNavigation(this.#idgen.get(product.product), product.navigation.items, slug)
|
|
459937
459937
|
};
|
|
459938
459938
|
break;
|
|
@@ -459941,12 +459941,12 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
459941
459941
|
type: "unversioned",
|
|
459942
459942
|
id: this.#idgen.get(product.product),
|
|
459943
459943
|
collapsed: void 0,
|
|
459944
|
-
landingPage: void 0,
|
|
459944
|
+
landingPage: product.landingPage != null ? this.toLandingPageNode(product.landingPage, slug) : void 0,
|
|
459945
459945
|
child: await this.toSidebarRootNode(this.#idgen.get(product.product), product.navigation.items, slug)
|
|
459946
459946
|
};
|
|
459947
459947
|
break;
|
|
459948
459948
|
case "versioned":
|
|
459949
|
-
child = await this.toVersionedNode(product.navigation, slug);
|
|
459949
|
+
child = await this.toVersionedNode(product.navigation, slug, product.landingPage ?? this.parsedDocsConfig.landingPage);
|
|
459950
459950
|
break;
|
|
459951
459951
|
default:
|
|
459952
459952
|
assertNever(product.navigation);
|
|
@@ -459991,10 +459991,11 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
459991
459991
|
};
|
|
459992
459992
|
}
|
|
459993
459993
|
}
|
|
459994
|
-
async toVersionNode(version7, parentSlug, isDefault) {
|
|
459994
|
+
async toVersionNode(version7, parentSlug, isDefault, landingPage) {
|
|
459995
459995
|
const id = this.#idgen.get(version7.version);
|
|
459996
459996
|
const slug = parentSlug.setVersionSlug(version7.slug ?? kebabCase_default(version7.version));
|
|
459997
459997
|
const child = version7.navigation.type === "tabbed" ? await this.convertTabbedNavigation(id, version7.navigation.items, slug) : await this.toSidebarRootNode(id, version7.navigation.items, slug);
|
|
459998
|
+
const resolvedLandingPage = version7.landingPage ?? landingPage;
|
|
459998
459999
|
return {
|
|
459999
460000
|
type: "version",
|
|
460000
460001
|
id,
|
|
@@ -460006,7 +460007,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
460006
460007
|
// TODO: the `default` property should be deprecated, and moved to the parent `versioned` node
|
|
460007
460008
|
default: isDefault,
|
|
460008
460009
|
availability: version7.availability != null ? convertAvailability5(version7.availability) : void 0,
|
|
460009
|
-
landingPage:
|
|
460010
|
+
landingPage: resolvedLandingPage != null ? this.toLandingPageNode(resolvedLandingPage, slug) : void 0,
|
|
460010
460011
|
hidden: version7.hidden,
|
|
460011
460012
|
authed: void 0,
|
|
460012
460013
|
viewers: version7.viewers,
|
|
@@ -478581,8 +478582,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
478581
478582
|
}
|
|
478582
478583
|
var fs$appendFile = fs35.appendFile;
|
|
478583
478584
|
if (fs$appendFile)
|
|
478584
|
-
fs35.appendFile =
|
|
478585
|
-
function
|
|
478585
|
+
fs35.appendFile = appendFile4;
|
|
478586
|
+
function appendFile4(path119, data2, options2, cb) {
|
|
478586
478587
|
if (typeof options2 === "function")
|
|
478587
478588
|
cb = options2, options2 = null;
|
|
478588
478589
|
return go$appendFile(path119, data2, options2, cb);
|
|
@@ -571792,7 +571793,7 @@ var require_dist24 = __commonJS({
|
|
|
571792
571793
|
return copy;
|
|
571793
571794
|
}
|
|
571794
571795
|
};
|
|
571795
|
-
var
|
|
571796
|
+
var import_promises215 = require("fs/promises");
|
|
571796
571797
|
var import_node_path310 = require("path");
|
|
571797
571798
|
async function resolveInputs(args) {
|
|
571798
571799
|
const {
|
|
@@ -571845,7 +571846,7 @@ var require_dist24 = __commonJS({
|
|
|
571845
571846
|
}
|
|
571846
571847
|
}
|
|
571847
571848
|
const oursPath = (0, import_node_path310.join)(outputDir, resolvedPath);
|
|
571848
|
-
const ours = await (0,
|
|
571849
|
+
const ours = await (0, import_promises215.readFile)(oursPath, "utf-8").catch(() => null);
|
|
571849
571850
|
let ghostTheirs = null;
|
|
571850
571851
|
let baseTreeUnreachable = false;
|
|
571851
571852
|
if (!base4 && !renameSourcePath) {
|
|
@@ -572087,7 +572088,7 @@ var require_dist24 = __commonJS({
|
|
|
572087
572088
|
conflictReasonHint
|
|
572088
572089
|
};
|
|
572089
572090
|
}
|
|
572090
|
-
var
|
|
572091
|
+
var import_promises216 = require("fs/promises");
|
|
572091
572092
|
var import_node_path45 = require("path");
|
|
572092
572093
|
async function runMergeAndRecord(args) {
|
|
572093
572094
|
const { plan, inputs, patch: patch5, accumulator } = args;
|
|
@@ -572097,14 +572098,14 @@ var require_dist24 = __commonJS({
|
|
|
572097
572098
|
}
|
|
572098
572099
|
if (plan.kind === "new-file-only-user") {
|
|
572099
572100
|
accumulator.recordMerge(resolvedPath, plan.theirs, patch5.base_generation);
|
|
572100
|
-
await (0,
|
|
572101
|
-
await (0,
|
|
572101
|
+
await (0, import_promises216.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572102
|
+
await (0, import_promises216.writeFile)(oursPath, plan.theirs);
|
|
572102
572103
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
572103
572104
|
}
|
|
572104
572105
|
if (plan.kind === "new-file-both") {
|
|
572105
572106
|
const merged2 = threeWayMerge("", ours, plan.theirs);
|
|
572106
|
-
await (0,
|
|
572107
|
-
await (0,
|
|
572107
|
+
await (0, import_promises216.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572108
|
+
await (0, import_promises216.writeFile)(oursPath, merged2.content);
|
|
572108
572109
|
const unreachableFlag = plan.baseTreeUnreachable ? { baseTreeUnreachable: true } : {};
|
|
572109
572110
|
if (merged2.hasConflicts) {
|
|
572110
572111
|
return {
|
|
@@ -572120,8 +572121,8 @@ var require_dist24 = __commonJS({
|
|
|
572120
572121
|
return { file: resolvedPath, status: "merged", ...unreachableFlag };
|
|
572121
572122
|
}
|
|
572122
572123
|
const merged = threeWayMerge(plan.mergeBase, ours, plan.theirs);
|
|
572123
|
-
await (0,
|
|
572124
|
-
await (0,
|
|
572124
|
+
await (0, import_promises216.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572125
|
+
await (0, import_promises216.writeFile)(oursPath, merged.content);
|
|
572125
572126
|
if (merged.hasConflicts) {
|
|
572126
572127
|
accumulator.recordConflict(resolvedPath, plan.theirs, patch5.base_generation);
|
|
572127
572128
|
return {
|
|
@@ -588891,13 +588892,13 @@ async function buildTranslatedDocsDefinition({ docsDefinition, locale, localePag
|
|
|
588891
588892
|
};
|
|
588892
588893
|
const localeAwareMarkdownLoader = async (filepath) => {
|
|
588893
588894
|
const pathToRead = await resolveLocalePath(filepath);
|
|
588894
|
-
const raw = await (0,
|
|
588895
|
+
const raw = await (0, import_promises119.readFile)(pathToRead, "utf-8");
|
|
588895
588896
|
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
588896
588897
|
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
588897
588898
|
};
|
|
588898
588899
|
const localeAwareFileLoader = async (filepath) => {
|
|
588899
588900
|
const pathToRead = await resolveLocalePath(filepath);
|
|
588900
|
-
return (0,
|
|
588901
|
+
return (0, import_promises119.readFile)(pathToRead, "utf-8");
|
|
588901
588902
|
};
|
|
588902
588903
|
const translatedPageEntries = await Promise.all(Object.entries(localePages).map(async ([path119, rawMarkdown]) => {
|
|
588903
588904
|
try {
|
|
@@ -588973,13 +588974,13 @@ async function buildTranslatedDocsDefinition({ docsDefinition, locale, localePag
|
|
|
588973
588974
|
}
|
|
588974
588975
|
};
|
|
588975
588976
|
}
|
|
588976
|
-
var
|
|
588977
|
+
var import_promises119;
|
|
588977
588978
|
var init_buildTranslatedDocsDefinition = __esm({
|
|
588978
588979
|
"../generation/remote-generation/remote-workspace-runner/lib/buildTranslatedDocsDefinition.js"() {
|
|
588979
588980
|
"use strict";
|
|
588980
588981
|
init_lib67();
|
|
588981
588982
|
init_lib8();
|
|
588982
|
-
|
|
588983
|
+
import_promises119 = require("fs/promises");
|
|
588983
588984
|
}
|
|
588984
588985
|
});
|
|
588985
588986
|
|
|
@@ -619428,7 +619429,7 @@ async function readFernYmlRaw(start2) {
|
|
|
619428
619429
|
for (let i5 = 0; i5 < 50; i5++) {
|
|
619429
619430
|
const candidate = (0, import_path102.resolve)(dir, "fern.yml");
|
|
619430
619431
|
try {
|
|
619431
|
-
const content5 = await (0,
|
|
619432
|
+
const content5 = await (0, import_promises143.readFile)(candidate, "utf-8");
|
|
619432
619433
|
const parsed = index_vite_proxy_tmp_default.load(content5);
|
|
619433
619434
|
if (isRawFernYml(parsed)) {
|
|
619434
619435
|
return parsed;
|
|
@@ -619476,11 +619477,11 @@ function extractInstances(raw) {
|
|
|
619476
619477
|
}
|
|
619477
619478
|
return raw.docs.instances.flatMap((inst) => typeof inst?.url === "string" ? [inst.url] : []);
|
|
619478
619479
|
}
|
|
619479
|
-
var
|
|
619480
|
+
var import_promises143, import_path102;
|
|
619480
619481
|
var init_completion2 = __esm({
|
|
619481
619482
|
"../cli-v2/lib/completion.js"() {
|
|
619482
619483
|
"use strict";
|
|
619483
|
-
|
|
619484
|
+
import_promises143 = require("fs/promises");
|
|
619484
619485
|
init_js_yaml();
|
|
619485
619486
|
import_path102 = require("path");
|
|
619486
619487
|
}
|
|
@@ -686971,7 +686972,7 @@ var AccessTokenPosthogManager = class {
|
|
|
686971
686972
|
properties: {
|
|
686972
686973
|
...event,
|
|
686973
686974
|
...event.properties,
|
|
686974
|
-
version: "5.
|
|
686975
|
+
version: "5.58.0",
|
|
686975
686976
|
usingAccessToken: true,
|
|
686976
686977
|
...getRunIdProperties()
|
|
686977
686978
|
}
|
|
@@ -687037,7 +687038,7 @@ var UserPosthogManager = class {
|
|
|
687037
687038
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
687038
687039
|
event: "CLI",
|
|
687039
687040
|
properties: {
|
|
687040
|
-
version: "5.
|
|
687041
|
+
version: "5.58.0",
|
|
687041
687042
|
...event,
|
|
687042
687043
|
...event.properties,
|
|
687043
687044
|
usingAccessToken: false,
|
|
@@ -868132,7 +868133,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
868132
868133
|
var LOGS_FOLDER_NAME = "logs";
|
|
868133
868134
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
868134
868135
|
function getCliSource() {
|
|
868135
|
-
const version7 = "5.
|
|
868136
|
+
const version7 = "5.58.0";
|
|
868136
868137
|
return `cli@${version7}`;
|
|
868137
868138
|
}
|
|
868138
868139
|
var DebugLogger = class {
|
|
@@ -889510,6 +889511,7 @@ async function validateAPIWorkspaceAndLogIssues({ workspace, context: context3,
|
|
|
889510
889511
|
}
|
|
889511
889512
|
|
|
889512
889513
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForAPIWorkspace.js
|
|
889514
|
+
init_lib25();
|
|
889513
889515
|
init_lib4();
|
|
889514
889516
|
init_lib35();
|
|
889515
889517
|
init_lib6();
|
|
@@ -896827,6 +896829,7 @@ ${result.error?.message ?? "Unknown error"}`,
|
|
|
896827
896829
|
|
|
896828
896830
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForAPIWorkspace.js
|
|
896829
896831
|
init_esm19();
|
|
896832
|
+
var import_promises118 = require("fs/promises");
|
|
896830
896833
|
|
|
896831
896834
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
896832
896835
|
init_lib8();
|
|
@@ -898346,6 +898349,16 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
|
|
|
898346
898349
|
generatorsYmlLineNumber: lineNumber
|
|
898347
898350
|
});
|
|
898348
898351
|
}
|
|
898352
|
+
await emitGenerationAnnotations({
|
|
898353
|
+
pullRequestUrl: remoteTaskHandlerResponse?.pullRequestUrl,
|
|
898354
|
+
publishTarget: remoteTaskHandlerResponse?.publishTarget,
|
|
898355
|
+
noChangesDetected: remoteTaskHandlerResponse?.noChangesDetected,
|
|
898356
|
+
version: remoteTaskHandlerResponse?.actualVersion,
|
|
898357
|
+
generatorName: generatorInvocation.name,
|
|
898358
|
+
groupName: generatorGroup.groupName,
|
|
898359
|
+
apiName: workspace.workspaceName,
|
|
898360
|
+
isAutomation: automation != null
|
|
898361
|
+
});
|
|
898349
898362
|
} catch (error50) {
|
|
898350
898363
|
if (automation == null) {
|
|
898351
898364
|
throw error50;
|
|
@@ -898381,6 +898394,68 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
|
|
|
898381
898394
|
});
|
|
898382
898395
|
}
|
|
898383
898396
|
}
|
|
898397
|
+
async function emitGenerationAnnotations(ctx) {
|
|
898398
|
+
if (!shouldEmitGithubAnnotations()) {
|
|
898399
|
+
return;
|
|
898400
|
+
}
|
|
898401
|
+
const notices = [];
|
|
898402
|
+
if (ctx.pullRequestUrl != null) {
|
|
898403
|
+
notices.push({
|
|
898404
|
+
event: "PR created",
|
|
898405
|
+
body: ctx.pullRequestUrl,
|
|
898406
|
+
summaryLine: `\u{1F500} **${ctx.generatorName}** \u2192 [PR](${ctx.pullRequestUrl})`
|
|
898407
|
+
});
|
|
898408
|
+
}
|
|
898409
|
+
if (ctx.publishTarget != null) {
|
|
898410
|
+
notices.push({
|
|
898411
|
+
event: `Published to ${ctx.publishTarget.label}`,
|
|
898412
|
+
body: `${ctx.publishTarget.version} \u2192 ${ctx.publishTarget.url}`,
|
|
898413
|
+
summaryLine: `\u{1F4E6} **${ctx.generatorName}** \u2192 [${ctx.publishTarget.label} ${ctx.publishTarget.version}](${ctx.publishTarget.url})`
|
|
898414
|
+
});
|
|
898415
|
+
}
|
|
898416
|
+
if (ctx.noChangesDetected) {
|
|
898417
|
+
notices.push({
|
|
898418
|
+
event: "No changes detected",
|
|
898419
|
+
body: "SDK repo is already up to date",
|
|
898420
|
+
summaryLine: `\u2705 **${ctx.generatorName}** \u2192 No changes detected`
|
|
898421
|
+
});
|
|
898422
|
+
}
|
|
898423
|
+
if (ctx.version != null && ctx.publishTarget == null && ctx.pullRequestUrl == null) {
|
|
898424
|
+
notices.push({
|
|
898425
|
+
event: `Version ${ctx.version}`,
|
|
898426
|
+
body: `Generated version ${ctx.version}`,
|
|
898427
|
+
summaryLine: `\u{1F3F7}\uFE0F **${ctx.generatorName}** \u2192 Version ${ctx.version}`
|
|
898428
|
+
});
|
|
898429
|
+
}
|
|
898430
|
+
if (notices.length === 0) {
|
|
898431
|
+
return;
|
|
898432
|
+
}
|
|
898433
|
+
const qualifiers = [`group=${ctx.groupName}`];
|
|
898434
|
+
if (ctx.apiName != null && ctx.apiName.length > 0) {
|
|
898435
|
+
qualifiers.push(`api=${ctx.apiName}`);
|
|
898436
|
+
}
|
|
898437
|
+
const prefix2 = `${ctx.generatorName} (${qualifiers.join(", ")})`;
|
|
898438
|
+
for (const notice of notices) {
|
|
898439
|
+
const title2 = `${prefix2} \u2192 ${notice.event}`;
|
|
898440
|
+
const annotation = renderGithubAnnotation("notice", notice.body, { title: title2 });
|
|
898441
|
+
if (annotation != null) {
|
|
898442
|
+
process.stdout.write(annotation);
|
|
898443
|
+
}
|
|
898444
|
+
}
|
|
898445
|
+
if (!ctx.isAutomation) {
|
|
898446
|
+
const stepSummaryPath = process.env.GITHUB_STEP_SUMMARY;
|
|
898447
|
+
if (stepSummaryPath != null && stepSummaryPath.length > 0) {
|
|
898448
|
+
const lines = notices.map((n2) => `${n2.summaryLine}
|
|
898449
|
+
`).join("");
|
|
898450
|
+
try {
|
|
898451
|
+
await (0, import_promises118.appendFile)(stepSummaryPath, lines, "utf8");
|
|
898452
|
+
} catch (error50) {
|
|
898453
|
+
process.stderr.write(`[warn] Failed to append to GITHUB_STEP_SUMMARY: ${error50}
|
|
898454
|
+
`);
|
|
898455
|
+
}
|
|
898456
|
+
}
|
|
898457
|
+
}
|
|
898458
|
+
}
|
|
898384
898459
|
|
|
898385
898460
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForDocsWorkspace.js
|
|
898386
898461
|
init_lib4();
|
|
@@ -898440,7 +898515,7 @@ init_lib6();
|
|
|
898440
898515
|
init_axios2();
|
|
898441
898516
|
init_source();
|
|
898442
898517
|
var import_crypto9 = require("crypto");
|
|
898443
|
-
var
|
|
898518
|
+
var import_promises121 = require("fs/promises");
|
|
898444
898519
|
init_lodash();
|
|
898445
898520
|
var mime3 = __toESM(require_mime_types(), 1);
|
|
898446
898521
|
var import_path80 = require("path");
|
|
@@ -898515,7 +898590,7 @@ init_lib67();
|
|
|
898515
898590
|
init_js();
|
|
898516
898591
|
init_lib66();
|
|
898517
898592
|
var import_crypto8 = require("crypto");
|
|
898518
|
-
var
|
|
898593
|
+
var import_promises120 = require("fs/promises");
|
|
898519
898594
|
var mime2 = __toESM(require_mime_types(), 1);
|
|
898520
898595
|
|
|
898521
898596
|
// ../generation/remote-generation/remote-workspace-runner/lib/mapDocsConfigToLedgerConfig.js
|
|
@@ -898887,7 +898962,7 @@ async function uploadMissingBlobs(missingContent, blobs, context3, filePaths) {
|
|
|
898887
898962
|
if (blob == null && filePaths != null) {
|
|
898888
898963
|
const filePath = filePaths.get(hash5);
|
|
898889
898964
|
if (filePath != null) {
|
|
898890
|
-
blob = await (0,
|
|
898965
|
+
blob = await (0, import_promises120.readFile)(filePath);
|
|
898891
898966
|
const inferred = mime2.lookup(filePath);
|
|
898892
898967
|
if (inferred !== false) {
|
|
898893
898968
|
contentType = inferred;
|
|
@@ -899187,7 +899262,7 @@ function sanitizeRelativePathForS3(relativeFilePath) {
|
|
|
899187
899262
|
return relativeFilePath.replace(/\.\.\//g, "_dot_dot_/");
|
|
899188
899263
|
}
|
|
899189
899264
|
async function readAndHashFile(absoluteFilePath) {
|
|
899190
|
-
const buffer = await (0,
|
|
899265
|
+
const buffer = await (0, import_promises121.readFile)(absoluteFilePath);
|
|
899191
899266
|
const hash5 = (0, import_crypto9.createHash)("sha256").update(new Uint8Array(buffer)).digest("hex");
|
|
899192
899267
|
return { buffer, hash: hash5 };
|
|
899193
899268
|
}
|
|
@@ -899688,13 +899763,13 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
899688
899763
|
};
|
|
899689
899764
|
const localeAwareMarkdownLoader = async (filepath) => {
|
|
899690
899765
|
const pathToRead = await resolveLocalePath(filepath);
|
|
899691
|
-
const raw = await (0,
|
|
899766
|
+
const raw = await (0, import_promises121.readFile)(pathToRead, "utf-8");
|
|
899692
899767
|
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
899693
899768
|
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
899694
899769
|
};
|
|
899695
899770
|
const localeAwareFileLoader = async (filepath) => {
|
|
899696
899771
|
const pathToRead = await resolveLocalePath(filepath);
|
|
899697
|
-
return (0,
|
|
899772
|
+
return (0, import_promises121.readFile)(pathToRead, "utf-8");
|
|
899698
899773
|
};
|
|
899699
899774
|
const translatedPageEntries = await Promise.all(Object.entries(localePages).map(async ([path119, rawMarkdown]) => {
|
|
899700
899775
|
try {
|
|
@@ -899888,7 +899963,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
899888
899963
|
try {
|
|
899889
899964
|
const uploadUrl = extractUploadUrl(urlValue);
|
|
899890
899965
|
const mimeType = mime3.lookup(absoluteFilePath);
|
|
899891
|
-
await axios_default.put(uploadUrl, await (0,
|
|
899966
|
+
await axios_default.put(uploadUrl, await (0, import_promises121.readFile)(absoluteFilePath), {
|
|
899892
899967
|
headers: {
|
|
899893
899968
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
899894
899969
|
// Set max cache control for S3 uploads
|
|
@@ -900539,7 +900614,7 @@ var LegacyDocsPublisher = class {
|
|
|
900539
900614
|
previewId,
|
|
900540
900615
|
disableTemplates: void 0,
|
|
900541
900616
|
skipUpload,
|
|
900542
|
-
cliVersion: "5.
|
|
900617
|
+
cliVersion: "5.58.0",
|
|
900543
900618
|
loginCommand: "fern auth login"
|
|
900544
900619
|
});
|
|
900545
900620
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -901529,7 +901604,7 @@ init_lib4();
|
|
|
901529
901604
|
init_lib8();
|
|
901530
901605
|
init_lib6();
|
|
901531
901606
|
init_source();
|
|
901532
|
-
var
|
|
901607
|
+
var import_promises122 = require("fs/promises");
|
|
901533
901608
|
var import_path82 = __toESM(require("path"), 1);
|
|
901534
901609
|
|
|
901535
901610
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -902400,7 +902475,7 @@ var InitCommand = class {
|
|
|
902400
902475
|
apiPath,
|
|
902401
902476
|
defaultGroup: result.defaultGroup
|
|
902402
902477
|
});
|
|
902403
|
-
await (0,
|
|
902478
|
+
await (0, import_promises122.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
902404
902479
|
context3.stderr.info(`
|
|
902405
902480
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
902406
902481
|
}
|
|
@@ -902422,9 +902497,9 @@ var InitCommand = class {
|
|
|
902422
902497
|
}
|
|
902423
902498
|
async writeSpecFile(cwd2, filename, content5) {
|
|
902424
902499
|
const specsDir = join8(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
902425
|
-
await (0,
|
|
902500
|
+
await (0, import_promises122.mkdir)(specsDir, { recursive: true });
|
|
902426
902501
|
const filePath = join8(specsDir, RelativeFilePath2.of(filename));
|
|
902427
|
-
await (0,
|
|
902502
|
+
await (0, import_promises122.writeFile)(filePath, content5, "utf-8");
|
|
902428
902503
|
}
|
|
902429
902504
|
resolveApiPath(apiSource) {
|
|
902430
902505
|
switch (apiSource.type) {
|
|
@@ -903586,7 +903661,7 @@ function addReplayCommand(cli) {
|
|
|
903586
903661
|
init_lib8();
|
|
903587
903662
|
init_lib6();
|
|
903588
903663
|
init_source();
|
|
903589
|
-
var
|
|
903664
|
+
var import_promises123 = require("fs/promises");
|
|
903590
903665
|
var SchemaCommand = class {
|
|
903591
903666
|
async handle(context3, args) {
|
|
903592
903667
|
const schema = this.resolveSchema(args.name);
|
|
@@ -903622,9 +903697,9 @@ var SchemaCommand = class {
|
|
|
903622
903697
|
const absoluteOutputPath = resolve6(context3.cwd, outputPath);
|
|
903623
903698
|
const outputDir = dirname6(absoluteOutputPath);
|
|
903624
903699
|
if (!await doesPathExist(outputDir)) {
|
|
903625
|
-
await (0,
|
|
903700
|
+
await (0, import_promises123.mkdir)(outputDir, { recursive: true });
|
|
903626
903701
|
}
|
|
903627
|
-
await (0,
|
|
903702
|
+
await (0, import_promises123.writeFile)(absoluteOutputPath, this.formatJson(value2, pretty));
|
|
903628
903703
|
context3.stderr.info(source_default.green(`Wrote JSON Schema to ${absoluteOutputPath}`));
|
|
903629
903704
|
}
|
|
903630
903705
|
};
|
|
@@ -903908,13 +903983,13 @@ init_lib4();
|
|
|
903908
903983
|
init_lib8();
|
|
903909
903984
|
init_lib6();
|
|
903910
903985
|
init_source();
|
|
903911
|
-
var
|
|
903986
|
+
var import_promises141 = require("fs/promises");
|
|
903912
903987
|
init_js_yaml();
|
|
903913
903988
|
|
|
903914
903989
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
903915
903990
|
init_lib8();
|
|
903916
903991
|
init_lib6();
|
|
903917
|
-
var
|
|
903992
|
+
var import_promises124 = require("fs/promises");
|
|
903918
903993
|
var import_os11 = require("os");
|
|
903919
903994
|
var import_path86 = __toESM(require("path"), 1);
|
|
903920
903995
|
|
|
@@ -903991,9 +904066,9 @@ var ApiSpecResolver = class {
|
|
|
903991
904066
|
});
|
|
903992
904067
|
}
|
|
903993
904068
|
const extension4 = this.inferExtensionFromContent(content5);
|
|
903994
|
-
const tempDir2 = await (0,
|
|
904069
|
+
const tempDir2 = await (0, import_promises124.mkdtemp)(import_path86.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
903995
904070
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path86.default.join(tempDir2, `spec${extension4}`));
|
|
903996
|
-
await (0,
|
|
904071
|
+
await (0, import_promises124.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
903997
904072
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: "stdin" });
|
|
903998
904073
|
return {
|
|
903999
904074
|
absoluteFilePath,
|
|
@@ -904009,9 +904084,9 @@ var ApiSpecResolver = class {
|
|
|
904009
904084
|
async resolveUrl({ reference: reference4 }) {
|
|
904010
904085
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
904011
904086
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
904012
|
-
const tempDir2 = await (0,
|
|
904087
|
+
const tempDir2 = await (0, import_promises124.mkdtemp)(import_path86.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
904013
904088
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path86.default.join(tempDir2, `spec${extension4}`));
|
|
904014
|
-
await (0,
|
|
904089
|
+
await (0, import_promises124.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
904015
904090
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
904016
904091
|
return {
|
|
904017
904092
|
absoluteFilePath,
|
|
@@ -904027,7 +904102,7 @@ var ApiSpecResolver = class {
|
|
|
904027
904102
|
code: CliError.Code.ConfigError
|
|
904028
904103
|
});
|
|
904029
904104
|
}
|
|
904030
|
-
const content5 = await (0,
|
|
904105
|
+
const content5 = await (0, import_promises124.readFile)(absoluteFilePath, "utf-8");
|
|
904031
904106
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
904032
904107
|
return {
|
|
904033
904108
|
absoluteFilePath,
|
|
@@ -922808,7 +922883,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
922808
922883
|
|
|
922809
922884
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
922810
922885
|
init_lib8();
|
|
922811
|
-
var
|
|
922886
|
+
var import_promises125 = require("fs/promises");
|
|
922812
922887
|
var import_path88 = __toESM(require("path"), 1);
|
|
922813
922888
|
|
|
922814
922889
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -922942,8 +923017,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
922942
923017
|
endpointId
|
|
922943
923018
|
});
|
|
922944
923019
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
922945
|
-
await (0,
|
|
922946
|
-
await (0,
|
|
923020
|
+
await (0, import_promises125.mkdir)(import_path88.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
923021
|
+
await (0, import_promises125.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
922947
923022
|
} catch (error50) {
|
|
922948
923023
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
922949
923024
|
}
|
|
@@ -922952,8 +923027,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
922952
923027
|
}
|
|
922953
923028
|
async initializeProject(outputDir) {
|
|
922954
923029
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
922955
|
-
await (0,
|
|
922956
|
-
await (0,
|
|
923030
|
+
await (0, import_promises125.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
923031
|
+
await (0, import_promises125.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
|
|
922957
923032
|
return absolutePathToOutputDir;
|
|
922958
923033
|
}
|
|
922959
923034
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -926466,7 +926541,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
926466
926541
|
};
|
|
926467
926542
|
|
|
926468
926543
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
926469
|
-
var
|
|
926544
|
+
var import_promises126 = require("fs/promises");
|
|
926470
926545
|
var import_path90 = __toESM(require("path"), 1);
|
|
926471
926546
|
var DynamicSnippetsGoTestGenerator = class {
|
|
926472
926547
|
context;
|
|
@@ -926495,8 +926570,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
926495
926570
|
endpointId
|
|
926496
926571
|
});
|
|
926497
926572
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
926498
|
-
await (0,
|
|
926499
|
-
await (0,
|
|
926573
|
+
await (0, import_promises126.mkdir)(import_path90.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
926574
|
+
await (0, import_promises126.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
926500
926575
|
} catch (error50) {
|
|
926501
926576
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
926502
926577
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -930383,7 +930458,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
930383
930458
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
930384
930459
|
init_lib33();
|
|
930385
930460
|
init_lib6();
|
|
930386
|
-
var
|
|
930461
|
+
var import_promises127 = require("fs/promises");
|
|
930387
930462
|
var import_path91 = __toESM(require("path"), 1);
|
|
930388
930463
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
930389
930464
|
context;
|
|
@@ -930421,8 +930496,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930421
930496
|
endpointId
|
|
930422
930497
|
});
|
|
930423
930498
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
930424
|
-
await (0,
|
|
930425
|
-
await (0,
|
|
930499
|
+
await (0, import_promises127.mkdir)(import_path91.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
930500
|
+
await (0, import_promises127.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
930426
930501
|
} catch (error50) {
|
|
930427
930502
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
930428
930503
|
}
|
|
@@ -930449,7 +930524,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930449
930524
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
930450
930525
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
930451
930526
|
if (buildReportsExists) {
|
|
930452
|
-
await (0,
|
|
930527
|
+
await (0, import_promises127.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
930453
930528
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
930454
930529
|
} else {
|
|
930455
930530
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -930463,7 +930538,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930463
930538
|
}
|
|
930464
930539
|
async initializeProject(outputDir) {
|
|
930465
930540
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
930466
|
-
await (0,
|
|
930541
|
+
await (0, import_promises127.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
930467
930542
|
return absolutePathToOutputDir;
|
|
930468
930543
|
}
|
|
930469
930544
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -933966,7 +934041,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
933966
934041
|
};
|
|
933967
934042
|
|
|
933968
934043
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
933969
|
-
var
|
|
934044
|
+
var import_promises128 = require("fs/promises");
|
|
933970
934045
|
var import_path92 = __toESM(require("path"), 1);
|
|
933971
934046
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
933972
934047
|
context;
|
|
@@ -933995,8 +934070,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
933995
934070
|
endpointId
|
|
933996
934071
|
});
|
|
933997
934072
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
933998
|
-
await (0,
|
|
933999
|
-
await (0,
|
|
934073
|
+
await (0, import_promises128.mkdir)(import_path92.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
934074
|
+
await (0, import_promises128.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
934000
934075
|
} catch (error50) {
|
|
934001
934076
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
934002
934077
|
}
|
|
@@ -937253,7 +937328,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
937253
937328
|
};
|
|
937254
937329
|
|
|
937255
937330
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
937256
|
-
var
|
|
937331
|
+
var import_promises129 = require("fs/promises");
|
|
937257
937332
|
var import_path93 = __toESM(require("path"), 1);
|
|
937258
937333
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
937259
937334
|
context;
|
|
@@ -937282,8 +937357,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
937282
937357
|
endpointId
|
|
937283
937358
|
});
|
|
937284
937359
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
937285
|
-
await (0,
|
|
937286
|
-
await (0,
|
|
937360
|
+
await (0, import_promises129.mkdir)(import_path93.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
937361
|
+
await (0, import_promises129.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
937287
937362
|
} catch (error50) {
|
|
937288
937363
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
937289
937364
|
}
|
|
@@ -940230,7 +940305,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
940230
940305
|
};
|
|
940231
940306
|
|
|
940232
940307
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
940233
|
-
var
|
|
940308
|
+
var import_promises130 = require("fs/promises");
|
|
940234
940309
|
var import_path94 = __toESM(require("path"), 1);
|
|
940235
940310
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
940236
940311
|
context;
|
|
@@ -940259,8 +940334,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
940259
940334
|
endpointId
|
|
940260
940335
|
});
|
|
940261
940336
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
940262
|
-
await (0,
|
|
940263
|
-
await (0,
|
|
940337
|
+
await (0, import_promises130.mkdir)(import_path94.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
940338
|
+
await (0, import_promises130.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
940264
940339
|
} catch (error50) {
|
|
940265
940340
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
940266
940341
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -940276,7 +940351,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
940276
940351
|
};
|
|
940277
940352
|
|
|
940278
940353
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
940279
|
-
var
|
|
940354
|
+
var import_promises131 = require("fs/promises");
|
|
940280
940355
|
var import_node_path40 = __toESM(require("path"), 1);
|
|
940281
940356
|
init_lib8();
|
|
940282
940357
|
|
|
@@ -945510,8 +945585,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945510
945585
|
absolutePathToOutputDir,
|
|
945511
945586
|
idx
|
|
945512
945587
|
});
|
|
945513
|
-
await (0,
|
|
945514
|
-
await (0,
|
|
945588
|
+
await (0, import_promises131.mkdir)(import_node_path40.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
945589
|
+
await (0, import_promises131.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
945515
945590
|
} catch (error50) {
|
|
945516
945591
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
945517
945592
|
}
|
|
@@ -945520,7 +945595,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945520
945595
|
}
|
|
945521
945596
|
async initializeProject(outputDir) {
|
|
945522
945597
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
945523
|
-
await (0,
|
|
945598
|
+
await (0, import_promises131.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
945524
945599
|
return absolutePathToOutputDir;
|
|
945525
945600
|
}
|
|
945526
945601
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -945529,7 +945604,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945529
945604
|
};
|
|
945530
945605
|
|
|
945531
945606
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
945532
|
-
var
|
|
945607
|
+
var import_promises132 = require("fs/promises");
|
|
945533
945608
|
var import_node_path41 = __toESM(require("path"), 1);
|
|
945534
945609
|
init_lib8();
|
|
945535
945610
|
|
|
@@ -950193,8 +950268,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
950193
950268
|
absolutePathToOutputDir,
|
|
950194
950269
|
idx
|
|
950195
950270
|
});
|
|
950196
|
-
await (0,
|
|
950197
|
-
await (0,
|
|
950271
|
+
await (0, import_promises132.mkdir)(import_node_path41.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
950272
|
+
await (0, import_promises132.writeFile)(dynamicSnippetFilePath, this.wrapSnippetAsLibrary(response.snippet, `Example${idx}`));
|
|
950198
950273
|
} catch (error50) {
|
|
950199
950274
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
950200
950275
|
}
|
|
@@ -950203,7 +950278,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
950203
950278
|
}
|
|
950204
950279
|
async initializeProject(outputDir) {
|
|
950205
950280
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Tests/Snippets"));
|
|
950206
|
-
await (0,
|
|
950281
|
+
await (0, import_promises132.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
950207
950282
|
return absolutePathToOutputDir;
|
|
950208
950283
|
}
|
|
950209
950284
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -952687,7 +952762,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
952687
952762
|
};
|
|
952688
952763
|
|
|
952689
952764
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
952690
|
-
var
|
|
952765
|
+
var import_promises133 = require("fs/promises");
|
|
952691
952766
|
var import_path95 = __toESM(require("path"), 1);
|
|
952692
952767
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
952693
952768
|
context;
|
|
@@ -952716,8 +952791,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
952716
952791
|
endpointId
|
|
952717
952792
|
});
|
|
952718
952793
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
952719
|
-
await (0,
|
|
952720
|
-
await (0,
|
|
952794
|
+
await (0, import_promises133.mkdir)(import_path95.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
952795
|
+
await (0, import_promises133.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
952721
952796
|
} catch (error50) {
|
|
952722
952797
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
952723
952798
|
}
|
|
@@ -952831,7 +952906,7 @@ init_lib8();
|
|
|
952831
952906
|
var import_autoversion3 = __toESM(require_autoversion(), 1);
|
|
952832
952907
|
init_lib9();
|
|
952833
952908
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
952834
|
-
var
|
|
952909
|
+
var import_promises137 = require("fs/promises");
|
|
952835
952910
|
var path102 = __toESM(require("path"), 1);
|
|
952836
952911
|
var import_path98 = require("path");
|
|
952837
952912
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
@@ -952839,12 +952914,12 @@ var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
|
952839
952914
|
// ../generation/local-generation/local-workspace-runner/lib/applyTypeRelocations.js
|
|
952840
952915
|
init_lib8();
|
|
952841
952916
|
init_lib9();
|
|
952842
|
-
var
|
|
952917
|
+
var import_promises134 = require("fs/promises");
|
|
952843
952918
|
async function applyTypeRelocations({ ir: ir3, tmpOutputDirectory, context: context3 }) {
|
|
952844
952919
|
const relocationsFilepath = join8(tmpOutputDirectory, RelativeFilePath2.of(TYPE_RELOCATIONS_FILENAME));
|
|
952845
952920
|
let contents;
|
|
952846
952921
|
try {
|
|
952847
|
-
contents = await (0,
|
|
952922
|
+
contents = await (0, import_promises134.readFile)(relocationsFilepath, "utf-8");
|
|
952848
952923
|
} catch {
|
|
952849
952924
|
return;
|
|
952850
952925
|
}
|
|
@@ -952878,7 +952953,7 @@ async function applyTypeRelocations({ ir: ir3, tmpOutputDirectory, context: cont
|
|
|
952878
952953
|
} catch (error50) {
|
|
952879
952954
|
context3.logger.warn(`Failed to apply type relocations from ${relocationsFilepath}: ${error50 instanceof Error ? error50.message : String(error50)}`);
|
|
952880
952955
|
} finally {
|
|
952881
|
-
await (0,
|
|
952956
|
+
await (0, import_promises134.rm)(relocationsFilepath, { force: true });
|
|
952882
952957
|
}
|
|
952883
952958
|
}
|
|
952884
952959
|
|
|
@@ -953420,7 +953495,7 @@ var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
|
953420
953495
|
init_lib33();
|
|
953421
953496
|
init_lib6();
|
|
953422
953497
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
953423
|
-
var
|
|
953498
|
+
var import_promises135 = require("fs/promises");
|
|
953424
953499
|
var import_os12 = require("os");
|
|
953425
953500
|
var import_path96 = require("path");
|
|
953426
953501
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
@@ -953529,7 +953604,7 @@ var LocalTaskHandler = class {
|
|
|
953529
953604
|
try {
|
|
953530
953605
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
953531
953606
|
diffFile = await this.generateDiffFile();
|
|
953532
|
-
const diffContent = await (0,
|
|
953607
|
+
const diffContent = await (0, import_promises135.readFile)(diffFile, "utf-8");
|
|
953533
953608
|
if (diffContent.trim().length === 0) {
|
|
953534
953609
|
this.context.logger.info("No changes detected in generated SDK");
|
|
953535
953610
|
return null;
|
|
@@ -953734,7 +953809,7 @@ var LocalTaskHandler = class {
|
|
|
953734
953809
|
} finally {
|
|
953735
953810
|
if (diffFile) {
|
|
953736
953811
|
try {
|
|
953737
|
-
await (0,
|
|
953812
|
+
await (0, import_promises135.rm)(diffFile);
|
|
953738
953813
|
} catch (cleanupError) {
|
|
953739
953814
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
953740
953815
|
}
|
|
@@ -953915,7 +953990,7 @@ var LocalTaskHandler = class {
|
|
|
953915
953990
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
953916
953991
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
953917
953992
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
953918
|
-
await (0,
|
|
953993
|
+
await (0, import_promises135.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true, verbatimSymlinks: true });
|
|
953919
953994
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
953920
953995
|
await this.runThrowawayGitCommand(["config", "gc.auto", "0"], tmpOutputResolutionDir);
|
|
953921
953996
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
@@ -953936,22 +954011,22 @@ var LocalTaskHandler = class {
|
|
|
953936
954011
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
953937
954012
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
953938
954013
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
953939
|
-
await (0,
|
|
954014
|
+
await (0, import_promises135.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), {
|
|
953940
954015
|
recursive: true,
|
|
953941
954016
|
force: true,
|
|
953942
954017
|
maxRetries: 3,
|
|
953943
954018
|
retryDelay: 100
|
|
953944
954019
|
});
|
|
953945
|
-
await (0,
|
|
953946
|
-
await (0,
|
|
954020
|
+
await (0, import_promises135.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
954021
|
+
await (0, import_promises135.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true, verbatimSymlinks: true });
|
|
953947
954022
|
}
|
|
953948
954023
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
953949
|
-
const contents = await (0,
|
|
954024
|
+
const contents = await (0, import_promises135.readdir)(this.absolutePathToLocalOutput);
|
|
953950
954025
|
const itemsToPreserve = [".git"];
|
|
953951
954026
|
if (await this.generatedOutputMissingReadme()) {
|
|
953952
954027
|
itemsToPreserve.push("README.md");
|
|
953953
954028
|
}
|
|
953954
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
954029
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises135.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
953955
954030
|
force: true,
|
|
953956
954031
|
recursive: true
|
|
953957
954032
|
})));
|
|
@@ -953959,11 +954034,11 @@ var LocalTaskHandler = class {
|
|
|
953959
954034
|
}
|
|
953960
954035
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
953961
954036
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
953962
|
-
await (0,
|
|
954037
|
+
await (0, import_promises135.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
953963
954038
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
953964
954039
|
}
|
|
953965
954040
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
953966
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
954041
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises135.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
953967
954042
|
if (firstLocalOutputItem == null) {
|
|
953968
954043
|
return;
|
|
953969
954044
|
}
|
|
@@ -953971,10 +954046,10 @@ var LocalTaskHandler = class {
|
|
|
953971
954046
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
953972
954047
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
953973
954048
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
953974
|
-
await (0,
|
|
954049
|
+
await (0, import_promises135.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true, verbatimSymlinks: true });
|
|
953975
954050
|
}
|
|
953976
954051
|
} else {
|
|
953977
|
-
await (0,
|
|
954052
|
+
await (0, import_promises135.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true, verbatimSymlinks: true });
|
|
953978
954053
|
}
|
|
953979
954054
|
}
|
|
953980
954055
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
@@ -953995,7 +954070,7 @@ var LocalTaskHandler = class {
|
|
|
953995
954070
|
*/
|
|
953996
954071
|
async generatedOutputMissingReadme() {
|
|
953997
954072
|
try {
|
|
953998
|
-
const contents = await (0,
|
|
954073
|
+
const contents = await (0, import_promises135.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
953999
954074
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
954000
954075
|
return false;
|
|
954001
954076
|
}
|
|
@@ -954045,13 +954120,13 @@ var LocalTaskHandler = class {
|
|
|
954045
954120
|
async readPriorChangelog(maxEntries) {
|
|
954046
954121
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
954047
954122
|
try {
|
|
954048
|
-
const files = await (0,
|
|
954123
|
+
const files = await (0, import_promises135.readdir)(this.absolutePathToLocalOutput);
|
|
954049
954124
|
const changelogFile = files.find((f3) => f3.toLowerCase() === "changelog.md");
|
|
954050
954125
|
if (!changelogFile) {
|
|
954051
954126
|
return "";
|
|
954052
954127
|
}
|
|
954053
954128
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
954054
|
-
const content5 = await (0,
|
|
954129
|
+
const content5 = await (0, import_promises135.readFile)(changelogPath, "utf-8");
|
|
954055
954130
|
if (content5.trim().length === 0) {
|
|
954056
954131
|
return "";
|
|
954057
954132
|
}
|
|
@@ -954127,11 +954202,11 @@ var LocalTaskHandler = class {
|
|
|
954127
954202
|
}
|
|
954128
954203
|
};
|
|
954129
954204
|
async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
954130
|
-
const tmpStat = await (0,
|
|
954205
|
+
const tmpStat = await (0, import_promises135.stat)(src);
|
|
954131
954206
|
if (tmpStat.size === 0) {
|
|
954132
954207
|
return "skipped-empty";
|
|
954133
954208
|
}
|
|
954134
|
-
await (0,
|
|
954209
|
+
await (0, import_promises135.cp)(src, dest);
|
|
954135
954210
|
return "copied";
|
|
954136
954211
|
}
|
|
954137
954212
|
|
|
@@ -954139,7 +954214,7 @@ async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
|
954139
954214
|
init_lib4();
|
|
954140
954215
|
init_lib8();
|
|
954141
954216
|
init_lib35();
|
|
954142
|
-
var
|
|
954217
|
+
var import_promises136 = require("fs/promises");
|
|
954143
954218
|
init_js_yaml();
|
|
954144
954219
|
var import_path97 = __toESM(require("path"), 1);
|
|
954145
954220
|
init_index_min2();
|
|
@@ -954208,7 +954283,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
954208
954283
|
});
|
|
954209
954284
|
}
|
|
954210
954285
|
resolved = filterSpec(resolved, audiences);
|
|
954211
|
-
await (0,
|
|
954286
|
+
await (0, import_promises136.writeFile)(import_path97.default.join(hostOutputDir, filename), JSON.stringify(resolved));
|
|
954212
954287
|
context3.logger.debug(`Resolved ${isAsync2 ? "AsyncAPI" : "OpenAPI"} spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
954213
954288
|
return {
|
|
954214
954289
|
type: isAsync2 ? "asyncapi" : "openapi",
|
|
@@ -954218,7 +954293,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
954218
954293
|
}
|
|
954219
954294
|
async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context: context3, index: index3 }) {
|
|
954220
954295
|
const filename = `openrpc${index3}.json`;
|
|
954221
|
-
const rawContent = await (0,
|
|
954296
|
+
const rawContent = await (0, import_promises136.readFile)(spec.absoluteFilepath, "utf-8");
|
|
954222
954297
|
let parsed;
|
|
954223
954298
|
try {
|
|
954224
954299
|
parsed = JSON.parse(rawContent);
|
|
@@ -954228,7 +954303,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954228
954303
|
let result = parsed;
|
|
954229
954304
|
const overrides = normalizeOverrides(spec.absoluteFilepathToOverrides);
|
|
954230
954305
|
for (const overridePath of overrides) {
|
|
954231
|
-
const overrideContent = await (0,
|
|
954306
|
+
const overrideContent = await (0, import_promises136.readFile)(overridePath, "utf-8");
|
|
954232
954307
|
let overrideParsed;
|
|
954233
954308
|
try {
|
|
954234
954309
|
overrideParsed = JSON.parse(overrideContent);
|
|
@@ -954240,7 +954315,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954240
954315
|
overrides: overrideParsed
|
|
954241
954316
|
});
|
|
954242
954317
|
}
|
|
954243
|
-
await (0,
|
|
954318
|
+
await (0, import_promises136.writeFile)(import_path97.default.join(hostOutputDir, filename), JSON.stringify(result));
|
|
954244
954319
|
context3.logger.debug(`Resolved OpenRPC spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
954245
954320
|
return {
|
|
954246
954321
|
type: "openrpc",
|
|
@@ -954251,7 +954326,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954251
954326
|
async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
954252
954327
|
const dirName = `protobuf${index3}`;
|
|
954253
954328
|
const destDir = import_path97.default.join(hostOutputDir, dirName);
|
|
954254
|
-
await (0,
|
|
954329
|
+
await (0, import_promises136.cp)(spec.absoluteFilepathToProtobufRoot, destDir, { recursive: true });
|
|
954255
954330
|
const entry = {
|
|
954256
954331
|
type: "protobuf",
|
|
954257
954332
|
specPath: toContainerPath(dirName, containerBaseDir)
|
|
@@ -954261,7 +954336,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
954261
954336
|
entry.overridePaths = [];
|
|
954262
954337
|
for (const [i5, override] of overrides.entries()) {
|
|
954263
954338
|
const overrideName = `protobuf${index3}-override-${i5}${import_path97.default.extname(override)}`;
|
|
954264
|
-
await (0,
|
|
954339
|
+
await (0, import_promises136.copyFile)(override, import_path97.default.join(hostOutputDir, overrideName));
|
|
954265
954340
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
954266
954341
|
}
|
|
954267
954342
|
}
|
|
@@ -954270,7 +954345,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
954270
954345
|
async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
954271
954346
|
const ext2 = import_path97.default.extname(spec.absoluteFilepath) || ".graphql";
|
|
954272
954347
|
const filename = `graphql${index3}${ext2}`;
|
|
954273
|
-
await (0,
|
|
954348
|
+
await (0, import_promises136.copyFile)(spec.absoluteFilepath, import_path97.default.join(hostOutputDir, filename));
|
|
954274
954349
|
const entry = {
|
|
954275
954350
|
type: "graphql",
|
|
954276
954351
|
specPath: toContainerPath(filename, containerBaseDir),
|
|
@@ -954281,7 +954356,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
954281
954356
|
entry.overridePaths = [];
|
|
954282
954357
|
for (const [i5, override] of overrides.entries()) {
|
|
954283
954358
|
const overrideName = `graphql${index3}-override-${i5}${import_path97.default.extname(override)}`;
|
|
954284
|
-
await (0,
|
|
954359
|
+
await (0, import_promises136.copyFile)(override, import_path97.default.join(hostOutputDir, overrideName));
|
|
954285
954360
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
954286
954361
|
}
|
|
954287
954362
|
}
|
|
@@ -954289,7 +954364,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
954289
954364
|
}
|
|
954290
954365
|
async function isAsyncAPISpec(filepath) {
|
|
954291
954366
|
try {
|
|
954292
|
-
const content5 = await (0,
|
|
954367
|
+
const content5 = await (0, import_promises136.readFile)(filepath, "utf-8");
|
|
954293
954368
|
return content5.includes("asyncapi");
|
|
954294
954369
|
} catch {
|
|
954295
954370
|
return false;
|
|
@@ -954399,7 +954474,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
954399
954474
|
context: context3,
|
|
954400
954475
|
audiences
|
|
954401
954476
|
});
|
|
954402
|
-
await (0,
|
|
954477
|
+
await (0, import_promises136.writeFile)(join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of(SPECS_MANIFEST_FILENAME)), JSON.stringify(manifest, void 0, 4));
|
|
954403
954478
|
const tarGzPath = join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of("specs.tar.gz"));
|
|
954404
954479
|
await Kn({
|
|
954405
954480
|
gzip: true,
|
|
@@ -954408,7 +954483,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
954408
954483
|
portable: true,
|
|
954409
954484
|
filter: (entryPath) => entryPath !== "./specs.tar.gz"
|
|
954410
954485
|
}, ["."]);
|
|
954411
|
-
return await (0,
|
|
954486
|
+
return await (0, import_promises136.readFile)(tarGzPath);
|
|
954412
954487
|
} finally {
|
|
954413
954488
|
await tmpDir.cleanup();
|
|
954414
954489
|
}
|
|
@@ -954450,24 +954525,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954450
954525
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
954451
954526
|
const configJsonFile = (0, import_path98.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
954452
954527
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
954453
|
-
await (0,
|
|
954528
|
+
await (0, import_promises137.writeFile)(configJsonFile, "");
|
|
954454
954529
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
954455
954530
|
const tmpOutputDirectory = (0, import_path98.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
954456
954531
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
954457
|
-
await (0,
|
|
954532
|
+
await (0, import_promises137.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
954458
954533
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
954459
954534
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
954460
954535
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
954461
954536
|
const snippetJsonFile = (0, import_path98.join)(workspaceTempDir.path, "snippet.json");
|
|
954462
954537
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
954463
|
-
await (0,
|
|
954538
|
+
await (0, import_promises137.writeFile)(snippetJsonFile, "");
|
|
954464
954539
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
954465
954540
|
}
|
|
954466
954541
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
954467
954542
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
954468
954543
|
const snippetTemplatesJsonFile = (0, import_path98.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
954469
954544
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
954470
|
-
await (0,
|
|
954545
|
+
await (0, import_promises137.writeFile)(snippetTemplatesJsonFile, "");
|
|
954471
954546
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
954472
954547
|
}
|
|
954473
954548
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -954508,7 +954583,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954508
954583
|
publishToRegistry,
|
|
954509
954584
|
paths
|
|
954510
954585
|
});
|
|
954511
|
-
await (0,
|
|
954586
|
+
await (0, import_promises137.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
954512
954587
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
954513
954588
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
954514
954589
|
hostPath: source2.absoluteFilePath,
|
|
@@ -954516,7 +954591,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954516
954591
|
}));
|
|
954517
954592
|
if (rawApiSpecs != null && rawApiSpecs.length > 0) {
|
|
954518
954593
|
const rawSpecsDir = (0, import_path98.join)(workspaceTempDir.path, SPECS_DIRECTORY_NAME);
|
|
954519
|
-
await (0,
|
|
954594
|
+
await (0, import_promises137.mkdir)(rawSpecsDir, { recursive: true });
|
|
954520
954595
|
const containerSpecsDir = environment2.usesContainerPaths ? CONTAINER_SPECS_DIRECTORY : rawSpecsDir;
|
|
954521
954596
|
const manifest = await collectRawSpecs({
|
|
954522
954597
|
specs: rawApiSpecs,
|
|
@@ -954525,7 +954600,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954525
954600
|
context: context3,
|
|
954526
954601
|
audiences
|
|
954527
954602
|
});
|
|
954528
|
-
await (0,
|
|
954603
|
+
await (0, import_promises137.writeFile)((0, import_path98.join)(rawSpecsDir, SPECS_MANIFEST_FILENAME), JSON.stringify(manifest, void 0, 4));
|
|
954529
954604
|
context3.logger.debug(`Wrote raw specs manifest with ${manifest.specs.length} spec(s) to ${rawSpecsDir}`);
|
|
954530
954605
|
sourceMounts.push({
|
|
954531
954606
|
hostPath: AbsoluteFilePath2.of(rawSpecsDir),
|
|
@@ -955289,7 +955364,7 @@ async function runVerifyPipeline({ outputDir, generatorName, generatorVersion, c
|
|
|
955289
955364
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
955290
955365
|
init_lib5();
|
|
955291
955366
|
init_lib6();
|
|
955292
|
-
var
|
|
955367
|
+
var import_promises139 = require("fs/promises");
|
|
955293
955368
|
|
|
955294
955369
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
955295
955370
|
init_lib12();
|
|
@@ -955299,7 +955374,7 @@ init_lib8();
|
|
|
955299
955374
|
init_lib11();
|
|
955300
955375
|
init_lib6();
|
|
955301
955376
|
init_esm19();
|
|
955302
|
-
var
|
|
955377
|
+
var import_promises138 = require("fs/promises");
|
|
955303
955378
|
var LegacyGeneratorInvocationAdapter = class {
|
|
955304
955379
|
context;
|
|
955305
955380
|
constructor(config5) {
|
|
@@ -955553,7 +955628,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
955553
955628
|
code: CliError.Code.InternalError
|
|
955554
955629
|
});
|
|
955555
955630
|
}
|
|
955556
|
-
const contents = await (0,
|
|
955631
|
+
const contents = await (0, import_promises138.readFile)(absolutePath, "utf-8");
|
|
955557
955632
|
return api_exports4.GithubLicense.custom({ contents });
|
|
955558
955633
|
}
|
|
955559
955634
|
buildReadme(target) {
|
|
@@ -955779,7 +955854,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
955779
955854
|
});
|
|
955780
955855
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
955781
955856
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
955782
|
-
await (0,
|
|
955857
|
+
await (0, import_promises139.rm)(snippetPath, { force: true });
|
|
955783
955858
|
}
|
|
955784
955859
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
955785
955860
|
return {
|
|
@@ -955798,7 +955873,7 @@ init_lib4();
|
|
|
955798
955873
|
init_lib8();
|
|
955799
955874
|
init_lib5();
|
|
955800
955875
|
init_lib6();
|
|
955801
|
-
var
|
|
955876
|
+
var import_promises140 = require("fs/promises");
|
|
955802
955877
|
var import_os14 = require("os");
|
|
955803
955878
|
var LegacyRemoteGenerationRunner = class {
|
|
955804
955879
|
context;
|
|
@@ -955857,13 +955932,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
955857
955932
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
955858
955933
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
955859
955934
|
if (targetOutputDirectory != null) {
|
|
955860
|
-
await (0,
|
|
955861
|
-
await (0,
|
|
955935
|
+
await (0, import_promises140.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
955936
|
+
await (0, import_promises140.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
955862
955937
|
recursive: true,
|
|
955863
955938
|
force: true
|
|
955864
955939
|
});
|
|
955865
955940
|
}
|
|
955866
|
-
await (0,
|
|
955941
|
+
await (0, import_promises140.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
955867
955942
|
}
|
|
955868
955943
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
955869
955944
|
return {
|
|
@@ -955892,7 +955967,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
955892
955967
|
}
|
|
955893
955968
|
async getAbsolutePathToPreview(args) {
|
|
955894
955969
|
if (this.isLocalGitCombo(args)) {
|
|
955895
|
-
const tmpPreviewDirectory = await (0,
|
|
955970
|
+
const tmpPreviewDirectory = await (0, import_promises140.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
955896
955971
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
955897
955972
|
}
|
|
955898
955973
|
if (!args.preview) {
|
|
@@ -956628,7 +956703,7 @@ Example:
|
|
|
956628
956703
|
if (!exists2) {
|
|
956629
956704
|
return { shouldProceed: true };
|
|
956630
956705
|
}
|
|
956631
|
-
const files = await (0,
|
|
956706
|
+
const files = await (0, import_promises141.readdir)(outputPath);
|
|
956632
956707
|
if (files.length === 0) {
|
|
956633
956708
|
return { shouldProceed: true };
|
|
956634
956709
|
}
|
|
@@ -957040,7 +957115,7 @@ init_lib4();
|
|
|
957040
957115
|
init_lib33();
|
|
957041
957116
|
init_lib6();
|
|
957042
957117
|
var import_fs38 = require("fs");
|
|
957043
|
-
var
|
|
957118
|
+
var import_promises142 = require("fs/promises");
|
|
957044
957119
|
var import_path101 = require("path");
|
|
957045
957120
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
957046
957121
|
var import_url8 = require("url");
|
|
@@ -957150,7 +957225,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957150
957225
|
}
|
|
957151
957226
|
this.migrationsInstallPromise = (async () => {
|
|
957152
957227
|
const cacheDir = this.cachePath;
|
|
957153
|
-
await (0,
|
|
957228
|
+
await (0, import_promises142.mkdir)(cacheDir, { recursive: true });
|
|
957154
957229
|
const npmCacheDir = (0, import_path101.join)(cacheDir, ".npm-cache");
|
|
957155
957230
|
const packageDir = (0, import_path101.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
957156
957231
|
const packageJsonPath = (0, import_path101.join)(packageDir, "package.json");
|
|
@@ -957167,7 +957242,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957167
957242
|
"--no-audit",
|
|
957168
957243
|
"--no-fund"
|
|
957169
957244
|
], { doNotPipeOutput: true });
|
|
957170
|
-
const packageJsonContent = await (0,
|
|
957245
|
+
const packageJsonContent = await (0, import_promises142.readFile)(packageJsonPath, "utf-8");
|
|
957171
957246
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
957172
957247
|
if (packageJson2.main == null) {
|
|
957173
957248
|
throw new CliError({
|
|
@@ -957212,7 +957287,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957212
957287
|
const myPid = String(process.pid);
|
|
957213
957288
|
while (true) {
|
|
957214
957289
|
try {
|
|
957215
|
-
const fh = await (0,
|
|
957290
|
+
const fh = await (0, import_promises142.open)(lockPath, "wx");
|
|
957216
957291
|
await fh.writeFile(myPid);
|
|
957217
957292
|
await fh.close();
|
|
957218
957293
|
const exitHandler = () => {
|
|
@@ -957229,9 +957304,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957229
957304
|
return async () => {
|
|
957230
957305
|
process.removeListener("exit", exitHandler);
|
|
957231
957306
|
try {
|
|
957232
|
-
const currentContent = await (0,
|
|
957307
|
+
const currentContent = await (0, import_promises142.readFile)(lockPath, "utf-8");
|
|
957233
957308
|
if (currentContent.trim() === myPid) {
|
|
957234
|
-
await (0,
|
|
957309
|
+
await (0, import_promises142.unlink)(lockPath);
|
|
957235
957310
|
} else {
|
|
957236
957311
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
957237
957312
|
}
|
|
@@ -957245,14 +957320,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957245
957320
|
throw err;
|
|
957246
957321
|
}
|
|
957247
957322
|
try {
|
|
957248
|
-
const lockContent = await (0,
|
|
957323
|
+
const lockContent = await (0, import_promises142.readFile)(lockPath, "utf-8");
|
|
957249
957324
|
const lockPid = Number(lockContent.trim());
|
|
957250
|
-
const lockStat = await (0,
|
|
957325
|
+
const lockStat = await (0, import_promises142.stat)(lockPath);
|
|
957251
957326
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
957252
957327
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
957253
957328
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
957254
957329
|
try {
|
|
957255
|
-
await (0,
|
|
957330
|
+
await (0, import_promises142.unlink)(lockPath);
|
|
957256
957331
|
} catch (unlinkErr) {
|
|
957257
957332
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
957258
957333
|
}
|
|
@@ -957941,7 +958016,7 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
957941
958016
|
init_lib19();
|
|
957942
958017
|
init_lib8();
|
|
957943
958018
|
init_source();
|
|
957944
|
-
var
|
|
958019
|
+
var import_promises147 = require("fs/promises");
|
|
957945
958020
|
var import_fs_extra = __toESM(require_lib18(), 1);
|
|
957946
958021
|
var import_path104 = __toESM(require("path"), 1);
|
|
957947
958022
|
|
|
@@ -957951,7 +958026,7 @@ init_lib26();
|
|
|
957951
958026
|
init_lib8();
|
|
957952
958027
|
init_lib6();
|
|
957953
958028
|
init_source();
|
|
957954
|
-
var
|
|
958029
|
+
var import_promises144 = require("fs/promises");
|
|
957955
958030
|
init_lodash();
|
|
957956
958031
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
957957
958032
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -957983,7 +958058,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
957983
958058
|
}
|
|
957984
958059
|
}
|
|
957985
958060
|
}
|
|
957986
|
-
await (0,
|
|
958061
|
+
await (0, import_promises144.mkdir)(FERN_DIRECTORY);
|
|
957987
958062
|
await writeProjectConfig({
|
|
957988
958063
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
957989
958064
|
organization,
|
|
@@ -958007,11 +958082,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
958007
958082
|
organization,
|
|
958008
958083
|
version: versionOfCli
|
|
958009
958084
|
};
|
|
958010
|
-
await (0,
|
|
958085
|
+
await (0, import_promises144.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
958011
958086
|
}
|
|
958012
958087
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
958013
958088
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
958014
|
-
await (0,
|
|
958089
|
+
await (0, import_promises144.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
958015
958090
|
}
|
|
958016
958091
|
|
|
958017
958092
|
// ../init/lib/createWorkspace.js
|
|
@@ -958205,7 +958280,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
958205
958280
|
init_lib4();
|
|
958206
958281
|
init_lib6();
|
|
958207
958282
|
init_source();
|
|
958208
|
-
var
|
|
958283
|
+
var import_promises145 = require("fs/promises");
|
|
958209
958284
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
958210
958285
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
958211
958286
|
const formatted = await formatDefinitionFile({
|
|
@@ -958213,7 +958288,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
958213
958288
|
});
|
|
958214
958289
|
if (formatted !== file4.rawContents) {
|
|
958215
958290
|
if (shouldFix) {
|
|
958216
|
-
await (0,
|
|
958291
|
+
await (0, import_promises145.writeFile)(file4.absoluteFilePath, formatted);
|
|
958217
958292
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
958218
958293
|
} else {
|
|
958219
958294
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -958226,7 +958301,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
958226
958301
|
// ../init/lib/createWorkspace.js
|
|
958227
958302
|
init_lib8();
|
|
958228
958303
|
init_lib6();
|
|
958229
|
-
var
|
|
958304
|
+
var import_promises146 = require("fs/promises");
|
|
958230
958305
|
init_js_yaml();
|
|
958231
958306
|
|
|
958232
958307
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -958427,7 +958502,7 @@ components:
|
|
|
958427
958502
|
// ../init/lib/createWorkspace.js
|
|
958428
958503
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
958429
958504
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958430
|
-
await (0,
|
|
958505
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace);
|
|
958431
958506
|
}
|
|
958432
958507
|
await writeGeneratorsConfiguration({
|
|
958433
958508
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -958442,7 +958517,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
958442
958517
|
}
|
|
958443
958518
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
958444
958519
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958445
|
-
await (0,
|
|
958520
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace);
|
|
958446
958521
|
}
|
|
958447
958522
|
await writeGeneratorsConfiguration({
|
|
958448
958523
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -958455,10 +958530,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
958455
958530
|
}
|
|
958456
958531
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
958457
958532
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958458
|
-
await (0,
|
|
958533
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
958459
958534
|
}
|
|
958460
958535
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
958461
|
-
await (0,
|
|
958536
|
+
await (0, import_promises146.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
958462
958537
|
await writeGeneratorsConfiguration({
|
|
958463
958538
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
958464
958539
|
cliVersion,
|
|
@@ -958503,7 +958578,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
958503
958578
|
return config5;
|
|
958504
958579
|
}
|
|
958505
958580
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
958506
|
-
await (0,
|
|
958581
|
+
await (0, import_promises146.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
958507
958582
|
sortKeys: (a3, b5) => {
|
|
958508
958583
|
if (a3 === "api") {
|
|
958509
958584
|
return -1;
|
|
@@ -958522,8 +958597,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
958522
958597
|
strategy: "status-code"
|
|
958523
958598
|
}
|
|
958524
958599
|
};
|
|
958525
|
-
await (0,
|
|
958526
|
-
await (0,
|
|
958600
|
+
await (0, import_promises146.mkdir)(directoryOfDefinition);
|
|
958601
|
+
await (0, import_promises146.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), index_vite_proxy_tmp_default.dump(rootApi));
|
|
958527
958602
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
958528
958603
|
let formattedContent;
|
|
958529
958604
|
try {
|
|
@@ -958539,7 +958614,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
958539
958614
|
code: CliError.Code.ParseError
|
|
958540
958615
|
});
|
|
958541
958616
|
}
|
|
958542
|
-
await (0,
|
|
958617
|
+
await (0, import_promises146.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
958543
958618
|
}
|
|
958544
958619
|
|
|
958545
958620
|
// ../init/lib/initializeAPI.js
|
|
@@ -958590,7 +958665,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
958590
958665
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
958591
958666
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
958592
958667
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
958593
|
-
await (0,
|
|
958668
|
+
await (0, import_promises147.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
958594
958669
|
if (inlinedApiDefinition) {
|
|
958595
958670
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
958596
958671
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -958629,7 +958704,7 @@ init_lib19();
|
|
|
958629
958704
|
init_lib4();
|
|
958630
958705
|
init_lib8();
|
|
958631
958706
|
init_source();
|
|
958632
|
-
var
|
|
958707
|
+
var import_promises148 = require("fs/promises");
|
|
958633
958708
|
init_js_yaml();
|
|
958634
958709
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
958635
958710
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -958645,7 +958720,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
958645
958720
|
} else {
|
|
958646
958721
|
try {
|
|
958647
958722
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
958648
|
-
await (0,
|
|
958723
|
+
await (0, import_promises148.writeFile)(docsYmlPath, index_vite_proxy_tmp_default.dump(docsConfig));
|
|
958649
958724
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
958650
958725
|
return;
|
|
958651
958726
|
} catch (writeError) {
|
|
@@ -958702,7 +958777,7 @@ var FernDocsBuilder = class {
|
|
|
958702
958777
|
init_lib12();
|
|
958703
958778
|
init_lib8();
|
|
958704
958779
|
init_lib6();
|
|
958705
|
-
var
|
|
958780
|
+
var import_promises149 = require("fs/promises");
|
|
958706
958781
|
init_js_yaml();
|
|
958707
958782
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
958708
958783
|
openApiSpecs = {};
|
|
@@ -958762,7 +958837,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
958762
958837
|
}
|
|
958763
958838
|
async build({ outputDirectory }) {
|
|
958764
958839
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
958765
|
-
await (0,
|
|
958840
|
+
await (0, import_promises149.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
958766
958841
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
958767
958842
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
958768
958843
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -958787,27 +958862,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
958787
958862
|
}))
|
|
958788
958863
|
};
|
|
958789
958864
|
}
|
|
958790
|
-
await (0,
|
|
958865
|
+
await (0, import_promises149.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), index_vite_proxy_tmp_default.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
958791
958866
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
958792
958867
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
958793
|
-
await (0,
|
|
958794
|
-
await (0,
|
|
958868
|
+
await (0, import_promises149.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
958869
|
+
await (0, import_promises149.cp)(absolutePath, absolutePathToOpenAPI);
|
|
958795
958870
|
}));
|
|
958796
958871
|
}
|
|
958797
|
-
await (0,
|
|
958872
|
+
await (0, import_promises149.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), index_vite_proxy_tmp_default.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
958798
958873
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
958799
958874
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
958800
|
-
await (0,
|
|
958875
|
+
await (0, import_promises149.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
958801
958876
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
958802
958877
|
${index_vite_proxy_tmp_default.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
958803
958878
|
|
|
958804
958879
|
` : "";
|
|
958805
|
-
await (0,
|
|
958880
|
+
await (0, import_promises149.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
958806
958881
|
}));
|
|
958807
958882
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
958808
958883
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
958809
|
-
await (0,
|
|
958810
|
-
await (0,
|
|
958884
|
+
await (0, import_promises149.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
958885
|
+
await (0, import_promises149.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
958811
958886
|
}));
|
|
958812
958887
|
}
|
|
958813
958888
|
setInstance({ companyName }) {
|
|
@@ -958841,7 +958916,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
958841
958916
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
958842
958917
|
init_lib8();
|
|
958843
958918
|
init_lib6();
|
|
958844
|
-
var
|
|
958919
|
+
var import_promises151 = require("fs/promises");
|
|
958845
958920
|
|
|
958846
958921
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
958847
958922
|
function convertColors(colors19) {
|
|
@@ -958902,10 +958977,10 @@ init_lib8();
|
|
|
958902
958977
|
|
|
958903
958978
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
958904
958979
|
init_lib8();
|
|
958905
|
-
var
|
|
958980
|
+
var import_promises150 = require("fs/promises");
|
|
958906
958981
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
958907
958982
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
958908
|
-
const text9 = await (0,
|
|
958983
|
+
const text9 = await (0, import_promises150.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
958909
958984
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
958910
958985
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
958911
958986
|
const transformedContent = markReferencedAssets({
|
|
@@ -959074,7 +959149,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
959074
959149
|
documentationTab = void 0;
|
|
959075
959150
|
tabUrlToInfo = {};
|
|
959076
959151
|
async import({ args, builder }) {
|
|
959077
|
-
const mintJsonContent = await (0,
|
|
959152
|
+
const mintJsonContent = await (0, import_promises151.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
959078
959153
|
const mint = this.parseMintJson({
|
|
959079
959154
|
content: mintJsonContent,
|
|
959080
959155
|
absolutePathToMintJson: args.absolutePathToMintJson
|
|
@@ -959220,7 +959295,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
959220
959295
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
959221
959296
|
init_lib12();
|
|
959222
959297
|
init_lib8();
|
|
959223
|
-
var
|
|
959298
|
+
var import_promises152 = require("fs/promises");
|
|
959224
959299
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
959225
959300
|
const mintlifyImporter = new MintlifyImporter({
|
|
959226
959301
|
context: taskContext
|
|
@@ -959231,7 +959306,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
959231
959306
|
builder
|
|
959232
959307
|
});
|
|
959233
959308
|
await builder.build({ outputDirectory: outputPath });
|
|
959234
|
-
await (0,
|
|
959309
|
+
await (0, import_promises152.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
959235
959310
|
version: versionOfCli,
|
|
959236
959311
|
organization
|
|
959237
959312
|
}, void 0, 4));
|
|
@@ -959292,7 +959367,7 @@ function assertIsStringArray(val) {
|
|
|
959292
959367
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
959293
959368
|
init_lib4();
|
|
959294
959369
|
init_lib8();
|
|
959295
|
-
var
|
|
959370
|
+
var import_promises153 = require("fs/promises");
|
|
959296
959371
|
|
|
959297
959372
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
959298
959373
|
init_unist_util_visit();
|
|
@@ -962646,7 +962721,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962646
962721
|
if (response.ok) {
|
|
962647
962722
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
962648
962723
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
962649
|
-
await (0,
|
|
962724
|
+
await (0, import_promises153.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
962650
962725
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
962651
962726
|
}
|
|
962652
962727
|
}
|
|
@@ -962663,7 +962738,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962663
962738
|
*/
|
|
962664
962739
|
async getAndCreateAssetsDirectory() {
|
|
962665
962740
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
962666
|
-
await (0,
|
|
962741
|
+
await (0, import_promises153.mkdir)(assetsDirectory, { recursive: true });
|
|
962667
962742
|
return assetsDirectory;
|
|
962668
962743
|
}
|
|
962669
962744
|
/**
|
|
@@ -962713,7 +962788,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962713
962788
|
absolutePathToOutputDirectory,
|
|
962714
962789
|
section
|
|
962715
962790
|
});
|
|
962716
|
-
await (0,
|
|
962791
|
+
await (0, import_promises153.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
962717
962792
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
962718
962793
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
962719
962794
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -962728,7 +962803,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962728
962803
|
absolutePathToOutputDirectoryForSection,
|
|
962729
962804
|
page: page.slug
|
|
962730
962805
|
});
|
|
962731
|
-
await (0,
|
|
962806
|
+
await (0, import_promises153.writeFile)(absolutePathForPage, result.data.mdx);
|
|
962732
962807
|
if (result.data.images.imageURLs.length > 0) {
|
|
962733
962808
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
962734
962809
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -962741,8 +962816,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962741
962816
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
962742
962817
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
962743
962818
|
const imageDir = dirname6(imagePath);
|
|
962744
|
-
await (0,
|
|
962745
|
-
await (0,
|
|
962819
|
+
await (0, import_promises153.mkdir)(imageDir, { recursive: true });
|
|
962820
|
+
await (0, import_promises153.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
962746
962821
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
962747
962822
|
} catch (error50) {
|
|
962748
962823
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -962826,7 +962901,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962826
962901
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
962827
962902
|
init_lib12();
|
|
962828
962903
|
init_lib8();
|
|
962829
|
-
var
|
|
962904
|
+
var import_promises154 = require("fs/promises");
|
|
962830
962905
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
962831
962906
|
const builder = new FernDocsBuilderImpl();
|
|
962832
962907
|
builder.setInstance({ companyName: organization });
|
|
@@ -962841,7 +962916,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
962841
962916
|
builder
|
|
962842
962917
|
});
|
|
962843
962918
|
await builder.build({ outputDirectory: outputPath });
|
|
962844
|
-
await (0,
|
|
962919
|
+
await (0, import_promises154.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
962845
962920
|
version: versionOfCli,
|
|
962846
962921
|
organization
|
|
962847
962922
|
}, void 0, 4));
|
|
@@ -962868,7 +962943,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
962868
962943
|
|
|
962869
962944
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
962870
962945
|
init_axios2();
|
|
962871
|
-
var
|
|
962946
|
+
var import_promises155 = require("fs/promises");
|
|
962872
962947
|
init_js_yaml();
|
|
962873
962948
|
var import_path105 = require("path");
|
|
962874
962949
|
var import_tmp_promise19 = __toESM(require_tmp_promise(), 1);
|
|
@@ -962884,7 +962959,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
962884
962959
|
const filePath = (0, import_path105.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
962885
962960
|
logger4.debug("tmpDir", tmpDir.path);
|
|
962886
962961
|
logger4.debug("filePath", filePath);
|
|
962887
|
-
await (0,
|
|
962962
|
+
await (0, import_promises155.writeFile)(filePath, data2);
|
|
962888
962963
|
return {
|
|
962889
962964
|
status: LoadOpenAPIStatus.Success,
|
|
962890
962965
|
filePath
|
|
@@ -966808,7 +966883,7 @@ function getAutomationContextFromEnv() {
|
|
|
966808
966883
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
966809
966884
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
966810
966885
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
966811
|
-
cli_version: "5.
|
|
966886
|
+
cli_version: "5.58.0"
|
|
966812
966887
|
};
|
|
966813
966888
|
}
|
|
966814
966889
|
function isAutomationMode() {
|
|
@@ -967640,7 +967715,7 @@ var CliContext = class _CliContext {
|
|
|
967640
967715
|
if (false) {
|
|
967641
967716
|
this.logger.error("CLI_VERSION is not defined");
|
|
967642
967717
|
}
|
|
967643
|
-
return "5.
|
|
967718
|
+
return "5.58.0";
|
|
967644
967719
|
}
|
|
967645
967720
|
getCliName() {
|
|
967646
967721
|
if (false) {
|
|
@@ -967950,7 +968025,7 @@ init_lib19();
|
|
|
967950
968025
|
init_lib8();
|
|
967951
968026
|
init_lib6();
|
|
967952
968027
|
init_source();
|
|
967953
|
-
var
|
|
968028
|
+
var import_promises156 = require("fs/promises");
|
|
967954
968029
|
|
|
967955
968030
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
967956
968031
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -968032,7 +968107,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
968032
968107
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
968033
968108
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
968034
968109
|
if (apisDirectoryExists) {
|
|
968035
|
-
const apiDirectoryContents = await (0,
|
|
968110
|
+
const apiDirectoryContents = await (0, import_promises156.readdir)(apisDirectory, { withFileTypes: true });
|
|
968036
968111
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
968037
968112
|
if (item.isDirectory()) {
|
|
968038
968113
|
all9.push(item.name);
|
|
@@ -968110,13 +968185,13 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
968110
968185
|
init_lib19();
|
|
968111
968186
|
init_lib6();
|
|
968112
968187
|
var import_generators_sdk6 = __toESM(require_generators_sdk(), 1);
|
|
968113
|
-
var
|
|
968188
|
+
var import_promises161 = require("fs/promises");
|
|
968114
968189
|
|
|
968115
968190
|
// src/commands/generator-list/getGeneratorList.ts
|
|
968116
968191
|
init_lib19();
|
|
968117
968192
|
init_lib4();
|
|
968118
968193
|
init_lib6();
|
|
968119
|
-
var
|
|
968194
|
+
var import_promises157 = require("fs/promises");
|
|
968120
968195
|
init_js_yaml();
|
|
968121
968196
|
var GenerationModeFilter = {
|
|
968122
968197
|
GitHub: "github",
|
|
@@ -968177,7 +968252,7 @@ async function getGeneratorList({
|
|
|
968177
968252
|
return;
|
|
968178
968253
|
}
|
|
968179
968254
|
try {
|
|
968180
|
-
await (0,
|
|
968255
|
+
await (0, import_promises157.writeFile)(outputLocation, generatorsListYaml);
|
|
968181
968256
|
} catch (error50) {
|
|
968182
968257
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
968183
968258
|
code: CliError.Code.ConfigError
|
|
@@ -968247,7 +968322,7 @@ async function getGeneratorMetadata({
|
|
|
968247
968322
|
|
|
968248
968323
|
// src/commands/organization/getOrganization.ts
|
|
968249
968324
|
init_lib6();
|
|
968250
|
-
var
|
|
968325
|
+
var import_promises158 = require("fs/promises");
|
|
968251
968326
|
async function getOrganization({
|
|
968252
968327
|
project,
|
|
968253
968328
|
outputLocation,
|
|
@@ -968259,7 +968334,7 @@ async function getOrganization({
|
|
|
968259
968334
|
return;
|
|
968260
968335
|
}
|
|
968261
968336
|
try {
|
|
968262
|
-
await (0,
|
|
968337
|
+
await (0, import_promises158.writeFile)(outputLocation, org);
|
|
968263
968338
|
} catch (error50) {
|
|
968264
968339
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
968265
968340
|
code: CliError.Code.ConfigError
|
|
@@ -968272,7 +968347,7 @@ init_lib19();
|
|
|
968272
968347
|
init_lib8();
|
|
968273
968348
|
init_lib6();
|
|
968274
968349
|
init_source();
|
|
968275
|
-
var
|
|
968350
|
+
var import_promises160 = require("fs/promises");
|
|
968276
968351
|
var import_path107 = __toESM(require("path"), 1);
|
|
968277
968352
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
968278
968353
|
var import_yaml6 = __toESM(require_dist11(), 1);
|
|
@@ -968282,7 +968357,7 @@ init_lib4();
|
|
|
968282
968357
|
init_lib33();
|
|
968283
968358
|
init_lib6();
|
|
968284
968359
|
var import_fs40 = require("fs");
|
|
968285
|
-
var
|
|
968360
|
+
var import_promises159 = require("fs/promises");
|
|
968286
968361
|
var import_os15 = require("os");
|
|
968287
968362
|
var import_path106 = require("path");
|
|
968288
968363
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -968310,7 +968385,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968310
968385
|
const myPid = String(process.pid);
|
|
968311
968386
|
while (true) {
|
|
968312
968387
|
try {
|
|
968313
|
-
const fh = await (0,
|
|
968388
|
+
const fh = await (0, import_promises159.open)(lockPath, "wx");
|
|
968314
968389
|
await fh.writeFile(myPid);
|
|
968315
968390
|
await fh.close();
|
|
968316
968391
|
const exitHandler = () => {
|
|
@@ -968327,9 +968402,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968327
968402
|
return async () => {
|
|
968328
968403
|
process.removeListener("exit", exitHandler);
|
|
968329
968404
|
try {
|
|
968330
|
-
const currentContent = await (0,
|
|
968405
|
+
const currentContent = await (0, import_promises159.readFile)(lockPath, "utf-8");
|
|
968331
968406
|
if (currentContent.trim() === myPid) {
|
|
968332
|
-
await (0,
|
|
968407
|
+
await (0, import_promises159.unlink)(lockPath);
|
|
968333
968408
|
} else {
|
|
968334
968409
|
logger4.debug(
|
|
968335
968410
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -968345,14 +968420,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968345
968420
|
throw err;
|
|
968346
968421
|
}
|
|
968347
968422
|
try {
|
|
968348
|
-
const lockContent = await (0,
|
|
968423
|
+
const lockContent = await (0, import_promises159.readFile)(lockPath, "utf-8");
|
|
968349
968424
|
const lockPid = Number(lockContent.trim());
|
|
968350
|
-
const lockStat = await (0,
|
|
968425
|
+
const lockStat = await (0, import_promises159.stat)(lockPath);
|
|
968351
968426
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
968352
968427
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
968353
968428
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
968354
968429
|
try {
|
|
968355
|
-
await (0,
|
|
968430
|
+
await (0, import_promises159.unlink)(lockPath);
|
|
968356
968431
|
} catch (unlinkErr) {
|
|
968357
968432
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
968358
968433
|
}
|
|
@@ -968376,7 +968451,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
968376
968451
|
}
|
|
968377
968452
|
migrationsInstallPromise = (async () => {
|
|
968378
968453
|
const cacheDir = getMigrationCacheDir();
|
|
968379
|
-
await (0,
|
|
968454
|
+
await (0, import_promises159.mkdir)(cacheDir, { recursive: true });
|
|
968380
968455
|
const npmCacheDir = (0, import_path106.join)(cacheDir, ".npm-cache");
|
|
968381
968456
|
const packageDir = (0, import_path106.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
968382
968457
|
const packageJsonPath = (0, import_path106.join)(packageDir, "package.json");
|
|
@@ -968393,7 +968468,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
968393
968468
|
"--no-audit",
|
|
968394
968469
|
"--no-fund"
|
|
968395
968470
|
]);
|
|
968396
|
-
const packageJsonContent = await (0,
|
|
968471
|
+
const packageJsonContent = await (0, import_promises159.readFile)(packageJsonPath, "utf-8");
|
|
968397
968472
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
968398
968473
|
if (packageJson2.main == null) {
|
|
968399
968474
|
throw new CliError({
|
|
@@ -968577,7 +968652,7 @@ async function loadAndUpdateGenerators({
|
|
|
968577
968652
|
skippedAutoreleaseDisabled: []
|
|
968578
968653
|
};
|
|
968579
968654
|
}
|
|
968580
|
-
const contents = await (0,
|
|
968655
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
968581
968656
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
968582
968657
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
968583
968658
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -968814,7 +968889,7 @@ async function upgradeGenerator({
|
|
|
968814
968889
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
968815
968890
|
});
|
|
968816
968891
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
968817
|
-
await (0,
|
|
968892
|
+
await (0, import_promises160.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
968818
968893
|
}
|
|
968819
968894
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
968820
968895
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -969214,7 +969289,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
969214
969289
|
}
|
|
969215
969290
|
if (argv.output) {
|
|
969216
969291
|
try {
|
|
969217
|
-
await (0,
|
|
969292
|
+
await (0, import_promises161.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
969218
969293
|
} catch (error50) {
|
|
969219
969294
|
cliContext.failAndThrow(
|
|
969220
969295
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -969231,7 +969306,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
969231
969306
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
969232
969307
|
init_lib19();
|
|
969233
969308
|
init_source();
|
|
969234
|
-
var
|
|
969309
|
+
var import_promises162 = require("fs/promises");
|
|
969235
969310
|
init_js_yaml();
|
|
969236
969311
|
async function addGeneratorToWorkspaces({
|
|
969237
969312
|
project: { apiWorkspaces },
|
|
@@ -969259,7 +969334,7 @@ async function addGeneratorToWorkspaces({
|
|
|
969259
969334
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
969260
969335
|
return;
|
|
969261
969336
|
}
|
|
969262
|
-
await (0,
|
|
969337
|
+
await (0, import_promises162.writeFile)(
|
|
969263
969338
|
absolutePathToGeneratorsConfiguration,
|
|
969264
969339
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(newConfiguration)
|
|
969265
969340
|
);
|
|
@@ -969327,11 +969402,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
969327
969402
|
|
|
969328
969403
|
// src/commands/generate/checkOutputDirectory.ts
|
|
969329
969404
|
init_lib8();
|
|
969330
|
-
var
|
|
969405
|
+
var import_promises165 = require("fs/promises");
|
|
969331
969406
|
|
|
969332
969407
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
969333
969408
|
init_lib8();
|
|
969334
|
-
var
|
|
969409
|
+
var import_promises163 = require("fs/promises");
|
|
969335
969410
|
|
|
969336
969411
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
969337
969412
|
init_lib8();
|
|
@@ -969351,17 +969426,17 @@ async function getOutputDirectories() {
|
|
|
969351
969426
|
if (!doesOutputDirectoriesFileExist) {
|
|
969352
969427
|
return [];
|
|
969353
969428
|
}
|
|
969354
|
-
const outputDirectoriesFileContents = await (0,
|
|
969429
|
+
const outputDirectoriesFileContents = await (0, import_promises163.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
969355
969430
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
969356
969431
|
return outputDirectories;
|
|
969357
969432
|
}
|
|
969358
969433
|
|
|
969359
969434
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
969360
|
-
var
|
|
969435
|
+
var import_promises164 = require("fs/promises");
|
|
969361
969436
|
var import_path108 = __toESM(require("path"), 1);
|
|
969362
969437
|
async function storeOutputDirectories(outputDirectories) {
|
|
969363
|
-
await (0,
|
|
969364
|
-
await (0,
|
|
969438
|
+
await (0, import_promises164.mkdir)(import_path108.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
969439
|
+
await (0, import_promises164.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
969365
969440
|
}
|
|
969366
969441
|
|
|
969367
969442
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -969383,7 +969458,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
969383
969458
|
shouldProceed: true
|
|
969384
969459
|
};
|
|
969385
969460
|
}
|
|
969386
|
-
const files = await (0,
|
|
969461
|
+
const files = await (0, import_promises165.readdir)(outputPath);
|
|
969387
969462
|
if (files.length === 0) {
|
|
969388
969463
|
return {
|
|
969389
969464
|
shouldProceed: true
|
|
@@ -970372,7 +970447,7 @@ function renderOverflowWarning(failureCount) {
|
|
|
970372
970447
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
970373
970448
|
init_lib4();
|
|
970374
970449
|
var import_fs41 = require("fs");
|
|
970375
|
-
var
|
|
970450
|
+
var import_promises166 = require("fs/promises");
|
|
970376
970451
|
var JSON_SCHEMA_VERSION = 1;
|
|
970377
970452
|
function renderStdoutSummary(results) {
|
|
970378
970453
|
return formatCounts(countResults(results));
|
|
@@ -970562,12 +970637,12 @@ async function writeResults({
|
|
|
970562
970637
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
970563
970638
|
if (stepSummaryPath != null) {
|
|
970564
970639
|
try {
|
|
970565
|
-
await (0,
|
|
970640
|
+
await (0, import_promises166.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
970566
970641
|
} catch {
|
|
970567
970642
|
}
|
|
970568
970643
|
}
|
|
970569
970644
|
if (jsonOutputPath != null) {
|
|
970570
|
-
await (0,
|
|
970645
|
+
await (0, import_promises166.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
970571
970646
|
}
|
|
970572
970647
|
}
|
|
970573
970648
|
function writeResultsSync({
|
|
@@ -970894,7 +970969,7 @@ function listPreviewGroups({
|
|
|
970894
970969
|
init_lib19();
|
|
970895
970970
|
init_lib6();
|
|
970896
970971
|
init_source();
|
|
970897
|
-
var
|
|
970972
|
+
var import_promises196 = require("fs/promises");
|
|
970898
970973
|
|
|
970899
970974
|
// ../cli-migrations/lib/runMigrations.js
|
|
970900
970975
|
init_lib4();
|
|
@@ -970905,7 +970980,7 @@ init_source();
|
|
|
970905
970980
|
init_lib27();
|
|
970906
970981
|
|
|
970907
970982
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
970908
|
-
var
|
|
970983
|
+
var import_promises167 = require("fs/promises");
|
|
970909
970984
|
|
|
970910
970985
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
970911
970986
|
init_lib8();
|
|
@@ -970942,7 +971017,7 @@ var migration = {
|
|
|
970942
971017
|
try {
|
|
970943
971018
|
const fileContents = await getFileContents(yamlFilepath);
|
|
970944
971019
|
const newContents = addDiscriminantToFile(fileContents);
|
|
970945
|
-
await (0,
|
|
971020
|
+
await (0, import_promises167.writeFile)(yamlFilepath, newContents);
|
|
970946
971021
|
} catch (error50) {
|
|
970947
971022
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
970948
971023
|
}
|
|
@@ -970950,7 +971025,7 @@ var migration = {
|
|
|
970950
971025
|
}
|
|
970951
971026
|
};
|
|
970952
971027
|
async function getFileContents(filepath) {
|
|
970953
|
-
const buffer = await (0,
|
|
971028
|
+
const buffer = await (0, import_promises167.readFile)(filepath);
|
|
970954
971029
|
return buffer.toString();
|
|
970955
971030
|
}
|
|
970956
971031
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -970979,7 +971054,7 @@ var versionMigrations = {
|
|
|
970979
971054
|
var __default = versionMigrations;
|
|
970980
971055
|
|
|
970981
971056
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
970982
|
-
var
|
|
971057
|
+
var import_promises168 = require("fs/promises");
|
|
970983
971058
|
var import_yaml7 = __toESM(require_dist11(), 1);
|
|
970984
971059
|
|
|
970985
971060
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -971023,7 +971098,7 @@ var migration2 = {
|
|
|
971023
971098
|
}
|
|
971024
971099
|
};
|
|
971025
971100
|
async function migrateFile(filepath, context3) {
|
|
971026
|
-
const contents = await (0,
|
|
971101
|
+
const contents = await (0, import_promises168.readFile)(filepath);
|
|
971027
971102
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
971028
971103
|
const types4 = parsedDocument.get("types");
|
|
971029
971104
|
if (types4 == null) {
|
|
@@ -971055,7 +971130,7 @@ async function migrateFile(filepath, context3) {
|
|
|
971055
971130
|
}
|
|
971056
971131
|
}
|
|
971057
971132
|
}
|
|
971058
|
-
await (0,
|
|
971133
|
+
await (0, import_promises168.writeFile)(filepath, parsedDocument.toString());
|
|
971059
971134
|
}
|
|
971060
971135
|
|
|
971061
971136
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -971066,7 +971141,7 @@ var versionMigrations2 = {
|
|
|
971066
971141
|
var __default2 = versionMigrations2;
|
|
971067
971142
|
|
|
971068
971143
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
971069
|
-
var
|
|
971144
|
+
var import_promises169 = require("fs/promises");
|
|
971070
971145
|
var import_yaml8 = __toESM(require_dist11(), 1);
|
|
971071
971146
|
|
|
971072
971147
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -971110,7 +971185,7 @@ var migration3 = {
|
|
|
971110
971185
|
}
|
|
971111
971186
|
};
|
|
971112
971187
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
971113
|
-
const contents = await (0,
|
|
971188
|
+
const contents = await (0, import_promises169.readFile)(filepath);
|
|
971114
971189
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
971115
971190
|
const draftGenerators = parsedDocument.get("draft");
|
|
971116
971191
|
if (draftGenerators == null) {
|
|
@@ -971137,7 +971212,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
971137
971212
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
971138
971213
|
}
|
|
971139
971214
|
});
|
|
971140
|
-
await (0,
|
|
971215
|
+
await (0, import_promises169.writeFile)(filepath, parsedDocument.toString());
|
|
971141
971216
|
}
|
|
971142
971217
|
|
|
971143
971218
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -971148,7 +971223,7 @@ var versionMigrations3 = {
|
|
|
971148
971223
|
var __default3 = versionMigrations3;
|
|
971149
971224
|
|
|
971150
971225
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
971151
|
-
var
|
|
971226
|
+
var import_promises170 = require("fs/promises");
|
|
971152
971227
|
var import_yaml9 = __toESM(require_dist11(), 1);
|
|
971153
971228
|
|
|
971154
971229
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -971192,7 +971267,7 @@ var migration4 = {
|
|
|
971192
971267
|
}
|
|
971193
971268
|
};
|
|
971194
971269
|
async function migrateFile2(filepath, context3) {
|
|
971195
|
-
const contents = await (0,
|
|
971270
|
+
const contents = await (0, import_promises170.readFile)(filepath);
|
|
971196
971271
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
971197
971272
|
const addType = (typeName, typeDeclaration2) => {
|
|
971198
971273
|
const types4 = parsedDocument.get("types");
|
|
@@ -971236,7 +971311,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
971236
971311
|
}
|
|
971237
971312
|
}
|
|
971238
971313
|
}
|
|
971239
|
-
await (0,
|
|
971314
|
+
await (0, import_promises170.writeFile)(filepath, parsedDocument.toString());
|
|
971240
971315
|
}
|
|
971241
971316
|
|
|
971242
971317
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -971247,7 +971322,7 @@ var versionMigrations4 = {
|
|
|
971247
971322
|
var __default4 = versionMigrations4;
|
|
971248
971323
|
|
|
971249
971324
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
971250
|
-
var
|
|
971325
|
+
var import_promises171 = require("fs/promises");
|
|
971251
971326
|
var import_yaml10 = __toESM(require_dist11(), 1);
|
|
971252
971327
|
|
|
971253
971328
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -971291,7 +971366,7 @@ var migration5 = {
|
|
|
971291
971366
|
}
|
|
971292
971367
|
};
|
|
971293
971368
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
971294
|
-
const contents = await (0,
|
|
971369
|
+
const contents = await (0, import_promises171.readFile)(filepath);
|
|
971295
971370
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
971296
971371
|
const releaseGenerators = parsedDocument.get("release");
|
|
971297
971372
|
if (releaseGenerators == null) {
|
|
@@ -971329,7 +971404,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
971329
971404
|
}
|
|
971330
971405
|
releaseGenerator.delete("outputs");
|
|
971331
971406
|
});
|
|
971332
|
-
await (0,
|
|
971407
|
+
await (0, import_promises171.writeFile)(filepath, parsedDocument.toString());
|
|
971333
971408
|
}
|
|
971334
971409
|
|
|
971335
971410
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -971340,7 +971415,7 @@ var versionMigrations5 = {
|
|
|
971340
971415
|
var __default5 = versionMigrations5;
|
|
971341
971416
|
|
|
971342
971417
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
971343
|
-
var
|
|
971418
|
+
var import_promises172 = require("fs/promises");
|
|
971344
971419
|
|
|
971345
971420
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
971346
971421
|
init_lib8();
|
|
@@ -971374,9 +971449,9 @@ var migration6 = {
|
|
|
971374
971449
|
run: async ({ context: context3 }) => {
|
|
971375
971450
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
971376
971451
|
for (const filepath of yamlFiles) {
|
|
971377
|
-
const contents = await (0,
|
|
971452
|
+
const contents = await (0, import_promises172.readFile)(filepath);
|
|
971378
971453
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
971379
|
-
await (0,
|
|
971454
|
+
await (0, import_promises172.writeFile)(filepath, newContents);
|
|
971380
971455
|
}
|
|
971381
971456
|
}
|
|
971382
971457
|
};
|
|
@@ -971389,7 +971464,7 @@ var versionMigrations6 = {
|
|
|
971389
971464
|
var __default6 = versionMigrations6;
|
|
971390
971465
|
|
|
971391
971466
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
971392
|
-
var
|
|
971467
|
+
var import_promises173 = require("fs/promises");
|
|
971393
971468
|
|
|
971394
971469
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
971395
971470
|
init_lib8();
|
|
@@ -971423,9 +971498,9 @@ var migration7 = {
|
|
|
971423
971498
|
run: async ({ context: context3 }) => {
|
|
971424
971499
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
971425
971500
|
for (const filepath of yamlFiles) {
|
|
971426
|
-
const contents = await (0,
|
|
971501
|
+
const contents = await (0, import_promises173.readFile)(filepath);
|
|
971427
971502
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
971428
|
-
await (0,
|
|
971503
|
+
await (0, import_promises173.writeFile)(filepath, newContents);
|
|
971429
971504
|
}
|
|
971430
971505
|
}
|
|
971431
971506
|
};
|
|
@@ -971439,7 +971514,7 @@ var __default7 = versionMigrations7;
|
|
|
971439
971514
|
|
|
971440
971515
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
971441
971516
|
init_lib4();
|
|
971442
|
-
var
|
|
971517
|
+
var import_promises174 = require("fs/promises");
|
|
971443
971518
|
init_js_yaml();
|
|
971444
971519
|
|
|
971445
971520
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -971573,7 +971648,7 @@ var migration8 = {
|
|
|
971573
971648
|
}
|
|
971574
971649
|
};
|
|
971575
971650
|
async function migrateGeneratorsYml3(filepath) {
|
|
971576
|
-
const contentsStr = await (0,
|
|
971651
|
+
const contentsStr = await (0, import_promises174.readFile)(filepath);
|
|
971577
971652
|
const contents = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
971578
971653
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
971579
971654
|
let newGeneratorsConfiguration = {};
|
|
@@ -971591,7 +971666,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
971591
971666
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
971592
971667
|
};
|
|
971593
971668
|
}
|
|
971594
|
-
await (0,
|
|
971669
|
+
await (0, import_promises174.writeFile)(filepath, index_vite_proxy_tmp_default.dump(newGeneratorsConfiguration));
|
|
971595
971670
|
}
|
|
971596
971671
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
971597
971672
|
const newSchema = {
|
|
@@ -971666,7 +971741,7 @@ var versionMigrations8 = {
|
|
|
971666
971741
|
var __default8 = versionMigrations8;
|
|
971667
971742
|
|
|
971668
971743
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
971669
|
-
var
|
|
971744
|
+
var import_promises175 = require("fs/promises");
|
|
971670
971745
|
var import_yaml11 = __toESM(require_dist11(), 1);
|
|
971671
971746
|
|
|
971672
971747
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -971710,7 +971785,7 @@ var migration9 = {
|
|
|
971710
971785
|
}
|
|
971711
971786
|
};
|
|
971712
971787
|
async function migrateRootApiFile(filepath) {
|
|
971713
|
-
const contents = await (0,
|
|
971788
|
+
const contents = await (0, import_promises175.readFile)(filepath);
|
|
971714
971789
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
971715
971790
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
971716
971791
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -971721,7 +971796,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
971721
971796
|
"property-name": errorDiscriminant.value
|
|
971722
971797
|
});
|
|
971723
971798
|
parsedDocument.delete("error-discriminant");
|
|
971724
|
-
await (0,
|
|
971799
|
+
await (0, import_promises175.writeFile)(filepath, parsedDocument.toString());
|
|
971725
971800
|
}
|
|
971726
971801
|
|
|
971727
971802
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -971732,7 +971807,7 @@ var versionMigrations9 = {
|
|
|
971732
971807
|
var __default9 = versionMigrations9;
|
|
971733
971808
|
|
|
971734
971809
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
971735
|
-
var
|
|
971810
|
+
var import_promises176 = require("fs/promises");
|
|
971736
971811
|
var import_yaml12 = __toESM(require_dist11(), 1);
|
|
971737
971812
|
|
|
971738
971813
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -971776,7 +971851,7 @@ var migration10 = {
|
|
|
971776
971851
|
}
|
|
971777
971852
|
};
|
|
971778
971853
|
async function migrateYamlFile(filepath, context3) {
|
|
971779
|
-
const contents = await (0,
|
|
971854
|
+
const contents = await (0, import_promises176.readFile)(filepath);
|
|
971780
971855
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
971781
971856
|
const services = parsedDocument.get("services");
|
|
971782
971857
|
if (services == null) {
|
|
@@ -971816,7 +971891,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
971816
971891
|
context3.failWithoutThrowing("Failed to convert endpoint", e2);
|
|
971817
971892
|
}
|
|
971818
971893
|
}
|
|
971819
|
-
await (0,
|
|
971894
|
+
await (0, import_promises176.writeFile)(filepath, parsedDocument.toString());
|
|
971820
971895
|
}
|
|
971821
971896
|
}
|
|
971822
971897
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -971895,7 +971970,7 @@ var versionMigrations10 = {
|
|
|
971895
971970
|
var __default10 = versionMigrations10;
|
|
971896
971971
|
|
|
971897
971972
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
971898
|
-
var
|
|
971973
|
+
var import_promises177 = require("fs/promises");
|
|
971899
971974
|
var import_yaml13 = __toESM(require_dist11(), 1);
|
|
971900
971975
|
|
|
971901
971976
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -971939,7 +972014,7 @@ var migration11 = {
|
|
|
971939
972014
|
}
|
|
971940
972015
|
};
|
|
971941
972016
|
async function migrateYamlFile2(filepath, context3) {
|
|
971942
|
-
const contents = await (0,
|
|
972017
|
+
const contents = await (0, import_promises177.readFile)(filepath);
|
|
971943
972018
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
971944
972019
|
const types4 = parsedDocument.get("types");
|
|
971945
972020
|
if (types4 == null) {
|
|
@@ -971965,7 +972040,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
971965
972040
|
examples.set(i5, { value: value2 });
|
|
971966
972041
|
}
|
|
971967
972042
|
}
|
|
971968
|
-
await (0,
|
|
972043
|
+
await (0, import_promises177.writeFile)(filepath, parsedDocument.toString());
|
|
971969
972044
|
}
|
|
971970
972045
|
|
|
971971
972046
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -971976,7 +972051,7 @@ var versionMigrations11 = {
|
|
|
971976
972051
|
var __default11 = versionMigrations11;
|
|
971977
972052
|
|
|
971978
972053
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
971979
|
-
var
|
|
972054
|
+
var import_promises178 = require("fs/promises");
|
|
971980
972055
|
var import_yaml14 = __toESM(require_dist11(), 1);
|
|
971981
972056
|
|
|
971982
972057
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -972020,7 +972095,7 @@ var migration12 = {
|
|
|
972020
972095
|
}
|
|
972021
972096
|
};
|
|
972022
972097
|
async function migrateYamlFile3(filepath, context3) {
|
|
972023
|
-
const contents = await (0,
|
|
972098
|
+
const contents = await (0, import_promises178.readFile)(filepath);
|
|
972024
972099
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
972025
972100
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
972026
972101
|
return context3.failAndThrow("File is not a map");
|
|
@@ -972050,7 +972125,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
972050
972125
|
pair.value = firstService.value;
|
|
972051
972126
|
}
|
|
972052
972127
|
}
|
|
972053
|
-
await (0,
|
|
972128
|
+
await (0, import_promises178.writeFile)(filepath, parsedDocument.toString());
|
|
972054
972129
|
}
|
|
972055
972130
|
|
|
972056
972131
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -972061,7 +972136,7 @@ var versionMigrations12 = {
|
|
|
972061
972136
|
var __default12 = versionMigrations12;
|
|
972062
972137
|
|
|
972063
972138
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
972064
|
-
var
|
|
972139
|
+
var import_promises179 = require("fs/promises");
|
|
972065
972140
|
var import_yaml15 = __toESM(require_dist11(), 1);
|
|
972066
972141
|
|
|
972067
972142
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -972105,7 +972180,7 @@ var migration13 = {
|
|
|
972105
972180
|
}
|
|
972106
972181
|
};
|
|
972107
972182
|
async function migrateYamlFile4(filepath, context3) {
|
|
972108
|
-
const contents = await (0,
|
|
972183
|
+
const contents = await (0, import_promises179.readFile)(filepath);
|
|
972109
972184
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
972110
972185
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
972111
972186
|
return context3.failAndThrow("File is not a map");
|
|
@@ -972124,7 +972199,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
972124
972199
|
}
|
|
972125
972200
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
972126
972201
|
parsedDocument.contents.items.unshift(docsPair);
|
|
972127
|
-
await (0,
|
|
972202
|
+
await (0, import_promises179.writeFile)(filepath, parsedDocument.toString());
|
|
972128
972203
|
}
|
|
972129
972204
|
|
|
972130
972205
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -972135,7 +972210,7 @@ var versionMigrations13 = {
|
|
|
972135
972210
|
var __default13 = versionMigrations13;
|
|
972136
972211
|
|
|
972137
972212
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
972138
|
-
var
|
|
972213
|
+
var import_promises180 = require("fs/promises");
|
|
972139
972214
|
|
|
972140
972215
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
972141
972216
|
init_lib8();
|
|
@@ -972178,14 +972253,14 @@ var migration14 = {
|
|
|
972178
972253
|
}
|
|
972179
972254
|
};
|
|
972180
972255
|
async function migrateYamlFile5(filepath) {
|
|
972181
|
-
const contents = await (0,
|
|
972256
|
+
const contents = await (0, import_promises180.readFile)(filepath);
|
|
972182
972257
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
972183
972258
|
const regex6 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
972184
972259
|
const updatedSnapshot = contents.toString().replace(regex6, (_match, _prefix, domain3) => {
|
|
972185
972260
|
return `docs:
|
|
972186
972261
|
domain: "${domain3}.${domainSuffix}"`;
|
|
972187
972262
|
});
|
|
972188
|
-
await (0,
|
|
972263
|
+
await (0, import_promises180.writeFile)(filepath, updatedSnapshot.toString());
|
|
972189
972264
|
}
|
|
972190
972265
|
|
|
972191
972266
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -972206,11 +972281,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
972206
972281
|
|
|
972207
972282
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
972208
972283
|
init_lib8();
|
|
972209
|
-
var
|
|
972284
|
+
var import_promises181 = require("fs/promises");
|
|
972210
972285
|
init_js_yaml();
|
|
972211
972286
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
972212
972287
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972213
|
-
const contentsStr = await (0,
|
|
972288
|
+
const contentsStr = await (0, import_promises181.readFile)(filepath);
|
|
972214
972289
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
972215
972290
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
972216
972291
|
if (result.ok) {
|
|
@@ -972229,7 +972304,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
972229
972304
|
|
|
972230
972305
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
972231
972306
|
init_lib8();
|
|
972232
|
-
var
|
|
972307
|
+
var import_promises183 = require("fs/promises");
|
|
972233
972308
|
init_js_yaml();
|
|
972234
972309
|
|
|
972235
972310
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -972438,11 +972513,11 @@ __export(legacy_exports, {
|
|
|
972438
972513
|
|
|
972439
972514
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
972440
972515
|
init_lib8();
|
|
972441
|
-
var
|
|
972516
|
+
var import_promises182 = require("fs/promises");
|
|
972442
972517
|
init_js_yaml();
|
|
972443
972518
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
972444
972519
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
972445
|
-
const contentsStr = await (0,
|
|
972520
|
+
const contentsStr = await (0, import_promises182.readFile)(filepath);
|
|
972446
972521
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
972447
972522
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
972448
972523
|
if (result.success) {
|
|
@@ -972472,7 +972547,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
972472
972547
|
var APIS_DIRECTORY2 = "apis";
|
|
972473
972548
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
972474
972549
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
972475
|
-
await (0,
|
|
972550
|
+
await (0, import_promises183.mkdir)(absolutePathToApisDirectory);
|
|
972476
972551
|
for (const workspace of workspaces) {
|
|
972477
972552
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
972478
972553
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -972480,11 +972555,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
972480
972555
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
972481
972556
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
972482
972557
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
972483
|
-
await (0,
|
|
972558
|
+
await (0, import_promises183.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
972484
972559
|
}
|
|
972485
972560
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
972486
972561
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
972487
|
-
await (0,
|
|
972562
|
+
await (0, import_promises183.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972488
972563
|
}
|
|
972489
972564
|
}
|
|
972490
972565
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -972497,7 +972572,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
972497
972572
|
generatorsConfiguration,
|
|
972498
972573
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
972499
972574
|
});
|
|
972500
|
-
await (0,
|
|
972575
|
+
await (0, import_promises183.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972501
972576
|
return convertedResponse.docsURLs;
|
|
972502
972577
|
}
|
|
972503
972578
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -972511,12 +972586,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
972511
972586
|
apiName
|
|
972512
972587
|
});
|
|
972513
972588
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972514
|
-
await (0,
|
|
972589
|
+
await (0, import_promises183.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
972515
972590
|
}
|
|
972516
972591
|
|
|
972517
972592
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
972518
972593
|
init_lib8();
|
|
972519
|
-
var
|
|
972594
|
+
var import_promises184 = require("fs/promises");
|
|
972520
972595
|
init_js_yaml();
|
|
972521
972596
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
972522
972597
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -972524,8 +972599,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
972524
972599
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
972525
972600
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
972526
972601
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
972527
|
-
await (0,
|
|
972528
|
-
await (0,
|
|
972602
|
+
await (0, import_promises184.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
972603
|
+
await (0, import_promises184.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972529
972604
|
}
|
|
972530
972605
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
972531
972606
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972538,7 +972613,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
972538
972613
|
apiName: void 0
|
|
972539
972614
|
});
|
|
972540
972615
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972541
|
-
await (0,
|
|
972616
|
+
await (0, import_promises184.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
972542
972617
|
}
|
|
972543
972618
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
972544
972619
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972550,24 +972625,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
972550
972625
|
generatorsConfiguration,
|
|
972551
972626
|
pathModificationStrategy: "MoveUp"
|
|
972552
972627
|
});
|
|
972553
|
-
await (0,
|
|
972628
|
+
await (0, import_promises184.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972554
972629
|
return convertedResponse.docsURLs;
|
|
972555
972630
|
}
|
|
972556
972631
|
|
|
972557
972632
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
972558
972633
|
init_lib8();
|
|
972559
|
-
var
|
|
972634
|
+
var import_promises185 = require("fs/promises");
|
|
972560
972635
|
init_js_yaml();
|
|
972561
972636
|
var APIS_DIRECTORY3 = "apis";
|
|
972562
972637
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
972563
972638
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
972564
|
-
await (0,
|
|
972639
|
+
await (0, import_promises185.mkdir)(absolutePathToApisDirectory);
|
|
972565
972640
|
for (const workspace of workspaces) {
|
|
972566
972641
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
972567
972642
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
972568
972643
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
972569
972644
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
972570
|
-
await (0,
|
|
972645
|
+
await (0, import_promises185.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972571
972646
|
}
|
|
972572
972647
|
}
|
|
972573
972648
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -972580,17 +972655,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
972580
972655
|
generatorsConfiguration,
|
|
972581
972656
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
972582
972657
|
});
|
|
972583
|
-
await (0,
|
|
972658
|
+
await (0, import_promises185.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972584
972659
|
}
|
|
972585
972660
|
|
|
972586
972661
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
972587
972662
|
init_lib8();
|
|
972588
|
-
var
|
|
972663
|
+
var import_promises186 = require("fs/promises");
|
|
972589
972664
|
init_js_yaml();
|
|
972590
972665
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
972591
972666
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
972592
972667
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
972593
|
-
await (0,
|
|
972668
|
+
await (0, import_promises186.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972594
972669
|
}
|
|
972595
972670
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
972596
972671
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972602,7 +972677,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
972602
972677
|
generatorsConfiguration,
|
|
972603
972678
|
pathModificationStrategy: "MoveUp"
|
|
972604
972679
|
});
|
|
972605
|
-
await (0,
|
|
972680
|
+
await (0, import_promises186.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972606
972681
|
}
|
|
972607
972682
|
|
|
972608
972683
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -972682,7 +972757,7 @@ var __default15 = versionMigrations15;
|
|
|
972682
972757
|
init_lib19();
|
|
972683
972758
|
init_lib8();
|
|
972684
972759
|
init_source();
|
|
972685
|
-
var
|
|
972760
|
+
var import_promises187 = require("fs/promises");
|
|
972686
972761
|
init_js_yaml();
|
|
972687
972762
|
var import_yaml16 = __toESM(require_dist11(), 1);
|
|
972688
972763
|
var migration16 = {
|
|
@@ -972726,7 +972801,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
972726
972801
|
if (existingGeneratorsYml == null) {
|
|
972727
972802
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
972728
972803
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
972729
|
-
await (0,
|
|
972804
|
+
await (0, import_promises187.writeFile)(absolutePathToGeneratorsYml, index_vite_proxy_tmp_default.dump({
|
|
972730
972805
|
api: {
|
|
972731
972806
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
972732
972807
|
}
|
|
@@ -972741,7 +972816,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
972741
972816
|
parsedDocument.set("api", {
|
|
972742
972817
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
972743
972818
|
});
|
|
972744
|
-
await (0,
|
|
972819
|
+
await (0, import_promises187.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
972745
972820
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
972746
972821
|
}
|
|
972747
972822
|
}
|
|
@@ -972771,7 +972846,7 @@ var __default16 = versionMigrations16;
|
|
|
972771
972846
|
init_lib19();
|
|
972772
972847
|
init_lib8();
|
|
972773
972848
|
init_source();
|
|
972774
|
-
var
|
|
972849
|
+
var import_promises188 = require("fs/promises");
|
|
972775
972850
|
init_js_yaml();
|
|
972776
972851
|
var import_yaml17 = __toESM(require_dist11(), 1);
|
|
972777
972852
|
var migration17 = {
|
|
@@ -972952,7 +973027,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
972952
973027
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
972953
973028
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
972954
973029
|
}
|
|
972955
|
-
await (0,
|
|
973030
|
+
await (0, import_promises188.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
972956
973031
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
972957
973032
|
}
|
|
972958
973033
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -972999,7 +973074,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
972999
973074
|
}
|
|
973000
973075
|
let specContent;
|
|
973001
973076
|
try {
|
|
973002
|
-
const fileContents = await (0,
|
|
973077
|
+
const fileContents = await (0, import_promises188.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
973003
973078
|
specContent = index_vite_proxy_tmp_default.load(fileContents);
|
|
973004
973079
|
} catch (e2) {
|
|
973005
973080
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e2}. Skipping...`);
|
|
@@ -973105,7 +973180,7 @@ var __default17 = versionMigrations17;
|
|
|
973105
973180
|
init_lib19();
|
|
973106
973181
|
init_lib8();
|
|
973107
973182
|
init_source();
|
|
973108
|
-
var
|
|
973183
|
+
var import_promises189 = require("fs/promises");
|
|
973109
973184
|
init_js_yaml();
|
|
973110
973185
|
var migration18 = {
|
|
973111
973186
|
name: "add-path-parameter-order-setting",
|
|
@@ -973194,7 +973269,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
973194
973269
|
documentToWrite = `${schemaComment}
|
|
973195
973270
|
${documentToWrite}`;
|
|
973196
973271
|
}
|
|
973197
|
-
await (0,
|
|
973272
|
+
await (0, import_promises189.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973198
973273
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973199
973274
|
}
|
|
973200
973275
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -973233,7 +973308,7 @@ var __default18 = versionMigrations18;
|
|
|
973233
973308
|
init_lib19();
|
|
973234
973309
|
init_lib8();
|
|
973235
973310
|
init_source();
|
|
973236
|
-
var
|
|
973311
|
+
var import_promises190 = require("fs/promises");
|
|
973237
973312
|
init_js_yaml();
|
|
973238
973313
|
var migration19 = {
|
|
973239
973314
|
name: "update-1_0_0-defaults",
|
|
@@ -973409,7 +973484,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
973409
973484
|
documentToWrite = `${schemaComment}
|
|
973410
973485
|
${documentToWrite}`;
|
|
973411
973486
|
}
|
|
973412
|
-
await (0,
|
|
973487
|
+
await (0, import_promises190.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973413
973488
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973414
973489
|
}
|
|
973415
973490
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -973481,7 +973556,7 @@ var __default19 = versionMigrations19;
|
|
|
973481
973556
|
init_lib19();
|
|
973482
973557
|
init_lib8();
|
|
973483
973558
|
init_source();
|
|
973484
|
-
var
|
|
973559
|
+
var import_promises191 = require("fs/promises");
|
|
973485
973560
|
init_js_yaml();
|
|
973486
973561
|
var migration20 = {
|
|
973487
973562
|
name: "update-2_0_0-defaults",
|
|
@@ -973657,7 +973732,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
973657
973732
|
documentToWrite = `${schemaComment}
|
|
973658
973733
|
${documentToWrite}`;
|
|
973659
973734
|
}
|
|
973660
|
-
await (0,
|
|
973735
|
+
await (0, import_promises191.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973661
973736
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973662
973737
|
}
|
|
973663
973738
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -973706,7 +973781,7 @@ var __default20 = versionMigrations20;
|
|
|
973706
973781
|
init_lib19();
|
|
973707
973782
|
init_lib8();
|
|
973708
973783
|
init_source();
|
|
973709
|
-
var
|
|
973784
|
+
var import_promises192 = require("fs/promises");
|
|
973710
973785
|
init_js_yaml();
|
|
973711
973786
|
var migration21 = {
|
|
973712
973787
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -973798,7 +973873,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
973798
973873
|
documentToWrite = `${schemaComment}
|
|
973799
973874
|
${documentToWrite}`;
|
|
973800
973875
|
}
|
|
973801
|
-
await (0,
|
|
973876
|
+
await (0, import_promises192.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973802
973877
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973803
973878
|
}
|
|
973804
973879
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -973847,7 +973922,7 @@ var __default21 = versionMigrations21;
|
|
|
973847
973922
|
init_lib19();
|
|
973848
973923
|
init_lib8();
|
|
973849
973924
|
init_source();
|
|
973850
|
-
var
|
|
973925
|
+
var import_promises193 = require("fs/promises");
|
|
973851
973926
|
init_js_yaml();
|
|
973852
973927
|
var migration22 = {
|
|
973853
973928
|
name: "enable-smart-casing",
|
|
@@ -973932,7 +974007,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
973932
974007
|
documentToWrite = `${schemaComment}
|
|
973933
974008
|
${documentToWrite}`;
|
|
973934
974009
|
}
|
|
973935
|
-
await (0,
|
|
974010
|
+
await (0, import_promises193.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973936
974011
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973937
974012
|
}
|
|
973938
974013
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -973972,7 +974047,7 @@ var __default22 = versionMigrations22;
|
|
|
973972
974047
|
init_lib19();
|
|
973973
974048
|
init_lib8();
|
|
973974
974049
|
init_source();
|
|
973975
|
-
var
|
|
974050
|
+
var import_promises194 = require("fs/promises");
|
|
973976
974051
|
init_js_yaml();
|
|
973977
974052
|
var migration23 = {
|
|
973978
974053
|
name: "disable-disambiguate-request-names",
|
|
@@ -974097,7 +974172,7 @@ async function updateGeneratorsYml6({ context: context3, files }) {
|
|
|
974097
974172
|
documentToWrite = `${schemaComment}
|
|
974098
974173
|
${documentToWrite}`;
|
|
974099
974174
|
}
|
|
974100
|
-
await (0,
|
|
974175
|
+
await (0, import_promises194.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
974101
974176
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
974102
974177
|
}
|
|
974103
974178
|
async function getFilesAndDirectories8(absoluteFilepath) {
|
|
@@ -974232,7 +974307,7 @@ init_lib33();
|
|
|
974232
974307
|
init_lib27();
|
|
974233
974308
|
init_lib6();
|
|
974234
974309
|
init_source();
|
|
974235
|
-
var
|
|
974310
|
+
var import_promises195 = require("fs/promises");
|
|
974236
974311
|
|
|
974237
974312
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
974238
974313
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -975288,7 +975363,7 @@ async function upgrade({
|
|
|
975288
975363
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
975289
975364
|
draft.version = resolvedTargetVersion;
|
|
975290
975365
|
});
|
|
975291
|
-
await (0,
|
|
975366
|
+
await (0, import_promises195.writeFile)(
|
|
975292
975367
|
projectConfig2._absolutePath,
|
|
975293
975368
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
975294
975369
|
);
|
|
@@ -975445,7 +975520,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
975445
975520
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
975446
975521
|
});
|
|
975447
975522
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
975448
|
-
await (0,
|
|
975523
|
+
await (0, import_promises196.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
975449
975524
|
}
|
|
975450
975525
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
975451
975526
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -975923,7 +975998,7 @@ async function previewDocsWorkspace({
|
|
|
975923
975998
|
// src/commands/docs-diff/docsDiff.ts
|
|
975924
975999
|
init_lib8();
|
|
975925
976000
|
init_lib6();
|
|
975926
|
-
var
|
|
976001
|
+
var import_promises197 = require("fs/promises");
|
|
975927
976002
|
var import_pngjs2 = __toESM(require_png(), 1);
|
|
975928
976003
|
async function getSlugForFiles2({
|
|
975929
976004
|
previewUrl,
|
|
@@ -976146,8 +976221,8 @@ async function generateComparisons2({
|
|
|
976146
976221
|
afterPath,
|
|
976147
976222
|
comparisonBasePath
|
|
976148
976223
|
}) {
|
|
976149
|
-
const beforePng = import_pngjs2.PNG.sync.read(await (0,
|
|
976150
|
-
const afterPng = import_pngjs2.PNG.sync.read(await (0,
|
|
976224
|
+
const beforePng = import_pngjs2.PNG.sync.read(await (0, import_promises197.readFile)(beforePath));
|
|
976225
|
+
const afterPng = import_pngjs2.PNG.sync.read(await (0, import_promises197.readFile)(afterPath));
|
|
976151
976226
|
const beforeOriginalHeight = beforePng.height;
|
|
976152
976227
|
const afterOriginalHeight = afterPng.height;
|
|
976153
976228
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -976185,7 +976260,7 @@ async function generateComparisons2({
|
|
|
976185
976260
|
const sideBySide = createSideBySideComparison2(croppedBefore, croppedAfter, 20, true);
|
|
976186
976261
|
const outPath = `${base4}-region-${i5 + 1}.png`;
|
|
976187
976262
|
const pngBuffer = import_pngjs2.PNG.sync.write(sideBySide);
|
|
976188
|
-
await (0,
|
|
976263
|
+
await (0, import_promises197.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
976189
976264
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
976190
976265
|
}
|
|
976191
976266
|
return results;
|
|
@@ -976264,7 +976339,7 @@ async function docsDiff({
|
|
|
976264
976339
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
976265
976340
|
);
|
|
976266
976341
|
if (!await doesPathExist(outputPath)) {
|
|
976267
|
-
await (0,
|
|
976342
|
+
await (0, import_promises197.mkdir)(outputPath, { recursive: true });
|
|
976268
976343
|
}
|
|
976269
976344
|
const results = [];
|
|
976270
976345
|
await cliContext.runTask(async (context3) => {
|
|
@@ -976692,7 +976767,7 @@ init_lib6();
|
|
|
976692
976767
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
976693
976768
|
init_lib12();
|
|
976694
976769
|
init_lib8();
|
|
976695
|
-
var
|
|
976770
|
+
var import_promises198 = require("fs/promises");
|
|
976696
976771
|
init_js_yaml();
|
|
976697
976772
|
var import_path109 = __toESM(require("path"), 1);
|
|
976698
976773
|
var ThemeExporter = class {
|
|
@@ -976705,18 +976780,18 @@ var ThemeExporter = class {
|
|
|
976705
976780
|
const docsDir = import_path109.default.dirname(docsYmlPath);
|
|
976706
976781
|
const outDir = output2 != null ? import_path109.default.resolve(process.cwd(), output2) : import_path109.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
976707
976782
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
976708
|
-
const raw = index_vite_proxy_tmp_default.load(await (0,
|
|
976783
|
+
const raw = index_vite_proxy_tmp_default.load(await (0, import_promises198.readFile)(docsYmlPath, "utf-8"));
|
|
976709
976784
|
const themeConfig = {};
|
|
976710
976785
|
for (const [k4, v3] of Object.entries(raw)) {
|
|
976711
976786
|
if (docs_yml_exports.THEME_ELIGIBLE_YAML_KEYS.has(k4)) {
|
|
976712
976787
|
themeConfig[k4] = v3;
|
|
976713
976788
|
}
|
|
976714
976789
|
}
|
|
976715
|
-
await (0,
|
|
976790
|
+
await (0, import_promises198.mkdir)(outDir, { recursive: true });
|
|
976716
976791
|
const assetsDir = import_path109.default.join(outDir, "assets");
|
|
976717
|
-
await (0,
|
|
976792
|
+
await (0, import_promises198.mkdir)(assetsDir, { recursive: true });
|
|
976718
976793
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
976719
|
-
await (0,
|
|
976794
|
+
await (0, import_promises198.writeFile)(import_path109.default.join(outDir, "theme.yml"), index_vite_proxy_tmp_default.dump(exported), "utf-8");
|
|
976720
976795
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
976721
976796
|
}
|
|
976722
976797
|
};
|
|
@@ -976730,8 +976805,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
976730
976805
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path109.default.basename(abs) : relFromProject : relFromSource;
|
|
976731
976806
|
const dest = import_path109.default.join(assetsDir, destRelative);
|
|
976732
976807
|
try {
|
|
976733
|
-
await (0,
|
|
976734
|
-
await (0,
|
|
976808
|
+
await (0, import_promises198.mkdir)(import_path109.default.dirname(dest), { recursive: true });
|
|
976809
|
+
await (0, import_promises198.copyFile)(abs, dest);
|
|
976735
976810
|
return `./assets/${destRelative.split(import_path109.default.sep).join("/")}`;
|
|
976736
976811
|
} catch {
|
|
976737
976812
|
return obj;
|
|
@@ -976823,7 +976898,7 @@ async function listDocsThemes({
|
|
|
976823
976898
|
|
|
976824
976899
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
976825
976900
|
init_lib6();
|
|
976826
|
-
var
|
|
976901
|
+
var import_promises200 = require("fs/promises");
|
|
976827
976902
|
init_js_yaml();
|
|
976828
976903
|
var import_path111 = __toESM(require("path"), 1);
|
|
976829
976904
|
|
|
@@ -976832,7 +976907,7 @@ init_lib8();
|
|
|
976832
976907
|
init_lib6();
|
|
976833
976908
|
var import_child_process13 = require("child_process");
|
|
976834
976909
|
var import_crypto10 = require("crypto");
|
|
976835
|
-
var
|
|
976910
|
+
var import_promises199 = require("fs/promises");
|
|
976836
976911
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
976837
976912
|
var import_path110 = __toESM(require("path"), 1);
|
|
976838
976913
|
function getGitRoot() {
|
|
@@ -976876,7 +976951,7 @@ var ThemeConfigProcessor = class {
|
|
|
976876
976951
|
filePaths.map(async (filePath) => {
|
|
976877
976952
|
const abs = import_path110.default.resolve(this.themeDir, filePath);
|
|
976878
976953
|
try {
|
|
976879
|
-
await (0,
|
|
976954
|
+
await (0, import_promises199.access)(abs);
|
|
976880
976955
|
} catch {
|
|
976881
976956
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
976882
976957
|
}
|
|
@@ -977041,7 +977116,7 @@ ${errors4.map((e2) => ` - ${e2}`).join("\n")}`,
|
|
|
977041
977116
|
return { config: cfg, filesUploaded };
|
|
977042
977117
|
}
|
|
977043
977118
|
async uploadFileToCas(absolutePath) {
|
|
977044
|
-
const content5 = await (0,
|
|
977119
|
+
const content5 = await (0, import_promises199.readFile)(absolutePath);
|
|
977045
977120
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
977046
977121
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
977047
977122
|
return this.uploadToCas(content5, contentType, bindPath, import_path110.default.basename(absolutePath));
|
|
@@ -977156,7 +977231,7 @@ async function uploadDocsTheme({
|
|
|
977156
977231
|
await cliContext.runTask(async (context3) => {
|
|
977157
977232
|
let rawYaml;
|
|
977158
977233
|
try {
|
|
977159
|
-
const content5 = await (0,
|
|
977234
|
+
const content5 = await (0, import_promises200.readFile)(themeYmlPath, "utf-8");
|
|
977160
977235
|
rawYaml = index_vite_proxy_tmp_default.load(content5, { schema: index_vite_proxy_tmp_default.JSON_SCHEMA });
|
|
977161
977236
|
} catch {
|
|
977162
977237
|
context3.failAndThrow(
|
|
@@ -977211,7 +977286,7 @@ async function uploadDocsTheme({
|
|
|
977211
977286
|
// src/commands/downgrade/downgrade.ts
|
|
977212
977287
|
init_lib19();
|
|
977213
977288
|
init_lib6();
|
|
977214
|
-
var
|
|
977289
|
+
var import_promises201 = require("fs/promises");
|
|
977215
977290
|
function ensureFinalNewline2(content5) {
|
|
977216
977291
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
977217
977292
|
}
|
|
@@ -977236,7 +977311,7 @@ async function downgrade({
|
|
|
977236
977311
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
977237
977312
|
draft.version = targetVersion;
|
|
977238
977313
|
});
|
|
977239
|
-
await (0,
|
|
977314
|
+
await (0, import_promises201.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
977240
977315
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
977241
977316
|
}
|
|
977242
977317
|
|
|
@@ -977244,7 +977319,7 @@ async function downgrade({
|
|
|
977244
977319
|
init_lib36();
|
|
977245
977320
|
init_lib8();
|
|
977246
977321
|
init_lib22();
|
|
977247
|
-
var
|
|
977322
|
+
var import_promises202 = require("fs/promises");
|
|
977248
977323
|
init_js_yaml();
|
|
977249
977324
|
|
|
977250
977325
|
// src/commands/export/convertIrToOpenApi.ts
|
|
@@ -978666,8 +978741,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
978666
978741
|
ir: ir3,
|
|
978667
978742
|
mode: "openapi"
|
|
978668
978743
|
});
|
|
978669
|
-
await (0,
|
|
978670
|
-
await (0,
|
|
978744
|
+
await (0, import_promises202.mkdir)(dirname6(outputPath), { recursive: true });
|
|
978745
|
+
await (0, import_promises202.writeFile)(
|
|
978671
978746
|
outputPath,
|
|
978672
978747
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : index_vite_proxy_tmp_default.dump(openapi, { indent: indent4 })
|
|
978673
978748
|
);
|
|
@@ -979273,7 +979348,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
979273
979348
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
979274
979349
|
init_lib8();
|
|
979275
979350
|
init_lib6();
|
|
979276
|
-
var
|
|
979351
|
+
var import_promises203 = require("fs/promises");
|
|
979277
979352
|
init_js_yaml();
|
|
979278
979353
|
async function compareOpenAPISpecs({
|
|
979279
979354
|
originalPath,
|
|
@@ -979315,12 +979390,12 @@ async function compareOpenAPISpecs({
|
|
|
979315
979390
|
}
|
|
979316
979391
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
979317
979392
|
}
|
|
979318
|
-
await (0,
|
|
979393
|
+
await (0, import_promises203.writeFile)(outputPath, index_vite_proxy_tmp_default.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
979319
979394
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
979320
979395
|
});
|
|
979321
979396
|
}
|
|
979322
979397
|
async function loadSpec2(filepath, context3) {
|
|
979323
|
-
const contents = await (0,
|
|
979398
|
+
const contents = await (0, import_promises203.readFile)(filepath, "utf8");
|
|
979324
979399
|
try {
|
|
979325
979400
|
return JSON.parse(contents);
|
|
979326
979401
|
} catch {
|
|
@@ -979428,7 +979503,7 @@ init_lib35();
|
|
|
979428
979503
|
init_lib16();
|
|
979429
979504
|
init_lib15();
|
|
979430
979505
|
init_lib6();
|
|
979431
|
-
var
|
|
979506
|
+
var import_promises204 = require("fs/promises");
|
|
979432
979507
|
init_js_yaml();
|
|
979433
979508
|
async function writeOverridesForWorkspaces({
|
|
979434
979509
|
project,
|
|
@@ -979454,7 +979529,7 @@ async function writeOverridesForWorkspaces({
|
|
|
979454
979529
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
979455
979530
|
let parsedOverrides = null;
|
|
979456
979531
|
try {
|
|
979457
|
-
const contents = (await (0,
|
|
979532
|
+
const contents = (await (0, import_promises204.readFile)(overridesFilepath, "utf8")).toString();
|
|
979458
979533
|
try {
|
|
979459
979534
|
parsedOverrides = JSON.parse(contents);
|
|
979460
979535
|
} catch (err) {
|
|
@@ -979519,7 +979594,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979519
979594
|
for (const overridesPath of overridesPaths) {
|
|
979520
979595
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
979521
979596
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides, includeModels, context: context3 });
|
|
979522
|
-
await (0,
|
|
979597
|
+
await (0, import_promises204.writeFile)(overridesPath, index_vite_proxy_tmp_default.dump(content5));
|
|
979523
979598
|
}
|
|
979524
979599
|
} else {
|
|
979525
979600
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -979533,7 +979608,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979533
979608
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
979534
979609
|
}
|
|
979535
979610
|
}
|
|
979536
|
-
await (0,
|
|
979611
|
+
await (0, import_promises204.writeFile)(
|
|
979537
979612
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
979538
979613
|
index_vite_proxy_tmp_default.dump(content5)
|
|
979539
979614
|
);
|
|
@@ -979992,7 +980067,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
979992
980067
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
979993
980068
|
init_lib21();
|
|
979994
980069
|
init_source();
|
|
979995
|
-
var
|
|
980070
|
+
var import_promises205 = require("fs/promises");
|
|
979996
980071
|
async function generateJsonschemaForWorkspaces({
|
|
979997
980072
|
typeLocator,
|
|
979998
980073
|
project,
|
|
@@ -980040,9 +980115,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
980040
980115
|
context: context3
|
|
980041
980116
|
});
|
|
980042
980117
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
980043
|
-
await (0,
|
|
980118
|
+
await (0, import_promises205.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
980044
980119
|
}
|
|
980045
|
-
await (0,
|
|
980120
|
+
await (0, import_promises205.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
980046
980121
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
980047
980122
|
});
|
|
980048
980123
|
})
|
|
@@ -980052,7 +980127,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
980052
980127
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
980053
980128
|
init_lib8();
|
|
980054
980129
|
init_lib6();
|
|
980055
|
-
var
|
|
980130
|
+
var import_promises206 = require("fs/promises");
|
|
980056
980131
|
init_js_yaml();
|
|
980057
980132
|
var HTTP_METHODS4 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
980058
980133
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -980081,11 +980156,11 @@ async function mergeOpenAPIWithOverrides({
|
|
|
980081
980156
|
if (split2) {
|
|
980082
980157
|
const examples = extractEnrichedExamples2(openapi, merged);
|
|
980083
980158
|
const output2 = isJson ? JSON.stringify(examples, null, 2) : index_vite_proxy_tmp_default.dump(examples, { lineWidth: -1, noRefs: true });
|
|
980084
|
-
await (0,
|
|
980159
|
+
await (0, import_promises206.writeFile)(outputPath, output2);
|
|
980085
980160
|
context3.logger.info(`Extracted enriched examples written to ${outputPath}`);
|
|
980086
980161
|
} else {
|
|
980087
980162
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : index_vite_proxy_tmp_default.dump(merged, { lineWidth: -1, noRefs: true });
|
|
980088
|
-
await (0,
|
|
980163
|
+
await (0, import_promises206.writeFile)(outputPath, output2);
|
|
980089
980164
|
if (outputPath === openapiPath) {
|
|
980090
980165
|
context3.logger.info(`Enriched ${openapiPath} in-place`);
|
|
980091
980166
|
} else {
|
|
@@ -980095,7 +980170,7 @@ async function mergeOpenAPIWithOverrides({
|
|
|
980095
980170
|
});
|
|
980096
980171
|
}
|
|
980097
980172
|
async function loadYamlOrJson(filepath, context3) {
|
|
980098
|
-
const contents = await (0,
|
|
980173
|
+
const contents = await (0, import_promises206.readFile)(filepath, "utf8");
|
|
980099
980174
|
try {
|
|
980100
980175
|
return JSON.parse(contents);
|
|
980101
980176
|
} catch {
|
|
@@ -980890,7 +980965,7 @@ init_lib35();
|
|
|
980890
980965
|
init_lib6();
|
|
980891
980966
|
init_esm19();
|
|
980892
980967
|
init_axios2();
|
|
980893
|
-
var
|
|
980968
|
+
var import_promises207 = require("fs/promises");
|
|
980894
980969
|
var import_path117 = __toESM(require("path"), 1);
|
|
980895
980970
|
init_index_min2();
|
|
980896
980971
|
var import_tmp_promise20 = __toESM(require_tmp_promise(), 1);
|
|
@@ -980944,7 +981019,7 @@ async function registerWorkspacesV1({
|
|
|
980944
981019
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
980945
981020
|
await Kn({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
980946
981021
|
context3.logger.info("Uploading definition...");
|
|
980947
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
981022
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises207.readFile)(tarPath));
|
|
980948
981023
|
context3.logger.info(
|
|
980949
981024
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
980950
981025
|
);
|
|
@@ -981001,7 +981076,7 @@ function getAIEnhancerConfig2() {
|
|
|
981001
981076
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
981002
981077
|
init_lib8();
|
|
981003
981078
|
init_lib35();
|
|
981004
|
-
var
|
|
981079
|
+
var import_promises208 = require("fs/promises");
|
|
981005
981080
|
var import_path118 = __toESM(require("path"), 1);
|
|
981006
981081
|
async function resolveSpecsForWorkspaces({
|
|
981007
981082
|
project,
|
|
@@ -981021,14 +981096,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
981021
981096
|
return;
|
|
981022
981097
|
}
|
|
981023
981098
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path118.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
981024
|
-
await (0,
|
|
981099
|
+
await (0, import_promises208.mkdir)(workspaceOutputDir, { recursive: true });
|
|
981025
981100
|
const manifest = await collectRawSpecs({
|
|
981026
981101
|
specs,
|
|
981027
981102
|
hostOutputDir: workspaceOutputDir,
|
|
981028
981103
|
containerBaseDir: ".",
|
|
981029
981104
|
context: context3
|
|
981030
981105
|
});
|
|
981031
|
-
await (0,
|
|
981106
|
+
await (0, import_promises208.writeFile)(
|
|
981032
981107
|
import_path118.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
981033
981108
|
JSON.stringify(manifest, void 0, 4)
|
|
981034
981109
|
);
|
|
@@ -981238,7 +981313,7 @@ init_lib17();
|
|
|
981238
981313
|
init_lib19();
|
|
981239
981314
|
init_lib8();
|
|
981240
981315
|
init_lib6();
|
|
981241
|
-
var
|
|
981316
|
+
var import_promises209 = __toESM(require("fs/promises"), 1);
|
|
981242
981317
|
|
|
981243
981318
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
981244
981319
|
var BASE_VERSION = "0.0.1";
|
|
@@ -981358,7 +981433,7 @@ async function sdkPreview({
|
|
|
981358
981433
|
const firstPath = pathOutputs[0];
|
|
981359
981434
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
981360
981435
|
if (absolutePathToOutput != null) {
|
|
981361
|
-
await
|
|
981436
|
+
await import_promises209.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
981362
981437
|
}
|
|
981363
981438
|
for (const workspace of project.apiWorkspaces) {
|
|
981364
981439
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -981548,7 +981623,7 @@ async function sdkPreview({
|
|
|
981548
981623
|
init_lib33();
|
|
981549
981624
|
init_lib6();
|
|
981550
981625
|
init_source();
|
|
981551
|
-
var
|
|
981626
|
+
var import_promises210 = require("fs/promises");
|
|
981552
981627
|
var import_path119 = require("path");
|
|
981553
981628
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
981554
981629
|
let command3;
|
|
@@ -981594,7 +981669,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
981594
981669
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
981595
981670
|
let resolvedPath;
|
|
981596
981671
|
try {
|
|
981597
|
-
resolvedPath = await (0,
|
|
981672
|
+
resolvedPath = await (0, import_promises210.realpath)(fernPath);
|
|
981598
981673
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
981599
981674
|
} catch (error50) {
|
|
981600
981675
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -981908,22 +981983,22 @@ init_lib19();
|
|
|
981908
981983
|
init_lib8();
|
|
981909
981984
|
init_lib6();
|
|
981910
981985
|
var fs33 = __toESM(require("fs"), 1);
|
|
981911
|
-
var
|
|
981986
|
+
var import_promises211 = require("fs/promises");
|
|
981912
981987
|
init_graphql();
|
|
981913
981988
|
init_js_yaml();
|
|
981914
981989
|
var import_stream18 = require("stream");
|
|
981915
|
-
var
|
|
981990
|
+
var import_promises212 = require("stream/promises");
|
|
981916
981991
|
async function fetchAndWriteFile(url3, path119, logger4, indent4) {
|
|
981917
981992
|
const resp = await fetch(url3);
|
|
981918
981993
|
if (resp.ok && resp.body) {
|
|
981919
981994
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
981920
981995
|
const fileStream = fs33.createWriteStream(path119);
|
|
981921
|
-
await (0,
|
|
981922
|
-
const fileContents = await (0,
|
|
981996
|
+
await (0, import_promises212.finished)(import_stream18.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
981997
|
+
const fileContents = await (0, import_promises211.readFile)(path119, "utf8");
|
|
981923
981998
|
try {
|
|
981924
|
-
await (0,
|
|
981999
|
+
await (0, import_promises211.writeFile)(path119, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
981925
982000
|
} catch (e2) {
|
|
981926
|
-
await (0,
|
|
982001
|
+
await (0, import_promises211.writeFile)(path119, index_vite_proxy_tmp_default.dump(index_vite_proxy_tmp_default.load(fileContents), { indent: indent4 }), "utf8");
|
|
981927
982002
|
}
|
|
981928
982003
|
logger4.debug("File written successfully");
|
|
981929
982004
|
}
|
|
@@ -982079,14 +982154,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
982079
982154
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path119, logger4) {
|
|
982080
982155
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
982081
982156
|
if (postResult.success) {
|
|
982082
|
-
await (0,
|
|
982157
|
+
await (0, import_promises211.writeFile)(path119, postResult.result, "utf8");
|
|
982083
982158
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
982084
982159
|
return;
|
|
982085
982160
|
}
|
|
982086
982161
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
982087
982162
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
982088
982163
|
if (getResult.success) {
|
|
982089
|
-
await (0,
|
|
982164
|
+
await (0, import_promises211.writeFile)(path119, getResult.result, "utf8");
|
|
982090
982165
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
982091
982166
|
return;
|
|
982092
982167
|
}
|
|
@@ -982796,7 +982871,7 @@ async function validateWorkspaces({
|
|
|
982796
982871
|
init_lib19();
|
|
982797
982872
|
init_lib8();
|
|
982798
982873
|
init_source();
|
|
982799
|
-
var
|
|
982874
|
+
var import_promises213 = require("fs/promises");
|
|
982800
982875
|
init_js_yaml();
|
|
982801
982876
|
var import_path121 = __toESM(require("path"), 1);
|
|
982802
982877
|
async function writeDefinitionForWorkspaces({
|
|
@@ -982878,22 +982953,22 @@ async function writeFernDefinition({
|
|
|
982878
982953
|
return a3.localeCompare(b5);
|
|
982879
982954
|
};
|
|
982880
982955
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
982881
|
-
await (0,
|
|
982956
|
+
await (0, import_promises213.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
982882
982957
|
}
|
|
982883
|
-
await (0,
|
|
982884
|
-
await (0,
|
|
982958
|
+
await (0, import_promises213.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
982959
|
+
await (0, import_promises213.writeFile)(
|
|
982885
982960
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
982886
982961
|
index_vite_proxy_tmp_default.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
982887
982962
|
);
|
|
982888
982963
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
982889
982964
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982890
|
-
await (0,
|
|
982891
|
-
await (0,
|
|
982965
|
+
await (0, import_promises213.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
982966
|
+
await (0, import_promises213.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(packageMarker.contents, { sortKeys }));
|
|
982892
982967
|
}
|
|
982893
982968
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
982894
982969
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982895
|
-
await (0,
|
|
982896
|
-
await (0,
|
|
982970
|
+
await (0, import_promises213.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
982971
|
+
await (0, import_promises213.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(definitionFile.contents, { sortKeys }));
|
|
982897
982972
|
}
|
|
982898
982973
|
}
|
|
982899
982974
|
|
|
@@ -982901,7 +982976,7 @@ async function writeFernDefinition({
|
|
|
982901
982976
|
init_lib67();
|
|
982902
982977
|
init_lib8();
|
|
982903
982978
|
init_source();
|
|
982904
|
-
var
|
|
982979
|
+
var import_promises214 = require("fs/promises");
|
|
982905
982980
|
async function writeDocsDefinitionForProject({
|
|
982906
982981
|
project,
|
|
982907
982982
|
outputPath,
|
|
@@ -982933,7 +983008,7 @@ async function writeDocsDefinitionForProject({
|
|
|
982933
983008
|
targetAudiences: docsWorkspace.config.instances[0]?.audiences ? Array.isArray(docsWorkspace.config.instances[0].audiences) ? docsWorkspace.config.instances[0].audiences : [docsWorkspace.config.instances[0].audiences] : void 0
|
|
982934
983009
|
});
|
|
982935
983010
|
const docsDefinition = await docsResolver.resolve();
|
|
982936
|
-
await (0,
|
|
983011
|
+
await (0, import_promises214.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
982937
983012
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
982938
983013
|
});
|
|
982939
983014
|
}
|