@postman/sdk-config 0.4.1 → 0.5.1

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.cjs CHANGED
@@ -34,6 +34,59 @@ var jsonValueSchema = zod.z.lazy(
34
34
  ])
35
35
  );
36
36
  var jsonObjectSchema = zod.z.record(zod.z.string(), jsonValueSchema);
37
+ var hashAlgorithmSchema = zod.z.enum(["sha1", "sha256", "sha384", "sha512"]);
38
+ var encodingSchema = zod.z.enum(["base64", "hex"]);
39
+ var payloadComponentSchema = zod.z.enum(["body", "timestamp", "notification-url", "message-id"]);
40
+ var payloadFormatSchema = zod.z.strictObject({
41
+ components: zod.z.array(payloadComponentSchema).min(1),
42
+ delimiter: zod.z.string().optional(),
43
+ /**
44
+ * Set when the body is a form-encoded parameter map that must be canonicalized before signing:
45
+ * keys sorted, each key's values deduped and sorted, concatenated as key-value pairs.
46
+ */
47
+ bodySort: zod.z.literal("alphabetical").optional()
48
+ });
49
+ var timestampSchema = zod.z.strictObject({
50
+ header: nonEmptyStringSchema,
51
+ format: zod.z.enum(["unix-seconds", "unix-millis", "iso8601"]).optional(),
52
+ /** Replay window in seconds. */
53
+ tolerance: zod.z.number().positive().optional()
54
+ });
55
+ var bodyHashLocationSchema = zod.z.discriminatedUnion("type", [
56
+ zod.z.strictObject({
57
+ type: zod.z.literal("query-parameter"),
58
+ name: nonEmptyStringSchema
59
+ })
60
+ ]);
61
+ var bodyHashBindingSchema = zod.z.strictObject({
62
+ algorithm: hashAlgorithmSchema,
63
+ encoding: encodingSchema.optional(),
64
+ location: bodyHashLocationSchema
65
+ });
66
+ var urlNormalizationSchema = zod.z.strictObject({
67
+ /** Try the URL with and without an explicit default port. */
68
+ portVariants: zod.z.boolean().optional(),
69
+ /** Try the URL with the pre-RFC3986 query encoding (`+` for space, unescaped `*`). */
70
+ legacyQueryEncoding: zod.z.boolean().optional()
71
+ }).refine(
72
+ ({ portVariants, legacyQueryEncoding }) => portVariants === true || legacyQueryEncoding === true,
73
+ { message: "url normalization must enable at least one variant" }
74
+ );
75
+ var webhookSignatureSchema = zod.z.discriminatedUnion("type", [
76
+ zod.z.strictObject({
77
+ type: zod.z.literal("hmac"),
78
+ /** Request header carrying the signature. */
79
+ header: nonEmptyStringSchema,
80
+ algorithm: hashAlgorithmSchema.optional(),
81
+ encoding: encodingSchema.optional(),
82
+ /** Stripped from the header value before comparison, e.g. `sha256=`. */
83
+ signaturePrefix: zod.z.string().optional(),
84
+ payloadFormat: payloadFormatSchema.optional(),
85
+ timestamp: timestampSchema.optional(),
86
+ bodyHashBinding: bodyHashBindingSchema.optional(),
87
+ urlNormalization: urlNormalizationSchema.optional()
88
+ })
89
+ ]);
37
90
 
38
91
  // src/sdk-config-domain/v1/api.ts
39
92
  var authVariableSchema = zod.z.strictObject({
@@ -192,13 +245,19 @@ var apiConfigSchema = zod.z.strictObject({
192
245
  * Absent means all audiences. A present empty array selects no tagged audience: untagged nodes
193
246
  * remain included, while every audience-tagged node is excluded.
194
247
  */
195
- audiences: zod.z.array(nonEmptyStringSchema).optional()
248
+ audiences: zod.z.array(nonEmptyStringSchema).optional(),
249
+ /**
250
+ * How the API signs the webhooks it sends, enabling a generated verification helper. API-wide, and
251
+ * independent of whether any webhook is modeled — see {@link webhookSignatureSchema}.
252
+ */
253
+ webhookSignature: webhookSignatureSchema.optional()
196
254
  });
197
255
 
198
256
  // src/sdk-config/v1/api.ts
199
257
  var sdkConfigV1AuthSchemeSchema = authSchemeSchema;
200
258
  var sdkConfigV1AuthConfigSchema = authConfigSchema;
201
259
  var sdkConfigV1ApiConfigSchema = apiConfigSchema;
260
+ var sdkConfigV1WebhookSignatureSchema = webhookSignatureSchema;
202
261
  var retryOverrideShape = {
203
262
  enabled: zod.z.boolean().optional(),
204
263
  maxAttempts: zod.z.number().int().min(1).optional(),
@@ -1187,10 +1246,16 @@ function finishOutputMapping(mapping, outputMode, sourcePath, state, index) {
1187
1246
  for (const path of collectLeafPaths(outputMode, sourcePath)) {
1188
1247
  if (path[path.length - 1] === "_visit") consume(state, path);
1189
1248
  }
1249
+ const legacyGenerateFullProject = isObject(outputMode) ? outputMode.generateFullProject : void 0;
1250
+ const generationShape = typeof legacyGenerateFullProject === "boolean" ? { generation: { ...mapping.generation, generateFullProject: legacyGenerateFullProject } } : {};
1251
+ if (typeof legacyGenerateFullProject === "boolean") {
1252
+ consume(state, [...sourcePath, "generateFullProject"]);
1253
+ }
1190
1254
  const unsupported = collectUnsupported(outputMode, sourcePath, state);
1191
1255
  const hasCredentials = unsupported.some((diagnostic) => isCredentialPath(diagnostic.path));
1192
1256
  return {
1193
1257
  ...mapping,
1258
+ ...generationShape,
1194
1259
  unsupportedFields: [
1195
1260
  ...state.credentialDiagnostics ?? [],
1196
1261
  ...hasCredentials ? [
@@ -1372,6 +1437,8 @@ var generationConfigOverrideShape = {
1372
1437
  inferServiceNames: zod.z.boolean().optional(),
1373
1438
  includeDeprecatedOperations: zod.z.boolean().optional(),
1374
1439
  multipleResponses: zod.z.boolean().optional(),
1440
+ /** Generate the entire SDK project, including package manifests and publishable artifacts. */
1441
+ generateFullProject: zod.z.boolean().optional(),
1375
1442
  devContainer: zod.z.boolean().optional(),
1376
1443
  allowMockClient: zod.z.boolean().optional(),
1377
1444
  ignoreFiles: zod.z.array(nonEmptyStringSchema).optional(),
@@ -1400,6 +1467,7 @@ var sdkConfigV1GenerationConfigSchema = zod.z.strictObject({
1400
1467
  inferServiceNames: zod.z.boolean().default(false),
1401
1468
  includeDeprecatedOperations: zod.z.boolean().default(true),
1402
1469
  multipleResponses: zod.z.boolean().default(false),
1470
+ generateFullProject: zod.z.boolean().default(false),
1403
1471
  devContainer: zod.z.boolean().default(false),
1404
1472
  allowMockClient: zod.z.boolean().default(false)
1405
1473
  });
@@ -2004,7 +2072,14 @@ function mapFernConfigToSdkConfigV1(input) {
2004
2072
  api.audiences = [...input.group.audiences.audiences];
2005
2073
  }
2006
2074
  const targets = mapped.map(
2007
- ({ generator, invocation, language, output, package: outputPackage }, index) => {
2075
+ ({
2076
+ generator,
2077
+ invocation,
2078
+ language,
2079
+ output,
2080
+ package: outputPackage,
2081
+ generation: outputGeneration
2082
+ }, index) => {
2008
2083
  const target = {
2009
2084
  language,
2010
2085
  output,
@@ -2018,6 +2093,7 @@ function mapFernConfigToSdkConfigV1(input) {
2018
2093
  }
2019
2094
  const targetGeneration = {
2020
2095
  ...generations.targetOverrides[index],
2096
+ ...outputGeneration,
2021
2097
  ...invocation.targetGeneration
2022
2098
  };
2023
2099
  if (Object.keys(targetGeneration).length > 0) {
@@ -2195,6 +2271,9 @@ function mapInvocation(generator, language, activeLanguages, index) {
2195
2271
  if (generator.keywords?.length) {
2196
2272
  generation.reservedKeywords = [...generator.keywords];
2197
2273
  }
2274
+ if (generator.generateFullProject !== void 0) {
2275
+ generation.generateFullProject = generator.generateFullProject;
2276
+ }
2198
2277
  const settings = isObject(generator.settings) ? generator.settings : void 0;
2199
2278
  if (settings) {
2200
2279
  const inlinePathParameters = takeBoolean(settings, ["inlinePathParameters"], state, [
@@ -2337,6 +2416,8 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
2337
2416
  basePath
2338
2417
  );
2339
2418
  if (webSockets !== void 0) generation.webSockets = webSockets;
2419
+ const generateFullProject = takeBoolean(config, ["generateFullProject"], state, basePath);
2420
+ if (generateFullProject !== void 0) generation.generateFullProject = generateFullProject;
2340
2421
  const inlineTypes = takeBoolean(config, ["enableInlineTypes"], state, basePath);
2341
2422
  const omitUndefined = takeBoolean(config, ["omitUndefined"], state, basePath);
2342
2423
  const forwardEnums = takeBoolean(config, ["enableForwardCompatibleEnums"], state, basePath);
@@ -2377,7 +2458,7 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
2377
2458
  case "rust":
2378
2459
  return mapRust(config, state, packageConfig, basePath);
2379
2460
  case "swift":
2380
- return compact({ moduleName: takeString(config, ["moduleName"], state, basePath) });
2461
+ return mapSwift(config, state, basePath);
2381
2462
  case "cli":
2382
2463
  return mapCli(config, state, packageConfig, basePath);
2383
2464
  case "terraform":
@@ -2544,6 +2625,12 @@ function mapRust(config, state, packageConfig, basePath) {
2544
2625
  defaultFeatures: takeStringArray(config, ["defaultFeatures"], state, basePath)
2545
2626
  });
2546
2627
  }
2628
+ function mapSwift(config, state, basePath) {
2629
+ return compact({
2630
+ moduleName: takeString(config, ["moduleName"], state, basePath),
2631
+ nullableAsOptional: takeBoolean(config, ["nullableAsOptional"], state, basePath)
2632
+ });
2633
+ }
2547
2634
  function mapCli(config, state, packageConfig, basePath) {
2548
2635
  const identity = takeObject(config, ["packageIdentity"], state, basePath);
2549
2636
  if (identity) {
@@ -2935,6 +3022,8 @@ var generationConfigSchema = zod.z.strictObject({
2935
3022
  inferServiceNames: zod.z.boolean().default(false),
2936
3023
  includeDeprecatedOperations: zod.z.boolean().default(true),
2937
3024
  multipleResponses: zod.z.boolean().default(false),
3025
+ /** Generate the entire SDK project, including package manifests and publishable artifacts. */
3026
+ generateFullProject: zod.z.boolean().default(false),
2938
3027
  devContainer: zod.z.boolean().default(false),
2939
3028
  allowMockClient: zod.z.boolean().default(false),
2940
3029
  ignoreFiles: zod.z.array(nonEmptyStringSchema).optional(),
@@ -3418,6 +3507,7 @@ exports.sdkConfigV1SwiftGenerationConfigSchema = swiftGenerationConfigSchema;
3418
3507
  exports.sdkConfigV1TargetSchema = sdkConfigV1TargetSchema;
3419
3508
  exports.sdkConfigV1TerraformGenerationConfigSchema = terraformGenerationConfigSchema;
3420
3509
  exports.sdkConfigV1TypescriptGenerationConfigSchema = typescriptGenerationConfigSchema;
3510
+ exports.sdkConfigV1WebhookSignatureSchema = sdkConfigV1WebhookSignatureSchema;
3421
3511
  exports.sourceConfigSchema = sourceConfigSchema;
3422
3512
  exports.sourceSpecConfigSchema = sourceSpecConfigSchema;
3423
3513
  exports.sourceSpecTypeSchema = sourceSpecTypeSchema;
@@ -3429,5 +3519,6 @@ exports.terraformGenerationConfigSchema = terraformGenerationConfigSchema;
3429
3519
  exports.typescriptGenerationConfigSchema = typescriptGenerationConfigSchema;
3430
3520
  exports.unsupportedFieldSchema = unsupportedFieldSchema;
3431
3521
  exports.validateSdkConfigV1 = validateSdkConfigV1;
3522
+ exports.webhookSignatureSchema = webhookSignatureSchema;
3432
3523
  //# sourceMappingURL=index.cjs.map
3433
3524
  //# sourceMappingURL=index.cjs.map