@phpsandbox/sdk 0.0.68 → 0.1.1
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 +10 -13
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +0 -3
- package/dist/beacon/index.d.ts +2 -0
- package/dist/beacon/index.js +5 -0
- package/dist/browser/phpsandbox-sdk.esm.js +306 -1010
- package/dist/browser/phpsandbox-sdk.esm.min.js +24 -24
- package/dist/browser/phpsandbox-sdk.iife.js +306 -1010
- package/dist/browser/phpsandbox-sdk.iife.min.js +24 -24
- package/dist/filesystem.d.ts +2 -1
- package/dist/filesystem.js +35 -2
- package/dist/index.d.ts +14 -19
- package/dist/index.js +16 -24
- package/dist/publications.d.ts +222 -0
- package/dist/{deployments.js → publications.js} +64 -69
- package/dist/repl.d.ts +0 -2
- package/dist/repl.js +0 -3
- package/dist/schemas/{deployments.d.ts → publications.d.ts} +68 -68
- package/dist/schemas/publications.js +133 -0
- package/dist/shell.d.ts +43 -22
- package/dist/shell.js +103 -75
- package/dist/terminal.d.ts +1 -3
- package/dist/terminal.js +2 -5
- package/docs/api-summary.md +13 -10
- package/docs/cdn-usage.md +4 -4
- package/docs/getting-started.md +6 -6
- package/examples/README.md +8 -9
- package/examples/basic.ts +1 -1
- package/examples/git-merge-smoke.ts +2 -2
- package/examples/laravel-load-test.ts +13 -18
- package/examples/notebook-readonly-smoke.ts +8 -8
- package/examples/publication-provider-label.ts +11 -0
- package/examples/{deploy-cloudflare-container.ts → publish-cloudflare-container.ts} +11 -11
- package/examples/{deploy-laravel-cloud.ts → publish-laravel-cloud.ts} +11 -11
- package/examples/{deploy-ssh-agent.ts → publish-ssh-agent.ts} +15 -16
- package/package.json +7 -2
- package/dist/deployments.d.ts +0 -251
- package/dist/laravel.d.ts +0 -22
- package/dist/laravel.js +0 -11
- package/dist/schemas/deployments.js +0 -133
- package/examples/deployment-provider-label.ts +0 -11
package/README.md
CHANGED
|
@@ -76,14 +76,11 @@ PHPSandbox.rest('token', 'https://api.phpsandbox.io/v1', {
|
|
|
76
76
|
const client = PHPSandbox.realtime(process.env.PHPSANDBOX_TOKEN!);
|
|
77
77
|
|
|
78
78
|
const created = await client.notebook.create('laravel');
|
|
79
|
-
const opened = await client.notebook.open('notebook-id');
|
|
80
|
-
await opened.ready();
|
|
81
|
-
|
|
82
79
|
const fetched = await client.notebook.get('notebook-id');
|
|
83
80
|
await fetched.ready();
|
|
84
81
|
|
|
85
82
|
const forked = await created.fork();
|
|
86
|
-
await forked.
|
|
83
|
+
await forked.destroy();
|
|
87
84
|
|
|
88
85
|
const persistent = await client.notebook.create('laravel', {
|
|
89
86
|
title: 'Persistent Laravel',
|
|
@@ -101,9 +98,9 @@ console.log(persistentFork.data.policy);
|
|
|
101
98
|
Notes:
|
|
102
99
|
|
|
103
100
|
- `create()` and `fork()` initialize automatically.
|
|
104
|
-
- `
|
|
101
|
+
- `get()` returns a notebook instance; call `await notebook.ready()` before using tools.
|
|
105
102
|
- API notebook creates and forks are ephemeral by default. `persistent: true` requires an entitled account.
|
|
106
|
-
- Use `NotebookData.runtimeUrl`, `runtimeUrlProvider`, and `
|
|
103
|
+
- Use `NotebookData.runtimeUrl`, `runtimeUrlProvider`, and `PublicationData.eventStreamUrl` for runtime access.
|
|
107
104
|
|
|
108
105
|
## Services At A Glance
|
|
109
106
|
|
|
@@ -117,7 +114,6 @@ Each `NotebookInstance` exposes service clients:
|
|
|
117
114
|
- `notebook.git` (`Git`)
|
|
118
115
|
- `notebook.lsp` (`Lsp`)
|
|
119
116
|
- `notebook.repl` (`Repl`)
|
|
120
|
-
- `notebook.laravel` (`Laravel`)
|
|
121
117
|
- `notebook.auth` (`Auth`)
|
|
122
118
|
- `notebook.log` (`Log`)
|
|
123
119
|
- `notebook.services` (`Services`)
|
|
@@ -125,9 +121,8 @@ Each `NotebookInstance` exposes service clients:
|
|
|
125
121
|
|
|
126
122
|
Notes:
|
|
127
123
|
|
|
128
|
-
- `terminal.spawn()`
|
|
129
|
-
- `notebook.repl.eval()`
|
|
130
|
-
- `notebook.laravel` is exposed by the SDK, but the current runtime action set does not expose Laravel maintenance actions.
|
|
124
|
+
- `terminal.spawn()` is the TTY-oriented process API; `notebook.run()` is the native non-TTY process API.
|
|
125
|
+
- `notebook.repl.eval()` evaluates PHP without exposing the unsupported `repl.start` action.
|
|
131
126
|
|
|
132
127
|
## Common Operations
|
|
133
128
|
|
|
@@ -166,9 +161,11 @@ console.log(exitCode);
|
|
|
166
161
|
### Shell
|
|
167
162
|
|
|
168
163
|
```ts
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
console.log(
|
|
164
|
+
const process = notebook.run('php -v', { tty: false });
|
|
165
|
+
for await (const chunk of process.output) {
|
|
166
|
+
console.log(chunk.source, new TextDecoder().decode(chunk.data));
|
|
167
|
+
}
|
|
168
|
+
(await process.exit).throw();
|
|
172
169
|
```
|
|
173
170
|
|
|
174
171
|
### Services
|
package/dist/auth.d.ts
CHANGED
package/dist/auth.js
CHANGED
package/dist/beacon/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Disposable } from '../types.js';
|
|
2
2
|
import { BeaconActions, BeaconEvents, BeaconOptions, DebugInfo, ConsoleEvent, BeaconErrorEvent, DebugRequest, DebugResult, ScreenshotRequest, ScreenshotResult, FetchRequest, FetchResult } from './types.js';
|
|
3
3
|
import { Navigator } from './navigator.js';
|
|
4
|
+
import type { NotebookInstance } from '../index.js';
|
|
4
5
|
export * from './types.js';
|
|
5
6
|
export { Navigator } from './navigator.js';
|
|
6
7
|
/**
|
|
@@ -166,6 +167,7 @@ export declare class Beacon implements BeaconActions {
|
|
|
166
167
|
* Factory function to create a beacon instance for an iframe
|
|
167
168
|
*/
|
|
168
169
|
export declare function createBeacon(iframe: HTMLIFrameElement, options?: BeaconOptions): Beacon;
|
|
170
|
+
export declare function connectBeacon(notebook: NotebookInstance, iframe: HTMLIFrameElement, options?: BeaconOptions): Promise<Beacon>;
|
|
169
171
|
/**
|
|
170
172
|
* Check if the current environment supports the Beacon SDK
|
|
171
173
|
*/
|
package/dist/beacon/index.js
CHANGED
|
@@ -530,6 +530,11 @@ export class Beacon {
|
|
|
530
530
|
export function createBeacon(iframe, options) {
|
|
531
531
|
return new Beacon(iframe, options);
|
|
532
532
|
}
|
|
533
|
+
export async function connectBeacon(notebook, iframe, options) {
|
|
534
|
+
const result = await notebook.ready();
|
|
535
|
+
iframe.src = result.data.previewUrl;
|
|
536
|
+
return createBeacon(iframe, options);
|
|
537
|
+
}
|
|
533
538
|
/**
|
|
534
539
|
* Check if the current environment supports the Beacon SDK
|
|
535
540
|
*/
|