@vouchington/request-contract-validation 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -20,3 +20,5 @@ Applications supply generated or hand-written contracts and decide authenticatio
20
20
  rate limits, request lifecycle, HTTP status, and error mapping. Header names in object inputs are
21
21
  lowercased before validation; case-insensitive duplicates are rejected when a header contract is
22
22
  present. This package has no generated bundle or shared registry.
23
+
24
+ `hasInputCarriers(operation)` reports whether an operation declares a contract for any carrier.
package/dist/index.d.mts CHANGED
@@ -12,6 +12,8 @@ export declare class RequestContractValidatorRegistry {
12
12
  private readonly validators;
13
13
  constructor(bundle: RequestContractsBundle);
14
14
  hasOperation(operation: string): boolean;
15
+ /** True when the operation declares a contract for at least one carrier; false if unknown. */
16
+ hasInputCarriers(operation: string): boolean;
15
17
  validateBody(operation: string, value: unknown): RequestValidationError | null;
16
18
  validate(operation: string, carrier: RequestCarrier, value: unknown): RequestValidationError | null;
17
19
  validateOperation(operation: string, input: Partial<Record<RequestCarrier, unknown>>): RequestValidationError | null;
package/dist/index.mjs CHANGED
@@ -35,6 +35,11 @@ export class RequestContractValidatorRegistry {
35
35
  hasOperation(operation) {
36
36
  return this.validators.has(operation);
37
37
  }
38
+ /** True when the operation declares a contract for at least one carrier; false if unknown. */
39
+ hasInputCarriers(operation) {
40
+ const validators = this.validators.get(operation);
41
+ return validators !== undefined && requestCarriers.some((carrier) => carrier in validators);
42
+ }
38
43
  validateBody(operation, value) {
39
44
  return this.validate(operation, 'body', value);
40
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchington/request-contract-validation",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Bundle-injected runtime validation of request contract carriers.",
5
5
  "homepage": "https://github.com/vouchington/vouchington-platform/tree/main/packages/request-contract-validation#readme",
6
6
  "bugs": {
@@ -31,15 +31,14 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "scripts": {
35
- "build": "tsc --project tsconfig.build.json",
36
- "prepack": "pnpm run build"
37
- },
38
34
  "dependencies": {
39
35
  "ajv": "^8.20.0",
40
36
  "ajv-formats": "^3.0.1"
41
37
  },
42
38
  "engines": {
43
39
  "node": ">=24.0.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc --project tsconfig.build.json"
44
43
  }
45
- }
44
+ }