@postman/sdk-config 0.3.2 → 0.3.3

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 (35) hide show
  1. package/dist/index.cjs +88 -22
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +88 -22
  6. package/dist/index.js.map +1 -1
  7. package/dist/sdk-config/index.cjs +88 -22
  8. package/dist/sdk-config/index.cjs.map +1 -1
  9. package/dist/sdk-config/index.d.cts +1 -1
  10. package/dist/sdk-config/index.d.ts +1 -1
  11. package/dist/sdk-config/index.js +88 -22
  12. package/dist/sdk-config/index.js.map +1 -1
  13. package/dist/sdk-config/v1/index.cjs +88 -22
  14. package/dist/sdk-config/v1/index.cjs.map +1 -1
  15. package/dist/sdk-config/v1/index.d.cts +37 -1
  16. package/dist/sdk-config/v1/index.d.ts +37 -1
  17. package/dist/sdk-config/v1/index.js +88 -22
  18. package/dist/sdk-config/v1/index.js.map +1 -1
  19. package/dist/sdk-config-ir/index.cjs +8 -2
  20. package/dist/sdk-config-ir/index.cjs.map +1 -1
  21. package/dist/sdk-config-ir/index.d.cts +1 -1
  22. package/dist/sdk-config-ir/index.d.ts +1 -1
  23. package/dist/sdk-config-ir/index.js +8 -2
  24. package/dist/sdk-config-ir/index.js.map +1 -1
  25. package/dist/sdk-config-ir/v1/index.cjs +8 -2
  26. package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
  27. package/dist/sdk-config-ir/v1/index.d.cts +15 -2
  28. package/dist/sdk-config-ir/v1/index.d.ts +15 -2
  29. package/dist/sdk-config-ir/v1/index.js +8 -2
  30. package/dist/sdk-config-ir/v1/index.js.map +1 -1
  31. package/dist/{typescript-DNqK3T3v.d.cts → typescript-CKRe_6MB.d.cts} +5 -0
  32. package/dist/{typescript-DNqK3T3v.d.ts → typescript-CKRe_6MB.d.ts} +5 -0
  33. package/package.json +1 -1
  34. package/src/sdk-config/v1/README.md +19 -16
  35. package/src/sdk-config-ir/v1/README.md +11 -6
@@ -292,7 +292,8 @@ var composerPackageNameSchema = nonEmptyStringSchema.regex(
292
292
  );
293
293
  var authorSchema = zod.z.strictObject({
294
294
  name: nonEmptyStringSchema,
295
- email: zod.z.email().optional()
295
+ email: zod.z.email().optional(),
296
+ url: nonEmptyStringSchema.optional()
296
297
  });
297
298
  var developerSchema = zod.z.strictObject({
298
299
  name: nonEmptyStringSchema,
@@ -922,7 +923,8 @@ function mapAuthors(value, sourcePath, state) {
922
923
  if (!isObject(author)) return [];
923
924
  const name = stringValue(author.name);
924
925
  const email = stringValue(author.email);
925
- return name ? [{ name, ...optional("email", email) }] : [];
926
+ const url = stringValue(author.url);
927
+ return name ? [{ name, ...optional("email", email), ...optional("url", url) }] : [];
926
928
  });
927
929
  if (authors.length !== value.length) return void 0;
928
930
  value.forEach((author, index) => {
@@ -930,6 +932,9 @@ function mapAuthors(value, sourcePath, state) {
930
932
  if (isObject(author) && stringValue(author.email)) {
931
933
  consume(state, [...sourcePath, index, "email"]);
932
934
  }
935
+ if (isObject(author) && stringValue(author.url)) {
936
+ consume(state, [...sourcePath, index, "url"]);
937
+ }
933
938
  });
934
939
  return authors;
935
940
  }
@@ -1413,13 +1418,18 @@ var pydanticConfigSchema = zod.z.strictObject({
1413
1418
  unionNaming: zod.z.enum(["v0", "v1"]).optional(),
1414
1419
  useFieldAliases: zod.z.boolean().optional()
1415
1420
  });
1421
+ var additionalInitExportSchema = zod.z.strictObject({
1422
+ from: nonEmptyStringSchema,
1423
+ imports: zod.z.array(nonEmptyStringSchema).min(1)
1424
+ });
1416
1425
  var pythonGenerationConfigSchema = zod.z.strictObject({
1417
1426
  pythonVersion: nonEmptyStringSchema.optional(),
1418
1427
  pydanticVersion: nonEmptyStringSchema.optional(),
1419
1428
  pydantic: pydanticConfigSchema.optional(),
1420
1429
  client: pythonClientSchema.optional(),
1421
1430
  alwaysInitializeOptionals: zod.z.boolean().optional(),
1422
- useTypedDictRequests: zod.z.boolean().optional()
1431
+ useTypedDictRequests: zod.z.boolean().optional(),
1432
+ additionalInitExports: zod.z.array(additionalInitExportSchema).optional()
1423
1433
  });
1424
1434
  var rubyGenerationConfigSchema = zod.z.strictObject({
1425
1435
  requirePaths: zod.z.array(nonEmptyStringSchema).optional()
@@ -1692,9 +1702,14 @@ function mapFernConfigToSdkConfigV1(input) {
1692
1702
  "Select a Fern generator group containing at least one SDK generator."
1693
1703
  );
1694
1704
  }
1705
+ const languages = input.group.generators.map(
1706
+ (generator, index) => resolveLanguage(generator, index)
1707
+ );
1708
+ requireUniqueLanguages(languages);
1709
+ const activeLanguages = new Set(languages);
1695
1710
  const mapped = input.group.generators.map((generator, index) => {
1696
- const language = resolveLanguage(generator, index);
1697
- const invocation = mapInvocation(generator, language, index);
1711
+ const language = languages[index];
1712
+ const invocation = mapInvocation(generator, language, activeLanguages, index);
1698
1713
  const outputMapping = generator.output ? { output: generator.output, unsupportedFields: [] } : mapOutput(generator, language, index);
1699
1714
  return {
1700
1715
  generator,
@@ -1703,7 +1718,6 @@ function mapFernConfigToSdkConfigV1(input) {
1703
1718
  ...outputMapping
1704
1719
  };
1705
1720
  });
1706
- requireUniqueLanguages(mapped.map(({ language }) => language));
1707
1721
  const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
1708
1722
  const docs = partitionSharedBlock(mapped.map(({ invocation }) => invocation.docs));
1709
1723
  const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
@@ -1874,14 +1888,17 @@ function partitionObjectValues(values) {
1874
1888
  }
1875
1889
  return { shared, overrides };
1876
1890
  }
1877
- function mapInvocation(generator, language, index) {
1891
+ function mapInvocation(generator, language, activeLanguages, index) {
1878
1892
  const prefix = ["group", "generators", index];
1879
1893
  const state = { consumedPaths: /* @__PURE__ */ new Set() };
1880
1894
  const config = isObject(generator.config) ? generator.config : {};
1881
1895
  const client = {};
1882
1896
  const generation = {};
1883
1897
  const packageConfig = {};
1884
- mapCommonConfig(config, state, client, generation, packageConfig, [...prefix, "config"]);
1898
+ mapCommonConfig(language, config, state, client, generation, packageConfig, [
1899
+ ...prefix,
1900
+ "config"
1901
+ ]);
1885
1902
  const rawGenerator = isObject(generator.raw) ? generator.raw : void 0;
1886
1903
  const smartCasing = typeof rawGenerator?.["smart-casing"] === "boolean" ? rawGenerator["smart-casing"] : generator.smartCasing === false ? false : void 0;
1887
1904
  const smartCasingDigitWordBoundary = typeof rawGenerator?.["smart-casing-digit-word-boundary"] === "boolean" ? rawGenerator["smart-casing-digit-word-boundary"] : generator.smartCasingDigitWordBoundary === true ? true : void 0;
@@ -1910,7 +1927,7 @@ function mapInvocation(generator, language, index) {
1910
1927
  client.pathParameterStyle = inlinePathParameters ? "inline" : "wrapped";
1911
1928
  }
1912
1929
  }
1913
- const docs = mapReadme(generator.readme, state, [...prefix, "readme"]);
1930
+ const docs = mapReadme(generator.readme, language, activeLanguages, state, [...prefix, "readme"]);
1914
1931
  const unsupportedFields = [
1915
1932
  ...collectUnsupported(config, [...prefix, "config"], state),
1916
1933
  ...settings ? collectUnsupported(settings, [...prefix, "settings"], state) : [],
@@ -1966,7 +1983,7 @@ function resolvedFieldGuidance(field) {
1966
1983
  function isDefaultAutomation(value) {
1967
1984
  return isObject(value) && value.generate === true && value.upgrade === true && value.preview === true && value.verify === true;
1968
1985
  }
1969
- function mapCommonConfig(config, state, client, generation, packageConfig, basePath) {
1986
+ function mapCommonConfig(language, config, state, client, generation, packageConfig, basePath) {
1970
1987
  const inlinePath = takeBoolean(config, ["inlinePathParameters"], state, basePath);
1971
1988
  const inlineFile = takeBoolean(config, ["inlineFileProperties"], state, basePath);
1972
1989
  const inlineRequest = takeBoolean(config, ["inlineRequestParams"], state, basePath);
@@ -1976,12 +1993,15 @@ function mapCommonConfig(config, state, client, generation, packageConfig, baseP
1976
1993
  client.requestParameterStyle = inlineRequest ? "inline" : "wrapped";
1977
1994
  const timeoutMs = takeTimeoutMs(config, state, basePath);
1978
1995
  if (timeoutMs !== void 0) client.timeoutMs = timeoutMs;
1979
- const skipValidation = takeBoolean(
1996
+ const directSkipValidation = takeBoolean(
1980
1997
  config,
1981
1998
  ["skipResponseValidation", "skipValidation"],
1982
1999
  state,
1983
2000
  basePath
1984
2001
  );
2002
+ const pydanticConfig = language === "python" ? takeObject(config, ["pydanticConfig"], state, basePath) : void 0;
2003
+ const nestedSkipValidation = pydanticConfig ? takeBoolean(pydanticConfig.value, ["skipValidation"], state, pydanticConfig.path) : void 0;
2004
+ const skipValidation = directSkipValidation ?? nestedSkipValidation;
1985
2005
  if (skipValidation !== void 0) client.responseValidation = !skipValidation;
1986
2006
  const useDefaults = takeBoolean(config, ["useDefaultRequestParameterValues"], state, basePath);
1987
2007
  if (useDefaults !== void 0) client.useDefaultRequestParameterValues = useDefaults;
@@ -2082,16 +2102,16 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
2082
2102
  }
2083
2103
  }
2084
2104
  function mapTypescript(config, state, packageConfig, basePath) {
2085
- const packageJson = takeObject(config, ["packageJson"], state, basePath);
2086
- const packageName = packageJson ? takeString(packageJson.value, ["name"], state, packageJson.path) : void 0;
2087
- if (packageName !== void 0) packageConfig.packageName = packageName;
2105
+ mapPackageManifest(config, ["packageJson"], state, packageConfig, basePath);
2088
2106
  const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
2089
2107
  const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
2108
+ const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
2090
2109
  return compact({
2091
2110
  typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
2092
2111
  zodVersion: takeString(config, ["zodVersion"], state, basePath),
2093
2112
  packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
2094
2113
  testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
2114
+ httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
2095
2115
  bundle: takeBoolean(config, ["bundle"], state, basePath),
2096
2116
  exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
2097
2117
  namespaceExportName: takeString(
@@ -2116,7 +2136,8 @@ function mapPython(config, state, packageConfig, basePath) {
2116
2136
  pythonVersion: takeString(config, ["pythonVersion", "pyprojectPythonVersion"], state, basePath),
2117
2137
  pydanticVersion: takeString(config, ["pydanticVersion"], state, basePath),
2118
2138
  alwaysInitializeOptionals: takeBoolean(config, ["alwaysInitializeOptionals"], state, basePath),
2119
- useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath)
2139
+ useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath),
2140
+ additionalInitExports: takePythonAdditionalInitExports(config, state, basePath)
2120
2141
  });
2121
2142
  }
2122
2143
  function mapJvm(language, config, state, packageConfig, basePath) {
@@ -2196,6 +2217,7 @@ function mapCsharp(config, state, packageConfig, basePath) {
2196
2217
  });
2197
2218
  }
2198
2219
  function mapPhp(config, state, packageConfig, basePath) {
2220
+ mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
2199
2221
  const packageName = takeString(config, ["packageName"], state, basePath);
2200
2222
  if (packageName !== void 0) packageConfig.packageName = packageName;
2201
2223
  return compact({
@@ -2278,7 +2300,7 @@ function mapMcp(config, state, basePath) {
2278
2300
  toolsets: takeToolsets(config, ["toolsets"], state, basePath)
2279
2301
  });
2280
2302
  }
2281
- function mapReadme(value, state, basePath) {
2303
+ function mapReadme(value, language, activeLanguages, state, basePath) {
2282
2304
  if (!isObject(value)) return {};
2283
2305
  const readme = compact({
2284
2306
  apiName: takeString(value, ["apiName"], state, basePath),
@@ -2286,7 +2308,7 @@ function mapReadme(value, state, basePath) {
2286
2308
  apiReferenceLink: takeString(value, ["apiReferenceLink"], state, basePath),
2287
2309
  bannerLink: takeString(value, ["bannerLink"], state, basePath),
2288
2310
  disabledSections: takeStringArray(value, ["disabledSections"], state, basePath),
2289
- customSections: takeCustomSections(value, state, basePath),
2311
+ customSections: takeCustomSections(value, language, activeLanguages, state, basePath),
2290
2312
  defaultEndpoint: takeReadmeEndpoint(value, ["defaultEndpoint"], state, basePath),
2291
2313
  features: takeReadmeFeatures(value, state, basePath)
2292
2314
  });
@@ -2348,15 +2370,59 @@ function mapDependency(name, value, state, path) {
2348
2370
  }
2349
2371
  ];
2350
2372
  }
2351
- function takeCustomSections(value, state, basePath) {
2373
+ function takeCustomSections(value, language, activeLanguages, state, basePath) {
2352
2374
  const located = locate(value, ["customSections"], basePath);
2353
2375
  if (!located || !Array.isArray(located.value)) return void 0;
2354
- const sections = located.value.flatMap(
2355
- (section) => isObject(section) && section.language === void 0 && typeof section.title === "string" && typeof section.content === "string" ? [{ title: section.title, content: section.content }] : []
2376
+ const sections = located.value.flatMap((section, index) => {
2377
+ if (!isObject(section) || typeof section.title !== "string" || section.title.length === 0 || typeof section.content !== "string") {
2378
+ return [];
2379
+ }
2380
+ const sectionLanguage = section.language;
2381
+ if (sectionLanguage !== void 0 && (typeof sectionLanguage !== "string" || !isFernLanguage(sectionLanguage) || !activeLanguages.has(sectionLanguage))) {
2382
+ return [];
2383
+ }
2384
+ consume(state, [...located.path, index]);
2385
+ return sectionLanguage === void 0 || sectionLanguage === language ? [{ title: section.title, content: section.content }] : [];
2386
+ });
2387
+ return sections.length > 0 ? sections : void 0;
2388
+ }
2389
+ function mapPackageManifest(config, aliases, state, packageConfig, basePath) {
2390
+ const manifest = takeObject(config, aliases, state, basePath);
2391
+ if (!manifest) return;
2392
+ const packageName = takeString(manifest.value, ["name"], state, manifest.path);
2393
+ const description = takeString(manifest.value, ["description"], state, manifest.path);
2394
+ const license = takeString(manifest.value, ["license"], state, manifest.path);
2395
+ const author = takeObject(manifest.value, ["author"], state, manifest.path);
2396
+ const authorName = author ? takeString(author.value, ["name"], state, author.path) : void 0;
2397
+ const authors = authorName && author ? [
2398
+ compact({
2399
+ name: authorName,
2400
+ email: takeString(author.value, ["email"], state, author.path),
2401
+ url: takeString(author.value, ["url"], state, author.path)
2402
+ })
2403
+ ] : void 0;
2404
+ Object.assign(
2405
+ packageConfig,
2406
+ compact({
2407
+ packageName,
2408
+ description,
2409
+ authors,
2410
+ license: license ? { type: license } : void 0
2411
+ })
2356
2412
  );
2357
- if (sections.length !== located.value.length) return void 0;
2413
+ }
2414
+ function takePythonAdditionalInitExports(config, state, basePath) {
2415
+ const located = locate(config, ["additionalInitExports"], basePath);
2416
+ if (!located || !Array.isArray(located.value)) return void 0;
2417
+ const exports = located.value.flatMap((entry) => {
2418
+ if (!isObject(entry)) return [];
2419
+ const from = stringValue(entry.from);
2420
+ const imports = stringArrayValue(entry.imports);
2421
+ return from && imports?.length ? [{ from, imports }] : [];
2422
+ });
2423
+ if (exports.length !== located.value.length) return void 0;
2358
2424
  consume(state, located.path);
2359
- return sections;
2425
+ return exports;
2360
2426
  }
2361
2427
  function takeReadmeEndpoint(value, aliases, state, basePath) {
2362
2428
  const located = locate(value, aliases, basePath);