@wp-playground/blueprints 0.1.46 → 0.1.49
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/lib/steps/client-methods.d.ts +174 -0
- package/lib/steps/index.d.ts +5 -1
- package/lib/steps/site-data.d.ts +43 -0
- package/package.json +2 -2
|
@@ -1,56 +1,230 @@
|
|
|
1
1
|
import { PHPRunOptions, PHPRequest } from '@php-wasm/universal';
|
|
2
2
|
import { StepHandler } from '.';
|
|
3
|
+
/**
|
|
4
|
+
* @inheritDoc runPHP
|
|
5
|
+
* @hasRunnableExample
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "runPHP",
|
|
11
|
+
* "code": "<?php echo 'Hello World'; ?>"
|
|
12
|
+
* }
|
|
13
|
+
* </code>
|
|
14
|
+
*/
|
|
3
15
|
export interface RunPHPStep {
|
|
16
|
+
/** The step identifier. */
|
|
4
17
|
step: 'runPHP';
|
|
18
|
+
/** The PHP code to run. */
|
|
5
19
|
code: string;
|
|
6
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Runs PHP code.
|
|
23
|
+
*/
|
|
7
24
|
export declare const runPHP: StepHandler<RunPHPStep>;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc runPHP
|
|
27
|
+
* @hasRunnableExample
|
|
28
|
+
* @example
|
|
29
|
+
*
|
|
30
|
+
* <code>
|
|
31
|
+
* {
|
|
32
|
+
* "step": "runPHP",
|
|
33
|
+
* "options": {
|
|
34
|
+
* "code": "<?php echo $_SERVER['HTTP_CONTENT_TYPE']; ?>",
|
|
35
|
+
* "headers": {
|
|
36
|
+
* "Content-type": "text/plain"
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* </code>
|
|
41
|
+
*/
|
|
8
42
|
export interface RunPHPWithOptionsStep {
|
|
9
43
|
step: 'runPHPWithOptions';
|
|
10
44
|
options: PHPRunOptions;
|
|
11
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Runs PHP code with the given options.
|
|
48
|
+
*/
|
|
12
49
|
export declare const runPHPWithOptions: StepHandler<RunPHPWithOptionsStep>;
|
|
50
|
+
/**
|
|
51
|
+
* @inheritDoc setPhpIniEntry
|
|
52
|
+
* @hasRunnableExample
|
|
53
|
+
* @example
|
|
54
|
+
*
|
|
55
|
+
* <code>
|
|
56
|
+
* {
|
|
57
|
+
* "step": "setPhpIniEntry",
|
|
58
|
+
* "key": "display_errors",
|
|
59
|
+
* "value": "1"
|
|
60
|
+
* }
|
|
61
|
+
* </code>
|
|
62
|
+
*/
|
|
13
63
|
export interface SetPhpIniEntryStep {
|
|
14
64
|
step: 'setPhpIniEntry';
|
|
15
65
|
key: string;
|
|
16
66
|
value: string;
|
|
17
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Sets a PHP ini entry.
|
|
70
|
+
*/
|
|
18
71
|
export declare const setPhpIniEntry: StepHandler<SetPhpIniEntryStep>;
|
|
72
|
+
/**
|
|
73
|
+
* @inheritDoc request
|
|
74
|
+
* @needsLogin
|
|
75
|
+
* @hasRunnableExample
|
|
76
|
+
* @example
|
|
77
|
+
*
|
|
78
|
+
* <code>
|
|
79
|
+
* {
|
|
80
|
+
* "step": "request",
|
|
81
|
+
* "request": {
|
|
82
|
+
* "method": "POST",
|
|
83
|
+
* "url": "/wp-admin/admin-ajax.php",
|
|
84
|
+
* "formData": {
|
|
85
|
+
* "action": "my_action",
|
|
86
|
+
* "foo": "bar"
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
* </code>
|
|
91
|
+
*/
|
|
19
92
|
export interface RequestStep {
|
|
20
93
|
step: 'request';
|
|
21
94
|
request: PHPRequest;
|
|
22
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Sends a HTTP request to the Playground.
|
|
98
|
+
*/
|
|
23
99
|
export declare const request: StepHandler<RequestStep>;
|
|
100
|
+
/**
|
|
101
|
+
* @inheritDoc cp
|
|
102
|
+
* @hasRunnableExample
|
|
103
|
+
* @landingPage /index2.php
|
|
104
|
+
* @example
|
|
105
|
+
*
|
|
106
|
+
* <code>
|
|
107
|
+
* {
|
|
108
|
+
* "step": "cp",
|
|
109
|
+
* "fromPath": "/wordpress/index.php",
|
|
110
|
+
* "toPath": "/wordpress/index2.php"
|
|
111
|
+
* }
|
|
112
|
+
* </code>
|
|
113
|
+
*/
|
|
24
114
|
export interface CpStep {
|
|
25
115
|
step: 'cp';
|
|
26
116
|
fromPath: string;
|
|
27
117
|
toPath: string;
|
|
28
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Copies a file from one path to another.
|
|
121
|
+
*/
|
|
29
122
|
export declare const cp: StepHandler<CpStep>;
|
|
123
|
+
/**
|
|
124
|
+
* @inheritDoc mv
|
|
125
|
+
* @hasRunnableExample
|
|
126
|
+
* @landingPage /index2.php
|
|
127
|
+
* @example
|
|
128
|
+
*
|
|
129
|
+
* <code>
|
|
130
|
+
* {
|
|
131
|
+
* "step": "mv",
|
|
132
|
+
* "fromPath": "/wordpress/index.php",
|
|
133
|
+
* "toPath": "/wordpress/index2.php"
|
|
134
|
+
* }
|
|
135
|
+
* </code>
|
|
136
|
+
*/
|
|
30
137
|
export interface MvStep {
|
|
31
138
|
step: 'mv';
|
|
32
139
|
fromPath: string;
|
|
33
140
|
toPath: string;
|
|
34
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Moves a file or directory from one path to another.
|
|
144
|
+
*/
|
|
35
145
|
export declare const mv: StepHandler<MvStep>;
|
|
146
|
+
/**
|
|
147
|
+
* @inheritDoc mkdir
|
|
148
|
+
* @hasRunnableExample
|
|
149
|
+
* @example
|
|
150
|
+
*
|
|
151
|
+
* <code>
|
|
152
|
+
* {
|
|
153
|
+
* "step": "mkdir",
|
|
154
|
+
* "path": "/wordpress/my-new-folder"
|
|
155
|
+
* }
|
|
156
|
+
* </code>
|
|
157
|
+
*/
|
|
36
158
|
export interface MkdirStep {
|
|
37
159
|
step: 'mkdir';
|
|
38
160
|
path: string;
|
|
39
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates a directory at the specified path.
|
|
164
|
+
*/
|
|
40
165
|
export declare const mkdir: StepHandler<MkdirStep>;
|
|
166
|
+
/**
|
|
167
|
+
* @inheritDoc rm
|
|
168
|
+
* @hasRunnableExample
|
|
169
|
+
* @landingPage /index.php
|
|
170
|
+
* @example
|
|
171
|
+
*
|
|
172
|
+
* <code>
|
|
173
|
+
* {
|
|
174
|
+
* "step": "rm",
|
|
175
|
+
* "path": "/wordpress/index.php"
|
|
176
|
+
* }
|
|
177
|
+
* </code>
|
|
178
|
+
*/
|
|
41
179
|
export interface RmStep {
|
|
42
180
|
step: 'rm';
|
|
43
181
|
path: string;
|
|
44
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Removes a file at the specified path.
|
|
185
|
+
*/
|
|
45
186
|
export declare const rm: StepHandler<RmStep>;
|
|
187
|
+
/**
|
|
188
|
+
* @inheritDoc rmdir
|
|
189
|
+
* @hasRunnableExample
|
|
190
|
+
* @landingPage /wp-admin/
|
|
191
|
+
* @example
|
|
192
|
+
*
|
|
193
|
+
* <code>
|
|
194
|
+
* {
|
|
195
|
+
* "step": "rm",
|
|
196
|
+
* "path": "/wordpress/wp-admin"
|
|
197
|
+
* }
|
|
198
|
+
* </code>
|
|
199
|
+
*/
|
|
46
200
|
export interface RmdirStep {
|
|
47
201
|
step: 'rmdir';
|
|
48
202
|
path: string;
|
|
49
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Removes a directory at the specified path.
|
|
206
|
+
*/
|
|
50
207
|
export declare const rmdir: StepHandler<RmdirStep>;
|
|
208
|
+
/**
|
|
209
|
+
* @inheritDoc writeFile
|
|
210
|
+
* @hasRunnableExample
|
|
211
|
+
* @landingPage /test.php
|
|
212
|
+
* @example
|
|
213
|
+
*
|
|
214
|
+
* <code>
|
|
215
|
+
* {
|
|
216
|
+
* "step": "writeFile",
|
|
217
|
+
* "path": "/wordpress/test.php",
|
|
218
|
+
* "data": "<?php echo 'Hello World!'; ?>"
|
|
219
|
+
* }
|
|
220
|
+
* </code>
|
|
221
|
+
*/
|
|
51
222
|
export interface WriteFileStep<ResourceType> {
|
|
52
223
|
step: 'writeFile';
|
|
53
224
|
path: string;
|
|
54
225
|
data: ResourceType | string | Uint8Array;
|
|
55
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Writes data to a file at the specified path.
|
|
229
|
+
*/
|
|
56
230
|
export declare const writeFile: StepHandler<WriteFileStep<File>>;
|
package/lib/steps/index.d.ts
CHANGED
|
@@ -21,8 +21,12 @@ export type StepDefinition = Step & {
|
|
|
21
21
|
caption?: string;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* If you add a step here, make sure to also
|
|
26
|
+
* add it to the exports below.
|
|
27
|
+
*/
|
|
24
28
|
export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | ApplyWordPressPatchesStep | CpStep | DefineWpConfigConstsStep | DefineVirtualWpConfigConstsStep | DefineSiteUrlStep | ImportFileStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | ReplaceSiteStep<Resource> | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep | UpdateUserMetaStep | WriteFileStep<Resource>;
|
|
25
|
-
export type { ActivatePluginStep, ApplyWordPressPatchesStep, CpStep, DefineWpConfigConstsStep, DefineSiteUrlStep, ImportFileStep, InstallPluginStep, InstallPluginOptions, InstallThemeStep, InstallThemeOptions, LoginStep, MkdirStep, MvStep, RequestStep, ReplaceSiteStep, RmStep, RmdirStep, RunPHPStep, RunPHPWithOptionsStep, RunWpInstallationWizardStep, WordPressInstallationOptions, SetPhpIniEntryStep, SetSiteOptionsStep, UnzipStep, UpdateUserMetaStep, WriteFileStep, };
|
|
29
|
+
export type { ActivatePluginStep, ActivateThemeStep, ApplyWordPressPatchesStep, CpStep, DefineWpConfigConstsStep, DefineVirtualWpConfigConstsStep, DefineSiteUrlStep, ImportFileStep, InstallPluginStep, InstallPluginOptions, InstallThemeStep, InstallThemeOptions, LoginStep, MkdirStep, MvStep, RequestStep, ReplaceSiteStep, RmStep, RmdirStep, RunPHPStep, RunPHPWithOptionsStep, RunWpInstallationWizardStep, WordPressInstallationOptions, SetPhpIniEntryStep, SetSiteOptionsStep, UnzipStep, UpdateUserMetaStep, WriteFileStep, };
|
|
26
30
|
export type StepHandler<S extends GenericStep<File>> = (
|
|
27
31
|
/**
|
|
28
32
|
* A PHP instance or Playground client.
|
package/lib/steps/site-data.d.ts
CHANGED
|
@@ -1,12 +1,55 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc setSiteOptions
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "setSiteOptions",
|
|
11
|
+
* "options": {
|
|
12
|
+
* "blogname": "My Blog",
|
|
13
|
+
* "blogdescription": "A great blog"
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* </code>
|
|
17
|
+
*/
|
|
2
18
|
export type SetSiteOptionsStep = {
|
|
19
|
+
/** The name of the step. Must be "setSiteOptions". */
|
|
3
20
|
step: 'setSiteOptions';
|
|
21
|
+
/** The options to set on the site. */
|
|
4
22
|
options: Record<string, unknown>;
|
|
5
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Sets site options. This is equivalent to calling `update_option` for each
|
|
26
|
+
* option in the `options` object.
|
|
27
|
+
*/
|
|
6
28
|
export declare const setSiteOptions: StepHandler<SetSiteOptionsStep>;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc updateUserMeta
|
|
31
|
+
* @hasRunnableExample
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
*
|
|
35
|
+
* <code>
|
|
36
|
+
* {
|
|
37
|
+
* "step": "updateUserMeta",
|
|
38
|
+
* "meta": {
|
|
39
|
+
* "first_name": "John",
|
|
40
|
+
* "last_name": "Doe"
|
|
41
|
+
* },
|
|
42
|
+
* "userId": 1
|
|
43
|
+
* }
|
|
44
|
+
* </code>
|
|
45
|
+
*/
|
|
7
46
|
export interface UpdateUserMetaStep {
|
|
8
47
|
step: 'updateUserMeta';
|
|
9
48
|
meta: Record<string, unknown>;
|
|
10
49
|
userId: number;
|
|
11
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Updates user meta. This is equivalent to calling `update_user_meta` for each
|
|
53
|
+
* meta value in the `meta` object.
|
|
54
|
+
*/
|
|
12
55
|
export declare const updateUserMeta: StepHandler<UpdateUserMetaStep>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/blueprints",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./index.js",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"access": "public",
|
|
22
22
|
"directory": "../../../dist/packages/playground/blueprints"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "93834fa77a89c21be2ade4c1d67430981ed92c83"
|
|
25
25
|
}
|