@postman/sdk-config 0.12.0 → 0.14.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/README.md +18 -6
- package/dist/index.cjs +170 -18
- 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 +170 -18
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +164 -17
- 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 +164 -17
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +164 -17
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +429 -31
- package/dist/sdk-config/v1/index.d.ts +429 -31
- package/dist/sdk-config/v1/index.js +164 -17
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +22 -5
- 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 +22 -5
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +22 -5
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +30 -4
- package/dist/sdk-config-ir/v1/index.d.ts +30 -4
- package/dist/sdk-config-ir/v1/index.js +22 -5
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-Byhn4MqL.d.cts → typescript-BFRxjAah.d.cts} +1 -0
- package/dist/{typescript-Byhn4MqL.d.ts → typescript-BFRxjAah.d.ts} +1 -0
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +35 -12
- package/src/sdk-config-ir/v1/README.md +36 -29
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { FernConfigMappingDiagnostic, FernConfigMappingError, FernConfigMappingResult, FernResolvedGeneratorGroupInput, FernResolvedGeneratorInput, FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, SdkConfigV1, SdkConfigV1ApiConfig, SdkConfigV1ApiConfigInput, SdkConfigV1CliOutputConfig, SdkConfigV1ClientConfig, SdkConfigV1ClientConfigInput, SdkConfigV1ClientConfigOverride, SdkConfigV1Dependency, SdkConfigV1DocsConfig, SdkConfigV1Document, SdkConfigV1GenerationConfig, SdkConfigV1GenerationConfigInput, SdkConfigV1GenerationConfigOverride, SdkConfigV1Input, SdkConfigV1OutputConfig, SdkConfigV1PackageConfig, SdkConfigV1PublishConfig, SdkConfigV1PublishRegistry, SdkConfigV1ReplayConfig, SdkConfigV1SourceConfig, SdkConfigV1SourceSpec, SdkConfigV1Target, SdkConfigV1WebhookSignature, SdkConfigV1WebhookSignatureInput, getSdkConfigV1Diagnostics, mapFernConfigToSdkConfigV1, parseSdkConfigV1, parseSdkConfigV1ForConsumption, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1CliOutputConfigSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 } from './v1/index.cjs';
|
|
2
|
-
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic, s as sdkConfigV1CliDistributionConfigSchema, t as sdkConfigV1CliDistributionGithubAppSchema, u as sdkConfigV1CliDistributionHomebrewSchema, v as sdkConfigV1CliDistributionScoopSchema, w as sdkConfigV1CliGenerationConfigSchema, x as sdkConfigV1ComposerPackageNameSchema, y as sdkConfigV1CsharpGenerationConfigSchema, A as sdkConfigV1ExactSemverSchema, B as sdkConfigV1GithubActionsSecretNameSchema, E as sdkConfigV1GoGenerationConfigSchema, F as sdkConfigV1GoModulePathSchema, H as sdkConfigV1JavaGenerationConfigSchema, N as sdkConfigV1KotlinGenerationConfigSchema, Q as sdkConfigV1McpGenerationConfigSchema, U as sdkConfigV1NonEmptyStringSchema, W as sdkConfigV1PhpGenerationConfigSchema, X as sdkConfigV1PythonGenerationConfigSchema, Y as sdkConfigV1RelativePathSchema, Z as sdkConfigV1RubyGenerationConfigSchema, _ as sdkConfigV1RustGenerationConfigSchema, $ as sdkConfigV1SwiftGenerationConfigSchema, a0 as sdkConfigV1TerraformGenerationConfigSchema, a1 as sdkConfigV1TypescriptGenerationConfigSchema } from '../typescript-
|
|
2
|
+
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic, s as sdkConfigV1CliDistributionConfigSchema, t as sdkConfigV1CliDistributionGithubAppSchema, u as sdkConfigV1CliDistributionHomebrewSchema, v as sdkConfigV1CliDistributionScoopSchema, w as sdkConfigV1CliGenerationConfigSchema, x as sdkConfigV1ComposerPackageNameSchema, y as sdkConfigV1CsharpGenerationConfigSchema, A as sdkConfigV1ExactSemverSchema, B as sdkConfigV1GithubActionsSecretNameSchema, E as sdkConfigV1GoGenerationConfigSchema, F as sdkConfigV1GoModulePathSchema, H as sdkConfigV1JavaGenerationConfigSchema, N as sdkConfigV1KotlinGenerationConfigSchema, Q as sdkConfigV1McpGenerationConfigSchema, U as sdkConfigV1NonEmptyStringSchema, W as sdkConfigV1PhpGenerationConfigSchema, X as sdkConfigV1PythonGenerationConfigSchema, Y as sdkConfigV1RelativePathSchema, Z as sdkConfigV1RubyGenerationConfigSchema, _ as sdkConfigV1RustGenerationConfigSchema, $ as sdkConfigV1SwiftGenerationConfigSchema, a0 as sdkConfigV1TerraformGenerationConfigSchema, a1 as sdkConfigV1TypescriptGenerationConfigSchema } from '../typescript-BFRxjAah.cjs';
|
|
3
3
|
import 'zod';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { FernConfigMappingDiagnostic, FernConfigMappingError, FernConfigMappingResult, FernResolvedGeneratorGroupInput, FernResolvedGeneratorInput, FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, SdkConfigV1, SdkConfigV1ApiConfig, SdkConfigV1ApiConfigInput, SdkConfigV1CliOutputConfig, SdkConfigV1ClientConfig, SdkConfigV1ClientConfigInput, SdkConfigV1ClientConfigOverride, SdkConfigV1Dependency, SdkConfigV1DocsConfig, SdkConfigV1Document, SdkConfigV1GenerationConfig, SdkConfigV1GenerationConfigInput, SdkConfigV1GenerationConfigOverride, SdkConfigV1Input, SdkConfigV1OutputConfig, SdkConfigV1PackageConfig, SdkConfigV1PublishConfig, SdkConfigV1PublishRegistry, SdkConfigV1ReplayConfig, SdkConfigV1SourceConfig, SdkConfigV1SourceSpec, SdkConfigV1Target, SdkConfigV1WebhookSignature, SdkConfigV1WebhookSignatureInput, getSdkConfigV1Diagnostics, mapFernConfigToSdkConfigV1, parseSdkConfigV1, parseSdkConfigV1ForConsumption, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1CliOutputConfigSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 } from './v1/index.js';
|
|
2
|
-
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic, s as sdkConfigV1CliDistributionConfigSchema, t as sdkConfigV1CliDistributionGithubAppSchema, u as sdkConfigV1CliDistributionHomebrewSchema, v as sdkConfigV1CliDistributionScoopSchema, w as sdkConfigV1CliGenerationConfigSchema, x as sdkConfigV1ComposerPackageNameSchema, y as sdkConfigV1CsharpGenerationConfigSchema, A as sdkConfigV1ExactSemverSchema, B as sdkConfigV1GithubActionsSecretNameSchema, E as sdkConfigV1GoGenerationConfigSchema, F as sdkConfigV1GoModulePathSchema, H as sdkConfigV1JavaGenerationConfigSchema, N as sdkConfigV1KotlinGenerationConfigSchema, Q as sdkConfigV1McpGenerationConfigSchema, U as sdkConfigV1NonEmptyStringSchema, W as sdkConfigV1PhpGenerationConfigSchema, X as sdkConfigV1PythonGenerationConfigSchema, Y as sdkConfigV1RelativePathSchema, Z as sdkConfigV1RubyGenerationConfigSchema, _ as sdkConfigV1RustGenerationConfigSchema, $ as sdkConfigV1SwiftGenerationConfigSchema, a0 as sdkConfigV1TerraformGenerationConfigSchema, a1 as sdkConfigV1TypescriptGenerationConfigSchema } from '../typescript-
|
|
2
|
+
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic, s as sdkConfigV1CliDistributionConfigSchema, t as sdkConfigV1CliDistributionGithubAppSchema, u as sdkConfigV1CliDistributionHomebrewSchema, v as sdkConfigV1CliDistributionScoopSchema, w as sdkConfigV1CliGenerationConfigSchema, x as sdkConfigV1ComposerPackageNameSchema, y as sdkConfigV1CsharpGenerationConfigSchema, A as sdkConfigV1ExactSemverSchema, B as sdkConfigV1GithubActionsSecretNameSchema, E as sdkConfigV1GoGenerationConfigSchema, F as sdkConfigV1GoModulePathSchema, H as sdkConfigV1JavaGenerationConfigSchema, N as sdkConfigV1KotlinGenerationConfigSchema, Q as sdkConfigV1McpGenerationConfigSchema, U as sdkConfigV1NonEmptyStringSchema, W as sdkConfigV1PhpGenerationConfigSchema, X as sdkConfigV1PythonGenerationConfigSchema, Y as sdkConfigV1RelativePathSchema, Z as sdkConfigV1RubyGenerationConfigSchema, _ as sdkConfigV1RustGenerationConfigSchema, $ as sdkConfigV1SwiftGenerationConfigSchema, a0 as sdkConfigV1TerraformGenerationConfigSchema, a1 as sdkConfigV1TypescriptGenerationConfigSchema } from '../typescript-BFRxjAah.js';
|
|
3
3
|
import 'zod';
|
package/dist/sdk-config/index.js
CHANGED
|
@@ -508,7 +508,10 @@ var cliDistributionConfigSchema = z.strictObject({
|
|
|
508
508
|
"A GitHub App used to mint short-lived tokens for every channel without its own tokenSecretName."
|
|
509
509
|
),
|
|
510
510
|
homebrew: cliDistributionHomebrewSchema.optional().describe("Publishes a Homebrew formula to a tap repository on each tagged release."),
|
|
511
|
-
scoop: cliDistributionScoopSchema.optional().describe("Publishes a Scoop manifest to a bucket repository on each tagged release.")
|
|
511
|
+
scoop: cliDistributionScoopSchema.optional().describe("Publishes a Scoop manifest to a bucket repository on each tagged release."),
|
|
512
|
+
githubAttestations: z.union([z.literal("auto"), z.boolean()], { error: 'must be "auto", true, or false' }).optional().describe(
|
|
513
|
+
'Whether the generated release workflow attests build provenance. "auto" (the generator default) attests only on public repositories; true always attests, for private repositories on GitHub Enterprise Cloud; false omits the attestation step and its permissions.'
|
|
514
|
+
)
|
|
512
515
|
}).superRefine((distribution, context) => {
|
|
513
516
|
if (distribution.homebrew !== void 0 || distribution.scoop !== void 0) {
|
|
514
517
|
return;
|
|
@@ -521,6 +524,9 @@ var cliDistributionConfigSchema = z.strictObject({
|
|
|
521
524
|
});
|
|
522
525
|
return;
|
|
523
526
|
}
|
|
527
|
+
if (distribution.githubAttestations !== void 0) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
524
530
|
context.addIssue({
|
|
525
531
|
code: "custom",
|
|
526
532
|
message: "distribution must configure at least one channel: homebrew or scoop"
|
|
@@ -532,14 +538,17 @@ var CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE = "CLI_DISTRIBUTION_NON_RELEASE_MODE"
|
|
|
532
538
|
var nonReleaseGithubModes = /* @__PURE__ */ new Set(["pull-request", "push", "commit"]);
|
|
533
539
|
function cliDistributionModeDiagnostic(output, outputPath) {
|
|
534
540
|
const mode = output?.github?.mode;
|
|
535
|
-
|
|
541
|
+
const distribution = output?.distribution;
|
|
542
|
+
if (distribution === void 0 || mode === void 0 || !nonReleaseGithubModes.has(mode)) {
|
|
536
543
|
return void 0;
|
|
537
544
|
}
|
|
545
|
+
const hasChannel = distribution.homebrew !== void 0 || distribution.scoop !== void 0;
|
|
546
|
+
const consequence = hasChannel ? "Homebrew and Scoop publish only after a semantic-version tag is pushed to the repository." : "the release workflow, including its githubAttestations setting, runs only after a semantic-version tag is pushed to the repository.";
|
|
538
547
|
return {
|
|
539
548
|
code: CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE,
|
|
540
549
|
severity: "warning",
|
|
541
550
|
path: [...outputPath, "github", "mode"],
|
|
542
|
-
reason: `GitHub mode "${mode}" does not create a release tag, so
|
|
551
|
+
reason: `GitHub mode "${mode}" does not create a release tag, so ${consequence}`,
|
|
543
552
|
suggestedAction: 'Use mode "release" or "commit-and-release", or push a version tag after merging generated changes.'
|
|
544
553
|
};
|
|
545
554
|
}
|
|
@@ -974,6 +983,7 @@ var DISTRIBUTION_KEYS = {
|
|
|
974
983
|
homebrew: { tap: "tap", formula: "formula", tokenEnvironmentVariable: "tokenSecretName" },
|
|
975
984
|
scoop: { bucket: "bucket", tokenEnvironmentVariable: "tokenSecretName" }
|
|
976
985
|
};
|
|
986
|
+
var DISTRIBUTION_SCALAR_KEYS = ["githubAttestations"];
|
|
977
987
|
function mapCliDistribution(config, state, basePath, targetIndex) {
|
|
978
988
|
if (!Object.hasOwn(config, "distribution")) return;
|
|
979
989
|
const raw = config.distribution;
|
|
@@ -1020,6 +1030,11 @@ function translateDistribution(distribution, path) {
|
|
|
1020
1030
|
}
|
|
1021
1031
|
value[block] = translatedBlock;
|
|
1022
1032
|
}
|
|
1033
|
+
for (const key of DISTRIBUTION_SCALAR_KEYS) {
|
|
1034
|
+
if (!Object.hasOwn(distribution, key)) continue;
|
|
1035
|
+
value[key] = distribution[key];
|
|
1036
|
+
consumedPaths.push([...path, key]);
|
|
1037
|
+
}
|
|
1023
1038
|
return { value, consumedPaths, legacyKeys };
|
|
1024
1039
|
}
|
|
1025
1040
|
function invalidDistributionDiagnostic(issue, path, legacyKeys, targetIndex) {
|
|
@@ -1159,6 +1174,7 @@ function mapOutput(generator, language, index) {
|
|
|
1159
1174
|
output.publishV2,
|
|
1160
1175
|
rawOutput,
|
|
1161
1176
|
language,
|
|
1177
|
+
"zip",
|
|
1162
1178
|
[...outputPath, "publishV2"],
|
|
1163
1179
|
state,
|
|
1164
1180
|
index
|
|
@@ -1180,6 +1196,7 @@ function mapOutput(generator, language, index) {
|
|
|
1180
1196
|
output.registryOverrides,
|
|
1181
1197
|
rawOutput,
|
|
1182
1198
|
language,
|
|
1199
|
+
"zip",
|
|
1183
1200
|
[...outputPath, "registryOverrides"],
|
|
1184
1201
|
state,
|
|
1185
1202
|
index
|
|
@@ -1207,7 +1224,14 @@ function mapOutput(generator, language, index) {
|
|
|
1207
1224
|
}
|
|
1208
1225
|
}
|
|
1209
1226
|
function sanitizeNormalizedOutput(output, rawOutput, state, index) {
|
|
1210
|
-
const publish = output.publish ? sanitizePublishConfig(
|
|
1227
|
+
const publish = output.publish ? sanitizePublishConfig(
|
|
1228
|
+
output.publish,
|
|
1229
|
+
output.publish,
|
|
1230
|
+
rawOutput,
|
|
1231
|
+
output.delivery,
|
|
1232
|
+
state,
|
|
1233
|
+
index
|
|
1234
|
+
) : void 0;
|
|
1211
1235
|
const publishShape = publish ? { publish } : {};
|
|
1212
1236
|
if (output.delivery !== "github") return { ...output, ...publishShape };
|
|
1213
1237
|
const { credentials, ...github } = output.github;
|
|
@@ -1234,13 +1258,22 @@ function githubOutput(value, publishInfo, rawOutput, language, sourcePath, state
|
|
|
1234
1258
|
);
|
|
1235
1259
|
consume(state, [...sourcePath, "owner"]);
|
|
1236
1260
|
consume(state, [...sourcePath, "repo"]);
|
|
1237
|
-
const publication = publishInfo ? mapPublication(
|
|
1261
|
+
const publication = publishInfo ? mapPublication(
|
|
1262
|
+
publishInfo,
|
|
1263
|
+
rawOutput,
|
|
1264
|
+
language,
|
|
1265
|
+
"github",
|
|
1266
|
+
[...sourcePath, "publishInfo"],
|
|
1267
|
+
state,
|
|
1268
|
+
index
|
|
1269
|
+
) : void 0;
|
|
1238
1270
|
const type = stringValue(value.type);
|
|
1239
1271
|
const licensePackage = mapGithubLicense(value.license, [...sourcePath, "license"], state);
|
|
1240
1272
|
const reviewers = mapReviewers(value.reviewers, [...sourcePath, "reviewers"], state);
|
|
1241
1273
|
if (type) consume(state, [...sourcePath, "type"]);
|
|
1242
1274
|
if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
|
|
1243
|
-
|
|
1275
|
+
const workflows = typeof value.workflows === "boolean" ? value.workflows : void 0;
|
|
1276
|
+
if (workflows !== void 0) consume(state, [...sourcePath, "workflows"]);
|
|
1244
1277
|
if (stringValue(value.host)) consume(state, [...sourcePath, "host"]);
|
|
1245
1278
|
if (stringValue(value.branch)) consume(state, [...sourcePath, "branch"]);
|
|
1246
1279
|
consumeCredentialObject(value.credentials, [...sourcePath, "credentials"], state);
|
|
@@ -1260,7 +1293,8 @@ function githubOutput(value, publishInfo, rawOutput, language, sourcePath, state
|
|
|
1260
1293
|
...optional("host", stringValue(value.host)),
|
|
1261
1294
|
...optional("branch", stringValue(value.branch)),
|
|
1262
1295
|
mode: value.makePr === true || type === "pullRequest" ? "pull-request" : type === "push" ? "push" : "release",
|
|
1263
|
-
...optional("reviewers", reviewers)
|
|
1296
|
+
...optional("reviewers", reviewers),
|
|
1297
|
+
...workflows === false ? { workflows } : {}
|
|
1264
1298
|
},
|
|
1265
1299
|
...publication ? { publish: publication.publish } : {}
|
|
1266
1300
|
},
|
|
@@ -1327,7 +1361,7 @@ function reviewerNames(value, expectedType, sourcePath, state) {
|
|
|
1327
1361
|
});
|
|
1328
1362
|
return names.length ? names : void 0;
|
|
1329
1363
|
}
|
|
1330
|
-
function mapPublication(value, rawOutput, language, sourcePath, state, index) {
|
|
1364
|
+
function mapPublication(value, rawOutput, language, delivery, sourcePath, state, index) {
|
|
1331
1365
|
if (!isObject(value))
|
|
1332
1366
|
fail(
|
|
1333
1367
|
"FERN_PUBLICATION_INVALID",
|
|
@@ -1348,6 +1382,7 @@ function mapPublication(value, rawOutput, language, sourcePath, state, index) {
|
|
|
1348
1382
|
compact({ registry, url: registryUrl }),
|
|
1349
1383
|
nested,
|
|
1350
1384
|
rawOutput,
|
|
1385
|
+
delivery,
|
|
1351
1386
|
state,
|
|
1352
1387
|
index
|
|
1353
1388
|
);
|
|
@@ -1368,7 +1403,7 @@ function mapPublication(value, rawOutput, language, sourcePath, state, index) {
|
|
|
1368
1403
|
...packageName || Object.keys(metadata).length ? { package: { ...optional("packageName", packageName), ...metadata } } : {}
|
|
1369
1404
|
};
|
|
1370
1405
|
}
|
|
1371
|
-
function sanitizePublishConfig(publish, resolvedPublication, rawOutput, state, index) {
|
|
1406
|
+
function sanitizePublishConfig(publish, resolvedPublication, rawOutput, delivery, state, index) {
|
|
1372
1407
|
const rawPublication = rawOutput?.location === publish.registry ? rawOutput : void 0;
|
|
1373
1408
|
const rawPath = ["group", "generators", index, "output"];
|
|
1374
1409
|
if (publish.registry === "npm" || publish.registry === "crates") {
|
|
@@ -1464,6 +1499,33 @@ function sanitizePublishConfig(publish, resolvedPublication, rawOutput, state, i
|
|
|
1464
1499
|
signature
|
|
1465
1500
|
});
|
|
1466
1501
|
}
|
|
1502
|
+
if (publish.registry === "nuget" || publish.registry === "rubygems") {
|
|
1503
|
+
const apiKey = mapApiKeyExpression(
|
|
1504
|
+
publish.registry,
|
|
1505
|
+
rawPublication,
|
|
1506
|
+
resolvedPublication,
|
|
1507
|
+
rawPath,
|
|
1508
|
+
state,
|
|
1509
|
+
index,
|
|
1510
|
+
fernDefaultApiKey(publish.registry, rawOutput, delivery)
|
|
1511
|
+
);
|
|
1512
|
+
warnForUnexpectedCredentialFields(
|
|
1513
|
+
rawPublication,
|
|
1514
|
+
resolvedPublication,
|
|
1515
|
+
["apiKey"],
|
|
1516
|
+
rawPath,
|
|
1517
|
+
state,
|
|
1518
|
+
index
|
|
1519
|
+
);
|
|
1520
|
+
return compact({
|
|
1521
|
+
registry: publish.registry,
|
|
1522
|
+
url: publish.url,
|
|
1523
|
+
releaseBranch: publish.releaseBranch,
|
|
1524
|
+
tolerateRepublish: publish.tolerateRepublish,
|
|
1525
|
+
apiKey,
|
|
1526
|
+
trustedPublishing: usesTrustedPublishing(rawPublication) || void 0
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1467
1529
|
warnForUnrepresentableCredentials(rawPublication, resolvedPublication, rawPath, state, index);
|
|
1468
1530
|
return compact({
|
|
1469
1531
|
registry: publish.registry,
|
|
@@ -1472,11 +1534,19 @@ function sanitizePublishConfig(publish, resolvedPublication, rawOutput, state, i
|
|
|
1472
1534
|
tolerateRepublish: publish.tolerateRepublish
|
|
1473
1535
|
});
|
|
1474
1536
|
}
|
|
1475
|
-
function mapLegacyPublication(value, rawOutput, language, sourcePath, state, index) {
|
|
1537
|
+
function mapLegacyPublication(value, rawOutput, language, delivery, sourcePath, state, index) {
|
|
1476
1538
|
const registry = defaultRegistry(language, sourcePath, index);
|
|
1477
1539
|
const overrides = isObject(value) ? value : {};
|
|
1478
1540
|
const override = isObject(overrides[registry]) ? overrides[registry] : {};
|
|
1479
|
-
return mapPublication(
|
|
1541
|
+
return mapPublication(
|
|
1542
|
+
override,
|
|
1543
|
+
rawOutput,
|
|
1544
|
+
language,
|
|
1545
|
+
delivery,
|
|
1546
|
+
[...sourcePath, registry],
|
|
1547
|
+
state,
|
|
1548
|
+
index
|
|
1549
|
+
);
|
|
1480
1550
|
}
|
|
1481
1551
|
function mapCredentialExpression(rawPublication, resolvedPublication, field, rawPath, state, index) {
|
|
1482
1552
|
const rawValue = rawPublication?.[field];
|
|
@@ -1491,6 +1561,45 @@ function mapCredentialExpression(rawPublication, resolvedPublication, field, raw
|
|
|
1491
1561
|
}
|
|
1492
1562
|
return void 0;
|
|
1493
1563
|
}
|
|
1564
|
+
var TRUSTED_PUBLISHING_VALUES = /* @__PURE__ */ new Set(["OIDC", "<USE_OIDC>"]);
|
|
1565
|
+
function rawApiKeyValue(raw) {
|
|
1566
|
+
return raw?.apiKey ?? raw?.["api-key"];
|
|
1567
|
+
}
|
|
1568
|
+
function usesTrustedPublishing(rawPublication) {
|
|
1569
|
+
const rawValue = rawApiKeyValue(rawPublication);
|
|
1570
|
+
return typeof rawValue === "string" && TRUSTED_PUBLISHING_VALUES.has(rawValue);
|
|
1571
|
+
}
|
|
1572
|
+
function mapApiKeyExpression(registry, rawPublication, resolvedPublication, rawPath, state, index, defaultSecretName) {
|
|
1573
|
+
const rawValue = rawApiKeyValue(rawPublication);
|
|
1574
|
+
if (isEnvironmentExpression(rawValue)) return rawValue;
|
|
1575
|
+
if (usesTrustedPublishing(rawPublication)) return void 0;
|
|
1576
|
+
if (defaultSecretName !== void 0) return defaultSecretName;
|
|
1577
|
+
if (rawValue === void 0 && !hasResolvedCredential(resolvedPublication, "apiKey")) {
|
|
1578
|
+
return void 0;
|
|
1579
|
+
}
|
|
1580
|
+
addCredentialDiagnostic(
|
|
1581
|
+
state,
|
|
1582
|
+
[...rawPath, "apiKey"],
|
|
1583
|
+
["targets", index, "output", "publish", "apiKey"],
|
|
1584
|
+
apiKeyOmissionReason(registry)
|
|
1585
|
+
);
|
|
1586
|
+
return void 0;
|
|
1587
|
+
}
|
|
1588
|
+
function apiKeyOmissionReason(registry) {
|
|
1589
|
+
const label = registry === "nuget" ? "NuGet" : "RubyGems";
|
|
1590
|
+
return `Fern ${label} apiKey is not an exact environment expression naming a secret`;
|
|
1591
|
+
}
|
|
1592
|
+
var FERN_DEFAULT_NUGET_API_KEY = "${NUGET_API_TOKEN}";
|
|
1593
|
+
function fernDefaultApiKey(registry, rawOutput, delivery) {
|
|
1594
|
+
if (registry !== "nuget" || delivery !== "github" || rawOutput?.location !== "nuget") {
|
|
1595
|
+
return void 0;
|
|
1596
|
+
}
|
|
1597
|
+
const rawApiKey = rawApiKeyValue(rawOutput);
|
|
1598
|
+
if (typeof rawApiKey === "string" && TRUSTED_PUBLISHING_VALUES.has(rawApiKey)) {
|
|
1599
|
+
return void 0;
|
|
1600
|
+
}
|
|
1601
|
+
return FERN_DEFAULT_NUGET_API_KEY;
|
|
1602
|
+
}
|
|
1494
1603
|
function mapPypiCredentialExpressions(rawPublication, resolvedPublication, rawPath, state, index) {
|
|
1495
1604
|
const rawToken = rawPublication?.token;
|
|
1496
1605
|
if (isEnvironmentExpression(rawToken)) {
|
|
@@ -2194,6 +2303,29 @@ var mavenSignatureSchema = z.strictObject({
|
|
|
2194
2303
|
"The armored secret key, or an environment expression that resolves to it."
|
|
2195
2304
|
)
|
|
2196
2305
|
});
|
|
2306
|
+
function apiKeySecretSchema(registry, example) {
|
|
2307
|
+
return nonEmptyStringSchema.regex(
|
|
2308
|
+
/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/,
|
|
2309
|
+
`${registry} apiKey must be an environment expression naming a secret, such as ${example}`
|
|
2310
|
+
);
|
|
2311
|
+
}
|
|
2312
|
+
function apiKeySecretDescription(registry, example) {
|
|
2313
|
+
return `An environment expression naming the repository secret that the generated release workflow reads the ${registry} API key from, such as ${example}. This is a secret name, never the key itself.`;
|
|
2314
|
+
}
|
|
2315
|
+
function trustedPublishingSchema(registry) {
|
|
2316
|
+
return z.boolean().optional().describe(
|
|
2317
|
+
`Whether ${registry} publication uses trusted publishing (OIDC) instead of an API key secret.`
|
|
2318
|
+
);
|
|
2319
|
+
}
|
|
2320
|
+
function refineApiKeyAgainstTrustedPublishing(publish, context) {
|
|
2321
|
+
if (publish.trustedPublishing === true && publish.apiKey !== void 0) {
|
|
2322
|
+
context.addIssue({
|
|
2323
|
+
code: "custom",
|
|
2324
|
+
message: "apiKey must be omitted when trustedPublishing is true",
|
|
2325
|
+
path: ["apiKey"]
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2197
2329
|
var commonPublishShape = {
|
|
2198
2330
|
url: nonEmptyStringSchema.optional().describe("A custom package registry URL."),
|
|
2199
2331
|
releaseBranch: nonEmptyStringSchema.optional().describe("The branch used by generated package release workflows."),
|
|
@@ -2229,12 +2361,16 @@ var sdkConfigV1PublishConfigSchema = z.discriminatedUnion("registry", [
|
|
|
2229
2361
|
}),
|
|
2230
2362
|
z.strictObject({
|
|
2231
2363
|
registry: z.literal("nuget").describe("Publishes the package to a NuGet-compatible registry."),
|
|
2364
|
+
apiKey: apiKeySecretSchema("NuGet", "${NUGET_API_KEY}").optional().describe(apiKeySecretDescription("NuGet", "${NUGET_API_KEY}")),
|
|
2365
|
+
trustedPublishing: trustedPublishingSchema("NuGet"),
|
|
2232
2366
|
...commonPublishShape
|
|
2233
|
-
}),
|
|
2367
|
+
}).superRefine(refineApiKeyAgainstTrustedPublishing),
|
|
2234
2368
|
z.strictObject({
|
|
2235
2369
|
registry: z.literal("rubygems").describe("Publishes the package to a RubyGems-compatible registry."),
|
|
2370
|
+
apiKey: apiKeySecretSchema("RubyGems", "${RUBYGEMS_API_KEY}").optional().describe(apiKeySecretDescription("RubyGems", "${RUBYGEMS_API_KEY}")),
|
|
2371
|
+
trustedPublishing: trustedPublishingSchema("RubyGems"),
|
|
2236
2372
|
...commonPublishShape
|
|
2237
|
-
}),
|
|
2373
|
+
}).superRefine(refineApiKeyAgainstTrustedPublishing),
|
|
2238
2374
|
z.strictObject({
|
|
2239
2375
|
registry: z.literal("crates").describe("Publishes the crate to a Cargo-compatible registry."),
|
|
2240
2376
|
token: nonEmptyStringSchema.optional().describe("The Cargo registry token, or an environment expression that resolves to it."),
|
|
@@ -2268,7 +2404,10 @@ var githubOutputSchema = z.strictObject({
|
|
|
2268
2404
|
mode: z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional().describe("How generated changes are delivered to the repository."),
|
|
2269
2405
|
reviewers: reviewersSchema.optional().describe("Reviewers requested for generated pull requests."),
|
|
2270
2406
|
credentials: githubCredentialsSchema.optional().describe("Credentials used to authenticate GitHub delivery."),
|
|
2271
|
-
privateRepository: z.boolean().optional().describe("Whether the destination repository is private.")
|
|
2407
|
+
privateRepository: z.boolean().optional().describe("Whether the destination repository is private."),
|
|
2408
|
+
workflows: z.boolean().optional().describe(
|
|
2409
|
+
"Whether generated .github/workflows files are delivered. Defaults to true. When false, newly generated workflow files are skipped and existing ones in the repository are left untouched."
|
|
2410
|
+
)
|
|
2272
2411
|
});
|
|
2273
2412
|
var filesOutputSchema = z.strictObject({
|
|
2274
2413
|
delivery: z.literal("files").describe("Writes the generated SDK to a directory."),
|
|
@@ -2292,7 +2431,7 @@ var sdkConfigV1OutputConfigSchema = z.discriminatedUnion(
|
|
|
2292
2431
|
);
|
|
2293
2432
|
var cliDistributionShape = {
|
|
2294
2433
|
distribution: cliDistributionConfigSchema.optional().describe(
|
|
2295
|
-
"CLI release channels
|
|
2434
|
+
"CLI release channels and build attestation settings for the generated release workflow; credentials are GitHub Actions secret names."
|
|
2296
2435
|
)
|
|
2297
2436
|
};
|
|
2298
2437
|
function rejectDistributionWithoutGithub(output, context) {
|
|
@@ -2338,6 +2477,9 @@ var apiImportSettingsSchema = z.strictObject({
|
|
|
2338
2477
|
discriminatedUnionV2: z.boolean().optional().describe("Whether oneOf and anyOf schemas use the newer discriminator inference rules."),
|
|
2339
2478
|
undiscriminatedUnionsWithLiterals: z.boolean().optional().describe("Whether literal-bearing unions remain undiscriminated during import."),
|
|
2340
2479
|
inlineAllOfSchemas: z.boolean().optional().describe("Whether schemas composed with allOf are inlined when possible."),
|
|
2480
|
+
inferDiscriminatedUnionBaseProperties: z.boolean().optional().describe(
|
|
2481
|
+
"Whether properties every discriminated-union variant shares are lifted onto the union."
|
|
2482
|
+
),
|
|
2341
2483
|
resolveSchemaCollisions: z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
|
|
2342
2484
|
asyncApiMessageNaming: z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
|
|
2343
2485
|
defaultIntegerFormat: z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one.")
|
|
@@ -2556,7 +2698,7 @@ var pythonGenerationConfigSchema = z.strictObject({
|
|
|
2556
2698
|
additionalInitExports: z.array(additionalInitExportSchema).optional().describe("Additional names re-exported from the package initializer.")
|
|
2557
2699
|
});
|
|
2558
2700
|
var rubyGenerationConfigSchema = z.strictObject({
|
|
2559
|
-
requirePaths: z.array(nonEmptyStringSchema).optional().describe("
|
|
2701
|
+
requirePaths: z.array(nonEmptyStringSchema).optional().describe("Files the generated entry file loads with `require`.")
|
|
2560
2702
|
});
|
|
2561
2703
|
var rustGenerationConfigSchema = z.strictObject({
|
|
2562
2704
|
/**
|
|
@@ -3287,7 +3429,12 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
3287
3429
|
}
|
|
3288
3430
|
const pythonClient = language === "python" ? takeObject(config, ["client"], state, basePath) : void 0;
|
|
3289
3431
|
const typescriptNaming = language === "typescript" || language === "mcp" ? takeObject(config, ["naming"], state, basePath) : void 0;
|
|
3290
|
-
const directClientName = takeString(
|
|
3432
|
+
const directClientName = takeString(
|
|
3433
|
+
config,
|
|
3434
|
+
language === "ruby" ? ["clientName"] : ["clientName", "clientClassName"],
|
|
3435
|
+
state,
|
|
3436
|
+
basePath
|
|
3437
|
+
);
|
|
3291
3438
|
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : typescriptNaming ? takeString(typescriptNaming.value, ["client"], state, typescriptNaming.path) : language === "ruby" ? (
|
|
3292
3439
|
// Fern's Ruby generator renames the root client class (`Auth0::Management`) with it.
|
|
3293
3440
|
takeString(config, ["clientModuleName"], state, basePath)
|