@withgateway/sdk 0.2.2 → 0.2.3

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/dist/index.mjs CHANGED
@@ -1344,7 +1344,7 @@ async function push(dir, opts = {}) {
1344
1344
  const pyproject = readPyproject(dir);
1345
1345
  const contractVersion = pyproject.version ? void 0 : readWorldContractVersion(dir).version;
1346
1346
  if (contractVersion) pyproject.version = contractVersion;
1347
- const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
1347
+ const slug = opts.slug ?? localMeta.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
1348
1348
  const resolve7 = await apiRequest(
1349
1349
  options,
1350
1350
  "POST",
@@ -3473,6 +3473,7 @@ var init_ingest = __esm({
3473
3473
  // src/worlds/index.ts
3474
3474
  var worlds_exports = {};
3475
3475
  __export(worlds_exports, {
3476
+ ApiError: () => ApiError2,
3476
3477
  BrowserActionRecorder: () => BrowserActionRecorder,
3477
3478
  COMPUTER_USE_SPECS: () => COMPUTER_USE_SPECS,
3478
3479
  DEFAULT_BRANCH: () => DEFAULT_BRANCH,
@@ -3581,11 +3582,7 @@ async function apiRequest(options, method, path9, body) {
3581
3582
  ...body === void 0 ? {} : { body: JSON.stringify(body) }
3582
3583
  });
3583
3584
  const text2 = await res.text();
3584
- if (!res.ok) {
3585
- throw new Error(
3586
- `${method} ${path9} -> ${res.status}: ${text2.slice(0, 400)}`
3587
- );
3588
- }
3585
+ if (!res.ok) throw new ApiError2(res.status, method, path9, text2.slice(0, 400));
3589
3586
  return JSON.parse(text2);
3590
3587
  }
3591
3588
  async function setEnvSecret(slug, key, value, options = {}) {
@@ -3737,7 +3734,7 @@ async function openWorld(slugRef, options = {}) {
3737
3734
  }
3738
3735
  return world;
3739
3736
  }
3740
- var WorldTask, WorldSet;
3737
+ var ApiError2, WorldTask, WorldSet;
3741
3738
  var init_worlds = __esm({
3742
3739
  "src/worlds/index.ts"() {
3743
3740
  "use strict";
@@ -3752,6 +3749,13 @@ var init_worlds = __esm({
3752
3749
  init_query();
3753
3750
  init_migrate();
3754
3751
  init_ingest();
3752
+ ApiError2 = class extends Error {
3753
+ constructor(status, method, path9, body) {
3754
+ super(`${method} ${path9} -> ${status}: ${body}`);
3755
+ this.status = status;
3756
+ this.name = "ApiError";
3757
+ }
3758
+ };
3755
3759
  WorldTask = class {
3756
3760
  constructor(world, name, variant) {
3757
3761
  this.world = world;
@@ -3822,7 +3826,7 @@ var require_package = __commonJS({
3822
3826
  "package.json"(exports, module) {
3823
3827
  module.exports = {
3824
3828
  name: "@withgateway/sdk",
3825
- version: "0.2.2",
3829
+ version: "0.2.3",
3826
3830
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
3827
3831
  main: "./dist/index.js",
3828
3832
  module: "./dist/index.mjs",
@@ -7977,6 +7981,7 @@ var tracing = {
7977
7981
  };
7978
7982
  export {
7979
7983
  AGENT_ID_KEY,
7984
+ ApiError2 as ApiError,
7980
7985
  BrowserActionRecorder,
7981
7986
  COMPUTER_USE_SPECS,
7982
7987
  DEFAULT_BRANCH,