@tileflow/capture 0.0.0-bootstrap.0 → 0.1.0-alpha.17

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 CHANGED
@@ -85,8 +85,8 @@ cost in advance or verify prepared CI, not as a prerequisite for normal capture.
85
85
 
86
86
  `createTileflowCaptureReceipt`, `parseTileflowCaptureReceipt`,
87
87
  `validateTileflowCaptureReceipt`, and `serializeTileflowCaptureReceipt` implement the strict,
88
- bounded schema-version-1 receipt contract. A receipt contains image/scene/style hashes, dimensions,
89
- renderer/platform identity, required nullable `source.tilesetVersion` evidence, and
88
+ bounded schema-version-2 receipt contract. A receipt contains image/scene/style hashes, dimensions,
89
+ renderer/platform identity, the required resolved `data` identity, and
90
90
  remote-dependency state; it contains no time, user, origin,
91
91
  repository, absolute path, config source, environment, or credential.
92
92
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Browser } from 'playwright';
2
- import { TileflowCaptureScene } from '@tileflow/core';
2
+ import { TileflowDataIdentity, TileflowCaptureScene } from '@tileflow/core';
3
3
  import { TileflowBuildArtifacts } from '@tileflow/dev';
4
4
 
5
5
  type TileflowCaptureRendererIdentity = {
@@ -38,12 +38,12 @@ declare class TileflowCaptureBrowserManager {
38
38
  close(): Promise<void>;
39
39
  }
40
40
 
41
- declare const tileflowCaptureReceiptSchemaVersion: 1;
41
+ declare const tileflowCaptureReceiptSchemaVersion: 2;
42
42
  declare const tileflowCaptureReceiptLimits: Readonly<{
43
43
  maximumBytes: number;
44
44
  }>;
45
45
  type TileflowCaptureReceipt = {
46
- schemaVersion: 1;
46
+ schemaVersion: 2;
47
47
  scene: {
48
48
  name: string;
49
49
  map: string;
@@ -66,13 +66,12 @@ type TileflowCaptureReceipt = {
66
66
  os: string;
67
67
  architecture: string;
68
68
  };
69
- source: {
70
- tilesetVersion: string | null;
71
- };
69
+ data: TileflowDataIdentity;
72
70
  networkDependent: boolean;
73
71
  };
74
72
  type CreateTileflowCaptureReceiptInput = {
75
73
  dpr: 1 | 2;
74
+ data: TileflowDataIdentity;
76
75
  height: number;
77
76
  map: string;
78
77
  networkDependent: boolean;
@@ -81,7 +80,6 @@ type CreateTileflowCaptureReceiptInput = {
81
80
  scene: string;
82
81
  sceneSha256: string;
83
82
  styleSha256: string;
84
- sourceVersion?: string;
85
83
  target: 'map' | 'application';
86
84
  width: number;
87
85
  };
package/dist/index.js CHANGED
@@ -1206,7 +1206,7 @@ import {
1206
1206
  tileflowCaptureSceneLimits as tileflowCaptureSceneLimits2,
1207
1207
  tileflowCaptureSceneNameSchema
1208
1208
  } from "@tileflow/core";
1209
- var tileflowCaptureReceiptSchemaVersion = 1;
1209
+ var tileflowCaptureReceiptSchemaVersion = 2;
1210
1210
  var tileflowCaptureReceiptLimits = Object.freeze({ maximumBytes: 64 * 1024 });
1211
1211
  function createTileflowCaptureReceipt(input) {
1212
1212
  return validateTileflowCaptureReceipt({
@@ -1228,7 +1228,7 @@ function createTileflowCaptureReceipt(input) {
1228
1228
  },
1229
1229
  renderer: input.renderer,
1230
1230
  platform: { os: process.platform, architecture: process.arch },
1231
- source: { tilesetVersion: input.sourceVersion ?? null },
1231
+ data: input.data,
1232
1232
  networkDependent: input.networkDependent
1233
1233
  });
1234
1234
  }
@@ -1264,7 +1264,7 @@ function validateTileflowCaptureReceipt(value) {
1264
1264
  "image",
1265
1265
  "renderer",
1266
1266
  "platform",
1267
- "source",
1267
+ "data",
1268
1268
  "networkDependent"
1269
1269
  ];
1270
1270
  if (receipt.schemaVersion !== tileflowCaptureReceiptSchemaVersion) {
@@ -1315,8 +1315,20 @@ function validateTileflowCaptureReceipt(value) {
1315
1315
  if (typeof receipt.networkDependent !== "boolean") {
1316
1316
  throw invalidReceipt("The baseline receipt has an invalid network dependency flag.");
1317
1317
  }
1318
- const source = requireRecord(receipt.source, "source");
1319
- requireExactKeys(source, ["tilesetVersion"]);
1318
+ const data = requireRecord(receipt.data, "data");
1319
+ requireExactKeys(data, [
1320
+ "kind",
1321
+ ...data.revision === void 0 ? [] : ["revision"],
1322
+ "schema",
1323
+ "schemaVersion",
1324
+ "sourceId"
1325
+ ]);
1326
+ if (data.kind !== "tileflow-world" && data.kind !== "vector-tiles") {
1327
+ throw invalidReceipt("The baseline receipt has an invalid data.kind.");
1328
+ }
1329
+ if (data.schema !== "openmaptiles" || data.sourceId !== "tileflow") {
1330
+ throw invalidReceipt("The baseline receipt has an unsupported data contract.");
1331
+ }
1320
1332
  return {
1321
1333
  schemaVersion: tileflowCaptureReceiptSchemaVersion,
1322
1334
  scene: {
@@ -1348,7 +1360,13 @@ function validateTileflowCaptureReceipt(value) {
1348
1360
  os: requireBoundedString(platform.os, "platform.os"),
1349
1361
  architecture: requireBoundedString(platform.architecture, "platform.architecture")
1350
1362
  },
1351
- source: { tilesetVersion: requireNullableSourceVersion(source.tilesetVersion) },
1363
+ data: {
1364
+ kind: data.kind,
1365
+ ...data.revision === void 0 ? {} : { revision: requireSourceRevision(data.revision) },
1366
+ schema: data.schema,
1367
+ schemaVersion: requirePositiveInteger(data.schemaVersion, "data.schemaVersion"),
1368
+ sourceId: data.sourceId
1369
+ },
1352
1370
  networkDependent: receipt.networkDependent
1353
1371
  };
1354
1372
  }
@@ -1399,10 +1417,9 @@ function requireBoundedString(value, field) {
1399
1417
  }
1400
1418
  return value;
1401
1419
  }
1402
- function requireNullableSourceVersion(value) {
1403
- if (value === null) return null;
1420
+ function requireSourceRevision(value) {
1404
1421
  if (typeof value !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(value)) {
1405
- throw invalidReceipt("The baseline receipt has an invalid source.tilesetVersion.");
1422
+ throw invalidReceipt("The baseline receipt has an invalid data.revision.");
1406
1423
  }
1407
1424
  return value;
1408
1425
  }
@@ -1529,6 +1546,7 @@ var TileflowCaptureSessionImpl = class {
1529
1546
  ]);
1530
1547
  const target = scene.target.kind;
1531
1548
  const receipt = createTileflowCaptureReceipt({
1549
+ data: style.metadata?.["tileflow:data"],
1532
1550
  dpr: scene.viewport.dpr,
1533
1551
  height: rendered.height,
1534
1552
  map: scene.map,
@@ -1538,7 +1556,6 @@ var TileflowCaptureSessionImpl = class {
1538
1556
  scene: sceneName,
1539
1557
  sceneSha256,
1540
1558
  styleSha256,
1541
- ...typeof style.metadata?.["tileflow:tilesetVersion"] === "string" ? { sourceVersion: style.metadata["tileflow:tilesetVersion"] } : {},
1542
1559
  target,
1543
1560
  width: rendered.width
1544
1561
  });
@@ -2034,7 +2051,7 @@ function pixelMetric(changedPixels, totalPixels) {
2034
2051
  return { changedPixels, totalPixels, ratio: changedPixels / totalPixels };
2035
2052
  }
2036
2053
  function sameSceneIdentity(baseline, actual) {
2037
- return baseline.scene.name === actual.scene.name && baseline.scene.map === actual.scene.map && baseline.scene.target === actual.scene.target && baseline.scene.sha256 === actual.scene.sha256 && baseline.source.tilesetVersion === actual.source.tilesetVersion;
2054
+ return baseline.scene.name === actual.scene.name && baseline.scene.map === actual.scene.map && baseline.scene.target === actual.scene.target && baseline.scene.sha256 === actual.scene.sha256 && serializeCanonicalJson3(baseline.data) === serializeCanonicalJson3(actual.data);
2038
2055
  }
2039
2056
  function sameRuntimeIdentity(baseline, actual) {
2040
2057
  return baseline.renderer.tileflow === actual.renderer.tileflow && baseline.renderer.maplibre === actual.renderer.maplibre && baseline.renderer.playwright === actual.renderer.playwright && baseline.renderer.chromiumRevision === actual.renderer.chromiumRevision && baseline.renderer.chromiumVersion === actual.renderer.chromiumVersion && baseline.platform.os === actual.platform.os && baseline.platform.architecture === actual.platform.architecture;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/capture",
3
- "version": "0.0.0-bootstrap.0",
3
+ "version": "0.1.0-alpha.17",
4
4
  "description": "Deterministic local visual capture and comparison for Tileflow maps.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,22 +37,22 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
+ "@tileflow/core": ">=0.1.0-alpha.19 <0.1.0-beta.0",
41
+ "@tileflow/dev": ">=0.1.0-alpha.18 <0.1.0-beta.0",
40
42
  "maplibre-gl": "5.24.0",
41
43
  "pixelmatch": "7.2.0",
42
44
  "playwright": "1.60.0",
43
- "pngjs": "7.0.0",
44
- "@tileflow/core": "0.1.0-alpha.15",
45
- "@tileflow/dev": "0.1.0-alpha.15"
45
+ "pngjs": "7.0.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^25.9.2",
49
49
  "@types/pngjs": "6.0.5",
50
- "next": "16.2.11",
50
+ "next": "16.3.0",
51
51
  "react": "^19.2.7",
52
52
  "react-dom": "^19.2.7",
53
53
  "vite": "^8.0.16",
54
54
  "webpack": "5.108.3",
55
- "@tileflow/react": "0.1.0-alpha.15"
55
+ "@tileflow/react": "0.1.0-alpha.19"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup src/index.ts --format esm --dts --clean --platform node",
@@ -62,4 +62,4 @@
62
62
  "smoke:browser": "pnpm run test",
63
63
  "verify": "pnpm run typecheck && pnpm run test"
64
64
  }
65
- }
65
+ }