@fern-api/fern-api-dev 5.40.1 → 5.41.0
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 +59 -37
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -620110,10 +620110,11 @@ var FIDDLE_ORIGIN = process.env.FERN_FIDDLE_ORIGIN ?? "https://fiddle-coordinato
|
|
|
620110
620110
|
function getFiddleOrigin() {
|
|
620111
620111
|
return FIDDLE_ORIGIN;
|
|
620112
620112
|
}
|
|
620113
|
-
function createFiddleService({ token } = {}) {
|
|
620113
|
+
function createFiddleService({ token, headers: headers2 } = {}) {
|
|
620114
620114
|
return new FernFiddleClient({
|
|
620115
620115
|
environment: FIDDLE_ORIGIN,
|
|
620116
|
-
token
|
|
620116
|
+
token,
|
|
620117
|
+
headers: headers2
|
|
620117
620118
|
});
|
|
620118
620119
|
}
|
|
620119
620120
|
|
|
@@ -626815,10 +626816,11 @@ var FernVenusApiClient = class {
|
|
|
626815
626816
|
};
|
|
626816
626817
|
|
|
626817
626818
|
// ../../core/lib/services/venus.js
|
|
626818
|
-
function createVenusService({ environment: environment2 = "https://venus-dev2.buildwithfern.com", token } = {}) {
|
|
626819
|
+
function createVenusService({ environment: environment2 = "https://venus-dev2.buildwithfern.com", token, headers: headers2 } = {}) {
|
|
626819
626820
|
return new FernVenusApiClient({
|
|
626820
626821
|
environment: environment2,
|
|
626821
|
-
token
|
|
626822
|
+
token,
|
|
626823
|
+
headers: headers2
|
|
626822
626824
|
});
|
|
626823
626825
|
}
|
|
626824
626826
|
|
|
@@ -662721,8 +662723,8 @@ function printIfUpgradeAvailable(context3, currentVersion, latestVersion2) {
|
|
|
662721
662723
|
}
|
|
662722
662724
|
|
|
662723
662725
|
// ../auth/lib/orgs/checkOrganizationMembership.js
|
|
662724
|
-
async function checkOrganizationMembership({ organization, token }) {
|
|
662725
|
-
const venus = createVenusService({ token: token.value });
|
|
662726
|
+
async function checkOrganizationMembership({ organization, token, headers: headers2 }) {
|
|
662727
|
+
const venus = createVenusService({ token: token.value, headers: headers2 });
|
|
662726
662728
|
const isMemberResponse = await venus.organization.isMember(organization);
|
|
662727
662729
|
if (isMemberResponse.ok && isMemberResponse.body) {
|
|
662728
662730
|
return { type: "member" };
|
|
@@ -662759,8 +662761,8 @@ function getOrganizationNameValidationError(organizationName) {
|
|
|
662759
662761
|
}
|
|
662760
662762
|
|
|
662761
662763
|
// ../auth/lib/orgs/createOrganizationIfDoesNotExist.js
|
|
662762
|
-
async function createOrganizationIfDoesNotExist({ organization, token, context: context3 }) {
|
|
662763
|
-
const venus = createVenusService({ token: token.value });
|
|
662764
|
+
async function createOrganizationIfDoesNotExist({ organization, token, context: context3, headers: headers2 }) {
|
|
662765
|
+
const venus = createVenusService({ token: token.value, headers: headers2 });
|
|
662764
662766
|
const getOrganizationResponse = await venus.organization.get(organization);
|
|
662765
662767
|
if (getOrganizationResponse.ok) {
|
|
662766
662768
|
return false;
|
|
@@ -669381,7 +669383,7 @@ var AccessTokenPosthogManager = class {
|
|
|
669381
669383
|
properties: {
|
|
669382
669384
|
...event,
|
|
669383
669385
|
...event.properties,
|
|
669384
|
-
version: "5.
|
|
669386
|
+
version: "5.41.0",
|
|
669385
669387
|
usingAccessToken: true,
|
|
669386
669388
|
...getRunIdProperties()
|
|
669387
669389
|
}
|
|
@@ -669445,7 +669447,7 @@ var UserPosthogManager = class {
|
|
|
669445
669447
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
669446
669448
|
event: "CLI",
|
|
669447
669449
|
properties: {
|
|
669448
|
-
version: "5.
|
|
669450
|
+
version: "5.41.0",
|
|
669449
669451
|
...event,
|
|
669450
669452
|
...event.properties,
|
|
669451
669453
|
usingAccessToken: false,
|
|
@@ -672220,8 +672222,10 @@ var import_promises52 = require("fs/promises");
|
|
|
672220
672222
|
var DEFAULT_USER = "default";
|
|
672221
672223
|
var LegacyTokenMigrator = class {
|
|
672222
672224
|
loader;
|
|
672223
|
-
|
|
672225
|
+
headers;
|
|
672226
|
+
constructor({ loader: loader2, headers: headers2 }) {
|
|
672224
672227
|
this.loader = loader2;
|
|
672228
|
+
this.headers = headers2;
|
|
672225
672229
|
}
|
|
672226
672230
|
/**
|
|
672227
672231
|
* Performs the migration from ~/.fern/token to ~/.fernrc + keyring.
|
|
@@ -672258,7 +672262,7 @@ var LegacyTokenMigrator = class {
|
|
|
672258
672262
|
*/
|
|
672259
672263
|
async fetchUserEmail(token) {
|
|
672260
672264
|
try {
|
|
672261
|
-
const venus = createVenusService({ token });
|
|
672265
|
+
const venus = createVenusService({ token, headers: this.headers });
|
|
672262
672266
|
const response = await venus.user.getMyself();
|
|
672263
672267
|
if (response.ok && response.body.email != null) {
|
|
672264
672268
|
return response.body.email;
|
|
@@ -672277,11 +672281,11 @@ var TokenService = class {
|
|
|
672277
672281
|
migrator;
|
|
672278
672282
|
// Tracks whether or not we've already performed the migration.
|
|
672279
672283
|
migrationPromise = null;
|
|
672280
|
-
constructor({ credential }) {
|
|
672284
|
+
constructor({ credential, headers: headers2 }) {
|
|
672281
672285
|
this.credential = credential;
|
|
672282
672286
|
const loader2 = new FernRcSchemaLoader();
|
|
672283
672287
|
this.accountManager = new FernRcAccountManager({ loader: loader2 });
|
|
672284
|
-
this.migrator = new LegacyTokenMigrator({ loader: loader2 });
|
|
672288
|
+
this.migrator = new LegacyTokenMigrator({ loader: loader2, headers: headers2 });
|
|
672285
672289
|
}
|
|
672286
672290
|
/**
|
|
672287
672291
|
* Adds a new account with its token.
|
|
@@ -675342,6 +675346,7 @@ var Context = class _Context {
|
|
|
675342
675346
|
isShuttingDown = false;
|
|
675343
675347
|
logFilePathPrinted = false;
|
|
675344
675348
|
createdAt = Date.now();
|
|
675349
|
+
requestId = v4_default();
|
|
675345
675350
|
cwd;
|
|
675346
675351
|
logLevel;
|
|
675347
675352
|
info;
|
|
@@ -675367,7 +675372,7 @@ var Context = class _Context {
|
|
|
675367
675372
|
this.logs = new LogFileWriter(this.cache.logs.absoluteFilePath);
|
|
675368
675373
|
this.ttyAwareLogger = ttyAwareLogger;
|
|
675369
675374
|
this.telemetry = telemetry;
|
|
675370
|
-
this.tokenService = new TokenService({ credential: new CredentialStore() });
|
|
675375
|
+
this.tokenService = new TokenService({ credential: new CredentialStore(), headers: this.headers });
|
|
675371
675376
|
}
|
|
675372
675377
|
/**
|
|
675373
675378
|
* Returns true if running in an interactive TTY environment (not CI).
|
|
@@ -675375,6 +675380,12 @@ var Context = class _Context {
|
|
|
675375
675380
|
get isTTY() {
|
|
675376
675381
|
return this.ttyAwareLogger.isTTY;
|
|
675377
675382
|
}
|
|
675383
|
+
/**
|
|
675384
|
+
* Returns headers that should be included with every outbound API request.
|
|
675385
|
+
*/
|
|
675386
|
+
get headers() {
|
|
675387
|
+
return { "X-Request-Id": this.requestId };
|
|
675388
|
+
}
|
|
675378
675389
|
/**
|
|
675379
675390
|
* Resolves the org from the local Fern config. Tries `fern.yml` first
|
|
675380
675391
|
* (`org` field), then falls back to `fern/fern.config.json` (`organization`
|
|
@@ -675503,18 +675514,18 @@ var Context = class _Context {
|
|
|
675503
675514
|
if (token.type === "organization") {
|
|
675504
675515
|
return;
|
|
675505
675516
|
}
|
|
675506
|
-
const result = await checkOrganizationMembership({ organization, token });
|
|
675517
|
+
const result = await checkOrganizationMembership({ organization, token, headers: this.headers });
|
|
675507
675518
|
switch (result.type) {
|
|
675508
675519
|
case "member":
|
|
675509
675520
|
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
675521
|
case "no-access":
|
|
675515
675522
|
throw CliError.unauthorized(`You do not have access to organization "${organization}".
|
|
675516
675523
|
|
|
675517
675524
|
Contact an organization admin to request access.`);
|
|
675525
|
+
case "not-found":
|
|
675526
|
+
throw CliError.notFound(`Organization "${organization}" does not exist.
|
|
675527
|
+
|
|
675528
|
+
To create it, run: fern org create ${organization}`);
|
|
675518
675529
|
case "unknown-error":
|
|
675519
675530
|
throw CliError.internalError(`Failed to verify access to organization "${organization}".`);
|
|
675520
675531
|
}
|
|
@@ -816850,10 +816861,11 @@ var TokenCommand = class {
|
|
|
816850
816861
|
await createOrganizationIfDoesNotExist({
|
|
816851
816862
|
organization: orgId,
|
|
816852
816863
|
token,
|
|
816853
|
-
context: new TaskContextAdapter({ context: context3 })
|
|
816864
|
+
context: new TaskContextAdapter({ context: context3 }),
|
|
816865
|
+
headers: context3.headers
|
|
816854
816866
|
});
|
|
816855
816867
|
}
|
|
816856
|
-
const venus = createVenusService({ token: token.value });
|
|
816868
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
816857
816869
|
const response = await venus.registry.generateRegistryTokens({
|
|
816858
816870
|
organizationId: orgId
|
|
816859
816871
|
});
|
|
@@ -860386,7 +860398,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
860386
860398
|
var LOGS_FOLDER_NAME = "logs";
|
|
860387
860399
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
860388
860400
|
function getCliSource() {
|
|
860389
|
-
const version7 = "5.
|
|
860401
|
+
const version7 = "5.41.0";
|
|
860390
860402
|
return `cli@${version7}`;
|
|
860391
860403
|
}
|
|
860392
860404
|
var DebugLogger = class {
|
|
@@ -881026,7 +881038,7 @@ var LegacyDocsPublisher = class {
|
|
|
881026
881038
|
previewId,
|
|
881027
881039
|
disableTemplates: void 0,
|
|
881028
881040
|
skipUpload,
|
|
881029
|
-
cliVersion: "5.
|
|
881041
|
+
cliVersion: "5.41.0",
|
|
881030
881042
|
loginCommand: "fern auth login"
|
|
881031
881043
|
});
|
|
881032
881044
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -881876,7 +881888,7 @@ var DeleteCommand = class {
|
|
|
881876
881888
|
});
|
|
881877
881889
|
}
|
|
881878
881890
|
const token = await context3.getTokenOrPrompt();
|
|
881879
|
-
const fdr = createFdrService({ token: token.value });
|
|
881891
|
+
const fdr = createFdrService({ token: token.value, headers: context3.headers });
|
|
881880
881892
|
context3.stderr.debug(`Deleting preview site: ${resolvedUrl}`);
|
|
881881
881893
|
try {
|
|
881882
881894
|
await fdr.docs.v2.write.deleteDocsSite({
|
|
@@ -882371,7 +882383,11 @@ var Wizard = class {
|
|
|
882371
882383
|
return;
|
|
882372
882384
|
}
|
|
882373
882385
|
try {
|
|
882374
|
-
const result = await checkOrganizationMembership({
|
|
882386
|
+
const result = await checkOrganizationMembership({
|
|
882387
|
+
organization,
|
|
882388
|
+
token,
|
|
882389
|
+
headers: this.context.headers
|
|
882390
|
+
});
|
|
882375
882391
|
switch (result.type) {
|
|
882376
882392
|
case "member":
|
|
882377
882393
|
this.context.stderr.info(` ${Icons.success} Organization "${organization}" found
|
|
@@ -882381,7 +882397,12 @@ var Wizard = class {
|
|
|
882381
882397
|
const taskContext = new TaskContextAdapter({ context: this.context });
|
|
882382
882398
|
const created = await withSpinner({
|
|
882383
882399
|
message: `Creating organization "${organization}"`,
|
|
882384
|
-
operation: () => createOrganizationIfDoesNotExist({
|
|
882400
|
+
operation: () => createOrganizationIfDoesNotExist({
|
|
882401
|
+
organization,
|
|
882402
|
+
token,
|
|
882403
|
+
context: taskContext,
|
|
882404
|
+
headers: this.context.headers
|
|
882405
|
+
}),
|
|
882385
882406
|
indent: 2
|
|
882386
882407
|
});
|
|
882387
882408
|
if (created) {
|
|
@@ -882984,7 +883005,8 @@ var CreateCommand = class {
|
|
|
882984
883005
|
operation: () => createOrganizationIfDoesNotExist({
|
|
882985
883006
|
organization: args.name,
|
|
882986
883007
|
token,
|
|
882987
|
-
context: new TaskContextAdapter({ context: context3 })
|
|
883008
|
+
context: new TaskContextAdapter({ context: context3 }),
|
|
883009
|
+
headers: context3.headers
|
|
882988
883010
|
})
|
|
882989
883011
|
});
|
|
882990
883012
|
if (created) {
|
|
@@ -883013,7 +883035,7 @@ var ListCommand = class {
|
|
|
883013
883035
|
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
883036
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883015
883037
|
}
|
|
883016
|
-
const venus = createVenusService({ token: token.value });
|
|
883038
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883017
883039
|
const firstPage = await this.fetchPage({ venus, pageId: 1 });
|
|
883018
883040
|
if (firstPage.organizations.length === 0) {
|
|
883019
883041
|
context3.stderr.info(`${Icons.info} You are not a member of any organizations.`);
|
|
@@ -883142,7 +883164,7 @@ var InviteMemberCommand = class {
|
|
|
883142
883164
|
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
883165
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883144
883166
|
}
|
|
883145
|
-
const venus = createVenusService({ token: token.value });
|
|
883167
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883146
883168
|
const orgLookup = await venus.organization.get(args.org);
|
|
883147
883169
|
if (!orgLookup.ok) {
|
|
883148
883170
|
orgLookup.error._visit({
|
|
@@ -883217,7 +883239,7 @@ var ListMembersCommand = class {
|
|
|
883217
883239
|
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
883240
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883219
883241
|
}
|
|
883220
|
-
const venus = createVenusService({ token: token.value });
|
|
883242
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883221
883243
|
const response = await withSpinner({
|
|
883222
883244
|
message: `Fetching members of organization "${args.org}"`,
|
|
883223
883245
|
operation: () => venus.organization.get(args.org)
|
|
@@ -883280,7 +883302,7 @@ var RemoveMemberCommand = class {
|
|
|
883280
883302
|
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
883303
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883282
883304
|
}
|
|
883283
|
-
const venus = createVenusService({ token: token.value });
|
|
883305
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883284
883306
|
const orgLookup = await venus.organization.get(args.org);
|
|
883285
883307
|
if (!orgLookup.ok) {
|
|
883286
883308
|
orgLookup.error._visit({
|
|
@@ -883366,7 +883388,7 @@ var CreateTokenCommand = class {
|
|
|
883366
883388
|
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
883389
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883368
883390
|
}
|
|
883369
|
-
const venus = createVenusService({ token: token.value });
|
|
883391
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883370
883392
|
const orgLookup = await venus.organization.get(args.org);
|
|
883371
883393
|
if (!orgLookup.ok) {
|
|
883372
883394
|
orgLookup.error._visit({
|
|
@@ -883446,7 +883468,7 @@ var ListTokensCommand = class {
|
|
|
883446
883468
|
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
883469
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883448
883470
|
}
|
|
883449
|
-
const venus = createVenusService({ token: token.value });
|
|
883471
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883450
883472
|
const orgLookup = await venus.organization.get(args.org);
|
|
883451
883473
|
if (!orgLookup.ok) {
|
|
883452
883474
|
orgLookup.error._visit({
|
|
@@ -883544,7 +883566,7 @@ var RevokeTokenCommand = class {
|
|
|
883544
883566
|
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
883567
|
throw new CliError({ code: CliError.Code.AuthError });
|
|
883546
883568
|
}
|
|
883547
|
-
const venus = createVenusService({ token: token.value });
|
|
883569
|
+
const venus = createVenusService({ token: token.value, headers: context3.headers });
|
|
883548
883570
|
const tokenId = args.tokenId;
|
|
883549
883571
|
const response = await withSpinner({
|
|
883550
883572
|
message: `Revoking token "${tokenId}"`,
|
|
@@ -955946,7 +955968,7 @@ function getAutomationContextFromEnv() {
|
|
|
955946
955968
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
955947
955969
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
955948
955970
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
955949
|
-
cli_version: "5.
|
|
955971
|
+
cli_version: "5.41.0"
|
|
955950
955972
|
};
|
|
955951
955973
|
}
|
|
955952
955974
|
function isAutomationMode() {
|
|
@@ -956772,7 +956794,7 @@ var CliContext = class _CliContext {
|
|
|
956772
956794
|
if (false) {
|
|
956773
956795
|
this.logger.error("CLI_VERSION is not defined");
|
|
956774
956796
|
}
|
|
956775
|
-
return "5.
|
|
956797
|
+
return "5.41.0";
|
|
956776
956798
|
}
|
|
956777
956799
|
getCliName() {
|
|
956778
956800
|
if (false) {
|
package/package.json
CHANGED