@phpsandbox/sdk 0.0.36 → 0.0.37
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/README.md +17 -0
- package/dist/browser/phpsandbox-sdk.esm.js +67 -0
- 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 +67 -0
- 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 +53 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,6 +110,7 @@ Each `NotebookInstance` exposes service clients:
|
|
|
110
110
|
- `notebook.auth` (`Auth`)
|
|
111
111
|
- `notebook.log` (`Log`)
|
|
112
112
|
- `notebook.services` (`Services`)
|
|
113
|
+
- `notebook.mail` (`NotebookMail`)
|
|
113
114
|
|
|
114
115
|
Notes:
|
|
115
116
|
|
|
@@ -208,6 +209,22 @@ const history = await notebook.git.log('main');
|
|
|
208
209
|
console.log(history[0]);
|
|
209
210
|
```
|
|
210
211
|
|
|
212
|
+
### Mail
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
const state = await notebook.mail.status();
|
|
216
|
+
|
|
217
|
+
if (!state.enabled) {
|
|
218
|
+
await notebook.mail.enable();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const mails = await notebook.mail.list();
|
|
222
|
+
const mail = await notebook.mail.get(mails.data[0].hash);
|
|
223
|
+
|
|
224
|
+
await notebook.mail.delete(mail.hash);
|
|
225
|
+
await notebook.mail.disable();
|
|
226
|
+
```
|
|
227
|
+
|
|
211
228
|
### Events
|
|
212
229
|
|
|
213
230
|
```ts
|
|
@@ -4972,6 +4972,7 @@ var NotebookApi = class {
|
|
|
4972
4972
|
this.client = client;
|
|
4973
4973
|
this.secrets = new NotebookSecretApi(client);
|
|
4974
4974
|
this.previewAuth = new NotebookPreviewAuthApi(client);
|
|
4975
|
+
this.mail = new NotebookMailApi(client);
|
|
4975
4976
|
}
|
|
4976
4977
|
async create(template, input = {}, init = true) {
|
|
4977
4978
|
const response = await this.client.post("/notebook", { template, ...input });
|
|
@@ -5094,6 +5095,35 @@ var NotebookPreviewAuthApi = class {
|
|
|
5094
5095
|
await this.client.delete(`/notebook/${id}/preview-auth`);
|
|
5095
5096
|
}
|
|
5096
5097
|
};
|
|
5098
|
+
var NotebookMailApi = class {
|
|
5099
|
+
constructor(client) {
|
|
5100
|
+
this.client = client;
|
|
5101
|
+
}
|
|
5102
|
+
async status(id) {
|
|
5103
|
+
const response = await this.client.get(`/notebook/${id}/mail`);
|
|
5104
|
+
return response.data;
|
|
5105
|
+
}
|
|
5106
|
+
async enable(id) {
|
|
5107
|
+
const response = await this.client.put(`/notebook/${id}/mail`);
|
|
5108
|
+
return response.data;
|
|
5109
|
+
}
|
|
5110
|
+
async disable(id) {
|
|
5111
|
+
await this.client.delete(`/notebook/${id}/mail`);
|
|
5112
|
+
}
|
|
5113
|
+
async list(id, options = {}) {
|
|
5114
|
+
const response = await this.client.get(
|
|
5115
|
+
`/notebook/${id}/mails${formatQueryString(options)}`
|
|
5116
|
+
);
|
|
5117
|
+
return response.data;
|
|
5118
|
+
}
|
|
5119
|
+
async get(id, hash) {
|
|
5120
|
+
const response = await this.client.get(`/notebook/${id}/mails/${encodeURIComponent(hash)}`);
|
|
5121
|
+
return response.data;
|
|
5122
|
+
}
|
|
5123
|
+
async delete(id, hash) {
|
|
5124
|
+
await this.client.delete(`/notebook/${id}/mails/${encodeURIComponent(hash)}`);
|
|
5125
|
+
}
|
|
5126
|
+
};
|
|
5097
5127
|
var _initPromise, _NotebookInstance_instances, init_fn;
|
|
5098
5128
|
var NotebookInstance = class {
|
|
5099
5129
|
constructor(data, client) {
|
|
@@ -5125,6 +5155,7 @@ var NotebookInstance = class {
|
|
|
5125
5155
|
this.services = new Services(this);
|
|
5126
5156
|
this.secrets = new NotebookSecrets(client, this.data.id);
|
|
5127
5157
|
this.previewAuth = new NotebookPreviewAuth(client, this.data.id);
|
|
5158
|
+
this.mail = new NotebookMail(client, this.data.id);
|
|
5128
5159
|
}
|
|
5129
5160
|
async ready() {
|
|
5130
5161
|
const terminalError = this.socket.getTerminalError();
|
|
@@ -5313,6 +5344,40 @@ var NotebookPreviewAuth = class {
|
|
|
5313
5344
|
return this.client.notebook.previewAuth.delete(this.notebookId);
|
|
5314
5345
|
}
|
|
5315
5346
|
};
|
|
5347
|
+
var NotebookMail = class {
|
|
5348
|
+
constructor(client, notebookId) {
|
|
5349
|
+
this.client = client;
|
|
5350
|
+
this.notebookId = notebookId;
|
|
5351
|
+
}
|
|
5352
|
+
status() {
|
|
5353
|
+
return this.client.notebook.mail.status(this.notebookId);
|
|
5354
|
+
}
|
|
5355
|
+
enable() {
|
|
5356
|
+
return this.client.notebook.mail.enable(this.notebookId);
|
|
5357
|
+
}
|
|
5358
|
+
disable() {
|
|
5359
|
+
return this.client.notebook.mail.disable(this.notebookId);
|
|
5360
|
+
}
|
|
5361
|
+
list(options = {}) {
|
|
5362
|
+
return this.client.notebook.mail.list(this.notebookId, options);
|
|
5363
|
+
}
|
|
5364
|
+
get(hash) {
|
|
5365
|
+
return this.client.notebook.mail.get(this.notebookId, hash);
|
|
5366
|
+
}
|
|
5367
|
+
delete(hash) {
|
|
5368
|
+
return this.client.notebook.mail.delete(this.notebookId, hash);
|
|
5369
|
+
}
|
|
5370
|
+
};
|
|
5371
|
+
function formatQueryString(params) {
|
|
5372
|
+
const searchParams = new URLSearchParams();
|
|
5373
|
+
for (const [key, value] of Object.entries(params)) {
|
|
5374
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
5375
|
+
searchParams.set(key, String(value));
|
|
5376
|
+
}
|
|
5377
|
+
}
|
|
5378
|
+
const query = searchParams.toString();
|
|
5379
|
+
return query === "" ? "" : `?${query}`;
|
|
5380
|
+
}
|
|
5316
5381
|
export {
|
|
5317
5382
|
ApiError,
|
|
5318
5383
|
Beacon,
|
|
@@ -5332,6 +5397,8 @@ export {
|
|
|
5332
5397
|
NotebookApi,
|
|
5333
5398
|
NotebookInitError,
|
|
5334
5399
|
NotebookInstance,
|
|
5400
|
+
NotebookMail,
|
|
5401
|
+
NotebookMailApi,
|
|
5335
5402
|
NotebookPreviewAuth,
|
|
5336
5403
|
NotebookPreviewAuthApi,
|
|
5337
5404
|
NotebookSecretApi,
|