@postman/sdk-config 0.16.0 → 0.17.0

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.
Files changed (35) hide show
  1. package/dist/index.cjs +76 -17
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +3 -3
  4. package/dist/index.d.ts +3 -3
  5. package/dist/index.js +71 -18
  6. package/dist/index.js.map +1 -1
  7. package/dist/sdk-config/index.cjs +64 -17
  8. package/dist/sdk-config/index.cjs.map +1 -1
  9. package/dist/sdk-config/index.d.cts +2 -2
  10. package/dist/sdk-config/index.d.ts +2 -2
  11. package/dist/sdk-config/index.js +61 -18
  12. package/dist/sdk-config/index.js.map +1 -1
  13. package/dist/sdk-config/v1/index.cjs +64 -17
  14. package/dist/sdk-config/v1/index.cjs.map +1 -1
  15. package/dist/sdk-config/v1/index.d.cts +222 -22
  16. package/dist/sdk-config/v1/index.d.ts +222 -22
  17. package/dist/sdk-config/v1/index.js +61 -18
  18. package/dist/sdk-config/v1/index.js.map +1 -1
  19. package/dist/sdk-config-ir/index.cjs +18 -1
  20. package/dist/sdk-config-ir/index.cjs.map +1 -1
  21. package/dist/sdk-config-ir/index.d.cts +2 -2
  22. package/dist/sdk-config-ir/index.d.ts +2 -2
  23. package/dist/sdk-config-ir/index.js +17 -2
  24. package/dist/sdk-config-ir/index.js.map +1 -1
  25. package/dist/sdk-config-ir/v1/index.cjs +18 -1
  26. package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
  27. package/dist/sdk-config-ir/v1/index.d.cts +22 -3
  28. package/dist/sdk-config-ir/v1/index.d.ts +22 -3
  29. package/dist/sdk-config-ir/v1/index.js +17 -2
  30. package/dist/sdk-config-ir/v1/index.js.map +1 -1
  31. package/dist/{typescript-Cc50beVo.d.cts → typescript-D0YeGxxS.d.cts} +6 -1
  32. package/dist/{typescript-Cc50beVo.d.ts → typescript-D0YeGxxS.d.ts} +6 -1
  33. package/package.json +1 -1
  34. package/src/sdk-config/v1/README.md +31 -0
  35. package/src/sdk-config-ir/v1/README.md +7 -0
package/dist/index.cjs CHANGED
@@ -13,6 +13,10 @@ var relativePathSchema = nonEmptyStringSchema.refine(
13
13
  (value) => !/^(?:[\\/]|[A-Za-z]:)/.test(value) && !value.split(/[\\/]/).some((segment) => segment === ".."),
14
14
  { message: "must be a relative path without parent directory segments" }
15
15
  );
16
+ var parentRelativePathSchema = nonEmptyStringSchema.refine(
17
+ (value) => !/^(?:[\\/]|[A-Za-z]:)/.test(value),
18
+ { message: "must be a relative path" }
19
+ );
16
20
  var exactSemverSchema = zod.z.string().refine(
17
21
  (value) => {
18
22
  if (value.trim() !== value || !/^\d/.test(value)) {
@@ -2500,7 +2504,8 @@ var apiImportSettingsSchema = zod.z.strictObject({
2500
2504
  ),
2501
2505
  resolveSchemaCollisions: zod.z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
2502
2506
  asyncApiMessageNaming: zod.z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
2503
- defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one.")
2507
+ defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one."),
2508
+ respectByteFormat: zod.z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
2504
2509
  });
2505
2510
  var sourceSpecTypeSchema = zod.z.enum([
2506
2511
  "openapi",
@@ -2511,28 +2516,66 @@ var sourceSpecTypeSchema = zod.z.enum([
2511
2516
  ]);
2512
2517
 
2513
2518
  // src/sdk-config/v1/source.ts
2514
- var sourceSpecShape = {
2519
+ var commonSourceSpecShape = {
2515
2520
  id: nonEmptyStringSchema.describe("A unique identifier for this API source."),
2516
- type: sourceSpecTypeSchema.describe("The API description format of this source."),
2517
2521
  name: nonEmptyStringSchema.optional().describe("A human-readable name for this API source."),
2518
2522
  namespace: nonEmptyStringSchema.optional().describe("A namespace used to isolate this source in a multi-source SDK."),
2519
- apiImportSettings: apiImportSettingsSchema.optional().describe("Import behavior that overrides the source-level defaults for this spec."),
2523
+ apiImportSettings: apiImportSettingsSchema.optional().describe("Import behavior that overrides the source-level defaults for this spec.")
2524
+ };
2525
+ var sourceSpecShape = {
2526
+ ...commonSourceSpecShape,
2527
+ type: sourceSpecTypeSchema.describe("The API description format of this source."),
2520
2528
  overlays: zod.z.array(relativePathSchema).optional().describe("Relative paths to overlays applied to this source in order."),
2521
2529
  overrides: zod.z.array(relativePathSchema).optional().describe("Relative paths to source override files applied in order.")
2522
2530
  };
2523
- var sdkConfigV1SourceSpecSchema = zod.z.union(
2524
- [
2525
- zod.z.strictObject({
2526
- ...sourceSpecShape,
2527
- path: relativePathSchema.describe("The relative path to the API source file.")
2528
- }),
2529
- zod.z.strictObject({
2530
- ...sourceSpecShape,
2531
- url: zod.z.url({ protocol: /^https?$/ }).describe("The HTTP or HTTPS URL of the API source file.")
2532
- })
2533
- ],
2534
- { error: "source spec must contain exactly one locator: path or HTTP(S) url" }
2535
- );
2531
+ var sdkConfigV1GitRemoteSchema = zod.z.strictObject({
2532
+ repo: nonEmptyStringSchema.describe("The git repository URL."),
2533
+ ref: nonEmptyStringSchema.optional().describe("The branch, tag, or commit SHA. Defaults to the repository's default branch."),
2534
+ path: relativePathSchema.describe("The path to the directory within the repository.")
2535
+ });
2536
+ var sdkConfigV1ProtobufRootSchema = zod.z.union([
2537
+ parentRelativePathSchema.describe("The relative path to the .proto directory root."),
2538
+ zod.z.strictObject({
2539
+ git: sdkConfigV1GitRemoteSchema.describe("The git remote holding the .proto files.")
2540
+ }).describe("A .proto directory root in a remote git repository.")
2541
+ ]);
2542
+ var sdkConfigV1ProtobufSourceSchema = zod.z.strictObject({
2543
+ root: sdkConfigV1ProtobufRootSchema.describe(
2544
+ "The .proto directory root, as a relative path or a git remote."
2545
+ ),
2546
+ target: parentRelativePathSchema.optional().describe("The relative path to the single .proto file that defines the API."),
2547
+ overrides: zod.z.array(parentRelativePathSchema).optional().describe("Relative paths to override files applied to the converted API in order."),
2548
+ dependencies: zod.z.array(nonEmptyStringSchema).optional().describe("Buf Schema Registry modules the .proto files depend on."),
2549
+ localGeneration: zod.z.boolean().optional().describe("Whether the .proto files are compiled locally instead of remotely."),
2550
+ fromOpenApi: zod.z.boolean().default(false).describe("Whether SDKs are generated from the OpenAPI converted from the .proto files.")
2551
+ });
2552
+ var sourceSpecOptions = [
2553
+ zod.z.strictObject({
2554
+ ...sourceSpecShape,
2555
+ path: relativePathSchema.describe("The relative path to the API source file.")
2556
+ }),
2557
+ zod.z.strictObject({
2558
+ ...sourceSpecShape,
2559
+ url: zod.z.url({ protocol: /^https?$/ }).describe("The HTTP or HTTPS URL of the API source file.")
2560
+ }),
2561
+ zod.z.strictObject({
2562
+ ...commonSourceSpecShape,
2563
+ proto: sdkConfigV1ProtobufSourceSchema.describe("The protobuf definitions of this source.")
2564
+ })
2565
+ ];
2566
+ var protobufSourceSpecOptionIndex = 2;
2567
+ function hasProtoLocator(input) {
2568
+ return typeof input === "object" && input !== null && "proto" in input;
2569
+ }
2570
+ var sdkConfigV1SourceSpecSchema = zod.z.union(sourceSpecOptions, {
2571
+ error: (issue) => {
2572
+ if (issue.code !== "invalid_union" || !hasProtoLocator(issue.input)) {
2573
+ return "source spec must contain exactly one locator: path, HTTP(S) url, or proto";
2574
+ }
2575
+ const details = (issue.errors[protobufSourceSpecOptionIndex] ?? []).map(({ path, message }) => path.length ? `${path.join(".")}: ${message}` : message).join("; ");
2576
+ return `protobuf source spec is invalid: ${details}`;
2577
+ }
2578
+ });
2536
2579
  var sdkConfigV1SourceConfigSchema = zod.z.strictObject({
2537
2580
  specs: zod.z.array(sdkConfigV1SourceSpecSchema).min(1, "source.specs must contain at least one source spec").describe("API source files in authoritative processing order."),
2538
2581
  apiImportSettings: apiImportSettingsSchema.optional().describe("Default import behavior shared by every source spec.")
@@ -4624,6 +4667,7 @@ var outputConfigSchema = zod.z.discriminatedUnion(
4624
4667
  var replayConfigSchema = zod.z.strictObject({
4625
4668
  enabled: zod.z.boolean().describe("Whether regeneration reapplies customer-authored repository changes.")
4626
4669
  });
4670
+ var sourceSpecOriginSchema = zod.z.enum(["protobuf"]);
4627
4671
  var sourceSpecConfigSchema = zod.z.strictObject({
4628
4672
  id: nonEmptyStringSchema.optional().describe("A unique identifier for this API source."),
4629
4673
  name: nonEmptyStringSchema.optional().describe("A human-readable name for this API source."),
@@ -4632,9 +4676,18 @@ var sourceSpecConfigSchema = zod.z.strictObject({
4632
4676
  "The materialized URL from which the generator retrieves the API source."
4633
4677
  ),
4634
4678
  specType: sourceSpecTypeSchema.describe("The API description format of this source."),
4679
+ origin: sourceSpecOriginSchema.optional().describe("The format this source was authored in before it was converted to specType."),
4635
4680
  apiImportSettings: apiImportSettingsSchema.optional().describe("Import behavior that overrides the source-level defaults for this spec."),
4636
4681
  overlays: zod.z.array(nonEmptyStringSchema).optional().describe("Materialized overlays applied to this source in order."),
4637
4682
  overrides: zod.z.array(nonEmptyStringSchema).optional().describe("Materialized source overrides applied in order.")
4683
+ }).superRefine(({ specType, origin }, context) => {
4684
+ if (origin === "protobuf" && specType !== "openapi") {
4685
+ context.addIssue({
4686
+ code: "custom",
4687
+ message: 'origin "protobuf" is only allowed on openapi specs',
4688
+ path: ["origin"]
4689
+ });
4690
+ }
4638
4691
  });
4639
4692
  var sourceConfigSchema = zod.z.strictObject({
4640
4693
  specs: zod.z.array(sourceSpecConfigSchema).min(1, "source.specs must contain at least one source spec").describe("Materialized API sources in authoritative processing order."),
@@ -4915,6 +4968,7 @@ exports.mcpGenerationConfigSchema = mcpGenerationConfigSchema;
4915
4968
  exports.nonEmptyStringSchema = nonEmptyStringSchema;
4916
4969
  exports.outputConfigSchema = outputConfigSchema;
4917
4970
  exports.packageConfigSchema = packageConfigSchema;
4971
+ exports.parentRelativePathSchema = parentRelativePathSchema;
4918
4972
  exports.parseSdkConfigIrV1 = parseSdkConfigIrV1;
4919
4973
  exports.parseSdkConfigIrV1ForConsumption = parseSdkConfigIrV1ForConsumption;
4920
4974
  exports.parseSdkConfigV1 = parseSdkConfigV1;
@@ -4949,6 +5003,7 @@ exports.sdkConfigV1DocsConfigSchema = sdkConfigV1DocsConfigSchema;
4949
5003
  exports.sdkConfigV1ExactSemverSchema = exactSemverSchema;
4950
5004
  exports.sdkConfigV1GenerationConfigOverrideSchema = sdkConfigV1GenerationConfigOverrideSchema;
4951
5005
  exports.sdkConfigV1GenerationConfigSchema = sdkConfigV1GenerationConfigSchema;
5006
+ exports.sdkConfigV1GitRemoteSchema = sdkConfigV1GitRemoteSchema;
4952
5007
  exports.sdkConfigV1GithubActionsSecretNameSchema = githubActionsSecretNameSchema;
4953
5008
  exports.sdkConfigV1GoGenerationConfigSchema = goGenerationConfigSchema;
4954
5009
  exports.sdkConfigV1GoModulePathSchema = goModulePathSchema;
@@ -4958,7 +5013,10 @@ exports.sdkConfigV1McpGenerationConfigSchema = mcpGenerationConfigSchema;
4958
5013
  exports.sdkConfigV1NonEmptyStringSchema = nonEmptyStringSchema;
4959
5014
  exports.sdkConfigV1OutputConfigSchema = sdkConfigV1OutputConfigSchema;
4960
5015
  exports.sdkConfigV1PackageConfigSchema = sdkConfigV1PackageConfigSchema;
5016
+ exports.sdkConfigV1ParentRelativePathSchema = parentRelativePathSchema;
4961
5017
  exports.sdkConfigV1PhpGenerationConfigSchema = phpGenerationConfigSchema;
5018
+ exports.sdkConfigV1ProtobufRootSchema = sdkConfigV1ProtobufRootSchema;
5019
+ exports.sdkConfigV1ProtobufSourceSchema = sdkConfigV1ProtobufSourceSchema;
4962
5020
  exports.sdkConfigV1PublishConfigSchema = sdkConfigV1PublishConfigSchema;
4963
5021
  exports.sdkConfigV1PublishRegistrySchema = sdkConfigV1PublishRegistrySchema;
4964
5022
  exports.sdkConfigV1PythonGenerationConfigSchema = pythonGenerationConfigSchema;
@@ -4979,6 +5037,7 @@ exports.sdkConfigV1WebhookSignatureSchema = sdkConfigV1WebhookSignatureSchema;
4979
5037
  exports.serializeSdkConfigIrV1 = serializeSdkConfigIrV1;
4980
5038
  exports.sourceConfigSchema = sourceConfigSchema;
4981
5039
  exports.sourceSpecConfigSchema = sourceSpecConfigSchema;
5040
+ exports.sourceSpecOriginSchema = sourceSpecOriginSchema;
4982
5041
  exports.sourceSpecTypeSchema = sourceSpecTypeSchema;
4983
5042
  exports.splitSdkConfigV1TargetGeneration = splitSdkConfigV1TargetGeneration;
4984
5043
  exports.swiftGenerationConfigSchema = swiftGenerationConfigSchema;