@postman/sdk-config 0.5.1 → 0.6.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.
@@ -9308,6 +9308,12 @@ type SdkConfigV1Document = SdkConfigV1Input;
9308
9308
  declare function validateSdkConfigV1(value: unknown): SdkConfigV1Document;
9309
9309
  /** Parses SDK Config and materializes its versioned defaults for runtime resolution. */
9310
9310
  declare function parseSdkConfigV1(value: unknown): SdkConfigV1;
9311
+ /**
9312
+ * Parses a service-to-service SDK Config v1 document while ignoring additive object fields unknown
9313
+ * to this package version. Customer-authored documents should continue to use the strict parser or
9314
+ * validator so misspellings are reported.
9315
+ */
9316
+ declare function parseSdkConfigV1ForConsumption(value: unknown): SdkConfigV1;
9311
9317
 
9312
9318
  /** A source is either a local path or an HTTP(S) URL; the two locators are mutually exclusive. */
9313
9319
  declare const sdkConfigV1SourceSpecSchema: z.ZodUnion<readonly [z.ZodObject<{
@@ -16754,4 +16760,4 @@ declare class FernConfigMappingError extends Error {
16754
16760
  /** Converts one resolved Fern generator group into a validated customer-facing SDK Config. */
16755
16761
  declare function mapFernConfigToSdkConfigV1(input: FernResolvedGeneratorGroupInput): FernConfigMappingResult;
16756
16762
 
16757
- export { type FernConfigMappingDiagnostic, FernConfigMappingError, type FernConfigMappingResult, type FernResolvedGeneratorGroupInput, type FernResolvedGeneratorInput, type FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, type SdkConfigV1, type SdkConfigV1ApiConfig, type SdkConfigV1ApiConfigInput, type SdkConfigV1ClientConfig, type SdkConfigV1ClientConfigInput, type SdkConfigV1ClientConfigOverride, type SdkConfigV1Dependency, type SdkConfigV1DocsConfig, type SdkConfigV1Document, type SdkConfigV1GenerationConfig, type SdkConfigV1GenerationConfigInput, type SdkConfigV1GenerationConfigOverride, type SdkConfigV1Input, type SdkConfigV1OutputConfig, type SdkConfigV1PackageConfig, type SdkConfigV1PublishConfig, type SdkConfigV1PublishRegistry, type SdkConfigV1ReplayConfig, type SdkConfigV1SourceConfig, type SdkConfigV1SourceSpec, type SdkConfigV1Target, type SdkConfigV1WebhookSignature, type SdkConfigV1WebhookSignatureInput, mapFernConfigToSdkConfigV1, parseSdkConfigV1, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 };
16763
+ export { type FernConfigMappingDiagnostic, FernConfigMappingError, type FernConfigMappingResult, type FernResolvedGeneratorGroupInput, type FernResolvedGeneratorInput, type FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, type SdkConfigV1, type SdkConfigV1ApiConfig, type SdkConfigV1ApiConfigInput, type SdkConfigV1ClientConfig, type SdkConfigV1ClientConfigInput, type SdkConfigV1ClientConfigOverride, type SdkConfigV1Dependency, type SdkConfigV1DocsConfig, type SdkConfigV1Document, type SdkConfigV1GenerationConfig, type SdkConfigV1GenerationConfigInput, type SdkConfigV1GenerationConfigOverride, type SdkConfigV1Input, type SdkConfigV1OutputConfig, type SdkConfigV1PackageConfig, type SdkConfigV1PublishConfig, type SdkConfigV1PublishRegistry, type SdkConfigV1ReplayConfig, type SdkConfigV1SourceConfig, type SdkConfigV1SourceSpec, type SdkConfigV1Target, type SdkConfigV1WebhookSignature, type SdkConfigV1WebhookSignatureInput, mapFernConfigToSdkConfigV1, parseSdkConfigV1, parseSdkConfigV1ForConsumption, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 };
@@ -9308,6 +9308,12 @@ type SdkConfigV1Document = SdkConfigV1Input;
9308
9308
  declare function validateSdkConfigV1(value: unknown): SdkConfigV1Document;
9309
9309
  /** Parses SDK Config and materializes its versioned defaults for runtime resolution. */
9310
9310
  declare function parseSdkConfigV1(value: unknown): SdkConfigV1;
9311
+ /**
9312
+ * Parses a service-to-service SDK Config v1 document while ignoring additive object fields unknown
9313
+ * to this package version. Customer-authored documents should continue to use the strict parser or
9314
+ * validator so misspellings are reported.
9315
+ */
9316
+ declare function parseSdkConfigV1ForConsumption(value: unknown): SdkConfigV1;
9311
9317
 
9312
9318
  /** A source is either a local path or an HTTP(S) URL; the two locators are mutually exclusive. */
9313
9319
  declare const sdkConfigV1SourceSpecSchema: z.ZodUnion<readonly [z.ZodObject<{
@@ -16754,4 +16760,4 @@ declare class FernConfigMappingError extends Error {
16754
16760
  /** Converts one resolved Fern generator group into a validated customer-facing SDK Config. */
16755
16761
  declare function mapFernConfigToSdkConfigV1(input: FernResolvedGeneratorGroupInput): FernConfigMappingResult;
16756
16762
 
16757
- export { type FernConfigMappingDiagnostic, FernConfigMappingError, type FernConfigMappingResult, type FernResolvedGeneratorGroupInput, type FernResolvedGeneratorInput, type FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, type SdkConfigV1, type SdkConfigV1ApiConfig, type SdkConfigV1ApiConfigInput, type SdkConfigV1ClientConfig, type SdkConfigV1ClientConfigInput, type SdkConfigV1ClientConfigOverride, type SdkConfigV1Dependency, type SdkConfigV1DocsConfig, type SdkConfigV1Document, type SdkConfigV1GenerationConfig, type SdkConfigV1GenerationConfigInput, type SdkConfigV1GenerationConfigOverride, type SdkConfigV1Input, type SdkConfigV1OutputConfig, type SdkConfigV1PackageConfig, type SdkConfigV1PublishConfig, type SdkConfigV1PublishRegistry, type SdkConfigV1ReplayConfig, type SdkConfigV1SourceConfig, type SdkConfigV1SourceSpec, type SdkConfigV1Target, type SdkConfigV1WebhookSignature, type SdkConfigV1WebhookSignatureInput, mapFernConfigToSdkConfigV1, parseSdkConfigV1, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 };
16763
+ export { type FernConfigMappingDiagnostic, FernConfigMappingError, type FernConfigMappingResult, type FernResolvedGeneratorGroupInput, type FernResolvedGeneratorInput, type FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, type SdkConfigV1, type SdkConfigV1ApiConfig, type SdkConfigV1ApiConfigInput, type SdkConfigV1ClientConfig, type SdkConfigV1ClientConfigInput, type SdkConfigV1ClientConfigOverride, type SdkConfigV1Dependency, type SdkConfigV1DocsConfig, type SdkConfigV1Document, type SdkConfigV1GenerationConfig, type SdkConfigV1GenerationConfigInput, type SdkConfigV1GenerationConfigOverride, type SdkConfigV1Input, type SdkConfigV1OutputConfig, type SdkConfigV1PackageConfig, type SdkConfigV1PublishConfig, type SdkConfigV1PublishRegistry, type SdkConfigV1ReplayConfig, type SdkConfigV1SourceConfig, type SdkConfigV1SourceSpec, type SdkConfigV1Target, type SdkConfigV1WebhookSignature, type SdkConfigV1WebhookSignatureInput, mapFernConfigToSdkConfigV1, parseSdkConfigV1, parseSdkConfigV1ForConsumption, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 };
@@ -1333,6 +1333,113 @@ function outputDiagnostic(path, index) {
1333
1333
  suggestedAction: resolvedGuidance?.suggestedAction ?? "Review this output setting and preserve it outside SDK Config when no equivalent exists."
1334
1334
  };
1335
1335
  }
1336
+ var OMIT = /* @__PURE__ */ Symbol("omit");
1337
+ function inputJsonSchema(schema) {
1338
+ return z.toJSONSchema(schema, {
1339
+ io: "input",
1340
+ unrepresentable: "any"
1341
+ });
1342
+ }
1343
+ function stripUnknownProperties(value, schema) {
1344
+ return project(value, schema, schema);
1345
+ }
1346
+ function project(value, candidateSchema, rootSchema, omitDefaults) {
1347
+ const resolvedCandidate = resolveSchema(candidateSchema, rootSchema);
1348
+ const schema = selectSchema(value, resolvedCandidate, rootSchema);
1349
+ if (Array.isArray(value)) {
1350
+ if (!schema.items) return value;
1351
+ return value.map((item) => {
1352
+ const projected = project(item, schema.items, rootSchema);
1353
+ return projected === OMIT ? item : projected;
1354
+ });
1355
+ }
1356
+ if (!isRecord(value) || schema.type !== "object") return value;
1357
+ const entries = [];
1358
+ const properties = schema.properties ?? {};
1359
+ const unionProperties = collectAlternativeProperties(resolvedCandidate, rootSchema);
1360
+ for (const [key, propertySchema] of Object.entries(properties)) {
1361
+ if (!Object.hasOwn(value, key)) continue;
1362
+ const projected = project(value[key], propertySchema, rootSchema);
1363
+ if (projected !== OMIT) entries.push([key, projected]);
1364
+ }
1365
+ for (const [key, fieldValue] of Object.entries(value)) {
1366
+ if (Object.hasOwn(properties, key)) continue;
1367
+ if (Object.hasOwn(unionProperties, key)) {
1368
+ entries.push([key, fieldValue]);
1369
+ continue;
1370
+ }
1371
+ if (schema.additionalProperties !== false) {
1372
+ const projected = typeof schema.additionalProperties === "object" ? project(fieldValue, schema.additionalProperties, rootSchema) : fieldValue;
1373
+ if (projected !== OMIT) entries.push([key, projected]);
1374
+ }
1375
+ }
1376
+ return Object.fromEntries(entries);
1377
+ }
1378
+ function collectAlternativeProperties(schema, rootSchema) {
1379
+ const alternatives = schema.oneOf ?? schema.anyOf;
1380
+ if (!alternatives) return schema.properties ?? {};
1381
+ return Object.assign(
1382
+ {},
1383
+ ...alternatives.map((alternative) => resolveSchema(alternative, rootSchema).properties ?? {})
1384
+ );
1385
+ }
1386
+ function selectSchema(value, schema, rootSchema) {
1387
+ const alternatives = schema.oneOf ?? schema.anyOf;
1388
+ if (!alternatives || alternatives.length === 0) return schema;
1389
+ const best = alternatives.map((alternative, index) => {
1390
+ const resolved = resolveSchema(alternative, rootSchema);
1391
+ return { index, schema: resolved, score: schemaMatchScore(value, resolved) };
1392
+ }).sort((left, right) => right.score - left.score || left.index - right.index)[0];
1393
+ return best.score === Number.NEGATIVE_INFINITY ? schema : best.schema;
1394
+ }
1395
+ function schemaMatchScore(value, schema) {
1396
+ if (Object.hasOwn(schema, "const") && !deepEqual(value, schema.const)) {
1397
+ return Number.NEGATIVE_INFINITY;
1398
+ }
1399
+ if (schema.enum && !schema.enum.some((candidate) => deepEqual(value, candidate))) {
1400
+ return Number.NEGATIVE_INFINITY;
1401
+ }
1402
+ if (schema.type === "object") {
1403
+ if (!isRecord(value)) return Number.NEGATIVE_INFINITY;
1404
+ const properties = schema.properties ?? {};
1405
+ for (const [key, propertySchema] of Object.entries(properties)) {
1406
+ if (!Object.hasOwn(value, key)) continue;
1407
+ if (Object.hasOwn(propertySchema, "const") && !deepEqual(value[key], propertySchema.const)) {
1408
+ return Number.NEGATIVE_INFINITY;
1409
+ }
1410
+ }
1411
+ return Object.keys(value).filter((key) => Object.hasOwn(properties, key)).length;
1412
+ }
1413
+ if (schema.type === "array") return Array.isArray(value) ? 1 : Number.NEGATIVE_INFINITY;
1414
+ if (schema.type === "string") return typeof value === "string" ? 1 : Number.NEGATIVE_INFINITY;
1415
+ if (schema.type === "number" || schema.type === "integer") {
1416
+ return typeof value === "number" ? 1 : Number.NEGATIVE_INFINITY;
1417
+ }
1418
+ if (schema.type === "boolean") return typeof value === "boolean" ? 1 : Number.NEGATIVE_INFINITY;
1419
+ if (schema.type === "null") return value === null ? 1 : Number.NEGATIVE_INFINITY;
1420
+ return 0;
1421
+ }
1422
+ function resolveSchema(schema, rootSchema) {
1423
+ if (!schema.$ref) return schema;
1424
+ if (!schema.$ref.startsWith("#/$defs/")) return schema;
1425
+ const name = schema.$ref.slice("#/$defs/".length).replaceAll("~1", "/").replaceAll("~0", "~");
1426
+ return rootSchema.$defs?.[name] ?? schema;
1427
+ }
1428
+ function isRecord(value) {
1429
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1430
+ }
1431
+ function deepEqual(left, right) {
1432
+ if (Object.is(left, right)) return true;
1433
+ if (Array.isArray(left) && Array.isArray(right)) {
1434
+ return left.length === right.length && left.every((value, index) => deepEqual(value, right[index]));
1435
+ }
1436
+ if (isRecord(left) && isRecord(right)) {
1437
+ const leftKeys = Object.keys(left);
1438
+ const rightKeys = Object.keys(right);
1439
+ return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual(left[key], right[key]));
1440
+ }
1441
+ return false;
1442
+ }
1336
1443
  var namingConfigSchema = z.strictObject({
1337
1444
  clientName: nonEmptyStringSchema.optional(),
1338
1445
  exportedClientName: nonEmptyStringSchema.optional(),
@@ -2011,6 +2118,10 @@ function validateSdkConfigV1(value) {
2011
2118
  function parseSdkConfigV1(value) {
2012
2119
  return sdkConfigV1Schema.parse(value);
2013
2120
  }
2121
+ var sdkConfigV1InputJsonSchema = inputJsonSchema(sdkConfigV1Schema);
2122
+ function parseSdkConfigV1ForConsumption(value) {
2123
+ return parseSdkConfigV1(stripUnknownProperties(value, sdkConfigV1InputJsonSchema));
2124
+ }
2014
2125
 
2015
2126
  // src/sdk-config/v1/fern-config-mapper.ts
2016
2127
  var generatorLanguages = {
@@ -2886,6 +2997,6 @@ function takeToolsets(value, aliases, state, basePath) {
2886
2997
  return Object.fromEntries(entries.filter((entry) => entry !== void 0));
2887
2998
  }
2888
2999
 
2889
- export { FernConfigMappingError, SDK_CONFIG_V1_SCHEMA_VERSION, mapFernConfigToSdkConfigV1, parseSdkConfigV1, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, cliGenerationConfigSchema as sdkConfigV1CliGenerationConfigSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, composerPackageNameSchema as sdkConfigV1ComposerPackageNameSchema, csharpGenerationConfigSchema as sdkConfigV1CsharpGenerationConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, exactSemverSchema as sdkConfigV1ExactSemverSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, goGenerationConfigSchema as sdkConfigV1GoGenerationConfigSchema, goModulePathSchema as sdkConfigV1GoModulePathSchema, javaGenerationConfigSchema as sdkConfigV1JavaGenerationConfigSchema, kotlinGenerationConfigSchema as sdkConfigV1KotlinGenerationConfigSchema, mcpGenerationConfigSchema as sdkConfigV1McpGenerationConfigSchema, nonEmptyStringSchema as sdkConfigV1NonEmptyStringSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, phpGenerationConfigSchema as sdkConfigV1PhpGenerationConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, pythonGenerationConfigSchema as sdkConfigV1PythonGenerationConfigSchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, relativePathSchema as sdkConfigV1RelativePathSchema, sdkConfigV1ReplayConfigSchema, rubyGenerationConfigSchema as sdkConfigV1RubyGenerationConfigSchema, rustGenerationConfigSchema as sdkConfigV1RustGenerationConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, swiftGenerationConfigSchema as sdkConfigV1SwiftGenerationConfigSchema, sdkConfigV1TargetSchema, terraformGenerationConfigSchema as sdkConfigV1TerraformGenerationConfigSchema, typescriptGenerationConfigSchema as sdkConfigV1TypescriptGenerationConfigSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 };
3000
+ export { FernConfigMappingError, SDK_CONFIG_V1_SCHEMA_VERSION, mapFernConfigToSdkConfigV1, parseSdkConfigV1, parseSdkConfigV1ForConsumption, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, cliGenerationConfigSchema as sdkConfigV1CliGenerationConfigSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, composerPackageNameSchema as sdkConfigV1ComposerPackageNameSchema, csharpGenerationConfigSchema as sdkConfigV1CsharpGenerationConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, exactSemverSchema as sdkConfigV1ExactSemverSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, goGenerationConfigSchema as sdkConfigV1GoGenerationConfigSchema, goModulePathSchema as sdkConfigV1GoModulePathSchema, javaGenerationConfigSchema as sdkConfigV1JavaGenerationConfigSchema, kotlinGenerationConfigSchema as sdkConfigV1KotlinGenerationConfigSchema, mcpGenerationConfigSchema as sdkConfigV1McpGenerationConfigSchema, nonEmptyStringSchema as sdkConfigV1NonEmptyStringSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, phpGenerationConfigSchema as sdkConfigV1PhpGenerationConfigSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, pythonGenerationConfigSchema as sdkConfigV1PythonGenerationConfigSchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, relativePathSchema as sdkConfigV1RelativePathSchema, sdkConfigV1ReplayConfigSchema, rubyGenerationConfigSchema as sdkConfigV1RubyGenerationConfigSchema, rustGenerationConfigSchema as sdkConfigV1RustGenerationConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, swiftGenerationConfigSchema as sdkConfigV1SwiftGenerationConfigSchema, sdkConfigV1TargetSchema, terraformGenerationConfigSchema as sdkConfigV1TerraformGenerationConfigSchema, typescriptGenerationConfigSchema as sdkConfigV1TypescriptGenerationConfigSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 };
2890
3001
  //# sourceMappingURL=index.js.map
2891
3002
  //# sourceMappingURL=index.js.map