rtblint-core 0.8.0 → 0.10.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/index.cjs CHANGED
@@ -65,6 +65,29 @@ function validateResponseDialect(input, dialect, version) {
65
65
  return wasm.validate_response_dialect(version ?? "", dialect, input);
66
66
  }
67
67
 
68
+ /**
69
+ * Validate an OpenRTB bid request against an exchange profile.
70
+ * "spec" (default) is the specification only. "google-ab" is Google
71
+ * Authorized Buyers OpenRTB: at=3 (FIXED_PRICE) is a valid auction type, and
72
+ * each Imp must carry ext.billing_id.
73
+ * @param {string} input - Raw bid request JSON.
74
+ * @param {"spec"|"google-ab"} profile - Exchange profile.
75
+ * @param {string} [version] - OpenRTB version id (default: latest tracked 2.6 snapshot).
76
+ */
77
+ function validateProfile(input, profile, version) {
78
+ return wasm.validate_profile(version ?? "", "spec-json", profile, input);
79
+ }
80
+
81
+ /**
82
+ * Validate an OpenRTB bid response against an exchange profile.
83
+ * @param {string} input - Raw bid response JSON.
84
+ * @param {"spec"|"google-ab"} profile - Exchange profile.
85
+ * @param {string} [version] - OpenRTB version id (default: latest tracked 2.6 snapshot).
86
+ */
87
+ function validateResponseProfile(input, profile, version) {
88
+ return wasm.validate_response_profile(version ?? "", "spec-json", profile, input);
89
+ }
90
+
68
91
  /** Every field the IAB OpenRTB protobuf schema types differently from the spec. */
69
92
  function protoBoolDivergences() {
70
93
  return wasm.proto_bool_divergences();
@@ -124,6 +147,8 @@ module.exports = {
124
147
  validateResponseAgainstRequest,
125
148
  validateDialect,
126
149
  validateResponseDialect,
150
+ validateProfile,
151
+ validateResponseProfile,
127
152
  protoBoolDivergences,
128
153
  validateArtfRequest,
129
154
  validateArtfResponse,
package/index.d.ts CHANGED
@@ -103,6 +103,32 @@ export function validateResponseDialect(
103
103
  version?: string
104
104
  ): ValidationResult;
105
105
 
106
+ /**
107
+ * Exchange profile applied on top of the spec. "spec" is the specification
108
+ * only. "google-ab" is Google Authorized Buyers OpenRTB: at=3 (FIXED_PRICE)
109
+ * is a valid auction type, and each Imp must carry ext.billing_id.
110
+ */
111
+ export type Profile = "spec" | "google-ab";
112
+
113
+ /**
114
+ * Validate an OpenRTB bid request against an exchange profile.
115
+ * @param input Raw bid request JSON.
116
+ * @param profile Exchange profile.
117
+ * @param version OpenRTB version id (default: latest tracked 2.6 snapshot).
118
+ */
119
+ export function validateProfile(
120
+ input: string,
121
+ profile: Profile,
122
+ version?: string
123
+ ): ValidationResult;
124
+
125
+ /** Validate an OpenRTB bid response against an exchange profile. */
126
+ export function validateResponseProfile(
127
+ input: string,
128
+ profile: Profile,
129
+ version?: string
130
+ ): ValidationResult;
131
+
106
132
  /** Every field the OpenRTB protobuf schema types differently from the spec. */
107
133
  export function protoBoolDivergences(): ProtoBoolField[];
108
134
 
package/index.mjs CHANGED
@@ -66,6 +66,29 @@ export function validateResponseDialect(input, dialect, version) {
66
66
  return wasm.validate_response_dialect(version ?? "", dialect, input);
67
67
  }
68
68
 
69
+ /**
70
+ * Validate an OpenRTB bid request against an exchange profile.
71
+ * "spec" (default) is the specification only. "google-ab" is Google
72
+ * Authorized Buyers OpenRTB: at=3 (FIXED_PRICE) is a valid auction type, and
73
+ * each Imp must carry ext.billing_id.
74
+ * @param {string} input - Raw bid request JSON.
75
+ * @param {"spec"|"google-ab"} profile - Exchange profile.
76
+ * @param {string} [version] - OpenRTB version id (default: latest tracked 2.6 snapshot).
77
+ */
78
+ export function validateProfile(input, profile, version) {
79
+ return wasm.validate_profile(version ?? "", "spec-json", profile, input);
80
+ }
81
+
82
+ /**
83
+ * Validate an OpenRTB bid response against an exchange profile.
84
+ * @param {string} input - Raw bid response JSON.
85
+ * @param {"spec"|"google-ab"} profile - Exchange profile.
86
+ * @param {string} [version] - OpenRTB version id (default: latest tracked 2.6 snapshot).
87
+ */
88
+ export function validateResponseProfile(input, profile, version) {
89
+ return wasm.validate_response_profile(version ?? "", "spec-json", profile, input);
90
+ }
91
+
69
92
  /** Every field the IAB OpenRTB protobuf schema types differently from the spec. */
70
93
  export function protoBoolDivergences() {
71
94
  return wasm.proto_bool_divergences();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rtblint-core",
3
- "version": "0.8.0",
3
+ "version": "0.10.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>",
@@ -53,6 +53,13 @@ export function validate_artf_response_applied(version_id: string, rtb_request:
53
53
  */
54
54
  export function validate_dialect(version_id: string, dialect_id: string, input: string): any;
55
55
 
56
+ /**
57
+ * Validate an OpenRTB bid request against a JSON dialect and an exchange
58
+ * profile ("spec" or "google-ab"). Empty profile id means the specification
59
+ * only. Unknown ids are rejected.
60
+ */
61
+ export function validate_profile(version_id: string, dialect_id: string, profile_id: string, input: string): any;
62
+
56
63
  /**
57
64
  * Validate an OpenRTB bid response payload against the latest tracked 2.6 snapshot.
58
65
  *
@@ -69,11 +76,23 @@ export function validate_response(input: string): any;
69
76
  */
70
77
  export function validate_response_against_request(version_id: string, request: string, response: string): any;
71
78
 
79
+ /**
80
+ * Validate an OpenRTB bid response against the bid request it answers, for
81
+ * a specific dialect and exchange profile.
82
+ */
83
+ export function validate_response_against_request_profile(version_id: string, dialect_id: string, profile_id: string, request: string, response: string): any;
84
+
72
85
  /**
73
86
  * Validate an OpenRTB bid response written in a specific JSON dialect.
74
87
  */
75
88
  export function validate_response_dialect(version_id: string, dialect_id: string, input: string): any;
76
89
 
90
+ /**
91
+ * Validate an OpenRTB bid response against a JSON dialect and an exchange
92
+ * profile.
93
+ */
94
+ export function validate_response_profile(version_id: string, dialect_id: string, profile_id: string, input: string): any;
95
+
77
96
  /**
78
97
  * Validate an OpenRTB bid response payload against a specific tracked version id
79
98
  * (for example "2.6-202606"). Unknown ids fall back to the latest 2.6 snapshot.
@@ -157,6 +157,33 @@ function validate_dialect(version_id, dialect_id, input) {
157
157
  }
158
158
  exports.validate_dialect = validate_dialect;
159
159
 
160
+ /**
161
+ * Validate an OpenRTB bid request against a JSON dialect and an exchange
162
+ * profile ("spec" or "google-ab"). Empty profile id means the specification
163
+ * only. Unknown ids are rejected.
164
+ * @param {string} version_id
165
+ * @param {string} dialect_id
166
+ * @param {string} profile_id
167
+ * @param {string} input
168
+ * @returns {any}
169
+ */
170
+ function validate_profile(version_id, dialect_id, profile_id, input) {
171
+ const ptr0 = passStringToWasm0(version_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
172
+ const len0 = WASM_VECTOR_LEN;
173
+ const ptr1 = passStringToWasm0(dialect_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
174
+ const len1 = WASM_VECTOR_LEN;
175
+ const ptr2 = passStringToWasm0(profile_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
176
+ const len2 = WASM_VECTOR_LEN;
177
+ const ptr3 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
178
+ const len3 = WASM_VECTOR_LEN;
179
+ const ret = wasm.validate_profile(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
180
+ if (ret[2]) {
181
+ throw takeFromExternrefTable0(ret[1]);
182
+ }
183
+ return takeFromExternrefTable0(ret[0]);
184
+ }
185
+ exports.validate_profile = validate_profile;
186
+
160
187
  /**
161
188
  * Validate an OpenRTB bid response payload against the latest tracked 2.6 snapshot.
162
189
  *
@@ -201,6 +228,35 @@ function validate_response_against_request(version_id, request, response) {
201
228
  }
202
229
  exports.validate_response_against_request = validate_response_against_request;
203
230
 
231
+ /**
232
+ * Validate an OpenRTB bid response against the bid request it answers, for
233
+ * a specific dialect and exchange profile.
234
+ * @param {string} version_id
235
+ * @param {string} dialect_id
236
+ * @param {string} profile_id
237
+ * @param {string} request
238
+ * @param {string} response
239
+ * @returns {any}
240
+ */
241
+ function validate_response_against_request_profile(version_id, dialect_id, profile_id, request, response) {
242
+ const ptr0 = passStringToWasm0(version_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
243
+ const len0 = WASM_VECTOR_LEN;
244
+ const ptr1 = passStringToWasm0(dialect_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
245
+ const len1 = WASM_VECTOR_LEN;
246
+ const ptr2 = passStringToWasm0(profile_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
247
+ const len2 = WASM_VECTOR_LEN;
248
+ const ptr3 = passStringToWasm0(request, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
249
+ const len3 = WASM_VECTOR_LEN;
250
+ const ptr4 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
251
+ const len4 = WASM_VECTOR_LEN;
252
+ const ret = wasm.validate_response_against_request_profile(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
253
+ if (ret[2]) {
254
+ throw takeFromExternrefTable0(ret[1]);
255
+ }
256
+ return takeFromExternrefTable0(ret[0]);
257
+ }
258
+ exports.validate_response_against_request_profile = validate_response_against_request_profile;
259
+
204
260
  /**
205
261
  * Validate an OpenRTB bid response written in a specific JSON dialect.
206
262
  * @param {string} version_id
@@ -223,6 +279,32 @@ function validate_response_dialect(version_id, dialect_id, input) {
223
279
  }
224
280
  exports.validate_response_dialect = validate_response_dialect;
225
281
 
282
+ /**
283
+ * Validate an OpenRTB bid response against a JSON dialect and an exchange
284
+ * profile.
285
+ * @param {string} version_id
286
+ * @param {string} dialect_id
287
+ * @param {string} profile_id
288
+ * @param {string} input
289
+ * @returns {any}
290
+ */
291
+ function validate_response_profile(version_id, dialect_id, profile_id, input) {
292
+ const ptr0 = passStringToWasm0(version_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
+ const len0 = WASM_VECTOR_LEN;
294
+ const ptr1 = passStringToWasm0(dialect_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
295
+ const len1 = WASM_VECTOR_LEN;
296
+ const ptr2 = passStringToWasm0(profile_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
297
+ const len2 = WASM_VECTOR_LEN;
298
+ const ptr3 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
299
+ const len3 = WASM_VECTOR_LEN;
300
+ const ret = wasm.validate_response_profile(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
301
+ if (ret[2]) {
302
+ throw takeFromExternrefTable0(ret[1]);
303
+ }
304
+ return takeFromExternrefTable0(ret[0]);
305
+ }
306
+ exports.validate_response_profile = validate_response_profile;
307
+
226
308
  /**
227
309
  * Validate an OpenRTB bid response payload against a specific tracked version id
228
310
  * (for example "2.6-202606"). Unknown ids fall back to the latest 2.6 snapshot.
Binary file
@@ -9,9 +9,12 @@ export const validate_artf_request: (a: number, b: number, c: number, d: number)
9
9
  export const validate_artf_response: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
10
10
  export const validate_artf_response_applied: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
11
11
  export const validate_dialect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
12
+ export const validate_profile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
12
13
  export const validate_response: (a: number, b: number) => [number, number, number];
13
14
  export const validate_response_against_request: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
15
+ export const validate_response_against_request_profile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
14
16
  export const validate_response_dialect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
17
+ export const validate_response_profile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
15
18
  export const validate_response_version: (a: number, b: number, c: number, d: number) => [number, number, number];
16
19
  export const validate_version: (a: number, b: number, c: number, d: number) => [number, number, number];
17
20
  export const versions: () => [number, number, number];