fern-api 0.39.10 → 0.39.12
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/bundle.cjs +119 -77
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -81211,9 +81211,9 @@ var require_symlink = __commonJS({
|
|
|
81211
81211
|
if (areIdentical(srcStat, dstStat))
|
|
81212
81212
|
return;
|
|
81213
81213
|
}
|
|
81214
|
-
const
|
|
81215
|
-
srcpath =
|
|
81216
|
-
const toType = await symlinkType(
|
|
81214
|
+
const relative4 = await symlinkPaths(srcpath, dstpath);
|
|
81215
|
+
srcpath = relative4.toDst;
|
|
81216
|
+
const toType = await symlinkType(relative4.toCwd, type2);
|
|
81217
81217
|
const dir = path45.dirname(dstpath);
|
|
81218
81218
|
if (!await pathExists2(dir)) {
|
|
81219
81219
|
await mkdirs(dir);
|
|
@@ -81232,9 +81232,9 @@ var require_symlink = __commonJS({
|
|
|
81232
81232
|
if (areIdentical(srcStat, dstStat))
|
|
81233
81233
|
return;
|
|
81234
81234
|
}
|
|
81235
|
-
const
|
|
81236
|
-
srcpath =
|
|
81237
|
-
type2 = symlinkTypeSync(
|
|
81235
|
+
const relative4 = symlinkPathsSync(srcpath, dstpath);
|
|
81236
|
+
srcpath = relative4.toDst;
|
|
81237
|
+
type2 = symlinkTypeSync(relative4.toCwd, type2);
|
|
81238
81238
|
const dir = path45.dirname(dstpath);
|
|
81239
81239
|
const exists = fs8.existsSync(dir);
|
|
81240
81240
|
if (exists)
|
|
@@ -86020,8 +86020,8 @@ var require_follow_redirects = __commonJS({
|
|
|
86020
86020
|
}
|
|
86021
86021
|
return parsed;
|
|
86022
86022
|
}
|
|
86023
|
-
function resolveUrl(
|
|
86024
|
-
return useNativeURL ? new URL2(
|
|
86023
|
+
function resolveUrl(relative4, base2) {
|
|
86024
|
+
return useNativeURL ? new URL2(relative4, base2) : parseUrl(url.resolve(base2, relative4));
|
|
86025
86025
|
}
|
|
86026
86026
|
function validateUrl(input) {
|
|
86027
86027
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -368671,51 +368671,51 @@ var require_uri_all = __commonJS({
|
|
|
368671
368671
|
}
|
|
368672
368672
|
return uriTokens.join("");
|
|
368673
368673
|
}
|
|
368674
|
-
function resolveComponents(base3,
|
|
368674
|
+
function resolveComponents(base3, relative4) {
|
|
368675
368675
|
var options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
368676
368676
|
var skipNormalization = arguments[3];
|
|
368677
368677
|
var target = {};
|
|
368678
368678
|
if (!skipNormalization) {
|
|
368679
368679
|
base3 = parse10(serialize5(base3, options2), options2);
|
|
368680
|
-
|
|
368680
|
+
relative4 = parse10(serialize5(relative4, options2), options2);
|
|
368681
368681
|
}
|
|
368682
368682
|
options2 = options2 || {};
|
|
368683
|
-
if (!options2.tolerant &&
|
|
368684
|
-
target.scheme =
|
|
368685
|
-
target.userinfo =
|
|
368686
|
-
target.host =
|
|
368687
|
-
target.port =
|
|
368688
|
-
target.path = removeDotSegments(
|
|
368689
|
-
target.query =
|
|
368683
|
+
if (!options2.tolerant && relative4.scheme) {
|
|
368684
|
+
target.scheme = relative4.scheme;
|
|
368685
|
+
target.userinfo = relative4.userinfo;
|
|
368686
|
+
target.host = relative4.host;
|
|
368687
|
+
target.port = relative4.port;
|
|
368688
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
368689
|
+
target.query = relative4.query;
|
|
368690
368690
|
} else {
|
|
368691
|
-
if (
|
|
368692
|
-
target.userinfo =
|
|
368693
|
-
target.host =
|
|
368694
|
-
target.port =
|
|
368695
|
-
target.path = removeDotSegments(
|
|
368696
|
-
target.query =
|
|
368691
|
+
if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
|
|
368692
|
+
target.userinfo = relative4.userinfo;
|
|
368693
|
+
target.host = relative4.host;
|
|
368694
|
+
target.port = relative4.port;
|
|
368695
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
368696
|
+
target.query = relative4.query;
|
|
368697
368697
|
} else {
|
|
368698
|
-
if (!
|
|
368698
|
+
if (!relative4.path) {
|
|
368699
368699
|
target.path = base3.path;
|
|
368700
|
-
if (
|
|
368701
|
-
target.query =
|
|
368700
|
+
if (relative4.query !== void 0) {
|
|
368701
|
+
target.query = relative4.query;
|
|
368702
368702
|
} else {
|
|
368703
368703
|
target.query = base3.query;
|
|
368704
368704
|
}
|
|
368705
368705
|
} else {
|
|
368706
|
-
if (
|
|
368707
|
-
target.path = removeDotSegments(
|
|
368706
|
+
if (relative4.path.charAt(0) === "/") {
|
|
368707
|
+
target.path = removeDotSegments(relative4.path);
|
|
368708
368708
|
} else {
|
|
368709
368709
|
if ((base3.userinfo !== void 0 || base3.host !== void 0 || base3.port !== void 0) && !base3.path) {
|
|
368710
|
-
target.path = "/" +
|
|
368710
|
+
target.path = "/" + relative4.path;
|
|
368711
368711
|
} else if (!base3.path) {
|
|
368712
|
-
target.path =
|
|
368712
|
+
target.path = relative4.path;
|
|
368713
368713
|
} else {
|
|
368714
|
-
target.path = base3.path.slice(0, base3.path.lastIndexOf("/") + 1) +
|
|
368714
|
+
target.path = base3.path.slice(0, base3.path.lastIndexOf("/") + 1) + relative4.path;
|
|
368715
368715
|
}
|
|
368716
368716
|
target.path = removeDotSegments(target.path);
|
|
368717
368717
|
}
|
|
368718
|
-
target.query =
|
|
368718
|
+
target.query = relative4.query;
|
|
368719
368719
|
}
|
|
368720
368720
|
target.userinfo = base3.userinfo;
|
|
368721
368721
|
target.host = base3.host;
|
|
@@ -368723,7 +368723,7 @@ var require_uri_all = __commonJS({
|
|
|
368723
368723
|
}
|
|
368724
368724
|
target.scheme = base3.scheme;
|
|
368725
368725
|
}
|
|
368726
|
-
target.fragment =
|
|
368726
|
+
target.fragment = relative4.fragment;
|
|
368727
368727
|
return target;
|
|
368728
368728
|
}
|
|
368729
368729
|
function resolve6(baseURI, relativeURI, options2) {
|
|
@@ -430518,7 +430518,7 @@ var require_lib20 = __commonJS({
|
|
|
430518
430518
|
// ../../../node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js
|
|
430519
430519
|
var require_depd = __commonJS({
|
|
430520
430520
|
"../../../node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js"(exports2, module2) {
|
|
430521
|
-
var
|
|
430521
|
+
var relative4 = require("path").relative;
|
|
430522
430522
|
module2.exports = depd;
|
|
430523
430523
|
var basePath = process.cwd();
|
|
430524
430524
|
function containsNamespace(str3, namespace) {
|
|
@@ -430710,7 +430710,7 @@ var require_depd = __commonJS({
|
|
|
430710
430710
|
return formatted;
|
|
430711
430711
|
}
|
|
430712
430712
|
function formatLocation(callSite) {
|
|
430713
|
-
return
|
|
430713
|
+
return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
430714
430714
|
}
|
|
430715
430715
|
function getStack() {
|
|
430716
430716
|
var limit = Error.stackTraceLimit;
|
|
@@ -1192625,7 +1192625,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1192625
1192625
|
properties: {
|
|
1192626
1192626
|
...event,
|
|
1192627
1192627
|
...event.properties,
|
|
1192628
|
-
version: "0.39.
|
|
1192628
|
+
version: "0.39.12",
|
|
1192629
1192629
|
usingAccessToken: true
|
|
1192630
1192630
|
}
|
|
1192631
1192631
|
});
|
|
@@ -1192687,7 +1192687,7 @@ var UserPosthogManager = class {
|
|
|
1192687
1192687
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1192688
1192688
|
event: "CLI",
|
|
1192689
1192689
|
properties: {
|
|
1192690
|
-
version: "0.39.
|
|
1192690
|
+
version: "0.39.12",
|
|
1192691
1192691
|
...event,
|
|
1192692
1192692
|
...event.properties
|
|
1192693
1192693
|
}
|
|
@@ -1207062,7 +1207062,8 @@ var HttpMethod4 = schemas_exports5.enum_(["GET", "POST", "PUT", "PATCH", "DELETE
|
|
|
1207062
1207062
|
var PathParameter2 = schemas_exports5.objectWithoutOptionalProperties({
|
|
1207063
1207063
|
name: schemas_exports5.string(),
|
|
1207064
1207064
|
schema: schemas_exports5.lazy(() => Schema3),
|
|
1207065
|
-
variableReference: schemas_exports5.string().optional()
|
|
1207065
|
+
variableReference: schemas_exports5.string().optional(),
|
|
1207066
|
+
parameterNameOverride: schemas_exports5.string().optional()
|
|
1207066
1207067
|
}).extend(WithDescription).extend(WithAvailability).extend(WithSource);
|
|
1207067
1207068
|
|
|
1207068
1207069
|
// ../openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/QueryParameter.js
|
|
@@ -1207216,6 +1207217,7 @@ var FernExample = schemas_exports5.unknown();
|
|
|
1207216
1207217
|
// ../openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/PathParameterExample.js
|
|
1207217
1207218
|
var PathParameterExample = schemas_exports5.objectWithoutOptionalProperties({
|
|
1207218
1207219
|
name: schemas_exports5.string(),
|
|
1207220
|
+
parameterNameOverride: schemas_exports5.string().optional(),
|
|
1207219
1207221
|
value: schemas_exports5.lazy(() => FullExample2)
|
|
1207220
1207222
|
});
|
|
1207221
1207223
|
|
|
@@ -1207792,7 +1207794,8 @@ var WebsocketHandshakeWithExample = schemas_exports5.objectWithoutOptionalProper
|
|
|
1207792
1207794
|
var PathParameterWithExample = schemas_exports5.objectWithoutOptionalProperties({
|
|
1207793
1207795
|
name: schemas_exports5.string(),
|
|
1207794
1207796
|
schema: schemas_exports5.lazy(() => SchemaWithExample2),
|
|
1207795
|
-
variableReference: schemas_exports5.string().optional()
|
|
1207797
|
+
variableReference: schemas_exports5.string().optional(),
|
|
1207798
|
+
parameterNameOverride: schemas_exports5.string().optional()
|
|
1207796
1207799
|
}).extend(WithDescription).extend(WithAvailability).extend(WithSource);
|
|
1207797
1207800
|
|
|
1207798
1207801
|
// ../openapi-ir-sdk/lib/sdk/serialization/resources/parseIr/types/JsonRequestWithExample.js
|
|
@@ -1213247,6 +1213250,7 @@ var ExampleEndpointFactory = class {
|
|
|
1213247
1213250
|
} else if (example != null) {
|
|
1213248
1213251
|
pathParameters.push({
|
|
1213249
1213252
|
name: pathParameter.name,
|
|
1213253
|
+
parameterNameOverride: pathParameter.parameterNameOverride,
|
|
1213250
1213254
|
value: example
|
|
1213251
1213255
|
});
|
|
1213252
1213256
|
}
|
|
@@ -1213814,6 +1213818,7 @@ function parseAsyncAPI({ document: document4, taskContext, options: options2, so
|
|
|
1213814
1213818
|
pathParameters.push({
|
|
1213815
1213819
|
name: name2,
|
|
1213816
1213820
|
description: parameter.description,
|
|
1213821
|
+
parameterNameOverride: void 0,
|
|
1213817
1213822
|
schema: parameter.schema != null ? convertSchema(parameter.schema, false, context, breadcrumbs, source, namespace) : SchemaWithExample.primitive({
|
|
1213818
1213823
|
schema: PrimitiveSchemaValueWithExample.string({
|
|
1213819
1213824
|
default: void 0,
|
|
@@ -1213938,6 +1213943,7 @@ function parseAsyncAPI({ document: document4, taskContext, options: options2, so
|
|
|
1213938
1213943
|
pathParameters: pathParameters.map((param) => {
|
|
1213939
1213944
|
return {
|
|
1213940
1213945
|
...param,
|
|
1213946
|
+
parameterNameOverride: void 0,
|
|
1213941
1213947
|
schema: convertSchemaWithExampleToSchema(param.schema)
|
|
1213942
1213948
|
};
|
|
1213943
1213949
|
})
|
|
@@ -1216192,6 +1216198,7 @@ function generateIr({ openApi, taskContext, options: options2, source, namespace
|
|
|
1216192
1216198
|
description: pathParameter.description,
|
|
1216193
1216199
|
name: pathParameter.name,
|
|
1216194
1216200
|
schema: convertSchemaWithExampleToSchema(pathParameter.schema),
|
|
1216201
|
+
parameterNameOverride: pathParameter.parameterNameOverride,
|
|
1216195
1216202
|
variableReference: pathParameter.variableReference,
|
|
1216196
1216203
|
availability: pathParameter.availability,
|
|
1216197
1216204
|
source: pathParameter.source
|
|
@@ -1217388,7 +1217395,7 @@ function buildEndpointExample({ endpointExample, context }) {
|
|
|
1217388
1217395
|
example.docs = endpointExample.description;
|
|
1217389
1217396
|
}
|
|
1217390
1217397
|
if (endpointExample.pathParameters != null && endpointExample.pathParameters.length > 0) {
|
|
1217391
|
-
example["path-parameters"] =
|
|
1217398
|
+
example["path-parameters"] = convertPathParameterExample(endpointExample.pathParameters);
|
|
1217392
1217399
|
}
|
|
1217393
1217400
|
if (endpointExample.queryParameters != null && endpointExample.queryParameters.length > 0) {
|
|
1217394
1217401
|
example["query-parameters"] = convertQueryParameterExample2(endpointExample.queryParameters);
|
|
@@ -1217427,9 +1217434,14 @@ function buildEndpointExample({ endpointExample, context }) {
|
|
|
1217427
1217434
|
}
|
|
1217428
1217435
|
return example;
|
|
1217429
1217436
|
}
|
|
1217430
|
-
function
|
|
1217437
|
+
function convertPathParameterExample(pathParameterExamples) {
|
|
1217431
1217438
|
const result = {};
|
|
1217432
|
-
|
|
1217439
|
+
pathParameterExamples.forEach((pathParameterExample) => {
|
|
1217440
|
+
const convertedExample = convertFullExample2(pathParameterExample.value);
|
|
1217441
|
+
if (convertedExample != null) {
|
|
1217442
|
+
result[pathParameterExample.parameterNameOverride ?? pathParameterExample.name] = convertedExample;
|
|
1217443
|
+
}
|
|
1217444
|
+
});
|
|
1217433
1217445
|
return result;
|
|
1217434
1217446
|
}
|
|
1217435
1217447
|
function convertQueryParameterExample2(namedFullExamples) {
|
|
@@ -1217486,9 +1217498,13 @@ function buildEndpoint({ endpoint, declarationFile, context }) {
|
|
|
1217486
1217498
|
const { nonRequestReferencedSchemas } = context.ir;
|
|
1217487
1217499
|
let schemaIdsToExclude = [];
|
|
1217488
1217500
|
const names2 = /* @__PURE__ */ new Set();
|
|
1217501
|
+
let path45 = endpoint.path;
|
|
1217489
1217502
|
const pathParameters = {};
|
|
1217490
1217503
|
for (const pathParameter of endpoint.pathParameters) {
|
|
1217491
|
-
|
|
1217504
|
+
if (pathParameter.parameterNameOverride) {
|
|
1217505
|
+
path45 = path45.replace(pathParameter.name, pathParameter.parameterNameOverride);
|
|
1217506
|
+
}
|
|
1217507
|
+
pathParameters[pathParameter.parameterNameOverride ?? pathParameter.name] = buildPathParameter({
|
|
1217492
1217508
|
pathParameter,
|
|
1217493
1217509
|
context,
|
|
1217494
1217510
|
fileContainingReference: declarationFile
|
|
@@ -1217526,7 +1217542,7 @@ function buildEndpoint({ endpoint, declarationFile, context }) {
|
|
|
1217526
1217542
|
}
|
|
1217527
1217543
|
}
|
|
1217528
1217544
|
const convertedEndpoint = {
|
|
1217529
|
-
path:
|
|
1217545
|
+
path: path45,
|
|
1217530
1217546
|
method: convertToHttpMethod(endpoint.method),
|
|
1217531
1217547
|
auth: endpoint.authed,
|
|
1217532
1217548
|
docs: endpoint.description ?? void 0,
|
|
@@ -1222798,10 +1222814,10 @@ var CliContext = class {
|
|
|
1222798
1222814
|
return "fern-api";
|
|
1222799
1222815
|
}
|
|
1222800
1222816
|
getPackageVersion() {
|
|
1222801
|
-
if ("0.39.
|
|
1222817
|
+
if ("0.39.12" == null) {
|
|
1222802
1222818
|
this.logger.error("CLI_VERSION is not defined");
|
|
1222803
1222819
|
}
|
|
1222804
|
-
return "0.39.
|
|
1222820
|
+
return "0.39.12";
|
|
1222805
1222821
|
}
|
|
1222806
1222822
|
getCliName() {
|
|
1222807
1222823
|
if ("fern" == null) {
|
|
@@ -1231163,16 +1231179,16 @@ function collect(events, tokenTypes) {
|
|
|
1231163
1231179
|
}
|
|
1231164
1231180
|
return result;
|
|
1231165
1231181
|
}
|
|
1231166
|
-
function relativeToPoint(stops,
|
|
1231182
|
+
function relativeToPoint(stops, relative4) {
|
|
1231167
1231183
|
let index2 = 0;
|
|
1231168
|
-
while (index2 < stops.length && stops[index2][0] <=
|
|
1231184
|
+
while (index2 < stops.length && stops[index2][0] <= relative4) {
|
|
1231169
1231185
|
index2 += 1;
|
|
1231170
1231186
|
}
|
|
1231171
1231187
|
if (index2 === 0) {
|
|
1231172
1231188
|
return void 0;
|
|
1231173
1231189
|
}
|
|
1231174
1231190
|
const [stopRelative, stopAbsolute] = stops[index2 - 1];
|
|
1231175
|
-
const rest =
|
|
1231191
|
+
const rest = relative4 - stopRelative;
|
|
1231176
1231192
|
return {
|
|
1231177
1231193
|
line: stopAbsolute.line,
|
|
1231178
1231194
|
column: stopAbsolute.column + rest,
|
|
@@ -1240295,7 +1240311,7 @@ async function convertTransport({ file, serviceDeclaration, sourceResolver }) {
|
|
|
1240295
1240311
|
source: serviceDeclaration.source,
|
|
1240296
1240312
|
file
|
|
1240297
1240313
|
});
|
|
1240298
|
-
if (resolvedSource.type !== "protobuf") {
|
|
1240314
|
+
if (resolvedSource == null || resolvedSource.type !== "protobuf") {
|
|
1240299
1240315
|
return Transport.http();
|
|
1240300
1240316
|
}
|
|
1240301
1240317
|
const protobufService = convertProtobufService({
|
|
@@ -1241854,7 +1241870,7 @@ async function convertTypeDeclarationSource({ file, typeDeclaration, typeName, s
|
|
|
1241854
1241870
|
source: typeDeclaration.source,
|
|
1241855
1241871
|
file
|
|
1241856
1241872
|
});
|
|
1241857
|
-
if (resolvedSource.type !== "protobuf") {
|
|
1241873
|
+
if (resolvedSource == null || resolvedSource.type !== "protobuf") {
|
|
1241858
1241874
|
return void 0;
|
|
1241859
1241875
|
}
|
|
1241860
1241876
|
return Source.proto(convertSourceToProtobufType({
|
|
@@ -1244130,17 +1244146,21 @@ var ProtobufParser = class {
|
|
|
1244130
1244146
|
|
|
1244131
1244147
|
// ../generation/ir-generator/lib/resolvers/SourceResolver.js
|
|
1244132
1244148
|
var SourceResolverImpl = class {
|
|
1244149
|
+
context;
|
|
1244133
1244150
|
workspace;
|
|
1244134
1244151
|
sourceCache;
|
|
1244135
|
-
constructor(workspace) {
|
|
1244152
|
+
constructor(context, workspace) {
|
|
1244153
|
+
this.context = context;
|
|
1244136
1244154
|
this.workspace = workspace;
|
|
1244137
1244155
|
this.sourceCache = /* @__PURE__ */ new Map();
|
|
1244138
1244156
|
}
|
|
1244139
1244157
|
async resolveSourceOrThrow({ source, file }) {
|
|
1244140
1244158
|
const resolvedType = await this.resolveSource({ source, file });
|
|
1244141
1244159
|
if (resolvedType == null) {
|
|
1244142
|
-
|
|
1244143
|
-
|
|
1244160
|
+
if (isRawProtobufSourceSchema(source)) {
|
|
1244161
|
+
throw new Error(`Cannot resolve source ${source.proto} from file ${file.relativeFilepath}`);
|
|
1244162
|
+
}
|
|
1244163
|
+
this.context.logger.warn(`Cannot resolve source ${source.openapi} from file ${file.relativeFilepath}`);
|
|
1244144
1244164
|
}
|
|
1244145
1244165
|
return resolvedType;
|
|
1244146
1244166
|
}
|
|
@@ -1244432,7 +1244452,7 @@ function getAudienceForEnvironment(environmentId, rawEnvironments) {
|
|
|
1244432
1244452
|
}
|
|
1244433
1244453
|
|
|
1244434
1244454
|
// ../generation/ir-generator/lib/generateIntermediateRepresentation.js
|
|
1244435
|
-
async function generateIntermediateRepresentation({ fdrApiDefinitionId, workspace, generationLanguage, keywords: keywords2, smartCasing, disableExamples, audiences, readme, packageName, version: version3 }) {
|
|
1244455
|
+
async function generateIntermediateRepresentation({ fdrApiDefinitionId, workspace, generationLanguage, keywords: keywords2, smartCasing, disableExamples, audiences, readme, packageName, version: version3, context }) {
|
|
1244436
1244456
|
const casingsGenerator = constructCasingsGenerator({ generationLanguage, keywords: keywords2, smartCasing });
|
|
1244437
1244457
|
const irGraph = new IrGraph(audiences);
|
|
1244438
1244458
|
const rootApiFileContext = constructRootApiFileContext({
|
|
@@ -1244452,7 +1244472,7 @@ async function generateIntermediateRepresentation({ fdrApiDefinitionId, workspac
|
|
|
1244452
1244472
|
const errorResolver = new ErrorResolverImpl(workspace);
|
|
1244453
1244473
|
const exampleResolver = new ExampleResolverImpl(typeResolver);
|
|
1244454
1244474
|
const variableResolver = new VariableResolverImpl();
|
|
1244455
|
-
const sourceResolver = new SourceResolverImpl(workspace);
|
|
1244475
|
+
const sourceResolver = new SourceResolverImpl(context, workspace);
|
|
1244456
1244476
|
const intermediateRepresentation = {
|
|
1244457
1244477
|
fdrApiDefinitionId,
|
|
1244458
1244478
|
apiVersion: await convertApiVersionScheme({
|
|
@@ -1246911,7 +1246931,8 @@ async function registerApi({ organization, workspace, context, token, audiences,
|
|
|
1246911
1246931
|
disableExamples: false,
|
|
1246912
1246932
|
readme: void 0,
|
|
1246913
1246933
|
version: void 0,
|
|
1246914
|
-
packageName: void 0
|
|
1246934
|
+
packageName: void 0,
|
|
1246935
|
+
context
|
|
1246915
1246936
|
});
|
|
1246916
1246937
|
const fdrService = createFdrService({
|
|
1246917
1246938
|
token: token.value
|
|
@@ -1247278,7 +1247299,8 @@ var DocsDefinitionResolver = class {
|
|
|
1247278
1247299
|
disableExamples: false,
|
|
1247279
1247300
|
readme: void 0,
|
|
1247280
1247301
|
version: void 0,
|
|
1247281
|
-
packageName: void 0
|
|
1247302
|
+
packageName: void 0,
|
|
1247303
|
+
context: this.taskContext
|
|
1247282
1247304
|
});
|
|
1247283
1247305
|
const apiDefinitionId = await this.registerApi({ ir, snippetsConfig });
|
|
1247284
1247306
|
const api = convertIrToApiDefinition(ir, apiDefinitionId);
|
|
@@ -1294862,7 +1294884,8 @@ async function generateIrForFernWorkspace({
|
|
|
1294862
1294884
|
audiences,
|
|
1294863
1294885
|
readme,
|
|
1294864
1294886
|
version: void 0,
|
|
1294865
|
-
packageName: void 0
|
|
1294887
|
+
packageName: void 0,
|
|
1294888
|
+
context
|
|
1294866
1294889
|
});
|
|
1294867
1294890
|
}
|
|
1294868
1294891
|
|
|
@@ -1305845,7 +1305868,8 @@ async function getIntermediateRepresentation2({ workspace, audiences, generatorI
|
|
|
1305845
1305868
|
disableExamples: generatorInvocation.disableExamples,
|
|
1305846
1305869
|
readme: generatorInvocation.readme,
|
|
1305847
1305870
|
version: version3,
|
|
1305848
|
-
packageName
|
|
1305871
|
+
packageName,
|
|
1305872
|
+
context
|
|
1305849
1305873
|
});
|
|
1305850
1305874
|
if (sourceConfig != null) {
|
|
1305851
1305875
|
intermediateRepresentation.sourceConfig = sourceConfig;
|
|
@@ -1305893,7 +1305917,9 @@ async function tryRunDocker({ docker, imageName, args, binds, removeAfterComplet
|
|
|
1305893
1305917
|
setImmediate(callback);
|
|
1305894
1305918
|
}
|
|
1305895
1305919
|
}), {
|
|
1305896
|
-
|
|
1305920
|
+
HostConfig: {
|
|
1305921
|
+
Binds: binds
|
|
1305922
|
+
},
|
|
1305897
1305923
|
User: "root"
|
|
1305898
1305924
|
});
|
|
1305899
1305925
|
if (removeAfterCompletion) {
|
|
@@ -1306267,6 +1306293,7 @@ var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
|
1306267
1306293
|
var import_axios6 = __toESM(require_axios4(), 1);
|
|
1306268
1306294
|
var import_form_data2 = __toESM(require_form_data(), 1);
|
|
1306269
1306295
|
var import_promises48 = require("fs/promises");
|
|
1306296
|
+
var import_path39 = require("path");
|
|
1306270
1306297
|
var import_tar2 = __toESM(require_tar(), 1);
|
|
1306271
1306298
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
1306272
1306299
|
async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version3, context, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview }) {
|
|
@@ -1306315,6 +1306342,18 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1306315
1306342
|
});
|
|
1306316
1306343
|
const absolutePathToFernConfigJson = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(PROJECT_CONFIG_FILENAME));
|
|
1306317
1306344
|
await (0, import_promises48.writeFile)(absolutePathToFernConfigJson, JSON.stringify(projectConfig.rawConfig, void 0, 2));
|
|
1306345
|
+
try {
|
|
1306346
|
+
const sources = workspace.getSources();
|
|
1306347
|
+
for (const source of sources) {
|
|
1306348
|
+
const sourceContents = await (0, import_promises48.readFile)(source.absoluteFilePath);
|
|
1306349
|
+
const relativeLocation = (0, import_path39.relative)(workspace.absoluteFilepath, source.absoluteFilePath);
|
|
1306350
|
+
const absolutePathToSourceFile = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(relativeLocation));
|
|
1306351
|
+
await (0, import_promises48.mkdir)(dirname(absolutePathToSourceFile), { recursive: true });
|
|
1306352
|
+
await (0, import_promises48.writeFile)(absolutePathToSourceFile, sourceContents);
|
|
1306353
|
+
}
|
|
1306354
|
+
} catch (error) {
|
|
1306355
|
+
context.logger.debug(`Failed to write source files to disk, continuing: ${error}`);
|
|
1306356
|
+
}
|
|
1306318
1306357
|
const tarPath = join(absolutePathToTmpDir, RelativeFilePath.of("definition.tgz"));
|
|
1306319
1306358
|
await import_tar2.default.create({ file: tarPath, cwd: absolutePathToTmpFernDirectory }, ["."]);
|
|
1306320
1306359
|
context.logger.debug("Getting upload URL for Fern definition.");
|
|
@@ -1306519,7 +1306558,7 @@ var import_axios7 = __toESM(require_axios4(), 1);
|
|
|
1306519
1306558
|
var import_decompress3 = __toESM(require_decompress(), 1);
|
|
1306520
1306559
|
var import_fs9 = require("fs");
|
|
1306521
1306560
|
var import_promises49 = require("fs/promises");
|
|
1306522
|
-
var
|
|
1306561
|
+
var import_path40 = __toESM(require("path"), 1);
|
|
1306523
1306562
|
var import_promises50 = require("stream/promises");
|
|
1306524
1306563
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
1306525
1306564
|
var _isFinished, _createdSnippets, _snippetsS3PreSignedReadUrl;
|
|
@@ -1306604,7 +1306643,7 @@ var RemoteTaskHandler = class {
|
|
|
1306604
1306643
|
} : void 0;
|
|
1306605
1306644
|
}
|
|
1306606
1306645
|
getAbsolutePathToLocalOutput() {
|
|
1306607
|
-
return this.absolutePathToPreview != null ? join(this.absolutePathToPreview, RelativeFilePath.of(
|
|
1306646
|
+
return this.absolutePathToPreview != null ? join(this.absolutePathToPreview, RelativeFilePath.of(import_path40.default.basename(this.generatorInvocation.name))) : this.generatorInvocation.absolutePathToLocalOutput;
|
|
1306608
1306647
|
}
|
|
1306609
1306648
|
get isFinished() {
|
|
1306610
1306649
|
return __privateGet(this, _isFinished);
|
|
@@ -1306635,7 +1306674,7 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1306635
1306674
|
responseType: "stream"
|
|
1306636
1306675
|
});
|
|
1306637
1306676
|
const tmpDir = await import_tmp_promise11.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1306638
|
-
const outputZipPath =
|
|
1306677
|
+
const outputZipPath = import_path40.default.join(tmpDir.path, "output.zip");
|
|
1306639
1306678
|
await (0, import_promises50.pipeline)(request.data, (0, import_fs9.createWriteStream)(outputZipPath));
|
|
1306640
1306679
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1306641
1306680
|
await (0, import_promises49.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
@@ -1306764,7 +1306803,8 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
1306764
1306803
|
audiences,
|
|
1306765
1306804
|
readme,
|
|
1306766
1306805
|
packageName,
|
|
1306767
|
-
version: version3 ?? await computeSemanticVersion({ fdr, packageName, generatorInvocation })
|
|
1306806
|
+
version: version3 ?? await computeSemanticVersion({ fdr, packageName, generatorInvocation }),
|
|
1306807
|
+
context: interactiveTaskContext
|
|
1306768
1306808
|
});
|
|
1306769
1306809
|
const sources = workspace.getSources();
|
|
1306770
1306810
|
const apiDefinition = convertIrToFdrApi({ ir, snippetsConfig: {} });
|
|
@@ -1307703,7 +1307743,8 @@ async function mockServer({
|
|
|
1307703
1307743
|
disableExamples: false,
|
|
1307704
1307744
|
readme: void 0,
|
|
1307705
1307745
|
version: void 0,
|
|
1307706
|
-
packageName: void 0
|
|
1307746
|
+
packageName: void 0,
|
|
1307747
|
+
context
|
|
1307707
1307748
|
});
|
|
1307708
1307749
|
const mockServer2 = new MockServer({
|
|
1307709
1307750
|
context,
|
|
@@ -1307719,7 +1307760,7 @@ async function mockServer({
|
|
|
1307719
1307760
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
1307720
1307761
|
var import_axios9 = __toESM(require_axios4(), 1);
|
|
1307721
1307762
|
var import_promises53 = require("fs/promises");
|
|
1307722
|
-
var
|
|
1307763
|
+
var import_path41 = __toESM(require("path"), 1);
|
|
1307723
1307764
|
var import_tar3 = __toESM(require_tar(), 1);
|
|
1307724
1307765
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
1307725
1307766
|
async function registerWorkspacesV1({
|
|
@@ -1307764,7 +1307805,7 @@ async function registerWorkspacesV1({
|
|
|
1307764
1307805
|
return;
|
|
1307765
1307806
|
}
|
|
1307766
1307807
|
const tmpDir = await import_tmp_promise13.default.dir();
|
|
1307767
|
-
const tarPath =
|
|
1307808
|
+
const tarPath = import_path41.default.join(tmpDir.path, "definition.tgz");
|
|
1307768
1307809
|
context.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
1307769
1307810
|
await import_tar3.default.create({ file: tarPath, cwd: resolvedWorkspace.absoluteFilepath }, ["."]);
|
|
1307770
1307811
|
context.logger.info("Uploading definition...");
|
|
@@ -1307834,7 +1307875,8 @@ async function testOutput({
|
|
|
1307834
1307875
|
disableExamples: false,
|
|
1307835
1307876
|
readme: void 0,
|
|
1307836
1307877
|
version: void 0,
|
|
1307837
|
-
packageName: void 0
|
|
1307878
|
+
packageName: void 0,
|
|
1307879
|
+
context
|
|
1307838
1307880
|
});
|
|
1307839
1307881
|
const mockServer2 = new MockServer({
|
|
1307840
1307882
|
context,
|
|
@@ -1310262,7 +1310304,7 @@ async function upgrade({
|
|
|
1310262
1310304
|
|
|
1310263
1310305
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
1310264
1310306
|
var import_promises77 = require("fs/promises");
|
|
1310265
|
-
var
|
|
1310307
|
+
var import_path42 = __toESM(require("path"), 1);
|
|
1310266
1310308
|
var semver3 = __toESM(require_semver2(), 1);
|
|
1310267
1310309
|
var import_yaml11 = __toESM(require_dist3(), 1);
|
|
1310268
1310310
|
async function loadAndUpdateGenerators({
|
|
@@ -1310286,7 +1310328,7 @@ async function loadAndUpdateGenerators({
|
|
|
1310286
1310328
|
return void 0;
|
|
1310287
1310329
|
}
|
|
1310288
1310330
|
if (!import_yaml11.default.isMap(generatorGroups)) {
|
|
1310289
|
-
context.failAndThrow(`Expected 'groups' to be a map in ${
|
|
1310331
|
+
context.failAndThrow(`Expected 'groups' to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`);
|
|
1310290
1310332
|
return void 0;
|
|
1310291
1310333
|
}
|
|
1310292
1310334
|
context.logger.debug(`Groups found: ${generatorGroups.toString()}`);
|
|
@@ -1310295,7 +1310337,7 @@ async function loadAndUpdateGenerators({
|
|
|
1310295
1310337
|
const group = groupBlock.value;
|
|
1310296
1310338
|
if (!import_yaml11.default.isMap(group)) {
|
|
1310297
1310339
|
context.failAndThrow(
|
|
1310298
|
-
`Expected group ${groupName} to be a map in ${
|
|
1310340
|
+
`Expected group ${groupName} to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310299
1310341
|
);
|
|
1310300
1310342
|
continue;
|
|
1310301
1310343
|
}
|
|
@@ -1310305,7 +1310347,7 @@ async function loadAndUpdateGenerators({
|
|
|
1310305
1310347
|
const generators = group.get("generators");
|
|
1310306
1310348
|
if (!import_yaml11.default.isSeq(generators)) {
|
|
1310307
1310349
|
context.failAndThrow(
|
|
1310308
|
-
`Expected group ${groupName} to have a 'generators' key in ${
|
|
1310350
|
+
`Expected group ${groupName} to have a 'generators' key in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310309
1310351
|
);
|
|
1310310
1310352
|
continue;
|
|
1310311
1310353
|
}
|
|
@@ -1310313,7 +1310355,7 @@ async function loadAndUpdateGenerators({
|
|
|
1310313
1310355
|
for (const generator of generators.items) {
|
|
1310314
1310356
|
if (!import_yaml11.default.isMap(generator)) {
|
|
1310315
1310357
|
context.failAndThrow(
|
|
1310316
|
-
`Expected generator in group ${groupName} to be a map in ${
|
|
1310358
|
+
`Expected generator in group ${groupName} to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310317
1310359
|
);
|
|
1310318
1310360
|
}
|
|
1310319
1310361
|
if (generatorFilter != null && generator.get("name") !== generatorFilter) {
|
|
@@ -1310408,7 +1310450,7 @@ async function validateWorkspaces({
|
|
|
1310408
1310450
|
|
|
1310409
1310451
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
1310410
1310452
|
var import_promises78 = require("fs/promises");
|
|
1310411
|
-
var
|
|
1310453
|
+
var import_path43 = __toESM(require("path"), 1);
|
|
1310412
1310454
|
async function writeDefinitionForWorkspaces({
|
|
1310413
1310455
|
project,
|
|
1310414
1310456
|
cliContext,
|
|
@@ -1310442,7 +1310484,7 @@ async function writeDefinitionForFernWorkspace({
|
|
|
1310442
1310484
|
absolutePathToOutputDirectory
|
|
1310443
1310485
|
});
|
|
1310444
1310486
|
context.logger.info(
|
|
1310445
|
-
source_default.green(`Wrote imported definition at ${
|
|
1310487
|
+
source_default.green(`Wrote imported definition at ${import_path43.default.relative(process.cwd(), absolutePathToOutputDirectory)}`)
|
|
1310446
1310488
|
);
|
|
1310447
1310489
|
}
|
|
1310448
1310490
|
}
|
|
@@ -1310461,7 +1310503,7 @@ async function writeDefinitionForOpenAPIWorkspace2({
|
|
|
1310461
1310503
|
absolutePathToOutputDirectory
|
|
1310462
1310504
|
});
|
|
1310463
1310505
|
context.logger.info(
|
|
1310464
|
-
source_default.green(`Wrote definition to ${
|
|
1310506
|
+
source_default.green(`Wrote definition to ${import_path43.default.relative(process.cwd(), absolutePathToOutputDirectory)}`)
|
|
1310465
1310507
|
);
|
|
1310466
1310508
|
}
|
|
1310467
1310509
|
async function writeFernDefinition2({
|