@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.
@@ -33,8 +33,9 @@ var PHPSandbox = (() => {
33
33
  BeaconConnectionError: () => BeaconConnectionError,
34
34
  BeaconError: () => BeaconError,
35
35
  BeaconTimeoutError: () => BeaconTimeoutError,
36
- Client: () => Client,
36
+ Client: () => Client2,
37
37
  CommandError: () => CommandError,
38
+ ComposerCredentials: () => ComposerCredentials,
38
39
  DeployStreamErrorSchema: () => DeployStreamErrorSchema,
39
40
  DeployStreamEventSchema: () => DeployStreamEventSchema,
40
41
  DeployStreamLogEventSchema: () => DeployStreamLogEventSchema,
@@ -76,9 +77,10 @@ var PHPSandbox = (() => {
76
77
  LspConnection: () => LspConnection,
77
78
  Navigator: () => Navigator,
78
79
  NotebookApi: () => NotebookApi,
80
+ NotebookComposerCredentialApi: () => NotebookComposerCredentialApi,
79
81
  NotebookDeploymentApi: () => NotebookDeploymentApi,
80
82
  NotebookInitError: () => NotebookInitError,
81
- NotebookInstance: () => NotebookInstance,
83
+ NotebookInstance: () => NotebookInstance2,
82
84
  NotebookMail: () => NotebookMail,
83
85
  NotebookMailApi: () => NotebookMailApi,
84
86
  NotebookPreview: () => NotebookPreview,
@@ -743,8 +745,9 @@ var PHPSandbox = (() => {
743
745
 
744
746
  // src/composer.ts
745
747
  var Composer = class {
746
- constructor(okra) {
748
+ constructor(okra, client) {
747
749
  this.okra = okra;
750
+ this.credentials = new ComposerCredentials(client, okra.data.id);
748
751
  }
749
752
  invoke(command, args = {}, options = {}) {
750
753
  return this.okra.invoke("composer.invoke", { command, args, options });
@@ -19928,13 +19931,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19928
19931
  constructor(client) {
19929
19932
  this.client = client;
19930
19933
  this.secrets = new NotebookSecretApi(client);
19934
+ this.composerCredentials = new NotebookComposerCredentialApi(client);
19931
19935
  this.preview = new NotebookPreviewApi(client);
19932
19936
  this.mail = new NotebookMailApi(client);
19933
19937
  this.deployment = new NotebookDeploymentApi(client);
19934
19938
  }
19935
19939
  async create(template, input = {}, init = true) {
19936
19940
  const response = await this.client.post("/notebook", { template, ...input });
19937
- const instance = new NotebookInstance(response.data, this.client);
19941
+ const instance = new NotebookInstance2(response.data, this.client);
19938
19942
  if (!init) {
19939
19943
  return instance;
19940
19944
  }
@@ -19942,18 +19946,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19942
19946
  }
19943
19947
  async get(id) {
19944
19948
  const response = await this.client.get(`/notebook/${id}`);
19945
- return new NotebookInstance(response.data, this.client);
19949
+ return new NotebookInstance2(response.data, this.client);
19946
19950
  }
19947
19951
  async update(id, input = {}) {
19948
19952
  const response = await this.client.put(`/notebook/${id}`, input);
19949
- return new NotebookInstance(response.data, this.client);
19953
+ return new NotebookInstance2(response.data, this.client);
19950
19954
  }
19951
19955
  async delete(id) {
19952
19956
  await this.client.delete(`/notebook/${id}`);
19953
19957
  }
19954
19958
  async fork(id, input = {}) {
19955
19959
  const response = await this.client.post(`/notebook/${id}/fork`, input);
19956
- return new NotebookInstance(response.data, this.client);
19960
+ return new NotebookInstance2(response.data, this.client);
19957
19961
  }
19958
19962
  async gitCredentials(id) {
19959
19963
  const response = await this.client.post(`/notebook/${id}/git/credentials`);
@@ -19961,10 +19965,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19961
19965
  }
19962
19966
  async open(id) {
19963
19967
  const response = await this.client.get(`/notebook/${id}`);
19964
- return new NotebookInstance(response.data, this.client);
19968
+ return new NotebookInstance2(response.data, this.client);
19965
19969
  }
19966
19970
  openFromData(data) {
19967
- return this.init(new NotebookInstance(data, this.client));
19971
+ return this.init(new NotebookInstance2(data, this.client));
19968
19972
  }
19969
19973
  async init(instance) {
19970
19974
  await instance.ready();
@@ -19979,7 +19983,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19979
19983
  baseUrl.hash = "";
19980
19984
  return baseUrl.toString();
19981
19985
  }
19982
- var Client = class {
19986
+ var Client2 = class {
19983
19987
  constructor(token, url2 = "https://api.phpsandbox.io/v1", options = {}) {
19984
19988
  this.fetch = globalThis.fetch;
19985
19989
  this.deployments = new DeploymentApi(this);
@@ -20059,7 +20063,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20059
20063
  return { data: body === "" ? void 0 : JSON.parse(body) };
20060
20064
  }
20061
20065
  };
20062
- var PHPSandbox = class extends Client {
20066
+ var PHPSandbox = class extends Client2 {
20063
20067
  };
20064
20068
  var NotebookSecretApi = class {
20065
20069
  constructor(client) {
@@ -20090,12 +20094,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20090
20094
  await this.client.delete(`/notebook/${id}/secrets/${encodeURIComponent(name)}${query ? `?${query}` : ""}`);
20091
20095
  }
20092
20096
  };
20097
+ var NotebookComposerCredentialApi = class {
20098
+ constructor(client) {
20099
+ this.client = client;
20100
+ }
20101
+ async set(id, input) {
20102
+ const response = await this.client.put(`/notebook/${id}/composer/credentials`, input);
20103
+ return response.data;
20104
+ }
20105
+ async remove(id, type, url2) {
20106
+ const params = new URLSearchParams({ type });
20107
+ if (url2) params.set("url", url2);
20108
+ await this.client.delete(`/notebook/${id}/composer/credentials?${params.toString()}`);
20109
+ }
20110
+ };
20093
20111
  var NotebookPreviewApi = class {
20094
20112
  constructor(client) {
20095
20113
  this.client = client;
20096
20114
  }
20097
- async get(id) {
20098
- const response = await this.client.get(`/notebook/${id}/preview`);
20115
+ async get(id, url2) {
20116
+ const query = url2 === void 0 ? "" : `?${new URLSearchParams({ url: url2 }).toString()}`;
20117
+ const response = await this.client.get(`/notebook/${id}/preview${query}`);
20099
20118
  return response.data;
20100
20119
  }
20101
20120
  async setPassword(id, input) {
@@ -20105,8 +20124,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20105
20124
  async disable(id) {
20106
20125
  await this.client.delete(`/notebook/${id}/preview`);
20107
20126
  }
20108
- async createSession(id) {
20109
- const response = await this.client.post(`/notebook/${id}/preview/session`);
20127
+ async createSession(id, input) {
20128
+ const response = await this.client.post(`/notebook/${id}/preview/session`, input);
20110
20129
  return response.data;
20111
20130
  }
20112
20131
  async createHandoff(id, input) {
@@ -20144,7 +20163,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20144
20163
  }
20145
20164
  };
20146
20165
  var _initPromise, _NotebookInstance_instances, init_fn;
20147
- var NotebookInstance = class {
20166
+ var NotebookInstance2 = class {
20148
20167
  constructor(data, client) {
20149
20168
  this.data = data;
20150
20169
  this.client = client;
@@ -20164,7 +20183,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20164
20183
  this.terminal = new Terminal(this);
20165
20184
  this.auth = new Auth(this);
20166
20185
  this.lsp = new Lsp(this);
20167
- this.composer = new Composer(this);
20186
+ this.composer = new Composer(this, client);
20168
20187
  this.log = new Log(this);
20169
20188
  this.repl = new Repl(this);
20170
20189
  this.container = new Container(this);
@@ -20306,8 +20325,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20306
20325
  this.disposables.push(disposable);
20307
20326
  return disposable;
20308
20327
  }
20309
- update() {
20310
- return this.invoke("notebook.update");
20328
+ update(input) {
20329
+ return this.client.notebook.update(this.data.id, input);
20311
20330
  }
20312
20331
  onDidInitialize(handler) {
20313
20332
  return this.listen("notebook.initialized", handler);
@@ -20368,13 +20387,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20368
20387
  return this.client.notebook.secrets.delete(this.notebookId, name, options);
20369
20388
  }
20370
20389
  };
20390
+ var ComposerCredentials = class {
20391
+ constructor(client, notebookId) {
20392
+ this.client = client;
20393
+ this.notebookId = notebookId;
20394
+ }
20395
+ set(input) {
20396
+ return this.client.notebook.composerCredentials.set(this.notebookId, input);
20397
+ }
20398
+ remove(type, url2) {
20399
+ return this.client.notebook.composerCredentials.remove(this.notebookId, type, url2);
20400
+ }
20401
+ };
20371
20402
  var NotebookPreview = class {
20372
20403
  constructor(client, notebookId) {
20373
20404
  this.client = client;
20374
20405
  this.notebookId = notebookId;
20375
20406
  }
20376
- get() {
20377
- return this.client.notebook.preview.get(this.notebookId);
20407
+ get(url2) {
20408
+ return this.client.notebook.preview.get(this.notebookId, url2);
20378
20409
  }
20379
20410
  setPassword(input) {
20380
20411
  return this.client.notebook.preview.setPassword(this.notebookId, input);
@@ -20382,8 +20413,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20382
20413
  disable() {
20383
20414
  return this.client.notebook.preview.disable(this.notebookId);
20384
20415
  }
20385
- createSession() {
20386
- return this.client.notebook.preview.createSession(this.notebookId);
20416
+ createSession(input) {
20417
+ return this.client.notebook.preview.createSession(this.notebookId, input);
20387
20418
  }
20388
20419
  createHandoff(input) {
20389
20420
  return this.client.notebook.preview.createHandoff(this.notebookId, input);