@phpsandbox/sdk 0.0.47 → 0.0.48
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 +34 -1
- package/dist/browser/phpsandbox-sdk.esm.js +31 -4
- 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 +31 -4
- 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/git.d.ts +123 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +27 -0
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,14 +85,19 @@ const persistent = await client.notebook.create('laravel', {
|
|
|
85
85
|
persistent: true,
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
const persistentFork = await created.fork({
|
|
89
|
+
persistent: true,
|
|
90
|
+
});
|
|
91
|
+
|
|
88
92
|
console.log(persistent.data.policy);
|
|
93
|
+
console.log(persistentFork.data.policy);
|
|
89
94
|
```
|
|
90
95
|
|
|
91
96
|
Notes:
|
|
92
97
|
|
|
93
98
|
- `create()` and `fork()` initialize automatically.
|
|
94
99
|
- `open()` and `get()` return a notebook instance; call `await notebook.ready()` before using tools.
|
|
95
|
-
- API notebook creates are ephemeral by default. `persistent: true` requires an entitled account.
|
|
100
|
+
- API notebook creates and forks are ephemeral by default. `persistent: true` requires an entitled account.
|
|
96
101
|
|
|
97
102
|
## Services At A Glance
|
|
98
103
|
|
|
@@ -207,8 +212,36 @@ await notebook.git.sync(
|
|
|
207
212
|
|
|
208
213
|
const history = await notebook.git.log('main');
|
|
209
214
|
console.log(history[0]);
|
|
215
|
+
|
|
216
|
+
const review = await notebook.git.review();
|
|
217
|
+
await notebook.git.stage({ paths: review.files.filter((file) => file.unstaged).map((file) => file.path) });
|
|
218
|
+
await notebook.git.unstage({ path: 'README.md' });
|
|
219
|
+
await notebook.git.revert({ path: 'README.md' });
|
|
220
|
+
await notebook.git.revert({ path: 'staged-file.php', staged: true });
|
|
221
|
+
|
|
222
|
+
const forkUrl = 'https://git.phpsandbox.io/fork-id.git';
|
|
223
|
+
const preview = await notebook.git.diff({
|
|
224
|
+
url: forkUrl,
|
|
225
|
+
token: process.env.PHPSANDBOX_TOKEN,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
if (preview.status === 'ready') {
|
|
229
|
+
const result = await notebook.git.merge({
|
|
230
|
+
url: forkUrl,
|
|
231
|
+
token: process.env.PHPSANDBOX_TOKEN,
|
|
232
|
+
expectedBaseRef: preview.baseRef,
|
|
233
|
+
author: 'PHPSandbox <hi@phpsandbox.io>',
|
|
234
|
+
message: 'Merge fork into base',
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
if (result.status === 'conflict') {
|
|
238
|
+
console.log(result.conflicts);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
210
241
|
```
|
|
211
242
|
|
|
243
|
+
Fork diff requires the base and fork to share Git history. If they do not, `diff()` returns `status: 'unrelated'`.
|
|
244
|
+
|
|
212
245
|
### Mail
|
|
213
246
|
|
|
214
247
|
```ts
|
|
@@ -4036,6 +4036,33 @@ var Git = class {
|
|
|
4036
4036
|
log(ref = "main") {
|
|
4037
4037
|
return this.okra.invoke("git.log", { ref });
|
|
4038
4038
|
}
|
|
4039
|
+
diff(input) {
|
|
4040
|
+
return this.okra.invoke("git.diff", input);
|
|
4041
|
+
}
|
|
4042
|
+
merge(input) {
|
|
4043
|
+
return this.okra.invoke("git.merge", input);
|
|
4044
|
+
}
|
|
4045
|
+
conflicts() {
|
|
4046
|
+
return this.okra.invoke("git.conflicts", {});
|
|
4047
|
+
}
|
|
4048
|
+
abortMerge() {
|
|
4049
|
+
return this.okra.invoke("git.resolve", { action: "abort" });
|
|
4050
|
+
}
|
|
4051
|
+
continueMerge(author, message) {
|
|
4052
|
+
return this.okra.invoke("git.resolve", { action: "continue", author, message });
|
|
4053
|
+
}
|
|
4054
|
+
review() {
|
|
4055
|
+
return this.okra.invoke("git.review", {});
|
|
4056
|
+
}
|
|
4057
|
+
stage(input = { all: true }) {
|
|
4058
|
+
return this.okra.invoke("git.stage", input);
|
|
4059
|
+
}
|
|
4060
|
+
unstage(input = { all: true }) {
|
|
4061
|
+
return this.okra.invoke("git.unstage", input);
|
|
4062
|
+
}
|
|
4063
|
+
revert(input) {
|
|
4064
|
+
return this.okra.invoke("git.revert", input);
|
|
4065
|
+
}
|
|
4039
4066
|
restore(ref) {
|
|
4040
4067
|
return this.okra.invoke("git.restore", { ref });
|
|
4041
4068
|
}
|
|
@@ -4822,8 +4849,8 @@ var NotebookApi = class {
|
|
|
4822
4849
|
async delete(id) {
|
|
4823
4850
|
await this.client.delete(`/notebook/${id}`);
|
|
4824
4851
|
}
|
|
4825
|
-
async fork(id) {
|
|
4826
|
-
const response = await this.client.post(`/notebook/${id}/fork
|
|
4852
|
+
async fork(id, input = {}) {
|
|
4853
|
+
const response = await this.client.post(`/notebook/${id}/fork`, input);
|
|
4827
4854
|
return this.init(new NotebookInstance(response.data, this.client));
|
|
4828
4855
|
}
|
|
4829
4856
|
async open(id) {
|
|
@@ -5008,8 +5035,8 @@ var NotebookInstance = class {
|
|
|
5008
5035
|
};
|
|
5009
5036
|
return ready();
|
|
5010
5037
|
}
|
|
5011
|
-
fork() {
|
|
5012
|
-
return this.client.notebook.fork(this.data.id);
|
|
5038
|
+
fork(input = {}) {
|
|
5039
|
+
return this.client.notebook.fork(this.data.id, input);
|
|
5013
5040
|
}
|
|
5014
5041
|
delete() {
|
|
5015
5042
|
return this.client.notebook.delete(this.data.id).then(() => {
|