@opencraw/studio 0.0.30 → 0.0.32
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/document-view/pdf-view.mapper.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +447 -31
- package/dist/page-snapshot/blocked-page.algorithm.d.ts +10 -0
- package/dist/page-snapshot/consent-banner.algorithm.d.ts +23 -0
- package/dist/page-snapshot/detect-url.use-case.d.ts +13 -0
- package/dist/page-snapshot/index.d.ts +2 -0
- package/dist/page-snapshot/inline-assets.mapper.d.ts +29 -0
- package/dist/page-snapshot/take-snapshot.use-case.d.ts +2 -0
- package/dist/recipe-workspace/import-document.use-case.d.ts +5 -3
- package/dist/src/document-view/pdf-view.mapper.d.ts +2 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/page-snapshot/blocked-page.algorithm.d.ts +10 -0
- package/dist/src/page-snapshot/consent-banner.algorithm.d.ts +23 -0
- package/dist/src/page-snapshot/detect-url.use-case.d.ts +13 -0
- package/dist/src/page-snapshot/index.d.ts +2 -0
- package/dist/src/page-snapshot/inline-assets.mapper.d.ts +29 -0
- package/dist/src/page-snapshot/take-snapshot.use-case.d.ts +2 -0
- package/dist/src/recipe-workspace/import-document.use-case.d.ts +5 -3
- package/dist/src/studio-api/command.contract.d.ts +11 -0
- package/dist/src/studio-api/detect-url-view.contract.d.ts +24 -0
- package/dist/src/studio-api/index.d.ts +4 -2
- package/dist/src/studio-api/infer-selector-view.contract.d.ts +14 -0
- package/dist/src/studio-api/pdf-view.contract.d.ts +3 -0
- package/dist/src/studio-api/snapshot-view.contract.d.ts +1 -0
- package/dist/src/studio-server/detect-url.handler.d.ts +10 -0
- package/dist/studio-api/command.contract.d.ts +11 -0
- package/dist/studio-api/detect-url-view.contract.d.ts +24 -0
- package/dist/studio-api/index.d.ts +4 -2
- package/dist/studio-api/infer-selector-view.contract.d.ts +14 -0
- package/dist/studio-api/pdf-view.contract.d.ts +3 -0
- package/dist/studio-api/snapshot-view.contract.d.ts +1 -0
- package/dist/studio-server/detect-url.handler.d.ts +10 -0
- package/dist/ui/assets/index-DQ3QLedY.js +42 -0
- package/dist/ui/assets/{pdf-Dt4HqIG1.js → pdf-DJOnIZdZ.js} +1 -1
- package/dist/ui/index.html +11 -2
- package/dist/ui/opencraw-logo.svg +28 -0
- package/package.json +3 -3
- package/dist/ui/assets/index-DrJpOP0X.js +0 -38
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a page is the site's bot check or an access-denied page instead of its content, and, if so, what to tell the person: the
|
|
3
|
+
* Studio's browser was turned away, so everything else on the screen is not the page they asked for.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The page's title and the start of its visible text.
|
|
6
|
+
* @param status - The HTTP status the page came with, when known.
|
|
7
|
+
* @returns A sentence for the person, or `undefined` when the page looks like a page.
|
|
8
|
+
*/
|
|
9
|
+
export declare function blockedPageNotice(text: string, status?: number): string | undefined;
|
|
10
|
+
//# sourceMappingURL=blocked-page.algorithm.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The attribute a pop-up that covers the page is marked with in the snapshot; the picture leaves it out unless "Show hidden" is on. */
|
|
2
|
+
export declare const OVERLAY_ATTRIBUTE = "data-oc-overlay";
|
|
3
|
+
/**
|
|
4
|
+
* A script that, in a page, finds a cookie or consent banner's button and presses it: "Reject all", "Only necessary cookies" and the
|
|
5
|
+
* like first, else "Accept all", "I agree"... in English, Portuguese, Spanish, French, Italian, German and Dutch, and by the ids the common
|
|
6
|
+
* consent tools give their buttons (OneTrust, Didomi, Cookiebot, Usercentrics, Osano, iubenda). A banner that is left in place covers the
|
|
7
|
+
* page in the Studio's view of it, and the Studio's own clicks (to pick a value) would land on it. Only buttons whose whole text is one
|
|
8
|
+
* of these are pressed, so a "Cookie settings" or "Gerir os cookies" button, a link to a policy and the page's own buttons are left alone.
|
|
9
|
+
* The answer is the text of the button pressed, or an empty string when there was none.
|
|
10
|
+
*
|
|
11
|
+
* It only ever runs in the browser the Studio captures the page with, never in a crawl.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DISMISS_CONSENT_SCRIPT: string;
|
|
14
|
+
/**
|
|
15
|
+
* A script that marks, in the page, every pop-up that covers it: something fixed to the window that fills most of it (a dimming backdrop,
|
|
16
|
+
* a modal), a modal dialog, or a banner a consent tool put there. The picture of the page leaves them out (the page behind is what the
|
|
17
|
+
* person wants to pick from), and "Show hidden" brings them back. Run after the consent button has been tried: a banner that went away
|
|
18
|
+
* needs nothing, one that stayed (its button in a form the script does not know, an icon with no text) is covered here.
|
|
19
|
+
*
|
|
20
|
+
* Only the outermost element of an overlay is marked, since hiding it hides all it holds.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MARK_OVERLAYS_SCRIPT = "(() => {\n const attribute = 'data-oc-overlay'\n const consentName = /cookie|consent|gdpr|privacy|onetrust|ot-sdk|didomi|cookiebot|usercentrics|trustarc|truste|osano|iubenda|cmp|banner-modal/i\n const width = window.innerWidth\n const height = window.innerHeight\n const marked = []\n for (const element of document.querySelectorAll('body *')) {\n if (marked.some((outer) => outer.contains(element))) continue\n const style = getComputedStyle(element)\n if (style.position !== 'fixed' || style.display === 'none' || style.visibility === 'hidden') continue\n const box = element.getBoundingClientRect()\n if (box.width === 0 || box.height === 0) continue\n const covers = box.width >= width * 0.6 && box.height >= height * 0.5\n const modal = element.getAttribute('aria-modal') === 'true' || element.getAttribute('role') === 'dialog' || element.getAttribute('role') === 'alertdialog'\n const named = consentName.test((element.id || '') + ' ' + (typeof element.className === 'string' ? element.className : ''))\n // A page built as one fixed, scrolling frame is the page, not a pop-up on it.\n if (covers && !modal && !named && (element.innerText || '').length > document.body.innerText.length * 0.6) continue\n // A bar along an edge (a site's own header or footer) is not a pop-up unless a consent tool named it.\n if (covers || modal || named) {\n element.setAttribute(attribute, '1')\n marked.push(element)\n }\n }\n\n return marked.length\n})()";
|
|
23
|
+
//# sourceMappingURL=consent-banner.algorithm.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** What an address returns, in the engine's own words (`html` is a page; anything else is a document it reads), or `unknown` when it cannot be fetched. */
|
|
2
|
+
export type UrlKind = 'html' | 'json' | 'jsonl' | 'text' | 'pdf' | 'csv' | 'xlsx' | 'pptx' | 'yaml' | 'markdown' | 'xml' | 'docx' | 'unknown';
|
|
3
|
+
/**
|
|
4
|
+
* What an address returns: the format the engine reads its response as (content type, then what the first bytes
|
|
5
|
+
* show, then the file extension in the address), and, for an API that serves JSON as `text/plain` (common), JSON when
|
|
6
|
+
* the text starts like an object or an array. Only the start of the response is read: a large file is not downloaded.
|
|
7
|
+
* An address that cannot be fetched is `unknown`; the recipe started from it then reports why on its first snapshot.
|
|
8
|
+
*
|
|
9
|
+
* @param url - The address.
|
|
10
|
+
* @returns The kind: `html` is a page to open in a browser, anything else a document to read.
|
|
11
|
+
*/
|
|
12
|
+
export declare function detectUrlKind(url: string): Promise<UrlKind>;
|
|
13
|
+
//# sourceMappingURL=detect-url.use-case.d.ts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { detectUrlKind } from './detect-url.use-case';
|
|
2
|
+
export type { UrlKind } from './detect-url.use-case';
|
|
1
3
|
export { fetchStartPage } from './fetch-start-page.use-case';
|
|
2
4
|
export { takeSnapshot } from './take-snapshot.use-case';
|
|
3
5
|
export type { SnapshotResult } from './take-snapshot.use-case';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A stylesheet or font the page loaded, as the capture browser received it. */
|
|
2
|
+
export interface CapturedAsset {
|
|
3
|
+
kind: 'css' | 'font';
|
|
4
|
+
/** The bytes; text for a stylesheet. */
|
|
5
|
+
body: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A stylesheet's text with every `url(...)` made absolute, and each font the page loaded embedded as a data address. The picture of a page
|
|
9
|
+
* is shown in a frame that is not the site, so a font file is a cross-site request the site's server does not allow: its text comes
|
|
10
|
+
* out in a fallback face and its icons (a menu, a close button) as empty boxes. A font inside the page cannot be refused.
|
|
11
|
+
*
|
|
12
|
+
* @param css - The stylesheet text.
|
|
13
|
+
* @param base - Where the stylesheet came from (or the page, for a `<style>` in it).
|
|
14
|
+
* @param assets - What the page loaded, by address.
|
|
15
|
+
* @returns The stylesheet, ready to sit inside the snapshot.
|
|
16
|
+
*/
|
|
17
|
+
export declare function embedFonts(css: string, base: string, assets: ReadonlyMap<string, CapturedAsset>): string;
|
|
18
|
+
/**
|
|
19
|
+
* Turns a captured page into one that carries its own styles: every `<link rel="stylesheet">` the page loaded becomes a `<style>` with
|
|
20
|
+
* the stylesheet's text, and the fonts in it (and in the page's own `<style>`s) are embedded. A stylesheet that was not captured is left
|
|
21
|
+
* as the link it was.
|
|
22
|
+
*
|
|
23
|
+
* @param html - The page as captured.
|
|
24
|
+
* @param pageUrl - The page's address.
|
|
25
|
+
* @param assets - The stylesheets and fonts the page loaded, by address.
|
|
26
|
+
* @returns The page with its styles and fonts inside it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function inlineAssets(html: string, pageUrl: string, assets: ReadonlyMap<string, CapturedAsset>): string;
|
|
29
|
+
//# sourceMappingURL=inline-assets.mapper.d.ts.map
|
|
@@ -15,6 +15,8 @@ export interface SnapshotResult {
|
|
|
15
15
|
* snapshot no longer has by the time it is cached.
|
|
16
16
|
*/
|
|
17
17
|
rawHtml: string;
|
|
18
|
+
/** Something to tell the person about the page: it is a bot check or an access-denied page, not the content. */
|
|
19
|
+
notice?: string;
|
|
18
20
|
/**
|
|
19
21
|
* The format `http.client.ts` read the body as (api mode only; `undefined`
|
|
20
22
|
* in web mode, whose document is always HTML) — what the content pane
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface ImportedDocument {
|
|
2
2
|
/** The copy's path on disk, inside `folder`. */
|
|
3
3
|
path: string;
|
|
4
|
-
/** The copy as a `file:` URL: what the recipe's `start.url` becomes. */
|
|
4
|
+
/** The copy as a `file:` URL relative to the folder (`file:report.pdf`): what the recipe's `start.url` becomes, so the folder can be moved or shared. */
|
|
5
5
|
url: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -9,8 +9,10 @@ export interface ImportedDocument {
|
|
|
9
9
|
* `file:` URL the same way a run would read any downloaded file (core's
|
|
10
10
|
* `HttpClient` handles `file:` itself). The folder is created when missing,
|
|
11
11
|
* so dropping a file is also a way to start a workspace. A name already in
|
|
12
|
-
* the folder is never overwritten:
|
|
13
|
-
*
|
|
12
|
+
* the folder is never overwritten: a file there with the very same bytes is
|
|
13
|
+
* reused (loading one document twice leaves one copy), a different one gets
|
|
14
|
+
* the next free numbered name (`report-2.pdf`); the returned `path`/`url`
|
|
15
|
+
* say which.
|
|
14
16
|
*
|
|
15
17
|
* @param folder - The workspace folder; created (recursively) when it does not exist.
|
|
16
18
|
* @param name - The file's own name, no directories: the copy keeps it, extension included.
|
|
@@ -12,6 +12,8 @@ export interface PdfRowView {
|
|
|
12
12
|
top: number;
|
|
13
13
|
bottom: number;
|
|
14
14
|
cells: PdfCellView[];
|
|
15
|
+
/** A running header or footer (see `@opencraw/core`'s `marginRows`); absent for body text. */
|
|
16
|
+
running?: boolean;
|
|
15
17
|
}
|
|
16
18
|
/** One page's geometry and diagnostics for the PDF canvas (studio plan §3.4, issue #94's 5b). */
|
|
17
19
|
export interface PdfPageView {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export { runSample, loadRecipePair } from './sample-run/index.js';
|
|
|
9
9
|
export type { RecipePair, SampleRunCallbacks, SampleRunHandle, SampleRunRecord, SampleRunRejected, SampleRunResult, SampleStepSummary, SampleStoppedBy } from './sample-run/index.js';
|
|
10
10
|
export { fetchStartPage } from './page-snapshot/index.js';
|
|
11
11
|
export type { WhyFacts, WhyStepFact } from './explain-why/index.js';
|
|
12
|
-
export { sampleBudgetSchema, openWorkspaceCommandSchema, chooseFolderCommandSchema, openPathCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, studioCommandSchema, chooseFolderViewSchema, openPathViewSchema, importDocumentViewSchema, stoppedBySchema, fieldTraceSchema, traceLineEventSchema, recordEventSchema, recordRejectedEventSchema, runFinishedEventSchema, workspaceChangedEventSchema, studioEventSchema, loadedHooksSchema, recipeIssueSchema, recipeListingSchema, workspaceViewSchema, sampleRunRecordSchema, sampleRunViewSchema, startPageViewSchema, snapshotViewSchema, verifySelectorViewSchema, fieldPickSchema, inferSelectorViewSchema, sentencePartSchema, outlineCardSchema, outlineBracketSchema, outlineNodeSchema, outlineViewSchema, whyViewSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, regionPreviewMatchSchema, regionPreviewViewSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, domTreeNodeViewSchema, pageDataFindingSchema, inspectViewSchema, observedResponseSchema, responsesSeenViewSchema, documentTreeNodeViewSchema, documentTreeViewSchema, pdfCellViewSchema, pdfRowViewSchema, pdfPageViewSchema, pdfDocumentViewSchema, tablePreviewTableSchema, tablePreviewBandSchema, tablePreviewMatchSchema, tablePreviewViewSchema, gridCellViewSchema, gridMergeViewSchema, gridSheetViewSchema, workbookDocumentViewSchema, gridTablePreviewMatchSchema, gridTablePreviewViewSchema, deckShapeViewSchema, deckChartSeriesViewSchema, deckChartViewSchema, deckSlideViewSchema, deckDocumentViewSchema, deckTablePreviewMatchSchema, deckTablePreviewViewSchema, startRecordingCommandSchema, stopRecordingCommandSchema, recordingCardEventSchema, recordingNoteEventSchema, recordingStoppedEventSchema, } from './studio-api/index.js';
|
|
13
|
-
export type { SampleBudget, OpenWorkspaceCommand, ChooseFolderCommand, OpenPathCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StudioCommand, ChooseFolderView, OpenPathView, ImportDocumentView, RegionPreviewMatchView, RegionPreviewView, StoppedBy, FieldTraceView, TraceLineEvent, RecordEvent, RecordRejectedEvent, RunFinishedEvent, WorkspaceChangedEvent, StudioEvent, LoadedHooks, RecipeIssue, RecipeListing, WorkspaceView, SampleRunView, StartPageView, SnapshotView, VerifySelectorView, FieldPick, InferSelectorView, SentencePart, OutlineCard, OutlineBracket, OutlineNode, OutlineView, WhyView, DomTreeNodeView, PageDataKind, PageDataFindingView, InspectView, ObservedResponseView, ResponsesSeenView, DocumentTreeNodeView, DocumentTreeView, PdfCellView, PdfRowView, PdfPageView, PdfDocumentView, TablePreviewTableView, TablePreviewBandView, TablePreviewMatchView, TablePreviewView, GridCellView, GridMergeView, GridSheetView, WorkbookDocumentView, GridTablePreviewMatchView, GridTablePreviewView, DeckShapeView, DeckChartSeriesView, DeckChartView, DeckSlideView, DeckDocumentView, DeckTablePreviewMatchView, DeckTablePreviewView, StartRecordingCommand, StopRecordingCommand, RecordingCardEvent, RecordingNoteEvent, RecordingStoppedEvent, } from './studio-api/index.js';
|
|
12
|
+
export { sampleBudgetSchema, openWorkspaceCommandSchema, chooseFolderCommandSchema, openPathCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, detectUrlCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, studioCommandSchema, chooseFolderViewSchema, openPathViewSchema, importDocumentViewSchema, stoppedBySchema, fieldTraceSchema, traceLineEventSchema, recordEventSchema, recordRejectedEventSchema, runFinishedEventSchema, workspaceChangedEventSchema, studioEventSchema, loadedHooksSchema, recipeIssueSchema, recipeListingSchema, workspaceViewSchema, sampleRunRecordSchema, sampleRunViewSchema, startPageViewSchema, detectUrlViewSchema, snapshotViewSchema, verifySelectorViewSchema, fieldPickSchema, inferSelectorViewSchema, sentencePartSchema, outlineCardSchema, outlineBracketSchema, outlineNodeSchema, outlineViewSchema, whyViewSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, regionPreviewMatchSchema, regionPreviewViewSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, domTreeNodeViewSchema, pageDataFindingSchema, inspectViewSchema, observedResponseSchema, responsesSeenViewSchema, documentTreeNodeViewSchema, documentTreeViewSchema, pdfCellViewSchema, pdfRowViewSchema, pdfPageViewSchema, pdfDocumentViewSchema, tablePreviewTableSchema, tablePreviewBandSchema, tablePreviewMatchSchema, tablePreviewViewSchema, gridCellViewSchema, gridMergeViewSchema, gridSheetViewSchema, workbookDocumentViewSchema, gridTablePreviewMatchSchema, gridTablePreviewViewSchema, deckShapeViewSchema, deckChartSeriesViewSchema, deckChartViewSchema, deckSlideViewSchema, deckDocumentViewSchema, deckTablePreviewMatchSchema, deckTablePreviewViewSchema, startRecordingCommandSchema, stopRecordingCommandSchema, recordingCardEventSchema, recordingNoteEventSchema, recordingStoppedEventSchema, } from './studio-api/index.js';
|
|
13
|
+
export type { SampleBudget, OpenWorkspaceCommand, ChooseFolderCommand, OpenPathCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, DetectUrlCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StudioCommand, ChooseFolderView, OpenPathView, ImportDocumentView, RegionPreviewMatchView, RegionPreviewView, StoppedBy, FieldTraceView, TraceLineEvent, RecordEvent, RecordRejectedEvent, RunFinishedEvent, WorkspaceChangedEvent, StudioEvent, LoadedHooks, RecipeIssue, RecipeListing, WorkspaceView, SampleRunView, StartPageView, DetectUrlView, SnapshotView, VerifySelectorView, FieldPick, InferSelectorView, SentencePart, OutlineCard, OutlineBracket, OutlineNode, OutlineView, WhyView, DomTreeNodeView, PageDataKind, PageDataFindingView, InspectView, ObservedResponseView, ResponsesSeenView, DocumentTreeNodeView, DocumentTreeView, PdfCellView, PdfRowView, PdfPageView, PdfDocumentView, TablePreviewTableView, TablePreviewBandView, TablePreviewMatchView, TablePreviewView, GridCellView, GridMergeView, GridSheetView, WorkbookDocumentView, GridTablePreviewMatchView, GridTablePreviewView, DeckShapeView, DeckChartSeriesView, DeckChartView, DeckSlideView, DeckDocumentView, DeckTablePreviewMatchView, DeckTablePreviewView, StartRecordingCommand, StopRecordingCommand, RecordingCardEvent, RecordingNoteEvent, RecordingStoppedEvent, } from './studio-api/index.js';
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a page is the site's bot check or an access-denied page instead of its content, and, if so, what to tell the person: the
|
|
3
|
+
* Studio's browser was turned away, so everything else on the screen is not the page they asked for.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The page's title and the start of its visible text.
|
|
6
|
+
* @param status - The HTTP status the page came with, when known.
|
|
7
|
+
* @returns A sentence for the person, or `undefined` when the page looks like a page.
|
|
8
|
+
*/
|
|
9
|
+
export declare function blockedPageNotice(text: string, status?: number): string | undefined;
|
|
10
|
+
//# sourceMappingURL=blocked-page.algorithm.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The attribute a pop-up that covers the page is marked with in the snapshot; the picture leaves it out unless "Show hidden" is on. */
|
|
2
|
+
export declare const OVERLAY_ATTRIBUTE = "data-oc-overlay";
|
|
3
|
+
/**
|
|
4
|
+
* A script that, in a page, finds a cookie or consent banner's button and presses it: "Reject all", "Only necessary cookies" and the
|
|
5
|
+
* like first, else "Accept all", "I agree"... in English, Portuguese, Spanish, French, Italian, German and Dutch, and by the ids the common
|
|
6
|
+
* consent tools give their buttons (OneTrust, Didomi, Cookiebot, Usercentrics, Osano, iubenda). A banner that is left in place covers the
|
|
7
|
+
* page in the Studio's view of it, and the Studio's own clicks (to pick a value) would land on it. Only buttons whose whole text is one
|
|
8
|
+
* of these are pressed, so a "Cookie settings" or "Gerir os cookies" button, a link to a policy and the page's own buttons are left alone.
|
|
9
|
+
* The answer is the text of the button pressed, or an empty string when there was none.
|
|
10
|
+
*
|
|
11
|
+
* It only ever runs in the browser the Studio captures the page with, never in a crawl.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DISMISS_CONSENT_SCRIPT: string;
|
|
14
|
+
/**
|
|
15
|
+
* A script that marks, in the page, every pop-up that covers it: something fixed to the window that fills most of it (a dimming backdrop,
|
|
16
|
+
* a modal), a modal dialog, or a banner a consent tool put there. The picture of the page leaves them out (the page behind is what the
|
|
17
|
+
* person wants to pick from), and "Show hidden" brings them back. Run after the consent button has been tried: a banner that went away
|
|
18
|
+
* needs nothing, one that stayed (its button in a form the script does not know, an icon with no text) is covered here.
|
|
19
|
+
*
|
|
20
|
+
* Only the outermost element of an overlay is marked, since hiding it hides all it holds.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MARK_OVERLAYS_SCRIPT = "(() => {\n const attribute = 'data-oc-overlay'\n const consentName = /cookie|consent|gdpr|privacy|onetrust|ot-sdk|didomi|cookiebot|usercentrics|trustarc|truste|osano|iubenda|cmp|banner-modal/i\n const width = window.innerWidth\n const height = window.innerHeight\n const marked = []\n for (const element of document.querySelectorAll('body *')) {\n if (marked.some((outer) => outer.contains(element))) continue\n const style = getComputedStyle(element)\n if (style.position !== 'fixed' || style.display === 'none' || style.visibility === 'hidden') continue\n const box = element.getBoundingClientRect()\n if (box.width === 0 || box.height === 0) continue\n const covers = box.width >= width * 0.6 && box.height >= height * 0.5\n const modal = element.getAttribute('aria-modal') === 'true' || element.getAttribute('role') === 'dialog' || element.getAttribute('role') === 'alertdialog'\n const named = consentName.test((element.id || '') + ' ' + (typeof element.className === 'string' ? element.className : ''))\n // A page built as one fixed, scrolling frame is the page, not a pop-up on it.\n if (covers && !modal && !named && (element.innerText || '').length > document.body.innerText.length * 0.6) continue\n // A bar along an edge (a site's own header or footer) is not a pop-up unless a consent tool named it.\n if (covers || modal || named) {\n element.setAttribute(attribute, '1')\n marked.push(element)\n }\n }\n\n return marked.length\n})()";
|
|
23
|
+
//# sourceMappingURL=consent-banner.algorithm.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** What an address returns, in the engine's own words (`html` is a page; anything else is a document it reads), or `unknown` when it cannot be fetched. */
|
|
2
|
+
export type UrlKind = 'html' | 'json' | 'jsonl' | 'text' | 'pdf' | 'csv' | 'xlsx' | 'pptx' | 'yaml' | 'markdown' | 'xml' | 'docx' | 'unknown';
|
|
3
|
+
/**
|
|
4
|
+
* What an address returns: the format the engine reads its response as (content type, then what the first bytes
|
|
5
|
+
* show, then the file extension in the address), and, for an API that serves JSON as `text/plain` (common), JSON when
|
|
6
|
+
* the text starts like an object or an array. Only the start of the response is read: a large file is not downloaded.
|
|
7
|
+
* An address that cannot be fetched is `unknown`; the recipe started from it then reports why on its first snapshot.
|
|
8
|
+
*
|
|
9
|
+
* @param url - The address.
|
|
10
|
+
* @returns The kind: `html` is a page to open in a browser, anything else a document to read.
|
|
11
|
+
*/
|
|
12
|
+
export declare function detectUrlKind(url: string): Promise<UrlKind>;
|
|
13
|
+
//# sourceMappingURL=detect-url.use-case.d.ts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { detectUrlKind } from './detect-url.use-case.js';
|
|
2
|
+
export type { UrlKind } from './detect-url.use-case.js';
|
|
1
3
|
export { fetchStartPage } from './fetch-start-page.use-case.js';
|
|
2
4
|
export { takeSnapshot } from './take-snapshot.use-case.js';
|
|
3
5
|
export type { SnapshotResult } from './take-snapshot.use-case.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A stylesheet or font the page loaded, as the capture browser received it. */
|
|
2
|
+
export interface CapturedAsset {
|
|
3
|
+
kind: 'css' | 'font';
|
|
4
|
+
/** The bytes; text for a stylesheet. */
|
|
5
|
+
body: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A stylesheet's text with every `url(...)` made absolute, and each font the page loaded embedded as a data address. The picture of a page
|
|
9
|
+
* is shown in a frame that is not the site, so a font file is a cross-site request the site's server does not allow: its text comes
|
|
10
|
+
* out in a fallback face and its icons (a menu, a close button) as empty boxes. A font inside the page cannot be refused.
|
|
11
|
+
*
|
|
12
|
+
* @param css - The stylesheet text.
|
|
13
|
+
* @param base - Where the stylesheet came from (or the page, for a `<style>` in it).
|
|
14
|
+
* @param assets - What the page loaded, by address.
|
|
15
|
+
* @returns The stylesheet, ready to sit inside the snapshot.
|
|
16
|
+
*/
|
|
17
|
+
export declare function embedFonts(css: string, base: string, assets: ReadonlyMap<string, CapturedAsset>): string;
|
|
18
|
+
/**
|
|
19
|
+
* Turns a captured page into one that carries its own styles: every `<link rel="stylesheet">` the page loaded becomes a `<style>` with
|
|
20
|
+
* the stylesheet's text, and the fonts in it (and in the page's own `<style>`s) are embedded. A stylesheet that was not captured is left
|
|
21
|
+
* as the link it was.
|
|
22
|
+
*
|
|
23
|
+
* @param html - The page as captured.
|
|
24
|
+
* @param pageUrl - The page's address.
|
|
25
|
+
* @param assets - The stylesheets and fonts the page loaded, by address.
|
|
26
|
+
* @returns The page with its styles and fonts inside it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function inlineAssets(html: string, pageUrl: string, assets: ReadonlyMap<string, CapturedAsset>): string;
|
|
29
|
+
//# sourceMappingURL=inline-assets.mapper.d.ts.map
|
|
@@ -15,6 +15,8 @@ export interface SnapshotResult {
|
|
|
15
15
|
* snapshot no longer has by the time it is cached.
|
|
16
16
|
*/
|
|
17
17
|
rawHtml: string;
|
|
18
|
+
/** Something to tell the person about the page: it is a bot check or an access-denied page, not the content. */
|
|
19
|
+
notice?: string;
|
|
18
20
|
/**
|
|
19
21
|
* The format `http.client.ts` read the body as (api mode only; `undefined`
|
|
20
22
|
* in web mode, whose document is always HTML) — what the content pane
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface ImportedDocument {
|
|
2
2
|
/** The copy's path on disk, inside `folder`. */
|
|
3
3
|
path: string;
|
|
4
|
-
/** The copy as a `file:` URL: what the recipe's `start.url` becomes. */
|
|
4
|
+
/** The copy as a `file:` URL relative to the folder (`file:report.pdf`): what the recipe's `start.url` becomes, so the folder can be moved or shared. */
|
|
5
5
|
url: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -9,8 +9,10 @@ export interface ImportedDocument {
|
|
|
9
9
|
* `file:` URL the same way a run would read any downloaded file (core's
|
|
10
10
|
* `HttpClient` handles `file:` itself). The folder is created when missing,
|
|
11
11
|
* so dropping a file is also a way to start a workspace. A name already in
|
|
12
|
-
* the folder is never overwritten:
|
|
13
|
-
*
|
|
12
|
+
* the folder is never overwritten: a file there with the very same bytes is
|
|
13
|
+
* reused (loading one document twice leaves one copy), a different one gets
|
|
14
|
+
* the next free numbered name (`report-2.pdf`); the returned `path`/`url`
|
|
15
|
+
* say which.
|
|
14
16
|
*
|
|
15
17
|
* @param folder - The workspace folder; created (recursively) when it does not exist.
|
|
16
18
|
* @param name - The file's own name, no directories: the copy keeps it, extension included.
|
|
@@ -10,6 +10,11 @@ export declare const openWorkspaceCommandSchema: z.ZodObject<{
|
|
|
10
10
|
type: z.ZodLiteral<"open-workspace">;
|
|
11
11
|
folder: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
+
/** Says what a page address returns, so a recipe is started the right way: a JSON API is read with a request, a page with a browser. */
|
|
14
|
+
export declare const detectUrlCommandSchema: z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"detect-url">;
|
|
16
|
+
url: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
13
18
|
/** Says what a path is (folder, recipe or document) and where to open it: how a link or an IDE entry opens a path (issue #235). `workspace` is the folder a document should belong to, when the caller has one. */
|
|
14
19
|
export declare const openPathCommandSchema: z.ZodObject<{
|
|
15
20
|
type: z.ZodLiteral<"open-path">;
|
|
@@ -87,6 +92,7 @@ export declare const inferSelectorCommandSchema: z.ZodObject<{
|
|
|
87
92
|
recipeId: z.ZodString;
|
|
88
93
|
path: z.ZodString;
|
|
89
94
|
nodeIds: z.ZodUnion<readonly [z.ZodTuple<[z.ZodString], null>, z.ZodTuple<[z.ZodString, z.ZodString], null>]>;
|
|
95
|
+
within: z.ZodOptional<z.ZodString>;
|
|
90
96
|
}, z.core.$strip>;
|
|
91
97
|
/**
|
|
92
98
|
* The Inspect panel's DOM tree and data-in-the-page findings, off the same
|
|
@@ -399,6 +405,9 @@ export declare const studioCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
399
405
|
}, z.core.$strip>, z.ZodObject<{
|
|
400
406
|
type: z.ZodLiteral<"fetch-start-page">;
|
|
401
407
|
recipeId: z.ZodString;
|
|
408
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
409
|
+
type: z.ZodLiteral<"detect-url">;
|
|
410
|
+
url: z.ZodString;
|
|
402
411
|
}, z.core.$strip>, z.ZodObject<{
|
|
403
412
|
type: z.ZodLiteral<"save-outline">;
|
|
404
413
|
path: z.ZodString;
|
|
@@ -417,6 +426,7 @@ export declare const studioCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
417
426
|
recipeId: z.ZodString;
|
|
418
427
|
path: z.ZodString;
|
|
419
428
|
nodeIds: z.ZodUnion<readonly [z.ZodTuple<[z.ZodString], null>, z.ZodTuple<[z.ZodString, z.ZodString], null>]>;
|
|
429
|
+
within: z.ZodOptional<z.ZodString>;
|
|
420
430
|
}, z.core.$strip>, z.ZodObject<{
|
|
421
431
|
type: z.ZodLiteral<"explain-why">;
|
|
422
432
|
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -523,6 +533,7 @@ export type RunSampleCommand = z.infer<typeof runSampleCommandSchema>;
|
|
|
523
533
|
export type StopRunCommand = z.infer<typeof stopRunCommandSchema>;
|
|
524
534
|
export type SaveRecipeCommand = z.infer<typeof saveRecipeCommandSchema>;
|
|
525
535
|
export type FetchStartPageCommand = z.infer<typeof fetchStartPageCommandSchema>;
|
|
536
|
+
export type DetectUrlCommand = z.infer<typeof detectUrlCommandSchema>;
|
|
526
537
|
export type SaveOutlineCommand = z.infer<typeof saveOutlineCommandSchema>;
|
|
527
538
|
export type TakeSnapshotCommand = z.infer<typeof takeSnapshotCommandSchema>;
|
|
528
539
|
export type VerifySelectorCommand = z.infer<typeof verifySelectorCommandSchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* `detect-url`'s answer: what the address returns, so "Load ▾ Web page" starts the right recipe: `html` is a page (opened in a
|
|
4
|
+
* browser); `json`, `pdf`, `csv`, `xlsx`, `markdown`, `xml`... are documents (read with a request); `unknown` when it could not be fetched.
|
|
5
|
+
*/
|
|
6
|
+
export declare const detectUrlViewSchema: z.ZodObject<{
|
|
7
|
+
kind: z.ZodEnum<{
|
|
8
|
+
unknown: "unknown";
|
|
9
|
+
text: "text";
|
|
10
|
+
html: "html";
|
|
11
|
+
json: "json";
|
|
12
|
+
jsonl: "jsonl";
|
|
13
|
+
pdf: "pdf";
|
|
14
|
+
csv: "csv";
|
|
15
|
+
xlsx: "xlsx";
|
|
16
|
+
pptx: "pptx";
|
|
17
|
+
yaml: "yaml";
|
|
18
|
+
markdown: "markdown";
|
|
19
|
+
xml: "xml";
|
|
20
|
+
docx: "docx";
|
|
21
|
+
}>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type DetectUrlView = z.infer<typeof detectUrlViewSchema>;
|
|
24
|
+
//# sourceMappingURL=detect-url-view.contract.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { sampleBudgetSchema, openWorkspaceCommandSchema, chooseFolderCommandSchema, openPathCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, startRecordingCommandSchema, stopRecordingCommandSchema, studioCommandSchema } from './command.contract.js';
|
|
2
|
-
export type { SampleBudget, OpenWorkspaceCommand, ChooseFolderCommand, OpenPathCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StartRecordingCommand, StopRecordingCommand, StudioCommand } from './command.contract.js';
|
|
1
|
+
export { sampleBudgetSchema, openWorkspaceCommandSchema, chooseFolderCommandSchema, openPathCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, detectUrlCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, startRecordingCommandSchema, stopRecordingCommandSchema, studioCommandSchema } from './command.contract.js';
|
|
2
|
+
export type { SampleBudget, OpenWorkspaceCommand, ChooseFolderCommand, OpenPathCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, DetectUrlCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StartRecordingCommand, StopRecordingCommand, StudioCommand } from './command.contract.js';
|
|
3
3
|
export { snapshotViewSchema } from './snapshot-view.contract.js';
|
|
4
4
|
export type { SnapshotView } from './snapshot-view.contract.js';
|
|
5
5
|
export { verifySelectorViewSchema } from './verify-selector-view.contract.js';
|
|
@@ -18,6 +18,8 @@ export { importDocumentViewSchema } from './import-document-view.contract.js';
|
|
|
18
18
|
export type { ImportDocumentView } from './import-document-view.contract.js';
|
|
19
19
|
export { sampleRunRecordSchema, sampleRunViewSchema } from './sample-run-view.contract.js';
|
|
20
20
|
export type { SampleRunRecord, SampleRunView } from './sample-run-view.contract.js';
|
|
21
|
+
export { detectUrlViewSchema } from './detect-url-view.contract.js';
|
|
22
|
+
export type { DetectUrlView } from './detect-url-view.contract.js';
|
|
21
23
|
export { startPageViewSchema } from './start-page-view.contract.js';
|
|
22
24
|
export type { StartPageView } from './start-page-view.contract.js';
|
|
23
25
|
export { sentencePartSchema, outlineCardSchema, outlineBracketSchema, outlineNodeSchema, outlineViewSchema } from './outline-view.contract.js';
|
|
@@ -59,6 +59,20 @@ export declare const inferSelectorViewSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
59
59
|
take: z.ZodString;
|
|
60
60
|
matches: z.ZodNumber;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
kind: z.ZodLiteral<"item-field">;
|
|
64
|
+
field: z.ZodObject<{
|
|
65
|
+
selector: z.ZodString;
|
|
66
|
+
tier: z.ZodEnum<{
|
|
67
|
+
id: "id";
|
|
68
|
+
"data-attr": "data-attr";
|
|
69
|
+
class: "class";
|
|
70
|
+
structure: "structure";
|
|
71
|
+
position: "position";
|
|
72
|
+
}>;
|
|
73
|
+
take: z.ZodString;
|
|
74
|
+
matches: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>;
|
|
62
76
|
}, z.core.$strip>, z.ZodObject<{
|
|
63
77
|
kind: z.ZodLiteral<"unsupported">;
|
|
64
78
|
reason: z.ZodString;
|
|
@@ -17,6 +17,7 @@ export declare const pdfRowViewSchema: z.ZodObject<{
|
|
|
17
17
|
height: z.ZodNumber;
|
|
18
18
|
text: z.ZodString;
|
|
19
19
|
}, z.core.$strip>>;
|
|
20
|
+
running: z.ZodOptional<z.ZodBoolean>;
|
|
20
21
|
}, z.core.$strip>;
|
|
21
22
|
export declare const pdfPageViewSchema: z.ZodObject<{
|
|
22
23
|
number: z.ZodNumber;
|
|
@@ -32,6 +33,7 @@ export declare const pdfPageViewSchema: z.ZodObject<{
|
|
|
32
33
|
height: z.ZodNumber;
|
|
33
34
|
text: z.ZodString;
|
|
34
35
|
}, z.core.$strip>>;
|
|
36
|
+
running: z.ZodOptional<z.ZodBoolean>;
|
|
35
37
|
}, z.core.$strip>>;
|
|
36
38
|
rowCount: z.ZodNumber;
|
|
37
39
|
cellCount: z.ZodNumber;
|
|
@@ -53,6 +55,7 @@ export declare const pdfDocumentViewSchema: z.ZodObject<{
|
|
|
53
55
|
height: z.ZodNumber;
|
|
54
56
|
text: z.ZodString;
|
|
55
57
|
}, z.core.$strip>>;
|
|
58
|
+
running: z.ZodOptional<z.ZodBoolean>;
|
|
56
59
|
}, z.core.$strip>>;
|
|
57
60
|
rowCount: z.ZodNumber;
|
|
58
61
|
cellCount: z.ZodNumber;
|
|
@@ -25,6 +25,7 @@ export declare const snapshotViewSchema: z.ZodObject<{
|
|
|
25
25
|
xml: "xml";
|
|
26
26
|
docx: "docx";
|
|
27
27
|
}>>;
|
|
28
|
+
notice: z.ZodOptional<z.ZodString>;
|
|
28
29
|
}, z.core.$strip>;
|
|
29
30
|
export type SnapshotView = z.infer<typeof snapshotViewSchema>;
|
|
30
31
|
//# sourceMappingURL=snapshot-view.contract.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DetectUrlCommand, DetectUrlView } from '../studio-api/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handles `detect-url`: what the address returns, for "Load ▾ Web page" to start a recipe that reads a document (a JSON API, a PDF,
|
|
4
|
+
* a spreadsheet, Markdown...) instead of a browser recipe over a response that is not a page.
|
|
5
|
+
*
|
|
6
|
+
* @param command - The address.
|
|
7
|
+
* @returns What it returns.
|
|
8
|
+
*/
|
|
9
|
+
export declare function handleDetectUrl(command: DetectUrlCommand): Promise<DetectUrlView>;
|
|
10
|
+
//# sourceMappingURL=detect-url.handler.d.ts.map
|
|
@@ -10,6 +10,11 @@ export declare const openWorkspaceCommandSchema: z.ZodObject<{
|
|
|
10
10
|
type: z.ZodLiteral<"open-workspace">;
|
|
11
11
|
folder: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
+
/** Says what a page address returns, so a recipe is started the right way: a JSON API is read with a request, a page with a browser. */
|
|
14
|
+
export declare const detectUrlCommandSchema: z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"detect-url">;
|
|
16
|
+
url: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
13
18
|
/** Says what a path is (folder, recipe or document) and where to open it: how a link or an IDE entry opens a path (issue #235). `workspace` is the folder a document should belong to, when the caller has one. */
|
|
14
19
|
export declare const openPathCommandSchema: z.ZodObject<{
|
|
15
20
|
type: z.ZodLiteral<"open-path">;
|
|
@@ -87,6 +92,7 @@ export declare const inferSelectorCommandSchema: z.ZodObject<{
|
|
|
87
92
|
recipeId: z.ZodString;
|
|
88
93
|
path: z.ZodString;
|
|
89
94
|
nodeIds: z.ZodUnion<readonly [z.ZodTuple<[z.ZodString], null>, z.ZodTuple<[z.ZodString, z.ZodString], null>]>;
|
|
95
|
+
within: z.ZodOptional<z.ZodString>;
|
|
90
96
|
}, z.core.$strip>;
|
|
91
97
|
/**
|
|
92
98
|
* The Inspect panel's DOM tree and data-in-the-page findings, off the same
|
|
@@ -399,6 +405,9 @@ export declare const studioCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
399
405
|
}, z.core.$strip>, z.ZodObject<{
|
|
400
406
|
type: z.ZodLiteral<"fetch-start-page">;
|
|
401
407
|
recipeId: z.ZodString;
|
|
408
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
409
|
+
type: z.ZodLiteral<"detect-url">;
|
|
410
|
+
url: z.ZodString;
|
|
402
411
|
}, z.core.$strip>, z.ZodObject<{
|
|
403
412
|
type: z.ZodLiteral<"save-outline">;
|
|
404
413
|
path: z.ZodString;
|
|
@@ -417,6 +426,7 @@ export declare const studioCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
417
426
|
recipeId: z.ZodString;
|
|
418
427
|
path: z.ZodString;
|
|
419
428
|
nodeIds: z.ZodUnion<readonly [z.ZodTuple<[z.ZodString], null>, z.ZodTuple<[z.ZodString, z.ZodString], null>]>;
|
|
429
|
+
within: z.ZodOptional<z.ZodString>;
|
|
420
430
|
}, z.core.$strip>, z.ZodObject<{
|
|
421
431
|
type: z.ZodLiteral<"explain-why">;
|
|
422
432
|
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -523,6 +533,7 @@ export type RunSampleCommand = z.infer<typeof runSampleCommandSchema>;
|
|
|
523
533
|
export type StopRunCommand = z.infer<typeof stopRunCommandSchema>;
|
|
524
534
|
export type SaveRecipeCommand = z.infer<typeof saveRecipeCommandSchema>;
|
|
525
535
|
export type FetchStartPageCommand = z.infer<typeof fetchStartPageCommandSchema>;
|
|
536
|
+
export type DetectUrlCommand = z.infer<typeof detectUrlCommandSchema>;
|
|
526
537
|
export type SaveOutlineCommand = z.infer<typeof saveOutlineCommandSchema>;
|
|
527
538
|
export type TakeSnapshotCommand = z.infer<typeof takeSnapshotCommandSchema>;
|
|
528
539
|
export type VerifySelectorCommand = z.infer<typeof verifySelectorCommandSchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* `detect-url`'s answer: what the address returns, so "Load ▾ Web page" starts the right recipe: `html` is a page (opened in a
|
|
4
|
+
* browser); `json`, `pdf`, `csv`, `xlsx`, `markdown`, `xml`... are documents (read with a request); `unknown` when it could not be fetched.
|
|
5
|
+
*/
|
|
6
|
+
export declare const detectUrlViewSchema: z.ZodObject<{
|
|
7
|
+
kind: z.ZodEnum<{
|
|
8
|
+
csv: "csv";
|
|
9
|
+
docx: "docx";
|
|
10
|
+
html: "html";
|
|
11
|
+
json: "json";
|
|
12
|
+
jsonl: "jsonl";
|
|
13
|
+
markdown: "markdown";
|
|
14
|
+
pdf: "pdf";
|
|
15
|
+
pptx: "pptx";
|
|
16
|
+
text: "text";
|
|
17
|
+
unknown: "unknown";
|
|
18
|
+
xlsx: "xlsx";
|
|
19
|
+
xml: "xml";
|
|
20
|
+
yaml: "yaml";
|
|
21
|
+
}>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type DetectUrlView = z.infer<typeof detectUrlViewSchema>;
|
|
24
|
+
//# sourceMappingURL=detect-url-view.contract.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { sampleBudgetSchema, openWorkspaceCommandSchema, chooseFolderCommandSchema, openPathCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, startRecordingCommandSchema, stopRecordingCommandSchema, studioCommandSchema } from './command.contract';
|
|
2
|
-
export type { SampleBudget, OpenWorkspaceCommand, ChooseFolderCommand, OpenPathCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StartRecordingCommand, StopRecordingCommand, StudioCommand } from './command.contract';
|
|
1
|
+
export { sampleBudgetSchema, openWorkspaceCommandSchema, chooseFolderCommandSchema, openPathCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, detectUrlCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, startRecordingCommandSchema, stopRecordingCommandSchema, studioCommandSchema } from './command.contract';
|
|
2
|
+
export type { SampleBudget, OpenWorkspaceCommand, ChooseFolderCommand, OpenPathCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, DetectUrlCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StartRecordingCommand, StopRecordingCommand, StudioCommand } from './command.contract';
|
|
3
3
|
export { snapshotViewSchema } from './snapshot-view.contract';
|
|
4
4
|
export type { SnapshotView } from './snapshot-view.contract';
|
|
5
5
|
export { verifySelectorViewSchema } from './verify-selector-view.contract';
|
|
@@ -18,6 +18,8 @@ export { importDocumentViewSchema } from './import-document-view.contract';
|
|
|
18
18
|
export type { ImportDocumentView } from './import-document-view.contract';
|
|
19
19
|
export { sampleRunRecordSchema, sampleRunViewSchema } from './sample-run-view.contract';
|
|
20
20
|
export type { SampleRunRecord, SampleRunView } from './sample-run-view.contract';
|
|
21
|
+
export { detectUrlViewSchema } from './detect-url-view.contract';
|
|
22
|
+
export type { DetectUrlView } from './detect-url-view.contract';
|
|
21
23
|
export { startPageViewSchema } from './start-page-view.contract';
|
|
22
24
|
export type { StartPageView } from './start-page-view.contract';
|
|
23
25
|
export { sentencePartSchema, outlineCardSchema, outlineBracketSchema, outlineNodeSchema, outlineViewSchema } from './outline-view.contract';
|
|
@@ -59,6 +59,20 @@ export declare const inferSelectorViewSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
59
59
|
take: z.ZodString;
|
|
60
60
|
matches: z.ZodNumber;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
kind: z.ZodLiteral<"item-field">;
|
|
64
|
+
field: z.ZodObject<{
|
|
65
|
+
selector: z.ZodString;
|
|
66
|
+
tier: z.ZodEnum<{
|
|
67
|
+
class: "class";
|
|
68
|
+
"data-attr": "data-attr";
|
|
69
|
+
id: "id";
|
|
70
|
+
position: "position";
|
|
71
|
+
structure: "structure";
|
|
72
|
+
}>;
|
|
73
|
+
take: z.ZodString;
|
|
74
|
+
matches: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>;
|
|
62
76
|
}, z.core.$strip>, z.ZodObject<{
|
|
63
77
|
kind: z.ZodLiteral<"unsupported">;
|
|
64
78
|
reason: z.ZodString;
|
|
@@ -17,6 +17,7 @@ export declare const pdfRowViewSchema: z.ZodObject<{
|
|
|
17
17
|
height: z.ZodNumber;
|
|
18
18
|
text: z.ZodString;
|
|
19
19
|
}, z.core.$strip>>;
|
|
20
|
+
running: z.ZodOptional<z.ZodBoolean>;
|
|
20
21
|
}, z.core.$strip>;
|
|
21
22
|
export declare const pdfPageViewSchema: z.ZodObject<{
|
|
22
23
|
number: z.ZodNumber;
|
|
@@ -32,6 +33,7 @@ export declare const pdfPageViewSchema: z.ZodObject<{
|
|
|
32
33
|
height: z.ZodNumber;
|
|
33
34
|
text: z.ZodString;
|
|
34
35
|
}, z.core.$strip>>;
|
|
36
|
+
running: z.ZodOptional<z.ZodBoolean>;
|
|
35
37
|
}, z.core.$strip>>;
|
|
36
38
|
rowCount: z.ZodNumber;
|
|
37
39
|
cellCount: z.ZodNumber;
|
|
@@ -53,6 +55,7 @@ export declare const pdfDocumentViewSchema: z.ZodObject<{
|
|
|
53
55
|
height: z.ZodNumber;
|
|
54
56
|
text: z.ZodString;
|
|
55
57
|
}, z.core.$strip>>;
|
|
58
|
+
running: z.ZodOptional<z.ZodBoolean>;
|
|
56
59
|
}, z.core.$strip>>;
|
|
57
60
|
rowCount: z.ZodNumber;
|
|
58
61
|
cellCount: z.ZodNumber;
|
|
@@ -25,6 +25,7 @@ export declare const snapshotViewSchema: z.ZodObject<{
|
|
|
25
25
|
xml: "xml";
|
|
26
26
|
yaml: "yaml";
|
|
27
27
|
}>>;
|
|
28
|
+
notice: z.ZodOptional<z.ZodString>;
|
|
28
29
|
}, z.core.$strip>;
|
|
29
30
|
export type SnapshotView = z.infer<typeof snapshotViewSchema>;
|
|
30
31
|
//# sourceMappingURL=snapshot-view.contract.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DetectUrlCommand, DetectUrlView } from '../studio-api';
|
|
2
|
+
/**
|
|
3
|
+
* Handles `detect-url`: what the address returns, for "Load ▾ Web page" to start a recipe that reads a document (a JSON API, a PDF,
|
|
4
|
+
* a spreadsheet, Markdown...) instead of a browser recipe over a response that is not a page.
|
|
5
|
+
*
|
|
6
|
+
* @param command - The address.
|
|
7
|
+
* @returns What it returns.
|
|
8
|
+
*/
|
|
9
|
+
export declare function handleDetectUrl(command: DetectUrlCommand): Promise<DetectUrlView>;
|
|
10
|
+
//# sourceMappingURL=detect-url.handler.d.ts.map
|