@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/dist/index.js CHANGED
@@ -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({
@@ -2533,13 +2606,18 @@ var credentialResolutionSchema = z.enum([
2533
2606
  "resolved-by-orchestrator",
2534
2607
  "resolved-by-fiddle"
2535
2608
  ]);
2609
+ var registryCredentialsSchema2 = z.strictObject({
2610
+ username: nonEmptyStringSchema.optional(),
2611
+ password: nonEmptyStringSchema.optional(),
2612
+ token: nonEmptyStringSchema.optional(),
2613
+ apiKey: nonEmptyStringSchema.optional()
2614
+ });
2536
2615
  var commonPublishShape2 = {
2537
2616
  url: nonEmptyStringSchema.optional(),
2538
- /**
2539
- * Reference to registry publishing credentials. Raw tokens/passwords are intentionally not part of
2540
- * SDK Config IR; the external publisher or orchestrator resolves this reference before use.
2541
- */
2617
+ /** Reference to registry publishing credentials. */
2542
2618
  credentialsRef: nonEmptyStringSchema.optional(),
2619
+ /** Raw registry credentials. These values can be sensitive and must be handled as secrets. */
2620
+ credentials: registryCredentialsSchema2.optional(),
2543
2621
  /**
2544
2622
  * Registry-specific package version override. If omitted, the external publisher/orchestrator may
2545
2623
  * fall back to target.sdkVersion.
@@ -2563,6 +2641,11 @@ var mavenSignatureEnvironmentSchema = z.strictObject({
2563
2641
  passwordEnvironmentVariable: nonEmptyStringSchema.optional(),
2564
2642
  secretKeyEnvironmentVariable: nonEmptyStringSchema.optional()
2565
2643
  });
2644
+ var mavenSignatureSchema2 = z.strictObject({
2645
+ keyId: nonEmptyStringSchema,
2646
+ password: nonEmptyStringSchema,
2647
+ secretKey: nonEmptyStringSchema
2648
+ });
2566
2649
  var publishConfigSchema = z.discriminatedUnion("registry", [
2567
2650
  z.strictObject({
2568
2651
  registry: z.literal("npm"),
@@ -2608,11 +2691,10 @@ var publishConfigSchema = z.discriminatedUnion("registry", [
2608
2691
  passwordEnvironmentVariable: nonEmptyStringSchema.optional(),
2609
2692
  mavenUrlEnvironmentVariable: nonEmptyStringSchema.optional(),
2610
2693
  signatureEnvironmentVariables: mavenSignatureEnvironmentSchema.optional(),
2611
- /**
2612
- * Reference to Maven signing credentials. Raw signing keys are intentionally not part of SDK
2613
- * Config IR; the external publisher or orchestrator resolves this reference before use.
2614
- */
2694
+ /** Reference to Maven signing credentials. */
2615
2695
  signingCredentialsRef: nonEmptyStringSchema.optional(),
2696
+ /** Raw Maven signing material. These values can be sensitive and must be handled as secrets. */
2697
+ signature: mavenSignatureSchema2.optional(),
2616
2698
  ...commonPublishShape2
2617
2699
  })
2618
2700
  ]);
@@ -2623,18 +2705,27 @@ var reviewersSchema2 = z.strictObject({
2623
2705
  var replayControlSchema = z.strictObject({
2624
2706
  enabled: z.boolean()
2625
2707
  });
2708
+ var githubLicenseSchema = z.strictObject({
2709
+ /** SPDX identifier or license key for the repository license (for example, "MIT"). */
2710
+ type: nonEmptyStringSchema.optional(),
2711
+ /** Path to a custom license file to be committed into the GitHub repository. */
2712
+ customPath: nonEmptyStringSchema.optional()
2713
+ }).refine((value) => value.type !== void 0 || value.customPath !== void 0, {
2714
+ message: "GitHub license must set type or customPath"
2715
+ });
2626
2716
  var githubOutputSchema2 = z.strictObject({
2627
2717
  repository: nonEmptyStringSchema,
2628
2718
  host: nonEmptyStringSchema.optional(),
2629
2719
  branch: nonEmptyStringSchema.optional(),
2630
- mode: z.enum(["release", "pull-request", "push"]).optional(),
2720
+ mode: z.enum(["release", "pull-request", "push", "commit", "commit-and-release"]).optional(),
2631
2721
  reviewers: reviewersSchema2.optional(),
2632
- /**
2633
- * Reference to GitHub credentials. Raw tokens are intentionally not part of SDK Config IR; the
2634
- * external publisher or orchestrator resolves this reference before use.
2635
- */
2722
+ /** Reference to GitHub credentials. */
2636
2723
  credentialsRef: nonEmptyStringSchema.optional(),
2724
+ /** Raw GitHub credentials. These values can be sensitive and must be handled as secrets. */
2725
+ credentials: registryCredentialsSchema2.optional(),
2637
2726
  privateRepository: z.boolean().optional(),
2727
+ /** GitHub license block scoped to repository delivery. */
2728
+ license: githubLicenseSchema.optional(),
2638
2729
  /** GitHub replay control. If omitted, the external publisher applies its default behavior. */
2639
2730
  replay: replayControlSchema.optional(),
2640
2731
  /** Run GitHub publishing verification. Defaults to false to match current Fiddle job behavior. */
@@ -2645,10 +2736,7 @@ var githubOutputSchema2 = z.strictObject({
2645
2736
  autoMerge: z.boolean().default(false)
2646
2737
  });
2647
2738
  var credentialResolutionShape = {
2648
- /**
2649
- * Where output credential references are resolved. SDK Config IR carries refs only; raw resolved
2650
- * credentials belong at the external publisher/orchestrator boundary, not in this config.
2651
- */
2739
+ /** Where output credential references are resolved. */
2652
2740
  credentialResolution: credentialResolutionSchema.default("refs-only")
2653
2741
  };
2654
2742
  var filesOutputSchema2 = z.strictObject({