fern-api 0.37.15 → 0.37.16
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 +116 -54
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1214480,7 +1214480,8 @@ var import_path11 = __toESM(require("path"));
|
|
|
1214480
1214480
|
var APIDefinitionPathSchema = z.string().describe("Path to the OpenAPI, AsyncAPI or Fern Definition");
|
|
1214481
1214481
|
var APIDefinitionSettingsSchema = z.object({
|
|
1214482
1214482
|
"use-title": z.optional(z.boolean()).describe("Whether to use the titles of the schemas within an OpenAPI definition as the names of the types within Fern. Defaults to true."),
|
|
1214483
|
-
unions: z.optional(z.enum(["v1"])).describe("What version of union generation to use, this will grow over time. Defaults to v0.")
|
|
1214483
|
+
unions: z.optional(z.enum(["v1"])).describe("What version of union generation to use, this will grow over time. Defaults to v0."),
|
|
1214484
|
+
"message-naming": z.optional(z.enum(["v1", "v2"])).describe("What version of message naming to use for AsyncAPI messages, this will grow over time. Defaults to v1.")
|
|
1214484
1214485
|
});
|
|
1214485
1214486
|
var APIDefintionWithOverridesSchema = z.object({
|
|
1214486
1214487
|
path: APIDefinitionPathSchema,
|
|
@@ -1214779,7 +1214780,7 @@ async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfigur
|
|
|
1214779
1214780
|
};
|
|
1214780
1214781
|
}
|
|
1214781
1214782
|
async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
1214782
|
-
var _a6, _b4, _c4, _d2, _e, _f;
|
|
1214783
|
+
var _a6, _b4, _c4, _d2, _e, _f, _g, _h;
|
|
1214783
1214784
|
const apiConfiguration = rawGeneratorsConfiguration.api;
|
|
1214784
1214785
|
const apiDefinitions = [];
|
|
1214785
1214786
|
if (apiConfiguration != null) {
|
|
@@ -1214792,7 +1214793,11 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214792
1214793
|
origin: void 0,
|
|
1214793
1214794
|
overrides: void 0,
|
|
1214794
1214795
|
audiences: [],
|
|
1214795
|
-
settings: {
|
|
1214796
|
+
settings: {
|
|
1214797
|
+
shouldUseTitleAsName: void 0,
|
|
1214798
|
+
shouldUseUndiscriminatedUnionsWithLiterals: void 0,
|
|
1214799
|
+
asyncApiMessageNaming: void 0
|
|
1214800
|
+
}
|
|
1214796
1214801
|
});
|
|
1214797
1214802
|
} else if (isRawProtobufAPIDefinitionSchema(apiConfiguration)) {
|
|
1214798
1214803
|
apiDefinitions.push({
|
|
@@ -1214805,7 +1214810,11 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214805
1214810
|
origin: void 0,
|
|
1214806
1214811
|
overrides: apiConfiguration.proto.overrides,
|
|
1214807
1214812
|
audiences: [],
|
|
1214808
|
-
settings: {
|
|
1214813
|
+
settings: {
|
|
1214814
|
+
shouldUseTitleAsName: void 0,
|
|
1214815
|
+
shouldUseUndiscriminatedUnionsWithLiterals: void 0,
|
|
1214816
|
+
asyncApiMessageNaming: void 0
|
|
1214817
|
+
}
|
|
1214809
1214818
|
});
|
|
1214810
1214819
|
} else if (Array.isArray(apiConfiguration)) {
|
|
1214811
1214820
|
for (const definition3 of apiConfiguration) {
|
|
@@ -1214820,7 +1214829,8 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214820
1214829
|
audiences: [],
|
|
1214821
1214830
|
settings: {
|
|
1214822
1214831
|
shouldUseTitleAsName: void 0,
|
|
1214823
|
-
shouldUseUndiscriminatedUnionsWithLiterals: void 0
|
|
1214832
|
+
shouldUseUndiscriminatedUnionsWithLiterals: void 0,
|
|
1214833
|
+
asyncApiMessageNaming: void 0
|
|
1214824
1214834
|
}
|
|
1214825
1214835
|
});
|
|
1214826
1214836
|
} else if (isRawProtobufAPIDefinitionSchema(definition3)) {
|
|
@@ -1214836,7 +1214846,8 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214836
1214846
|
audiences: [],
|
|
1214837
1214847
|
settings: {
|
|
1214838
1214848
|
shouldUseTitleAsName: void 0,
|
|
1214839
|
-
shouldUseUndiscriminatedUnionsWithLiterals: void 0
|
|
1214849
|
+
shouldUseUndiscriminatedUnionsWithLiterals: void 0,
|
|
1214850
|
+
asyncApiMessageNaming: void 0
|
|
1214840
1214851
|
}
|
|
1214841
1214852
|
});
|
|
1214842
1214853
|
} else {
|
|
@@ -1214850,7 +1214861,8 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214850
1214861
|
audiences: definition3.audiences,
|
|
1214851
1214862
|
settings: {
|
|
1214852
1214863
|
shouldUseTitleAsName: (_a6 = definition3.settings) == null ? void 0 : _a6["use-title"],
|
|
1214853
|
-
shouldUseUndiscriminatedUnionsWithLiterals: ((_b4 = definition3.settings) == null ? void 0 : _b4.unions) === "v1"
|
|
1214864
|
+
shouldUseUndiscriminatedUnionsWithLiterals: ((_b4 = definition3.settings) == null ? void 0 : _b4.unions) === "v1",
|
|
1214865
|
+
asyncApiMessageNaming: (_c4 = definition3.settings) == null ? void 0 : _c4["message-naming"]
|
|
1214854
1214866
|
}
|
|
1214855
1214867
|
});
|
|
1214856
1214868
|
}
|
|
@@ -1214865,8 +1214877,9 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214865
1214877
|
overrides: apiConfiguration.overrides,
|
|
1214866
1214878
|
audiences: apiConfiguration.audiences,
|
|
1214867
1214879
|
settings: {
|
|
1214868
|
-
shouldUseTitleAsName: (
|
|
1214869
|
-
shouldUseUndiscriminatedUnionsWithLiterals: ((
|
|
1214880
|
+
shouldUseTitleAsName: (_d2 = apiConfiguration.settings) == null ? void 0 : _d2["use-title"],
|
|
1214881
|
+
shouldUseUndiscriminatedUnionsWithLiterals: ((_e = apiConfiguration.settings) == null ? void 0 : _e.unions) === "v1",
|
|
1214882
|
+
asyncApiMessageNaming: (_f = apiConfiguration.settings) == null ? void 0 : _f["message-naming"]
|
|
1214870
1214883
|
}
|
|
1214871
1214884
|
});
|
|
1214872
1214885
|
}
|
|
@@ -1214887,7 +1214900,8 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214887
1214900
|
audiences: [],
|
|
1214888
1214901
|
settings: {
|
|
1214889
1214902
|
shouldUseTitleAsName: settings == null ? void 0 : settings["use-title"],
|
|
1214890
|
-
shouldUseUndiscriminatedUnionsWithLiterals: (settings == null ? void 0 : settings.unions) === "v1"
|
|
1214903
|
+
shouldUseUndiscriminatedUnionsWithLiterals: (settings == null ? void 0 : settings.unions) === "v1",
|
|
1214904
|
+
asyncApiMessageNaming: void 0
|
|
1214891
1214905
|
}
|
|
1214892
1214906
|
});
|
|
1214893
1214907
|
} else if (openapi != null) {
|
|
@@ -1214900,8 +1214914,9 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214900
1214914
|
overrides: openapi.overrides,
|
|
1214901
1214915
|
audiences: [],
|
|
1214902
1214916
|
settings: {
|
|
1214903
|
-
shouldUseTitleAsName: (
|
|
1214904
|
-
shouldUseUndiscriminatedUnionsWithLiterals: ((
|
|
1214917
|
+
shouldUseTitleAsName: (_g = openapi.settings) == null ? void 0 : _g["use-title"],
|
|
1214918
|
+
shouldUseUndiscriminatedUnionsWithLiterals: ((_h = openapi.settings) == null ? void 0 : _h.unions) === "v1",
|
|
1214919
|
+
asyncApiMessageNaming: void 0
|
|
1214905
1214920
|
}
|
|
1214906
1214921
|
});
|
|
1214907
1214922
|
}
|
|
@@ -1214916,7 +1214931,8 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
|
|
|
1214916
1214931
|
audiences: [],
|
|
1214917
1214932
|
settings: {
|
|
1214918
1214933
|
shouldUseTitleAsName: settings == null ? void 0 : settings["use-title"],
|
|
1214919
|
-
shouldUseUndiscriminatedUnionsWithLiterals: (settings == null ? void 0 : settings.unions) === "v1"
|
|
1214934
|
+
shouldUseUndiscriminatedUnionsWithLiterals: (settings == null ? void 0 : settings.unions) === "v1",
|
|
1214935
|
+
asyncApiMessageNaming: settings == null ? void 0 : settings["message-naming"]
|
|
1214920
1214936
|
}
|
|
1214921
1214937
|
});
|
|
1214922
1214938
|
}
|
|
@@ -1217702,7 +1217718,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1217702
1217718
|
properties: {
|
|
1217703
1217719
|
...event,
|
|
1217704
1217720
|
...event.properties,
|
|
1217705
|
-
version: "0.37.
|
|
1217721
|
+
version: "0.37.16",
|
|
1217706
1217722
|
usingAccessToken: true
|
|
1217707
1217723
|
}
|
|
1217708
1217724
|
});
|
|
@@ -1217764,7 +1217780,7 @@ var UserPosthogManager = class {
|
|
|
1217764
1217780
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1217765
1217781
|
event: "CLI",
|
|
1217766
1217782
|
properties: {
|
|
1217767
|
-
version: "0.37.
|
|
1217783
|
+
version: "0.37.16",
|
|
1217768
1217784
|
...event,
|
|
1217769
1217785
|
...event.properties
|
|
1217770
1217786
|
}
|
|
@@ -1217798,7 +1217814,8 @@ async function getPosthogManager() {
|
|
|
1217798
1217814
|
async function createPosthogManager() {
|
|
1217799
1217815
|
try {
|
|
1217800
1217816
|
const posthogApiKey = "phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal\n";
|
|
1217801
|
-
|
|
1217817
|
+
const disableTelemetry = process.env.FERN_DISABLE_TELEMETRY === "true";
|
|
1217818
|
+
if (posthogApiKey == null || disableTelemetry) {
|
|
1217802
1217819
|
return new NoopPosthogManager();
|
|
1217803
1217820
|
}
|
|
1217804
1217821
|
const userToken = await getUserToken();
|
|
@@ -1233546,6 +1233563,11 @@ function buildPathParameter({ pathParameter, context, fileContainingReference })
|
|
|
1233546
1233563
|
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/parse.js
|
|
1233547
1233564
|
var import_promises29 = require("fs/promises");
|
|
1233548
1233565
|
|
|
1233566
|
+
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/asyncapi/options.js
|
|
1233567
|
+
var DEFAULT_PARSE_ASYNCAPI_SETTINGS = {
|
|
1233568
|
+
naming: "v1"
|
|
1233569
|
+
};
|
|
1233570
|
+
|
|
1233549
1233571
|
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/getExtension.js
|
|
1233550
1233572
|
function getExtension(object4, extension3) {
|
|
1233551
1233573
|
const extensions2 = Array.isArray(extension3) ? extension3 : [extension3];
|
|
@@ -1235130,8 +1235152,8 @@ function getAllProperties({ schema: schema2, context, breadcrumbs }) {
|
|
|
1235130
1235152
|
}
|
|
1235131
1235153
|
|
|
1235132
1235154
|
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/schema/convertUndiscriminatedOneOf.js
|
|
1235133
|
-
function convertUndiscriminatedOneOf({ nameOverride, generatedName, breadcrumbs, description, availability, wrapAsNullable, context, subtypes, groupName }) {
|
|
1235134
|
-
const
|
|
1235155
|
+
function convertUndiscriminatedOneOf({ nameOverride, generatedName, breadcrumbs, description, availability, wrapAsNullable, context, subtypes, groupName, subtypePrefixOverrides }) {
|
|
1235156
|
+
const derivedSubtypePrefixes = getUniqueSubTypeNames({ schemas: subtypes });
|
|
1235135
1235157
|
const convertedSubtypes = subtypes.flatMap((schema2, index2) => {
|
|
1235136
1235158
|
if (!isReferenceObject(schema2) && schema2.enum != null) {
|
|
1235137
1235159
|
return schema2.enum.map((enumValue) => {
|
|
@@ -1235145,7 +1235167,14 @@ function convertUndiscriminatedOneOf({ nameOverride, generatedName, breadcrumbs,
|
|
|
1235145
1235167
|
});
|
|
1235146
1235168
|
});
|
|
1235147
1235169
|
}
|
|
1235148
|
-
|
|
1235170
|
+
let subtypePrefix = derivedSubtypePrefixes[index2];
|
|
1235171
|
+
if (subtypePrefixOverrides != null) {
|
|
1235172
|
+
const override = subtypePrefixOverrides[index2];
|
|
1235173
|
+
if (override != null && "name" in override) {
|
|
1235174
|
+
subtypePrefix = override.name;
|
|
1235175
|
+
}
|
|
1235176
|
+
}
|
|
1235177
|
+
return [convertSchema(schema2, false, context, [...breadcrumbs, subtypePrefix ?? `${index2}`])];
|
|
1235149
1235178
|
});
|
|
1235150
1235179
|
const uniqueSubtypes = [];
|
|
1235151
1235180
|
for (let i2 = 0; i2 < convertedSubtypes.length; ++i2) {
|
|
@@ -1237903,12 +1237932,12 @@ function getFernExamples(channel) {
|
|
|
1237903
1237932
|
}
|
|
1237904
1237933
|
|
|
1237905
1237934
|
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/asyncapi/parse.js
|
|
1237906
|
-
function parseAsyncAPI({ document: document4, taskContext, options: options2 }) {
|
|
1237935
|
+
function parseAsyncAPI({ document: document4, taskContext, options: options2, asyncApiOptions }) {
|
|
1237907
1237936
|
var _a6, _b4, _c4, _d2;
|
|
1237908
1237937
|
const breadcrumbs = [];
|
|
1237909
1237938
|
if (((_a6 = document4.tags) == null ? void 0 : _a6[0]) != null) {
|
|
1237910
1237939
|
breadcrumbs.push(document4.tags[0].name);
|
|
1237911
|
-
} else {
|
|
1237940
|
+
} else if (asyncApiOptions.naming !== "v2") {
|
|
1237912
1237941
|
breadcrumbs.push("websocket");
|
|
1237913
1237942
|
}
|
|
1237914
1237943
|
const context = new AsyncAPIV2ParserContext({
|
|
@@ -1237989,7 +1238018,9 @@ function parseAsyncAPI({ document: document4, taskContext, options: options2 })
|
|
|
1237989
1238018
|
generatedName: channel.publish.operationId ?? "PublishEvent",
|
|
1237990
1238019
|
event: channel.publish,
|
|
1237991
1238020
|
breadcrumbs,
|
|
1237992
|
-
context
|
|
1238021
|
+
context,
|
|
1238022
|
+
options: options2,
|
|
1238023
|
+
asyncApiOptions
|
|
1237993
1238024
|
});
|
|
1237994
1238025
|
}
|
|
1237995
1238026
|
let subscribeSchema = void 0;
|
|
@@ -1237998,7 +1238029,9 @@ function parseAsyncAPI({ document: document4, taskContext, options: options2 })
|
|
|
1237998
1238029
|
generatedName: channel.subscribe.operationId ?? "SubscribeEvent",
|
|
1237999
1238030
|
event: channel.subscribe,
|
|
1238000
1238031
|
breadcrumbs,
|
|
1238001
|
-
context
|
|
1238032
|
+
context,
|
|
1238033
|
+
options: options2,
|
|
1238034
|
+
asyncApiOptions
|
|
1238002
1238035
|
});
|
|
1238003
1238036
|
}
|
|
1238004
1238037
|
if (headers.length > 0 || queryParameters.length > 0 || publishSchema != null || subscribeSchema != null) {
|
|
@@ -1238068,16 +1238101,29 @@ function parseAsyncAPI({ document: document4, taskContext, options: options2 })
|
|
|
1238068
1238101
|
basePath: getExtension(document4, FernAsyncAPIExtension.BASE_PATH)
|
|
1238069
1238102
|
};
|
|
1238070
1238103
|
}
|
|
1238071
|
-
function convertMessageToSchema({ generatedName, event, context, breadcrumbs }) {
|
|
1238104
|
+
function convertMessageToSchema({ generatedName, event, context, breadcrumbs, options: options2, asyncApiOptions }) {
|
|
1238072
1238105
|
if (event.message.oneOf != null) {
|
|
1238073
1238106
|
const subtypes = [];
|
|
1238107
|
+
const prefixes = [];
|
|
1238074
1238108
|
for (const schema2 of event.message.oneOf) {
|
|
1238075
1238109
|
let resolvedSchema;
|
|
1238110
|
+
let namePrefix = { type: "notFound" };
|
|
1238076
1238111
|
if (isReferenceObject(schema2)) {
|
|
1238077
|
-
|
|
1238112
|
+
const resolvedMessage = context.resolveMessageReference(schema2);
|
|
1238113
|
+
if (!isReferenceObject(resolvedMessage.payload) && asyncApiOptions.naming === "v2") {
|
|
1238114
|
+
namePrefix = resolvedMessage.name ? { type: "name", name: resolvedMessage.name } : namePrefix;
|
|
1238115
|
+
resolvedSchema = {
|
|
1238116
|
+
...resolvedMessage.payload,
|
|
1238117
|
+
title: resolvedMessage.name ?? resolvedMessage.payload.title,
|
|
1238118
|
+
description: resolvedMessage.name ?? resolvedMessage.payload.description
|
|
1238119
|
+
};
|
|
1238120
|
+
} else {
|
|
1238121
|
+
resolvedSchema = resolvedMessage.payload;
|
|
1238122
|
+
}
|
|
1238078
1238123
|
} else {
|
|
1238079
1238124
|
resolvedSchema = schema2;
|
|
1238080
1238125
|
}
|
|
1238126
|
+
prefixes.push(namePrefix);
|
|
1238081
1238127
|
subtypes.push(resolvedSchema);
|
|
1238082
1238128
|
}
|
|
1238083
1238129
|
return convertUndiscriminatedOneOf({
|
|
@@ -1238089,7 +1238135,8 @@ function convertMessageToSchema({ generatedName, event, context, breadcrumbs })
|
|
|
1238089
1238135
|
groupName: void 0,
|
|
1238090
1238136
|
wrapAsNullable: false,
|
|
1238091
1238137
|
breadcrumbs,
|
|
1238092
|
-
context
|
|
1238138
|
+
context,
|
|
1238139
|
+
subtypePrefixOverrides: asyncApiOptions.naming === "v2" ? prefixes : []
|
|
1238093
1238140
|
});
|
|
1238094
1238141
|
}
|
|
1238095
1238142
|
return void 0;
|
|
@@ -1240487,7 +1240534,8 @@ async function parse4({ specs, taskContext, optionOverrides }) {
|
|
|
1240487
1240534
|
const parsedAsyncAPI = parseAsyncAPI({
|
|
1240488
1240535
|
document: asyncAPI,
|
|
1240489
1240536
|
taskContext,
|
|
1240490
|
-
options: getParseOptions({ specSettings: spec.settings })
|
|
1240537
|
+
options: getParseOptions({ specSettings: spec.settings }),
|
|
1240538
|
+
asyncApiOptions: getParseAsyncOptions({ specSettings: spec.settings })
|
|
1240491
1240539
|
});
|
|
1240492
1240540
|
if (parsedAsyncAPI.channel != null) {
|
|
1240493
1240541
|
ir.channel.push(parsedAsyncAPI.channel);
|
|
@@ -1240515,6 +1240563,11 @@ function getParseOptions({ specSettings, overrides }) {
|
|
|
1240515
1240563
|
audiences: (overrides == null ? void 0 : overrides.audiences) ?? (specSettings == null ? void 0 : specSettings.audiences) ?? DEFAULT_PARSE_OPENAPI_SETTINGS.audiences
|
|
1240516
1240564
|
};
|
|
1240517
1240565
|
}
|
|
1240566
|
+
function getParseAsyncOptions({ specSettings, overrides }) {
|
|
1240567
|
+
return {
|
|
1240568
|
+
naming: (overrides == null ? void 0 : overrides.naming) ?? (specSettings == null ? void 0 : specSettings.asyncApiNaming) ?? DEFAULT_PARSE_ASYNCAPI_SETTINGS.naming
|
|
1240569
|
+
};
|
|
1240570
|
+
}
|
|
1240518
1240571
|
function merge3(ir1, ir2) {
|
|
1240519
1240572
|
return {
|
|
1240520
1240573
|
apiVersion: ir1.apiVersion ?? ir2.apiVersion,
|
|
@@ -1242913,7 +1242966,7 @@ function mapValues2(items, mapper) {
|
|
|
1242913
1242966
|
|
|
1242914
1242967
|
// pnp:/home/runner/work/fern/fern/packages/cli/workspace-loader/lib/loadAPIWorkspace.js
|
|
1242915
1242968
|
async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion, workspaceName }) {
|
|
1242916
|
-
var _a6, _b4, _c4, _d2;
|
|
1242969
|
+
var _a6, _b4, _c4, _d2, _e;
|
|
1242917
1242970
|
const generatorsConfiguration = await generators_yml_exports.loadGeneratorsConfiguration({
|
|
1242918
1242971
|
absolutePathToWorkspace,
|
|
1242919
1242972
|
context
|
|
@@ -1242996,7 +1243049,8 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion,
|
|
|
1242996
1243049
|
settings: {
|
|
1242997
1243050
|
audiences: definition3.audiences ?? [],
|
|
1242998
1243051
|
shouldUseTitleAsName: ((_c4 = definition3.settings) == null ? void 0 : _c4.shouldUseTitleAsName) ?? true,
|
|
1242999
|
-
shouldUseUndiscriminatedUnionsWithLiterals: ((_d2 = definition3.settings) == null ? void 0 : _d2.shouldUseUndiscriminatedUnionsWithLiterals) ?? false
|
|
1243052
|
+
shouldUseUndiscriminatedUnionsWithLiterals: ((_d2 = definition3.settings) == null ? void 0 : _d2.shouldUseUndiscriminatedUnionsWithLiterals) ?? false,
|
|
1243053
|
+
asyncApiNaming: (_e = definition3.settings) == null ? void 0 : _e.asyncApiMessageNaming
|
|
1243000
1243054
|
}
|
|
1243001
1243055
|
});
|
|
1243002
1243056
|
}
|
|
@@ -1247161,10 +1247215,10 @@ var CliContext = class {
|
|
|
1247161
1247215
|
return "fern-api";
|
|
1247162
1247216
|
}
|
|
1247163
1247217
|
getPackageVersion() {
|
|
1247164
|
-
if ("0.37.
|
|
1247218
|
+
if ("0.37.16" == null) {
|
|
1247165
1247219
|
this.logger.error("CLI_VERSION is not defined");
|
|
1247166
1247220
|
}
|
|
1247167
|
-
return "0.37.
|
|
1247221
|
+
return "0.37.16";
|
|
1247168
1247222
|
}
|
|
1247169
1247223
|
getCliName() {
|
|
1247170
1247224
|
if ("fern" == null) {
|
|
@@ -1255166,7 +1255220,7 @@ var _ApiDefinitionHolder2 = class {
|
|
|
1255166
1255220
|
static getSubpackageId(pkg2) {
|
|
1255167
1255221
|
return isSubpackage2(pkg2) ? pkg2.subpackageId : ROOT_PACKAGE_ID2;
|
|
1255168
1255222
|
}
|
|
1255169
|
-
|
|
1255223
|
+
getSubpackageByIdOrLocator(subpackageId) {
|
|
1255170
1255224
|
if (subpackageId == null) {
|
|
1255171
1255225
|
return void 0;
|
|
1255172
1255226
|
} else if (subpackageId === ROOT_PACKAGE_ID2) {
|
|
@@ -1255665,7 +1255719,7 @@ _convertPackage = new WeakSet();
|
|
|
1255665
1255719
|
convertPackage_fn = function(pkg2, parentSlug, idgen) {
|
|
1255666
1255720
|
const overviewPageId = pkg2.overviewAbsolutePath != null ? navigation_exports2.PageId(this.toRelativeFilepath(pkg2.overviewAbsolutePath)) : void 0;
|
|
1255667
1255721
|
const maybeFullSlug = pkg2.overviewAbsolutePath != null ? this.markdownFilesToFullSlugs.get(pkg2.overviewAbsolutePath) : void 0;
|
|
1255668
|
-
const subpackage = __privateGet(this, _holder2).
|
|
1255722
|
+
const subpackage = __privateGet(this, _holder2).getSubpackageByIdOrLocator(pkg2.package);
|
|
1255669
1255723
|
if (subpackage != null) {
|
|
1255670
1255724
|
const subpackageId = ApiDefinitionHolder2.getSubpackageId(subpackage);
|
|
1255671
1255725
|
const subpackageNodeId = idgen.append(subpackageId);
|
|
@@ -1255725,16 +1255779,17 @@ convertSection_fn = function(section, parentSlug, idgen) {
|
|
|
1255725
1255779
|
const overviewPageId = section.overviewAbsolutePath != null ? navigation_exports2.PageId(this.toRelativeFilepath(section.overviewAbsolutePath)) : void 0;
|
|
1255726
1255780
|
const maybeFullSlug = section.overviewAbsolutePath != null ? this.markdownFilesToFullSlugs.get(section.overviewAbsolutePath) : void 0;
|
|
1255727
1255781
|
const nodeId = idgen.append(`section:${kebabCase_default2(section.title)}`);
|
|
1255728
|
-
const
|
|
1255729
|
-
const subpackage = __privateGet(this, _holder2).
|
|
1255730
|
-
|
|
1255782
|
+
const subpackageIds = section.referencedSubpackages.map((locator) => {
|
|
1255783
|
+
const subpackage = __privateGet(this, _holder2).getSubpackageByIdOrLocator(locator);
|
|
1255784
|
+
return subpackage != null ? ApiDefinitionHolder2.getSubpackageId(subpackage) : void 0;
|
|
1255785
|
+
}).filter((subpackageId) => {
|
|
1255786
|
+
if (subpackageId == null) {
|
|
1255731
1255787
|
this.taskContext.logger.error(`Subpackage ${subpackageId} not found in ${this.apiDefinitionId}`);
|
|
1255732
|
-
return false;
|
|
1255733
1255788
|
}
|
|
1255734
|
-
return
|
|
1255735
|
-
});
|
|
1255736
|
-
__privateGet(this, _nodeIdToSubpackageId).set(nodeId.get(),
|
|
1255737
|
-
|
|
1255789
|
+
return subpackageId != null;
|
|
1255790
|
+
}).filter(isNonNullish);
|
|
1255791
|
+
__privateGet(this, _nodeIdToSubpackageId).set(nodeId.get(), subpackageIds);
|
|
1255792
|
+
subpackageIds.forEach((subpackageId) => {
|
|
1255738
1255793
|
if (__privateGet(this, _visitedSubpackages2).has(subpackageId)) {
|
|
1255739
1255794
|
this.taskContext.logger.error(`Duplicate subpackage found in the API Reference layout: ${subpackageId}`);
|
|
1255740
1255795
|
}
|
|
@@ -1255765,7 +1255820,7 @@ convertSection_fn = function(section, parentSlug, idgen) {
|
|
|
1255765
1255820
|
_convertUnknownIdentifier = new WeakSet();
|
|
1255766
1255821
|
convertUnknownIdentifier_fn = function(unknownIdentifier, apiDefinitionPackageId, parentSlug, idgen) {
|
|
1255767
1255822
|
unknownIdentifier = unknownIdentifier.trim();
|
|
1255768
|
-
const subpackage = __privateGet(this, _holder2).
|
|
1255823
|
+
const subpackage = __privateGet(this, _holder2).getSubpackageByIdOrLocator(unknownIdentifier);
|
|
1255769
1255824
|
if (subpackage != null) {
|
|
1255770
1255825
|
const subpackageId = ApiDefinitionHolder2.getSubpackageId(subpackage);
|
|
1255771
1255826
|
const subpackageNodeId = idgen.append(subpackageId);
|
|
@@ -1255968,7 +1256023,7 @@ convertApiDefinitionPackage_fn = function(pkg2, parentSlug) {
|
|
|
1255968
1256023
|
if (__privateGet(this, _visitedSubpackages2).has(subpackageId)) {
|
|
1255969
1256024
|
return;
|
|
1255970
1256025
|
}
|
|
1255971
|
-
const subpackage = __privateGet(this, _holder2).
|
|
1256026
|
+
const subpackage = __privateGet(this, _holder2).getSubpackageByIdOrLocator(subpackageId);
|
|
1255972
1256027
|
if (subpackage == null) {
|
|
1255973
1256028
|
this.taskContext.logger.error(`Subpackage ${subpackageId} not found in ${this.apiDefinitionId}`);
|
|
1255974
1256029
|
return;
|
|
@@ -1256004,7 +1256059,7 @@ convertApiDefinitionPackage_fn = function(pkg2, parentSlug) {
|
|
|
1256004
1256059
|
};
|
|
1256005
1256060
|
_convertApiDefinitionPackageId = new WeakSet();
|
|
1256006
1256061
|
convertApiDefinitionPackageId_fn = function(packageId, parentSlug) {
|
|
1256007
|
-
const pkg2 = packageId != null ? __privateGet(this, _holder2).resolveSubpackage(__privateGet(this, _holder2).
|
|
1256062
|
+
const pkg2 = packageId != null ? __privateGet(this, _holder2).resolveSubpackage(__privateGet(this, _holder2).getSubpackageByIdOrLocator(packageId)) : void 0;
|
|
1256008
1256063
|
if (pkg2 == null) {
|
|
1256009
1256064
|
this.taskContext.logger.error(`Subpackage ${packageId} not found in ${this.apiDefinitionId}`);
|
|
1256010
1256065
|
return [];
|
|
@@ -1317424,6 +1317479,9 @@ async function generateWorkspace({
|
|
|
1317424
1317479
|
context
|
|
1317425
1317480
|
});
|
|
1317426
1317481
|
} else {
|
|
1317482
|
+
if (!token) {
|
|
1317483
|
+
return context.failAndThrow("Please run fern login");
|
|
1317484
|
+
}
|
|
1317427
1317485
|
await runRemoteGenerationForAPIWorkspace({
|
|
1317428
1317486
|
projectConfig,
|
|
1317429
1317487
|
organization,
|
|
@@ -1317455,17 +1317513,21 @@ async function generateAPIWorkspaces({
|
|
|
1317455
1317513
|
preview,
|
|
1317456
1317514
|
mode
|
|
1317457
1317515
|
}) {
|
|
1317458
|
-
|
|
1317459
|
-
|
|
1317460
|
-
|
|
1317461
|
-
|
|
1317462
|
-
await cliContext.runTask(async (context) => {
|
|
1317463
|
-
await createOrganizationIfDoesNotExist({
|
|
1317464
|
-
organization: project.config.organization,
|
|
1317465
|
-
token,
|
|
1317466
|
-
context
|
|
1317467
|
-
});
|
|
1317516
|
+
let token = void 0;
|
|
1317517
|
+
if (!useLocalDocker) {
|
|
1317518
|
+
const currentToken = await cliContext.runTask(async (context) => {
|
|
1317519
|
+
return askToLogin(context);
|
|
1317468
1317520
|
});
|
|
1317521
|
+
if (currentToken.type === "user") {
|
|
1317522
|
+
await cliContext.runTask(async (context) => {
|
|
1317523
|
+
await createOrganizationIfDoesNotExist({
|
|
1317524
|
+
organization: project.config.organization,
|
|
1317525
|
+
token: currentToken,
|
|
1317526
|
+
context
|
|
1317527
|
+
});
|
|
1317528
|
+
});
|
|
1317529
|
+
}
|
|
1317530
|
+
token = currentToken;
|
|
1317469
1317531
|
}
|
|
1317470
1317532
|
cliContext.instrumentPostHogEvent({
|
|
1317471
1317533
|
orgId: project.config.organization,
|