bdy 1.10.4 → 1.10.5-dev

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.10.4",
4
+ "version": "1.10.5-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -19,7 +19,16 @@ const node_fs_1 = require("node:fs");
19
19
  const output_1 = __importDefault(require("../output"));
20
20
  const texts_1 = require("../texts");
21
21
  const eventsource_1 = require("eventsource");
22
- const serviceUrl = process.env.SNAPSHOTS_SERVICE_URL || 'http://localhost:3000';
22
+ const customServiceUrl = process.env.SNAPSHOTS_SERVICE_URL;
23
+ function getServiceUrl() {
24
+ if (customServiceUrl) {
25
+ return customServiceUrl;
26
+ }
27
+ if (context_js_1.token.startsWith('bud_vt_eu')) {
28
+ return 'https://vt.eu.buddy.works';
29
+ }
30
+ return 'https://vt.buddy.works';
31
+ }
23
32
  function prepareSnapshotInternal(snapshot) {
24
33
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
34
  const { resourceDiscoveryTimeout, cookies, ...filteredSnapshot } = snapshot;
@@ -264,7 +273,7 @@ async function downloadScrapPackage(buildId) {
264
273
  return response;
265
274
  }
266
275
  async function sendRequest({ url, payload, multipart, }) {
267
- output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(`${serviceUrl}${url}`));
276
+ output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(`${getServiceUrl()}${url}`));
268
277
  const init = {
269
278
  method: 'GET',
270
279
  redirect: 'follow',
@@ -278,7 +287,7 @@ async function sendRequest({ url, payload, multipart, }) {
278
287
  init.method = 'POST';
279
288
  init.body = payload;
280
289
  }
281
- const response = await (0, undici_1.fetch)(`${serviceUrl}${url}`, init);
290
+ const response = await (0, undici_1.fetch)(`${getServiceUrl()}${url}`, init);
282
291
  const contentType = response.headers.get('content-type');
283
292
  if (contentType && contentType.includes('application/json')) {
284
293
  try {
@@ -297,7 +306,7 @@ async function sendRequest({ url, payload, multipart, }) {
297
306
  return [text, undefined];
298
307
  }
299
308
  function connectToScrapSession(buildId) {
300
- return new eventsource_1.EventSource(`${serviceUrl}/sse`, {
309
+ return new eventsource_1.EventSource(`${getServiceUrl()}/sse`, {
301
310
  fetch: (url, options) => {
302
311
  return (0, undici_1.fetch)(url, {
303
312
  ...options,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.10.4",
4
+ "version": "1.10.5-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {