fern-api 0.26.4 → 0.26.5

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/bundle.cjs +565 -259
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -438566,6 +438566,88 @@ var require_semver6 = __commonJS({
438566
438566
  }
438567
438567
  });
438568
438568
 
438569
+ // pnp:/home/circleci/project/.yarn/cache/supports-hyperlinks-npm-2.3.0-d19176eba2-9ee0de3c8c.zip/node_modules/supports-hyperlinks/index.js
438570
+ var require_supports_hyperlinks = __commonJS({
438571
+ "pnp:/home/circleci/project/.yarn/cache/supports-hyperlinks-npm-2.3.0-d19176eba2-9ee0de3c8c.zip/node_modules/supports-hyperlinks/index.js"(exports2, module2) {
438572
+ "use strict";
438573
+ var supportsColor4 = require_supports_color2();
438574
+ var hasFlag4 = require_has_flag();
438575
+ function parseVersion2(versionString) {
438576
+ if (/^\d{3,4}$/.test(versionString)) {
438577
+ const m = /(\d{1,2})(\d{2})/.exec(versionString);
438578
+ return {
438579
+ major: 0,
438580
+ minor: parseInt(m[1], 10),
438581
+ patch: parseInt(m[2], 10)
438582
+ };
438583
+ }
438584
+ const versions = (versionString || "").split(".").map((n2) => parseInt(n2, 10));
438585
+ return {
438586
+ major: versions[0],
438587
+ minor: versions[1],
438588
+ patch: versions[2]
438589
+ };
438590
+ }
438591
+ function supportsHyperlink(stream) {
438592
+ const { env: env5 } = process;
438593
+ if ("FORCE_HYPERLINK" in env5) {
438594
+ return !(env5.FORCE_HYPERLINK.length > 0 && parseInt(env5.FORCE_HYPERLINK, 10) === 0);
438595
+ }
438596
+ if (hasFlag4("no-hyperlink") || hasFlag4("no-hyperlinks") || hasFlag4("hyperlink=false") || hasFlag4("hyperlink=never")) {
438597
+ return false;
438598
+ }
438599
+ if (hasFlag4("hyperlink=true") || hasFlag4("hyperlink=always")) {
438600
+ return true;
438601
+ }
438602
+ if ("NETLIFY" in env5) {
438603
+ return true;
438604
+ }
438605
+ if (!supportsColor4.supportsColor(stream)) {
438606
+ return false;
438607
+ }
438608
+ if (stream && !stream.isTTY) {
438609
+ return false;
438610
+ }
438611
+ if (process.platform === "win32") {
438612
+ return false;
438613
+ }
438614
+ if ("CI" in env5) {
438615
+ return false;
438616
+ }
438617
+ if ("TEAMCITY_VERSION" in env5) {
438618
+ return false;
438619
+ }
438620
+ if ("TERM_PROGRAM" in env5) {
438621
+ const version3 = parseVersion2(env5.TERM_PROGRAM_VERSION);
438622
+ switch (env5.TERM_PROGRAM) {
438623
+ case "iTerm.app":
438624
+ if (version3.major === 3) {
438625
+ return version3.minor >= 1;
438626
+ }
438627
+ return version3.major > 3;
438628
+ case "WezTerm":
438629
+ return version3.major >= 20200620;
438630
+ case "vscode":
438631
+ return version3.major > 1 || version3.major === 1 && version3.minor >= 72;
438632
+ }
438633
+ }
438634
+ if ("VTE_VERSION" in env5) {
438635
+ if (env5.VTE_VERSION === "0.50.0") {
438636
+ return false;
438637
+ }
438638
+ const version3 = parseVersion2(env5.VTE_VERSION);
438639
+ return version3.major > 0 || version3.minor >= 50;
438640
+ }
438641
+ return false;
438642
+ }
438643
+ module2.exports = {
438644
+ supportsHyperlink,
438645
+ stdout: supportsHyperlink(process.stdout),
438646
+ stderr: supportsHyperlink(process.stderr)
438647
+ };
438648
+ }
438649
+ });
438650
+
438569
438651
  // pnp:/home/circleci/project/.yarn/cache/builtins-npm-5.0.1-6d4820dd76-66d204657f.zip/node_modules/builtins/index.js
438570
438652
  var require_builtins = __commonJS({
438571
438653
  "pnp:/home/circleci/project/.yarn/cache/builtins-npm-5.0.1-6d4820dd76-66d204657f.zip/node_modules/builtins/index.js"(exports2, module2) {
@@ -939805,88 +939887,6 @@ var require_decompress = __commonJS({
939805
939887
  }
939806
939888
  });
939807
939889
 
939808
- // pnp:/home/circleci/project/.yarn/cache/supports-hyperlinks-npm-2.3.0-d19176eba2-9ee0de3c8c.zip/node_modules/supports-hyperlinks/index.js
939809
- var require_supports_hyperlinks = __commonJS({
939810
- "pnp:/home/circleci/project/.yarn/cache/supports-hyperlinks-npm-2.3.0-d19176eba2-9ee0de3c8c.zip/node_modules/supports-hyperlinks/index.js"(exports2, module2) {
939811
- "use strict";
939812
- var supportsColor4 = require_supports_color2();
939813
- var hasFlag4 = require_has_flag();
939814
- function parseVersion2(versionString) {
939815
- if (/^\d{3,4}$/.test(versionString)) {
939816
- const m = /(\d{1,2})(\d{2})/.exec(versionString);
939817
- return {
939818
- major: 0,
939819
- minor: parseInt(m[1], 10),
939820
- patch: parseInt(m[2], 10)
939821
- };
939822
- }
939823
- const versions = (versionString || "").split(".").map((n2) => parseInt(n2, 10));
939824
- return {
939825
- major: versions[0],
939826
- minor: versions[1],
939827
- patch: versions[2]
939828
- };
939829
- }
939830
- function supportsHyperlink(stream) {
939831
- const { env: env5 } = process;
939832
- if ("FORCE_HYPERLINK" in env5) {
939833
- return !(env5.FORCE_HYPERLINK.length > 0 && parseInt(env5.FORCE_HYPERLINK, 10) === 0);
939834
- }
939835
- if (hasFlag4("no-hyperlink") || hasFlag4("no-hyperlinks") || hasFlag4("hyperlink=false") || hasFlag4("hyperlink=never")) {
939836
- return false;
939837
- }
939838
- if (hasFlag4("hyperlink=true") || hasFlag4("hyperlink=always")) {
939839
- return true;
939840
- }
939841
- if ("NETLIFY" in env5) {
939842
- return true;
939843
- }
939844
- if (!supportsColor4.supportsColor(stream)) {
939845
- return false;
939846
- }
939847
- if (stream && !stream.isTTY) {
939848
- return false;
939849
- }
939850
- if (process.platform === "win32") {
939851
- return false;
939852
- }
939853
- if ("CI" in env5) {
939854
- return false;
939855
- }
939856
- if ("TEAMCITY_VERSION" in env5) {
939857
- return false;
939858
- }
939859
- if ("TERM_PROGRAM" in env5) {
939860
- const version3 = parseVersion2(env5.TERM_PROGRAM_VERSION);
939861
- switch (env5.TERM_PROGRAM) {
939862
- case "iTerm.app":
939863
- if (version3.major === 3) {
939864
- return version3.minor >= 1;
939865
- }
939866
- return version3.major > 3;
939867
- case "WezTerm":
939868
- return version3.major >= 20200620;
939869
- case "vscode":
939870
- return version3.major > 1 || version3.major === 1 && version3.minor >= 72;
939871
- }
939872
- }
939873
- if ("VTE_VERSION" in env5) {
939874
- if (env5.VTE_VERSION === "0.50.0") {
939875
- return false;
939876
- }
939877
- const version3 = parseVersion2(env5.VTE_VERSION);
939878
- return version3.major > 0 || version3.minor >= 50;
939879
- }
939880
- return false;
939881
- }
939882
- module2.exports = {
939883
- supportsHyperlink,
939884
- stdout: supportsHyperlink(process.stdout),
939885
- stderr: supportsHyperlink(process.stderr)
939886
- };
939887
- }
939888
- });
939889
-
939890
939890
  // pnp:/home/circleci/project/.yarn/cache/is-buffer-npm-2.0.5-17e563f277-764c9ad8b5.zip/node_modules/is-buffer/index.js
939891
939891
  var require_is_buffer = __commonJS({
939892
939892
  "pnp:/home/circleci/project/.yarn/cache/is-buffer-npm-2.0.5-17e563f277-764c9ad8b5.zip/node_modules/is-buffer/index.js"(exports2, module2) {
@@ -973894,6 +973894,11 @@ function isTabbedNavigationConfig3(navigationConfig) {
973894
973894
  return Array.isArray(navigationConfig) && navigationConfig.length > 0 && navigationConfig[0].tab != null;
973895
973895
  }
973896
973896
 
973897
+ // pnp:/home/circleci/project/packages/cli/configuration/lib/DocsLinks.js
973898
+ var DocsLinks = {
973899
+ oauth: "https://buildwithfern.com/learn/api-definition/fern/api-yml-reference#authentication"
973900
+ };
973901
+
973897
973902
  // pnp:/home/circleci/project/packages/cli/configuration/lib/fern-config-json/index.js
973898
973903
  var fern_config_json_exports = {};
973899
973904
  __export(fern_config_json_exports, {
@@ -977710,7 +977715,7 @@ var AccessTokenPosthogManager = class {
977710
977715
  properties: {
977711
977716
  ...event,
977712
977717
  ...event.properties,
977713
- version: "0.26.4",
977718
+ version: "0.26.5",
977714
977719
  usingAccessToken: true
977715
977720
  }
977716
977721
  });
@@ -977772,7 +977777,7 @@ var UserPosthogManager = class {
977772
977777
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
977773
977778
  event: "CLI",
977774
977779
  properties: {
977775
- version: "0.26.4",
977780
+ version: "0.26.5",
977776
977781
  ...event,
977777
977782
  ...event.properties
977778
977783
  }
@@ -988863,9 +988868,12 @@ __export(schemas_exports3, {
988863
988868
  HttpResponseStreamSchema: () => HttpResponseStreamSchema,
988864
988869
  HttpServiceSchema: () => HttpServiceSchema,
988865
988870
  MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema,
988871
+ OAuthAccessTokenRequestPropertiesSchema: () => OAuthAccessTokenRequestPropertiesSchema,
988872
+ OAuthAccessTokenResponsePropertiesSchema: () => OAuthAccessTokenResponsePropertiesSchema,
988866
988873
  OAuthClientCredentialsSchema: () => OAuthClientCredentialsSchema,
988867
988874
  OAuthGetTokenEndpointSchema: () => OAuthGetTokenEndpointSchema,
988868
988875
  OAuthRefreshTokenEndpointSchema: () => OAuthRefreshTokenEndpointSchema,
988876
+ OAuthRefreshTokenRequestPropertiesSchema: () => OAuthRefreshTokenRequestPropertiesSchema,
988869
988877
  OAuthSchemeSchema: () => OAuthSchemeSchema,
988870
988878
  ObjectPropertySchema: () => ObjectPropertySchema,
988871
988879
  ObjectSchema: () => ObjectSchema,
@@ -988984,29 +988992,37 @@ var HeaderAuthSchemeSchema = AuthVariableSchema.extend({
988984
988992
  prefix: z.optional(z.string())
988985
988993
  });
988986
988994
 
988987
- // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthAccessTokenPropertiesSchema.js
988988
- var OAuthAccessTokenPropertiesSchema = z.strictObject({
988989
- "access-token": z.string(),
988990
- "expires-in": z.optional(z.string()),
988991
- "refresh-token": z.optional(z.string())
988995
+ // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthAccessTokenRequestPropertiesSchema.js
988996
+ var OAuthAccessTokenRequestPropertiesSchema = z.strictObject({
988997
+ "client-id": z.optional(z.string()).describe("The property name for the client ID."),
988998
+ "client-secret": z.optional(z.string()).describe("The property name for the client secret."),
988999
+ scopes: z.optional(z.string()).describe("The property name for the scopes.")
989000
+ });
989001
+
989002
+ // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthAccessTokenResponsePropertiesSchema.js
989003
+ var OAuthAccessTokenResponsePropertiesSchema = z.strictObject({
989004
+ "access-token": z.optional(z.string()).describe("The property name for the access token."),
989005
+ "expires-in": z.optional(z.string()).describe("The property name for the expires in property."),
989006
+ "refresh-token": z.optional(z.string()).describe("The property name for the refresh token.")
988992
989007
  });
988993
989008
 
988994
989009
  // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthGetTokenEndpointSchema.js
988995
989010
  var OAuthGetTokenEndpointSchema = z.strictObject({
988996
989011
  endpoint: z.string().describe("The endpoint to get the access token, such as 'auth.get_token')"),
988997
- "response-properties": OAuthAccessTokenPropertiesSchema
989012
+ "request-properties": OAuthAccessTokenRequestPropertiesSchema.optional(),
989013
+ "response-properties": OAuthAccessTokenResponsePropertiesSchema.optional()
988998
989014
  });
988999
989015
 
989000
- // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthRefreshTokenPropertiesSchema.js
989001
- var OAuthRefreshTokenPropertiesSchema = z.strictObject({
989002
- "refresh-token": z.string()
989016
+ // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthRefreshTokenRequestPropertiesSchema.js
989017
+ var OAuthRefreshTokenRequestPropertiesSchema = z.strictObject({
989018
+ "refresh-token": z.string().describe("The property name for the refresh token.")
989003
989019
  });
989004
989020
 
989005
989021
  // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthRefreshTokenEndpointSchema.js
989006
989022
  var OAuthRefreshTokenEndpointSchema = z.strictObject({
989007
989023
  endpoint: z.string().describe("The endpoint to refresh the access token, such as 'auth.refresh_token')"),
989008
- "request-properties": OAuthRefreshTokenPropertiesSchema,
989009
- "response-properties": OAuthAccessTokenPropertiesSchema
989024
+ "request-properties": OAuthRefreshTokenRequestPropertiesSchema.optional(),
989025
+ "response-properties": OAuthAccessTokenResponsePropertiesSchema.optional()
989010
989026
  });
989011
989027
 
989012
989028
  // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/OAuthClientCredentialsSchema.js
@@ -1002526,10 +1002542,10 @@ var CliContext = class {
1002526
1002542
  return "fern-api";
1002527
1002543
  }
1002528
1002544
  getPackageVersion() {
1002529
- if ("0.26.4" == null) {
1002545
+ if ("0.26.5" == null) {
1002530
1002546
  this.logger.error("CLI_VERSION is not defined");
1002531
1002547
  }
1002532
- return "0.26.4";
1002548
+ return "0.26.5";
1002533
1002549
  }
1002534
1002550
  getCliName() {
1002535
1002551
  if ("fern" == null) {
@@ -1007044,43 +1007060,107 @@ async function convertOAuthClientCredentials({ propertyResolver, endpointResolve
1007044
1007060
  }
1007045
1007061
 
1007046
1007062
  // pnp:/home/circleci/project/packages/cli/generation/ir-generator/lib/converters/convertOAuthUtils.js
1007063
+ var DEFAULT_TOKEN_ENDPOINT = {
1007064
+ requestProperties: {
1007065
+ type: "access_token",
1007066
+ client_id: ["client_id"],
1007067
+ client_secret: ["client_secret"],
1007068
+ scopes: void 0
1007069
+ },
1007070
+ responseProperties: {
1007071
+ type: "access_token",
1007072
+ access_token: ["access_token"],
1007073
+ expires_in: void 0,
1007074
+ refresh_token: void 0
1007075
+ }
1007076
+ };
1007077
+ var DEFAULT_REFRESH_TOKEN_ENDPOINT = {
1007078
+ requestProperties: {
1007079
+ type: "refresh_token",
1007080
+ refresh_token: ["refresh_token"]
1007081
+ },
1007082
+ responseProperties: {
1007083
+ type: "access_token",
1007084
+ access_token: ["access_token"],
1007085
+ refresh_token: void 0,
1007086
+ expires_in: void 0
1007087
+ }
1007088
+ };
1007047
1007089
  function getTokenEndpoint(oauthSchema) {
1007048
- const maybeExpiresIn = oauthSchema["get-token"]["response-properties"]["expires-in"];
1007049
- const maybeRefreshToken = oauthSchema["get-token"]["response-properties"]["refresh-token"];
1007090
+ var _a5, _b4;
1007050
1007091
  return {
1007051
1007092
  endpoint: oauthSchema["get-token"].endpoint,
1007052
- requestProperties: {
1007053
- type: "access_token",
1007054
- client_id: ["client_id"],
1007055
- client_secret: ["client_secret"],
1007056
- scopes: void 0
1007057
- },
1007058
- responseProperties: {
1007059
- type: "access_token",
1007060
- access_token: getResponsePropertyComponents(oauthSchema["get-token"]["response-properties"]["access-token"]),
1007061
- expires_in: maybeExpiresIn != null ? getResponsePropertyComponents(maybeExpiresIn) : void 0,
1007062
- refresh_token: maybeRefreshToken != null ? getResponsePropertyComponents(maybeRefreshToken) : void 0
1007063
- }
1007093
+ requestProperties: getTokenEndpointRequestProperties({
1007094
+ requestProperties: (_a5 = oauthSchema["get-token"]) == null ? void 0 : _a5["request-properties"]
1007095
+ }),
1007096
+ responseProperties: getTokenEndpointResponseProperties({
1007097
+ responseProperties: (_b4 = oauthSchema["get-token"]) == null ? void 0 : _b4["response-properties"]
1007098
+ })
1007064
1007099
  };
1007065
1007100
  }
1007066
1007101
  function getRefreshTokenEndpoint(oauthSchema) {
1007102
+ var _a5, _b4;
1007067
1007103
  if (oauthSchema["refresh-token"] == null) {
1007068
1007104
  return void 0;
1007069
1007105
  }
1007070
- const maybeExpiresIn = oauthSchema["get-token"]["response-properties"]["expires-in"];
1007071
- const maybeRefreshToken = oauthSchema["get-token"]["response-properties"]["refresh-token"];
1007072
1007106
  return {
1007073
1007107
  endpoint: oauthSchema["refresh-token"].endpoint,
1007074
- requestProperties: {
1007075
- type: "refresh_token",
1007076
- refresh_token: getRequestPropertyComponents(oauthSchema["refresh-token"]["request-properties"]["refresh-token"])
1007077
- },
1007078
- responseProperties: {
1007079
- type: "access_token",
1007080
- access_token: getResponsePropertyComponents(oauthSchema["get-token"]["response-properties"]["access-token"]),
1007081
- expires_in: maybeExpiresIn != null ? getResponsePropertyComponents(maybeExpiresIn) : void 0,
1007082
- refresh_token: maybeRefreshToken != null ? getResponsePropertyComponents(maybeRefreshToken) : void 0
1007083
- }
1007108
+ requestProperties: getRefreshTokenEndpointRequestProperties({
1007109
+ requestProperties: (_a5 = oauthSchema["refresh-token"]) == null ? void 0 : _a5["request-properties"]
1007110
+ }),
1007111
+ responseProperties: getRefreshTokenEndpointResponseProperties({
1007112
+ responseProperties: (_b4 = oauthSchema["refresh-token"]) == null ? void 0 : _b4["response-properties"]
1007113
+ })
1007114
+ };
1007115
+ }
1007116
+ function getTokenEndpointRequestProperties({ requestProperties }) {
1007117
+ if (requestProperties == null) {
1007118
+ return DEFAULT_TOKEN_ENDPOINT.requestProperties;
1007119
+ }
1007120
+ const maybeClientId = requestProperties["client-id"];
1007121
+ const maybeClientSecret = requestProperties["client-secret"];
1007122
+ const maybeScopes = requestProperties.scopes;
1007123
+ return {
1007124
+ type: "access_token",
1007125
+ client_id: maybeClientId != null ? getRequestPropertyComponents(maybeClientId) : DEFAULT_TOKEN_ENDPOINT.requestProperties.client_id,
1007126
+ client_secret: maybeClientSecret != null ? getRequestPropertyComponents(maybeClientSecret) : DEFAULT_TOKEN_ENDPOINT.requestProperties.client_secret,
1007127
+ scopes: maybeScopes != null ? getRequestPropertyComponents(maybeScopes) : DEFAULT_TOKEN_ENDPOINT.requestProperties.scopes
1007128
+ };
1007129
+ }
1007130
+ function getTokenEndpointResponseProperties({ responseProperties }) {
1007131
+ return getTokenEndpointResponsePropertiesWithDefault({
1007132
+ responseProperties,
1007133
+ defaultValue: DEFAULT_TOKEN_ENDPOINT.responseProperties
1007134
+ });
1007135
+ }
1007136
+ function getRefreshTokenEndpointRequestProperties({ requestProperties }) {
1007137
+ if (requestProperties == null) {
1007138
+ return DEFAULT_REFRESH_TOKEN_ENDPOINT.requestProperties;
1007139
+ }
1007140
+ const maybeRefreshToken = requestProperties["refresh-token"];
1007141
+ return {
1007142
+ type: "refresh_token",
1007143
+ refresh_token: maybeRefreshToken != null ? getRequestPropertyComponents(maybeRefreshToken) : DEFAULT_REFRESH_TOKEN_ENDPOINT.requestProperties.refresh_token
1007144
+ };
1007145
+ }
1007146
+ function getRefreshTokenEndpointResponseProperties({ responseProperties }) {
1007147
+ return getTokenEndpointResponsePropertiesWithDefault({
1007148
+ responseProperties,
1007149
+ defaultValue: DEFAULT_REFRESH_TOKEN_ENDPOINT.responseProperties
1007150
+ });
1007151
+ }
1007152
+ function getTokenEndpointResponsePropertiesWithDefault({ responseProperties, defaultValue }) {
1007153
+ if (responseProperties == null) {
1007154
+ return defaultValue;
1007155
+ }
1007156
+ const maybeAccessToken = responseProperties["access-token"];
1007157
+ const maybeExpiresIn = responseProperties["expires-in"];
1007158
+ const maybeRefreshToken = responseProperties["refresh-token"];
1007159
+ return {
1007160
+ type: "access_token",
1007161
+ access_token: maybeAccessToken != null ? getResponsePropertyComponents(maybeAccessToken) : defaultValue.access_token,
1007162
+ expires_in: maybeExpiresIn != null ? getResponsePropertyComponents(maybeExpiresIn) : defaultValue.expires_in,
1007163
+ refresh_token: maybeRefreshToken != null ? getResponsePropertyComponents(maybeRefreshToken) : defaultValue.refresh_token
1007084
1007164
  };
1007085
1007165
  }
1007086
1007166
 
@@ -1012785,6 +1012865,21 @@ var ValidNavigationRule = {
1012785
1012865
  }
1012786
1012866
  };
1012787
1012867
 
1012868
+ // pnp:/home/circleci/project/.yarn/cache/terminal-link-npm-3.0.0-82cbbd7f4a-85a78ae50a.zip/node_modules/terminal-link/index.js
1012869
+ var import_supports_hyperlinks = __toESM(require_supports_hyperlinks());
1012870
+ function terminalLink(text8, url, { target = "stdout", ...options2 } = {}) {
1012871
+ if (!import_supports_hyperlinks.default[target]) {
1012872
+ if (options2.fallback === false) {
1012873
+ return text8;
1012874
+ }
1012875
+ return typeof options2.fallback === "function" ? options2.fallback(text8, url) : `${text8} (\u200B${url}\u200B)`;
1012876
+ }
1012877
+ return ansi_escapes_default.link(text8, url);
1012878
+ }
1012879
+ terminalLink.isSupported = import_supports_hyperlinks.default.stdout;
1012880
+ terminalLink.stderr = (text8, url, options2 = {}) => terminalLink(text8, url, { target: "stderr", ...options2 });
1012881
+ terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
1012882
+
1012788
1012883
  // pnp:/home/circleci/project/packages/cli/yaml/validator/lib/utils/propertyValidatorUtils.js
1012789
1012884
  var REQUEST_PREFIX2 = "$request.";
1012790
1012885
  var RESPONSE_PREFIX = "$response.";
@@ -1012813,6 +1012908,15 @@ function requestTypeHasProperty({ typeResolver, file, endpoint, propertyComponen
1012813
1012908
  });
1012814
1012909
  }
1012815
1012910
  function inlinedRequestTypeHasProperty({ typeResolver, file, requestType, propertyComponents, validate: validate3 }) {
1012911
+ if (isQueryParameterProperty({
1012912
+ typeResolver,
1012913
+ file,
1012914
+ requestType,
1012915
+ propertyComponents,
1012916
+ validate: validate3
1012917
+ })) {
1012918
+ return true;
1012919
+ }
1012816
1012920
  if (requestType.body == null) {
1012817
1012921
  return false;
1012818
1012922
  }
@@ -1012848,9 +1012952,25 @@ function inlinedRequestTypeHasProperty({ typeResolver, file, requestType, proper
1012848
1012952
  validate: validate3
1012849
1012953
  });
1012850
1012954
  }
1012955
+ function isQueryParameterProperty({ typeResolver, file, requestType, propertyComponents, validate: validate3 }) {
1012956
+ if (propertyComponents.length !== 1 || typeof requestType === "string" || requestType["query-parameters"] == null) {
1012957
+ return false;
1012958
+ }
1012959
+ const queryParameter = requestType["query-parameters"][propertyComponents[0] ?? ""];
1012960
+ if (queryParameter == null) {
1012961
+ return false;
1012962
+ }
1012963
+ const resolvedQueryParameterType = typeResolver.resolveType({
1012964
+ type: typeof queryParameter !== "string" ? queryParameter.type : queryParameter,
1012965
+ file
1012966
+ });
1012967
+ return validate3({
1012968
+ resolvedType: resolvedQueryParameterType
1012969
+ });
1012970
+ }
1012851
1012971
  function resolvedTypeHasProperty2({ typeResolver, file, resolvedType, propertyComponents, validate: validate3 }) {
1012852
1012972
  if (propertyComponents.length === 0) {
1012853
- return validate3(resolvedType);
1012973
+ return validate3({ resolvedType });
1012854
1012974
  }
1012855
1012975
  const objectSchema = maybeObjectSchema2(resolvedType);
1012856
1012976
  if (objectSchema == null) {
@@ -1012993,29 +1013113,61 @@ function trimPrefix(value, prefix) {
1012993
1013113
  }
1012994
1013114
 
1012995
1013115
  // pnp:/home/circleci/project/packages/cli/yaml/validator/lib/rules/valid-oauth/validateUtils.js
1012996
- function validateRefreshTokenRequestProperty({ endpointId, endpoint, typeResolver, file, refreshTokenProperty }) {
1012997
- const violations = [];
1012998
- const refreshTokenPropertyComponents = getRequestPropertyComponents2(refreshTokenProperty);
1012999
- if (refreshTokenPropertyComponents == null) {
1013000
- violations.push({
1013001
- severity: "error",
1013002
- message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} must define a dot-delimited 'refresh-token' property starting with $request (e.g. $request.refresh_token).`
1013003
- });
1013004
- return violations;
1013005
- }
1013006
- if (!requestTypeHasProperty({
1013116
+ var DEFAULT_CLIENT_ID = `${REQUEST_PREFIX2}client_id`;
1013117
+ var DEFAULT_CLIENT_SECRET = `${REQUEST_PREFIX2}client_secret`;
1013118
+ var DEFAULT_ACCESS_TOKEN = `${RESPONSE_PREFIX}access_token`;
1013119
+ var DEFAULT_REFRESH_TOKEN = `${REQUEST_PREFIX2}refresh_token`;
1013120
+ function validateClientIdRequestProperty({ endpointId, endpoint, typeResolver, file, clientIdProperty }) {
1013121
+ return validateRequestProperty({
1013122
+ endpointId,
1013123
+ endpoint,
1013007
1013124
  typeResolver,
1013008
1013125
  file,
1013126
+ requestProperty: clientIdProperty,
1013127
+ propertyValidator: {
1013128
+ propertyID: "client-id",
1013129
+ validate: isStringType
1013130
+ }
1013131
+ });
1013132
+ }
1013133
+ function validateClientSecretRequestProperty({ endpointId, endpoint, typeResolver, file, clientSecretProperty }) {
1013134
+ return validateRequestProperty({
1013135
+ endpointId,
1013009
1013136
  endpoint,
1013010
- propertyComponents: refreshTokenPropertyComponents,
1013011
- validate: isValidTokenType
1013012
- })) {
1013013
- violations.push({
1013014
- severity: "error",
1013015
- message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} specifies 'refresh-token' ${refreshTokenProperty}, which is not a valid 'refresh-token' type.`
1013016
- });
1013017
- }
1013018
- return violations;
1013137
+ typeResolver,
1013138
+ file,
1013139
+ requestProperty: clientSecretProperty,
1013140
+ propertyValidator: {
1013141
+ propertyID: "client-secret",
1013142
+ validate: isStringType
1013143
+ }
1013144
+ });
1013145
+ }
1013146
+ function validateScopesRequestProperty({ endpointId, endpoint, typeResolver, file, scopesProperty }) {
1013147
+ return validateRequestProperty({
1013148
+ endpointId,
1013149
+ endpoint,
1013150
+ typeResolver,
1013151
+ file,
1013152
+ requestProperty: scopesProperty,
1013153
+ propertyValidator: {
1013154
+ propertyID: "scopes",
1013155
+ validate: isStringType
1013156
+ }
1013157
+ });
1013158
+ }
1013159
+ function validateRefreshTokenRequestProperty({ endpointId, endpoint, typeResolver, file, refreshTokenProperty }) {
1013160
+ return validateRequestProperty({
1013161
+ endpointId,
1013162
+ endpoint,
1013163
+ typeResolver,
1013164
+ file,
1013165
+ requestProperty: refreshTokenProperty,
1013166
+ propertyValidator: {
1013167
+ propertyID: "refresh-token",
1013168
+ validate: isStringType
1013169
+ }
1013170
+ });
1013019
1013171
  }
1013020
1013172
  function validateAccessTokenResponseProperty({ endpointId, typeResolver, file, resolvedResponseType, accessTokenProperty }) {
1013021
1013173
  return validateResponseProperty({
@@ -1013062,31 +1013214,48 @@ function isValidExpiresInProperty({ typeResolver, file, resolvedType, propertyCo
1013062
1013214
  file,
1013063
1013215
  resolvedType,
1013064
1013216
  propertyComponents,
1013065
- validate: isValidExpiryType
1013217
+ validate: isIntegerType
1013066
1013218
  });
1013067
1013219
  }
1013068
- function isValidExpiryType(resolvedType) {
1013069
- const primitiveType = maybePrimitiveType(resolvedType);
1013070
- if (primitiveType == null) {
1013071
- return false;
1013072
- }
1013073
- return primitiveType === "INTEGER";
1013074
- }
1013075
1013220
  function isValidTokenProperty({ typeResolver, file, resolvedType, propertyComponents }) {
1013076
1013221
  return resolvedTypeHasProperty2({
1013077
1013222
  typeResolver,
1013078
1013223
  file,
1013079
1013224
  resolvedType,
1013080
1013225
  propertyComponents,
1013081
- validate: isValidTokenType
1013226
+ validate: isStringType
1013082
1013227
  });
1013083
1013228
  }
1013084
- function isValidTokenType(resolvedType) {
1013085
- const primitiveType = maybePrimitiveType(resolvedType);
1013086
- if (primitiveType == null) {
1013087
- return false;
1013229
+ function validateRequestProperty({ endpointId, endpoint, typeResolver, file, requestProperty, propertyValidator }) {
1013230
+ const violations = [];
1013231
+ const requestPropertyComponents = getRequestPropertyComponents2(requestProperty);
1013232
+ if (requestPropertyComponents == null) {
1013233
+ violations.push({
1013234
+ severity: "error",
1013235
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} must define a dot-delimited '${propertyValidator.propertyID}' property starting with $request (e.g. $request.${propertyValidator.propertyID}).`
1013236
+ });
1013237
+ return violations;
1013088
1013238
  }
1013089
- return primitiveType === "STRING";
1013239
+ if (requestPropertyComponents.length > 1) {
1013240
+ violations.push({
1013241
+ severity: "error",
1013242
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} cannot reference nested $request properties like '${requestProperty}'; expected '$request.${propertyValidator.propertyID}' instead.`
1013243
+ });
1013244
+ return violations;
1013245
+ }
1013246
+ if (!requestTypeHasProperty({
1013247
+ typeResolver,
1013248
+ file,
1013249
+ endpoint,
1013250
+ propertyComponents: requestPropertyComponents,
1013251
+ validate: propertyValidator.validate
1013252
+ })) {
1013253
+ violations.push({
1013254
+ severity: "error",
1013255
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} specifies '${propertyValidator.propertyID}' ${requestProperty}, which is not a valid '${propertyValidator.propertyID}' type.`
1013256
+ });
1013257
+ }
1013258
+ return violations;
1013090
1013259
  }
1013091
1013260
  function validateResponseProperty({ endpointId, typeResolver, file, resolvedResponseType, responseProperty, propertyValidator }) {
1013092
1013261
  const violations = [];
@@ -1013110,17 +1013279,41 @@ function validateResponseProperty({ endpointId, typeResolver, file, resolvedResp
1013110
1013279
  }
1013111
1013280
  return violations;
1013112
1013281
  }
1013282
+ function isIntegerType({ resolvedType }) {
1013283
+ return maybePrimitiveType(resolvedType) === "INTEGER";
1013284
+ }
1013285
+ function isStringType({ resolvedType }) {
1013286
+ return maybePrimitiveType(resolvedType) === "STRING";
1013287
+ }
1013113
1013288
 
1013114
1013289
  // pnp:/home/circleci/project/packages/cli/yaml/validator/lib/rules/valid-oauth/validateRefreshTokenEndpoint.js
1013115
1013290
  function validateRefreshTokenEndpoint({ endpointId, endpoint, typeResolver, file, refreshEndpoint }) {
1013291
+ var _a5, _b4, _c4, _d2;
1013116
1013292
  const violations = [];
1013117
- violations.push(...validateRefreshTokenRequestProperty({
1013118
- endpointId,
1013119
- endpoint,
1013120
- typeResolver,
1013121
- file,
1013122
- refreshTokenProperty: refreshEndpoint["request-properties"]["refresh-token"]
1013123
- }));
1013293
+ const maybeRefreshToken = (_a5 = refreshEndpoint["request-properties"]) == null ? void 0 : _a5["refresh-token"];
1013294
+ if (maybeRefreshToken != null) {
1013295
+ violations.push(...validateRefreshTokenRequestProperty({
1013296
+ endpointId,
1013297
+ endpoint,
1013298
+ typeResolver,
1013299
+ file,
1013300
+ refreshTokenProperty: maybeRefreshToken
1013301
+ }));
1013302
+ } else {
1013303
+ const refreshTokenViolations = validateRefreshTokenRequestProperty({
1013304
+ endpointId,
1013305
+ endpoint,
1013306
+ typeResolver,
1013307
+ file,
1013308
+ refreshTokenProperty: DEFAULT_REFRESH_TOKEN
1013309
+ });
1013310
+ if (refreshTokenViolations.length > 0) {
1013311
+ violations.push({
1013312
+ severity: "error",
1013313
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} is missing a valid refresh-token, such as '${DEFAULT_REFRESH_TOKEN}'.`
1013314
+ });
1013315
+ }
1013316
+ }
1013124
1013317
  const resolvedResponseType = resolveResponseType({ endpoint, typeResolver, file });
1013125
1013318
  if (resolvedResponseType == null) {
1013126
1013319
  violations.push({
@@ -1013129,17 +1013322,31 @@ function validateRefreshTokenEndpoint({ endpointId, endpoint, typeResolver, file
1013129
1013322
  });
1013130
1013323
  return violations;
1013131
1013324
  }
1013132
- const accessTokenProperty = refreshEndpoint["response-properties"]["access-token"];
1013133
- if (accessTokenProperty != null) {
1013325
+ const maybeAccessToken = (_b4 = refreshEndpoint["response-properties"]) == null ? void 0 : _b4["access-token"];
1013326
+ if (maybeAccessToken != null) {
1013134
1013327
  violations.push(...validateAccessTokenResponseProperty({
1013135
1013328
  endpointId,
1013136
1013329
  typeResolver,
1013137
- file: maybeFileFromResolvedType2(resolvedResponseType) ?? file,
1013330
+ file,
1013138
1013331
  resolvedResponseType,
1013139
- accessTokenProperty
1013332
+ accessTokenProperty: maybeAccessToken
1013140
1013333
  }));
1013334
+ } else {
1013335
+ const accessTokenViolations = validateAccessTokenResponseProperty({
1013336
+ endpointId,
1013337
+ typeResolver,
1013338
+ file,
1013339
+ resolvedResponseType,
1013340
+ accessTokenProperty: DEFAULT_ACCESS_TOKEN
1013341
+ });
1013342
+ if (accessTokenViolations.length > 0) {
1013343
+ violations.push({
1013344
+ severity: "error",
1013345
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} is missing a valid access-token, such as '${DEFAULT_ACCESS_TOKEN}'.`
1013346
+ });
1013347
+ }
1013141
1013348
  }
1013142
- const expiresInProperty = refreshEndpoint["response-properties"]["expires-in"];
1013349
+ const expiresInProperty = (_c4 = refreshEndpoint == null ? void 0 : refreshEndpoint["response-properties"]) == null ? void 0 : _c4["expires-in"];
1013143
1013350
  if (expiresInProperty != null) {
1013144
1013351
  violations.push(...validateExpiresInResponseProperty({
1013145
1013352
  endpointId,
@@ -1013149,7 +1013356,7 @@ function validateRefreshTokenEndpoint({ endpointId, endpoint, typeResolver, file
1013149
1013356
  expiresInProperty
1013150
1013357
  }));
1013151
1013358
  }
1013152
- const refreshTokenProperty = refreshEndpoint["response-properties"]["refresh-token"];
1013359
+ const refreshTokenProperty = (_d2 = refreshEndpoint == null ? void 0 : refreshEndpoint["response-properties"]) == null ? void 0 : _d2["refresh-token"];
1013153
1013360
  if (refreshTokenProperty != null) {
1013154
1013361
  violations.push(...validateRefreshTokenResponseProperty({
1013155
1013362
  endpointId,
@@ -1013164,7 +1013371,66 @@ function validateRefreshTokenEndpoint({ endpointId, endpoint, typeResolver, file
1013164
1013371
 
1013165
1013372
  // pnp:/home/circleci/project/packages/cli/yaml/validator/lib/rules/valid-oauth/validateTokenEndpoint.js
1013166
1013373
  function validateTokenEndpoint({ endpointId, endpoint, typeResolver, file, tokenEndpoint }) {
1013374
+ var _a5, _b4, _c4, _d2, _e, _f;
1013167
1013375
  const violations = [];
1013376
+ const maybeClientId = (_a5 = tokenEndpoint["request-properties"]) == null ? void 0 : _a5["client-id"];
1013377
+ if (maybeClientId != null) {
1013378
+ violations.push(...validateClientIdRequestProperty({
1013379
+ endpointId,
1013380
+ endpoint,
1013381
+ typeResolver,
1013382
+ file,
1013383
+ clientIdProperty: maybeClientId
1013384
+ }));
1013385
+ } else {
1013386
+ const clientIdViolations = validateClientIdRequestProperty({
1013387
+ endpointId,
1013388
+ endpoint,
1013389
+ typeResolver,
1013390
+ file,
1013391
+ clientIdProperty: DEFAULT_CLIENT_ID
1013392
+ });
1013393
+ if (clientIdViolations.length > 0) {
1013394
+ violations.push({
1013395
+ severity: "error",
1013396
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} is missing a valid client-id, such as '${DEFAULT_CLIENT_ID}'.`
1013397
+ });
1013398
+ }
1013399
+ }
1013400
+ const maybeClientSecret = (_b4 = tokenEndpoint["request-properties"]) == null ? void 0 : _b4["client-secret"];
1013401
+ if (maybeClientSecret != null) {
1013402
+ violations.push(...validateClientSecretRequestProperty({
1013403
+ endpointId,
1013404
+ endpoint,
1013405
+ typeResolver,
1013406
+ file,
1013407
+ clientSecretProperty: maybeClientSecret
1013408
+ }));
1013409
+ } else {
1013410
+ const clientSecretViolations = validateClientSecretRequestProperty({
1013411
+ endpointId,
1013412
+ endpoint,
1013413
+ typeResolver,
1013414
+ file,
1013415
+ clientSecretProperty: DEFAULT_CLIENT_SECRET
1013416
+ });
1013417
+ if (clientSecretViolations.length > 0) {
1013418
+ violations.push({
1013419
+ severity: "error",
1013420
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} is missing a valid client-secret, such as '${DEFAULT_CLIENT_SECRET}'.`
1013421
+ });
1013422
+ }
1013423
+ }
1013424
+ const scopesProperty = (_c4 = tokenEndpoint == null ? void 0 : tokenEndpoint["request-properties"]) == null ? void 0 : _c4.scopes;
1013425
+ if (scopesProperty != null) {
1013426
+ violations.push(...validateScopesRequestProperty({
1013427
+ endpointId,
1013428
+ endpoint,
1013429
+ typeResolver,
1013430
+ file,
1013431
+ scopesProperty
1013432
+ }));
1013433
+ }
1013168
1013434
  const resolvedResponseType = resolveResponseType({ endpoint, typeResolver, file });
1013169
1013435
  if (resolvedResponseType == null) {
1013170
1013436
  violations.push({
@@ -1013173,14 +1013439,31 @@ function validateTokenEndpoint({ endpointId, endpoint, typeResolver, file, token
1013173
1013439
  });
1013174
1013440
  return violations;
1013175
1013441
  }
1013176
- violations.push(...validateAccessTokenResponseProperty({
1013177
- endpointId,
1013178
- typeResolver,
1013179
- file: maybeFileFromResolvedType2(resolvedResponseType) ?? file,
1013180
- resolvedResponseType,
1013181
- accessTokenProperty: tokenEndpoint["response-properties"]["access-token"]
1013182
- }));
1013183
- const expiresInProperty = tokenEndpoint["response-properties"]["expires-in"];
1013442
+ const maybeAccessToken = (_d2 = tokenEndpoint["response-properties"]) == null ? void 0 : _d2["access-token"];
1013443
+ if (maybeAccessToken != null) {
1013444
+ violations.push(...validateAccessTokenResponseProperty({
1013445
+ endpointId,
1013446
+ typeResolver,
1013447
+ file,
1013448
+ resolvedResponseType,
1013449
+ accessTokenProperty: maybeAccessToken
1013450
+ }));
1013451
+ } else {
1013452
+ const accessTokenViolations = validateAccessTokenResponseProperty({
1013453
+ endpointId,
1013454
+ typeResolver,
1013455
+ file,
1013456
+ resolvedResponseType,
1013457
+ accessTokenProperty: DEFAULT_ACCESS_TOKEN
1013458
+ });
1013459
+ if (accessTokenViolations.length > 0) {
1013460
+ violations.push({
1013461
+ severity: "error",
1013462
+ message: `OAuth configuration for endpoint ${source_default.bold(endpointId)} is missing a valid access-token, such as '${DEFAULT_ACCESS_TOKEN}'.`
1013463
+ });
1013464
+ }
1013465
+ }
1013466
+ const expiresInProperty = (_e = tokenEndpoint == null ? void 0 : tokenEndpoint["response-properties"]) == null ? void 0 : _e["expires-in"];
1013184
1013467
  if (expiresInProperty != null) {
1013185
1013468
  violations.push(...validateExpiresInResponseProperty({
1013186
1013469
  endpointId,
@@ -1013190,7 +1013473,7 @@ function validateTokenEndpoint({ endpointId, endpoint, typeResolver, file, token
1013190
1013473
  expiresInProperty
1013191
1013474
  }));
1013192
1013475
  }
1013193
- const refreshTokenProperty = tokenEndpoint["response-properties"]["refresh-token"];
1013476
+ const refreshTokenProperty = (_f = tokenEndpoint == null ? void 0 : tokenEndpoint["response-properties"]) == null ? void 0 : _f["refresh-token"];
1013194
1013477
  if (refreshTokenProperty != null) {
1013195
1013478
  violations.push(...validateRefreshTokenResponseProperty({
1013196
1013479
  endpointId,
@@ -1013228,6 +1013511,9 @@ function validateClientCredentials({ endpointId, endpoint, typeResolver, file, r
1013228
1013511
  }
1013229
1013512
 
1013230
1013513
  // pnp:/home/circleci/project/packages/cli/yaml/validator/lib/rules/valid-oauth/valid-oauth.js
1013514
+ var DOCS_LINK_MESSAGE = `For details, see the ${terminalLink("docs", DocsLinks.oauth, {
1013515
+ fallback: (text8, url) => `${text8}: ${url}`
1013516
+ })}.`;
1013231
1013517
  var ValidOauthRule = {
1013232
1013518
  name: "valid-oauth",
1013233
1013519
  create: ({ workspace }) => {
@@ -1013246,7 +1013532,7 @@ var ValidOauthRule = {
1013246
1013532
  return [
1013247
1013533
  {
1013248
1013534
  severity: "error",
1013249
- message: `File declares oauth scheme '${oauthScheme.name}', but no imports are declared to reference the required token endpoint(s).`
1013535
+ message: `File declares oauth scheme '${oauthScheme.name}', but no imports are declared to reference the required token endpoint(s). ${DOCS_LINK_MESSAGE}`
1013250
1013536
  }
1013251
1013537
  ];
1013252
1013538
  }
@@ -1013268,7 +1013554,7 @@ var ValidOauthRule = {
1013268
1013554
  return [
1013269
1013555
  {
1013270
1013556
  severity: "error",
1013271
- message: `File declares oauth scheme '${oauthScheme.name}', but the OAuth 'get-token' endpoint could not be resolved.`
1013557
+ message: `File declares oauth scheme '${oauthScheme.name}', but the OAuth 'get-token' endpoint could not be resolved. ${DOCS_LINK_MESSAGE}`
1013272
1013558
  }
1013273
1013559
  ];
1013274
1013560
  }
@@ -1013286,7 +1013572,7 @@ var ValidOauthRule = {
1013286
1013572
  return [
1013287
1013573
  {
1013288
1013574
  severity: "error",
1013289
- message: `File declares oauth scheme '${oauthScheme.name}', but the OAuth 'refresh-token' endpoint could not be resolved.`
1013575
+ message: `File declares oauth scheme '${oauthScheme.name}', but the OAuth 'refresh-token' endpoint could not be resolved. ${DOCS_LINK_MESSAGE}`
1013290
1013576
  }
1013291
1013577
  ];
1013292
1013578
  }
@@ -1013306,8 +1013592,8 @@ var ValidOauthRule = {
1013306
1013592
  rootApiFile: workspace.definition.rootApiFile.contents
1013307
1013593
  });
1013308
1013594
  switch (oauthSchema.type) {
1013309
- case "client-credentials":
1013310
- return validateClientCredentials({
1013595
+ case "client-credentials": {
1013596
+ const violations = validateClientCredentials({
1013311
1013597
  endpointId,
1013312
1013598
  endpoint,
1013313
1013599
  typeResolver,
@@ -1013316,6 +1013602,14 @@ var ValidOauthRule = {
1013316
1013602
  resolvedRefreshEndpoint,
1013317
1013603
  clientCredentials: oauthSchema
1013318
1013604
  });
1013605
+ if (violations.length > 0) {
1013606
+ return violations.map((violation) => ({
1013607
+ severity: violation.severity,
1013608
+ message: violation.message + ` ${DOCS_LINK_MESSAGE}`
1013609
+ }));
1013610
+ }
1013611
+ return [];
1013612
+ }
1013319
1013613
  default:
1013320
1013614
  assertNever(oauthSchema.type);
1013321
1013615
  }
@@ -1013440,7 +1013734,7 @@ function isValidResultsProperty({ typeResolver, file, resolvedType, propertyComp
1013440
1013734
  validate: isValidResultsType
1013441
1013735
  });
1013442
1013736
  }
1013443
- function isValidResultsType(resolvedType) {
1013737
+ function isValidResultsType({ resolvedType }) {
1013444
1013738
  return true;
1013445
1013739
  }
1013446
1013740
 
@@ -1013513,7 +1013807,7 @@ function isValidCursorProperty({ typeResolver, file, resolvedType, propertyCompo
1013513
1013807
  validate: isValidCursorType
1013514
1013808
  });
1013515
1013809
  }
1013516
- function isValidCursorType(resolvedType) {
1013810
+ function isValidCursorType({ resolvedType }) {
1013517
1013811
  const primitiveType = maybePrimitiveType(resolvedType);
1013518
1013812
  if (primitiveType == null) {
1013519
1013813
  return false;
@@ -1013570,7 +1013864,7 @@ function isValidOffsetProperty({ typeResolver, file, resolvedType, propertyCompo
1013570
1013864
  validate: isValidOffsetType
1013571
1013865
  });
1013572
1013866
  }
1013573
- function isValidOffsetType(resolvedType) {
1013867
+ function isValidOffsetType({ resolvedType }) {
1013574
1013868
  const primitiveType = maybePrimitiveType(resolvedType);
1013575
1013869
  if (primitiveType == null) {
1013576
1013870
  return false;
@@ -1019206,24 +1019500,29 @@ function convertExampleEndpoint({ example }) {
1019206
1019500
  function convertExampleResponse5({ example }) {
1019207
1019501
  switch (example.type) {
1019208
1019502
  case "ok":
1019209
- switch (example.value.type) {
1019210
- case "body":
1019211
- return IrVersions_exports.V43.ExampleResponse.ok({ body: example.value.value });
1019212
- case "sse":
1019213
- return IrVersions_exports.V43.ExampleResponse.ok({
1019214
- body: void 0
1019215
- });
1019216
- case "stream":
1019217
- return IrVersions_exports.V43.ExampleResponse.ok({
1019218
- body: void 0
1019219
- });
1019220
- }
1019503
+ return convertExampleSuccessResponse({ example: example.value });
1019221
1019504
  case "error":
1019222
1019505
  return IrVersions_exports.V43.ExampleResponse.error(example);
1019223
1019506
  default:
1019224
1019507
  assertNever(example);
1019225
1019508
  }
1019226
1019509
  }
1019510
+ function convertExampleSuccessResponse({ example }) {
1019511
+ switch (example.type) {
1019512
+ case "body":
1019513
+ return IrVersions_exports.V43.ExampleResponse.ok({ body: example.value });
1019514
+ case "sse":
1019515
+ return IrVersions_exports.V43.ExampleResponse.ok({
1019516
+ body: void 0
1019517
+ });
1019518
+ case "stream":
1019519
+ return IrVersions_exports.V43.ExampleResponse.ok({
1019520
+ body: void 0
1019521
+ });
1019522
+ default:
1019523
+ assertNever(example);
1019524
+ }
1019525
+ }
1019227
1019526
 
1019228
1019527
  // pnp:/home/circleci/project/packages/cli/generation/ir-migrations/lib/migrations/v5-to-v4/convertName.js
1019229
1019528
  function convertNameToV1(name2) {
@@ -1021796,23 +1022095,6 @@ var import_fs8 = require("fs");
1021796
1022095
  var import_promises41 = require("fs/promises");
1021797
1022096
  var import_path35 = __toESM(require("path"));
1021798
1022097
  var import_promises42 = require("stream/promises");
1021799
-
1021800
- // pnp:/home/circleci/project/.yarn/cache/terminal-link-npm-3.0.0-82cbbd7f4a-85a78ae50a.zip/node_modules/terminal-link/index.js
1021801
- var import_supports_hyperlinks = __toESM(require_supports_hyperlinks());
1021802
- function terminalLink(text8, url, { target = "stdout", ...options2 } = {}) {
1021803
- if (!import_supports_hyperlinks.default[target]) {
1021804
- if (options2.fallback === false) {
1021805
- return text8;
1021806
- }
1021807
- return typeof options2.fallback === "function" ? options2.fallback(text8, url) : `${text8} (\u200B${url}\u200B)`;
1021808
- }
1021809
- return ansi_escapes_default.link(text8, url);
1021810
- }
1021811
- terminalLink.isSupported = import_supports_hyperlinks.default.stdout;
1021812
- terminalLink.stderr = (text8, url, options2 = {}) => terminalLink(text8, url, { target: "stderr", ...options2 });
1021813
- terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
1021814
-
1021815
- // pnp:/home/circleci/project/packages/cli/generation/remote-generation/remote-workspace-runner/lib/RemoteTaskHandler.js
1021816
1022098
  var import_tmp_promise9 = __toESM(require_tmp_promise());
1021817
1022099
  var _isFinished, _createdSnippets, _snippetsS3PreSignedReadUrl;
1021818
1022100
  var RemoteTaskHandler = class {
@@ -1052878,7 +1053160,8 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain2
1052878
1053160
  token,
1052879
1053161
  uploadUrls,
1052880
1053162
  version: version3,
1052881
- editThisPage
1053163
+ editThisPage,
1053164
+ absolutePathToFernFolder: docsWorkspace.absoluteFilepath
1052882
1053165
  });
1052883
1053166
  context.logger.debug("Calling registerDocs... ", JSON.stringify(registerDocsRequest, void 0, 4));
1052884
1053167
  const registerDocsResponse = await fdr.docs.v2.write.finishDocsRegister(docsRegistrationId, registerDocsRequest);
@@ -1052898,7 +1053181,7 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain2
1052898
1053181
  }
1052899
1053182
  }
1052900
1053183
  }
1052901
- async function constructRegisterDocsRequest({ parsedDocsConfig, organization, fernWorkspaces, context, token, uploadUrls, version: version3, editThisPage }) {
1053184
+ async function constructRegisterDocsRequest({ parsedDocsConfig, organization, fernWorkspaces, context, token, uploadUrls, version: version3, editThisPage, absolutePathToFernFolder }) {
1052902
1053185
  const fullSlugs = Object.fromEntries(Object.entries(parsedDocsConfig.pages).map(([pageId, pageContent]) => {
1052903
1053186
  const frontmatter = (0, import_gray_matter2.default)(pageContent);
1052904
1053187
  const fullSlug = frontmatter.data.slug;
@@ -1052915,10 +1053198,11 @@ async function constructRegisterDocsRequest({ parsedDocsConfig, organization, fe
1052915
1053198
  token,
1052916
1053199
  uploadUrls,
1052917
1053200
  version: version3,
1052918
- fullSlugs
1053201
+ fullSlugs,
1053202
+ absolutePathToFernFolder
1052919
1053203
  });
1052920
1053204
  let pages = {
1052921
- ...entries(parsedDocsConfig.pages).reduce((pages2, [pageFilepath, pageContents]) => ({
1053205
+ ...entries({ ...parsedDocsConfig.pages }).reduce((pages2, [pageFilepath, pageContents]) => ({
1052922
1053206
  ...pages2,
1052923
1053207
  [pageFilepath]: {
1052924
1053208
  markdown: pageContents,
@@ -1052958,7 +1053242,7 @@ function createEditThisPageUrl(editThisPage, pageFilepath) {
1052958
1053242
  const { owner, repo, branch = "main", host = "https://github.com" } = editThisPage.github;
1052959
1053243
  return `${wrapWithHttps(host)}/${owner}/${repo}/blob/${branch}/fern/${pageFilepath}`;
1052960
1053244
  }
1052961
- async function convertDocsConfiguration({ parsedDocsConfig, organization, fernWorkspaces, context, token, uploadUrls, version: version3, fullSlugs }) {
1053245
+ async function convertDocsConfiguration({ parsedDocsConfig, organization, fernWorkspaces, context, token, uploadUrls, version: version3, fullSlugs, absolutePathToFernFolder }) {
1052962
1053246
  var _a5, _b4;
1052963
1053247
  const convertedNavigation = await convertNavigationConfig({
1052964
1053248
  navigationConfig: parsedDocsConfig.navigation,
@@ -1052969,7 +1053253,8 @@ async function convertDocsConfiguration({ parsedDocsConfig, organization, fernWo
1052969
1053253
  context,
1052970
1053254
  token,
1052971
1053255
  version: version3,
1052972
- fullSlugs
1053256
+ fullSlugs,
1053257
+ absolutePathToFernFolder
1052973
1053258
  });
1052974
1053259
  const config = {
1052975
1053260
  title: parsedDocsConfig.title,
@@ -1052999,12 +1053284,10 @@ async function convertDocsConfiguration({ parsedDocsConfig, organization, fernWo
1052999
1053284
  };
1053000
1053285
  return {
1053001
1053286
  config,
1053002
- pages: {
1053003
- ...convertedNavigation.pages
1053004
- }
1053287
+ pages: convertedNavigation.pages
1053005
1053288
  };
1053006
1053289
  }
1053007
- async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs }) {
1053290
+ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
1053008
1053291
  let config;
1053009
1053292
  let pages = {};
1053010
1053293
  switch (navigationConfig.type) {
@@ -1053017,7 +1053300,8 @@ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfi
1053017
1053300
  context,
1053018
1053301
  token,
1053019
1053302
  version: version3,
1053020
- fullSlugs
1053303
+ fullSlugs,
1053304
+ absolutePathToFernFolder
1053021
1053305
  })));
1053022
1053306
  for (const untabbedItem of untabbedItems) {
1053023
1053307
  pages = {
@@ -1053030,19 +1053314,23 @@ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfi
1053030
1053314
  };
1053031
1053315
  break;
1053032
1053316
  }
1053033
- case "tabbed":
1053317
+ case "tabbed": {
1053318
+ const tabbedItem = await convertTabbedNavigation(navigationConfig.items, tabs, {
1053319
+ parsedDocsConfig,
1053320
+ organization,
1053321
+ fernWorkspaces,
1053322
+ context,
1053323
+ token,
1053324
+ version: version3,
1053325
+ fullSlugs,
1053326
+ absolutePathToFernFolder
1053327
+ });
1053034
1053328
  config = {
1053035
- tabs: await convertTabbedNavigation(navigationConfig.items, tabs, {
1053036
- parsedDocsConfig,
1053037
- organization,
1053038
- fernWorkspaces,
1053039
- context,
1053040
- token,
1053041
- version: version3,
1053042
- fullSlugs
1053043
- })
1053329
+ tabs: tabbedItem.tabs
1053044
1053330
  };
1053331
+ pages = { ...pages, ...tabbedItem.pages };
1053045
1053332
  break;
1053333
+ }
1053046
1053334
  case "versioned":
1053047
1053335
  config = {
1053048
1053336
  versions: await Promise.all(navigationConfig.versions.map(async (version4) => {
@@ -1053055,7 +1053343,8 @@ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfi
1053055
1053343
  context,
1053056
1053344
  token,
1053057
1053345
  version: version4.version,
1053058
- fullSlugs
1053346
+ fullSlugs,
1053347
+ absolutePathToFernFolder
1053059
1053348
  });
1053060
1053349
  pages = {
1053061
1053350
  ...pages,
@@ -1053092,7 +1053381,7 @@ function convertAvailability2(availability) {
1053092
1053381
  assertNever(availability);
1053093
1053382
  }
1053094
1053383
  }
1053095
- async function convertUnversionedNavigationConfig({ navigationConfig, tabs, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs }) {
1053384
+ async function convertUnversionedNavigationConfig({ navigationConfig, tabs, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
1053096
1053385
  let config;
1053097
1053386
  let pages = {};
1053098
1053387
  switch (navigationConfig.type) {
@@ -1053105,7 +1053394,8 @@ async function convertUnversionedNavigationConfig({ navigationConfig, tabs, pars
1053105
1053394
  context,
1053106
1053395
  token,
1053107
1053396
  version: version3,
1053108
- fullSlugs
1053397
+ fullSlugs,
1053398
+ absolutePathToFernFolder
1053109
1053399
  })));
1053110
1053400
  config = {
1053111
1053401
  items: untabbedItems.map((item) => item.item)
@@ -1053119,17 +1053409,20 @@ async function convertUnversionedNavigationConfig({ navigationConfig, tabs, pars
1053119
1053409
  break;
1053120
1053410
  }
1053121
1053411
  case "tabbed": {
1053412
+ const tabbedItem = await convertTabbedNavigation(navigationConfig.items, tabs, {
1053413
+ parsedDocsConfig,
1053414
+ organization,
1053415
+ fernWorkspaces,
1053416
+ context,
1053417
+ token,
1053418
+ version: version3,
1053419
+ fullSlugs,
1053420
+ absolutePathToFernFolder
1053421
+ });
1053122
1053422
  config = {
1053123
- tabs: await convertTabbedNavigation(navigationConfig.items, tabs, {
1053124
- parsedDocsConfig,
1053125
- organization,
1053126
- fernWorkspaces,
1053127
- context,
1053128
- token,
1053129
- version: version3,
1053130
- fullSlugs
1053131
- })
1053423
+ tabs: tabbedItem.tabs
1053132
1053424
  };
1053425
+ pages = { ...pages, ...tabbedItem.pages };
1053133
1053426
  break;
1053134
1053427
  }
1053135
1053428
  default:
@@ -1053140,8 +1053433,9 @@ async function convertUnversionedNavigationConfig({ navigationConfig, tabs, pars
1053140
1053433
  pages
1053141
1053434
  };
1053142
1053435
  }
1053143
- function convertTabbedNavigation(items, tabs, { parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs }) {
1053144
- return Promise.all(items.map(async (tabbedItem) => {
1053436
+ async function convertTabbedNavigation(items, tabs, { parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
1053437
+ let pages = {};
1053438
+ const convertedTabs = await Promise.all(items.map(async (tabbedItem) => {
1053145
1053439
  const tabConfig = tabs == null ? void 0 : tabs[tabbedItem.tab];
1053146
1053440
  if (tabConfig == null) {
1053147
1053441
  throw new Error(`Couldn't find config for tab id ${tabbedItem.tab}`);
@@ -1053167,8 +1053461,15 @@ function convertTabbedNavigation(items, tabs, { parsedDocsConfig, organization,
1053167
1053461
  context,
1053168
1053462
  token,
1053169
1053463
  version: version3,
1053170
- fullSlugs
1053464
+ fullSlugs,
1053465
+ absolutePathToFernFolder
1053171
1053466
  })));
1053467
+ tabbedItems.forEach((tabbedItem2) => {
1053468
+ pages = {
1053469
+ ...pages,
1053470
+ ...tabbedItem2.pages
1053471
+ };
1053472
+ });
1053172
1053473
  return {
1053173
1053474
  title: tabConfig.displayName,
1053174
1053475
  icon: tabConfig.icon,
@@ -1053176,6 +1053477,10 @@ function convertTabbedNavigation(items, tabs, { parsedDocsConfig, organization,
1053176
1053477
  urlSlugOverride: tabConfig.slug
1053177
1053478
  };
1053178
1053479
  }));
1053480
+ return {
1053481
+ tabs: convertedTabs,
1053482
+ pages
1053483
+ };
1053179
1053484
  }
1053180
1053485
  function convertDocsTypographyConfiguration({ typographyConfiguration, parsedDocsConfig, uploadUrls, context, fullSlugs }) {
1053181
1053486
  if (typographyConfiguration == null) {
@@ -1053334,7 +1053639,7 @@ function convertImageReference2({ imageReference: imageReference2, parsedDocsCon
1053334
1053639
  }
1053335
1053640
  return file.fileId;
1053336
1053641
  }
1053337
- async function convertNavigationItem2({ item, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs }) {
1053642
+ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
1053338
1053643
  var _a5, _b4;
1053339
1053644
  let convertedItem;
1053340
1053645
  let pages = {};
@@ -1053360,7 +1053665,8 @@ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fe
1053360
1053665
  context,
1053361
1053666
  token,
1053362
1053667
  version: version3,
1053363
- fullSlugs
1053668
+ fullSlugs,
1053669
+ absolutePathToFernFolder
1053364
1053670
  })));
1053365
1053671
  convertedItem = {
1053366
1053672
  type: "section",
@@ -1053400,8 +1053706,7 @@ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fe
1053400
1053706
  const changelogItems = [];
1053401
1053707
  if (workspace.changelog != null) {
1053402
1053708
  for (const file of workspace.changelog.files) {
1053403
- const splitFilepath = file.absoluteFilepath.split("/");
1053404
- const filename = splitFilepath[splitFilepath.length - 1];
1053709
+ const filename = last_default(file.absoluteFilepath.split("/"));
1053405
1053710
  if (filename == null) {
1053406
1053711
  continue;
1053407
1053712
  }
@@ -1053409,12 +1053714,13 @@ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fe
1053409
1053714
  if (changelogDate == null) {
1053410
1053715
  continue;
1053411
1053716
  }
1053412
- pages[file.absoluteFilepath] = {
1053717
+ const relativePath = relative(absolutePathToFernFolder, file.absoluteFilepath);
1053718
+ pages[relativePath] = {
1053413
1053719
  markdown: file.contents
1053414
1053720
  };
1053415
1053721
  changelogItems.push({
1053416
1053722
  date: changelogDate.toISOString(),
1053417
- pageId: file.absoluteFilepath
1053723
+ pageId: relativePath
1053418
1053724
  });
1053419
1053725
  }
1053420
1053726
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.26.4",
3
+ "version": "0.26.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",