@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.
@@ -705,6 +705,7 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
705
705
  if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
706
706
  if (stringValue(value.host)) consume(state, [...sourcePath, "host"]);
707
707
  if (stringValue(value.branch)) consume(state, [...sourcePath, "branch"]);
708
+ const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
708
709
  return {
709
710
  output: {
710
711
  delivery: "github",
@@ -713,13 +714,58 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
713
714
  ...optional("host", stringValue(value.host)),
714
715
  ...optional("branch", stringValue(value.branch)),
715
716
  mode: value.makePr === true || type === "pullRequest" ? "pull-request" : type === "push" ? "push" : "release",
716
- ...optional("reviewers", reviewers)
717
+ ...optional("reviewers", reviewers),
718
+ ...optional("credentials", credentials)
717
719
  },
718
720
  ...publication ? { publish: publication.publish } : {}
719
721
  },
720
722
  ...optional("package", publication?.package)
721
723
  };
722
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
+ }
723
769
  function mapReviewers(value, sourcePath, state) {
724
770
  if (Array.isArray(value)) {
725
771
  const teams2 = reviewerNames(value, "team", sourcePath, state);
@@ -763,11 +809,13 @@ function mapPublication(value, language, sourcePath, state, index) {
763
809
  const registry = publicationRegistry(type, language, [...sourcePath, "type"], index);
764
810
  const registryUrl = stringValue(nested.registryUrl);
765
811
  if (registryUrl) consume(state, [...nestedPath, "registryUrl"]);
812
+ const credentials = mapInlineCredentials(nested, nestedPath, state);
766
813
  if (registry === "maven") {
767
814
  const coordinate = stringValue(nested.coordinate);
815
+ const signature = mapMavenSignature(nested.signature, [...nestedPath, "signature"], state);
768
816
  if (coordinate) consume(state, [...nestedPath, "coordinate"]);
769
817
  return {
770
- publish: compact({ registry, url: registryUrl }),
818
+ publish: compact({ registry, url: registryUrl, credentials, signature }),
771
819
  ...coordinate ? { package: mavenPackage(coordinate, [...nestedPath, "coordinate"], index) } : {}
772
820
  };
773
821
  }
@@ -776,7 +824,7 @@ function mapPublication(value, language, sourcePath, state, index) {
776
824
  if (packageName) consume(state, [...nestedPath, packageNameField]);
777
825
  const metadata = registry === "pypi" ? mapPypiMetadata(nested.pypiMetadata, nestedPath, state) : {};
778
826
  return {
779
- publish: compact({ registry, url: registryUrl }),
827
+ publish: compact({ registry, url: registryUrl, credentials }),
780
828
  ...packageName || Object.keys(metadata).length ? { package: { ...optional("packageName", packageName), ...metadata } } : {}
781
829
  };
782
830
  }
@@ -893,7 +941,11 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
893
941
  code: "FERN_OUTPUT_CREDENTIAL_UNSUPPORTED",
894
942
  severity: "warning",
895
943
  path: sourcePath,
896
- reason: "Fern output credentials and signatures are intentionally excluded from SDK Config v1",
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",
897
949
  suggestedAction: "Provide publishing credentials through the build request or external secret resolution."
898
950
  }
899
951
  ] : [],
@@ -1113,15 +1165,33 @@ var sdkConfigV1PublishRegistrySchema = z.enum([
1113
1165
  "go",
1114
1166
  "composer"
1115
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
+ });
1116
1179
  var commonPublishShape = {
1117
1180
  url: nonEmptyStringSchema.optional(),
1181
+ /** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
1182
+ credentials: registryCredentialsSchema.optional(),
1118
1183
  releaseBranch: nonEmptyStringSchema.optional(),
1119
1184
  tolerateRepublish: z.boolean().optional()
1120
1185
  };
1121
1186
  var sdkConfigV1PublishConfigSchema = z.discriminatedUnion("registry", [
1122
1187
  z.strictObject({ registry: z.literal("npm"), ...commonPublishShape }),
1123
1188
  z.strictObject({ registry: z.literal("pypi"), ...commonPublishShape }),
1124
- z.strictObject({ registry: z.literal("maven"), ...commonPublishShape }),
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
+ }),
1125
1195
  z.strictObject({ registry: z.literal("nuget"), ...commonPublishShape }),
1126
1196
  z.strictObject({ registry: z.literal("rubygems"), ...commonPublishShape }),
1127
1197
  z.strictObject({ registry: z.literal("crates"), ...commonPublishShape }),
@@ -1132,12 +1202,15 @@ var reviewersSchema = z.strictObject({
1132
1202
  teams: z.array(nonEmptyStringSchema).optional(),
1133
1203
  users: z.array(nonEmptyStringSchema).optional()
1134
1204
  });
1205
+ var githubCredentialsSchema = registryCredentialsSchema;
1135
1206
  var githubOutputSchema = z.strictObject({
1136
1207
  repository: nonEmptyStringSchema,
1137
1208
  host: nonEmptyStringSchema.optional(),
1138
1209
  branch: nonEmptyStringSchema.optional(),
1139
- mode: z.enum(["release", "pull-request", "push"]).optional(),
1210
+ mode: z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
1140
1211
  reviewers: reviewersSchema.optional(),
1212
+ /** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
1213
+ credentials: githubCredentialsSchema.optional(),
1141
1214
  privateRepository: z.boolean().optional()
1142
1215
  });
1143
1216
  var filesOutputSchema = z.strictObject({