@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
|
@@ -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"]) {
|
|
@@ -1806,17 +1818,22 @@ var typescriptGenerationConfigSchema = zod.z.strictObject({
|
|
|
1806
1818
|
compilerOptions: compilerOptionsSchema.optional(),
|
|
1807
1819
|
httpClient: httpClientSchema.optional(),
|
|
1808
1820
|
packageManager: zod.z.enum(["pnpm", "yarn"]).optional(),
|
|
1821
|
+
/** e.g. `1.22.22` — from the customer's own `config.packageJson.packageManager` (`yarn@1.22.22`). */
|
|
1822
|
+
packageManagerVersion: nonEmptyStringSchema.optional(),
|
|
1809
1823
|
testFramework: zod.z.enum(["jest", "vitest"]).optional(),
|
|
1810
1824
|
namingStrategy: zod.z.enum(["base", "originalPropertyNames"]).optional(),
|
|
1811
1825
|
bundle: zod.z.boolean().optional(),
|
|
1812
1826
|
exportClassDefault: zod.z.boolean().optional(),
|
|
1813
1827
|
/** Name of the top-level namespace export emitted by Fern-compatible TypeScript SDKs. */
|
|
1814
1828
|
namespaceExportName: nonEmptyStringSchema.optional(),
|
|
1829
|
+
consolidateTypeFiles: zod.z.boolean().optional(),
|
|
1815
1830
|
allowCustomFetcher: zod.z.boolean().optional(),
|
|
1816
1831
|
useBrandedStringAliases: zod.z.boolean().optional(),
|
|
1817
1832
|
useLegacyExports: zod.z.boolean().optional(),
|
|
1818
1833
|
useBigInt: zod.z.boolean().optional(),
|
|
1819
1834
|
serdeLayer: zod.z.boolean().optional(),
|
|
1835
|
+
/** Ship only the ESM build (drops CJS) to avoid the Node dual-package hazard. */
|
|
1836
|
+
esmOnly: zod.z.boolean().optional(),
|
|
1820
1837
|
scripts: zod.z.array(packageScriptSchema).optional()
|
|
1821
1838
|
});
|
|
1822
1839
|
|
|
@@ -2490,15 +2507,23 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2490
2507
|
};
|
|
2491
2508
|
}
|
|
2492
2509
|
const pythonClient = language === "python" ? takeObject(config, ["client"], state, basePath) : void 0;
|
|
2510
|
+
const typescriptNaming = language === "typescript" || language === "mcp" ? takeObject(config, ["naming"], state, basePath) : void 0;
|
|
2493
2511
|
const directClientName = takeString(config, ["clientName", "clientClassName"], state, basePath);
|
|
2494
|
-
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : void 0;
|
|
2512
|
+
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : typescriptNaming ? takeString(typescriptNaming.value, ["client"], state, typescriptNaming.path) : void 0;
|
|
2495
2513
|
const directExportedClientName = takeString(
|
|
2496
2514
|
config,
|
|
2497
2515
|
["exportedClientName", "exportedClientClassName"],
|
|
2498
2516
|
state,
|
|
2499
2517
|
basePath
|
|
2500
2518
|
);
|
|
2501
|
-
const nestedExportedClientName = pythonClient ? takeString(pythonClient.value, ["exportedClassName"], state, pythonClient.path) :
|
|
2519
|
+
const nestedExportedClientName = pythonClient ? takeString(pythonClient.value, ["exportedClassName"], state, pythonClient.path) : typescriptNaming ? (
|
|
2520
|
+
// TypeScript's `naming.namespace` is the base every other naming.* field defaults from
|
|
2521
|
+
// (Fern's docs: `client` defaults to `${PascalCase(namespace)}Client`, same for
|
|
2522
|
+
// `environment`/`error`/etc.) — the same role `exportedClientName` already plays for every
|
|
2523
|
+
// other language's `clientPrefix` derivation.
|
|
2524
|
+
takeString(typescriptNaming.value, ["namespace"], state, typescriptNaming.path)
|
|
2525
|
+
) : void 0;
|
|
2526
|
+
const nestedEnvironmentTypeName = typescriptNaming ? takeString(typescriptNaming.value, ["environment"], state, typescriptNaming.path) : void 0;
|
|
2502
2527
|
const naming = compact({
|
|
2503
2528
|
pagerName: takeString(
|
|
2504
2529
|
config,
|
|
@@ -2508,12 +2533,7 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2508
2533
|
),
|
|
2509
2534
|
clientName: directClientName ?? nestedClientName,
|
|
2510
2535
|
exportedClientName: directExportedClientName ?? nestedExportedClientName,
|
|
2511
|
-
environmentTypeName: takeString(
|
|
2512
|
-
config,
|
|
2513
|
-
["environmentClassName", "environmentEnumName"],
|
|
2514
|
-
state,
|
|
2515
|
-
basePath
|
|
2516
|
-
),
|
|
2536
|
+
environmentTypeName: takeString(config, ["environmentClassName", "environmentEnumName"], state, basePath) ?? nestedEnvironmentTypeName,
|
|
2517
2537
|
apiErrorName: takeString(config, ["baseApiExceptionClassName"], state, basePath),
|
|
2518
2538
|
baseErrorName: takeString(config, ["baseExceptionClassName"], state, basePath)
|
|
2519
2539
|
});
|
|
@@ -2527,6 +2547,10 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2527
2547
|
basePath
|
|
2528
2548
|
);
|
|
2529
2549
|
if (webSockets !== void 0) generation.webSockets = webSockets;
|
|
2550
|
+
if (language === "typescript") {
|
|
2551
|
+
const streams = mapTypescriptStreams(config, state, basePath);
|
|
2552
|
+
if (streams) generation.streams = streams;
|
|
2553
|
+
}
|
|
2530
2554
|
const generateFullProject = takeBoolean(config, ["generateFullProject"], state, basePath);
|
|
2531
2555
|
if (generateFullProject !== void 0) generation.generateFullProject = generateFullProject;
|
|
2532
2556
|
const inlineTypes = takeBoolean(config, ["enableInlineTypes"], state, basePath);
|
|
@@ -2544,6 +2568,18 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2544
2568
|
if (packagePath !== void 0) generation.layout = { packagePath };
|
|
2545
2569
|
mapDependencies(config, state, packageConfig, basePath);
|
|
2546
2570
|
}
|
|
2571
|
+
function mapTypescriptStreams(config, state, basePath) {
|
|
2572
|
+
const responseType = takeEnum(config, ["streamType"], ["wrapper", "web"], state, basePath);
|
|
2573
|
+
const fileResponseType = takeEnum(
|
|
2574
|
+
config,
|
|
2575
|
+
["fileResponseType"],
|
|
2576
|
+
["stream", "binary-response"],
|
|
2577
|
+
state,
|
|
2578
|
+
basePath
|
|
2579
|
+
);
|
|
2580
|
+
if (responseType === void 0 && fileResponseType === void 0) return void 0;
|
|
2581
|
+
return { enabled: true, ...compact({ responseType, fileResponseType }) };
|
|
2582
|
+
}
|
|
2547
2583
|
function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
2548
2584
|
switch (language) {
|
|
2549
2585
|
case "typescript":
|
|
@@ -2577,29 +2613,39 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
|
2577
2613
|
}
|
|
2578
2614
|
}
|
|
2579
2615
|
function mapTypescript(config, state, packageConfig, basePath) {
|
|
2580
|
-
|
|
2616
|
+
const packageJsonManifest = mapPackageManifest(
|
|
2617
|
+
config,
|
|
2618
|
+
["packageJson"],
|
|
2619
|
+
state,
|
|
2620
|
+
packageConfig,
|
|
2621
|
+
basePath
|
|
2622
|
+
);
|
|
2623
|
+
const packageJsonPackageManager = packageJsonManifest ? takeString(packageJsonManifest.value, ["packageManager"], state, packageJsonManifest.path) : void 0;
|
|
2624
|
+
const packageManagerAtIndex = packageJsonPackageManager ? packageJsonPackageManager.indexOf("@", packageJsonPackageManager.startsWith("@") ? 1 : 0) : -1;
|
|
2625
|
+
const packageManagerVersionPart = packageManagerAtIndex >= 0 ? packageJsonPackageManager?.slice(packageManagerAtIndex + 1).split("+")[0] : void 0;
|
|
2626
|
+
const packageManagerVersion = packageManagerVersionPart || void 0;
|
|
2581
2627
|
const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
|
|
2582
2628
|
const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
|
|
2583
2629
|
const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
|
|
2630
|
+
const namingObject = takeObject(config, ["naming"], state, basePath);
|
|
2631
|
+
const nestedNamespace = namingObject ? takeString(namingObject.value, ["namespace"], state, namingObject.path) : void 0;
|
|
2584
2632
|
return compact({
|
|
2585
2633
|
typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
|
|
2586
2634
|
zodVersion: takeString(config, ["zodVersion"], state, basePath),
|
|
2587
2635
|
packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
|
|
2636
|
+
packageManagerVersion,
|
|
2588
2637
|
testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
|
|
2589
2638
|
httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
|
|
2590
2639
|
bundle: takeBoolean(config, ["bundle"], state, basePath),
|
|
2591
2640
|
exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
|
|
2592
|
-
namespaceExportName: takeString(
|
|
2593
|
-
|
|
2594
|
-
["namespaceExportName", "namespaceExport"],
|
|
2595
|
-
state,
|
|
2596
|
-
basePath
|
|
2597
|
-
),
|
|
2641
|
+
namespaceExportName: takeString(config, ["namespaceExportName", "namespaceExport"], state, basePath) ?? nestedNamespace,
|
|
2642
|
+
consolidateTypeFiles: takeBoolean(config, ["consolidateTypeFiles"], state, basePath),
|
|
2598
2643
|
allowCustomFetcher: takeBoolean(config, ["allowCustomFetcher"], state, basePath),
|
|
2599
2644
|
useBrandedStringAliases: takeBoolean(config, ["useBrandedStringAliases"], state, basePath),
|
|
2600
2645
|
useLegacyExports: takeBoolean(config, ["useLegacyExports"], state, basePath),
|
|
2601
2646
|
useBigInt: takeBoolean(config, ["useBigInt"], state, basePath),
|
|
2602
|
-
serdeLayer: serdeLayer ?? (noSerdeLayer === void 0 ? void 0 : !noSerdeLayer)
|
|
2647
|
+
serdeLayer: serdeLayer ?? (noSerdeLayer === void 0 ? void 0 : !noSerdeLayer),
|
|
2648
|
+
esmOnly: takeBoolean(config, ["esmOnly"], state, basePath)
|
|
2603
2649
|
});
|
|
2604
2650
|
}
|
|
2605
2651
|
function mapPython(config, state, packageConfig, basePath) {
|
|
@@ -2710,7 +2756,8 @@ function mapCsharp(config, state, packageConfig, basePath) {
|
|
|
2710
2756
|
});
|
|
2711
2757
|
}
|
|
2712
2758
|
function mapPhp(config, state, packageConfig, basePath) {
|
|
2713
|
-
mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2759
|
+
const manifest = mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2760
|
+
if (manifest) mapComposerRequirements(manifest, state, packageConfig);
|
|
2714
2761
|
const packageName = takeString(config, ["packageName"], state, basePath);
|
|
2715
2762
|
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2716
2763
|
return compact({
|
|
@@ -2718,6 +2765,20 @@ function mapPhp(config, state, packageConfig, basePath) {
|
|
|
2718
2765
|
generateClientInterfaces: takeBoolean(config, ["generateClientInterfaces"], state, basePath)
|
|
2719
2766
|
});
|
|
2720
2767
|
}
|
|
2768
|
+
function mapComposerRequirements(manifest, state, packageConfig) {
|
|
2769
|
+
const fields = [
|
|
2770
|
+
["require", "extraDependencies"],
|
|
2771
|
+
["require-dev", "extraDevDependencies"]
|
|
2772
|
+
];
|
|
2773
|
+
for (const [composerField, packageField] of fields) {
|
|
2774
|
+
const located = takeObject(manifest.value, [composerField], state, manifest.path);
|
|
2775
|
+
if (!located) continue;
|
|
2776
|
+
const dependencies = Object.entries(located.value).flatMap(
|
|
2777
|
+
([name, dependency]) => mapDependency(name, dependency, state, [...located.path, name])
|
|
2778
|
+
);
|
|
2779
|
+
if (dependencies.length) packageConfig[packageField] = dependencies;
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2721
2782
|
function mapRuby(config, state, packageConfig, basePath) {
|
|
2722
2783
|
const moduleName = takeString(config, ["moduleName"], state, basePath);
|
|
2723
2784
|
if (moduleName !== void 0) packageConfig.moduleName = moduleName;
|
|
@@ -2887,28 +2948,52 @@ function takeCustomSections(value, language, activeLanguages, state, basePath) {
|
|
|
2887
2948
|
}
|
|
2888
2949
|
function mapPackageManifest(config, aliases, state, packageConfig, basePath) {
|
|
2889
2950
|
const manifest = takeObject(config, aliases, state, basePath);
|
|
2890
|
-
if (!manifest) return;
|
|
2951
|
+
if (!manifest) return void 0;
|
|
2891
2952
|
const packageName = takeString(manifest.value, ["name"], state, manifest.path);
|
|
2892
2953
|
const description = takeString(manifest.value, ["description"], state, manifest.path);
|
|
2954
|
+
const keywords = takeStringArray(manifest.value, ["keywords"], state, manifest.path);
|
|
2893
2955
|
const license = takeString(manifest.value, ["license"], state, manifest.path);
|
|
2894
2956
|
const author = takeObject(manifest.value, ["author"], state, manifest.path);
|
|
2895
2957
|
const authorName = author ? takeString(author.value, ["name"], state, author.path) : void 0;
|
|
2896
|
-
const authors =
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2958
|
+
const authors = [
|
|
2959
|
+
...authorName && author ? [
|
|
2960
|
+
compact({
|
|
2961
|
+
name: authorName,
|
|
2962
|
+
email: takeString(author.value, ["email"], state, author.path),
|
|
2963
|
+
url: takeString(author.value, ["url"], state, author.path)
|
|
2964
|
+
})
|
|
2965
|
+
] : [],
|
|
2966
|
+
...takeManifestAuthors(manifest, state)
|
|
2967
|
+
];
|
|
2903
2968
|
Object.assign(
|
|
2904
2969
|
packageConfig,
|
|
2905
2970
|
compact({
|
|
2906
2971
|
packageName,
|
|
2907
2972
|
description,
|
|
2908
|
-
|
|
2973
|
+
homepage: takeString(manifest.value, ["homepage"], state, manifest.path),
|
|
2974
|
+
keywords,
|
|
2975
|
+
authors: authors.length ? authors : void 0,
|
|
2909
2976
|
license: license ? { type: license } : void 0
|
|
2910
2977
|
})
|
|
2911
2978
|
);
|
|
2979
|
+
return manifest;
|
|
2980
|
+
}
|
|
2981
|
+
function takeManifestAuthors(manifest, state) {
|
|
2982
|
+
const located = locate(manifest.value, ["authors"], manifest.path);
|
|
2983
|
+
if (!located || !Array.isArray(located.value)) return [];
|
|
2984
|
+
return located.value.flatMap((entry, index) => {
|
|
2985
|
+
if (!isObject(entry)) return [];
|
|
2986
|
+
const path = [...located.path, index];
|
|
2987
|
+
const name = takeString(entry, ["name"], state, path);
|
|
2988
|
+
if (!name) return [];
|
|
2989
|
+
return [
|
|
2990
|
+
compact({
|
|
2991
|
+
name,
|
|
2992
|
+
email: takeString(entry, ["email"], state, path),
|
|
2993
|
+
url: takeString(entry, ["url"], state, path)
|
|
2994
|
+
})
|
|
2995
|
+
];
|
|
2996
|
+
});
|
|
2912
2997
|
}
|
|
2913
2998
|
function takePythonAdditionalInitExports(config, state, basePath) {
|
|
2914
2999
|
const located = locate(config, ["additionalInitExports"], basePath);
|