@wp-playground/client 0.6.2 → 0.6.3

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 +49 -23
  3. package/index.d.ts +32 -25
  4. package/index.js +1878 -1776
  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,9 @@ export interface PHPRunOptions {
661
654
  */
662
655
  headers?: PHPRequestHeaders;
663
656
  /**
664
- * Request body without the files.
665
- */
666
- body?: string;
667
- /**
668
- * Uploaded files.
657
+ * Request body.
669
658
  */
670
- fileInfos?: FileInfo[];
659
+ body?: string | Uint8Array;
671
660
  /**
672
661
  * The code snippet to eval instead of a php file.
673
662
  */
@@ -689,12 +678,6 @@ export interface PHPOutput {
689
678
  /** Stderr lines */
690
679
  stderr: string[];
691
680
  }
692
- export interface FileInfo {
693
- key: string;
694
- name: string;
695
- type: string;
696
- data: Uint8Array;
697
- }
698
681
  export interface RmDirOptions {
699
682
  /**
700
683
  * If true, recursively removes the directory and all its contents.
@@ -1879,6 +1862,30 @@ export interface EnableMultisiteStep {
1879
1862
  * @param enableMultisite
1880
1863
  */
1881
1864
  export declare const enableMultisite: StepHandler<EnableMultisiteStep>;
1865
+ /**
1866
+ * @inheritDoc wpCLI
1867
+ * @hasRunnableExample
1868
+ * @example
1869
+ *
1870
+ * <code>
1871
+ * {
1872
+ * "step": "wpCLI",
1873
+ * "command": "wp post create --post_title='Test post' --post_excerpt='Some content'"
1874
+ * }
1875
+ * </code>
1876
+ */
1877
+ export interface WPCLIStep {
1878
+ /** The step identifier. */
1879
+ step: "wp-cli";
1880
+ /** The WP CLI command to run. */
1881
+ command: string | string[];
1882
+ /** wp-cli.phar path */
1883
+ wpCliPath?: string;
1884
+ }
1885
+ /**
1886
+ * Runs PHP code.
1887
+ */
1888
+ export declare const wpCLI: StepHandler<WPCLIStep, Promise<PHPResponse>>;
1882
1889
  /**
1883
1890
  * Used by the export step to exclude the Playground-specific files
1884
1891
  * from the zip file. Keep it in sync with the list of files created
@@ -1896,7 +1903,7 @@ export type StepDefinition = Step & {
1896
1903
  * If you add a step here, make sure to also
1897
1904
  * add it to the exports below.
1898
1905
  */
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>;
1906
+ 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
1907
  /**
1901
1908
  * Progress reporting details.
1902
1909
  */