@fern-api/fern-api-dev 5.40.1 → 5.41.1
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 +73 -38
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -600700,13 +600700,14 @@ function createExamplesForResponseStatusCodes({ endpoint: endpoint3, userRequest
|
|
|
600700
600700
|
requestExamplesUsed.add(firstUserRequestName);
|
|
600701
600701
|
}
|
|
600702
600702
|
let key2 = createExampleKey(firstUserRequestName ?? firstAutoRequestName ?? "base", firstAutoResponseName ?? "base", response?.statusCode);
|
|
600703
|
+
const userOrAutoStore = firstUserRequestExample != null ? userResults : autoResults;
|
|
600703
600704
|
if (maybeCreateAndStoreExample({
|
|
600704
600705
|
key: key2,
|
|
600705
600706
|
displayName: firstUserRequestName ?? firstAutoRequestName ?? fallbackExampleDisplayName,
|
|
600706
600707
|
request: firstUserRequestExample ?? firstAutoRequestExample ?? baseRequestExample,
|
|
600707
600708
|
response: firstAutoResponseExample ?? baseResponseExample,
|
|
600708
600709
|
exampleStore,
|
|
600709
|
-
userOrAutoStore
|
|
600710
|
+
userOrAutoStore
|
|
600710
600711
|
})) {
|
|
600711
600712
|
examplesCreatedForResponse = true;
|
|
600712
600713
|
}
|
|
@@ -620110,10 +620111,11 @@ var FIDDLE_ORIGIN = process.env.FERN_FIDDLE_ORIGIN ?? "https://fiddle-coordinato
|
|
|
620110
620111
|
function getFiddleOrigin() {
|
|
620111
620112
|
return FIDDLE_ORIGIN;
|
|
620112
620113
|
}
|
|
620113
|
-
function createFiddleService({ token } = {}) {
|
|
620114
|
+
function createFiddleService({ token, headers: headers2 } = {}) {
|
|
620114
620115
|
return new FernFiddleClient({
|
|
620115
620116
|
environment: FIDDLE_ORIGIN,
|
|
620116
|
-
token
|
|
620117
|
+
token,
|
|
620118
|
+
headers: headers2
|
|
620117
620119
|
});
|
|
620118
620120
|
}
|
|
620119
620121
|
|
|
@@ -626815,10 +626817,11 @@ var FernVenusApiClient = class {
|
|
|
626815
626817
|
};
|
|
626816
626818
|
|
|
626817
626819
|
// ../../core/lib/services/venus.js
|
|
626818
|
-
function createVenusService({ environment: environment2 = "https://venus-dev2.buildwithfern.com", token } = {}) {
|
|
626820
|
+
function createVenusService({ environment: environment2 = "https://venus-dev2.buildwithfern.com", token, headers: headers2 } = {}) {
|
|
626819
626821
|
return new FernVenusApiClient({
|
|
626820
626822
|
environment: environment2,
|
|
626821
|
-
token
|
|
626823
|
+
token,
|
|
626824
|
+
headers: headers2
|
|
626822
626825
|
});
|
|
626823
626826
|
}
|
|
626824
626827
|
|
|
@@ -662721,8 +662724,8 @@ function printIfUpgradeAvailable(context3, currentVersion, latestVersion2) {
|
|
|
662721
662724
|
}
|
|
662722
662725
|
|
|
662723
662726
|
// ../auth/lib/orgs/checkOrganizationMembership.js
|
|
662724
|
-
async function checkOrganizationMembership({ organization, token }) {
|
|
662725
|
-
const venus = createVenusService({ token: token.value });
|
|
662727
|
+
async function checkOrganizationMembership({ organization, token, headers: headers2 }) {
|
|
662728
|
+
const venus = createVenusService({ token: token.value, headers: headers2 });
|
|
662726
662729
|
const isMemberResponse = await venus.organization.isMember(organization);
|
|
662727
662730
|
if (isMemberResponse.ok && isMemberResponse.body) {
|
|
662728
662731
|
return { type: "member" };
|
|
@@ -662759,8 +662762,8 @@ function getOrganizationNameValidationError(organizationName) {
|
|
|
662759
662762
|
}
|
|
662760
662763
|
|
|
662761
662764
|
// ../auth/lib/orgs/createOrganizationIfDoesNotExist.js
|
|
662762
|
-
async function createOrganizationIfDoesNotExist({ organization, token, context: context3 }) {
|
|
662763
|
-
const venus = createVenusService({ token: token.value });
|
|
662765
|
+
async function createOrganizationIfDoesNotExist({ organization, token, context: context3, headers: headers2 }) {
|
|
662766
|
+
const venus = createVenusService({ token: token.value, headers: headers2 });
|
|
662764
662767
|
const getOrganizationResponse = await venus.organization.get(organization);
|
|
662765
662768
|
if (getOrganizationResponse.ok) {
|
|
662766
662769
|
return false;
|
|
@@ -669381,7 +669384,7 @@ var AccessTokenPosthogManager = class {
|
|
|
669381
669384
|
properties: {
|
|
669382
669385
|
...event,
|
|
669383
669386
|
...event.properties,
|
|
669384
|
-
version: "5.
|
|
669387
|
+
version: "5.41.1",
|
|
669385
669388
|
usingAccessToken: true,
|
|
669386
669389
|
...getRunIdProperties()
|
|
669387
669390
|
}
|
|
@@ -669445,7 +669448,7 @@ var UserPosthogManager = class {
|
|
|
669445
669448
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
669446
669449
|
event: "CLI",
|
|
669447
669450
|
properties: {
|
|
669448
|
-
version: "5.
|
|
669451
|
+
version: "5.41.1",
|
|
669449
669452
|
...event,
|
|
669450
669453
|
...event.properties,
|
|
669451
669454
|
usingAccessToken: false,
|
|
@@ -672220,8 +672223,10 @@ var import_promises52 = require("fs/promises");
|
|
|
672220
672223
|
var DEFAULT_USER = "default";
|
|
672221
672224
|
var LegacyTokenMigrator = class {
|
|
672222
672225
|
loader;
|
|
672223
|
-
|
|
672226
|
+
headers;
|
|
672227
|
+
constructor({ loader: loader2, headers: headers2 }) {
|
|
672224
672228
|
this.loader = loader2;
|
|
672229
|
+
this.headers = headers2;
|
|
672225
672230
|
}
|
|
672226
672231
|
/**
|
|
672227
672232
|
* Performs the migration from ~/.fern/token to ~/.fernrc + keyring.
|
|
@@ -672258,7 +672263,7 @@ var LegacyTokenMigrator = class {
|
|
|
672258
672263
|
*/
|
|
672259
672264
|
async fetchUserEmail(token) {
|
|
672260
672265
|
try {
|
|
672261
|
-
const venus = createVenusService({ token });
|
|
672266
|
+
const venus = createVenusService({ token, headers: this.headers });
|
|
672262
672267
|
const response = await venus.user.getMyself();
|
|
672263
672268
|
if (response.ok && response.body.email != null) {
|
|
672264
672269
|
return response.body.email;
|
|
@@ -672277,11 +672282,11 @@ var TokenService = class {
|
|
|
672277
672282
|
migrator;
|
|
672278
672283
|
// Tracks whether or not we've already performed the migration.
|
|
672279
672284
|
migrationPromise = null;
|
|
672280
|
-
constructor({ credential }) {
|
|
672285
|
+
constructor({ credential, headers: headers2 }) {
|
|
672281
672286
|
this.credential = credential;
|
|
672282
672287
|
const loader2 = new FernRcSchemaLoader();
|
|
672283
672288
|
this.accountManager = new FernRcAccountManager({ loader: loader2 });
|
|
672284
|
-
this.migrator = new LegacyTokenMigrator({ loader: loader2 });
|
|
672289
|
+
this.migrator = new LegacyTokenMigrator({ loader: loader2, headers: headers2 });
|
|
672285
672290
|
}
|
|
672286
672291
|
/**
|
|
672287
672292
|
* Adds a new account with its token.
|
|
@@ -675342,6 +675347,7 @@ var Context = class _Context {
|
|
|
675342
675347
|
isShuttingDown = false;
|
|
675343
675348
|
logFilePathPrinted = false;
|
|
675344
675349
|
createdAt = Date.now();
|
|
675350
|
+
requestId = v4_default();
|
|
675345
675351
|
cwd;
|
|
675346
675352
|
logLevel;
|
|
675347
675353
|
info;
|
|
@@ -675367,7 +675373,7 @@ var Context = class _Context {
|
|
|
675367
675373
|
this.logs = new LogFileWriter(this.cache.logs.absoluteFilePath);
|
|
675368
675374
|
this.ttyAwareLogger = ttyAwareLogger;
|
|
675369
675375
|
this.telemetry = telemetry;
|
|
675370
|
-
this.tokenService = new TokenService({ credential: new CredentialStore() });
|
|
675376
|
+
this.tokenService = new TokenService({ credential: new CredentialStore(), headers: this.headers });
|
|
675371
675377
|
}
|
|
675372
675378
|
/**
|
|
675373
675379
|
* Returns true if running in an interactive TTY environment (not CI).
|
|
@@ -675375,6 +675381,12 @@ var Context = class _Context {
|
|
|
675375
675381
|
get isTTY() {
|
|
675376
675382
|
return this.ttyAwareLogger.isTTY;
|
|
675377
675383
|
}
|
|
675384
|
+
/**
|
|
675385
|
+
* Returns headers that should be included with every outbound API request.
|
|
675386
|
+
*/
|
|
675387
|
+
get headers() {
|
|
675388
|
+
return { "X-Request-Id": this.requestId };
|
|
675389
|
+
}
|
|
675378
675390
|
/**
|
|
675379
675391
|
* Resolves the org from the local Fern config. Tries `fern.yml` first
|
|
675380
675392
|
* (`org` field), then falls back to `fern/fern.config.json` (`organization`
|
|
@@ -675503,18 +675515,18 @@ var Context = class _Context {
|
|
|
675503
675515
|
if (token.type === "organization") {
|
|
675504
675516
|
return;
|
|
675505
675517
|
}
|
|
675506
|
-
const result = await checkOrganizationMembership({ organization, token });
|
|
675518
|
+
const result = await checkOrganizationMembership({ organization, token, headers: this.headers });
|
|
675507
675519
|
switch (result.type) {
|
|
675508
675520
|
case "member":
|
|
675509
675521
|
return;
|
|
675510
|
-
case "not-found":
|
|
675511
|
-
throw CliError.notFound(`Organization "${organization}" does not exist.
|
|
675512
|
-
|
|
675513
|
-
To create it, run: fern org create ${organization}`);
|
|
675514
675522
|
case "no-access":
|
|
675515
675523
|
throw CliError.unauthorized(`You do not have access to organization "${organization}".
|
|
675516
675524
|
|
|
675517
675525
|
Contact an organization admin to request access.`);
|
|
675526
|
+
case "not-found":
|
|
675527
|
+
throw CliError.notFound(`Organization "${organization}" does not exist.
|
|
675528
|
+
|
|
675529
|
+
To create it, run: fern org create ${organization}`);
|
|
675518
675530
|
case "unknown-error":
|
|
675519
675531
|
throw CliError.internalError(`Failed to verify access to organization "${organization}".`);
|
|
675520
675532
|
}
|
|
@@ -816850,10 +816862,11 @@ var TokenCommand = class {
|
|
|
816850
816862
|
await createOrganizationIfDoesNotExist({
|
|
816851
816863
|
organization: orgId,
|
|
816852
816864
|
token,
|
|
816853
|
-
context: new TaskContextAdapter({ context: context3 })
|
|
816865
|
+
context: new TaskContextAdapter({ context: context3 }),
|
|
816866
|
+
headers: context3.headers
|
|
816854
816867
|
});
|
|
816855
816868
|
}
|
|
816856
|
-
const venus = createVenusService({ token: token.value });
|
|
816869
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
816857
816870
|
const response = await venus.registry.generateRegistryTokens({
|
|
816858
816871
|
organizationId: orgId
|
|
816859
816872
|
});
|
|
@@ -824034,10 +824047,22 @@ function convertService(irService, ir11) {
|
|
|
824034
824047
|
}),
|
|
824035
824048
|
includeInApiExplorer: irEndpoint.apiPlayground
|
|
824036
824049
|
};
|
|
824050
|
+
attachUserSpecifiedV2ExamplesMarker(endpoint3, irEndpoint);
|
|
824037
824051
|
endpoints.push(endpoint3);
|
|
824038
824052
|
}
|
|
824039
824053
|
return endpoints;
|
|
824040
824054
|
}
|
|
824055
|
+
function attachUserSpecifiedV2ExamplesMarker(endpoint3, irEndpoint) {
|
|
824056
|
+
const userSpecifiedExamples = irEndpoint.v2Examples?.userSpecifiedExamples;
|
|
824057
|
+
if (userSpecifiedExamples == null || Object.keys(userSpecifiedExamples).length === 0) {
|
|
824058
|
+
return;
|
|
824059
|
+
}
|
|
824060
|
+
const endpointWithV2ExamplesMarker = endpoint3;
|
|
824061
|
+
endpointWithV2ExamplesMarker.v2Examples = {
|
|
824062
|
+
userSpecifiedExamples,
|
|
824063
|
+
autogeneratedExamples: {}
|
|
824064
|
+
};
|
|
824065
|
+
}
|
|
824041
824066
|
function convertWebSocketChannel(channel3, ir11) {
|
|
824042
824067
|
let examples = [];
|
|
824043
824068
|
if (channel3.v2Examples != null && (Object.keys(channel3.v2Examples.userSpecifiedExamples).length > 0 || Object.keys(channel3.v2Examples.autogeneratedExamples).length > 0)) {
|
|
@@ -860386,7 +860411,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
860386
860411
|
var LOGS_FOLDER_NAME = "logs";
|
|
860387
860412
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
860388
860413
|
function getCliSource() {
|
|
860389
|
-
const version7 = "5.
|
|
860414
|
+
const version7 = "5.41.1";
|
|
860390
860415
|
return `cli@${version7}`;
|
|
860391
860416
|
}
|
|
860392
860417
|
var DebugLogger = class {
|
|
@@ -881026,7 +881051,7 @@ var LegacyDocsPublisher = class {
|
|
|
881026
881051
|
previewId,
|
|
881027
881052
|
disableTemplates: void 0,
|
|
881028
881053
|
skipUpload,
|
|
881029
|
-
cliVersion: "5.
|
|
881054
|
+
cliVersion: "5.41.1",
|
|
881030
881055
|
loginCommand: "fern auth login"
|
|
881031
881056
|
});
|
|
881032
881057
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -881876,7 +881901,7 @@ var DeleteCommand = class {
|
|
|
881876
881901
|
});
|
|
881877
881902
|
}
|
|
881878
881903
|
const token = await context3.getTokenOrPrompt();
|
|
881879
|
-
const fdr = createFdrService({ token: token.value });
|
|
881904
|
+
const fdr = createFdrService({ token: token.value, headers: context3.headers });
|
|
881880
881905
|
context3.stderr.debug(`Deleting preview site: ${resolvedUrl}`);
|
|
881881
881906
|
try {
|
|
881882
881907
|
await fdr.docs.v2.write.deleteDocsSite({
|
|
@@ -882371,7 +882396,11 @@ var Wizard = class {
|
|
|
882371
882396
|
return;
|
|
882372
882397
|
}
|
|
882373
882398
|
try {
|
|
882374
|
-
const result = await checkOrganizationMembership({
|
|
882399
|
+
const result = await checkOrganizationMembership({
|
|
882400
|
+
organization,
|
|
882401
|
+
token,
|
|
882402
|
+
headers: this.context.headers
|
|
882403
|
+
});
|
|
882375
882404
|
switch (result.type) {
|
|
882376
882405
|
case "member":
|
|
882377
882406
|
this.context.stderr.info(` ${Icons.success} Organization "${organization}" found
|
|
@@ -882381,7 +882410,12 @@ var Wizard = class {
|
|
|
882381
882410
|
const taskContext = new TaskContextAdapter({ context: this.context });
|
|
882382
882411
|
const created = await withSpinner({
|
|
882383
882412
|
message: `Creating organization "${organization}"`,
|
|
882384
|
-
operation: () => createOrganizationIfDoesNotExist({
|
|
882413
|
+
operation: () => createOrganizationIfDoesNotExist({
|
|
882414
|
+
organization,
|
|
882415
|
+
token,
|
|
882416
|
+
context: taskContext,
|
|
882417
|
+
headers: this.context.headers
|
|
882418
|
+
}),
|
|
882385
882419
|
indent: 2
|
|
882386
882420
|
});
|
|
882387
882421
|
if (created) {
|
|
@@ -882984,7 +883018,8 @@ var CreateCommand = class {
|
|
|
882984
883018
|
operation: () => createOrganizationIfDoesNotExist({
|
|
882985
883019
|
organization: args.name,
|
|
882986
883020
|
token,
|
|
882987
|
-
context: new TaskContextAdapter({ context: context3 })
|
|
883021
|
+
context: new TaskContextAdapter({ context: context3 }),
|
|
883022
|
+
headers: context3.headers
|
|
882988
883023
|
})
|
|
882989
883024
|
});
|
|
882990
883025
|
if (created) {
|
|
@@ -883013,7 +883048,7 @@ var ListCommand = class {
|
|
|
883013
883048
|
context3.stderr.error(`${Icons.error} Organization tokens cannot list organizations. Unset the FERN_TOKEN environment variable and run 'fern auth login' to list your organizations.`);
|
|
883014
883049
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883015
883050
|
}
|
|
883016
|
-
const venus = createVenusService({ token: token.value });
|
|
883051
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883017
883052
|
const firstPage = await this.fetchPage({ venus, pageId: 1 });
|
|
883018
883053
|
if (firstPage.organizations.length === 0) {
|
|
883019
883054
|
context3.stderr.info(`${Icons.info} You are not a member of any organizations.`);
|
|
@@ -883142,7 +883177,7 @@ var InviteMemberCommand = class {
|
|
|
883142
883177
|
context3.stderr.error(`${Icons.error} Organization tokens cannot manage members. Unset the FERN_TOKEN environment variable and run 'fern auth login' to manage members.`);
|
|
883143
883178
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883144
883179
|
}
|
|
883145
|
-
const venus = createVenusService({ token: token.value });
|
|
883180
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883146
883181
|
const orgLookup = await venus.organization.get(args.org);
|
|
883147
883182
|
if (!orgLookup.ok) {
|
|
883148
883183
|
orgLookup.error._visit({
|
|
@@ -883217,7 +883252,7 @@ var ListMembersCommand = class {
|
|
|
883217
883252
|
context3.stderr.error(`${Icons.error} Organization tokens cannot list members. Unset the FERN_TOKEN environment variable and run 'fern auth login' to list members.`);
|
|
883218
883253
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883219
883254
|
}
|
|
883220
|
-
const venus = createVenusService({ token: token.value });
|
|
883255
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883221
883256
|
const response = await withSpinner({
|
|
883222
883257
|
message: `Fetching members of organization "${args.org}"`,
|
|
883223
883258
|
operation: () => venus.organization.get(args.org)
|
|
@@ -883280,7 +883315,7 @@ var RemoveMemberCommand = class {
|
|
|
883280
883315
|
context3.stderr.error(`${Icons.error} Organization tokens cannot remove members. Unset the FERN_TOKEN environment variable and run 'fern auth login' to remove members.`);
|
|
883281
883316
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883282
883317
|
}
|
|
883283
|
-
const venus = createVenusService({ token: token.value });
|
|
883318
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883284
883319
|
const orgLookup = await venus.organization.get(args.org);
|
|
883285
883320
|
if (!orgLookup.ok) {
|
|
883286
883321
|
orgLookup.error._visit({
|
|
@@ -883366,7 +883401,7 @@ var CreateTokenCommand = class {
|
|
|
883366
883401
|
context3.stderr.error(`${Icons.error} Organization tokens cannot manage API tokens. Unset the FERN_TOKEN environment variable and run 'fern auth login' to manage tokens.`);
|
|
883367
883402
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883368
883403
|
}
|
|
883369
|
-
const venus = createVenusService({ token: token.value });
|
|
883404
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883370
883405
|
const orgLookup = await venus.organization.get(args.org);
|
|
883371
883406
|
if (!orgLookup.ok) {
|
|
883372
883407
|
orgLookup.error._visit({
|
|
@@ -883446,7 +883481,7 @@ var ListTokensCommand = class {
|
|
|
883446
883481
|
context3.stderr.error(`${Icons.error} Organization tokens cannot list API tokens. Unset the FERN_TOKEN environment variable and run 'fern auth login' to list tokens.`);
|
|
883447
883482
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883448
883483
|
}
|
|
883449
|
-
const venus = createVenusService({ token: token.value });
|
|
883484
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883450
883485
|
const orgLookup = await venus.organization.get(args.org);
|
|
883451
883486
|
if (!orgLookup.ok) {
|
|
883452
883487
|
orgLookup.error._visit({
|
|
@@ -883544,7 +883579,7 @@ var RevokeTokenCommand = class {
|
|
|
883544
883579
|
context3.stderr.error(`${Icons.error} Organization tokens cannot revoke API tokens. Unset the FERN_TOKEN environment variable and run 'fern auth login' to revoke tokens.`);
|
|
883545
883580
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883546
883581
|
}
|
|
883547
|
-
const venus = createVenusService({ token: token.value });
|
|
883582
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883548
883583
|
const tokenId = args.tokenId;
|
|
883549
883584
|
const response = await withSpinner({
|
|
883550
883585
|
message: `Revoking token "${tokenId}"`,
|
|
@@ -955946,7 +955981,7 @@ function getAutomationContextFromEnv() {
|
|
|
955946
955981
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
955947
955982
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
955948
955983
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
955949
|
-
cli_version: "5.
|
|
955984
|
+
cli_version: "5.41.1"
|
|
955950
955985
|
};
|
|
955951
955986
|
}
|
|
955952
955987
|
function isAutomationMode() {
|
|
@@ -956772,7 +956807,7 @@ var CliContext = class _CliContext {
|
|
|
956772
956807
|
if (false) {
|
|
956773
956808
|
this.logger.error("CLI_VERSION is not defined");
|
|
956774
956809
|
}
|
|
956775
|
-
return "5.
|
|
956810
|
+
return "5.41.1";
|
|
956776
956811
|
}
|
|
956777
956812
|
getCliName() {
|
|
956778
956813
|
if (false) {
|
package/package.json
CHANGED