pixellint 0.27.0 → 0.29.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/README.md +9 -2
- package/index.cjs +5 -0
- package/index.d.ts +39 -0
- package/index.mjs +8 -0
- package/package.json +1 -1
- package/wasm/pixellint.d.ts +6 -0
- package/wasm/pixellint.js +17 -0
- package/wasm/pixellint_bg.wasm +0 -0
- package/wasm/pixellint_bg.wasm.d.ts +1 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install pixellint
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
```js
|
|
13
|
-
import { validate, isOk } from "pixellint";
|
|
13
|
+
import { validate, isOk, validateMany } from "pixellint";
|
|
14
14
|
|
|
15
15
|
const pixel = validate("https://www.facebook.com/tr?ev=Purchase");
|
|
16
16
|
isOk(pixel); // false: missing Pixel ID
|
|
@@ -22,6 +22,12 @@ const capi = validate(
|
|
|
22
22
|
{ kind: "json" },
|
|
23
23
|
);
|
|
24
24
|
isOk(capi); // false: event_time is milliseconds, Meta wants seconds
|
|
25
|
+
|
|
26
|
+
const document = validateMany([
|
|
27
|
+
"https://example.com/pixel?id=1#frag",
|
|
28
|
+
"https://example.com/pixel?id=1#frag",
|
|
29
|
+
]);
|
|
30
|
+
document.summary.unique_artifacts; // 1
|
|
25
31
|
```
|
|
26
32
|
|
|
27
33
|
Every finding carries a stable `code`, a `severity`, a `fix_hint`, the byte
|
|
@@ -41,7 +47,7 @@ finding.targets[0]; // { component: "whole_url", start: 0, end: 46, ... }
|
|
|
41
47
|
- URL conformance, transport, credentials, fragments, and ad-tech macro handling
|
|
42
48
|
- IAB consent signals: TCF `gdpr` and `gdpr_consent`, the deprecated US Privacy
|
|
43
49
|
string, and GPP `gpp` and `gpp_sid`
|
|
44
|
-
- Vendor parameter contracts for
|
|
50
|
+
- Vendor parameter contracts for 129 endpoint families, including Meta
|
|
45
51
|
Conversions API, TikTok Events API, Reddit CAPI, and the browser pixels
|
|
46
52
|
- Endpoint attribution for 119 vendor rows, so an unrecognized pixel still gets a name.
|
|
47
53
|
|
|
@@ -50,6 +56,7 @@ finding.targets[0]; // { component: "whole_url", start: 0, end: 46, ... }
|
|
|
50
56
|
| Function | Returns |
|
|
51
57
|
| --- | --- |
|
|
52
58
|
| `validate(artifact, options?)` | The full validation summary |
|
|
59
|
+
| `validateMany(document)` | Document report for extracted artifacts |
|
|
53
60
|
| `isOk(summary)` | `false` when any error-severity finding is present |
|
|
54
61
|
| `rulepacks()` | Every rulepack with its evidence level |
|
|
55
62
|
| `vendors()` | The vendor endpoint directory |
|
package/index.cjs
CHANGED
|
@@ -10,6 +10,10 @@ function validate(artifact, options = {}) {
|
|
|
10
10
|
return wasm.validate(kind, artifact, state, vendor);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
function validateMany(document) {
|
|
14
|
+
return wasm.validate_many(JSON.stringify(document));
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
function isOk(summary) {
|
|
14
18
|
return summary.reports.every((report) =>
|
|
15
19
|
report.violations.every((violation) => violation.severity !== "error"),
|
|
@@ -18,6 +22,7 @@ function isOk(summary) {
|
|
|
18
22
|
|
|
19
23
|
module.exports = {
|
|
20
24
|
validate,
|
|
25
|
+
validateMany,
|
|
21
26
|
isOk,
|
|
22
27
|
rulepacks: () => wasm.rulepacks(),
|
|
23
28
|
vendors: () => wasm.vendors(),
|
package/index.d.ts
CHANGED
|
@@ -83,6 +83,45 @@ export interface ValidateOptions {
|
|
|
83
83
|
/** Validate a measurement artifact against every applicable rulepack. */
|
|
84
84
|
export function validate(artifact: string, options?: ValidateOptions): ValidationSummary;
|
|
85
85
|
|
|
86
|
+
export interface FindingCounts {
|
|
87
|
+
artifacts_total?: number;
|
|
88
|
+
unique_artifacts?: number;
|
|
89
|
+
errors: number;
|
|
90
|
+
warnings: number;
|
|
91
|
+
infos: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface ArtifactOccurrence {
|
|
95
|
+
occurrence_id?: string | null;
|
|
96
|
+
source_kind?: string | null;
|
|
97
|
+
path?: string | null;
|
|
98
|
+
line?: number | null;
|
|
99
|
+
column?: number | null;
|
|
100
|
+
context_label?: string | null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface AggregatedArtifact {
|
|
104
|
+
artifact_id: string;
|
|
105
|
+
dedupe_key: string;
|
|
106
|
+
artifact_kind: ArtifactKind;
|
|
107
|
+
raw_artifact: string;
|
|
108
|
+
normalized_artifact: string;
|
|
109
|
+
ok: boolean;
|
|
110
|
+
summary: FindingCounts;
|
|
111
|
+
reports: ValidationReport[];
|
|
112
|
+
occurrences: ArtifactOccurrence[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface DocumentReport {
|
|
116
|
+
document_kind: string;
|
|
117
|
+
extractor?: { id: string; version?: string | null };
|
|
118
|
+
summary: FindingCounts;
|
|
119
|
+
artifacts: AggregatedArtifact[];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Validate extracted artifacts as one document. The caller already extracted URLs. */
|
|
123
|
+
export function validateMany(document: object | string[]): DocumentReport;
|
|
124
|
+
|
|
86
125
|
/** True when no error-severity finding is present. */
|
|
87
126
|
export function isOk(summary: ValidationSummary): boolean;
|
|
88
127
|
|
package/index.mjs
CHANGED
|
@@ -22,6 +22,14 @@ export function validate(artifact, options = {}) {
|
|
|
22
22
|
return wasm.validate(kind, artifact, state, vendor);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Validate extracted artifacts as one document.
|
|
27
|
+
* @param {object|Array} document - MULTI_ARTIFACT_SCHEMA object, or an array of URL strings.
|
|
28
|
+
*/
|
|
29
|
+
export function validateMany(document) {
|
|
30
|
+
return wasm.validate_many(JSON.stringify(document));
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
/** Rulepacks this build ships, with their evidence levels. */
|
|
26
34
|
export function rulepacks() {
|
|
27
35
|
return wasm.rulepacks();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixellint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Validator for pixels, postbacks, conversion API payloads, and tracking URLs: Meta CAPI, Facebook pixel, GTM, and vendor rulepacks",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Aleks <aleks@vastlint.org>",
|
package/wasm/pixellint.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ export function rulepacks(): any;
|
|
|
12
12
|
*/
|
|
13
13
|
export function validate(artifact_kind: string, artifact: string, expansion_state?: string | null, claimed_vendor?: string | null): any;
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Validates extracted artifacts as one document. The caller already pulled
|
|
17
|
+
* tracking URLs out. A JSON array of URL strings is a list of `url` artifacts.
|
|
18
|
+
*/
|
|
19
|
+
export function validate_many(document_json: string): any;
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* Validates a URL artifact with default options, the common case.
|
|
17
23
|
*/
|
package/wasm/pixellint.js
CHANGED
|
@@ -39,6 +39,23 @@ function validate(artifact_kind, artifact, expansion_state, claimed_vendor) {
|
|
|
39
39
|
}
|
|
40
40
|
exports.validate = validate;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Validates extracted artifacts as one document. The caller already pulled
|
|
44
|
+
* tracking URLs out. A JSON array of URL strings is a list of `url` artifacts.
|
|
45
|
+
* @param {string} document_json
|
|
46
|
+
* @returns {any}
|
|
47
|
+
*/
|
|
48
|
+
function validate_many(document_json) {
|
|
49
|
+
const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
50
|
+
const len0 = WASM_VECTOR_LEN;
|
|
51
|
+
const ret = wasm.validate_many(ptr0, len0);
|
|
52
|
+
if (ret[2]) {
|
|
53
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
54
|
+
}
|
|
55
|
+
return takeFromExternrefTable0(ret[0]);
|
|
56
|
+
}
|
|
57
|
+
exports.validate_many = validate_many;
|
|
58
|
+
|
|
42
59
|
/**
|
|
43
60
|
* Validates a URL artifact with default options, the common case.
|
|
44
61
|
* @param {string} artifact
|
package/wasm/pixellint_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const rulepacks: () => [number, number, number];
|
|
5
5
|
export const validate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
6
|
+
export const validate_many: (a: number, b: number) => [number, number, number];
|
|
6
7
|
export const validate_url: (a: number, b: number) => [number, number, number];
|
|
7
8
|
export const vendor_for_host: (a: number, b: number) => [number, number, number];
|
|
8
9
|
export const vendors: () => [number, number, number];
|