@phpsandbox/sdk 0.2.3 → 0.3.0
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 +19 -11
- package/dist/browser/phpsandbox-sdk.esm.js +18 -29
- package/dist/browser/phpsandbox-sdk.esm.min.js +23 -23
- package/dist/browser/phpsandbox-sdk.iife.js +18 -29
- package/dist/browser/phpsandbox-sdk.iife.min.js +8 -8
- package/dist/integrations/account.d.ts +1 -0
- package/dist/publication/instance.d.ts +0 -1
- package/dist/publication/instance.js +0 -9
- package/dist/publication/notebook.d.ts +10 -11
- package/dist/publication/notebook.js +20 -18
- package/dist/publication/types.d.ts +200 -111
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -372,30 +372,38 @@ MIT
|
|
|
372
372
|
|
|
373
373
|
### Publishing without Helfer
|
|
374
374
|
|
|
375
|
-
Publishing is a platform capability. An API-key client can assign production settings with `notebook.secrets`, discover destinations and owned resources through `notebook.publication.catalog`, and submit its application choices through `
|
|
375
|
+
Publishing is a platform capability. An API-key client can assign production settings with `notebook.secrets`, discover destinations and owned resources through `notebook.publication.catalog`, and submit its application choices through `prepare`.
|
|
376
376
|
|
|
377
377
|
```ts
|
|
378
378
|
const notebook = await client.notebook.get('SANDBOX_ID');
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
const configuration = await notebook.publication.updateConfiguration({
|
|
380
|
+
expectedRevision: 0,
|
|
381
|
+
operations: [{ op: 'add-app', app: {
|
|
382
|
+
name: 'Backend', kind: 'http', root: '.',
|
|
383
383
|
build: { mode: 'dockerfile', context: '.', dockerfile: { source: 'project', path: 'Dockerfile' } },
|
|
384
|
-
runtime: {
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
runtime: { mode: 'container', port: 3333, healthCheck: { path: '/' } },
|
|
385
|
+
destination: { provider: 'ssh-server', serverId: 'OWNED_SERVER_ID' },
|
|
386
|
+
routing: { mode: 'managed' }, resourceIds: [],
|
|
387
|
+
} }],
|
|
388
|
+
});
|
|
389
|
+
const review = await notebook.publication.prepare({
|
|
390
|
+
expectedRevision: configuration.revision, appIds: [configuration.apps[0].id],
|
|
387
391
|
});
|
|
388
392
|
if (!review.review.ready) {
|
|
389
393
|
console.log(review.review.blockers);
|
|
390
394
|
} else {
|
|
391
395
|
// Present this exact review and obtain confirmation before executing.
|
|
392
|
-
const application = await notebook.publication.
|
|
396
|
+
const application = await notebook.publication.publish({ reviewId: review.review.id });
|
|
393
397
|
const current = await notebook.publication.application(application.id);
|
|
394
|
-
console.log(current.status); // publishing, healthy, failed, or deleted
|
|
398
|
+
console.log(current.status); // publishing, healthy, partial, failed, or deleted
|
|
395
399
|
}
|
|
396
400
|
notebook.dispose();
|
|
397
401
|
```
|
|
398
402
|
|
|
399
|
-
Core owns validation, source snapshots, review expiry, identity, resource ownership, execution and recovery. The confirmation reference binds the resolved review; another client does not copy source revisions or recreate provider logic. Repeated confirmation of an executed reference returns its existing application. A corrected review retains the publication and address. `retryApplication(id)` asks the platform to revalidate and retry failed
|
|
403
|
+
Core owns validation, source snapshots, review expiry, identity, resource ownership, execution and recovery. The confirmation reference binds the resolved review; another client does not copy source revisions or recreate provider logic. Repeated confirmation of an executed reference returns its existing application. A corrected review retains the publication and address. `retryApplication(id)` asks the platform to revalidate and retry failed apps; inspect current state and logs when an outcome is uncertain. `destroyApplication(id)` unpublishes, and resource deletion requires the explicit `deleteResources` option.
|
|
400
404
|
|
|
401
405
|
Helfer presents choices, recommendations and explanations, and resumes its own conversation from platform outcomes. Its chat monitor does not own builds or publication state. The CLI exposes the same operations as `application plan`, `application publish`, `application status`, `application retry`, and `application delete`; JSON input is available for multi-component plans.
|
|
406
|
+
|
|
407
|
+
`configuration()` is the authoritative saved App configuration and deployment inventory. Changes use explicit revision-checked operations; adding an app preserves omitted apps. Review and confirm use `prepare({ expectedRevision, appIds? })` and `publish({ reviewId })`. The provider-input publishing contract and `PublicationInstance.publish()` have been removed. Inspect per-app reviewed source and route state; a workspace digest includes uncommitted changes, while a native Git destination commits and pushes that workspace before building. The commit reported at review is the last synced commit, not a promise of the final prepared build commit.
|
|
408
|
+
|
|
409
|
+
Shared managed-resource creation currently starts with one app. After creation, update the resource definition to `reuse` with its actual catalog inventory ID, then attach further apps. Simultaneous first-time shared-resource provisioning is not supported. Historical deployments require explicit adoption by their exact publication ID; new publishing always creates a saved App.
|
|
@@ -15146,17 +15146,6 @@ var PublicationInstance = class _PublicationInstance {
|
|
|
15146
15146
|
follow() {
|
|
15147
15147
|
return new PublicationRun(this, this.client).start();
|
|
15148
15148
|
}
|
|
15149
|
-
async publish() {
|
|
15150
|
-
if (!this.notebookId) {
|
|
15151
|
-
throw new PHPSandboxError("Publishing requires a notebook-scoped publication instance.");
|
|
15152
|
-
}
|
|
15153
|
-
const response = await this.client.post(
|
|
15154
|
-
`/notebook/${encodeURIComponent(this.notebookId)}/publication`
|
|
15155
|
-
);
|
|
15156
|
-
const run = new PublicationRun(new _PublicationInstance(response.data, this.client, this.notebookId), this.client);
|
|
15157
|
-
run.start();
|
|
15158
|
-
return run;
|
|
15159
|
-
}
|
|
15160
15149
|
async destroy(options = {}) {
|
|
15161
15150
|
const query = options.deleteResources ? "?deleteResources=1" : "";
|
|
15162
15151
|
await this.client.delete(`/publications/${encodeURIComponent(this.data.id)}${query}`);
|
|
@@ -15283,24 +15272,28 @@ var NotebookPublication = class {
|
|
|
15283
15272
|
async readiness() {
|
|
15284
15273
|
return (await this.client.get(`${this.path}/publication/readiness`)).data;
|
|
15285
15274
|
}
|
|
15286
|
-
/**
|
|
15275
|
+
/** Inspect saved configuration and the actual inventory, including removed and legacy apps. */
|
|
15276
|
+
async configuration() {
|
|
15277
|
+
return (await this.client.get(`${this.path}/publication/configuration`)).data;
|
|
15278
|
+
}
|
|
15279
|
+
/** Explicit operations preserve omitted apps. Removals never stop deployments or delete resource data. */
|
|
15280
|
+
async updateConfiguration(input) {
|
|
15281
|
+
return (await this.client.patch(`${this.path}/publication/configuration`, input)).data;
|
|
15282
|
+
}
|
|
15283
|
+
/** Review all or selected configured apps at an exact saved revision. */
|
|
15287
15284
|
async prepare(input) {
|
|
15288
15285
|
return (await this.client.post(`${this.path}/publication/plan`, input)).data;
|
|
15289
15286
|
}
|
|
15290
|
-
/**
|
|
15291
|
-
async
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
/** Publish every component in a reviewed application plan. */
|
|
15295
|
-
async publishApplication(input) {
|
|
15296
|
-
const application = (await this.client.post(`${this.path}/publication/application`, input)).data;
|
|
15297
|
-
this.startApplicationRuns(application);
|
|
15287
|
+
/** Publish the exact app selection in a server-owned review. */
|
|
15288
|
+
async publish(input) {
|
|
15289
|
+
const application = (await this.client.post(`${this.path}/publication`, input)).data;
|
|
15290
|
+
if (!("confirmationRequired" in application)) this.startApplicationRuns(application);
|
|
15298
15291
|
return application;
|
|
15299
15292
|
}
|
|
15300
15293
|
async application(applicationId) {
|
|
15301
15294
|
return (await this.client.get(`${this.path}/publication/application/${encodeURIComponent(applicationId)}`)).data;
|
|
15302
15295
|
}
|
|
15303
|
-
/** Retry
|
|
15296
|
+
/** Retry failed apps and pending route attachments while preserving running releases. */
|
|
15304
15297
|
async retryApplication(applicationId) {
|
|
15305
15298
|
const application = (await this.client.post(
|
|
15306
15299
|
`${this.path}/publication/application/${encodeURIComponent(applicationId)}/retry`,
|
|
@@ -15314,10 +15307,11 @@ var NotebookPublication = class {
|
|
|
15314
15307
|
await this.client.delete(`${this.path}/publication/application/${encodeURIComponent(applicationId)}${query}`);
|
|
15315
15308
|
}
|
|
15316
15309
|
startApplicationRuns(application) {
|
|
15317
|
-
for (const
|
|
15318
|
-
if (!
|
|
15310
|
+
for (const app of application.apps) {
|
|
15311
|
+
if (!(application.selectedAppIds ?? []).includes(app.appId)) continue;
|
|
15312
|
+
if (!["pending", "queued", "building", "deploying"].includes(app.publication.status)) continue;
|
|
15319
15313
|
new PublicationRun(
|
|
15320
|
-
new PublicationInstance(
|
|
15314
|
+
new PublicationInstance(app.publication, this.client, this.notebookId),
|
|
15321
15315
|
this.client
|
|
15322
15316
|
).start();
|
|
15323
15317
|
}
|
|
@@ -15329,11 +15323,6 @@ var NotebookPublication = class {
|
|
|
15329
15323
|
}
|
|
15330
15324
|
return (await this.client.get(`${this.path}/publication/catalog?${query}`)).data;
|
|
15331
15325
|
}
|
|
15332
|
-
/** Core validates the plan, prepares source and executes publishing. */
|
|
15333
|
-
async publish(input) {
|
|
15334
|
-
const response = await this.client.post(`${this.path}/publication`, input);
|
|
15335
|
-
return new PublicationRun(new PublicationInstance(response.data, this.client, this.notebookId), this.client).start();
|
|
15336
|
-
}
|
|
15337
15326
|
};
|
|
15338
15327
|
|
|
15339
15328
|
// src/publication/providers/laravel-cloud.ts
|