@pagefront/lint-commerce 0.12.0 → 0.13.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.
Files changed (72) hide show
  1. package/README.md +57 -13
  2. package/dist/catalogue.js +6 -2
  3. package/dist/collection-catalogue.d.ts +15 -0
  4. package/dist/collection-catalogue.js +30 -0
  5. package/dist/generated/release-manifest.d.ts +9 -0
  6. package/dist/generated/release-manifest.js +10 -0
  7. package/dist/generated/schema-ids.js +3 -0
  8. package/dist/generated/schemas.js +2744 -23
  9. package/dist/index.d.ts +3 -2
  10. package/dist/index.js +3 -2
  11. package/dist/lint-sheet.d.ts +4 -3
  12. package/dist/lint-sheet.js +9 -6
  13. package/dist/organization-catalogue.d.ts +4 -4
  14. package/dist/organization-catalogue.js +7 -6
  15. package/dist/overrides.d.ts +36 -0
  16. package/dist/overrides.js +5 -0
  17. package/dist/releases.d.ts +21 -6
  18. package/dist/releases.js +30 -8
  19. package/dist/rules/checkout-template.d.ts +69 -0
  20. package/dist/rules/checkout-template.js +165 -0
  21. package/dist/rules/col-e-001.d.ts +11 -0
  22. package/dist/rules/col-e-001.js +31 -0
  23. package/dist/rules/col-e-002.d.ts +2 -0
  24. package/dist/rules/col-e-002.js +37 -0
  25. package/dist/rules/col-e-003.d.ts +11 -0
  26. package/dist/rules/col-e-003.js +18 -0
  27. package/dist/rules/col-e-004.d.ts +12 -0
  28. package/dist/rules/col-e-004.js +19 -0
  29. package/dist/rules/col-e-005.d.ts +16 -0
  30. package/dist/rules/col-e-005.js +64 -0
  31. package/dist/rules/col-shared.d.ts +25 -0
  32. package/dist/rules/col-shared.js +43 -0
  33. package/dist/rules/col-w-001.d.ts +11 -0
  34. package/dist/rules/col-w-001.js +21 -0
  35. package/dist/rules/col-w-002.d.ts +12 -0
  36. package/dist/rules/col-w-002.js +31 -0
  37. package/dist/rules/col-w-004.d.ts +12 -0
  38. package/dist/rules/col-w-004.js +37 -0
  39. package/dist/rules/col-w-005.d.ts +12 -0
  40. package/dist/rules/col-w-005.js +41 -0
  41. package/dist/rules/col-w-006.d.ts +11 -0
  42. package/dist/rules/col-w-006.js +37 -0
  43. package/dist/rules/org-w-007.d.ts +15 -0
  44. package/dist/rules/org-w-007.js +47 -0
  45. package/dist/rules/pdp-e-005.d.ts +3 -1
  46. package/dist/rules/pdp-e-005.js +7 -5
  47. package/dist/rules/pdp-e-017.js +34 -6
  48. package/dist/rules/pdp-e-019.d.ts +2 -0
  49. package/dist/rules/pdp-e-019.js +50 -0
  50. package/dist/rules/pdp-e-020.d.ts +13 -0
  51. package/dist/rules/pdp-e-020.js +31 -0
  52. package/dist/rules/pdp-e-021.d.ts +11 -0
  53. package/dist/rules/pdp-e-021.js +32 -0
  54. package/dist/rules/pdp-w-021.js +1 -1
  55. package/dist/rules/pdp-w-031.d.ts +4 -4
  56. package/dist/rules/pdp-w-031.js +9 -7
  57. package/dist/rules/pdp-w-040.d.ts +12 -0
  58. package/dist/rules/pdp-w-040.js +37 -0
  59. package/dist/rules/release-schema.d.ts +3 -2
  60. package/dist/rules/release-schema.js +11 -11
  61. package/dist/schema-registry.d.ts +11 -0
  62. package/dist/schema-registry.js +24 -9
  63. package/dist/schema-validators.js +14 -5
  64. package/dist/sheet-type.d.ts +17 -12
  65. package/dist/sheet-type.js +11 -0
  66. package/dist/test-hooks.d.ts +15 -0
  67. package/dist/test-hooks.js +28 -0
  68. package/dist/validate-and-lint.d.ts +9 -5
  69. package/dist/validate-and-lint.js +33 -5
  70. package/dist/version.d.ts +1 -1
  71. package/dist/version.js +1 -1
  72. 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. Both commerce page types are handled: product sheets and
24
- Commerce Organization Sheets each validate against their own schema and
25
- lint with their own catalogue, dispatched by sheet type.
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.16.0, supporting commerce releases 0.4.0 (Product Sheet spec
30
- 0.10.0, Organization Sheet spec 0.4.0) and 0.3.0, and the legacy draft line
31
- (format 0.9): 58 product rules (`PDP-E-001` to `PDP-E-018`, `PDP-W-001` to
32
- `PDP-W-039`, `PDP-I-001`) and 10 organization rules (`ORG-E-001` to
33
- `ORG-E-004`, `ORG-W-001` to `ORG-W-006`), each defined in
30
+ Catalogue 0.17.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): 62 product rules (`PDP-E-001` to `PDP-E-021`, `PDP-W-001` to
34
+ `PDP-W-040`, `PDP-I-001`), 11 organization rules (`ORG-E-001` to
35
+ `ORG-E-004`, `ORG-W-001` to `ORG-W-007`) and 10 collection rules
36
+ (`COL-E-001` to `COL-E-005`, `COL-W-001`, `COL-W-002`, `COL-W-004` to
37
+ `COL-W-006`; `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,44 @@ 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
+ Changed in 0.12.1 (catalogue 0.16.1):
213
+
214
+ - `PDP-E-017` adds a type hint. When a reference matches no option but a
215
+ declared option has the same text under another JSON type, the message
216
+ names both types, and the finding's `values` carry `reference_type`,
217
+ `declared_option` and `declared_type`. Comparison is unchanged and the
218
+ finding stays an error.
177
219
 
178
220
  ## API
179
221
 
@@ -208,11 +250,13 @@ internal):
208
250
  `/spec/commerce/product/` or `/schemas/product/` path likewise wins
209
251
  for `"product"`), falling back to a data block whose `@type` is
210
252
  `Organization`/`OnlineStore`/`OnlineBusiness` with
211
- `pagefront:commerceRole` present; `"product"` otherwise.
212
- - `commerceCatalogue`, `organizationCatalogue` — the per-page-type
213
- catalogue objects (read-only), for direct engine use or
214
- introspection. Product rules never run on organization sheets and
215
- vice versa.
253
+ `pagefront:commerceRole` present, or `"collection"` for a
254
+ `/spec/commerce/collection/` path or a `Collection` data block with
255
+ `pagefront:collectionKind` present; `"product"` otherwise.
256
+ - `commerceCatalogue`, `organizationCatalogue`, `collectionCatalogue` —
257
+ the per-page-type catalogue objects (read-only), for direct engine use
258
+ or introspection. No page type's rules run on another page type's
259
+ sheets.
216
260
  - Types: `SchemaError`, `ValidateAndLintResult`,
217
261
  `ValidateOrganizationResult`, `SheetType`, and the core types the
218
262
  signatures mention — `Report`, `Finding`, `Summary`, `Severity`,
package/dist/catalogue.js CHANGED
@@ -17,6 +17,9 @@ 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";
20
23
  import { pdpW001 } from "./rules/pdp-w-001.js";
21
24
  import { pdpW002 } from "./rules/pdp-w-002.js";
22
25
  import { pdpW003 } from "./rules/pdp-w-003.js";
@@ -56,6 +59,7 @@ import { pdpW036 } from "./rules/pdp-w-036.js";
56
59
  import { pdpW037 } from "./rules/pdp-w-037.js";
57
60
  import { pdpW038 } from "./rules/pdp-w-038.js";
58
61
  import { pdpW039 } from "./rules/pdp-w-039.js";
62
+ import { pdpW040 } from "./rules/pdp-w-040.js";
59
63
  import { pdpI001 } from "./rules/pdp-i-001.js";
60
64
  /**
61
65
  * The commerce product-sheet rule catalogue — the executable form of
@@ -67,6 +71,6 @@ import { pdpI001 } from "./rules/pdp-i-001.js";
67
71
  export const commerceCatalogue = {
68
72
  vertical: "commerce",
69
73
  releases: KNOWN_RELEASES,
70
- catalogueVersion: "0.16.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],
74
+ catalogueVersion: "0.17.0",
75
+ rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, pdpE017, pdpE018, pdpE019, pdpE020, pdpE021, 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, pdpI001],
72
76
  };
@@ -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,30 @@
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
+ /**
13
+ * The Commerce Collection Sheet rule catalogue — the executable form
14
+ * of the "Commerce Collection Sheet rules" section of
15
+ * commerce/spec/rules.md (normative). It shares rules.md's catalogue
16
+ * version with the product and organization catalogues: one normative
17
+ * document, one version, three page-type rule sets dispatched by sheet
18
+ * type (see sheet-type.ts). No page type's rules run on another page
19
+ * type's sheets.
20
+ *
21
+ * COL-W-003 is reserved in rules.md and awaits implementation: a root
22
+ * category absent from the organization sheet's `hasOfferCatalog` needs
23
+ * both sheets, which a single-sheet linter does not have.
24
+ */
25
+ export const collectionCatalogue = {
26
+ vertical: "commerce",
27
+ releases: KNOWN_RELEASES,
28
+ catalogueVersion: "0.17.0",
29
+ rules: [colE001, colE002, colE003, colE004, colE005, colW001, colW002, colW004, colW005, colW006],
30
+ };
@@ -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
  ];