@fern-api/fdr-sdk 1.1.7-45ebcd86eb → 1.1.7-97cbb284fe

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.
package/dist/js/index.mjs CHANGED
@@ -48060,9 +48060,36 @@ import { OpenAPILink as OpenAPILink5 } from "@orpc/openapi-client/fetch";
48060
48060
  // src/orpc-client/docs/v2/library-docs/contract.ts
48061
48061
  import { oc as oc7 } from "@orpc/contract";
48062
48062
  import * as z15 from "zod";
48063
+ var ALLOWED_HOSTNAMES = /* @__PURE__ */ new Set(["github.com", "gitlab.com"]);
48064
+ var GithubUrlSchema = z15.string().url().describe(
48065
+ "HTTPS URL of a GitHub or GitLab repository. Currently only github.com and gitlab.com are supported. Must match the pattern https://github.com/<owner>/<repo> or https://gitlab.com/<owner>/<repo>."
48066
+ ).refine(
48067
+ (url) => {
48068
+ try {
48069
+ const parsed = new URL(url);
48070
+ if (parsed.protocol !== "https:") {
48071
+ return false;
48072
+ }
48073
+ if (!ALLOWED_HOSTNAMES.has(parsed.hostname)) {
48074
+ return false;
48075
+ }
48076
+ if (parsed.username || parsed.password) {
48077
+ return false;
48078
+ }
48079
+ return /^\/[\w.-]+\/[\w.-]+(?:\.git)?\/?$/.test(parsed.pathname);
48080
+ } catch {
48081
+ return false;
48082
+ }
48083
+ },
48084
+ { message: "Must be a valid https://github.com/<owner>/<repo> or https://gitlab.com/<owner>/<repo> URL" }
48085
+ );
48086
+ var SafeBranchSchema = z15.string().regex(/^[a-zA-Z0-9._/-]+$/, "Invalid branch name").nullish();
48087
+ var SafePackagePathSchema = z15.string().refine((p6) => !p6.includes("..") && !p6.startsWith("/"), {
48088
+ message: "packagePath must not contain path traversal sequences"
48089
+ }).nullish();
48063
48090
  var LibraryDocsBaseConfigSchema = z15.object({
48064
- branch: z15.string().nullish(),
48065
- packagePath: z15.string().nullish(),
48091
+ branch: SafeBranchSchema,
48092
+ packagePath: SafePackagePathSchema,
48066
48093
  title: z15.string().nullish(),
48067
48094
  slug: z15.string().nullish()
48068
48095
  });
@@ -48073,13 +48100,13 @@ var CppLibraryDocsConfigSchema = LibraryDocsBaseConfigSchema.extend({
48073
48100
  var StartLibraryDocsGenerationInputSchema = z15.discriminatedUnion("language", [
48074
48101
  z15.object({
48075
48102
  orgId: z15.string(),
48076
- githubUrl: z15.string(),
48103
+ githubUrl: GithubUrlSchema,
48077
48104
  language: z15.literal("PYTHON"),
48078
48105
  config: PythonLibraryDocsConfigSchema.nullish()
48079
48106
  }),
48080
48107
  z15.object({
48081
48108
  orgId: z15.string(),
48082
- githubUrl: z15.string(),
48109
+ githubUrl: GithubUrlSchema,
48083
48110
  language: z15.literal("CPP"),
48084
48111
  config: CppLibraryDocsConfigSchema.nullish()
48085
48112
  })