@plan2net/typo3-playwright-toolkit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +338 -0
- package/README.md +404 -0
- package/dist/builders/content-builder.d.ts +30 -0
- package/dist/builders/content-builder.d.ts.map +1 -0
- package/dist/builders/content-builder.js +67 -0
- package/dist/builders/content-builder.js.map +1 -0
- package/dist/builders/content-factory.d.ts +10 -0
- package/dist/builders/content-factory.d.ts.map +1 -0
- package/dist/builders/content-factory.js +23 -0
- package/dist/builders/content-factory.js.map +1 -0
- package/dist/builders/core-content.d.ts +127 -0
- package/dist/builders/core-content.d.ts.map +1 -0
- package/dist/builders/core-content.js +223 -0
- package/dist/builders/core-content.js.map +1 -0
- package/dist/builders/fields.d.ts +7 -0
- package/dist/builders/fields.d.ts.map +1 -0
- package/dist/builders/fields.js +20 -0
- package/dist/builders/fields.js.map +1 -0
- package/dist/builders/identifier.d.ts +2 -0
- package/dist/builders/identifier.d.ts.map +1 -0
- package/dist/builders/identifier.js +11 -0
- package/dist/builders/identifier.js.map +1 -0
- package/dist/builders/page-builder.d.ts +40 -0
- package/dist/builders/page-builder.d.ts.map +1 -0
- package/dist/builders/page-builder.js +119 -0
- package/dist/builders/page-builder.js.map +1 -0
- package/dist/builders/request-context.d.ts +23 -0
- package/dist/builders/request-context.d.ts.map +1 -0
- package/dist/builders/request-context.js +32 -0
- package/dist/builders/request-context.js.map +1 -0
- package/dist/checks/accessibility.d.ts +34 -0
- package/dist/checks/accessibility.d.ts.map +1 -0
- package/dist/checks/accessibility.js +90 -0
- package/dist/checks/accessibility.js.map +1 -0
- package/dist/checks/csp.d.ts +39 -0
- package/dist/checks/csp.d.ts.map +1 -0
- package/dist/checks/csp.js +179 -0
- package/dist/checks/csp.js.map +1 -0
- package/dist/checks/screenshot.d.ts +18 -0
- package/dist/checks/screenshot.d.ts.map +1 -0
- package/dist/checks/screenshot.js +125 -0
- package/dist/checks/screenshot.js.map +1 -0
- package/dist/config.d.ts +100 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +68 -0
- package/dist/config.js.map +1 -0
- package/dist/contract.d.ts +9 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +25 -0
- package/dist/contract.js.map +1 -0
- package/dist/global-setup.d.ts +20 -0
- package/dist/global-setup.d.ts.map +1 -0
- package/dist/global-setup.js +103 -0
- package/dist/global-setup.js.map +1 -0
- package/dist/global-teardown.d.ts +34 -0
- package/dist/global-teardown.d.ts.map +1 -0
- package/dist/global-teardown.js +269 -0
- package/dist/global-teardown.js.map +1 -0
- package/dist/http/api-secret.d.ts +11 -0
- package/dist/http/api-secret.d.ts.map +1 -0
- package/dist/http/api-secret.js +27 -0
- package/dist/http/api-secret.js.map +1 -0
- package/dist/http/cleanup-client.d.ts +26 -0
- package/dist/http/cleanup-client.d.ts.map +1 -0
- package/dist/http/cleanup-client.js +91 -0
- package/dist/http/cleanup-client.js.map +1 -0
- package/dist/http/off-site-headers.d.ts +13 -0
- package/dist/http/off-site-headers.d.ts.map +1 -0
- package/dist/http/off-site-headers.js +27 -0
- package/dist/http/off-site-headers.js.map +1 -0
- package/dist/http/prepare-context.d.ts +4 -0
- package/dist/http/prepare-context.d.ts.map +1 -0
- package/dist/http/prepare-context.js +6 -0
- package/dist/http/prepare-context.js.map +1 -0
- package/dist/http/record-edit.d.ts +37 -0
- package/dist/http/record-edit.d.ts.map +1 -0
- package/dist/http/record-edit.js +86 -0
- package/dist/http/record-edit.js.map +1 -0
- package/dist/http/toolkit-request.d.ts +8 -0
- package/dist/http/toolkit-request.d.ts.map +1 -0
- package/dist/http/toolkit-request.js +45 -0
- package/dist/http/toolkit-request.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect/cli.d.ts +3 -0
- package/dist/inspect/cli.d.ts.map +1 -0
- package/dist/inspect/cli.js +36 -0
- package/dist/inspect/cli.js.map +1 -0
- package/dist/inspect/links.d.ts +10 -0
- package/dist/inspect/links.d.ts.map +1 -0
- package/dist/inspect/links.js +51 -0
- package/dist/inspect/links.js.map +1 -0
- package/dist/inspect/token.d.ts +5 -0
- package/dist/inspect/token.d.ts.map +1 -0
- package/dist/inspect/token.js +15 -0
- package/dist/inspect/token.js.map +1 -0
- package/dist/playwright/base-config.d.ts +4 -0
- package/dist/playwright/base-config.d.ts.map +1 -0
- package/dist/playwright/base-config.js +34 -0
- package/dist/playwright/base-config.js.map +1 -0
- package/dist/playwright/index.d.ts +3 -0
- package/dist/playwright/index.d.ts.map +1 -0
- package/dist/playwright/index.js +3 -0
- package/dist/playwright/index.js.map +1 -0
- package/dist/scenario.d.ts +46 -0
- package/dist/scenario.d.ts.map +1 -0
- package/dist/scenario.js +139 -0
- package/dist/scenario.js.map +1 -0
- package/dist/state/attempt-claim.d.ts +8 -0
- package/dist/state/attempt-claim.d.ts.map +1 -0
- package/dist/state/attempt-claim.js +47 -0
- package/dist/state/attempt-claim.js.map +1 -0
- package/dist/state/attempt-registry.d.ts +36 -0
- package/dist/state/attempt-registry.d.ts.map +1 -0
- package/dist/state/attempt-registry.js +68 -0
- package/dist/state/attempt-registry.js.map +1 -0
- package/dist/state/ensure-state.d.ts +42 -0
- package/dist/state/ensure-state.d.ts.map +1 -0
- package/dist/state/ensure-state.js +169 -0
- package/dist/state/ensure-state.js.map +1 -0
- package/dist/state/json-safe.d.ts +9 -0
- package/dist/state/json-safe.d.ts.map +1 -0
- package/dist/state/json-safe.js +18 -0
- package/dist/state/json-safe.js.map +1 -0
- package/dist/state/run-id.d.ts +6 -0
- package/dist/state/run-id.d.ts.map +1 -0
- package/dist/state/run-id.js +28 -0
- package/dist/state/run-id.js.map +1 -0
- package/dist/state/run-namespace.d.ts +33 -0
- package/dist/state/run-namespace.d.ts.map +1 -0
- package/dist/state/run-namespace.js +136 -0
- package/dist/state/run-namespace.js.map +1 -0
- package/dist/state/safe-paths.d.ts +10 -0
- package/dist/state/safe-paths.d.ts.map +1 -0
- package/dist/state/safe-paths.js +56 -0
- package/dist/state/safe-paths.js.map +1 -0
- package/dist/state/scenario-outcome.d.ts +9 -0
- package/dist/state/scenario-outcome.d.ts.map +1 -0
- package/dist/state/scenario-outcome.js +23 -0
- package/dist/state/scenario-outcome.js.map +1 -0
- package/dist/state/scenario-state.d.ts +41 -0
- package/dist/state/scenario-state.d.ts.map +1 -0
- package/dist/state/scenario-state.js +50 -0
- package/dist/state/scenario-state.js.map +1 -0
- package/dist/state/setup-lock.d.ts +22 -0
- package/dist/state/setup-lock.d.ts.map +1 -0
- package/dist/state/setup-lock.js +90 -0
- package/dist/state/setup-lock.js.map +1 -0
- package/dist/types/common.d.ts +17 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/content-builder.d.ts +16 -0
- package/dist/types/content-builder.d.ts.map +1 -0
- package/dist/types/content-builder.js +2 -0
- package/dist/types/content-builder.js.map +1 -0
- package/dist/types/playwright-extensions.d.ts +8 -0
- package/dist/types/playwright-extensions.d.ts.map +1 -0
- package/dist/types/playwright-extensions.js +2 -0
- package/dist/types/playwright-extensions.js.map +1 -0
- package/package.json +88 -0
- package/tsconfig.base.json +13 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { ContentBuilderInterface, ContentFields } from '../types/content-builder.js';
|
|
2
|
+
import type { RecordDataMap } from '../http/record-edit.js';
|
|
3
|
+
export declare abstract class CoreContent implements ContentBuilderInterface {
|
|
4
|
+
abstract readonly type: string;
|
|
5
|
+
protected fields: ContentFields;
|
|
6
|
+
withHeader(header: string): this;
|
|
7
|
+
withSubheader(subheader: string): this;
|
|
8
|
+
/** 0 is "hidden", 1–5 are h1–h5 in a stock fluid_styled_content install. */
|
|
9
|
+
withHeaderLayout(layout: number): this;
|
|
10
|
+
withHeaderLink(link: string): this;
|
|
11
|
+
withColPos(colPos: number): this;
|
|
12
|
+
setHidden(hidden?: boolean): this;
|
|
13
|
+
/** Any column the typed setters do not cover, including your own. */
|
|
14
|
+
withField(column: string, value: ContentFields[string]): this;
|
|
15
|
+
getFields(): ContentFields;
|
|
16
|
+
protected set(column: string, value: ContentFields[string]): this;
|
|
17
|
+
}
|
|
18
|
+
declare abstract class MediaCoreContent extends CoreContent {
|
|
19
|
+
/** The tt_content column the references hang off — `assets`, `image`, `media`. */
|
|
20
|
+
protected abstract readonly mediaColumn: string;
|
|
21
|
+
private fileUids;
|
|
22
|
+
private identifiers;
|
|
23
|
+
withFile(fileUid: number): this;
|
|
24
|
+
withFiles(fileUids: number[]): this;
|
|
25
|
+
getFields(): ContentFields;
|
|
26
|
+
getAdditionalRecords(contentIdentifier: string, pageId: string): RecordDataMap;
|
|
27
|
+
private referenceIdentifiers;
|
|
28
|
+
}
|
|
29
|
+
declare abstract class GalleryCoreContent extends MediaCoreContent {
|
|
30
|
+
withColumns(imagecols: number): this;
|
|
31
|
+
/** TCA `imageorient`: 0 above-center, 8 below-center, 17 in-text-right, … */
|
|
32
|
+
withOrientation(imageorient: number): this;
|
|
33
|
+
withImageSize(width?: number, height?: number): this;
|
|
34
|
+
}
|
|
35
|
+
export declare class HeaderContent extends CoreContent {
|
|
36
|
+
readonly type = "header";
|
|
37
|
+
}
|
|
38
|
+
export declare class TextContent extends CoreContent {
|
|
39
|
+
readonly type = "text";
|
|
40
|
+
withBodyText(html: string): this;
|
|
41
|
+
}
|
|
42
|
+
export declare class TextmediaContent extends GalleryCoreContent {
|
|
43
|
+
readonly type = "textmedia";
|
|
44
|
+
protected readonly mediaColumn = "assets";
|
|
45
|
+
withBodyText(html: string): this;
|
|
46
|
+
}
|
|
47
|
+
export declare class TextpicContent extends GalleryCoreContent {
|
|
48
|
+
readonly type = "textpic";
|
|
49
|
+
protected readonly mediaColumn = "image";
|
|
50
|
+
withBodyText(html: string): this;
|
|
51
|
+
}
|
|
52
|
+
export declare class ImageContent extends GalleryCoreContent {
|
|
53
|
+
readonly type = "image";
|
|
54
|
+
protected readonly mediaColumn = "image";
|
|
55
|
+
}
|
|
56
|
+
export declare class BulletsContent extends CoreContent {
|
|
57
|
+
readonly type = "bullets";
|
|
58
|
+
/** One bullet per line — the column is a plain newline-separated text field. */
|
|
59
|
+
withItems(items: string[]): this;
|
|
60
|
+
/** TCA `bullets_type`: 0 disc, 1 numbered, 2 none. */
|
|
61
|
+
withBulletsType(bulletsType: number): this;
|
|
62
|
+
}
|
|
63
|
+
export declare class TableContent extends CoreContent {
|
|
64
|
+
readonly type = "table";
|
|
65
|
+
withRows(rows: string[][]): this;
|
|
66
|
+
withCaption(caption: string): this;
|
|
67
|
+
/** 1 puts the first row in a thead; 0 none, 2 first column, 3 both. */
|
|
68
|
+
withHeaderPosition(position: number): this;
|
|
69
|
+
private delimiter;
|
|
70
|
+
}
|
|
71
|
+
export declare class UploadsContent extends MediaCoreContent {
|
|
72
|
+
readonly type = "uploads";
|
|
73
|
+
protected readonly mediaColumn = "media";
|
|
74
|
+
}
|
|
75
|
+
export declare class HtmlContent extends CoreContent {
|
|
76
|
+
readonly type = "html";
|
|
77
|
+
withHtml(html: string): this;
|
|
78
|
+
}
|
|
79
|
+
export declare class DividerContent extends CoreContent {
|
|
80
|
+
readonly type = "div";
|
|
81
|
+
}
|
|
82
|
+
export declare class ShortcutContent extends CoreContent {
|
|
83
|
+
readonly type = "shortcut";
|
|
84
|
+
/** Each entry is `tt_content_<uid>`, or a bare uid for tt_content. */
|
|
85
|
+
withRecords(records: string[]): this;
|
|
86
|
+
}
|
|
87
|
+
export declare class MenuContent extends CoreContent {
|
|
88
|
+
readonly type: string;
|
|
89
|
+
constructor(type: string);
|
|
90
|
+
withPages(pageUids: number[]): this;
|
|
91
|
+
withSelectedCategories(categoryUids: number[]): this;
|
|
92
|
+
}
|
|
93
|
+
export declare const MENU_TYPES: readonly ["menu_pages", "menu_subpages", "menu_sitemap", "menu_sitemap_pages", "menu_section", "menu_section_pages", "menu_abstract", "menu_recently_updated", "menu_related_pages", "menu_categorized_pages", "menu_categorized_content"];
|
|
94
|
+
export type MenuType = (typeof MENU_TYPES)[number];
|
|
95
|
+
export interface CoreContentTypeMap extends Record<MenuType, MenuContent> {
|
|
96
|
+
header: HeaderContent;
|
|
97
|
+
text: TextContent;
|
|
98
|
+
textmedia: TextmediaContent;
|
|
99
|
+
textpic: TextpicContent;
|
|
100
|
+
image: ImageContent;
|
|
101
|
+
bullets: BulletsContent;
|
|
102
|
+
table: TableContent;
|
|
103
|
+
uploads: UploadsContent;
|
|
104
|
+
html: HtmlContent;
|
|
105
|
+
div: DividerContent;
|
|
106
|
+
shortcut: ShortcutContent;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Consumers add their own CTypes by merging into this interface, which is what
|
|
110
|
+
* keeps `configure` typed for them too:
|
|
111
|
+
*
|
|
112
|
+
* ```ts
|
|
113
|
+
* declare module '@plan2net/typo3-playwright-toolkit' {
|
|
114
|
+
* interface ContentTypeMap { my_teaser: TeaserContent }
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* It starts empty so a key here can also replace a core one, the way
|
|
119
|
+
* `registerContentTypes` replaces the builder behind it.
|
|
120
|
+
*/
|
|
121
|
+
export interface ContentTypeMap {
|
|
122
|
+
}
|
|
123
|
+
export type ContentTypeKey = keyof ContentTypeMap | keyof CoreContentTypeMap;
|
|
124
|
+
export type ContentTypeFor<K extends ContentTypeKey> = K extends keyof ContentTypeMap ? ContentTypeMap[K] : K extends keyof CoreContentTypeMap ? CoreContentTypeMap[K] : never;
|
|
125
|
+
export declare function coreContentTypes(): Record<string, new () => ContentBuilderInterface>;
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=core-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-content.d.ts","sourceRoot":"","sources":["../../src/builders/core-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAu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jB,GAAG,EAAE,cAAc,CAAA;IACnB,QAAQ,EAAE,eAAe,CAAA;CAC5B;AAED;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC,MAAM,MAAM,cAAc,GAAG,MAAM,cAAc,GAAG,MAAM,kBAAkB,CAAA;AAE5E,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,SAAS,MAAM,cAAc,GAC/E,cAAc,CAAC,CAAC,CAAC,GACjB,CAAC,SAAS,MAAM,kBAAkB,GAChC,kBAAkB,CAAC,CAAC,CAAC,GACrB,KAAK,CAAA;AAEb,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,uBAAuB,CAAC,CAwBpF"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { newRecordIdentifier } from './identifier.js';
|
|
2
|
+
export class CoreContent {
|
|
3
|
+
fields = {};
|
|
4
|
+
withHeader(header) {
|
|
5
|
+
return this.set('header', header);
|
|
6
|
+
}
|
|
7
|
+
withSubheader(subheader) {
|
|
8
|
+
return this.set('subheader', subheader);
|
|
9
|
+
}
|
|
10
|
+
/** 0 is "hidden", 1–5 are h1–h5 in a stock fluid_styled_content install. */
|
|
11
|
+
withHeaderLayout(layout) {
|
|
12
|
+
return this.set('header_layout', layout);
|
|
13
|
+
}
|
|
14
|
+
withHeaderLink(link) {
|
|
15
|
+
return this.set('header_link', link);
|
|
16
|
+
}
|
|
17
|
+
withColPos(colPos) {
|
|
18
|
+
return this.set('colPos', colPos);
|
|
19
|
+
}
|
|
20
|
+
setHidden(hidden = true) {
|
|
21
|
+
return this.set('hidden', hidden);
|
|
22
|
+
}
|
|
23
|
+
/** Any column the typed setters do not cover, including your own. */
|
|
24
|
+
withField(column, value) {
|
|
25
|
+
return this.set(column, value);
|
|
26
|
+
}
|
|
27
|
+
getFields() {
|
|
28
|
+
return { CType: this.type, ...this.fields };
|
|
29
|
+
}
|
|
30
|
+
set(column, value) {
|
|
31
|
+
this.fields[column] = value;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class MediaCoreContent extends CoreContent {
|
|
36
|
+
fileUids = [];
|
|
37
|
+
identifiers = [];
|
|
38
|
+
withFile(fileUid) {
|
|
39
|
+
this.fileUids.push(fileUid);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
withFiles(fileUids) {
|
|
43
|
+
this.fileUids.push(...fileUids);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
getFields() {
|
|
47
|
+
const fields = super.getFields();
|
|
48
|
+
if (this.fileUids.length > 0) {
|
|
49
|
+
fields[this.mediaColumn] = this.referenceIdentifiers().join(',');
|
|
50
|
+
}
|
|
51
|
+
return fields;
|
|
52
|
+
}
|
|
53
|
+
getAdditionalRecords(contentIdentifier, pageId) {
|
|
54
|
+
if (this.fileUids.length === 0) {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
const identifiers = this.referenceIdentifiers();
|
|
58
|
+
const references = {};
|
|
59
|
+
this.fileUids.forEach((fileUid, index) => {
|
|
60
|
+
references[identifiers[index]] = {
|
|
61
|
+
uid_local: fileUid,
|
|
62
|
+
pid: pageId,
|
|
63
|
+
tablenames: 'tt_content',
|
|
64
|
+
fieldname: this.mediaColumn,
|
|
65
|
+
sys_language_uid: 0,
|
|
66
|
+
sorting_foreign: index + 1,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
return { sys_file_reference: references };
|
|
70
|
+
}
|
|
71
|
+
// Minted once: getFields() lists them in the parent column and
|
|
72
|
+
// getAdditionalRecords() keys the children by them, and the two must agree.
|
|
73
|
+
referenceIdentifiers() {
|
|
74
|
+
while (this.identifiers.length < this.fileUids.length) {
|
|
75
|
+
this.identifiers.push(newRecordIdentifier());
|
|
76
|
+
}
|
|
77
|
+
return this.identifiers;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
class GalleryCoreContent extends MediaCoreContent {
|
|
81
|
+
withColumns(imagecols) {
|
|
82
|
+
return this.set('imagecols', imagecols);
|
|
83
|
+
}
|
|
84
|
+
/** TCA `imageorient`: 0 above-center, 8 below-center, 17 in-text-right, … */
|
|
85
|
+
withOrientation(imageorient) {
|
|
86
|
+
return this.set('imageorient', imageorient);
|
|
87
|
+
}
|
|
88
|
+
withImageSize(width, height) {
|
|
89
|
+
if (undefined !== width) {
|
|
90
|
+
this.set('imagewidth', width);
|
|
91
|
+
}
|
|
92
|
+
if (undefined !== height) {
|
|
93
|
+
this.set('imageheight', height);
|
|
94
|
+
}
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export class HeaderContent extends CoreContent {
|
|
99
|
+
type = 'header';
|
|
100
|
+
}
|
|
101
|
+
export class TextContent extends CoreContent {
|
|
102
|
+
type = 'text';
|
|
103
|
+
withBodyText(html) {
|
|
104
|
+
return this.set('bodytext', html);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export class TextmediaContent extends GalleryCoreContent {
|
|
108
|
+
type = 'textmedia';
|
|
109
|
+
mediaColumn = 'assets';
|
|
110
|
+
withBodyText(html) {
|
|
111
|
+
return this.set('bodytext', html);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export class TextpicContent extends GalleryCoreContent {
|
|
115
|
+
type = 'textpic';
|
|
116
|
+
mediaColumn = 'image';
|
|
117
|
+
withBodyText(html) {
|
|
118
|
+
return this.set('bodytext', html);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export class ImageContent extends GalleryCoreContent {
|
|
122
|
+
type = 'image';
|
|
123
|
+
mediaColumn = 'image';
|
|
124
|
+
}
|
|
125
|
+
export class BulletsContent extends CoreContent {
|
|
126
|
+
type = 'bullets';
|
|
127
|
+
/** One bullet per line — the column is a plain newline-separated text field. */
|
|
128
|
+
withItems(items) {
|
|
129
|
+
return this.set('bodytext', items.join('\n'));
|
|
130
|
+
}
|
|
131
|
+
/** TCA `bullets_type`: 0 disc, 1 numbered, 2 none. */
|
|
132
|
+
withBulletsType(bulletsType) {
|
|
133
|
+
return this.set('bullets_type', bulletsType);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export class TableContent extends CoreContent {
|
|
137
|
+
type = 'table';
|
|
138
|
+
withRows(rows) {
|
|
139
|
+
const delimiter = String.fromCharCode(this.delimiter());
|
|
140
|
+
return this.set('bodytext', rows.map((row) => row.join(delimiter)).join('\n')).set('cols', rows[0]?.length ?? 0);
|
|
141
|
+
}
|
|
142
|
+
withCaption(caption) {
|
|
143
|
+
return this.set('table_caption', caption);
|
|
144
|
+
}
|
|
145
|
+
/** 1 puts the first row in a thead; 0 none, 2 first column, 3 both. */
|
|
146
|
+
withHeaderPosition(position) {
|
|
147
|
+
return this.set('table_header_position', position);
|
|
148
|
+
}
|
|
149
|
+
delimiter() {
|
|
150
|
+
const configured = this.fields.table_delimiter;
|
|
151
|
+
return 'number' === typeof configured ? configured : 124;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
export class UploadsContent extends MediaCoreContent {
|
|
155
|
+
type = 'uploads';
|
|
156
|
+
mediaColumn = 'media';
|
|
157
|
+
}
|
|
158
|
+
export class HtmlContent extends CoreContent {
|
|
159
|
+
type = 'html';
|
|
160
|
+
withHtml(html) {
|
|
161
|
+
return this.set('bodytext', html);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export class DividerContent extends CoreContent {
|
|
165
|
+
type = 'div';
|
|
166
|
+
}
|
|
167
|
+
export class ShortcutContent extends CoreContent {
|
|
168
|
+
type = 'shortcut';
|
|
169
|
+
/** Each entry is `tt_content_<uid>`, or a bare uid for tt_content. */
|
|
170
|
+
withRecords(records) {
|
|
171
|
+
return this.set('records', records.join(','));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export class MenuContent extends CoreContent {
|
|
175
|
+
type;
|
|
176
|
+
constructor(type) {
|
|
177
|
+
super();
|
|
178
|
+
this.type = type;
|
|
179
|
+
}
|
|
180
|
+
withPages(pageUids) {
|
|
181
|
+
return this.set('pages', pageUids.join(','));
|
|
182
|
+
}
|
|
183
|
+
withSelectedCategories(categoryUids) {
|
|
184
|
+
return this.set('selected_categories', categoryUids.join(','));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
export const MENU_TYPES = [
|
|
188
|
+
'menu_pages',
|
|
189
|
+
'menu_subpages',
|
|
190
|
+
'menu_sitemap',
|
|
191
|
+
'menu_sitemap_pages',
|
|
192
|
+
'menu_section',
|
|
193
|
+
'menu_section_pages',
|
|
194
|
+
'menu_abstract',
|
|
195
|
+
'menu_recently_updated',
|
|
196
|
+
'menu_related_pages',
|
|
197
|
+
'menu_categorized_pages',
|
|
198
|
+
'menu_categorized_content',
|
|
199
|
+
];
|
|
200
|
+
export function coreContentTypes() {
|
|
201
|
+
const types = {
|
|
202
|
+
header: HeaderContent,
|
|
203
|
+
text: TextContent,
|
|
204
|
+
textmedia: TextmediaContent,
|
|
205
|
+
textpic: TextpicContent,
|
|
206
|
+
image: ImageContent,
|
|
207
|
+
bullets: BulletsContent,
|
|
208
|
+
table: TableContent,
|
|
209
|
+
uploads: UploadsContent,
|
|
210
|
+
html: HtmlContent,
|
|
211
|
+
div: DividerContent,
|
|
212
|
+
shortcut: ShortcutContent,
|
|
213
|
+
};
|
|
214
|
+
for (const menuType of MENU_TYPES) {
|
|
215
|
+
types[menuType] = class extends MenuContent {
|
|
216
|
+
constructor() {
|
|
217
|
+
super(menuType);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return types;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=core-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-content.js","sourceRoot":"","sources":["../../src/builders/core-content.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,OAAgB,WAAW;IAGnB,MAAM,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AAM,UAAU,GAAG;IACtB,YAAY;IACZ,eAAe;IACf,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,oBAAoB;IACpB,eAAe;IACf,uBAAuB;IACvB,oBAAoB;IACpB,wBAAwB;IACxB,0BAA0B;CACpB,CAAA;AA0CV,MAAM,UAAU,gBAAgB;IAC5B,MAAM,KAAK,GAAsD;QAC7D,MAAM,EAAE,aAAa;QACrB,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,gBAAgB;QAC3B,OAAO,EAAE,cAAc;QACvB,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,cAAc;QACvB,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,eAAe;KAC5B,CAAA;IAED,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAChC,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAM,SAAQ,WAAW;YACvC;gBACI,KAAK,CAAC,QAAQ,CAAC,CAAA;YACnB,CAAC;SACJ,CAAA;IACL,CAAC;IAED,OAAO,KAAK,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TYPO3 columns take scalars: a boolean is a 0/1 int column and a crop config is
|
|
3
|
+
* a JSON *string* column, not a nested object. An undefined field is left out
|
|
4
|
+
* rather than sent as null, which DataHandler would write.
|
|
5
|
+
*/
|
|
6
|
+
export declare function coerceFields(fields: Record<string, unknown>): Record<string, unknown>;
|
|
7
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/builders/fields.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAerF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TYPO3 columns take scalars: a boolean is a 0/1 int column and a crop config is
|
|
3
|
+
* a JSON *string* column, not a nested object. An undefined field is left out
|
|
4
|
+
* rather than sent as null, which DataHandler would write.
|
|
5
|
+
*/
|
|
6
|
+
export function coerceFields(fields) {
|
|
7
|
+
const coerced = {};
|
|
8
|
+
for (const [column, value] of Object.entries(fields)) {
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if ('boolean' === typeof value) {
|
|
13
|
+
coerced[column] = value ? 1 : 0;
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
coerced[column] = 'object' === typeof value ? JSON.stringify(value) : value;
|
|
17
|
+
}
|
|
18
|
+
return coerced;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/builders/fields.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAA+B;IACxD,MAAM,OAAO,GAA4B,EAAE,CAAA;IAE3C,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,SAAQ;QACZ,CAAC;QACD,IAAI,SAAS,KAAK,OAAO,KAAK,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/B,SAAQ;QACZ,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,GAAG,QAAQ,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC/E,CAAC;IAED,OAAO,OAAO,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../src/builders/identifier.ts"],"names":[],"mappings":"AASA,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Hex only, like StringUtility::getUniqueId(): RelationHandler reads a list
|
|
2
|
+
// entry containing `_` as table_uid and never resolves it back to the record.
|
|
3
|
+
function typo3StyleIdentifier() {
|
|
4
|
+
const time = Date.now().toString(16);
|
|
5
|
+
const entropy = Math.floor(Math.random() * 0xffffffff).toString(16);
|
|
6
|
+
return `NEW${time}${entropy.padStart(8, '0')}`;
|
|
7
|
+
}
|
|
8
|
+
export function newRecordIdentifier() {
|
|
9
|
+
return typo3StyleIdentifier();
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=identifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../src/builders/identifier.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,SAAS,oBAAoB;IACzB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACpC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEnE,OAAO,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,mBAAmB;IAC/B,OAAO,oBAAoB,EAAE,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Page } from '@playwright/test';
|
|
2
|
+
import { CropConfig } from '../types/common.js';
|
|
3
|
+
import { type RequestContext } from './request-context.js';
|
|
4
|
+
interface Fields {
|
|
5
|
+
[key: string]: string | number | boolean | undefined | CropConfig;
|
|
6
|
+
}
|
|
7
|
+
export declare class PageBuilder {
|
|
8
|
+
protected fields: Fields;
|
|
9
|
+
private page;
|
|
10
|
+
private imageFileId?;
|
|
11
|
+
private imageCropConfig?;
|
|
12
|
+
private mediaIdentifierValue?;
|
|
13
|
+
private readonly requestContext?;
|
|
14
|
+
constructor(page: Page, requestContext?: Partial<RequestContext>);
|
|
15
|
+
withTitle(title: string): this;
|
|
16
|
+
/** Any other TCA column — doktype, layout, backend_layout, shortcut_mode, … */
|
|
17
|
+
withField(column: string, value: string | number | boolean): this;
|
|
18
|
+
/** The test ID is appended so two runs never claim the same URL. */
|
|
19
|
+
withSlug(slug: string): this;
|
|
20
|
+
withExistingImage(fileId: number): this;
|
|
21
|
+
withImageCropFocus(cropConfig: CropConfig): this;
|
|
22
|
+
atParentId(id: number): this;
|
|
23
|
+
create(): Promise<{
|
|
24
|
+
id: string;
|
|
25
|
+
slug: string;
|
|
26
|
+
}>;
|
|
27
|
+
update(pageId: string): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
slug: string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* A second record the page's own `media` field lists, which is what makes
|
|
33
|
+
* DataHandler link it once the page has a uid.
|
|
34
|
+
*/
|
|
35
|
+
private mediaRecords;
|
|
36
|
+
private pageFields;
|
|
37
|
+
private mediaIdentifier;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=page-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-builder.d.ts","sourceRoot":"","sources":["../../src/builders/page-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AA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0,0 +1,119 @@
|
|
|
1
|
+
import { saveRecord } from '../http/record-edit.js';
|
|
2
|
+
import { requireTestId, resolveRequestContext } from './request-context.js';
|
|
3
|
+
import { coerceFields } from './fields.js';
|
|
4
|
+
import { newRecordIdentifier } from './identifier.js';
|
|
5
|
+
const DEFAULT_CROP = '{"default":{"cropArea":{"x":0,"y":0,"width":1,"height":1},"selectedRatio":"NaN","focusArea":null}}';
|
|
6
|
+
export class PageBuilder {
|
|
7
|
+
fields = {
|
|
8
|
+
doktype: 1,
|
|
9
|
+
shortcut_mode: 0,
|
|
10
|
+
pid: 1,
|
|
11
|
+
hidden: false,
|
|
12
|
+
layout: 0,
|
|
13
|
+
subtitle: '',
|
|
14
|
+
};
|
|
15
|
+
page;
|
|
16
|
+
imageFileId;
|
|
17
|
+
imageCropConfig;
|
|
18
|
+
mediaIdentifierValue;
|
|
19
|
+
requestContext;
|
|
20
|
+
constructor(page, requestContext) {
|
|
21
|
+
this.page = page;
|
|
22
|
+
this.requestContext = requestContext;
|
|
23
|
+
}
|
|
24
|
+
withTitle(title) {
|
|
25
|
+
this.fields.title = title;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
/** Any other TCA column — doktype, layout, backend_layout, shortcut_mode, … */
|
|
29
|
+
withField(column, value) {
|
|
30
|
+
this.fields[column] = value;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/** The test ID is appended so two runs never claim the same URL. */
|
|
34
|
+
withSlug(slug) {
|
|
35
|
+
const testId = requireTestId(this.page, this.requestContext?.testId);
|
|
36
|
+
let normalizedSlug = slug.startsWith('/') ? slug : `/${slug}`;
|
|
37
|
+
normalizedSlug = normalizedSlug.endsWith('/') ? normalizedSlug.slice(0, -1) : normalizedSlug;
|
|
38
|
+
this.fields.slug = `${normalizedSlug}-${testId.toLowerCase()}`;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
withExistingImage(fileId) {
|
|
42
|
+
this.imageFileId = fileId;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
withImageCropFocus(cropConfig) {
|
|
46
|
+
this.imageCropConfig = cropConfig;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
atParentId(id) {
|
|
50
|
+
this.fields.pid = id;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
async create() {
|
|
54
|
+
const context = resolveRequestContext(this.page, this.requestContext);
|
|
55
|
+
const identifier = newRecordIdentifier();
|
|
56
|
+
const uid = await saveRecord(this.page.request, context, {
|
|
57
|
+
table: 'pages',
|
|
58
|
+
identifier,
|
|
59
|
+
target: Number(this.fields.pid),
|
|
60
|
+
data: {
|
|
61
|
+
pages: { [identifier]: this.pageFields() },
|
|
62
|
+
...this.mediaRecords(identifier),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
return { id: String(uid), slug: this.fields.slug || '' };
|
|
66
|
+
}
|
|
67
|
+
async update(pageId) {
|
|
68
|
+
const context = resolveRequestContext(this.page, this.requestContext);
|
|
69
|
+
await saveRecord(this.page.request, context, {
|
|
70
|
+
table: 'pages',
|
|
71
|
+
identifier: pageId,
|
|
72
|
+
target: Number(pageId),
|
|
73
|
+
data: {
|
|
74
|
+
pages: { [pageId]: this.pageFields() },
|
|
75
|
+
...this.mediaRecords(pageId),
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
return { id: pageId, slug: this.fields.slug || '' };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A second record the page's own `media` field lists, which is what makes
|
|
82
|
+
* DataHandler link it once the page has a uid.
|
|
83
|
+
*/
|
|
84
|
+
mediaRecords(pageIdentifier) {
|
|
85
|
+
if (!this.imageFileId) {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
sys_file_reference: {
|
|
90
|
+
[this.mediaIdentifier()]: {
|
|
91
|
+
uid_local: this.imageFileId,
|
|
92
|
+
pid: pageIdentifier,
|
|
93
|
+
tablenames: 'pages',
|
|
94
|
+
fieldname: 'media',
|
|
95
|
+
hidden: 0,
|
|
96
|
+
sys_language_uid: 0,
|
|
97
|
+
alternative: '',
|
|
98
|
+
description: '',
|
|
99
|
+
title: '',
|
|
100
|
+
crop: this.imageCropConfig ? JSON.stringify(this.imageCropConfig) : DEFAULT_CROP,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
pageFields() {
|
|
106
|
+
const fields = coerceFields(this.fields);
|
|
107
|
+
if (this.imageFileId) {
|
|
108
|
+
fields.media = this.mediaIdentifier();
|
|
109
|
+
}
|
|
110
|
+
return fields;
|
|
111
|
+
}
|
|
112
|
+
// Minted once: pageFields() lists it in `media` and mediaRecords() keys the
|
|
113
|
+
// reference by it, and the two must agree.
|
|
114
|
+
mediaIdentifier() {
|
|
115
|
+
this.mediaIdentifierValue ??= newRecordIdentifier();
|
|
116
|
+
return this.mediaIdentifierValue;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=page-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-builder.js","sourceRoot":"","sources":["../../src/builders/page-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAsB,MAAM,wBAAwB,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAuB,MAAM,sBAAsB,CAAA;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAMrD,MAAM,YAAY,GACd,oGAAoG,CAAA;AAExG,MAAM,OAAO,WAAW;IACV,MAAM,GAAW;QACvB,OAAO,EAAE,CAAC;QACV,aAAa,EAAE,CAAC;QAChB,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,EAAE;KACf,CAAA;IAEO,IAAI,CAAM;IACV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F,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAG,IAAI,CAAC,MAAM,CAAC,IAAe,IAAI,EAAE,EAAE,CAAA;IACnE,CAAC;IAED;;;OAGG;IACK,YAAY,CAAC,cAAsB;QACvC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,OAAO,EAAE,CAAA;QACb,CAAC;QAED,OAAO;YACH,kBAAkB,EAAE;gBAChB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE;oBACtB,SAAS,EAAE,IAAI,CAAC,WAAW;oBAC3B,GAAG,EAAE,cAAc;oBACnB,UAAU,EAAE,OAAO;oBACnB,SAAS,EAAE,OAAO;oBAClB,MAAM,EAAE,CAAC;oBACT,gBAAgB,EAAE,CAAC;oBACnB,WAAW,EAAE,EAAE;oBACf,WAAW,EAAE,EAAE;oBACf,KAAK,EAAE,EAAE;oBACT,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY;iBACnF;aACJ;SACJ,CAAA;IACL,CAAC;IAEO,UAAU;QACd,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAExC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;QACzC,CAAC;QAED,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,4EAA4E;IAC5E,2CAA2C;IACnC,eAAe;QACnB,IAAI,CAAC,oBAAoB,KAAK,mBAAmB,EAAE,CAAA;QAEnD,OAAO,IAAI,CAAC,oBAAoB,CAAA;IACpC,CAAC;CACJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** TYPO3's own default for `BE/entryPoint`, which 11.5 and 12.4 have no setting for. */
|
|
2
|
+
export declare const DEFAULT_BACKEND_PATH = "/typo3";
|
|
3
|
+
export interface RequestContext {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** Where the backend routes answer, from `BE/entryPoint`; the session endpoint reports it. */
|
|
6
|
+
backendPath: string;
|
|
7
|
+
testId: string;
|
|
8
|
+
/** For `record_edit`; the session endpoint hands it out. */
|
|
9
|
+
routeToken: string;
|
|
10
|
+
}
|
|
11
|
+
export interface RequestContextSource {
|
|
12
|
+
url(): string;
|
|
13
|
+
context(): unknown;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The fixtures put the test ID on the page and context; an explicit one overrides
|
|
17
|
+
* it. An empty ID is refused rather than sent, because the extension reads an
|
|
18
|
+
* empty header as "use the base database".
|
|
19
|
+
*/
|
|
20
|
+
export declare function ambientTestId(page: RequestContextSource): string | undefined;
|
|
21
|
+
export declare function requireTestId(page: RequestContextSource, explicit?: string): string;
|
|
22
|
+
export declare function resolveRequestContext(page: RequestContextSource, explicit?: Partial<RequestContext>): RequestContext;
|
|
23
|
+
//# sourceMappingURL=request-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../src/builders/request-context.ts"],"names":[],"mappings":"AAGA,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,8FAA8F;IAC9F,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,oBAAoB;IACjC,GAAG,IAAI,MAAM,CAAA;IACb,OAAO,IAAI,OAAO,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAM5E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAWnF;AAED,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,GAAE,OAAO,CAAC,cAAc,CAAM,GACvC,cAAc,CAShB"}
|