@postman/sdk-config 0.6.0 → 0.7.0
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 +112 -27
- 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 +112 -27
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +112 -27
- 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 +112 -27
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +112 -27
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +13 -1
- package/dist/sdk-config/v1/index.d.ts +13 -1
- package/dist/sdk-config/v1/index.js +112 -27
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +5 -0
- 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 +5 -0
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +5 -0
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +20 -2
- package/dist/sdk-config-ir/v1/index.d.ts +20 -2
- package/dist/sdk-config-ir/v1/index.js +5 -0
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-BruxA5zG.d.cts → typescript-BdDv_kwT.d.cts} +8 -0
- package/dist/{typescript-BruxA5zG.d.ts → typescript-BdDv_kwT.d.ts} +8 -0
- package/package.json +1 -1
- package/src/sdk-config-ir/v1/README.md +4 -2
package/dist/index.cjs
CHANGED
|
@@ -790,6 +790,7 @@ function githubOutput(value, publishInfo, rawOutput, language, sourcePath, state
|
|
|
790
790
|
consume(state, [...sourcePath, "repo"]);
|
|
791
791
|
const publication = publishInfo ? mapPublication(publishInfo, rawOutput, language, [...sourcePath, "publishInfo"], state, index) : void 0;
|
|
792
792
|
const type = stringValue(value.type);
|
|
793
|
+
const licensePackage = mapGithubLicense(value.license, [...sourcePath, "license"], state);
|
|
793
794
|
const reviewers = mapReviewers(value.reviewers, [...sourcePath, "reviewers"], state);
|
|
794
795
|
if (type) consume(state, [...sourcePath, "type"]);
|
|
795
796
|
if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
|
|
@@ -816,9 +817,20 @@ function githubOutput(value, publishInfo, rawOutput, language, sourcePath, state
|
|
|
816
817
|
},
|
|
817
818
|
...publication ? { publish: publication.publish } : {}
|
|
818
819
|
},
|
|
819
|
-
|
|
820
|
+
// The GitHub license wins over a publication-supplied one; `licensePackage` is `{}` or `{ license }`.
|
|
821
|
+
...optionalObject("package", { ...publication?.package, ...licensePackage })
|
|
820
822
|
};
|
|
821
823
|
}
|
|
824
|
+
var basicLicenseTypes = { mit: "MIT", apache: "APACHE" };
|
|
825
|
+
function mapGithubLicense(value, sourcePath, state) {
|
|
826
|
+
if (!isObject(value) || stringValue(value.type) !== "basic") return {};
|
|
827
|
+
const id = stringValue(value.id);
|
|
828
|
+
const type = id ? basicLicenseTypes[id.toLowerCase()] : void 0;
|
|
829
|
+
if (!type) return {};
|
|
830
|
+
consume(state, [...sourcePath, "type"]);
|
|
831
|
+
consume(state, [...sourcePath, "id"]);
|
|
832
|
+
return { license: { type } };
|
|
833
|
+
}
|
|
822
834
|
function consumeCredentialObject(value, sourcePath, state) {
|
|
823
835
|
if (!isObject(value)) return;
|
|
824
836
|
for (const field of ["username", "password", "token", "apiKey"]) {
|
|
@@ -1818,17 +1830,22 @@ var typescriptGenerationConfigSchema = zod.z.strictObject({
|
|
|
1818
1830
|
compilerOptions: compilerOptionsSchema.optional(),
|
|
1819
1831
|
httpClient: httpClientSchema.optional(),
|
|
1820
1832
|
packageManager: zod.z.enum(["pnpm", "yarn"]).optional(),
|
|
1833
|
+
/** e.g. `1.22.22` — from the customer's own `config.packageJson.packageManager` (`yarn@1.22.22`). */
|
|
1834
|
+
packageManagerVersion: nonEmptyStringSchema.optional(),
|
|
1821
1835
|
testFramework: zod.z.enum(["jest", "vitest"]).optional(),
|
|
1822
1836
|
namingStrategy: zod.z.enum(["base", "originalPropertyNames"]).optional(),
|
|
1823
1837
|
bundle: zod.z.boolean().optional(),
|
|
1824
1838
|
exportClassDefault: zod.z.boolean().optional(),
|
|
1825
1839
|
/** Name of the top-level namespace export emitted by Fern-compatible TypeScript SDKs. */
|
|
1826
1840
|
namespaceExportName: nonEmptyStringSchema.optional(),
|
|
1841
|
+
consolidateTypeFiles: zod.z.boolean().optional(),
|
|
1827
1842
|
allowCustomFetcher: zod.z.boolean().optional(),
|
|
1828
1843
|
useBrandedStringAliases: zod.z.boolean().optional(),
|
|
1829
1844
|
useLegacyExports: zod.z.boolean().optional(),
|
|
1830
1845
|
useBigInt: zod.z.boolean().optional(),
|
|
1831
1846
|
serdeLayer: zod.z.boolean().optional(),
|
|
1847
|
+
/** Ship only the ESM build (drops CJS) to avoid the Node dual-package hazard. */
|
|
1848
|
+
esmOnly: zod.z.boolean().optional(),
|
|
1832
1849
|
scripts: zod.z.array(packageScriptSchema).optional()
|
|
1833
1850
|
});
|
|
1834
1851
|
|
|
@@ -2502,15 +2519,23 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2502
2519
|
};
|
|
2503
2520
|
}
|
|
2504
2521
|
const pythonClient = language === "python" ? takeObject(config, ["client"], state, basePath) : void 0;
|
|
2522
|
+
const typescriptNaming = language === "typescript" || language === "mcp" ? takeObject(config, ["naming"], state, basePath) : void 0;
|
|
2505
2523
|
const directClientName = takeString(config, ["clientName", "clientClassName"], state, basePath);
|
|
2506
|
-
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : void 0;
|
|
2524
|
+
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : typescriptNaming ? takeString(typescriptNaming.value, ["client"], state, typescriptNaming.path) : void 0;
|
|
2507
2525
|
const directExportedClientName = takeString(
|
|
2508
2526
|
config,
|
|
2509
2527
|
["exportedClientName", "exportedClientClassName"],
|
|
2510
2528
|
state,
|
|
2511
2529
|
basePath
|
|
2512
2530
|
);
|
|
2513
|
-
const nestedExportedClientName = pythonClient ? takeString(pythonClient.value, ["exportedClassName"], state, pythonClient.path) :
|
|
2531
|
+
const nestedExportedClientName = pythonClient ? takeString(pythonClient.value, ["exportedClassName"], state, pythonClient.path) : typescriptNaming ? (
|
|
2532
|
+
// TypeScript's `naming.namespace` is the base every other naming.* field defaults from
|
|
2533
|
+
// (Fern's docs: `client` defaults to `${PascalCase(namespace)}Client`, same for
|
|
2534
|
+
// `environment`/`error`/etc.) — the same role `exportedClientName` already plays for every
|
|
2535
|
+
// other language's `clientPrefix` derivation.
|
|
2536
|
+
takeString(typescriptNaming.value, ["namespace"], state, typescriptNaming.path)
|
|
2537
|
+
) : void 0;
|
|
2538
|
+
const nestedEnvironmentTypeName = typescriptNaming ? takeString(typescriptNaming.value, ["environment"], state, typescriptNaming.path) : void 0;
|
|
2514
2539
|
const naming = compact({
|
|
2515
2540
|
pagerName: takeString(
|
|
2516
2541
|
config,
|
|
@@ -2520,12 +2545,7 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2520
2545
|
),
|
|
2521
2546
|
clientName: directClientName ?? nestedClientName,
|
|
2522
2547
|
exportedClientName: directExportedClientName ?? nestedExportedClientName,
|
|
2523
|
-
environmentTypeName: takeString(
|
|
2524
|
-
config,
|
|
2525
|
-
["environmentClassName", "environmentEnumName"],
|
|
2526
|
-
state,
|
|
2527
|
-
basePath
|
|
2528
|
-
),
|
|
2548
|
+
environmentTypeName: takeString(config, ["environmentClassName", "environmentEnumName"], state, basePath) ?? nestedEnvironmentTypeName,
|
|
2529
2549
|
apiErrorName: takeString(config, ["baseApiExceptionClassName"], state, basePath),
|
|
2530
2550
|
baseErrorName: takeString(config, ["baseExceptionClassName"], state, basePath)
|
|
2531
2551
|
});
|
|
@@ -2539,6 +2559,10 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2539
2559
|
basePath
|
|
2540
2560
|
);
|
|
2541
2561
|
if (webSockets !== void 0) generation.webSockets = webSockets;
|
|
2562
|
+
if (language === "typescript") {
|
|
2563
|
+
const streams = mapTypescriptStreams(config, state, basePath);
|
|
2564
|
+
if (streams) generation.streams = streams;
|
|
2565
|
+
}
|
|
2542
2566
|
const generateFullProject = takeBoolean(config, ["generateFullProject"], state, basePath);
|
|
2543
2567
|
if (generateFullProject !== void 0) generation.generateFullProject = generateFullProject;
|
|
2544
2568
|
const inlineTypes = takeBoolean(config, ["enableInlineTypes"], state, basePath);
|
|
@@ -2556,6 +2580,18 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2556
2580
|
if (packagePath !== void 0) generation.layout = { packagePath };
|
|
2557
2581
|
mapDependencies(config, state, packageConfig, basePath);
|
|
2558
2582
|
}
|
|
2583
|
+
function mapTypescriptStreams(config, state, basePath) {
|
|
2584
|
+
const responseType = takeEnum(config, ["streamType"], ["wrapper", "web"], state, basePath);
|
|
2585
|
+
const fileResponseType = takeEnum(
|
|
2586
|
+
config,
|
|
2587
|
+
["fileResponseType"],
|
|
2588
|
+
["stream", "binary-response"],
|
|
2589
|
+
state,
|
|
2590
|
+
basePath
|
|
2591
|
+
);
|
|
2592
|
+
if (responseType === void 0 && fileResponseType === void 0) return void 0;
|
|
2593
|
+
return { enabled: true, ...compact({ responseType, fileResponseType }) };
|
|
2594
|
+
}
|
|
2559
2595
|
function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
2560
2596
|
switch (language) {
|
|
2561
2597
|
case "typescript":
|
|
@@ -2589,29 +2625,39 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
|
2589
2625
|
}
|
|
2590
2626
|
}
|
|
2591
2627
|
function mapTypescript(config, state, packageConfig, basePath) {
|
|
2592
|
-
|
|
2628
|
+
const packageJsonManifest = mapPackageManifest(
|
|
2629
|
+
config,
|
|
2630
|
+
["packageJson"],
|
|
2631
|
+
state,
|
|
2632
|
+
packageConfig,
|
|
2633
|
+
basePath
|
|
2634
|
+
);
|
|
2635
|
+
const packageJsonPackageManager = packageJsonManifest ? takeString(packageJsonManifest.value, ["packageManager"], state, packageJsonManifest.path) : void 0;
|
|
2636
|
+
const packageManagerAtIndex = packageJsonPackageManager ? packageJsonPackageManager.indexOf("@", packageJsonPackageManager.startsWith("@") ? 1 : 0) : -1;
|
|
2637
|
+
const packageManagerVersionPart = packageManagerAtIndex >= 0 ? packageJsonPackageManager?.slice(packageManagerAtIndex + 1).split("+")[0] : void 0;
|
|
2638
|
+
const packageManagerVersion = packageManagerVersionPart || void 0;
|
|
2593
2639
|
const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
|
|
2594
2640
|
const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
|
|
2595
2641
|
const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
|
|
2642
|
+
const namingObject = takeObject(config, ["naming"], state, basePath);
|
|
2643
|
+
const nestedNamespace = namingObject ? takeString(namingObject.value, ["namespace"], state, namingObject.path) : void 0;
|
|
2596
2644
|
return compact({
|
|
2597
2645
|
typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
|
|
2598
2646
|
zodVersion: takeString(config, ["zodVersion"], state, basePath),
|
|
2599
2647
|
packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
|
|
2648
|
+
packageManagerVersion,
|
|
2600
2649
|
testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
|
|
2601
2650
|
httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
|
|
2602
2651
|
bundle: takeBoolean(config, ["bundle"], state, basePath),
|
|
2603
2652
|
exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
|
|
2604
|
-
namespaceExportName: takeString(
|
|
2605
|
-
|
|
2606
|
-
["namespaceExportName", "namespaceExport"],
|
|
2607
|
-
state,
|
|
2608
|
-
basePath
|
|
2609
|
-
),
|
|
2653
|
+
namespaceExportName: takeString(config, ["namespaceExportName", "namespaceExport"], state, basePath) ?? nestedNamespace,
|
|
2654
|
+
consolidateTypeFiles: takeBoolean(config, ["consolidateTypeFiles"], state, basePath),
|
|
2610
2655
|
allowCustomFetcher: takeBoolean(config, ["allowCustomFetcher"], state, basePath),
|
|
2611
2656
|
useBrandedStringAliases: takeBoolean(config, ["useBrandedStringAliases"], state, basePath),
|
|
2612
2657
|
useLegacyExports: takeBoolean(config, ["useLegacyExports"], state, basePath),
|
|
2613
2658
|
useBigInt: takeBoolean(config, ["useBigInt"], state, basePath),
|
|
2614
|
-
serdeLayer: serdeLayer ?? (noSerdeLayer === void 0 ? void 0 : !noSerdeLayer)
|
|
2659
|
+
serdeLayer: serdeLayer ?? (noSerdeLayer === void 0 ? void 0 : !noSerdeLayer),
|
|
2660
|
+
esmOnly: takeBoolean(config, ["esmOnly"], state, basePath)
|
|
2615
2661
|
});
|
|
2616
2662
|
}
|
|
2617
2663
|
function mapPython(config, state, packageConfig, basePath) {
|
|
@@ -2722,7 +2768,8 @@ function mapCsharp(config, state, packageConfig, basePath) {
|
|
|
2722
2768
|
});
|
|
2723
2769
|
}
|
|
2724
2770
|
function mapPhp(config, state, packageConfig, basePath) {
|
|
2725
|
-
mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2771
|
+
const manifest = mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2772
|
+
if (manifest) mapComposerRequirements(manifest, state, packageConfig);
|
|
2726
2773
|
const packageName = takeString(config, ["packageName"], state, basePath);
|
|
2727
2774
|
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2728
2775
|
return compact({
|
|
@@ -2730,6 +2777,20 @@ function mapPhp(config, state, packageConfig, basePath) {
|
|
|
2730
2777
|
generateClientInterfaces: takeBoolean(config, ["generateClientInterfaces"], state, basePath)
|
|
2731
2778
|
});
|
|
2732
2779
|
}
|
|
2780
|
+
function mapComposerRequirements(manifest, state, packageConfig) {
|
|
2781
|
+
const fields = [
|
|
2782
|
+
["require", "extraDependencies"],
|
|
2783
|
+
["require-dev", "extraDevDependencies"]
|
|
2784
|
+
];
|
|
2785
|
+
for (const [composerField, packageField] of fields) {
|
|
2786
|
+
const located = takeObject(manifest.value, [composerField], state, manifest.path);
|
|
2787
|
+
if (!located) continue;
|
|
2788
|
+
const dependencies = Object.entries(located.value).flatMap(
|
|
2789
|
+
([name, dependency]) => mapDependency(name, dependency, state, [...located.path, name])
|
|
2790
|
+
);
|
|
2791
|
+
if (dependencies.length) packageConfig[packageField] = dependencies;
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2733
2794
|
function mapRuby(config, state, packageConfig, basePath) {
|
|
2734
2795
|
const moduleName = takeString(config, ["moduleName"], state, basePath);
|
|
2735
2796
|
if (moduleName !== void 0) packageConfig.moduleName = moduleName;
|
|
@@ -2899,28 +2960,52 @@ function takeCustomSections(value, language, activeLanguages, state, basePath) {
|
|
|
2899
2960
|
}
|
|
2900
2961
|
function mapPackageManifest(config, aliases, state, packageConfig, basePath) {
|
|
2901
2962
|
const manifest = takeObject(config, aliases, state, basePath);
|
|
2902
|
-
if (!manifest) return;
|
|
2963
|
+
if (!manifest) return void 0;
|
|
2903
2964
|
const packageName = takeString(manifest.value, ["name"], state, manifest.path);
|
|
2904
2965
|
const description = takeString(manifest.value, ["description"], state, manifest.path);
|
|
2966
|
+
const keywords = takeStringArray(manifest.value, ["keywords"], state, manifest.path);
|
|
2905
2967
|
const license = takeString(manifest.value, ["license"], state, manifest.path);
|
|
2906
2968
|
const author = takeObject(manifest.value, ["author"], state, manifest.path);
|
|
2907
2969
|
const authorName = author ? takeString(author.value, ["name"], state, author.path) : void 0;
|
|
2908
|
-
const authors =
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2970
|
+
const authors = [
|
|
2971
|
+
...authorName && author ? [
|
|
2972
|
+
compact({
|
|
2973
|
+
name: authorName,
|
|
2974
|
+
email: takeString(author.value, ["email"], state, author.path),
|
|
2975
|
+
url: takeString(author.value, ["url"], state, author.path)
|
|
2976
|
+
})
|
|
2977
|
+
] : [],
|
|
2978
|
+
...takeManifestAuthors(manifest, state)
|
|
2979
|
+
];
|
|
2915
2980
|
Object.assign(
|
|
2916
2981
|
packageConfig,
|
|
2917
2982
|
compact({
|
|
2918
2983
|
packageName,
|
|
2919
2984
|
description,
|
|
2920
|
-
|
|
2985
|
+
homepage: takeString(manifest.value, ["homepage"], state, manifest.path),
|
|
2986
|
+
keywords,
|
|
2987
|
+
authors: authors.length ? authors : void 0,
|
|
2921
2988
|
license: license ? { type: license } : void 0
|
|
2922
2989
|
})
|
|
2923
2990
|
);
|
|
2991
|
+
return manifest;
|
|
2992
|
+
}
|
|
2993
|
+
function takeManifestAuthors(manifest, state) {
|
|
2994
|
+
const located = locate(manifest.value, ["authors"], manifest.path);
|
|
2995
|
+
if (!located || !Array.isArray(located.value)) return [];
|
|
2996
|
+
return located.value.flatMap((entry, index) => {
|
|
2997
|
+
if (!isObject(entry)) return [];
|
|
2998
|
+
const path = [...located.path, index];
|
|
2999
|
+
const name = takeString(entry, ["name"], state, path);
|
|
3000
|
+
if (!name) return [];
|
|
3001
|
+
return [
|
|
3002
|
+
compact({
|
|
3003
|
+
name,
|
|
3004
|
+
email: takeString(entry, ["email"], state, path),
|
|
3005
|
+
url: takeString(entry, ["url"], state, path)
|
|
3006
|
+
})
|
|
3007
|
+
];
|
|
3008
|
+
});
|
|
2924
3009
|
}
|
|
2925
3010
|
function takePythonAdditionalInitExports(config, state, basePath) {
|
|
2926
3011
|
const located = locate(config, ["additionalInitExports"], basePath);
|