fern-api 0.30.1 → 0.30.2
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 +131 -27
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1030261,7 +1030261,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1030261
1030261
|
properties: {
|
|
1030262
1030262
|
...event,
|
|
1030263
1030263
|
...event.properties,
|
|
1030264
|
-
version: "0.30.
|
|
1030264
|
+
version: "0.30.2",
|
|
1030265
1030265
|
usingAccessToken: true
|
|
1030266
1030266
|
}
|
|
1030267
1030267
|
});
|
|
@@ -1030323,7 +1030323,7 @@ var UserPosthogManager = class {
|
|
|
1030323
1030323
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1030324
1030324
|
event: "CLI",
|
|
1030325
1030325
|
properties: {
|
|
1030326
|
-
version: "0.30.
|
|
1030326
|
+
version: "0.30.2",
|
|
1030327
1030327
|
...event,
|
|
1030328
1030328
|
...event.properties
|
|
1030329
1030329
|
}
|
|
@@ -1056046,10 +1056046,10 @@ var CliContext = class {
|
|
|
1056046
1056046
|
return "fern-api";
|
|
1056047
1056047
|
}
|
|
1056048
1056048
|
getPackageVersion() {
|
|
1056049
|
-
if ("0.30.
|
|
1056049
|
+
if ("0.30.2" == null) {
|
|
1056050
1056050
|
this.logger.error("CLI_VERSION is not defined");
|
|
1056051
1056051
|
}
|
|
1056052
|
-
return "0.30.
|
|
1056052
|
+
return "0.30.2";
|
|
1056053
1056053
|
}
|
|
1056054
1056054
|
getCliName() {
|
|
1056055
1056055
|
if ("fern" == null) {
|
|
@@ -1060469,6 +1060469,93 @@ function convertErrorDiscriminationStrategy(rawStrategy, file) {
|
|
|
1060469
1060469
|
}
|
|
1060470
1060470
|
}
|
|
1060471
1060471
|
|
|
1060472
|
+
// pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/converters/convertReadmeConfig.js
|
|
1060473
|
+
function convertReadmeConfig({ readme, services }) {
|
|
1060474
|
+
const readmeEndpointCache = new ReadmeEndpointCache(services);
|
|
1060475
|
+
return {
|
|
1060476
|
+
apiReferenceLink: readme.apiReferenceLink,
|
|
1060477
|
+
bannerLink: readme.bannerLink,
|
|
1060478
|
+
defaultEndpoint: readme.defaultEndpoint != null ? readmeEndpointCache.getEndpointForReadmeOrThrow(readme.defaultEndpoint).id : void 0,
|
|
1060479
|
+
features: readme.features != null ? Object.fromEntries(Object.entries(readme.features).map(([featureId, endpoints]) => {
|
|
1060480
|
+
return [
|
|
1060481
|
+
featureId,
|
|
1060482
|
+
endpoints.map((endpoint) => readmeEndpointCache.getEndpointForReadmeOrThrow(endpoint).id)
|
|
1060483
|
+
];
|
|
1060484
|
+
})) : void 0
|
|
1060485
|
+
};
|
|
1060486
|
+
}
|
|
1060487
|
+
var ReadmeEndpointCache = class {
|
|
1060488
|
+
endpoints = {};
|
|
1060489
|
+
constructor(services) {
|
|
1060490
|
+
this.endpoints = this.buildEndpoints(services);
|
|
1060491
|
+
}
|
|
1060492
|
+
getEndpointForReadme(readmeEndpoint) {
|
|
1060493
|
+
const readmeEndpointObject = getReadmeEndpointObject({ endpoint: readmeEndpoint });
|
|
1060494
|
+
const endpointKey = this.getEndpointKeyForReadmeEndpoint(readmeEndpointObject);
|
|
1060495
|
+
return this.endpoints[endpointKey];
|
|
1060496
|
+
}
|
|
1060497
|
+
getEndpointForReadmeOrThrow(readmeEndpoint) {
|
|
1060498
|
+
const endpoint = this.getEndpointForReadme(readmeEndpoint);
|
|
1060499
|
+
if (endpoint == null) {
|
|
1060500
|
+
throw new Error(`Endpoint not found for ${JSON.stringify(readmeEndpoint)}`);
|
|
1060501
|
+
}
|
|
1060502
|
+
return endpoint;
|
|
1060503
|
+
}
|
|
1060504
|
+
buildEndpoints(services) {
|
|
1060505
|
+
const endpoints = {};
|
|
1060506
|
+
for (const service of Object.values(services)) {
|
|
1060507
|
+
for (const endpoint of service.endpoints) {
|
|
1060508
|
+
endpoints[this.getEndpointKeyForHttpEndpoint(endpoint)] = endpoint;
|
|
1060509
|
+
}
|
|
1060510
|
+
}
|
|
1060511
|
+
return endpoints;
|
|
1060512
|
+
}
|
|
1060513
|
+
getEndpointKeyForReadmeEndpoint(endpoint) {
|
|
1060514
|
+
return this.getEndpointKey({
|
|
1060515
|
+
method: endpoint.method,
|
|
1060516
|
+
path: endpoint.path,
|
|
1060517
|
+
stream: endpoint.stream ?? false
|
|
1060518
|
+
});
|
|
1060519
|
+
}
|
|
1060520
|
+
getEndpointKeyForHttpEndpoint(endpoint) {
|
|
1060521
|
+
var _a5, _b4;
|
|
1060522
|
+
return this.getEndpointKey({
|
|
1060523
|
+
method: endpoint.method,
|
|
1060524
|
+
path: getFullPathForEndpoint(endpoint),
|
|
1060525
|
+
stream: ((_b4 = (_a5 = endpoint.response) == null ? void 0 : _a5.body) == null ? void 0 : _b4.type) === "streaming"
|
|
1060526
|
+
});
|
|
1060527
|
+
}
|
|
1060528
|
+
getEndpointKey({ method: method2, path: path42, stream }) {
|
|
1060529
|
+
return `${method2}|${path42}|${stream}`;
|
|
1060530
|
+
}
|
|
1060531
|
+
};
|
|
1060532
|
+
function getFullPathForEndpoint(endpoint) {
|
|
1060533
|
+
let url = "";
|
|
1060534
|
+
if (endpoint.fullPath.head.length > 0) {
|
|
1060535
|
+
url = urlJoin21(url, endpoint.fullPath.head);
|
|
1060536
|
+
}
|
|
1060537
|
+
for (const part of endpoint.fullPath.parts) {
|
|
1060538
|
+
url = urlJoin21(url, "{" + part.pathParameter + "}");
|
|
1060539
|
+
if (part.tail.length > 0) {
|
|
1060540
|
+
url = urlJoin21(url, part.tail);
|
|
1060541
|
+
}
|
|
1060542
|
+
}
|
|
1060543
|
+
return url.startsWith("/") ? url : `/${url}`;
|
|
1060544
|
+
}
|
|
1060545
|
+
function getReadmeEndpointObject({ endpoint }) {
|
|
1060546
|
+
if (typeof endpoint === "string") {
|
|
1060547
|
+
const split2 = endpoint.split(" ");
|
|
1060548
|
+
if (split2.length !== 2 || split2[0] == null || split2[1] == null) {
|
|
1060549
|
+
throw new Error(`invalid endpoint string: ${endpoint}`);
|
|
1060550
|
+
}
|
|
1060551
|
+
return {
|
|
1060552
|
+
method: split2[0],
|
|
1060553
|
+
path: split2[1]
|
|
1060554
|
+
};
|
|
1060555
|
+
}
|
|
1060556
|
+
return endpoint;
|
|
1060557
|
+
}
|
|
1060558
|
+
|
|
1060472
1060559
|
// pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/converters/convertWebhookGroup.js
|
|
1060473
1060560
|
async function convertWebhookGroup({ webhooks, file }) {
|
|
1060474
1060561
|
const webhookGroup = [];
|
|
@@ -1062820,7 +1062907,7 @@ var VariableResolverImpl = _VariableResolverImpl;
|
|
|
1062820
1062907
|
__publicField(VariableResolverImpl, "VARIABLE_PREFIX", "$");
|
|
1062821
1062908
|
|
|
1062822
1062909
|
// pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/generateIntermediateRepresentation.js
|
|
1062823
|
-
async function generateIntermediateRepresentation({ workspace, generationLanguage, keywords: keywords3, smartCasing, disableExamples, audiences }) {
|
|
1062910
|
+
async function generateIntermediateRepresentation({ workspace, generationLanguage, keywords: keywords3, smartCasing, disableExamples, audiences, readme }) {
|
|
1062824
1062911
|
const casingsGenerator = constructCasingsGenerator({ generationLanguage, keywords: keywords3, smartCasing });
|
|
1062825
1062912
|
const irGraph = new IrGraph(audiences);
|
|
1062826
1062913
|
const rootApiFileContext = constructRootApiFileContext({
|
|
@@ -1063072,6 +1063159,7 @@ async function generateIntermediateRepresentation({ workspace, generationLanguag
|
|
|
1063072
1063159
|
return ((_b4 = (_a5 = endpoint.response) == null ? void 0 : _a5.body) == null ? void 0 : _b4.type) === "fileDownload";
|
|
1063073
1063160
|
});
|
|
1063074
1063161
|
});
|
|
1063162
|
+
const readmeConfig = readme != null ? convertReadmeConfig({ readme, services: intermediateRepresentation.services }) : void 0;
|
|
1063075
1063163
|
return {
|
|
1063076
1063164
|
...intermediateRepresentationForAudiences,
|
|
1063077
1063165
|
...packageTreeGenerator.build(filteredIr),
|
|
@@ -1063085,7 +1063173,8 @@ async function generateIntermediateRepresentation({ workspace, generationLanguag
|
|
|
1063085
1063173
|
sdkName: "X-Fern-SDK-Name",
|
|
1063086
1063174
|
sdkVersion: "X-Fern-SDK-Version"
|
|
1063087
1063175
|
}
|
|
1063088
|
-
}
|
|
1063176
|
+
},
|
|
1063177
|
+
readmeConfig
|
|
1063089
1063178
|
};
|
|
1063090
1063179
|
}
|
|
1063091
1063180
|
function computeServiceTypeReferenceInfo(irGraph) {
|
|
@@ -1070779,7 +1070868,8 @@ var DocsDefinitionResolver = class {
|
|
|
1070779
1070868
|
generationLanguage: void 0,
|
|
1070780
1070869
|
keywords: void 0,
|
|
1070781
1070870
|
smartCasing: false,
|
|
1070782
|
-
disableExamples: false
|
|
1070871
|
+
disableExamples: false,
|
|
1070872
|
+
readme: void 0
|
|
1070783
1070873
|
});
|
|
1070784
1070874
|
const apiDefinitionId = await this.registerApi({ ir, snippetsConfig });
|
|
1070785
1070875
|
const unsortedChangelogItems = [];
|
|
@@ -1073682,7 +1073772,8 @@ async function registerApi({ organization, workspace, context, token, audiences,
|
|
|
1073682
1073772
|
generationLanguage: void 0,
|
|
1073683
1073773
|
keywords: void 0,
|
|
1073684
1073774
|
smartCasing: false,
|
|
1073685
|
-
disableExamples: false
|
|
1073775
|
+
disableExamples: false,
|
|
1073776
|
+
readme: void 0
|
|
1073686
1073777
|
});
|
|
1073687
1073778
|
const fdrService = createFdrService({
|
|
1073688
1073779
|
token: token.value
|
|
@@ -1101487,7 +1101578,8 @@ async function generateIrForFernWorkspace({
|
|
|
1101487
1101578
|
keywords: keywords3,
|
|
1101488
1101579
|
smartCasing,
|
|
1101489
1101580
|
disableExamples,
|
|
1101490
|
-
audiences
|
|
1101581
|
+
audiences,
|
|
1101582
|
+
readme
|
|
1101491
1101583
|
}) {
|
|
1101492
1101584
|
await validateAPIWorkspaceAndLogIssues({ workspace, context, logWarnings: false });
|
|
1101493
1101585
|
return generateIntermediateRepresentation({
|
|
@@ -1101496,7 +1101588,8 @@ async function generateIrForFernWorkspace({
|
|
|
1101496
1101588
|
keywords: keywords3,
|
|
1101497
1101589
|
smartCasing,
|
|
1101498
1101590
|
disableExamples,
|
|
1101499
|
-
audiences
|
|
1101591
|
+
audiences,
|
|
1101592
|
+
readme
|
|
1101500
1101593
|
});
|
|
1101501
1101594
|
}
|
|
1101502
1101595
|
|
|
@@ -1101518,7 +1101611,8 @@ async function generateFdrApiDefinitionForWorkspaces({
|
|
|
1101518
1101611
|
audiences,
|
|
1101519
1101612
|
keywords: void 0,
|
|
1101520
1101613
|
smartCasing: false,
|
|
1101521
|
-
disableExamples: false
|
|
1101614
|
+
disableExamples: false,
|
|
1101615
|
+
readme: void 0
|
|
1101522
1101616
|
});
|
|
1101523
1101617
|
const apiDefinition = convertIrToFdrApi({
|
|
1101524
1101618
|
ir,
|
|
@@ -1107298,11 +1107392,11 @@ var V46_TO_V45_MIGRATION = {
|
|
|
1107298
1107392
|
laterVersion: "v46",
|
|
1107299
1107393
|
earlierVersion: "v45",
|
|
1107300
1107394
|
firstGeneratorVersionToConsumeNewIR: {
|
|
1107301
|
-
[GeneratorName.TYPESCRIPT_NODE_SDK]:
|
|
1107302
|
-
[GeneratorName.TYPESCRIPT_BROWSER_SDK]:
|
|
1107395
|
+
[GeneratorName.TYPESCRIPT_NODE_SDK]: "0.21.0",
|
|
1107396
|
+
[GeneratorName.TYPESCRIPT_BROWSER_SDK]: "0.21.0",
|
|
1107303
1107397
|
[GeneratorName.TYPESCRIPT]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1107304
1107398
|
[GeneratorName.TYPESCRIPT_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1107305
|
-
[GeneratorName.TYPESCRIPT_EXPRESS]:
|
|
1107399
|
+
[GeneratorName.TYPESCRIPT_EXPRESS]: "0.16.0",
|
|
1107306
1107400
|
[GeneratorName.JAVA]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1107307
1107401
|
[GeneratorName.JAVA_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1107308
1107402
|
[GeneratorName.JAVA_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
@@ -1109089,7 +1109183,8 @@ async function generateIrForWorkspaces({
|
|
|
1109089
1109183
|
audiences,
|
|
1109090
1109184
|
version: version3,
|
|
1109091
1109185
|
keywords: keywords3,
|
|
1109092
|
-
smartCasing
|
|
1109186
|
+
smartCasing,
|
|
1109187
|
+
readme
|
|
1109093
1109188
|
}) {
|
|
1109094
1109189
|
await Promise.all(
|
|
1109095
1109190
|
project.apiWorkspaces.map(async (workspace) => {
|
|
@@ -1109126,7 +1109221,8 @@ async function generateIrForWorkspaces({
|
|
|
1109126
1109221
|
smartCasing,
|
|
1109127
1109222
|
disableExamples: false,
|
|
1109128
1109223
|
audiences,
|
|
1109129
|
-
version: version3
|
|
1109224
|
+
version: version3,
|
|
1109225
|
+
readme
|
|
1109130
1109226
|
});
|
|
1109131
1109227
|
const irOutputFilePath = import_path34.default.resolve(irFilepath);
|
|
1109132
1109228
|
await (0, import_promises35.writeFile)(
|
|
@@ -1109146,7 +1109242,8 @@ async function getIntermediateRepresentation({
|
|
|
1109146
1109242
|
keywords: keywords3,
|
|
1109147
1109243
|
smartCasing,
|
|
1109148
1109244
|
disableExamples,
|
|
1109149
|
-
version: version3
|
|
1109245
|
+
version: version3,
|
|
1109246
|
+
readme
|
|
1109150
1109247
|
}) {
|
|
1109151
1109248
|
const intermediateRepresentation = await generateIrForFernWorkspace({
|
|
1109152
1109249
|
workspace,
|
|
@@ -1109155,7 +1109252,8 @@ async function getIntermediateRepresentation({
|
|
|
1109155
1109252
|
audiences,
|
|
1109156
1109253
|
keywords: keywords3,
|
|
1109157
1109254
|
smartCasing,
|
|
1109158
|
-
disableExamples
|
|
1109255
|
+
disableExamples,
|
|
1109256
|
+
readme
|
|
1109159
1109257
|
});
|
|
1109160
1109258
|
if (version3 == null) {
|
|
1109161
1109259
|
return serialization_exports2.IntermediateRepresentation.jsonOrThrow(intermediateRepresentation, {
|
|
@@ -1109544,7 +1109642,8 @@ async function getIntermediateRepresentation2({ workspace, audiences, generatorI
|
|
|
1109544
1109642
|
generationLanguage: generatorInvocation.language,
|
|
1109545
1109643
|
keywords: generatorInvocation.keywords,
|
|
1109546
1109644
|
smartCasing: generatorInvocation.smartCasing,
|
|
1109547
|
-
disableExamples: generatorInvocation.disableExamples
|
|
1109645
|
+
disableExamples: generatorInvocation.disableExamples,
|
|
1109646
|
+
readme: generatorInvocation.readme
|
|
1109548
1109647
|
});
|
|
1109549
1109648
|
context.logger.debug("Generated IR");
|
|
1109550
1109649
|
const migratedIntermediateRepresentation = irVersionOverride != null ? await migrateIntermediateRepresentationThroughVersion({
|
|
@@ -1110375,14 +1110474,15 @@ function convertLogLevel(logLevel) {
|
|
|
1110375
1110474
|
}
|
|
1110376
1110475
|
|
|
1110377
1110476
|
// pnp:/home/circleci/project/packages/cli/generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForGenerator.js
|
|
1110378
|
-
async function runRemoteGenerationForGenerator({ projectConfig, organization, workspace, interactiveTaskContext, generatorInvocation, version: version3, audiences, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview }) {
|
|
1110477
|
+
async function runRemoteGenerationForGenerator({ projectConfig, organization, workspace, interactiveTaskContext, generatorInvocation, version: version3, audiences, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, readme }) {
|
|
1110379
1110478
|
const intermediateRepresentation = await generateIntermediateRepresentation({
|
|
1110380
1110479
|
workspace,
|
|
1110381
1110480
|
generationLanguage: generatorInvocation.language,
|
|
1110382
1110481
|
keywords: generatorInvocation.keywords,
|
|
1110383
1110482
|
smartCasing: generatorInvocation.smartCasing,
|
|
1110384
1110483
|
disableExamples: generatorInvocation.disableExamples,
|
|
1110385
|
-
audiences
|
|
1110484
|
+
audiences,
|
|
1110485
|
+
readme
|
|
1110386
1110486
|
});
|
|
1110387
1110487
|
const job = await createAndStartJob({
|
|
1110388
1110488
|
projectConfig,
|
|
@@ -1110453,7 +1110553,8 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
1110453
1110553
|
token,
|
|
1110454
1110554
|
whitelabel: (_a5 = workspaceMetadata.workspace.generatorsConfiguration) == null ? void 0 : _a5.whitelabel,
|
|
1110455
1110555
|
irVersionOverride: generatorInvocation.irVersionOverride,
|
|
1110456
|
-
absolutePathToPreview: workspaceMetadata.absolutePathToPreview
|
|
1110556
|
+
absolutePathToPreview: workspaceMetadata.absolutePathToPreview,
|
|
1110557
|
+
readme: generatorInvocation.readme
|
|
1110457
1110558
|
});
|
|
1110458
1110559
|
if (remoteTaskHandlerResponse != null && remoteTaskHandlerResponse.createdSnippets) {
|
|
1110459
1110560
|
snippetsProducedBy.push(generatorInvocation);
|
|
@@ -1110911,7 +1111012,7 @@ var MockServer = class {
|
|
|
1110911
1111012
|
const endpointGroups = /* @__PURE__ */ new Map();
|
|
1110912
1111013
|
for (const service of Object.values(ir.services)) {
|
|
1110913
1111014
|
for (const endpoint of service.endpoints) {
|
|
1110914
|
-
const endpointPath =
|
|
1111015
|
+
const endpointPath = getFullPathForEndpoint2(endpoint);
|
|
1110915
1111016
|
context.logger.debug(`Registering ${endpoint.method} ${endpointPath} ...`);
|
|
1110916
1111017
|
const existingGroup = endpointGroups.get(endpointPath) ?? /* @__PURE__ */ new Map();
|
|
1110917
1111018
|
const existingEndpoints = existingGroup.get(endpoint.method) ?? [];
|
|
@@ -1110986,7 +1111087,7 @@ var MockServer = class {
|
|
|
1110986
1111087
|
});
|
|
1110987
1111088
|
}
|
|
1110988
1111089
|
};
|
|
1110989
|
-
function
|
|
1111090
|
+
function getFullPathForEndpoint2(endpoint) {
|
|
1110990
1111091
|
let url = "";
|
|
1110991
1111092
|
if (endpoint.fullPath.head.length > 0) {
|
|
1110992
1111093
|
url = urlJoin21(url, endpoint.fullPath.head);
|
|
@@ -1111169,7 +1111270,8 @@ async function mockServer({
|
|
|
1111169
1111270
|
generationLanguage: void 0,
|
|
1111170
1111271
|
keywords: void 0,
|
|
1111171
1111272
|
smartCasing: false,
|
|
1111172
|
-
disableExamples: false
|
|
1111273
|
+
disableExamples: false,
|
|
1111274
|
+
readme: void 0
|
|
1111173
1111275
|
});
|
|
1111174
1111276
|
const mockServer2 = new MockServer({
|
|
1111175
1111277
|
context,
|
|
@@ -1111300,7 +1111402,8 @@ async function testOutput({
|
|
|
1111300
1111402
|
generationLanguage: void 0,
|
|
1111301
1111403
|
keywords: void 0,
|
|
1111302
1111404
|
smartCasing: false,
|
|
1111303
|
-
disableExamples: false
|
|
1111405
|
+
disableExamples: false,
|
|
1111406
|
+
readme: void 0
|
|
1111304
1111407
|
});
|
|
1111305
1111408
|
const mockServer2 = new MockServer({
|
|
1111306
1111409
|
context,
|
|
@@ -1114466,7 +1114569,8 @@ function addIrCommand(cli, cliContext) {
|
|
|
1114466
1114569
|
audiences: argv.audience.length > 0 ? { type: "select", audiences: argv.audience } : { type: "all" },
|
|
1114467
1114570
|
version: argv.version,
|
|
1114468
1114571
|
keywords: void 0,
|
|
1114469
|
-
smartCasing: false
|
|
1114572
|
+
smartCasing: false,
|
|
1114573
|
+
readme: void 0
|
|
1114470
1114574
|
});
|
|
1114471
1114575
|
}
|
|
1114472
1114576
|
);
|