@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.
- package/README.md +8 -4
- package/dist/index.cjs +199 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +199 -45
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +167 -28
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.d.cts +1 -1
- package/dist/sdk-config/index.d.ts +1 -1
- package/dist/sdk-config/index.js +167 -28
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +167 -28
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +4803 -1
- package/dist/sdk-config/v1/index.d.ts +4803 -1
- package/dist/sdk-config/v1/index.js +167 -28
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +40 -19
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.d.cts +1 -1
- package/dist/sdk-config-ir/index.d.ts +1 -1
- package/dist/sdk-config-ir/index.js +40 -19
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +40 -19
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +490 -162
- package/dist/sdk-config-ir/v1/index.d.ts +490 -162
- package/dist/sdk-config-ir/v1/index.js +40 -19
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-DNqK3T3v.d.cts → typescript-CKRe_6MB.d.cts} +5 -0
- package/dist/{typescript-DNqK3T3v.d.ts → typescript-CKRe_6MB.d.ts} +5 -0
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +33 -23
- package/src/sdk-config-ir/v1/README.md +102 -96
|
@@ -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,
|
|
@@ -705,6 +706,7 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
|
|
|
705
706
|
if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
|
|
706
707
|
if (stringValue(value.host)) consume(state, [...sourcePath, "host"]);
|
|
707
708
|
if (stringValue(value.branch)) consume(state, [...sourcePath, "branch"]);
|
|
709
|
+
const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
|
|
708
710
|
return {
|
|
709
711
|
output: {
|
|
710
712
|
delivery: "github",
|
|
@@ -713,13 +715,58 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
|
|
|
713
715
|
...optional("host", stringValue(value.host)),
|
|
714
716
|
...optional("branch", stringValue(value.branch)),
|
|
715
717
|
mode: value.makePr === true || type === "pullRequest" ? "pull-request" : type === "push" ? "push" : "release",
|
|
716
|
-
...optional("reviewers", reviewers)
|
|
718
|
+
...optional("reviewers", reviewers),
|
|
719
|
+
...optional("credentials", credentials)
|
|
717
720
|
},
|
|
718
721
|
...publication ? { publish: publication.publish } : {}
|
|
719
722
|
},
|
|
720
723
|
...optional("package", publication?.package)
|
|
721
724
|
};
|
|
722
725
|
}
|
|
726
|
+
function mapCredentials(value, sourcePath, state) {
|
|
727
|
+
if (!isObject(value)) return void 0;
|
|
728
|
+
return credentialsFromObject(value, sourcePath, state);
|
|
729
|
+
}
|
|
730
|
+
function mapInlineCredentials(value, sourcePath, state) {
|
|
731
|
+
const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
|
|
732
|
+
if (credentials) return credentials;
|
|
733
|
+
return credentialsFromObject(value, sourcePath, state);
|
|
734
|
+
}
|
|
735
|
+
function credentialsFromObject(value, sourcePath, state) {
|
|
736
|
+
const credentials = {};
|
|
737
|
+
const username = stringValue(value.username);
|
|
738
|
+
const password = stringValue(value.password);
|
|
739
|
+
const token = stringValue(value.token);
|
|
740
|
+
const apiKey = stringValue(value.apiKey);
|
|
741
|
+
if (username) {
|
|
742
|
+
credentials.username = username;
|
|
743
|
+
consume(state, [...sourcePath, "username"]);
|
|
744
|
+
}
|
|
745
|
+
if (password) {
|
|
746
|
+
credentials.password = password;
|
|
747
|
+
consume(state, [...sourcePath, "password"]);
|
|
748
|
+
}
|
|
749
|
+
if (token) {
|
|
750
|
+
credentials.token = token;
|
|
751
|
+
consume(state, [...sourcePath, "token"]);
|
|
752
|
+
}
|
|
753
|
+
if (apiKey) {
|
|
754
|
+
credentials.apiKey = apiKey;
|
|
755
|
+
consume(state, [...sourcePath, "apiKey"]);
|
|
756
|
+
}
|
|
757
|
+
return Object.keys(credentials).length === 0 ? void 0 : credentials;
|
|
758
|
+
}
|
|
759
|
+
function mapMavenSignature(value, sourcePath, state) {
|
|
760
|
+
if (!isObject(value)) return void 0;
|
|
761
|
+
const keyId = stringValue(value.keyId);
|
|
762
|
+
const password = stringValue(value.password);
|
|
763
|
+
const secretKey = stringValue(value.secretKey);
|
|
764
|
+
if (!keyId || !password || !secretKey) return void 0;
|
|
765
|
+
consume(state, [...sourcePath, "keyId"]);
|
|
766
|
+
consume(state, [...sourcePath, "password"]);
|
|
767
|
+
consume(state, [...sourcePath, "secretKey"]);
|
|
768
|
+
return { keyId, password, secretKey };
|
|
769
|
+
}
|
|
723
770
|
function mapReviewers(value, sourcePath, state) {
|
|
724
771
|
if (Array.isArray(value)) {
|
|
725
772
|
const teams2 = reviewerNames(value, "team", sourcePath, state);
|
|
@@ -763,11 +810,13 @@ function mapPublication(value, language, sourcePath, state, index) {
|
|
|
763
810
|
const registry = publicationRegistry(type, language, [...sourcePath, "type"], index);
|
|
764
811
|
const registryUrl = stringValue(nested.registryUrl);
|
|
765
812
|
if (registryUrl) consume(state, [...nestedPath, "registryUrl"]);
|
|
813
|
+
const credentials = mapInlineCredentials(nested, nestedPath, state);
|
|
766
814
|
if (registry === "maven") {
|
|
767
815
|
const coordinate = stringValue(nested.coordinate);
|
|
816
|
+
const signature = mapMavenSignature(nested.signature, [...nestedPath, "signature"], state);
|
|
768
817
|
if (coordinate) consume(state, [...nestedPath, "coordinate"]);
|
|
769
818
|
return {
|
|
770
|
-
publish: compact({ registry, url: registryUrl }),
|
|
819
|
+
publish: compact({ registry, url: registryUrl, credentials, signature }),
|
|
771
820
|
...coordinate ? { package: mavenPackage(coordinate, [...nestedPath, "coordinate"], index) } : {}
|
|
772
821
|
};
|
|
773
822
|
}
|
|
@@ -776,7 +825,7 @@ function mapPublication(value, language, sourcePath, state, index) {
|
|
|
776
825
|
if (packageName) consume(state, [...nestedPath, packageNameField]);
|
|
777
826
|
const metadata = registry === "pypi" ? mapPypiMetadata(nested.pypiMetadata, nestedPath, state) : {};
|
|
778
827
|
return {
|
|
779
|
-
publish: compact({ registry, url: registryUrl }),
|
|
828
|
+
publish: compact({ registry, url: registryUrl, credentials }),
|
|
780
829
|
...packageName || Object.keys(metadata).length ? { package: { ...optional("packageName", packageName), ...metadata } } : {}
|
|
781
830
|
};
|
|
782
831
|
}
|
|
@@ -868,7 +917,8 @@ function mapAuthors(value, sourcePath, state) {
|
|
|
868
917
|
if (!isObject(author)) return [];
|
|
869
918
|
const name = stringValue(author.name);
|
|
870
919
|
const email = stringValue(author.email);
|
|
871
|
-
|
|
920
|
+
const url = stringValue(author.url);
|
|
921
|
+
return name ? [{ name, ...optional("email", email), ...optional("url", url) }] : [];
|
|
872
922
|
});
|
|
873
923
|
if (authors.length !== value.length) return void 0;
|
|
874
924
|
value.forEach((author, index) => {
|
|
@@ -876,6 +926,9 @@ function mapAuthors(value, sourcePath, state) {
|
|
|
876
926
|
if (isObject(author) && stringValue(author.email)) {
|
|
877
927
|
consume(state, [...sourcePath, index, "email"]);
|
|
878
928
|
}
|
|
929
|
+
if (isObject(author) && stringValue(author.url)) {
|
|
930
|
+
consume(state, [...sourcePath, index, "url"]);
|
|
931
|
+
}
|
|
879
932
|
});
|
|
880
933
|
return authors;
|
|
881
934
|
}
|
|
@@ -893,7 +946,11 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
|
893
946
|
code: "FERN_OUTPUT_CREDENTIAL_UNSUPPORTED",
|
|
894
947
|
severity: "warning",
|
|
895
948
|
path: sourcePath,
|
|
896
|
-
|
|
949
|
+
// This diagnostic only captures credential/signature fields that remained
|
|
950
|
+
// unconsumed after mapping supported registry/GitHub credentials into
|
|
951
|
+
// SDK Config v1. Supported credential shapes are carried through; this
|
|
952
|
+
// warning is about the remaining legacy-only credential fields.
|
|
953
|
+
reason: "Some Fern output credentials and signatures are intentionally excluded from SDK Config v1 when they cannot be represented in the public schema",
|
|
897
954
|
suggestedAction: "Provide publishing credentials through the build request or external secret resolution."
|
|
898
955
|
}
|
|
899
956
|
] : [],
|
|
@@ -1113,15 +1170,33 @@ var sdkConfigV1PublishRegistrySchema = z.enum([
|
|
|
1113
1170
|
"go",
|
|
1114
1171
|
"composer"
|
|
1115
1172
|
]);
|
|
1173
|
+
var registryCredentialsSchema = z.strictObject({
|
|
1174
|
+
username: nonEmptyStringSchema.optional(),
|
|
1175
|
+
password: nonEmptyStringSchema.optional(),
|
|
1176
|
+
token: nonEmptyStringSchema.optional(),
|
|
1177
|
+
apiKey: nonEmptyStringSchema.optional()
|
|
1178
|
+
});
|
|
1179
|
+
var mavenSignatureSchema = z.strictObject({
|
|
1180
|
+
keyId: nonEmptyStringSchema,
|
|
1181
|
+
password: nonEmptyStringSchema,
|
|
1182
|
+
secretKey: nonEmptyStringSchema
|
|
1183
|
+
});
|
|
1116
1184
|
var commonPublishShape = {
|
|
1117
1185
|
url: nonEmptyStringSchema.optional(),
|
|
1186
|
+
/** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
|
|
1187
|
+
credentials: registryCredentialsSchema.optional(),
|
|
1118
1188
|
releaseBranch: nonEmptyStringSchema.optional(),
|
|
1119
1189
|
tolerateRepublish: z.boolean().optional()
|
|
1120
1190
|
};
|
|
1121
1191
|
var sdkConfigV1PublishConfigSchema = z.discriminatedUnion("registry", [
|
|
1122
1192
|
z.strictObject({ registry: z.literal("npm"), ...commonPublishShape }),
|
|
1123
1193
|
z.strictObject({ registry: z.literal("pypi"), ...commonPublishShape }),
|
|
1124
|
-
z.strictObject({
|
|
1194
|
+
z.strictObject({
|
|
1195
|
+
registry: z.literal("maven"),
|
|
1196
|
+
/** Raw Maven signing material. These values can be sensitive and must be handled as secrets. */
|
|
1197
|
+
signature: mavenSignatureSchema.optional(),
|
|
1198
|
+
...commonPublishShape
|
|
1199
|
+
}),
|
|
1125
1200
|
z.strictObject({ registry: z.literal("nuget"), ...commonPublishShape }),
|
|
1126
1201
|
z.strictObject({ registry: z.literal("rubygems"), ...commonPublishShape }),
|
|
1127
1202
|
z.strictObject({ registry: z.literal("crates"), ...commonPublishShape }),
|
|
@@ -1132,12 +1207,15 @@ var reviewersSchema = z.strictObject({
|
|
|
1132
1207
|
teams: z.array(nonEmptyStringSchema).optional(),
|
|
1133
1208
|
users: z.array(nonEmptyStringSchema).optional()
|
|
1134
1209
|
});
|
|
1210
|
+
var githubCredentialsSchema = registryCredentialsSchema;
|
|
1135
1211
|
var githubOutputSchema = z.strictObject({
|
|
1136
1212
|
repository: nonEmptyStringSchema,
|
|
1137
1213
|
host: nonEmptyStringSchema.optional(),
|
|
1138
1214
|
branch: nonEmptyStringSchema.optional(),
|
|
1139
|
-
mode: z.enum(["release", "pull-request", "push"]).optional(),
|
|
1215
|
+
mode: z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
|
|
1140
1216
|
reviewers: reviewersSchema.optional(),
|
|
1217
|
+
/** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
|
|
1218
|
+
credentials: githubCredentialsSchema.optional(),
|
|
1141
1219
|
privateRepository: z.boolean().optional()
|
|
1142
1220
|
});
|
|
1143
1221
|
var filesOutputSchema = z.strictObject({
|
|
@@ -1334,13 +1412,18 @@ var pydanticConfigSchema = z.strictObject({
|
|
|
1334
1412
|
unionNaming: z.enum(["v0", "v1"]).optional(),
|
|
1335
1413
|
useFieldAliases: z.boolean().optional()
|
|
1336
1414
|
});
|
|
1415
|
+
var additionalInitExportSchema = z.strictObject({
|
|
1416
|
+
from: nonEmptyStringSchema,
|
|
1417
|
+
imports: z.array(nonEmptyStringSchema).min(1)
|
|
1418
|
+
});
|
|
1337
1419
|
var pythonGenerationConfigSchema = z.strictObject({
|
|
1338
1420
|
pythonVersion: nonEmptyStringSchema.optional(),
|
|
1339
1421
|
pydanticVersion: nonEmptyStringSchema.optional(),
|
|
1340
1422
|
pydantic: pydanticConfigSchema.optional(),
|
|
1341
1423
|
client: pythonClientSchema.optional(),
|
|
1342
1424
|
alwaysInitializeOptionals: z.boolean().optional(),
|
|
1343
|
-
useTypedDictRequests: z.boolean().optional()
|
|
1425
|
+
useTypedDictRequests: z.boolean().optional(),
|
|
1426
|
+
additionalInitExports: z.array(additionalInitExportSchema).optional()
|
|
1344
1427
|
});
|
|
1345
1428
|
var rubyGenerationConfigSchema = z.strictObject({
|
|
1346
1429
|
requirePaths: z.array(nonEmptyStringSchema).optional()
|
|
@@ -1613,9 +1696,14 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
1613
1696
|
"Select a Fern generator group containing at least one SDK generator."
|
|
1614
1697
|
);
|
|
1615
1698
|
}
|
|
1699
|
+
const languages = input.group.generators.map(
|
|
1700
|
+
(generator, index) => resolveLanguage(generator, index)
|
|
1701
|
+
);
|
|
1702
|
+
requireUniqueLanguages(languages);
|
|
1703
|
+
const activeLanguages = new Set(languages);
|
|
1616
1704
|
const mapped = input.group.generators.map((generator, index) => {
|
|
1617
|
-
const language =
|
|
1618
|
-
const invocation = mapInvocation(generator, language, index);
|
|
1705
|
+
const language = languages[index];
|
|
1706
|
+
const invocation = mapInvocation(generator, language, activeLanguages, index);
|
|
1619
1707
|
const outputMapping = generator.output ? { output: generator.output, unsupportedFields: [] } : mapOutput(generator, language, index);
|
|
1620
1708
|
return {
|
|
1621
1709
|
generator,
|
|
@@ -1624,7 +1712,6 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
1624
1712
|
...outputMapping
|
|
1625
1713
|
};
|
|
1626
1714
|
});
|
|
1627
|
-
requireUniqueLanguages(mapped.map(({ language }) => language));
|
|
1628
1715
|
const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
|
|
1629
1716
|
const docs = partitionSharedBlock(mapped.map(({ invocation }) => invocation.docs));
|
|
1630
1717
|
const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
|
|
@@ -1795,14 +1882,17 @@ function partitionObjectValues(values) {
|
|
|
1795
1882
|
}
|
|
1796
1883
|
return { shared, overrides };
|
|
1797
1884
|
}
|
|
1798
|
-
function mapInvocation(generator, language, index) {
|
|
1885
|
+
function mapInvocation(generator, language, activeLanguages, index) {
|
|
1799
1886
|
const prefix = ["group", "generators", index];
|
|
1800
1887
|
const state = { consumedPaths: /* @__PURE__ */ new Set() };
|
|
1801
1888
|
const config = isObject(generator.config) ? generator.config : {};
|
|
1802
1889
|
const client = {};
|
|
1803
1890
|
const generation = {};
|
|
1804
1891
|
const packageConfig = {};
|
|
1805
|
-
mapCommonConfig(config, state, client, generation, packageConfig, [
|
|
1892
|
+
mapCommonConfig(language, config, state, client, generation, packageConfig, [
|
|
1893
|
+
...prefix,
|
|
1894
|
+
"config"
|
|
1895
|
+
]);
|
|
1806
1896
|
const rawGenerator = isObject(generator.raw) ? generator.raw : void 0;
|
|
1807
1897
|
const smartCasing = typeof rawGenerator?.["smart-casing"] === "boolean" ? rawGenerator["smart-casing"] : generator.smartCasing === false ? false : void 0;
|
|
1808
1898
|
const smartCasingDigitWordBoundary = typeof rawGenerator?.["smart-casing-digit-word-boundary"] === "boolean" ? rawGenerator["smart-casing-digit-word-boundary"] : generator.smartCasingDigitWordBoundary === true ? true : void 0;
|
|
@@ -1831,7 +1921,7 @@ function mapInvocation(generator, language, index) {
|
|
|
1831
1921
|
client.pathParameterStyle = inlinePathParameters ? "inline" : "wrapped";
|
|
1832
1922
|
}
|
|
1833
1923
|
}
|
|
1834
|
-
const docs = mapReadme(generator.readme, state, [...prefix, "readme"]);
|
|
1924
|
+
const docs = mapReadme(generator.readme, language, activeLanguages, state, [...prefix, "readme"]);
|
|
1835
1925
|
const unsupportedFields = [
|
|
1836
1926
|
...collectUnsupported(config, [...prefix, "config"], state),
|
|
1837
1927
|
...settings ? collectUnsupported(settings, [...prefix, "settings"], state) : [],
|
|
@@ -1887,7 +1977,7 @@ function resolvedFieldGuidance(field) {
|
|
|
1887
1977
|
function isDefaultAutomation(value) {
|
|
1888
1978
|
return isObject(value) && value.generate === true && value.upgrade === true && value.preview === true && value.verify === true;
|
|
1889
1979
|
}
|
|
1890
|
-
function mapCommonConfig(config, state, client, generation, packageConfig, basePath) {
|
|
1980
|
+
function mapCommonConfig(language, config, state, client, generation, packageConfig, basePath) {
|
|
1891
1981
|
const inlinePath = takeBoolean(config, ["inlinePathParameters"], state, basePath);
|
|
1892
1982
|
const inlineFile = takeBoolean(config, ["inlineFileProperties"], state, basePath);
|
|
1893
1983
|
const inlineRequest = takeBoolean(config, ["inlineRequestParams"], state, basePath);
|
|
@@ -1897,12 +1987,15 @@ function mapCommonConfig(config, state, client, generation, packageConfig, baseP
|
|
|
1897
1987
|
client.requestParameterStyle = inlineRequest ? "inline" : "wrapped";
|
|
1898
1988
|
const timeoutMs = takeTimeoutMs(config, state, basePath);
|
|
1899
1989
|
if (timeoutMs !== void 0) client.timeoutMs = timeoutMs;
|
|
1900
|
-
const
|
|
1990
|
+
const directSkipValidation = takeBoolean(
|
|
1901
1991
|
config,
|
|
1902
1992
|
["skipResponseValidation", "skipValidation"],
|
|
1903
1993
|
state,
|
|
1904
1994
|
basePath
|
|
1905
1995
|
);
|
|
1996
|
+
const pydanticConfig = language === "python" ? takeObject(config, ["pydanticConfig"], state, basePath) : void 0;
|
|
1997
|
+
const nestedSkipValidation = pydanticConfig ? takeBoolean(pydanticConfig.value, ["skipValidation"], state, pydanticConfig.path) : void 0;
|
|
1998
|
+
const skipValidation = directSkipValidation ?? nestedSkipValidation;
|
|
1906
1999
|
if (skipValidation !== void 0) client.responseValidation = !skipValidation;
|
|
1907
2000
|
const useDefaults = takeBoolean(config, ["useDefaultRequestParameterValues"], state, basePath);
|
|
1908
2001
|
if (useDefaults !== void 0) client.useDefaultRequestParameterValues = useDefaults;
|
|
@@ -2003,16 +2096,16 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
|
2003
2096
|
}
|
|
2004
2097
|
}
|
|
2005
2098
|
function mapTypescript(config, state, packageConfig, basePath) {
|
|
2006
|
-
|
|
2007
|
-
const packageName = packageJson ? takeString(packageJson.value, ["name"], state, packageJson.path) : void 0;
|
|
2008
|
-
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2099
|
+
mapPackageManifest(config, ["packageJson"], state, packageConfig, basePath);
|
|
2009
2100
|
const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
|
|
2010
2101
|
const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
|
|
2102
|
+
const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
|
|
2011
2103
|
return compact({
|
|
2012
2104
|
typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
|
|
2013
2105
|
zodVersion: takeString(config, ["zodVersion"], state, basePath),
|
|
2014
2106
|
packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
|
|
2015
2107
|
testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
|
|
2108
|
+
httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
|
|
2016
2109
|
bundle: takeBoolean(config, ["bundle"], state, basePath),
|
|
2017
2110
|
exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
|
|
2018
2111
|
namespaceExportName: takeString(
|
|
@@ -2037,7 +2130,8 @@ function mapPython(config, state, packageConfig, basePath) {
|
|
|
2037
2130
|
pythonVersion: takeString(config, ["pythonVersion", "pyprojectPythonVersion"], state, basePath),
|
|
2038
2131
|
pydanticVersion: takeString(config, ["pydanticVersion"], state, basePath),
|
|
2039
2132
|
alwaysInitializeOptionals: takeBoolean(config, ["alwaysInitializeOptionals"], state, basePath),
|
|
2040
|
-
useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath)
|
|
2133
|
+
useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath),
|
|
2134
|
+
additionalInitExports: takePythonAdditionalInitExports(config, state, basePath)
|
|
2041
2135
|
});
|
|
2042
2136
|
}
|
|
2043
2137
|
function mapJvm(language, config, state, packageConfig, basePath) {
|
|
@@ -2117,6 +2211,7 @@ function mapCsharp(config, state, packageConfig, basePath) {
|
|
|
2117
2211
|
});
|
|
2118
2212
|
}
|
|
2119
2213
|
function mapPhp(config, state, packageConfig, basePath) {
|
|
2214
|
+
mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2120
2215
|
const packageName = takeString(config, ["packageName"], state, basePath);
|
|
2121
2216
|
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2122
2217
|
return compact({
|
|
@@ -2199,7 +2294,7 @@ function mapMcp(config, state, basePath) {
|
|
|
2199
2294
|
toolsets: takeToolsets(config, ["toolsets"], state, basePath)
|
|
2200
2295
|
});
|
|
2201
2296
|
}
|
|
2202
|
-
function mapReadme(value, state, basePath) {
|
|
2297
|
+
function mapReadme(value, language, activeLanguages, state, basePath) {
|
|
2203
2298
|
if (!isObject(value)) return {};
|
|
2204
2299
|
const readme = compact({
|
|
2205
2300
|
apiName: takeString(value, ["apiName"], state, basePath),
|
|
@@ -2207,7 +2302,7 @@ function mapReadme(value, state, basePath) {
|
|
|
2207
2302
|
apiReferenceLink: takeString(value, ["apiReferenceLink"], state, basePath),
|
|
2208
2303
|
bannerLink: takeString(value, ["bannerLink"], state, basePath),
|
|
2209
2304
|
disabledSections: takeStringArray(value, ["disabledSections"], state, basePath),
|
|
2210
|
-
customSections: takeCustomSections(value, state, basePath),
|
|
2305
|
+
customSections: takeCustomSections(value, language, activeLanguages, state, basePath),
|
|
2211
2306
|
defaultEndpoint: takeReadmeEndpoint(value, ["defaultEndpoint"], state, basePath),
|
|
2212
2307
|
features: takeReadmeFeatures(value, state, basePath)
|
|
2213
2308
|
});
|
|
@@ -2269,15 +2364,59 @@ function mapDependency(name, value, state, path) {
|
|
|
2269
2364
|
}
|
|
2270
2365
|
];
|
|
2271
2366
|
}
|
|
2272
|
-
function takeCustomSections(value, state, basePath) {
|
|
2367
|
+
function takeCustomSections(value, language, activeLanguages, state, basePath) {
|
|
2273
2368
|
const located = locate(value, ["customSections"], basePath);
|
|
2274
2369
|
if (!located || !Array.isArray(located.value)) return void 0;
|
|
2275
|
-
const sections = located.value.flatMap(
|
|
2276
|
-
(
|
|
2370
|
+
const sections = located.value.flatMap((section, index) => {
|
|
2371
|
+
if (!isObject(section) || typeof section.title !== "string" || section.title.length === 0 || typeof section.content !== "string") {
|
|
2372
|
+
return [];
|
|
2373
|
+
}
|
|
2374
|
+
const sectionLanguage = section.language;
|
|
2375
|
+
if (sectionLanguage !== void 0 && (typeof sectionLanguage !== "string" || !isFernLanguage(sectionLanguage) || !activeLanguages.has(sectionLanguage))) {
|
|
2376
|
+
return [];
|
|
2377
|
+
}
|
|
2378
|
+
consume(state, [...located.path, index]);
|
|
2379
|
+
return sectionLanguage === void 0 || sectionLanguage === language ? [{ title: section.title, content: section.content }] : [];
|
|
2380
|
+
});
|
|
2381
|
+
return sections.length > 0 ? sections : void 0;
|
|
2382
|
+
}
|
|
2383
|
+
function mapPackageManifest(config, aliases, state, packageConfig, basePath) {
|
|
2384
|
+
const manifest = takeObject(config, aliases, state, basePath);
|
|
2385
|
+
if (!manifest) return;
|
|
2386
|
+
const packageName = takeString(manifest.value, ["name"], state, manifest.path);
|
|
2387
|
+
const description = takeString(manifest.value, ["description"], state, manifest.path);
|
|
2388
|
+
const license = takeString(manifest.value, ["license"], state, manifest.path);
|
|
2389
|
+
const author = takeObject(manifest.value, ["author"], state, manifest.path);
|
|
2390
|
+
const authorName = author ? takeString(author.value, ["name"], state, author.path) : void 0;
|
|
2391
|
+
const authors = authorName && author ? [
|
|
2392
|
+
compact({
|
|
2393
|
+
name: authorName,
|
|
2394
|
+
email: takeString(author.value, ["email"], state, author.path),
|
|
2395
|
+
url: takeString(author.value, ["url"], state, author.path)
|
|
2396
|
+
})
|
|
2397
|
+
] : void 0;
|
|
2398
|
+
Object.assign(
|
|
2399
|
+
packageConfig,
|
|
2400
|
+
compact({
|
|
2401
|
+
packageName,
|
|
2402
|
+
description,
|
|
2403
|
+
authors,
|
|
2404
|
+
license: license ? { type: license } : void 0
|
|
2405
|
+
})
|
|
2277
2406
|
);
|
|
2278
|
-
|
|
2407
|
+
}
|
|
2408
|
+
function takePythonAdditionalInitExports(config, state, basePath) {
|
|
2409
|
+
const located = locate(config, ["additionalInitExports"], basePath);
|
|
2410
|
+
if (!located || !Array.isArray(located.value)) return void 0;
|
|
2411
|
+
const exports = located.value.flatMap((entry) => {
|
|
2412
|
+
if (!isObject(entry)) return [];
|
|
2413
|
+
const from = stringValue(entry.from);
|
|
2414
|
+
const imports = stringArrayValue(entry.imports);
|
|
2415
|
+
return from && imports?.length ? [{ from, imports }] : [];
|
|
2416
|
+
});
|
|
2417
|
+
if (exports.length !== located.value.length) return void 0;
|
|
2279
2418
|
consume(state, located.path);
|
|
2280
|
-
return
|
|
2419
|
+
return exports;
|
|
2281
2420
|
}
|
|
2282
2421
|
function takeReadmeEndpoint(value, aliases, state, basePath) {
|
|
2283
2422
|
const located = locate(value, aliases, basePath);
|