@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
@@ -1341,7 +1341,7 @@ async function push(dir, opts = {}) {
1341
1341
  const pyproject = readPyproject(dir);
1342
1342
  const contractVersion = pyproject.version ? void 0 : readWorldContractVersion(dir).version;
1343
1343
  if (contractVersion) pyproject.version = contractVersion;
1344
- const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
1344
+ const slug = opts.slug ?? localMeta.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
1345
1345
  const resolve6 = await apiRequest(
1346
1346
  options,
1347
1347
  "POST",
@@ -2635,14 +2635,19 @@ async function importLocalWorldData(dir, rows, opts, creds) {
2635
2635
  files: readWorldFiles(dir),
2636
2636
  rows,
2637
2637
  mode: opts.mode ?? "append",
2638
+ ...opts.merge && opts.merge !== "upsert" ? { merge: opts.merge } : {},
2638
2639
  ...opts.redact && opts.redact !== "off" ? { redact: opts.redact } : {}
2639
2640
  });
2640
2641
  if (res.files?.length) writeWorldFiles(dir, res.files);
2641
- if (res.changed) dropBuildOutputs(dir);
2642
+ const dropped = res.changed ? dropBuildOutputs(dir) : [];
2642
2643
  return {
2643
2644
  kind: res.kind ?? "unknown",
2644
2645
  entity_counts: res.entity_counts ?? {},
2645
- changed: Boolean(res.changed)
2646
+ changed: Boolean(res.changed),
2647
+ ...dropped.length ? {
2648
+ dropped_build_outputs: dropped,
2649
+ next: `gateway worlds schema compile ${dir} # rebuilds the snapshots from the imported data`
2650
+ } : {}
2646
2651
  };
2647
2652
  }
2648
2653
  function dropBuildOutputs(dir) {
@@ -3465,6 +3470,7 @@ var init_ingest = __esm({
3465
3470
  // src/worlds/index.ts
3466
3471
  var worlds_exports = {};
3467
3472
  __export(worlds_exports, {
3473
+ ApiError: () => ApiError2,
3468
3474
  BrowserActionRecorder: () => BrowserActionRecorder,
3469
3475
  COMPUTER_USE_SPECS: () => COMPUTER_USE_SPECS,
3470
3476
  DEFAULT_BRANCH: () => DEFAULT_BRANCH,
@@ -3573,11 +3579,7 @@ async function apiRequest(options, method, path8, body) {
3573
3579
  ...body === void 0 ? {} : { body: JSON.stringify(body) }
3574
3580
  });
3575
3581
  const text2 = await res.text();
3576
- if (!res.ok) {
3577
- throw new Error(
3578
- `${method} ${path8} -> ${res.status}: ${text2.slice(0, 400)}`
3579
- );
3580
- }
3582
+ if (!res.ok) throw new ApiError2(res.status, method, path8, text2.slice(0, 400));
3581
3583
  return JSON.parse(text2);
3582
3584
  }
3583
3585
  async function setEnvSecret(slug, key, value, options = {}) {
@@ -3729,7 +3731,7 @@ async function openWorld(slugRef, options = {}) {
3729
3731
  }
3730
3732
  return world;
3731
3733
  }
3732
- var WorldTask, WorldSet;
3734
+ var ApiError2, WorldTask, WorldSet;
3733
3735
  var init_worlds = __esm({
3734
3736
  "src/worlds/index.ts"() {
3735
3737
  init_session();
@@ -3743,6 +3745,13 @@ var init_worlds = __esm({
3743
3745
  init_query();
3744
3746
  init_migrate();
3745
3747
  init_ingest();
3748
+ ApiError2 = class extends Error {
3749
+ constructor(status, method, path8, body) {
3750
+ super(`${method} ${path8} -> ${status}: ${body}`);
3751
+ this.status = status;
3752
+ this.name = "ApiError";
3753
+ }
3754
+ };
3746
3755
  WorldTask = class {
3747
3756
  constructor(world, name, variant) {
3748
3757
  this.world = world;
@@ -3809,6 +3818,7 @@ var init_worlds = __esm({
3809
3818
  });
3810
3819
  init_worlds();
3811
3820
  export {
3821
+ ApiError2 as ApiError,
3812
3822
  BrowserActionRecorder,
3813
3823
  COMPUTER_USE_SPECS,
3814
3824
  DEFAULT_BRANCH,