@postman/sdk-config 0.9.0 → 0.10.1
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 +79 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +79 -10
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +79 -10
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.js +79 -10
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +79 -10
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.js +79 -10
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -677,8 +677,19 @@ function mapOutput(generator, language, index) {
|
|
|
677
677
|
const outputPath = ["group", "generators", index, "outputMode"];
|
|
678
678
|
const state = { consumedPaths: /* @__PURE__ */ new Set(), credentialDiagnostics: [] };
|
|
679
679
|
if (generator.output) {
|
|
680
|
+
const downloadSnippets = mapDownloadSnippets(
|
|
681
|
+
generator.outputMode,
|
|
682
|
+
outputPath,
|
|
683
|
+
state,
|
|
684
|
+
language,
|
|
685
|
+
index
|
|
686
|
+
);
|
|
680
687
|
return {
|
|
681
688
|
output: sanitizeNormalizedOutput(generator.output, rawOutput, state, index),
|
|
689
|
+
...optional(
|
|
690
|
+
"docs",
|
|
691
|
+
downloadSnippets === void 0 ? void 0 : { snippets: { enabled: downloadSnippets } }
|
|
692
|
+
),
|
|
682
693
|
unsupportedFields: state.credentialDiagnostics ?? []
|
|
683
694
|
};
|
|
684
695
|
}
|
|
@@ -694,7 +705,8 @@ function mapOutput(generator, language, index) {
|
|
|
694
705
|
generator.outputMode,
|
|
695
706
|
outputPath,
|
|
696
707
|
state,
|
|
697
|
-
index
|
|
708
|
+
index,
|
|
709
|
+
language
|
|
698
710
|
);
|
|
699
711
|
}
|
|
700
712
|
if (!isObject(generator.outputMode) || typeof generator.outputMode.type !== "string") {
|
|
@@ -710,14 +722,22 @@ function mapOutput(generator, language, index) {
|
|
|
710
722
|
consume(state, [...outputPath, "type"]);
|
|
711
723
|
switch (output.type) {
|
|
712
724
|
case "downloadFiles":
|
|
713
|
-
return finishOutputMapping(
|
|
725
|
+
return finishOutputMapping(
|
|
726
|
+
{ output: { delivery: "zip" } },
|
|
727
|
+
output,
|
|
728
|
+
outputPath,
|
|
729
|
+
state,
|
|
730
|
+
index,
|
|
731
|
+
language
|
|
732
|
+
);
|
|
714
733
|
case "github":
|
|
715
734
|
return finishOutputMapping(
|
|
716
735
|
githubOutput(output, output.publishInfo, rawOutput, language, outputPath, state, index),
|
|
717
736
|
output,
|
|
718
737
|
outputPath,
|
|
719
738
|
state,
|
|
720
|
-
index
|
|
739
|
+
index,
|
|
740
|
+
language
|
|
721
741
|
);
|
|
722
742
|
case "githubV2": {
|
|
723
743
|
if (!isObject(output.githubV2))
|
|
@@ -742,7 +762,8 @@ function mapOutput(generator, language, index) {
|
|
|
742
762
|
output,
|
|
743
763
|
outputPath,
|
|
744
764
|
state,
|
|
745
|
-
index
|
|
765
|
+
index,
|
|
766
|
+
language
|
|
746
767
|
);
|
|
747
768
|
}
|
|
748
769
|
case "publishV2": {
|
|
@@ -762,7 +783,8 @@ function mapOutput(generator, language, index) {
|
|
|
762
783
|
output,
|
|
763
784
|
outputPath,
|
|
764
785
|
state,
|
|
765
|
-
index
|
|
786
|
+
index,
|
|
787
|
+
language
|
|
766
788
|
);
|
|
767
789
|
}
|
|
768
790
|
case "publish": {
|
|
@@ -782,7 +804,8 @@ function mapOutput(generator, language, index) {
|
|
|
782
804
|
output,
|
|
783
805
|
outputPath,
|
|
784
806
|
state,
|
|
785
|
-
index
|
|
807
|
+
index,
|
|
808
|
+
language
|
|
786
809
|
);
|
|
787
810
|
}
|
|
788
811
|
default:
|
|
@@ -1289,7 +1312,8 @@ function mapAuthors(value, sourcePath, state) {
|
|
|
1289
1312
|
});
|
|
1290
1313
|
return authors;
|
|
1291
1314
|
}
|
|
1292
|
-
function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
1315
|
+
function finishOutputMapping(mapping, outputMode, sourcePath, state, index, language) {
|
|
1316
|
+
const downloadSnippets = mapDownloadSnippets(outputMode, sourcePath, state, language, index);
|
|
1293
1317
|
for (const path of collectLeafPaths(outputMode, sourcePath)) {
|
|
1294
1318
|
if (path[path.length - 1] === "_visit") consume(state, path);
|
|
1295
1319
|
}
|
|
@@ -1297,6 +1321,10 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
|
1297
1321
|
const hasCredentials = unsupported.some((diagnostic) => isCredentialPath(diagnostic.path));
|
|
1298
1322
|
return {
|
|
1299
1323
|
...mapping,
|
|
1324
|
+
...optional(
|
|
1325
|
+
"docs",
|
|
1326
|
+
downloadSnippets === void 0 ? void 0 : { snippets: { enabled: downloadSnippets } }
|
|
1327
|
+
),
|
|
1300
1328
|
unsupportedFields: [
|
|
1301
1329
|
...state.credentialDiagnostics ?? [],
|
|
1302
1330
|
...hasCredentials ? [
|
|
@@ -1316,6 +1344,45 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
|
1316
1344
|
]
|
|
1317
1345
|
};
|
|
1318
1346
|
}
|
|
1347
|
+
function mapDownloadSnippets(value, sourcePath, state, language, index) {
|
|
1348
|
+
if (!isObject(value)) return void 0;
|
|
1349
|
+
const candidates = [];
|
|
1350
|
+
switch (value.type) {
|
|
1351
|
+
case "downloadFiles":
|
|
1352
|
+
case "github":
|
|
1353
|
+
candidates.push({ value, path: sourcePath });
|
|
1354
|
+
break;
|
|
1355
|
+
case "githubV2":
|
|
1356
|
+
if (isObject(value.githubV2)) {
|
|
1357
|
+
candidates.push({ value: value.githubV2, path: [...sourcePath, "githubV2"] });
|
|
1358
|
+
}
|
|
1359
|
+
break;
|
|
1360
|
+
case "publishV2":
|
|
1361
|
+
if (isObject(value.publishV2)) {
|
|
1362
|
+
candidates.push({ value: value.publishV2, path: [...sourcePath, "publishV2"] });
|
|
1363
|
+
}
|
|
1364
|
+
break;
|
|
1365
|
+
case "publish":
|
|
1366
|
+
if (isObject(value.registryOverrides)) {
|
|
1367
|
+
const registry = defaultRegistry(language, [...sourcePath, "registryOverrides"], index);
|
|
1368
|
+
const override = value.registryOverrides[registry];
|
|
1369
|
+
if (isObject(override)) {
|
|
1370
|
+
candidates.push({
|
|
1371
|
+
value: override,
|
|
1372
|
+
path: [...sourcePath, "registryOverrides", registry]
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1378
|
+
let enabled;
|
|
1379
|
+
for (const candidate of candidates) {
|
|
1380
|
+
if (typeof candidate.value.downloadSnippets !== "boolean") continue;
|
|
1381
|
+
consume(state, [...candidate.path, "downloadSnippets"]);
|
|
1382
|
+
enabled = enabled === true || candidate.value.downloadSnippets;
|
|
1383
|
+
}
|
|
1384
|
+
return enabled;
|
|
1385
|
+
}
|
|
1319
1386
|
function isCredentialPath(path) {
|
|
1320
1387
|
const fields = path.filter((part) => typeof part === "string");
|
|
1321
1388
|
const field = fields[fields.length - 1];
|
|
@@ -2251,11 +2318,12 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
2251
2318
|
generator,
|
|
2252
2319
|
language,
|
|
2253
2320
|
invocation,
|
|
2254
|
-
...outputMapping
|
|
2321
|
+
...outputMapping,
|
|
2322
|
+
docs: { ...invocation.docs, ...outputMapping.docs }
|
|
2255
2323
|
};
|
|
2256
2324
|
});
|
|
2257
2325
|
const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
|
|
2258
|
-
const docs = partitionSharedBlock(mapped.map(({
|
|
2326
|
+
const docs = partitionSharedBlock(mapped.map(({ docs: docs2 }) => docs2));
|
|
2259
2327
|
const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
|
|
2260
2328
|
const api = { ...input.api ?? {} };
|
|
2261
2329
|
delete api.audiences;
|
|
@@ -2790,7 +2858,8 @@ function mapPython(config, state, packageConfig, basePath) {
|
|
|
2790
2858
|
});
|
|
2791
2859
|
}
|
|
2792
2860
|
function mapJvm(language, config, state, packageConfig, basePath) {
|
|
2793
|
-
const
|
|
2861
|
+
const namespaceAliases = language === "java" ? ["packagePrefix"] : ["packageName", "packagePrefix"];
|
|
2862
|
+
const namespace = takeString(config, namespaceAliases, state, basePath);
|
|
2794
2863
|
const groupId = takeString(config, ["group", "groupId"], state, basePath);
|
|
2795
2864
|
const artifactId = takeString(config, ["artifact", "artifactId"], state, basePath);
|
|
2796
2865
|
if (namespace !== void 0) packageConfig.namespace = namespace;
|