@pagefront/lint-commerce 0.10.0 → 0.12.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 +49 -16
- package/dist/catalogue.js +4 -2
- package/dist/generated/release-manifest.d.ts +30 -0
- package/dist/generated/release-manifest.js +36 -0
- package/dist/generated/schema-ids.d.ts +1 -0
- package/dist/generated/schema-ids.js +9 -0
- package/dist/generated/schema-properties.d.ts +1 -0
- package/dist/{schema-properties.js → generated/schema-properties.js} +2 -10
- package/dist/generated/schemas.d.ts +1 -0
- package/dist/generated/schemas.js +7326 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +8 -5
- package/dist/organization-catalogue.js +3 -2
- package/dist/releases.d.ts +12 -26
- package/dist/releases.js +16 -30
- package/dist/rules/org-e-001.js +2 -0
- package/dist/rules/org-e-002.js +2 -0
- package/dist/rules/org-e-003.js +2 -0
- package/dist/rules/org-e-004.d.ts +11 -0
- package/dist/rules/org-e-004.js +18 -0
- package/dist/rules/org-w-001.js +2 -0
- package/dist/rules/org-w-002.js +2 -0
- package/dist/rules/org-w-003.js +2 -0
- package/dist/rules/org-w-004.js +2 -0
- package/dist/rules/org-w-005.js +2 -0
- package/dist/rules/org-w-006.js +2 -0
- package/dist/rules/pdp-e-001.js +2 -0
- package/dist/rules/pdp-e-002.js +2 -0
- package/dist/rules/pdp-e-003.js +2 -0
- package/dist/rules/pdp-e-004.js +2 -0
- package/dist/rules/pdp-e-005.js +2 -0
- package/dist/rules/pdp-e-006.js +2 -0
- package/dist/rules/pdp-e-007.js +2 -0
- package/dist/rules/pdp-e-008.js +2 -0
- package/dist/rules/pdp-e-009.js +2 -0
- package/dist/rules/pdp-e-010.js +2 -0
- package/dist/rules/pdp-e-011.js +2 -0
- package/dist/rules/pdp-e-012.js +2 -0
- package/dist/rules/pdp-e-013.js +2 -0
- package/dist/rules/pdp-e-014.js +2 -0
- package/dist/rules/pdp-e-015.js +2 -0
- package/dist/rules/pdp-e-016.js +2 -0
- package/dist/rules/pdp-e-017.d.ts +2 -0
- package/dist/rules/pdp-e-017.js +80 -0
- package/dist/rules/pdp-e-018.d.ts +11 -0
- package/dist/rules/pdp-e-018.js +18 -0
- package/dist/rules/pdp-i-001.js +5 -2
- package/dist/rules/pdp-w-001.js +2 -0
- package/dist/rules/pdp-w-002.js +2 -0
- package/dist/rules/pdp-w-003.js +2 -0
- package/dist/rules/pdp-w-004.js +2 -0
- package/dist/rules/pdp-w-005.js +2 -0
- package/dist/rules/pdp-w-006.js +2 -0
- package/dist/rules/pdp-w-007.js +2 -0
- package/dist/rules/pdp-w-008.js +2 -0
- package/dist/rules/pdp-w-009.js +2 -0
- package/dist/rules/pdp-w-010.js +2 -0
- package/dist/rules/pdp-w-011.js +2 -0
- package/dist/rules/pdp-w-012.js +2 -0
- package/dist/rules/pdp-w-013.js +2 -0
- package/dist/rules/pdp-w-014.js +2 -0
- package/dist/rules/pdp-w-015.js +2 -0
- package/dist/rules/pdp-w-016.js +2 -0
- package/dist/rules/pdp-w-017.js +2 -0
- package/dist/rules/pdp-w-018.js +2 -0
- package/dist/rules/pdp-w-019.js +2 -0
- package/dist/rules/pdp-w-020.js +2 -0
- package/dist/rules/pdp-w-021.js +2 -0
- package/dist/rules/pdp-w-022.js +2 -0
- package/dist/rules/pdp-w-023.js +2 -0
- package/dist/rules/pdp-w-024.js +2 -0
- package/dist/rules/pdp-w-025.js +2 -0
- package/dist/rules/pdp-w-026.js +2 -0
- package/dist/rules/pdp-w-027.js +2 -0
- package/dist/rules/pdp-w-028.js +2 -0
- package/dist/rules/pdp-w-029.js +2 -0
- package/dist/rules/pdp-w-030.js +2 -0
- package/dist/rules/pdp-w-031.js +2 -0
- package/dist/rules/pdp-w-032.js +2 -0
- package/dist/rules/pdp-w-033.js +2 -0
- package/dist/rules/pdp-w-034.js +2 -0
- package/dist/rules/pdp-w-035.js +2 -0
- package/dist/rules/pdp-w-036.js +2 -0
- package/dist/rules/pdp-w-037.js +2 -0
- package/dist/rules/pdp-w-038.js +2 -0
- package/dist/rules/pdp-w-039.js +2 -0
- package/dist/rules/release-schema.d.ts +18 -7
- package/dist/rules/release-schema.js +55 -15
- package/dist/schema-registry.d.ts +42 -0
- package/dist/schema-registry.js +52 -0
- package/dist/schema-validators.d.ts +7 -8
- package/dist/schema-validators.js +18 -4
- package/dist/validate-and-lint.d.ts +28 -21
- package/dist/validate-and-lint.js +60 -36
- package/dist/validate-organization.d.ts +5 -5
- package/dist/validate-organization.js +8 -18
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/legacy-schemas.d.ts +0 -9
- package/dist/legacy-schemas.js +0 -2446
- package/dist/organization-schema.d.ts +0 -10
- package/dist/organization-schema.js +0 -443
- package/dist/product-schema.d.ts +0 -9
- package/dist/product-schema.js +0 -2015
- package/dist/schema-properties.d.ts +0 -10
package/README.md
CHANGED
|
@@ -26,11 +26,11 @@ lint with their own catalogue, dispatched by sheet type.
|
|
|
26
26
|
|
|
27
27
|
## Catalogue
|
|
28
28
|
|
|
29
|
-
Catalogue 0.
|
|
30
|
-
0.
|
|
31
|
-
0.9):
|
|
32
|
-
`PDP-W-039`, `PDP-I-001`) and
|
|
33
|
-
`ORG-E-
|
|
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
|
|
34
34
|
[`rules.md`](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/rules.md)
|
|
35
35
|
with its target, check, message and remediation. Every report carries the
|
|
36
36
|
`catalogue_version` it was produced with.
|
|
@@ -143,23 +143,56 @@ that replaces format versions:
|
|
|
143
143
|
- New exports: `detectSheetLine`, `RELEASE_MANIFEST`, `KNOWN_RELEASES`,
|
|
144
144
|
`sheetSpecVersionFor`.
|
|
145
145
|
|
|
146
|
+
Changed in 0.11.0 (catalogue 0.15.0, unchanged):
|
|
147
|
+
|
|
148
|
+
- Layer 1 validates a sheet against the published schema its `$schema`
|
|
149
|
+
names. The package bundles every file in the repository's frozen schema
|
|
150
|
+
store (`commerce/schemas/`) at build time, with the release manifest;
|
|
151
|
+
nothing is embedded by hand.
|
|
152
|
+
- A `$schema` naming no bundled schema fails Layer 1 with one error. In
|
|
153
|
+
0.10.0 the schema was chosen from the envelope field, so a release
|
|
154
|
+
sheet pointing at another version passed Layer 1 and fired `PDP-E-002`;
|
|
155
|
+
it now fails Layer 1 against the schema it names.
|
|
156
|
+
- New exports: `CURRENT_RELEASE`, `schemaUrlFor`, `BUNDLED_SCHEMA_IDS`.
|
|
157
|
+
|
|
158
|
+
Added in 0.12.0 (catalogue 0.16.0), with commerce release 0.4.0. Requires
|
|
159
|
+
`@pagefront/lint-core` 0.3.0.
|
|
160
|
+
|
|
161
|
+
- **A sheet is judged by the release it declares.** Layer 1 validates it
|
|
162
|
+
against the schema its `release` bundles for its type (release 0.4.0:
|
|
163
|
+
`product/v0.10.0.json`, `organization/v0.4.0.json`, which require
|
|
164
|
+
`$schema`; release 0.3.0: the 0.3.0 schemas). Legacy sheets keep
|
|
165
|
+
resolving through `$schema`.
|
|
166
|
+
- **Rules are gated by release.** Every rule has an `appliesFrom` release
|
|
167
|
+
and the engine skips it on a sheet declaring a lower one. All earlier
|
|
168
|
+
rules apply from 0.3.0 and to legacy sheets.
|
|
169
|
+
- `PDP-E-002` and `ORG-E-003` compare a present `$schema` with the URL of
|
|
170
|
+
the schema the release bundles, and are quiet when `$schema` is absent.
|
|
171
|
+
- `PDP-E-017` (applies from release 0.4.0) — an exclusion, or an
|
|
172
|
+
adjustment's `when`, names a dimension the configurator does not declare
|
|
173
|
+
or an option the dimension does not list. Values are compared strictly:
|
|
174
|
+
`1` is not `"1"`.
|
|
175
|
+
- `PDP-E-018` and `ORG-E-004` — the sheet declares a `release` the release
|
|
176
|
+
manifest does not list. At Layer 1 this is a single error at `/release`.
|
|
177
|
+
|
|
146
178
|
## API
|
|
147
179
|
|
|
148
180
|
The public surface — everything importable from the package root, and
|
|
149
|
-
nothing else (the bundled
|
|
181
|
+
nothing else (the bundled schemas and the individual rule modules are
|
|
150
182
|
internal):
|
|
151
183
|
|
|
152
184
|
- `validateAndLint(input: unknown, options?: LintOptions)` — the CLI's
|
|
153
|
-
own pipeline as a function: Layer 1 against the
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`detectSheetType`). Returns
|
|
185
|
+
own pipeline as a function: Layer 1 against the published schema the
|
|
186
|
+
document's declared release bundles for its page type, then Layer 2
|
|
187
|
+
against that page type's catalogue (see `detectSheetType`), with the
|
|
188
|
+
rules that apply from that release. Returns
|
|
158
189
|
`{ layer: 1, schemaErrors: SchemaError[] }` or
|
|
159
|
-
`{ layer: 2, report: Report }`.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
schema
|
|
190
|
+
`{ layer: 2, report: Report }`. The package bundles every published
|
|
191
|
+
schema, on both lines. A `release` the manifest does not list fails
|
|
192
|
+
Layer 1 with a single error at `/release` (keyword `release`). A
|
|
193
|
+
`$schema` that disagrees with the release is a Layer 2 finding. Legacy
|
|
194
|
+
sheets (`format_version`) are validated against the schema their
|
|
195
|
+
`$schema` names, or the legacy schema when it is absent.
|
|
163
196
|
Layer 1 runs validators compiled ahead of time at
|
|
164
197
|
package build, so the pipeline needs no runtime code generation and
|
|
165
198
|
runs under Cloudflare Workers and strict Content Security Policies.
|
|
@@ -167,7 +200,7 @@ internal):
|
|
|
167
200
|
only, for input you have already schema-validated. Dispatches to the
|
|
168
201
|
page type's catalogue the same way.
|
|
169
202
|
- `validateOrganizationSheet(input: unknown)` — Layer 1 only, against
|
|
170
|
-
the
|
|
203
|
+
the Commerce Organization Sheet schema the document names. Returns
|
|
171
204
|
`{ valid: true }` or `{ valid: false, schemaErrors: SchemaError[] }`.
|
|
172
205
|
- `detectSheetType(sheet: Sheet): SheetType` — the page-type dispatch:
|
|
173
206
|
`"organization"` when the envelope `$schema` path contains
|
package/dist/catalogue.js
CHANGED
|
@@ -15,6 +15,8 @@ import { pdpE013 } from "./rules/pdp-e-013.js";
|
|
|
15
15
|
import { pdpE014 } from "./rules/pdp-e-014.js";
|
|
16
16
|
import { pdpE015 } from "./rules/pdp-e-015.js";
|
|
17
17
|
import { pdpE016 } from "./rules/pdp-e-016.js";
|
|
18
|
+
import { pdpE017 } from "./rules/pdp-e-017.js";
|
|
19
|
+
import { pdpE018 } from "./rules/pdp-e-018.js";
|
|
18
20
|
import { pdpW001 } from "./rules/pdp-w-001.js";
|
|
19
21
|
import { pdpW002 } from "./rules/pdp-w-002.js";
|
|
20
22
|
import { pdpW003 } from "./rules/pdp-w-003.js";
|
|
@@ -65,6 +67,6 @@ import { pdpI001 } from "./rules/pdp-i-001.js";
|
|
|
65
67
|
export const commerceCatalogue = {
|
|
66
68
|
vertical: "commerce",
|
|
67
69
|
releases: KNOWN_RELEASES,
|
|
68
|
-
catalogueVersion: "0.
|
|
69
|
-
rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, 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],
|
|
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],
|
|
70
72
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const RELEASE_MANIFEST: {
|
|
2
|
+
readonly $comment: "The commerce release manifest: each release and the member versions it bundles. Consumed by the linter; the human-readable form is releases.md.";
|
|
3
|
+
readonly vertical: "commerce";
|
|
4
|
+
readonly schema_url_template: "https://themachineweb.org/pagefront/spec/commerce/{sheet}/v{version}.json";
|
|
5
|
+
readonly releases: readonly [{
|
|
6
|
+
readonly release: "0.3.0";
|
|
7
|
+
readonly date: "2026-10-01";
|
|
8
|
+
readonly vocabulary: "0.3.0";
|
|
9
|
+
readonly sheets: {
|
|
10
|
+
readonly product: "0.9.0";
|
|
11
|
+
readonly organization: "0.3.0";
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
readonly release: "0.4.0";
|
|
15
|
+
readonly date: "2026-10-02";
|
|
16
|
+
readonly vocabulary: "0.4.0";
|
|
17
|
+
readonly sheets: {
|
|
18
|
+
readonly product: "0.10.0";
|
|
19
|
+
readonly organization: "0.4.0";
|
|
20
|
+
};
|
|
21
|
+
}];
|
|
22
|
+
readonly legacy: {
|
|
23
|
+
readonly envelope_field: "format_version";
|
|
24
|
+
readonly format_versions: readonly ["0.9"];
|
|
25
|
+
readonly schemas: {
|
|
26
|
+
readonly product: "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json";
|
|
27
|
+
readonly organization: "https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
|
|
2
|
+
export const RELEASE_MANIFEST = {
|
|
3
|
+
"$comment": "The commerce release manifest: each release and the member versions it bundles. Consumed by the linter; the human-readable form is releases.md.",
|
|
4
|
+
"vertical": "commerce",
|
|
5
|
+
"schema_url_template": "https://themachineweb.org/pagefront/spec/commerce/{sheet}/v{version}.json",
|
|
6
|
+
"releases": [
|
|
7
|
+
{
|
|
8
|
+
"release": "0.3.0",
|
|
9
|
+
"date": "2026-10-01",
|
|
10
|
+
"vocabulary": "0.3.0",
|
|
11
|
+
"sheets": {
|
|
12
|
+
"product": "0.9.0",
|
|
13
|
+
"organization": "0.3.0"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"release": "0.4.0",
|
|
18
|
+
"date": "2026-10-02",
|
|
19
|
+
"vocabulary": "0.4.0",
|
|
20
|
+
"sheets": {
|
|
21
|
+
"product": "0.10.0",
|
|
22
|
+
"organization": "0.4.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"legacy": {
|
|
27
|
+
"envelope_field": "format_version",
|
|
28
|
+
"format_versions": [
|
|
29
|
+
"0.9"
|
|
30
|
+
],
|
|
31
|
+
"schemas": {
|
|
32
|
+
"product": "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json",
|
|
33
|
+
"organization": "https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SCHEMA_IDS: readonly string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
|
|
2
|
+
export const SCHEMA_IDS = [
|
|
3
|
+
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.3.0.json",
|
|
4
|
+
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.4.0.json",
|
|
5
|
+
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json",
|
|
6
|
+
"https://themachineweb.org/pagefront/spec/commerce/product/v0.10.0.json",
|
|
7
|
+
"https://themachineweb.org/pagefront/spec/commerce/product/v0.9.0.json",
|
|
8
|
+
"https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json"
|
|
9
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DATA_BLOCK_PROPERTIES: readonly string[];
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* The data-block property inventory for PDP-I-001, derived from the
|
|
3
|
-
* Pagefront JSON Schema (commerce/spec/product.json, format 0.9) —
|
|
4
|
-
* the normative property inventory per the catalogue's Definitions
|
|
5
|
-
* section. Generated from `$defs.dataBlock.properties`; the
|
|
6
|
-
* inventory drift test (test/inventory.test.mjs) fails when the
|
|
7
|
-
* schema and this list diverge. Regenerate on schema change, in the
|
|
8
|
-
* same catalogue-versioned change.
|
|
9
|
-
*/
|
|
1
|
+
// Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
|
|
10
2
|
export const DATA_BLOCK_PROPERTIES = [
|
|
11
3
|
"@context",
|
|
12
4
|
"@id",
|
|
@@ -64,5 +56,5 @@ export const DATA_BLOCK_PROPERTIES = [
|
|
|
64
56
|
"variesBy",
|
|
65
57
|
"video",
|
|
66
58
|
"weight",
|
|
67
|
-
"width"
|
|
59
|
+
"width"
|
|
68
60
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SCHEMAS: Readonly<Record<string, Record<string, unknown>>>;
|