@wordpress/e2e-test-utils-playwright 1.46.0 → 1.48.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/build-types/admin/index.d.ts +3 -0
- package/build-types/admin/index.d.ts.map +1 -1
- package/build-types/admin/visit-site-editor.d.ts.map +1 -1
- package/build-types/admin/wait-for-site-editor.d.ts +12 -0
- package/build-types/admin/wait-for-site-editor.d.ts.map +1 -0
- package/build-types/metrics/index.d.ts +22 -5
- package/build-types/metrics/index.d.ts.map +1 -1
- package/build-types/request-utils/index.d.ts +3 -1
- package/build-types/request-utils/index.d.ts.map +1 -1
- package/build-types/request-utils/preferences.d.ts +11 -0
- package/build-types/request-utils/preferences.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/admin/create-new-post.ts +47 -0
- package/src/admin/edit-post.ts +24 -0
- package/{build/admin/get-page-error.js → src/admin/get-page-error.ts} +12 -9
- package/src/admin/index.ts +52 -0
- package/src/admin/visit-admin-page.ts +43 -0
- package/src/admin/visit-site-editor.ts +62 -0
- package/src/admin/wait-for-site-editor.ts +52 -0
- package/src/config.ts +12 -0
- package/src/editor/click-block-options-menu-item.ts +18 -0
- package/src/editor/click-block-toolbar-button.ts +21 -0
- package/src/editor/get-blocks.ts +75 -0
- package/src/editor/get-edited-post-content.ts +19 -0
- package/src/editor/index.ts +95 -0
- package/src/editor/insert-block.ts +54 -0
- package/src/editor/open-document-settings-sidebar.ts +31 -0
- package/src/editor/preview.ts +32 -0
- package/src/editor/publish-post.ts +51 -0
- package/src/editor/save-draft.ts +20 -0
- package/src/editor/select-blocks.ts +48 -0
- package/src/editor/set-content.ts +24 -0
- package/src/editor/set-is-fixed-toolbar.ts +20 -0
- package/src/editor/set-preferences.ts +37 -0
- package/src/editor/show-block-toolbar.ts +20 -0
- package/src/editor/site-editor.ts +55 -0
- package/src/editor/switch-editor-tool.ts +34 -0
- package/src/editor/switch-to-legacy-canvas.ts +20 -0
- package/src/editor/transform-block-to.ts +34 -0
- package/src/index.ts +8 -0
- package/src/lighthouse/index.ts +75 -0
- package/src/metrics/index.ts +441 -0
- package/src/page-utils/drag-files.ts +173 -0
- package/src/page-utils/emulate-network-conditions.ts +101 -0
- package/src/page-utils/index.ts +54 -0
- package/src/page-utils/is-current-url.ts +20 -0
- package/src/page-utils/keycodes.ts +48 -0
- package/src/page-utils/press-keys.ts +195 -0
- package/{build → src}/page-utils/set-browser-viewport.js +14 -12
- package/src/request-utils/blocks.ts +58 -0
- package/src/request-utils/comments.ts +80 -0
- package/src/request-utils/gutenberg-experiments.ts +62 -0
- package/src/request-utils/index.ts +222 -0
- package/src/request-utils/login.ts +34 -0
- package/src/request-utils/media.ts +102 -0
- package/src/request-utils/menus.ts +145 -0
- package/src/request-utils/pages.ts +75 -0
- package/src/request-utils/patterns.ts +31 -0
- package/src/request-utils/plugins.ts +103 -0
- package/src/request-utils/posts.ts +69 -0
- package/src/request-utils/preferences.ts +63 -0
- package/{build/request-utils/records.js → src/request-utils/records.ts} +15 -10
- package/src/request-utils/rest.ts +222 -0
- package/src/request-utils/site-settings.ts +58 -0
- package/src/request-utils/templates.ts +83 -0
- package/src/request-utils/themes.ts +110 -0
- package/src/request-utils/users.ts +125 -0
- package/src/request-utils/widgets.js +68 -0
- package/src/test.ts +204 -0
- package/src/types.ts +13 -0
- package/build/admin/create-new-post.cjs +0 -51
- package/build/admin/create-new-post.cjs.map +0 -7
- package/build/admin/create-new-post.js +0 -31
- package/build/admin/create-new-post.js.map +0 -1
- package/build/admin/edit-post.cjs +0 -40
- package/build/admin/edit-post.cjs.map +0 -7
- package/build/admin/edit-post.js +0 -20
- package/build/admin/edit-post.js.map +0 -1
- package/build/admin/get-page-error.cjs +0 -36
- package/build/admin/get-page-error.cjs.map +0 -7
- package/build/admin/get-page-error.js.map +0 -1
- package/build/admin/index.cjs +0 -59
- package/build/admin/index.cjs.map +0 -7
- package/build/admin/index.js +0 -37
- package/build/admin/index.js.map +0 -1
- package/build/admin/visit-admin-page.cjs +0 -47
- package/build/admin/visit-admin-page.cjs.map +0 -7
- package/build/admin/visit-admin-page.js +0 -32
- package/build/admin/visit-admin-page.js.map +0 -1
- package/build/admin/visit-site-editor.cjs +0 -90
- package/build/admin/visit-site-editor.cjs.map +0 -7
- package/build/admin/visit-site-editor.js +0 -73
- package/build/admin/visit-site-editor.js.map +0 -1
- package/build/config.cjs +0 -45
- package/build/config.cjs.map +0 -7
- package/build/config.js +0 -13
- package/build/config.js.map +0 -1
- package/build/editor/click-block-options-menu-item.cjs +0 -34
- package/build/editor/click-block-options-menu-item.cjs.map +0 -7
- package/build/editor/click-block-options-menu-item.js +0 -17
- package/build/editor/click-block-options-menu-item.js.map +0 -1
- package/build/editor/click-block-toolbar-button.cjs +0 -38
- package/build/editor/click-block-toolbar-button.cjs.map +0 -7
- package/build/editor/click-block-toolbar-button.js +0 -16
- package/build/editor/click-block-toolbar-button.js.map +0 -1
- package/build/editor/get-blocks.cjs +0 -64
- package/build/editor/get-blocks.cjs.map +0 -7
- package/build/editor/get-blocks.js +0 -45
- package/build/editor/get-blocks.js.map +0 -1
- package/build/editor/get-edited-post-content.cjs +0 -36
- package/build/editor/get-edited-post-content.cjs.map +0 -7
- package/build/editor/get-edited-post-content.js +0 -15
- package/build/editor/get-edited-post-content.js.map +0 -1
- package/build/editor/index.cjs +0 -97
- package/build/editor/index.cjs.map +0 -7
- package/build/editor/index.js +0 -75
- package/build/editor/index.js.map +0 -1
- package/build/editor/insert-block.cjs +0 -55
- package/build/editor/insert-block.cjs.map +0 -7
- package/build/editor/insert-block.js +0 -23
- package/build/editor/insert-block.js.map +0 -1
- package/build/editor/open-document-settings-sidebar.cjs +0 -42
- package/build/editor/open-document-settings-sidebar.cjs.map +0 -7
- package/build/editor/open-document-settings-sidebar.js +0 -27
- package/build/editor/open-document-settings-sidebar.js.map +0 -1
- package/build/editor/preview.cjs +0 -42
- package/build/editor/preview.cjs.map +0 -7
- package/build/editor/preview.js +0 -21
- package/build/editor/preview.js.map +0 -1
- package/build/editor/publish-post.cjs +0 -47
- package/build/editor/publish-post.cjs.map +0 -7
- package/build/editor/publish-post.js +0 -45
- package/build/editor/publish-post.js.map +0 -1
- package/build/editor/save-draft.cjs +0 -34
- package/build/editor/save-draft.cjs.map +0 -7
- package/build/editor/save-draft.js +0 -18
- package/build/editor/save-draft.js.map +0 -1
- package/build/editor/select-blocks.cjs +0 -51
- package/build/editor/select-blocks.cjs.map +0 -7
- package/build/editor/select-blocks.js +0 -28
- package/build/editor/select-blocks.js.map +0 -1
- package/build/editor/set-content.cjs +0 -39
- package/build/editor/set-content.cjs.map +0 -7
- package/build/editor/set-content.js +0 -17
- package/build/editor/set-content.js.map +0 -1
- package/build/editor/set-is-fixed-toolbar.cjs +0 -36
- package/build/editor/set-is-fixed-toolbar.cjs.map +0 -7
- package/build/editor/set-is-fixed-toolbar.js +0 -18
- package/build/editor/set-is-fixed-toolbar.js.map +0 -1
- package/build/editor/set-preferences.cjs +0 -43
- package/build/editor/set-preferences.cjs.map +0 -7
- package/build/editor/set-preferences.js +0 -21
- package/build/editor/set-preferences.js.map +0 -1
- package/build/editor/show-block-toolbar.cjs +0 -35
- package/build/editor/show-block-toolbar.cjs.map +0 -7
- package/build/editor/show-block-toolbar.js +0 -19
- package/build/editor/show-block-toolbar.js.map +0 -1
- package/build/editor/site-editor.cjs +0 -51
- package/build/editor/site-editor.cjs.map +0 -7
- package/build/editor/site-editor.js +0 -44
- package/build/editor/site-editor.js.map +0 -1
- package/build/editor/switch-editor-tool.cjs +0 -47
- package/build/editor/switch-editor-tool.cjs.map +0 -7
- package/build/editor/switch-editor-tool.js +0 -33
- package/build/editor/switch-editor-tool.js.map +0 -1
- package/build/editor/switch-to-legacy-canvas.cjs +0 -39
- package/build/editor/switch-to-legacy-canvas.cjs.map +0 -7
- package/build/editor/switch-to-legacy-canvas.js +0 -18
- package/build/editor/switch-to-legacy-canvas.js.map +0 -1
- package/build/editor/transform-block-to.cjs +0 -46
- package/build/editor/transform-block-to.cjs.map +0 -7
- package/build/editor/transform-block-to.js +0 -24
- package/build/editor/transform-block-to.js.map +0 -1
- package/build/index.cjs +0 -51
- package/build/index.cjs.map +0 -7
- package/build/index.js +0 -19
- package/build/index.js.map +0 -1
- package/build/lighthouse/index.cjs +0 -96
- package/build/lighthouse/index.cjs.map +0 -7
- package/build/lighthouse/index.js +0 -61
- package/build/lighthouse/index.js.map +0 -1
- package/build/metrics/index.cjs +0 -309
- package/build/metrics/index.cjs.map +0 -7
- package/build/metrics/index.js +0 -258
- package/build/metrics/index.js.map +0 -1
- package/build/page-utils/drag-files.cjs +0 -143
- package/build/page-utils/drag-files.cjs.map +0 -7
- package/build/page-utils/drag-files.js +0 -119
- package/build/page-utils/drag-files.js.map +0 -1
- package/build/page-utils/emulate-network-conditions.cjs +0 -99
- package/build/page-utils/emulate-network-conditions.cjs.map +0 -7
- package/build/page-utils/emulate-network-conditions.js +0 -71
- package/build/page-utils/emulate-network-conditions.js.map +0 -1
- package/build/page-utils/index.cjs +0 -59
- package/build/page-utils/index.cjs.map +0 -7
- package/build/page-utils/index.js +0 -37
- package/build/page-utils/index.js.map +0 -1
- package/build/page-utils/is-current-url.cjs +0 -36
- package/build/page-utils/is-current-url.cjs.map +0 -7
- package/build/page-utils/is-current-url.js +0 -21
- package/build/page-utils/is-current-url.js.map +0 -1
- package/build/page-utils/keycodes.cjs +0 -55
- package/build/page-utils/keycodes.cjs.map +0 -7
- package/build/page-utils/keycodes.js +0 -41
- package/build/page-utils/keycodes.js.map +0 -1
- package/build/page-utils/press-keys.cjs +0 -165
- package/build/page-utils/press-keys.cjs.map +0 -7
- package/build/page-utils/press-keys.js +0 -141
- package/build/page-utils/press-keys.js.map +0 -1
- package/build/page-utils/set-browser-viewport.cjs +0 -39
- package/build/page-utils/set-browser-viewport.cjs.map +0 -7
- package/build/page-utils/set-browser-viewport.js.map +0 -1
- package/build/request-utils/blocks.cjs +0 -51
- package/build/request-utils/blocks.cjs.map +0 -7
- package/build/request-utils/blocks.js +0 -40
- package/build/request-utils/blocks.js.map +0 -1
- package/build/request-utils/comments.cjs +0 -66
- package/build/request-utils/comments.cjs.map +0 -7
- package/build/request-utils/comments.js +0 -52
- package/build/request-utils/comments.js.map +0 -1
- package/build/request-utils/gutenberg-experiments.cjs +0 -56
- package/build/request-utils/gutenberg-experiments.cjs.map +0 -7
- package/build/request-utils/gutenberg-experiments.js +0 -47
- package/build/request-utils/gutenberg-experiments.js.map +0 -1
- package/build/request-utils/index.cjs +0 -199
- package/build/request-utils/index.cjs.map +0 -7
- package/build/request-utils/index.js +0 -194
- package/build/request-utils/index.js.map +0 -1
- package/build/request-utils/login.cjs +0 -48
- package/build/request-utils/login.cjs.map +0 -7
- package/build/request-utils/login.js +0 -21
- package/build/request-utils/login.js.map +0 -1
- package/build/request-utils/media.cjs +0 -83
- package/build/request-utils/media.cjs.map +0 -7
- package/build/request-utils/media.js +0 -106
- package/build/request-utils/media.js.map +0 -1
- package/build/request-utils/menus.cjs +0 -128
- package/build/request-utils/menus.cjs.map +0 -7
- package/build/request-utils/menus.js +0 -116
- package/build/request-utils/menus.js.map +0 -1
- package/build/request-utils/pages.cjs +0 -66
- package/build/request-utils/pages.cjs.map +0 -7
- package/build/request-utils/pages.js +0 -53
- package/build/request-utils/pages.js.map +0 -1
- package/build/request-utils/patterns.cjs +0 -44
- package/build/request-utils/patterns.cjs.map +0 -7
- package/build/request-utils/patterns.js +0 -27
- package/build/request-utils/patterns.js.map +0 -1
- package/build/request-utils/plugins.cjs +0 -81
- package/build/request-utils/plugins.cjs.map +0 -7
- package/build/request-utils/plugins.js +0 -85
- package/build/request-utils/plugins.js.map +0 -1
- package/build/request-utils/posts.cjs +0 -56
- package/build/request-utils/posts.cjs.map +0 -7
- package/build/request-utils/posts.js +0 -42
- package/build/request-utils/posts.js.map +0 -1
- package/build/request-utils/preferences.cjs +0 -41
- package/build/request-utils/preferences.cjs.map +0 -7
- package/build/request-utils/preferences.js +0 -20
- package/build/request-utils/preferences.js.map +0 -1
- package/build/request-utils/records.cjs +0 -37
- package/build/request-utils/records.cjs.map +0 -7
- package/build/request-utils/records.js.map +0 -1
- package/build/request-utils/rest.cjs +0 -174
- package/build/request-utils/rest.cjs.map +0 -7
- package/build/request-utils/rest.js +0 -181
- package/build/request-utils/rest.js.map +0 -1
- package/build/request-utils/site-settings.cjs +0 -45
- package/build/request-utils/site-settings.cjs.map +0 -7
- package/build/request-utils/site-settings.js +0 -33
- package/build/request-utils/site-settings.js.map +0 -1
- package/build/request-utils/templates.cjs +0 -68
- package/build/request-utils/templates.cjs.map +0 -7
- package/build/request-utils/templates.js +0 -54
- package/build/request-utils/templates.js.map +0 -1
- package/build/request-utils/themes.cjs +0 -92
- package/build/request-utils/themes.cjs.map +0 -7
- package/build/request-utils/themes.js +0 -69
- package/build/request-utils/themes.js.map +0 -1
- package/build/request-utils/users.cjs +0 -83
- package/build/request-utils/users.cjs.map +0 -7
- package/build/request-utils/users.js +0 -81
- package/build/request-utils/users.js.map +0 -1
- package/build/request-utils/widgets.cjs +0 -79
- package/build/request-utils/widgets.cjs.map +0 -7
- package/build/request-utils/widgets.js +0 -61
- package/build/request-utils/widgets.js.map +0 -1
- package/build/test.cjs +0 -136
- package/build/test.cjs.map +0 -7
- package/build/test.js +0 -189
- package/build/test.js.map +0 -1
- package/build/types.cjs +0 -19
- package/build/types.cjs.map +0 -7
- package/build/types.js +0 -3
- package/build/types.js.map +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createClassicMenu = createClassicMenu;
|
|
4
|
-
exports.createNavigationMenu = createNavigationMenu;
|
|
5
|
-
exports.deleteAllMenus = deleteAllMenus;
|
|
6
|
-
exports.getNavigationMenus = getNavigationMenus;
|
|
7
|
-
/**
|
|
8
|
-
* Create a classic menu
|
|
9
|
-
*
|
|
10
|
-
* @param name Menu name.
|
|
11
|
-
* @return Menu content.
|
|
12
|
-
*/
|
|
13
|
-
async function createClassicMenu(name) {
|
|
14
|
-
const menuItems = [
|
|
15
|
-
{
|
|
16
|
-
title: 'Custom link',
|
|
17
|
-
url: 'http://localhost:8889/',
|
|
18
|
-
type: 'custom',
|
|
19
|
-
menu_order: 1,
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
const menu = await this.rest({
|
|
23
|
-
method: 'POST',
|
|
24
|
-
path: `/wp/v2/menus/`,
|
|
25
|
-
data: {
|
|
26
|
-
name,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
await this.batchRest(menuItems.map((menuItem) => ({
|
|
30
|
-
method: 'POST',
|
|
31
|
-
path: `/wp/v2/menu-items`,
|
|
32
|
-
body: {
|
|
33
|
-
menus: menu.id,
|
|
34
|
-
object_id: undefined,
|
|
35
|
-
...menuItem,
|
|
36
|
-
parent: undefined,
|
|
37
|
-
},
|
|
38
|
-
})));
|
|
39
|
-
return menu;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Create a navigation menu
|
|
43
|
-
*
|
|
44
|
-
* @param menuData navigation menu post data.
|
|
45
|
-
* @return Menu content.
|
|
46
|
-
*/
|
|
47
|
-
async function createNavigationMenu(menuData) {
|
|
48
|
-
return this.createRecord('navigation', {
|
|
49
|
-
status: 'publish',
|
|
50
|
-
...menuData,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Delete all navigation and classic menus
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
async function deleteAllMenus() {
|
|
58
|
-
const navMenus = await this.rest({
|
|
59
|
-
path: `/wp/v2/navigation/`,
|
|
60
|
-
data: {
|
|
61
|
-
status: [
|
|
62
|
-
'publish',
|
|
63
|
-
'pending',
|
|
64
|
-
'draft',
|
|
65
|
-
'auto-draft',
|
|
66
|
-
'future',
|
|
67
|
-
'private',
|
|
68
|
-
'inherit',
|
|
69
|
-
'trash',
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
if (navMenus.length) {
|
|
74
|
-
await this.batchRest(navMenus.map((menu) => ({
|
|
75
|
-
method: 'DELETE',
|
|
76
|
-
path: `/wp/v2/navigation/${menu.id}?force=true`,
|
|
77
|
-
})));
|
|
78
|
-
}
|
|
79
|
-
const classicMenus = await this.rest({
|
|
80
|
-
path: `/wp/v2/menus/`,
|
|
81
|
-
data: {
|
|
82
|
-
status: [
|
|
83
|
-
'publish',
|
|
84
|
-
'pending',
|
|
85
|
-
'draft',
|
|
86
|
-
'auto-draft',
|
|
87
|
-
'future',
|
|
88
|
-
'private',
|
|
89
|
-
'inherit',
|
|
90
|
-
'trash',
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
if (classicMenus.length) {
|
|
95
|
-
await this.batchRest(classicMenus.map((menu) => ({
|
|
96
|
-
method: 'DELETE',
|
|
97
|
-
path: `/wp/v2/menus/${menu.id}?force=true`,
|
|
98
|
-
})));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Get latest navigation menus
|
|
103
|
-
*
|
|
104
|
-
* @param args
|
|
105
|
-
* @param args.status
|
|
106
|
-
* @return {string} Menu content.
|
|
107
|
-
*/
|
|
108
|
-
async function getNavigationMenus(args) {
|
|
109
|
-
const navigationMenus = await this.rest({
|
|
110
|
-
method: 'GET',
|
|
111
|
-
path: `/wp/v2/navigation/`,
|
|
112
|
-
data: args,
|
|
113
|
-
});
|
|
114
|
-
return navigationMenus;
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=menus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menus.js","sourceRoot":"","sources":["../../src/request-utils/menus.ts"],"names":[],"mappings":";;;;;;AAeA;;;;;GAKG;AACI,KAAK,4BAAiD,IAAY;IACxE,MAAM,SAAS,GAAG;QACjB;YACC,KAAK,EAAE,aAAa;YACpB,GAAG,EAAE,wBAAwB;YAC7B,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,CAAC;SACb;KACD,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAoB;QAC/C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE;YACL,IAAI;SACJ;KACD,CAAE,CAAC;IAEJ,MAAM,IAAI,CAAC,SAAS,CACnB,SAAS,CAAC,GAAG,CAAE,CAAE,QAAQ,EAAG,EAAE,CAAC,CAAE;QAChC,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE;YACL,KAAK,EAAE,IAAI,CAAC,EAAE;YACd,SAAS,EAAE,SAAS;YACpB,GAAG,QAAQ;YACX,MAAM,EAAE,SAAS;SACjB;KACD,CAAE,CAAE,CACL,CAAC;IAEF,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACI,KAAK,+BAEX,QAAkB;IAElB,OAAO,IAAI,CAAC,YAAY,CAAoB,YAAY,EAAE;QACzD,MAAM,EAAE,SAAS;QACjB,GAAG,QAAQ;KACX,CAAE,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,KAAK;IACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAsB;QACrD,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE;YACL,MAAM,EAAE;gBACP,SAAS;gBACT,SAAS;gBACT,OAAO;gBACP,YAAY;gBACZ,QAAQ;gBACR,SAAS;gBACT,SAAS;gBACT,OAAO;aACP;SACD;KACD,CAAE,CAAC;IAEJ,IAAK,QAAQ,CAAC,MAAM,EAAG,CAAC;QACvB,MAAM,IAAI,CAAC,SAAS,CACnB,QAAQ,CAAC,GAAG,CAAE,CAAE,IAAI,EAAG,EAAE,CAAC,CAAE;YAC3B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,qBAAsB,IAAI,CAAC,EAAG,aAAa;SACjD,CAAE,CAAE,CACL,CAAC;IACH,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,IAAI,CAAsB;QACzD,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE;YACL,MAAM,EAAE;gBACP,SAAS;gBACT,SAAS;gBACT,OAAO;gBACP,YAAY;gBACZ,QAAQ;gBACR,SAAS;gBACT,SAAS;gBACT,OAAO;aACP;SACD;KACD,CAAE,CAAC;IAEJ,IAAK,YAAY,CAAC,MAAM,EAAG,CAAC;QAC3B,MAAM,IAAI,CAAC,SAAS,CACnB,YAAY,CAAC,GAAG,CAAE,CAAE,IAAI,EAAG,EAAE,CAAC,CAAE;YAC/B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,gBAAiB,IAAI,CAAC,EAAG,aAAa;SAC5C,CAAE,CAAE,CACL,CAAC;IACH,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACI,KAAK,6BAEX,IAA2B;IAE3B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,IAAI,CAAsB;QAC5D,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,IAAI;KACV,CAAE,CAAC;IACJ,OAAO,eAAe,CAAC;AACxB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/pages.ts
|
|
21
|
-
var pages_exports = {};
|
|
22
|
-
__export(pages_exports, {
|
|
23
|
-
createPage: () => createPage,
|
|
24
|
-
deleteAllPages: () => deleteAllPages,
|
|
25
|
-
deletePage: () => deletePage
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(pages_exports);
|
|
28
|
-
var PAGE_STATUS = [
|
|
29
|
-
"publish",
|
|
30
|
-
"future",
|
|
31
|
-
"draft",
|
|
32
|
-
"pending",
|
|
33
|
-
"private",
|
|
34
|
-
"trash"
|
|
35
|
-
];
|
|
36
|
-
async function deletePage(id) {
|
|
37
|
-
return await this.rest({
|
|
38
|
-
method: "DELETE",
|
|
39
|
-
path: `/wp/v2/pages/${id}`,
|
|
40
|
-
params: {
|
|
41
|
-
force: true
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
async function deleteAllPages() {
|
|
46
|
-
const pages = await this.rest({
|
|
47
|
-
path: "/wp/v2/pages",
|
|
48
|
-
params: {
|
|
49
|
-
per_page: 100,
|
|
50
|
-
status: PAGE_STATUS.join(",")
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
await Promise.all(
|
|
54
|
-
pages.map((page) => deletePage.call(this, page.id))
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
async function createPage(payload) {
|
|
58
|
-
return this.createRecord("pages", { ...payload });
|
|
59
|
-
}
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
createPage,
|
|
63
|
-
deleteAllPages,
|
|
64
|
-
deletePage
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=pages.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/pages.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\nconst PAGE_STATUS = [\n\t'publish',\n\t'future',\n\t'draft',\n\t'pending',\n\t'private',\n\t'trash',\n] as const;\n\nexport type Page = {\n\tid: number;\n\tstatus: ( typeof PAGE_STATUS )[ number ];\n};\n\nexport type CreatePagePayload = {\n\ttitle?: string;\n\tcontent?: string;\n\tstatus: ( typeof PAGE_STATUS )[ number ];\n\tdate?: string;\n\tdate_gmt?: string;\n};\n\nexport async function deletePage( this: RequestUtils, id: number ) {\n\t// https://developer.wordpress.org/rest-api/reference/pages/#delete-a-page\n\treturn await this.rest( {\n\t\tmethod: 'DELETE',\n\t\tpath: `/wp/v2/pages/${ id }`,\n\t\tparams: {\n\t\t\tforce: true,\n\t\t},\n\t} );\n}\n\n/**\n * Delete all pages using REST API.\n *\n * @param this\n */\nexport async function deleteAllPages( this: RequestUtils ) {\n\t// List all pages.\n\t// https://developer.wordpress.org/rest-api/reference/pages/#list-pages\n\tconst pages = await this.rest< Page[] >( {\n\t\tpath: '/wp/v2/pages',\n\t\tparams: {\n\t\t\tper_page: 100,\n\n\t\t\tstatus: PAGE_STATUS.join( ',' ),\n\t\t},\n\t} );\n\n\t// Delete all pages one by one.\n\t// \"/wp/v2/pages\" not yet supports batch requests.\n\tawait Promise.all(\n\t\tpages.map( ( page ) => deletePage.call( this, page.id ) )\n\t);\n}\n\n/**\n * Create a new page.\n *\n * @param this\n * @param payload The page payload.\n */\nexport async function createPage(\n\tthis: RequestUtils,\n\tpayload: CreatePagePayload\n) {\n\t// https://developer.wordpress.org/rest-api/reference/pages/#create-a-page\n\treturn this.createRecord< Page >( 'pages', { ...payload } );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAM,cAAc;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAeA,eAAsB,WAAgC,IAAa;AAElE,SAAO,MAAM,KAAK,KAAM;AAAA,IACvB,QAAQ;AAAA,IACR,MAAM,gBAAiB,EAAG;AAAA,IAC1B,QAAQ;AAAA,MACP,OAAO;AAAA,IACR;AAAA,EACD,CAAE;AACH;AAOA,eAAsB,iBAAqC;AAG1D,QAAM,QAAQ,MAAM,KAAK,KAAgB;AAAA,IACxC,MAAM;AAAA,IACN,QAAQ;AAAA,MACP,UAAU;AAAA,MAEV,QAAQ,YAAY,KAAM,GAAI;AAAA,IAC/B;AAAA,EACD,CAAE;AAIF,QAAM,QAAQ;AAAA,IACb,MAAM,IAAK,CAAE,SAAU,WAAW,KAAM,MAAM,KAAK,EAAG,CAAE;AAAA,EACzD;AACD;AAQA,eAAsB,WAErB,SACC;AAED,SAAO,KAAK,aAAsB,SAAS,EAAE,GAAG,QAAQ,CAAE;AAC3D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deletePage = deletePage;
|
|
4
|
-
exports.deleteAllPages = deleteAllPages;
|
|
5
|
-
exports.createPage = createPage;
|
|
6
|
-
const PAGE_STATUS = [
|
|
7
|
-
'publish',
|
|
8
|
-
'future',
|
|
9
|
-
'draft',
|
|
10
|
-
'pending',
|
|
11
|
-
'private',
|
|
12
|
-
'trash',
|
|
13
|
-
];
|
|
14
|
-
async function deletePage(id) {
|
|
15
|
-
// https://developer.wordpress.org/rest-api/reference/pages/#delete-a-page
|
|
16
|
-
return await this.rest({
|
|
17
|
-
method: 'DELETE',
|
|
18
|
-
path: `/wp/v2/pages/${id}`,
|
|
19
|
-
params: {
|
|
20
|
-
force: true,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Delete all pages using REST API.
|
|
26
|
-
*
|
|
27
|
-
* @param this
|
|
28
|
-
*/
|
|
29
|
-
async function deleteAllPages() {
|
|
30
|
-
// List all pages.
|
|
31
|
-
// https://developer.wordpress.org/rest-api/reference/pages/#list-pages
|
|
32
|
-
const pages = await this.rest({
|
|
33
|
-
path: '/wp/v2/pages',
|
|
34
|
-
params: {
|
|
35
|
-
per_page: 100,
|
|
36
|
-
status: PAGE_STATUS.join(','),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
// Delete all pages one by one.
|
|
40
|
-
// "/wp/v2/pages" not yet supports batch requests.
|
|
41
|
-
await Promise.all(pages.map((page) => deletePage.call(this, page.id)));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Create a new page.
|
|
45
|
-
*
|
|
46
|
-
* @param this
|
|
47
|
-
* @param payload The page payload.
|
|
48
|
-
*/
|
|
49
|
-
async function createPage(payload) {
|
|
50
|
-
// https://developer.wordpress.org/rest-api/reference/pages/#create-a-page
|
|
51
|
-
return this.createRecord('pages', { ...payload });
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=pages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../src/request-utils/pages.ts"],"names":[],"mappings":";;;;;AAKA,MAAM,WAAW,GAAG;IACnB,SAAS;IACT,QAAQ;IACR,OAAO;IACP,SAAS;IACT,SAAS;IACT,OAAO;CACE,CAAC;AAeJ,KAAK,qBAA0C,EAAU;IAC/D,0EAA0E;IAC1E,OAAO,MAAM,IAAI,CAAC,IAAI,CAAE;QACvB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,gBAAiB,EAAG,EAAE;QAC5B,MAAM,EAAE;YACP,KAAK,EAAE,IAAI;SACX;KACD,CAAE,CAAC;AACL,CAAC;AAED;;;;GAIG;AACI,KAAK;IACX,kBAAkB;IAClB,uEAAuE;IACvE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAY;QACxC,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE;YACP,QAAQ,EAAE,GAAG;YAEb,MAAM,EAAE,WAAW,CAAC,IAAI,CAAE,GAAG,CAAE;SAC/B;KACD,CAAE,CAAC;IAEJ,+BAA+B;IAC/B,kDAAkD;IAClD,MAAM,OAAO,CAAC,GAAG,CAChB,KAAK,CAAC,GAAG,CAAE,CAAE,IAAI,EAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAE,CAAE,CACzD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACI,KAAK,qBAEX,OAA0B;IAE1B,0EAA0E;IAC1E,OAAO,IAAI,CAAC,YAAY,CAAU,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,CAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/patterns.ts
|
|
21
|
-
var patterns_exports = {};
|
|
22
|
-
__export(patterns_exports, {
|
|
23
|
-
deleteAllPatternCategories: () => deleteAllPatternCategories
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(patterns_exports);
|
|
26
|
-
async function deleteAllPatternCategories() {
|
|
27
|
-
const categories = await this.rest({
|
|
28
|
-
path: "/wp/v2/wp_pattern_category",
|
|
29
|
-
params: {
|
|
30
|
-
per_page: 100
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
await this.batchRest(
|
|
34
|
-
categories.map((category) => ({
|
|
35
|
-
method: "DELETE",
|
|
36
|
-
path: `/wp/v2/wp_pattern_category/${category.id}?force=true`
|
|
37
|
-
}))
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
deleteAllPatternCategories
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=patterns.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/patterns.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\n/**\n * Delete all pattern categories using REST API.\n *\n * @see https://developer.wordpress.org/rest-api/reference/categories/#list-categories\n * @param this\n */\nexport async function deleteAllPatternCategories( this: RequestUtils ) {\n\t// List all pattern categories.\n\t// https://developer.wordpress.org/rest-api/reference/categories/#list-categories\n\tconst categories = await this.rest( {\n\t\tpath: '/wp/v2/wp_pattern_category',\n\t\tparams: {\n\t\t\tper_page: 100,\n\t\t},\n\t} );\n\n\t// Delete pattern categories.\n\t// https://developer.wordpress.org/rest-api/reference/categories/#delete-a-category\n\t// \"/wp/v2/category\" does not yet supports batch requests.\n\tawait this.batchRest(\n\t\tcategories.map( ( category: { id: number } ) => ( {\n\t\t\tmethod: 'DELETE',\n\t\t\tpath: `/wp/v2/wp_pattern_category/${ category.id }?force=true`,\n\t\t} ) )\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,eAAsB,6BAAiD;AAGtE,QAAM,aAAa,MAAM,KAAK,KAAM;AAAA,IACnC,MAAM;AAAA,IACN,QAAQ;AAAA,MACP,UAAU;AAAA,IACX;AAAA,EACD,CAAE;AAKF,QAAM,KAAK;AAAA,IACV,WAAW,IAAK,CAAE,cAAgC;AAAA,MACjD,QAAQ;AAAA,MACR,MAAM,8BAA+B,SAAS,EAAG;AAAA,IAClD,EAAI;AAAA,EACL;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteAllPatternCategories = deleteAllPatternCategories;
|
|
4
|
-
/**
|
|
5
|
-
* Delete all pattern categories using REST API.
|
|
6
|
-
*
|
|
7
|
-
* @see https://developer.wordpress.org/rest-api/reference/categories/#list-categories
|
|
8
|
-
* @param this
|
|
9
|
-
*/
|
|
10
|
-
async function deleteAllPatternCategories() {
|
|
11
|
-
// List all pattern categories.
|
|
12
|
-
// https://developer.wordpress.org/rest-api/reference/categories/#list-categories
|
|
13
|
-
const categories = await this.rest({
|
|
14
|
-
path: '/wp/v2/wp_pattern_category',
|
|
15
|
-
params: {
|
|
16
|
-
per_page: 100,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
// Delete pattern categories.
|
|
20
|
-
// https://developer.wordpress.org/rest-api/reference/categories/#delete-a-category
|
|
21
|
-
// "/wp/v2/category" does not yet supports batch requests.
|
|
22
|
-
await this.batchRest(categories.map((category) => ({
|
|
23
|
-
method: 'DELETE',
|
|
24
|
-
path: `/wp/v2/wp_pattern_category/${category.id}?force=true`,
|
|
25
|
-
})));
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=patterns.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/request-utils/patterns.ts"],"names":[],"mappings":";;;AAKA;;;;;GAKG;AACI,KAAK;IACX,+BAA+B;IAC/B,iFAAiF;IACjF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAE;QACnC,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE;YACP,QAAQ,EAAE,GAAG;SACb;KACD,CAAE,CAAC;IAEJ,6BAA6B;IAC7B,mFAAmF;IACnF,0DAA0D;IAC1D,MAAM,IAAI,CAAC,SAAS,CACnB,UAAU,CAAC,GAAG,CAAE,CAAE,QAAwB,EAAG,EAAE,CAAC,CAAE;QACjD,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,8BAA+B,QAAQ,CAAC,EAAG,aAAa;KAC9D,CAAE,CAAE,CACL,CAAC;AACH,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/plugins.ts
|
|
21
|
-
var plugins_exports = {};
|
|
22
|
-
__export(plugins_exports, {
|
|
23
|
-
activatePlugin: () => activatePlugin,
|
|
24
|
-
deactivatePlugin: () => deactivatePlugin,
|
|
25
|
-
getPluginsMap: () => getPluginsMap
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(plugins_exports);
|
|
28
|
-
var import_change_case = require("change-case");
|
|
29
|
-
async function getPluginsMap(forceRefetch = false) {
|
|
30
|
-
if (!forceRefetch && this.pluginsMap) {
|
|
31
|
-
return this.pluginsMap;
|
|
32
|
-
}
|
|
33
|
-
const plugins = await this.rest({
|
|
34
|
-
path: "/wp/v2/plugins"
|
|
35
|
-
});
|
|
36
|
-
this.pluginsMap = {};
|
|
37
|
-
for (const plugin of plugins) {
|
|
38
|
-
const slug = (0, import_change_case.paramCase)(plugin.name.toLowerCase());
|
|
39
|
-
this.pluginsMap[slug] = plugin.plugin;
|
|
40
|
-
}
|
|
41
|
-
return this.pluginsMap;
|
|
42
|
-
}
|
|
43
|
-
function getPluginFromMap(slug, pluginsMap) {
|
|
44
|
-
const plugin = pluginsMap[slug];
|
|
45
|
-
if (!plugin) {
|
|
46
|
-
for (const key of Object.keys(pluginsMap)) {
|
|
47
|
-
if (key.toLowerCase().replace(/-/g, "") === slug.toLowerCase().replace(/-/g, "")) {
|
|
48
|
-
throw new Error(
|
|
49
|
-
`The plugin "${slug}" isn't installed. Did you perhaps mean "${key}"?`
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
throw new Error(`The plugin "${slug}" isn't installed`);
|
|
54
|
-
}
|
|
55
|
-
return plugin;
|
|
56
|
-
}
|
|
57
|
-
async function activatePlugin(slug) {
|
|
58
|
-
const pluginsMap = await this.getPluginsMap();
|
|
59
|
-
const plugin = getPluginFromMap(slug, pluginsMap);
|
|
60
|
-
await this.rest({
|
|
61
|
-
method: "PUT",
|
|
62
|
-
path: `/wp/v2/plugins/${plugin}`,
|
|
63
|
-
data: { status: "active" }
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
async function deactivatePlugin(slug) {
|
|
67
|
-
const pluginsMap = await this.getPluginsMap();
|
|
68
|
-
const plugin = getPluginFromMap(slug, pluginsMap);
|
|
69
|
-
await this.rest({
|
|
70
|
-
method: "PUT",
|
|
71
|
-
path: `/wp/v2/plugins/${plugin}`,
|
|
72
|
-
data: { status: "inactive" }
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
-
0 && (module.exports = {
|
|
77
|
-
activatePlugin,
|
|
78
|
-
deactivatePlugin,
|
|
79
|
-
getPluginsMap
|
|
80
|
-
});
|
|
81
|
-
//# sourceMappingURL=plugins.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/plugins.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\n/**\n * Fetch the plugins from API and cache them in memory,\n * since they are unlikely to change during testing.\n *\n * @param this\n * @param forceRefetch Force refetch the installed plugins to update the cache.\n */\nasync function getPluginsMap( this: RequestUtils, forceRefetch = false ) {\n\tif ( ! forceRefetch && this.pluginsMap ) {\n\t\treturn this.pluginsMap;\n\t}\n\n\tconst plugins = await this.rest( {\n\t\tpath: '/wp/v2/plugins',\n\t} );\n\tthis.pluginsMap = {};\n\tfor ( const plugin of plugins ) {\n\t\t// Ideally, we should be using sanitize_title() in PHP rather than kebabCase(),\n\t\t// but we don't have the exact port of it in JS.\n\t\t// This is a good approximation though.\n\t\tconst slug = kebabCase( plugin.name.toLowerCase() );\n\t\tthis.pluginsMap[ slug ] = plugin.plugin;\n\t}\n\treturn this.pluginsMap;\n}\n\n/**\n * Finds a plugin in the plugin map.\n *\n * Attempts to provide a helpful error message if not found.\n *\n * @param slug Plugin slug.\n * @param pluginsMap Plugins map.\n */\nfunction getPluginFromMap(\n\tslug: string,\n\tpluginsMap: Record< string, string >\n) {\n\tconst plugin = pluginsMap[ slug ];\n\n\tif ( ! plugin ) {\n\t\tfor ( const key of Object.keys( pluginsMap ) ) {\n\t\t\tif (\n\t\t\t\tkey.toLowerCase().replace( /-/g, '' ) ===\n\t\t\t\tslug.toLowerCase().replace( /-/g, '' )\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The plugin \"${ slug }\" isn't installed. Did you perhaps mean \"${ key }\"?`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error( `The plugin \"${ slug }\" isn't installed` );\n\t}\n\n\treturn plugin;\n}\n\n/**\n * Activates an installed plugin.\n *\n * @param this RequestUtils.\n * @param slug Plugin slug.\n */\nasync function activatePlugin( this: RequestUtils, slug: string ) {\n\tconst pluginsMap = await this.getPluginsMap();\n\tconst plugin = getPluginFromMap( slug, pluginsMap );\n\n\tawait this.rest( {\n\t\tmethod: 'PUT',\n\t\tpath: `/wp/v2/plugins/${ plugin }`,\n\t\tdata: { status: 'active' },\n\t} );\n}\n\n/**\n * Deactivates an active plugin.\n *\n * @param this RequestUtils.\n * @param slug Plugin slug.\n */\nasync function deactivatePlugin( this: RequestUtils, slug: string ) {\n\tconst pluginsMap = await this.getPluginsMap();\n\tconst plugin = getPluginFromMap( slug, pluginsMap );\n\n\tawait this.rest( {\n\t\tmethod: 'PUT',\n\t\tpath: `/wp/v2/plugins/${ plugin }`,\n\t\tdata: { status: 'inactive' },\n\t} );\n}\n\nexport { getPluginsMap, activatePlugin, deactivatePlugin };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAuC;AAcvC,eAAe,cAAmC,eAAe,OAAQ;AACxE,MAAK,CAAE,gBAAgB,KAAK,YAAa;AACxC,WAAO,KAAK;AAAA,EACb;AAEA,QAAM,UAAU,MAAM,KAAK,KAAM;AAAA,IAChC,MAAM;AAAA,EACP,CAAE;AACF,OAAK,aAAa,CAAC;AACnB,aAAY,UAAU,SAAU;AAI/B,UAAM,WAAO,mBAAAA,WAAW,OAAO,KAAK,YAAY,CAAE;AAClD,SAAK,WAAY,IAAK,IAAI,OAAO;AAAA,EAClC;AACA,SAAO,KAAK;AACb;AAUA,SAAS,iBACR,MACA,YACC;AACD,QAAM,SAAS,WAAY,IAAK;AAEhC,MAAK,CAAE,QAAS;AACf,eAAY,OAAO,OAAO,KAAM,UAAW,GAAI;AAC9C,UACC,IAAI,YAAY,EAAE,QAAS,MAAM,EAAG,MACpC,KAAK,YAAY,EAAE,QAAS,MAAM,EAAG,GACpC;AACD,cAAM,IAAI;AAAA,UACT,eAAgB,IAAK,4CAA6C,GAAI;AAAA,QACvE;AAAA,MACD;AAAA,IACD;AAEA,UAAM,IAAI,MAAO,eAAgB,IAAK,mBAAoB;AAAA,EAC3D;AAEA,SAAO;AACR;AAQA,eAAe,eAAoC,MAAe;AACjE,QAAM,aAAa,MAAM,KAAK,cAAc;AAC5C,QAAM,SAAS,iBAAkB,MAAM,UAAW;AAElD,QAAM,KAAK,KAAM;AAAA,IAChB,QAAQ;AAAA,IACR,MAAM,kBAAmB,MAAO;AAAA,IAChC,MAAM,EAAE,QAAQ,SAAS;AAAA,EAC1B,CAAE;AACH;AAQA,eAAe,iBAAsC,MAAe;AACnE,QAAM,aAAa,MAAM,KAAK,cAAc;AAC5C,QAAM,SAAS,iBAAkB,MAAM,UAAW;AAElD,QAAM,KAAK,KAAM;AAAA,IAChB,QAAQ;AAAA,IACR,MAAM,kBAAmB,MAAO;AAAA,IAChC,MAAM,EAAE,QAAQ,WAAW;AAAA,EAC5B,CAAE;AACH;",
|
|
6
|
-
"names": ["kebabCase"]
|
|
7
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPluginsMap = getPluginsMap;
|
|
4
|
-
exports.activatePlugin = activatePlugin;
|
|
5
|
-
exports.deactivatePlugin = deactivatePlugin;
|
|
6
|
-
/**
|
|
7
|
-
* External dependencies
|
|
8
|
-
*/
|
|
9
|
-
const change_case_1 = require("change-case");
|
|
10
|
-
/**
|
|
11
|
-
* Fetch the plugins from API and cache them in memory,
|
|
12
|
-
* since they are unlikely to change during testing.
|
|
13
|
-
*
|
|
14
|
-
* @param this
|
|
15
|
-
* @param forceRefetch Force refetch the installed plugins to update the cache.
|
|
16
|
-
*/
|
|
17
|
-
async function getPluginsMap(forceRefetch = false) {
|
|
18
|
-
if (!forceRefetch && this.pluginsMap) {
|
|
19
|
-
return this.pluginsMap;
|
|
20
|
-
}
|
|
21
|
-
const plugins = await this.rest({
|
|
22
|
-
path: '/wp/v2/plugins',
|
|
23
|
-
});
|
|
24
|
-
this.pluginsMap = {};
|
|
25
|
-
for (const plugin of plugins) {
|
|
26
|
-
// Ideally, we should be using sanitize_title() in PHP rather than kebabCase(),
|
|
27
|
-
// but we don't have the exact port of it in JS.
|
|
28
|
-
// This is a good approximation though.
|
|
29
|
-
const slug = (0, change_case_1.paramCase)(plugin.name.toLowerCase());
|
|
30
|
-
this.pluginsMap[slug] = plugin.plugin;
|
|
31
|
-
}
|
|
32
|
-
return this.pluginsMap;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Finds a plugin in the plugin map.
|
|
36
|
-
*
|
|
37
|
-
* Attempts to provide a helpful error message if not found.
|
|
38
|
-
*
|
|
39
|
-
* @param slug Plugin slug.
|
|
40
|
-
* @param pluginsMap Plugins map.
|
|
41
|
-
*/
|
|
42
|
-
function getPluginFromMap(slug, pluginsMap) {
|
|
43
|
-
const plugin = pluginsMap[slug];
|
|
44
|
-
if (!plugin) {
|
|
45
|
-
for (const key of Object.keys(pluginsMap)) {
|
|
46
|
-
if (key.toLowerCase().replace(/-/g, '') ===
|
|
47
|
-
slug.toLowerCase().replace(/-/g, '')) {
|
|
48
|
-
throw new Error(`The plugin "${slug}" isn't installed. Did you perhaps mean "${key}"?`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
throw new Error(`The plugin "${slug}" isn't installed`);
|
|
52
|
-
}
|
|
53
|
-
return plugin;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Activates an installed plugin.
|
|
57
|
-
*
|
|
58
|
-
* @param this RequestUtils.
|
|
59
|
-
* @param slug Plugin slug.
|
|
60
|
-
*/
|
|
61
|
-
async function activatePlugin(slug) {
|
|
62
|
-
const pluginsMap = await this.getPluginsMap();
|
|
63
|
-
const plugin = getPluginFromMap(slug, pluginsMap);
|
|
64
|
-
await this.rest({
|
|
65
|
-
method: 'PUT',
|
|
66
|
-
path: `/wp/v2/plugins/${plugin}`,
|
|
67
|
-
data: { status: 'active' },
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Deactivates an active plugin.
|
|
72
|
-
*
|
|
73
|
-
* @param this RequestUtils.
|
|
74
|
-
* @param slug Plugin slug.
|
|
75
|
-
*/
|
|
76
|
-
async function deactivatePlugin(slug) {
|
|
77
|
-
const pluginsMap = await this.getPluginsMap();
|
|
78
|
-
const plugin = getPluginFromMap(slug, pluginsMap);
|
|
79
|
-
await this.rest({
|
|
80
|
-
method: 'PUT',
|
|
81
|
-
path: `/wp/v2/plugins/${plugin}`,
|
|
82
|
-
data: { status: 'inactive' },
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=plugins.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/request-utils/plugins.ts"],"names":[],"mappings":";;QAsGS,aAAa;QAAE,cAAc;QAAE,gBAAgB;AAtGxD;;GAEG;AACH,6CAAqD;AAOrD;;;;;;GAMG;AACH,KAAK,UAAU,aAAa,CAAsB,YAAY,GAAG,KAAK;IACrE,IAAK,CAAE,YAAY,IAAI,IAAI,CAAC,UAAU,EAAG,CAAC;QACzC,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAE;QAChC,IAAI,EAAE,gBAAgB;KACtB,CAAE,CAAC;IACJ,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACrB,KAAM,MAAM,MAAM,IAAI,OAAO,EAAG,CAAC;QAChC,+EAA+E;QAC/E,gDAAgD;QAChD,uCAAuC;QACvC,MAAM,IAAI,GAAG,IAAA,uBAAS,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAE,CAAC;QACpD,IAAI,CAAC,UAAU,CAAE,IAAI,CAAE,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,gBAAgB,CACxB,IAAY,EACZ,UAAoC;IAEpC,MAAM,MAAM,GAAG,UAAU,CAAE,IAAI,CAAE,CAAC;IAElC,IAAK,CAAE,MAAM,EAAG,CAAC;QAChB,KAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAE,UAAU,CAAE,EAAG,CAAC;YAC/C,IACC,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAE,IAAI,EAAE,EAAE,CAAE;gBACrC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAE,IAAI,EAAE,EAAE,CAAE,EACrC,CAAC;gBACF,MAAM,IAAI,KAAK,CACd,eAAgB,IAAK,4CAA6C,GAAI,IAAI,CAC1E,CAAC;YACH,CAAC;QACF,CAAC;QAED,MAAM,IAAI,KAAK,CAAE,eAAgB,IAAK,mBAAmB,CAAE,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,cAAc,CAAsB,IAAY;IAC9D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAE,IAAI,EAAE,UAAU,CAAE,CAAC;IAEpD,MAAM,IAAI,CAAC,IAAI,CAAE;QAChB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,kBAAmB,MAAO,EAAE;QAClC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;KAC1B,CAAE,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,gBAAgB,CAAsB,IAAY;IAChE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAE,IAAI,EAAE,UAAU,CAAE,CAAC;IAEpD,MAAM,IAAI,CAAC,IAAI,CAAE;QAChB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,kBAAmB,MAAO,EAAE;QAClC,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;KAC5B,CAAE,CAAC;AACL,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/e2e-test-utils-playwright/src/request-utils/posts.ts
|
|
21
|
-
var posts_exports = {};
|
|
22
|
-
__export(posts_exports, {
|
|
23
|
-
createPost: () => createPost,
|
|
24
|
-
deleteAllPosts: () => deleteAllPosts
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(posts_exports);
|
|
27
|
-
async function deleteAllPosts(postType = "posts") {
|
|
28
|
-
const posts = await this.rest({
|
|
29
|
-
path: `/wp/v2/${postType}`,
|
|
30
|
-
params: {
|
|
31
|
-
per_page: 100,
|
|
32
|
-
// All possible statuses.
|
|
33
|
-
status: "publish,future,draft,pending,private,trash"
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
await Promise.all(
|
|
37
|
-
posts.map(
|
|
38
|
-
(post) => this.rest({
|
|
39
|
-
method: "DELETE",
|
|
40
|
-
path: `/wp/v2/${postType}/${post.id}`,
|
|
41
|
-
params: {
|
|
42
|
-
force: true
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
async function createPost(payload) {
|
|
49
|
-
return this.createRecord("posts", { ...payload });
|
|
50
|
-
}
|
|
51
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 && (module.exports = {
|
|
53
|
-
createPost,
|
|
54
|
-
deleteAllPosts
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=posts.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/request-utils/posts.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\nexport interface Post {\n\tid: number;\n\tcontent: string;\n\tstatus: 'publish' | 'future' | 'draft' | 'pending' | 'private';\n\tlink: string;\n}\n\nexport interface CreatePostPayload {\n\ttitle?: string;\n\tcontent?: string;\n\tstatus: 'publish' | 'future' | 'draft' | 'pending' | 'private';\n\tdate?: string;\n\tdate_gmt: string;\n}\n\n/**\n * Delete all posts using REST API.\n *\n * @param this\n * @param postType The type of post to delete. Defaults to 'posts'.\n */\nexport async function deleteAllPosts(\n\tthis: RequestUtils,\n\tpostType: string = 'posts'\n) {\n\t// List all posts.\n\t// https://developer.wordpress.org/rest-api/reference/posts/#list-posts\n\tconst posts = await this.rest< Post[] >( {\n\t\tpath: `/wp/v2/${ postType }`,\n\t\tparams: {\n\t\t\tper_page: 100,\n\t\t\t// All possible statuses.\n\t\t\tstatus: 'publish,future,draft,pending,private,trash',\n\t\t},\n\t} );\n\n\t// Delete all posts one by one.\n\t// https://developer.wordpress.org/rest-api/reference/posts/#delete-a-post\n\t// \"/wp/v2/posts\" not yet supports batch requests.\n\tawait Promise.all(\n\t\tposts.map( ( post ) =>\n\t\t\tthis.rest( {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\tpath: `/wp/v2/${ postType }/${ post.id }`,\n\t\t\t\tparams: {\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t} )\n\t\t)\n\t);\n}\n\n/**\n * Creates a new post using the REST API.\n *\n * @param this\n * @param payload Post attributes.\n */\nexport async function createPost(\n\tthis: RequestUtils,\n\tpayload: CreatePostPayload\n) {\n\treturn this.createRecord< Post >( 'posts', { ...payload } );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BA,eAAsB,eAErB,WAAmB,SAClB;AAGD,QAAM,QAAQ,MAAM,KAAK,KAAgB;AAAA,IACxC,MAAM,UAAW,QAAS;AAAA,IAC1B,QAAQ;AAAA,MACP,UAAU;AAAA;AAAA,MAEV,QAAQ;AAAA,IACT;AAAA,EACD,CAAE;AAKF,QAAM,QAAQ;AAAA,IACb,MAAM;AAAA,MAAK,CAAE,SACZ,KAAK,KAAM;AAAA,QACV,QAAQ;AAAA,QACR,MAAM,UAAW,QAAS,IAAK,KAAK,EAAG;AAAA,QACvC,QAAQ;AAAA,UACP,OAAO;AAAA,QACR;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AACD;AAQA,eAAsB,WAErB,SACC;AACD,SAAO,KAAK,aAAsB,SAAS,EAAE,GAAG,QAAQ,CAAE;AAC3D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteAllPosts = deleteAllPosts;
|
|
4
|
-
exports.createPost = createPost;
|
|
5
|
-
/**
|
|
6
|
-
* Delete all posts using REST API.
|
|
7
|
-
*
|
|
8
|
-
* @param this
|
|
9
|
-
* @param postType The type of post to delete. Defaults to 'posts'.
|
|
10
|
-
*/
|
|
11
|
-
async function deleteAllPosts(postType = 'posts') {
|
|
12
|
-
// List all posts.
|
|
13
|
-
// https://developer.wordpress.org/rest-api/reference/posts/#list-posts
|
|
14
|
-
const posts = await this.rest({
|
|
15
|
-
path: `/wp/v2/${postType}`,
|
|
16
|
-
params: {
|
|
17
|
-
per_page: 100,
|
|
18
|
-
// All possible statuses.
|
|
19
|
-
status: 'publish,future,draft,pending,private,trash',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
// Delete all posts one by one.
|
|
23
|
-
// https://developer.wordpress.org/rest-api/reference/posts/#delete-a-post
|
|
24
|
-
// "/wp/v2/posts" not yet supports batch requests.
|
|
25
|
-
await Promise.all(posts.map((post) => this.rest({
|
|
26
|
-
method: 'DELETE',
|
|
27
|
-
path: `/wp/v2/${postType}/${post.id}`,
|
|
28
|
-
params: {
|
|
29
|
-
force: true,
|
|
30
|
-
},
|
|
31
|
-
})));
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a new post using the REST API.
|
|
35
|
-
*
|
|
36
|
-
* @param this
|
|
37
|
-
* @param payload Post attributes.
|
|
38
|
-
*/
|
|
39
|
-
async function createPost(payload) {
|
|
40
|
-
return this.createRecord('posts', { ...payload });
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=posts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"posts.js","sourceRoot":"","sources":["../../src/request-utils/posts.ts"],"names":[],"mappings":";;;;AAoBA;;;;;GAKG;AACI,KAAK,yBAEX,QAAQ,GAAW,OAAO;IAE1B,kBAAkB;IAClB,uEAAuE;IACvE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAY;QACxC,IAAI,EAAE,UAAW,QAAS,EAAE;QAC5B,MAAM,EAAE;YACP,QAAQ,EAAE,GAAG;YACb,yBAAyB;YACzB,MAAM,EAAE,4CAA4C;SACpD;KACD,CAAE,CAAC;IAEJ,+BAA+B;IAC/B,0EAA0E;IAC1E,kDAAkD;IAClD,MAAM,OAAO,CAAC,GAAG,CAChB,KAAK,CAAC,GAAG,CAAE,CAAE,IAAI,EAAG,EAAE,CACrB,IAAI,CAAC,IAAI,CAAE;QACV,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,UAAW,QAAS,IAAK,IAAI,CAAC,EAAG,EAAE;QACzC,MAAM,EAAE;YACP,KAAK,EAAE,IAAI;SACX;KACD,CAAE,CACH,CACD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACI,KAAK,qBAEX,OAA0B;IAE1B,OAAO,IAAI,CAAC,YAAY,CAAU,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,CAAE,CAAC;AAC7D,CAAC"}
|