@phpsandbox/sdk 0.0.18 → 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.
- package/dist/browser/phpsandbox-sdk.esm.js +15 -6
- package/dist/browser/phpsandbox-sdk.esm.js.map +2 -2
- package/dist/browser/phpsandbox-sdk.esm.min.js +2 -2
- package/dist/browser/phpsandbox-sdk.esm.min.js.map +3 -3
- package/dist/browser/phpsandbox-sdk.iife.js +15 -6
- package/dist/browser/phpsandbox-sdk.iife.js.map +2 -2
- package/dist/browser/phpsandbox-sdk.iife.min.js +2 -2
- package/dist/browser/phpsandbox-sdk.iife.min.js.map +3 -3
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -4524,9 +4524,11 @@ function isBeaconSupported() {
|
|
|
4524
4524
|
|
|
4525
4525
|
// src/index.ts
|
|
4526
4526
|
var NotebookInitError = class extends Error {
|
|
4527
|
-
constructor(message) {
|
|
4527
|
+
constructor(message, data = {}) {
|
|
4528
4528
|
super(message);
|
|
4529
4529
|
this.message = message;
|
|
4530
|
+
this.data = data;
|
|
4531
|
+
this.name = "NotebookInitError";
|
|
4530
4532
|
}
|
|
4531
4533
|
};
|
|
4532
4534
|
var ApiError = class extends Error {
|
|
@@ -4553,6 +4555,10 @@ var NotebookApi = class {
|
|
|
4553
4555
|
const response = await this.client.get(`/notebook/${id}`);
|
|
4554
4556
|
return new NotebookInstance(response.data, this.client);
|
|
4555
4557
|
}
|
|
4558
|
+
async update(id, input = {}) {
|
|
4559
|
+
const response = await this.client.put(`/notebook/${id}`, input);
|
|
4560
|
+
return new NotebookInstance(response.data, this.client);
|
|
4561
|
+
}
|
|
4556
4562
|
async delete(id) {
|
|
4557
4563
|
await this.client.delete(`/notebook/${id}`);
|
|
4558
4564
|
}
|
|
@@ -4596,6 +4602,9 @@ var Client = class {
|
|
|
4596
4602
|
delete(path) {
|
|
4597
4603
|
return this.makeRequest("DELETE", path);
|
|
4598
4604
|
}
|
|
4605
|
+
put(path, body) {
|
|
4606
|
+
return this.makeRequest("PUT", path, { body: body ? JSON.stringify(body) : void 0 });
|
|
4607
|
+
}
|
|
4599
4608
|
async makeRequest(method, path, init) {
|
|
4600
4609
|
const response = await this.fetch(
|
|
4601
4610
|
new Request(new URL(`v1/${path.replace(/^\//, "")}`, this.baseUrl), {
|
|
@@ -4668,7 +4677,9 @@ var NotebookInstance = class {
|
|
|
4668
4677
|
return this.invoke("ping");
|
|
4669
4678
|
}
|
|
4670
4679
|
listen(event, handler) {
|
|
4671
|
-
|
|
4680
|
+
const disposable = this.emitter.listen(event, handler);
|
|
4681
|
+
this.disposables.push(disposable);
|
|
4682
|
+
return disposable;
|
|
4672
4683
|
}
|
|
4673
4684
|
dispose() {
|
|
4674
4685
|
this.disposables.forEach((d) => d.dispose());
|
|
@@ -4726,9 +4737,7 @@ var NotebookInstance = class {
|
|
|
4726
4737
|
return this.invoke("notebook.update");
|
|
4727
4738
|
}
|
|
4728
4739
|
onDidInitialize(handler) {
|
|
4729
|
-
|
|
4730
|
-
this.disposables.push(disposable);
|
|
4731
|
-
return disposable;
|
|
4740
|
+
return this.listen("notebook.initialized", handler);
|
|
4732
4741
|
}
|
|
4733
4742
|
async reconnect() {
|
|
4734
4743
|
const whenConnected = this.whenConnected();
|
|
@@ -4751,7 +4760,7 @@ init_fn = function() {
|
|
|
4751
4760
|
this.onDidInitialize((result) => {
|
|
4752
4761
|
this.initialized = result;
|
|
4753
4762
|
if (result.type === "error") {
|
|
4754
|
-
reject(new NotebookInitError(result.message));
|
|
4763
|
+
reject(new NotebookInitError(result.message, result.data));
|
|
4755
4764
|
}
|
|
4756
4765
|
resolve(result);
|
|
4757
4766
|
});
|