@fern-api/fern-api-dev 5.23.3-453-g95a1c6fbe81 → 5.23.3-459-gc7f48c6da37

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 +82 -18
  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.23.3-453-g95a1c6fbe81",
669565
+ version: "5.23.3-459-gc7f48c6da37",
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.23.3-453-g95a1c6fbe81",
669629
+ version: "5.23.3-459-gc7f48c6da37",
669630
669630
  ...event,
669631
669631
  ...event.properties,
669632
669632
  usingAccessToken: false,
@@ -861367,7 +861367,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
861367
861367
  var LOGS_FOLDER_NAME = "logs";
861368
861368
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
861369
861369
  function getCliSource() {
861370
- const version7 = "5.23.3-453-g95a1c6fbe81";
861370
+ const version7 = "5.23.3-459-gc7f48c6da37";
861371
861371
  return `cli@${version7}`;
861372
861372
  }
861373
861373
  var DebugLogger = class {
@@ -892459,7 +892459,7 @@ var LegacyDocsPublisher = class {
892459
892459
  previewId,
892460
892460
  disableTemplates: void 0,
892461
892461
  skipUpload,
892462
- cliVersion: "5.23.3-453-g95a1c6fbe81",
892462
+ cliVersion: "5.23.3-459-gc7f48c6da37",
892463
892463
  loginCommand: "fern auth login"
892464
892464
  });
892465
892465
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -925028,14 +925028,25 @@ var EndpointSnippetGenerator5 = class {
925028
925028
  getMethodArgsForBodyRequest({ request: request7, snippet: snippet2 }) {
925029
925029
  const args = [];
925030
925030
  this.context.errors.scope(Scope4.PathParameters);
925031
- const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
925032
- if (pathParameters.length > 0) {
925033
- args.push(...this.getPathParameters({ namedParameters: pathParameters, snippet: snippet2 }).map((field5) => field5.value));
925031
+ const irPathParameters = this.context.ir.pathParameters ?? [];
925032
+ const requiredIrPathParameters = irPathParameters.filter((p14) => p14.variable == null);
925033
+ const optionalIrPathParameters = irPathParameters.filter((p14) => p14.variable != null);
925034
+ const requiredPathParameters = [...requiredIrPathParameters, ...request7.pathParameters ?? []];
925035
+ if (requiredPathParameters.length > 0) {
925036
+ args.push(...this.getPathParameters({ namedParameters: requiredPathParameters, snippet: snippet2 }).map((field5) => field5.value));
925034
925037
  }
925035
925038
  this.context.errors.unscope();
925036
925039
  this.context.errors.scope(Scope4.RequestBody);
925037
925040
  if (request7.body != null) {
925038
- args.push(this.getBodyRequestArg({ body: request7.body, value: snippet2.requestBody }));
925041
+ const bodyArg = this.getBodyRequestArg({ body: request7.body, value: snippet2.requestBody });
925042
+ if (!php_exports.TypeLiteral.isNop(bodyArg)) {
925043
+ args.push(bodyArg);
925044
+ }
925045
+ }
925046
+ this.context.errors.unscope();
925047
+ this.context.errors.scope(Scope4.PathParameters);
925048
+ if (optionalIrPathParameters.length > 0) {
925049
+ args.push(...this.getPathParameters({ namedParameters: optionalIrPathParameters, snippet: snippet2 }).map((field5) => field5.value));
925039
925050
  }
925040
925051
  this.context.errors.unscope();
925041
925052
  return args;
@@ -925062,17 +925073,25 @@ var EndpointSnippetGenerator5 = class {
925062
925073
  const args = [];
925063
925074
  const inlinePathParameters = this.context.customConfig?.inlinePathParameters ?? false;
925064
925075
  this.context.errors.scope(Scope4.PathParameters);
925065
- const pathParameterFields = [];
925066
- const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
925067
- if (pathParameters.length > 0) {
925068
- pathParameterFields.push(...this.getPathParameters({ namedParameters: pathParameters, snippet: snippet2 }));
925069
- }
925076
+ const irPathParameters = this.context.ir.pathParameters ?? [];
925077
+ const requiredIrPathParameters = irPathParameters.filter((p14) => p14.variable == null);
925078
+ const optionalIrPathParameters = irPathParameters.filter((p14) => p14.variable != null);
925079
+ const requiredPathParameterFields = [];
925080
+ const requiredPathParams = [...requiredIrPathParameters, ...request7.pathParameters ?? []];
925081
+ if (requiredPathParams.length > 0) {
925082
+ requiredPathParameterFields.push(...this.getPathParameters({ namedParameters: requiredPathParams, snippet: snippet2 }));
925083
+ }
925084
+ const optionalPathParameterFields = [];
925085
+ if (optionalIrPathParameters.length > 0) {
925086
+ optionalPathParameterFields.push(...this.getPathParameters({ namedParameters: optionalIrPathParameters, snippet: snippet2 }));
925087
+ }
925088
+ const pathParameterFields = [...requiredPathParameterFields, ...optionalPathParameterFields];
925070
925089
  this.context.errors.unscope();
925071
925090
  this.context.errors.scope(Scope4.RequestBody);
925072
925091
  const filePropertyInfo = this.getFilePropertyInfo({ request: request7, snippet: snippet2 });
925073
925092
  this.context.errors.unscope();
925074
925093
  if (!this.context.includePathParametersInWrappedRequest({ request: request7, inlinePathParameters })) {
925075
- args.push(...pathParameterFields.map((field5) => field5.value));
925094
+ args.push(...requiredPathParameterFields.map((field5) => field5.value));
925076
925095
  }
925077
925096
  if (this.context.needsRequestParameter({
925078
925097
  request: request7,
@@ -925090,6 +925109,9 @@ var EndpointSnippetGenerator5 = class {
925090
925109
  filePropertyInfo
925091
925110
  }));
925092
925111
  }
925112
+ if (!this.context.includePathParametersInWrappedRequest({ request: request7, inlinePathParameters })) {
925113
+ args.push(...optionalPathParameterFields.map((field5) => field5.value));
925114
+ }
925093
925115
  return args;
925094
925116
  }
925095
925117
  getFilePropertyInfo({ request: request7, snippet: snippet2 }) {
@@ -941307,7 +941329,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
941307
941329
  idx
941308
941330
  });
941309
941331
  await (0, import_promises127.mkdir)(import_node_path40.default.dirname(dynamicSnippetFilePath), { recursive: true });
941310
- await (0, import_promises127.writeFile)(dynamicSnippetFilePath, response.snippet);
941332
+ await (0, import_promises127.writeFile)(dynamicSnippetFilePath, this.wrapSnippetAsLibrary(response.snippet, `Example${idx}`));
941311
941333
  } catch (error50) {
941312
941334
  this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
941313
941335
  }
@@ -941315,14 +941337,56 @@ var DynamicSnippetsSwiftTestGenerator = class {
941315
941337
  this.context.logger.debug("Done generating dynamic snippet tests");
941316
941338
  }
941317
941339
  async initializeProject(outputDir) {
941318
- const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
941340
+ const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Tests/Snippets"));
941319
941341
  await (0, import_promises127.mkdir)(absolutePathToOutputDir, { recursive: true });
941320
941342
  return absolutePathToOutputDir;
941321
941343
  }
941322
941344
  getTestFilePath({ absolutePathToOutputDir, idx }) {
941323
941345
  return join8(absolutePathToOutputDir, RelativeFilePath2.of(`Example${idx}.swift`));
941324
941346
  }
941347
+ wrapSnippetAsLibrary(snippet2, enumName) {
941348
+ return wrapSnippetAsLibrary({
941349
+ snippet: snippet2,
941350
+ enumName,
941351
+ warn: (message) => this.context.logger.warn(message)
941352
+ });
941353
+ }
941325
941354
  };
941355
+ function wrapSnippetAsLibrary({ snippet: snippet2, enumName, warn: warn2 }) {
941356
+ const FUNC_DECL = "private func main() async throws {";
941357
+ const FUNC_INVOCATION = "try await main()";
941358
+ if (!snippet2.includes(FUNC_DECL)) {
941359
+ warn2(`Snippet ${enumName} does not match expected format (missing '${FUNC_DECL}'). Writing raw snippet.`);
941360
+ return snippet2;
941361
+ }
941362
+ const lines = snippet2.trimEnd().split("\n");
941363
+ const result = [];
941364
+ let insideFunc = false;
941365
+ let foundInvocation = false;
941366
+ for (const line of lines) {
941367
+ if (line.trimEnd() === FUNC_DECL) {
941368
+ result.push(`enum ${enumName} {`);
941369
+ result.push(" static func snippet() async throws {");
941370
+ insideFunc = true;
941371
+ } else if (line.trimEnd() === FUNC_INVOCATION) {
941372
+ foundInvocation = true;
941373
+ } else if (insideFunc) {
941374
+ result.push(line === "" ? "" : ` ${line}`);
941375
+ } else {
941376
+ result.push(line);
941377
+ }
941378
+ }
941379
+ if (!foundInvocation) {
941380
+ warn2(`Snippet ${enumName} missing expected '${FUNC_INVOCATION}'. Writing raw snippet.`);
941381
+ return snippet2;
941382
+ }
941383
+ while (result.length > 0 && result[result.length - 1] === "") {
941384
+ result.pop();
941385
+ }
941386
+ result.push("}");
941387
+ result.push("");
941388
+ return result.join("\n");
941389
+ }
941326
941390
 
941327
941391
  // ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
941328
941392
  init_lib8();
@@ -957556,7 +957620,7 @@ function getAutomationContextFromEnv() {
957556
957620
  config_branch: process.env.FERN_CONFIG_BRANCH,
957557
957621
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
957558
957622
  trigger: process.env.GITHUB_EVENT_NAME,
957559
- cli_version: "5.23.3-453-g95a1c6fbe81"
957623
+ cli_version: "5.23.3-459-gc7f48c6da37"
957560
957624
  };
957561
957625
  }
957562
957626
  function isAutomationMode() {
@@ -958382,7 +958446,7 @@ var CliContext = class _CliContext {
958382
958446
  if (false) {
958383
958447
  this.logger.error("CLI_VERSION is not defined");
958384
958448
  }
958385
- return "5.23.3-453-g95a1c6fbe81";
958449
+ return "5.23.3-459-gc7f48c6da37";
958386
958450
  }
958387
958451
  getCliName() {
958388
958452
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.3-453-g95a1c6fbe81",
2
+ "version": "5.23.3-459-gc7f48c6da37",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",