@phpsandbox/sdk 0.0.48 → 0.0.51

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 CHANGED
@@ -219,16 +219,17 @@ await notebook.git.unstage({ path: 'README.md' });
219
219
  await notebook.git.revert({ path: 'README.md' });
220
220
  await notebook.git.revert({ path: 'staged-file.php', staged: true });
221
221
 
222
- const forkUrl = 'https://git.phpsandbox.io/fork-id.git';
222
+ const fork = await notebook.fork();
223
+ const forkCredentials = await fork.git.credentials();
223
224
  const preview = await notebook.git.diff({
224
- url: forkUrl,
225
- token: process.env.PHPSANDBOX_TOKEN,
225
+ url: forkCredentials.url,
226
+ token: forkCredentials.token,
226
227
  });
227
228
 
228
229
  if (preview.status === 'ready') {
229
230
  const result = await notebook.git.merge({
230
- url: forkUrl,
231
- token: process.env.PHPSANDBOX_TOKEN,
231
+ url: forkCredentials.url,
232
+ token: forkCredentials.token,
232
233
  expectedBaseRef: preview.baseRef,
233
234
  author: 'PHPSandbox <hi@phpsandbox.io>',
234
235
  message: 'Merge fork into base',
@@ -4063,6 +4063,9 @@ var Git = class {
4063
4063
  revert(input) {
4064
4064
  return this.okra.invoke("git.revert", input);
4065
4065
  }
4066
+ credentials() {
4067
+ return this.okra.gitCredentials();
4068
+ }
4066
4069
  restore(ref) {
4067
4070
  return this.okra.invoke("git.restore", { ref });
4068
4071
  }
@@ -4853,6 +4856,10 @@ var NotebookApi = class {
4853
4856
  const response = await this.client.post(`/notebook/${id}/fork`, input);
4854
4857
  return this.init(new NotebookInstance(response.data, this.client));
4855
4858
  }
4859
+ async gitCredentials(id) {
4860
+ const response = await this.client.post(`/notebook/${id}/git/credentials`);
4861
+ return response.data;
4862
+ }
4856
4863
  async open(id) {
4857
4864
  const response = await this.client.get(`/notebook/${id}`);
4858
4865
  return new NotebookInstance(response.data, this.client);
@@ -5038,6 +5045,9 @@ var NotebookInstance = class {
5038
5045
  fork(input = {}) {
5039
5046
  return this.client.notebook.fork(this.data.id, input);
5040
5047
  }
5048
+ gitCredentials() {
5049
+ return this.client.notebook.gitCredentials(this.data.id);
5050
+ }
5041
5051
  delete() {
5042
5052
  return this.client.notebook.delete(this.data.id).then(() => {
5043
5053
  this.socket.terminate(new NotebookUnavailableError("Notebook has been deleted.", { id: this.data.id }));