@withgateway/sdk 0.1.18 → 0.1.19

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
@@ -503,7 +503,7 @@ async function push(dir, opts = {}) {
503
503
  if (!fs.statSync(dir).isDirectory()) throw new Error(`Not a directory: ${dir}`);
504
504
  const localMeta = readLocalMeta(dir) ?? {};
505
505
  const branch = opts.branch ?? localMeta.branch ?? DEFAULT_BRANCH;
506
- const baseVersionId = localMeta.versionId ?? null;
506
+ const baseVersionId = opts.baseVersionId ?? localMeta.versionId ?? null;
507
507
  const contentHash = computeContentHash(dir);
508
508
  const pyproject = readPyproject(dir);
509
509
  const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
@@ -738,9 +738,24 @@ async function validateWorld(dir, opts) {
738
738
  "No branch to validate on: pass --branch or run inside a git checkout / GitHub Actions."
739
739
  );
740
740
  progress(`pushing ${dir} as ${opts.slug ?? "(pyproject name)"}@${branch}\u2026`);
741
+ let tipVersionId = null;
742
+ if (opts.slug) {
743
+ try {
744
+ const tip = await apiRequest(
745
+ options,
746
+ "POST",
747
+ "/api/public/benchmark-containers/resolve-version",
748
+ { slug: opts.slug, ref: branch }
749
+ );
750
+ tipVersionId = tip.versionId ?? null;
751
+ } catch {
752
+ tipVersionId = null;
753
+ }
754
+ }
741
755
  const pushed = await push(dir, {
742
756
  slug: opts.slug,
743
757
  branch,
758
+ baseVersionId: tipVersionId,
744
759
  message: `PR validation push (${provenance.commit?.slice(0, 12) ?? "local"})`,
745
760
  ...provenance.actor?.name ? { author: provenance.actor.name } : {},
746
761
  options
@@ -1097,7 +1112,7 @@ var require_package = __commonJS({
1097
1112
  "package.json"(exports, module) {
1098
1113
  module.exports = {
1099
1114
  name: "@withgateway/sdk",
1100
- version: "0.1.18",
1115
+ version: "0.1.19",
1101
1116
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
1102
1117
  main: "./dist/index.js",
1103
1118
  module: "./dist/index.mjs",