@discomedia/utils 1.0.65 → 1.0.67

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.cjs CHANGED
@@ -4,7 +4,7 @@ var require$$0$3 = require('events');
4
4
  var require$$1 = require('https');
5
5
  var require$$2 = require('http');
6
6
  var require$$3$1 = require('net');
7
- var require$$4$1 = require('tls');
7
+ var require$$4 = require('tls');
8
8
  var require$$3 = require('crypto');
9
9
  var require$$0$2 = require('stream');
10
10
  var require$$7 = require('url');
@@ -1565,6 +1565,37 @@ class InvalidWebhookSignatureError extends Error {
1565
1565
  super(message);
1566
1566
  }
1567
1567
  }
1568
+ /**
1569
+ * Error thrown by the API server during OAuth token exchange.
1570
+ * Can have status codes 400, 401, or 403.
1571
+ * Other status codes from OAuth endpoints are raised as normal APIError types.
1572
+ */
1573
+ class OAuthError extends APIError {
1574
+ constructor(status, error, headers) {
1575
+ let finalMessage = 'OAuth2 authentication error';
1576
+ let error_code = undefined;
1577
+ if (error && typeof error === 'object') {
1578
+ const errorData = error;
1579
+ error_code = errorData['error'];
1580
+ const description = errorData['error_description'];
1581
+ if (description && typeof description === 'string') {
1582
+ finalMessage = description;
1583
+ }
1584
+ else if (error_code) {
1585
+ finalMessage = error_code;
1586
+ }
1587
+ }
1588
+ super(status, error, finalMessage, headers);
1589
+ this.error_code = error_code;
1590
+ }
1591
+ }
1592
+ class SubjectTokenProviderError extends OpenAIError {
1593
+ constructor(message, provider, cause) {
1594
+ super(message);
1595
+ this.provider = provider;
1596
+ this.cause = cause;
1597
+ }
1598
+ }
1568
1599
 
1569
1600
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1570
1601
  // https://url.spec.whatwg.org/#url-scheme-string
@@ -1617,7 +1648,7 @@ const safeJSON = (text) => {
1617
1648
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1618
1649
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1619
1650
 
1620
- const VERSION = '6.32.0'; // x-release-please-version
1651
+ const VERSION = '6.34.0'; // x-release-please-version
1621
1652
 
1622
1653
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1623
1654
  const isRunningInBrowser = () => {
@@ -2998,6 +3029,91 @@ class ConversationCursorPage extends AbstractPage {
2998
3029
  }
2999
3030
  }
3000
3031
 
3032
+ const SUBJECT_TOKEN_TYPES = {
3033
+ jwt: 'urn:ietf:params:oauth:token-type:jwt',
3034
+ id: 'urn:ietf:params:oauth:token-type:id_token',
3035
+ };
3036
+ const TOKEN_EXCHANGE_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:token-exchange';
3037
+ class WorkloadIdentityAuth {
3038
+ constructor(config, fetch) {
3039
+ this.cachedToken = null;
3040
+ this.refreshPromise = null;
3041
+ this.tokenExchangeUrl = 'https://auth.openai.com/oauth/token';
3042
+ this.config = config;
3043
+ this.fetch = fetch ?? getDefaultFetch();
3044
+ }
3045
+ async getToken() {
3046
+ if (!this.cachedToken || this.isTokenExpired(this.cachedToken)) {
3047
+ if (this.refreshPromise) {
3048
+ return await this.refreshPromise;
3049
+ }
3050
+ this.refreshPromise = this.refreshToken();
3051
+ try {
3052
+ const token = await this.refreshPromise;
3053
+ return token;
3054
+ }
3055
+ finally {
3056
+ this.refreshPromise = null;
3057
+ }
3058
+ }
3059
+ if (this.needsRefresh(this.cachedToken) && !this.refreshPromise) {
3060
+ this.refreshPromise = this.refreshToken().finally(() => {
3061
+ this.refreshPromise = null;
3062
+ });
3063
+ }
3064
+ return this.cachedToken.token;
3065
+ }
3066
+ async refreshToken() {
3067
+ const subjectToken = await this.config.provider.getToken();
3068
+ const response = await this.fetch(this.tokenExchangeUrl, {
3069
+ method: 'POST',
3070
+ headers: {
3071
+ 'Content-Type': 'application/json',
3072
+ },
3073
+ body: JSON.stringify({
3074
+ grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
3075
+ client_id: this.config.clientId,
3076
+ subject_token: subjectToken,
3077
+ subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
3078
+ identity_provider_id: this.config.identityProviderId,
3079
+ service_account_id: this.config.serviceAccountId,
3080
+ }),
3081
+ });
3082
+ if (!response.ok) {
3083
+ const errorText = await response.text();
3084
+ let body = undefined;
3085
+ try {
3086
+ body = JSON.parse(errorText);
3087
+ }
3088
+ catch { }
3089
+ if (response.status === 400 || response.status === 401 || response.status === 403) {
3090
+ throw new OAuthError(response.status, body, response.headers);
3091
+ }
3092
+ throw APIError.generate(response.status, body, `Token exchange failed with status ${response.status}`, response.headers);
3093
+ }
3094
+ const tokenResponse = (await response.json());
3095
+ const expiresIn = tokenResponse.expires_in || 3600;
3096
+ const expiresAt = Date.now() + expiresIn * 1000;
3097
+ this.cachedToken = {
3098
+ token: tokenResponse.access_token,
3099
+ expiresAt,
3100
+ };
3101
+ return tokenResponse.access_token;
3102
+ }
3103
+ isTokenExpired(cachedToken) {
3104
+ return Date.now() >= cachedToken.expiresAt;
3105
+ }
3106
+ needsRefresh(cachedToken) {
3107
+ const bufferSeconds = this.config.refreshBufferSeconds ?? 1200;
3108
+ const bufferMs = bufferSeconds * 1000;
3109
+ return Date.now() >= cachedToken.expiresAt - bufferMs;
3110
+ }
3111
+ invalidateToken() {
3112
+ this.cachedToken = null;
3113
+ this.refreshPromise = null;
3114
+ }
3115
+ }
3116
+
3001
3117
  const checkFileSupport = () => {
3002
3118
  if (typeof File === 'undefined') {
3003
3119
  const { process } = globalThis;
@@ -8303,6 +8419,7 @@ _Webhooks_instances = new WeakSet(), _Webhooks_validateSecret = function _Webhoo
8303
8419
 
8304
8420
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8305
8421
  var _OpenAI_instances, _a$1, _OpenAI_encoder, _OpenAI_baseURLOverridden;
8422
+ const WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER = 'workload-identity-auth';
8306
8423
  /**
8307
8424
  * API Client for interfacing with the OpenAI API.
8308
8425
  */
@@ -8323,7 +8440,7 @@ class OpenAI {
8323
8440
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
8324
8441
  * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
8325
8442
  */
8326
- constructor({ baseURL = readEnv('OPENAI_BASE_URL'), apiKey = readEnv('OPENAI_API_KEY'), organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, ...opts } = {}) {
8443
+ constructor({ baseURL = readEnv('OPENAI_BASE_URL'), apiKey = readEnv('OPENAI_API_KEY'), organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, workloadIdentity, ...opts } = {}) {
8327
8444
  _OpenAI_instances.add(this);
8328
8445
  _OpenAI_encoder.set(this, void 0);
8329
8446
  /**
@@ -8378,14 +8495,21 @@ class OpenAI {
8378
8495
  this.containers = new Containers(this);
8379
8496
  this.skills = new Skills(this);
8380
8497
  this.videos = new Videos(this);
8381
- if (apiKey === undefined) {
8382
- throw new OpenAIError('Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.');
8498
+ if (workloadIdentity) {
8499
+ if (apiKey && apiKey !== WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER) {
8500
+ throw new OpenAIError('The `apiKey` and `workloadIdentity` arguments are mutually exclusive; only one can be passed at a time.');
8501
+ }
8502
+ apiKey = WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER;
8503
+ }
8504
+ else if (apiKey === undefined) {
8505
+ throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, or set the `OPENAI_API_KEY` environment variable.');
8383
8506
  }
8384
8507
  const options = {
8385
8508
  apiKey,
8386
8509
  organization,
8387
8510
  project,
8388
8511
  webhookSecret,
8512
+ workloadIdentity,
8389
8513
  ...opts,
8390
8514
  baseURL: baseURL || `https://api.openai.com/v1`,
8391
8515
  };
@@ -8407,6 +8531,9 @@ class OpenAI {
8407
8531
  this.fetch = options.fetch ?? getDefaultFetch();
8408
8532
  __classPrivateFieldSet(this, _OpenAI_encoder, FallbackEncoder);
8409
8533
  this._options = options;
8534
+ if (workloadIdentity) {
8535
+ this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
8536
+ }
8410
8537
  this.apiKey = typeof apiKey === 'string' ? apiKey : 'Missing Key';
8411
8538
  this.organization = organization;
8412
8539
  this.project = project;
@@ -8426,6 +8553,7 @@ class OpenAI {
8426
8553
  fetch: this.fetch,
8427
8554
  fetchOptions: this.fetchOptions,
8428
8555
  apiKey: this.apiKey,
8556
+ workloadIdentity: this._options.workloadIdentity,
8429
8557
  organization: this.organization,
8430
8558
  project: this.project,
8431
8559
  webhookSecret: this.webhookSecret,
@@ -8552,7 +8680,7 @@ class OpenAI {
8552
8680
  throw new APIUserAbortError();
8553
8681
  }
8554
8682
  const controller = new AbortController();
8555
- const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
8683
+ const response = await this.fetchWithAuth(url, req, timeout, controller).catch(castToError);
8556
8684
  const headersTime = Date.now();
8557
8685
  if (response instanceof globalThis.Error) {
8558
8686
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
@@ -8582,6 +8710,9 @@ class OpenAI {
8582
8710
  durationMs: headersTime - startTime,
8583
8711
  message: response.message,
8584
8712
  }));
8713
+ if (response instanceof OAuthError || response instanceof SubjectTokenProviderError) {
8714
+ throw response;
8715
+ }
8585
8716
  if (isTimeout) {
8586
8717
  throw new APIConnectionTimeoutError();
8587
8718
  }
@@ -8593,6 +8724,20 @@ class OpenAI {
8593
8724
  .join('');
8594
8725
  const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
8595
8726
  if (!response.ok) {
8727
+ if (response.status === 401 &&
8728
+ this._workloadIdentityAuth &&
8729
+ !options.__metadata?.['hasStreamingBody'] &&
8730
+ !options.__metadata?.['workloadIdentityTokenRefreshed']) {
8731
+ await CancelReadableStream(response.body);
8732
+ this._workloadIdentityAuth.invalidateToken();
8733
+ return this.makeRequest({
8734
+ ...options,
8735
+ __metadata: {
8736
+ ...options.__metadata,
8737
+ workloadIdentityTokenRefreshed: true,
8738
+ },
8739
+ }, retriesRemaining, retryOfRequestLogID ?? requestLogID);
8740
+ }
8596
8741
  const shouldRetry = await this.shouldRetry(response);
8597
8742
  if (retriesRemaining && shouldRetry) {
8598
8743
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
@@ -8643,6 +8788,18 @@ class OpenAI {
8643
8788
  const request = this.makeRequest(options, null, undefined);
8644
8789
  return new PagePromise(this, request, Page);
8645
8790
  }
8791
+ async fetchWithAuth(url, init, timeout, controller) {
8792
+ if (this._workloadIdentityAuth) {
8793
+ const headers = init.headers;
8794
+ const authHeader = headers.get('Authorization');
8795
+ if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
8796
+ const token = await this._workloadIdentityAuth.getToken();
8797
+ headers.set('Authorization', `Bearer ${token}`);
8798
+ }
8799
+ }
8800
+ const response = await this.fetchWithTimeout(url, init, timeout, controller);
8801
+ return response;
8802
+ }
8646
8803
  async fetchWithTimeout(url, init, ms, controller) {
8647
8804
  const { signal, method, ...options } = init || {};
8648
8805
  const abort = this._makeAbort(controller);
@@ -8739,7 +8896,13 @@ class OpenAI {
8739
8896
  if ('timeout' in options)
8740
8897
  validatePositiveInteger('timeout', options.timeout);
8741
8898
  options.timeout = options.timeout ?? this.timeout;
8742
- const { bodyHeaders, body } = this.buildBody({ options });
8899
+ const { bodyHeaders, body, isStreamingBody } = this.buildBody({ options });
8900
+ if (isStreamingBody) {
8901
+ inputOptions.__metadata = {
8902
+ ...inputOptions.__metadata,
8903
+ hasStreamingBody: true,
8904
+ };
8905
+ }
8743
8906
  const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
8744
8907
  const req = {
8745
8908
  method,
@@ -8786,9 +8949,18 @@ class OpenAI {
8786
8949
  }
8787
8950
  buildBody({ options: { body, headers: rawHeaders } }) {
8788
8951
  if (!body) {
8789
- return { bodyHeaders: undefined, body: undefined };
8952
+ return { bodyHeaders: undefined, body: undefined, isStreamingBody: false };
8790
8953
  }
8791
8954
  const headers = buildHeaders([rawHeaders]);
8955
+ const isReadableStream = typeof globalThis.ReadableStream !== 'undefined' &&
8956
+ body instanceof globalThis.ReadableStream;
8957
+ const isRetryableBody = !isReadableStream &&
8958
+ (typeof body === 'string' ||
8959
+ body instanceof ArrayBuffer ||
8960
+ ArrayBuffer.isView(body) ||
8961
+ (typeof globalThis.Blob !== 'undefined' && body instanceof globalThis.Blob) ||
8962
+ body instanceof URLSearchParams ||
8963
+ body instanceof FormData);
8792
8964
  if (
8793
8965
  // Pass raw type verbatim
8794
8966
  ArrayBuffer.isView(body) ||
@@ -8804,23 +8976,28 @@ class OpenAI {
8804
8976
  // `URLSearchParams` -> `application/x-www-form-urlencoded`
8805
8977
  body instanceof URLSearchParams ||
8806
8978
  // Send chunked stream (each chunk has own `length`)
8807
- (globalThis.ReadableStream && body instanceof globalThis.ReadableStream)) {
8808
- return { bodyHeaders: undefined, body: body };
8979
+ isReadableStream) {
8980
+ return { bodyHeaders: undefined, body: body, isStreamingBody: !isRetryableBody };
8809
8981
  }
8810
8982
  else if (typeof body === 'object' &&
8811
8983
  (Symbol.asyncIterator in body ||
8812
8984
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
8813
- return { bodyHeaders: undefined, body: ReadableStreamFrom(body) };
8985
+ return {
8986
+ bodyHeaders: undefined,
8987
+ body: ReadableStreamFrom(body),
8988
+ isStreamingBody: true,
8989
+ };
8814
8990
  }
8815
8991
  else if (typeof body === 'object' &&
8816
8992
  headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
8817
8993
  return {
8818
8994
  bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
8819
8995
  body: this.stringifyQuery(body),
8996
+ isStreamingBody: false,
8820
8997
  };
8821
8998
  }
8822
8999
  else {
8823
- return __classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers });
9000
+ return { ...__classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers }), isStreamingBody: false };
8824
9001
  }
8825
9002
  }
8826
9003
  }
@@ -13509,6 +13686,9 @@ function requirePermessageDeflate () {
13509
13686
  * acknowledge disabling of client context takeover
13510
13687
  * @param {Number} [options.concurrencyLimit=10] The number of concurrent
13511
13688
  * calls to zlib
13689
+ * @param {Boolean} [options.isServer=false] Create the instance in either
13690
+ * server or client mode
13691
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
13512
13692
  * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
13513
13693
  * use of a custom server window size
13514
13694
  * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
@@ -13519,16 +13699,13 @@ function requirePermessageDeflate () {
13519
13699
  * deflate
13520
13700
  * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
13521
13701
  * inflate
13522
- * @param {Boolean} [isServer=false] Create the instance in either server or
13523
- * client mode
13524
- * @param {Number} [maxPayload=0] The maximum allowed message length
13525
13702
  */
13526
- constructor(options, isServer, maxPayload) {
13527
- this._maxPayload = maxPayload | 0;
13703
+ constructor(options) {
13528
13704
  this._options = options || {};
13529
13705
  this._threshold =
13530
13706
  this._options.threshold !== undefined ? this._options.threshold : 1024;
13531
- this._isServer = !!isServer;
13707
+ this._maxPayload = this._options.maxPayload | 0;
13708
+ this._isServer = !!this._options.isServer;
13532
13709
  this._deflate = null;
13533
13710
  this._inflate = null;
13534
13711
 
@@ -16010,7 +16187,7 @@ function requireWebsocket () {
16010
16187
  const https = require$$1;
16011
16188
  const http = require$$2;
16012
16189
  const net = require$$3$1;
16013
- const tls = require$$4$1;
16190
+ const tls = require$$4;
16014
16191
  const { randomBytes, createHash } = require$$3;
16015
16192
  const { Duplex, Readable } = require$$0$2;
16016
16193
  const { URL } = require$$7;
@@ -16697,7 +16874,7 @@ function requireWebsocket () {
16697
16874
  } else {
16698
16875
  try {
16699
16876
  parsedUrl = new URL(address);
16700
- } catch (e) {
16877
+ } catch {
16701
16878
  throw new SyntaxError(`Invalid URL: ${address}`);
16702
16879
  }
16703
16880
  }
@@ -16759,11 +16936,11 @@ function requireWebsocket () {
16759
16936
  opts.timeout = opts.handshakeTimeout;
16760
16937
 
16761
16938
  if (opts.perMessageDeflate) {
16762
- perMessageDeflate = new PerMessageDeflate(
16763
- opts.perMessageDeflate !== true ? opts.perMessageDeflate : {},
16764
- false,
16765
- opts.maxPayload
16766
- );
16939
+ perMessageDeflate = new PerMessageDeflate({
16940
+ ...opts.perMessageDeflate,
16941
+ isServer: false,
16942
+ maxPayload: opts.maxPayload
16943
+ });
16767
16944
  opts.headers['Sec-WebSocket-Extensions'] = format({
16768
16945
  [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
16769
16946
  });
@@ -17570,13 +17747,14 @@ function requireStream () {
17570
17747
 
17571
17748
  requireStream();
17572
17749
 
17750
+ requireExtension();
17751
+
17752
+ requirePermessageDeflate();
17753
+
17573
17754
  requireReceiver();
17574
17755
 
17575
17756
  requireSender();
17576
17757
 
17577
- var websocketExports = requireWebsocket();
17578
- var WebSocket = /*@__PURE__*/getDefaultExportFromCjs(websocketExports);
17579
-
17580
17758
  var subprotocol;
17581
17759
  var hasRequiredSubprotocol;
17582
17760
 
@@ -17647,6 +17825,11 @@ function requireSubprotocol () {
17647
17825
  return subprotocol;
17648
17826
  }
17649
17827
 
17828
+ requireSubprotocol();
17829
+
17830
+ var websocketExports = requireWebsocket();
17831
+ var WebSocket = /*@__PURE__*/getDefaultExportFromCjs(websocketExports);
17832
+
17650
17833
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */
17651
17834
 
17652
17835
  var websocketServer;
@@ -17947,11 +18130,11 @@ function requireWebsocketServer () {
17947
18130
  this.options.perMessageDeflate &&
17948
18131
  secWebSocketExtensions !== undefined
17949
18132
  ) {
17950
- const perMessageDeflate = new PerMessageDeflate(
17951
- this.options.perMessageDeflate,
17952
- true,
17953
- this.options.maxPayload
17954
- );
18133
+ const perMessageDeflate = new PerMessageDeflate({
18134
+ ...this.options.perMessageDeflate,
18135
+ isServer: true,
18136
+ maxPayload: this.options.maxPayload
18137
+ });
17955
18138
 
17956
18139
  try {
17957
18140
  const offers = extension.parse(secWebSocketExtensions);
@@ -18215,10 +18398,6 @@ var config = {};
18215
18398
 
18216
18399
  var main = {exports: {}};
18217
18400
 
18218
- var version = "17.3.1";
18219
- var require$$4 = {
18220
- version: version};
18221
-
18222
18401
  var hasRequiredMain;
18223
18402
 
18224
18403
  function requireMain () {
@@ -18228,25 +18407,17 @@ function requireMain () {
18228
18407
  const path = require$$1$1;
18229
18408
  const os = require$$2$1;
18230
18409
  const crypto = require$$3;
18231
- const packageJson = require$$4;
18232
-
18233
- const version = packageJson.version;
18234
18410
 
18235
18411
  // Array of tips to display randomly
18236
18412
  const TIPS = [
18237
- '🔐 encrypt with Dotenvx: https://dotenvx.com',
18238
- '🔐 prevent committing .env to code: https://dotenvx.com/precommit',
18239
- '🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
18240
- '🤖 agentic secret storage: https://dotenvx.com/as2',
18241
- '⚡️ secrets for agents: https://dotenvx.com/as2',
18242
- '🛡️ auth for agents: https://vestauth.com',
18243
- '🛠️ run anywhere with `dotenvx run -- yourcommand`',
18244
- '⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
18245
- '⚙️ enable debug logging with { debug: true }',
18246
- '⚙️ override existing env vars with { override: true }',
18247
- '⚙️ suppress all logs with { quiet: true }',
18248
- '⚙️ write to custom object with { processEnv: myObject }',
18249
- '⚙️ load multiple .env files with { path: [\'.env.local\', \'.env\'] }'
18413
+ ' encrypted .env [www.dotenvx.com]',
18414
+ ' secrets for agents [www.dotenvx.com]',
18415
+ ' auth for agents [www.vestauth.com]',
18416
+ ' custom filepath { path: \'/custom/path/.env\' }',
18417
+ ' enable debugging { debug: true }',
18418
+ ' override existing { override: true }',
18419
+ ' suppress logs { quiet: true }',
18420
+ ' multiple files { path: [\'.env.local\', \'.env\'] }'
18250
18421
  ];
18251
18422
 
18252
18423
  // Get a random tip from the tips array
@@ -18354,15 +18525,15 @@ function requireMain () {
18354
18525
  }
18355
18526
 
18356
18527
  function _warn (message) {
18357
- console.error(`[dotenv@${version}][WARN] ${message}`);
18528
+ console.error(`⚠ ${message}`);
18358
18529
  }
18359
18530
 
18360
18531
  function _debug (message) {
18361
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
18532
+ console.log(`┆ ${message}`);
18362
18533
  }
18363
18534
 
18364
18535
  function _log (message) {
18365
- console.log(`[dotenv@${version}] ${message}`);
18536
+ console.log(`◇ ${message}`);
18366
18537
  }
18367
18538
 
18368
18539
  function _dotenvKey (options) {
@@ -18456,7 +18627,7 @@ function requireMain () {
18456
18627
  const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet));
18457
18628
 
18458
18629
  if (debug || !quiet) {
18459
- _log('Loading env from encrypted .env.vault');
18630
+ _log('loading env from encrypted .env.vault');
18460
18631
  }
18461
18632
 
18462
18633
  const parsed = DotenvModule._parseVault(options);
@@ -18485,7 +18656,7 @@ function requireMain () {
18485
18656
  encoding = options.encoding;
18486
18657
  } else {
18487
18658
  if (debug) {
18488
- _debug('No encoding is specified. UTF-8 is used by default');
18659
+ _debug('no encoding is specified (UTF-8 is used by default)');
18489
18660
  }
18490
18661
  }
18491
18662
 
@@ -18513,7 +18684,7 @@ function requireMain () {
18513
18684
  DotenvModule.populate(parsedAll, parsed, options);
18514
18685
  } catch (e) {
18515
18686
  if (debug) {
18516
- _debug(`Failed to load ${path} ${e.message}`);
18687
+ _debug(`failed to load ${path} ${e.message}`);
18517
18688
  }
18518
18689
  lastError = e;
18519
18690
  }
@@ -18534,13 +18705,13 @@ function requireMain () {
18534
18705
  shortPaths.push(relative);
18535
18706
  } catch (e) {
18536
18707
  if (debug) {
18537
- _debug(`Failed to load ${filePath} ${e.message}`);
18708
+ _debug(`failed to load ${filePath} ${e.message}`);
18538
18709
  }
18539
18710
  lastError = e;
18540
18711
  }
18541
18712
  }
18542
18713
 
18543
- _log(`injecting env (${keysCount}) from ${shortPaths.join(',')} ${dim(`-- tip: ${_getRandomTip()}`)}`);
18714
+ _log(`injected env (${keysCount}) from ${shortPaths.join(',')} ${dim(`// tip: ${_getRandomTip()}`)}`);
18544
18715
  }
18545
18716
 
18546
18717
  if (lastError) {
@@ -18561,7 +18732,7 @@ function requireMain () {
18561
18732
 
18562
18733
  // dotenvKey exists but .env.vault file does not exist
18563
18734
  if (!vaultPath) {
18564
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
18735
+ _warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`);
18565
18736
 
18566
18737
  return DotenvModule.configDotenv(options)
18567
18738
  }
@@ -19091,7 +19262,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
19091
19262
  pageCount++;
19092
19263
  const requestParams = {
19093
19264
  ...params,
19094
- adjustment: DEFAULT_ADJUSTMENT,
19265
+ adjustment: params.adjustment ?? DEFAULT_ADJUSTMENT,
19095
19266
  feed: DEFAULT_FEED,
19096
19267
  ...(pageToken && { page_token: pageToken }),
19097
19268
  };