@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.
@@ -283,8 +283,8 @@ var clientConfigSchema = zod.z.strictObject({
283
283
  var sdkConfigV1ClientConfigSchema = clientConfigSchema;
284
284
  var sdkConfigV1ClientConfigOverrideSchema = clientConfigOverrideSchema;
285
285
  var goModulePathSchema = relativePathSchema.regex(
286
- /^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)+$/,
287
- "Go module path must be a slash-delimited path using letters, numbers, dots, dashes, underscores, or tildes"
286
+ /^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*$/,
287
+ "Go module path must use letters, numbers, dots, dashes, underscores or tildes, in slash-delimited segments"
288
288
  );
289
289
  var composerPackageNameSchema = nonEmptyStringSchema.regex(
290
290
  /^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$/,
@@ -549,6 +549,9 @@ function compact(value) {
549
549
  function optional(key, value) {
550
550
  return value === void 0 ? {} : { [key]: value };
551
551
  }
552
+ function optionalObject(key, value) {
553
+ return Object.keys(value).length === 0 ? {} : { [key]: value };
554
+ }
552
555
  function isObject(value) {
553
556
  return value !== null && typeof value === "object" && !Array.isArray(value);
554
557
  }
@@ -708,6 +711,7 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
708
711
  if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
709
712
  if (stringValue(value.host)) consume(state, [...sourcePath, "host"]);
710
713
  if (stringValue(value.branch)) consume(state, [...sourcePath, "branch"]);
714
+ const credentials = mapCredentials(value.credentials, [...sourcePath, "credentials"], state);
711
715
  return {
712
716
  output: {
713
717
  delivery: "github",
@@ -716,13 +720,58 @@ function githubOutput(value, publishInfo, language, sourcePath, state, index) {
716
720
  ...optional("host", stringValue(value.host)),
717
721
  ...optional("branch", stringValue(value.branch)),
718
722
  mode: value.makePr === true || type === "pullRequest" ? "pull-request" : type === "push" ? "push" : "release",
719
- ...optional("reviewers", reviewers)
723
+ ...optional("reviewers", reviewers),
724
+ ...optional("credentials", credentials)
720
725
  },
721
726
  ...publication ? { publish: publication.publish } : {}
722
727
  },
723
728
  ...optional("package", publication?.package)
724
729
  };
725
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
+ }
726
775
  function mapReviewers(value, sourcePath, state) {
727
776
  if (Array.isArray(value)) {
728
777
  const teams2 = reviewerNames(value, "team", sourcePath, state);
@@ -766,11 +815,13 @@ function mapPublication(value, language, sourcePath, state, index) {
766
815
  const registry = publicationRegistry(type, language, [...sourcePath, "type"], index);
767
816
  const registryUrl = stringValue(nested.registryUrl);
768
817
  if (registryUrl) consume(state, [...nestedPath, "registryUrl"]);
818
+ const credentials = mapInlineCredentials(nested, nestedPath, state);
769
819
  if (registry === "maven") {
770
820
  const coordinate = stringValue(nested.coordinate);
821
+ const signature = mapMavenSignature(nested.signature, [...nestedPath, "signature"], state);
771
822
  if (coordinate) consume(state, [...nestedPath, "coordinate"]);
772
823
  return {
773
- publish: compact({ registry, url: registryUrl }),
824
+ publish: compact({ registry, url: registryUrl, credentials, signature }),
774
825
  ...coordinate ? { package: mavenPackage(coordinate, [...nestedPath, "coordinate"], index) } : {}
775
826
  };
776
827
  }
@@ -779,7 +830,7 @@ function mapPublication(value, language, sourcePath, state, index) {
779
830
  if (packageName) consume(state, [...nestedPath, packageNameField]);
780
831
  const metadata = registry === "pypi" ? mapPypiMetadata(nested.pypiMetadata, nestedPath, state) : {};
781
832
  return {
782
- publish: compact({ registry, url: registryUrl }),
833
+ publish: compact({ registry, url: registryUrl, credentials }),
783
834
  ...packageName || Object.keys(metadata).length ? { package: { ...optional("packageName", packageName), ...metadata } } : {}
784
835
  };
785
836
  }
@@ -896,7 +947,11 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
896
947
  code: "FERN_OUTPUT_CREDENTIAL_UNSUPPORTED",
897
948
  severity: "warning",
898
949
  path: sourcePath,
899
- 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",
900
955
  suggestedAction: "Provide publishing credentials through the build request or external secret resolution."
901
956
  }
902
957
  ] : [],
@@ -1116,15 +1171,33 @@ var sdkConfigV1PublishRegistrySchema = zod.z.enum([
1116
1171
  "go",
1117
1172
  "composer"
1118
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
+ });
1119
1185
  var commonPublishShape = {
1120
1186
  url: nonEmptyStringSchema.optional(),
1187
+ /** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
1188
+ credentials: registryCredentialsSchema.optional(),
1121
1189
  releaseBranch: nonEmptyStringSchema.optional(),
1122
1190
  tolerateRepublish: zod.z.boolean().optional()
1123
1191
  };
1124
1192
  var sdkConfigV1PublishConfigSchema = zod.z.discriminatedUnion("registry", [
1125
1193
  zod.z.strictObject({ registry: zod.z.literal("npm"), ...commonPublishShape }),
1126
1194
  zod.z.strictObject({ registry: zod.z.literal("pypi"), ...commonPublishShape }),
1127
- 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
+ }),
1128
1201
  zod.z.strictObject({ registry: zod.z.literal("nuget"), ...commonPublishShape }),
1129
1202
  zod.z.strictObject({ registry: zod.z.literal("rubygems"), ...commonPublishShape }),
1130
1203
  zod.z.strictObject({ registry: zod.z.literal("crates"), ...commonPublishShape }),
@@ -1135,12 +1208,15 @@ var reviewersSchema = zod.z.strictObject({
1135
1208
  teams: zod.z.array(nonEmptyStringSchema).optional(),
1136
1209
  users: zod.z.array(nonEmptyStringSchema).optional()
1137
1210
  });
1211
+ var githubCredentialsSchema = registryCredentialsSchema;
1138
1212
  var githubOutputSchema = zod.z.strictObject({
1139
1213
  repository: nonEmptyStringSchema,
1140
1214
  host: nonEmptyStringSchema.optional(),
1141
1215
  branch: nonEmptyStringSchema.optional(),
1142
- mode: zod.z.enum(["release", "pull-request", "push"]).optional(),
1216
+ mode: zod.z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
1143
1217
  reviewers: reviewersSchema.optional(),
1218
+ /** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
1219
+ credentials: githubCredentialsSchema.optional(),
1144
1220
  privateRepository: zod.z.boolean().optional()
1145
1221
  });
1146
1222
  var filesOutputSchema = zod.z.strictObject({
@@ -1558,12 +1634,12 @@ var sdkConfigV1Schema = zod.z.strictObject({
1558
1634
  sdkVersion: nonEmptyStringSchema.default("1.0.0"),
1559
1635
  apiVersion: nonEmptyStringSchema.optional(),
1560
1636
  source: sdkConfigV1SourceConfigSchema,
1561
- api: sdkConfigV1ApiConfigSchema,
1562
- client: sdkConfigV1ClientConfigSchema,
1563
- package: sdkConfigV1PackageConfigSchema,
1637
+ api: sdkConfigV1ApiConfigSchema.prefault({}),
1638
+ client: sdkConfigV1ClientConfigSchema.prefault({}),
1639
+ package: sdkConfigV1PackageConfigSchema.prefault({}),
1564
1640
  output: sdkConfigV1OutputConfigSchema.optional(),
1565
- docs: sdkConfigV1DocsConfigSchema,
1566
- generation: sdkConfigV1GenerationConfigSchema,
1641
+ docs: sdkConfigV1DocsConfigSchema.prefault({}),
1642
+ generation: sdkConfigV1GenerationConfigSchema.prefault({}),
1567
1643
  targets: zod.z.array(sdkConfigV1TargetSchema).min(1)
1568
1644
  }).superRefine(({ output, package: globalPackage, targets }, context) => {
1569
1645
  const configuredLanguages = /* @__PURE__ */ new Set();
@@ -1679,11 +1755,10 @@ function mapFernConfigToSdkConfigV1(input) {
1679
1755
  source: input.source,
1680
1756
  ...optional("sdkVersion", input.sdkVersion),
1681
1757
  ...optional("apiVersion", input.apiVersion),
1682
- api,
1683
- client: clients.shared,
1684
- package: {},
1685
- docs: docs.shared,
1686
- generation: generations.shared,
1758
+ ...optionalObject("api", api),
1759
+ ...optionalObject("client", clients.shared),
1760
+ ...optionalObject("docs", docs.shared),
1761
+ ...optionalObject("generation", generations.shared),
1687
1762
  targets
1688
1763
  };
1689
1764
  const parsed = sdkConfigV1Schema.safeParse(sdkConfig);