@upstash/qstash 2.10.1 → 2.11.1

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/solidjs.js CHANGED
@@ -277,6 +277,9 @@ var formatWorkflowError = (error) => {
277
277
 
278
278
  // src/client/utils.ts
279
279
  var DEFAULT_BULK_COUNT = 100;
280
+ function serializeLabel(label) {
281
+ return Array.isArray(label) ? label.join(",") : label;
282
+ }
280
283
  var isIgnoredHeader = (header) => {
281
284
  const lowerCaseHeader = header.toLowerCase();
282
285
  return lowerCaseHeader.startsWith("content-type") || lowerCaseHeader.startsWith("upstash-");
@@ -361,7 +364,7 @@ function processHeaders(request) {
361
364
  headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
362
365
  }
363
366
  if (request.label !== void 0) {
364
- headers.set("Upstash-Label", request.label);
367
+ headers.set("Upstash-Label", serializeLabel(request.label));
365
368
  }
366
369
  if (request.redact !== void 0) {
367
370
  const redactParts = [];
@@ -458,17 +461,23 @@ function normalizeCursor(response) {
458
461
  const cursor = response.cursor;
459
462
  return { ...response, cursor: cursor || void 0 };
460
463
  }
464
+ function _processGlobal() {
465
+ const proc = globalThis["process"];
466
+ return proc;
467
+ }
461
468
  function getRuntime() {
462
- if (typeof process === "object" && typeof process.versions == "object" && process.versions.bun)
463
- return `bun@${process.versions.bun}`;
469
+ const proc = _processGlobal();
470
+ if (proc?.versions?.bun)
471
+ return `bun@${proc.versions.bun}`;
464
472
  if (typeof EdgeRuntime === "string")
465
473
  return "edge-light";
466
- else if (typeof process === "object" && typeof process.version === "string")
467
- return `node@${process.version}`;
474
+ if (typeof proc?.version === "string")
475
+ return `node@${proc.version}`;
468
476
  return "";
469
477
  }
470
478
  function getSafeEnvironment() {
471
- return typeof process === "undefined" ? {} : process.env;
479
+ const proc = _processGlobal();
480
+ return proc?.env ?? {};
472
481
  }
473
482
 
474
483
  // src/client/multi-region/utils.ts
@@ -512,12 +521,453 @@ function normalizeRegionHeader(region) {
512
521
  return void 0;
513
522
  }
514
523
 
524
+ // src/dev-server/constants.ts
525
+ var DEFAULT_DEV_PORT = 8080;
526
+ var DEV_CREDENTIALS = {
527
+ token: "eyJVc2VySUQiOiJkZWZhdWx0VXNlciIsIlBhc3N3b3JkIjoiZGVmYXVsdFBhc3N3b3JkIn0=",
528
+ currentSigningKey: "sig_7kYjw48mhY7kAjqNGcy6cr29RJ6r",
529
+ nextSigningKey: "sig_5ZB6DVzB1wjE8S6rZ7eenA8Pdnhs"
530
+ };
531
+ var GITHUB_RELEASES_URL = "https://api.github.com/repos/upstash/qstash-cli/releases/latest";
532
+ var BINARY_URL_BASE = "https://artifacts.upstash.com/qstash/versions";
533
+ var CONSOLE_URL = "https://console.upstash.com/qstash/local-mode-user";
534
+ var DEV_PREFIX = "\x1B[2m[QStash Dev]\x1B[0m";
535
+ var CLI_PREFIX = "\x1B[2m[QStash CLI]\x1B[0m";
536
+ var _n = (m) => `node:${m}`;
537
+ var importHttp = () => import(
538
+ /* webpackIgnore: true */
539
+ _n("http")
540
+ );
541
+ var importHttps = () => import(
542
+ /* webpackIgnore: true */
543
+ _n("https")
544
+ );
545
+ var importFs = () => import(
546
+ /* webpackIgnore: true */
547
+ _n("fs")
548
+ );
549
+ var importChildProcess = () => import(
550
+ /* webpackIgnore: true */
551
+ _n("child_process")
552
+ );
553
+ var importOs = () => import(
554
+ /* webpackIgnore: true */
555
+ _n("os")
556
+ );
557
+
558
+ // src/dev-server/http.ts
559
+ var HTTP_OK = 200;
560
+ var HTTP_MULTI_CHOICE = 300;
561
+ var nativeGet = async (url, headers, timeoutMs) => {
562
+ const parsedUrl = new URL(url);
563
+ const httpModule = parsedUrl.protocol === "https:" ? await importHttps() : await importHttp();
564
+ return new Promise((resolve, reject) => {
565
+ const request = httpModule.get(url, { headers }, (response) => {
566
+ const chunks = [];
567
+ response.on("data", (chunk) => chunks.push(chunk));
568
+ response.on("end", () => {
569
+ const statusCode = response.statusCode ?? 0;
570
+ resolve({
571
+ ok: statusCode >= HTTP_OK && statusCode < HTTP_MULTI_CHOICE,
572
+ statusCode,
573
+ body: Buffer.concat(chunks)
574
+ });
575
+ });
576
+ response.on("error", reject);
577
+ });
578
+ if (timeoutMs) {
579
+ request.setTimeout(timeoutMs, () => {
580
+ request.destroy(new Error("Request timed out"));
581
+ });
582
+ }
583
+ request.on("error", reject);
584
+ });
585
+ };
586
+
587
+ // src/dev-server/health.ts
588
+ var HEALTH_CHECK_TIMEOUT_MS = 2e3;
589
+ var isDevServerRunning = async (baseUrl) => {
590
+ try {
591
+ const { ok: ok4, body } = await nativeGet(
592
+ `${baseUrl}/v2/keys`,
593
+ { Authorization: `Bearer ${DEV_CREDENTIALS.token}` },
594
+ HEALTH_CHECK_TIMEOUT_MS
595
+ );
596
+ if (!ok4)
597
+ return false;
598
+ const data = JSON.parse(body.toString());
599
+ return data.current === DEV_CREDENTIALS.currentSigningKey && data.next === DEV_CREDENTIALS.nextSigningKey;
600
+ } catch {
601
+ return false;
602
+ }
603
+ };
604
+ var _didLogUnreachable = false;
605
+ var checkDevServerReachable = async (baseUrl, runtime) => {
606
+ if (await pingEdge(baseUrl))
607
+ return;
608
+ if (!_didLogUnreachable) {
609
+ console.error(unreachableMessage(baseUrl, runtime));
610
+ _didLogUnreachable = true;
611
+ }
612
+ throw new Error(`${DEV_PREFIX} dev server unreachable at ${baseUrl}`);
613
+ };
614
+ var pingEdge = async (baseUrl) => {
615
+ try {
616
+ const controller = new AbortController();
617
+ const timeout = setTimeout(() => {
618
+ controller.abort();
619
+ }, HEALTH_CHECK_TIMEOUT_MS);
620
+ const response = await fetch(`${baseUrl}/v2/keys`, {
621
+ headers: { Authorization: `Bearer ${DEV_CREDENTIALS.token}` },
622
+ signal: controller.signal
623
+ });
624
+ clearTimeout(timeout);
625
+ return response.ok;
626
+ } catch {
627
+ return false;
628
+ }
629
+ };
630
+ var unreachableMessage = (baseUrl, runtime) => {
631
+ const port = new URL(baseUrl).port;
632
+ const manualStartCmd = `npx @upstash/qstash-cli dev --port ${port}`;
633
+ const header = `
634
+ ${DEV_PREFIX} The dev server is not running at ${baseUrl}.
635
+
636
+ `;
637
+ if (runtime === "cloudflare-workers") {
638
+ return header + `Cloudflare Workers cannot start the dev server automatically.
639
+ Start it manually before running wrangler dev:
640
+
641
+ ${manualStartCmd}
642
+ `;
643
+ }
644
+ return header + `Edge runtimes cannot start the dev server automatically.
645
+ Either:
646
+ 1. Add the instrumentation hook to start it with your app:
647
+
648
+ // instrumentation.ts
649
+ import { registerQStashDev } from "@upstash/qstash/nextjs";
650
+ export async function register() { await registerQStashDev(); }
651
+
652
+ 2. Or start it manually:
653
+
654
+ ${manualStartCmd}
655
+ `;
656
+ };
657
+
658
+ // src/dev-server/binary.ts
659
+ var ensureBinary = async () => {
660
+ const fs = await importFs();
661
+ const os = await importOs();
662
+ const cacheDirectory = await findCacheDirectory();
663
+ const isWindows = os.platform() === "win32";
664
+ const binaryName = isWindows ? "qstash.exe" : "qstash";
665
+ const binaryPath = `${cacheDirectory}/${binaryName}`;
666
+ const versionFile = `${cacheDirectory}/.version`;
667
+ let version;
668
+ try {
669
+ version = await fetchLatestVersion();
670
+ } catch (error) {
671
+ if (fs.existsSync(binaryPath)) {
672
+ const cachedVersion = fs.existsSync(versionFile) ? fs.readFileSync(versionFile, "utf8").trim() : "unknown";
673
+ console.log(`${DEV_PREFIX} Offline, using local v${cachedVersion}`);
674
+ return binaryPath;
675
+ }
676
+ throw error;
677
+ }
678
+ return downloadBinary(version, cacheDirectory);
679
+ };
680
+ var fetchLatestVersion = async () => {
681
+ const { ok: ok4, statusCode, body } = await nativeGet(GITHUB_RELEASES_URL, {
682
+ Accept: "application/vnd.github.v3+json",
683
+ "User-Agent": "upstash-qstash-js"
684
+ });
685
+ if (!ok4) {
686
+ throw new Error(`[QStash Dev] Failed to fetch latest version: HTTP ${statusCode}`);
687
+ }
688
+ const data = JSON.parse(body.toString());
689
+ return data.tag_name.replace(/^v/, "");
690
+ };
691
+ var findCacheDirectory = async () => {
692
+ const fs = await importFs();
693
+ const os = await importOs();
694
+ const home = os.homedir();
695
+ const platform = os.platform();
696
+ let base;
697
+ if (platform === "darwin") {
698
+ base = `${home}/Library/Caches/upstash`;
699
+ } else if (platform === "win32") {
700
+ base = `${process.env.LOCALAPPDATA ?? `${home}/AppData/Local`}/upstash`;
701
+ } else {
702
+ base = `${home}/.cache/upstash`;
703
+ }
704
+ const cacheDirectory = `${base}/qstash-dev`;
705
+ await fs.promises.mkdir(cacheDirectory, { recursive: true });
706
+ return cacheDirectory;
707
+ };
708
+ var downloadBinary = async (version, cacheDirectory) => {
709
+ const fs = await importFs();
710
+ const childProcess = await importChildProcess();
711
+ const os = await importOs();
712
+ const osPlatform = os.platform();
713
+ const isWindows = osPlatform === "win32";
714
+ const platform = isWindows ? "windows" : osPlatform === "darwin" ? "darwin" : "linux";
715
+ const arch = os.arch() === "arm64" ? "arm64" : "amd64";
716
+ const archiveName = `qstash-server_${version}_${platform}_${arch}`;
717
+ const binaryName = isWindows ? "qstash.exe" : "qstash";
718
+ const binaryPath = `${cacheDirectory}/${binaryName}`;
719
+ const versionFile = `${cacheDirectory}/.version`;
720
+ if (fs.existsSync(binaryPath) && fs.existsSync(versionFile)) {
721
+ const cachedVersion = fs.readFileSync(versionFile, "utf8").trim();
722
+ if (cachedVersion === version) {
723
+ return binaryPath;
724
+ }
725
+ }
726
+ await fs.promises.rm(cacheDirectory, { recursive: true, force: true });
727
+ await fs.promises.mkdir(cacheDirectory, { recursive: true });
728
+ const extension = isWindows ? "zip" : "tar.gz";
729
+ const archiveUrl = `${BINARY_URL_BASE}/${version}/${archiveName}.${extension}`;
730
+ console.log(`${DEV_PREFIX} Downloading dev server v${version}...`);
731
+ const { ok: ok4, statusCode, body } = await nativeGet(archiveUrl);
732
+ if (!ok4) {
733
+ throw new Error(`[QStash Dev] Failed to download binary: HTTP ${statusCode}`);
734
+ }
735
+ const archivePath = `${cacheDirectory}/${archiveName}.${extension}`;
736
+ await fs.promises.writeFile(archivePath, new Uint8Array(body));
737
+ childProcess.execFileSync("tar", ["-xf", archivePath, "-C", cacheDirectory], {
738
+ stdio: "pipe"
739
+ });
740
+ if (!isWindows) {
741
+ const EXECUTABLE_PERMISSION = 493;
742
+ await fs.promises.chmod(binaryPath, EXECUTABLE_PERMISSION);
743
+ }
744
+ await fs.promises.writeFile(versionFile, version);
745
+ await fs.promises.unlink(archivePath).catch(() => {
746
+ });
747
+ return binaryPath;
748
+ };
749
+
750
+ // src/dev-server/process.ts
751
+ var STARTUP_TIMEOUT_MS = 3e4;
752
+ var _proc = () => {
753
+ return globalThis["process"] ?? {};
754
+ };
755
+ var spawnServer = async (binaryPath, port, onUnexpectedExit) => {
756
+ const childProcess = await importChildProcess();
757
+ const child = await new Promise((resolve, reject) => {
758
+ const child2 = childProcess.spawn(binaryPath, ["dev", "--port", String(port)], {
759
+ stdio: ["ignore", "pipe", "pipe"]
760
+ });
761
+ const timeout = setTimeout(() => {
762
+ child2.kill();
763
+ reject(new Error("[QStash Dev] Server failed to start within 30 seconds"));
764
+ }, STARTUP_TIMEOUT_MS);
765
+ let startupOutput = "";
766
+ let started = false;
767
+ const bufferLine = (line) => {
768
+ if (!started)
769
+ startupOutput += `${line}
770
+ `;
771
+ };
772
+ forwardWithPrefix(child2.stdout, _proc().stdout, (line) => {
773
+ bufferLine(line);
774
+ if (!started && /runn+ing( at|\.)/i.test(line)) {
775
+ clearTimeout(timeout);
776
+ started = true;
777
+ resolve(child2);
778
+ }
779
+ });
780
+ forwardWithPrefix(child2.stderr, _proc().stderr, bufferLine);
781
+ child2.on("error", (error) => {
782
+ clearTimeout(timeout);
783
+ reject(new Error(`[QStash Dev] Failed to start server: ${error.message}`));
784
+ });
785
+ child2.on("close", (code, _signal) => {
786
+ if (started) {
787
+ onUnexpectedExit?.();
788
+ return;
789
+ }
790
+ clearTimeout(timeout);
791
+ reject(new Error(formatStartupError(code, startupOutput)));
792
+ });
793
+ });
794
+ registerCleanup(child);
795
+ child.unref?.();
796
+ child.stdout?.unref?.();
797
+ child.stderr?.unref?.();
798
+ };
799
+ var formatStartupError = (code, startupOutput) => {
800
+ const cleaned = startupOutput.replaceAll(/\u001B\[[\d;]*m/g, "").replaceAll(/^\d{1,2}:\d{2}(AM|PM)\s+\w{3}\s+/gm, "").trim();
801
+ if (/address already in use/i.test(cleaned)) {
802
+ const match = /:(\d+)\s*$/.exec(cleaned);
803
+ const portHint = match ? ` on port ${match[1]}` : "";
804
+ return `[QStash Dev] Port already in use${portHint}. Set QSTASH_DEV_PORT to use a different port, or stop the process holding it.`;
805
+ }
806
+ const codeSuffix = code ? ` with code ${code}` : "";
807
+ const detail = cleaned ? `: ${cleaned}` : "";
808
+ return `[QStash Dev] Server exited unexpectedly${codeSuffix}${detail}`;
809
+ };
810
+ var forwardWithPrefix = (source, destination, onLine) => {
811
+ if (!source)
812
+ return;
813
+ let buffer = "";
814
+ const flushLine = (line) => {
815
+ destination?.write(`${CLI_PREFIX} ${line}
816
+ `);
817
+ onLine(line);
818
+ };
819
+ source.on("data", (data) => {
820
+ buffer += data.toString();
821
+ let newlineIndex = buffer.indexOf("\n");
822
+ while (newlineIndex !== -1) {
823
+ flushLine(buffer.slice(0, newlineIndex));
824
+ buffer = buffer.slice(newlineIndex + 1);
825
+ newlineIndex = buffer.indexOf("\n");
826
+ }
827
+ });
828
+ source.on("end", () => {
829
+ if (buffer.length > 0) {
830
+ flushLine(buffer);
831
+ buffer = "";
832
+ }
833
+ });
834
+ source.on("error", () => {
835
+ });
836
+ };
837
+ var currentChild;
838
+ var processHandlersRegistered = false;
839
+ var killCurrentChild = () => {
840
+ if (!currentChild)
841
+ return;
842
+ try {
843
+ currentChild.kill("SIGTERM");
844
+ } catch {
845
+ }
846
+ currentChild = void 0;
847
+ };
848
+ var registerCleanup = (child) => {
849
+ currentChild = child;
850
+ if (!processHandlersRegistered) {
851
+ processHandlersRegistered = true;
852
+ const proc = _proc();
853
+ proc.on?.("exit", killCurrentChild);
854
+ proc.on?.("SIGINT", () => {
855
+ killCurrentChild();
856
+ proc.exit?.(0);
857
+ });
858
+ proc.on?.("SIGTERM", () => {
859
+ killCurrentChild();
860
+ proc.exit?.(0);
861
+ });
862
+ }
863
+ };
864
+
865
+ // src/dev-server/index.ts
866
+ var _processGlobal2 = () => {
867
+ const proc = globalThis["process"];
868
+ return proc;
869
+ };
870
+ var devServerPromise;
871
+ var ensureDevelopmentServer = (env, devMode) => {
872
+ if (!shouldUseDevelopmentMode(devMode, env))
873
+ return Promise.resolve();
874
+ const procEnv = _processGlobal2()?.env;
875
+ if (procEnv?.NEXT_PHASE === "phase-production-build")
876
+ return Promise.resolve();
877
+ if (procEnv?.NODE_ENV === "production")
878
+ return Promise.resolve();
879
+ const runtime = getRuntime2();
880
+ if (runtime !== "nodejs") {
881
+ return checkDevServerReachable(getDevUrl(env), runtime);
882
+ }
883
+ if (!devServerPromise) {
884
+ devServerPromise = startPipeline(env).catch((error) => {
885
+ devServerPromise = void 0;
886
+ throw error;
887
+ });
888
+ }
889
+ return devServerPromise;
890
+ };
891
+ var startPipeline = async (env) => {
892
+ const baseUrl = getDevUrl(env);
893
+ const port = new URL(baseUrl).port;
894
+ const consoleLink = `\x1B[36m${CONSOLE_URL}?port=${port}\x1B[0m`;
895
+ if (await isDevServerRunning(baseUrl)) {
896
+ console.log(
897
+ `${DEV_PREFIX} Server already running at ${baseUrl}
898
+ ${DEV_PREFIX} Console: ${consoleLink}`
899
+ );
900
+ return;
901
+ }
902
+ const binaryPath = await ensureBinary();
903
+ await spawnServer(binaryPath, port, () => {
904
+ devServerPromise = void 0;
905
+ });
906
+ };
907
+ var shouldUseDevelopmentMode = (devMode, env) => {
908
+ if (devMode !== void 0)
909
+ return devMode;
910
+ const value = env?.QSTASH_DEV ?? getProcessEnvironment("QSTASH_DEV");
911
+ if (value === void 0 || value === "" || value === "false" || value === "0")
912
+ return false;
913
+ if (value === "true" || value === "1")
914
+ return true;
915
+ throw new Error(`[QStash Dev] Invalid value for QSTASH_DEV in environment: ${value}`);
916
+ };
917
+ var getDevelopmentCredentials = (env) => {
918
+ return {
919
+ ...DEV_CREDENTIALS,
920
+ baseUrl: getDevUrl(env)
921
+ };
922
+ };
923
+ var getDevUrl = (env) => {
924
+ const portString = env?.QSTASH_DEV_PORT ?? getProcessEnvironment("QSTASH_DEV_PORT");
925
+ let port = DEFAULT_DEV_PORT;
926
+ if (portString) {
927
+ const parsed = Number.parseInt(portString, 10);
928
+ if (!Number.isNaN(parsed) && parsed > 0) {
929
+ port = parsed;
930
+ }
931
+ }
932
+ return `http://127.0.0.1:${port}`;
933
+ };
934
+ var getRuntime2 = () => {
935
+ if (typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers") {
936
+ return "cloudflare-workers";
937
+ }
938
+ const proc = _processGlobal2();
939
+ if (!proc) {
940
+ return "browser";
941
+ }
942
+ if (!proc.release?.name) {
943
+ return "edge";
944
+ }
945
+ return "nodejs";
946
+ };
947
+ var getProcessEnvironment = (key) => {
948
+ const proc = _processGlobal2();
949
+ return proc?.env ? proc.env[key] : void 0;
950
+ };
951
+
515
952
  // src/client/multi-region/incoming.ts
516
953
  var getReceiverSigningKeys = ({
517
954
  environment,
518
955
  regionFromHeader,
519
- config
956
+ config,
957
+ devMode
520
958
  }) => {
959
+ if (shouldUseDevelopmentMode(devMode, environment)) {
960
+ if (config?.currentSigningKey || config?.nextSigningKey) {
961
+ console.warn(
962
+ `${DEV_PREFIX} Dev mode is active. Ignoring signing keys from config. Set devMode: false to use your own keys.`
963
+ );
964
+ }
965
+ const developmentCreds = getDevelopmentCredentials(environment);
966
+ return {
967
+ currentSigningKey: developmentCreds.currentSigningKey,
968
+ nextSigningKey: developmentCreds.nextSigningKey
969
+ };
970
+ }
521
971
  if (config?.currentSigningKey && config.nextSigningKey) {
522
972
  return {
523
973
  currentSigningKey: config.currentSigningKey,
@@ -562,8 +1012,21 @@ var getClientCredentials = (clientCredentialConfig) => {
562
1012
  };
563
1013
  var resolveCredentials = ({
564
1014
  environment,
565
- config
1015
+ config,
1016
+ devMode
566
1017
  }) => {
1018
+ if (shouldUseDevelopmentMode(devMode, environment)) {
1019
+ if (config?.baseUrl || config?.token) {
1020
+ console.warn(
1021
+ `${DEV_PREFIX} Dev mode is active. Ignoring baseUrl/token from config. Set devMode: false to use your own credentials.`
1022
+ );
1023
+ }
1024
+ const developmentCreds = getDevelopmentCredentials(environment);
1025
+ return {
1026
+ baseUrl: developmentCreds.baseUrl,
1027
+ token: developmentCreds.token
1028
+ };
1029
+ }
567
1030
  if (config?.baseUrl && config.token) {
568
1031
  return {
569
1032
  baseUrl: config.baseUrl,
@@ -616,9 +1079,11 @@ var SignatureError = class extends Error {
616
1079
  var Receiver = class {
617
1080
  currentSigningKey;
618
1081
  nextSigningKey;
1082
+ devMode;
619
1083
  constructor(config) {
620
1084
  this.currentSigningKey = config?.currentSigningKey;
621
1085
  this.nextSigningKey = config?.nextSigningKey;
1086
+ this.devMode = config?.devMode;
622
1087
  }
623
1088
  /**
624
1089
  * Verify the signature of a request.
@@ -637,7 +1102,8 @@ var Receiver = class {
637
1102
  config: {
638
1103
  currentSigningKey: this.currentSigningKey,
639
1104
  nextSigningKey: this.nextSigningKey
640
- }
1105
+ },
1106
+ devMode: this.devMode
641
1107
  });
642
1108
  if (!signingKeys) {
643
1109
  throw new Error(
@@ -903,12 +1369,14 @@ var HttpClient = class {
903
1369
  baseUrl;
904
1370
  authorization;
905
1371
  options;
1372
+ devMode;
906
1373
  retry;
907
1374
  headers;
908
1375
  telemetryHeaders;
909
1376
  constructor(config) {
910
1377
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
911
1378
  this.authorization = config.authorization;
1379
+ this.devMode = config.devMode;
912
1380
  this.retry = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
913
1381
  typeof config.retry === "boolean" && !config.retry ? {
914
1382
  attempts: 1,
@@ -921,6 +1389,7 @@ var HttpClient = class {
921
1389
  this.telemetryHeaders = config.telemetryHeaders;
922
1390
  }
923
1391
  async request(request) {
1392
+ await ensureDevelopmentServer(void 0, this.devMode);
924
1393
  const { response } = await this.requestWithBackoff(request);
925
1394
  if (request.parseResponseAsJson === false) {
926
1395
  return void 0;
@@ -928,6 +1397,7 @@ var HttpClient = class {
928
1397
  return await response.json();
929
1398
  }
930
1399
  async *requestStream(request) {
1400
+ await ensureDevelopmentServer(void 0, this.devMode);
931
1401
  const { response } = await this.requestWithBackoff(request);
932
1402
  if (!response.body) {
933
1403
  throw new Error("No response body");
@@ -3036,7 +3506,7 @@ var Workflow = class {
3036
3506
  };
3037
3507
 
3038
3508
  // version.ts
3039
- var VERSION = "2.10.1";
3509
+ var VERSION = "2.11.1";
3040
3510
 
3041
3511
  // src/client/client.ts
3042
3512
  var Client = class {
@@ -3044,7 +3514,14 @@ var Client = class {
3044
3514
  token;
3045
3515
  constructor(config) {
3046
3516
  const environment = getSafeEnvironment();
3047
- const { baseUrl, token } = getClientCredentials({ environment, config });
3517
+ const { baseUrl, token } = getClientCredentials({
3518
+ environment,
3519
+ config,
3520
+ devMode: config?.devMode
3521
+ });
3522
+ if (shouldUseDevelopmentMode(config?.devMode, environment)) {
3523
+ void ensureDevelopmentServer(environment, config?.devMode);
3524
+ }
3048
3525
  const enableTelemetry = environment.UPSTASH_DISABLE_TELEMETRY ? false : config?.enableTelemetry ?? true;
3049
3526
  const isCloudflare = typeof caches !== "undefined" && "default" in caches;
3050
3527
  const telemetryHeaders = new Headers(
@@ -3061,7 +3538,8 @@ var Client = class {
3061
3538
  //@ts-expect-error caused by undici and bunjs type overlap
3062
3539
  headers: prefixHeaders(new Headers(config?.headers ?? {})),
3063
3540
  //@ts-expect-error caused by undici and bunjs type overlap
3064
- telemetryHeaders
3541
+ telemetryHeaders,
3542
+ devMode: config?.devMode
3065
3543
  });
3066
3544
  this.token = token;
3067
3545
  }
package/solidjs.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import "./chunk-Z37KJCW7.mjs";
1
+ import "./chunk-ATX5KA4T.mjs";
2
2
  import {
3
3
  Receiver,
4
4
  serve
5
- } from "./chunk-35B33QW3.mjs";
5
+ } from "./chunk-T3Z5YUS4.mjs";
6
6
 
7
7
  // platforms/solidjs.ts
8
8
  var verifySignatureSolidjs = (handler, config) => {
package/svelte.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
2
- import { ae as RouteFunction, af as WorkflowServeOptions } from './client-CsM1dTnz.mjs';
2
+ import { ae as RouteFunction, af as WorkflowServeOptions } from './client-BHOXiX0H.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
package/svelte.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
2
- import { ae as RouteFunction, af as WorkflowServeOptions } from './client-CsM1dTnz.js';
2
+ import { ae as RouteFunction, af as WorkflowServeOptions } from './client-BHOXiX0H.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {