@postman/sdk-config 0.3.1 → 0.3.2
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 +8 -4
- package/dist/index.cjs +111 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +111 -23
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +79 -6
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.js +79 -6
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +79 -6
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +4766 -0
- package/dist/sdk-config/v1/index.d.ts +4766 -0
- package/dist/sdk-config/v1/index.js +79 -6
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +32 -17
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.js +32 -17
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +32 -17
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +475 -160
- package/dist/sdk-config-ir/v1/index.d.ts +475 -160
- package/dist/sdk-config-ir/v1/index.js +32 -17
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +14 -7
- package/src/sdk-config-ir/v1/README.md +92 -91
package/README.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Build and validate SDK Config documents for SDK Generation API requests.
|
|
4
4
|
|
|
5
5
|
SDK Config describes what to generate: API source provenance, SDK identity, API behavior, client
|
|
6
|
-
behavior, package metadata, documentation, output, shared generation options,
|
|
7
|
-
language targets. The materialized API source bytes,
|
|
8
|
-
metadata belong to the SDK Generation API request rather than the SDK
|
|
6
|
+
behavior, package metadata, documentation, output, shared generation options, optional publishing
|
|
7
|
+
credentials/signing material, and one or more language targets. The materialized API source bytes,
|
|
8
|
+
idempotency, and transport metadata belong to the SDK Generation API request rather than the SDK
|
|
9
|
+
Config document.
|
|
9
10
|
|
|
10
11
|
## Install
|
|
11
12
|
|
|
@@ -70,7 +71,10 @@ if (!result.success) {
|
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
SDK Config objects are strict. Unknown fields, duplicate language targets, incompatible package
|
|
73
|
-
publication settings, and non-exact generator versions are rejected.
|
|
74
|
+
publication settings, and non-exact generator versions are rejected. Publishing credentials and
|
|
75
|
+
signing material may be provided under `output.publish.credentials`, Maven
|
|
76
|
+
`output.publish.signature`, or `output.github.credentials`; these fields can contain raw secrets and
|
|
77
|
+
must be handled accordingly by clients and servers.
|
|
74
78
|
|
|
75
79
|
`SdkConfigV1` accepts customer-facing local source paths and HTTP(S) source URLs, but not
|
|
76
80
|
server-owned signed URLs or artifact metadata. See the
|
package/dist/index.cjs
CHANGED
|
@@ -711,6 +711,7 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
|
|
|
711
711
|
if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
|
|
712
712
|
if (stringValue(value.host)) consume(state, [...sourcePath, "host"]);
|
|
713
713
|
if (stringValue(value.branch)) consume(state, [...sourcePath, "branch"]);
|
|
714
|
+
const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
|
|
714
715
|
return {
|
|
715
716
|
output: {
|
|
716
717
|
delivery: "github",
|
|
@@ -719,13 +720,58 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
|
|
|
719
720
|
...optional("host", stringValue(value.host)),
|
|
720
721
|
...optional("branch", stringValue(value.branch)),
|
|
721
722
|
mode: value.makePr === true || type === "pullRequest" ? "pull-request" : type === "push" ? "push" : "release",
|
|
722
|
-
...optional("reviewers", reviewers)
|
|
723
|
+
...optional("reviewers", reviewers),
|
|
724
|
+
...optional("credentials", credentials)
|
|
723
725
|
},
|
|
724
726
|
...publication ? { publish: publication.publish } : {}
|
|
725
727
|
},
|
|
726
728
|
...optional("package", publication?.package)
|
|
727
729
|
};
|
|
728
730
|
}
|
|
731
|
+
function mapCredentials(value, sourcePath, state) {
|
|
732
|
+
if (!isObject(value)) return void 0;
|
|
733
|
+
return credentialsFromObject(value, sourcePath, state);
|
|
734
|
+
}
|
|
735
|
+
function mapInlineCredentials(value, sourcePath, state) {
|
|
736
|
+
const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
|
|
737
|
+
if (credentials) return credentials;
|
|
738
|
+
return credentialsFromObject(value, sourcePath, state);
|
|
739
|
+
}
|
|
740
|
+
function credentialsFromObject(value, sourcePath, state) {
|
|
741
|
+
const credentials = {};
|
|
742
|
+
const username = stringValue(value.username);
|
|
743
|
+
const password = stringValue(value.password);
|
|
744
|
+
const token = stringValue(value.token);
|
|
745
|
+
const apiKey = stringValue(value.apiKey);
|
|
746
|
+
if (username) {
|
|
747
|
+
credentials.username = username;
|
|
748
|
+
consume(state, [...sourcePath, "username"]);
|
|
749
|
+
}
|
|
750
|
+
if (password) {
|
|
751
|
+
credentials.password = password;
|
|
752
|
+
consume(state, [...sourcePath, "password"]);
|
|
753
|
+
}
|
|
754
|
+
if (token) {
|
|
755
|
+
credentials.token = token;
|
|
756
|
+
consume(state, [...sourcePath, "token"]);
|
|
757
|
+
}
|
|
758
|
+
if (apiKey) {
|
|
759
|
+
credentials.apiKey = apiKey;
|
|
760
|
+
consume(state, [...sourcePath, "apiKey"]);
|
|
761
|
+
}
|
|
762
|
+
return Object.keys(credentials).length === 0 ? void 0 : credentials;
|
|
763
|
+
}
|
|
764
|
+
function mapMavenSignature(value, sourcePath, state) {
|
|
765
|
+
if (!isObject(value)) return void 0;
|
|
766
|
+
const keyId = stringValue(value.keyId);
|
|
767
|
+
const password = stringValue(value.password);
|
|
768
|
+
const secretKey = stringValue(value.secretKey);
|
|
769
|
+
if (!keyId || !password || !secretKey) return void 0;
|
|
770
|
+
consume(state, [...sourcePath, "keyId"]);
|
|
771
|
+
consume(state, [...sourcePath, "password"]);
|
|
772
|
+
consume(state, [...sourcePath, "secretKey"]);
|
|
773
|
+
return { keyId, password, secretKey };
|
|
774
|
+
}
|
|
729
775
|
function mapReviewers(value, sourcePath, state) {
|
|
730
776
|
if (Array.isArray(value)) {
|
|
731
777
|
const teams2 = reviewerNames(value, "team", sourcePath, state);
|
|
@@ -769,11 +815,13 @@ function mapPublication(value, language, sourcePath, state, index) {
|
|
|
769
815
|
const registry = publicationRegistry(type, language, [...sourcePath, "type"], index);
|
|
770
816
|
const registryUrl = stringValue(nested.registryUrl);
|
|
771
817
|
if (registryUrl) consume(state, [...nestedPath, "registryUrl"]);
|
|
818
|
+
const credentials = mapInlineCredentials(nested, nestedPath, state);
|
|
772
819
|
if (registry === "maven") {
|
|
773
820
|
const coordinate = stringValue(nested.coordinate);
|
|
821
|
+
const signature = mapMavenSignature(nested.signature, [...nestedPath, "signature"], state);
|
|
774
822
|
if (coordinate) consume(state, [...nestedPath, "coordinate"]);
|
|
775
823
|
return {
|
|
776
|
-
publish: compact({ registry, url: registryUrl }),
|
|
824
|
+
publish: compact({ registry, url: registryUrl, credentials, signature }),
|
|
777
825
|
...coordinate ? { package: mavenPackage(coordinate, [...nestedPath, "coordinate"], index) } : {}
|
|
778
826
|
};
|
|
779
827
|
}
|
|
@@ -782,7 +830,7 @@ function mapPublication(value, language, sourcePath, state, index) {
|
|
|
782
830
|
if (packageName) consume(state, [...nestedPath, packageNameField]);
|
|
783
831
|
const metadata = registry === "pypi" ? mapPypiMetadata(nested.pypiMetadata, nestedPath, state) : {};
|
|
784
832
|
return {
|
|
785
|
-
publish: compact({ registry, url: registryUrl }),
|
|
833
|
+
publish: compact({ registry, url: registryUrl, credentials }),
|
|
786
834
|
...packageName || Object.keys(metadata).length ? { package: { ...optional("packageName", packageName), ...metadata } } : {}
|
|
787
835
|
};
|
|
788
836
|
}
|
|
@@ -899,7 +947,11 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
|
899
947
|
code: "FERN_OUTPUT_CREDENTIAL_UNSUPPORTED",
|
|
900
948
|
severity: "warning",
|
|
901
949
|
path: sourcePath,
|
|
902
|
-
|
|
950
|
+
// This diagnostic only captures credential/signature fields that remained
|
|
951
|
+
// unconsumed after mapping supported registry/GitHub credentials into
|
|
952
|
+
// SDK Config v1. Supported credential shapes are carried through; this
|
|
953
|
+
// warning is about the remaining legacy-only credential fields.
|
|
954
|
+
reason: "Some Fern output credentials and signatures are intentionally excluded from SDK Config v1 when they cannot be represented in the public schema",
|
|
903
955
|
suggestedAction: "Provide publishing credentials through the build request or external secret resolution."
|
|
904
956
|
}
|
|
905
957
|
] : [],
|
|
@@ -1119,15 +1171,33 @@ var sdkConfigV1PublishRegistrySchema = zod.z.enum([
|
|
|
1119
1171
|
"go",
|
|
1120
1172
|
"composer"
|
|
1121
1173
|
]);
|
|
1174
|
+
var registryCredentialsSchema = zod.z.strictObject({
|
|
1175
|
+
username: nonEmptyStringSchema.optional(),
|
|
1176
|
+
password: nonEmptyStringSchema.optional(),
|
|
1177
|
+
token: nonEmptyStringSchema.optional(),
|
|
1178
|
+
apiKey: nonEmptyStringSchema.optional()
|
|
1179
|
+
});
|
|
1180
|
+
var mavenSignatureSchema = zod.z.strictObject({
|
|
1181
|
+
keyId: nonEmptyStringSchema,
|
|
1182
|
+
password: nonEmptyStringSchema,
|
|
1183
|
+
secretKey: nonEmptyStringSchema
|
|
1184
|
+
});
|
|
1122
1185
|
var commonPublishShape = {
|
|
1123
1186
|
url: nonEmptyStringSchema.optional(),
|
|
1187
|
+
/** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
|
|
1188
|
+
credentials: registryCredentialsSchema.optional(),
|
|
1124
1189
|
releaseBranch: nonEmptyStringSchema.optional(),
|
|
1125
1190
|
tolerateRepublish: zod.z.boolean().optional()
|
|
1126
1191
|
};
|
|
1127
1192
|
var sdkConfigV1PublishConfigSchema = zod.z.discriminatedUnion("registry", [
|
|
1128
1193
|
zod.z.strictObject({ registry: zod.z.literal("npm"), ...commonPublishShape }),
|
|
1129
1194
|
zod.z.strictObject({ registry: zod.z.literal("pypi"), ...commonPublishShape }),
|
|
1130
|
-
zod.z.strictObject({
|
|
1195
|
+
zod.z.strictObject({
|
|
1196
|
+
registry: zod.z.literal("maven"),
|
|
1197
|
+
/** Raw Maven signing material. These values can be sensitive and must be handled as secrets. */
|
|
1198
|
+
signature: mavenSignatureSchema.optional(),
|
|
1199
|
+
...commonPublishShape
|
|
1200
|
+
}),
|
|
1131
1201
|
zod.z.strictObject({ registry: zod.z.literal("nuget"), ...commonPublishShape }),
|
|
1132
1202
|
zod.z.strictObject({ registry: zod.z.literal("rubygems"), ...commonPublishShape }),
|
|
1133
1203
|
zod.z.strictObject({ registry: zod.z.literal("crates"), ...commonPublishShape }),
|
|
@@ -1138,12 +1208,15 @@ var reviewersSchema = zod.z.strictObject({
|
|
|
1138
1208
|
teams: zod.z.array(nonEmptyStringSchema).optional(),
|
|
1139
1209
|
users: zod.z.array(nonEmptyStringSchema).optional()
|
|
1140
1210
|
});
|
|
1211
|
+
var githubCredentialsSchema = registryCredentialsSchema;
|
|
1141
1212
|
var githubOutputSchema = zod.z.strictObject({
|
|
1142
1213
|
repository: nonEmptyStringSchema,
|
|
1143
1214
|
host: nonEmptyStringSchema.optional(),
|
|
1144
1215
|
branch: nonEmptyStringSchema.optional(),
|
|
1145
|
-
mode: zod.z.enum(["release", "pull-request", "push"]).optional(),
|
|
1216
|
+
mode: zod.z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
|
|
1146
1217
|
reviewers: reviewersSchema.optional(),
|
|
1218
|
+
/** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
|
|
1219
|
+
credentials: githubCredentialsSchema.optional(),
|
|
1147
1220
|
privateRepository: zod.z.boolean().optional()
|
|
1148
1221
|
});
|
|
1149
1222
|
var filesOutputSchema = zod.z.strictObject({
|
|
@@ -2539,13 +2612,18 @@ var credentialResolutionSchema = zod.z.enum([
|
|
|
2539
2612
|
"resolved-by-orchestrator",
|
|
2540
2613
|
"resolved-by-fiddle"
|
|
2541
2614
|
]);
|
|
2615
|
+
var registryCredentialsSchema2 = zod.z.strictObject({
|
|
2616
|
+
username: nonEmptyStringSchema.optional(),
|
|
2617
|
+
password: nonEmptyStringSchema.optional(),
|
|
2618
|
+
token: nonEmptyStringSchema.optional(),
|
|
2619
|
+
apiKey: nonEmptyStringSchema.optional()
|
|
2620
|
+
});
|
|
2542
2621
|
var commonPublishShape2 = {
|
|
2543
2622
|
url: nonEmptyStringSchema.optional(),
|
|
2544
|
-
/**
|
|
2545
|
-
* Reference to registry publishing credentials. Raw tokens/passwords are intentionally not part of
|
|
2546
|
-
* SDK Config IR; the external publisher or orchestrator resolves this reference before use.
|
|
2547
|
-
*/
|
|
2623
|
+
/** Reference to registry publishing credentials. */
|
|
2548
2624
|
credentialsRef: nonEmptyStringSchema.optional(),
|
|
2625
|
+
/** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
|
|
2626
|
+
credentials: registryCredentialsSchema2.optional(),
|
|
2549
2627
|
/**
|
|
2550
2628
|
* Registry-specific package version override. If omitted, the external publisher/orchestrator may
|
|
2551
2629
|
* fall back to target.sdkVersion.
|
|
@@ -2569,6 +2647,11 @@ var mavenSignatureEnvironmentSchema = zod.z.strictObject({
|
|
|
2569
2647
|
passwordEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2570
2648
|
secretKeyEnvironmentVariable: nonEmptyStringSchema.optional()
|
|
2571
2649
|
});
|
|
2650
|
+
var mavenSignatureSchema2 = zod.z.strictObject({
|
|
2651
|
+
keyId: nonEmptyStringSchema,
|
|
2652
|
+
password: nonEmptyStringSchema,
|
|
2653
|
+
secretKey: nonEmptyStringSchema
|
|
2654
|
+
});
|
|
2572
2655
|
var publishConfigSchema = zod.z.discriminatedUnion("registry", [
|
|
2573
2656
|
zod.z.strictObject({
|
|
2574
2657
|
registry: zod.z.literal("npm"),
|
|
@@ -2614,11 +2697,10 @@ var publishConfigSchema = zod.z.discriminatedUnion("registry", [
|
|
|
2614
2697
|
passwordEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2615
2698
|
mavenUrlEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2616
2699
|
signatureEnvironmentVariables: mavenSignatureEnvironmentSchema.optional(),
|
|
2617
|
-
/**
|
|
2618
|
-
* Reference to Maven signing credentials. Raw signing keys are intentionally not part of SDK
|
|
2619
|
-
* Config IR; the external publisher or orchestrator resolves this reference before use.
|
|
2620
|
-
*/
|
|
2700
|
+
/** Reference to Maven signing credentials. */
|
|
2621
2701
|
signingCredentialsRef: nonEmptyStringSchema.optional(),
|
|
2702
|
+
/** Raw Maven signing material. These values can be sensitive and must be handled as secrets. */
|
|
2703
|
+
signature: mavenSignatureSchema2.optional(),
|
|
2622
2704
|
...commonPublishShape2
|
|
2623
2705
|
})
|
|
2624
2706
|
]);
|
|
@@ -2629,18 +2711,27 @@ var reviewersSchema2 = zod.z.strictObject({
|
|
|
2629
2711
|
var replayControlSchema = zod.z.strictObject({
|
|
2630
2712
|
enabled: zod.z.boolean()
|
|
2631
2713
|
});
|
|
2714
|
+
var githubLicenseSchema = zod.z.strictObject({
|
|
2715
|
+
/** SPDX identifier or license key for the repository license (for example, "MIT"). */
|
|
2716
|
+
type: nonEmptyStringSchema.optional(),
|
|
2717
|
+
/** Path to a custom license file to be committed into the GitHub repository. */
|
|
2718
|
+
customPath: nonEmptyStringSchema.optional()
|
|
2719
|
+
}).refine((value) => value.type !== void 0 || value.customPath !== void 0, {
|
|
2720
|
+
message: "GitHub license must set type or customPath"
|
|
2721
|
+
});
|
|
2632
2722
|
var githubOutputSchema2 = zod.z.strictObject({
|
|
2633
2723
|
repository: nonEmptyStringSchema,
|
|
2634
2724
|
host: nonEmptyStringSchema.optional(),
|
|
2635
2725
|
branch: nonEmptyStringSchema.optional(),
|
|
2636
|
-
mode: zod.z.enum(["release", "pull-request", "push"]).optional(),
|
|
2726
|
+
mode: zod.z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
|
|
2637
2727
|
reviewers: reviewersSchema2.optional(),
|
|
2638
|
-
/**
|
|
2639
|
-
* Reference to GitHub credentials. Raw tokens are intentionally not part of SDK Config IR; the
|
|
2640
|
-
* external publisher or orchestrator resolves this reference before use.
|
|
2641
|
-
*/
|
|
2728
|
+
/** Reference to GitHub credentials. */
|
|
2642
2729
|
credentialsRef: nonEmptyStringSchema.optional(),
|
|
2730
|
+
/** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
|
|
2731
|
+
credentials: registryCredentialsSchema2.optional(),
|
|
2643
2732
|
privateRepository: zod.z.boolean().optional(),
|
|
2733
|
+
/** GitHub license block scoped to repository delivery. */
|
|
2734
|
+
license: githubLicenseSchema.optional(),
|
|
2644
2735
|
/** GitHub replay control. If omitted, the external publisher applies its default behavior. */
|
|
2645
2736
|
replay: replayControlSchema.optional(),
|
|
2646
2737
|
/** Run GitHub publishing verification. Defaults to false to match current Fiddle job behavior. */
|
|
@@ -2651,10 +2742,7 @@ var githubOutputSchema2 = zod.z.strictObject({
|
|
|
2651
2742
|
autoMerge: zod.z.boolean().default(false)
|
|
2652
2743
|
});
|
|
2653
2744
|
var credentialResolutionShape = {
|
|
2654
|
-
/**
|
|
2655
|
-
* Where output credential references are resolved. SDK Config IR carries refs only; raw resolved
|
|
2656
|
-
* credentials belong at the external publisher/orchestrator boundary, not in this config.
|
|
2657
|
-
*/
|
|
2745
|
+
/** Where output credential references are resolved. */
|
|
2658
2746
|
credentialResolution: credentialResolutionSchema.default("refs-only")
|
|
2659
2747
|
};
|
|
2660
2748
|
var filesOutputSchema2 = zod.z.strictObject({
|