@discomedia/utils 1.0.42 → 1.0.44

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
@@ -2449,7 +2449,7 @@ const safeJSON = (text) => {
2449
2449
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2450
2450
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2451
2451
 
2452
- const VERSION = '6.5.0'; // x-release-please-version
2452
+ const VERSION = '6.7.0'; // x-release-please-version
2453
2453
 
2454
2454
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2455
2455
  const isRunningInBrowser = () => {
@@ -7291,20 +7291,19 @@ let Files$1 = class Files extends APIResource {
7291
7291
  * up to 512 MB, and the size of all files uploaded by one organization can be up
7292
7292
  * to 1 TB.
7293
7293
  *
7294
- * The Assistants API supports files up to 2 million tokens and of specific file
7295
- * types. See the
7296
- * [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for
7297
- * details.
7298
- *
7299
- * The Fine-tuning API only supports `.jsonl` files. The input also has certain
7300
- * required formats for fine-tuning
7301
- * [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
7302
- * [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
7303
- * models.
7304
- *
7305
- * The Batch API only supports `.jsonl` files up to 200 MB in size. The input also
7306
- * has a specific required
7307
- * [format](https://platform.openai.com/docs/api-reference/batch/request-input).
7294
+ * - The Assistants API supports files up to 2 million tokens and of specific file
7295
+ * types. See the
7296
+ * [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools)
7297
+ * for details.
7298
+ * - The Fine-tuning API only supports `.jsonl` files. The input also has certain
7299
+ * required formats for fine-tuning
7300
+ * [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input)
7301
+ * or
7302
+ * [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
7303
+ * models.
7304
+ * - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
7305
+ * also has a specific required
7306
+ * [format](https://platform.openai.com/docs/api-reference/batch/request-input).
7308
7307
  *
7309
7308
  * Please [contact us](https://help.openai.com/) if you need to increase these
7310
7309
  * storage limits.
@@ -8207,11 +8206,27 @@ class InputItems extends APIResource {
8207
8206
  }
8208
8207
  }
8209
8208
 
8209
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8210
+ class InputTokens extends APIResource {
8211
+ /**
8212
+ * Get input token counts
8213
+ *
8214
+ * @example
8215
+ * ```ts
8216
+ * const response = await client.responses.inputTokens.count();
8217
+ * ```
8218
+ */
8219
+ count(body = {}, options) {
8220
+ return this._client.post('/responses/input_tokens', { body, ...options });
8221
+ }
8222
+ }
8223
+
8210
8224
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8211
8225
  class Responses extends APIResource {
8212
8226
  constructor() {
8213
8227
  super(...arguments);
8214
8228
  this.inputItems = new InputItems(this._client);
8229
+ this.inputTokens = new InputTokens(this._client);
8215
8230
  }
8216
8231
  create(body, options) {
8217
8232
  return this._client.post('/responses', { body, ...options, stream: body.stream ?? false })._thenUnwrap((rsp) => {
@@ -8277,6 +8292,7 @@ class Responses extends APIResource {
8277
8292
  }
8278
8293
  }
8279
8294
  Responses.InputItems = InputItems;
8295
+ Responses.InputTokens = InputTokens;
8280
8296
 
8281
8297
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8282
8298
  class Parts extends APIResource {
@@ -16941,7 +16957,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16941
16957
  */
16942
16958
  async getHistoricalBars(params) {
16943
16959
  const symbols = params.symbols;
16944
- const symbolsStr = symbols.join(',');
16960
+ symbols.join(',');
16945
16961
  let allBars = {};
16946
16962
  let pageToken = null;
16947
16963
  let hasMorePages = true;
@@ -16952,7 +16968,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16952
16968
  symbols.forEach((symbol) => {
16953
16969
  allBars[symbol] = [];
16954
16970
  });
16955
- log(`Starting historical bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
16971
+ log(`Starting historical bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
16956
16972
  while (hasMorePages) {
16957
16973
  pageCount++;
16958
16974
  const requestParams = {
@@ -16963,7 +16979,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16963
16979
  };
16964
16980
  const response = await this.makeRequest('/stocks/bars', 'GET', requestParams);
16965
16981
  if (!response.bars) {
16966
- log(`No bars data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
16982
+ log(`No bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
16967
16983
  break;
16968
16984
  }
16969
16985
  // Track currency from first response
@@ -17005,10 +17021,10 @@ class AlpacaMarketDataAPI extends EventEmitter {
17005
17021
  }
17006
17022
  }
17007
17023
  // Final summary
17008
- const symbolsJoined = Object.entries(allBars)
17024
+ const symbolCounts = Object.entries(allBars)
17009
17025
  .map(([symbol, bars]) => `${symbol}: ${bars.length}`)
17010
17026
  .join(', ');
17011
- log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbolsJoined.length} symbols'}`);
17027
+ log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbols.length} symbols (${symbolCounts})`);
17012
17028
  return {
17013
17029
  bars: allBars,
17014
17030
  next_page_token: null, // Always null since we fetch all pages
@@ -17279,7 +17295,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17279
17295
  */
17280
17296
  async getHistoricalOptionsBars(params) {
17281
17297
  const symbols = params.symbols;
17282
- const symbolsStr = symbols.join(',');
17298
+ symbols.join(',');
17283
17299
  let allBars = {};
17284
17300
  let pageToken = null;
17285
17301
  let hasMorePages = true;
@@ -17289,7 +17305,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17289
17305
  symbols.forEach((symbol) => {
17290
17306
  allBars[symbol] = [];
17291
17307
  });
17292
- log(`Starting historical options bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
17308
+ log(`Starting historical options bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
17293
17309
  while (hasMorePages) {
17294
17310
  pageCount++;
17295
17311
  const requestParams = {
@@ -17298,7 +17314,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17298
17314
  };
17299
17315
  const response = await this.makeRequest('/options/bars', 'GET', requestParams, 'v1beta1');
17300
17316
  if (!response.bars) {
17301
- log(`No options bars data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
17317
+ log(`No options bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
17302
17318
  break;
17303
17319
  }
17304
17320
  // Combine bars for each symbol
@@ -17328,7 +17344,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17328
17344
  const dateRangeStr = earliestTimestamp && latestTimestamp
17329
17345
  ? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
17330
17346
  : 'unknown range';
17331
- log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbolsStr}, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17347
+ log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17332
17348
  type: 'debug',
17333
17349
  });
17334
17350
  // Prevent infinite loops
@@ -17357,7 +17373,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17357
17373
  */
17358
17374
  async getHistoricalOptionsTrades(params) {
17359
17375
  const symbols = params.symbols;
17360
- const symbolsStr = symbols.join(',');
17376
+ symbols.join(',');
17361
17377
  let allTrades = {};
17362
17378
  let pageToken = null;
17363
17379
  let hasMorePages = true;
@@ -17367,7 +17383,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17367
17383
  symbols.forEach((symbol) => {
17368
17384
  allTrades[symbol] = [];
17369
17385
  });
17370
- log(`Starting historical options trades fetch for ${symbolsStr.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
17386
+ log(`Starting historical options trades fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
17371
17387
  while (hasMorePages) {
17372
17388
  pageCount++;
17373
17389
  const requestParams = {
@@ -17376,7 +17392,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17376
17392
  };
17377
17393
  const response = await this.makeRequest('/options/trades', 'GET', requestParams, 'v1beta1');
17378
17394
  if (!response.trades) {
17379
- log(`No options trades data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
17395
+ log(`No options trades data found in response for ${symbols.length} symbols`, { type: 'warn' });
17380
17396
  break;
17381
17397
  }
17382
17398
  // Combine trades for each symbol
@@ -17406,7 +17422,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17406
17422
  const dateRangeStr = earliestTimestamp && latestTimestamp
17407
17423
  ? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
17408
17424
  : 'unknown range';
17409
- log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbolsStr.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17425
+ log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17410
17426
  type: 'debug',
17411
17427
  });
17412
17428
  // Prevent infinite loops