@phpsandbox/sdk 0.6.0-canary.6 → 0.6.0-canary.7

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
@@ -172,7 +172,6 @@ Each `NotebookInstance` exposes service clients:
172
172
  - `notebook.auth` (`Auth`)
173
173
  - `notebook.services` (`Services`)
174
174
  - `notebook.mail` (`NotebookMail`)
175
- - `notebook.feedback` (`Feedback`)
176
175
 
177
176
  Notes:
178
177
 
@@ -401,27 +400,39 @@ await notebook.mail.delete(mail.hash);
401
400
  await notebook.mail.disable();
402
401
  ```
403
402
 
403
+ ### Product features
404
+
405
+ Projects own the product lifecycle. Address Customers, Payments, feedback, and publishing with an existing project ID; creating a standalone compute sandbox does not create a project.
406
+
407
+ This replaces `notebook.feedback`, `notebook.payments`, `notebook.publication`, and the `forNotebook` helpers. Use a project ID explicitly; sandbox IDs are not aliases for projects.
408
+
409
+ ```ts
410
+ const customers = client.customers.forProject('PROJECT_ID');
411
+ const payments = client.payments.forProject('PROJECT_ID');
412
+ const publishing = client.publications.forProject('PROJECT_ID');
413
+ ```
414
+
404
415
  ### Feedback
405
416
 
406
417
  ```ts
407
418
  // Feedback uses the same API token as the rest of the SDK.
408
- // You can also address it directly with client.feedback.forProject(projectId)
409
- // or client.feedback.forNotebook(notebookId), without fetching a notebook.
410
- await notebook.feedback.configure({
419
+ // Product features require an existing project ID, not a sandbox ID.
420
+ const projectFeedback = client.feedback.forProject('PROJECT_ID');
421
+ await projectFeedback.configure({
411
422
  widget: {
412
423
  targets: ['preview', 'publication'],
413
424
  types: ['bug', 'suggestion', 'question'],
414
425
  },
415
426
  });
416
427
 
417
- const feedback = await notebook.feedback.submit({
428
+ const feedback = await projectFeedback.submit({
418
429
  type: 'bug',
419
430
  message: 'Saving the profile failed.',
420
431
  author: { externalId: 'customer-42', email: 'ada@example.com' },
421
432
  context: { url: 'https://app.example.com/profile', path: '/profile' },
422
433
  });
423
434
 
424
- await notebook.feedback.update(feedback.id, { status: 'resolved' });
435
+ await projectFeedback.update(feedback.id, { status: 'resolved' });
425
436
  ```
426
437
 
427
438
  The server-side SDK uses the same PHPSandbox API token as the rest of the sandbox. Set `widget: null` to remove the optional popout without disabling API ingestion.
@@ -479,42 +490,38 @@ MIT
479
490
 
480
491
  ### Publishing apps
481
492
 
482
- Save your app configuration, prepare a proposal for the apps you want to publish, and submit that proposal after explicit confirmation. Use `notebook.secrets` for production secrets and `notebook.publication.catalog` to discover destinations and available resources.
493
+ Save your app configuration, prepare a proposal for the apps you want to publish, and submit that proposal after explicit confirmation. Use `notebook.secrets` for production secrets and `client.publications.forProject(projectId).catalog` to discover destinations and available resources.
483
494
 
484
495
  ```ts
485
- const notebook = await client.notebook.get('SANDBOX_ID');
486
- try {
487
- const configuration = await notebook.publication.updateConfiguration({
488
- expectedRevision: 0,
489
- operations: [{ op: 'add-app', app: {
490
- name: 'Backend', kind: 'http', root: '.',
491
- build: { mode: 'dockerfile', context: '.', dockerfile: { source: 'project', path: 'Dockerfile' } },
492
- runtime: { mode: 'container', port: 3333, healthCheck: { path: '/' } },
493
- destination: { provider: 'ssh-server', serverId: 'OWNED_SERVER_ID' },
494
- routing: { mode: 'managed' }, resourceIds: [],
495
- } }],
496
- });
497
- const appIds = [configuration.apps[0].id];
498
- const plan = await notebook.publication.prepare({
499
- expectedRevision: configuration.revision, appIds,
496
+ const publisher = client.publications.forProject('PROJECT_ID');
497
+ const configuration = await publisher.updateConfiguration({
498
+ expectedRevision: 0,
499
+ operations: [{ op: 'add-app', app: {
500
+ name: 'Backend', kind: 'http', root: '.',
501
+ build: { mode: 'dockerfile', context: '.', dockerfile: { source: 'project', path: 'Dockerfile' } },
502
+ runtime: { mode: 'container', port: 3333, healthCheck: { path: '/' } },
503
+ destination: { provider: 'ssh-server', serverId: 'OWNED_SERVER_ID' },
504
+ routing: { mode: 'managed' }, resourceIds: [],
505
+ } }],
506
+ });
507
+ const appIds = [configuration.apps[0].id];
508
+ const plan = await publisher.prepare({
509
+ expectedRevision: configuration.revision, appIds,
510
+ });
511
+ if (!plan.review.ready) {
512
+ console.log(plan.review.blockers);
513
+ } else {
514
+ // Show this proposal to the user and wait for their confirmation.
515
+ const result = await publisher.publish({
516
+ reviewId: plan.review.id, proposal: plan.review.proposal, appIds,
500
517
  });
501
- if (!plan.review.ready) {
502
- console.log(plan.review.blockers);
518
+ if ('confirmationRequired' in result) {
519
+ // Show the changes and updated proposal; obtain a new confirmation.
520
+ console.log(result.changes, result.plan);
503
521
  } else {
504
- // Show this proposal to the user and wait for their confirmation.
505
- const result = await notebook.publication.publish({
506
- reviewId: plan.review.id, proposal: plan.review.proposal, appIds,
507
- });
508
- if ('confirmationRequired' in result) {
509
- // Show the changes and updated proposal; obtain a new confirmation.
510
- console.log(result.changes, result.plan);
511
- } else {
512
- const current = await notebook.publication.application(result.id);
513
- console.log(current.status); // publishing, healthy, partial, failed, or deleted
514
- }
522
+ const current = await publisher.application(result.id);
523
+ console.log(current.status); // publishing, healthy, partial, failed, or deleted
515
524
  }
516
- } finally {
517
- notebook.dispose();
518
525
  }
519
526
  ```
520
527