@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
|
@@ -333,6 +333,8 @@ var PHPSandbox = (() => {
|
|
|
333
333
|
NotebookApi: () => NotebookApi,
|
|
334
334
|
NotebookInitError: () => NotebookInitError,
|
|
335
335
|
NotebookInstance: () => NotebookInstance,
|
|
336
|
+
NotebookSecretApi: () => NotebookSecretApi,
|
|
337
|
+
NotebookSecrets: () => NotebookSecrets,
|
|
336
338
|
NotebookState: () => NotebookState,
|
|
337
339
|
PHPSandbox: () => PHPSandbox,
|
|
338
340
|
PHPSandboxError: () => PHPSandboxError,
|
|
@@ -3072,6 +3074,12 @@ var PHPSandbox = (() => {
|
|
|
3072
3074
|
console[level](`[Transport ${timestamp}] ${message}${logData ? "\n" + logData : ""}`);
|
|
3073
3075
|
}
|
|
3074
3076
|
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Ensure the websocket is open without requiring an application-level roundtrip.
|
|
3079
|
+
*/
|
|
3080
|
+
connect() {
|
|
3081
|
+
return __privateMethod(this, _Transport_instances, connect_fn).call(this);
|
|
3082
|
+
}
|
|
3075
3083
|
id() {
|
|
3076
3084
|
return this.clientId;
|
|
3077
3085
|
}
|
|
@@ -3804,39 +3812,37 @@ var PHPSandbox = (() => {
|
|
|
3804
3812
|
};
|
|
3805
3813
|
return inst;
|
|
3806
3814
|
}
|
|
3807
|
-
var EE = mittWithOnce();
|
|
3808
3815
|
var EventManager = class _EventManager {
|
|
3816
|
+
constructor() {
|
|
3817
|
+
this.emitter = mittWithOnce();
|
|
3818
|
+
}
|
|
3809
3819
|
listen(event, callback) {
|
|
3810
3820
|
const dispose = () => {
|
|
3811
3821
|
this.removeListener(event, callback);
|
|
3812
3822
|
};
|
|
3813
|
-
|
|
3823
|
+
this.emitter.on(event, callback);
|
|
3814
3824
|
return { dispose };
|
|
3815
3825
|
}
|
|
3816
3826
|
emit(event, data) {
|
|
3817
|
-
|
|
3827
|
+
this.emitter.emit(event, data);
|
|
3818
3828
|
}
|
|
3819
3829
|
once(event, callback) {
|
|
3820
|
-
|
|
3830
|
+
this.emitter.once(event, callback);
|
|
3821
3831
|
}
|
|
3822
3832
|
static make() {
|
|
3823
|
-
return
|
|
3833
|
+
return new _EventManager();
|
|
3824
3834
|
}
|
|
3825
3835
|
static refresh() {
|
|
3826
|
-
|
|
3827
|
-
EE = mittWithOnce();
|
|
3828
|
-
return _EventManager.instance = new _EventManager();
|
|
3836
|
+
return new _EventManager();
|
|
3829
3837
|
}
|
|
3830
3838
|
removeListener(event, callbackSignature) {
|
|
3831
|
-
|
|
3839
|
+
this.emitter.off(event, callbackSignature);
|
|
3832
3840
|
}
|
|
3833
3841
|
static createInstance() {
|
|
3834
|
-
|
|
3835
|
-
_EventManager.instance = new _EventManager();
|
|
3836
|
-
return _EventManager.instance;
|
|
3842
|
+
return new _EventManager();
|
|
3837
3843
|
}
|
|
3838
3844
|
inspect() {
|
|
3839
|
-
return
|
|
3845
|
+
return this.emitter.all;
|
|
3840
3846
|
}
|
|
3841
3847
|
};
|
|
3842
3848
|
|
|
@@ -4606,6 +4612,7 @@ var PHPSandbox = (() => {
|
|
|
4606
4612
|
var NotebookApi = class {
|
|
4607
4613
|
constructor(client) {
|
|
4608
4614
|
this.client = client;
|
|
4615
|
+
this.secrets = new NotebookSecretApi(client);
|
|
4609
4616
|
}
|
|
4610
4617
|
async create(template, input = {}, init = true) {
|
|
4611
4618
|
const response = await this.client.post("/notebook", { template, ...input });
|
|
@@ -4680,11 +4687,32 @@ var PHPSandbox = (() => {
|
|
|
4680
4687
|
if (!response.ok) {
|
|
4681
4688
|
throw new ApiError(response, await response.text());
|
|
4682
4689
|
}
|
|
4683
|
-
|
|
4690
|
+
if (response.status === 204) {
|
|
4691
|
+
return { data: void 0 };
|
|
4692
|
+
}
|
|
4693
|
+
const body = await response.text();
|
|
4694
|
+
return { data: body === "" ? void 0 : JSON.parse(body) };
|
|
4684
4695
|
}
|
|
4685
4696
|
};
|
|
4686
4697
|
var PHPSandbox = class extends Client {
|
|
4687
4698
|
};
|
|
4699
|
+
var NotebookSecretApi = class {
|
|
4700
|
+
constructor(client) {
|
|
4701
|
+
this.client = client;
|
|
4702
|
+
}
|
|
4703
|
+
async list(id) {
|
|
4704
|
+
const response = await this.client.get(`/notebook/${id}/secrets`);
|
|
4705
|
+
return response.data;
|
|
4706
|
+
}
|
|
4707
|
+
async set(id, name, input) {
|
|
4708
|
+
const payload = typeof input === "string" ? { value: input } : input;
|
|
4709
|
+
const response = await this.client.put(`/notebook/${id}/secrets/${encodeURIComponent(name)}`, payload);
|
|
4710
|
+
return response.data;
|
|
4711
|
+
}
|
|
4712
|
+
async delete(id, name) {
|
|
4713
|
+
await this.client.delete(`/notebook/${id}/secrets/${encodeURIComponent(name)}`);
|
|
4714
|
+
}
|
|
4715
|
+
};
|
|
4688
4716
|
var _initPromise, _NotebookInstance_instances, init_fn;
|
|
4689
4717
|
var NotebookInstance = class {
|
|
4690
4718
|
constructor(data, client) {
|
|
@@ -4712,11 +4740,12 @@ var PHPSandbox = (() => {
|
|
|
4712
4740
|
this.laravel = new Lravel(this);
|
|
4713
4741
|
this.shell = new Shell(this);
|
|
4714
4742
|
this.git = new Git(this);
|
|
4743
|
+
this.secrets = new NotebookSecrets(client, this.data.id);
|
|
4715
4744
|
}
|
|
4716
4745
|
async ready() {
|
|
4717
4746
|
const ready = async () => {
|
|
4718
4747
|
if (this.client.options.startClosed && !this.socket.isConnected) {
|
|
4719
|
-
await this.socket.
|
|
4748
|
+
await this.socket.connect();
|
|
4720
4749
|
}
|
|
4721
4750
|
return __privateGet(this, _initPromise);
|
|
4722
4751
|
};
|
|
@@ -4833,6 +4862,21 @@ var PHPSandbox = (() => {
|
|
|
4833
4862
|
}));
|
|
4834
4863
|
return __privateGet(this, _initPromise);
|
|
4835
4864
|
};
|
|
4865
|
+
var NotebookSecrets = class {
|
|
4866
|
+
constructor(client, notebookId) {
|
|
4867
|
+
this.client = client;
|
|
4868
|
+
this.notebookId = notebookId;
|
|
4869
|
+
}
|
|
4870
|
+
list() {
|
|
4871
|
+
return this.client.notebook.secrets.list(this.notebookId);
|
|
4872
|
+
}
|
|
4873
|
+
set(name, input) {
|
|
4874
|
+
return this.client.notebook.secrets.set(this.notebookId, name, input);
|
|
4875
|
+
}
|
|
4876
|
+
delete(name) {
|
|
4877
|
+
return this.client.notebook.secrets.delete(this.notebookId, name);
|
|
4878
|
+
}
|
|
4879
|
+
};
|
|
4836
4880
|
return __toCommonJS(index_exports);
|
|
4837
4881
|
})();
|
|
4838
4882
|
/*! Bundled license information:
|