@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
@@ -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
  }
@@ -1255,6 +1260,8 @@ var apiImportSettingsSchema = zod.z.strictObject({
1255
1260
  objectQueryParameters: zod.z.boolean().optional(),
1256
1261
  typeDatesAsStrings: zod.z.boolean().optional(),
1257
1262
  groupMultiApiEnvironments: zod.z.boolean().optional(),
1263
+ ignoreTags: zod.z.boolean().optional(),
1264
+ disambiguateRequestNames: zod.z.boolean().optional(),
1258
1265
  defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional()
1259
1266
  });
1260
1267
  var sourceSpecTypeSchema = zod.z.enum([
@@ -1413,13 +1420,18 @@ var pydanticConfigSchema = zod.z.strictObject({
1413
1420
  unionNaming: zod.z.enum(["v0", "v1"]).optional(),
1414
1421
  useFieldAliases: zod.z.boolean().optional()
1415
1422
  });
1423
+ var additionalInitExportSchema = zod.z.strictObject({
1424
+ from: nonEmptyStringSchema,
1425
+ imports: zod.z.array(nonEmptyStringSchema).min(1)
1426
+ });
1416
1427
  var pythonGenerationConfigSchema = zod.z.strictObject({
1417
1428
  pythonVersion: nonEmptyStringSchema.optional(),
1418
1429
  pydanticVersion: nonEmptyStringSchema.optional(),
1419
1430
  pydantic: pydanticConfigSchema.optional(),
1420
1431
  client: pythonClientSchema.optional(),
1421
1432
  alwaysInitializeOptionals: zod.z.boolean().optional(),
1422
- useTypedDictRequests: zod.z.boolean().optional()
1433
+ useTypedDictRequests: zod.z.boolean().optional(),
1434
+ additionalInitExports: zod.z.array(additionalInitExportSchema).optional()
1423
1435
  });
1424
1436
  var rubyGenerationConfigSchema = zod.z.strictObject({
1425
1437
  requirePaths: zod.z.array(nonEmptyStringSchema).optional()
@@ -1692,9 +1704,14 @@ function mapFernConfigToSdkConfigV1(input) {
1692
1704
  "Select a Fern generator group containing at least one SDK generator."
1693
1705
  );
1694
1706
  }
1707
+ const languages = input.group.generators.map(
1708
+ (generator, index) => resolveLanguage(generator, index)
1709
+ );
1710
+ requireUniqueLanguages(languages);
1711
+ const activeLanguages = new Set(languages);
1695
1712
  const mapped = input.group.generators.map((generator, index) => {
1696
- const language = resolveLanguage(generator, index);
1697
- const invocation = mapInvocation(generator, language, index);
1713
+ const language = languages[index];
1714
+ const invocation = mapInvocation(generator, language, activeLanguages, index);
1698
1715
  const outputMapping = generator.output ? { output: generator.output, unsupportedFields: [] } : mapOutput(generator, language, index);
1699
1716
  return {
1700
1717
  generator,
@@ -1703,7 +1720,6 @@ function mapFernConfigToSdkConfigV1(input) {
1703
1720
  ...outputMapping
1704
1721
  };
1705
1722
  });
1706
- requireUniqueLanguages(mapped.map(({ language }) => language));
1707
1723
  const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
1708
1724
  const docs = partitionSharedBlock(mapped.map(({ invocation }) => invocation.docs));
1709
1725
  const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
@@ -1874,14 +1890,17 @@ function partitionObjectValues(values) {
1874
1890
  }
1875
1891
  return { shared, overrides };
1876
1892
  }
1877
- function mapInvocation(generator, language, index) {
1893
+ function mapInvocation(generator, language, activeLanguages, index) {
1878
1894
  const prefix = ["group", "generators", index];
1879
1895
  const state = { consumedPaths: /* @__PURE__ */ new Set() };
1880
1896
  const config = isObject(generator.config) ? generator.config : {};
1881
1897
  const client = {};
1882
1898
  const generation = {};
1883
1899
  const packageConfig = {};
1884
- mapCommonConfig(config, state, client, generation, packageConfig, [...prefix, "config"]);
1900
+ mapCommonConfig(language, config, state, client, generation, packageConfig, [
1901
+ ...prefix,
1902
+ "config"
1903
+ ]);
1885
1904
  const rawGenerator = isObject(generator.raw) ? generator.raw : void 0;
1886
1905
  const smartCasing = typeof rawGenerator?.["smart-casing"] === "boolean" ? rawGenerator["smart-casing"] : generator.smartCasing === false ? false : void 0;
1887
1906
  const smartCasingDigitWordBoundary = typeof rawGenerator?.["smart-casing-digit-word-boundary"] === "boolean" ? rawGenerator["smart-casing-digit-word-boundary"] : generator.smartCasingDigitWordBoundary === true ? true : void 0;
@@ -1910,7 +1929,7 @@ function mapInvocation(generator, language, index) {
1910
1929
  client.pathParameterStyle = inlinePathParameters ? "inline" : "wrapped";
1911
1930
  }
1912
1931
  }
1913
- const docs = mapReadme(generator.readme, state, [...prefix, "readme"]);
1932
+ const docs = mapReadme(generator.readme, language, activeLanguages, state, [...prefix, "readme"]);
1914
1933
  const unsupportedFields = [
1915
1934
  ...collectUnsupported(config, [...prefix, "config"], state),
1916
1935
  ...settings ? collectUnsupported(settings, [...prefix, "settings"], state) : [],
@@ -1966,7 +1985,7 @@ function resolvedFieldGuidance(field) {
1966
1985
  function isDefaultAutomation(value) {
1967
1986
  return isObject(value) && value.generate === true && value.upgrade === true && value.preview === true && value.verify === true;
1968
1987
  }
1969
- function mapCommonConfig(config, state, client, generation, packageConfig, basePath) {
1988
+ function mapCommonConfig(language, config, state, client, generation, packageConfig, basePath) {
1970
1989
  const inlinePath = takeBoolean(config, ["inlinePathParameters"], state, basePath);
1971
1990
  const inlineFile = takeBoolean(config, ["inlineFileProperties"], state, basePath);
1972
1991
  const inlineRequest = takeBoolean(config, ["inlineRequestParams"], state, basePath);
@@ -1976,12 +1995,15 @@ function mapCommonConfig(config, state, client, generation, packageConfig, baseP
1976
1995
  client.requestParameterStyle = inlineRequest ? "inline" : "wrapped";
1977
1996
  const timeoutMs = takeTimeoutMs(config, state, basePath);
1978
1997
  if (timeoutMs !== void 0) client.timeoutMs = timeoutMs;
1979
- const skipValidation = takeBoolean(
1998
+ const directSkipValidation = takeBoolean(
1980
1999
  config,
1981
2000
  ["skipResponseValidation", "skipValidation"],
1982
2001
  state,
1983
2002
  basePath
1984
2003
  );
2004
+ const pydanticConfig = language === "python" ? takeObject(config, ["pydanticConfig"], state, basePath) : void 0;
2005
+ const nestedSkipValidation = pydanticConfig ? takeBoolean(pydanticConfig.value, ["skipValidation"], state, pydanticConfig.path) : void 0;
2006
+ const skipValidation = directSkipValidation ?? nestedSkipValidation;
1985
2007
  if (skipValidation !== void 0) client.responseValidation = !skipValidation;
1986
2008
  const useDefaults = takeBoolean(config, ["useDefaultRequestParameterValues"], state, basePath);
1987
2009
  if (useDefaults !== void 0) client.useDefaultRequestParameterValues = useDefaults;
@@ -2082,16 +2104,16 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
2082
2104
  }
2083
2105
  }
2084
2106
  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;
2107
+ mapPackageManifest(config, ["packageJson"], state, packageConfig, basePath);
2088
2108
  const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
2089
2109
  const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
2110
+ const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
2090
2111
  return compact({
2091
2112
  typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
2092
2113
  zodVersion: takeString(config, ["zodVersion"], state, basePath),
2093
2114
  packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
2094
2115
  testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
2116
+ httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
2095
2117
  bundle: takeBoolean(config, ["bundle"], state, basePath),
2096
2118
  exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
2097
2119
  namespaceExportName: takeString(
@@ -2116,7 +2138,8 @@ function mapPython(config, state, packageConfig, basePath) {
2116
2138
  pythonVersion: takeString(config, ["pythonVersion", "pyprojectPythonVersion"], state, basePath),
2117
2139
  pydanticVersion: takeString(config, ["pydanticVersion"], state, basePath),
2118
2140
  alwaysInitializeOptionals: takeBoolean(config, ["alwaysInitializeOptionals"], state, basePath),
2119
- useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath)
2141
+ useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath),
2142
+ additionalInitExports: takePythonAdditionalInitExports(config, state, basePath)
2120
2143
  });
2121
2144
  }
2122
2145
  function mapJvm(language, config, state, packageConfig, basePath) {
@@ -2196,6 +2219,7 @@ function mapCsharp(config, state, packageConfig, basePath) {
2196
2219
  });
2197
2220
  }
2198
2221
  function mapPhp(config, state, packageConfig, basePath) {
2222
+ mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
2199
2223
  const packageName = takeString(config, ["packageName"], state, basePath);
2200
2224
  if (packageName !== void 0) packageConfig.packageName = packageName;
2201
2225
  return compact({
@@ -2278,7 +2302,7 @@ function mapMcp(config, state, basePath) {
2278
2302
  toolsets: takeToolsets(config, ["toolsets"], state, basePath)
2279
2303
  });
2280
2304
  }
2281
- function mapReadme(value, state, basePath) {
2305
+ function mapReadme(value, language, activeLanguages, state, basePath) {
2282
2306
  if (!isObject(value)) return {};
2283
2307
  const readme = compact({
2284
2308
  apiName: takeString(value, ["apiName"], state, basePath),
@@ -2286,7 +2310,7 @@ function mapReadme(value, state, basePath) {
2286
2310
  apiReferenceLink: takeString(value, ["apiReferenceLink"], state, basePath),
2287
2311
  bannerLink: takeString(value, ["bannerLink"], state, basePath),
2288
2312
  disabledSections: takeStringArray(value, ["disabledSections"], state, basePath),
2289
- customSections: takeCustomSections(value, state, basePath),
2313
+ customSections: takeCustomSections(value, language, activeLanguages, state, basePath),
2290
2314
  defaultEndpoint: takeReadmeEndpoint(value, ["defaultEndpoint"], state, basePath),
2291
2315
  features: takeReadmeFeatures(value, state, basePath)
2292
2316
  });
@@ -2348,15 +2372,59 @@ function mapDependency(name, value, state, path) {
2348
2372
  }
2349
2373
  ];
2350
2374
  }
2351
- function takeCustomSections(value, state, basePath) {
2375
+ function takeCustomSections(value, language, activeLanguages, state, basePath) {
2352
2376
  const located = locate(value, ["customSections"], basePath);
2353
2377
  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 }] : []
2378
+ const sections = located.value.flatMap((section, index) => {
2379
+ if (!isObject(section) || typeof section.title !== "string" || section.title.length === 0 || typeof section.content !== "string") {
2380
+ return [];
2381
+ }
2382
+ const sectionLanguage = section.language;
2383
+ if (sectionLanguage !== void 0 && (typeof sectionLanguage !== "string" || !isFernLanguage(sectionLanguage) || !activeLanguages.has(sectionLanguage))) {
2384
+ return [];
2385
+ }
2386
+ consume(state, [...located.path, index]);
2387
+ return sectionLanguage === void 0 || sectionLanguage === language ? [{ title: section.title, content: section.content }] : [];
2388
+ });
2389
+ return sections.length > 0 ? sections : void 0;
2390
+ }
2391
+ function mapPackageManifest(config, aliases, state, packageConfig, basePath) {
2392
+ const manifest = takeObject(config, aliases, state, basePath);
2393
+ if (!manifest) return;
2394
+ const packageName = takeString(manifest.value, ["name"], state, manifest.path);
2395
+ const description = takeString(manifest.value, ["description"], state, manifest.path);
2396
+ const license = takeString(manifest.value, ["license"], state, manifest.path);
2397
+ const author = takeObject(manifest.value, ["author"], state, manifest.path);
2398
+ const authorName = author ? takeString(author.value, ["name"], state, author.path) : void 0;
2399
+ const authors = authorName && author ? [
2400
+ compact({
2401
+ name: authorName,
2402
+ email: takeString(author.value, ["email"], state, author.path),
2403
+ url: takeString(author.value, ["url"], state, author.path)
2404
+ })
2405
+ ] : void 0;
2406
+ Object.assign(
2407
+ packageConfig,
2408
+ compact({
2409
+ packageName,
2410
+ description,
2411
+ authors,
2412
+ license: license ? { type: license } : void 0
2413
+ })
2356
2414
  );
2357
- if (sections.length !== located.value.length) return void 0;
2415
+ }
2416
+ function takePythonAdditionalInitExports(config, state, basePath) {
2417
+ const located = locate(config, ["additionalInitExports"], basePath);
2418
+ if (!located || !Array.isArray(located.value)) return void 0;
2419
+ const exports = located.value.flatMap((entry) => {
2420
+ if (!isObject(entry)) return [];
2421
+ const from = stringValue(entry.from);
2422
+ const imports = stringArrayValue(entry.imports);
2423
+ return from && imports?.length ? [{ from, imports }] : [];
2424
+ });
2425
+ if (exports.length !== located.value.length) return void 0;
2358
2426
  consume(state, located.path);
2359
- return sections;
2427
+ return exports;
2360
2428
  }
2361
2429
  function takeReadmeEndpoint(value, aliases, state, basePath) {
2362
2430
  const located = locate(value, aliases, basePath);