@withgateway/sdk 0.2.1 → 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.
Files changed (44) hide show
  1. package/dist/cli.js +438 -81
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +439 -82
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/files/index.js +9 -5
  6. package/dist/files/index.js.map +1 -1
  7. package/dist/files/index.mjs +9 -5
  8. package/dist/files/index.mjs.map +1 -1
  9. package/dist/index.d.mts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +21 -10
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +20 -10
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/traces/index.js +9 -5
  16. package/dist/traces/index.js.map +1 -1
  17. package/dist/traces/index.mjs +9 -5
  18. package/dist/traces/index.mjs.map +1 -1
  19. package/dist/tracing/index.js +1 -1
  20. package/dist/tracing/index.js.map +1 -1
  21. package/dist/tracing/index.mjs +1 -1
  22. package/dist/tracing/index.mjs.map +1 -1
  23. package/dist/worlds/index.d.mts +7 -1
  24. package/dist/worlds/index.d.ts +7 -1
  25. package/dist/worlds/index.js +19 -9
  26. package/dist/worlds/index.js.map +1 -1
  27. package/dist/worlds/index.mjs +19 -9
  28. package/dist/worlds/index.mjs.map +1 -1
  29. package/package.json +1 -1
  30. package/runtime/gatewaysdk/environment/schema/api.py +61 -3
  31. package/runtime/gatewaysdk/environment/schema/batch.py +5 -1
  32. package/runtime/gatewaysdk/environment/schema/connector.py +11 -0
  33. package/runtime/gatewaysdk/environment/schema/data.py +76 -2
  34. package/runtime/gatewaysdk/environment/schema/dependencies.py +11 -1
  35. package/runtime/gatewaysdk/environment/schema/host.py +8 -17
  36. package/runtime/gatewaysdk/environment/schema/local.py +105 -19
  37. package/runtime/gatewaysdk/environment/schema/mapping.py +13 -1
  38. package/runtime/gatewaysdk/environment/schema/platform.py +32 -5
  39. package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +4 -1
  40. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +5 -5
  41. package/runtime/gatewaysdk/environment/schema/tools_world.py +5 -1
  42. package/runtime/gatewaysdk/environment/schema/validation.py +4 -3
  43. package/skills/benchmarks-getting-started/SKILL.md +4 -1
  44. package/skills/worlds-getting-started/SKILL.md +5 -5
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",
@@ -2638,14 +2638,19 @@ async function importLocalWorldData(dir, rows, opts, creds) {
2638
2638
  files: readWorldFiles(dir),
2639
2639
  rows,
2640
2640
  mode: opts.mode ?? "append",
2641
+ ...opts.merge && opts.merge !== "upsert" ? { merge: opts.merge } : {},
2641
2642
  ...opts.redact && opts.redact !== "off" ? { redact: opts.redact } : {}
2642
2643
  });
2643
2644
  if (res.files?.length) writeWorldFiles(dir, res.files);
2644
- if (res.changed) dropBuildOutputs(dir);
2645
+ const dropped = res.changed ? dropBuildOutputs(dir) : [];
2645
2646
  return {
2646
2647
  kind: res.kind ?? "unknown",
2647
2648
  entity_counts: res.entity_counts ?? {},
2648
- changed: Boolean(res.changed)
2649
+ changed: Boolean(res.changed),
2650
+ ...dropped.length ? {
2651
+ dropped_build_outputs: dropped,
2652
+ next: `gateway worlds schema compile ${dir} # rebuilds the snapshots from the imported data`
2653
+ } : {}
2649
2654
  };
2650
2655
  }
2651
2656
  function dropBuildOutputs(dir) {
@@ -3468,6 +3473,7 @@ var init_ingest = __esm({
3468
3473
  // src/worlds/index.ts
3469
3474
  var worlds_exports = {};
3470
3475
  __export(worlds_exports, {
3476
+ ApiError: () => ApiError2,
3471
3477
  BrowserActionRecorder: () => BrowserActionRecorder,
3472
3478
  COMPUTER_USE_SPECS: () => COMPUTER_USE_SPECS,
3473
3479
  DEFAULT_BRANCH: () => DEFAULT_BRANCH,
@@ -3576,11 +3582,7 @@ async function apiRequest(options, method, path9, body) {
3576
3582
  ...body === void 0 ? {} : { body: JSON.stringify(body) }
3577
3583
  });
3578
3584
  const text2 = await res.text();
3579
- if (!res.ok) {
3580
- throw new Error(
3581
- `${method} ${path9} -> ${res.status}: ${text2.slice(0, 400)}`
3582
- );
3583
- }
3585
+ if (!res.ok) throw new ApiError2(res.status, method, path9, text2.slice(0, 400));
3584
3586
  return JSON.parse(text2);
3585
3587
  }
3586
3588
  async function setEnvSecret(slug, key, value, options = {}) {
@@ -3732,7 +3734,7 @@ async function openWorld(slugRef, options = {}) {
3732
3734
  }
3733
3735
  return world;
3734
3736
  }
3735
- var WorldTask, WorldSet;
3737
+ var ApiError2, WorldTask, WorldSet;
3736
3738
  var init_worlds = __esm({
3737
3739
  "src/worlds/index.ts"() {
3738
3740
  "use strict";
@@ -3747,6 +3749,13 @@ var init_worlds = __esm({
3747
3749
  init_query();
3748
3750
  init_migrate();
3749
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
+ };
3750
3759
  WorldTask = class {
3751
3760
  constructor(world, name, variant) {
3752
3761
  this.world = world;
@@ -3817,7 +3826,7 @@ var require_package = __commonJS({
3817
3826
  "package.json"(exports, module) {
3818
3827
  module.exports = {
3819
3828
  name: "@withgateway/sdk",
3820
- version: "0.2.1",
3829
+ version: "0.2.3",
3821
3830
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
3822
3831
  main: "./dist/index.js",
3823
3832
  module: "./dist/index.mjs",
@@ -7972,6 +7981,7 @@ var tracing = {
7972
7981
  };
7973
7982
  export {
7974
7983
  AGENT_ID_KEY,
7984
+ ApiError2 as ApiError,
7975
7985
  BrowserActionRecorder,
7976
7986
  COMPUTER_USE_SPECS,
7977
7987
  DEFAULT_BRANCH,