@postman/sdk-config 0.3.2 → 0.3.4

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 +90 -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 +90 -22
  6. package/dist/index.js.map +1 -1
  7. package/dist/sdk-config/index.cjs +90 -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 +90 -22
  12. package/dist/sdk-config/index.js.map +1 -1
  13. package/dist/sdk-config/v1/index.cjs +90 -22
  14. package/dist/sdk-config/v1/index.cjs.map +1 -1
  15. package/dist/sdk-config/v1/index.d.cts +53 -1
  16. package/dist/sdk-config/v1/index.d.ts +53 -1
  17. package/dist/sdk-config/v1/index.js +90 -22
  18. package/dist/sdk-config/v1/index.js.map +1 -1
  19. package/dist/sdk-config-ir/index.cjs +10 -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 +10 -2
  24. package/dist/sdk-config-ir/index.js.map +1 -1
  25. package/dist/sdk-config-ir/v1/index.cjs +10 -2
  26. package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
  27. package/dist/sdk-config-ir/v1/index.d.cts +27 -2
  28. package/dist/sdk-config-ir/v1/index.d.ts +27 -2
  29. package/dist/sdk-config-ir/v1/index.js +10 -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 +35 -21
@@ -286,7 +286,8 @@ var composerPackageNameSchema = nonEmptyStringSchema.regex(
286
286
  );
287
287
  var authorSchema = z.strictObject({
288
288
  name: nonEmptyStringSchema,
289
- email: z.email().optional()
289
+ email: z.email().optional(),
290
+ url: nonEmptyStringSchema.optional()
290
291
  });
291
292
  var developerSchema = z.strictObject({
292
293
  name: nonEmptyStringSchema,
@@ -916,7 +917,8 @@ function mapAuthors(value, sourcePath, state) {
916
917
  if (!isObject(author)) return [];
917
918
  const name = stringValue(author.name);
918
919
  const email = stringValue(author.email);
919
- return name ? [{ name, ...optional("email", email) }] : [];
920
+ const url = stringValue(author.url);
921
+ return name ? [{ name, ...optional("email", email), ...optional("url", url) }] : [];
920
922
  });
921
923
  if (authors.length !== value.length) return void 0;
922
924
  value.forEach((author, index) => {
@@ -924,6 +926,9 @@ function mapAuthors(value, sourcePath, state) {
924
926
  if (isObject(author) && stringValue(author.email)) {
925
927
  consume(state, [...sourcePath, index, "email"]);
926
928
  }
929
+ if (isObject(author) && stringValue(author.url)) {
930
+ consume(state, [...sourcePath, index, "url"]);
931
+ }
927
932
  });
928
933
  return authors;
929
934
  }
@@ -1249,6 +1254,8 @@ var apiImportSettingsSchema = z.strictObject({
1249
1254
  objectQueryParameters: z.boolean().optional(),
1250
1255
  typeDatesAsStrings: z.boolean().optional(),
1251
1256
  groupMultiApiEnvironments: z.boolean().optional(),
1257
+ ignoreTags: z.boolean().optional(),
1258
+ disambiguateRequestNames: z.boolean().optional(),
1252
1259
  defaultIntegerFormat: z.enum(["int32", "int64", "uint32", "uint64"]).optional()
1253
1260
  });
1254
1261
  var sourceSpecTypeSchema = z.enum([
@@ -1407,13 +1414,18 @@ var pydanticConfigSchema = z.strictObject({
1407
1414
  unionNaming: z.enum(["v0", "v1"]).optional(),
1408
1415
  useFieldAliases: z.boolean().optional()
1409
1416
  });
1417
+ var additionalInitExportSchema = z.strictObject({
1418
+ from: nonEmptyStringSchema,
1419
+ imports: z.array(nonEmptyStringSchema).min(1)
1420
+ });
1410
1421
  var pythonGenerationConfigSchema = z.strictObject({
1411
1422
  pythonVersion: nonEmptyStringSchema.optional(),
1412
1423
  pydanticVersion: nonEmptyStringSchema.optional(),
1413
1424
  pydantic: pydanticConfigSchema.optional(),
1414
1425
  client: pythonClientSchema.optional(),
1415
1426
  alwaysInitializeOptionals: z.boolean().optional(),
1416
- useTypedDictRequests: z.boolean().optional()
1427
+ useTypedDictRequests: z.boolean().optional(),
1428
+ additionalInitExports: z.array(additionalInitExportSchema).optional()
1417
1429
  });
1418
1430
  var rubyGenerationConfigSchema = z.strictObject({
1419
1431
  requirePaths: z.array(nonEmptyStringSchema).optional()
@@ -1686,9 +1698,14 @@ function mapFernConfigToSdkConfigV1(input) {
1686
1698
  "Select a Fern generator group containing at least one SDK generator."
1687
1699
  );
1688
1700
  }
1701
+ const languages = input.group.generators.map(
1702
+ (generator, index) => resolveLanguage(generator, index)
1703
+ );
1704
+ requireUniqueLanguages(languages);
1705
+ const activeLanguages = new Set(languages);
1689
1706
  const mapped = input.group.generators.map((generator, index) => {
1690
- const language = resolveLanguage(generator, index);
1691
- const invocation = mapInvocation(generator, language, index);
1707
+ const language = languages[index];
1708
+ const invocation = mapInvocation(generator, language, activeLanguages, index);
1692
1709
  const outputMapping = generator.output ? { output: generator.output, unsupportedFields: [] } : mapOutput(generator, language, index);
1693
1710
  return {
1694
1711
  generator,
@@ -1697,7 +1714,6 @@ function mapFernConfigToSdkConfigV1(input) {
1697
1714
  ...outputMapping
1698
1715
  };
1699
1716
  });
1700
- requireUniqueLanguages(mapped.map(({ language }) => language));
1701
1717
  const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
1702
1718
  const docs = partitionSharedBlock(mapped.map(({ invocation }) => invocation.docs));
1703
1719
  const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
@@ -1868,14 +1884,17 @@ function partitionObjectValues(values) {
1868
1884
  }
1869
1885
  return { shared, overrides };
1870
1886
  }
1871
- function mapInvocation(generator, language, index) {
1887
+ function mapInvocation(generator, language, activeLanguages, index) {
1872
1888
  const prefix = ["group", "generators", index];
1873
1889
  const state = { consumedPaths: /* @__PURE__ */ new Set() };
1874
1890
  const config = isObject(generator.config) ? generator.config : {};
1875
1891
  const client = {};
1876
1892
  const generation = {};
1877
1893
  const packageConfig = {};
1878
- mapCommonConfig(config, state, client, generation, packageConfig, [...prefix, "config"]);
1894
+ mapCommonConfig(language, config, state, client, generation, packageConfig, [
1895
+ ...prefix,
1896
+ "config"
1897
+ ]);
1879
1898
  const rawGenerator = isObject(generator.raw) ? generator.raw : void 0;
1880
1899
  const smartCasing = typeof rawGenerator?.["smart-casing"] === "boolean" ? rawGenerator["smart-casing"] : generator.smartCasing === false ? false : void 0;
1881
1900
  const smartCasingDigitWordBoundary = typeof rawGenerator?.["smart-casing-digit-word-boundary"] === "boolean" ? rawGenerator["smart-casing-digit-word-boundary"] : generator.smartCasingDigitWordBoundary === true ? true : void 0;
@@ -1904,7 +1923,7 @@ function mapInvocation(generator, language, index) {
1904
1923
  client.pathParameterStyle = inlinePathParameters ? "inline" : "wrapped";
1905
1924
  }
1906
1925
  }
1907
- const docs = mapReadme(generator.readme, state, [...prefix, "readme"]);
1926
+ const docs = mapReadme(generator.readme, language, activeLanguages, state, [...prefix, "readme"]);
1908
1927
  const unsupportedFields = [
1909
1928
  ...collectUnsupported(config, [...prefix, "config"], state),
1910
1929
  ...settings ? collectUnsupported(settings, [...prefix, "settings"], state) : [],
@@ -1960,7 +1979,7 @@ function resolvedFieldGuidance(field) {
1960
1979
  function isDefaultAutomation(value) {
1961
1980
  return isObject(value) && value.generate === true && value.upgrade === true && value.preview === true && value.verify === true;
1962
1981
  }
1963
- function mapCommonConfig(config, state, client, generation, packageConfig, basePath) {
1982
+ function mapCommonConfig(language, config, state, client, generation, packageConfig, basePath) {
1964
1983
  const inlinePath = takeBoolean(config, ["inlinePathParameters"], state, basePath);
1965
1984
  const inlineFile = takeBoolean(config, ["inlineFileProperties"], state, basePath);
1966
1985
  const inlineRequest = takeBoolean(config, ["inlineRequestParams"], state, basePath);
@@ -1970,12 +1989,15 @@ function mapCommonConfig(config, state, client, generation, packageConfig, baseP
1970
1989
  client.requestParameterStyle = inlineRequest ? "inline" : "wrapped";
1971
1990
  const timeoutMs = takeTimeoutMs(config, state, basePath);
1972
1991
  if (timeoutMs !== void 0) client.timeoutMs = timeoutMs;
1973
- const skipValidation = takeBoolean(
1992
+ const directSkipValidation = takeBoolean(
1974
1993
  config,
1975
1994
  ["skipResponseValidation", "skipValidation"],
1976
1995
  state,
1977
1996
  basePath
1978
1997
  );
1998
+ const pydanticConfig = language === "python" ? takeObject(config, ["pydanticConfig"], state, basePath) : void 0;
1999
+ const nestedSkipValidation = pydanticConfig ? takeBoolean(pydanticConfig.value, ["skipValidation"], state, pydanticConfig.path) : void 0;
2000
+ const skipValidation = directSkipValidation ?? nestedSkipValidation;
1979
2001
  if (skipValidation !== void 0) client.responseValidation = !skipValidation;
1980
2002
  const useDefaults = takeBoolean(config, ["useDefaultRequestParameterValues"], state, basePath);
1981
2003
  if (useDefaults !== void 0) client.useDefaultRequestParameterValues = useDefaults;
@@ -2076,16 +2098,16 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
2076
2098
  }
2077
2099
  }
2078
2100
  function mapTypescript(config, state, packageConfig, basePath) {
2079
- const packageJson = takeObject(config, ["packageJson"], state, basePath);
2080
- const packageName = packageJson ? takeString(packageJson.value, ["name"], state, packageJson.path) : void 0;
2081
- if (packageName !== void 0) packageConfig.packageName = packageName;
2101
+ mapPackageManifest(config, ["packageJson"], state, packageConfig, basePath);
2082
2102
  const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
2083
2103
  const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
2104
+ const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
2084
2105
  return compact({
2085
2106
  typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
2086
2107
  zodVersion: takeString(config, ["zodVersion"], state, basePath),
2087
2108
  packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
2088
2109
  testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
2110
+ httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
2089
2111
  bundle: takeBoolean(config, ["bundle"], state, basePath),
2090
2112
  exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
2091
2113
  namespaceExportName: takeString(
@@ -2110,7 +2132,8 @@ function mapPython(config, state, packageConfig, basePath) {
2110
2132
  pythonVersion: takeString(config, ["pythonVersion", "pyprojectPythonVersion"], state, basePath),
2111
2133
  pydanticVersion: takeString(config, ["pydanticVersion"], state, basePath),
2112
2134
  alwaysInitializeOptionals: takeBoolean(config, ["alwaysInitializeOptionals"], state, basePath),
2113
- useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath)
2135
+ useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath),
2136
+ additionalInitExports: takePythonAdditionalInitExports(config, state, basePath)
2114
2137
  });
2115
2138
  }
2116
2139
  function mapJvm(language, config, state, packageConfig, basePath) {
@@ -2190,6 +2213,7 @@ function mapCsharp(config, state, packageConfig, basePath) {
2190
2213
  });
2191
2214
  }
2192
2215
  function mapPhp(config, state, packageConfig, basePath) {
2216
+ mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
2193
2217
  const packageName = takeString(config, ["packageName"], state, basePath);
2194
2218
  if (packageName !== void 0) packageConfig.packageName = packageName;
2195
2219
  return compact({
@@ -2272,7 +2296,7 @@ function mapMcp(config, state, basePath) {
2272
2296
  toolsets: takeToolsets(config, ["toolsets"], state, basePath)
2273
2297
  });
2274
2298
  }
2275
- function mapReadme(value, state, basePath) {
2299
+ function mapReadme(value, language, activeLanguages, state, basePath) {
2276
2300
  if (!isObject(value)) return {};
2277
2301
  const readme = compact({
2278
2302
  apiName: takeString(value, ["apiName"], state, basePath),
@@ -2280,7 +2304,7 @@ function mapReadme(value, state, basePath) {
2280
2304
  apiReferenceLink: takeString(value, ["apiReferenceLink"], state, basePath),
2281
2305
  bannerLink: takeString(value, ["bannerLink"], state, basePath),
2282
2306
  disabledSections: takeStringArray(value, ["disabledSections"], state, basePath),
2283
- customSections: takeCustomSections(value, state, basePath),
2307
+ customSections: takeCustomSections(value, language, activeLanguages, state, basePath),
2284
2308
  defaultEndpoint: takeReadmeEndpoint(value, ["defaultEndpoint"], state, basePath),
2285
2309
  features: takeReadmeFeatures(value, state, basePath)
2286
2310
  });
@@ -2342,15 +2366,59 @@ function mapDependency(name, value, state, path) {
2342
2366
  }
2343
2367
  ];
2344
2368
  }
2345
- function takeCustomSections(value, state, basePath) {
2369
+ function takeCustomSections(value, language, activeLanguages, state, basePath) {
2346
2370
  const located = locate(value, ["customSections"], basePath);
2347
2371
  if (!located || !Array.isArray(located.value)) return void 0;
2348
- const sections = located.value.flatMap(
2349
- (section) => isObject(section) && section.language === void 0 && typeof section.title === "string" && typeof section.content === "string" ? [{ title: section.title, content: section.content }] : []
2372
+ const sections = located.value.flatMap((section, index) => {
2373
+ if (!isObject(section) || typeof section.title !== "string" || section.title.length === 0 || typeof section.content !== "string") {
2374
+ return [];
2375
+ }
2376
+ const sectionLanguage = section.language;
2377
+ if (sectionLanguage !== void 0 && (typeof sectionLanguage !== "string" || !isFernLanguage(sectionLanguage) || !activeLanguages.has(sectionLanguage))) {
2378
+ return [];
2379
+ }
2380
+ consume(state, [...located.path, index]);
2381
+ return sectionLanguage === void 0 || sectionLanguage === language ? [{ title: section.title, content: section.content }] : [];
2382
+ });
2383
+ return sections.length > 0 ? sections : void 0;
2384
+ }
2385
+ function mapPackageManifest(config, aliases, state, packageConfig, basePath) {
2386
+ const manifest = takeObject(config, aliases, state, basePath);
2387
+ if (!manifest) return;
2388
+ const packageName = takeString(manifest.value, ["name"], state, manifest.path);
2389
+ const description = takeString(manifest.value, ["description"], state, manifest.path);
2390
+ const license = takeString(manifest.value, ["license"], state, manifest.path);
2391
+ const author = takeObject(manifest.value, ["author"], state, manifest.path);
2392
+ const authorName = author ? takeString(author.value, ["name"], state, author.path) : void 0;
2393
+ const authors = authorName && author ? [
2394
+ compact({
2395
+ name: authorName,
2396
+ email: takeString(author.value, ["email"], state, author.path),
2397
+ url: takeString(author.value, ["url"], state, author.path)
2398
+ })
2399
+ ] : void 0;
2400
+ Object.assign(
2401
+ packageConfig,
2402
+ compact({
2403
+ packageName,
2404
+ description,
2405
+ authors,
2406
+ license: license ? { type: license } : void 0
2407
+ })
2350
2408
  );
2351
- if (sections.length !== located.value.length) return void 0;
2409
+ }
2410
+ function takePythonAdditionalInitExports(config, state, basePath) {
2411
+ const located = locate(config, ["additionalInitExports"], basePath);
2412
+ if (!located || !Array.isArray(located.value)) return void 0;
2413
+ const exports = located.value.flatMap((entry) => {
2414
+ if (!isObject(entry)) return [];
2415
+ const from = stringValue(entry.from);
2416
+ const imports = stringArrayValue(entry.imports);
2417
+ return from && imports?.length ? [{ from, imports }] : [];
2418
+ });
2419
+ if (exports.length !== located.value.length) return void 0;
2352
2420
  consume(state, located.path);
2353
- return sections;
2421
+ return exports;
2354
2422
  }
2355
2423
  function takeReadmeEndpoint(value, aliases, state, basePath) {
2356
2424
  const located = locate(value, aliases, basePath);