@postman/sdk-config 0.3.0 → 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 +11 -6
- package/dist/index.cjs +125 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +125 -35
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +93 -18
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.js +93 -18
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +93 -18
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +4776 -10
- package/dist/sdk-config/v1/index.d.ts +4776 -10
- package/dist/sdk-config/v1/index.js +93 -18
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +34 -19
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.js +34 -19
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +34 -19
- 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 +34 -19
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +17 -10
- package/src/sdk-config-ir/v1/README.md +92 -91
package/dist/sdk-config/index.js
CHANGED
|
@@ -277,8 +277,8 @@ var clientConfigSchema = z.strictObject({
|
|
|
277
277
|
var sdkConfigV1ClientConfigSchema = clientConfigSchema;
|
|
278
278
|
var sdkConfigV1ClientConfigOverrideSchema = clientConfigOverrideSchema;
|
|
279
279
|
var goModulePathSchema = relativePathSchema.regex(
|
|
280
|
-
/^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)
|
|
281
|
-
"Go module path must
|
|
280
|
+
/^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*$/,
|
|
281
|
+
"Go module path must use letters, numbers, dots, dashes, underscores or tildes, in slash-delimited segments"
|
|
282
282
|
);
|
|
283
283
|
var composerPackageNameSchema = nonEmptyStringSchema.regex(
|
|
284
284
|
/^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$/,
|
|
@@ -543,6 +543,9 @@ function compact(value) {
|
|
|
543
543
|
function optional(key, value) {
|
|
544
544
|
return value === void 0 ? {} : { [key]: value };
|
|
545
545
|
}
|
|
546
|
+
function optionalObject(key, value) {
|
|
547
|
+
return Object.keys(value).length === 0 ? {} : { [key]: value };
|
|
548
|
+
}
|
|
546
549
|
function isObject(value) {
|
|
547
550
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
548
551
|
}
|
|
@@ -702,6 +705,7 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
|
|
|
702
705
|
if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
|
|
703
706
|
if (stringValue(value.host)) consume(state, [...sourcePath, "host"]);
|
|
704
707
|
if (stringValue(value.branch)) consume(state, [...sourcePath, "branch"]);
|
|
708
|
+
const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
|
|
705
709
|
return {
|
|
706
710
|
output: {
|
|
707
711
|
delivery: "github",
|
|
@@ -710,13 +714,58 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
|
|
|
710
714
|
...optional("host", stringValue(value.host)),
|
|
711
715
|
...optional("branch", stringValue(value.branch)),
|
|
712
716
|
mode: value.makePr === true || type === "pullRequest" ? "pull-request" : type === "push" ? "push" : "release",
|
|
713
|
-
...optional("reviewers", reviewers)
|
|
717
|
+
...optional("reviewers", reviewers),
|
|
718
|
+
...optional("credentials", credentials)
|
|
714
719
|
},
|
|
715
720
|
...publication ? { publish: publication.publish } : {}
|
|
716
721
|
},
|
|
717
722
|
...optional("package", publication?.package)
|
|
718
723
|
};
|
|
719
724
|
}
|
|
725
|
+
function mapCredentials(value, sourcePath, state) {
|
|
726
|
+
if (!isObject(value)) return void 0;
|
|
727
|
+
return credentialsFromObject(value, sourcePath, state);
|
|
728
|
+
}
|
|
729
|
+
function mapInlineCredentials(value, sourcePath, state) {
|
|
730
|
+
const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
|
|
731
|
+
if (credentials) return credentials;
|
|
732
|
+
return credentialsFromObject(value, sourcePath, state);
|
|
733
|
+
}
|
|
734
|
+
function credentialsFromObject(value, sourcePath, state) {
|
|
735
|
+
const credentials = {};
|
|
736
|
+
const username = stringValue(value.username);
|
|
737
|
+
const password = stringValue(value.password);
|
|
738
|
+
const token = stringValue(value.token);
|
|
739
|
+
const apiKey = stringValue(value.apiKey);
|
|
740
|
+
if (username) {
|
|
741
|
+
credentials.username = username;
|
|
742
|
+
consume(state, [...sourcePath, "username"]);
|
|
743
|
+
}
|
|
744
|
+
if (password) {
|
|
745
|
+
credentials.password = password;
|
|
746
|
+
consume(state, [...sourcePath, "password"]);
|
|
747
|
+
}
|
|
748
|
+
if (token) {
|
|
749
|
+
credentials.token = token;
|
|
750
|
+
consume(state, [...sourcePath, "token"]);
|
|
751
|
+
}
|
|
752
|
+
if (apiKey) {
|
|
753
|
+
credentials.apiKey = apiKey;
|
|
754
|
+
consume(state, [...sourcePath, "apiKey"]);
|
|
755
|
+
}
|
|
756
|
+
return Object.keys(credentials).length === 0 ? void 0 : credentials;
|
|
757
|
+
}
|
|
758
|
+
function mapMavenSignature(value, sourcePath, state) {
|
|
759
|
+
if (!isObject(value)) return void 0;
|
|
760
|
+
const keyId = stringValue(value.keyId);
|
|
761
|
+
const password = stringValue(value.password);
|
|
762
|
+
const secretKey = stringValue(value.secretKey);
|
|
763
|
+
if (!keyId || !password || !secretKey) return void 0;
|
|
764
|
+
consume(state, [...sourcePath, "keyId"]);
|
|
765
|
+
consume(state, [...sourcePath, "password"]);
|
|
766
|
+
consume(state, [...sourcePath, "secretKey"]);
|
|
767
|
+
return { keyId, password, secretKey };
|
|
768
|
+
}
|
|
720
769
|
function mapReviewers(value, sourcePath, state) {
|
|
721
770
|
if (Array.isArray(value)) {
|
|
722
771
|
const teams2 = reviewerNames(value, "team", sourcePath, state);
|
|
@@ -760,11 +809,13 @@ function mapPublication(value, language, sourcePath, state, index) {
|
|
|
760
809
|
const registry = publicationRegistry(type, language, [...sourcePath, "type"], index);
|
|
761
810
|
const registryUrl = stringValue(nested.registryUrl);
|
|
762
811
|
if (registryUrl) consume(state, [...nestedPath, "registryUrl"]);
|
|
812
|
+
const credentials = mapInlineCredentials(nested, nestedPath, state);
|
|
763
813
|
if (registry === "maven") {
|
|
764
814
|
const coordinate = stringValue(nested.coordinate);
|
|
815
|
+
const signature = mapMavenSignature(nested.signature, [...nestedPath, "signature"], state);
|
|
765
816
|
if (coordinate) consume(state, [...nestedPath, "coordinate"]);
|
|
766
817
|
return {
|
|
767
|
-
publish: compact({ registry, url: registryUrl }),
|
|
818
|
+
publish: compact({ registry, url: registryUrl, credentials, signature }),
|
|
768
819
|
...coordinate ? { package: mavenPackage(coordinate, [...nestedPath, "coordinate"], index) } : {}
|
|
769
820
|
};
|
|
770
821
|
}
|
|
@@ -773,7 +824,7 @@ function mapPublication(value, language, sourcePath, state, index) {
|
|
|
773
824
|
if (packageName) consume(state, [...nestedPath, packageNameField]);
|
|
774
825
|
const metadata = registry === "pypi" ? mapPypiMetadata(nested.pypiMetadata, nestedPath, state) : {};
|
|
775
826
|
return {
|
|
776
|
-
publish: compact({ registry, url: registryUrl }),
|
|
827
|
+
publish: compact({ registry, url: registryUrl, credentials }),
|
|
777
828
|
...packageName || Object.keys(metadata).length ? { package: { ...optional("packageName", packageName), ...metadata } } : {}
|
|
778
829
|
};
|
|
779
830
|
}
|
|
@@ -890,7 +941,11 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
|
|
|
890
941
|
code: "FERN_OUTPUT_CREDENTIAL_UNSUPPORTED",
|
|
891
942
|
severity: "warning",
|
|
892
943
|
path: sourcePath,
|
|
893
|
-
|
|
944
|
+
// This diagnostic only captures credential/signature fields that remained
|
|
945
|
+
// unconsumed after mapping supported registry/GitHub credentials into
|
|
946
|
+
// SDK Config v1. Supported credential shapes are carried through; this
|
|
947
|
+
// warning is about the remaining legacy-only credential fields.
|
|
948
|
+
reason: "Some Fern output credentials and signatures are intentionally excluded from SDK Config v1 when they cannot be represented in the public schema",
|
|
894
949
|
suggestedAction: "Provide publishing credentials through the build request or external secret resolution."
|
|
895
950
|
}
|
|
896
951
|
] : [],
|
|
@@ -1110,15 +1165,33 @@ var sdkConfigV1PublishRegistrySchema = z.enum([
|
|
|
1110
1165
|
"go",
|
|
1111
1166
|
"composer"
|
|
1112
1167
|
]);
|
|
1168
|
+
var registryCredentialsSchema = z.strictObject({
|
|
1169
|
+
username: nonEmptyStringSchema.optional(),
|
|
1170
|
+
password: nonEmptyStringSchema.optional(),
|
|
1171
|
+
token: nonEmptyStringSchema.optional(),
|
|
1172
|
+
apiKey: nonEmptyStringSchema.optional()
|
|
1173
|
+
});
|
|
1174
|
+
var mavenSignatureSchema = z.strictObject({
|
|
1175
|
+
keyId: nonEmptyStringSchema,
|
|
1176
|
+
password: nonEmptyStringSchema,
|
|
1177
|
+
secretKey: nonEmptyStringSchema
|
|
1178
|
+
});
|
|
1113
1179
|
var commonPublishShape = {
|
|
1114
1180
|
url: nonEmptyStringSchema.optional(),
|
|
1181
|
+
/** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
|
|
1182
|
+
credentials: registryCredentialsSchema.optional(),
|
|
1115
1183
|
releaseBranch: nonEmptyStringSchema.optional(),
|
|
1116
1184
|
tolerateRepublish: z.boolean().optional()
|
|
1117
1185
|
};
|
|
1118
1186
|
var sdkConfigV1PublishConfigSchema = z.discriminatedUnion("registry", [
|
|
1119
1187
|
z.strictObject({ registry: z.literal("npm"), ...commonPublishShape }),
|
|
1120
1188
|
z.strictObject({ registry: z.literal("pypi"), ...commonPublishShape }),
|
|
1121
|
-
z.strictObject({
|
|
1189
|
+
z.strictObject({
|
|
1190
|
+
registry: z.literal("maven"),
|
|
1191
|
+
/** Raw Maven signing material. These values can be sensitive and must be handled as secrets. */
|
|
1192
|
+
signature: mavenSignatureSchema.optional(),
|
|
1193
|
+
...commonPublishShape
|
|
1194
|
+
}),
|
|
1122
1195
|
z.strictObject({ registry: z.literal("nuget"), ...commonPublishShape }),
|
|
1123
1196
|
z.strictObject({ registry: z.literal("rubygems"), ...commonPublishShape }),
|
|
1124
1197
|
z.strictObject({ registry: z.literal("crates"), ...commonPublishShape }),
|
|
@@ -1129,12 +1202,15 @@ var reviewersSchema = z.strictObject({
|
|
|
1129
1202
|
teams: z.array(nonEmptyStringSchema).optional(),
|
|
1130
1203
|
users: z.array(nonEmptyStringSchema).optional()
|
|
1131
1204
|
});
|
|
1205
|
+
var githubCredentialsSchema = registryCredentialsSchema;
|
|
1132
1206
|
var githubOutputSchema = z.strictObject({
|
|
1133
1207
|
repository: nonEmptyStringSchema,
|
|
1134
1208
|
host: nonEmptyStringSchema.optional(),
|
|
1135
1209
|
branch: nonEmptyStringSchema.optional(),
|
|
1136
|
-
mode: z.enum(["release", "pull-request", "push"]).optional(),
|
|
1210
|
+
mode: z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
|
|
1137
1211
|
reviewers: reviewersSchema.optional(),
|
|
1212
|
+
/** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
|
|
1213
|
+
credentials: githubCredentialsSchema.optional(),
|
|
1138
1214
|
privateRepository: z.boolean().optional()
|
|
1139
1215
|
});
|
|
1140
1216
|
var filesOutputSchema = z.strictObject({
|
|
@@ -1552,12 +1628,12 @@ var sdkConfigV1Schema = z.strictObject({
|
|
|
1552
1628
|
sdkVersion: nonEmptyStringSchema.default("1.0.0"),
|
|
1553
1629
|
apiVersion: nonEmptyStringSchema.optional(),
|
|
1554
1630
|
source: sdkConfigV1SourceConfigSchema,
|
|
1555
|
-
api: sdkConfigV1ApiConfigSchema,
|
|
1556
|
-
client: sdkConfigV1ClientConfigSchema,
|
|
1557
|
-
package: sdkConfigV1PackageConfigSchema,
|
|
1631
|
+
api: sdkConfigV1ApiConfigSchema.prefault({}),
|
|
1632
|
+
client: sdkConfigV1ClientConfigSchema.prefault({}),
|
|
1633
|
+
package: sdkConfigV1PackageConfigSchema.prefault({}),
|
|
1558
1634
|
output: sdkConfigV1OutputConfigSchema.optional(),
|
|
1559
|
-
docs: sdkConfigV1DocsConfigSchema,
|
|
1560
|
-
generation: sdkConfigV1GenerationConfigSchema,
|
|
1635
|
+
docs: sdkConfigV1DocsConfigSchema.prefault({}),
|
|
1636
|
+
generation: sdkConfigV1GenerationConfigSchema.prefault({}),
|
|
1561
1637
|
targets: z.array(sdkConfigV1TargetSchema).min(1)
|
|
1562
1638
|
}).superRefine(({ output, package: globalPackage, targets }, context) => {
|
|
1563
1639
|
const configuredLanguages = /* @__PURE__ */ new Set();
|
|
@@ -1673,11 +1749,10 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
1673
1749
|
source: input.source,
|
|
1674
1750
|
...optional("sdkVersion", input.sdkVersion),
|
|
1675
1751
|
...optional("apiVersion", input.apiVersion),
|
|
1676
|
-
api,
|
|
1677
|
-
client
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
generation: generations.shared,
|
|
1752
|
+
...optionalObject("api", api),
|
|
1753
|
+
...optionalObject("client", clients.shared),
|
|
1754
|
+
...optionalObject("docs", docs.shared),
|
|
1755
|
+
...optionalObject("generation", generations.shared),
|
|
1681
1756
|
targets
|
|
1682
1757
|
};
|
|
1683
1758
|
const parsed = sdkConfigV1Schema.safeParse(sdkConfig);
|