@phpsandbox/sdk 0.0.23 → 0.0.26
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 +59 -15
- 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 +59 -15
- 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/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +11 -13
- package/dist/events/index.js.map +1 -1
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -8
- package/dist/index.js.map +1 -1
- package/dist/socket/index.d.ts +4 -0
- package/dist/socket/index.d.ts.map +1 -1
- package/dist/socket/index.js +6 -0
- package/dist/socket/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -3032,6 +3032,12 @@ var Transport = class {
|
|
|
3032
3032
|
console[level](`[Transport ${timestamp}] ${message}${logData ? "\n" + logData : ""}`);
|
|
3033
3033
|
}
|
|
3034
3034
|
}
|
|
3035
|
+
/**
|
|
3036
|
+
* Ensure the websocket is open without requiring an application-level roundtrip.
|
|
3037
|
+
*/
|
|
3038
|
+
connect() {
|
|
3039
|
+
return __privateMethod(this, _Transport_instances, connect_fn).call(this);
|
|
3040
|
+
}
|
|
3035
3041
|
id() {
|
|
3036
3042
|
return this.clientId;
|
|
3037
3043
|
}
|
|
@@ -3764,39 +3770,37 @@ function mittWithOnce(all) {
|
|
|
3764
3770
|
};
|
|
3765
3771
|
return inst;
|
|
3766
3772
|
}
|
|
3767
|
-
var EE = mittWithOnce();
|
|
3768
3773
|
var EventManager = class _EventManager {
|
|
3774
|
+
constructor() {
|
|
3775
|
+
this.emitter = mittWithOnce();
|
|
3776
|
+
}
|
|
3769
3777
|
listen(event, callback) {
|
|
3770
3778
|
const dispose = () => {
|
|
3771
3779
|
this.removeListener(event, callback);
|
|
3772
3780
|
};
|
|
3773
|
-
|
|
3781
|
+
this.emitter.on(event, callback);
|
|
3774
3782
|
return { dispose };
|
|
3775
3783
|
}
|
|
3776
3784
|
emit(event, data) {
|
|
3777
|
-
|
|
3785
|
+
this.emitter.emit(event, data);
|
|
3778
3786
|
}
|
|
3779
3787
|
once(event, callback) {
|
|
3780
|
-
|
|
3788
|
+
this.emitter.once(event, callback);
|
|
3781
3789
|
}
|
|
3782
3790
|
static make() {
|
|
3783
|
-
return
|
|
3791
|
+
return new _EventManager();
|
|
3784
3792
|
}
|
|
3785
3793
|
static refresh() {
|
|
3786
|
-
|
|
3787
|
-
EE = mittWithOnce();
|
|
3788
|
-
return _EventManager.instance = new _EventManager();
|
|
3794
|
+
return new _EventManager();
|
|
3789
3795
|
}
|
|
3790
3796
|
removeListener(event, callbackSignature) {
|
|
3791
|
-
|
|
3797
|
+
this.emitter.off(event, callbackSignature);
|
|
3792
3798
|
}
|
|
3793
3799
|
static createInstance() {
|
|
3794
|
-
|
|
3795
|
-
_EventManager.instance = new _EventManager();
|
|
3796
|
-
return _EventManager.instance;
|
|
3800
|
+
return new _EventManager();
|
|
3797
3801
|
}
|
|
3798
3802
|
inspect() {
|
|
3799
|
-
return
|
|
3803
|
+
return this.emitter.all;
|
|
3800
3804
|
}
|
|
3801
3805
|
};
|
|
3802
3806
|
|
|
@@ -4566,6 +4570,7 @@ var ApiError = class extends Error {
|
|
|
4566
4570
|
var NotebookApi = class {
|
|
4567
4571
|
constructor(client) {
|
|
4568
4572
|
this.client = client;
|
|
4573
|
+
this.secrets = new NotebookSecretApi(client);
|
|
4569
4574
|
}
|
|
4570
4575
|
async create(template, input = {}, init = true) {
|
|
4571
4576
|
const response = await this.client.post("/notebook", { template, ...input });
|
|
@@ -4640,11 +4645,32 @@ var Client = class {
|
|
|
4640
4645
|
if (!response.ok) {
|
|
4641
4646
|
throw new ApiError(response, await response.text());
|
|
4642
4647
|
}
|
|
4643
|
-
|
|
4648
|
+
if (response.status === 204) {
|
|
4649
|
+
return { data: void 0 };
|
|
4650
|
+
}
|
|
4651
|
+
const body = await response.text();
|
|
4652
|
+
return { data: body === "" ? void 0 : JSON.parse(body) };
|
|
4644
4653
|
}
|
|
4645
4654
|
};
|
|
4646
4655
|
var PHPSandbox = class extends Client {
|
|
4647
4656
|
};
|
|
4657
|
+
var NotebookSecretApi = class {
|
|
4658
|
+
constructor(client) {
|
|
4659
|
+
this.client = client;
|
|
4660
|
+
}
|
|
4661
|
+
async list(id) {
|
|
4662
|
+
const response = await this.client.get(`/notebook/${id}/secrets`);
|
|
4663
|
+
return response.data;
|
|
4664
|
+
}
|
|
4665
|
+
async set(id, name, input) {
|
|
4666
|
+
const payload = typeof input === "string" ? { value: input } : input;
|
|
4667
|
+
const response = await this.client.put(`/notebook/${id}/secrets/${encodeURIComponent(name)}`, payload);
|
|
4668
|
+
return response.data;
|
|
4669
|
+
}
|
|
4670
|
+
async delete(id, name) {
|
|
4671
|
+
await this.client.delete(`/notebook/${id}/secrets/${encodeURIComponent(name)}`);
|
|
4672
|
+
}
|
|
4673
|
+
};
|
|
4648
4674
|
var _initPromise, _NotebookInstance_instances, init_fn;
|
|
4649
4675
|
var NotebookInstance = class {
|
|
4650
4676
|
constructor(data, client) {
|
|
@@ -4672,11 +4698,12 @@ var NotebookInstance = class {
|
|
|
4672
4698
|
this.laravel = new Lravel(this);
|
|
4673
4699
|
this.shell = new Shell(this);
|
|
4674
4700
|
this.git = new Git(this);
|
|
4701
|
+
this.secrets = new NotebookSecrets(client, this.data.id);
|
|
4675
4702
|
}
|
|
4676
4703
|
async ready() {
|
|
4677
4704
|
const ready = async () => {
|
|
4678
4705
|
if (this.client.options.startClosed && !this.socket.isConnected) {
|
|
4679
|
-
await this.socket.
|
|
4706
|
+
await this.socket.connect();
|
|
4680
4707
|
}
|
|
4681
4708
|
return __privateGet(this, _initPromise);
|
|
4682
4709
|
};
|
|
@@ -4793,6 +4820,21 @@ init_fn = function() {
|
|
|
4793
4820
|
}));
|
|
4794
4821
|
return __privateGet(this, _initPromise);
|
|
4795
4822
|
};
|
|
4823
|
+
var NotebookSecrets = class {
|
|
4824
|
+
constructor(client, notebookId) {
|
|
4825
|
+
this.client = client;
|
|
4826
|
+
this.notebookId = notebookId;
|
|
4827
|
+
}
|
|
4828
|
+
list() {
|
|
4829
|
+
return this.client.notebook.secrets.list(this.notebookId);
|
|
4830
|
+
}
|
|
4831
|
+
set(name, input) {
|
|
4832
|
+
return this.client.notebook.secrets.set(this.notebookId, name, input);
|
|
4833
|
+
}
|
|
4834
|
+
delete(name) {
|
|
4835
|
+
return this.client.notebook.secrets.delete(this.notebookId, name);
|
|
4836
|
+
}
|
|
4837
|
+
};
|
|
4796
4838
|
export {
|
|
4797
4839
|
ApiError,
|
|
4798
4840
|
Beacon,
|
|
@@ -4812,6 +4854,8 @@ export {
|
|
|
4812
4854
|
NotebookApi,
|
|
4813
4855
|
NotebookInitError,
|
|
4814
4856
|
NotebookInstance,
|
|
4857
|
+
NotebookSecretApi,
|
|
4858
|
+
NotebookSecrets,
|
|
4815
4859
|
NotebookState,
|
|
4816
4860
|
PHPSandbox,
|
|
4817
4861
|
PHPSandboxError,
|