@phpsandbox/sdk 0.0.17 → 0.0.19

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.
@@ -3821,8 +3821,11 @@ var PHPSandbox = (() => {
3821
3821
  constructor(okra) {
3822
3822
  this.okra = okra;
3823
3823
  }
3824
- checkpoint(author, message, branch = "main") {
3825
- return this.okra.invoke("git.checkpoint", { author, message, branch });
3824
+ checkpoint(author, message, branch = "main", allowEmpty = false) {
3825
+ return this.okra.invoke("git.checkpoint", { author, message, branch, allowEmpty });
3826
+ }
3827
+ checkout(branch, create = true) {
3828
+ return this.okra.invoke("git.checkout", { branch, create });
3826
3829
  }
3827
3830
  sync(url, author, ref = "main", token, direction = "both", force = false) {
3828
3831
  return this.okra.invoke("git.sync", { url, author, ref, token, direction, force });
@@ -3833,6 +3836,9 @@ var PHPSandbox = (() => {
3833
3836
  restore(ref) {
3834
3837
  return this.okra.invoke("git.restore", { ref });
3835
3838
  }
3839
+ status() {
3840
+ return this.okra.invoke("git.status", {});
3841
+ }
3836
3842
  };
3837
3843
 
3838
3844
  // src/beacon/index.ts
@@ -4558,9 +4564,11 @@ var PHPSandbox = (() => {
4558
4564
 
4559
4565
  // src/index.ts
4560
4566
  var NotebookInitError = class extends Error {
4561
- constructor(message) {
4567
+ constructor(message, data = {}) {
4562
4568
  super(message);
4563
4569
  this.message = message;
4570
+ this.data = data;
4571
+ this.name = "NotebookInitError";
4564
4572
  }
4565
4573
  };
4566
4574
  var ApiError = class extends Error {
@@ -4587,6 +4595,10 @@ var PHPSandbox = (() => {
4587
4595
  const response = await this.client.get(`/notebook/${id}`);
4588
4596
  return new NotebookInstance(response.data, this.client);
4589
4597
  }
4598
+ async update(id, input = {}) {
4599
+ const response = await this.client.put(`/notebook/${id}`, input);
4600
+ return new NotebookInstance(response.data, this.client);
4601
+ }
4590
4602
  async delete(id) {
4591
4603
  await this.client.delete(`/notebook/${id}`);
4592
4604
  }
@@ -4630,6 +4642,9 @@ var PHPSandbox = (() => {
4630
4642
  delete(path) {
4631
4643
  return this.makeRequest("DELETE", path);
4632
4644
  }
4645
+ put(path, body) {
4646
+ return this.makeRequest("PUT", path, { body: body ? JSON.stringify(body) : void 0 });
4647
+ }
4633
4648
  async makeRequest(method, path, init) {
4634
4649
  const response = await this.fetch(
4635
4650
  new Request(new URL(`v1/${path.replace(/^\//, "")}`, this.baseUrl), {
@@ -4702,7 +4717,9 @@ var PHPSandbox = (() => {
4702
4717
  return this.invoke("ping");
4703
4718
  }
4704
4719
  listen(event, handler) {
4705
- return this.emitter.listen(event, handler);
4720
+ const disposable = this.emitter.listen(event, handler);
4721
+ this.disposables.push(disposable);
4722
+ return disposable;
4706
4723
  }
4707
4724
  dispose() {
4708
4725
  this.disposables.forEach((d) => d.dispose());
@@ -4760,9 +4777,7 @@ var PHPSandbox = (() => {
4760
4777
  return this.invoke("notebook.update");
4761
4778
  }
4762
4779
  onDidInitialize(handler) {
4763
- const disposable = this.listen("notebook.initialized", handler);
4764
- this.disposables.push(disposable);
4765
- return disposable;
4780
+ return this.listen("notebook.initialized", handler);
4766
4781
  }
4767
4782
  async reconnect() {
4768
4783
  const whenConnected = this.whenConnected();
@@ -4785,7 +4800,7 @@ var PHPSandbox = (() => {
4785
4800
  this.onDidInitialize((result) => {
4786
4801
  this.initialized = result;
4787
4802
  if (result.type === "error") {
4788
- reject(new NotebookInitError(result.message));
4803
+ reject(new NotebookInitError(result.message, result.data));
4789
4804
  }
4790
4805
  resolve(result);
4791
4806
  });