@fern-api/fern-api-dev 5.63.1 → 5.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +51 -16
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -687227,7 +687227,7 @@ var AccessTokenPosthogManager = class {
687227
687227
  properties: {
687228
687228
  ...event,
687229
687229
  ...event.properties,
687230
- version: "5.63.1",
687230
+ version: "5.64.0",
687231
687231
  usingAccessToken: true,
687232
687232
  ...getRunIdProperties()
687233
687233
  }
@@ -687293,7 +687293,7 @@ var UserPosthogManager = class {
687293
687293
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
687294
687294
  event: "CLI",
687295
687295
  properties: {
687296
- version: "5.63.1",
687296
+ version: "5.64.0",
687297
687297
  ...event,
687298
687298
  ...event.properties,
687299
687299
  usingAccessToken: false,
@@ -868388,7 +868388,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
868388
868388
  var LOGS_FOLDER_NAME = "logs";
868389
868389
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
868390
868390
  function getCliSource() {
868391
- const version7 = "5.63.1";
868391
+ const version7 = "5.64.0";
868392
868392
  return `cli@${version7}`;
868393
868393
  }
868394
868394
  var DebugLogger = class {
@@ -889949,6 +889949,9 @@ var import_child_process8 = require("child_process");
889949
889949
  var import_path77 = __toESM(require("path"), 1);
889950
889950
  init_esm16();
889951
889951
  var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
889952
+ function isCommitSha(ref2) {
889953
+ return /^[0-9a-f]{7,40}$/i.test(ref2);
889954
+ }
889952
889955
  function cloneTargetKey(target) {
889953
889956
  return `${target.repo}#${target.ref ?? "HEAD"}`;
889954
889957
  }
@@ -889986,12 +889989,22 @@ async function resolveRemoteSpecs({ definitions: definitions7, context: context3
889986
889989
  const tmpDir = await import_tmp_promise12.default.dir({ unsafeCleanup: true });
889987
889990
  const clonePath = AbsoluteFilePath2.of(tmpDir.path);
889988
889991
  const git = simpleGit();
889989
- const cloneArgs = ["--depth", "1", "--config", "core.symlinks=false"];
889990
- if (target.ref != null) {
889991
- cloneArgs.push("--branch", target.ref);
889992
- }
889992
+ const useCommitShaFlow = target.ref != null && isCommitSha(target.ref);
889993
889993
  try {
889994
- await git.clone(target.repo, tmpDir.path, cloneArgs);
889994
+ if (useCommitShaFlow) {
889995
+ const ref2 = target.ref;
889996
+ const cloneArgs = ["--depth", "1", "--config", "core.symlinks=false", "--no-checkout"];
889997
+ await git.clone(target.repo, tmpDir.path, cloneArgs);
889998
+ const repoGit = simpleGit(tmpDir.path);
889999
+ await repoGit.fetch("origin", ref2, { "--depth": "1" });
890000
+ await repoGit.checkout(ref2);
890001
+ } else {
890002
+ const cloneArgs = ["--depth", "1", "--config", "core.symlinks=false"];
890003
+ if (target.ref != null) {
890004
+ cloneArgs.push("--branch", target.ref);
890005
+ }
890006
+ await git.clone(target.repo, tmpDir.path, cloneArgs);
890007
+ }
889995
890008
  } catch (error50) {
889996
890009
  const errorMessage = extractErrorMessage(error50);
889997
890010
  if (errorMessage.includes("Authentication failed") || errorMessage.includes("could not read Username") || errorMessage.includes("401") || errorMessage.includes("403")) {
@@ -890019,11 +890032,16 @@ async function resolveRemoteSpecs({ definitions: definitions7, context: context3
890019
890032
  throw new Error(`Invalid git source path '${def.gitSource.path}': path must be relative to the repository root and cannot traverse outside it.`);
890020
890033
  }
890021
890034
  if (def.schema.type === "protobuf") {
890035
+ const resolvedTarget = def.schema.target.length > 0 ? import_path77.default.resolve(clonedPath, def.schema.target) : def.schema.target;
890036
+ if (resolvedTarget.length > 0 && !resolvedTarget.startsWith(clonedPath + import_path77.default.sep) && resolvedTarget !== clonedPath) {
890037
+ throw new Error(`Invalid proto target path '${def.schema.target}': path must be relative to the repository root and cannot traverse outside it.`);
890038
+ }
890022
890039
  return {
890023
890040
  ...def,
890024
890041
  schema: {
890025
890042
  ...def.schema,
890026
- root: resolvedPath
890043
+ root: resolvedPath,
890044
+ target: resolvedTarget
890027
890045
  },
890028
890046
  gitSource: void 0,
890029
890047
  resolvedAbsolutePath: true
@@ -890067,13 +890085,14 @@ async function loadSingleNamespaceAPIWorkspace({ absolutePathToWorkspace, namesp
890067
890085
  }
890068
890086
  };
890069
890087
  }
890070
- const absoluteFilepathToTarget = definition3.schema.target.length === 0 ? void 0 : join8(absolutePathToWorkspace, RelativeFilePath2.of(definition3.schema.target));
890088
+ const absoluteFilepathToTarget = definition3.schema.target.length === 0 ? void 0 : import_path78.default.isAbsolute(definition3.schema.target) && definition3.resolvedAbsolutePath ? AbsoluteFilePath2.of(definition3.schema.target) : join8(absolutePathToWorkspace, RelativeFilePath2.of(definition3.schema.target));
890071
890089
  if (absoluteFilepathToTarget != null) {
890072
890090
  if (!await doesPathExist(absoluteFilepathToTarget)) {
890091
+ const displayTarget = import_path78.default.isAbsolute(definition3.schema.target) && definition3.resolvedAbsolutePath ? RelativeFilePath2.of(import_path78.default.basename(definition3.schema.target)) : RelativeFilePath2.of(definition3.schema.target);
890073
890092
  return {
890074
890093
  didSucceed: false,
890075
890094
  failures: {
890076
- [RelativeFilePath2.of(definition3.schema.target)]: {
890095
+ [displayTarget]: {
890077
890096
  type: WorkspaceLoaderFailureType.FILE_MISSING
890078
890097
  }
890079
890098
  }
@@ -900886,7 +900905,7 @@ var LegacyDocsPublisher = class {
900886
900905
  previewId,
900887
900906
  disableTemplates: void 0,
900888
900907
  skipUpload,
900889
- cliVersion: "5.63.1",
900908
+ cliVersion: "5.64.0",
900890
900909
  loginCommand: "fern auth login"
900891
900910
  });
900892
900911
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -951447,7 +951466,7 @@ var TypeLiteral4 = class _TypeLiteral extends AstNode9 {
951447
951466
  writer2.writeLine("{");
951448
951467
  writer2.indent();
951449
951468
  for (const entry of entries24) {
951450
- entry.key.write(writer2);
951469
+ this.writeObjectKey({ writer: writer2, key: entry.key });
951451
951470
  writer2.write(": ");
951452
951471
  entry.value.write(writer2);
951453
951472
  writer2.writeLine(",");
@@ -951455,6 +951474,14 @@ var TypeLiteral4 = class _TypeLiteral extends AstNode9 {
951455
951474
  writer2.dedent();
951456
951475
  writer2.write("}");
951457
951476
  }
951477
+ writeObjectKey({ writer: writer2, key: key2 }) {
951478
+ const internal2 = key2.internalType;
951479
+ if (internal2.type === "string" && isValidIdentifier(internal2.value)) {
951480
+ writer2.write(internal2.value);
951481
+ return;
951482
+ }
951483
+ key2.write(writer2);
951484
+ }
951458
951485
  writeObject({ writer: writer2, object: object23 }) {
951459
951486
  const fields = filterNopObjectFields({ fields: object23.fields });
951460
951487
  if (fields.length === 0) {
@@ -951590,7 +951617,12 @@ var TypeLiteral4 = class _TypeLiteral extends AstNode9 {
951590
951617
  writer2.writeLine("{");
951591
951618
  writer2.indent();
951592
951619
  for (const [key2, val] of entries24) {
951593
- writer2.write(`${key2}: `);
951620
+ if (isValidIdentifier(key2)) {
951621
+ writer2.write(`${key2}: `);
951622
+ } else {
951623
+ writer2.writeNode(_TypeLiteral.string(key2));
951624
+ writer2.write(": ");
951625
+ }
951594
951626
  writer2.writeNode(_TypeLiteral.unknown(val));
951595
951627
  writer2.writeLine(",");
951596
951628
  }
@@ -951598,6 +951630,9 @@ var TypeLiteral4 = class _TypeLiteral extends AstNode9 {
951598
951630
  writer2.write("}");
951599
951631
  }
951600
951632
  };
951633
+ function isValidIdentifier(value2) {
951634
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(value2);
951635
+ }
951601
951636
  function filterNopObjectFields({ fields }) {
951602
951637
  return fields.filter((field5) => !TypeLiteral4.isNop(field5.value));
951603
951638
  }
@@ -967178,7 +967213,7 @@ function getAutomationContextFromEnv() {
967178
967213
  config_branch: process.env.FERN_CONFIG_BRANCH,
967179
967214
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
967180
967215
  trigger: process.env.GITHUB_EVENT_NAME,
967181
- cli_version: "5.63.1"
967216
+ cli_version: "5.64.0"
967182
967217
  };
967183
967218
  }
967184
967219
  function isAutomationMode() {
@@ -968010,7 +968045,7 @@ var CliContext = class _CliContext {
968010
968045
  if (false) {
968011
968046
  this.logger.error("CLI_VERSION is not defined");
968012
968047
  }
968013
- return "5.63.1";
968048
+ return "5.64.0";
968014
968049
  }
968015
968050
  getCliName() {
968016
968051
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.63.1",
2
+ "version": "5.64.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",