@phpsandbox/sdk 0.1.13 → 0.1.15

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.
Files changed (40) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -18
  3. package/dist/browser/phpsandbox-sdk.esm.js +25 -14
  4. package/dist/browser/phpsandbox-sdk.esm.min.js +9 -9
  5. package/dist/browser/phpsandbox-sdk.iife.js +25 -14
  6. package/dist/browser/phpsandbox-sdk.iife.min.js +9 -9
  7. package/dist/errors/index.d.ts +7 -1
  8. package/dist/errors/index.js +2 -1
  9. package/dist/index.d.ts +27 -6
  10. package/dist/index.js +16 -12
  11. package/dist/{integrations.d.ts → integrations/account.d.ts} +1 -1
  12. package/dist/integrations/index.d.ts +2 -0
  13. package/dist/integrations/index.js +2 -0
  14. package/dist/{sandbox-integrations.d.ts → integrations/sandbox.d.ts} +2 -2
  15. package/dist/{sandbox-integrations.js → integrations/sandbox.js} +1 -1
  16. package/dist/log.d.ts +1 -1
  17. package/dist/log.js +1 -1
  18. package/dist/metrics.d.ts +1 -1
  19. package/dist/metrics.js +1 -1
  20. package/dist/ports.d.ts +1 -1
  21. package/dist/ports.js +1 -1
  22. package/dist/runtime.d.ts +1 -1
  23. package/dist/runtime.js +1 -1
  24. package/package.json +5 -9
  25. package/docs/api-summary.md +0 -181
  26. package/docs/cdn-usage.md +0 -68
  27. package/docs/getting-started.md +0 -169
  28. package/examples/README.md +0 -203
  29. package/examples/basic.ts +0 -15
  30. package/examples/get.ts +0 -22
  31. package/examples/git-merge-smoke.ts +0 -395
  32. package/examples/laravel-load-test.ts +0 -2800
  33. package/examples/notebook-readonly-smoke.ts +0 -806
  34. package/examples/publication-provider-label.ts +0 -11
  35. package/examples/publish-cloudflare-container.ts +0 -65
  36. package/examples/publish-laravel-cloud.ts +0 -123
  37. package/examples/publish-ssh-agent.ts +0 -211
  38. /package/dist/{integrations.js → integrations/account.js} +0 -0
  39. /package/dist/{runtime-telemetry.d.ts → telemetry.d.ts} +0 -0
  40. /package/dist/{runtime-telemetry.js → telemetry.js} +0 -0
@@ -100,9 +100,10 @@ var PHPSandbox = (() => {
100
100
  }
101
101
  };
102
102
  var TransportError = class _TransportError extends PHPSandboxError {
103
- constructor(message, code, cause) {
103
+ constructor(message, code, cause, response) {
104
104
  super(message, cause);
105
105
  this.code = code;
106
+ this.response = response;
106
107
  }
107
108
  static is(error51, code) {
108
109
  return error51 instanceof _TransportError && (code === void 0 || error51.code === code);
@@ -1067,7 +1068,7 @@ var PHPSandbox = (() => {
1067
1068
  }
1068
1069
  };
1069
1070
 
1070
- // src/runtime-telemetry.ts
1071
+ // src/telemetry.ts
1071
1072
  var RuntimeTelemetry = class {
1072
1073
  constructor(okra) {
1073
1074
  this.okra = okra;
@@ -19762,7 +19763,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19762
19763
  }
19763
19764
  };
19764
19765
 
19765
- // src/integrations.ts
19766
+ // src/integrations/account.ts
19766
19767
  var IntegrationApi = class {
19767
19768
  constructor(client) {
19768
19769
  this.client = client;
@@ -19809,7 +19810,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19809
19810
  return typeof integration === "string" ? integration : integration.id;
19810
19811
  }
19811
19812
 
19812
- // src/sandbox-integrations.ts
19813
+ // src/integrations/sandbox.ts
19813
19814
  var SandboxIntegrationApi = class {
19814
19815
  constructor(notebookId, client) {
19815
19816
  this.notebookId = notebookId;
@@ -19884,6 +19885,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19884
19885
  constructor(client) {
19885
19886
  this.client = client;
19886
19887
  }
19888
+ async inspectImport(input) {
19889
+ const response = await this.client.post("/notebook/imports/inspect", input);
19890
+ return response.data;
19891
+ }
19887
19892
  async create(template, input = {}) {
19888
19893
  const response = await this.client.post("/notebook", { template, ...input });
19889
19894
  return new NotebookInstance(response.data, this.client);
@@ -19949,7 +19954,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19949
19954
  })
19950
19955
  );
19951
19956
  if (!response.ok) {
19952
- throw remoteError("core", errorPayload(await responsePayload(response)), response);
19957
+ throw await responseError(response);
19953
19958
  }
19954
19959
  if (!response.body) {
19955
19960
  throw new TransportError("PHPSandbox API response body is not readable.", "InvalidResponse", response);
@@ -19967,7 +19972,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19967
19972
  })
19968
19973
  );
19969
19974
  if (!response.ok) {
19970
- throw remoteError("core", errorPayload(await responsePayload(response)), response);
19975
+ throw await responseError(response);
19971
19976
  }
19972
19977
  if (!response.body) {
19973
19978
  throw new TransportError("PHPSandbox API SSE response body is not readable.", "InvalidResponse", response);
@@ -19983,7 +19988,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19983
19988
  })
19984
19989
  );
19985
19990
  if (!response.ok) {
19986
- throw remoteError("core", errorPayload(await responsePayload(response)), response);
19991
+ throw await responseError(response);
19987
19992
  }
19988
19993
  if (response.status === 204) {
19989
19994
  return { data: void 0 };
@@ -20016,15 +20021,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20016
20021
  }
20017
20022
  }
20018
20023
  };
20019
- async function responsePayload(response) {
20024
+ async function responseError(response) {
20020
20025
  const body = await response.text();
20021
- if (body === "") {
20022
- return void 0;
20023
- }
20024
20026
  try {
20025
- return JSON.parse(body);
20026
- } catch (error51) {
20027
- throw new TransportError("PHPSandbox API returned an invalid JSON response.", "InvalidResponse", error51);
20027
+ return remoteError("core", errorPayload(body === "" ? void 0 : JSON.parse(body)), response);
20028
+ } catch {
20029
+ return new TransportError(
20030
+ `PHPSandbox API returned an invalid error response (HTTP ${response.status}).`,
20031
+ "InvalidResponse",
20032
+ response,
20033
+ {
20034
+ status: response.status,
20035
+ statusText: response.statusText,
20036
+ body
20037
+ }
20038
+ );
20028
20039
  }
20029
20040
  }
20030
20041
  function errorPayload(payload) {