@wp-playground/client 0.6.2 → 0.6.4

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.
Files changed (5) hide show
  1. package/README.md +1 -1
  2. package/index.cjs +50 -24
  3. package/index.d.ts +34 -23
  4. package/index.js +2092 -1844
  5. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -317,7 +317,7 @@ export interface RequestHandler {
317
317
  * headers: {
318
318
  * 'X-foo': 'bar',
319
319
  * },
320
- * formData: {
320
+ * body: {
321
321
  * foo: 'bar',
322
322
  * },
323
323
  * });
@@ -626,18 +626,11 @@ export interface PHPRequest {
626
626
  */
627
627
  headers?: PHPRequestHeaders;
628
628
  /**
629
- * Uploaded files
629
+ * Request body.
630
+ * If an object is given, the request will be encoded as multipart
631
+ * and sent with a `multipart/form-data` header.
630
632
  */
631
- files?: Record<string, File>;
632
- /**
633
- * Request body without the files.
634
- */
635
- body?: string;
636
- /**
637
- * Form data. If set, the request body will be ignored and
638
- * the content-type header will be set to `application/x-www-form-urlencoded`.
639
- */
640
- formData?: Record<string, unknown>;
633
+ body?: string | Uint8Array | Record<string, string | Uint8Array | File>;
641
634
  }
642
635
  export interface PHPRunOptions {
643
636
  /**
@@ -661,13 +654,13 @@ export interface PHPRunOptions {
661
654
  */
662
655
  headers?: PHPRequestHeaders;
663
656
  /**
664
- * Request body without the files.
657
+ * Request body.
665
658
  */
666
- body?: string;
659
+ body?: string | Uint8Array;
667
660
  /**
668
- * Uploaded files.
661
+ * Environment variables to set for this run.
669
662
  */
670
- fileInfos?: FileInfo[];
663
+ env?: Record<string, string>;
671
664
  /**
672
665
  * The code snippet to eval instead of a php file.
673
666
  */
@@ -689,12 +682,6 @@ export interface PHPOutput {
689
682
  /** Stderr lines */
690
683
  stderr: string[];
691
684
  }
692
- export interface FileInfo {
693
- key: string;
694
- name: string;
695
- type: string;
696
- data: Uint8Array;
697
- }
698
685
  export interface RmDirOptions {
699
686
  /**
700
687
  * If true, recursively removes the directory and all its contents.
@@ -1879,6 +1866,30 @@ export interface EnableMultisiteStep {
1879
1866
  * @param enableMultisite
1880
1867
  */
1881
1868
  export declare const enableMultisite: StepHandler<EnableMultisiteStep>;
1869
+ /**
1870
+ * @inheritDoc wpCLI
1871
+ * @hasRunnableExample
1872
+ * @example
1873
+ *
1874
+ * <code>
1875
+ * {
1876
+ * "step": "wpCLI",
1877
+ * "command": "wp post create --post_title='Test post' --post_excerpt='Some content'"
1878
+ * }
1879
+ * </code>
1880
+ */
1881
+ export interface WPCLIStep {
1882
+ /** The step identifier. */
1883
+ step: "wp-cli";
1884
+ /** The WP CLI command to run. */
1885
+ command: string | string[];
1886
+ /** wp-cli.phar path */
1887
+ wpCliPath?: string;
1888
+ }
1889
+ /**
1890
+ * Runs PHP code.
1891
+ */
1892
+ export declare const wpCLI: StepHandler<WPCLIStep, Promise<PHPResponse>>;
1882
1893
  /**
1883
1894
  * Used by the export step to exclude the Playground-specific files
1884
1895
  * from the zip file. Keep it in sync with the list of files created
@@ -1896,7 +1907,7 @@ export type StepDefinition = Step & {
1896
1907
  * If you add a step here, make sure to also
1897
1908
  * add it to the exports below.
1898
1909
  */
1899
- export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | CpStep | DefineWpConfigConstsStep | DefineSiteUrlStep | EnableMultisiteStep | ImportFileStep<Resource> | ImportWordPressFilesStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | RunSqlStep<Resource> | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep<Resource> | UpdateUserMetaStep | WriteFileStep<Resource>;
1910
+ export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | CpStep | DefineWpConfigConstsStep | DefineSiteUrlStep | EnableMultisiteStep | ImportFileStep<Resource> | ImportWordPressFilesStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | RunSqlStep<Resource> | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep<Resource> | UpdateUserMetaStep | WriteFileStep<Resource> | WPCLIStep;
1900
1911
  /**
1901
1912
  * Progress reporting details.
1902
1913
  */