@discomedia/utils 1.0.6 → 1.0.7

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.
Files changed (78) hide show
  1. package/README.md +95 -3
  2. package/dist/index-frontend.cjs +16027 -0
  3. package/dist/index-frontend.cjs.map +1 -0
  4. package/dist/index-frontend.mjs +16023 -0
  5. package/dist/index-frontend.mjs.map +1 -0
  6. package/dist/index.cjs +529 -10
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.mjs +529 -10
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/package.json +7 -1
  11. package/dist/test.js +6426 -582
  12. package/dist/test.js.map +1 -1
  13. package/dist/types/alpaca-market-data-api.d.ts +1 -0
  14. package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
  15. package/dist/types/alpaca-trading-api.d.ts.map +1 -1
  16. package/dist/types/index-frontend.d.ts +15 -0
  17. package/dist/types/index-frontend.d.ts.map +1 -0
  18. package/dist/types/old-test.d.ts +2 -0
  19. package/dist/types/old-test.d.ts.map +1 -0
  20. package/dist/types-frontend/alpaca-market-data-api.d.ts +372 -0
  21. package/dist/types-frontend/alpaca-market-data-api.d.ts.map +1 -0
  22. package/dist/types-frontend/alpaca-trading-api.d.ts +315 -0
  23. package/dist/types-frontend/alpaca-trading-api.d.ts.map +1 -0
  24. package/dist/types-frontend/format-tools.d.ts +46 -0
  25. package/dist/types-frontend/format-tools.d.ts.map +1 -0
  26. package/dist/types-frontend/index-frontend.d.ts +15 -0
  27. package/dist/types-frontend/index-frontend.d.ts.map +1 -0
  28. package/dist/types-frontend/index.d.ts +125 -0
  29. package/dist/types-frontend/index.d.ts.map +1 -0
  30. package/dist/types-frontend/json-tools.d.ts +33 -0
  31. package/dist/types-frontend/json-tools.d.ts.map +1 -0
  32. package/dist/types-frontend/llm-config.d.ts +36 -0
  33. package/dist/types-frontend/llm-config.d.ts.map +1 -0
  34. package/dist/types-frontend/llm-deepseek.d.ts +12 -0
  35. package/dist/types-frontend/llm-deepseek.d.ts.map +1 -0
  36. package/dist/types-frontend/llm-images.d.ts +49 -0
  37. package/dist/types-frontend/llm-images.d.ts.map +1 -0
  38. package/dist/types-frontend/llm-openai.d.ts +64 -0
  39. package/dist/types-frontend/llm-openai.d.ts.map +1 -0
  40. package/dist/types-frontend/llm-utils.d.ts +16 -0
  41. package/dist/types-frontend/llm-utils.d.ts.map +1 -0
  42. package/dist/types-frontend/logging.d.ts +12 -0
  43. package/dist/types-frontend/logging.d.ts.map +1 -0
  44. package/dist/types-frontend/market-hours.d.ts +24 -0
  45. package/dist/types-frontend/market-hours.d.ts.map +1 -0
  46. package/dist/types-frontend/market-time.d.ts +254 -0
  47. package/dist/types-frontend/market-time.d.ts.map +1 -0
  48. package/dist/types-frontend/misc-utils.d.ts +49 -0
  49. package/dist/types-frontend/misc-utils.d.ts.map +1 -0
  50. package/dist/types-frontend/old-test.d.ts +2 -0
  51. package/dist/types-frontend/old-test.d.ts.map +1 -0
  52. package/dist/types-frontend/polygon-indices.d.ts +85 -0
  53. package/dist/types-frontend/polygon-indices.d.ts.map +1 -0
  54. package/dist/types-frontend/polygon.d.ts +126 -0
  55. package/dist/types-frontend/polygon.d.ts.map +1 -0
  56. package/dist/types-frontend/technical-analysis.d.ts +90 -0
  57. package/dist/types-frontend/technical-analysis.d.ts.map +1 -0
  58. package/dist/types-frontend/test.d.ts +2 -0
  59. package/dist/types-frontend/test.d.ts.map +1 -0
  60. package/dist/types-frontend/testing/market-time-refactor-test.d.ts +1 -0
  61. package/dist/types-frontend/testing/market-time-refactor-test.d.ts.map +1 -0
  62. package/dist/types-frontend/types/alpaca-types.d.ts +962 -0
  63. package/dist/types-frontend/types/alpaca-types.d.ts.map +1 -0
  64. package/dist/types-frontend/types/index.d.ts +7 -0
  65. package/dist/types-frontend/types/index.d.ts.map +1 -0
  66. package/dist/types-frontend/types/llm-types.d.ts +82 -0
  67. package/dist/types-frontend/types/llm-types.d.ts.map +1 -0
  68. package/dist/types-frontend/types/logging-types.d.ts +10 -0
  69. package/dist/types-frontend/types/logging-types.d.ts.map +1 -0
  70. package/dist/types-frontend/types/market-time-types.d.ts +59 -0
  71. package/dist/types-frontend/types/market-time-types.d.ts.map +1 -0
  72. package/dist/types-frontend/types/polygon-indices-types.d.ts +190 -0
  73. package/dist/types-frontend/types/polygon-indices-types.d.ts.map +1 -0
  74. package/dist/types-frontend/types/polygon-types.d.ts +204 -0
  75. package/dist/types-frontend/types/polygon-types.d.ts.map +1 -0
  76. package/dist/types-frontend/types/ta-types.d.ts +89 -0
  77. package/dist/types-frontend/types/ta-types.d.ts.map +1 -0
  78. package/package.json +7 -1
package/dist/index.cjs CHANGED
@@ -3,15 +3,18 @@
3
3
  var dateFns = require('date-fns');
4
4
  var dateFnsTz = require('date-fns-tz');
5
5
  var require$$0$3 = require('events');
6
- var require$$1$1 = require('https');
6
+ var require$$1 = require('https');
7
7
  var require$$2 = require('http');
8
- var require$$3 = require('net');
9
- var require$$4 = require('tls');
10
- var require$$1 = require('crypto');
8
+ var require$$3$1 = require('net');
9
+ var require$$4$1 = require('tls');
10
+ var require$$3 = require('crypto');
11
11
  var require$$0$2 = require('stream');
12
12
  var require$$7 = require('url');
13
13
  var require$$0 = require('zlib');
14
14
  var require$$0$1 = require('buffer');
15
+ var require$$0$4 = require('fs');
16
+ var require$$1$1 = require('path');
17
+ var require$$2$1 = require('os');
15
18
 
16
19
  /**
17
20
  * Logs a message to the console.
@@ -11880,7 +11883,7 @@ function requireSender () {
11880
11883
  hasRequiredSender = 1;
11881
11884
 
11882
11885
  const { Duplex } = require$$0$2;
11883
- const { randomFillSync } = require$$1;
11886
+ const { randomFillSync } = require$$3;
11884
11887
 
11885
11888
  const PerMessageDeflate = requirePermessageDeflate();
11886
11889
  const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
@@ -13001,11 +13004,11 @@ function requireWebsocket () {
13001
13004
  hasRequiredWebsocket = 1;
13002
13005
 
13003
13006
  const EventEmitter = require$$0$3;
13004
- const https = require$$1$1;
13007
+ const https = require$$1;
13005
13008
  const http = require$$2;
13006
- const net = require$$3;
13007
- const tls = require$$4;
13008
- const { randomBytes, createHash } = require$$1;
13009
+ const net = require$$3$1;
13010
+ const tls = require$$4$1;
13011
+ const { randomBytes, createHash } = require$$3;
13009
13012
  const { Duplex, Readable } = require$$0$2;
13010
13013
  const { URL } = require$$7;
13011
13014
 
@@ -14648,7 +14651,7 @@ function requireWebsocketServer () {
14648
14651
  const EventEmitter = require$$0$3;
14649
14652
  const http = require$$2;
14650
14653
  const { Duplex } = require$$0$2;
14651
- const { createHash } = require$$1;
14654
+ const { createHash } = require$$3;
14652
14655
 
14653
14656
  const extension = requireExtension();
14654
14657
  const PerMessageDeflate = requirePermessageDeflate();
@@ -15196,6 +15199,522 @@ function requireWebsocketServer () {
15196
15199
 
15197
15200
  requireWebsocketServer();
15198
15201
 
15202
+ var config = {};
15203
+
15204
+ var main = {exports: {}};
15205
+
15206
+ var version = "17.1.0";
15207
+ var require$$4 = {
15208
+ version: version};
15209
+
15210
+ var hasRequiredMain;
15211
+
15212
+ function requireMain () {
15213
+ if (hasRequiredMain) return main.exports;
15214
+ hasRequiredMain = 1;
15215
+ const fs = require$$0$4;
15216
+ const path = require$$1$1;
15217
+ const os = require$$2$1;
15218
+ const crypto = require$$3;
15219
+ const packageJson = require$$4;
15220
+
15221
+ const version = packageJson.version;
15222
+
15223
+ // Array of tips to display randomly
15224
+ const TIPS = [
15225
+ '🔐 encrypt with dotenvx: https://dotenvx.com',
15226
+ '🔐 prevent committing .env to code: https://dotenvx.com/precommit',
15227
+ '🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
15228
+ '🛠️ run anywhere with `dotenvx run -- yourcommand`',
15229
+ '⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
15230
+ '⚙️ enable debug logging with { debug: true }',
15231
+ '⚙️ override existing env vars with { override: true }',
15232
+ '⚙️ suppress all logs with { quiet: true }',
15233
+ '⚙️ write to custom object with { processEnv: myObject }',
15234
+ '⚙️ load multiple .env files with { path: [\'.env.local\', \'.env\'] }'
15235
+ ];
15236
+
15237
+ // Get a random tip from the tips array
15238
+ function _getRandomTip () {
15239
+ return TIPS[Math.floor(Math.random() * TIPS.length)]
15240
+ }
15241
+
15242
+ function supportsAnsi () {
15243
+ return process.stdout.isTTY // && process.env.TERM !== 'dumb'
15244
+ }
15245
+
15246
+ function dim (text) {
15247
+ return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text
15248
+ }
15249
+
15250
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
15251
+
15252
+ // Parse src into an Object
15253
+ function parse (src) {
15254
+ const obj = {};
15255
+
15256
+ // Convert buffer to string
15257
+ let lines = src.toString();
15258
+
15259
+ // Convert line breaks to same format
15260
+ lines = lines.replace(/\r\n?/mg, '\n');
15261
+
15262
+ let match;
15263
+ while ((match = LINE.exec(lines)) != null) {
15264
+ const key = match[1];
15265
+
15266
+ // Default undefined or null to empty string
15267
+ let value = (match[2] || '');
15268
+
15269
+ // Remove whitespace
15270
+ value = value.trim();
15271
+
15272
+ // Check if double quoted
15273
+ const maybeQuote = value[0];
15274
+
15275
+ // Remove surrounding quotes
15276
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
15277
+
15278
+ // Expand newlines if double quoted
15279
+ if (maybeQuote === '"') {
15280
+ value = value.replace(/\\n/g, '\n');
15281
+ value = value.replace(/\\r/g, '\r');
15282
+ }
15283
+
15284
+ // Add to object
15285
+ obj[key] = value;
15286
+ }
15287
+
15288
+ return obj
15289
+ }
15290
+
15291
+ function _parseVault (options) {
15292
+ options = options || {};
15293
+
15294
+ const vaultPath = _vaultPath(options);
15295
+ options.path = vaultPath; // parse .env.vault
15296
+ const result = DotenvModule.configDotenv(options);
15297
+ if (!result.parsed) {
15298
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
15299
+ err.code = 'MISSING_DATA';
15300
+ throw err
15301
+ }
15302
+
15303
+ // handle scenario for comma separated keys - for use with key rotation
15304
+ // example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
15305
+ const keys = _dotenvKey(options).split(',');
15306
+ const length = keys.length;
15307
+
15308
+ let decrypted;
15309
+ for (let i = 0; i < length; i++) {
15310
+ try {
15311
+ // Get full key
15312
+ const key = keys[i].trim();
15313
+
15314
+ // Get instructions for decrypt
15315
+ const attrs = _instructions(result, key);
15316
+
15317
+ // Decrypt
15318
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
15319
+
15320
+ break
15321
+ } catch (error) {
15322
+ // last key
15323
+ if (i + 1 >= length) {
15324
+ throw error
15325
+ }
15326
+ // try next key
15327
+ }
15328
+ }
15329
+
15330
+ // Parse decrypted .env string
15331
+ return DotenvModule.parse(decrypted)
15332
+ }
15333
+
15334
+ function _warn (message) {
15335
+ console.error(`[dotenv@${version}][WARN] ${message}`);
15336
+ }
15337
+
15338
+ function _debug (message) {
15339
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
15340
+ }
15341
+
15342
+ function _log (message) {
15343
+ console.log(`[dotenv@${version}] ${message}`);
15344
+ }
15345
+
15346
+ function _dotenvKey (options) {
15347
+ // prioritize developer directly setting options.DOTENV_KEY
15348
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
15349
+ return options.DOTENV_KEY
15350
+ }
15351
+
15352
+ // secondary infra already contains a DOTENV_KEY environment variable
15353
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
15354
+ return process.env.DOTENV_KEY
15355
+ }
15356
+
15357
+ // fallback to empty string
15358
+ return ''
15359
+ }
15360
+
15361
+ function _instructions (result, dotenvKey) {
15362
+ // Parse DOTENV_KEY. Format is a URI
15363
+ let uri;
15364
+ try {
15365
+ uri = new URL(dotenvKey);
15366
+ } catch (error) {
15367
+ if (error.code === 'ERR_INVALID_URL') {
15368
+ const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');
15369
+ err.code = 'INVALID_DOTENV_KEY';
15370
+ throw err
15371
+ }
15372
+
15373
+ throw error
15374
+ }
15375
+
15376
+ // Get decrypt key
15377
+ const key = uri.password;
15378
+ if (!key) {
15379
+ const err = new Error('INVALID_DOTENV_KEY: Missing key part');
15380
+ err.code = 'INVALID_DOTENV_KEY';
15381
+ throw err
15382
+ }
15383
+
15384
+ // Get environment
15385
+ const environment = uri.searchParams.get('environment');
15386
+ if (!environment) {
15387
+ const err = new Error('INVALID_DOTENV_KEY: Missing environment part');
15388
+ err.code = 'INVALID_DOTENV_KEY';
15389
+ throw err
15390
+ }
15391
+
15392
+ // Get ciphertext payload
15393
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
15394
+ const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
15395
+ if (!ciphertext) {
15396
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
15397
+ err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT';
15398
+ throw err
15399
+ }
15400
+
15401
+ return { ciphertext, key }
15402
+ }
15403
+
15404
+ function _vaultPath (options) {
15405
+ let possibleVaultPath = null;
15406
+
15407
+ if (options && options.path && options.path.length > 0) {
15408
+ if (Array.isArray(options.path)) {
15409
+ for (const filepath of options.path) {
15410
+ if (fs.existsSync(filepath)) {
15411
+ possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`;
15412
+ }
15413
+ }
15414
+ } else {
15415
+ possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
15416
+ }
15417
+ } else {
15418
+ possibleVaultPath = path.resolve(process.cwd(), '.env.vault');
15419
+ }
15420
+
15421
+ if (fs.existsSync(possibleVaultPath)) {
15422
+ return possibleVaultPath
15423
+ }
15424
+
15425
+ return null
15426
+ }
15427
+
15428
+ function _resolveHome (envPath) {
15429
+ return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
15430
+ }
15431
+
15432
+ function _configVault (options) {
15433
+ const debug = Boolean(options && options.debug);
15434
+ const quiet = Boolean(options && options.quiet);
15435
+
15436
+ if (debug || !quiet) {
15437
+ _log('Loading env from encrypted .env.vault');
15438
+ }
15439
+
15440
+ const parsed = DotenvModule._parseVault(options);
15441
+
15442
+ let processEnv = process.env;
15443
+ if (options && options.processEnv != null) {
15444
+ processEnv = options.processEnv;
15445
+ }
15446
+
15447
+ DotenvModule.populate(processEnv, parsed, options);
15448
+
15449
+ return { parsed }
15450
+ }
15451
+
15452
+ function configDotenv (options) {
15453
+ const dotenvPath = path.resolve(process.cwd(), '.env');
15454
+ let encoding = 'utf8';
15455
+ const debug = Boolean(options && options.debug);
15456
+ const quiet = Boolean(options && options.quiet);
15457
+
15458
+ if (options && options.encoding) {
15459
+ encoding = options.encoding;
15460
+ } else {
15461
+ if (debug) {
15462
+ _debug('No encoding is specified. UTF-8 is used by default');
15463
+ }
15464
+ }
15465
+
15466
+ let optionPaths = [dotenvPath]; // default, look for .env
15467
+ if (options && options.path) {
15468
+ if (!Array.isArray(options.path)) {
15469
+ optionPaths = [_resolveHome(options.path)];
15470
+ } else {
15471
+ optionPaths = []; // reset default
15472
+ for (const filepath of options.path) {
15473
+ optionPaths.push(_resolveHome(filepath));
15474
+ }
15475
+ }
15476
+ }
15477
+
15478
+ // Build the parsed data in a temporary object (because we need to return it). Once we have the final
15479
+ // parsed data, we will combine it with process.env (or options.processEnv if provided).
15480
+ let lastError;
15481
+ const parsedAll = {};
15482
+ for (const path of optionPaths) {
15483
+ try {
15484
+ // Specifying an encoding returns a string instead of a buffer
15485
+ const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
15486
+
15487
+ DotenvModule.populate(parsedAll, parsed, options);
15488
+ } catch (e) {
15489
+ if (debug) {
15490
+ _debug(`Failed to load ${path} ${e.message}`);
15491
+ }
15492
+ lastError = e;
15493
+ }
15494
+ }
15495
+
15496
+ let processEnv = process.env;
15497
+ if (options && options.processEnv != null) {
15498
+ processEnv = options.processEnv;
15499
+ }
15500
+
15501
+ const populated = DotenvModule.populate(processEnv, parsedAll, options);
15502
+
15503
+ if (debug || !quiet) {
15504
+ const keysCount = Object.keys(populated).length;
15505
+ const shortPaths = [];
15506
+ for (const filePath of optionPaths) {
15507
+ try {
15508
+ const relative = path.relative(process.cwd(), filePath);
15509
+ shortPaths.push(relative);
15510
+ } catch (e) {
15511
+ if (debug) {
15512
+ _debug(`Failed to load ${filePath} ${e.message}`);
15513
+ }
15514
+ lastError = e;
15515
+ }
15516
+ }
15517
+
15518
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(',')} ${dim(`(tip: ${_getRandomTip()})`)}`);
15519
+ }
15520
+
15521
+ if (lastError) {
15522
+ return { parsed: parsedAll, error: lastError }
15523
+ } else {
15524
+ return { parsed: parsedAll }
15525
+ }
15526
+ }
15527
+
15528
+ // Populates process.env from .env file
15529
+ function config (options) {
15530
+ // fallback to original dotenv if DOTENV_KEY is not set
15531
+ if (_dotenvKey(options).length === 0) {
15532
+ return DotenvModule.configDotenv(options)
15533
+ }
15534
+
15535
+ const vaultPath = _vaultPath(options);
15536
+
15537
+ // dotenvKey exists but .env.vault file does not exist
15538
+ if (!vaultPath) {
15539
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
15540
+
15541
+ return DotenvModule.configDotenv(options)
15542
+ }
15543
+
15544
+ return DotenvModule._configVault(options)
15545
+ }
15546
+
15547
+ function decrypt (encrypted, keyStr) {
15548
+ const key = Buffer.from(keyStr.slice(-64), 'hex');
15549
+ let ciphertext = Buffer.from(encrypted, 'base64');
15550
+
15551
+ const nonce = ciphertext.subarray(0, 12);
15552
+ const authTag = ciphertext.subarray(-16);
15553
+ ciphertext = ciphertext.subarray(12, -16);
15554
+
15555
+ try {
15556
+ const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
15557
+ aesgcm.setAuthTag(authTag);
15558
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
15559
+ } catch (error) {
15560
+ const isRange = error instanceof RangeError;
15561
+ const invalidKeyLength = error.message === 'Invalid key length';
15562
+ const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
15563
+
15564
+ if (isRange || invalidKeyLength) {
15565
+ const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)');
15566
+ err.code = 'INVALID_DOTENV_KEY';
15567
+ throw err
15568
+ } else if (decryptionFailed) {
15569
+ const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');
15570
+ err.code = 'DECRYPTION_FAILED';
15571
+ throw err
15572
+ } else {
15573
+ throw error
15574
+ }
15575
+ }
15576
+ }
15577
+
15578
+ // Populate process.env with parsed values
15579
+ function populate (processEnv, parsed, options = {}) {
15580
+ const debug = Boolean(options && options.debug);
15581
+ const override = Boolean(options && options.override);
15582
+ const populated = {};
15583
+
15584
+ if (typeof parsed !== 'object') {
15585
+ const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
15586
+ err.code = 'OBJECT_REQUIRED';
15587
+ throw err
15588
+ }
15589
+
15590
+ // Set process.env
15591
+ for (const key of Object.keys(parsed)) {
15592
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
15593
+ if (override === true) {
15594
+ processEnv[key] = parsed[key];
15595
+ populated[key] = parsed[key];
15596
+ }
15597
+
15598
+ if (debug) {
15599
+ if (override === true) {
15600
+ _debug(`"${key}" is already defined and WAS overwritten`);
15601
+ } else {
15602
+ _debug(`"${key}" is already defined and was NOT overwritten`);
15603
+ }
15604
+ }
15605
+ } else {
15606
+ processEnv[key] = parsed[key];
15607
+ populated[key] = parsed[key];
15608
+ }
15609
+ }
15610
+
15611
+ return populated
15612
+ }
15613
+
15614
+ const DotenvModule = {
15615
+ configDotenv,
15616
+ _configVault,
15617
+ _parseVault,
15618
+ config,
15619
+ decrypt,
15620
+ parse,
15621
+ populate
15622
+ };
15623
+
15624
+ main.exports.configDotenv = DotenvModule.configDotenv;
15625
+ main.exports._configVault = DotenvModule._configVault;
15626
+ main.exports._parseVault = DotenvModule._parseVault;
15627
+ main.exports.config = DotenvModule.config;
15628
+ main.exports.decrypt = DotenvModule.decrypt;
15629
+ main.exports.parse = DotenvModule.parse;
15630
+ main.exports.populate = DotenvModule.populate;
15631
+
15632
+ main.exports = DotenvModule;
15633
+ return main.exports;
15634
+ }
15635
+
15636
+ var envOptions;
15637
+ var hasRequiredEnvOptions;
15638
+
15639
+ function requireEnvOptions () {
15640
+ if (hasRequiredEnvOptions) return envOptions;
15641
+ hasRequiredEnvOptions = 1;
15642
+ // ../config.js accepts options via environment variables
15643
+ const options = {};
15644
+
15645
+ if (process.env.DOTENV_CONFIG_ENCODING != null) {
15646
+ options.encoding = process.env.DOTENV_CONFIG_ENCODING;
15647
+ }
15648
+
15649
+ if (process.env.DOTENV_CONFIG_PATH != null) {
15650
+ options.path = process.env.DOTENV_CONFIG_PATH;
15651
+ }
15652
+
15653
+ if (process.env.DOTENV_CONFIG_QUIET != null) {
15654
+ options.quiet = process.env.DOTENV_CONFIG_QUIET;
15655
+ }
15656
+
15657
+ if (process.env.DOTENV_CONFIG_DEBUG != null) {
15658
+ options.debug = process.env.DOTENV_CONFIG_DEBUG;
15659
+ }
15660
+
15661
+ if (process.env.DOTENV_CONFIG_OVERRIDE != null) {
15662
+ options.override = process.env.DOTENV_CONFIG_OVERRIDE;
15663
+ }
15664
+
15665
+ if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
15666
+ options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
15667
+ }
15668
+
15669
+ envOptions = options;
15670
+ return envOptions;
15671
+ }
15672
+
15673
+ var cliOptions;
15674
+ var hasRequiredCliOptions;
15675
+
15676
+ function requireCliOptions () {
15677
+ if (hasRequiredCliOptions) return cliOptions;
15678
+ hasRequiredCliOptions = 1;
15679
+ const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
15680
+
15681
+ cliOptions = function optionMatcher (args) {
15682
+ const options = args.reduce(function (acc, cur) {
15683
+ const matches = cur.match(re);
15684
+ if (matches) {
15685
+ acc[matches[1]] = matches[2];
15686
+ }
15687
+ return acc
15688
+ }, {});
15689
+
15690
+ if (!('quiet' in options)) {
15691
+ options.quiet = 'true';
15692
+ }
15693
+
15694
+ return options
15695
+ };
15696
+ return cliOptions;
15697
+ }
15698
+
15699
+ var hasRequiredConfig;
15700
+
15701
+ function requireConfig () {
15702
+ if (hasRequiredConfig) return config;
15703
+ hasRequiredConfig = 1;
15704
+ (function () {
15705
+ requireMain().config(
15706
+ Object.assign(
15707
+ {},
15708
+ requireEnvOptions(),
15709
+ requireCliOptions()(process.argv)
15710
+ )
15711
+ );
15712
+ })();
15713
+ return config;
15714
+ }
15715
+
15716
+ requireConfig();
15717
+
15199
15718
  const log = (message, options = { type: 'info' }) => {
15200
15719
  log$1(message, { ...options, source: 'AlpacaMarketDataAPI' });
15201
15720
  };