fern-api 0.31.3 → 0.31.4
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 +29 -23
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1101274,7 +1101274,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1101274
1101274
|
properties: {
|
|
1101275
1101275
|
...event,
|
|
1101276
1101276
|
...event.properties,
|
|
1101277
|
-
version: "0.31.
|
|
1101277
|
+
version: "0.31.4",
|
|
1101278
1101278
|
usingAccessToken: true
|
|
1101279
1101279
|
}
|
|
1101280
1101280
|
});
|
|
@@ -1101336,7 +1101336,7 @@ var UserPosthogManager = class {
|
|
|
1101336
1101336
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1101337
1101337
|
event: "CLI",
|
|
1101338
1101338
|
properties: {
|
|
1101339
|
-
version: "0.31.
|
|
1101339
|
+
version: "0.31.4",
|
|
1101340
1101340
|
...event,
|
|
1101341
1101341
|
...event.properties
|
|
1101342
1101342
|
}
|
|
@@ -1121975,8 +1121975,7 @@ var HeaderWithCount = class {
|
|
|
1121975
1121975
|
var GLOBAL_HEADER_PERCENTAGE_THRESHOLD = 0.75;
|
|
1121976
1121976
|
var HEADERS_TO_IGNORE = new Set(...["Authorization"]);
|
|
1121977
1121977
|
function buildGlobalHeaders(context) {
|
|
1121978
|
-
|
|
1121979
|
-
const predefinedGlobalHeaders = new Map((_a5 = context.ir.globalHeaders) == null ? void 0 : _a5.map((header) => [header.header, header]));
|
|
1121978
|
+
const predefinedGlobalHeaders = Object.fromEntries((context.ir.globalHeaders ?? []).map((header) => [header.header, header]));
|
|
1121980
1121979
|
const globalHeaders = {};
|
|
1121981
1121980
|
for (const endpoint of context.ir.endpoints) {
|
|
1121982
1121981
|
for (const header of endpoint.headers) {
|
|
@@ -1121985,7 +1121984,7 @@ function buildGlobalHeaders(context) {
|
|
|
1121985
1121984
|
}
|
|
1121986
1121985
|
let headerWithCount = globalHeaders[header.name];
|
|
1121987
1121986
|
if (headerWithCount == null) {
|
|
1121988
|
-
const predefinedHeader = predefinedGlobalHeaders
|
|
1121987
|
+
const predefinedHeader = predefinedGlobalHeaders[header.name];
|
|
1121989
1121988
|
const convertedHeader = buildHeader({
|
|
1121990
1121989
|
header: {
|
|
1121991
1121990
|
...header,
|
|
@@ -1122002,25 +1122001,32 @@ function buildGlobalHeaders(context) {
|
|
|
1122002
1122001
|
}
|
|
1122003
1122002
|
}
|
|
1122004
1122003
|
const globalHeaderThreshold = context.ir.endpoints.length * GLOBAL_HEADER_PERCENTAGE_THRESHOLD;
|
|
1122004
|
+
for (const [headerName, header] of Object.entries(predefinedGlobalHeaders)) {
|
|
1122005
|
+
let schema2 = "optional<string>";
|
|
1122006
|
+
if (header.name == null && header.env == null && typeof header.schema === "string") {
|
|
1122007
|
+
schema2 = header.schema;
|
|
1122008
|
+
} else if (header != null) {
|
|
1122009
|
+
schema2 = {
|
|
1122010
|
+
name: header.name,
|
|
1122011
|
+
env: header.env,
|
|
1122012
|
+
type: header.schema != null ? getTypeFromTypeReference(buildTypeReference({
|
|
1122013
|
+
schema: header.schema,
|
|
1122014
|
+
context,
|
|
1122015
|
+
fileContainingReference: RelativeFilePath.of("api.yml")
|
|
1122016
|
+
})) ?? "optional<string>" : "optional<string>"
|
|
1122017
|
+
};
|
|
1122018
|
+
}
|
|
1122019
|
+
context.builder.addGlobalHeader({
|
|
1122020
|
+
name: headerName,
|
|
1122021
|
+
schema: schema2
|
|
1122022
|
+
});
|
|
1122023
|
+
}
|
|
1122005
1122024
|
for (const [headerName, header] of Object.entries(globalHeaders)) {
|
|
1122006
|
-
const predefinedHeader = predefinedGlobalHeaders
|
|
1122007
|
-
|
|
1122025
|
+
const predefinedHeader = predefinedGlobalHeaders[headerName];
|
|
1122026
|
+
const isRequired = header.count === context.ir.endpoints.length;
|
|
1122008
1122027
|
const isOptional = header.count >= globalHeaderThreshold;
|
|
1122009
1122028
|
if (predefinedHeader != null) {
|
|
1122010
|
-
|
|
1122011
|
-
let schema2;
|
|
1122012
|
-
if (typeof header.schema === "string") {
|
|
1122013
|
-
schema2 = header.schema;
|
|
1122014
|
-
} else {
|
|
1122015
|
-
schema2 = {
|
|
1122016
|
-
...header.schema,
|
|
1122017
|
-
env: predefinedHeader.env ?? header.schema.env
|
|
1122018
|
-
};
|
|
1122019
|
-
}
|
|
1122020
|
-
context.builder.addGlobalHeader({
|
|
1122021
|
-
name: headerName,
|
|
1122022
|
-
schema: isRequired ? schema2 : wrapTypeReferenceAsOptional(schema2)
|
|
1122023
|
-
});
|
|
1122029
|
+
continue;
|
|
1122024
1122030
|
} else if (isRequired) {
|
|
1122025
1122031
|
context.builder.addGlobalHeader({
|
|
1122026
1122032
|
name: headerName,
|
|
@@ -1127336,10 +1127342,10 @@ var CliContext = class {
|
|
|
1127336
1127342
|
return "fern-api";
|
|
1127337
1127343
|
}
|
|
1127338
1127344
|
getPackageVersion() {
|
|
1127339
|
-
if ("0.31.
|
|
1127345
|
+
if ("0.31.4" == null) {
|
|
1127340
1127346
|
this.logger.error("CLI_VERSION is not defined");
|
|
1127341
1127347
|
}
|
|
1127342
|
-
return "0.31.
|
|
1127348
|
+
return "0.31.4";
|
|
1127343
1127349
|
}
|
|
1127344
1127350
|
getCliName() {
|
|
1127345
1127351
|
if ("fern" == null) {
|