@postman/sdk-config 0.4.1 → 0.5.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.
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(),
@@ -2377,7 +2436,7 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
2377
2436
  case "rust":
2378
2437
  return mapRust(config, state, packageConfig, basePath);
2379
2438
  case "swift":
2380
- return compact({ moduleName: takeString(config, ["moduleName"], state, basePath) });
2439
+ return mapSwift(config, state, basePath);
2381
2440
  case "cli":
2382
2441
  return mapCli(config, state, packageConfig, basePath);
2383
2442
  case "terraform":
@@ -2544,6 +2603,12 @@ function mapRust(config, state, packageConfig, basePath) {
2544
2603
  defaultFeatures: takeStringArray(config, ["defaultFeatures"], state, basePath)
2545
2604
  });
2546
2605
  }
2606
+ function mapSwift(config, state, basePath) {
2607
+ return compact({
2608
+ moduleName: takeString(config, ["moduleName"], state, basePath),
2609
+ nullableAsOptional: takeBoolean(config, ["nullableAsOptional"], state, basePath)
2610
+ });
2611
+ }
2547
2612
  function mapCli(config, state, packageConfig, basePath) {
2548
2613
  const identity = takeObject(config, ["packageIdentity"], state, basePath);
2549
2614
  if (identity) {
@@ -3418,6 +3483,7 @@ exports.sdkConfigV1SwiftGenerationConfigSchema = swiftGenerationConfigSchema;
3418
3483
  exports.sdkConfigV1TargetSchema = sdkConfigV1TargetSchema;
3419
3484
  exports.sdkConfigV1TerraformGenerationConfigSchema = terraformGenerationConfigSchema;
3420
3485
  exports.sdkConfigV1TypescriptGenerationConfigSchema = typescriptGenerationConfigSchema;
3486
+ exports.sdkConfigV1WebhookSignatureSchema = sdkConfigV1WebhookSignatureSchema;
3421
3487
  exports.sourceConfigSchema = sourceConfigSchema;
3422
3488
  exports.sourceSpecConfigSchema = sourceSpecConfigSchema;
3423
3489
  exports.sourceSpecTypeSchema = sourceSpecTypeSchema;
@@ -3429,5 +3495,6 @@ exports.terraformGenerationConfigSchema = terraformGenerationConfigSchema;
3429
3495
  exports.typescriptGenerationConfigSchema = typescriptGenerationConfigSchema;
3430
3496
  exports.unsupportedFieldSchema = unsupportedFieldSchema;
3431
3497
  exports.validateSdkConfigV1 = validateSdkConfigV1;
3498
+ exports.webhookSignatureSchema = webhookSignatureSchema;
3432
3499
  //# sourceMappingURL=index.cjs.map
3433
3500
  //# sourceMappingURL=index.cjs.map