@fern-api/fern-api-dev 5.101.1 → 5.101.2

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 +168 -84
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -265878,82 +265878,6 @@ var init_convertEnvironments = __esm({
265878
265878
  }
265879
265879
  });
265880
265880
 
265881
- // ../../commons/ir-utils/lib/hashJSON.js
265882
- function hashJSON(obj) {
265883
- let hash5 = 2166136261;
265884
- function feedChar(char) {
265885
- hash5 ^= char;
265886
- hash5 += (hash5 << 1) + (hash5 << 4) + (hash5 << 7) + (hash5 << 8) + (hash5 << 24);
265887
- hash5 >>>= 0;
265888
- }
265889
- function feedString(str2) {
265890
- for (let i5 = 0, len = str2.length; i5 < len; i5++) {
265891
- feedChar(str2.charCodeAt(i5));
265892
- }
265893
- }
265894
- function traverse(value2, currentDepth) {
265895
- if (typeof value2 === "object" && value2 != null) {
265896
- if (currentDepth > MAX_DEPTH) {
265897
- feedString("[MaxDepthExceeded]");
265898
- return;
265899
- }
265900
- if (Array.isArray(value2)) {
265901
- feedChar(91);
265902
- for (let i5 = 0; i5 < value2.length; i5++) {
265903
- if (i5 > 0) {
265904
- feedChar(44);
265905
- }
265906
- traverse(value2[i5], currentDepth + 1);
265907
- }
265908
- feedChar(93);
265909
- } else {
265910
- feedChar(123);
265911
- const keys25 = Object.keys(value2).sort();
265912
- const klen = keys25.length;
265913
- for (let i5 = 0; i5 < klen; i5++) {
265914
- if (i5 > 0) {
265915
- feedChar(44);
265916
- }
265917
- feedString(keys25[i5] ?? "");
265918
- feedChar(58);
265919
- traverse(value2[keys25[i5] ?? ""], currentDepth + 1);
265920
- }
265921
- feedChar(125);
265922
- }
265923
- } else {
265924
- feedString(String(value2));
265925
- }
265926
- }
265927
- traverse(obj, 0);
265928
- return hash5.toString(16);
265929
- }
265930
- var MAX_DEPTH;
265931
- var init_hashJSON = __esm({
265932
- "../../commons/ir-utils/lib/hashJSON.js"() {
265933
- "use strict";
265934
- MAX_DEPTH = 64;
265935
- }
265936
- });
265937
-
265938
- // ../../commons/ir-utils/lib/utils/isTypeReferenceOptional.js
265939
- function isTypeReferenceOptional({ typeReference: typeReference2, typeDeclarations }) {
265940
- if (typeReference2.type === "container" && typeReference2.container.type === "optional") {
265941
- return true;
265942
- }
265943
- if (typeReference2.type === "named") {
265944
- const typeDeclaration2 = typeDeclarations?.[typeReference2.typeId];
265945
- if (typeDeclaration2?.shape.type === "alias" && typeDeclaration2?.shape.resolvedType.type === "container" && typeDeclaration2?.shape.resolvedType.container.type === "optional") {
265946
- return true;
265947
- }
265948
- }
265949
- return false;
265950
- }
265951
- var init_isTypeReferenceOptional = __esm({
265952
- "../../commons/ir-utils/lib/utils/isTypeReferenceOptional.js"() {
265953
- "use strict";
265954
- }
265955
- });
265956
-
265957
265881
  // ../../commons/casings-generator/lib/reserved.js
265958
265882
  var RESERVED_KEYWORDS;
265959
265883
  var init_reserved = __esm({
@@ -266849,6 +266773,82 @@ var init_namesUtils = __esm({
266849
266773
  }
266850
266774
  });
266851
266775
 
266776
+ // ../../commons/ir-utils/lib/hashJSON.js
266777
+ function hashJSON(obj) {
266778
+ let hash5 = 2166136261;
266779
+ function feedChar(char) {
266780
+ hash5 ^= char;
266781
+ hash5 += (hash5 << 1) + (hash5 << 4) + (hash5 << 7) + (hash5 << 8) + (hash5 << 24);
266782
+ hash5 >>>= 0;
266783
+ }
266784
+ function feedString(str2) {
266785
+ for (let i5 = 0, len = str2.length; i5 < len; i5++) {
266786
+ feedChar(str2.charCodeAt(i5));
266787
+ }
266788
+ }
266789
+ function traverse(value2, currentDepth) {
266790
+ if (typeof value2 === "object" && value2 != null) {
266791
+ if (currentDepth > MAX_DEPTH) {
266792
+ feedString("[MaxDepthExceeded]");
266793
+ return;
266794
+ }
266795
+ if (Array.isArray(value2)) {
266796
+ feedChar(91);
266797
+ for (let i5 = 0; i5 < value2.length; i5++) {
266798
+ if (i5 > 0) {
266799
+ feedChar(44);
266800
+ }
266801
+ traverse(value2[i5], currentDepth + 1);
266802
+ }
266803
+ feedChar(93);
266804
+ } else {
266805
+ feedChar(123);
266806
+ const keys25 = Object.keys(value2).sort();
266807
+ const klen = keys25.length;
266808
+ for (let i5 = 0; i5 < klen; i5++) {
266809
+ if (i5 > 0) {
266810
+ feedChar(44);
266811
+ }
266812
+ feedString(keys25[i5] ?? "");
266813
+ feedChar(58);
266814
+ traverse(value2[keys25[i5] ?? ""], currentDepth + 1);
266815
+ }
266816
+ feedChar(125);
266817
+ }
266818
+ } else {
266819
+ feedString(String(value2));
266820
+ }
266821
+ }
266822
+ traverse(obj, 0);
266823
+ return hash5.toString(16);
266824
+ }
266825
+ var MAX_DEPTH;
266826
+ var init_hashJSON = __esm({
266827
+ "../../commons/ir-utils/lib/hashJSON.js"() {
266828
+ "use strict";
266829
+ MAX_DEPTH = 64;
266830
+ }
266831
+ });
266832
+
266833
+ // ../../commons/ir-utils/lib/utils/isTypeReferenceOptional.js
266834
+ function isTypeReferenceOptional({ typeReference: typeReference2, typeDeclarations }) {
266835
+ if (typeReference2.type === "container" && typeReference2.container.type === "optional") {
266836
+ return true;
266837
+ }
266838
+ if (typeReference2.type === "named") {
266839
+ const typeDeclaration2 = typeDeclarations?.[typeReference2.typeId];
266840
+ if (typeDeclaration2?.shape.type === "alias" && typeDeclaration2?.shape.resolvedType.type === "container" && typeDeclaration2?.shape.resolvedType.container.type === "optional") {
266841
+ return true;
266842
+ }
266843
+ }
266844
+ return false;
266845
+ }
266846
+ var init_isTypeReferenceOptional = __esm({
266847
+ "../../commons/ir-utils/lib/utils/isTypeReferenceOptional.js"() {
266848
+ "use strict";
266849
+ }
266850
+ });
266851
+
266852
266852
  // ../../commons/ir-utils/lib/examples/v1/generateContainerExample.js
266853
266853
  function generateContainerExample({ fieldName, containerType, maxDepth, currentDepth, typeDeclarations, skipOptionalProperties, visitedTypes }) {
266854
266854
  if (currentDepth >= maxDepth) {
@@ -268446,8 +268446,8 @@ function generateEndpointExample({ ir: ir3, endpoint: endpoint3, service, typeDe
268446
268446
  return { type: "failure", message: `Parse failure with exceptions ${e2}` };
268447
268447
  }
268448
268448
  }
268449
- function getUrlForExample(endpoint3, example) {
268450
- const pathParameters = {};
268449
+ function getUrlForExample(endpoint3, example, fallbackPathParameterValues = {}) {
268450
+ const pathParameters = { ...fallbackPathParameterValues };
268451
268451
  [...example.rootPathParameters, ...example.servicePathParameters, ...example.endpointPathParameters].forEach((examplePathParameter) => {
268452
268452
  const value2 = examplePathParameter.value.jsonExample;
268453
268453
  const stringValue = typeof value2 === "string" ? value2 : JSON.stringify(value2);
@@ -268478,6 +268478,87 @@ var init_generateEndpointExample = __esm({
268478
268478
  }
268479
268479
  });
268480
268480
 
268481
+ // ../../commons/ir-utils/lib/examples/backfillMissingPathParameterExamples.js
268482
+ function backfillMissingPathParameterExamples({ ir: ir3 }) {
268483
+ for (const service of Object.values(ir3.services)) {
268484
+ for (const endpoint3 of service.endpoints) {
268485
+ for (const userSpecifiedExample of endpoint3.userSpecifiedExamples) {
268486
+ if (userSpecifiedExample.example == null) {
268487
+ continue;
268488
+ }
268489
+ backfillExample({
268490
+ typeDeclarations: ir3.types,
268491
+ rootPathParameters: ir3.pathParameters,
268492
+ service,
268493
+ endpoint: endpoint3,
268494
+ example: userSpecifiedExample.example
268495
+ });
268496
+ }
268497
+ }
268498
+ }
268499
+ return ir3;
268500
+ }
268501
+ function backfillExample({ typeDeclarations, rootPathParameters, service, endpoint: endpoint3, example }) {
268502
+ const buckets = [
268503
+ { declared: rootPathParameters, examples: example.rootPathParameters },
268504
+ { declared: service.pathParameters, examples: example.servicePathParameters },
268505
+ { declared: endpoint3.pathParameters, examples: example.endpointPathParameters }
268506
+ ];
268507
+ const suppliedNames = new Set(buckets.flatMap((bucket) => bucket.examples.map((pathParameter) => getOriginalName(pathParameter.name))));
268508
+ let anyMissing = false;
268509
+ const clientDefaultValues = {};
268510
+ for (const bucket of buckets) {
268511
+ for (const pathParameter of bucket.declared) {
268512
+ if (suppliedNames.has(getOriginalName(pathParameter.name))) {
268513
+ continue;
268514
+ }
268515
+ anyMissing = true;
268516
+ if (pathParameter.clientDefault != null) {
268517
+ clientDefaultValues[getOriginalName(pathParameter.name)] = literalToString(pathParameter.clientDefault);
268518
+ continue;
268519
+ }
268520
+ const pathParameterExample = generateExample({ pathParameter, typeDeclarations });
268521
+ if (pathParameterExample == null) {
268522
+ continue;
268523
+ }
268524
+ bucket.examples.push(pathParameterExample);
268525
+ }
268526
+ }
268527
+ if (anyMissing) {
268528
+ example.url = getUrlForExample(endpoint3, example, clientDefaultValues);
268529
+ }
268530
+ }
268531
+ function generateExample({ pathParameter, typeDeclarations }) {
268532
+ const generated = generatePathParameterExamples2([pathParameter], {
268533
+ typeDeclarations,
268534
+ skipOptionalRequestProperties: true,
268535
+ maxDepth: 1
268536
+ });
268537
+ if (generated.type === "failure") {
268538
+ return void 0;
268539
+ }
268540
+ return generated.example[0];
268541
+ }
268542
+ function literalToString(literal3) {
268543
+ switch (literal3.type) {
268544
+ case "string":
268545
+ return literal3.string;
268546
+ case "boolean":
268547
+ return String(literal3.boolean);
268548
+ default:
268549
+ assertNever(literal3);
268550
+ }
268551
+ }
268552
+ var init_backfillMissingPathParameterExamples = __esm({
268553
+ "../../commons/ir-utils/lib/examples/backfillMissingPathParameterExamples.js"() {
268554
+ "use strict";
268555
+ init_lib4();
268556
+ init_namesUtils();
268557
+ init_generateEndpointExample();
268558
+ init_generateParameterExamples();
268559
+ }
268560
+ });
268561
+
268481
268562
  // ../../commons/ir-utils/lib/examples/v1/generateWebSocketExample.js
268482
268563
  function generateWebSocketExample({ ir: ir3, channel: channel3, typeDeclarations, skipOptionalRequestProperties }) {
268483
268564
  const result = {
@@ -272308,6 +272389,7 @@ var init_lib22 = __esm({
272308
272389
  init_convertApiAuth();
272309
272390
  init_constructHttpPath();
272310
272391
  init_convertEnvironments();
272392
+ init_backfillMissingPathParameterExamples();
272311
272393
  init_injectAutogeneratedExamples();
272312
272394
  init_generateEndpointExample();
272313
272395
  init_filterIntermediateRepresentationForAudiences();
@@ -282040,6 +282122,7 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
282040
282122
  resolveGlobalParameterApplicability(intermediateRepresentation, {
282041
282123
  onWarning: (message) => context3.logger.warn(message)
282042
282124
  });
282125
+ backfillMissingPathParameterExamples({ ir: intermediateRepresentation });
282043
282126
  const intermediateRepresentationWithGeneratedExamples = exampleGeneration.disabled ? intermediateRepresentation : injectAutogeneratedExamples({ ir: intermediateRepresentation, exampleGeneration });
282044
282127
  const workspaceDefinitionRootApiFileContents = workspace.definition.rootApiFile.contents;
282045
282128
  const ignoreAudiences = environments2?.environments._visit({
@@ -347875,6 +347958,7 @@ var init_AbstractSpecConverter = __esm({
347875
347958
  if (!this.irGraph.hasNoAudiences()) {
347876
347959
  ir3 = this.filterIrForAudiences(ir3);
347877
347960
  }
347961
+ backfillMissingPathParameterExamples({ ir: ir3 });
347878
347962
  const exampleGeneration = this.context.exampleGenerationArgs;
347879
347963
  const irWithV2Examples = injectAutogeneratedV2Examples({ ir: ir3, exampleGeneration, logger: this.context.logger });
347880
347964
  if (this.context.generateV1Examples) {
@@ -703346,7 +703430,7 @@ var AccessTokenPosthogManager = class {
703346
703430
  properties: {
703347
703431
  ...event,
703348
703432
  ...event.properties,
703349
- version: "5.101.1",
703433
+ version: "5.101.2",
703350
703434
  usingAccessToken: true,
703351
703435
  ...getRunIdProperties()
703352
703436
  }
@@ -703412,7 +703496,7 @@ var UserPosthogManager = class {
703412
703496
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
703413
703497
  event: "CLI",
703414
703498
  properties: {
703415
- version: "5.101.1",
703499
+ version: "5.101.2",
703416
703500
  ...event,
703417
703501
  ...event.properties,
703418
703502
  usingAccessToken: false,
@@ -884794,7 +884878,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
884794
884878
  var LOGS_FOLDER_NAME = "logs";
884795
884879
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
884796
884880
  function getCliSource() {
884797
- const version7 = "5.101.1";
884881
+ const version7 = "5.101.2";
884798
884882
  return `cli@${version7}`;
884799
884883
  }
884800
884884
  var DebugLogger = class {
@@ -910714,7 +910798,7 @@ var LegacyDocsPublisher = class {
910714
910798
  previewId,
910715
910799
  disableTemplates: void 0,
910716
910800
  skipUpload,
910717
- cliVersion: "5.101.1",
910801
+ cliVersion: "5.101.2",
910718
910802
  loginCommand: "fern auth login"
910719
910803
  });
910720
910804
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -978085,7 +978169,7 @@ function getAutomationContextFromEnv() {
978085
978169
  config_branch: process.env.FERN_CONFIG_BRANCH,
978086
978170
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
978087
978171
  trigger: process.env.GITHUB_EVENT_NAME,
978088
- cli_version: "5.101.1"
978172
+ cli_version: "5.101.2"
978089
978173
  };
978090
978174
  }
978091
978175
  function isAutomationMode() {
@@ -978917,7 +979001,7 @@ var CliContext = class _CliContext {
978917
979001
  if (false) {
978918
979002
  this.logger.error("CLI_VERSION is not defined");
978919
979003
  }
978920
- return "5.101.1";
979004
+ return "5.101.2";
978921
979005
  }
978922
979006
  getCliName() {
978923
979007
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.101.1",
2
+ "version": "5.101.2",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",