@pagefront/lint-commerce 0.12.1 → 0.14.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 +72 -13
- package/dist/catalogue.js +8 -2
- package/dist/collection-catalogue.d.ts +15 -0
- package/dist/collection-catalogue.js +31 -0
- package/dist/generated/release-manifest.d.ts +9 -0
- package/dist/generated/release-manifest.js +10 -0
- package/dist/generated/schema-ids.js +3 -0
- package/dist/generated/schemas.js +2744 -23
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/lint-sheet.d.ts +4 -3
- package/dist/lint-sheet.js +9 -6
- package/dist/organization-catalogue.d.ts +4 -4
- package/dist/organization-catalogue.js +8 -6
- package/dist/overrides.d.ts +36 -0
- package/dist/overrides.js +5 -0
- package/dist/releases.d.ts +21 -6
- package/dist/releases.js +30 -8
- package/dist/rules/checkout-template.d.ts +69 -0
- package/dist/rules/checkout-template.js +165 -0
- package/dist/rules/col-e-001.d.ts +11 -0
- package/dist/rules/col-e-001.js +31 -0
- package/dist/rules/col-e-002.d.ts +2 -0
- package/dist/rules/col-e-002.js +37 -0
- package/dist/rules/col-e-003.d.ts +11 -0
- package/dist/rules/col-e-003.js +18 -0
- package/dist/rules/col-e-004.d.ts +12 -0
- package/dist/rules/col-e-004.js +19 -0
- package/dist/rules/col-e-005.d.ts +16 -0
- package/dist/rules/col-e-005.js +64 -0
- package/dist/rules/col-shared.d.ts +25 -0
- package/dist/rules/col-shared.js +43 -0
- package/dist/rules/col-w-001.d.ts +11 -0
- package/dist/rules/col-w-001.js +21 -0
- package/dist/rules/col-w-002.d.ts +12 -0
- package/dist/rules/col-w-002.js +31 -0
- package/dist/rules/col-w-004.d.ts +12 -0
- package/dist/rules/col-w-004.js +37 -0
- package/dist/rules/col-w-005.d.ts +12 -0
- package/dist/rules/col-w-005.js +41 -0
- package/dist/rules/col-w-006.d.ts +11 -0
- package/dist/rules/col-w-006.js +37 -0
- package/dist/rules/col-w-007.d.ts +13 -0
- package/dist/rules/col-w-007.js +32 -0
- package/dist/rules/org-w-007.d.ts +15 -0
- package/dist/rules/org-w-007.js +47 -0
- package/dist/rules/org-w-008.d.ts +15 -0
- package/dist/rules/org-w-008.js +59 -0
- package/dist/rules/pdp-e-005.d.ts +3 -1
- package/dist/rules/pdp-e-005.js +7 -5
- package/dist/rules/pdp-e-019.d.ts +2 -0
- package/dist/rules/pdp-e-019.js +50 -0
- package/dist/rules/pdp-e-020.d.ts +13 -0
- package/dist/rules/pdp-e-020.js +31 -0
- package/dist/rules/pdp-e-021.d.ts +11 -0
- package/dist/rules/pdp-e-021.js +32 -0
- package/dist/rules/pdp-e-022.d.ts +13 -0
- package/dist/rules/pdp-e-022.js +33 -0
- package/dist/rules/pdp-w-016.d.ts +4 -0
- package/dist/rules/pdp-w-016.js +7 -0
- package/dist/rules/pdp-w-021.js +1 -1
- package/dist/rules/pdp-w-031.d.ts +4 -4
- package/dist/rules/pdp-w-031.js +9 -7
- package/dist/rules/pdp-w-040.d.ts +12 -0
- package/dist/rules/pdp-w-040.js +37 -0
- package/dist/rules/pdp-w-041.d.ts +15 -0
- package/dist/rules/pdp-w-041.js +53 -0
- package/dist/rules/release-schema.d.ts +3 -2
- package/dist/rules/release-schema.js +11 -11
- package/dist/rules/unavailable-offer.d.ts +2 -0
- package/dist/rules/unavailable-offer.js +13 -0
- package/dist/schema-registry.d.ts +11 -0
- package/dist/schema-registry.js +24 -9
- package/dist/schema-validators.js +14 -5
- package/dist/sheet-type.d.ts +17 -12
- package/dist/sheet-type.js +11 -0
- package/dist/test-hooks.d.ts +15 -0
- package/dist/test-hooks.js +28 -0
- package/dist/validate-and-lint.d.ts +9 -5
- package/dist/validate-and-lint.js +33 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,17 +20,21 @@ pagefront-lint-commerce <sheet-url-or-path> [options]
|
|
|
20
20
|
The CLI validates Layer 1 (JSON Schema) first; a failing Sheet gets its
|
|
21
21
|
schema errors on stderr and no report. Exit codes: `0` nothing
|
|
22
22
|
blocking, `1` Layer 1 failure or blocking findings, `2` operational
|
|
23
|
-
failure.
|
|
24
|
-
Commerce Organization Sheets
|
|
25
|
-
lint with their own catalogue, dispatched by
|
|
23
|
+
failure. The three commerce page types are handled: product sheets,
|
|
24
|
+
Commerce Organization Sheets and Commerce Collection Sheets each validate
|
|
25
|
+
against their own schema and lint with their own catalogue, dispatched by
|
|
26
|
+
sheet type.
|
|
26
27
|
|
|
27
28
|
## Catalogue
|
|
28
29
|
|
|
29
|
-
Catalogue 0.
|
|
30
|
-
0.
|
|
31
|
-
(
|
|
32
|
-
|
|
33
|
-
`
|
|
30
|
+
Catalogue 0.20.0, supporting commerce releases 0.5.0 (Product Sheet spec
|
|
31
|
+
0.11.0, Organization Sheet spec 0.5.0, Collection Sheet spec 0.1.0), 0.4.0
|
|
32
|
+
(Product Sheet spec 0.10.0, Organization Sheet spec 0.4.0) and 0.3.0, and the
|
|
33
|
+
legacy draft line (format 0.9): 64 product rules (`PDP-E-001` to `PDP-E-022`, `PDP-W-001` to
|
|
34
|
+
`PDP-W-041`, `PDP-I-001`), 12 organization rules (`ORG-E-001` to
|
|
35
|
+
`ORG-E-004`, `ORG-W-001` to `ORG-W-008`) and 11 collection rules
|
|
36
|
+
(`COL-E-001` to `COL-E-005`, `COL-W-001`, `COL-W-002`, `COL-W-004` to
|
|
37
|
+
`COL-W-007`; `COL-W-003` is reserved), each defined in
|
|
34
38
|
[`rules.md`](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/rules.md)
|
|
35
39
|
with its target, check, message and remediation. Every report carries the
|
|
36
40
|
`catalogue_version` it was produced with.
|
|
@@ -174,6 +178,59 @@ Added in 0.12.0 (catalogue 0.16.0), with commerce release 0.4.0. Requires
|
|
|
174
178
|
`1` is not `"1"`.
|
|
175
179
|
- `PDP-E-018` and `ORG-E-004` — the sheet declares a `release` the release
|
|
176
180
|
manifest does not list. At Layer 1 this is a single error at `/release`.
|
|
181
|
+
- `PDP-E-019`, `PDP-E-020`, `PDP-E-021` and `PDP-W-040` (apply from release
|
|
182
|
+
0.5.0) — "Where to buy" in the Product Sheet spec: an Offer's
|
|
183
|
+
`checkoutPageURLTemplate` that is not a string, is not a valid RFC 6570
|
|
184
|
+
template, names a variable other than `quantity`, or does not expand
|
|
185
|
+
(with `quantity` set to 1) to an absolute https URL; a template on an
|
|
186
|
+
Offer with neither `areaServed` nor `eligibleRegion`; an Offer `url` that
|
|
187
|
+
is not an absolute http or https URL; and an Offer without `url` on a
|
|
188
|
+
sheet carrying several offers.
|
|
189
|
+
|
|
190
|
+
Added in 0.13.0 (catalogue 0.17.0), released with commerce release 0.5.0,
|
|
191
|
+
with the Commerce Collection Sheet spec
|
|
192
|
+
([`collection.md`](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/collection.md)):
|
|
193
|
+
|
|
194
|
+
- A third page type. A sheet whose `$schema` path contains
|
|
195
|
+
`/spec/commerce/collection/`, or whose data block is a `Collection`
|
|
196
|
+
carrying `pagefront:collectionKind`, lints with the collection catalogue:
|
|
197
|
+
`COL-E-001` (member entry without `@id`), `COL-E-002` (kind absent or
|
|
198
|
+
outside the enum), `COL-E-003` and `COL-E-004` (the envelope's version
|
|
199
|
+
fields), `COL-E-005` (a `hasPart`, `isPartOf` or `brand` sheet URL off its
|
|
200
|
+
edge's host), `COL-W-001` (empty `hasPart`), `COL-W-002` (member without
|
|
201
|
+
`pagefront:sheetUrl`), `COL-W-004` (brand reference and brand kind
|
|
202
|
+
disagree), `COL-W-005` (parent of another kind), `COL-W-006` (duplicate
|
|
203
|
+
member).
|
|
204
|
+
- `ORG-W-007` — a `hasOfferCatalog` entry whose `pagefront:sheetUrl` is on
|
|
205
|
+
another host than the canonical host.
|
|
206
|
+
- Until a release bundles the Collection Sheet spec, Layer 1 reports that
|
|
207
|
+
the declared release bundles no Collection Sheet schema (one error at
|
|
208
|
+
`/release`), and a legacy-line sheet of that type that the legacy line has
|
|
209
|
+
no such schema (at `/format_version`).
|
|
210
|
+
- New export: `collectionCatalogue`. `SheetType` gains `"collection"`.
|
|
211
|
+
|
|
212
|
+
Added in 0.14.0 (catalogue 0.20.0; catalogues 0.18.0 and 0.19.0 were never
|
|
213
|
+
published on their own). Requires `@pagefront/lint-core` 0.4.0, unchanged.
|
|
214
|
+
|
|
215
|
+
- `PDP-E-022` (applies from release 0.6.0) — "Unavailable offers
|
|
216
|
+
without a price" in the Product Sheet spec: a `checkoutPageURLTemplate` on
|
|
217
|
+
an Offer whose `availability` is `OutOfStock`, `SoldOut` or `Discontinued`.
|
|
218
|
+
From the same change, `PDP-W-016` is silent on such an Offer, which the
|
|
219
|
+
spec publishes without a price.
|
|
220
|
+
- `PDP-W-041` (applies from release 0.6.0) — a purchase URL off the
|
|
221
|
+
canonical host: an Offer's `url`, or its `checkoutPageURLTemplate`
|
|
222
|
+
expanded with `quantity` set to 1, on another host than the canonical
|
|
223
|
+
host. The linter cannot see the seller's `pagefront:checkoutHosts`.
|
|
224
|
+
- `ORG-W-008` (applies from release 0.6.0) — `pagefront:checkoutHosts`
|
|
225
|
+
without the `seller` role, and one finding per entry that is not a bare
|
|
226
|
+
host (not a string, empty, or carrying a scheme, a path or a port).
|
|
227
|
+
- `COL-W-007` (applies from release 0.5.0) — a parent entry in `isPartOf`
|
|
228
|
+
without `pagefront:sheetUrl`, or with a blank one: the counterpart of
|
|
229
|
+
`COL-W-002` for a sheet's parents. A category's parents are category
|
|
230
|
+
sheets, so the producer that emitted the sheet knows their addresses.
|
|
231
|
+
- The three rules gated to release 0.6.0 wait for that release: the bundled
|
|
232
|
+
release manifest has no 0.6.0 row yet, and a sheet declaring 0.6.0 fails
|
|
233
|
+
Layer 1 (`PDP-E-018`, `ORG-E-004`) until it lands.
|
|
177
234
|
|
|
178
235
|
Changed in 0.12.1 (catalogue 0.16.1):
|
|
179
236
|
|
|
@@ -216,11 +273,13 @@ internal):
|
|
|
216
273
|
`/spec/commerce/product/` or `/schemas/product/` path likewise wins
|
|
217
274
|
for `"product"`), falling back to a data block whose `@type` is
|
|
218
275
|
`Organization`/`OnlineStore`/`OnlineBusiness` with
|
|
219
|
-
`pagefront:commerceRole` present
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
276
|
+
`pagefront:commerceRole` present, or `"collection"` for a
|
|
277
|
+
`/spec/commerce/collection/` path or a `Collection` data block with
|
|
278
|
+
`pagefront:collectionKind` present; `"product"` otherwise.
|
|
279
|
+
- `commerceCatalogue`, `organizationCatalogue`, `collectionCatalogue` —
|
|
280
|
+
the per-page-type catalogue objects (read-only), for direct engine use
|
|
281
|
+
or introspection. No page type's rules run on another page type's
|
|
282
|
+
sheets.
|
|
224
283
|
- Types: `SchemaError`, `ValidateAndLintResult`,
|
|
225
284
|
`ValidateOrganizationResult`, `SheetType`, and the core types the
|
|
226
285
|
signatures mention — `Report`, `Finding`, `Summary`, `Severity`,
|
package/dist/catalogue.js
CHANGED
|
@@ -17,6 +17,10 @@ import { pdpE015 } from "./rules/pdp-e-015.js";
|
|
|
17
17
|
import { pdpE016 } from "./rules/pdp-e-016.js";
|
|
18
18
|
import { pdpE017 } from "./rules/pdp-e-017.js";
|
|
19
19
|
import { pdpE018 } from "./rules/pdp-e-018.js";
|
|
20
|
+
import { pdpE019 } from "./rules/pdp-e-019.js";
|
|
21
|
+
import { pdpE020 } from "./rules/pdp-e-020.js";
|
|
22
|
+
import { pdpE021 } from "./rules/pdp-e-021.js";
|
|
23
|
+
import { pdpE022 } from "./rules/pdp-e-022.js";
|
|
20
24
|
import { pdpW001 } from "./rules/pdp-w-001.js";
|
|
21
25
|
import { pdpW002 } from "./rules/pdp-w-002.js";
|
|
22
26
|
import { pdpW003 } from "./rules/pdp-w-003.js";
|
|
@@ -56,6 +60,8 @@ import { pdpW036 } from "./rules/pdp-w-036.js";
|
|
|
56
60
|
import { pdpW037 } from "./rules/pdp-w-037.js";
|
|
57
61
|
import { pdpW038 } from "./rules/pdp-w-038.js";
|
|
58
62
|
import { pdpW039 } from "./rules/pdp-w-039.js";
|
|
63
|
+
import { pdpW040 } from "./rules/pdp-w-040.js";
|
|
64
|
+
import { pdpW041 } from "./rules/pdp-w-041.js";
|
|
59
65
|
import { pdpI001 } from "./rules/pdp-i-001.js";
|
|
60
66
|
/**
|
|
61
67
|
* The commerce product-sheet rule catalogue — the executable form of
|
|
@@ -67,6 +73,6 @@ import { pdpI001 } from "./rules/pdp-i-001.js";
|
|
|
67
73
|
export const commerceCatalogue = {
|
|
68
74
|
vertical: "commerce",
|
|
69
75
|
releases: KNOWN_RELEASES,
|
|
70
|
-
catalogueVersion: "0.
|
|
71
|
-
rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, pdpE017, pdpE018, pdpW001, pdpW002, pdpW003, pdpW004, pdpW005, pdpW006, pdpW007, pdpW008, pdpW009, pdpW010, pdpW011, pdpW012, pdpW013, pdpW014, pdpW015, pdpW016, pdpW017, pdpW018, pdpW019, pdpW020, pdpW021, pdpW022, pdpW023, pdpW024, pdpW025, pdpW026, pdpW027, pdpW028, pdpW029, pdpW030, pdpW031, pdpW032, pdpW033, pdpW034, pdpW035, pdpW036, pdpW037, pdpW038, pdpW039, pdpI001],
|
|
76
|
+
catalogueVersion: "0.20.0",
|
|
77
|
+
rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, pdpE017, pdpE018, pdpE019, pdpE020, pdpE021, pdpE022, pdpW001, pdpW002, pdpW003, pdpW004, pdpW005, pdpW006, pdpW007, pdpW008, pdpW009, pdpW010, pdpW011, pdpW012, pdpW013, pdpW014, pdpW015, pdpW016, pdpW017, pdpW018, pdpW019, pdpW020, pdpW021, pdpW022, pdpW023, pdpW024, pdpW025, pdpW026, pdpW027, pdpW028, pdpW029, pdpW030, pdpW031, pdpW032, pdpW033, pdpW034, pdpW035, pdpW036, pdpW037, pdpW038, pdpW039, pdpW040, pdpW041, pdpI001],
|
|
72
78
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Catalogue } from "@pagefront/lint-core";
|
|
2
|
+
/**
|
|
3
|
+
* The Commerce Collection Sheet rule catalogue — the executable form
|
|
4
|
+
* of the "Commerce Collection Sheet rules" section of
|
|
5
|
+
* commerce/spec/rules.md (normative). It shares rules.md's catalogue
|
|
6
|
+
* version with the product and organization catalogues: one normative
|
|
7
|
+
* document, one version, three page-type rule sets dispatched by sheet
|
|
8
|
+
* type (see sheet-type.ts). No page type's rules run on another page
|
|
9
|
+
* type's sheets.
|
|
10
|
+
*
|
|
11
|
+
* COL-W-003 is reserved in rules.md and awaits implementation: a root
|
|
12
|
+
* category absent from the organization sheet's `hasOfferCatalog` needs
|
|
13
|
+
* both sheets, which a single-sheet linter does not have.
|
|
14
|
+
*/
|
|
15
|
+
export declare const collectionCatalogue: Catalogue;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { KNOWN_RELEASES } from "./releases.js";
|
|
2
|
+
import { colE001 } from "./rules/col-e-001.js";
|
|
3
|
+
import { colE002 } from "./rules/col-e-002.js";
|
|
4
|
+
import { colE003 } from "./rules/col-e-003.js";
|
|
5
|
+
import { colE004 } from "./rules/col-e-004.js";
|
|
6
|
+
import { colE005 } from "./rules/col-e-005.js";
|
|
7
|
+
import { colW001 } from "./rules/col-w-001.js";
|
|
8
|
+
import { colW002 } from "./rules/col-w-002.js";
|
|
9
|
+
import { colW004 } from "./rules/col-w-004.js";
|
|
10
|
+
import { colW005 } from "./rules/col-w-005.js";
|
|
11
|
+
import { colW006 } from "./rules/col-w-006.js";
|
|
12
|
+
import { colW007 } from "./rules/col-w-007.js";
|
|
13
|
+
/**
|
|
14
|
+
* The Commerce Collection Sheet rule catalogue — the executable form
|
|
15
|
+
* of the "Commerce Collection Sheet rules" section of
|
|
16
|
+
* commerce/spec/rules.md (normative). It shares rules.md's catalogue
|
|
17
|
+
* version with the product and organization catalogues: one normative
|
|
18
|
+
* document, one version, three page-type rule sets dispatched by sheet
|
|
19
|
+
* type (see sheet-type.ts). No page type's rules run on another page
|
|
20
|
+
* type's sheets.
|
|
21
|
+
*
|
|
22
|
+
* COL-W-003 is reserved in rules.md and awaits implementation: a root
|
|
23
|
+
* category absent from the organization sheet's `hasOfferCatalog` needs
|
|
24
|
+
* both sheets, which a single-sheet linter does not have.
|
|
25
|
+
*/
|
|
26
|
+
export const collectionCatalogue = {
|
|
27
|
+
vertical: "commerce",
|
|
28
|
+
releases: KNOWN_RELEASES,
|
|
29
|
+
catalogueVersion: "0.20.0",
|
|
30
|
+
rules: [colE001, colE002, colE003, colE004, colE005, colW001, colW002, colW004, colW005, colW006, colW007],
|
|
31
|
+
};
|
|
@@ -18,6 +18,15 @@ export declare const RELEASE_MANIFEST: {
|
|
|
18
18
|
readonly product: "0.10.0";
|
|
19
19
|
readonly organization: "0.4.0";
|
|
20
20
|
};
|
|
21
|
+
}, {
|
|
22
|
+
readonly release: "0.5.0";
|
|
23
|
+
readonly date: "2026-10-18";
|
|
24
|
+
readonly vocabulary: "0.5.0";
|
|
25
|
+
readonly sheets: {
|
|
26
|
+
readonly product: "0.11.0";
|
|
27
|
+
readonly organization: "0.5.0";
|
|
28
|
+
readonly collection: "0.1.0";
|
|
29
|
+
};
|
|
21
30
|
}];
|
|
22
31
|
readonly legacy: {
|
|
23
32
|
readonly envelope_field: "format_version";
|
|
@@ -21,6 +21,16 @@ export const RELEASE_MANIFEST = {
|
|
|
21
21
|
"product": "0.10.0",
|
|
22
22
|
"organization": "0.4.0"
|
|
23
23
|
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"release": "0.5.0",
|
|
27
|
+
"date": "2026-10-18",
|
|
28
|
+
"vocabulary": "0.5.0",
|
|
29
|
+
"sheets": {
|
|
30
|
+
"product": "0.11.0",
|
|
31
|
+
"organization": "0.5.0",
|
|
32
|
+
"collection": "0.1.0"
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
35
|
],
|
|
26
36
|
"legacy": {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
|
|
2
2
|
export const SCHEMA_IDS = [
|
|
3
|
+
"https://themachineweb.org/pagefront/spec/commerce/collection/v0.1.0.json",
|
|
3
4
|
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.3.0.json",
|
|
4
5
|
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.4.0.json",
|
|
6
|
+
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.5.0.json",
|
|
5
7
|
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json",
|
|
6
8
|
"https://themachineweb.org/pagefront/spec/commerce/product/v0.10.0.json",
|
|
9
|
+
"https://themachineweb.org/pagefront/spec/commerce/product/v0.11.0.json",
|
|
7
10
|
"https://themachineweb.org/pagefront/spec/commerce/product/v0.9.0.json",
|
|
8
11
|
"https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json"
|
|
9
12
|
];
|