@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.
@@ -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
- reason: "Fern output credentials and signatures are intentionally excluded from SDK Config v1",
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({ registry: zod.z.literal("maven"), ...commonPublishShape }),
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({