@fern-api/fern-api-dev 5.44.10 → 5.44.12

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 +92 -8
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -669562,7 +669562,7 @@ var AccessTokenPosthogManager = class {
669562
669562
  properties: {
669563
669563
  ...event,
669564
669564
  ...event.properties,
669565
- version: "5.44.10",
669565
+ version: "5.44.12",
669566
669566
  usingAccessToken: true,
669567
669567
  ...getRunIdProperties()
669568
669568
  }
@@ -669626,7 +669626,7 @@ var UserPosthogManager = class {
669626
669626
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
669627
669627
  event: "CLI",
669628
669628
  properties: {
669629
- version: "5.44.10",
669629
+ version: "5.44.12",
669630
669630
  ...event,
669631
669631
  ...event.properties,
669632
669632
  usingAccessToken: false,
@@ -823807,6 +823807,15 @@ async function processEndpoint(workItem, enhancer, context3, organizationId, sta
823807
823807
  try {
823808
823808
  const result = await enhancer.enhanceExample(request7);
823809
823809
  circuitBreaker?.recordSuccess();
823810
+ if (result.enhancedRequestExample != null && request7.originalRequestExample != null) {
823811
+ const unwrapped = unwrapLambdaBodyEnvelope(result.enhancedRequestExample);
823812
+ const originalHasBody = isObjectWithKey(request7.originalRequestExample, "body");
823813
+ if (unwrapped.wasWrapped && !originalHasBody) {
823814
+ result.enhancedRequestExample = backfillMissingFields(unwrapped.inner, request7.originalRequestExample);
823815
+ } else {
823816
+ result.enhancedRequestExample = backfillMissingFields(result.enhancedRequestExample, request7.originalRequestExample);
823817
+ }
823818
+ }
823810
823819
  const requestChanged = result.enhancedRequestExample !== request7.originalRequestExample;
823811
823820
  const responseChanged = result.enhancedResponseExample !== request7.originalResponseExample;
823812
823821
  if (requestChanged || responseChanged) {
@@ -824080,6 +824089,39 @@ function extractExampleValue(bodyV3) {
824080
824089
  return bodyV3.value;
824081
824090
  }
824082
824091
  }
824092
+ function isObjectWithKey(value2, key2) {
824093
+ return typeof value2 === "object" && value2 !== null && !Array.isArray(value2) && key2 in value2;
824094
+ }
824095
+ function unwrapLambdaBodyEnvelope(value2) {
824096
+ if (typeof value2 === "object" && value2 !== null && !Array.isArray(value2) && "body" in value2) {
824097
+ return { wasWrapped: true, inner: value2.body };
824098
+ }
824099
+ return { wasWrapped: false, inner: value2 };
824100
+ }
824101
+ function backfillMissingFields(enhanced, original) {
824102
+ if (typeof enhanced !== "object" || enhanced === null || typeof original !== "object" || original === null || Array.isArray(enhanced) || Array.isArray(original)) {
824103
+ return enhanced;
824104
+ }
824105
+ const enhancedObj = enhanced;
824106
+ const originalObj = original;
824107
+ let hasMissing = false;
824108
+ for (const key2 of Object.keys(originalObj)) {
824109
+ if (!(key2 in enhancedObj)) {
824110
+ hasMissing = true;
824111
+ break;
824112
+ }
824113
+ }
824114
+ if (!hasMissing) {
824115
+ return enhanced;
824116
+ }
824117
+ const merged = { ...enhancedObj };
824118
+ for (const [key2, value2] of Object.entries(originalObj)) {
824119
+ if (!(key2 in merged)) {
824120
+ merged[key2] = value2;
824121
+ }
824122
+ }
824123
+ return merged;
824124
+ }
824083
824125
 
824084
824126
  // ../register/lib/ir-to-fdr-converter/convertIrToFdrApi.js
824085
824127
  init_js();
@@ -861325,7 +861367,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
861325
861367
  var LOGS_FOLDER_NAME = "logs";
861326
861368
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
861327
861369
  function getCliSource() {
861328
- const version7 = "5.44.10";
861370
+ const version7 = "5.44.12";
861329
861371
  return `cli@${version7}`;
861330
861372
  }
861331
861373
  var DebugLogger = class {
@@ -892417,7 +892459,7 @@ var LegacyDocsPublisher = class {
892417
892459
  previewId,
892418
892460
  disableTemplates: void 0,
892419
892461
  skipUpload,
892420
- cliVersion: "5.44.10",
892462
+ cliVersion: "5.44.12",
892421
892463
  loginCommand: "fern auth login"
892422
892464
  });
892423
892465
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -941265,7 +941307,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
941265
941307
  idx
941266
941308
  });
941267
941309
  await (0, import_promises127.mkdir)(import_node_path40.default.dirname(dynamicSnippetFilePath), { recursive: true });
941268
- await (0, import_promises127.writeFile)(dynamicSnippetFilePath, response.snippet);
941310
+ await (0, import_promises127.writeFile)(dynamicSnippetFilePath, this.wrapSnippetAsLibrary(response.snippet, `Example${idx}`));
941269
941311
  } catch (error50) {
941270
941312
  this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
941271
941313
  }
@@ -941273,14 +941315,56 @@ var DynamicSnippetsSwiftTestGenerator = class {
941273
941315
  this.context.logger.debug("Done generating dynamic snippet tests");
941274
941316
  }
941275
941317
  async initializeProject(outputDir) {
941276
- const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
941318
+ const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Tests/Snippets"));
941277
941319
  await (0, import_promises127.mkdir)(absolutePathToOutputDir, { recursive: true });
941278
941320
  return absolutePathToOutputDir;
941279
941321
  }
941280
941322
  getTestFilePath({ absolutePathToOutputDir, idx }) {
941281
941323
  return join8(absolutePathToOutputDir, RelativeFilePath2.of(`Example${idx}.swift`));
941282
941324
  }
941325
+ wrapSnippetAsLibrary(snippet2, enumName) {
941326
+ return wrapSnippetAsLibrary({
941327
+ snippet: snippet2,
941328
+ enumName,
941329
+ warn: (message) => this.context.logger.warn(message)
941330
+ });
941331
+ }
941283
941332
  };
941333
+ function wrapSnippetAsLibrary({ snippet: snippet2, enumName, warn: warn2 }) {
941334
+ const FUNC_DECL = "private func main() async throws {";
941335
+ const FUNC_INVOCATION = "try await main()";
941336
+ if (!snippet2.includes(FUNC_DECL)) {
941337
+ warn2(`Snippet ${enumName} does not match expected format (missing '${FUNC_DECL}'). Writing raw snippet.`);
941338
+ return snippet2;
941339
+ }
941340
+ const lines = snippet2.trimEnd().split("\n");
941341
+ const result = [];
941342
+ let insideFunc = false;
941343
+ let foundInvocation = false;
941344
+ for (const line of lines) {
941345
+ if (line.trimEnd() === FUNC_DECL) {
941346
+ result.push(`enum ${enumName} {`);
941347
+ result.push(" static func snippet() async throws {");
941348
+ insideFunc = true;
941349
+ } else if (line.trimEnd() === FUNC_INVOCATION) {
941350
+ foundInvocation = true;
941351
+ } else if (insideFunc) {
941352
+ result.push(line === "" ? "" : ` ${line}`);
941353
+ } else {
941354
+ result.push(line);
941355
+ }
941356
+ }
941357
+ if (!foundInvocation) {
941358
+ warn2(`Snippet ${enumName} missing expected '${FUNC_INVOCATION}'. Writing raw snippet.`);
941359
+ return snippet2;
941360
+ }
941361
+ while (result.length > 0 && result[result.length - 1] === "") {
941362
+ result.pop();
941363
+ }
941364
+ result.push("}");
941365
+ result.push("");
941366
+ return result.join("\n");
941367
+ }
941284
941368
 
941285
941369
  // ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
941286
941370
  init_lib8();
@@ -957514,7 +957598,7 @@ function getAutomationContextFromEnv() {
957514
957598
  config_branch: process.env.FERN_CONFIG_BRANCH,
957515
957599
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
957516
957600
  trigger: process.env.GITHUB_EVENT_NAME,
957517
- cli_version: "5.44.10"
957601
+ cli_version: "5.44.12"
957518
957602
  };
957519
957603
  }
957520
957604
  function isAutomationMode() {
@@ -958340,7 +958424,7 @@ var CliContext = class _CliContext {
958340
958424
  if (false) {
958341
958425
  this.logger.error("CLI_VERSION is not defined");
958342
958426
  }
958343
- return "5.44.10";
958427
+ return "5.44.12";
958344
958428
  }
958345
958429
  getCliName() {
958346
958430
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.44.10",
2
+ "version": "5.44.12",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",