@postman/sdk-config 0.3.1 → 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 (36) hide show
  1. package/README.md +8 -4
  2. package/dist/index.cjs +199 -45
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +199 -45
  7. package/dist/index.js.map +1 -1
  8. package/dist/sdk-config/index.cjs +167 -28
  9. package/dist/sdk-config/index.cjs.map +1 -1
  10. package/dist/sdk-config/index.d.cts +1 -1
  11. package/dist/sdk-config/index.d.ts +1 -1
  12. package/dist/sdk-config/index.js +167 -28
  13. package/dist/sdk-config/index.js.map +1 -1
  14. package/dist/sdk-config/v1/index.cjs +167 -28
  15. package/dist/sdk-config/v1/index.cjs.map +1 -1
  16. package/dist/sdk-config/v1/index.d.cts +4803 -1
  17. package/dist/sdk-config/v1/index.d.ts +4803 -1
  18. package/dist/sdk-config/v1/index.js +167 -28
  19. package/dist/sdk-config/v1/index.js.map +1 -1
  20. package/dist/sdk-config-ir/index.cjs +40 -19
  21. package/dist/sdk-config-ir/index.cjs.map +1 -1
  22. package/dist/sdk-config-ir/index.d.cts +1 -1
  23. package/dist/sdk-config-ir/index.d.ts +1 -1
  24. package/dist/sdk-config-ir/index.js +40 -19
  25. package/dist/sdk-config-ir/index.js.map +1 -1
  26. package/dist/sdk-config-ir/v1/index.cjs +40 -19
  27. package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
  28. package/dist/sdk-config-ir/v1/index.d.cts +490 -162
  29. package/dist/sdk-config-ir/v1/index.d.ts +490 -162
  30. package/dist/sdk-config-ir/v1/index.js +40 -19
  31. package/dist/sdk-config-ir/v1/index.js.map +1 -1
  32. package/dist/{typescript-DNqK3T3v.d.cts → typescript-CKRe_6MB.d.cts} +5 -0
  33. package/dist/{typescript-DNqK3T3v.d.ts → typescript-CKRe_6MB.d.ts} +5 -0
  34. package/package.json +1 -1
  35. package/src/sdk-config/v1/README.md +33 -23
  36. package/src/sdk-config-ir/v1/README.md +102 -96
@@ -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,
@@ -711,6 +712,7 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
711
712
  if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
712
713
  if (stringValue(value.host)) consume(state, [...sourcePath, "host"]);
713
714
  if (stringValue(value.branch)) consume(state, [...sourcePath, "branch"]);
715
+ const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
714
716
  return {
715
717
  output: {
716
718
  delivery: "github",
@@ -719,13 +721,58 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
719
721
  ...optional("host", stringValue(value.host)),
720
722
  ...optional("branch", stringValue(value.branch)),
721
723
  mode: value.makePr === true || type === "pullRequest" ? "pull-request" : type === "push" ? "push" : "release",
722
- ...optional("reviewers", reviewers)
724
+ ...optional("reviewers", reviewers),
725
+ ...optional("credentials", credentials)
723
726
  },
724
727
  ...publication ? { publish: publication.publish } : {}
725
728
  },
726
729
  ...optional("package", publication?.package)
727
730
  };
728
731
  }
732
+ function mapCredentials(value, sourcePath, state) {
733
+ if (!isObject(value)) return void 0;
734
+ return credentialsFromObject(value, sourcePath, state);
735
+ }
736
+ function mapInlineCredentials(value, sourcePath, state) {
737
+ const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
738
+ if (credentials) return credentials;
739
+ return credentialsFromObject(value, sourcePath, state);
740
+ }
741
+ function credentialsFromObject(value, sourcePath, state) {
742
+ const credentials = {};
743
+ const username = stringValue(value.username);
744
+ const password = stringValue(value.password);
745
+ const token = stringValue(value.token);
746
+ const apiKey = stringValue(value.apiKey);
747
+ if (username) {
748
+ credentials.username = username;
749
+ consume(state, [...sourcePath, "username"]);
750
+ }
751
+ if (password) {
752
+ credentials.password = password;
753
+ consume(state, [...sourcePath, "password"]);
754
+ }
755
+ if (token) {
756
+ credentials.token = token;
757
+ consume(state, [...sourcePath, "token"]);
758
+ }
759
+ if (apiKey) {
760
+ credentials.apiKey = apiKey;
761
+ consume(state, [...sourcePath, "apiKey"]);
762
+ }
763
+ return Object.keys(credentials).length === 0 ? void 0 : credentials;
764
+ }
765
+ function mapMavenSignature(value, sourcePath, state) {
766
+ if (!isObject(value)) return void 0;
767
+ const keyId = stringValue(value.keyId);
768
+ const password = stringValue(value.password);
769
+ const secretKey = stringValue(value.secretKey);
770
+ if (!keyId || !password || !secretKey) return void 0;
771
+ consume(state, [...sourcePath, "keyId"]);
772
+ consume(state, [...sourcePath, "password"]);
773
+ consume(state, [...sourcePath, "secretKey"]);
774
+ return { keyId, password, secretKey };
775
+ }
729
776
  function mapReviewers(value, sourcePath, state) {
730
777
  if (Array.isArray(value)) {
731
778
  const teams2 = reviewerNames(value, "team", sourcePath, state);
@@ -769,11 +816,13 @@ function mapPublication(value, language, sourcePath, state, index) {
769
816
  const registry = publicationRegistry(type, language, [...sourcePath, "type"], index);
770
817
  const registryUrl = stringValue(nested.registryUrl);
771
818
  if (registryUrl) consume(state, [...nestedPath, "registryUrl"]);
819
+ const credentials = mapInlineCredentials(nested, nestedPath, state);
772
820
  if (registry === "maven") {
773
821
  const coordinate = stringValue(nested.coordinate);
822
+ const signature = mapMavenSignature(nested.signature, [...nestedPath, "signature"], state);
774
823
  if (coordinate) consume(state, [...nestedPath, "coordinate"]);
775
824
  return {
776
- publish: compact({ registry, url: registryUrl }),
825
+ publish: compact({ registry, url: registryUrl, credentials, signature }),
777
826
  ...coordinate ? { package: mavenPackage(coordinate, [...nestedPath, "coordinate"], index) } : {}
778
827
  };
779
828
  }
@@ -782,7 +831,7 @@ function mapPublication(value, language, sourcePath, state, index) {
782
831
  if (packageName) consume(state, [...nestedPath, packageNameField]);
783
832
  const metadata = registry === "pypi" ? mapPypiMetadata(nested.pypiMetadata, nestedPath, state) : {};
784
833
  return {
785
- publish: compact({ registry, url: registryUrl }),
834
+ publish: compact({ registry, url: registryUrl, credentials }),
786
835
  ...packageName || Object.keys(metadata).length ? { package: { ...optional("packageName", packageName), ...metadata } } : {}
787
836
  };
788
837
  }
@@ -874,7 +923,8 @@ function mapAuthors(value, sourcePath, state) {
874
923
  if (!isObject(author)) return [];
875
924
  const name = stringValue(author.name);
876
925
  const email = stringValue(author.email);
877
- return name ? [{ name, ...optional("email", email) }] : [];
926
+ const url = stringValue(author.url);
927
+ return name ? [{ name, ...optional("email", email), ...optional("url", url) }] : [];
878
928
  });
879
929
  if (authors.length !== value.length) return void 0;
880
930
  value.forEach((author, index) => {
@@ -882,6 +932,9 @@ function mapAuthors(value, sourcePath, state) {
882
932
  if (isObject(author) && stringValue(author.email)) {
883
933
  consume(state, [...sourcePath, index, "email"]);
884
934
  }
935
+ if (isObject(author) && stringValue(author.url)) {
936
+ consume(state, [...sourcePath, index, "url"]);
937
+ }
885
938
  });
886
939
  return authors;
887
940
  }
@@ -899,7 +952,11 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
899
952
  code: "FERN_OUTPUT_CREDENTIAL_UNSUPPORTED",
900
953
  severity: "warning",
901
954
  path: sourcePath,
902
- reason: "Fern output credentials and signatures are intentionally excluded from SDK Config v1",
955
+ // This diagnostic only captures credential/signature fields that remained
956
+ // unconsumed after mapping supported registry/GitHub credentials into
957
+ // SDK Config v1. Supported credential shapes are carried through; this
958
+ // warning is about the remaining legacy-only credential fields.
959
+ reason: "Some Fern output credentials and signatures are intentionally excluded from SDK Config v1 when they cannot be represented in the public schema",
903
960
  suggestedAction: "Provide publishing credentials through the build request or external secret resolution."
904
961
  }
905
962
  ] : [],
@@ -1119,15 +1176,33 @@ var sdkConfigV1PublishRegistrySchema = zod.z.enum([
1119
1176
  "go",
1120
1177
  "composer"
1121
1178
  ]);
1179
+ var registryCredentialsSchema = zod.z.strictObject({
1180
+ username: nonEmptyStringSchema.optional(),
1181
+ password: nonEmptyStringSchema.optional(),
1182
+ token: nonEmptyStringSchema.optional(),
1183
+ apiKey: nonEmptyStringSchema.optional()
1184
+ });
1185
+ var mavenSignatureSchema = zod.z.strictObject({
1186
+ keyId: nonEmptyStringSchema,
1187
+ password: nonEmptyStringSchema,
1188
+ secretKey: nonEmptyStringSchema
1189
+ });
1122
1190
  var commonPublishShape = {
1123
1191
  url: nonEmptyStringSchema.optional(),
1192
+ /** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
1193
+ credentials: registryCredentialsSchema.optional(),
1124
1194
  releaseBranch: nonEmptyStringSchema.optional(),
1125
1195
  tolerateRepublish: zod.z.boolean().optional()
1126
1196
  };
1127
1197
  var sdkConfigV1PublishConfigSchema = zod.z.discriminatedUnion("registry", [
1128
1198
  zod.z.strictObject({ registry: zod.z.literal("npm"), ...commonPublishShape }),
1129
1199
  zod.z.strictObject({ registry: zod.z.literal("pypi"), ...commonPublishShape }),
1130
- zod.z.strictObject({ registry: zod.z.literal("maven"), ...commonPublishShape }),
1200
+ zod.z.strictObject({
1201
+ registry: zod.z.literal("maven"),
1202
+ /** Raw Maven signing material. These values can be sensitive and must be handled as secrets. */
1203
+ signature: mavenSignatureSchema.optional(),
1204
+ ...commonPublishShape
1205
+ }),
1131
1206
  zod.z.strictObject({ registry: zod.z.literal("nuget"), ...commonPublishShape }),
1132
1207
  zod.z.strictObject({ registry: zod.z.literal("rubygems"), ...commonPublishShape }),
1133
1208
  zod.z.strictObject({ registry: zod.z.literal("crates"), ...commonPublishShape }),
@@ -1138,12 +1213,15 @@ var reviewersSchema = zod.z.strictObject({
1138
1213
  teams: zod.z.array(nonEmptyStringSchema).optional(),
1139
1214
  users: zod.z.array(nonEmptyStringSchema).optional()
1140
1215
  });
1216
+ var githubCredentialsSchema = registryCredentialsSchema;
1141
1217
  var githubOutputSchema = zod.z.strictObject({
1142
1218
  repository: nonEmptyStringSchema,
1143
1219
  host: nonEmptyStringSchema.optional(),
1144
1220
  branch: nonEmptyStringSchema.optional(),
1145
- mode: zod.z.enum(["release", "pull-request", "push"]).optional(),
1221
+ mode: zod.z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
1146
1222
  reviewers: reviewersSchema.optional(),
1223
+ /** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
1224
+ credentials: githubCredentialsSchema.optional(),
1147
1225
  privateRepository: zod.z.boolean().optional()
1148
1226
  });
1149
1227
  var filesOutputSchema = zod.z.strictObject({
@@ -1340,13 +1418,18 @@ var pydanticConfigSchema = zod.z.strictObject({
1340
1418
  unionNaming: zod.z.enum(["v0", "v1"]).optional(),
1341
1419
  useFieldAliases: zod.z.boolean().optional()
1342
1420
  });
1421
+ var additionalInitExportSchema = zod.z.strictObject({
1422
+ from: nonEmptyStringSchema,
1423
+ imports: zod.z.array(nonEmptyStringSchema).min(1)
1424
+ });
1343
1425
  var pythonGenerationConfigSchema = zod.z.strictObject({
1344
1426
  pythonVersion: nonEmptyStringSchema.optional(),
1345
1427
  pydanticVersion: nonEmptyStringSchema.optional(),
1346
1428
  pydantic: pydanticConfigSchema.optional(),
1347
1429
  client: pythonClientSchema.optional(),
1348
1430
  alwaysInitializeOptionals: zod.z.boolean().optional(),
1349
- useTypedDictRequests: zod.z.boolean().optional()
1431
+ useTypedDictRequests: zod.z.boolean().optional(),
1432
+ additionalInitExports: zod.z.array(additionalInitExportSchema).optional()
1350
1433
  });
1351
1434
  var rubyGenerationConfigSchema = zod.z.strictObject({
1352
1435
  requirePaths: zod.z.array(nonEmptyStringSchema).optional()
@@ -1619,9 +1702,14 @@ function mapFernConfigToSdkConfigV1(input) {
1619
1702
  "Select a Fern generator group containing at least one SDK generator."
1620
1703
  );
1621
1704
  }
1705
+ const languages = input.group.generators.map(
1706
+ (generator, index) => resolveLanguage(generator, index)
1707
+ );
1708
+ requireUniqueLanguages(languages);
1709
+ const activeLanguages = new Set(languages);
1622
1710
  const mapped = input.group.generators.map((generator, index) => {
1623
- const language = resolveLanguage(generator, index);
1624
- const invocation = mapInvocation(generator, language, index);
1711
+ const language = languages[index];
1712
+ const invocation = mapInvocation(generator, language, activeLanguages, index);
1625
1713
  const outputMapping = generator.output ? { output: generator.output, unsupportedFields: [] } : mapOutput(generator, language, index);
1626
1714
  return {
1627
1715
  generator,
@@ -1630,7 +1718,6 @@ function mapFernConfigToSdkConfigV1(input) {
1630
1718
  ...outputMapping
1631
1719
  };
1632
1720
  });
1633
- requireUniqueLanguages(mapped.map(({ language }) => language));
1634
1721
  const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
1635
1722
  const docs = partitionSharedBlock(mapped.map(({ invocation }) => invocation.docs));
1636
1723
  const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
@@ -1801,14 +1888,17 @@ function partitionObjectValues(values) {
1801
1888
  }
1802
1889
  return { shared, overrides };
1803
1890
  }
1804
- function mapInvocation(generator, language, index) {
1891
+ function mapInvocation(generator, language, activeLanguages, index) {
1805
1892
  const prefix = ["group", "generators", index];
1806
1893
  const state = { consumedPaths: /* @__PURE__ */ new Set() };
1807
1894
  const config = isObject(generator.config) ? generator.config : {};
1808
1895
  const client = {};
1809
1896
  const generation = {};
1810
1897
  const packageConfig = {};
1811
- mapCommonConfig(config, state, client, generation, packageConfig, [...prefix, "config"]);
1898
+ mapCommonConfig(language, config, state, client, generation, packageConfig, [
1899
+ ...prefix,
1900
+ "config"
1901
+ ]);
1812
1902
  const rawGenerator = isObject(generator.raw) ? generator.raw : void 0;
1813
1903
  const smartCasing = typeof rawGenerator?.["smart-casing"] === "boolean" ? rawGenerator["smart-casing"] : generator.smartCasing === false ? false : void 0;
1814
1904
  const smartCasingDigitWordBoundary = typeof rawGenerator?.["smart-casing-digit-word-boundary"] === "boolean" ? rawGenerator["smart-casing-digit-word-boundary"] : generator.smartCasingDigitWordBoundary === true ? true : void 0;
@@ -1837,7 +1927,7 @@ function mapInvocation(generator, language, index) {
1837
1927
  client.pathParameterStyle = inlinePathParameters ? "inline" : "wrapped";
1838
1928
  }
1839
1929
  }
1840
- const docs = mapReadme(generator.readme, state, [...prefix, "readme"]);
1930
+ const docs = mapReadme(generator.readme, language, activeLanguages, state, [...prefix, "readme"]);
1841
1931
  const unsupportedFields = [
1842
1932
  ...collectUnsupported(config, [...prefix, "config"], state),
1843
1933
  ...settings ? collectUnsupported(settings, [...prefix, "settings"], state) : [],
@@ -1893,7 +1983,7 @@ function resolvedFieldGuidance(field) {
1893
1983
  function isDefaultAutomation(value) {
1894
1984
  return isObject(value) && value.generate === true && value.upgrade === true && value.preview === true && value.verify === true;
1895
1985
  }
1896
- function mapCommonConfig(config, state, client, generation, packageConfig, basePath) {
1986
+ function mapCommonConfig(language, config, state, client, generation, packageConfig, basePath) {
1897
1987
  const inlinePath = takeBoolean(config, ["inlinePathParameters"], state, basePath);
1898
1988
  const inlineFile = takeBoolean(config, ["inlineFileProperties"], state, basePath);
1899
1989
  const inlineRequest = takeBoolean(config, ["inlineRequestParams"], state, basePath);
@@ -1903,12 +1993,15 @@ function mapCommonConfig(config, state, client, generation, packageConfig, baseP
1903
1993
  client.requestParameterStyle = inlineRequest ? "inline" : "wrapped";
1904
1994
  const timeoutMs = takeTimeoutMs(config, state, basePath);
1905
1995
  if (timeoutMs !== void 0) client.timeoutMs = timeoutMs;
1906
- const skipValidation = takeBoolean(
1996
+ const directSkipValidation = takeBoolean(
1907
1997
  config,
1908
1998
  ["skipResponseValidation", "skipValidation"],
1909
1999
  state,
1910
2000
  basePath
1911
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;
1912
2005
  if (skipValidation !== void 0) client.responseValidation = !skipValidation;
1913
2006
  const useDefaults = takeBoolean(config, ["useDefaultRequestParameterValues"], state, basePath);
1914
2007
  if (useDefaults !== void 0) client.useDefaultRequestParameterValues = useDefaults;
@@ -2009,16 +2102,16 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
2009
2102
  }
2010
2103
  }
2011
2104
  function mapTypescript(config, state, packageConfig, basePath) {
2012
- const packageJson = takeObject(config, ["packageJson"], state, basePath);
2013
- const packageName = packageJson ? takeString(packageJson.value, ["name"], state, packageJson.path) : void 0;
2014
- if (packageName !== void 0) packageConfig.packageName = packageName;
2105
+ mapPackageManifest(config, ["packageJson"], state, packageConfig, basePath);
2015
2106
  const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
2016
2107
  const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
2108
+ const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
2017
2109
  return compact({
2018
2110
  typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
2019
2111
  zodVersion: takeString(config, ["zodVersion"], state, basePath),
2020
2112
  packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
2021
2113
  testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
2114
+ httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
2022
2115
  bundle: takeBoolean(config, ["bundle"], state, basePath),
2023
2116
  exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
2024
2117
  namespaceExportName: takeString(
@@ -2043,7 +2136,8 @@ function mapPython(config, state, packageConfig, basePath) {
2043
2136
  pythonVersion: takeString(config, ["pythonVersion", "pyprojectPythonVersion"], state, basePath),
2044
2137
  pydanticVersion: takeString(config, ["pydanticVersion"], state, basePath),
2045
2138
  alwaysInitializeOptionals: takeBoolean(config, ["alwaysInitializeOptionals"], state, basePath),
2046
- useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath)
2139
+ useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath),
2140
+ additionalInitExports: takePythonAdditionalInitExports(config, state, basePath)
2047
2141
  });
2048
2142
  }
2049
2143
  function mapJvm(language, config, state, packageConfig, basePath) {
@@ -2123,6 +2217,7 @@ function mapCsharp(config, state, packageConfig, basePath) {
2123
2217
  });
2124
2218
  }
2125
2219
  function mapPhp(config, state, packageConfig, basePath) {
2220
+ mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
2126
2221
  const packageName = takeString(config, ["packageName"], state, basePath);
2127
2222
  if (packageName !== void 0) packageConfig.packageName = packageName;
2128
2223
  return compact({
@@ -2205,7 +2300,7 @@ function mapMcp(config, state, basePath) {
2205
2300
  toolsets: takeToolsets(config, ["toolsets"], state, basePath)
2206
2301
  });
2207
2302
  }
2208
- function mapReadme(value, state, basePath) {
2303
+ function mapReadme(value, language, activeLanguages, state, basePath) {
2209
2304
  if (!isObject(value)) return {};
2210
2305
  const readme = compact({
2211
2306
  apiName: takeString(value, ["apiName"], state, basePath),
@@ -2213,7 +2308,7 @@ function mapReadme(value, state, basePath) {
2213
2308
  apiReferenceLink: takeString(value, ["apiReferenceLink"], state, basePath),
2214
2309
  bannerLink: takeString(value, ["bannerLink"], state, basePath),
2215
2310
  disabledSections: takeStringArray(value, ["disabledSections"], state, basePath),
2216
- customSections: takeCustomSections(value, state, basePath),
2311
+ customSections: takeCustomSections(value, language, activeLanguages, state, basePath),
2217
2312
  defaultEndpoint: takeReadmeEndpoint(value, ["defaultEndpoint"], state, basePath),
2218
2313
  features: takeReadmeFeatures(value, state, basePath)
2219
2314
  });
@@ -2275,15 +2370,59 @@ function mapDependency(name, value, state, path) {
2275
2370
  }
2276
2371
  ];
2277
2372
  }
2278
- function takeCustomSections(value, state, basePath) {
2373
+ function takeCustomSections(value, language, activeLanguages, state, basePath) {
2279
2374
  const located = locate(value, ["customSections"], basePath);
2280
2375
  if (!located || !Array.isArray(located.value)) return void 0;
2281
- const sections = located.value.flatMap(
2282
- (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
+ })
2283
2412
  );
2284
- 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;
2285
2424
  consume(state, located.path);
2286
- return sections;
2425
+ return exports;
2287
2426
  }
2288
2427
  function takeReadmeEndpoint(value, aliases, state, basePath) {
2289
2428
  const located = locate(value, aliases, basePath);