@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.js CHANGED
@@ -48102,9 +48102,36 @@ var import_fetch5 = require("@orpc/openapi-client/fetch");
48102
48102
  // src/orpc-client/docs/v2/library-docs/contract.ts
48103
48103
  var import_contract8 = require("@orpc/contract");
48104
48104
  var z15 = __toESM(require("zod"), 1);
48105
+ var ALLOWED_HOSTNAMES = /* @__PURE__ */ new Set(["github.com", "gitlab.com"]);
48106
+ var GithubUrlSchema = z15.string().url().describe(
48107
+ "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>."
48108
+ ).refine(
48109
+ (url) => {
48110
+ try {
48111
+ const parsed = new URL(url);
48112
+ if (parsed.protocol !== "https:") {
48113
+ return false;
48114
+ }
48115
+ if (!ALLOWED_HOSTNAMES.has(parsed.hostname)) {
48116
+ return false;
48117
+ }
48118
+ if (parsed.username || parsed.password) {
48119
+ return false;
48120
+ }
48121
+ return /^\/[\w.-]+\/[\w.-]+(?:\.git)?\/?$/.test(parsed.pathname);
48122
+ } catch {
48123
+ return false;
48124
+ }
48125
+ },
48126
+ { message: "Must be a valid https://github.com/<owner>/<repo> or https://gitlab.com/<owner>/<repo> URL" }
48127
+ );
48128
+ var SafeBranchSchema = z15.string().regex(/^[a-zA-Z0-9._/-]+$/, "Invalid branch name").nullish();
48129
+ var SafePackagePathSchema = z15.string().refine((p6) => !p6.includes("..") && !p6.startsWith("/"), {
48130
+ message: "packagePath must not contain path traversal sequences"
48131
+ }).nullish();
48105
48132
  var LibraryDocsBaseConfigSchema = z15.object({
48106
- branch: z15.string().nullish(),
48107
- packagePath: z15.string().nullish(),
48133
+ branch: SafeBranchSchema,
48134
+ packagePath: SafePackagePathSchema,
48108
48135
  title: z15.string().nullish(),
48109
48136
  slug: z15.string().nullish()
48110
48137
  });
@@ -48115,13 +48142,13 @@ var CppLibraryDocsConfigSchema = LibraryDocsBaseConfigSchema.extend({
48115
48142
  var StartLibraryDocsGenerationInputSchema = z15.discriminatedUnion("language", [
48116
48143
  z15.object({
48117
48144
  orgId: z15.string(),
48118
- githubUrl: z15.string(),
48145
+ githubUrl: GithubUrlSchema,
48119
48146
  language: z15.literal("PYTHON"),
48120
48147
  config: PythonLibraryDocsConfigSchema.nullish()
48121
48148
  }),
48122
48149
  z15.object({
48123
48150
  orgId: z15.string(),
48124
- githubUrl: z15.string(),
48151
+ githubUrl: GithubUrlSchema,
48125
48152
  language: z15.literal("CPP"),
48126
48153
  config: CppLibraryDocsConfigSchema.nullish()
48127
48154
  })