@postman/sdk-config 0.15.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 +83 -19
  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 +78 -20
  6. package/dist/index.js.map +1 -1
  7. package/dist/sdk-config/index.cjs +71 -19
  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 +68 -20
  12. package/dist/sdk-config/index.js.map +1 -1
  13. package/dist/sdk-config/v1/index.cjs +71 -19
  14. package/dist/sdk-config/v1/index.cjs.map +1 -1
  15. package/dist/sdk-config/v1/index.d.cts +230 -22
  16. package/dist/sdk-config/v1/index.d.ts +230 -22
  17. package/dist/sdk-config/v1/index.js +68 -20
  18. package/dist/sdk-config/v1/index.js.map +1 -1
  19. package/dist/sdk-config-ir/index.cjs +21 -2
  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 +20 -3
  24. package/dist/sdk-config-ir/index.js.map +1 -1
  25. package/dist/sdk-config-ir/v1/index.cjs +21 -2
  26. package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
  27. package/dist/sdk-config-ir/v1/index.d.cts +34 -3
  28. package/dist/sdk-config-ir/v1/index.d.ts +34 -3
  29. package/dist/sdk-config-ir/v1/index.js +20 -3
  30. package/dist/sdk-config-ir/v1/index.js.map +1 -1
  31. package/dist/{typescript-sGNHFomT.d.cts → typescript-D0YeGxxS.d.cts} +11 -1
  32. package/dist/{typescript-sGNHFomT.d.ts → typescript-D0YeGxxS.d.ts} +11 -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
@@ -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)) {
@@ -2488,7 +2492,8 @@ var apiImportSettingsSchema = zod.z.strictObject({
2488
2492
  ),
2489
2493
  resolveSchemaCollisions: zod.z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
2490
2494
  asyncApiMessageNaming: zod.z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
2491
- defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one.")
2495
+ defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one."),
2496
+ respectByteFormat: zod.z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
2492
2497
  });
2493
2498
  var sourceSpecTypeSchema = zod.z.enum([
2494
2499
  "openapi",
@@ -2499,28 +2504,66 @@ var sourceSpecTypeSchema = zod.z.enum([
2499
2504
  ]);
2500
2505
 
2501
2506
  // src/sdk-config/v1/source.ts
2502
- var sourceSpecShape = {
2507
+ var commonSourceSpecShape = {
2503
2508
  id: nonEmptyStringSchema.describe("A unique identifier for this API source."),
2504
- type: sourceSpecTypeSchema.describe("The API description format of this source."),
2505
2509
  name: nonEmptyStringSchema.optional().describe("A human-readable name for this API source."),
2506
2510
  namespace: nonEmptyStringSchema.optional().describe("A namespace used to isolate this source in a multi-source SDK."),
2507
- apiImportSettings: apiImportSettingsSchema.optional().describe("Import behavior that overrides the source-level defaults for this spec."),
2511
+ apiImportSettings: apiImportSettingsSchema.optional().describe("Import behavior that overrides the source-level defaults for this spec.")
2512
+ };
2513
+ var sourceSpecShape = {
2514
+ ...commonSourceSpecShape,
2515
+ type: sourceSpecTypeSchema.describe("The API description format of this source."),
2508
2516
  overlays: zod.z.array(relativePathSchema).optional().describe("Relative paths to overlays applied to this source in order."),
2509
2517
  overrides: zod.z.array(relativePathSchema).optional().describe("Relative paths to source override files applied in order.")
2510
2518
  };
2511
- var sdkConfigV1SourceSpecSchema = zod.z.union(
2512
- [
2513
- zod.z.strictObject({
2514
- ...sourceSpecShape,
2515
- path: relativePathSchema.describe("The relative path to the API source file.")
2516
- }),
2517
- zod.z.strictObject({
2518
- ...sourceSpecShape,
2519
- url: zod.z.url({ protocol: /^https?$/ }).describe("The HTTP or HTTPS URL of the API source file.")
2520
- })
2521
- ],
2522
- { error: "source spec must contain exactly one locator: path or HTTP(S) url" }
2523
- );
2519
+ var sdkConfigV1GitRemoteSchema = zod.z.strictObject({
2520
+ repo: nonEmptyStringSchema.describe("The git repository URL."),
2521
+ ref: nonEmptyStringSchema.optional().describe("The branch, tag, or commit SHA. Defaults to the repository's default branch."),
2522
+ path: relativePathSchema.describe("The path to the directory within the repository.")
2523
+ });
2524
+ var sdkConfigV1ProtobufRootSchema = zod.z.union([
2525
+ parentRelativePathSchema.describe("The relative path to the .proto directory root."),
2526
+ zod.z.strictObject({
2527
+ git: sdkConfigV1GitRemoteSchema.describe("The git remote holding the .proto files.")
2528
+ }).describe("A .proto directory root in a remote git repository.")
2529
+ ]);
2530
+ var sdkConfigV1ProtobufSourceSchema = zod.z.strictObject({
2531
+ root: sdkConfigV1ProtobufRootSchema.describe(
2532
+ "The .proto directory root, as a relative path or a git remote."
2533
+ ),
2534
+ target: parentRelativePathSchema.optional().describe("The relative path to the single .proto file that defines the API."),
2535
+ overrides: zod.z.array(parentRelativePathSchema).optional().describe("Relative paths to override files applied to the converted API in order."),
2536
+ dependencies: zod.z.array(nonEmptyStringSchema).optional().describe("Buf Schema Registry modules the .proto files depend on."),
2537
+ localGeneration: zod.z.boolean().optional().describe("Whether the .proto files are compiled locally instead of remotely."),
2538
+ fromOpenApi: zod.z.boolean().default(false).describe("Whether SDKs are generated from the OpenAPI converted from the .proto files.")
2539
+ });
2540
+ var sourceSpecOptions = [
2541
+ zod.z.strictObject({
2542
+ ...sourceSpecShape,
2543
+ path: relativePathSchema.describe("The relative path to the API source file.")
2544
+ }),
2545
+ zod.z.strictObject({
2546
+ ...sourceSpecShape,
2547
+ url: zod.z.url({ protocol: /^https?$/ }).describe("The HTTP or HTTPS URL of the API source file.")
2548
+ }),
2549
+ zod.z.strictObject({
2550
+ ...commonSourceSpecShape,
2551
+ proto: sdkConfigV1ProtobufSourceSchema.describe("The protobuf definitions of this source.")
2552
+ })
2553
+ ];
2554
+ var protobufSourceSpecOptionIndex = 2;
2555
+ function hasProtoLocator(input) {
2556
+ return typeof input === "object" && input !== null && "proto" in input;
2557
+ }
2558
+ var sdkConfigV1SourceSpecSchema = zod.z.union(sourceSpecOptions, {
2559
+ error: (issue) => {
2560
+ if (issue.code !== "invalid_union" || !hasProtoLocator(issue.input)) {
2561
+ return "source spec must contain exactly one locator: path, HTTP(S) url, or proto";
2562
+ }
2563
+ const details = (issue.errors[protobufSourceSpecOptionIndex] ?? []).map(({ path, message }) => path.length ? `${path.join(".")}: ${message}` : message).join("; ");
2564
+ return `protobuf source spec is invalid: ${details}`;
2565
+ }
2566
+ });
2524
2567
  var sdkConfigV1SourceConfigSchema = zod.z.strictObject({
2525
2568
  specs: zod.z.array(sdkConfigV1SourceSpecSchema).min(1, "source.specs must contain at least one source spec").describe("API source files in authoritative processing order."),
2526
2569
  apiImportSettings: apiImportSettingsSchema.optional().describe("Default import behavior shared by every source spec.")
@@ -2554,7 +2597,9 @@ var goGenerationConfigSchema = zod.z.strictObject({
2554
2597
  /** Overrides the fern root-client constructor independently from the client type name. */
2555
2598
  clientConstructorName: nonEmptyStringSchema.optional().describe("The generated root-client constructor name."),
2556
2599
  unionVersion: zod.z.enum(["v0", "v1"]).optional().describe("The representation used for generated Go unions."),
2557
- includeLegacyClientOptions: zod.z.boolean().optional().describe("Whether the client retains legacy constructor option helpers.")
2600
+ includeLegacyClientOptions: zod.z.boolean().optional().describe("Whether the client retains legacy constructor option helpers."),
2601
+ /** `root` keeps Fern's layout; `types` moves the schema types into a `types` subpackage. */
2602
+ packageLayout: zod.z.enum(["root", "types"]).optional().describe("Where the generated Go schema types are declared.")
2558
2603
  });
2559
2604
  var jvmGenerationConfigSchema = zod.z.strictObject({
2560
2605
  packageLayout: zod.z.enum(["flat", "nested"]).optional().describe("Whether generated JVM packages use a flat or nested resource layout."),
@@ -3727,7 +3772,10 @@ function mapGo(config, state, packageConfig, basePath) {
3727
3772
  state,
3728
3773
  basePath
3729
3774
  ),
3730
- clientConstructorName: takeString(config, ["clientConstructorName"], state, basePath)
3775
+ clientConstructorName: takeString(config, ["clientConstructorName"], state, basePath),
3776
+ // One alias covers every spelling: `locate` compares through `normalizeKey`, which strips `-`
3777
+ // and `_` and lowercases, so `package-layout` in generators.yml matches too.
3778
+ packageLayout: takeEnum(config, ["packageLayout"], ["root", "types"], state, basePath)
3731
3779
  });
3732
3780
  }
3733
3781
  function mapCsharp(config, state, packageConfig, basePath) {
@@ -4245,6 +4293,7 @@ exports.sdkConfigV1DocsConfigSchema = sdkConfigV1DocsConfigSchema;
4245
4293
  exports.sdkConfigV1ExactSemverSchema = exactSemverSchema;
4246
4294
  exports.sdkConfigV1GenerationConfigOverrideSchema = sdkConfigV1GenerationConfigOverrideSchema;
4247
4295
  exports.sdkConfigV1GenerationConfigSchema = sdkConfigV1GenerationConfigSchema;
4296
+ exports.sdkConfigV1GitRemoteSchema = sdkConfigV1GitRemoteSchema;
4248
4297
  exports.sdkConfigV1GithubActionsSecretNameSchema = githubActionsSecretNameSchema;
4249
4298
  exports.sdkConfigV1GoGenerationConfigSchema = goGenerationConfigSchema;
4250
4299
  exports.sdkConfigV1GoModulePathSchema = goModulePathSchema;
@@ -4254,7 +4303,10 @@ exports.sdkConfigV1McpGenerationConfigSchema = mcpGenerationConfigSchema;
4254
4303
  exports.sdkConfigV1NonEmptyStringSchema = nonEmptyStringSchema;
4255
4304
  exports.sdkConfigV1OutputConfigSchema = sdkConfigV1OutputConfigSchema;
4256
4305
  exports.sdkConfigV1PackageConfigSchema = sdkConfigV1PackageConfigSchema;
4306
+ exports.sdkConfigV1ParentRelativePathSchema = parentRelativePathSchema;
4257
4307
  exports.sdkConfigV1PhpGenerationConfigSchema = phpGenerationConfigSchema;
4308
+ exports.sdkConfigV1ProtobufRootSchema = sdkConfigV1ProtobufRootSchema;
4309
+ exports.sdkConfigV1ProtobufSourceSchema = sdkConfigV1ProtobufSourceSchema;
4258
4310
  exports.sdkConfigV1PublishConfigSchema = sdkConfigV1PublishConfigSchema;
4259
4311
  exports.sdkConfigV1PublishRegistrySchema = sdkConfigV1PublishRegistrySchema;
4260
4312
  exports.sdkConfigV1PythonGenerationConfigSchema = pythonGenerationConfigSchema;