@phpsandbox/sdk 0.0.61 → 0.0.64

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.
@@ -652,8 +652,9 @@ var LspConnection = class _LspConnection {
652
652
 
653
653
  // src/composer.ts
654
654
  var Composer = class {
655
- constructor(okra) {
655
+ constructor(okra, client) {
656
656
  this.okra = okra;
657
+ this.credentials = new ComposerCredentials(client, okra.data.id);
657
658
  }
658
659
  invoke(command, args = {}, options = {}) {
659
660
  return this.okra.invoke("composer.invoke", { command, args, options });
@@ -19837,13 +19838,14 @@ var NotebookApi = class {
19837
19838
  constructor(client) {
19838
19839
  this.client = client;
19839
19840
  this.secrets = new NotebookSecretApi(client);
19841
+ this.composerCredentials = new NotebookComposerCredentialApi(client);
19840
19842
  this.preview = new NotebookPreviewApi(client);
19841
19843
  this.mail = new NotebookMailApi(client);
19842
19844
  this.deployment = new NotebookDeploymentApi(client);
19843
19845
  }
19844
19846
  async create(template, input = {}, init = true) {
19845
19847
  const response = await this.client.post("/notebook", { template, ...input });
19846
- const instance = new NotebookInstance(response.data, this.client);
19848
+ const instance = new NotebookInstance2(response.data, this.client);
19847
19849
  if (!init) {
19848
19850
  return instance;
19849
19851
  }
@@ -19851,18 +19853,18 @@ var NotebookApi = class {
19851
19853
  }
19852
19854
  async get(id) {
19853
19855
  const response = await this.client.get(`/notebook/${id}`);
19854
- return new NotebookInstance(response.data, this.client);
19856
+ return new NotebookInstance2(response.data, this.client);
19855
19857
  }
19856
19858
  async update(id, input = {}) {
19857
19859
  const response = await this.client.put(`/notebook/${id}`, input);
19858
- return new NotebookInstance(response.data, this.client);
19860
+ return new NotebookInstance2(response.data, this.client);
19859
19861
  }
19860
19862
  async delete(id) {
19861
19863
  await this.client.delete(`/notebook/${id}`);
19862
19864
  }
19863
19865
  async fork(id, input = {}) {
19864
19866
  const response = await this.client.post(`/notebook/${id}/fork`, input);
19865
- return new NotebookInstance(response.data, this.client);
19867
+ return new NotebookInstance2(response.data, this.client);
19866
19868
  }
19867
19869
  async gitCredentials(id) {
19868
19870
  const response = await this.client.post(`/notebook/${id}/git/credentials`);
@@ -19870,10 +19872,10 @@ var NotebookApi = class {
19870
19872
  }
19871
19873
  async open(id) {
19872
19874
  const response = await this.client.get(`/notebook/${id}`);
19873
- return new NotebookInstance(response.data, this.client);
19875
+ return new NotebookInstance2(response.data, this.client);
19874
19876
  }
19875
19877
  openFromData(data) {
19876
- return this.init(new NotebookInstance(data, this.client));
19878
+ return this.init(new NotebookInstance2(data, this.client));
19877
19879
  }
19878
19880
  async init(instance) {
19879
19881
  await instance.ready();
@@ -19888,7 +19890,7 @@ function normalizeApiBaseUrl(url2) {
19888
19890
  baseUrl.hash = "";
19889
19891
  return baseUrl.toString();
19890
19892
  }
19891
- var Client = class {
19893
+ var Client2 = class {
19892
19894
  constructor(token, url2 = "https://api.phpsandbox.io/v1", options = {}) {
19893
19895
  this.fetch = globalThis.fetch;
19894
19896
  this.deployments = new DeploymentApi(this);
@@ -19968,7 +19970,7 @@ var Client = class {
19968
19970
  return { data: body === "" ? void 0 : JSON.parse(body) };
19969
19971
  }
19970
19972
  };
19971
- var PHPSandbox = class extends Client {
19973
+ var PHPSandbox = class extends Client2 {
19972
19974
  };
19973
19975
  var NotebookSecretApi = class {
19974
19976
  constructor(client) {
@@ -19999,12 +20001,27 @@ var NotebookSecretApi = class {
19999
20001
  await this.client.delete(`/notebook/${id}/secrets/${encodeURIComponent(name)}${query ? `?${query}` : ""}`);
20000
20002
  }
20001
20003
  };
20004
+ var NotebookComposerCredentialApi = class {
20005
+ constructor(client) {
20006
+ this.client = client;
20007
+ }
20008
+ async set(id, input) {
20009
+ const response = await this.client.put(`/notebook/${id}/composer/credentials`, input);
20010
+ return response.data;
20011
+ }
20012
+ async remove(id, type, url2) {
20013
+ const params = new URLSearchParams({ type });
20014
+ if (url2) params.set("url", url2);
20015
+ await this.client.delete(`/notebook/${id}/composer/credentials?${params.toString()}`);
20016
+ }
20017
+ };
20002
20018
  var NotebookPreviewApi = class {
20003
20019
  constructor(client) {
20004
20020
  this.client = client;
20005
20021
  }
20006
- async get(id) {
20007
- const response = await this.client.get(`/notebook/${id}/preview`);
20022
+ async get(id, url2) {
20023
+ const query = url2 === void 0 ? "" : `?${new URLSearchParams({ url: url2 }).toString()}`;
20024
+ const response = await this.client.get(`/notebook/${id}/preview${query}`);
20008
20025
  return response.data;
20009
20026
  }
20010
20027
  async setPassword(id, input) {
@@ -20014,8 +20031,8 @@ var NotebookPreviewApi = class {
20014
20031
  async disable(id) {
20015
20032
  await this.client.delete(`/notebook/${id}/preview`);
20016
20033
  }
20017
- async createSession(id) {
20018
- const response = await this.client.post(`/notebook/${id}/preview/session`);
20034
+ async createSession(id, input) {
20035
+ const response = await this.client.post(`/notebook/${id}/preview/session`, input);
20019
20036
  return response.data;
20020
20037
  }
20021
20038
  async createHandoff(id, input) {
@@ -20053,7 +20070,7 @@ var NotebookMailApi = class {
20053
20070
  }
20054
20071
  };
20055
20072
  var _initPromise, _NotebookInstance_instances, init_fn;
20056
- var NotebookInstance = class {
20073
+ var NotebookInstance2 = class {
20057
20074
  constructor(data, client) {
20058
20075
  this.data = data;
20059
20076
  this.client = client;
@@ -20073,7 +20090,7 @@ var NotebookInstance = class {
20073
20090
  this.terminal = new Terminal(this);
20074
20091
  this.auth = new Auth(this);
20075
20092
  this.lsp = new Lsp(this);
20076
- this.composer = new Composer(this);
20093
+ this.composer = new Composer(this, client);
20077
20094
  this.log = new Log(this);
20078
20095
  this.repl = new Repl(this);
20079
20096
  this.container = new Container(this);
@@ -20215,8 +20232,8 @@ var NotebookInstance = class {
20215
20232
  this.disposables.push(disposable);
20216
20233
  return disposable;
20217
20234
  }
20218
- update() {
20219
- return this.invoke("notebook.update");
20235
+ update(input) {
20236
+ return this.client.notebook.update(this.data.id, input);
20220
20237
  }
20221
20238
  onDidInitialize(handler) {
20222
20239
  return this.listen("notebook.initialized", handler);
@@ -20277,13 +20294,25 @@ var NotebookSecrets = class {
20277
20294
  return this.client.notebook.secrets.delete(this.notebookId, name, options);
20278
20295
  }
20279
20296
  };
20297
+ var ComposerCredentials = class {
20298
+ constructor(client, notebookId) {
20299
+ this.client = client;
20300
+ this.notebookId = notebookId;
20301
+ }
20302
+ set(input) {
20303
+ return this.client.notebook.composerCredentials.set(this.notebookId, input);
20304
+ }
20305
+ remove(type, url2) {
20306
+ return this.client.notebook.composerCredentials.remove(this.notebookId, type, url2);
20307
+ }
20308
+ };
20280
20309
  var NotebookPreview = class {
20281
20310
  constructor(client, notebookId) {
20282
20311
  this.client = client;
20283
20312
  this.notebookId = notebookId;
20284
20313
  }
20285
- get() {
20286
- return this.client.notebook.preview.get(this.notebookId);
20314
+ get(url2) {
20315
+ return this.client.notebook.preview.get(this.notebookId, url2);
20287
20316
  }
20288
20317
  setPassword(input) {
20289
20318
  return this.client.notebook.preview.setPassword(this.notebookId, input);
@@ -20291,8 +20320,8 @@ var NotebookPreview = class {
20291
20320
  disable() {
20292
20321
  return this.client.notebook.preview.disable(this.notebookId);
20293
20322
  }
20294
- createSession() {
20295
- return this.client.notebook.preview.createSession(this.notebookId);
20323
+ createSession(input) {
20324
+ return this.client.notebook.preview.createSession(this.notebookId, input);
20296
20325
  }
20297
20326
  createHandoff(input) {
20298
20327
  return this.client.notebook.preview.createHandoff(this.notebookId, input);
@@ -20338,8 +20367,9 @@ export {
20338
20367
  BeaconConnectionError,
20339
20368
  BeaconError,
20340
20369
  BeaconTimeoutError,
20341
- Client,
20370
+ Client2 as Client,
20342
20371
  CommandError,
20372
+ ComposerCredentials,
20343
20373
  DeployStreamErrorSchema,
20344
20374
  DeployStreamEventSchema,
20345
20375
  DeployStreamLogEventSchema,
@@ -20381,9 +20411,10 @@ export {
20381
20411
  LspConnection,
20382
20412
  Navigator,
20383
20413
  NotebookApi,
20414
+ NotebookComposerCredentialApi,
20384
20415
  NotebookDeploymentApi,
20385
20416
  NotebookInitError,
20386
- NotebookInstance,
20417
+ NotebookInstance2 as NotebookInstance,
20387
20418
  NotebookMail,
20388
20419
  NotebookMailApi,
20389
20420
  NotebookPreview,