@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/sdk-config/index.js
CHANGED
|
@@ -671,8 +671,19 @@ function mapOutput(generator, language, index) {
|
|
|
671
671
|
const outputPath = ["group", "generators", index, "outputMode"];
|
|
672
672
|
const state = { consumedPaths: /* @__PURE__ */ new Set(), credentialDiagnostics: [] };
|
|
673
673
|
if (generator.output) {
|
|
674
|
+
const downloadSnippets = mapDownloadSnippets(
|
|
675
|
+
generator.outputMode,
|
|
676
|
+
outputPath,
|
|
677
|
+
state,
|
|
678
|
+
language,
|
|
679
|
+
index
|
|
680
|
+
);
|
|
674
681
|
return {
|
|
675
682
|
output: sanitizeNormalizedOutput(generator.output, rawOutput, state, index),
|
|
683
|
+
...optional(
|
|
684
|
+
"docs",
|
|
685
|
+
downloadSnippets === void 0 ? void 0 : { snippets: { enabled: downloadSnippets } }
|
|
686
|
+
),
|
|
676
687
|
unsupportedFields: state.credentialDiagnostics ?? []
|
|
677
688
|
};
|
|
678
689
|
}
|
|
@@ -688,7 +699,8 @@ function mapOutput(generator, language, index) {
|
|
|
688
699
|
generator.outputMode,
|
|
689
700
|
outputPath,
|
|
690
701
|
state,
|
|
691
|
-
index
|
|
702
|
+
index,
|
|
703
|
+
language
|
|
692
704
|
);
|
|
693
705
|
}
|
|
694
706
|
if (!isObject(generator.outputMode) || typeof generator.outputMode.type !== "string") {
|
|
@@ -704,14 +716,22 @@ function mapOutput(generator, language, index) {
|
|
|
704
716
|
consume(state, [...outputPath, "type"]);
|
|
705
717
|
switch (output.type) {
|
|
706
718
|
case "downloadFiles":
|
|
707
|
-
return finishOutputMapping(
|
|
719
|
+
return finishOutputMapping(
|
|
720
|
+
{ output: { delivery: "zip" } },
|
|
721
|
+
output,
|
|
722
|
+
outputPath,
|
|
723
|
+
state,
|
|
724
|
+
index,
|
|
725
|
+
language
|
|
726
|
+
);
|
|
708
727
|
case "github":
|
|
709
728
|
return finishOutputMapping(
|
|
710
729
|
githubOutput(output, output.publishInfo, rawOutput, language, outputPath, state, index),
|
|
711
730
|
output,
|
|
712
731
|
outputPath,
|
|
713
732
|
state,
|
|
714
|
-
index
|
|
733
|
+
index,
|
|
734
|
+
language
|
|
715
735
|
);
|
|
716
736
|
case "githubV2": {
|
|
717
737
|
if (!isObject(output.githubV2))
|
|
@@ -736,7 +756,8 @@ function mapOutput(generator, language, index) {
|
|
|
736
756
|
output,
|
|
737
757
|
outputPath,
|
|
738
758
|
state,
|
|
739
|
-
index
|
|
759
|
+
index,
|
|
760
|
+
language
|
|
740
761
|
);
|
|
741
762
|
}
|
|
742
763
|
case "publishV2": {
|
|
@@ -756,7 +777,8 @@ function mapOutput(generator, language, index) {
|
|
|
756
777
|
output,
|
|
757
778
|
outputPath,
|
|
758
779
|
state,
|
|
759
|
-
index
|
|
780
|
+
index,
|
|
781
|
+
language
|
|
760
782
|
);
|
|
761
783
|
}
|
|
762
784
|
case "publish": {
|
|
@@ -776,7 +798,8 @@ function mapOutput(generator, language, index) {
|
|
|
776
798
|
output,
|
|
777
799
|
outputPath,
|
|
778
800
|
state,
|
|
779
|
-
index
|
|
801
|
+
index,
|
|
802
|
+
language
|
|
780
803
|
);
|
|
781
804
|
}
|
|
782
805
|
default:
|
|
@@ -1283,7 +1306,8 @@ function mapAuthors(value, sourcePath, state) {
|
|
|
1283
1306
|
});
|
|
1284
1307
|
return authors;
|
|
1285
1308
|
}
|
|
1286
|
-
function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
1309
|
+
function finishOutputMapping(mapping, outputMode, sourcePath, state, index, language) {
|
|
1310
|
+
const downloadSnippets = mapDownloadSnippets(outputMode, sourcePath, state, language, index);
|
|
1287
1311
|
for (const path of collectLeafPaths(outputMode, sourcePath)) {
|
|
1288
1312
|
if (path[path.length - 1] === "_visit") consume(state, path);
|
|
1289
1313
|
}
|
|
@@ -1291,6 +1315,10 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
|
1291
1315
|
const hasCredentials = unsupported.some((diagnostic) => isCredentialPath(diagnostic.path));
|
|
1292
1316
|
return {
|
|
1293
1317
|
...mapping,
|
|
1318
|
+
...optional(
|
|
1319
|
+
"docs",
|
|
1320
|
+
downloadSnippets === void 0 ? void 0 : { snippets: { enabled: downloadSnippets } }
|
|
1321
|
+
),
|
|
1294
1322
|
unsupportedFields: [
|
|
1295
1323
|
...state.credentialDiagnostics ?? [],
|
|
1296
1324
|
...hasCredentials ? [
|
|
@@ -1310,6 +1338,45 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
|
1310
1338
|
]
|
|
1311
1339
|
};
|
|
1312
1340
|
}
|
|
1341
|
+
function mapDownloadSnippets(value, sourcePath, state, language, index) {
|
|
1342
|
+
if (!isObject(value)) return void 0;
|
|
1343
|
+
const candidates = [];
|
|
1344
|
+
switch (value.type) {
|
|
1345
|
+
case "downloadFiles":
|
|
1346
|
+
case "github":
|
|
1347
|
+
candidates.push({ value, path: sourcePath });
|
|
1348
|
+
break;
|
|
1349
|
+
case "githubV2":
|
|
1350
|
+
if (isObject(value.githubV2)) {
|
|
1351
|
+
candidates.push({ value: value.githubV2, path: [...sourcePath, "githubV2"] });
|
|
1352
|
+
}
|
|
1353
|
+
break;
|
|
1354
|
+
case "publishV2":
|
|
1355
|
+
if (isObject(value.publishV2)) {
|
|
1356
|
+
candidates.push({ value: value.publishV2, path: [...sourcePath, "publishV2"] });
|
|
1357
|
+
}
|
|
1358
|
+
break;
|
|
1359
|
+
case "publish":
|
|
1360
|
+
if (isObject(value.registryOverrides)) {
|
|
1361
|
+
const registry = defaultRegistry(language, [...sourcePath, "registryOverrides"], index);
|
|
1362
|
+
const override = value.registryOverrides[registry];
|
|
1363
|
+
if (isObject(override)) {
|
|
1364
|
+
candidates.push({
|
|
1365
|
+
value: override,
|
|
1366
|
+
path: [...sourcePath, "registryOverrides", registry]
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
let enabled;
|
|
1373
|
+
for (const candidate of candidates) {
|
|
1374
|
+
if (typeof candidate.value.downloadSnippets !== "boolean") continue;
|
|
1375
|
+
consume(state, [...candidate.path, "downloadSnippets"]);
|
|
1376
|
+
enabled = enabled === true || candidate.value.downloadSnippets;
|
|
1377
|
+
}
|
|
1378
|
+
return enabled;
|
|
1379
|
+
}
|
|
1313
1380
|
function isCredentialPath(path) {
|
|
1314
1381
|
const fields = path.filter((part) => typeof part === "string");
|
|
1315
1382
|
const field = fields[fields.length - 1];
|
|
@@ -2233,11 +2300,12 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
2233
2300
|
generator,
|
|
2234
2301
|
language,
|
|
2235
2302
|
invocation,
|
|
2236
|
-
...outputMapping
|
|
2303
|
+
...outputMapping,
|
|
2304
|
+
docs: { ...invocation.docs, ...outputMapping.docs }
|
|
2237
2305
|
};
|
|
2238
2306
|
});
|
|
2239
2307
|
const clients = partitionSharedBlock(mapped.map(({ invocation }) => invocation.client));
|
|
2240
|
-
const docs = partitionSharedBlock(mapped.map(({
|
|
2308
|
+
const docs = partitionSharedBlock(mapped.map(({ docs: docs2 }) => docs2));
|
|
2241
2309
|
const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
|
|
2242
2310
|
const api = { ...input.api ?? {} };
|
|
2243
2311
|
delete api.audiences;
|
|
@@ -2772,7 +2840,8 @@ function mapPython(config, state, packageConfig, basePath) {
|
|
|
2772
2840
|
});
|
|
2773
2841
|
}
|
|
2774
2842
|
function mapJvm(language, config, state, packageConfig, basePath) {
|
|
2775
|
-
const
|
|
2843
|
+
const namespaceAliases = language === "java" ? ["packagePrefix"] : ["packageName", "packagePrefix"];
|
|
2844
|
+
const namespace = takeString(config, namespaceAliases, state, basePath);
|
|
2776
2845
|
const groupId = takeString(config, ["group", "groupId"], state, basePath);
|
|
2777
2846
|
const artifactId = takeString(config, ["artifact", "artifactId"], state, basePath);
|
|
2778
2847
|
if (namespace !== void 0) packageConfig.namespace = namespace;
|