@discomedia/utils 1.0.43 → 1.0.45

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
@@ -1084,6 +1084,7 @@ function isOpenRouterModel(model) {
1084
1084
  'openai/gpt-5',
1085
1085
  'openai/gpt-5-mini',
1086
1086
  'openai/gpt-5-nano',
1087
+ 'openai/gpt-5.1',
1087
1088
  'openai/gpt-oss-120b',
1088
1089
  'z.ai/glm-4.5',
1089
1090
  'z.ai/glm-4.5-air',
@@ -2449,7 +2450,7 @@ const safeJSON = (text) => {
2449
2450
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2450
2451
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2451
2452
 
2452
- const VERSION = '6.7.0'; // x-release-please-version
2453
+ const VERSION = '6.9.1'; // x-release-please-version
2453
2454
 
2454
2455
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2455
2456
  const isRunningInBrowser = () => {
@@ -9428,6 +9429,10 @@ const openAiModelCosts = {
9428
9429
  inputCost: 0.05 / 1_000_000,
9429
9430
  outputCost: 0.4 / 1_000_000,
9430
9431
  },
9432
+ 'gpt-5.1': {
9433
+ inputCost: 1.25 / 1_000_000,
9434
+ outputCost: 10 / 1_000_000,
9435
+ },
9431
9436
  'o4-mini': {
9432
9437
  inputCost: 1.1 / 1_000_000,
9433
9438
  outputCost: 4.4 / 1_000_000,
@@ -9888,6 +9893,7 @@ const isSupportedModel = (model) => {
9888
9893
  'gpt-5',
9889
9894
  'gpt-5-mini',
9890
9895
  'gpt-5-nano',
9896
+ 'gpt-5.1',
9891
9897
  'o4-mini',
9892
9898
  'o3',
9893
9899
  ].includes(model);
@@ -9900,7 +9906,7 @@ const isSupportedModel = (model) => {
9900
9906
  function supportsTemperature(model) {
9901
9907
  // Reasoning models don't support temperature
9902
9908
  // GPT-5 models also do not support temperature
9903
- const reasoningAndGPT5Models = ['o1', 'o1-mini', 'o3-mini', 'o4-mini', 'o3', 'gpt-5', 'gpt-5-mini', 'gpt-5-nano'];
9909
+ const reasoningAndGPT5Models = ['o1', 'o1-mini', 'o3-mini', 'o4-mini', 'o3', 'gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'gpt-5.1'];
9904
9910
  return !reasoningAndGPT5Models.includes(model);
9905
9911
  }
9906
9912
  /**
@@ -9918,7 +9924,7 @@ function isReasoningModel(model) {
9918
9924
  * @returns True if the model is a GPT-5 model, false otherwise.
9919
9925
  */
9920
9926
  function isGPT5Model(model) {
9921
- const gpt5Models = ['gpt-5', 'gpt-5-mini', 'gpt-5-nano'];
9927
+ const gpt5Models = ['gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'gpt-5.1'];
9922
9928
  return gpt5Models.includes(model);
9923
9929
  }
9924
9930
  /**
@@ -16957,7 +16963,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16957
16963
  */
16958
16964
  async getHistoricalBars(params) {
16959
16965
  const symbols = params.symbols;
16960
- const symbolsStr = symbols.join(',');
16966
+ symbols.join(',');
16961
16967
  let allBars = {};
16962
16968
  let pageToken = null;
16963
16969
  let hasMorePages = true;
@@ -16968,7 +16974,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16968
16974
  symbols.forEach((symbol) => {
16969
16975
  allBars[symbol] = [];
16970
16976
  });
16971
- log(`Starting historical bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
16977
+ log(`Starting historical bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
16972
16978
  while (hasMorePages) {
16973
16979
  pageCount++;
16974
16980
  const requestParams = {
@@ -16979,7 +16985,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16979
16985
  };
16980
16986
  const response = await this.makeRequest('/stocks/bars', 'GET', requestParams);
16981
16987
  if (!response.bars) {
16982
- log(`No bars data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
16988
+ log(`No bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
16983
16989
  break;
16984
16990
  }
16985
16991
  // Track currency from first response
@@ -17021,10 +17027,10 @@ class AlpacaMarketDataAPI extends EventEmitter {
17021
17027
  }
17022
17028
  }
17023
17029
  // Final summary
17024
- const symbolsJoined = Object.entries(allBars)
17030
+ const symbolCounts = Object.entries(allBars)
17025
17031
  .map(([symbol, bars]) => `${symbol}: ${bars.length}`)
17026
17032
  .join(', ');
17027
- log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbolsJoined.length} symbols'}`);
17033
+ log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbols.length} symbols (${symbolCounts})`);
17028
17034
  return {
17029
17035
  bars: allBars,
17030
17036
  next_page_token: null, // Always null since we fetch all pages
@@ -17295,7 +17301,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17295
17301
  */
17296
17302
  async getHistoricalOptionsBars(params) {
17297
17303
  const symbols = params.symbols;
17298
- const symbolsStr = symbols.join(',');
17304
+ symbols.join(',');
17299
17305
  let allBars = {};
17300
17306
  let pageToken = null;
17301
17307
  let hasMorePages = true;
@@ -17305,7 +17311,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17305
17311
  symbols.forEach((symbol) => {
17306
17312
  allBars[symbol] = [];
17307
17313
  });
17308
- log(`Starting historical options bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
17314
+ log(`Starting historical options bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
17309
17315
  while (hasMorePages) {
17310
17316
  pageCount++;
17311
17317
  const requestParams = {
@@ -17314,7 +17320,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17314
17320
  };
17315
17321
  const response = await this.makeRequest('/options/bars', 'GET', requestParams, 'v1beta1');
17316
17322
  if (!response.bars) {
17317
- log(`No options bars data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
17323
+ log(`No options bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
17318
17324
  break;
17319
17325
  }
17320
17326
  // Combine bars for each symbol
@@ -17344,7 +17350,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17344
17350
  const dateRangeStr = earliestTimestamp && latestTimestamp
17345
17351
  ? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
17346
17352
  : 'unknown range';
17347
- log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbolsStr}, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17353
+ log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17348
17354
  type: 'debug',
17349
17355
  });
17350
17356
  // Prevent infinite loops
@@ -17373,7 +17379,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17373
17379
  */
17374
17380
  async getHistoricalOptionsTrades(params) {
17375
17381
  const symbols = params.symbols;
17376
- const symbolsStr = symbols.join(',');
17382
+ symbols.join(',');
17377
17383
  let allTrades = {};
17378
17384
  let pageToken = null;
17379
17385
  let hasMorePages = true;
@@ -17383,7 +17389,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17383
17389
  symbols.forEach((symbol) => {
17384
17390
  allTrades[symbol] = [];
17385
17391
  });
17386
- log(`Starting historical options trades fetch for ${symbolsStr.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
17392
+ log(`Starting historical options trades fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
17387
17393
  while (hasMorePages) {
17388
17394
  pageCount++;
17389
17395
  const requestParams = {
@@ -17392,7 +17398,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17392
17398
  };
17393
17399
  const response = await this.makeRequest('/options/trades', 'GET', requestParams, 'v1beta1');
17394
17400
  if (!response.trades) {
17395
- log(`No options trades data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
17401
+ log(`No options trades data found in response for ${symbols.length} symbols`, { type: 'warn' });
17396
17402
  break;
17397
17403
  }
17398
17404
  // Combine trades for each symbol
@@ -17422,7 +17428,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17422
17428
  const dateRangeStr = earliestTimestamp && latestTimestamp
17423
17429
  ? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
17424
17430
  : 'unknown range';
17425
- log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbolsStr.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17431
+ log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17426
17432
  type: 'debug',
17427
17433
  });
17428
17434
  // Prevent infinite loops