@fern-api/fern-api-dev 5.80.5 → 5.82.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.
Files changed (2) hide show
  1. package/cli.cjs +813 -61
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -62211,6 +62211,13 @@ var init_OAuthAccessTokenResponseProperties = __esm({
62211
62211
  }
62212
62212
  });
62213
62213
 
62214
+ // ../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthAuthorizationCode.js
62215
+ var init_OAuthAuthorizationCode = __esm({
62216
+ "../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthAuthorizationCode.js"() {
62217
+ "use strict";
62218
+ }
62219
+ });
62220
+
62214
62221
  // ../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthClientCredentials.js
62215
62222
  var init_OAuthClientCredentials = __esm({
62216
62223
  "../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthClientCredentials.js"() {
@@ -62234,10 +62241,107 @@ var init_OAuthConfiguration = __esm({
62234
62241
  }
62235
62242
  };
62236
62243
  },
62244
+ authorizationCode: (value2) => {
62245
+ return {
62246
+ ...value2,
62247
+ type: "authorizationCode",
62248
+ _visit: function(visitor) {
62249
+ return OAuthConfiguration._visit(this, visitor);
62250
+ }
62251
+ };
62252
+ },
62253
+ deviceCode: (value2) => {
62254
+ return {
62255
+ ...value2,
62256
+ type: "deviceCode",
62257
+ _visit: function(visitor) {
62258
+ return OAuthConfiguration._visit(this, visitor);
62259
+ }
62260
+ };
62261
+ },
62237
62262
  _visit: (value2, visitor) => {
62238
62263
  switch (value2.type) {
62239
62264
  case "clientCredentials":
62240
62265
  return visitor.clientCredentials(value2);
62266
+ case "authorizationCode":
62267
+ return visitor.authorizationCode(value2);
62268
+ case "deviceCode":
62269
+ return visitor.deviceCode(value2);
62270
+ default:
62271
+ return visitor._other(value2);
62272
+ }
62273
+ }
62274
+ };
62275
+ }
62276
+ });
62277
+
62278
+ // ../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthDeviceCode.js
62279
+ var init_OAuthDeviceCode = __esm({
62280
+ "../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthDeviceCode.js"() {
62281
+ "use strict";
62282
+ }
62283
+ });
62284
+
62285
+ // ../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthPkceConfiguration.js
62286
+ var init_OAuthPkceConfiguration = __esm({
62287
+ "../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthPkceConfiguration.js"() {
62288
+ "use strict";
62289
+ }
62290
+ });
62291
+
62292
+ // ../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthPkceMethod.js
62293
+ var OAuthPkceMethodValues, OAuthPkceMethod;
62294
+ var init_OAuthPkceMethod = __esm({
62295
+ "../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthPkceMethod.js"() {
62296
+ "use strict";
62297
+ OAuthPkceMethodValues = {
62298
+ S256: "S256"
62299
+ };
62300
+ OAuthPkceMethod = {
62301
+ ...OAuthPkceMethodValues,
62302
+ _visit: (value2, visitor) => {
62303
+ switch (value2) {
62304
+ case OAuthPkceMethod.S256:
62305
+ return visitor.s256();
62306
+ default:
62307
+ return visitor._other();
62308
+ }
62309
+ }
62310
+ };
62311
+ }
62312
+ });
62313
+
62314
+ // ../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthPublicClientId.js
62315
+ var OAuthPublicClientId;
62316
+ var init_OAuthPublicClientId = __esm({
62317
+ "../../ir-sdk/lib/sdk/api/resources/auth/types/OAuthPublicClientId.js"() {
62318
+ "use strict";
62319
+ init_api2();
62320
+ OAuthPublicClientId = {
62321
+ literal: (value2) => {
62322
+ return {
62323
+ value: value2,
62324
+ type: "literal",
62325
+ _visit: function(visitor) {
62326
+ return OAuthPublicClientId._visit(this, visitor);
62327
+ }
62328
+ };
62329
+ },
62330
+ environmentVariable: (value2) => {
62331
+ return {
62332
+ value: value2,
62333
+ type: "environmentVariable",
62334
+ _visit: function(visitor) {
62335
+ return OAuthPublicClientId._visit(this, visitor);
62336
+ }
62337
+ };
62338
+ },
62339
+ _visit: (value2, visitor) => {
62340
+ switch (value2.type) {
62341
+ case "literal":
62342
+ return visitor.literal(value2.value);
62343
+ case "environmentVariable":
62344
+ return visitor.environmentVariable(value2.value);
62241
62345
  default:
62242
62346
  return visitor._other(value2);
62243
62347
  }
@@ -62293,8 +62397,13 @@ var init_types43 = __esm({
62293
62397
  init_InferredAuthSchemeTokenEndpoint();
62294
62398
  init_OAuthAccessTokenRequestProperties();
62295
62399
  init_OAuthAccessTokenResponseProperties();
62400
+ init_OAuthAuthorizationCode();
62296
62401
  init_OAuthClientCredentials();
62297
62402
  init_OAuthConfiguration();
62403
+ init_OAuthDeviceCode();
62404
+ init_OAuthPkceConfiguration();
62405
+ init_OAuthPkceMethod();
62406
+ init_OAuthPublicClientId();
62298
62407
  init_OAuthRefreshEndpoint();
62299
62408
  init_OAuthRefreshTokenRequestProperties();
62300
62409
  init_OAuthScheme();
@@ -62307,7 +62416,9 @@ var auth_exports3 = {};
62307
62416
  __export(auth_exports3, {
62308
62417
  AuthScheme: () => AuthScheme,
62309
62418
  AuthSchemesRequirement: () => AuthSchemesRequirement,
62310
- OAuthConfiguration: () => OAuthConfiguration
62419
+ OAuthConfiguration: () => OAuthConfiguration,
62420
+ OAuthPkceMethod: () => OAuthPkceMethod,
62421
+ OAuthPublicClientId: () => OAuthPublicClientId
62311
62422
  });
62312
62423
  var init_auth4 = __esm({
62313
62424
  "../../ir-sdk/lib/sdk/api/resources/auth/index.js"() {
@@ -70875,6 +70986,8 @@ __export(api_exports, {
70875
70986
  NamedTypeDefault: () => NamedTypeDefault,
70876
70987
  NonStreamHttpResponseBody: () => NonStreamHttpResponseBody,
70877
70988
  OAuthConfiguration: () => OAuthConfiguration,
70989
+ OAuthPkceMethod: () => OAuthPkceMethod,
70990
+ OAuthPublicClientId: () => OAuthPublicClientId,
70878
70991
  ObjectPropertyAccess: () => ObjectPropertyAccess4,
70879
70992
  Pagination: () => Pagination2,
70880
70993
  PathParameterLocation: () => PathParameterLocation,
@@ -73465,6 +73578,85 @@ var init_InferredAuthScheme2 = __esm({
73465
73578
  }
73466
73579
  });
73467
73580
 
73581
+ // ../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthPkceMethod.js
73582
+ var OAuthPkceMethod2;
73583
+ var init_OAuthPkceMethod2 = __esm({
73584
+ "../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthPkceMethod.js"() {
73585
+ "use strict";
73586
+ init_core2();
73587
+ OAuthPkceMethod2 = schemas_exports3.enum_(["S256"]);
73588
+ }
73589
+ });
73590
+
73591
+ // ../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthPkceConfiguration.js
73592
+ var OAuthPkceConfiguration;
73593
+ var init_OAuthPkceConfiguration2 = __esm({
73594
+ "../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthPkceConfiguration.js"() {
73595
+ "use strict";
73596
+ init_core2();
73597
+ init_OAuthPkceMethod2();
73598
+ OAuthPkceConfiguration = schemas_exports3.objectWithoutOptionalProperties({
73599
+ method: OAuthPkceMethod2
73600
+ });
73601
+ }
73602
+ });
73603
+
73604
+ // ../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthPublicClientId.js
73605
+ var OAuthPublicClientId2;
73606
+ var init_OAuthPublicClientId2 = __esm({
73607
+ "../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthPublicClientId.js"() {
73608
+ "use strict";
73609
+ init_api2();
73610
+ init_core2();
73611
+ init_EnvironmentVariable3();
73612
+ OAuthPublicClientId2 = schemas_exports3.union("type", {
73613
+ literal: schemas_exports3.object({
73614
+ value: schemas_exports3.string()
73615
+ }),
73616
+ environmentVariable: schemas_exports3.object({
73617
+ value: EnvironmentVariable
73618
+ })
73619
+ }).transform({
73620
+ transform: (value2) => {
73621
+ switch (value2.type) {
73622
+ case "literal":
73623
+ return OAuthPublicClientId.literal(value2.value);
73624
+ case "environmentVariable":
73625
+ return OAuthPublicClientId.environmentVariable(value2.value);
73626
+ default:
73627
+ return value2;
73628
+ }
73629
+ },
73630
+ untransform: ({ _visit, ...value2 }) => value2
73631
+ });
73632
+ }
73633
+ });
73634
+
73635
+ // ../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthAuthorizationCode.js
73636
+ var OAuthAuthorizationCode;
73637
+ var init_OAuthAuthorizationCode2 = __esm({
73638
+ "../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthAuthorizationCode.js"() {
73639
+ "use strict";
73640
+ init_core2();
73641
+ init_OAuthPkceConfiguration2();
73642
+ init_OAuthPublicClientId2();
73643
+ OAuthAuthorizationCode = schemas_exports3.objectWithoutOptionalProperties({
73644
+ clientId: OAuthPublicClientId2,
73645
+ authorizationUrl: schemas_exports3.string(),
73646
+ tokenUrl: schemas_exports3.string(),
73647
+ refreshUrl: schemas_exports3.string().optional(),
73648
+ redirectUri: schemas_exports3.string().optional(),
73649
+ scopes: schemas_exports3.list(schemas_exports3.string()).optional(),
73650
+ pkce: OAuthPkceConfiguration,
73651
+ authorizationParameters: schemas_exports3.record(schemas_exports3.string(), schemas_exports3.string()).optional(),
73652
+ tokenParameters: schemas_exports3.record(schemas_exports3.string(), schemas_exports3.string()).optional(),
73653
+ refreshParameters: schemas_exports3.record(schemas_exports3.string(), schemas_exports3.string()).optional(),
73654
+ tokenHeader: schemas_exports3.string().optional(),
73655
+ tokenPrefix: schemas_exports3.string().optional()
73656
+ });
73657
+ }
73658
+ });
73659
+
73468
73660
  // ../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthAccessTokenResponseProperties.js
73469
73661
  var OAuthAccessTokenResponseProperties;
73470
73662
  var init_OAuthAccessTokenResponseProperties2 = __esm({
@@ -73660,6 +73852,28 @@ var init_OAuthClientCredentials2 = __esm({
73660
73852
  }
73661
73853
  });
73662
73854
 
73855
+ // ../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthDeviceCode.js
73856
+ var OAuthDeviceCode;
73857
+ var init_OAuthDeviceCode2 = __esm({
73858
+ "../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthDeviceCode.js"() {
73859
+ "use strict";
73860
+ init_core2();
73861
+ init_OAuthPublicClientId2();
73862
+ OAuthDeviceCode = schemas_exports3.objectWithoutOptionalProperties({
73863
+ clientId: OAuthPublicClientId2,
73864
+ deviceAuthorizationUrl: schemas_exports3.string(),
73865
+ tokenUrl: schemas_exports3.string(),
73866
+ refreshUrl: schemas_exports3.string().optional(),
73867
+ scopes: schemas_exports3.list(schemas_exports3.string()).optional(),
73868
+ deviceAuthorizationParameters: schemas_exports3.record(schemas_exports3.string(), schemas_exports3.string()).optional(),
73869
+ tokenParameters: schemas_exports3.record(schemas_exports3.string(), schemas_exports3.string()).optional(),
73870
+ refreshParameters: schemas_exports3.record(schemas_exports3.string(), schemas_exports3.string()).optional(),
73871
+ tokenHeader: schemas_exports3.string().optional(),
73872
+ tokenPrefix: schemas_exports3.string().optional()
73873
+ });
73874
+ }
73875
+ });
73876
+
73663
73877
  // ../../ir-sdk/lib/sdk/serialization/resources/auth/types/OAuthConfiguration.js
73664
73878
  var OAuthConfiguration2;
73665
73879
  var init_OAuthConfiguration2 = __esm({
@@ -73667,14 +73881,22 @@ var init_OAuthConfiguration2 = __esm({
73667
73881
  "use strict";
73668
73882
  init_api2();
73669
73883
  init_core2();
73884
+ init_OAuthAuthorizationCode2();
73670
73885
  init_OAuthClientCredentials2();
73886
+ init_OAuthDeviceCode2();
73671
73887
  OAuthConfiguration2 = schemas_exports3.union("type", {
73672
- clientCredentials: OAuthClientCredentials
73888
+ clientCredentials: OAuthClientCredentials,
73889
+ authorizationCode: OAuthAuthorizationCode,
73890
+ deviceCode: OAuthDeviceCode
73673
73891
  }).transform({
73674
73892
  transform: (value2) => {
73675
73893
  switch (value2.type) {
73676
73894
  case "clientCredentials":
73677
73895
  return OAuthConfiguration.clientCredentials(value2);
73896
+ case "authorizationCode":
73897
+ return OAuthConfiguration.authorizationCode(value2);
73898
+ case "deviceCode":
73899
+ return OAuthConfiguration.deviceCode(value2);
73678
73900
  default:
73679
73901
  return value2;
73680
73902
  }
@@ -73793,8 +74015,13 @@ var init_types72 = __esm({
73793
74015
  init_InferredAuthSchemeTokenEndpoint2();
73794
74016
  init_OAuthAccessTokenRequestProperties2();
73795
74017
  init_OAuthAccessTokenResponseProperties2();
74018
+ init_OAuthAuthorizationCode2();
73796
74019
  init_OAuthClientCredentials2();
73797
74020
  init_OAuthConfiguration2();
74021
+ init_OAuthDeviceCode2();
74022
+ init_OAuthPkceConfiguration2();
74023
+ init_OAuthPkceMethod2();
74024
+ init_OAuthPublicClientId2();
73798
74025
  init_OAuthRefreshEndpoint2();
73799
74026
  init_OAuthRefreshTokenRequestProperties2();
73800
74027
  init_OAuthScheme2();
@@ -73820,8 +74047,13 @@ __export(auth_exports5, {
73820
74047
  InferredAuthenticatedRequestHeader: () => InferredAuthenticatedRequestHeader2,
73821
74048
  OAuthAccessTokenRequestProperties: () => OAuthAccessTokenRequestProperties,
73822
74049
  OAuthAccessTokenResponseProperties: () => OAuthAccessTokenResponseProperties,
74050
+ OAuthAuthorizationCode: () => OAuthAuthorizationCode,
73823
74051
  OAuthClientCredentials: () => OAuthClientCredentials,
73824
74052
  OAuthConfiguration: () => OAuthConfiguration2,
74053
+ OAuthDeviceCode: () => OAuthDeviceCode,
74054
+ OAuthPkceConfiguration: () => OAuthPkceConfiguration,
74055
+ OAuthPkceMethod: () => OAuthPkceMethod2,
74056
+ OAuthPublicClientId: () => OAuthPublicClientId2,
73825
74057
  OAuthRefreshEndpoint: () => OAuthRefreshEndpoint,
73826
74058
  OAuthRefreshTokenRequestProperties: () => OAuthRefreshTokenRequestProperties,
73827
74059
  OAuthScheme: () => OAuthScheme,
@@ -83277,8 +83509,13 @@ __export(serialization_exports2, {
83277
83509
  NugetPublishTarget: () => NugetPublishTarget,
83278
83510
  OAuthAccessTokenRequestProperties: () => OAuthAccessTokenRequestProperties,
83279
83511
  OAuthAccessTokenResponseProperties: () => OAuthAccessTokenResponseProperties,
83512
+ OAuthAuthorizationCode: () => OAuthAuthorizationCode,
83280
83513
  OAuthClientCredentials: () => OAuthClientCredentials,
83281
83514
  OAuthConfiguration: () => OAuthConfiguration2,
83515
+ OAuthDeviceCode: () => OAuthDeviceCode,
83516
+ OAuthPkceConfiguration: () => OAuthPkceConfiguration,
83517
+ OAuthPkceMethod: () => OAuthPkceMethod2,
83518
+ OAuthPublicClientId: () => OAuthPublicClientId2,
83282
83519
  OAuthRefreshEndpoint: () => OAuthRefreshEndpoint,
83283
83520
  OAuthRefreshTokenRequestProperties: () => OAuthRefreshTokenRequestProperties,
83284
83521
  OAuthScheme: () => OAuthScheme,
@@ -102149,6 +102386,7 @@ var init_latest_version = __esm({
102149
102386
  "../../../node_modules/.pnpm/latest-version@9.0.0/node_modules/latest-version/index.js"() {
102150
102387
  "use strict";
102151
102388
  init_package_json();
102389
+ init_package_json();
102152
102390
  }
102153
102391
  });
102154
102392
 
@@ -273887,6 +274125,9 @@ var init_DynamicSnippetsConverter = __esm({
273887
274125
  }
273888
274126
  getOAuthCustomProperties(scheme) {
273889
274127
  const parameters2 = [];
274128
+ if (scheme.configuration.type !== "clientCredentials") {
274129
+ return parameters2;
274130
+ }
273890
274131
  const customProperties = scheme.configuration.tokenEndpoint.requestProperties.customProperties ?? [];
273891
274132
  for (const customProperty of customProperties) {
273892
274133
  if (isExcludedOAuthProperty(customProperty.property.valueType)) {
@@ -273912,6 +274153,9 @@ var init_DynamicSnippetsConverter = __esm({
273912
274153
  }
273913
274154
  getOAuthCustomPropertyValues(scheme) {
273914
274155
  const values2 = {};
274156
+ if (scheme.configuration.type !== "clientCredentials") {
274157
+ return values2;
274158
+ }
273915
274159
  const customProperties = scheme.configuration.tokenEndpoint.requestProperties.customProperties ?? [];
273916
274160
  for (const customProperty of customProperties) {
273917
274161
  if (isExcludedOAuthProperty(customProperty.property.valueType)) {
@@ -311563,23 +311807,6 @@ var init_lib26 = __esm({
311563
311807
  }
311564
311808
  });
311565
311809
 
311566
- // ../../../node_modules/.pnpm/semver-diff@4.0.0/node_modules/semver-diff/index.js
311567
- function semverDiff(versionA, versionB) {
311568
- versionA = import_semver11.default.parse(versionA);
311569
- versionB = import_semver11.default.parse(versionB);
311570
- if (import_semver11.default.compareBuild(versionA, versionB) >= 0) {
311571
- return;
311572
- }
311573
- return import_semver11.default.diff(versionA, versionB) || "build";
311574
- }
311575
- var import_semver11;
311576
- var init_semver_diff = __esm({
311577
- "../../../node_modules/.pnpm/semver-diff@4.0.0/node_modules/semver-diff/index.js"() {
311578
- "use strict";
311579
- import_semver11 = __toESM(require_semver2(), 1);
311580
- }
311581
- });
311582
-
311583
311810
  // ../semver-utils/lib/parseVersion.js
311584
311811
  function parseVersion(versionString) {
311585
311812
  const alphaMatch = versionString.match(ALPHA_VERSION_REGEX);
@@ -311715,6 +311942,39 @@ var init_parseVersion = __esm({
311715
311942
  }
311716
311943
  });
311717
311944
 
311945
+ // ../semver-utils/lib/isValidVersion.js
311946
+ function isValidVersion(versionString) {
311947
+ try {
311948
+ parseVersion(versionString);
311949
+ return true;
311950
+ } catch {
311951
+ return false;
311952
+ }
311953
+ }
311954
+ var init_isValidVersion = __esm({
311955
+ "../semver-utils/lib/isValidVersion.js"() {
311956
+ "use strict";
311957
+ init_parseVersion();
311958
+ }
311959
+ });
311960
+
311961
+ // ../../../node_modules/.pnpm/semver-diff@4.0.0/node_modules/semver-diff/index.js
311962
+ function semverDiff(versionA, versionB) {
311963
+ versionA = import_semver11.default.parse(versionA);
311964
+ versionB = import_semver11.default.parse(versionB);
311965
+ if (import_semver11.default.compareBuild(versionA, versionB) >= 0) {
311966
+ return;
311967
+ }
311968
+ return import_semver11.default.diff(versionA, versionB) || "build";
311969
+ }
311970
+ var import_semver11;
311971
+ var init_semver_diff = __esm({
311972
+ "../../../node_modules/.pnpm/semver-diff@4.0.0/node_modules/semver-diff/index.js"() {
311973
+ "use strict";
311974
+ import_semver11 = __toESM(require_semver2(), 1);
311975
+ }
311976
+ });
311977
+
311718
311978
  // ../semver-utils/lib/isVersionAhead.js
311719
311979
  function isVersionAhead(a3, b5) {
311720
311980
  if (a3 === b5) {
@@ -311803,6 +312063,7 @@ var init_isVersionAhead = __esm({
311803
312063
  var init_lib27 = __esm({
311804
312064
  "../semver-utils/lib/index.js"() {
311805
312065
  "use strict";
312066
+ init_isValidVersion();
311806
312067
  init_isVersionAhead();
311807
312068
  init_parseVersion();
311808
312069
  }
@@ -460271,17 +460532,25 @@ function convertAuthScheme2({ scheme, playgroundConfig, context: context3 }) {
460271
460532
  description: scheme.docs
460272
460533
  };
460273
460534
  case "oauth": {
460274
- const tokenPath = scheme.configuration.tokenEndpoint.responseProperties.accessToken.propertyPath?.map((p6) => getOriginalName(p6.name)).join(".") || "$.body.access_token";
460535
+ const configuration2 = scheme.configuration;
460536
+ if (configuration2.type !== "clientCredentials") {
460537
+ return {
460538
+ type: "bearerAuth",
460539
+ tokenName: "token",
460540
+ description: scheme.docs
460541
+ };
460542
+ }
460543
+ const tokenPath = configuration2.tokenEndpoint.responseProperties.accessToken.propertyPath?.map((p6) => getOriginalName(p6.name)).join(".") || "$.body.access_token";
460275
460544
  return playgroundConfig?.oauth ? {
460276
460545
  type: "oAuth",
460277
460546
  value: {
460278
460547
  type: "clientCredentials",
460279
460548
  value: {
460280
460549
  type: "referencedEndpoint",
460281
- endpointId: FdrAPI_exports.EndpointId(scheme.configuration.tokenEndpoint.endpointReference.endpointId),
460550
+ endpointId: FdrAPI_exports.EndpointId(configuration2.tokenEndpoint.endpointReference.endpointId),
460282
460551
  accessTokenLocator: tokenPath,
460283
- headerName: scheme.configuration.tokenHeader,
460284
- tokenPrefix: scheme.configuration.tokenPrefix,
460552
+ headerName: configuration2.tokenHeader,
460553
+ tokenPrefix: configuration2.tokenPrefix,
460285
460554
  description: scheme.docs
460286
460555
  }
460287
460556
  }
@@ -691755,7 +692024,7 @@ var AccessTokenPosthogManager = class {
691755
692024
  properties: {
691756
692025
  ...event,
691757
692026
  ...event.properties,
691758
- version: "5.80.5",
692027
+ version: "5.82.0",
691759
692028
  usingAccessToken: true,
691760
692029
  ...getRunIdProperties()
691761
692030
  }
@@ -691821,7 +692090,7 @@ var UserPosthogManager = class {
691821
692090
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
691822
692091
  event: "CLI",
691823
692092
  properties: {
691824
- version: "5.80.5",
692093
+ version: "5.82.0",
691825
692094
  ...event,
691826
692095
  ...event.properties,
691827
692096
  usingAccessToken: false,
@@ -872927,7 +873196,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
872927
873196
  var LOGS_FOLDER_NAME = "logs";
872928
873197
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
872929
873198
  function getCliSource() {
872930
- const version7 = "5.80.5";
873199
+ const version7 = "5.82.0";
872931
873200
  return `cli@${version7}`;
872932
873201
  }
872933
873202
  var DebugLogger = class {
@@ -905623,7 +905892,7 @@ var LegacyDocsPublisher = class {
905623
905892
  previewId,
905624
905893
  disableTemplates: void 0,
905625
905894
  skipUpload,
905626
- cliVersion: "5.80.5",
905895
+ cliVersion: "5.82.0",
905627
905896
  loginCommand: "fern auth login"
905628
905897
  });
905629
905898
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -972488,7 +972757,7 @@ function getAutomationContextFromEnv() {
972488
972757
  config_branch: process.env.FERN_CONFIG_BRANCH,
972489
972758
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
972490
972759
  trigger: process.env.GITHUB_EVENT_NAME,
972491
- cli_version: "5.80.5"
972760
+ cli_version: "5.82.0"
972492
972761
  };
972493
972762
  }
972494
972763
  function isAutomationMode() {
@@ -973320,7 +973589,7 @@ var CliContext = class _CliContext {
973320
973589
  if (false) {
973321
973590
  this.logger.error("CLI_VERSION is not defined");
973322
973591
  }
973323
- return "5.80.5";
973592
+ return "5.82.0";
973324
973593
  }
973325
973594
  getCliName() {
973326
973595
  if (false) {
@@ -980709,6 +980978,341 @@ async function rerunFernCliAtVersion({
980709
980978
  }
980710
980979
  }
980711
980980
 
980981
+ // src/commands/org/orgConfig.ts
980982
+ init_lib19();
980983
+ init_lib27();
980984
+ init_lib6();
980985
+ init_source();
980986
+ init_latest_version();
980987
+
980988
+ // src/commands/docs-theme/themeOrigin.ts
980989
+ var FDR_ORIGIN = process.env.OVERRIDE_FDR_ORIGIN ?? "https://registry-dev2.buildwithfern.com" ?? "https://registry.buildwithfern.com";
980990
+ function describeFetchError(error50) {
980991
+ if (!(error50 instanceof Error)) {
980992
+ return String(error50);
980993
+ }
980994
+ const cause = error50.cause;
980995
+ if (cause instanceof Error) {
980996
+ return cause.message;
980997
+ }
980998
+ return error50.message;
980999
+ }
981000
+ function parseErrorDetail(body) {
981001
+ try {
981002
+ const parsed = JSON.parse(body);
981003
+ const message = parsed.message ?? parsed.error?.message;
981004
+ if (typeof message === "string") {
981005
+ return message;
981006
+ }
981007
+ } catch {
981008
+ }
981009
+ return void 0;
981010
+ }
981011
+
981012
+ // src/commands/org/orgConfig.ts
981013
+ function clampVersionToOrgBounds(intendedVersion, { min, max }) {
981014
+ const isPinned = min != null && max != null && min === max;
981015
+ if (min != null && isVersionAhead(min, intendedVersion)) {
981016
+ return { version: min, reason: isPinned ? "pin" : "floor" };
981017
+ }
981018
+ if (max != null && isVersionAhead(intendedVersion, max)) {
981019
+ return { version: max, reason: isPinned ? "pin" : "ceiling" };
981020
+ }
981021
+ return { version: intendedVersion };
981022
+ }
981023
+ async function getAuthToken(cliContext) {
981024
+ const token = await cliContext.runTask(async (context3) => {
981025
+ return askToLogin(context3);
981026
+ });
981027
+ if (token == null) {
981028
+ return cliContext.failAndThrow("Failed to authenticate. Please run 'fern login' first.", void 0, {
981029
+ code: CliError.Code.AuthError
981030
+ });
981031
+ }
981032
+ return token;
981033
+ }
981034
+ async function resolveOrgId(cliContext, orgOverride) {
981035
+ if (orgOverride != null) {
981036
+ return orgOverride;
981037
+ }
981038
+ const fernDirectory = await getFernDirectory();
981039
+ if (fernDirectory == null) {
981040
+ return cliContext.failAndThrow(
981041
+ `Directory "${FERN_DIRECTORY}" not found. Run from a Fern project or pass --org.`,
981042
+ void 0,
981043
+ { code: CliError.Code.ConfigError }
981044
+ );
981045
+ }
981046
+ const projectConfig = await cliContext.runTask(
981047
+ (context3) => loadProjectConfig({ directory: fernDirectory, context: context3 })
981048
+ );
981049
+ return projectConfig.organization;
981050
+ }
981051
+ async function orgConfigRequest(context3, orgId, init3, actionLabel) {
981052
+ let res;
981053
+ try {
981054
+ res = await fetch(`${FDR_ORIGIN}/v2/registry/org-config/${orgId}`, init3);
981055
+ } catch (err) {
981056
+ return context3.failAndThrow(`Failed to reach FDR: ${describeFetchError(err)}`, void 0, {
981057
+ code: CliError.Code.NetworkError
981058
+ });
981059
+ }
981060
+ if (!res.ok) {
981061
+ const body = await res.text();
981062
+ const detail = parseErrorDetail(body) ?? body;
981063
+ return context3.failAndThrow(`Failed to ${actionLabel}: HTTP ${res.status} \u2014 ${detail}`, void 0, {
981064
+ code: CliError.Code.NetworkError
981065
+ });
981066
+ }
981067
+ return res;
981068
+ }
981069
+ async function getOrgConfig({
981070
+ cliContext,
981071
+ org,
981072
+ json: json2
981073
+ }) {
981074
+ const token = await getAuthToken(cliContext);
981075
+ const orgId = await resolveOrgId(cliContext, org);
981076
+ await cliContext.runTask(async (context3) => {
981077
+ const res = await orgConfigRequest(
981078
+ context3,
981079
+ orgId,
981080
+ { headers: { Authorization: `Bearer ${token.value}` } },
981081
+ "get org config"
981082
+ );
981083
+ const data2 = await res.json();
981084
+ if (json2) {
981085
+ process.stdout.write(JSON.stringify(data2, null, 2) + "\n");
981086
+ return;
981087
+ }
981088
+ if (data2.cliVersionMin == null && data2.cliVersionMax == null) {
981089
+ context3.logger.info(`No org-level CLI config set for "${orgId}".`);
981090
+ return;
981091
+ }
981092
+ const { cliVersionMin, cliVersionMax } = data2;
981093
+ if (cliVersionMin != null && cliVersionMin === cliVersionMax) {
981094
+ context3.logger.info(`Fern CLI pinned to ${source_default.green(cliVersionMin)}`);
981095
+ } else if (cliVersionMin != null && cliVersionMax != null) {
981096
+ context3.logger.info(
981097
+ `Fern CLI must be between ${source_default.green(cliVersionMin)} and ${source_default.green(cliVersionMax)}`
981098
+ );
981099
+ } else if (cliVersionMin != null) {
981100
+ context3.logger.info(`Fern CLI must be at least ${source_default.green(cliVersionMin)}`);
981101
+ } else if (cliVersionMax != null) {
981102
+ context3.logger.info(`Fern CLI must be at most ${source_default.green(cliVersionMax)}`);
981103
+ }
981104
+ });
981105
+ }
981106
+ var FERN_CLI_PACKAGE_NAME = "fern-api";
981107
+ async function assertCliVersionIsPublished(cliContext, version7) {
981108
+ try {
981109
+ await latestVersion(FERN_CLI_PACKAGE_NAME, { version: version7 });
981110
+ } catch (err) {
981111
+ if (err instanceof VersionNotFoundError) {
981112
+ cliContext.failAndThrow(
981113
+ `Fern CLI version "${version7}" was not found on npm. Set a published version \u2014 see https://www.npmjs.com/package/${FERN_CLI_PACKAGE_NAME}?activeTab=versions.`,
981114
+ void 0,
981115
+ { code: CliError.Code.ConfigError }
981116
+ );
981117
+ return;
981118
+ }
981119
+ cliContext.logger.debug(`Could not verify Fern CLI version "${version7}" exists on npm: ${String(err)}`);
981120
+ }
981121
+ }
981122
+ async function setOrgCliVersion({
981123
+ cliContext,
981124
+ min,
981125
+ max,
981126
+ org
981127
+ }) {
981128
+ for (const version7 of [min, max]) {
981129
+ if (version7 != null && !isValidVersion(version7)) {
981130
+ cliContext.failAndThrow(
981131
+ `"${version7}" isn't a valid version. Pass an exact published version like 5.45.0 (or a prerelease like 5.45.0-rc0) \u2014 see https://www.npmjs.com/package/${FERN_CLI_PACKAGE_NAME}?activeTab=versions.`,
981132
+ void 0,
981133
+ { code: CliError.Code.ConfigError }
981134
+ );
981135
+ return;
981136
+ }
981137
+ }
981138
+ if (min != null && max != null && isVersionAhead(min, max)) {
981139
+ cliContext.failAndThrow(`Minimum version ${min} must not be greater than maximum version ${max}.`, void 0, {
981140
+ code: CliError.Code.ConfigError
981141
+ });
981142
+ return;
981143
+ }
981144
+ for (const version7 of [min, max]) {
981145
+ if (version7 != null) {
981146
+ await assertCliVersionIsPublished(cliContext, version7);
981147
+ }
981148
+ }
981149
+ const token = await getAuthToken(cliContext);
981150
+ const orgId = await resolveOrgId(cliContext, org);
981151
+ const requestBody = {};
981152
+ if (min != null) {
981153
+ requestBody.cliVersionMin = min;
981154
+ }
981155
+ if (max != null) {
981156
+ requestBody.cliVersionMax = max;
981157
+ }
981158
+ await cliContext.runTask(async (context3) => {
981159
+ await orgConfigRequest(
981160
+ context3,
981161
+ orgId,
981162
+ {
981163
+ method: "PUT",
981164
+ headers: {
981165
+ Authorization: `Bearer ${token.value}`,
981166
+ "Content-Type": "application/json"
981167
+ },
981168
+ body: JSON.stringify(requestBody)
981169
+ },
981170
+ "set org config"
981171
+ );
981172
+ if (min != null && max != null && min === max) {
981173
+ context3.logger.info(`Pinned CLI version to ${source_default.green(min)} for org "${orgId}".`);
981174
+ } else if (min != null && max != null) {
981175
+ context3.logger.info(`Set CLI version range to ${source_default.green(`${min} \u2013 ${max}`)} for org "${orgId}".`);
981176
+ } else if (min != null) {
981177
+ context3.logger.info(`Set minimum CLI version to ${source_default.green(min)} for org "${orgId}".`);
981178
+ } else if (max != null) {
981179
+ context3.logger.info(`Set maximum CLI version to ${source_default.green(max)} for org "${orgId}".`);
981180
+ }
981181
+ });
981182
+ }
981183
+ async function unsetOrgCliVersion({
981184
+ cliContext,
981185
+ org,
981186
+ field: field5
981187
+ }) {
981188
+ const token = await getAuthToken(cliContext);
981189
+ const orgId = await resolveOrgId(cliContext, org);
981190
+ await cliContext.runTask(async (context3) => {
981191
+ const init3 = field5 === "all" ? { method: "DELETE", headers: { Authorization: `Bearer ${token.value}` } } : {
981192
+ method: "PUT",
981193
+ headers: {
981194
+ Authorization: `Bearer ${token.value}`,
981195
+ "Content-Type": "application/json"
981196
+ },
981197
+ body: JSON.stringify(field5 === "min" ? { cliVersionMin: null } : { cliVersionMax: null })
981198
+ };
981199
+ await orgConfigRequest(context3, orgId, init3, "unset org config");
981200
+ const label = field5 === "min" ? "minimum" : field5 === "max" ? "maximum" : "minimum and maximum";
981201
+ context3.logger.info(`Removed ${label} CLI version for org "${orgId}".`);
981202
+ });
981203
+ }
981204
+ function sanitizeBound(version7) {
981205
+ return version7 != null && isValidVersion(version7) ? version7 : void 0;
981206
+ }
981207
+ async function fetchOrgCliVersionBounds({
981208
+ cliContext,
981209
+ orgId,
981210
+ token,
981211
+ timeoutMs
981212
+ }) {
981213
+ try {
981214
+ const res = await fetch(`${FDR_ORIGIN}/v2/registry/org-config/${orgId}`, {
981215
+ headers: { Authorization: `Bearer ${token}` },
981216
+ signal: timeoutMs != null ? AbortSignal.timeout(timeoutMs) : void 0
981217
+ });
981218
+ if (!res.ok) {
981219
+ cliContext.logger.debug(`Failed to fetch org config: HTTP ${res.status}`);
981220
+ return { ok: false };
981221
+ }
981222
+ const data2 = await res.json();
981223
+ return {
981224
+ ok: true,
981225
+ bounds: { min: sanitizeBound(data2.cliVersionMin), max: sanitizeBound(data2.cliVersionMax) }
981226
+ };
981227
+ } catch (err) {
981228
+ cliContext.logger.debug(`Failed to fetch org config: ${describeFetchError(err)}`);
981229
+ return { ok: false };
981230
+ }
981231
+ }
981232
+ var ORG_BOUNDS_FETCH_TIMEOUT_MS = 2500;
981233
+ async function getOrgCliVersionBounds({
981234
+ cliContext,
981235
+ orgId
981236
+ }) {
981237
+ if (process.env.FERN_IGNORE_ORG_VERSION_BOUNDS === "true" || process.env.FERN_IGNORE_ORG_VERSION_FLOOR === "true") {
981238
+ return {};
981239
+ }
981240
+ try {
981241
+ const token = await getToken2();
981242
+ if (token == null) {
981243
+ return {};
981244
+ }
981245
+ const result = await fetchOrgCliVersionBounds({
981246
+ cliContext,
981247
+ orgId,
981248
+ token: token.value,
981249
+ timeoutMs: ORG_BOUNDS_FETCH_TIMEOUT_MS
981250
+ });
981251
+ if (!result.ok) {
981252
+ return {};
981253
+ }
981254
+ return result.bounds;
981255
+ } catch (err) {
981256
+ cliContext.logger.debug(`Failed to resolve org CLI version bounds: ${String(err)}`);
981257
+ return {};
981258
+ }
981259
+ }
981260
+ async function resolveClampedVersionForOrg({
981261
+ cliContext,
981262
+ orgId,
981263
+ version: version7
981264
+ }) {
981265
+ const bounds = await getOrgCliVersionBounds({ cliContext, orgId });
981266
+ try {
981267
+ return { ...clampVersionToOrgBounds(version7, bounds), bounds };
981268
+ } catch {
981269
+ return { version: version7, bounds };
981270
+ }
981271
+ }
981272
+ function describeOrgBounds(orgId, { min, max }, color3) {
981273
+ if (min != null && max != null && min === max) {
981274
+ return `Org "${orgId}" pins Fern CLI to ${color3(min)}`;
981275
+ }
981276
+ if (min != null && max != null) {
981277
+ return `Org "${orgId}" requires Fern CLI between ${color3(min)} and ${color3(max)}`;
981278
+ }
981279
+ if (min != null) {
981280
+ return `Org "${orgId}" requires Fern CLI ${color3(`>= ${min}`)}`;
981281
+ }
981282
+ if (max != null) {
981283
+ return `Org "${orgId}" caps Fern CLI at ${color3(`<= ${max}`)}`;
981284
+ }
981285
+ return `Org "${orgId}"`;
981286
+ }
981287
+ async function applyOrgBoundsToVersion({
981288
+ cliContext,
981289
+ orgId,
981290
+ intendedVersion
981291
+ }) {
981292
+ const { version: version7, reason, bounds } = await resolveClampedVersionForOrg({
981293
+ cliContext,
981294
+ orgId,
981295
+ version: intendedVersion
981296
+ });
981297
+ if (reason != null) {
981298
+ cliContext.logger.info(`${describeOrgBounds(orgId, bounds, source_default.green)} \u2014 running ${source_default.green(version7)}.`);
981299
+ }
981300
+ return version7;
981301
+ }
981302
+ async function warnIfVersionOutsideOrgBounds({
981303
+ cliContext,
981304
+ orgId,
981305
+ currentVersion
981306
+ }) {
981307
+ const { reason, bounds } = await resolveClampedVersionForOrg({ cliContext, orgId, version: currentVersion });
981308
+ if (reason != null) {
981309
+ const suffix = reason === "ceiling" ? "was not downgraded" : reason === "floor" ? "was not upgraded" : "was not changed";
981310
+ cliContext.logger.warn(
981311
+ `${describeOrgBounds(orgId, bounds, source_default.yellow)}, but this CLI is ${source_default.yellow(currentVersion)}. Version redirection is disabled, so it ${suffix}.`
981312
+ );
981313
+ }
981314
+ }
981315
+
980712
981316
  // src/commands/upgrade/upgrade.ts
980713
981317
  var PREVIOUS_VERSION_ENV_VAR = "FERN_PRE_UPGRADE_VERSION";
980714
981318
  function ensureFinalNewline(content5) {
@@ -980939,6 +981543,19 @@ async function upgrade({
980939
981543
  }
980940
981544
  }
980941
981545
  }
981546
+ if (resolvedTargetVersion == null) {
981547
+ cliContext.logger.info("No upgrade available.");
981548
+ return;
981549
+ }
981550
+ if (!isLocalDev) {
981551
+ try {
981552
+ resolvedTargetVersion = await applyOrgVersionBounds({
981553
+ cliContext,
981554
+ resolvedTargetVersion
981555
+ });
981556
+ } catch {
981557
+ }
981558
+ }
980942
981559
  if (cliContext.environment.packageVersion === resolvedTargetVersion || isLocalDev) {
980943
981560
  const fernDirectory2 = await getFernDirectory();
980944
981561
  if (fernDirectory2 == null) {
@@ -981036,6 +981653,56 @@ async function upgrade({
981036
981653
  throw error50;
981037
981654
  }
981038
981655
  }
981656
+ async function applyOrgVersionBounds({
981657
+ cliContext,
981658
+ resolvedTargetVersion
981659
+ }) {
981660
+ const fernDirectory = await getFernDirectory();
981661
+ if (fernDirectory == null) {
981662
+ return resolvedTargetVersion;
981663
+ }
981664
+ let orgId;
981665
+ try {
981666
+ const projectConfig = await cliContext.runTask(
981667
+ (context3) => loadProjectConfig({ directory: fernDirectory, context: context3 })
981668
+ );
981669
+ orgId = projectConfig.organization;
981670
+ } catch {
981671
+ return resolvedTargetVersion;
981672
+ }
981673
+ const token = await getToken2();
981674
+ if (token == null) {
981675
+ return resolvedTargetVersion;
981676
+ }
981677
+ const result = await fetchOrgCliVersionBounds({
981678
+ cliContext,
981679
+ orgId,
981680
+ token: token.value,
981681
+ timeoutMs: ORG_BOUNDS_FETCH_TIMEOUT_MS
981682
+ });
981683
+ if (!result.ok) {
981684
+ return resolvedTargetVersion;
981685
+ }
981686
+ const { min, max } = result.bounds;
981687
+ if (min == null && max == null) {
981688
+ return resolvedTargetVersion;
981689
+ }
981690
+ try {
981691
+ const { version: version7, reason } = clampVersionToOrgBounds(resolvedTargetVersion, { min, max });
981692
+ if (reason === "floor") {
981693
+ cliContext.logger.info(
981694
+ `Org "${orgId}" requires minimum CLI version ${source_default.green(version7)} (resolved ${resolvedTargetVersion}).`
981695
+ );
981696
+ } else if (reason === "ceiling") {
981697
+ cliContext.logger.info(
981698
+ `Org "${orgId}" caps CLI version at ${source_default.green(version7)} (resolved ${resolvedTargetVersion}).`
981699
+ );
981700
+ }
981701
+ return version7;
981702
+ } catch {
981703
+ return resolvedTargetVersion;
981704
+ }
981705
+ }
981039
981706
 
981040
981707
  // src/commands/automations/upgrade/executeAutomationsUpgrade.ts
981041
981708
  var CHANGELOG_BASE2 = "https://buildwithfern.com/learn/sdks/generators";
@@ -982280,32 +982947,6 @@ Found ${previewDeployments.length} preview deployment(s):
982280
982947
  // src/commands/docs-theme/deleteDocsTheme.ts
982281
982948
  var import_node_readline6 = require("readline");
982282
982949
  init_lib6();
982283
-
982284
- // src/commands/docs-theme/themeOrigin.ts
982285
- var FDR_ORIGIN = process.env.OVERRIDE_FDR_ORIGIN ?? "https://registry-dev2.buildwithfern.com" ?? "https://registry.buildwithfern.com";
982286
- function describeFetchError(error50) {
982287
- if (!(error50 instanceof Error)) {
982288
- return String(error50);
982289
- }
982290
- const cause = error50.cause;
982291
- if (cause instanceof Error) {
982292
- return cause.message;
982293
- }
982294
- return error50.message;
982295
- }
982296
- function parseErrorDetail(body) {
982297
- try {
982298
- const parsed = JSON.parse(body);
982299
- const message = parsed.message ?? parsed.error?.message;
982300
- if (typeof message === "string") {
982301
- return message;
982302
- }
982303
- } catch {
982304
- }
982305
- return void 0;
982306
- }
982307
-
982308
- // src/commands/docs-theme/deleteDocsTheme.ts
982309
982950
  async function confirmDeletion(themeName) {
982310
982951
  const rl = (0, import_node_readline6.createInterface)({ input: process.stdin, output: process.stderr });
982311
982952
  return new Promise((resolve15) => {
@@ -988780,6 +989421,31 @@ function installProcessHandlers(cliContext, { isLocal }) {
988780
989421
  });
988781
989422
  }
988782
989423
 
989424
+ // src/utils/versionRedirection.ts
989425
+ init_helpers();
989426
+ var VERSION_REDIRECTION_EXEMPT_COMMANDS = /* @__PURE__ */ new Set(["org"]);
989427
+ function isVersionRedirectionExempt(argv) {
989428
+ const command3 = getInvokedCommandName(argv);
989429
+ return command3 != null && VERSION_REDIRECTION_EXEMPT_COMMANDS.has(command3);
989430
+ }
989431
+ function getInvokedCommandName(argv) {
989432
+ const args = hideBin(argv);
989433
+ for (let i5 = 0; i5 < args.length; i5++) {
989434
+ const arg = args[i5];
989435
+ if (arg == null) {
989436
+ continue;
989437
+ }
989438
+ if (arg.startsWith("-")) {
989439
+ if (arg === "--log-level") {
989440
+ i5++;
989441
+ }
989442
+ continue;
989443
+ }
989444
+ return arg;
989445
+ }
989446
+ return void 0;
989447
+ }
989448
+
988783
989449
  // src/cli.ts
988784
989450
  if (process.platform === "linux" && parseInt(process.versions.node.split(".")[0] ?? "0", 10) >= 26 && process.env.UV_USE_IO_URING !== "0") {
988785
989451
  const result = (0, import_node_child_process14.spawnSync)(process.execPath, process.argv.slice(1), {
@@ -988826,7 +989492,7 @@ async function runCli() {
988826
989492
  if (cwd2 != null) {
988827
989493
  process.chdir(cwd2);
988828
989494
  }
988829
- if (isCompletion) {
989495
+ if (isCompletion || isVersionRedirectionExempt(process.argv)) {
988830
989496
  await tryRunCli(cliContext);
988831
989497
  } else {
988832
989498
  const versionOfCliToRun = await getIntendedVersionOfCli(cliContext);
@@ -988916,6 +989582,7 @@ async function tryRunCli(cliContext) {
988916
989582
  addAutomationsCommand(cli, cliContext);
988917
989583
  addGetOrganizationCommand(cli, cliContext);
988918
989584
  addGeneratorCommands(cli, cliContext);
989585
+ addOrgCommand2(cli, cliContext);
988919
989586
  addProtocGenFernCommand(cli, cliContext);
988920
989587
  addInstallDependenciesCommand(cli, cliContext);
988921
989588
  cli.middleware(async (argv) => {
@@ -988929,6 +989596,14 @@ async function tryRunCli(cliContext) {
988929
989596
  }
988930
989597
  async function getIntendedVersionOfCli(cliContext) {
988931
989598
  if (process.env.FERN_NO_VERSION_REDIRECTION === "true") {
989599
+ const orgId = await getOrganization2(cliContext);
989600
+ if (orgId != null) {
989601
+ await warnIfVersionOutsideOrgBounds({
989602
+ cliContext,
989603
+ orgId,
989604
+ currentVersion: cliContext.environment.packageVersion
989605
+ });
989606
+ }
988932
989607
  return cliContext.environment.packageVersion;
988933
989608
  }
988934
989609
  const fernDirectory = await getFernDirectory();
@@ -988936,13 +989611,19 @@ async function getIntendedVersionOfCli(cliContext) {
988936
989611
  const projectConfig = await cliContext.runTask(
988937
989612
  (context3) => loadProjectConfig({ directory: fernDirectory, context: context3 })
988938
989613
  );
989614
+ let intendedVersion;
988939
989615
  if (projectConfig.version === "*") {
988940
- return cliContext.environment.packageVersion;
988941
- }
988942
- if (projectConfig.version === "latest") {
988943
- return getLatestVersionOfCli({ cliEnvironment: cliContext.environment });
989616
+ intendedVersion = cliContext.environment.packageVersion;
989617
+ } else if (projectConfig.version === "latest") {
989618
+ intendedVersion = await getLatestVersionOfCli({ cliEnvironment: cliContext.environment });
989619
+ } else {
989620
+ intendedVersion = projectConfig.version;
988944
989621
  }
988945
- return projectConfig.version;
989622
+ return await applyOrgBoundsToVersion({
989623
+ cliContext,
989624
+ orgId: projectConfig.organization,
989625
+ intendedVersion
989626
+ });
988946
989627
  }
988947
989628
  return getLatestVersionOfCli({ cliEnvironment: cliContext.environment });
988948
989629
  }
@@ -991753,6 +992434,77 @@ Remove ${matched.length} patch(es)? [y/N] `, resolvePrompt);
991753
992434
  }
991754
992435
  );
991755
992436
  }
992437
+ function addOrgCommand2(cli, cliContext) {
992438
+ cli.command("org", "Manage org-level configuration", (yargs) => {
992439
+ yargs.command(
992440
+ "set",
992441
+ "Set an org-level config value (admin only)",
992442
+ (setYargs) => setYargs.command(
992443
+ "cli-version [version]",
992444
+ "Set the org's Fern CLI version policy: pin an exact version, or set a min/max range",
992445
+ (y4) => y4.positional("version", {
992446
+ type: "string",
992447
+ description: "Pin to an exact version (sets both the floor and ceiling)"
992448
+ }).option("min", {
992449
+ type: "string",
992450
+ description: "Minimum allowed CLI version (floor)"
992451
+ }).option("max", {
992452
+ type: "string",
992453
+ description: "Maximum allowed CLI version (ceiling)"
992454
+ }).option("org", { type: "string", description: "Override org ID" }),
992455
+ async (argv) => {
992456
+ cliContext.instrumentPostHogEvent({ command: "fern org set cli-version" });
992457
+ const { version: version7, min, max } = argv;
992458
+ if (version7 != null && (min != null || max != null)) {
992459
+ cliContext.failAndThrow(
992460
+ "Pass either an exact version to pin (e.g. `fern org set cli-version 5.45.0`) or --min/--max to set a range, not both."
992461
+ );
992462
+ return;
992463
+ }
992464
+ if (version7 == null && min == null && max == null) {
992465
+ cliContext.failAndThrow(
992466
+ "Nothing to set. Pass a version to pin (e.g. `fern org set cli-version 5.45.0`) or --min/--max to set a range."
992467
+ );
992468
+ return;
992469
+ }
992470
+ if (version7 != null) {
992471
+ await setOrgCliVersion({ cliContext, min: version7, max: version7, org: argv.org });
992472
+ } else {
992473
+ await setOrgCliVersion({ cliContext, min, max, org: argv.org });
992474
+ }
992475
+ }
992476
+ ).demandCommand(1, "Specify what to set, e.g. `fern org set cli-version 5.45.0`."),
992477
+ () => {
992478
+ }
992479
+ );
992480
+ yargs.command(
992481
+ "get",
992482
+ "View org-level config",
992483
+ (y4) => y4.option("org", { type: "string", description: "Override org ID" }).option("json", { type: "boolean", description: "Output as JSON" }),
992484
+ async (argv) => {
992485
+ cliContext.instrumentPostHogEvent({ command: "fern org get" });
992486
+ await getOrgConfig({ cliContext, org: argv.org, json: argv.json });
992487
+ }
992488
+ );
992489
+ yargs.command(
992490
+ "unset",
992491
+ "Remove an org-level config value (admin only)",
992492
+ (unsetYargs) => unsetYargs.command(
992493
+ "cli-version",
992494
+ "Clear the org's Fern CLI version policy (both bounds by default, or --min/--max for one end)",
992495
+ (y4) => y4.option("min", { type: "boolean", description: "Clear only the floor" }).option("max", { type: "boolean", description: "Clear only the ceiling" }).option("org", { type: "string", description: "Override org ID" }),
992496
+ async (argv) => {
992497
+ cliContext.instrumentPostHogEvent({ command: "fern org unset cli-version" });
992498
+ const field5 = argv.min && !argv.max ? "min" : argv.max && !argv.min ? "max" : "all";
992499
+ await unsetOrgCliVersion({ cliContext, org: argv.org, field: field5 });
992500
+ }
992501
+ ).demandCommand(1, "Specify what to unset, e.g. `fern org unset cli-version`."),
992502
+ () => {
992503
+ }
992504
+ );
992505
+ return yargs;
992506
+ });
992507
+ }
991756
992508
  function parseOwnerRepo(githubRepo) {
991757
992509
  const cleaned = githubRepo.replace(/^https?:\/\//, "").replace(/\.git$/, "").replace(/^github\.com\//, "");
991758
992510
  const parts = cleaned.split("/");
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.80.5",
2
+ "version": "5.82.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",