@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.
- package/dist/index.cjs +88 -22
- 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 +88 -22
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +88 -22
- 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 +88 -22
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +88 -22
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +37 -1
- package/dist/sdk-config/v1/index.d.ts +37 -1
- package/dist/sdk-config/v1/index.js +88 -22
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +8 -2
- 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 +8 -2
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +8 -2
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +15 -2
- package/dist/sdk-config-ir/v1/index.d.ts +15 -2
- package/dist/sdk-config-ir/v1/index.js +8 -2
- 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 +19 -16
- package/src/sdk-config-ir/v1/README.md +11 -6
|
@@ -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
|
-
|
|
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
|
}
|
|
@@ -1407,13 +1412,18 @@ var pydanticConfigSchema = z.strictObject({
|
|
|
1407
1412
|
unionNaming: z.enum(["v0", "v1"]).optional(),
|
|
1408
1413
|
useFieldAliases: z.boolean().optional()
|
|
1409
1414
|
});
|
|
1415
|
+
var additionalInitExportSchema = z.strictObject({
|
|
1416
|
+
from: nonEmptyStringSchema,
|
|
1417
|
+
imports: z.array(nonEmptyStringSchema).min(1)
|
|
1418
|
+
});
|
|
1410
1419
|
var pythonGenerationConfigSchema = z.strictObject({
|
|
1411
1420
|
pythonVersion: nonEmptyStringSchema.optional(),
|
|
1412
1421
|
pydanticVersion: nonEmptyStringSchema.optional(),
|
|
1413
1422
|
pydantic: pydanticConfigSchema.optional(),
|
|
1414
1423
|
client: pythonClientSchema.optional(),
|
|
1415
1424
|
alwaysInitializeOptionals: z.boolean().optional(),
|
|
1416
|
-
useTypedDictRequests: z.boolean().optional()
|
|
1425
|
+
useTypedDictRequests: z.boolean().optional(),
|
|
1426
|
+
additionalInitExports: z.array(additionalInitExportSchema).optional()
|
|
1417
1427
|
});
|
|
1418
1428
|
var rubyGenerationConfigSchema = z.strictObject({
|
|
1419
1429
|
requirePaths: z.array(nonEmptyStringSchema).optional()
|
|
@@ -1686,9 +1696,14 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
1686
1696
|
"Select a Fern generator group containing at least one SDK generator."
|
|
1687
1697
|
);
|
|
1688
1698
|
}
|
|
1699
|
+
const languages = input.group.generators.map(
|
|
1700
|
+
(generator, index) => resolveLanguage(generator, index)
|
|
1701
|
+
);
|
|
1702
|
+
requireUniqueLanguages(languages);
|
|
1703
|
+
const activeLanguages = new Set(languages);
|
|
1689
1704
|
const mapped = input.group.generators.map((generator, index) => {
|
|
1690
|
-
const language =
|
|
1691
|
-
const invocation = mapInvocation(generator, language, index);
|
|
1705
|
+
const language = languages[index];
|
|
1706
|
+
const invocation = mapInvocation(generator, language, activeLanguages, index);
|
|
1692
1707
|
const outputMapping = generator.output ? { output: generator.output, unsupportedFields: [] } : mapOutput(generator, language, index);
|
|
1693
1708
|
return {
|
|
1694
1709
|
generator,
|
|
@@ -1697,7 +1712,6 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
1697
1712
|
...outputMapping
|
|
1698
1713
|
};
|
|
1699
1714
|
});
|
|
1700
|
-
requireUniqueLanguages(mapped.map(({ language }) => language));
|
|
1701
1715
|
const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
|
|
1702
1716
|
const docs = partitionSharedBlock(mapped.map(({ invocation }) => invocation.docs));
|
|
1703
1717
|
const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
|
|
@@ -1868,14 +1882,17 @@ function partitionObjectValues(values) {
|
|
|
1868
1882
|
}
|
|
1869
1883
|
return { shared, overrides };
|
|
1870
1884
|
}
|
|
1871
|
-
function mapInvocation(generator, language, index) {
|
|
1885
|
+
function mapInvocation(generator, language, activeLanguages, index) {
|
|
1872
1886
|
const prefix = ["group", "generators", index];
|
|
1873
1887
|
const state = { consumedPaths: /* @__PURE__ */ new Set() };
|
|
1874
1888
|
const config = isObject(generator.config) ? generator.config : {};
|
|
1875
1889
|
const client = {};
|
|
1876
1890
|
const generation = {};
|
|
1877
1891
|
const packageConfig = {};
|
|
1878
|
-
mapCommonConfig(config, state, client, generation, packageConfig, [
|
|
1892
|
+
mapCommonConfig(language, config, state, client, generation, packageConfig, [
|
|
1893
|
+
...prefix,
|
|
1894
|
+
"config"
|
|
1895
|
+
]);
|
|
1879
1896
|
const rawGenerator = isObject(generator.raw) ? generator.raw : void 0;
|
|
1880
1897
|
const smartCasing = typeof rawGenerator?.["smart-casing"] === "boolean" ? rawGenerator["smart-casing"] : generator.smartCasing === false ? false : void 0;
|
|
1881
1898
|
const smartCasingDigitWordBoundary = typeof rawGenerator?.["smart-casing-digit-word-boundary"] === "boolean" ? rawGenerator["smart-casing-digit-word-boundary"] : generator.smartCasingDigitWordBoundary === true ? true : void 0;
|
|
@@ -1904,7 +1921,7 @@ function mapInvocation(generator, language, index) {
|
|
|
1904
1921
|
client.pathParameterStyle = inlinePathParameters ? "inline" : "wrapped";
|
|
1905
1922
|
}
|
|
1906
1923
|
}
|
|
1907
|
-
const docs = mapReadme(generator.readme, state, [...prefix, "readme"]);
|
|
1924
|
+
const docs = mapReadme(generator.readme, language, activeLanguages, state, [...prefix, "readme"]);
|
|
1908
1925
|
const unsupportedFields = [
|
|
1909
1926
|
...collectUnsupported(config, [...prefix, "config"], state),
|
|
1910
1927
|
...settings ? collectUnsupported(settings, [...prefix, "settings"], state) : [],
|
|
@@ -1960,7 +1977,7 @@ function resolvedFieldGuidance(field) {
|
|
|
1960
1977
|
function isDefaultAutomation(value) {
|
|
1961
1978
|
return isObject(value) && value.generate === true && value.upgrade === true && value.preview === true && value.verify === true;
|
|
1962
1979
|
}
|
|
1963
|
-
function mapCommonConfig(config, state, client, generation, packageConfig, basePath) {
|
|
1980
|
+
function mapCommonConfig(language, config, state, client, generation, packageConfig, basePath) {
|
|
1964
1981
|
const inlinePath = takeBoolean(config, ["inlinePathParameters"], state, basePath);
|
|
1965
1982
|
const inlineFile = takeBoolean(config, ["inlineFileProperties"], state, basePath);
|
|
1966
1983
|
const inlineRequest = takeBoolean(config, ["inlineRequestParams"], state, basePath);
|
|
@@ -1970,12 +1987,15 @@ function mapCommonConfig(config, state, client, generation, packageConfig, baseP
|
|
|
1970
1987
|
client.requestParameterStyle = inlineRequest ? "inline" : "wrapped";
|
|
1971
1988
|
const timeoutMs = takeTimeoutMs(config, state, basePath);
|
|
1972
1989
|
if (timeoutMs !== void 0) client.timeoutMs = timeoutMs;
|
|
1973
|
-
const
|
|
1990
|
+
const directSkipValidation = takeBoolean(
|
|
1974
1991
|
config,
|
|
1975
1992
|
["skipResponseValidation", "skipValidation"],
|
|
1976
1993
|
state,
|
|
1977
1994
|
basePath
|
|
1978
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;
|
|
1979
1999
|
if (skipValidation !== void 0) client.responseValidation = !skipValidation;
|
|
1980
2000
|
const useDefaults = takeBoolean(config, ["useDefaultRequestParameterValues"], state, basePath);
|
|
1981
2001
|
if (useDefaults !== void 0) client.useDefaultRequestParameterValues = useDefaults;
|
|
@@ -2076,16 +2096,16 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
|
2076
2096
|
}
|
|
2077
2097
|
}
|
|
2078
2098
|
function mapTypescript(config, state, packageConfig, basePath) {
|
|
2079
|
-
|
|
2080
|
-
const packageName = packageJson ? takeString(packageJson.value, ["name"], state, packageJson.path) : void 0;
|
|
2081
|
-
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2099
|
+
mapPackageManifest(config, ["packageJson"], state, packageConfig, basePath);
|
|
2082
2100
|
const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
|
|
2083
2101
|
const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
|
|
2102
|
+
const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
|
|
2084
2103
|
return compact({
|
|
2085
2104
|
typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
|
|
2086
2105
|
zodVersion: takeString(config, ["zodVersion"], state, basePath),
|
|
2087
2106
|
packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
|
|
2088
2107
|
testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
|
|
2108
|
+
httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
|
|
2089
2109
|
bundle: takeBoolean(config, ["bundle"], state, basePath),
|
|
2090
2110
|
exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
|
|
2091
2111
|
namespaceExportName: takeString(
|
|
@@ -2110,7 +2130,8 @@ function mapPython(config, state, packageConfig, basePath) {
|
|
|
2110
2130
|
pythonVersion: takeString(config, ["pythonVersion", "pyprojectPythonVersion"], state, basePath),
|
|
2111
2131
|
pydanticVersion: takeString(config, ["pydanticVersion"], state, basePath),
|
|
2112
2132
|
alwaysInitializeOptionals: takeBoolean(config, ["alwaysInitializeOptionals"], state, basePath),
|
|
2113
|
-
useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath)
|
|
2133
|
+
useTypedDictRequests: takeBoolean(config, ["useTypedDictRequests"], state, basePath),
|
|
2134
|
+
additionalInitExports: takePythonAdditionalInitExports(config, state, basePath)
|
|
2114
2135
|
});
|
|
2115
2136
|
}
|
|
2116
2137
|
function mapJvm(language, config, state, packageConfig, basePath) {
|
|
@@ -2190,6 +2211,7 @@ function mapCsharp(config, state, packageConfig, basePath) {
|
|
|
2190
2211
|
});
|
|
2191
2212
|
}
|
|
2192
2213
|
function mapPhp(config, state, packageConfig, basePath) {
|
|
2214
|
+
mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2193
2215
|
const packageName = takeString(config, ["packageName"], state, basePath);
|
|
2194
2216
|
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2195
2217
|
return compact({
|
|
@@ -2272,7 +2294,7 @@ function mapMcp(config, state, basePath) {
|
|
|
2272
2294
|
toolsets: takeToolsets(config, ["toolsets"], state, basePath)
|
|
2273
2295
|
});
|
|
2274
2296
|
}
|
|
2275
|
-
function mapReadme(value, state, basePath) {
|
|
2297
|
+
function mapReadme(value, language, activeLanguages, state, basePath) {
|
|
2276
2298
|
if (!isObject(value)) return {};
|
|
2277
2299
|
const readme = compact({
|
|
2278
2300
|
apiName: takeString(value, ["apiName"], state, basePath),
|
|
@@ -2280,7 +2302,7 @@ function mapReadme(value, state, basePath) {
|
|
|
2280
2302
|
apiReferenceLink: takeString(value, ["apiReferenceLink"], state, basePath),
|
|
2281
2303
|
bannerLink: takeString(value, ["bannerLink"], state, basePath),
|
|
2282
2304
|
disabledSections: takeStringArray(value, ["disabledSections"], state, basePath),
|
|
2283
|
-
customSections: takeCustomSections(value, state, basePath),
|
|
2305
|
+
customSections: takeCustomSections(value, language, activeLanguages, state, basePath),
|
|
2284
2306
|
defaultEndpoint: takeReadmeEndpoint(value, ["defaultEndpoint"], state, basePath),
|
|
2285
2307
|
features: takeReadmeFeatures(value, state, basePath)
|
|
2286
2308
|
});
|
|
@@ -2342,15 +2364,59 @@ function mapDependency(name, value, state, path) {
|
|
|
2342
2364
|
}
|
|
2343
2365
|
];
|
|
2344
2366
|
}
|
|
2345
|
-
function takeCustomSections(value, state, basePath) {
|
|
2367
|
+
function takeCustomSections(value, language, activeLanguages, state, basePath) {
|
|
2346
2368
|
const located = locate(value, ["customSections"], basePath);
|
|
2347
2369
|
if (!located || !Array.isArray(located.value)) return void 0;
|
|
2348
|
-
const sections = located.value.flatMap(
|
|
2349
|
-
(
|
|
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
|
+
})
|
|
2350
2406
|
);
|
|
2351
|
-
|
|
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;
|
|
2352
2418
|
consume(state, located.path);
|
|
2353
|
-
return
|
|
2419
|
+
return exports;
|
|
2354
2420
|
}
|
|
2355
2421
|
function takeReadmeEndpoint(value, aliases, state, basePath) {
|
|
2356
2422
|
const located = locate(value, aliases, basePath);
|