@opencraw/studio 0.0.18 → 0.0.19
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/dist/browser-provisioning/ensure-browser-launch.use-case.d.ts +12 -0
- package/dist/browser-provisioning/index.d.ts +2 -0
- package/dist/browser-provisioning/install-chromium.use-case.d.ts +2 -0
- package/dist/browser-provisioning/missing-browser.policy.d.ts +3 -0
- package/dist/document-view/deck-view.mapper.d.ts +70 -0
- package/dist/document-view/index.d.ts +13 -0
- package/dist/document-view/pdf-view.mapper.d.ts +47 -0
- package/dist/document-view/region-preview.use-case.d.ts +30 -0
- package/dist/document-view/table-preview.use-case.d.ts +152 -0
- package/dist/document-view/tree-view.mapper.d.ts +47 -0
- package/dist/document-view/workbook-view.mapper.d.ts +51 -0
- package/dist/explain-why/index.d.ts +5 -0
- package/dist/explain-why/item-hint.algorithm.d.ts +13 -0
- package/dist/explain-why/why-sentence.mapper.d.ts +48 -0
- package/dist/explain-why/why.use-case.d.ts +26 -0
- package/dist/flow-recording/action-to-step.mapper.d.ts +16 -0
- package/dist/flow-recording/index.d.ts +13 -0
- package/dist/flow-recording/next-link.policy.d.ts +27 -0
- package/dist/flow-recording/recorded-action.contract.d.ts +114 -0
- package/dist/flow-recording/recorder-script.client.d.ts +48 -0
- package/dist/flow-recording/recorder-session.use-case.d.ts +67 -0
- package/dist/flow-recording/secret-field.policy.d.ts +33 -0
- package/dist/flow-recording/wait-insertion.policy.d.ts +26 -0
- package/dist/index.d.ts +14 -1
- package/dist/main.d.ts +18 -0
- package/dist/page-inspector/dom-tree.mapper.d.ts +32 -0
- package/dist/page-inspector/index.d.ts +7 -0
- package/dist/page-inspector/page-data.algorithm.d.ts +39 -0
- package/dist/page-inspector/responses-seen.use-case.d.ts +36 -0
- package/dist/page-snapshot/fetch-start-page.use-case.d.ts +20 -0
- package/dist/page-snapshot/hidden-marks.algorithm.d.ts +23 -0
- package/dist/page-snapshot/index.d.ts +13 -0
- package/dist/page-snapshot/invalidate-stale-snapshot.use-case.d.ts +12 -0
- package/dist/page-snapshot/pdf-bytes.use-case.d.ts +16 -0
- package/dist/page-snapshot/reread-csv.use-case.d.ts +22 -0
- package/dist/page-snapshot/rewrite-document.mapper.d.ts +27 -0
- package/dist/page-snapshot/snapshot.store.d.ts +14 -0
- package/dist/page-snapshot/start-point.policy.d.ts +12 -0
- package/dist/page-snapshot/take-snapshot.use-case.d.ts +60 -0
- package/dist/recipe-workspace/import-document.use-case.d.ts +22 -0
- package/dist/recipe-workspace/index.d.ts +5 -0
- package/dist/recipe-workspace/open-workspace.use-case.d.ts +15 -0
- package/dist/recipe-workspace/save-recipe.use-case.d.ts +21 -0
- package/dist/sample-run/index.d.ts +8 -0
- package/dist/sample-run/last-run.store.d.ts +17 -0
- package/dist/sample-run/load-recipe-pair.use-case.d.ts +18 -0
- package/dist/sample-run/run-sample.use-case.d.ts +40 -0
- package/dist/sample-run/sample-run-record.contract.d.ts +48 -0
- package/dist/scope-outline/card-sentence.mapper.d.ts +18 -0
- package/dist/scope-outline/index.d.ts +8 -0
- package/dist/scope-outline/outline-to-recipe.mapper.d.ts +17 -0
- package/dist/scope-outline/outline.model.d.ts +57 -0
- package/dist/scope-outline/recipe-to-outline.mapper.d.ts +14 -0
- package/dist/scope-outline/scope-at-path.algorithm.d.ts +19 -0
- package/dist/selector-inference/class-token.policy.d.ts +35 -0
- package/dist/selector-inference/dom-path.model.d.ts +73 -0
- package/dist/selector-inference/index.d.ts +12 -0
- package/dist/selector-inference/list-inference.algorithm.d.ts +43 -0
- package/dist/selector-inference/selector-candidates.algorithm.d.ts +22 -0
- package/dist/selector-inference/selector-ranking.policy.d.ts +27 -0
- package/dist/selector-inference/shadow-dom.error.d.ts +11 -0
- package/dist/selector-inference/take-kind.policy.d.ts +12 -0
- package/dist/studio-api/command.contract.d.ts +531 -0
- package/dist/studio-api/deck-preview-view.contract.d.ts +28 -0
- package/dist/studio-api/deck-view.contract.d.ts +127 -0
- package/dist/studio-api/document-tree-view.contract.d.ts +26 -0
- package/dist/studio-api/event.contract.d.ts +155 -0
- package/dist/studio-api/grid-preview-view.contract.d.ts +26 -0
- package/dist/studio-api/grid-view.contract.d.ts +75 -0
- package/dist/studio-api/import-document-view.contract.d.ts +8 -0
- package/dist/studio-api/index.d.ts +43 -0
- package/dist/studio-api/infer-selector-view.contract.d.ts +68 -0
- package/dist/studio-api/inspect-view.contract.d.ts +62 -0
- package/dist/studio-api/outline-view.contract.d.ts +37 -0
- package/dist/studio-api/pdf-view.contract.d.ts +66 -0
- package/dist/studio-api/region-preview-view.contract.d.ts +53 -0
- package/dist/studio-api/responses-seen-view.contract.d.ts +20 -0
- package/dist/studio-api/sample-run-view.contract.d.ts +28 -0
- package/dist/studio-api/snapshot-view.contract.d.ts +30 -0
- package/dist/studio-api/start-page-view.contract.d.ts +7 -0
- package/dist/studio-api/table-preview-view.contract.d.ts +65 -0
- package/dist/studio-api/verify-selector-view.contract.d.ts +18 -0
- package/dist/studio-api/why-view.contract.d.ts +16 -0
- package/dist/studio-api/workspace-view.contract.d.ts +67 -0
- package/dist/studio-server/access-token.policy.d.ts +26 -0
- package/dist/studio-server/deck-preview.handler.d.ts +17 -0
- package/dist/studio-server/deck-view.handler.d.ts +15 -0
- package/dist/studio-server/document-tree.handler.d.ts +14 -0
- package/dist/studio-server/explain-why.handler.d.ts +14 -0
- package/dist/studio-server/fetch-start-page.handler.d.ts +14 -0
- package/dist/studio-server/grid-preview.handler.d.ts +17 -0
- package/dist/studio-server/grid-view.handler.d.ts +20 -0
- package/dist/studio-server/import-document.handler.d.ts +14 -0
- package/dist/studio-server/index.d.ts +3 -0
- package/dist/studio-server/infer-selector.handler.d.ts +18 -0
- package/dist/studio-server/inspect-page.handler.d.ts +18 -0
- package/dist/studio-server/open-workspace.handler.d.ts +20 -0
- package/dist/studio-server/pdf-bytes.handler.d.ts +17 -0
- package/dist/studio-server/pdf-view.handler.d.ts +14 -0
- package/dist/studio-server/recording.handler.d.ts +36 -0
- package/dist/studio-server/region-preview.handler.d.ts +17 -0
- package/dist/studio-server/responses-seen.handler.d.ts +16 -0
- package/dist/studio-server/run-sample.handler.d.ts +28 -0
- package/dist/studio-server/save-outline.handler.d.ts +18 -0
- package/dist/studio-server/save-recipe.handler.d.ts +15 -0
- package/dist/studio-server/static-file.handler.d.ts +14 -0
- package/dist/studio-server/studio-http.use-case.d.ts +40 -0
- package/dist/studio-server/table-preview.handler.d.ts +16 -0
- package/dist/studio-server/take-snapshot.handler.d.ts +16 -0
- package/dist/studio-server/verify-selector.handler.d.ts +18 -0
- package/dist/studio-server/websocket.client.d.ts +22 -0
- package/dist/studio-server/workspace.store.d.ts +36 -0
- package/dist/trusted-plugins/index.d.ts +2 -0
- package/dist/trusted-plugins/trusted-plugins.contract.d.ts +14 -0
- package/package.json +3 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BrowserSessionConfig } from '@opencraw/core';
|
|
2
|
+
/**
|
|
3
|
+
* Runs a browser-launching function, and — only when it fails with Playwright's own "no browser
|
|
4
|
+
* downloaded" error, only for a default chromium launch with no explicit binary configured — installs
|
|
5
|
+
* Chromium once and retries, instead of letting Playwright's raw error reach the studio's caller.
|
|
6
|
+
*
|
|
7
|
+
* An explicit `executablePath` or `OPENCRAW_CHROMIUM` means the person (or this repo's own sandbox)
|
|
8
|
+
* already chose a specific binary; a missing-browser failure there is their setup to fix, not
|
|
9
|
+
* something to silently install over.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ensureBrowserLaunch<T>(browser: BrowserSessionConfig | undefined, launch: () => Promise<T>, installChromium?: (run?: () => Promise<void>) => Promise<void>): Promise<T>;
|
|
12
|
+
//# sourceMappingURL=ensure-browser-launch.use-case.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Recognises Playwright's own "no browser downloaded" failure so a launch can be retried after installing one, instead of surfacing Playwright's raw ASCII-art error. */
|
|
2
|
+
export declare function isMissingBrowserError(error: unknown): boolean;
|
|
3
|
+
//# sourceMappingURL=missing-browser.policy.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { DeckDocument } from '@opencraw/core';
|
|
2
|
+
import type { GridSheetView } from './workbook-view.mapper';
|
|
3
|
+
/** One text box on a slide, in points from the slide's top-left corner — mirrors `@opencraw/core`'s `DeckShape`. */
|
|
4
|
+
export interface DeckShapeView {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
text: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
}
|
|
12
|
+
/** One series of a chart — mirrors `@opencraw/core`'s `DeckChart`'s own series entries. */
|
|
13
|
+
export interface DeckChartSeriesView {
|
|
14
|
+
name: string;
|
|
15
|
+
categories: string[];
|
|
16
|
+
values: (number | null)[];
|
|
17
|
+
}
|
|
18
|
+
/** One chart on a slide — mirrors `@opencraw/core`'s `DeckChart`. */
|
|
19
|
+
export interface DeckChartView {
|
|
20
|
+
type: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
series: DeckChartSeriesView[];
|
|
23
|
+
}
|
|
24
|
+
/** One slide's geometry, tables, charts and notes for the deck canvas (studio plan §3.4, issue #94's 5d). */
|
|
25
|
+
export interface DeckSlideView {
|
|
26
|
+
number: number;
|
|
27
|
+
title?: string;
|
|
28
|
+
hidden: boolean;
|
|
29
|
+
/** Text boxes in reading order, ready to draw as absolutely-positioned boxes. */
|
|
30
|
+
shapes: DeckShapeView[];
|
|
31
|
+
/**
|
|
32
|
+
* `shapes` grouped into visual rows, left to right — indices into
|
|
33
|
+
* `shapes` — the same grouping `findDeckTables`'s `shapes: true` reading
|
|
34
|
+
* groups a slide's text boxes into (`rowsOfCells`, the pure algorithm
|
|
35
|
+
* `@opencraw/core`'s own `deck-table.algorithm.ts`'s `shapeTables` uses).
|
|
36
|
+
* The deck canvas's text-box-grid pick (issue #94's 5d) reads this to find
|
|
37
|
+
* the row a clicked shape sits in, and that row's own leftmost shape's
|
|
38
|
+
* text, without recomputing the grouping client-side or reaching for a
|
|
39
|
+
* core-internal helper: the exact row `findDeckTables` would match a
|
|
40
|
+
* `header`/`until` pattern against at run time.
|
|
41
|
+
*/
|
|
42
|
+
shapeRows: number[][];
|
|
43
|
+
/** Native tables, as the grid canvas's own sheet view (`workbook-view.mapper.ts`'s `GridSheetView`) — reused wholesale rather than a parallel shape, since a deck's native table *is* a sheet (`@opencraw/core`'s own `DeckSlide.tables`). */
|
|
44
|
+
tables: GridSheetView[];
|
|
45
|
+
charts: DeckChartView[];
|
|
46
|
+
notes: string;
|
|
47
|
+
}
|
|
48
|
+
/** What `deck-view` answers with (studio plan §3.4, issue #94's 5d): the slide size in points and every slide's shapes, tables, charts and notes, for the deck canvas to draw and pick from. */
|
|
49
|
+
export interface DeckDocumentView {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
slides: DeckSlideView[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Builds the deck canvas's view model (studio plan §3.4, issue #94's 5d)
|
|
56
|
+
* from an already-read `DeckDocument` (`take-snapshot`'s cached body — no
|
|
57
|
+
* second read of the file): every slide's shapes (with their visual-row
|
|
58
|
+
* grouping, for the text-box-grid pick), native tables (through
|
|
59
|
+
* `workbook-view.mapper.ts`'s own sheet view — a deck table *is* a sheet),
|
|
60
|
+
* charts and notes. Table-specific diagnostics for a `table` extract's own
|
|
61
|
+
* options (the live preview) are not here — they come from
|
|
62
|
+
* `table-preview.use-case.ts`'s `previewDeckTable` instead, computed live as
|
|
63
|
+
* those options change, the same split `pdf-view.mapper.ts`/`workbook-view.mapper.ts`
|
|
64
|
+
* already use.
|
|
65
|
+
*
|
|
66
|
+
* @param document - The read deck.
|
|
67
|
+
* @returns The view.
|
|
68
|
+
*/
|
|
69
|
+
export declare function deckDocumentView(document: DeckDocument): DeckDocumentView;
|
|
70
|
+
//# sourceMappingURL=deck-view.mapper.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { deckDocumentView } from './deck-view.mapper';
|
|
2
|
+
export type { DeckChartSeriesView, DeckChartView, DeckDocumentView, DeckShapeView, DeckSlideView } from './deck-view.mapper';
|
|
3
|
+
export { documentTreeView } from './tree-view.mapper';
|
|
4
|
+
export type { DocumentTreeNode, DocumentTreeView, TreeValueType } from './tree-view.mapper';
|
|
5
|
+
export { pdfDocumentView } from './pdf-view.mapper';
|
|
6
|
+
export type { PdfCellView, PdfDocumentView, PdfPageView, PdfRowView } from './pdf-view.mapper';
|
|
7
|
+
export { previewDeckTable, previewGridTable, previewPdfTable } from './table-preview.use-case';
|
|
8
|
+
export type { DeckTablePreviewMatch, DeckTablePreviewOptions, DeckTablePreviewResult, GridTablePreviewMatch, GridTablePreviewOptions, GridTablePreviewResult, TablePreviewMatch, TablePreviewOptions, TablePreviewResult } from './table-preview.use-case';
|
|
9
|
+
export { previewRegion } from './region-preview.use-case';
|
|
10
|
+
export type { RegionPreviewResult, RegionPreviewMatch } from './region-preview.use-case';
|
|
11
|
+
export { workbookDocumentView } from './workbook-view.mapper';
|
|
12
|
+
export type { GridCellType, GridCellView, GridMergeView, GridSheetView, WorkbookDocumentView } from './workbook-view.mapper';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { PdfDocument } from '@opencraw/core';
|
|
2
|
+
/** One text cell, in PDF points (y growing upwards from the bottom edge) — mirrors `@opencraw/core`'s `PdfCell`. */
|
|
3
|
+
export interface PdfCellView {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
/** One row of cells, top to bottom. */
|
|
11
|
+
export interface PdfRowView {
|
|
12
|
+
top: number;
|
|
13
|
+
bottom: number;
|
|
14
|
+
cells: PdfCellView[];
|
|
15
|
+
}
|
|
16
|
+
/** One page's geometry and diagnostics for the PDF canvas (studio plan §3.4, issue #94's 5b). */
|
|
17
|
+
export interface PdfPageView {
|
|
18
|
+
number: number;
|
|
19
|
+
/** In PDF points, the size `pdf.js` renders the page at scale 1. */
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
rows: PdfRowView[];
|
|
23
|
+
/** `rows.length`, for the diagnostics line ("N rows, M cells"). */
|
|
24
|
+
rowCount: number;
|
|
25
|
+
cellCount: number;
|
|
26
|
+
/** Whether `readPdf` found any text on this page — `false` means a scan: the person sees at once there is nothing here to read (issue #94's 5b). */
|
|
27
|
+
hasTextLayer: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** The PDF canvas's view of a read document: every page's cells and rows, ready to draw over `pdf.js`'s own rendering. */
|
|
30
|
+
export interface PdfDocumentView {
|
|
31
|
+
pages: PdfPageView[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Builds the PDF canvas's view model (studio plan §3.4, issue #94's 5b) from
|
|
35
|
+
* an already-read `PdfDocument` (`take-snapshot`'s cached body — no second
|
|
36
|
+
* read of the file): every cell and row `readPdf` found, in PDF points, plus
|
|
37
|
+
* per-page counts and whether the page has a text layer at all. Table-specific
|
|
38
|
+
* diagnostics (the header row, the column bands, the wrapped-row regrouping)
|
|
39
|
+
* are not here — they depend on a `table` extract's own options, so they come
|
|
40
|
+
* from `table-preview.use-case.ts` instead, computed live as those options
|
|
41
|
+
* change.
|
|
42
|
+
*
|
|
43
|
+
* @param document - The read PDF.
|
|
44
|
+
* @returns The view.
|
|
45
|
+
*/
|
|
46
|
+
export declare function pdfDocumentView(document: PdfDocument): PdfDocumentView;
|
|
47
|
+
//# sourceMappingURL=pdf-view.mapper.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DeckDocument, DeckShape, PdfCell, PdfDocument } from '@opencraw/core';
|
|
2
|
+
/** One page (or slide) a `region` extract's box reads text off: the text the step binds, and what it was read from — a PDF's cells or a deck's text boxes (what the canvas highlights). */
|
|
3
|
+
export interface RegionPreviewMatch {
|
|
4
|
+
/** The page number of a PDF, or the slide number of a deck. */
|
|
5
|
+
page: number;
|
|
6
|
+
text: string;
|
|
7
|
+
cells: PdfCell[];
|
|
8
|
+
shapes: DeckShape[];
|
|
9
|
+
}
|
|
10
|
+
/** What a `region` extract's selector reads off the already-read document: one match per page or slide with text in the box. */
|
|
11
|
+
export interface RegionPreviewResult {
|
|
12
|
+
matches: RegionPreviewMatch[];
|
|
13
|
+
/** The selector does not parse yet (the person is still typing it, or dragging a box into shape), or names a `page=` on a deck (or a `slide=` on a PDF): reported, not thrown. */
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Runs a `region` extract's selector against an already-read PDF or deck
|
|
18
|
+
* (issues #121 and #122: the canvases' click-to-snap selection) — the
|
|
19
|
+
* engine's own `regionText` / `deckRegionText`, so what the canvas
|
|
20
|
+
* highlights and the text it shows are exactly what the step will read,
|
|
21
|
+
* and a pure function of the document, so re-running it on every change
|
|
22
|
+
* of the box costs nothing. A `slide=` on a PDF (or a `page=` on a deck)
|
|
23
|
+
* is the same mismatch the step would fail with, reported as `error`.
|
|
24
|
+
*
|
|
25
|
+
* @param document - The read PDF or deck (`take-snapshot`'s cached body).
|
|
26
|
+
* @param selector - The `region` selector, `page=1 x=72..252 y=640..664` or `slide=2 x=60..900 y=30..90`.
|
|
27
|
+
* @returns The matches, or `error` when the selector does not parse or does not fit the document.
|
|
28
|
+
*/
|
|
29
|
+
export declare function previewRegion(document: PdfDocument | DeckDocument, selector: string): RegionPreviewResult;
|
|
30
|
+
//# sourceMappingURL=region-preview.use-case.d.ts.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { DeckDocument, PdfDocument, PdfTable, TableAlign, TableBandDiagnostics, WorkbookCell, WorkbookDocument } from '@opencraw/core';
|
|
2
|
+
/**
|
|
3
|
+
* A `table` extract's own options, as the studio's picks build them: string
|
|
4
|
+
* patterns, not yet compiled — the same shape `ExtractStep`'s `table`-kind
|
|
5
|
+
* fields have, kept separate so this slice does not import the engine's
|
|
6
|
+
* recipe schema for one interface.
|
|
7
|
+
*/
|
|
8
|
+
export interface TablePreviewOptions {
|
|
9
|
+
/** Matches the header row (the recipe's `selector`). */
|
|
10
|
+
header: string;
|
|
11
|
+
/** Matches the row that ends the table. */
|
|
12
|
+
until?: string;
|
|
13
|
+
/** Output key -> a pattern for that column's header cell. */
|
|
14
|
+
columns?: Record<string, string>;
|
|
15
|
+
align?: TableAlign;
|
|
16
|
+
}
|
|
17
|
+
/** One matched table, with the exact rows to highlight on the page. */
|
|
18
|
+
export interface TablePreviewMatch {
|
|
19
|
+
page: number;
|
|
20
|
+
/** Index into that page's rows of the header row. */
|
|
21
|
+
headerRowIndex: number;
|
|
22
|
+
/** Every row index (into that page's rows) this match highlights: the header, every regrouped body row, and the `until` row when there is one — sorted, deduplicated. */
|
|
23
|
+
matchedRowIndices: number[];
|
|
24
|
+
/** The column bands the body's cells clustered into, left to right — a column band pick reads its `name` (issue #94's 5b). */
|
|
25
|
+
bands: TableBandDiagnostics[];
|
|
26
|
+
/** The gap (in points) two cell edges may differ by and still share a band — shown while dragging a band edge. */
|
|
27
|
+
bandTolerance: number;
|
|
28
|
+
table: PdfTable;
|
|
29
|
+
}
|
|
30
|
+
/** What `previewPdfTable` answers with: either the matches, or, when a pattern does not compile, why. */
|
|
31
|
+
export interface TablePreviewResult {
|
|
32
|
+
matches: TablePreviewMatch[];
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Runs a `table` extract's options against an already-read PDF (studio plan
|
|
37
|
+
* §3.4, issue #94's 5b: the live preview) — a pure function of the document
|
|
38
|
+
* and the options, so re-running it on every keystroke as the person edits
|
|
39
|
+
* `selector`/`until`/`columns` costs nothing: no re-fetch, no re-parse
|
|
40
|
+
* (`readPdf` already ran once, when `take-snapshot` captured the document).
|
|
41
|
+
*
|
|
42
|
+
* The workbook grid's live preview (issue #94's 5c) is `previewGridTable`,
|
|
43
|
+
* below: the same idea (a pure re-run of the options against the cached
|
|
44
|
+
* document), but its own result shape — a workbook table has no page, no
|
|
45
|
+
* column bands, no wrapped-row regrouping, so folding it into
|
|
46
|
+
* `TablePreviewMatch`/`TablePreviewResult` would leave most of those fields
|
|
47
|
+
* meaningless for a grid pick; a `GridTablePreviewMatch`/`GridTablePreviewResult`
|
|
48
|
+
* sibling reads honestly instead.
|
|
49
|
+
*
|
|
50
|
+
* @param document - The already-read PDF.
|
|
51
|
+
* @param options - The `table` extract's options, not yet compiled to `RegExp`.
|
|
52
|
+
* @returns Every match, each with the exact row indices to highlight — or `error` (and no matches) when a pattern is not a valid regular expression, expected while the person is still typing it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function previewPdfTable(document: PdfDocument, options: TablePreviewOptions): TablePreviewResult;
|
|
55
|
+
/**
|
|
56
|
+
* A `table` extract's own options for a workbook (CSV or spreadsheet), as
|
|
57
|
+
* the studio's grid canvas picks build them (issue #94's 5c) — mirrors
|
|
58
|
+
* `@opencraw/core`'s `GridTableQuery`, kept as strings (not yet compiled)
|
|
59
|
+
* the same way `TablePreviewOptions` does for PDF.
|
|
60
|
+
*/
|
|
61
|
+
export interface GridTablePreviewOptions {
|
|
62
|
+
/** Matches the names of the sheets to read; default every sheet. */
|
|
63
|
+
sheet?: string;
|
|
64
|
+
/** Matches the header row (the recipe's `selector`). */
|
|
65
|
+
header: string;
|
|
66
|
+
/** Matches the row that ends the table. */
|
|
67
|
+
until?: string;
|
|
68
|
+
/** Output key -> a pattern for that column's header cell. */
|
|
69
|
+
columns?: Record<string, string>;
|
|
70
|
+
/** How many rows the header spans; default 1. */
|
|
71
|
+
headerRows?: number;
|
|
72
|
+
/** Output keys whose empty cells take the value of the row above (a merged-group label pick, issue #94's 5c). */
|
|
73
|
+
fillDown?: string[];
|
|
74
|
+
/** Read hidden sheets and rows too. */
|
|
75
|
+
includeHidden?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** One table matched by a `table` extract's options against a workbook — mirrors `@opencraw/core`'s `GridTable`. */
|
|
78
|
+
export interface GridTablePreviewMatch {
|
|
79
|
+
sheet: string;
|
|
80
|
+
title: string;
|
|
81
|
+
header: string[];
|
|
82
|
+
rows: Record<string, WorkbookCell>[];
|
|
83
|
+
}
|
|
84
|
+
/** What `previewGridTable` answers with: either the matches, or, when a pattern does not compile, why (mirrors `TablePreviewResult`). */
|
|
85
|
+
export interface GridTablePreviewResult {
|
|
86
|
+
matches: GridTablePreviewMatch[];
|
|
87
|
+
error?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Runs a `table` extract's options against an already-read workbook (studio
|
|
91
|
+
* plan §3.4, issue #94's 5c: the live preview) — a pure function of the
|
|
92
|
+
* document and the options, exactly like `previewPdfTable` above: no
|
|
93
|
+
* re-fetch, no re-parse (`csvWorkbook`/`readXlsxWorkbook` already ran once,
|
|
94
|
+
* when `take-snapshot` captured the document).
|
|
95
|
+
*
|
|
96
|
+
* @param document - The already-read workbook.
|
|
97
|
+
* @param options - The `table` extract's options, not yet compiled to `RegExp`.
|
|
98
|
+
* @returns Every matched table — or `error` (and no matches) when a pattern is not a valid regular expression, expected while the person is still typing it.
|
|
99
|
+
*/
|
|
100
|
+
export declare function previewGridTable(document: WorkbookDocument, options: GridTablePreviewOptions): GridTablePreviewResult;
|
|
101
|
+
/**
|
|
102
|
+
* A `table` extract's own options for a deck, as the studio's deck canvas
|
|
103
|
+
* picks build them (issue #94's 5d) — mirrors `@opencraw/core`'s
|
|
104
|
+
* `DeckTableQuery`, kept as strings (not yet compiled) the same way
|
|
105
|
+
* `TablePreviewOptions`/`GridTablePreviewOptions` do for PDF/workbook.
|
|
106
|
+
*/
|
|
107
|
+
export interface DeckTablePreviewOptions {
|
|
108
|
+
/** Matches the titles of the slides to read; default every slide. */
|
|
109
|
+
slide?: string;
|
|
110
|
+
/** Read text boxes laid out as a table instead of native tables. */
|
|
111
|
+
shapes?: boolean;
|
|
112
|
+
/** With `shapes`: how a row's values sit against a box wrapped over several lines. */
|
|
113
|
+
align?: TableAlign;
|
|
114
|
+
/** Matches the header row (the recipe's `selector`). */
|
|
115
|
+
header: string;
|
|
116
|
+
/** Matches the row that ends the table. */
|
|
117
|
+
until?: string;
|
|
118
|
+
/** Output key -> a pattern for that column's header cell. */
|
|
119
|
+
columns?: Record<string, string>;
|
|
120
|
+
/** How many rows the header spans; default 1 (native tables only). */
|
|
121
|
+
headerRows?: number;
|
|
122
|
+
/** Output keys whose empty cells take the value of the row above (native tables only). */
|
|
123
|
+
fillDown?: string[];
|
|
124
|
+
/** Read hidden slides too. */
|
|
125
|
+
includeHidden?: boolean;
|
|
126
|
+
}
|
|
127
|
+
/** One table matched by a `table` extract's options against a deck — mirrors `@opencraw/core`'s `DeckTable`. */
|
|
128
|
+
export interface DeckTablePreviewMatch {
|
|
129
|
+
slide: number;
|
|
130
|
+
slideTitle: string;
|
|
131
|
+
title: string;
|
|
132
|
+
header: string[];
|
|
133
|
+
rows: Record<string, WorkbookCell>[];
|
|
134
|
+
}
|
|
135
|
+
/** What `previewDeckTable` answers with: either the matches, or, when a pattern does not compile, why (mirrors `TablePreviewResult`/`GridTablePreviewResult`). */
|
|
136
|
+
export interface DeckTablePreviewResult {
|
|
137
|
+
matches: DeckTablePreviewMatch[];
|
|
138
|
+
error?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Runs a `table` extract's options against an already-read deck (studio plan
|
|
142
|
+
* §3.4, issue #94's 5d: the live preview) — a pure function of the document
|
|
143
|
+
* and the options, exactly like `previewPdfTable`/`previewGridTable` above:
|
|
144
|
+
* no re-fetch, no re-parse (`readPptxDeck` already ran once, when
|
|
145
|
+
* `take-snapshot` captured the document).
|
|
146
|
+
*
|
|
147
|
+
* @param document - The already-read deck.
|
|
148
|
+
* @param options - The `table` extract's options, not yet compiled to `RegExp`.
|
|
149
|
+
* @returns Every matched table — or `error` (and no matches) when a pattern is not a valid regular expression, expected while the person is still typing it.
|
|
150
|
+
*/
|
|
151
|
+
export declare function previewDeckTable(document: DeckDocument, options: DeckTablePreviewOptions): DeckTablePreviewResult;
|
|
152
|
+
//# sourceMappingURL=table-preview.use-case.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HttpBody } from '@opencraw/core';
|
|
2
|
+
/** A JSON/XML value's shape, for the tree's icon and for deciding whether a node can generalise to a list. */
|
|
3
|
+
export type TreeValueType = 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null' | 'element';
|
|
4
|
+
/** One row of the document tree (studio plan §3.4, issue #94's 5a): a JSON/YAML value or an XML element/attribute. */
|
|
5
|
+
export interface DocumentTreeNode {
|
|
6
|
+
/** A stable key for React lists: the node's own path. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The property name, array index or element/attribute name to show. */
|
|
9
|
+
label: string;
|
|
10
|
+
valueType: TreeValueType;
|
|
11
|
+
/** A short rendering of a leaf's value; absent for `object`/`array`/`element`. */
|
|
12
|
+
preview?: string;
|
|
13
|
+
/** This exact node's JSONPath (JSON/YAML documents only). */
|
|
14
|
+
jsonpath?: string;
|
|
15
|
+
/** This exact node's XPath (XML documents only). */
|
|
16
|
+
xpath?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Set when this node is one item of an array (JSON) or one of several
|
|
19
|
+
* same-named siblings (XML): the path generalised to every item —
|
|
20
|
+
* `$.results[*]` instead of `$.results[2]` — and how many there are, so a
|
|
21
|
+
* pick can offer "the whole list" per studio plan §3.4.
|
|
22
|
+
*/
|
|
23
|
+
listPath?: string;
|
|
24
|
+
listCount?: number;
|
|
25
|
+
/** XML only: the element's own attributes, name -> value (also reachable as child rows). */
|
|
26
|
+
attributes?: Record<string, string>;
|
|
27
|
+
children: DocumentTreeNode[];
|
|
28
|
+
}
|
|
29
|
+
/** What `document-tree` answers with: the parsed document as a tree, and (XML only) the namespace prefixes it declares or that reading synthesised for an unprefixed default namespace, offered so a pick's `extract` can reference them (studio plan §3.4). */
|
|
30
|
+
export interface DocumentTreeView {
|
|
31
|
+
format: 'json' | 'xml';
|
|
32
|
+
root: DocumentTreeNode;
|
|
33
|
+
namespaces?: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds the document tree for `document-tree` (studio plan §3.4, issue
|
|
37
|
+
* #94's 5a) from the body `page-snapshot`'s `take-snapshot.use-case.ts`
|
|
38
|
+
* already fetched — no second read of the document.
|
|
39
|
+
*
|
|
40
|
+
* @param body - The parsed body (`HttpBody`); YAML and JSON Lines both
|
|
41
|
+
* arrive here already normalised to `{ kind: 'json' }` by `http.client.ts`.
|
|
42
|
+
* @returns The tree.
|
|
43
|
+
* @throws Error when `body`'s kind is not `json` or `xml` (PDF, workbook and
|
|
44
|
+
* deck documents get their own canvases — 5b/5c/5d, not this mapper).
|
|
45
|
+
*/
|
|
46
|
+
export declare function documentTreeView(body: HttpBody): DocumentTreeView;
|
|
47
|
+
//# sourceMappingURL=tree-view.mapper.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { WorkbookCell, WorkbookDocument } from '@opencraw/core';
|
|
2
|
+
/** A cell's type, for the grid to show it as (issue #94's 5c): a number and a boolean keep their runtime type; a date is a string that reads as one of the ISO shapes `read-xlsx.client.ts` writes (a day, a moment, or both) — the workbook model itself has no separate date type (`WorkbookCell` is `string | number | boolean`), so this is the same "does it look like one" a person reading the cell would make. */
|
|
3
|
+
export type GridCellType = 'string' | 'number' | 'boolean' | 'date';
|
|
4
|
+
/** One cell, with the type the grid shows it as. */
|
|
5
|
+
export interface GridCellView {
|
|
6
|
+
value: WorkbookCell;
|
|
7
|
+
type: GridCellType;
|
|
8
|
+
}
|
|
9
|
+
/** One merged range, 0-based and inclusive — mirrors `@opencraw/core`'s A1 references (`Sheet.merges`), already resolved to bounds so the grid can draw it as one cell (`rowSpan`/`colSpan`) instead of parsing `B10:B13` itself. */
|
|
10
|
+
export interface GridMergeView {
|
|
11
|
+
ref: string;
|
|
12
|
+
top: number;
|
|
13
|
+
left: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
right: number;
|
|
16
|
+
}
|
|
17
|
+
/** One sheet of the grid canvas (issue #94's 5c). */
|
|
18
|
+
export interface GridSheetView {
|
|
19
|
+
name: string;
|
|
20
|
+
hidden: boolean;
|
|
21
|
+
/** 0-based row indices hidden in the sheet. */
|
|
22
|
+
hiddenRows: number[];
|
|
23
|
+
/** The widest row's own length, ragged rows included — for the grid to size its columns. */
|
|
24
|
+
columnCount: number;
|
|
25
|
+
rows: GridCellView[][];
|
|
26
|
+
merges: GridMergeView[];
|
|
27
|
+
}
|
|
28
|
+
/** What `grid-view` answers with (studio plan §3.4, issue #94's 5c): every sheet's cells, typed, with hidden sheets/rows marked and merged ranges resolved — the CSV/workbook grid's own view of the document, structurally the same idea as `pdf-view.mapper.ts`'s `PdfDocumentView`. */
|
|
29
|
+
export interface WorkbookDocumentView {
|
|
30
|
+
sheets: GridSheetView[];
|
|
31
|
+
/** Present when the workbook came from a CSV — the detected (or overridden) delimiter and encoding, shown and overridable (issue #94's 5c). */
|
|
32
|
+
csv?: {
|
|
33
|
+
encoding: string;
|
|
34
|
+
delimiter: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Builds the grid canvas's view model (studio plan §3.4, issue #94's 5c) from
|
|
39
|
+
* an already-read `WorkbookDocument` (`take-snapshot`'s cached body — no
|
|
40
|
+
* second read of the file): every sheet's cells, typed, with hidden sheets
|
|
41
|
+
* and rows marked, and merged ranges resolved to bounds so the grid draws
|
|
42
|
+
* them as one cell. Table-specific diagnostics (the matched rows of the
|
|
43
|
+
* current `table` extract's options) are not here — they depend on the
|
|
44
|
+
* picks so far, so they come from `table-preview.use-case.ts`'s
|
|
45
|
+
* `previewGridTable` instead, computed live as those options change.
|
|
46
|
+
*
|
|
47
|
+
* @param document - The read workbook (a spreadsheet or a CSV).
|
|
48
|
+
* @returns The view.
|
|
49
|
+
*/
|
|
50
|
+
export declare function workbookDocumentView(document: WorkbookDocument): WorkbookDocumentView;
|
|
51
|
+
//# sourceMappingURL=workbook-view.mapper.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A best-effort hint about what a missing value's bound id actually held in
|
|
3
|
+
* the scope snapshot: the keys of an object, or the length of a list — the
|
|
4
|
+
* fallback when there is no per-item DOM snapshot to compare a selector
|
|
5
|
+
* against (see `why-sentence.mapper.ts`'s doc comment for why the richer,
|
|
6
|
+
* "the item has `.price_new`" hint is out of this phase's scope).
|
|
7
|
+
*
|
|
8
|
+
* @param scope - The record's scope snapshot (`SampleRunRecord.scope`/`SampleRunRejected.scope`).
|
|
9
|
+
* @param boundId - The leading id the rule's `from` reads.
|
|
10
|
+
* @returns A short clause (no leading punctuation), or `undefined` when the id is not in scope or nothing useful can be said about it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function hintFor(scope: Record<string, unknown> | undefined, boundId: string | undefined): string | undefined;
|
|
13
|
+
//# sourceMappingURL=item-hint.algorithm.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { FieldTrace } from '@opencraw/core';
|
|
2
|
+
/** One step of the recipe that may have bound the missing value's source id, and how it went over the whole sample run (`sample-run`'s `SampleStepSummary`). */
|
|
3
|
+
export interface WhyStepFact {
|
|
4
|
+
path: string;
|
|
5
|
+
stepType: string;
|
|
6
|
+
stepId?: string;
|
|
7
|
+
outcome: 'ran' | 'skipped' | 'retried' | 'not-found';
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Everything `buildWhySentence` needs to explain one missing or rejected value; gathered by `why.use-case.ts` from the last sample run's kept trace, scope and step summary. */
|
|
11
|
+
export interface WhyFacts {
|
|
12
|
+
field: string;
|
|
13
|
+
outcome: 'missing' | 'rejected';
|
|
14
|
+
/** The engine's own rejection reason (`record:reject`'s `reason`), for a rejected record. */
|
|
15
|
+
reason?: string;
|
|
16
|
+
/** The resolved missing-value policy (`nullable`, `default`, `null`, `fail`, `skip-record`), when the field could be found in the output recipe. */
|
|
17
|
+
policy?: string;
|
|
18
|
+
/** The field's mapping trace, when the record itself was emitted (a `missing` outcome only — a rejected record never reached `data`). */
|
|
19
|
+
trace?: FieldTrace;
|
|
20
|
+
/** The leading id the rule's `from` reads (`item` of `item.description`), when the rule could be found. */
|
|
21
|
+
boundId?: string;
|
|
22
|
+
/** The step that binds `boundId`, when one was found in the recipe. */
|
|
23
|
+
step?: WhyStepFact;
|
|
24
|
+
/** A best-effort hint about what the bound value actually held (phase 2's item snapshot gives a richer one for a CSS pick; this is the scope-only fallback — see this module's doc comment). */
|
|
25
|
+
hint?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Builds the Why? tab's sentence (studio plan §4.4, issue #92) from the
|
|
29
|
+
* facts `why.use-case.ts` gathers: the value the mapping read (and each
|
|
30
|
+
* transform's effect on it), the step that bound its source id and whether
|
|
31
|
+
* it ran, was skipped, or bound nothing this recipe knows of, the
|
|
32
|
+
* missing-value policy that applied, and a hint about what was actually
|
|
33
|
+
* there instead.
|
|
34
|
+
*
|
|
35
|
+
* This is the scope-snapshot-only half of the design: phase 2's per-item DOM
|
|
36
|
+
* snapshot (the CSS-selector "the item has `.price_new`" hint the issue's
|
|
37
|
+
* example shows) is not wired in here — `sample-run` keeps the mapping's
|
|
38
|
+
* scope snapshot (bound ids and their values), not a per-`forEach`-item DOM
|
|
39
|
+
* capture, and building that link is a bigger integration than this phase's
|
|
40
|
+
* budget covers (see this package's `page-snapshot` slice, which captures a
|
|
41
|
+
* step's page for the content pane, not per-iteration). `hint`, when given,
|
|
42
|
+
* is instead built from the scope snapshot itself (`item-hint.algorithm.ts`).
|
|
43
|
+
*
|
|
44
|
+
* @param facts - What is known about the value.
|
|
45
|
+
* @returns One sentence, always ending in a period.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildWhySentence(facts: WhyFacts): string;
|
|
48
|
+
//# sourceMappingURL=why-sentence.mapper.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { InputRecipe, OutputRecipe } from '@opencraw/core';
|
|
2
|
+
import type { LastRunCache } from '../sample-run';
|
|
3
|
+
import type { WhyTarget, WhyView } from '../studio-api';
|
|
4
|
+
/**
|
|
5
|
+
* Explains one missing or rejected value from a recipe's last sample run
|
|
6
|
+
* (issue #92's Why? tab, studio plan §4.4): the mapping trace and scope
|
|
7
|
+
* snapshot `run-sample` kept, the recipe's own rule and field for the
|
|
8
|
+
* missing-value policy, and the step that bound the value's source id — did
|
|
9
|
+
* it run, was it skipped, or does no step in this recipe bind it at all.
|
|
10
|
+
*
|
|
11
|
+
* @param folder - The workspace folder (to re-read the recipe pair: the last
|
|
12
|
+
* run only kept the run's own data, not the recipe text, and a save may
|
|
13
|
+
* have happened since).
|
|
14
|
+
* @param cache - The server's last-run cache (`sample-run`'s `LastRunCache`).
|
|
15
|
+
* @param loadPair - Loads the input/output recipe pair; injected so this
|
|
16
|
+
* stays testable without a real workspace folder (`sample-run`'s
|
|
17
|
+
* `loadRecipePair` in production).
|
|
18
|
+
* @param target - What was clicked.
|
|
19
|
+
* @returns The explanation.
|
|
20
|
+
* @throws Error when no sample run has finished for this recipe yet, or the target does not name a real record/field.
|
|
21
|
+
*/
|
|
22
|
+
export declare function explainWhy(folder: string, cache: LastRunCache, loadPair: (folder: string, recipeId: string) => Promise<{
|
|
23
|
+
input: InputRecipe;
|
|
24
|
+
output: OutputRecipe;
|
|
25
|
+
}>, target: WhyTarget): Promise<WhyView>;
|
|
26
|
+
//# sourceMappingURL=why.use-case.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Step } from '@opencraw/core';
|
|
2
|
+
import type { ResolvedAction } from './recorded-action.contract';
|
|
3
|
+
/**
|
|
4
|
+
* Turns one resolved recorded action into the recipe step it reads as
|
|
5
|
+
* (issue #95's card sentences): `Click <selector>`, `Fill <selector> with
|
|
6
|
+
* <value>`, `Select <selector> = <value>`, `Press <key>`, `Scroll to
|
|
7
|
+
* bottom`. Pure: `recorder-session.use-case.ts` has already resolved the
|
|
8
|
+
* selector (`selector-inference`) and, for a secret field, already replaced
|
|
9
|
+
* `value` with its `{{env.NAME}}` placeholder (`secret-field.policy.ts`) —
|
|
10
|
+
* this mapper never sees, and so can never leak, a real secret value.
|
|
11
|
+
*
|
|
12
|
+
* @param action - The resolved action.
|
|
13
|
+
* @returns The step it becomes, or `undefined` for an action this mapper cannot place (a click/fill/select with no verified selector).
|
|
14
|
+
*/
|
|
15
|
+
export declare function actionToStep(action: ResolvedAction): Step | undefined;
|
|
16
|
+
//# sourceMappingURL=action-to-step.mapper.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { openRecorderSession } from './recorder-session.use-case';
|
|
2
|
+
export type { RecorderCallbacks, RecorderNote, RecorderSessionHandle, RecorderSessionOptions } from './recorder-session.use-case';
|
|
3
|
+
export { rawActionSchema, recordedFieldSchema, recordedLinkSchema, RECORDED_ACTION_KINDS, UNSUPPORTED_REASONS } from './recorded-action.contract';
|
|
4
|
+
export type { RawAction, RecordedActionKind, RecordedField, RecordedLink, ResolvedAction, UnsupportedReason } from './recorded-action.contract';
|
|
5
|
+
export { actionToStep } from './action-to-step.mapper';
|
|
6
|
+
export { isSecretField, secretEnvName, secretPlaceholder } from './secret-field.policy';
|
|
7
|
+
export { looksLikeNextLink, paginateStepFor } from './next-link.policy';
|
|
8
|
+
export type { PaginateStep } from './next-link.policy';
|
|
9
|
+
export { insertWaitStep } from './wait-insertion.policy';
|
|
10
|
+
export type { WaitContext, WaitStep } from './wait-insertion.policy';
|
|
11
|
+
export { recorderScript } from './recorder-script.client';
|
|
12
|
+
export type { Page } from 'playwright';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Step } from '@opencraw/core';
|
|
2
|
+
import type { RecordedLink } from './recorded-action.contract';
|
|
3
|
+
/** `paginate`'s own `next` shape, `selector` form only — the only one a recorded click can offer. */
|
|
4
|
+
export type PaginateStep = Extract<Step, {
|
|
5
|
+
type: 'paginate';
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Whether a clicked, navigating element looks like a "next" link (issue
|
|
9
|
+
* #95's exact heuristics): `rel="next"`, link text matching "next", or the
|
|
10
|
+
* resolved selector itself carrying `li.next a`/`a[aria-label=Next]`. Only
|
|
11
|
+
* meaningful for a click that navigated — the caller checks that first.
|
|
12
|
+
*
|
|
13
|
+
* @param link - The anchor's own `rel`/text/`aria-label`, as reported by `recorder-script.client.ts`.
|
|
14
|
+
* @param selector - The action's resolved selector (`selector-inference`'s own candidate).
|
|
15
|
+
* @returns Whether the studio should offer to turn this click into a `paginate` step.
|
|
16
|
+
*/
|
|
17
|
+
export declare function looksLikeNextLink(link: RecordedLink | undefined, selector: string | undefined): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The `paginate` step a "next" link's selector offers (studio plan §3.1/#95:
|
|
20
|
+
* `For every page — click <selector>`), with an empty body: the studio
|
|
21
|
+
* offers this shape, the person fills in what runs on each page.
|
|
22
|
+
*
|
|
23
|
+
* @param selector - The next link's resolved, verified selector.
|
|
24
|
+
* @returns A `paginate` step, `next.selector` only.
|
|
25
|
+
*/
|
|
26
|
+
export declare function paginateStepFor(selector: string): PaginateStep;
|
|
27
|
+
//# sourceMappingURL=next-link.policy.d.ts.map
|