@orkestrel/capture 0.0.9 → 0.0.10
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 +4 -2
- package/dist/src/core/index.cjs +75 -22
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +124 -51
- package/dist/src/core/index.d.ts +124 -51
- package/dist/src/core/index.js +73 -22
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +1012 -316
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +523 -22
- package/dist/src/server/index.d.ts +523 -22
- package/dist/src/server/index.js +991 -319
- package/dist/src/server/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import type { CAPTURE_VERSION } from '@orkestrel/capture';
|
|
1
2
|
import type { CaptureCollectionReceipt } from '@orkestrel/capture';
|
|
2
3
|
import type { CaptureDeclaration } from '@orkestrel/capture';
|
|
3
4
|
import type { CaptureDestination } from '@orkestrel/capture';
|
|
4
5
|
import type { CaptureDigest } from '@orkestrel/capture';
|
|
5
6
|
import { CaptureError } from '@orkestrel/capture';
|
|
7
|
+
import type { CaptureErrorCode } from '@orkestrel/capture';
|
|
8
|
+
import type { CaptureExpandedManifest } from '@orkestrel/capture';
|
|
6
9
|
import type { CaptureFreshness } from '@orkestrel/capture';
|
|
7
10
|
import type { CaptureLookup } from '@orkestrel/capture';
|
|
8
11
|
import type { CaptureLookupJournal } from '@orkestrel/capture';
|
|
12
|
+
import type { CaptureManifestDocument } from '@orkestrel/capture';
|
|
9
13
|
import type { CapturePortfolioRoot } from '@orkestrel/capture';
|
|
10
14
|
import type { CaptureProvided } from '@orkestrel/capture';
|
|
11
15
|
import type { CaptureReceipt } from '@orkestrel/capture';
|
|
@@ -15,7 +19,7 @@ import type { CaptureRun } from '@orkestrel/capture';
|
|
|
15
19
|
import type { CaptureSelection } from '@orkestrel/capture';
|
|
16
20
|
import type { CaptureSources } from '@orkestrel/capture';
|
|
17
21
|
import type { CaptureStamp } from '@orkestrel/capture';
|
|
18
|
-
import type {
|
|
22
|
+
import type { CaptureStatus } from '@orkestrel/capture';
|
|
19
23
|
import type { CaptureViewport } from '@orkestrel/capture';
|
|
20
24
|
import type { CaptureWarning } from '@orkestrel/capture';
|
|
21
25
|
import type { DuplexInterface } from '@orkestrel/process';
|
|
@@ -178,11 +182,25 @@ export declare function buildCaptureIntegrityOptions(root: string, project: Capt
|
|
|
178
182
|
*
|
|
179
183
|
* @example
|
|
180
184
|
* ```ts
|
|
181
|
-
* buildCaptureLookupJournal([], []).
|
|
185
|
+
* buildCaptureLookupJournal([], []).populations // {}
|
|
182
186
|
* ```
|
|
183
187
|
*/
|
|
184
188
|
export declare function buildCaptureLookupJournal(lookups: readonly CaptureLookup[], collections: readonly CaptureCollectionReceipt[], manifest?: string): CaptureLookupJournal;
|
|
185
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Stores each distinct file map of an expanded manifest once, in a table keyed by the map's digest.
|
|
192
|
+
*
|
|
193
|
+
* @param manifest - The expanded manifest the engine publishes
|
|
194
|
+
* @returns The document whose stamps, lookups, and collections name their maps by table key
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* const document = buildCaptureManifestDocument(manifest)
|
|
199
|
+
* Object.keys(document.populations) // one digest per distinct shared or input map
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
export declare function buildCaptureManifestDocument(manifest: CaptureExpandedManifest): CaptureManifestDocument;
|
|
203
|
+
|
|
186
204
|
/**
|
|
187
205
|
* Builds the values capture merges into one variant's Vitest project.
|
|
188
206
|
*
|
|
@@ -199,6 +217,19 @@ export declare function buildCaptureLookupJournal(lookups: readonly CaptureLooku
|
|
|
199
217
|
*/
|
|
200
218
|
export declare function buildCaptureOverride(options: Omit<CaptureWrapperOptions<unknown>, 'url' | 'project'>, variant: CaptureViewport, provided: Pick<CaptureProvided, 'directory' | 'record' | 'capture' | 'request'>): CaptureWrapperOverride;
|
|
201
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Builds the report a preflight prints and a contact-sheet index carries from one preflight result.
|
|
222
|
+
*
|
|
223
|
+
* @param result - The judged selection
|
|
224
|
+
* @returns The selection, freshness, mixed observations, issues, identical groups, image sizes, and `acceptance: false`
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* buildCaptureReaderReport(await preflight.check()).acceptance // false
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export declare function buildCaptureReaderReport(result: CapturePreflightResult): CaptureReaderReport;
|
|
232
|
+
|
|
202
233
|
/**
|
|
203
234
|
* Imports complete receipts only after their actual exits and exact report bytes validate.
|
|
204
235
|
*
|
|
@@ -230,6 +261,21 @@ export declare function buildCaptureRegistry(inputs: readonly CaptureReceiptInpu
|
|
|
230
261
|
*/
|
|
231
262
|
export declare function buildCaptureRequestRefusal(file: string, cause?: unknown): CaptureError;
|
|
232
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Builds a document's population table from the memo its table keys were computed through.
|
|
266
|
+
*
|
|
267
|
+
* @param memo - The memo `computeCaptureTableKey` filled for one document build
|
|
268
|
+
* @returns Each distinct ordered map under its digest, in the order the build first met it
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* const memo = new Map()
|
|
273
|
+
* const key = computeCaptureTableKey({ 'src/a.ts': 'f'.repeat(64) }, memo)
|
|
274
|
+
* buildCaptureTable(memo)[key] // { 'src/a.ts': 'ffff…' }
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
export declare function buildCaptureTable(memo: ReadonlyMap<Readonly<Record<string, string>>, CaptureDigest>): Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
278
|
+
|
|
233
279
|
/**
|
|
234
280
|
* Builds a journey wrapper's Vitest configuration as plain data, answering discovery first.
|
|
235
281
|
*
|
|
@@ -607,6 +653,22 @@ export declare const CAPTURE_PNG_LIMITS: Readonly<{
|
|
|
607
653
|
*/
|
|
608
654
|
export declare const CAPTURE_PROGRESS_SUFFIX = ".progress.jsonl";
|
|
609
655
|
|
|
656
|
+
/**
|
|
657
|
+
* Names the command that clears each refusal condition, or none where no command clears it.
|
|
658
|
+
*
|
|
659
|
+
* @remarks
|
|
660
|
+
* `registry` is the complete-registry refresh, and `journey` is the selected owner's journey, which
|
|
661
|
+
* refreshes its state lookups. A runner prints the command on stdout after the report line it
|
|
662
|
+
* follows, ahead of the refusal on stderr, and on stderr after the refusal when no report line
|
|
663
|
+
* precedes it; a condition with no command prints none.
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```ts
|
|
667
|
+
* CAPTURE_RECOVERIES.REGISTRY // 'registry'
|
|
668
|
+
* ```
|
|
669
|
+
*/
|
|
670
|
+
export declare const CAPTURE_RECOVERIES: Readonly<Record<CaptureErrorCode, 'registry' | 'journey' | undefined>>;
|
|
671
|
+
|
|
610
672
|
/**
|
|
611
673
|
* Caps each refusal population so hostile records cannot flood a terminal or agent context.
|
|
612
674
|
* @example
|
|
@@ -726,6 +788,20 @@ export declare const CAPTURE_STAGES: Readonly<{
|
|
|
726
788
|
readonly rest: 'rest';
|
|
727
789
|
}>;
|
|
728
790
|
|
|
791
|
+
/**
|
|
792
|
+
* Names the command that clears each freshness classification, or none where no command clears it.
|
|
793
|
+
*
|
|
794
|
+
* @remarks
|
|
795
|
+
* `capture` is a frames run over the read selection. A `duplicate` or an `orphan` names a registry
|
|
796
|
+
* or a file that no frames run changes, and a `current` frame needs nothing.
|
|
797
|
+
*
|
|
798
|
+
* @example
|
|
799
|
+
* ```ts
|
|
800
|
+
* CAPTURE_STATUS_RECOVERIES['stale-own'] // 'capture'
|
|
801
|
+
* ```
|
|
802
|
+
*/
|
|
803
|
+
export declare const CAPTURE_STATUS_RECOVERIES: Readonly<Record<CaptureStatus, 'capture' | undefined>>;
|
|
804
|
+
|
|
729
805
|
/**
|
|
730
806
|
* Names the executable's subcommands in the order its usage text lists them.
|
|
731
807
|
*
|
|
@@ -1213,7 +1289,7 @@ export declare interface CaptureDiscoveryOptions {
|
|
|
1213
1289
|
* @example
|
|
1214
1290
|
* ```ts
|
|
1215
1291
|
* const request: CaptureDiscoveryRequest = {
|
|
1216
|
-
* version:
|
|
1292
|
+
* version: 2,
|
|
1217
1293
|
* phase: 'discover',
|
|
1218
1294
|
* id: 'run-1',
|
|
1219
1295
|
* nonce: 'a1b2',
|
|
@@ -1224,7 +1300,7 @@ export declare interface CaptureDiscoveryOptions {
|
|
|
1224
1300
|
* ```
|
|
1225
1301
|
*/
|
|
1226
1302
|
export declare interface CaptureDiscoveryRequest {
|
|
1227
|
-
readonly version:
|
|
1303
|
+
readonly version: typeof CAPTURE_VERSION;
|
|
1228
1304
|
readonly phase: 'discover';
|
|
1229
1305
|
readonly id: string;
|
|
1230
1306
|
readonly nonce: string;
|
|
@@ -1267,7 +1343,7 @@ export declare interface CaptureDiscoveryRunOptions {
|
|
|
1267
1343
|
export declare interface CaptureEvidence {
|
|
1268
1344
|
readonly registry: CaptureRegistry;
|
|
1269
1345
|
readonly collections: readonly CaptureCollectionReceipt[];
|
|
1270
|
-
readonly manifest?:
|
|
1346
|
+
readonly manifest?: CaptureExpandedManifest;
|
|
1271
1347
|
readonly lookups: readonly CaptureLookup[];
|
|
1272
1348
|
readonly runs: readonly CaptureRunEvidence[];
|
|
1273
1349
|
}
|
|
@@ -1371,7 +1447,7 @@ export declare interface CaptureHolder {
|
|
|
1371
1447
|
* @example
|
|
1372
1448
|
* ```ts
|
|
1373
1449
|
* const description: CaptureHostDescription = {
|
|
1374
|
-
* version:
|
|
1450
|
+
* version: 2,
|
|
1375
1451
|
* id: 'run-1',
|
|
1376
1452
|
* nonce: 'a1b2',
|
|
1377
1453
|
* config: 'configs/vite.journey.config.ts',
|
|
@@ -1382,7 +1458,7 @@ export declare interface CaptureHolder {
|
|
|
1382
1458
|
* ```
|
|
1383
1459
|
*/
|
|
1384
1460
|
export declare interface CaptureHostDescription {
|
|
1385
|
-
readonly version:
|
|
1461
|
+
readonly version: typeof CAPTURE_VERSION;
|
|
1386
1462
|
readonly id: string;
|
|
1387
1463
|
readonly nonce: string;
|
|
1388
1464
|
readonly config: string;
|
|
@@ -1522,8 +1598,9 @@ export declare class CaptureIntegrity implements CaptureIntegrityInterface {
|
|
|
1522
1598
|
*
|
|
1523
1599
|
* @param options - The original selector, producing variants, state, and optional exact case
|
|
1524
1600
|
* @returns The agreed declaring case, output mappings, and validated lookup receipts
|
|
1525
|
-
* @throws Thrown when evidence is missing, stale, ambiguous, or disagrees with the selection;
|
|
1526
|
-
* the
|
|
1601
|
+
* @throws Thrown when evidence is missing, stale, ambiguous, or disagrees with the selection; a
|
|
1602
|
+
* refusal of the requested state names the owner's journey refresh, and a fault in the evidence
|
|
1603
|
+
* read keeps its own message.
|
|
1527
1604
|
*
|
|
1528
1605
|
* @example
|
|
1529
1606
|
* ```ts
|
|
@@ -2388,6 +2465,34 @@ export declare interface CaptureReaderOptions {
|
|
|
2388
2465
|
readonly stderr?: CaptureWriteHandler;
|
|
2389
2466
|
}
|
|
2390
2467
|
|
|
2468
|
+
/**
|
|
2469
|
+
* Holds the report a preflight prints on its `READER` line and a contact-sheet index carries.
|
|
2470
|
+
*
|
|
2471
|
+
* @remarks
|
|
2472
|
+
* `identical` groups the files whose bytes are identical, and `sizes` gives each readable image's
|
|
2473
|
+
* decoded dimensions and its file size in bytes. `acceptance` is always `false`: the report is
|
|
2474
|
+
* iteration evidence and never assembled-portfolio acceptance.
|
|
2475
|
+
*
|
|
2476
|
+
* @example
|
|
2477
|
+
* ```ts
|
|
2478
|
+
* const report: CaptureReaderReport = buildCaptureReaderReport(await preflight.check())
|
|
2479
|
+
* ```
|
|
2480
|
+
*/
|
|
2481
|
+
export declare interface CaptureReaderReport {
|
|
2482
|
+
readonly selection: CaptureReadResult;
|
|
2483
|
+
readonly freshness: CaptureCheckResult;
|
|
2484
|
+
readonly mixed: readonly string[];
|
|
2485
|
+
readonly issues: readonly string[];
|
|
2486
|
+
readonly identical: ReadonlyArray<readonly string[]>;
|
|
2487
|
+
readonly sizes: ReadonlyArray<{
|
|
2488
|
+
readonly file: string;
|
|
2489
|
+
readonly width: number;
|
|
2490
|
+
readonly height: number;
|
|
2491
|
+
readonly bytes: number;
|
|
2492
|
+
}>;
|
|
2493
|
+
readonly acceptance: false;
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2391
2496
|
/**
|
|
2392
2497
|
* Returns a reader's authenticated selection, uniform scopes, and engine for pixel classification.
|
|
2393
2498
|
*
|
|
@@ -2470,7 +2575,8 @@ export declare interface CaptureReceiptInput {
|
|
|
2470
2575
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
2471
2576
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
2472
2577
|
* run into a refresh and refuses while another runner holds a request file in the request directory.
|
|
2473
|
-
* Before any stage, it reads the inherited manifest and lookup journal
|
|
2578
|
+
* Before any stage, it reads the inherited manifest and lookup journal: it refuses a document of
|
|
2579
|
+
* another version with that refusal's own removal and refresh commands alone, and an unsupported
|
|
2474
2580
|
* schema with the file to inspect and repair.
|
|
2475
2581
|
*
|
|
2476
2582
|
* @example
|
|
@@ -2822,6 +2928,36 @@ export declare interface CaptureSheetGroup {
|
|
|
2822
2928
|
readonly picture: CapturePicture;
|
|
2823
2929
|
}
|
|
2824
2930
|
|
|
2931
|
+
/**
|
|
2932
|
+
* Holds a contact-sheet run's `index.json` document, which its `SHEETS` line also prints.
|
|
2933
|
+
*
|
|
2934
|
+
* @remarks
|
|
2935
|
+
* It carries every member of the preflight report beside `sheets`, which lists each written sheet
|
|
2936
|
+
* with its size and its rows of groups. A cell keeps every member of its sheet cell except the
|
|
2937
|
+
* picture, and `displayed` gives the size of the shrunk picture the sheet shows.
|
|
2938
|
+
*
|
|
2939
|
+
* @example
|
|
2940
|
+
* ```ts
|
|
2941
|
+
* const index: CaptureSheetIndex = { ...buildCaptureReaderReport(result), sheets: [] }
|
|
2942
|
+
* ```
|
|
2943
|
+
*/
|
|
2944
|
+
export declare interface CaptureSheetIndex extends CaptureReaderReport {
|
|
2945
|
+
readonly sheets: ReadonlyArray<{
|
|
2946
|
+
readonly file: string;
|
|
2947
|
+
readonly width: number;
|
|
2948
|
+
readonly height: number;
|
|
2949
|
+
readonly rows: ReadonlyArray<ReadonlyArray<{
|
|
2950
|
+
readonly identity: string;
|
|
2951
|
+
readonly cells: ReadonlyArray<Omit<CaptureSheetCell, 'picture'> & {
|
|
2952
|
+
readonly displayed: {
|
|
2953
|
+
readonly width: number;
|
|
2954
|
+
readonly height: number;
|
|
2955
|
+
};
|
|
2956
|
+
}>;
|
|
2957
|
+
}>>;
|
|
2958
|
+
}>;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2825
2961
|
/**
|
|
2826
2962
|
* Carries a contact-sheet output request separately from the population selection.
|
|
2827
2963
|
*
|
|
@@ -2870,8 +3006,8 @@ export declare interface CaptureSheetRow {
|
|
|
2870
3006
|
* selection through `CapturePreflight`, so it judges the same population the preflight does and
|
|
2871
3007
|
* keeps its refusals. It writes the sheets, an index of every cell, and a notes document into a new
|
|
2872
3008
|
* directory that is contained in the workspace, has an existing parent, and lies outside every
|
|
2873
|
-
* selected capture directory. A frame whose image cannot be read shows as a red mark
|
|
2874
|
-
*
|
|
3009
|
+
* selected capture directory. A frame whose image cannot be read shows as a red mark with no source
|
|
3010
|
+
* size, and its index cell carries the freshness the engine classified, `missing` for an absent file.
|
|
2875
3011
|
*
|
|
2876
3012
|
* @example
|
|
2877
3013
|
* ```ts
|
|
@@ -3199,6 +3335,31 @@ export declare function collectCaptureErrors(file: string, text: string): readon
|
|
|
3199
3335
|
*/
|
|
3200
3336
|
export declare function collectCaptureIdentical(images: readonly CaptureImageResult[]): ReadonlyArray<readonly string[]>;
|
|
3201
3337
|
|
|
3338
|
+
/**
|
|
3339
|
+
* Collects the owner selectors the projects' owner tags declare, once each, in tag order.
|
|
3340
|
+
*
|
|
3341
|
+
* @param projects - The discovered host projects
|
|
3342
|
+
* @returns Each tagged owner selector, ancestors included where the wrapper tags them
|
|
3343
|
+
* @example
|
|
3344
|
+
* ```ts
|
|
3345
|
+
* collectCaptureOwners(projects) // ['pages', 'pages:mail'] for owner:pages and owner:pages:mail tags
|
|
3346
|
+
* ```
|
|
3347
|
+
*/
|
|
3348
|
+
export declare function collectCaptureOwners(projects: readonly CaptureProject[]): readonly string[];
|
|
3349
|
+
|
|
3350
|
+
/**
|
|
3351
|
+
* Collects the variants that produce each destination across the registry receipts and the lookup runs.
|
|
3352
|
+
*
|
|
3353
|
+
* @param evidence - The accepted registry and the authenticated lookup runs
|
|
3354
|
+
* @returns Each destination description mapped to its distinct producing variants, in first-seen order
|
|
3355
|
+
*
|
|
3356
|
+
* @example
|
|
3357
|
+
* ```ts
|
|
3358
|
+
* collectCaptureProducers({ registry, runs: [] }).get(describeCaptureDestination(destination)) // ['light-390']
|
|
3359
|
+
* ```
|
|
3360
|
+
*/
|
|
3361
|
+
export declare function collectCaptureProducers(evidence: Pick<CaptureEvidence, 'registry' | 'runs'>): ReadonlyMap<string, readonly string[]>;
|
|
3362
|
+
|
|
3202
3363
|
/**
|
|
3203
3364
|
* Composes pictures on the contact-sheet gray background.
|
|
3204
3365
|
*
|
|
@@ -3218,6 +3379,22 @@ export declare function collectCaptureIdentical(images: readonly CaptureImageRes
|
|
|
3218
3379
|
*/
|
|
3219
3380
|
export declare function composeCapturePictures(pictures: readonly CapturePicture[], vertical: boolean, gap?: number): CapturePicture;
|
|
3220
3381
|
|
|
3382
|
+
/**
|
|
3383
|
+
* Computes the width and height of the composite that `composeCapturePictures` builds from
|
|
3384
|
+
* pictures of these sizes.
|
|
3385
|
+
*
|
|
3386
|
+
* @param pictures - The ordered source sizes
|
|
3387
|
+
* @param vertical - If `true`, stacks them; if `false`, places them side by side
|
|
3388
|
+
* @param gap - The space between source pictures. Default: 6.
|
|
3389
|
+
* @returns The composite's width and height, each 0 for no pictures
|
|
3390
|
+
*
|
|
3391
|
+
* @example
|
|
3392
|
+
* ```ts
|
|
3393
|
+
* computeCaptureComposite([{ width: 4, height: 2 }, { width: 3, height: 5 }], false) // { width: 13, height: 5 }
|
|
3394
|
+
* ```
|
|
3395
|
+
*/
|
|
3396
|
+
export declare function computeCaptureComposite(pictures: ReadonlyArray<Pick<CapturePicture, 'width' | 'height'>>, vertical: boolean, gap?: number): Pick<CapturePicture, 'width' | 'height'>;
|
|
3397
|
+
|
|
3221
3398
|
/**
|
|
3222
3399
|
* Hashes exact source or image bytes with SHA-256.
|
|
3223
3400
|
*
|
|
@@ -3250,6 +3427,25 @@ export declare function computeCaptureHash(bytes: string | Uint8Array): string;
|
|
|
3250
3427
|
*/
|
|
3251
3428
|
export declare function computeCaptureMatchKey(inputs: CaptureDigest, patterns: readonly string[]): string;
|
|
3252
3429
|
|
|
3430
|
+
/**
|
|
3431
|
+
* Computes the table key of a file map, the digest from `buildCaptureDigest([], files)`, once per map.
|
|
3432
|
+
*
|
|
3433
|
+
* @remarks
|
|
3434
|
+
* The memo belongs to one document build: it holds each map by identity beside its ordered,
|
|
3435
|
+
* digested population, so equal maps from different objects share one key.
|
|
3436
|
+
*
|
|
3437
|
+
* @param files - The path-to-hash map a document stores once
|
|
3438
|
+
* @param memo - The build's memo from each map to its ordered, digested population
|
|
3439
|
+
* @returns The digest that names the map in the document's population table
|
|
3440
|
+
*
|
|
3441
|
+
* @example
|
|
3442
|
+
* ```ts
|
|
3443
|
+
* const memo = new Map()
|
|
3444
|
+
* computeCaptureTableKey({ 'src/a.ts': 'f'.repeat(64) }, memo).length // 64
|
|
3445
|
+
* ```
|
|
3446
|
+
*/
|
|
3447
|
+
export declare function computeCaptureTableKey(files: Readonly<Record<string, string>>, memo: Map<Readonly<Record<string, string>>, CaptureDigest>): string;
|
|
3448
|
+
|
|
3253
3449
|
/**
|
|
3254
3450
|
* Computes the registry identity from its authenticated receipts and exact output population.
|
|
3255
3451
|
*
|
|
@@ -3258,7 +3454,7 @@ export declare function computeCaptureMatchKey(inputs: CaptureDigest, patterns:
|
|
|
3258
3454
|
*
|
|
3259
3455
|
* @example
|
|
3260
3456
|
* ```ts
|
|
3261
|
-
* computeRegistryDigest({ version:
|
|
3457
|
+
* computeRegistryDigest({ version: 2, receipts: [], entries: [] }).length // 64
|
|
3262
3458
|
* ```
|
|
3263
3459
|
*/
|
|
3264
3460
|
export declare function computeRegistryDigest(registry: Pick<CaptureRegistry, 'version' | 'receipts' | 'entries'>): string;
|
|
@@ -3403,6 +3599,22 @@ export declare function createCaptureSheets(options: CaptureSheetOptions): Captu
|
|
|
3403
3599
|
*/
|
|
3404
3600
|
export declare function decodeCapturePicture(bytes: Buffer): CapturePicture;
|
|
3405
3601
|
|
|
3602
|
+
/**
|
|
3603
|
+
* Describes the PNG chunk whose header sits at an offset by its type, offset, and length.
|
|
3604
|
+
*
|
|
3605
|
+
* @remarks The type is untrusted file bytes, so it is JSON-encoded and length-capped.
|
|
3606
|
+
*
|
|
3607
|
+
* @param bytes - The complete PNG
|
|
3608
|
+
* @param position - The offset of the chunk header, with its 8 header bytes inside `bytes`
|
|
3609
|
+
* @returns The chunk's description for a refusal
|
|
3610
|
+
*
|
|
3611
|
+
* @example
|
|
3612
|
+
* ```ts
|
|
3613
|
+
* describeCaptureChunk(encodeCapturePicture(picture), 8) // '"IHDR" at offset 8 with length 13'
|
|
3614
|
+
* ```
|
|
3615
|
+
*/
|
|
3616
|
+
export declare function describeCaptureChunk(bytes: Buffer, position: number): string;
|
|
3617
|
+
|
|
3406
3618
|
/**
|
|
3407
3619
|
* Describes a refusal with its key path, bounded preview, correction, and member differences.
|
|
3408
3620
|
*
|
|
@@ -3501,7 +3713,8 @@ export declare function encodeCaptureChunk(name: string, data: Buffer): Buffer;
|
|
|
3501
3713
|
* @param picture - The complete RGB pixel buffer
|
|
3502
3714
|
* @param compressed - If `true`, compresses scanlines; if `false`, stores them in the deflate stream. Default: `true`.
|
|
3503
3715
|
* @returns A PNG file
|
|
3504
|
-
* @throws Thrown when
|
|
3716
|
+
* @throws Thrown when a dimension is not a whole number of at least 1, or when the pixel length is
|
|
3717
|
+
* not `width * height * 3`.
|
|
3505
3718
|
*
|
|
3506
3719
|
* @example
|
|
3507
3720
|
* ```ts
|
|
@@ -3558,7 +3771,8 @@ export declare function filterCaptureInputs(inputs: CaptureDigest, patterns: rea
|
|
|
3558
3771
|
* Inflates a PNG's compressed stream, refusing one that is corrupt or longer than declared.
|
|
3559
3772
|
*
|
|
3560
3773
|
* @param data - The concatenated data-chunk payloads
|
|
3561
|
-
* @param length - The inflated length the header's dimensions declare
|
|
3774
|
+
* @param length - The inflated length the header's dimensions declare, a whole number from 1 to
|
|
3775
|
+
* `Number.MAX_SAFE_INTEGER`; any other value gives an unspecified result that might throw
|
|
3562
3776
|
* @returns The inflated scanlines
|
|
3563
3777
|
* @throws Thrown when the stream is not valid deflate data or inflates past `length`.
|
|
3564
3778
|
*
|
|
@@ -3579,6 +3793,20 @@ export declare function inflateCaptureStream(data: Buffer, length: number): Buff
|
|
|
3579
3793
|
*/
|
|
3580
3794
|
export declare function matchesCaptureFile(previous: CaptureFileSnapshot, current: CaptureFileSnapshot | undefined): boolean;
|
|
3581
3795
|
|
|
3796
|
+
/**
|
|
3797
|
+
* Checks whether a picture size fits `CAPTURE_PNG_LIMITS`, per side and in pixels.
|
|
3798
|
+
*
|
|
3799
|
+
* @param picture - The size to check
|
|
3800
|
+
* @returns True if neither side passes `CAPTURE_PNG_LIMITS.side` and the area does not pass
|
|
3801
|
+
* `CAPTURE_PNG_LIMITS.pixels`; false otherwise
|
|
3802
|
+
*
|
|
3803
|
+
* @example
|
|
3804
|
+
* ```ts
|
|
3805
|
+
* matchesCaptureLimits({ width: 13040, height: 1636 }) // false
|
|
3806
|
+
* ```
|
|
3807
|
+
*/
|
|
3808
|
+
export declare function matchesCaptureLimits(picture: Pick<CapturePicture, 'width' | 'height'>): boolean;
|
|
3809
|
+
|
|
3582
3810
|
/**
|
|
3583
3811
|
* Checks whether bytes open with the eight-byte PNG signature.
|
|
3584
3812
|
*
|
|
@@ -3603,6 +3831,24 @@ export declare function matchesCaptureSignature(bytes: Uint8Array): boolean;
|
|
|
3603
3831
|
*/
|
|
3604
3832
|
export declare function matchesCaptureTransient(error: unknown, platform?: NodeJS.Platform): boolean;
|
|
3605
3833
|
|
|
3834
|
+
/**
|
|
3835
|
+
* Checks whether an error is the refusal `requireCaptureVersion` throws for another document version.
|
|
3836
|
+
*
|
|
3837
|
+
* @remarks
|
|
3838
|
+
* A caller that adds its own recovery to a refusal passes this one through unchanged, because it
|
|
3839
|
+
* already names the removal and the refresh.
|
|
3840
|
+
*
|
|
3841
|
+
* @param error - The caught value
|
|
3842
|
+
* @returns True if it is an `EVIDENCE` capture error whose context carries a file and a numeric version; false otherwise
|
|
3843
|
+
*
|
|
3844
|
+
* @example
|
|
3845
|
+
* ```ts
|
|
3846
|
+
* matchesCaptureVersionRefusal(captureError(() => requireCaptureVersion({ version: 1 }, 'Registry', file, [file]))) // true
|
|
3847
|
+
* matchesCaptureVersionRefusal(new Error('Invalid')) // false
|
|
3848
|
+
* ```
|
|
3849
|
+
*/
|
|
3850
|
+
export declare function matchesCaptureVersionRefusal(error: unknown): boolean;
|
|
3851
|
+
|
|
3606
3852
|
/**
|
|
3607
3853
|
* Merges unique lookup populations with incoming identities replacing inherited ones.
|
|
3608
3854
|
*
|
|
@@ -3684,7 +3930,10 @@ export declare function readCaptureArguments(argv: readonly string[], command: C
|
|
|
3684
3930
|
* @param bytes - The complete PNG
|
|
3685
3931
|
* @param offset - The next chunk header. Default: 8.
|
|
3686
3932
|
* @returns Ordered compressed-data chunks
|
|
3687
|
-
* @throws Thrown for
|
|
3933
|
+
* @throws Thrown for bytes over the file budget; a truncated chunk, which a file with no closing
|
|
3934
|
+
* chunk also meets; a bad checksum; a closing chunk that is not empty and last; an IHDR chunk
|
|
3935
|
+
* anywhere but offset 8; a critical chunk other than IHDR, PLTE, IDAT, and IEND; or IDAT chunks
|
|
3936
|
+
* that are not consecutive.
|
|
3688
3937
|
*
|
|
3689
3938
|
* @example
|
|
3690
3939
|
* ```ts
|
|
@@ -3803,19 +4052,54 @@ export declare function readCaptureInputs(root: string, patterns: readonly strin
|
|
|
3803
4052
|
*/
|
|
3804
4053
|
export declare function readCaptureListing<TEntry>(directory: string, list: (path: string) => readonly TEntry[]): readonly TEntry[];
|
|
3805
4054
|
|
|
4055
|
+
/**
|
|
4056
|
+
* Admits a decoded lookup journal, checking its declared version before its schema.
|
|
4057
|
+
*
|
|
4058
|
+
* @param value - The decoded journal file
|
|
4059
|
+
* @param file - The journal path each refusal names
|
|
4060
|
+
* @returns The journal, whose table digests `readCaptureLookups` verifies
|
|
4061
|
+
* @throws Thrown with the removal and the refresh commands when the journal declares another
|
|
4062
|
+
* protocol version, and thrown naming the file when its schema is invalid.
|
|
4063
|
+
*
|
|
4064
|
+
* @example
|
|
4065
|
+
* ```ts
|
|
4066
|
+
* readCaptureLookupJournal(JSON.parse(text), 'tmp/captures/states/lookups.json').lookups.length
|
|
4067
|
+
* ```
|
|
4068
|
+
*/
|
|
4069
|
+
export declare function readCaptureLookupJournal(value: unknown, file: string): CaptureLookupJournal;
|
|
4070
|
+
|
|
3806
4071
|
/**
|
|
3807
4072
|
* Resolves journal lookup references after verifying each stored input population's digest.
|
|
3808
4073
|
*
|
|
3809
4074
|
* @param journal - A structurally validated lookup journal
|
|
4075
|
+
* @param file - The journal path each refusal names
|
|
3810
4076
|
* @returns Every expanded lookup in its stored order, sharing the verified input maps
|
|
3811
|
-
* @throws Thrown when
|
|
4077
|
+
* @throws Thrown when a population does not hash to its key or a lookup names an unknown key.
|
|
4078
|
+
*
|
|
4079
|
+
* @example
|
|
4080
|
+
* ```ts
|
|
4081
|
+
* readCaptureLookups(buildCaptureLookupJournal([], []), 'tmp/captures/states/lookups.json') // []
|
|
4082
|
+
* ```
|
|
4083
|
+
*/
|
|
4084
|
+
export declare function readCaptureLookups(journal: CaptureLookupJournal, file: string): readonly CaptureLookup[];
|
|
4085
|
+
|
|
4086
|
+
/**
|
|
4087
|
+
* Admits a stored manifest and expands every table reference into the file map it names.
|
|
4088
|
+
*
|
|
4089
|
+
* @param value - The decoded manifest file
|
|
4090
|
+
* @param file - The manifest path each refusal names
|
|
4091
|
+
* @returns The expanded manifest, whose references to one key share one verified map
|
|
4092
|
+
* @throws Thrown with the removal and the refresh commands when the document declares another
|
|
4093
|
+
* protocol version, and thrown when its schema is invalid, a table map does not hash to its key,
|
|
4094
|
+
* or a reference names no table key.
|
|
3812
4095
|
*
|
|
3813
4096
|
* @example
|
|
3814
4097
|
* ```ts
|
|
3815
|
-
*
|
|
4098
|
+
* const manifest = readCaptureManifest(JSON.parse(text), 'tmp/captures/states/manifest.json')
|
|
4099
|
+
* manifest.lookups[0]?.inputs // the expanded input map
|
|
3816
4100
|
* ```
|
|
3817
4101
|
*/
|
|
3818
|
-
export declare function
|
|
4102
|
+
export declare function readCaptureManifest(value: unknown, file: string): CaptureExpandedManifest;
|
|
3819
4103
|
|
|
3820
4104
|
/**
|
|
3821
4105
|
* Parses standard option tokens and refuses empty values, terminators, and repeated single options.
|
|
@@ -4022,12 +4306,31 @@ export declare function readCaptureRequestOwner(name: string): number | undefine
|
|
|
4022
4306
|
*/
|
|
4023
4307
|
export declare function readCaptureSeparator(entry: string): string;
|
|
4024
4308
|
|
|
4309
|
+
/**
|
|
4310
|
+
* Reads a document's population table after verifying that each map hashes to the key it is stored under.
|
|
4311
|
+
*
|
|
4312
|
+
* @param table - The stored table from each digest to its path-to-hash map
|
|
4313
|
+
* @param subject - The document and its path, which open the refusal message
|
|
4314
|
+
* @returns Each verified map by its digest
|
|
4315
|
+
* @throws Thrown when a stored map does not hash to its key.
|
|
4316
|
+
*
|
|
4317
|
+
* @example
|
|
4318
|
+
* ```ts
|
|
4319
|
+
* readCaptureTable({}, 'Manifest at tmp/captures/states/manifest.json').size // 0
|
|
4320
|
+
* ```
|
|
4321
|
+
*/
|
|
4322
|
+
export declare function readCaptureTable(table: Readonly<Record<string, Readonly<Record<string, string>>>>, subject: string): ReadonlyMap<string, Readonly<Record<string, string>>>;
|
|
4323
|
+
|
|
4025
4324
|
/**
|
|
4026
4325
|
* Reads original title segments from the accepted registry's authenticated JSON reporter files.
|
|
4027
4326
|
* @param root - The repository root that contains the registry and its reporters
|
|
4028
4327
|
* @param file - The accepted registry path
|
|
4029
4328
|
* @param selector - The optional owner selector that bounds the case candidates
|
|
4030
4329
|
* @returns Exact case names mapped to their original title segments within the selected owners
|
|
4330
|
+
* @throws Thrown with the removal of the registry and the manifest and lookup journal beside it,
|
|
4331
|
+
* and the refresh commands, when the registry declares another protocol version; thrown as a
|
|
4332
|
+
* `REGISTRY` capture error when the registry or a reporter it names is absent, unreadable, or fails
|
|
4333
|
+
* authentication.
|
|
4031
4334
|
* @example
|
|
4032
4335
|
* ```ts
|
|
4033
4336
|
* const titles = readCaptureTitles('/workspace', '/workspace/tmp/captures/states/registry.json')
|
|
@@ -4065,8 +4368,13 @@ export declare function readCaptureViewport(test: unknown): CaptureViewport;
|
|
|
4065
4368
|
/**
|
|
4066
4369
|
* Renders an exact owner command with the selected variants and filters in host shell syntax.
|
|
4067
4370
|
*
|
|
4371
|
+
* @remarks
|
|
4372
|
+
* A flag is rendered only when the rendered command's `CAPTURE_COMMAND_OPTIONS` entry declares it,
|
|
4373
|
+
* so a journey drops `--state`, a registry refresh drops `--case`, and only `stale` keeps
|
|
4374
|
+
* `--portfolio`. `--changed` and `--plan` are never rendered.
|
|
4375
|
+
*
|
|
4068
4376
|
* @param command - The request command, translated to its executable name, or the registry command
|
|
4069
|
-
* @param parsed - The parsed flags, a `false` bail rendered as `--no-bail
|
|
4377
|
+
* @param parsed - The parsed flags, a `false` bail rendered as `--no-bail`; changed and plan flags are deliberately replaced by the owner
|
|
4070
4378
|
* @param selector - The explicit owner or all selector; omitted for a registry refresh
|
|
4071
4379
|
* @param root - The workspace that makes the wrapper path relative
|
|
4072
4380
|
* @returns The command ready to copy into the host shell
|
|
@@ -4126,6 +4434,21 @@ export declare function requireCaptureContained(root: string, path: string): str
|
|
|
4126
4434
|
*/
|
|
4127
4435
|
export declare function requireCaptureImageSize(size: number): void;
|
|
4128
4436
|
|
|
4437
|
+
/**
|
|
4438
|
+
* Returns the one variant that produces a destination, refusing a destination with none or several.
|
|
4439
|
+
*
|
|
4440
|
+
* @param destination - The destination whose producer is read
|
|
4441
|
+
* @param producers - The map `collectCaptureProducers` returns
|
|
4442
|
+
* @returns The destination's unique producing variant
|
|
4443
|
+
* @throws Thrown as an `EVIDENCE` capture error when no variant or more than one produces the destination.
|
|
4444
|
+
*
|
|
4445
|
+
* @example
|
|
4446
|
+
* ```ts
|
|
4447
|
+
* requireCaptureProducer(destination, collectCaptureProducers({ registry, runs: [] })) // 'light-390'
|
|
4448
|
+
* ```
|
|
4449
|
+
*/
|
|
4450
|
+
export declare function requireCaptureProducer(destination: CaptureDestination, producers: ReadonlyMap<string, readonly string[]>): string;
|
|
4451
|
+
|
|
4129
4452
|
/**
|
|
4130
4453
|
* Refuses a wrapper project set whose members repeat or disagree on a host declaration.
|
|
4131
4454
|
*
|
|
@@ -4156,6 +4479,45 @@ export declare function requireCaptureProjects(projects: readonly CaptureProject
|
|
|
4156
4479
|
*/
|
|
4157
4480
|
export declare function requireCaptureSelection(selector: string, variants: readonly string[], projects: readonly CaptureProject[], outputs?: readonly string[], portfolio?: string): void;
|
|
4158
4481
|
|
|
4482
|
+
/**
|
|
4483
|
+
* Returns the verified map a table key names, refusing a key the table does not hold.
|
|
4484
|
+
*
|
|
4485
|
+
* @param table - The verified table `readCaptureTable` returns
|
|
4486
|
+
* @param key - The digest a stored member names
|
|
4487
|
+
* @param subject - The document and its path, which open the refusal message
|
|
4488
|
+
* @param field - The referencing field the refusal message names
|
|
4489
|
+
* @returns The file map stored under the key
|
|
4490
|
+
* @throws Thrown when the table holds no map under the key.
|
|
4491
|
+
*
|
|
4492
|
+
* @example
|
|
4493
|
+
* ```ts
|
|
4494
|
+
* requireCaptureTableEntry(new Map([[key, files]]), key, 'Manifest at manifest.json', 'inputs') === files // true
|
|
4495
|
+
* ```
|
|
4496
|
+
*/
|
|
4497
|
+
export declare function requireCaptureTableEntry(table: ReadonlyMap<string, Readonly<Record<string, string>>>, key: string, subject: string, field: string): Readonly<Record<string, string>>;
|
|
4498
|
+
|
|
4499
|
+
/**
|
|
4500
|
+
* Refuses a document that declares a numeric version other than `CAPTURE_VERSION`, naming what to remove and the refresh commands.
|
|
4501
|
+
*
|
|
4502
|
+
* @remarks
|
|
4503
|
+
* A document with no numeric version passes, so the schema check that follows names that fault.
|
|
4504
|
+
* No document of another version is converted.
|
|
4505
|
+
*
|
|
4506
|
+
* @param value - The decoded document
|
|
4507
|
+
* @param subject - The document kind that opens the refusal, such as `Registry`
|
|
4508
|
+
* @param file - The document path the refusal names
|
|
4509
|
+
* @param removal - The paths, or the phrases naming them, to remove before the refresh
|
|
4510
|
+
* @throws Thrown as an `EVIDENCE` capture error whose context carries `file` and `version` when the
|
|
4511
|
+
* document declares another numeric version.
|
|
4512
|
+
*
|
|
4513
|
+
* @example
|
|
4514
|
+
* ```ts
|
|
4515
|
+
* requireCaptureVersion({ version: 1 }, 'Registry', 'registry.json', ['registry.json'])
|
|
4516
|
+
* // throws: Registry version 1 at registry.json is not version 2, … Remove registry.json, then refresh explicitly with: capture registry, then capture frames all
|
|
4517
|
+
* ```
|
|
4518
|
+
*/
|
|
4519
|
+
export declare function requireCaptureVersion(value: unknown, subject: string, file: string, removal: readonly string[]): void;
|
|
4520
|
+
|
|
4159
4521
|
/**
|
|
4160
4522
|
* Maps usage refusals to exit 64 and every other failure to exit 1.
|
|
4161
4523
|
*
|
|
@@ -4176,6 +4538,26 @@ export declare function resolveCaptureExit(error: unknown): number;
|
|
|
4176
4538
|
*/
|
|
4177
4539
|
export declare function resolveCapturePhysical(path: string): string;
|
|
4178
4540
|
|
|
4541
|
+
/**
|
|
4542
|
+
* Classifies a failure raised while reading the accepted registry as the registry condition.
|
|
4543
|
+
*
|
|
4544
|
+
* @remarks
|
|
4545
|
+
* The complete-registry refresh clears every such failure but a document of another version, whose
|
|
4546
|
+
* refusal names its own removal and refresh.
|
|
4547
|
+
*
|
|
4548
|
+
* @param error - The value a registry read threw
|
|
4549
|
+
* @returns A `REGISTRY` capture error with the same message and the original as its cause, for a
|
|
4550
|
+
* value that is not a capture error or is an `EVIDENCE` capture error other than a version refusal;
|
|
4551
|
+
* otherwise the value itself
|
|
4552
|
+
*
|
|
4553
|
+
* @example
|
|
4554
|
+
* ```ts
|
|
4555
|
+
* resolveCaptureRegistryFault(new CaptureError('Invalid accepted registry schema or digest', { code: 'EVIDENCE' })) // a REGISTRY capture error
|
|
4556
|
+
* resolveCaptureRegistryFault(new CaptureError('Unknown portfolio: x', { code: 'SELECTION' })) // the same error
|
|
4557
|
+
* ```
|
|
4558
|
+
*/
|
|
4559
|
+
export declare function resolveCaptureRegistryFault(error: unknown): unknown;
|
|
4560
|
+
|
|
4179
4561
|
/**
|
|
4180
4562
|
* Resolves a path to the slash-separated form the evidence documents store, relative to a root.
|
|
4181
4563
|
*
|
|
@@ -4239,6 +4621,26 @@ export declare function resolveCaptureSheetIdentity(entry: CaptureDestination):
|
|
|
4239
4621
|
*/
|
|
4240
4622
|
export declare function resolveCaptureStages(variants: readonly string[], first: string, command: CaptureRequest['command']): readonly CaptureStagePlan[];
|
|
4241
4623
|
|
|
4624
|
+
/**
|
|
4625
|
+
* Picks the standalone portfolio root a selection names by its selector or its portfolio.
|
|
4626
|
+
*
|
|
4627
|
+
* @remarks
|
|
4628
|
+
* A standalone root has no stamping route and no registry refresh, so a selection reads it only
|
|
4629
|
+
* when it names the root's portfolio. Every other selection reads the primary directory.
|
|
4630
|
+
*
|
|
4631
|
+
* @param roots - The wrapper's standalone roots
|
|
4632
|
+
* @param selector - The selected owner selector
|
|
4633
|
+
* @param portfolio - The selected portfolio, when the selection names one
|
|
4634
|
+
* @returns The named standalone root, or `undefined` for a primary selection
|
|
4635
|
+
* @example
|
|
4636
|
+
* ```ts
|
|
4637
|
+
* const vue = { portfolio: 'vue', directory: 'tmp/captures/vue', scoped: false }
|
|
4638
|
+
* resolveCaptureStandalone([vue], 'vue:home') // vue
|
|
4639
|
+
* resolveCaptureStandalone([vue], 'pages:mail') // undefined
|
|
4640
|
+
* ```
|
|
4641
|
+
*/
|
|
4642
|
+
export declare function resolveCaptureStandalone(roots: readonly CapturePortfolioRoot[], selector: string, portfolio?: string): CapturePortfolioRoot | undefined;
|
|
4643
|
+
|
|
4242
4644
|
/**
|
|
4243
4645
|
* Resolves selected producing variants in declaration order and requires their projects.
|
|
4244
4646
|
*
|
|
@@ -4272,6 +4674,27 @@ export declare function resolveCaptureVariants(selected: readonly string[], proj
|
|
|
4272
4674
|
*/
|
|
4273
4675
|
export declare function resolveCaptureWrapperProject(input: unknown, mode?: string): Promise<unknown>;
|
|
4274
4676
|
|
|
4677
|
+
/**
|
|
4678
|
+
* Walks a PNG's checked chunks from one header and returns each header's offset, up to the closing chunk.
|
|
4679
|
+
*
|
|
4680
|
+
* @remarks
|
|
4681
|
+
* The walk reads at most `count` chunks, and never more than the bytes can hold, so an infinite or
|
|
4682
|
+
* very large count ends at the closing chunk or at a refusal. Each level halves the count, so the
|
|
4683
|
+
* call depth grows with the logarithm of the chunks the bytes can hold.
|
|
4684
|
+
*
|
|
4685
|
+
* @param bytes - The complete PNG
|
|
4686
|
+
* @param position - The offset of the first chunk header to read
|
|
4687
|
+
* @param count - The most chunks to read
|
|
4688
|
+
* @returns The offset of each chunk header read, in order
|
|
4689
|
+
* @throws Thrown for a truncated chunk, a bad checksum, or a closing chunk that is not empty and last.
|
|
4690
|
+
*
|
|
4691
|
+
* @example
|
|
4692
|
+
* ```ts
|
|
4693
|
+
* scanCaptureChunks(encodeCapturePicture({ width: 1, height: 1, pixels: Uint8Array.from([1, 2, 3]) }), 8, Infinity) // [8, 33, 57]
|
|
4694
|
+
* ```
|
|
4695
|
+
*/
|
|
4696
|
+
export declare function scanCaptureChunks(bytes: Buffer, position: number, count: number): readonly number[];
|
|
4697
|
+
|
|
4275
4698
|
/**
|
|
4276
4699
|
* Reports a portfolio, owner, and viewport whose frames mix cropped, viewport-sized, and page-sized images.
|
|
4277
4700
|
*
|
|
@@ -4307,8 +4730,10 @@ export declare function settleCaptureShutdown(retract: CaptureRetractionHandler,
|
|
|
4307
4730
|
* Scales a picture with an exact area average and clips its displayed height.
|
|
4308
4731
|
*
|
|
4309
4732
|
* @param picture - The source RGB picture
|
|
4310
|
-
* @param factor - The
|
|
4311
|
-
*
|
|
4733
|
+
* @param factor - The reduction factor, a whole number of at least 1; any other value gives an
|
|
4734
|
+
* unspecified result that might throw
|
|
4735
|
+
* @param limit - The maximum displayed height, a whole number of at least 1; any other value gives
|
|
4736
|
+
* an unspecified result that might throw
|
|
4312
4737
|
* @returns A separately owned scaled picture
|
|
4313
4738
|
*
|
|
4314
4739
|
* @example
|
|
@@ -4328,6 +4753,82 @@ export declare function shrinkCapturePicture(picture: CapturePicture, factor: nu
|
|
|
4328
4753
|
*/
|
|
4329
4754
|
export declare function splitCapturePages<T>(entries: readonly T[], size: number): ReadonlyArray<readonly T[]>;
|
|
4330
4755
|
|
|
4756
|
+
/**
|
|
4757
|
+
* Splits contact-sheet rows into consecutive pages of at most `size` rows whose stacked composite
|
|
4758
|
+
* fits `CAPTURE_PNG_LIMITS`.
|
|
4759
|
+
*
|
|
4760
|
+
* @remarks
|
|
4761
|
+
* A page takes each next row while it holds fewer than `size` rows and the stacked composite,
|
|
4762
|
+
* with `gap` between rows, still fits; otherwise the row opens the next page.
|
|
4763
|
+
*
|
|
4764
|
+
* @param rows - The ordered rows, each with its composite width and height
|
|
4765
|
+
* @param size - The most rows a page holds, a whole number of at least 1; any other value gives an
|
|
4766
|
+
* unspecified result that might throw
|
|
4767
|
+
* @param gap - The space between stacked rows
|
|
4768
|
+
* @returns The pages, in order
|
|
4769
|
+
* @throws Thrown with the `USAGE` condition when one row alone does not fit `CAPTURE_PNG_LIMITS`,
|
|
4770
|
+
* naming its composite, the limits, and the narrower `--variant` selection that recovers.
|
|
4771
|
+
*
|
|
4772
|
+
* @example
|
|
4773
|
+
* ```ts
|
|
4774
|
+
* splitCaptureSheets([{ width: 13040, height: 400 }, { width: 13040, height: 400 }], 4, 12).length // 1
|
|
4775
|
+
* ```
|
|
4776
|
+
*/
|
|
4777
|
+
export declare function splitCaptureSheets<T extends Pick<CapturePicture, 'width' | 'height'>>(rows: readonly T[], size: number, gap: number): ReadonlyArray<readonly T[]>;
|
|
4778
|
+
|
|
4779
|
+
/**
|
|
4780
|
+
* Sums one channel of a picture over a block of source rows.
|
|
4781
|
+
*
|
|
4782
|
+
* @remarks
|
|
4783
|
+
* Source row `top + row` starts its block at `(top + row) * picture.width * 3 + left`, and each row
|
|
4784
|
+
* contributes `columns` samples through `sumCaptureRow`. The caller bounds the block: the call reads
|
|
4785
|
+
* `rows × columns` samples, inside the bytes or not, so a row count that is not above 0 sums nothing
|
|
4786
|
+
* and a fractional row count reads its ceiling. For whole-number arguments, the sum equals the
|
|
4787
|
+
* direct sum of those samples where every number the call computes from its arguments is a safe
|
|
4788
|
+
* integer, each row number, each intermediate sum and product of a row start, and each sample index
|
|
4789
|
+
* among them.
|
|
4790
|
+
*
|
|
4791
|
+
* @param picture - The source RGB picture
|
|
4792
|
+
* @param top - The block's first source row
|
|
4793
|
+
* @param left - The byte offset of the block's first sample inside a row, its channel included
|
|
4794
|
+
* @param row - The first row to sum, counted from `top`
|
|
4795
|
+
* @param rows - The number of rows to sum
|
|
4796
|
+
* @param columns - The number of samples to sum in each row
|
|
4797
|
+
* @returns The block's sum
|
|
4798
|
+
* @throws Thrown as an `EVIDENCE` capture error when `rows` is `Infinity`, or when `columns` is
|
|
4799
|
+
* `Infinity` and the block reads a row.
|
|
4800
|
+
*
|
|
4801
|
+
* @example
|
|
4802
|
+
* ```ts
|
|
4803
|
+
* sumCaptureBlock({ width: 2, height: 2, pixels: Uint8Array.from([1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0]) }, 0, 0, 0, 2, 2) // 10
|
|
4804
|
+
* ```
|
|
4805
|
+
*/
|
|
4806
|
+
export declare function sumCaptureBlock(picture: CapturePicture, top: number, left: number, row: number, rows: number, columns: number): number;
|
|
4807
|
+
|
|
4808
|
+
/**
|
|
4809
|
+
* Sums a run of samples three bytes apart, one channel of consecutive RGB pixels.
|
|
4810
|
+
*
|
|
4811
|
+
* @remarks
|
|
4812
|
+
* The caller bounds the run: the call reads one sample per column, inside the bytes or not, so a
|
|
4813
|
+
* count that is not above 0 sums nothing and a fractional count reads its ceiling. Each sample reads
|
|
4814
|
+
* `pixels[index] ?? 0` at the index the call computes, so an index outside the bytes, a fractional
|
|
4815
|
+
* index, or a `NaN` index reads 0. For whole-number arguments, the sum equals the direct sum of
|
|
4816
|
+
* those samples where every number the call computes from its arguments is a safe integer, each
|
|
4817
|
+
* sample index among them.
|
|
4818
|
+
*
|
|
4819
|
+
* @param pixels - The source RGB bytes
|
|
4820
|
+
* @param start - The index of the first sample
|
|
4821
|
+
* @param columns - The number of samples to sum
|
|
4822
|
+
* @returns The sum, reading an index outside the bytes or a fractional index as 0
|
|
4823
|
+
* @throws Thrown as an `EVIDENCE` capture error when `columns` is `Infinity`.
|
|
4824
|
+
*
|
|
4825
|
+
* @example
|
|
4826
|
+
* ```ts
|
|
4827
|
+
* sumCaptureRow(Uint8Array.from([1, 0, 0, 2, 0, 0, 3]), 0, 3) // 6
|
|
4828
|
+
* ```
|
|
4829
|
+
*/
|
|
4830
|
+
export declare function sumCaptureRow(pixels: Uint8Array, start: number, columns: number): number;
|
|
4831
|
+
|
|
4331
4832
|
/**
|
|
4332
4833
|
* Reconstructs one filtered PNG scanline from its filter byte and the row above.
|
|
4333
4834
|
*
|