@fern-api/fern-api-dev 3.48.1 → 3.48.2-1-g90f1e7aac5
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 +192 -96
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1302568,90 +1302568,6 @@ function addAuthCommand(cli) {
|
|
|
1302568
1302568
|
commandGroup(cli, "auth <command>", "Authenticate fern", [addLoginCommand, addLogoutCommand, addTokenCommand]);
|
|
1302569
1302569
|
}
|
|
1302570
1302570
|
|
|
1302571
|
-
// ../cli-v2/lib/config/FernYmlConverter.js
|
|
1302572
|
-
var FernYmlConverter = class {
|
|
1302573
|
-
/**
|
|
1302574
|
-
* Converts a sourced fern.yml schema to a FernYml configuration, performing
|
|
1302575
|
-
* validation beyond what zod can provide (e.g. does the SDK version actually
|
|
1302576
|
-
* exist, etc).
|
|
1302577
|
-
*
|
|
1302578
|
-
* Extracts plain values from the sourced schema while preserving
|
|
1302579
|
-
* access to the original sourced data for error reporting.
|
|
1302580
|
-
*/
|
|
1302581
|
-
convert(sourced) {
|
|
1302582
|
-
return {
|
|
1302583
|
-
source: sourced,
|
|
1302584
|
-
edition: sourced.edition.value,
|
|
1302585
|
-
org: sourced.org.value,
|
|
1302586
|
-
cli: this.ifPresent(sourced.cli, (cli) => this.convertCli(cli)),
|
|
1302587
|
-
sdks: this.ifPresent(sourced.sdks, (sdks) => this.convertSdks(sdks))
|
|
1302588
|
-
};
|
|
1302589
|
-
}
|
|
1302590
|
-
convertCli(cli) {
|
|
1302591
|
-
return {
|
|
1302592
|
-
version: cli.version?.value
|
|
1302593
|
-
};
|
|
1302594
|
-
}
|
|
1302595
|
-
convertSdks(sourced) {
|
|
1302596
|
-
return {
|
|
1302597
|
-
autorelease: sourced.autorelease?.value,
|
|
1302598
|
-
defaultGroup: sourced.defaultGroup?.value,
|
|
1302599
|
-
readme: this.ifPresent(sourced.readme, (readme) => this.convertReadme(readme)),
|
|
1302600
|
-
targets: this.ifPresent(sourced.targets, (targets2) => this.convertTargets(targets2))
|
|
1302601
|
-
};
|
|
1302602
|
-
}
|
|
1302603
|
-
convertReadme(readme) {
|
|
1302604
|
-
return {
|
|
1302605
|
-
defaultEndpoint: readme.defaultEndpoint?.value
|
|
1302606
|
-
};
|
|
1302607
|
-
}
|
|
1302608
|
-
convertTargets(sourced) {
|
|
1302609
|
-
return Object.fromEntries(Object.entries(sourced).map(([name3, target]) => [name3, this.convertTarget(target)]));
|
|
1302610
|
-
}
|
|
1302611
|
-
convertTarget(sourced) {
|
|
1302612
|
-
return {
|
|
1302613
|
-
lang: sourced.lang?.value,
|
|
1302614
|
-
version: sourced.version?.value,
|
|
1302615
|
-
config: sourced.config?.value,
|
|
1302616
|
-
publish: this.ifPresent(sourced.publish, (publish2) => this.convertPublish(publish2)),
|
|
1302617
|
-
output: this.ifPresent(sourced.output, (output2) => this.convertOutput(output2))
|
|
1302618
|
-
};
|
|
1302619
|
-
}
|
|
1302620
|
-
convertPublish(publish2) {
|
|
1302621
|
-
return {
|
|
1302622
|
-
npm: this.ifPresent(publish2.npm, (npm) => this.convertNpm(npm))
|
|
1302623
|
-
};
|
|
1302624
|
-
}
|
|
1302625
|
-
convertNpm(npm) {
|
|
1302626
|
-
return {
|
|
1302627
|
-
packageName: npm.packageName.value
|
|
1302628
|
-
};
|
|
1302629
|
-
}
|
|
1302630
|
-
convertOutput(output2) {
|
|
1302631
|
-
return {
|
|
1302632
|
-
path: output2.path?.value,
|
|
1302633
|
-
git: this.ifPresent(output2.git, (git) => this.convertGit(git))
|
|
1302634
|
-
};
|
|
1302635
|
-
}
|
|
1302636
|
-
convertGit(git) {
|
|
1302637
|
-
return {
|
|
1302638
|
-
repository: git.repository.value
|
|
1302639
|
-
};
|
|
1302640
|
-
}
|
|
1302641
|
-
/**
|
|
1302642
|
-
* Helper to handle optional sourced objects. The Sourced<T | undefined> type
|
|
1302643
|
-
* creates a union of SourcedObject<T> | SourcedNullish<undefined>. At runtime,
|
|
1302644
|
-
* missing properties return actual undefined (not SourcedNullish) due to proxy
|
|
1302645
|
-
* behavior, but TypeScript can't know this. This helper narrows the type safely.
|
|
1302646
|
-
*/
|
|
1302647
|
-
ifPresent(value, convert6) {
|
|
1302648
|
-
if (value == null || "value" in value) {
|
|
1302649
|
-
return void 0;
|
|
1302650
|
-
}
|
|
1302651
|
-
return convert6(value);
|
|
1302652
|
-
}
|
|
1302653
|
-
};
|
|
1302654
|
-
|
|
1302655
1302571
|
// ../config/lib/FernYml.js
|
|
1302656
1302572
|
var FernYml;
|
|
1302657
1302573
|
(function(FernYml2) {
|
|
@@ -1316457,13 +1316373,26 @@ var PublishSchema = external_exports.object({
|
|
|
1316457
1316373
|
npm: NpmPublishSchema.optional()
|
|
1316458
1316374
|
});
|
|
1316459
1316375
|
|
|
1316376
|
+
// ../config/lib/schemas/SdkTargetLanguageSchema.js
|
|
1316377
|
+
var SdkTargetLanguageSchema = external_exports.enum([
|
|
1316378
|
+
"csharp",
|
|
1316379
|
+
"go",
|
|
1316380
|
+
"java",
|
|
1316381
|
+
"php",
|
|
1316382
|
+
"python",
|
|
1316383
|
+
"ruby",
|
|
1316384
|
+
"rust",
|
|
1316385
|
+
"swift",
|
|
1316386
|
+
"typescript"
|
|
1316387
|
+
]);
|
|
1316388
|
+
|
|
1316460
1316389
|
// ../config/lib/schemas/SdkTargetSchema.js
|
|
1316461
1316390
|
var SdkTargetSchema = external_exports.object({
|
|
1316462
|
-
lang:
|
|
1316391
|
+
lang: SdkTargetLanguageSchema.optional(),
|
|
1316463
1316392
|
version: external_exports.string().optional(),
|
|
1316464
1316393
|
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
1316465
1316394
|
publish: PublishSchema.optional(),
|
|
1316466
|
-
output: OutputSchema
|
|
1316395
|
+
output: OutputSchema,
|
|
1316467
1316396
|
group: external_exports.array(external_exports.string()).optional()
|
|
1316468
1316397
|
});
|
|
1316469
1316398
|
|
|
@@ -1324019,6 +1323948,11 @@ function createSourcedObject({ value, wrapChild, location: location2 }) {
|
|
|
1324019
1323948
|
});
|
|
1324020
1323949
|
}
|
|
1324021
1323950
|
|
|
1323951
|
+
// ../source/lib/isNullish.js
|
|
1323952
|
+
function isNullish(value) {
|
|
1323953
|
+
return value == null || typeof value === "object" && "value" in value;
|
|
1323954
|
+
}
|
|
1323955
|
+
|
|
1324022
1323956
|
// ../source/lib/Sourced.js
|
|
1324023
1323957
|
var SourcedString = class {
|
|
1324024
1323958
|
_value;
|
|
@@ -1325014,7 +1324948,7 @@ var FileFinder = class {
|
|
|
1325014
1324948
|
}
|
|
1325015
1324949
|
};
|
|
1325016
1324950
|
|
|
1325017
|
-
// ../cli-v2/lib/config/FernYmlSchemaLoader.js
|
|
1324951
|
+
// ../cli-v2/lib/config/fern-yml/FernYmlSchemaLoader.js
|
|
1325018
1324952
|
var FernYmlSchemaLoader = class {
|
|
1325019
1324953
|
finder;
|
|
1325020
1324954
|
loader;
|
|
@@ -1325040,15 +1324974,14 @@ var FernYmlSchemaLoader = class {
|
|
|
1325040
1324974
|
}
|
|
1325041
1324975
|
};
|
|
1325042
1324976
|
|
|
1325043
|
-
// ../cli-v2/lib/config/loadFernYml.js
|
|
1324977
|
+
// ../cli-v2/lib/config/fern-yml/loadFernYml.js
|
|
1325044
1324978
|
async function loadFernYml({ cwd: cwd2 }) {
|
|
1325045
1324979
|
const schemaLoader = new FernYmlSchemaLoader({ cwd: cwd2 });
|
|
1325046
1324980
|
const result = await schemaLoader.load();
|
|
1325047
1324981
|
if (!result.success) {
|
|
1325048
1324982
|
throw new ValidationError(result.issues);
|
|
1325049
1324983
|
}
|
|
1325050
|
-
|
|
1325051
|
-
return converter.convert(result.sourced);
|
|
1324984
|
+
return result;
|
|
1325052
1324985
|
}
|
|
1325053
1324986
|
|
|
1325054
1324987
|
// ../cli-v2/lib/commands/check.js
|
|
@@ -1325059,12 +1324992,174 @@ async function handleCheck(context2, _args) {
|
|
|
1325059
1324992
|
await loadFernYml({ cwd: context2.cwd });
|
|
1325060
1324993
|
}
|
|
1325061
1324994
|
|
|
1324995
|
+
// ../cli-v2/lib/sdk/config/getDockerImageReference.js
|
|
1324996
|
+
var SDK_DOCKER_IMAGES = {
|
|
1324997
|
+
csharp: "fernapi/fern-csharp-sdk",
|
|
1324998
|
+
go: "fernapi/fern-go-sdk",
|
|
1324999
|
+
java: "fernapi/fern-java-sdk",
|
|
1325000
|
+
php: "fernapi/fern-php-sdk",
|
|
1325001
|
+
python: "fernapi/fern-python-sdk",
|
|
1325002
|
+
ruby: "fernapi/fern-ruby-sdk",
|
|
1325003
|
+
rust: "fernapi/fern-rust-sdk",
|
|
1325004
|
+
swift: "fernapi/fern-swift-sdk",
|
|
1325005
|
+
typescript: "fernapi/fern-typescript-node-sdk"
|
|
1325006
|
+
};
|
|
1325007
|
+
function getDockerImageReference({ lang, version: version7 }) {
|
|
1325008
|
+
const image3 = SDK_DOCKER_IMAGES[lang];
|
|
1325009
|
+
const tag = version7 ?? "latest";
|
|
1325010
|
+
return {
|
|
1325011
|
+
image: image3,
|
|
1325012
|
+
tag
|
|
1325013
|
+
};
|
|
1325014
|
+
}
|
|
1325015
|
+
|
|
1325016
|
+
// ../cli-v2/lib/sdk/config/Language.js
|
|
1325017
|
+
var LANGUAGES = ["csharp", "go", "java", "php", "python", "ruby", "rust", "swift", "typescript"];
|
|
1325018
|
+
|
|
1325019
|
+
// ../cli-v2/lib/sdk/config/SdkConfigConverter.js
|
|
1325020
|
+
var SdkConfigConverter = class {
|
|
1325021
|
+
logger;
|
|
1325022
|
+
issues = [];
|
|
1325023
|
+
constructor({ logger }) {
|
|
1325024
|
+
this.logger = logger;
|
|
1325025
|
+
}
|
|
1325026
|
+
/**
|
|
1325027
|
+
* Converts a sourced fern.yml schema to SDK generation configuration.
|
|
1325028
|
+
*
|
|
1325029
|
+
* @param sourced - The sourced fern.yml schema with source location tracking.
|
|
1325030
|
+
* @returns Result with either the converted config or validation issues.
|
|
1325031
|
+
*/
|
|
1325032
|
+
convert({ fernYml }) {
|
|
1325033
|
+
if (!fernYml.success) {
|
|
1325034
|
+
return {
|
|
1325035
|
+
success: false,
|
|
1325036
|
+
issues: fernYml.issues
|
|
1325037
|
+
};
|
|
1325038
|
+
}
|
|
1325039
|
+
const sdks = fernYml.data.sdks;
|
|
1325040
|
+
const sourced = fernYml.sourced.sdks;
|
|
1325041
|
+
if (sdks == null || isNullish(sourced)) {
|
|
1325042
|
+
return {
|
|
1325043
|
+
success: false,
|
|
1325044
|
+
issues: []
|
|
1325045
|
+
};
|
|
1325046
|
+
}
|
|
1325047
|
+
const config3 = {
|
|
1325048
|
+
org: fernYml.data.org,
|
|
1325049
|
+
defaultGroup: sdks.defaultGroup,
|
|
1325050
|
+
targets: this.convertTargets({
|
|
1325051
|
+
targetsConfig: sdks.targets,
|
|
1325052
|
+
sourced: sourced.targets
|
|
1325053
|
+
})
|
|
1325054
|
+
};
|
|
1325055
|
+
if (this.issues.length > 0) {
|
|
1325056
|
+
return {
|
|
1325057
|
+
success: false,
|
|
1325058
|
+
issues: this.issues
|
|
1325059
|
+
};
|
|
1325060
|
+
}
|
|
1325061
|
+
return {
|
|
1325062
|
+
success: true,
|
|
1325063
|
+
config: config3
|
|
1325064
|
+
};
|
|
1325065
|
+
}
|
|
1325066
|
+
convertTargets({ targetsConfig, sourced }) {
|
|
1325067
|
+
const targets2 = [];
|
|
1325068
|
+
for (const [name3, target] of Object.entries(targetsConfig)) {
|
|
1325069
|
+
const sourcedTarget = sourced[name3];
|
|
1325070
|
+
if (sourcedTarget == null) {
|
|
1325071
|
+
continue;
|
|
1325072
|
+
}
|
|
1325073
|
+
const converted = this.convertTarget({
|
|
1325074
|
+
name: name3,
|
|
1325075
|
+
target,
|
|
1325076
|
+
sourced: sourcedTarget
|
|
1325077
|
+
});
|
|
1325078
|
+
if (converted != null) {
|
|
1325079
|
+
targets2.push(converted);
|
|
1325080
|
+
}
|
|
1325081
|
+
}
|
|
1325082
|
+
return targets2;
|
|
1325083
|
+
}
|
|
1325084
|
+
convertTarget({ name: name3, target, sourced }) {
|
|
1325085
|
+
const lang = this.resolveLanguage({ name: name3, target, sourced });
|
|
1325086
|
+
if (lang == null) {
|
|
1325087
|
+
return void 0;
|
|
1325088
|
+
}
|
|
1325089
|
+
const resolvedDockerImage = this.resolveDockerImage({ name: name3, lang, version: target.version });
|
|
1325090
|
+
return {
|
|
1325091
|
+
name: name3,
|
|
1325092
|
+
lang,
|
|
1325093
|
+
image: resolvedDockerImage.image,
|
|
1325094
|
+
version: target.version ?? resolvedDockerImage.tag,
|
|
1325095
|
+
config: target.config != null ? this.convertConfig(target.config) : void 0,
|
|
1325096
|
+
output: this.convertOutput({ output: target.output, sourced: sourced.output }),
|
|
1325097
|
+
publish: target.publish != null && !isNullish(sourced.publish) ? this.convertPublish({ publish: target.publish, sourced: sourced.publish }) : void 0,
|
|
1325098
|
+
groups: target.group ?? []
|
|
1325099
|
+
};
|
|
1325100
|
+
}
|
|
1325101
|
+
resolveDockerImage({ name: name3, lang, version: version7 }) {
|
|
1325102
|
+
const dockerImage = getDockerImageReference({ lang, version: version7 });
|
|
1325103
|
+
if (version7 == null) {
|
|
1325104
|
+
this.logger.debug(`Target "${name3}" has no version specified, using ${dockerImage}`);
|
|
1325105
|
+
}
|
|
1325106
|
+
return dockerImage;
|
|
1325107
|
+
}
|
|
1325108
|
+
convertConfig(config3) {
|
|
1325109
|
+
return config3;
|
|
1325110
|
+
}
|
|
1325111
|
+
convertOutput({ output: output2, sourced }) {
|
|
1325112
|
+
return {
|
|
1325113
|
+
path: output2.path,
|
|
1325114
|
+
git: output2.git != null && !isNullish(sourced.git) ? this.convertGit({ git: output2.git, sourced: sourced.git }) : void 0
|
|
1325115
|
+
};
|
|
1325116
|
+
}
|
|
1325117
|
+
convertGit({ git, sourced: _sourced }) {
|
|
1325118
|
+
return {
|
|
1325119
|
+
repository: git.repository
|
|
1325120
|
+
};
|
|
1325121
|
+
}
|
|
1325122
|
+
convertPublish({ publish: publish2, sourced }) {
|
|
1325123
|
+
return {
|
|
1325124
|
+
npm: publish2.npm != null && !isNullish(sourced.npm) ? this.convertNpm({ npm: publish2.npm, sourced: sourced.npm }) : void 0
|
|
1325125
|
+
};
|
|
1325126
|
+
}
|
|
1325127
|
+
convertNpm({ npm, sourced: _sourced }) {
|
|
1325128
|
+
return {
|
|
1325129
|
+
packageName: npm.packageName
|
|
1325130
|
+
};
|
|
1325131
|
+
}
|
|
1325132
|
+
resolveLanguage({ name: name3, target, sourced }) {
|
|
1325133
|
+
if (target.lang != null) {
|
|
1325134
|
+
return target.lang;
|
|
1325135
|
+
}
|
|
1325136
|
+
const lang = name3;
|
|
1325137
|
+
if (LANGUAGES.includes(lang)) {
|
|
1325138
|
+
return lang;
|
|
1325139
|
+
}
|
|
1325140
|
+
this.issues.push(new ValidationIssue({
|
|
1325141
|
+
message: `target "${name3}" is not a recognized language; please specify the "lang" property`,
|
|
1325142
|
+
location: sourced.$loc
|
|
1325143
|
+
}));
|
|
1325144
|
+
return void 0;
|
|
1325145
|
+
}
|
|
1325146
|
+
};
|
|
1325147
|
+
|
|
1325062
1325148
|
// ../cli-v2/lib/commands/sdk/generate.js
|
|
1325063
1325149
|
function addGenerateCommand(cli) {
|
|
1325064
1325150
|
command2(cli, "generate", "Generate SDKs configured in fern.yml", handleGenerate);
|
|
1325065
1325151
|
}
|
|
1325066
1325152
|
async function handleGenerate(context2, _args) {
|
|
1325067
|
-
context2.
|
|
1325153
|
+
const fernYml = await loadFernYml({ cwd: context2.cwd });
|
|
1325154
|
+
const converter = new SdkConfigConverter({ logger: context2.stderr });
|
|
1325155
|
+
const result = converter.convert({ fernYml });
|
|
1325156
|
+
if (!result.success) {
|
|
1325157
|
+
throw new ValidationError(result.issues);
|
|
1325158
|
+
}
|
|
1325159
|
+
context2.stdout.info(`Generating SDKs for org: ${result.config.org}`);
|
|
1325160
|
+
for (const target of result.config.targets) {
|
|
1325161
|
+
context2.stdout.info(` ${target.name}: ${target.image}:${target.version}`);
|
|
1325162
|
+
}
|
|
1325068
1325163
|
}
|
|
1325069
1325164
|
|
|
1325070
1325165
|
// ../cli-v2/lib/commands/sdk.js
|
|
@@ -1429451,7 +1429546,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1429451
1429546
|
properties: {
|
|
1429452
1429547
|
...event,
|
|
1429453
1429548
|
...event.properties,
|
|
1429454
|
-
version: "3.48.1",
|
|
1429549
|
+
version: "3.48.2-1-g90f1e7aac5",
|
|
1429455
1429550
|
usingAccessToken: true
|
|
1429456
1429551
|
}
|
|
1429457
1429552
|
});
|
|
@@ -1429550,7 +1429645,7 @@ var UserPosthogManager = class {
|
|
|
1429550
1429645
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1429551
1429646
|
event: "CLI",
|
|
1429552
1429647
|
properties: {
|
|
1429553
|
-
version: "3.48.1",
|
|
1429648
|
+
version: "3.48.2-1-g90f1e7aac5",
|
|
1429554
1429649
|
...event,
|
|
1429555
1429650
|
...event.properties,
|
|
1429556
1429651
|
usingAccessToken: false,
|
|
@@ -1508976,7 +1509071,7 @@ var CliContext = class {
|
|
|
1508976
1509071
|
if (false) {
|
|
1508977
1509072
|
this.logger.error("CLI_VERSION is not defined");
|
|
1508978
1509073
|
}
|
|
1508979
|
-
return "3.48.1";
|
|
1509074
|
+
return "3.48.2-1-g90f1e7aac5";
|
|
1508980
1509075
|
}
|
|
1508981
1509076
|
getCliName() {
|
|
1508982
1509077
|
if (false) {
|
|
@@ -1598533,7 +1598628,8 @@ function convertService(irService, ir14) {
|
|
|
1598533
1598628
|
const shouldUseUserSpecifiedExampleName = Object.values(userSpecifiedExamples).map((example) => example.response?.statusCode).filter((statusCode, index3, array2) => array2.indexOf(statusCode) !== index3).length > 0;
|
|
1598534
1598629
|
for (const [exampleName, example] of Object.entries(userSpecifiedExamples)) {
|
|
1598535
1598630
|
endpointExample = convertV2HttpEndpointExample({
|
|
1598536
|
-
|
|
1598631
|
+
// Always show user-specified displayName (OpenAPI summary), or disambiguate if needed.
|
|
1598632
|
+
shouldUseExampleName: example.displayName != null || shouldUseUserSpecifiedExampleName,
|
|
1598537
1598633
|
exampleName: example.displayName ?? exampleName,
|
|
1598538
1598634
|
example,
|
|
1598539
1598635
|
irEndpoint,
|
|
@@ -1610165,7 +1610261,7 @@ var import_path40 = __toESM(require("path"), 1);
|
|
|
1610165
1610261
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1610166
1610262
|
var LOGS_FOLDER_NAME = "logs";
|
|
1610167
1610263
|
function getCliSource() {
|
|
1610168
|
-
const version7 = "3.48.1";
|
|
1610264
|
+
const version7 = "3.48.2-1-g90f1e7aac5";
|
|
1610169
1610265
|
return `cli@${version7}`;
|
|
1610170
1610266
|
}
|
|
1610171
1610267
|
var DebugLogger = class {
|
package/package.json
CHANGED