rtblint-core 0.4.0 → 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/LICENSE CHANGED
@@ -170,7 +170,7 @@
170
170
  END OF TERMS AND CONDITIONS
171
171
 
172
172
  Copyright 2026 aleksUIX
173
- https://github.com/aleksUIX/vastlint
173
+ https://github.com/aleksUIX/rtblint
174
174
 
175
175
  Licensed under the Apache License, Version 2.0 (the "License");
176
176
  you may not use this file except in compliance with the License.
package/index.cjs CHANGED
@@ -28,6 +28,19 @@ function validateResponse(input, version) {
28
28
  : wasm.validate_response_version(version, input);
29
29
  }
30
30
 
31
+ /**
32
+ * Validate an OpenRTB bid response against the bid request it answers.
33
+ * Runs the full response validation plus cross-checks: impid resolution,
34
+ * mtype and adm markup coherence against the referenced Imp's media
35
+ * subtypes, dealid, seat, and currency constraints.
36
+ * @param {string} response - Raw bid response JSON.
37
+ * @param {string} request - Raw bid request JSON (the originating request).
38
+ * @param {string} [version] - OpenRTB version id (default: latest tracked 2.6 snapshot).
39
+ */
40
+ function validateResponseAgainstRequest(response, request, version) {
41
+ return wasm.validate_response_against_request(version ?? "", request, response);
42
+ }
43
+
31
44
  /** Every tracked OpenRTB version id. */
32
45
  function versions() {
33
46
  return wasm.versions();
@@ -43,4 +56,11 @@ function coreVersion() {
43
56
  return wasm.core_version();
44
57
  }
45
58
 
46
- module.exports = { validate, validateResponse, versions, rules, coreVersion };
59
+ module.exports = {
60
+ validate,
61
+ validateResponse,
62
+ validateResponseAgainstRequest,
63
+ versions,
64
+ rules,
65
+ coreVersion,
66
+ };
package/index.d.ts CHANGED
@@ -38,6 +38,21 @@ export function validate(input: string, version?: string): ValidationResult;
38
38
  */
39
39
  export function validateResponse(input: string, version?: string): ValidationResult;
40
40
 
41
+ /**
42
+ * Validate an OpenRTB bid response against the bid request it answers.
43
+ * Runs the full response validation plus cross-checks: impid resolution,
44
+ * mtype and adm markup coherence against the referenced Imp's media
45
+ * subtypes, dealid, seat, and currency constraints.
46
+ * @param response Raw bid response JSON.
47
+ * @param request Raw bid request JSON (the originating request).
48
+ * @param version OpenRTB version id, e.g. "2.6-202505" (default: latest tracked 2.6 snapshot).
49
+ */
50
+ export function validateResponseAgainstRequest(
51
+ response: string,
52
+ request: string,
53
+ version?: string
54
+ ): ValidationResult;
55
+
41
56
  /** Every tracked OpenRTB version id. */
42
57
  export function versions(): string[];
43
58
 
package/index.mjs CHANGED
@@ -29,6 +29,19 @@ export function validateResponse(input, version) {
29
29
  : wasm.validate_response_version(version, input);
30
30
  }
31
31
 
32
+ /**
33
+ * Validate an OpenRTB bid response against the bid request it answers.
34
+ * Runs the full response validation plus cross-checks: impid resolution,
35
+ * mtype and adm markup coherence against the referenced Imp's media
36
+ * subtypes, dealid, seat, and currency constraints.
37
+ * @param {string} response - Raw bid response JSON.
38
+ * @param {string} request - Raw bid request JSON (the originating request).
39
+ * @param {string} [version] - OpenRTB version id (default: latest tracked 2.6 snapshot).
40
+ */
41
+ export function validateResponseAgainstRequest(response, request, version) {
42
+ return wasm.validate_response_against_request(version ?? "", request, response);
43
+ }
44
+
32
45
  /** Every tracked OpenRTB version id. */
33
46
  export function versions() {
34
47
  return wasm.versions();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rtblint-core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "OpenRTB linter: validates OpenRTB 2.x bid requests and bid responses against versioned IAB spec snapshots",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Aleks <aleks@vastlint.org>",
@@ -26,6 +26,15 @@ export function validate(input: string): any;
26
26
  */
27
27
  export function validate_response(input: string): any;
28
28
 
29
+ /**
30
+ * Validate an OpenRTB bid response against the bid request it answers, for
31
+ * a specific tracked version id. Runs the full response validation plus
32
+ * cross-checks: impid resolution, mtype and adm markup coherence against
33
+ * the referenced Imp's media subtypes, dealid, seat, and currency
34
+ * constraints. Unknown version ids fall back to the latest 2.6 snapshot.
35
+ */
36
+ export function validate_response_against_request(version_id: string, request: string, response: string): any;
37
+
29
38
  /**
30
39
  * Validate an OpenRTB bid response payload against a specific tracked version id
31
40
  * (for example "2.6-202606"). Unknown ids fall back to the latest 2.6 snapshot.
@@ -68,6 +68,32 @@ function validate_response(input) {
68
68
  }
69
69
  exports.validate_response = validate_response;
70
70
 
71
+ /**
72
+ * Validate an OpenRTB bid response against the bid request it answers, for
73
+ * a specific tracked version id. Runs the full response validation plus
74
+ * cross-checks: impid resolution, mtype and adm markup coherence against
75
+ * the referenced Imp's media subtypes, dealid, seat, and currency
76
+ * constraints. Unknown version ids fall back to the latest 2.6 snapshot.
77
+ * @param {string} version_id
78
+ * @param {string} request
79
+ * @param {string} response
80
+ * @returns {any}
81
+ */
82
+ function validate_response_against_request(version_id, request, response) {
83
+ const ptr0 = passStringToWasm0(version_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
84
+ const len0 = WASM_VECTOR_LEN;
85
+ const ptr1 = passStringToWasm0(request, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
86
+ const len1 = WASM_VECTOR_LEN;
87
+ const ptr2 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
+ const len2 = WASM_VECTOR_LEN;
89
+ const ret = wasm.validate_response_against_request(ptr0, len0, ptr1, len1, ptr2, len2);
90
+ if (ret[2]) {
91
+ throw takeFromExternrefTable0(ret[1]);
92
+ }
93
+ return takeFromExternrefTable0(ret[0]);
94
+ }
95
+ exports.validate_response_against_request = validate_response_against_request;
96
+
71
97
  /**
72
98
  * Validate an OpenRTB bid response payload against a specific tracked version id
73
99
  * (for example "2.6-202606"). Unknown ids fall back to the latest 2.6 snapshot.
Binary file
@@ -5,6 +5,7 @@ export const core_version: () => [number, number];
5
5
  export const rules: () => [number, number, number];
6
6
  export const validate: (a: number, b: number) => [number, number, number];
7
7
  export const validate_response: (a: number, b: number) => [number, number, number];
8
+ export const validate_response_against_request: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
8
9
  export const validate_response_version: (a: number, b: number, c: number, d: number) => [number, number, number];
9
10
  export const validate_version: (a: number, b: number, c: number, d: number) => [number, number, number];
10
11
  export const versions: () => [number, number, number];