@phpsandbox/sdk 0.0.61 → 0.0.63

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,6 +20001,20 @@ 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;
@@ -20053,7 +20069,7 @@ var NotebookMailApi = class {
20053
20069
  }
20054
20070
  };
20055
20071
  var _initPromise, _NotebookInstance_instances, init_fn;
20056
- var NotebookInstance = class {
20072
+ var NotebookInstance2 = class {
20057
20073
  constructor(data, client) {
20058
20074
  this.data = data;
20059
20075
  this.client = client;
@@ -20073,7 +20089,7 @@ var NotebookInstance = class {
20073
20089
  this.terminal = new Terminal(this);
20074
20090
  this.auth = new Auth(this);
20075
20091
  this.lsp = new Lsp(this);
20076
- this.composer = new Composer(this);
20092
+ this.composer = new Composer(this, client);
20077
20093
  this.log = new Log(this);
20078
20094
  this.repl = new Repl(this);
20079
20095
  this.container = new Container(this);
@@ -20215,8 +20231,8 @@ var NotebookInstance = class {
20215
20231
  this.disposables.push(disposable);
20216
20232
  return disposable;
20217
20233
  }
20218
- update() {
20219
- return this.invoke("notebook.update");
20234
+ update(input) {
20235
+ return this.client.notebook.update(this.data.id, input);
20220
20236
  }
20221
20237
  onDidInitialize(handler) {
20222
20238
  return this.listen("notebook.initialized", handler);
@@ -20277,6 +20293,18 @@ var NotebookSecrets = class {
20277
20293
  return this.client.notebook.secrets.delete(this.notebookId, name, options);
20278
20294
  }
20279
20295
  };
20296
+ var ComposerCredentials = class {
20297
+ constructor(client, notebookId) {
20298
+ this.client = client;
20299
+ this.notebookId = notebookId;
20300
+ }
20301
+ set(input) {
20302
+ return this.client.notebook.composerCredentials.set(this.notebookId, input);
20303
+ }
20304
+ remove(type, url2) {
20305
+ return this.client.notebook.composerCredentials.remove(this.notebookId, type, url2);
20306
+ }
20307
+ };
20280
20308
  var NotebookPreview = class {
20281
20309
  constructor(client, notebookId) {
20282
20310
  this.client = client;
@@ -20338,8 +20366,9 @@ export {
20338
20366
  BeaconConnectionError,
20339
20367
  BeaconError,
20340
20368
  BeaconTimeoutError,
20341
- Client,
20369
+ Client2 as Client,
20342
20370
  CommandError,
20371
+ ComposerCredentials,
20343
20372
  DeployStreamErrorSchema,
20344
20373
  DeployStreamEventSchema,
20345
20374
  DeployStreamLogEventSchema,
@@ -20381,9 +20410,10 @@ export {
20381
20410
  LspConnection,
20382
20411
  Navigator,
20383
20412
  NotebookApi,
20413
+ NotebookComposerCredentialApi,
20384
20414
  NotebookDeploymentApi,
20385
20415
  NotebookInitError,
20386
- NotebookInstance,
20416
+ NotebookInstance2 as NotebookInstance,
20387
20417
  NotebookMail,
20388
20418
  NotebookMailApi,
20389
20419
  NotebookPreview,